diff --git a/CHANGELOG.md b/CHANGELOG.md
--- a/CHANGELOG.md
+++ b/CHANGELOG.md
@@ -1,5 +1,54 @@
 # Changelog
 
+See [MIGRATION.md](https://github.com/Tritlo/duckdb-haskell/blob/main/MIGRATION.md)
+for the upgrade instructions.
+
+## 2.0.0.0
+
+- Target DuckDB 2.0. The retained API supports DuckDB 2.0.x releases. Use the
+  earlier package release with DuckDB 1.5.
+- Generate the bindings from the DuckDB 2.0.0 client headers with hs-bindgen
+  1.0. `Database.DuckDB.FFI` contains all 548 functions of the retained API.
+  Remove `Database.DuckDB.FFI.Deprecated`. Its functions are in
+  `Database.DuckDB.FFI`. See MIGRATION.md for the changed types and names.
+- Add `Database.DuckDB.FFI.V2` with the 620 functions of the new C API.
+  Upstream marks this API as unstable, so it requires exactly DuckDB 2.0.0.
+- DuckDB 2.0.0 plans casts between some pairs of types as casts that cannot
+  fail. This includes registered casts, for example from INTEGER to VARCHAR. If
+  a registered cast reports an error for such a pair with an Invalid Input, Out
+  of Range, or Conversion code, or with a code that DuckDB does not map, for
+  example `DUCKDB_V2_ERROR_API`, DuckDB gives an INTERNAL error. During query
+  execution, that error invalidates the database. A V1 cast cannot
+  choose the code of its error. A V2 cast can report
+  `DUCKDB_V2_ERROR_TYPE_MISMATCH`. The other codes that keep their type and the
+  database, and that abort an explicit transaction under each transaction
+  invalidation policy, are the codes with the prefix `DUCKDB_V2_ERROR_` and
+  these names: IO_GENERAL, IO_HTTP, INPUT_OBJECT_SIZE, RESOURCE_OUT_OF_MEMORY,
+  RESOURCE_DEPENDENCY, RESOURCE_MISSING_EXTENSION, RESOURCE_AUTOLOAD,
+  TYPE_UNKNOWN, TYPE_INVALID, TYPE_DECIMAL, TYPE_DIVIDE_BY_ZERO, QUERY_SYNTAX,
+  QUERY_PLANNER, QUERY_OPTIMIZER, QUERY_EXPRESSION, QUERY_EXECUTOR,
+  QUERY_SCHEDULER, QUERY_NOT_IMPLEMENTED, QUERY_PARAMETER_NOT_RESOLVED,
+  DATABASE_CONSTRAINT, DATABASE_INDEX, DATABASE_SEQUENCE, DATABASE_STATISTICS,
+  DATABASE_SERIALIZATION, DATABASE_TRANSACTION, CONFIGURATION_SETTINGS,
+  CONFIGURATION_INVALID, RUNTIME_INTERRUPT, and RUNTIME_NULL_POINTER.
+- Add nanosecond timezone timestamps and the data-corruption and
+  resource-in-use error tags.
+- Remove the Arrow callback constructors, wrappers, and release helpers. Use
+  `toFunPtr` and `fromFunPtr` from hs-bindgen-runtime.
+- Deprecated native functions no longer have `DEPRECATED` pragmas.
+- Download the DuckDB 2.0.0 shared-library archives on glibc Linux and macOS.
+  Keep their symlinks and versioned library files.
+- Install both client headers, `duckdb_arrow.h`, and the DuckDB license with
+  the library.
+- Reject platforms other than Linux and macOS on x86_64 and aarch64 at compile
+  time.
+- Add an opt-in `extension` mode for loadable V2 extensions on Linux and macOS.
+  It uses the host's function table and does not link another DuckDB library.
+  This mode exposes only the V2 module. The C entry point of an extension calls
+  `duckdb_haskell_extension_load`, which negotiates the function table and
+  starts the threaded GHC runtime.
+- Install `duckdb_extension_v2.h` and `duckdb_haskell_extension.h`.
+
 ## 1.5.6.0
 
 - Use the official DuckDB 1.5.6 header and native download. Keep native support
diff --git a/Setup.hs b/Setup.hs
--- a/Setup.hs
+++ b/Setup.hs
@@ -3,22 +3,25 @@
 
 import Control.Exception (IOException, catch, throwIO)
 import Control.Monad (filterM, unless, when)
-import Data.List (intercalate, isPrefixOf, nub, stripPrefix)
+import Data.List (intercalate, isPrefixOf, isSuffixOf, nub, stripPrefix)
 import Data.Maybe (isJust, isNothing)
 import Distribution.PackageDescription
 import Distribution.Simple
 import Distribution.Simple.Setup (ConfigFlags, configConfigurationsFlags, configConfigureArgs, configExtraLibDirs)
+
 #if MIN_VERSION_Cabal(3,14,0)
 import Distribution.Utils.Path (getSymbolicPath, makeSymbolicPath)
+
 #endif
 import System.Directory
 import System.Environment (lookupEnv)
 import System.FilePath (isAbsolute, (</>))
 import System.IO.Temp (withTempDirectory)
 import System.Info (arch, os)
-import System.Process (callProcess, readProcess)
+import System.Process (CreateProcess (..), callProcess, proc, readCreateProcess)
 
 #if !MIN_VERSION_Cabal(3,14,0)
+
 -- | Cabal versions before 3.14 use plain file paths.
 makeSymbolicPath :: FilePath -> FilePath
 makeSymbolicPath = id
@@ -26,109 +29,125 @@
 -- | Read a plain file path with Cabal versions before 3.14.
 getSymbolicPath :: FilePath -> FilePath
 getSymbolicPath = id
+
 #endif
 
--- | Save the native library directory in the package description.
+-- | Set native library paths when Cabal configures the package.
 main :: IO ()
 main = defaultMainWithHooks simpleUserHooks{confHook = configure}
   where
     configure (description, hooks) flags = do
-        nativeDirs <- nativeLibraryDirs flags
-        let addLibrary lib =
-                let info = libBuildInfo lib
-                 in lib
-                        { libBuildInfo =
-                            info
-                                { ldOptions =
-                                    (if os `elem` ["linux", "darwin"] then concatMap (\dir -> ["-Xlinker", "-rpath", "-Xlinker", dir]) nativeDirs else [])
-                                        <> ldOptions info
-                                }
+      nativeDirs <- nativeLibraryDirs flags
+      let addLibrary lib =
+            let info = libBuildInfo lib
+            in  lib
+                  { libBuildInfo =
+                      info
+                        { ldOptions =
+                            (if os `elem` ["linux", "darwin"] then concatMap (\dir -> ["-Xlinker", "-rpath", "-Xlinker", dir]) nativeDirs else [])
+                              <> ldOptions info
                         }
-            updated = description{condLibrary = fmap (fmap addLibrary) (condLibrary description)}
-            updatedFlags =
-                if null nativeDirs
-                    then flags
-                    else flags{configExtraLibDirs = map makeSymbolicPath nativeDirs}
-        confHook simpleUserHooks (updated, hooks) updatedFlags
+                  }
+          updated = description{condLibrary = fmap (\tree -> tree{condTreeData = addLibrary (condTreeData tree)}) (condLibrary description)}
+          updatedFlags =
+            if null nativeDirs
+              then flags
+              else flags{configExtraLibDirs = map makeSymbolicPath nativeDirs}
+      confHook simpleUserHooks (updated, hooks) updatedFlags
 
 -- | Use a supplied library, or download one to the user cache.
 nativeLibraryDirs :: ConfigFlags -> IO [FilePath]
 nativeLibraryDirs flags = do
-    nixBuild <- lookupEnv "NIX_BUILD_TOP"
-    nixShell <- lookupEnv "IN_NIX_SHELL"
-    let supplied = map getSymbolicPath (configExtraLibDirs flags)
-        system = lookupFlagAssignment (mkFlagName "systemlib") (configConfigurationsFlags flags) == Just True
-    if isJust nixBuild || isJust nixShell
-        then pure []
-        else
-            if system || not (null supplied)
-                then do
-                    unless (all isAbsolute supplied) $
-                        fail "Use absolute paths in --extra-lib-dirs so Cabal can track the library location."
-                    pure (nub supplied)
-                else (: []) <$> installNativeLibrary flags
+  nixBuild <- lookupEnv "NIX_BUILD_TOP"
+  nixShell <- lookupEnv "IN_NIX_SHELL"
+  let supplied = map getSymbolicPath (configExtraLibDirs flags)
+      system = lookupFlagAssignment (mkFlagName "systemlib") (configConfigurationsFlags flags) == Just True
+      extension = lookupFlagAssignment (mkFlagName "extension") (configConfigurationsFlags flags) == Just True
+  if extension || isJust nixBuild || isJust nixShell
+    then pure []
+    else
+      if system || not (null supplied)
+        then do
+          unless (all isAbsolute supplied) $
+            fail "Use absolute paths in --extra-lib-dirs so Cabal can track the library location."
+          pure (nub supplied)
+        else (: []) <$> installNativeLibrary flags
 
-{- | Pin the download to the release verified by the checksums below.
-The Haskell package version can differ from the native library version.
--}
-nativeVersion :: String
-nativeVersion = "1.5.6"
+-- | Name the release platform and the shared library for this system.
+nativePlatform :: IO (String, FilePath)
+nativePlatform = case (os, arch) of
+  ("linux", "x86_64") -> pure ("linux-amd64", "libduckdb.so")
+  ("linux", "aarch64") -> pure ("linux-arm64", "libduckdb.so")
+  ("darwin", cpu) | cpu `elem` ["x86_64", "aarch64"] -> pure ("osx-universal", "libduckdb.dylib")
+  _ -> fail "duckdb-ffi supports glibc Linux and macOS on x86_64 and aarch64."
 
--- | Select an official archive and its release checksum.
-nativeArchive :: IO (String, String, FilePath)
-nativeArchive = case (os, arch) of
-    ("linux", "x86_64") -> pure ("linux-amd64", "b845005f5132a7d8180057c35e14a7626632258782f871a90861b19c1c03841b", "libduckdb.so")
-    ("linux", "aarch64") -> pure ("linux-arm64", "b72ed9f05003f5e9d2015f7ceada6416b377d9dd33169cdde3c9e33897856eee", "libduckdb.so")
-    ("darwin", "x86_64") -> mac
-    ("darwin", "aarch64") -> mac
-    _ -> fail "Automatic DuckDB installation supports glibc Linux and macOS. Supply DuckDB >= 1.5.3 and < 1.6 with -fsystemlib and --extra-lib-dirs."
-  where
-    mac = pure ("osx-universal", "e0bc007d9b0094c0970ac1847a8601d10aad07cbd2910ce586ec810f77b638d6", "libduckdb.dylib")
+-- | Read the release path and checksum for one platform from @native.sha256@.
+-- Each line has a checksum and a release path, for example
+-- @v2.0.0/duckdb-shared-libs-linux-amd64.tar.gz@.
+nativeArchive :: String -> IO (FilePath, String)
+nativeArchive platform = do
+  pinned <- doesFileExist "native.sha256"
+  unless pinned $ fail "native.sha256 is missing. The package must list it in extra-source-files."
+  pins <- readFile "native.sha256"
+  case [(path, checksum) | [checksum, path] <- map words (lines pins), ("/duckdb-shared-libs-" <> platform <> ".tar.gz") `isSuffixOf` path] of
+    [archive] -> pure archive
+    _ -> fail ("native.sha256 must contain one archive for " <> platform <> ".")
 
 -- | Download into a temporary directory. Publish the verified library atomically.
 installNativeLibrary :: ConfigFlags -> IO FilePath
 installNativeLibrary flags = do
-    base <- case filter (isPrefixOf "--duckdb-install-dir") (configConfigureArgs flags) of
-        [] -> getXdgDirectory XdgCache "duckdb-haskell" >>= makeAbsolute
-        [option]
-            | Just directory <- stripPrefix "--duckdb-install-dir=" option
-            , isAbsolute directory ->
-                pure directory
-        _ -> fail "Pass --configure-option=--duckdb-install-dir=/absolute/path once, with an absolute directory."
-    (platform, checksum, libraryName) <- nativeArchive
-    let root = base </> nativeVersion
-        destination = root </> platform
-        complete dir = do
-            libraryExists <- doesFileExist (dir </> libraryName)
-            markerExists <- doesFileExist (dir </> "SHA256")
-            marker <- if markerExists then readFile (dir </> "SHA256") else pure ""
-            pure (libraryExists && marker == checksum <> "\n")
-    -- Check existence first to accept a library installed by another build.
-    exists <- doesPathExist destination
-    ready <- complete destination
-    unless ready $ do
-        when exists $ fail ("Incomplete DuckDB installation: remove " <> destination <> " and retry.")
-        let programs = ["curl", "unzip", if os == "darwin" then "shasum" else "sha256sum"]
-        missing <- filterM (\program -> isNothing <$> findExecutable program) programs
-        unless (null missing) $
-            fail ("DuckDB installation requires these programs on PATH: " <> intercalate ", " missing <> ". Install them, or supply DuckDB with -fsystemlib and --extra-lib-dirs. See README.md for details.")
-        createDirectoryIfMissing True root
-        withTempDirectory root ".download-" $ \staging -> do
-            let archive = staging </> "duckdb.zip"
-                extracted = staging </> "library"
-                url = "https://github.com/duckdb/duckdb/releases/download/v" <> nativeVersion <> "/libduckdb-" <> platform <> ".zip"
-            putStrLn ("Downloading DuckDB " <> nativeVersion <> " to " <> destination)
-            callProcess "curl" ["--fail", "--location", "--proto", "=https", "--proto-redir", "=https", "--tlsv1.2", "--retry", "2", "--output", archive, url]
-            digest <-
-                if os == "darwin"
-                    then readProcess "shasum" ["-a", "256", archive] ""
-                    else readProcess "sha256sum" [archive] ""
-            unless (takeWhile (/= ' ') digest == checksum) $ fail "DuckDB archive checksum mismatch."
-            createDirectory extracted
-            callProcess "unzip" ["-q", archive, libraryName, "-d", extracted]
-            writeFile (extracted </> "SHA256") (checksum <> "\n")
-            -- Another build can publish the same verified archive first.
-            renameDirectory extracted destination `catch` \(err :: IOException) -> do
-                installed <- complete destination
-                unless installed (throwIO err)
-    pure destination
+  base <- case filter (isPrefixOf "--duckdb-install-dir") (configConfigureArgs flags) of
+    [] -> getXdgDirectory XdgCache "duckdb-haskell" >>= makeAbsolute
+    [option]
+      | Just directory <- stripPrefix "--duckdb-install-dir=" option
+      , isAbsolute directory ->
+          pure directory
+    _ -> fail "Pass --configure-option=--duckdb-install-dir=/absolute/path once, with an absolute directory."
+  (platform, libraryName) <- nativePlatform
+  (release, checksum) <- nativeArchive platform
+  let version = drop 1 (takeWhile (/= '/') release)
+      root = base </> version
+      destination = root </> platform
+      complete dir = do
+        libraryExists <- doesFileExist (dir </> libraryName)
+        markerExists <- doesFileExist (dir </> "SHA256")
+        marker <- if markerExists then readFile (dir </> "SHA256") else pure ""
+        pure (libraryExists && marker == checksum <> "\n")
+  -- Check existence first to accept a library installed by another build.
+  exists <- doesPathExist destination
+  ready <- complete destination
+  unless ready $ do
+    when exists $ fail ("Incomplete DuckDB installation: remove " <> destination <> " and retry.")
+    let programs = ["curl", "tar", if os == "darwin" then "shasum" else "sha256sum"]
+    missing <- filterM (\program -> isNothing <$> findExecutable program) programs
+    unless (null missing) $
+      fail
+        ( "DuckDB installation requires these programs on PATH: "
+            <> intercalate ", " missing
+            <> ". Install them, or supply DuckDB with -fsystemlib and --extra-lib-dirs=/absolute/path/to/duckdb."
+        )
+    createDirectoryIfMissing True root
+    withTempDirectory root ".download-" $ \staging -> do
+      let archiveName = "duckdb.tar.gz"
+          archive = staging </> archiveName
+          extracted = staging </> "library"
+          url = "https://github.com/duckdb/duckdb/releases/download/" <> release
+          hash = if os == "darwin" then proc "shasum" ["-a", "256", archiveName] else proc "sha256sum" [archiveName]
+      putStrLn ("Downloading DuckDB " <> version <> " to " <> destination)
+      callProcess
+        "curl"
+        ["--fail", "--location", "--proto", "=https", "--proto-redir", "=https", "--tlsv1.2", "--retry", "2", "--output", archive, url]
+      -- Hash a plain relative name. Hash tools escape other names in their output.
+      digest <- readCreateProcess hash{cwd = Just staging} ""
+      unless (takeWhile (/= ' ') digest == checksum) $ fail "DuckDB archive checksum mismatch."
+      createDirectory extracted
+      -- Keep the shared-library symlinks and their versioned targets together.
+      callProcess "tar" ["-xzf", archive, "-C", extracted]
+      libraryPresent <- doesFileExist (extracted </> libraryName)
+      unless libraryPresent $ fail "DuckDB archive does not contain the expected shared library and its symlink targets."
+      writeFile (extracted </> "SHA256") (checksum <> "\n")
+      -- Another build can publish the same verified archive first.
+      renameDirectory extracted destination `catch` \(err :: IOException) -> do
+        installed <- complete destination
+        unless installed (throwIO err)
+  pure destination
diff --git a/cbits/duckdb-LICENSE b/cbits/duckdb-LICENSE
new file mode 100644
--- /dev/null
+++ b/cbits/duckdb-LICENSE
@@ -0,0 +1,7 @@
+Copyright 2018-2026 Stichting DuckDB Foundation
+
+Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
+
+The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
+
+THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
diff --git a/cbits/duckdb.h b/cbits/duckdb.h
--- a/cbits/duckdb.h
+++ b/cbits/duckdb.h
@@ -282,6 +282,9 @@
 
 	//! VARIANT type
 	DUCKDB_TYPE_VARIANT = 41,
+
+	//! duckdb_timestamp (nanoseconds)
+	DUCKDB_TYPE_TIMESTAMP_TZ_NS = 42,
 } DUCKDB_TYPE;
 
 /*!
@@ -399,7 +402,9 @@
 	DUCKDB_ERROR_MISSING_EXTENSION = 39,
 	DUCKDB_ERROR_AUTOLOAD = 40,
 	DUCKDB_ERROR_SEQUENCE = 41,
+	DUCKDB_ERROR_DATA_CORRUPTION = 43,
 	DUCKDB_INVALID_CONFIGURATION = 42,
+	DUCKDB_ERROR_RESOURCE_IN_USE = 44,
 } duckdb_error_type;
 
 /*!
@@ -2240,10 +2245,10 @@
 
 #if DUCKDB_API_VERSION_AT_LEAST(0, 2, 5)
 /*!
- * Flush the appender to the table, forcing the cache of the appender to be cleared. If flushing the data triggers a
- * constraint violation or any other error, then all data is invalidated, and this function returns DuckDBError. It is
- * not possible to append more values. Call duckdb_appender_error_data to obtain the error data followed by
- * duckdb_appender_destroy to destroy the invalidated appender.
+ * Flush the appender to the table, forcing the cache of the appender to be cleared. Requires a connection with no open
+ * result. If flushing the data triggers a constraint violation or any other error, then all data is invalidated, and
+ * this function returns DuckDBError. It is not possible to append more values. Call duckdb_appender_error_data to
+ * obtain the error data followed by duckdb_appender_destroy to destroy the invalidated appender.
  *
  * history:
  * - stable: v0.2.5
@@ -5624,6 +5629,14 @@
 /*!
  * Closes the pending result and de-allocates all memory allocated for the result.
  *
+ * Destroying a pending result whose statement has not completed aborts the statement. On autocommit, its writes are
+ * rolled back. Inside a transaction, a statement that may write invalidates the transaction, and a read-only statement
+ * just stops. Until the statement has completed, preparing or running another statement on the connection fails with
+ * `DUCKDB_ERROR_RESOURCE_IN_USE` and leaves it untouched. `duckdb_pending_execution_is_finished` reporting true does
+ * not mean that the statement completed. To make sure a statement takes effect, complete it before destroying the
+ * pending result: call `duckdb_execute_pending`, and fetch a streaming result until `duckdb_fetch_chunk` returns NULL.
+ * A NULL chunk is also returned on an error, so check `duckdb_result_error` afterwards.
+ *
  * history:
  * - stable: v0.5.0
  *
@@ -6498,6 +6511,13 @@
 /*!
  * Closes the result and de-allocates all memory allocated for that result.
  *
+ * Destroying a streaming result whose statement has not completed aborts the statement. On autocommit, its writes are
+ * rolled back. Inside a transaction, a statement that may write invalidates the transaction, and a read-only statement
+ * just stops. Until the statement has completed, preparing or running another statement on the connection fails with
+ * `DUCKDB_ERROR_RESOURCE_IN_USE` and leaves it untouched. To make sure the statement takes effect, complete it by
+ * fetching until `duckdb_fetch_chunk` returns NULL before destroying the result. A NULL chunk is also returned on an
+ * error, so check `duckdb_result_error` afterwards.
+ *
  * history:
  * - stable: v0.1.0
  *
@@ -8762,6 +8782,20 @@
 DUCKDB_C_API duckdb_value duckdb_create_timestamp_tz(duckdb_timestamp input);
 #endif
 
+#if DUCKDB_API_VERSION_AT_LEAST(1, 5, 6)
+/*!
+ * Creates a TIMESTAMP_TZ_NS value from a duckdb_timestamp_ns
+ *
+ * history:
+ * - unstable: v1.5.4
+ * - stable: v1.5.6
+ *
+ * @param input The duckdb_timestamp_ns value
+ * @return duckdb_value
+ */
+DUCKDB_C_API duckdb_value duckdb_create_timestamp_tz_ns(duckdb_timestamp_ns input);
+#endif
+
 #if DUCKDB_API_VERSION_AT_LEAST(1, 2, 0)
 /*!
  * Creates a TIMESTAMP_S value from a duckdb_timestamp_s
@@ -9126,6 +9160,20 @@
  * @return duckdb_timestamp
  */
 DUCKDB_C_API duckdb_timestamp duckdb_get_timestamp_tz(duckdb_value val);
+#endif
+
+#if DUCKDB_API_VERSION_AT_LEAST(1, 5, 6)
+/*!
+ * Returns the TIMESTAMP_TZ_NS value of the given value.
+ *
+ * history:
+ * - unstable: v1.5.4
+ * - stable: v1.5.6
+ *
+ * @param val A duckdb_value containing a TIMESTAMP_TZ_NS
+ * @return duckdb_timestamp_ns
+ */
+DUCKDB_C_API duckdb_timestamp_ns duckdb_get_timestamp_tz_ns(duckdb_value val);
 #endif
 
 #if DUCKDB_API_VERSION_AT_LEAST(1, 2, 0)
diff --git a/cbits/duckdb_arrow.h b/cbits/duckdb_arrow.h
--- a/cbits/duckdb_arrow.h
+++ b/cbits/duckdb_arrow.h
@@ -4,6 +4,9 @@
 #include <stdint.h>
 
 // Arrow C Data Interface structures used by the deprecated DuckDB API.
+#ifndef ARROW_C_DATA_INTERFACE
+#define ARROW_C_DATA_INTERFACE
+
 struct ArrowSchema {
   const char *format;
   const char *name;
@@ -28,7 +31,11 @@
   void (*release)(struct ArrowArray *);
   void *private_data;
 };
+#endif
 
+#ifndef ARROW_C_STREAM_INTERFACE
+#define ARROW_C_STREAM_INTERFACE
+
 struct ArrowArrayStream {
   int (*get_schema)(struct ArrowArrayStream *, struct ArrowSchema *);
   int (*get_next)(struct ArrowArrayStream *, struct ArrowArray *);
@@ -36,5 +43,6 @@
   void (*release)(struct ArrowArrayStream *);
   void *private_data;
 };
+#endif
 
 #endif
diff --git a/cbits/duckdb_extension_v2.h b/cbits/duckdb_extension_v2.h
new file mode 100644
--- /dev/null
+++ b/cbits/duckdb_extension_v2.h
@@ -0,0 +1,3510 @@
+//===----------------------------------------------------------------------===//
+//
+//                         DuckDB
+//
+// duckdb_extension_v2.h
+//
+//
+//===----------------------------------------------------------------------===//
+//
+// !!!!!!!
+// WARNING: this file is autogenerated, manual changes will be overwritten
+// !!!!!!!
+
+// WARNING: this API is not yet stable, meaning it is only guaranteed to work for this specific DuckDB version.
+
+#pragma once
+
+// An extension targets either the V1 or the V2 C API, never both.
+#ifdef DUCKDB_EXTENSION_HEADER_VERSION
+#error "duckdb_extension.h and duckdb_extension_v2.h cannot both be included: pick one C API version"
+#endif
+#define DUCKDB_EXTENSION_HEADER_VERSION 2
+
+#include "duckdb_v2.h"
+
+//===--------------------------------------------------------------------===//
+// Util Macros
+//===--------------------------------------------------------------------===//
+
+#ifdef __cplusplus
+#define DUCKDB_EXTENSION_EXTERN_C_GUARD_OPEN  extern "C" {
+#define DUCKDB_EXTENSION_EXTERN_C_GUARD_CLOSE }
+#else
+#define DUCKDB_EXTENSION_EXTERN_C_GUARD_OPEN
+#define DUCKDB_EXTENSION_EXTERN_C_GUARD_CLOSE
+#endif
+
+#define DUCKDB_EXTENSION_GLUE_HELPER(x, y) x##y
+#define DUCKDB_EXTENSION_GLUE(x, y)        DUCKDB_EXTENSION_GLUE_HELPER(x, y)
+#define DUCKDB_EXTENSION_STR_HELPER(x)     #x
+#define DUCKDB_EXTENSION_STR(x)            DUCKDB_EXTENSION_STR_HELPER(x)
+#define DUCKDB_EXTENSION_SEMVER_STRING(major, minor, patch)                                                            \
+	"v" DUCKDB_EXTENSION_STR_HELPER(major) "." DUCKDB_EXTENSION_STR_HELPER(minor) "." DUCKDB_EXTENSION_STR_HELPER(patch)
+
+//===--------------------------------------------------------------------===//
+// Versioning
+//===--------------------------------------------------------------------===//
+//! Set version to latest if no explicit version is defined
+
+#if !defined(DUCKDB_EXTENSION_API_VERSION_MAJOR) && !defined(DUCKDB_EXTENSION_API_VERSION_MINOR) &&                    \
+    !defined(DUCKDB_EXTENSION_API_VERSION_PATCH)
+#define DUCKDB_EXTENSION_API_VERSION_MAJOR 2
+#define DUCKDB_EXTENSION_API_VERSION_MINOR 0
+#define DUCKDB_EXTENSION_API_VERSION_PATCH 0
+#elif !(defined(DUCKDB_EXTENSION_API_VERSION_MAJOR) && defined(DUCKDB_EXTENSION_API_VERSION_MINOR) &&                  \
+        defined(DUCKDB_EXTENSION_API_VERSION_PATCH))
+#error "either all or none of the  DUCKDB_EXTENSION_API_VERSION_ defines should be defined"
+#endif
+
+//! The version string passed to DuckDB on extension load. The major selects the V2 API family; for extensions pinned
+//! to an exact DuckDB version (C_STRUCT_UNSTABLE) the loader reads only the major and ignores the rest.
+#define DUCKDB_EXTENSION_API_VERSION_STRING                                                                            \
+	DUCKDB_EXTENSION_SEMVER_STRING(DUCKDB_EXTENSION_API_VERSION_MAJOR, DUCKDB_EXTENSION_API_VERSION_MINOR,             \
+	                               DUCKDB_EXTENSION_API_VERSION_PATCH)
+
+#if DUCKDB_EXTENSION_API_VERSION_MAJOR != 2
+#error "This version of the extension API header only supports API VERSION v2.x.x"
+#endif
+
+// No V2 function has been stabilized yet, so without the unstable surface the function pointer struct would be empty.
+#if !DUCKDB_V2_API_ALLOW_UNSTABLE
+#error                                                                                                                 \
+    "the V2 C API has no stable surface yet: build with build_loadable_extension_capi_unstable or build_static_extension_capi_unstable, which tie the extension to this DuckDB version"
+#endif
+
+//===--------------------------------------------------------------------===//
+// Function pointer struct
+//===--------------------------------------------------------------------===//
+typedef struct {
+	// capigen:begin appended
+#if DUCKDB_V2_API_ALLOW_UNSTABLE
+	DUCKDB_V2_ERROR(*duckdb_v2_arena_allocate)
+	(duckdb_v2_arena_handle arena, idx_t byte_len, uint8_t **out_ptr, duckdb_v2_error_info_handle *err);
+	DUCKDB_V2_ERROR(*duckdb_v2_bignum_decode)
+	(const uint8_t *in_data, idx_t in_length, uint8_t *out_data, idx_t out_capacity, idx_t *out_length,
+	 bool *out_is_negative, duckdb_v2_error_info_handle *err);
+	DUCKDB_V2_ERROR(*duckdb_v2_bignum_encode)
+	(const uint8_t *in_data, idx_t in_length, bool is_negative, uint8_t *out_data, idx_t out_capacity,
+	 idx_t *out_length, duckdb_v2_error_info_handle *err);
+	DUCKDB_V2_ERROR(*duckdb_v2_column_data_collection_append)
+	(duckdb_v2_column_data_collection_handle collection, duckdb_v2_column_data_collection_append_state_handle state,
+	 duckdb_v2_data_chunk_handle chunk, duckdb_v2_error_info_handle *err);
+	DUCKDB_V2_ERROR(*duckdb_v2_column_data_collection_append_state_create)
+	(duckdb_v2_column_data_collection_handle collection,
+	 duckdb_v2_column_data_collection_append_state_handle *out_state, duckdb_v2_error_info_handle *err);
+	DUCKDB_V2_ERROR(*duckdb_v2_column_data_collection_append_state_destroy)
+	(duckdb_v2_column_data_collection_append_state_handle *state);
+	DUCKDB_V2_ERROR(*duckdb_v2_column_data_collection_combine)
+	(duckdb_v2_column_data_collection_handle target, duckdb_v2_column_data_collection_handle *source,
+	 duckdb_v2_error_info_handle *err);
+	DUCKDB_V2_ERROR(*duckdb_v2_column_data_collection_create)
+	(duckdb_v2_factory_handle factory, const duckdb_v2_logical_type_handle *types_array, idx_t types_count,
+	 duckdb_v2_column_data_collection_handle *out_collection, duckdb_v2_error_info_handle *err);
+	DUCKDB_V2_ERROR (*duckdb_v2_column_data_collection_destroy)(duckdb_v2_column_data_collection_handle *collection);
+	DUCKDB_V2_ERROR(*duckdb_v2_column_data_collection_reset)
+	(duckdb_v2_column_data_collection_handle collection, duckdb_v2_error_info_handle *err);
+	DUCKDB_V2_ERROR(*duckdb_v2_column_data_collection_row_count)
+	(duckdb_v2_column_data_collection_handle collection, idx_t *out_row_count, duckdb_v2_error_info_handle *err);
+	DUCKDB_V2_ERROR(*duckdb_v2_column_data_collection_scan)
+	(duckdb_v2_column_data_collection_handle collection,
+	 duckdb_v2_column_data_collection_shared_scan_state_handle shared_state,
+	 duckdb_v2_column_data_collection_worker_scan_state_handle worker_state, duckdb_v2_data_chunk_handle out_chunk,
+	 bool *did_produce_chunk, duckdb_v2_error_info_handle *err);
+	DUCKDB_V2_ERROR(*duckdb_v2_column_data_collection_shared_scan_state_create)
+	(duckdb_v2_column_data_collection_handle collection,
+	 duckdb_v2_column_data_collection_shared_scan_state_handle *out_state, duckdb_v2_error_info_handle *err);
+	DUCKDB_V2_ERROR(*duckdb_v2_column_data_collection_shared_scan_state_destroy)
+	(duckdb_v2_column_data_collection_shared_scan_state_handle *state);
+	DUCKDB_V2_ERROR(*duckdb_v2_column_data_collection_worker_scan_state_create)
+	(duckdb_v2_column_data_collection_handle collection,
+	 duckdb_v2_column_data_collection_worker_scan_state_handle *out_state, duckdb_v2_error_info_handle *err);
+	DUCKDB_V2_ERROR(*duckdb_v2_column_data_collection_worker_scan_state_destroy)
+	(duckdb_v2_column_data_collection_worker_scan_state_handle *state);
+	DUCKDB_V2_ERROR(*duckdb_v2_config_get_option_by_index)
+	(duckdb_v2_config_handle config, idx_t index, duckdb_v2_option_handle *out_option,
+	 duckdb_v2_error_info_handle *err);
+	DUCKDB_V2_ERROR(*duckdb_v2_config_get_option_by_name)
+	(duckdb_v2_config_handle config, const duckdb_v2_identifier_t *name, duckdb_v2_option_handle *out_option,
+	 duckdb_v2_error_info_handle *err);
+	DUCKDB_V2_ERROR(*duckdb_v2_config_get_option_count)
+	(duckdb_v2_config_handle config, idx_t *out_count, duckdb_v2_error_info_handle *err);
+	DUCKDB_V2_ERROR(*duckdb_v2_connection_create)
+	(duckdb_v2_instance_handle instance, duckdb_v2_connection_handle *out_conn, duckdb_v2_error_info_handle *err);
+	DUCKDB_V2_ERROR (*duckdb_v2_connection_destroy)(duckdb_v2_connection_handle *conn);
+	DUCKDB_V2_ERROR(*duckdb_v2_connection_interrupt)
+	(duckdb_v2_connection_handle conn, duckdb_v2_error_info_handle *err);
+	DUCKDB_V2_ERROR(*duckdb_v2_connection_progress_get)
+	(duckdb_v2_connection_handle conn, double *out_percentage, uint64_t *out_rows_processed,
+	 uint64_t *out_total_rows_to_process, duckdb_v2_error_info_handle *err);
+	DUCKDB_V2_ERROR(*duckdb_v2_data_chunk_copy)
+	(duckdb_v2_factory_handle factory, duckdb_v2_data_chunk_handle chunk, duckdb_v2_data_chunk_handle *out_chunk,
+	 duckdb_v2_error_info_handle *err);
+	DUCKDB_V2_ERROR(*duckdb_v2_data_chunk_create)
+	(duckdb_v2_factory_handle factory, const duckdb_v2_logical_type_handle *types, idx_t column_count,
+	 duckdb_v2_data_chunk_handle *out_chunk, duckdb_v2_error_info_handle *err);
+	DUCKDB_V2_ERROR (*duckdb_v2_data_chunk_destroy)(duckdb_v2_data_chunk_handle *chunk);
+	DUCKDB_V2_ERROR(*duckdb_v2_data_chunk_get_size)
+	(duckdb_v2_data_chunk_handle chunk, idx_t *out_size, duckdb_v2_error_info_handle *err);
+	DUCKDB_V2_ERROR(*duckdb_v2_data_chunk_get_vector)
+	(duckdb_v2_data_chunk_handle chunk, idx_t index, duckdb_v2_vector_handle *out_vector,
+	 duckdb_v2_error_info_handle *err);
+	DUCKDB_V2_ERROR(*duckdb_v2_data_chunk_get_vector_count)
+	(duckdb_v2_data_chunk_handle chunk, idx_t *out_count, duckdb_v2_error_info_handle *err);
+	DUCKDB_V2_ERROR(*duckdb_v2_environment_create)
+	(duckdb_v2_environment_handle *out_env, duckdb_v2_error_info_handle *err);
+	DUCKDB_V2_ERROR (*duckdb_v2_environment_destroy)(duckdb_v2_environment_handle *env);
+	DUCKDB_V2_ERROR(*duckdb_v2_environment_get_instance_count)
+	(duckdb_v2_environment_handle env, idx_t *out_count, duckdb_v2_error_info_handle *err);
+	DUCKDB_V2_ERROR (*duckdb_v2_error_info_destroy)(duckdb_v2_error_info_handle *info);
+	DUCKDB_V2_ERROR (*duckdb_v2_error_info_get_code)(duckdb_v2_error_info_handle info, DUCKDB_V2_ERROR *out_code);
+	DUCKDB_V2_ERROR (*duckdb_v2_error_info_get_raw_text)(duckdb_v2_error_info_handle info, duckdb_v2_str *out_raw_text);
+	DUCKDB_V2_ERROR (*duckdb_v2_error_info_get_text)(duckdb_v2_error_info_handle info, duckdb_v2_str *out_text);
+	DUCKDB_V2_ERROR (*duckdb_v2_error_info_set_code)(duckdb_v2_error_info_handle info, DUCKDB_V2_ERROR code);
+	DUCKDB_V2_ERROR (*duckdb_v2_error_info_set_text)(duckdb_v2_error_info_handle info, const duckdb_v2_str *text);
+	DUCKDB_V2_ERROR(*duckdb_v2_factory_create_type_from_id)
+	(duckdb_v2_factory_handle factory, DUCKDB_V2_LOGICAL_TYPE_ID type_id, const duckdb_v2_identifier_t *param_names,
+	 const duckdb_v2_value_handle *param_values, idx_t param_count, duckdb_v2_logical_type_handle *out_type,
+	 duckdb_v2_error_info_handle *err);
+	DUCKDB_V2_ERROR(*duckdb_v2_factory_create_type_from_name)
+	(duckdb_v2_factory_handle factory, duckdb_v2_qname_handle name, const duckdb_v2_identifier_t *param_names,
+	 const duckdb_v2_value_handle *param_values, idx_t param_count, duckdb_v2_logical_type_handle *out_type,
+	 duckdb_v2_error_info_handle *err);
+	DUCKDB_V2_ERROR(*duckdb_v2_factory_create_type_from_text)
+	(duckdb_v2_factory_handle factory, const duckdb_v2_str *text, duckdb_v2_logical_type_handle *out_type,
+	 duckdb_v2_error_info_handle *err);
+	DUCKDB_V2_ERROR(*duckdb_v2_factory_create_type_with_alias)
+	(duckdb_v2_factory_handle factory, duckdb_v2_logical_type_handle base_type,
+	 const duckdb_v2_identifier_t *alias_name, duckdb_v2_logical_type_handle *out_type,
+	 duckdb_v2_error_info_handle *err);
+	DUCKDB_V2_ERROR(*duckdb_v2_instance_attach)
+	(duckdb_v2_instance_handle instance, const duckdb_v2_identifier_t *name, const duckdb_v2_str *path,
+	 duckdb_v2_attach_options_handle options, bool make_default, duckdb_v2_error_info_handle *err);
+	DUCKDB_V2_ERROR(*duckdb_v2_instance_create)
+	(duckdb_v2_environment_handle env, duckdb_v2_instance_handle *out_instance, duckdb_v2_error_info_handle *err);
+	DUCKDB_V2_ERROR(*duckdb_v2_instance_create_with_options)
+	(duckdb_v2_environment_handle env, const duckdb_v2_str *option_names, const duckdb_v2_str *option_values,
+	 idx_t option_count, duckdb_v2_instance_handle *out_instance, duckdb_v2_error_info_handle *err);
+	DUCKDB_V2_ERROR (*duckdb_v2_instance_destroy)(duckdb_v2_instance_handle *instance);
+	DUCKDB_V2_ERROR(*duckdb_v2_instance_detach)
+	(duckdb_v2_instance_handle instance, const duckdb_v2_identifier_t *name, duckdb_v2_error_info_handle *err);
+	DUCKDB_V2_ERROR (*duckdb_v2_library_version)(duckdb_v2_str *out_version, duckdb_v2_error_info_handle *err);
+	DUCKDB_V2_ERROR(*duckdb_v2_logical_type_copy)
+	(duckdb_v2_logical_type_handle type, duckdb_v2_logical_type_handle *out_type, duckdb_v2_error_info_handle *err);
+	DUCKDB_V2_ERROR (*duckdb_v2_logical_type_destroy)(duckdb_v2_logical_type_handle *type);
+	DUCKDB_V2_ERROR(*duckdb_v2_logical_type_get_id)
+	(duckdb_v2_logical_type_handle type, DUCKDB_V2_LOGICAL_TYPE_ID *out_id, duckdb_v2_error_info_handle *err);
+	DUCKDB_V2_ERROR(*duckdb_v2_logical_type_get_name)
+	(duckdb_v2_logical_type_handle type, duckdb_v2_identifier_t *out_name, duckdb_v2_error_info_handle *err);
+	DUCKDB_V2_ERROR(*duckdb_v2_logical_type_get_param)
+	(duckdb_v2_logical_type_handle type, idx_t index, duckdb_v2_identifier_t *out_name,
+	 duckdb_v2_value_handle *out_value, duckdb_v2_error_info_handle *err);
+	DUCKDB_V2_ERROR(*duckdb_v2_logical_type_get_param_count)
+	(duckdb_v2_logical_type_handle type, idx_t *out_count, duckdb_v2_error_info_handle *err);
+	DUCKDB_V2_ERROR(*duckdb_v2_logical_type_is_equal)
+	(duckdb_v2_logical_type_handle left, duckdb_v2_logical_type_handle right, bool *result,
+	 duckdb_v2_error_info_handle *err);
+	DUCKDB_V2_ERROR(*duckdb_v2_logical_type_to_text)
+	(duckdb_v2_logical_type_handle type, char *out_text, idx_t out_capacity, idx_t *out_length,
+	 duckdb_v2_error_info_handle *err);
+	DUCKDB_V2_ERROR (*duckdb_v2_option_destroy)(duckdb_v2_option_handle *option);
+	DUCKDB_V2_ERROR(*duckdb_v2_option_get_alias)
+	(duckdb_v2_option_handle option, idx_t index, duckdb_v2_identifier_t *out_alias, duckdb_v2_error_info_handle *err);
+	DUCKDB_V2_ERROR(*duckdb_v2_option_get_alias_count)
+	(duckdb_v2_option_handle option, idx_t *out_count, duckdb_v2_error_info_handle *err);
+	DUCKDB_V2_ERROR(*duckdb_v2_option_get_default_value)
+	(duckdb_v2_option_handle option, duckdb_v2_value_handle *out_value, duckdb_v2_error_info_handle *err);
+	DUCKDB_V2_ERROR(*duckdb_v2_option_get_description)
+	(duckdb_v2_option_handle option, duckdb_v2_str *out_description, duckdb_v2_error_info_handle *err);
+	DUCKDB_V2_ERROR(*duckdb_v2_option_get_name)
+	(duckdb_v2_option_handle option, duckdb_v2_identifier_t *out_name, duckdb_v2_error_info_handle *err);
+	DUCKDB_V2_ERROR(*duckdb_v2_parse_sql)
+	(duckdb_v2_connection_handle conn, const char *sql, duckdb_v2_statement_iterator_handle *out_iterator,
+	 duckdb_v2_error_info_handle *err);
+	DUCKDB_V2_ERROR (*duckdb_v2_result_destroy)(duckdb_v2_result_handle *result);
+	DUCKDB_V2_ERROR(*duckdb_v2_result_drain)
+	(duckdb_v2_result_handle result, idx_t *out_rows_changed, duckdb_v2_error_info_handle *err);
+	DUCKDB_V2_ERROR(*duckdb_v2_result_fetch_chunk)
+	(duckdb_v2_result_handle result, duckdb_v2_data_chunk_handle *out_chunk, duckdb_v2_error_info_handle *err);
+	DUCKDB_V2_ERROR(*duckdb_v2_result_get_result_type)
+	(duckdb_v2_result_handle result, DUCKDB_V2_RESULT_TYPE *out_type, duckdb_v2_error_info_handle *err);
+	DUCKDB_V2_ERROR(*duckdb_v2_result_get_schema)
+	(duckdb_v2_result_handle result, duckdb_v2_schema_handle *out_schema, duckdb_v2_error_info_handle *err);
+	DUCKDB_V2_ERROR(*duckdb_v2_result_get_statement_type)
+	(duckdb_v2_result_handle result, DUCKDB_V2_STATEMENT_TYPE *out_type, duckdb_v2_error_info_handle *err);
+	DUCKDB_V2_ERROR(*duckdb_v2_result_render_box)
+	(duckdb_v2_result_handle *result, idx_t max_rows, idx_t max_width, idx_t max_col_width,
+	 const duckdb_v2_str *null_value, idx_t render_mode, idx_t limit, duckdb_v2_text_sink_fn sink, void *user_data,
+	 duckdb_v2_error_info_handle *err);
+	DUCKDB_V2_ERROR(*duckdb_v2_result_step)
+	(duckdb_v2_result_handle result, duckdb_v2_data_chunk_handle *out_chunk, DUCKDB_V2_RESULT_STEP_STATUS *out_status,
+	 duckdb_v2_error_info_handle *err);
+	DUCKDB_V2_ERROR (*duckdb_v2_result_wait)(duckdb_v2_result_handle result, duckdb_v2_error_info_handle *err);
+	DUCKDB_V2_ERROR (*duckdb_v2_schema_destroy)(duckdb_v2_schema_handle *schema);
+	DUCKDB_V2_ERROR(*duckdb_v2_schema_get_count)
+	(duckdb_v2_schema_handle schema, idx_t *out_count, duckdb_v2_error_info_handle *err);
+	DUCKDB_V2_ERROR(*duckdb_v2_schema_get_field)
+	(duckdb_v2_schema_handle schema, idx_t index, duckdb_v2_identifier_t *out_name,
+	 duckdb_v2_logical_type_handle *out_type, duckdb_v2_error_info_handle *err);
+	DUCKDB_V2_ERROR (*duckdb_v2_sql_statement_destroy)(duckdb_v2_sql_statement_handle *statement);
+	DUCKDB_V2_ERROR(*duckdb_v2_statement_bind)
+	(duckdb_v2_connection_handle conn, duckdb_v2_sql_statement_handle statement, duckdb_v2_schema_handle *out_schema,
+	 duckdb_v2_schema_handle *out_parameters, duckdb_v2_error_info_handle *err);
+	DUCKDB_V2_ERROR(*duckdb_v2_statement_execute)
+	(duckdb_v2_connection_handle conn, duckdb_v2_sql_statement_handle statement,
+	 const duckdb_v2_identifier_t *parameter_names, const duckdb_v2_value_handle *parameter_values,
+	 idx_t parameter_count, duckdb_v2_result_handle *out_result, duckdb_v2_error_info_handle *err);
+	DUCKDB_V2_ERROR (*duckdb_v2_statement_iterator_destroy)(duckdb_v2_statement_iterator_handle *iterator);
+	DUCKDB_V2_ERROR(*duckdb_v2_statement_iterator_next)
+	(duckdb_v2_statement_iterator_handle iterator, duckdb_v2_sql_statement_handle *out_statement,
+	 duckdb_v2_error_info_handle *err);
+	DUCKDB_V2_ERROR(*duckdb_v2_value_cast)
+	(duckdb_v2_factory_handle factory, duckdb_v2_value_handle value, duckdb_v2_logical_type_handle target_type,
+	 duckdb_v2_value_handle *out_value, duckdb_v2_error_info_handle *err);
+	DUCKDB_V2_ERROR(*duckdb_v2_value_create_array)
+	(duckdb_v2_factory_handle factory, duckdb_v2_logical_type_handle child_type, const duckdb_v2_value_handle *children,
+	 idx_t child_count, duckdb_v2_value_handle *out_value, duckdb_v2_error_info_handle *err);
+	DUCKDB_V2_ERROR(*duckdb_v2_value_create_bigint)
+	(duckdb_v2_factory_handle factory, int64_t in_value, duckdb_v2_value_handle *out_value,
+	 duckdb_v2_error_info_handle *err);
+	DUCKDB_V2_ERROR(*duckdb_v2_value_create_bignum)
+	(duckdb_v2_factory_handle factory, const duckdb_v2_str *in_value, duckdb_v2_value_handle *out_value,
+	 duckdb_v2_error_info_handle *err);
+	DUCKDB_V2_ERROR(*duckdb_v2_value_create_bit)
+	(duckdb_v2_factory_handle factory, const duckdb_v2_str *in_value, duckdb_v2_value_handle *out_value,
+	 duckdb_v2_error_info_handle *err);
+	DUCKDB_V2_ERROR(*duckdb_v2_value_create_blob)
+	(duckdb_v2_factory_handle factory, const duckdb_v2_str *in_value, duckdb_v2_value_handle *out_value,
+	 duckdb_v2_error_info_handle *err);
+	DUCKDB_V2_ERROR(*duckdb_v2_value_create_bool)
+	(duckdb_v2_factory_handle factory, bool in_value, duckdb_v2_value_handle *out_value,
+	 duckdb_v2_error_info_handle *err);
+	DUCKDB_V2_ERROR(*duckdb_v2_value_create_date)
+	(duckdb_v2_factory_handle factory, int32_t in_value, duckdb_v2_value_handle *out_value,
+	 duckdb_v2_error_info_handle *err);
+	DUCKDB_V2_ERROR(*duckdb_v2_value_create_decimal)
+	(duckdb_v2_factory_handle factory, const duckdb_v2_hugeint_t *in_value, uint8_t width, uint8_t scale,
+	 duckdb_v2_value_handle *out_value, duckdb_v2_error_info_handle *err);
+	DUCKDB_V2_ERROR(*duckdb_v2_value_create_double)
+	(duckdb_v2_factory_handle factory, double in_value, duckdb_v2_value_handle *out_value,
+	 duckdb_v2_error_info_handle *err);
+	DUCKDB_V2_ERROR(*duckdb_v2_value_create_float)
+	(duckdb_v2_factory_handle factory, float in_value, duckdb_v2_value_handle *out_value,
+	 duckdb_v2_error_info_handle *err);
+	DUCKDB_V2_ERROR(*duckdb_v2_value_create_hugeint)
+	(duckdb_v2_factory_handle factory, const duckdb_v2_hugeint_t *in_value, duckdb_v2_value_handle *out_value,
+	 duckdb_v2_error_info_handle *err);
+	DUCKDB_V2_ERROR(*duckdb_v2_value_create_int)
+	(duckdb_v2_factory_handle factory, int32_t in_value, duckdb_v2_value_handle *out_value,
+	 duckdb_v2_error_info_handle *err);
+	DUCKDB_V2_ERROR(*duckdb_v2_value_create_interval)
+	(duckdb_v2_factory_handle factory, const duckdb_v2_interval_t *in_value, duckdb_v2_value_handle *out_value,
+	 duckdb_v2_error_info_handle *err);
+	DUCKDB_V2_ERROR(*duckdb_v2_value_create_list)
+	(duckdb_v2_factory_handle factory, duckdb_v2_logical_type_handle child_type, const duckdb_v2_value_handle *children,
+	 idx_t child_count, duckdb_v2_value_handle *out_value, duckdb_v2_error_info_handle *err);
+	DUCKDB_V2_ERROR(*duckdb_v2_value_create_map)
+	(duckdb_v2_factory_handle factory, duckdb_v2_logical_type_handle key_type, duckdb_v2_logical_type_handle value_type,
+	 const duckdb_v2_value_handle *keys, const duckdb_v2_value_handle *values, idx_t entry_count,
+	 duckdb_v2_value_handle *out_value, duckdb_v2_error_info_handle *err);
+	DUCKDB_V2_ERROR(*duckdb_v2_value_create_null)
+	(duckdb_v2_factory_handle factory, duckdb_v2_logical_type_handle type, duckdb_v2_value_handle *out_value,
+	 duckdb_v2_error_info_handle *err);
+	DUCKDB_V2_ERROR(*duckdb_v2_value_create_smallint)
+	(duckdb_v2_factory_handle factory, int16_t in_value, duckdb_v2_value_handle *out_value,
+	 duckdb_v2_error_info_handle *err);
+	DUCKDB_V2_ERROR(*duckdb_v2_value_create_struct)
+	(duckdb_v2_factory_handle factory, const duckdb_v2_identifier_t *names, const duckdb_v2_value_handle *children,
+	 idx_t field_count, duckdb_v2_value_handle *out_value, duckdb_v2_error_info_handle *err);
+	DUCKDB_V2_ERROR(*duckdb_v2_value_create_time)
+	(duckdb_v2_factory_handle factory, int64_t in_value, duckdb_v2_value_handle *out_value,
+	 duckdb_v2_error_info_handle *err);
+	DUCKDB_V2_ERROR(*duckdb_v2_value_create_time_ns)
+	(duckdb_v2_factory_handle factory, int64_t in_value, duckdb_v2_value_handle *out_value,
+	 duckdb_v2_error_info_handle *err);
+	DUCKDB_V2_ERROR(*duckdb_v2_value_create_time_tz)
+	(duckdb_v2_factory_handle factory, uint64_t in_value, duckdb_v2_value_handle *out_value,
+	 duckdb_v2_error_info_handle *err);
+	DUCKDB_V2_ERROR(*duckdb_v2_value_create_timestamp)
+	(duckdb_v2_factory_handle factory, int64_t in_value, duckdb_v2_value_handle *out_value,
+	 duckdb_v2_error_info_handle *err);
+	DUCKDB_V2_ERROR(*duckdb_v2_value_create_timestamp_ms)
+	(duckdb_v2_factory_handle factory, int64_t in_value, duckdb_v2_value_handle *out_value,
+	 duckdb_v2_error_info_handle *err);
+	DUCKDB_V2_ERROR(*duckdb_v2_value_create_timestamp_ns)
+	(duckdb_v2_factory_handle factory, int64_t in_value, duckdb_v2_value_handle *out_value,
+	 duckdb_v2_error_info_handle *err);
+	DUCKDB_V2_ERROR(*duckdb_v2_value_create_timestamp_sec)
+	(duckdb_v2_factory_handle factory, int64_t in_value, duckdb_v2_value_handle *out_value,
+	 duckdb_v2_error_info_handle *err);
+	DUCKDB_V2_ERROR(*duckdb_v2_value_create_timestamp_tz)
+	(duckdb_v2_factory_handle factory, int64_t in_value, duckdb_v2_value_handle *out_value,
+	 duckdb_v2_error_info_handle *err);
+	DUCKDB_V2_ERROR(*duckdb_v2_value_create_timestamp_tz_ns)
+	(duckdb_v2_factory_handle factory, int64_t in_value, duckdb_v2_value_handle *out_value,
+	 duckdb_v2_error_info_handle *err);
+	DUCKDB_V2_ERROR(*duckdb_v2_value_create_tinyint)
+	(duckdb_v2_factory_handle factory, int8_t in_value, duckdb_v2_value_handle *out_value,
+	 duckdb_v2_error_info_handle *err);
+	DUCKDB_V2_ERROR(*duckdb_v2_value_create_tuple)
+	(duckdb_v2_factory_handle factory, const duckdb_v2_value_handle *children, idx_t field_count,
+	 duckdb_v2_value_handle *out_value, duckdb_v2_error_info_handle *err);
+	DUCKDB_V2_ERROR(*duckdb_v2_value_create_type)
+	(duckdb_v2_factory_handle factory, duckdb_v2_logical_type_handle in_type, duckdb_v2_value_handle *out_value,
+	 duckdb_v2_error_info_handle *err);
+	DUCKDB_V2_ERROR(*duckdb_v2_value_create_ubigint)
+	(duckdb_v2_factory_handle factory, uint64_t in_value, duckdb_v2_value_handle *out_value,
+	 duckdb_v2_error_info_handle *err);
+	DUCKDB_V2_ERROR(*duckdb_v2_value_create_uhugeint)
+	(duckdb_v2_factory_handle factory, const duckdb_v2_uhugeint_t *in_value, duckdb_v2_value_handle *out_value,
+	 duckdb_v2_error_info_handle *err);
+	DUCKDB_V2_ERROR(*duckdb_v2_value_create_uint)
+	(duckdb_v2_factory_handle factory, uint32_t in_value, duckdb_v2_value_handle *out_value,
+	 duckdb_v2_error_info_handle *err);
+	DUCKDB_V2_ERROR(*duckdb_v2_value_create_usmallint)
+	(duckdb_v2_factory_handle factory, uint16_t in_value, duckdb_v2_value_handle *out_value,
+	 duckdb_v2_error_info_handle *err);
+	DUCKDB_V2_ERROR(*duckdb_v2_value_create_utinyint)
+	(duckdb_v2_factory_handle factory, uint8_t in_value, duckdb_v2_value_handle *out_value,
+	 duckdb_v2_error_info_handle *err);
+	DUCKDB_V2_ERROR(*duckdb_v2_value_create_uuid)
+	(duckdb_v2_factory_handle factory, const duckdb_v2_hugeint_t *in_value, duckdb_v2_value_handle *out_value,
+	 duckdb_v2_error_info_handle *err);
+	DUCKDB_V2_ERROR(*duckdb_v2_value_create_varchar)
+	(duckdb_v2_factory_handle factory, const duckdb_v2_str *in_value, duckdb_v2_value_handle *out_value,
+	 duckdb_v2_error_info_handle *err);
+	DUCKDB_V2_ERROR (*duckdb_v2_value_destroy)(duckdb_v2_value_handle *value);
+	DUCKDB_V2_ERROR(*duckdb_v2_value_get_bigint)
+	(duckdb_v2_value_handle value, int64_t *out, duckdb_v2_error_info_handle *err);
+	DUCKDB_V2_ERROR(*duckdb_v2_value_get_blob)
+	(duckdb_v2_value_handle value, duckdb_v2_str *out, duckdb_v2_error_info_handle *err);
+	DUCKDB_V2_ERROR(*duckdb_v2_value_get_bool)
+	(duckdb_v2_value_handle value, bool *out, duckdb_v2_error_info_handle *err);
+	DUCKDB_V2_ERROR(*duckdb_v2_value_get_child)
+	(duckdb_v2_value_handle value, idx_t index, duckdb_v2_value_handle *out_child, duckdb_v2_error_info_handle *err);
+	DUCKDB_V2_ERROR(*duckdb_v2_value_get_child_count)
+	(duckdb_v2_value_handle value, idx_t *out_count, duckdb_v2_error_info_handle *err);
+	DUCKDB_V2_ERROR(*duckdb_v2_value_get_date)
+	(duckdb_v2_value_handle value, int32_t *out, duckdb_v2_error_info_handle *err);
+	DUCKDB_V2_ERROR(*duckdb_v2_value_get_decimal)
+	(duckdb_v2_value_handle value, duckdb_v2_hugeint_t *out, uint8_t *out_width, uint8_t *out_scale,
+	 duckdb_v2_error_info_handle *err);
+	DUCKDB_V2_ERROR(*duckdb_v2_value_get_double)
+	(duckdb_v2_value_handle value, double *out, duckdb_v2_error_info_handle *err);
+	DUCKDB_V2_ERROR(*duckdb_v2_value_get_float)
+	(duckdb_v2_value_handle value, float *out, duckdb_v2_error_info_handle *err);
+	DUCKDB_V2_ERROR(*duckdb_v2_value_get_hugeint)
+	(duckdb_v2_value_handle value, duckdb_v2_hugeint_t *out, duckdb_v2_error_info_handle *err);
+	DUCKDB_V2_ERROR(*duckdb_v2_value_get_int)
+	(duckdb_v2_value_handle value, int32_t *out, duckdb_v2_error_info_handle *err);
+	DUCKDB_V2_ERROR(*duckdb_v2_value_get_interval)
+	(duckdb_v2_value_handle value, duckdb_v2_interval_t *out, duckdb_v2_error_info_handle *err);
+	DUCKDB_V2_ERROR(*duckdb_v2_value_get_logical_type)
+	(duckdb_v2_value_handle value, duckdb_v2_logical_type_handle *out_type, duckdb_v2_error_info_handle *err);
+	DUCKDB_V2_ERROR(*duckdb_v2_value_get_smallint)
+	(duckdb_v2_value_handle value, int16_t *out, duckdb_v2_error_info_handle *err);
+	DUCKDB_V2_ERROR(*duckdb_v2_value_get_time)
+	(duckdb_v2_value_handle value, int64_t *out, duckdb_v2_error_info_handle *err);
+	DUCKDB_V2_ERROR(*duckdb_v2_value_get_time_ns)
+	(duckdb_v2_value_handle value, int64_t *out, duckdb_v2_error_info_handle *err);
+	DUCKDB_V2_ERROR(*duckdb_v2_value_get_time_tz)
+	(duckdb_v2_value_handle value, uint64_t *out, duckdb_v2_error_info_handle *err);
+	DUCKDB_V2_ERROR(*duckdb_v2_value_get_timestamp)
+	(duckdb_v2_value_handle value, int64_t *out, duckdb_v2_error_info_handle *err);
+	DUCKDB_V2_ERROR(*duckdb_v2_value_get_timestamp_ms)
+	(duckdb_v2_value_handle value, int64_t *out, duckdb_v2_error_info_handle *err);
+	DUCKDB_V2_ERROR(*duckdb_v2_value_get_timestamp_ns)
+	(duckdb_v2_value_handle value, int64_t *out, duckdb_v2_error_info_handle *err);
+	DUCKDB_V2_ERROR(*duckdb_v2_value_get_timestamp_sec)
+	(duckdb_v2_value_handle value, int64_t *out, duckdb_v2_error_info_handle *err);
+	DUCKDB_V2_ERROR(*duckdb_v2_value_get_timestamp_tz)
+	(duckdb_v2_value_handle value, int64_t *out, duckdb_v2_error_info_handle *err);
+	DUCKDB_V2_ERROR(*duckdb_v2_value_get_timestamp_tz_ns)
+	(duckdb_v2_value_handle value, int64_t *out, duckdb_v2_error_info_handle *err);
+	DUCKDB_V2_ERROR(*duckdb_v2_value_get_tinyint)
+	(duckdb_v2_value_handle value, int8_t *out, duckdb_v2_error_info_handle *err);
+	DUCKDB_V2_ERROR(*duckdb_v2_value_get_type)
+	(duckdb_v2_value_handle value, duckdb_v2_logical_type_handle *out_type, duckdb_v2_error_info_handle *err);
+	DUCKDB_V2_ERROR(*duckdb_v2_value_get_ubigint)
+	(duckdb_v2_value_handle value, uint64_t *out, duckdb_v2_error_info_handle *err);
+	DUCKDB_V2_ERROR(*duckdb_v2_value_get_uhugeint)
+	(duckdb_v2_value_handle value, duckdb_v2_uhugeint_t *out, duckdb_v2_error_info_handle *err);
+	DUCKDB_V2_ERROR(*duckdb_v2_value_get_uint)
+	(duckdb_v2_value_handle value, uint32_t *out, duckdb_v2_error_info_handle *err);
+	DUCKDB_V2_ERROR(*duckdb_v2_value_get_usmallint)
+	(duckdb_v2_value_handle value, uint16_t *out, duckdb_v2_error_info_handle *err);
+	DUCKDB_V2_ERROR(*duckdb_v2_value_get_utinyint)
+	(duckdb_v2_value_handle value, uint8_t *out, duckdb_v2_error_info_handle *err);
+	DUCKDB_V2_ERROR(*duckdb_v2_value_get_uuid)
+	(duckdb_v2_value_handle value, duckdb_v2_hugeint_t *out, duckdb_v2_error_info_handle *err);
+	DUCKDB_V2_ERROR(*duckdb_v2_value_get_varchar)
+	(duckdb_v2_value_handle value, duckdb_v2_str *out, duckdb_v2_error_info_handle *err);
+	DUCKDB_V2_ERROR(*duckdb_v2_value_is_null)
+	(duckdb_v2_value_handle value, bool *out_is_null, duckdb_v2_error_info_handle *err);
+	DUCKDB_V2_ERROR(*duckdb_v2_value_to_string)
+	(duckdb_v2_value_handle value, char *out_string, idx_t out_capacity, idx_t *out_length,
+	 duckdb_v2_error_info_handle *err);
+	DUCKDB_V2_ERROR(*duckdb_v2_vector_constant_set_valid)
+	(duckdb_v2_vector_handle vector, bool validity, duckdb_v2_error_info_handle *err);
+	DUCKDB_V2_ERROR(*duckdb_v2_vector_flat_get_validity_mutable)
+	(duckdb_v2_vector_handle vector, uint64_t **out_validity, duckdb_v2_error_info_handle *err);
+	DUCKDB_V2_ERROR (*duckdb_v2_vector_flatten)(duckdb_v2_vector_handle vector, duckdb_v2_error_info_handle *err);
+	DUCKDB_V2_ERROR(*duckdb_v2_vector_get_arena)
+	(duckdb_v2_vector_handle vector, duckdb_v2_arena_handle *out_arena, duckdb_v2_error_info_handle *err);
+	DUCKDB_V2_ERROR(*duckdb_v2_vector_get_child)
+	(duckdb_v2_vector_handle vector, idx_t index, duckdb_v2_vector_handle *out_child, duckdb_v2_error_info_handle *err);
+	DUCKDB_V2_ERROR(*duckdb_v2_vector_get_child_count)
+	(duckdb_v2_vector_handle vector, idx_t *out_count, duckdb_v2_error_info_handle *err);
+	DUCKDB_V2_ERROR(*duckdb_v2_vector_get_data_mutable)
+	(duckdb_v2_vector_handle vector, void **out_data, duckdb_v2_error_info_handle *err);
+	DUCKDB_V2_ERROR(*duckdb_v2_vector_get_logical_type)
+	(duckdb_v2_vector_handle vector, duckdb_v2_logical_type_handle *out_type, duckdb_v2_error_info_handle *err);
+	DUCKDB_V2_ERROR(*duckdb_v2_vector_get_size)
+	(duckdb_v2_vector_handle vector, idx_t *out_size, duckdb_v2_error_info_handle *err);
+	DUCKDB_V2_ERROR(*duckdb_v2_vector_get_value)
+	(duckdb_v2_vector_handle vector, idx_t row, duckdb_v2_value_handle *out_value, duckdb_v2_error_info_handle *err);
+	DUCKDB_V2_ERROR(*duckdb_v2_vector_get_vector_type)
+	(duckdb_v2_vector_handle vector, DUCKDB_V2_VECTOR_TYPE *out_type, duckdb_v2_error_info_handle *err);
+	DUCKDB_V2_ERROR(*duckdb_v2_vector_get_view)
+	(duckdb_v2_vector_handle vector, duckdb_v2_vector_view *out_view, duckdb_v2_error_info_handle *err);
+	DUCKDB_V2_ERROR(*duckdb_v2_vector_make_constant)
+	(duckdb_v2_vector_handle vector, duckdb_v2_value_handle value, idx_t count, duckdb_v2_error_info_handle *err);
+	DUCKDB_V2_ERROR(*duckdb_v2_vector_make_sequence)
+	(duckdb_v2_vector_handle vector, int64_t start, int64_t increment, idx_t count, duckdb_v2_error_info_handle *err);
+	DUCKDB_V2_ERROR(*duckdb_v2_vector_reference)
+	(duckdb_v2_vector_handle vector, duckdb_v2_vector_handle source, duckdb_v2_error_info_handle *err);
+	DUCKDB_V2_ERROR(*duckdb_v2_vector_set_null)
+	(duckdb_v2_vector_handle vector, idx_t row, duckdb_v2_error_info_handle *err);
+	DUCKDB_V2_ERROR(*duckdb_v2_vector_set_size)
+	(duckdb_v2_vector_handle vector, idx_t size, duckdb_v2_error_info_handle *err);
+	DUCKDB_V2_ERROR(*duckdb_v2_vector_set_value)
+	(duckdb_v2_vector_handle vector, idx_t row, duckdb_v2_value_handle value, duckdb_v2_error_info_handle *err);
+	DUCKDB_V2_ERROR(*duckdb_v2_connection_register_scalar_function)
+	(duckdb_v2_connection_handle conn, duckdb_v2_scalar_function_handle function, duckdb_v2_error_info_handle *err);
+	DUCKDB_V2_ERROR(*duckdb_v2_context_log)
+	(duckdb_v2_context_handle ctx, DUCKDB_V2_LOG_LEVEL level, const duckdb_v2_str *log_type,
+	 const duckdb_v2_str *message, duckdb_v2_error_info_handle *err);
+	DUCKDB_V2_ERROR(*duckdb_v2_extension_register_scalar_function)
+	(duckdb_v2_extension_handle extension, duckdb_v2_scalar_function_handle function, duckdb_v2_error_info_handle *err);
+	DUCKDB_V2_ERROR(*duckdb_v2_function_signature_add_parameter)
+	(duckdb_v2_function_signature_handle sig, const duckdb_v2_identifier_t *name, duckdb_v2_logical_type_handle type,
+	 duckdb_v2_value_handle value, DUCKDB_V2_FUNCTION_PARAMETER_KIND kind, duckdb_v2_error_info_handle *err);
+	DUCKDB_V2_ERROR(*duckdb_v2_function_signature_set_return_type)
+	(duckdb_v2_function_signature_handle sig, duckdb_v2_logical_type_handle type, duckdb_v2_error_info_handle *err);
+	DUCKDB_V2_ERROR(*duckdb_v2_scalar_function_create)
+	(duckdb_v2_factory_handle factory, duckdb_v2_scalar_function_handle *function, duckdb_v2_error_info_handle *err);
+	DUCKDB_V2_ERROR (*duckdb_v2_scalar_function_destroy)(duckdb_v2_scalar_function_handle *function);
+	DUCKDB_V2_ERROR(*duckdb_v2_scalar_function_exec_get_arg)
+	(duckdb_v2_scalar_function_exec_info_handle info, idx_t index, duckdb_v2_vector_handle *vector,
+	 duckdb_v2_error_info_handle *err);
+	DUCKDB_V2_ERROR(*duckdb_v2_scalar_function_exec_get_arg_count)
+	(duckdb_v2_scalar_function_exec_info_handle info, idx_t *positional_fixed, idx_t *positional_variadic,
+	 idx_t *named_fixed, idx_t *named_variadic, duckdb_v2_error_info_handle *err);
+	DUCKDB_V2_ERROR(*duckdb_v2_scalar_function_exec_get_bind_data)
+	(duckdb_v2_scalar_function_exec_info_handle info, void **data, duckdb_v2_error_info_handle *err);
+	DUCKDB_V2_ERROR(*duckdb_v2_scalar_function_exec_get_init_data)
+	(duckdb_v2_scalar_function_exec_info_handle info, void **data, duckdb_v2_error_info_handle *err);
+	DUCKDB_V2_ERROR(*duckdb_v2_scalar_function_exec_get_result)
+	(duckdb_v2_scalar_function_exec_info_handle info, duckdb_v2_vector_handle *vector,
+	 duckdb_v2_error_info_handle *err);
+	DUCKDB_V2_ERROR(*duckdb_v2_scalar_function_exec_get_row_count)
+	(duckdb_v2_scalar_function_exec_info_handle info, idx_t *count, duckdb_v2_error_info_handle *err);
+	DUCKDB_V2_ERROR(*duckdb_v2_scalar_function_exec_get_user_data)
+	(duckdb_v2_scalar_function_exec_info_handle info, void **data, duckdb_v2_error_info_handle *err);
+	DUCKDB_V2_ERROR(*duckdb_v2_scalar_function_get_signature)
+	(duckdb_v2_scalar_function_handle function, duckdb_v2_function_signature_handle *sig,
+	 duckdb_v2_error_info_handle *err);
+	DUCKDB_V2_ERROR(*duckdb_v2_scalar_function_init_get_bind_data)
+	(duckdb_v2_scalar_function_init_info_handle info, void **data, duckdb_v2_error_info_handle *err);
+	DUCKDB_V2_ERROR(*duckdb_v2_scalar_function_init_get_user_data)
+	(duckdb_v2_scalar_function_init_info_handle info, void **data, duckdb_v2_error_info_handle *err);
+	DUCKDB_V2_ERROR(*duckdb_v2_scalar_function_init_set_init_data)
+	(duckdb_v2_scalar_function_init_info_handle info, duckdb_v2_opaque *data, duckdb_v2_error_info_handle *err);
+	DUCKDB_V2_ERROR(*duckdb_v2_scalar_function_set_bind_callback)
+	(duckdb_v2_scalar_function_handle function, duckdb_v2_scalar_function_bind_callback_fn callback,
+	 duckdb_v2_error_info_handle *err);
+	DUCKDB_V2_ERROR(*duckdb_v2_scalar_function_set_exec_callback)
+	(duckdb_v2_scalar_function_handle function, duckdb_v2_scalar_function_exec_callback_fn callback,
+	 duckdb_v2_error_info_handle *err);
+	DUCKDB_V2_ERROR(*duckdb_v2_scalar_function_set_init_callback)
+	(duckdb_v2_scalar_function_handle function, duckdb_v2_scalar_function_init_callback_fn callback,
+	 duckdb_v2_error_info_handle *err);
+	DUCKDB_V2_ERROR(*duckdb_v2_scalar_function_set_name)
+	(duckdb_v2_scalar_function_handle function, const duckdb_v2_identifier_t *name, duckdb_v2_error_info_handle *err);
+	DUCKDB_V2_ERROR(*duckdb_v2_scalar_function_set_user_data)
+	(duckdb_v2_scalar_function_handle function, duckdb_v2_opaque *data, duckdb_v2_error_info_handle *err);
+	DUCKDB_V2_ERROR(*duckdb_v2_aggregate_function_bind_set_return_type)
+	(duckdb_v2_aggregate_function_bind_info_handle info, duckdb_v2_logical_type_handle return_type,
+	 duckdb_v2_error_info_handle *err);
+	DUCKDB_V2_ERROR(*duckdb_v2_aggregate_function_combine_get_bind_data)
+	(duckdb_v2_aggregate_function_combine_info_handle info, void **data, duckdb_v2_error_info_handle *err);
+	DUCKDB_V2_ERROR(*duckdb_v2_aggregate_function_combine_get_sources)
+	(duckdb_v2_aggregate_function_combine_info_handle info, void ***states, duckdb_v2_error_info_handle *err);
+	DUCKDB_V2_ERROR(*duckdb_v2_aggregate_function_combine_get_state_count)
+	(duckdb_v2_aggregate_function_combine_info_handle info, idx_t *count, duckdb_v2_error_info_handle *err);
+	DUCKDB_V2_ERROR(*duckdb_v2_aggregate_function_combine_get_targets)
+	(duckdb_v2_aggregate_function_combine_info_handle info, void ***states, duckdb_v2_error_info_handle *err);
+	DUCKDB_V2_ERROR(*duckdb_v2_aggregate_function_combine_get_user_data)
+	(duckdb_v2_aggregate_function_combine_info_handle info, void **data, duckdb_v2_error_info_handle *err);
+	DUCKDB_V2_ERROR(*duckdb_v2_aggregate_function_create)
+	(duckdb_v2_factory_handle factory, duckdb_v2_aggregate_function_handle *function, duckdb_v2_error_info_handle *err);
+	DUCKDB_V2_ERROR (*duckdb_v2_aggregate_function_destroy)(duckdb_v2_aggregate_function_handle *function);
+	DUCKDB_V2_ERROR(*duckdb_v2_aggregate_function_destroy_get_bind_data)
+	(duckdb_v2_aggregate_function_destroy_info_handle info, void **data, duckdb_v2_error_info_handle *err);
+	DUCKDB_V2_ERROR(*duckdb_v2_aggregate_function_destroy_get_state_count)
+	(duckdb_v2_aggregate_function_destroy_info_handle info, idx_t *count, duckdb_v2_error_info_handle *err);
+	DUCKDB_V2_ERROR(*duckdb_v2_aggregate_function_destroy_get_states)
+	(duckdb_v2_aggregate_function_destroy_info_handle info, void ***states, duckdb_v2_error_info_handle *err);
+	DUCKDB_V2_ERROR(*duckdb_v2_aggregate_function_destroy_get_user_data)
+	(duckdb_v2_aggregate_function_destroy_info_handle info, void **data, duckdb_v2_error_info_handle *err);
+	DUCKDB_V2_ERROR(*duckdb_v2_aggregate_function_finalize_get_bind_data)
+	(duckdb_v2_aggregate_function_finalize_info_handle info, void **data, duckdb_v2_error_info_handle *err);
+	DUCKDB_V2_ERROR(*duckdb_v2_aggregate_function_finalize_get_result)
+	(duckdb_v2_aggregate_function_finalize_info_handle info, duckdb_v2_vector_handle *vector,
+	 duckdb_v2_error_info_handle *err);
+	DUCKDB_V2_ERROR(*duckdb_v2_aggregate_function_finalize_get_result_offset)
+	(duckdb_v2_aggregate_function_finalize_info_handle info, idx_t *offset, duckdb_v2_error_info_handle *err);
+	DUCKDB_V2_ERROR(*duckdb_v2_aggregate_function_finalize_get_state_count)
+	(duckdb_v2_aggregate_function_finalize_info_handle info, idx_t *count, duckdb_v2_error_info_handle *err);
+	DUCKDB_V2_ERROR(*duckdb_v2_aggregate_function_finalize_get_states)
+	(duckdb_v2_aggregate_function_finalize_info_handle info, void ***states, duckdb_v2_error_info_handle *err);
+	DUCKDB_V2_ERROR(*duckdb_v2_aggregate_function_finalize_get_user_data)
+	(duckdb_v2_aggregate_function_finalize_info_handle info, void **data, duckdb_v2_error_info_handle *err);
+	DUCKDB_V2_ERROR(*duckdb_v2_aggregate_function_get_signature)
+	(duckdb_v2_aggregate_function_handle function, duckdb_v2_function_signature_handle *sig,
+	 duckdb_v2_error_info_handle *err);
+	DUCKDB_V2_ERROR(*duckdb_v2_aggregate_function_init_get_bind_data)
+	(duckdb_v2_aggregate_function_init_info_handle info, void **data, duckdb_v2_error_info_handle *err);
+	DUCKDB_V2_ERROR(*duckdb_v2_aggregate_function_init_get_state_count)
+	(duckdb_v2_aggregate_function_init_info_handle info, idx_t *count, duckdb_v2_error_info_handle *err);
+	DUCKDB_V2_ERROR(*duckdb_v2_aggregate_function_init_get_states)
+	(duckdb_v2_aggregate_function_init_info_handle info, void ***states, duckdb_v2_error_info_handle *err);
+	DUCKDB_V2_ERROR(*duckdb_v2_aggregate_function_init_get_user_data)
+	(duckdb_v2_aggregate_function_init_info_handle info, void **data, duckdb_v2_error_info_handle *err);
+	DUCKDB_V2_ERROR(*duckdb_v2_aggregate_function_set_bind_callback)
+	(duckdb_v2_aggregate_function_handle function, duckdb_v2_aggregate_function_bind_callback_fn callback,
+	 duckdb_v2_error_info_handle *err);
+	DUCKDB_V2_ERROR(*duckdb_v2_aggregate_function_set_combine_callback)
+	(duckdb_v2_aggregate_function_handle function, duckdb_v2_aggregate_function_combine_callback_fn callback,
+	 duckdb_v2_error_info_handle *err);
+	DUCKDB_V2_ERROR(*duckdb_v2_aggregate_function_set_destroy_callback)
+	(duckdb_v2_aggregate_function_handle function, duckdb_v2_aggregate_function_destroy_callback_fn callback,
+	 duckdb_v2_error_info_handle *err);
+	DUCKDB_V2_ERROR(*duckdb_v2_aggregate_function_set_finalize_callback)
+	(duckdb_v2_aggregate_function_handle function, duckdb_v2_aggregate_function_finalize_callback_fn callback,
+	 duckdb_v2_error_info_handle *err);
+	DUCKDB_V2_ERROR(*duckdb_v2_aggregate_function_set_init_callback)
+	(duckdb_v2_aggregate_function_handle function, duckdb_v2_aggregate_function_init_callback_fn callback,
+	 duckdb_v2_error_info_handle *err);
+	DUCKDB_V2_ERROR(*duckdb_v2_aggregate_function_set_name)
+	(duckdb_v2_aggregate_function_handle function, const duckdb_v2_identifier_t *name,
+	 duckdb_v2_error_info_handle *err);
+	DUCKDB_V2_ERROR(*duckdb_v2_aggregate_function_set_size_callback)
+	(duckdb_v2_aggregate_function_handle function, duckdb_v2_aggregate_function_size_callback_fn callback,
+	 duckdb_v2_error_info_handle *err);
+	DUCKDB_V2_ERROR(*duckdb_v2_aggregate_function_set_update_callback)
+	(duckdb_v2_aggregate_function_handle function, duckdb_v2_aggregate_function_update_callback_fn callback,
+	 duckdb_v2_error_info_handle *err);
+	DUCKDB_V2_ERROR(*duckdb_v2_aggregate_function_set_user_data)
+	(duckdb_v2_aggregate_function_handle function, duckdb_v2_opaque *data, duckdb_v2_error_info_handle *err);
+	DUCKDB_V2_ERROR(*duckdb_v2_aggregate_function_size_get_bind_data)
+	(duckdb_v2_aggregate_function_size_info_handle info, void **data, duckdb_v2_error_info_handle *err);
+	DUCKDB_V2_ERROR(*duckdb_v2_aggregate_function_size_get_user_data)
+	(duckdb_v2_aggregate_function_size_info_handle info, void **data, duckdb_v2_error_info_handle *err);
+	DUCKDB_V2_ERROR(*duckdb_v2_aggregate_function_size_set_state_size)
+	(duckdb_v2_aggregate_function_size_info_handle info, idx_t size, duckdb_v2_error_info_handle *err);
+	DUCKDB_V2_ERROR(*duckdb_v2_aggregate_function_update_get_arg)
+	(duckdb_v2_aggregate_function_update_info_handle info, idx_t index, duckdb_v2_vector_handle *vector,
+	 duckdb_v2_error_info_handle *err);
+	DUCKDB_V2_ERROR(*duckdb_v2_aggregate_function_update_get_arg_count)
+	(duckdb_v2_aggregate_function_update_info_handle info, idx_t *positional_fixed, idx_t *positional_variadic,
+	 idx_t *named_fixed, idx_t *named_variadic, duckdb_v2_error_info_handle *err);
+	DUCKDB_V2_ERROR(*duckdb_v2_aggregate_function_update_get_bind_data)
+	(duckdb_v2_aggregate_function_update_info_handle info, void **data, duckdb_v2_error_info_handle *err);
+	DUCKDB_V2_ERROR(*duckdb_v2_aggregate_function_update_get_row_count)
+	(duckdb_v2_aggregate_function_update_info_handle info, idx_t *count, duckdb_v2_error_info_handle *err);
+	DUCKDB_V2_ERROR(*duckdb_v2_aggregate_function_update_get_states)
+	(duckdb_v2_aggregate_function_update_info_handle info, void ***states, duckdb_v2_error_info_handle *err);
+	DUCKDB_V2_ERROR(*duckdb_v2_aggregate_function_update_get_user_data)
+	(duckdb_v2_aggregate_function_update_info_handle info, void **data, duckdb_v2_error_info_handle *err);
+	DUCKDB_V2_ERROR(*duckdb_v2_connection_register_aggregate_function)
+	(duckdb_v2_connection_handle conn, duckdb_v2_aggregate_function_handle function, duckdb_v2_error_info_handle *err);
+	DUCKDB_V2_ERROR(*duckdb_v2_extension_register_aggregate_function)
+	(duckdb_v2_extension_handle extension, duckdb_v2_aggregate_function_handle function,
+	 duckdb_v2_error_info_handle *err);
+	DUCKDB_V2_ERROR(*duckdb_v2_aggregate_function_set_property)
+	(duckdb_v2_aggregate_function_handle function, DUCKDB_V2_FUNCTION_PROPERTY_KEY key,
+	 DUCKDB_V2_FUNCTION_PROPERTY_VALUE value, duckdb_v2_error_info_handle *err);
+	DUCKDB_V2_ERROR(*duckdb_v2_scalar_function_set_property)
+	(duckdb_v2_scalar_function_handle function, DUCKDB_V2_FUNCTION_PROPERTY_KEY key,
+	 DUCKDB_V2_FUNCTION_PROPERTY_VALUE value, duckdb_v2_error_info_handle *err);
+	DUCKDB_V2_ERROR(*duckdb_v2_connection_register_table_function)
+	(duckdb_v2_connection_handle conn, duckdb_v2_table_function_handle function, duckdb_v2_error_info_handle *err);
+	DUCKDB_V2_ERROR(*duckdb_v2_extension_register_table_function)
+	(duckdb_v2_extension_handle extension, duckdb_v2_table_function_handle function, duckdb_v2_error_info_handle *err);
+	DUCKDB_V2_ERROR(*duckdb_v2_table_function_bind_add_result_column)
+	(duckdb_v2_table_function_bind_info_handle info, const duckdb_v2_identifier_t *name,
+	 duckdb_v2_logical_type_handle type, duckdb_v2_error_info_handle *err);
+	DUCKDB_V2_ERROR(*duckdb_v2_table_function_bind_set_cardinality)
+	(duckdb_v2_table_function_bind_info_handle info, idx_t cardinality, bool is_exact,
+	 duckdb_v2_error_info_handle *err);
+	DUCKDB_V2_ERROR(*duckdb_v2_table_function_create)
+	(duckdb_v2_factory_handle factory, duckdb_v2_table_function_handle *function, duckdb_v2_error_info_handle *err);
+	DUCKDB_V2_ERROR (*duckdb_v2_table_function_destroy)(duckdb_v2_table_function_handle *function);
+	DUCKDB_V2_ERROR(*duckdb_v2_table_function_exec_get_bind_data)
+	(duckdb_v2_table_function_exec_info_handle info, void **data, duckdb_v2_error_info_handle *err);
+	DUCKDB_V2_ERROR(*duckdb_v2_table_function_exec_get_global_state)
+	(duckdb_v2_table_function_exec_info_handle info, void **data, duckdb_v2_error_info_handle *err);
+	DUCKDB_V2_ERROR(*duckdb_v2_table_function_exec_get_local_state)
+	(duckdb_v2_table_function_exec_info_handle info, void **data, duckdb_v2_error_info_handle *err);
+	DUCKDB_V2_ERROR(*duckdb_v2_table_function_exec_get_output_chunk)
+	(duckdb_v2_table_function_exec_info_handle info, duckdb_v2_data_chunk_handle *chunk,
+	 duckdb_v2_error_info_handle *err);
+	DUCKDB_V2_ERROR(*duckdb_v2_table_function_exec_get_user_data)
+	(duckdb_v2_table_function_exec_info_handle info, void **data, duckdb_v2_error_info_handle *err);
+	DUCKDB_V2_ERROR(*duckdb_v2_table_function_get_signature)
+	(duckdb_v2_table_function_handle function, duckdb_v2_function_signature_handle *sig,
+	 duckdb_v2_error_info_handle *err);
+	DUCKDB_V2_ERROR(*duckdb_v2_table_function_init_global_get_bind_data)
+	(duckdb_v2_table_function_init_global_info_handle info, void **data, duckdb_v2_error_info_handle *err);
+	DUCKDB_V2_ERROR(*duckdb_v2_table_function_init_global_get_user_data)
+	(duckdb_v2_table_function_init_global_info_handle info, void **data, duckdb_v2_error_info_handle *err);
+	DUCKDB_V2_ERROR(*duckdb_v2_table_function_init_global_set_global_state)
+	(duckdb_v2_table_function_init_global_info_handle info, duckdb_v2_opaque *data, duckdb_v2_error_info_handle *err);
+	DUCKDB_V2_ERROR(*duckdb_v2_table_function_init_global_set_max_threads)
+	(duckdb_v2_table_function_init_global_info_handle info, idx_t max_threads, duckdb_v2_error_info_handle *err);
+	DUCKDB_V2_ERROR(*duckdb_v2_table_function_init_local_get_bind_data)
+	(duckdb_v2_table_function_init_local_info_handle info, void **data, duckdb_v2_error_info_handle *err);
+	DUCKDB_V2_ERROR(*duckdb_v2_table_function_init_local_get_global_state)
+	(duckdb_v2_table_function_init_local_info_handle info, void **data, duckdb_v2_error_info_handle *err);
+	DUCKDB_V2_ERROR(*duckdb_v2_table_function_init_local_get_user_data)
+	(duckdb_v2_table_function_init_local_info_handle info, void **data, duckdb_v2_error_info_handle *err);
+	DUCKDB_V2_ERROR(*duckdb_v2_table_function_init_local_set_local_state)
+	(duckdb_v2_table_function_init_local_info_handle info, duckdb_v2_opaque *data, duckdb_v2_error_info_handle *err);
+	DUCKDB_V2_ERROR(*duckdb_v2_table_function_progress_get_bind_data)
+	(duckdb_v2_table_function_progress_info_handle info, void **data, duckdb_v2_error_info_handle *err);
+	DUCKDB_V2_ERROR(*duckdb_v2_table_function_progress_get_global_state)
+	(duckdb_v2_table_function_progress_info_handle info, void **data, duckdb_v2_error_info_handle *err);
+	DUCKDB_V2_ERROR(*duckdb_v2_table_function_progress_get_user_data)
+	(duckdb_v2_table_function_progress_info_handle info, void **data, duckdb_v2_error_info_handle *err);
+	DUCKDB_V2_ERROR(*duckdb_v2_table_function_progress_set_progress)
+	(duckdb_v2_table_function_progress_info_handle info, double progress, duckdb_v2_error_info_handle *err);
+	DUCKDB_V2_ERROR(*duckdb_v2_table_function_set_bind_callback)
+	(duckdb_v2_table_function_handle function, duckdb_v2_table_function_bind_callback_fn callback,
+	 duckdb_v2_error_info_handle *err);
+	DUCKDB_V2_ERROR(*duckdb_v2_table_function_set_exec_callback)
+	(duckdb_v2_table_function_handle function, duckdb_v2_table_function_exec_callback_fn callback,
+	 duckdb_v2_error_info_handle *err);
+	DUCKDB_V2_ERROR(*duckdb_v2_table_function_set_init_global_callback)
+	(duckdb_v2_table_function_handle function, duckdb_v2_table_function_init_global_callback_fn callback,
+	 duckdb_v2_error_info_handle *err);
+	DUCKDB_V2_ERROR(*duckdb_v2_table_function_set_init_local_callback)
+	(duckdb_v2_table_function_handle function, duckdb_v2_table_function_init_local_callback_fn callback,
+	 duckdb_v2_error_info_handle *err);
+	DUCKDB_V2_ERROR(*duckdb_v2_table_function_set_name)
+	(duckdb_v2_table_function_handle function, const duckdb_v2_identifier_t *name, duckdb_v2_error_info_handle *err);
+	DUCKDB_V2_ERROR(*duckdb_v2_table_function_set_progress_callback)
+	(duckdb_v2_table_function_handle function, duckdb_v2_table_function_progress_callback_fn callback,
+	 duckdb_v2_error_info_handle *err);
+	DUCKDB_V2_ERROR(*duckdb_v2_table_function_set_user_data)
+	(duckdb_v2_table_function_handle function, duckdb_v2_opaque *data, duckdb_v2_error_info_handle *err);
+	DUCKDB_V2_ERROR(*duckdb_v2_cast_function_create)
+	(duckdb_v2_factory_handle factory, duckdb_v2_cast_function_handle *function, duckdb_v2_error_info_handle *err);
+	DUCKDB_V2_ERROR (*duckdb_v2_cast_function_destroy)(duckdb_v2_cast_function_handle *function);
+	DUCKDB_V2_ERROR(*duckdb_v2_cast_function_exec_get_input)
+	(duckdb_v2_cast_function_exec_info_handle info, duckdb_v2_vector_handle *vector, duckdb_v2_error_info_handle *err);
+	DUCKDB_V2_ERROR(*duckdb_v2_cast_function_exec_get_mode)
+	(duckdb_v2_cast_function_exec_info_handle info, DUCKDB_V2_CAST_MODE *mode, duckdb_v2_error_info_handle *err);
+	DUCKDB_V2_ERROR(*duckdb_v2_cast_function_exec_get_output)
+	(duckdb_v2_cast_function_exec_info_handle info, duckdb_v2_vector_handle *vector, duckdb_v2_error_info_handle *err);
+	DUCKDB_V2_ERROR(*duckdb_v2_cast_function_exec_get_row_count)
+	(duckdb_v2_cast_function_exec_info_handle info, idx_t *count, duckdb_v2_error_info_handle *err);
+	DUCKDB_V2_ERROR(*duckdb_v2_cast_function_exec_get_user_data)
+	(duckdb_v2_cast_function_exec_info_handle info, void **data, duckdb_v2_error_info_handle *err);
+	DUCKDB_V2_ERROR(*duckdb_v2_cast_function_set_exec_callback)
+	(duckdb_v2_cast_function_handle function, duckdb_v2_cast_function_exec_callback_fn callback,
+	 duckdb_v2_error_info_handle *err);
+	DUCKDB_V2_ERROR(*duckdb_v2_cast_function_set_implicit_cast_cost)
+	(duckdb_v2_cast_function_handle function, int64_t cost, duckdb_v2_error_info_handle *err);
+	DUCKDB_V2_ERROR(*duckdb_v2_cast_function_set_source_type)
+	(duckdb_v2_cast_function_handle function, duckdb_v2_logical_type_handle source_type,
+	 duckdb_v2_error_info_handle *err);
+	DUCKDB_V2_ERROR(*duckdb_v2_cast_function_set_target_type)
+	(duckdb_v2_cast_function_handle function, duckdb_v2_logical_type_handle target_type,
+	 duckdb_v2_error_info_handle *err);
+	DUCKDB_V2_ERROR(*duckdb_v2_cast_function_set_user_data)
+	(duckdb_v2_cast_function_handle function, duckdb_v2_opaque *data, duckdb_v2_error_info_handle *err);
+	DUCKDB_V2_ERROR(*duckdb_v2_column_data_collection_clear)
+	(duckdb_v2_column_data_collection_handle collection, duckdb_v2_error_info_handle *err);
+	DUCKDB_V2_ERROR(*duckdb_v2_connection_register_cast_function)
+	(duckdb_v2_connection_handle conn, duckdb_v2_cast_function_handle function, duckdb_v2_error_info_handle *err);
+	DUCKDB_V2_ERROR(*duckdb_v2_connection_register_custom_type)
+	(duckdb_v2_connection_handle conn, duckdb_v2_custom_type_handle type, duckdb_v2_error_info_handle *err);
+	DUCKDB_V2_ERROR(*duckdb_v2_connection_register_replacement_scan)
+	(duckdb_v2_connection_handle conn, duckdb_v2_replacement_scan_handle scan, duckdb_v2_error_info_handle *err);
+	DUCKDB_V2_ERROR(*duckdb_v2_context_get_file_system)
+	(duckdb_v2_context_handle context, duckdb_v2_file_system_handle *file_system, duckdb_v2_error_info_handle *err);
+	DUCKDB_V2_ERROR(*duckdb_v2_custom_type_create)
+	(duckdb_v2_factory_handle factory, duckdb_v2_custom_type_handle *type, duckdb_v2_error_info_handle *err);
+	DUCKDB_V2_ERROR (*duckdb_v2_custom_type_destroy)(duckdb_v2_custom_type_handle *type);
+	DUCKDB_V2_ERROR(*duckdb_v2_custom_type_set_base_type)
+	(duckdb_v2_custom_type_handle type, duckdb_v2_logical_type_handle base_type, duckdb_v2_error_info_handle *err);
+	DUCKDB_V2_ERROR(*duckdb_v2_custom_type_set_name)
+	(duckdb_v2_custom_type_handle type, const duckdb_v2_identifier_t *name, duckdb_v2_error_info_handle *err);
+	DUCKDB_V2_ERROR(*duckdb_v2_extension_register_cast_function)
+	(duckdb_v2_extension_handle extension, duckdb_v2_cast_function_handle function, duckdb_v2_error_info_handle *err);
+	DUCKDB_V2_ERROR(*duckdb_v2_extension_register_custom_type)
+	(duckdb_v2_extension_handle extension, duckdb_v2_custom_type_handle type, duckdb_v2_error_info_handle *err);
+	DUCKDB_V2_ERROR(*duckdb_v2_extension_register_replacement_scan)
+	(duckdb_v2_extension_handle extension, duckdb_v2_replacement_scan_handle scan, duckdb_v2_error_info_handle *err);
+	DUCKDB_V2_ERROR (*duckdb_v2_file_close)(duckdb_v2_file_handle file, duckdb_v2_error_info_handle *err);
+	DUCKDB_V2_ERROR (*duckdb_v2_file_destroy)(duckdb_v2_file_handle *file);
+	DUCKDB_V2_ERROR(*duckdb_v2_file_open_options_create)
+	(duckdb_v2_file_system_handle file_system, duckdb_v2_file_open_options_handle *options,
+	 duckdb_v2_error_info_handle *err);
+	DUCKDB_V2_ERROR (*duckdb_v2_file_open_options_destroy)(duckdb_v2_file_open_options_handle *options);
+	DUCKDB_V2_ERROR(*duckdb_v2_file_open_options_set_flag)
+	(duckdb_v2_file_open_options_handle options, DUCKDB_V2_FILE_FLAG flag, duckdb_v2_error_info_handle *err);
+	DUCKDB_V2_ERROR(*duckdb_v2_file_open_options_set_value)
+	(duckdb_v2_file_open_options_handle options, const duckdb_v2_str *name, duckdb_v2_value_handle value,
+	 duckdb_v2_error_info_handle *err);
+	DUCKDB_V2_ERROR(*duckdb_v2_file_read)
+	(duckdb_v2_file_handle file, void *buffer, idx_t buffer_size, idx_t *bytes_read, duckdb_v2_error_info_handle *err);
+	DUCKDB_V2_ERROR(*duckdb_v2_file_read_at)
+	(duckdb_v2_file_handle file, void *buffer, idx_t buffer_size, idx_t location, duckdb_v2_error_info_handle *err);
+	DUCKDB_V2_ERROR(*duckdb_v2_file_seek)
+	(duckdb_v2_file_handle file, idx_t position, duckdb_v2_error_info_handle *err);
+	DUCKDB_V2_ERROR (*duckdb_v2_file_size)(duckdb_v2_file_handle file, idx_t *size, duckdb_v2_error_info_handle *err);
+	DUCKDB_V2_ERROR (*duckdb_v2_file_sync)(duckdb_v2_file_handle file, duckdb_v2_error_info_handle *err);
+	DUCKDB_V2_ERROR(*duckdb_v2_file_system_open)
+	(duckdb_v2_file_system_handle file_system, const duckdb_v2_str *file_path,
+	 duckdb_v2_file_open_options_handle options, duckdb_v2_file_handle *file, duckdb_v2_error_info_handle *err);
+	DUCKDB_V2_ERROR(*duckdb_v2_file_tell)
+	(duckdb_v2_file_handle file, idx_t *position, duckdb_v2_error_info_handle *err);
+	DUCKDB_V2_ERROR(*duckdb_v2_file_write)
+	(duckdb_v2_file_handle file, const void *buffer, idx_t buffer_size, idx_t *bytes_written,
+	 duckdb_v2_error_info_handle *err);
+	DUCKDB_V2_ERROR(*duckdb_v2_file_write_at)
+	(duckdb_v2_file_handle file, const void *buffer, idx_t buffer_size, idx_t location,
+	 duckdb_v2_error_info_handle *err);
+	DUCKDB_V2_ERROR(*duckdb_v2_instance_register_replacement_scan)
+	(duckdb_v2_instance_handle instance, duckdb_v2_replacement_scan_handle scan, duckdb_v2_error_info_handle *err);
+	DUCKDB_V2_ERROR(*duckdb_v2_qname_create)
+	(const duckdb_v2_identifier_t *parts, idx_t part_count, duckdb_v2_qname_handle *name,
+	 duckdb_v2_error_info_handle *err);
+	DUCKDB_V2_ERROR (*duckdb_v2_qname_destroy)(duckdb_v2_qname_handle *name);
+	DUCKDB_V2_ERROR(*duckdb_v2_qname_equals)
+	(duckdb_v2_qname_handle left, duckdb_v2_qname_handle right, bool *result, duckdb_v2_error_info_handle *err);
+	DUCKDB_V2_ERROR(*duckdb_v2_qname_get_part)
+	(duckdb_v2_qname_handle name, idx_t index, duckdb_v2_identifier_t *part, duckdb_v2_error_info_handle *err);
+	DUCKDB_V2_ERROR(*duckdb_v2_qname_get_part_count)
+	(duckdb_v2_qname_handle name, idx_t *count, duckdb_v2_error_info_handle *err);
+	DUCKDB_V2_ERROR(*duckdb_v2_qname_hash)
+	(duckdb_v2_qname_handle name, uint64_t *hash, duckdb_v2_error_info_handle *err);
+	DUCKDB_V2_ERROR(*duckdb_v2_qname_parse)
+	(const duckdb_v2_str *text, duckdb_v2_qname_handle *name, duckdb_v2_error_info_handle *err);
+	DUCKDB_V2_ERROR(*duckdb_v2_qname_render)
+	(duckdb_v2_qname_handle name, char *out_text, idx_t out_capacity, idx_t *out_length,
+	 duckdb_v2_error_info_handle *err);
+	DUCKDB_V2_ERROR(*duckdb_v2_replacement_scan_add_argument)
+	(duckdb_v2_replacement_scan_info_handle info, duckdb_v2_value_handle value, duckdb_v2_error_info_handle *err);
+	DUCKDB_V2_ERROR(*duckdb_v2_replacement_scan_add_named_argument)
+	(duckdb_v2_replacement_scan_info_handle info, const duckdb_v2_identifier_t *name, duckdb_v2_value_handle value,
+	 duckdb_v2_error_info_handle *err);
+	DUCKDB_V2_ERROR(*duckdb_v2_replacement_scan_create)
+	(duckdb_v2_factory_handle factory, duckdb_v2_replacement_scan_handle *scan, duckdb_v2_error_info_handle *err);
+	DUCKDB_V2_ERROR (*duckdb_v2_replacement_scan_destroy)(duckdb_v2_replacement_scan_handle *scan);
+	DUCKDB_V2_ERROR(*duckdb_v2_replacement_scan_get_name)
+	(duckdb_v2_replacement_scan_info_handle info, duckdb_v2_qname_handle *name, duckdb_v2_error_info_handle *err);
+	DUCKDB_V2_ERROR(*duckdb_v2_replacement_scan_get_user_data)
+	(duckdb_v2_replacement_scan_info_handle info, void **data, duckdb_v2_error_info_handle *err);
+	DUCKDB_V2_ERROR(*duckdb_v2_replacement_scan_set_alias)
+	(duckdb_v2_replacement_scan_info_handle info, const duckdb_v2_identifier_t *alias,
+	 duckdb_v2_error_info_handle *err);
+	DUCKDB_V2_ERROR(*duckdb_v2_replacement_scan_set_callback)
+	(duckdb_v2_replacement_scan_handle scan, duckdb_v2_replacement_scan_callback_fn callback,
+	 duckdb_v2_error_info_handle *err);
+	DUCKDB_V2_ERROR(*duckdb_v2_replacement_scan_set_collection)
+	(duckdb_v2_replacement_scan_info_handle info, duckdb_v2_column_data_collection_handle collection,
+	 const duckdb_v2_identifier_t *column_names, idx_t column_count, duckdb_v2_error_info_handle *err);
+	DUCKDB_V2_ERROR(*duckdb_v2_replacement_scan_set_function_name)
+	(duckdb_v2_replacement_scan_info_handle info, duckdb_v2_qname_handle name, duckdb_v2_error_info_handle *err);
+	DUCKDB_V2_ERROR(*duckdb_v2_replacement_scan_set_subquery)
+	(duckdb_v2_replacement_scan_info_handle info, const duckdb_v2_str *sql, duckdb_v2_error_info_handle *err);
+	DUCKDB_V2_ERROR(*duckdb_v2_replacement_scan_set_user_data)
+	(duckdb_v2_replacement_scan_handle scan, duckdb_v2_opaque *data, duckdb_v2_error_info_handle *err);
+	DUCKDB_V2_ERROR(*duckdb_v2_arrow_exporter_append)
+	(duckdb_v2_arrow_exporter_handle exporter, duckdb_v2_data_chunk_handle *chunk, bool consume, bool flush,
+	 duckdb_v2_error_info_handle *err);
+	DUCKDB_V2_ERROR(*duckdb_v2_arrow_exporter_create)
+	(duckdb_v2_context_handle context, const duckdb_v2_logical_type_handle *types, const duckdb_v2_str *names,
+	 idx_t count, idx_t batch_size, duckdb_v2_arrow_exporter_handle *out_exporter, duckdb_v2_error_info_handle *err);
+	DUCKDB_V2_ERROR (*duckdb_v2_arrow_exporter_destroy)(duckdb_v2_arrow_exporter_handle *exporter);
+	DUCKDB_V2_ERROR(*duckdb_v2_arrow_exporter_get_schema)
+	(duckdb_v2_arrow_exporter_handle exporter, struct ArrowSchema *out_schema, duckdb_v2_error_info_handle *err);
+	DUCKDB_V2_ERROR(*duckdb_v2_arrow_exporter_next_array)
+	(duckdb_v2_arrow_exporter_handle exporter, struct ArrowArray *out_array, duckdb_v2_error_info_handle *err);
+	DUCKDB_V2_ERROR(*duckdb_v2_arrow_importer_append)
+	(duckdb_v2_arrow_importer_handle importer, struct ArrowArray *array, bool consume, bool flush,
+	 duckdb_v2_error_info_handle *err);
+	DUCKDB_V2_ERROR(*duckdb_v2_arrow_importer_create)
+	(duckdb_v2_context_handle context, struct ArrowSchema *schema, idx_t batch_size,
+	 duckdb_v2_arrow_importer_handle *out_importer, duckdb_v2_error_info_handle *err);
+	DUCKDB_V2_ERROR (*duckdb_v2_arrow_importer_destroy)(duckdb_v2_arrow_importer_handle *importer);
+	DUCKDB_V2_ERROR(*duckdb_v2_arrow_importer_get_schema)
+	(duckdb_v2_arrow_importer_handle importer, duckdb_v2_schema_handle *out_schema, duckdb_v2_error_info_handle *err);
+	DUCKDB_V2_ERROR(*duckdb_v2_arrow_importer_next_chunk)
+	(duckdb_v2_arrow_importer_handle importer, duckdb_v2_data_chunk_handle *out_chunk,
+	 duckdb_v2_error_info_handle *err);
+	DUCKDB_V2_ERROR (*duckdb_v2_column_description_destroy)(duckdb_v2_column_description_handle *column);
+	DUCKDB_V2_ERROR(*duckdb_v2_column_description_get_name)
+	(duckdb_v2_column_description_handle column, duckdb_v2_identifier_t *name, duckdb_v2_error_info_handle *err);
+	DUCKDB_V2_ERROR(*duckdb_v2_column_description_get_type)
+	(duckdb_v2_column_description_handle column, duckdb_v2_logical_type_handle *type, duckdb_v2_error_info_handle *err);
+	DUCKDB_V2_ERROR(*duckdb_v2_column_description_has_default)
+	(duckdb_v2_column_description_handle column, bool *has_default, duckdb_v2_error_info_handle *err);
+	DUCKDB_V2_ERROR(*duckdb_v2_column_description_has_generated)
+	(duckdb_v2_column_description_handle column, bool *has_generated, duckdb_v2_error_info_handle *err);
+	DUCKDB_V2_ERROR(*duckdb_v2_connection_describe_table)
+	(duckdb_v2_connection_handle conn, duckdb_v2_qname_handle name, duckdb_v2_table_description_handle *desc,
+	 duckdb_v2_error_info_handle *err);
+	DUCKDB_V2_ERROR(*duckdb_v2_connection_register_copy_function)
+	(duckdb_v2_connection_handle conn, duckdb_v2_copy_function_handle function, duckdb_v2_error_info_handle *err);
+	DUCKDB_V2_ERROR(*duckdb_v2_copy_from_bind_get_column_count)
+	(duckdb_v2_copy_from_bind_info_handle info, idx_t *count, duckdb_v2_error_info_handle *err);
+	DUCKDB_V2_ERROR(*duckdb_v2_copy_from_bind_get_column_name)
+	(duckdb_v2_copy_from_bind_info_handle info, idx_t index, duckdb_v2_identifier_t *name,
+	 duckdb_v2_error_info_handle *err);
+	DUCKDB_V2_ERROR(*duckdb_v2_copy_from_bind_get_column_type)
+	(duckdb_v2_copy_from_bind_info_handle info, idx_t index, duckdb_v2_logical_type_handle *type,
+	 duckdb_v2_error_info_handle *err);
+	DUCKDB_V2_ERROR(*duckdb_v2_copy_from_bind_get_file_path)
+	(duckdb_v2_copy_from_bind_info_handle info, duckdb_v2_str *path, duckdb_v2_error_info_handle *err);
+	DUCKDB_V2_ERROR(*duckdb_v2_copy_from_bind_get_option_count)
+	(duckdb_v2_copy_from_bind_info_handle info, idx_t *count, duckdb_v2_error_info_handle *err);
+	DUCKDB_V2_ERROR(*duckdb_v2_copy_from_bind_get_option_name)
+	(duckdb_v2_copy_from_bind_info_handle info, idx_t index, duckdb_v2_identifier_t *name,
+	 duckdb_v2_error_info_handle *err);
+	DUCKDB_V2_ERROR(*duckdb_v2_copy_from_bind_get_option_value)
+	(duckdb_v2_copy_from_bind_info_handle info, idx_t index, duckdb_v2_value_handle *value,
+	 duckdb_v2_error_info_handle *err);
+	DUCKDB_V2_ERROR(*duckdb_v2_copy_from_bind_get_user_data)
+	(duckdb_v2_copy_from_bind_info_handle info, void **data, duckdb_v2_error_info_handle *err);
+	DUCKDB_V2_ERROR(*duckdb_v2_copy_from_bind_set_bind_data)
+	(duckdb_v2_copy_from_bind_info_handle info, duckdb_v2_opaque *data, duckdb_v2_error_info_handle *err);
+	DUCKDB_V2_ERROR(*duckdb_v2_copy_from_bind_set_cardinality)
+	(duckdb_v2_copy_from_bind_info_handle info, idx_t cardinality, bool is_exact, duckdb_v2_error_info_handle *err);
+	DUCKDB_V2_ERROR(*duckdb_v2_copy_from_exec_get_bind_data)
+	(duckdb_v2_copy_from_exec_info_handle info, void **data, duckdb_v2_error_info_handle *err);
+	DUCKDB_V2_ERROR(*duckdb_v2_copy_from_exec_get_global_state)
+	(duckdb_v2_copy_from_exec_info_handle info, void **data, duckdb_v2_error_info_handle *err);
+	DUCKDB_V2_ERROR(*duckdb_v2_copy_from_exec_get_local_state)
+	(duckdb_v2_copy_from_exec_info_handle info, void **data, duckdb_v2_error_info_handle *err);
+	DUCKDB_V2_ERROR(*duckdb_v2_copy_from_exec_get_output_chunk)
+	(duckdb_v2_copy_from_exec_info_handle info, duckdb_v2_data_chunk_handle *chunk, duckdb_v2_error_info_handle *err);
+	DUCKDB_V2_ERROR(*duckdb_v2_copy_from_exec_get_user_data)
+	(duckdb_v2_copy_from_exec_info_handle info, void **data, duckdb_v2_error_info_handle *err);
+	DUCKDB_V2_ERROR(*duckdb_v2_copy_from_init_global_get_bind_data)
+	(duckdb_v2_copy_from_init_global_info_handle info, void **data, duckdb_v2_error_info_handle *err);
+	DUCKDB_V2_ERROR(*duckdb_v2_copy_from_init_global_get_user_data)
+	(duckdb_v2_copy_from_init_global_info_handle info, void **data, duckdb_v2_error_info_handle *err);
+	DUCKDB_V2_ERROR(*duckdb_v2_copy_from_init_global_set_global_state)
+	(duckdb_v2_copy_from_init_global_info_handle info, duckdb_v2_opaque *data, duckdb_v2_error_info_handle *err);
+	DUCKDB_V2_ERROR(*duckdb_v2_copy_from_init_global_set_max_threads)
+	(duckdb_v2_copy_from_init_global_info_handle info, idx_t max_threads, duckdb_v2_error_info_handle *err);
+	DUCKDB_V2_ERROR(*duckdb_v2_copy_from_init_local_get_bind_data)
+	(duckdb_v2_copy_from_init_local_info_handle info, void **data, duckdb_v2_error_info_handle *err);
+	DUCKDB_V2_ERROR(*duckdb_v2_copy_from_init_local_get_global_state)
+	(duckdb_v2_copy_from_init_local_info_handle info, void **data, duckdb_v2_error_info_handle *err);
+	DUCKDB_V2_ERROR(*duckdb_v2_copy_from_init_local_get_user_data)
+	(duckdb_v2_copy_from_init_local_info_handle info, void **data, duckdb_v2_error_info_handle *err);
+	DUCKDB_V2_ERROR(*duckdb_v2_copy_from_init_local_set_local_state)
+	(duckdb_v2_copy_from_init_local_info_handle info, duckdb_v2_opaque *data, duckdb_v2_error_info_handle *err);
+	DUCKDB_V2_ERROR(*duckdb_v2_copy_from_progress_get_bind_data)
+	(duckdb_v2_copy_from_progress_info_handle info, void **data, duckdb_v2_error_info_handle *err);
+	DUCKDB_V2_ERROR(*duckdb_v2_copy_from_progress_get_global_state)
+	(duckdb_v2_copy_from_progress_info_handle info, void **data, duckdb_v2_error_info_handle *err);
+	DUCKDB_V2_ERROR(*duckdb_v2_copy_from_progress_get_user_data)
+	(duckdb_v2_copy_from_progress_info_handle info, void **data, duckdb_v2_error_info_handle *err);
+	DUCKDB_V2_ERROR(*duckdb_v2_copy_from_progress_set_progress)
+	(duckdb_v2_copy_from_progress_info_handle info, double progress, duckdb_v2_error_info_handle *err);
+	DUCKDB_V2_ERROR(*duckdb_v2_copy_from_set_bind_callback)
+	(duckdb_v2_copy_function_handle function, duckdb_v2_copy_from_bind_callback_fn callback,
+	 duckdb_v2_error_info_handle *err);
+	DUCKDB_V2_ERROR(*duckdb_v2_copy_from_set_exec_callback)
+	(duckdb_v2_copy_function_handle function, duckdb_v2_copy_from_exec_callback_fn callback,
+	 duckdb_v2_error_info_handle *err);
+	DUCKDB_V2_ERROR(*duckdb_v2_copy_from_set_init_global_callback)
+	(duckdb_v2_copy_function_handle function, duckdb_v2_copy_from_init_global_callback_fn callback,
+	 duckdb_v2_error_info_handle *err);
+	DUCKDB_V2_ERROR(*duckdb_v2_copy_from_set_init_local_callback)
+	(duckdb_v2_copy_function_handle function, duckdb_v2_copy_from_init_local_callback_fn callback,
+	 duckdb_v2_error_info_handle *err);
+	DUCKDB_V2_ERROR(*duckdb_v2_copy_from_set_progress_callback)
+	(duckdb_v2_copy_function_handle function, duckdb_v2_copy_from_progress_callback_fn callback,
+	 duckdb_v2_error_info_handle *err);
+	DUCKDB_V2_ERROR(*duckdb_v2_copy_function_create)
+	(duckdb_v2_factory_handle factory, duckdb_v2_copy_function_handle *function, duckdb_v2_error_info_handle *err);
+	DUCKDB_V2_ERROR (*duckdb_v2_copy_function_destroy)(duckdb_v2_copy_function_handle *function);
+	DUCKDB_V2_ERROR(*duckdb_v2_copy_function_set_name)
+	(duckdb_v2_copy_function_handle function, const duckdb_v2_identifier_t *name, duckdb_v2_error_info_handle *err);
+	DUCKDB_V2_ERROR(*duckdb_v2_copy_function_set_user_data)
+	(duckdb_v2_copy_function_handle function, duckdb_v2_opaque *data, duckdb_v2_error_info_handle *err);
+	DUCKDB_V2_ERROR(*duckdb_v2_copy_to_batch_get_bind_data)
+	(duckdb_v2_copy_to_batch_info_handle info, void **data, duckdb_v2_error_info_handle *err);
+	DUCKDB_V2_ERROR(*duckdb_v2_copy_to_batch_get_init_data)
+	(duckdb_v2_copy_to_batch_info_handle info, void **data, duckdb_v2_error_info_handle *err);
+	DUCKDB_V2_ERROR(*duckdb_v2_copy_to_batch_get_user_data)
+	(duckdb_v2_copy_to_batch_info_handle info, void **data, duckdb_v2_error_info_handle *err);
+	DUCKDB_V2_ERROR(*duckdb_v2_copy_to_batch_set_batch_data)
+	(duckdb_v2_copy_to_batch_info_handle info, duckdb_v2_opaque *data, duckdb_v2_error_info_handle *err);
+	DUCKDB_V2_ERROR(*duckdb_v2_copy_to_batch_size_get_bind_data)
+	(duckdb_v2_copy_to_batch_size_info_handle info, void **data, duckdb_v2_error_info_handle *err);
+	DUCKDB_V2_ERROR(*duckdb_v2_copy_to_batch_size_get_user_data)
+	(duckdb_v2_copy_to_batch_size_info_handle info, void **data, duckdb_v2_error_info_handle *err);
+	DUCKDB_V2_ERROR(*duckdb_v2_copy_to_batch_size_set_target)
+	(duckdb_v2_copy_to_batch_size_info_handle info, idx_t rows, duckdb_v2_error_info_handle *err);
+	DUCKDB_V2_ERROR(*duckdb_v2_copy_to_batch_take_input)
+	(duckdb_v2_copy_to_batch_info_handle info, duckdb_v2_column_data_collection_handle *collection,
+	 duckdb_v2_error_info_handle *err);
+	DUCKDB_V2_ERROR(*duckdb_v2_copy_to_bind_get_column_count)
+	(duckdb_v2_copy_to_bind_info_handle info, idx_t *count, duckdb_v2_error_info_handle *err);
+	DUCKDB_V2_ERROR(*duckdb_v2_copy_to_bind_get_column_name)
+	(duckdb_v2_copy_to_bind_info_handle info, idx_t index, duckdb_v2_identifier_t *name,
+	 duckdb_v2_error_info_handle *err);
+	DUCKDB_V2_ERROR(*duckdb_v2_copy_to_bind_get_column_type)
+	(duckdb_v2_copy_to_bind_info_handle info, idx_t index, duckdb_v2_logical_type_handle *type,
+	 duckdb_v2_error_info_handle *err);
+	DUCKDB_V2_ERROR(*duckdb_v2_copy_to_bind_get_file_path)
+	(duckdb_v2_copy_to_bind_info_handle info, duckdb_v2_str *path, duckdb_v2_error_info_handle *err);
+	DUCKDB_V2_ERROR(*duckdb_v2_copy_to_bind_get_option_count)
+	(duckdb_v2_copy_to_bind_info_handle info, idx_t *count, duckdb_v2_error_info_handle *err);
+	DUCKDB_V2_ERROR(*duckdb_v2_copy_to_bind_get_option_name)
+	(duckdb_v2_copy_to_bind_info_handle info, idx_t index, duckdb_v2_identifier_t *name,
+	 duckdb_v2_error_info_handle *err);
+	DUCKDB_V2_ERROR(*duckdb_v2_copy_to_bind_get_option_value)
+	(duckdb_v2_copy_to_bind_info_handle info, idx_t index, duckdb_v2_value_handle *value,
+	 duckdb_v2_error_info_handle *err);
+	DUCKDB_V2_ERROR(*duckdb_v2_copy_to_bind_get_user_data)
+	(duckdb_v2_copy_to_bind_info_handle info, void **data, duckdb_v2_error_info_handle *err);
+	DUCKDB_V2_ERROR(*duckdb_v2_copy_to_bind_set_bind_data)
+	(duckdb_v2_copy_to_bind_info_handle info, duckdb_v2_opaque *data, duckdb_v2_error_info_handle *err);
+	DUCKDB_V2_ERROR(*duckdb_v2_copy_to_finalize_get_bind_data)
+	(duckdb_v2_copy_to_finalize_info_handle info, void **data, duckdb_v2_error_info_handle *err);
+	DUCKDB_V2_ERROR(*duckdb_v2_copy_to_finalize_get_init_data)
+	(duckdb_v2_copy_to_finalize_info_handle info, void **data, duckdb_v2_error_info_handle *err);
+	DUCKDB_V2_ERROR(*duckdb_v2_copy_to_finalize_get_user_data)
+	(duckdb_v2_copy_to_finalize_info_handle info, void **data, duckdb_v2_error_info_handle *err);
+	DUCKDB_V2_ERROR(*duckdb_v2_copy_to_flush_get_batch_data)
+	(duckdb_v2_copy_to_flush_info_handle info, void **data, duckdb_v2_error_info_handle *err);
+	DUCKDB_V2_ERROR(*duckdb_v2_copy_to_flush_get_bind_data)
+	(duckdb_v2_copy_to_flush_info_handle info, void **data, duckdb_v2_error_info_handle *err);
+	DUCKDB_V2_ERROR(*duckdb_v2_copy_to_flush_get_init_data)
+	(duckdb_v2_copy_to_flush_info_handle info, void **data, duckdb_v2_error_info_handle *err);
+	DUCKDB_V2_ERROR(*duckdb_v2_copy_to_flush_get_user_data)
+	(duckdb_v2_copy_to_flush_info_handle info, void **data, duckdb_v2_error_info_handle *err);
+	DUCKDB_V2_ERROR(*duckdb_v2_copy_to_init_get_bind_data)
+	(duckdb_v2_copy_to_init_info_handle info, void **data, duckdb_v2_error_info_handle *err);
+	DUCKDB_V2_ERROR(*duckdb_v2_copy_to_init_get_file_path)
+	(duckdb_v2_copy_to_init_info_handle info, duckdb_v2_str *path, duckdb_v2_error_info_handle *err);
+	DUCKDB_V2_ERROR(*duckdb_v2_copy_to_init_get_user_data)
+	(duckdb_v2_copy_to_init_info_handle info, void **data, duckdb_v2_error_info_handle *err);
+	DUCKDB_V2_ERROR(*duckdb_v2_copy_to_init_set_init_data)
+	(duckdb_v2_copy_to_init_info_handle info, duckdb_v2_opaque *data, duckdb_v2_error_info_handle *err);
+	DUCKDB_V2_ERROR(*duckdb_v2_copy_to_set_batch_callback)
+	(duckdb_v2_copy_function_handle function, duckdb_v2_copy_to_batch_callback_fn callback,
+	 duckdb_v2_error_info_handle *err);
+	DUCKDB_V2_ERROR(*duckdb_v2_copy_to_set_batch_size_callback)
+	(duckdb_v2_copy_function_handle function, duckdb_v2_copy_to_batch_size_callback_fn callback,
+	 duckdb_v2_error_info_handle *err);
+	DUCKDB_V2_ERROR(*duckdb_v2_copy_to_set_bind_callback)
+	(duckdb_v2_copy_function_handle function, duckdb_v2_copy_to_bind_callback_fn callback,
+	 duckdb_v2_error_info_handle *err);
+	DUCKDB_V2_ERROR(*duckdb_v2_copy_to_set_finalize_callback)
+	(duckdb_v2_copy_function_handle function, duckdb_v2_copy_to_finalize_callback_fn callback,
+	 duckdb_v2_error_info_handle *err);
+	DUCKDB_V2_ERROR(*duckdb_v2_copy_to_set_flush_callback)
+	(duckdb_v2_copy_function_handle function, duckdb_v2_copy_to_flush_callback_fn callback,
+	 duckdb_v2_error_info_handle *err);
+	DUCKDB_V2_ERROR(*duckdb_v2_copy_to_set_init_callback)
+	(duckdb_v2_copy_function_handle function, duckdb_v2_copy_to_init_callback_fn callback,
+	 duckdb_v2_error_info_handle *err);
+	DUCKDB_V2_ERROR(*duckdb_v2_expression_cast_get_mode)
+	(duckdb_v2_expression_handle expression, DUCKDB_V2_CAST_MODE *mode, duckdb_v2_error_info_handle *err);
+	DUCKDB_V2_ERROR(*duckdb_v2_expression_column_ref_get_index)
+	(duckdb_v2_expression_handle expression, idx_t *index, duckdb_v2_error_info_handle *err);
+	DUCKDB_V2_ERROR(*duckdb_v2_expression_constant_get_value)
+	(duckdb_v2_expression_handle expression, duckdb_v2_value_handle *value, duckdb_v2_error_info_handle *err);
+	DUCKDB_V2_ERROR(*duckdb_v2_expression_function_get_name)
+	(duckdb_v2_expression_handle expression, duckdb_v2_identifier_t *name, duckdb_v2_error_info_handle *err);
+	DUCKDB_V2_ERROR(*duckdb_v2_expression_function_get_qname)
+	(duckdb_v2_expression_handle expression, duckdb_v2_qname_handle *name, duckdb_v2_error_info_handle *err);
+	DUCKDB_V2_ERROR(*duckdb_v2_expression_get_child)
+	(duckdb_v2_expression_handle expression, idx_t index, duckdb_v2_expression_handle *child,
+	 duckdb_v2_error_info_handle *err);
+	DUCKDB_V2_ERROR(*duckdb_v2_expression_get_child_count)
+	(duckdb_v2_expression_handle expression, idx_t *count, duckdb_v2_error_info_handle *err);
+	DUCKDB_V2_ERROR(*duckdb_v2_expression_get_return_type)
+	(duckdb_v2_expression_handle expression, duckdb_v2_logical_type_handle *type, duckdb_v2_error_info_handle *err);
+	DUCKDB_V2_ERROR(*duckdb_v2_expression_get_type)
+	(duckdb_v2_expression_handle expression, DUCKDB_V2_EXPRESSION_TYPE *type, duckdb_v2_error_info_handle *err);
+	DUCKDB_V2_ERROR(*duckdb_v2_extension_register_copy_function)
+	(duckdb_v2_extension_handle extension, duckdb_v2_copy_function_handle function, duckdb_v2_error_info_handle *err);
+	DUCKDB_V2_ERROR(*duckdb_v2_identifier_render_quoted)
+	(const duckdb_v2_identifier_t *name, char *out_text, idx_t out_capacity, idx_t *out_length,
+	 duckdb_v2_error_info_handle *err);
+	DUCKDB_V2_ERROR(*duckdb_v2_prepared_statement_create)
+	(duckdb_v2_connection_handle conn, duckdb_v2_sql_statement_handle statement, bool require_cacheable,
+	 duckdb_v2_prepared_statement_handle *out_prepared, duckdb_v2_error_info_handle *err);
+	DUCKDB_V2_ERROR (*duckdb_v2_prepared_statement_destroy)(duckdb_v2_prepared_statement_handle *prepared);
+	DUCKDB_V2_ERROR(*duckdb_v2_prepared_statement_execute)
+	(duckdb_v2_prepared_statement_handle prepared, const duckdb_v2_identifier_t *parameter_names,
+	 const duckdb_v2_value_handle *parameter_values, idx_t parameter_count, duckdb_v2_result_handle *out_result,
+	 duckdb_v2_error_info_handle *err);
+	DUCKDB_V2_ERROR(*duckdb_v2_prepared_statement_reuses_plan)
+	(duckdb_v2_prepared_statement_handle prepared, bool *out_reuses, duckdb_v2_error_info_handle *err);
+	DUCKDB_V2_ERROR (*duckdb_v2_table_description_destroy)(duckdb_v2_table_description_handle *desc);
+	DUCKDB_V2_ERROR(*duckdb_v2_table_description_get_column)
+	(duckdb_v2_table_description_handle desc, idx_t index, duckdb_v2_column_description_handle *column,
+	 duckdb_v2_error_info_handle *err);
+	DUCKDB_V2_ERROR(*duckdb_v2_table_description_get_column_count)
+	(duckdb_v2_table_description_handle desc, idx_t *count, duckdb_v2_error_info_handle *err);
+	DUCKDB_V2_ERROR(*duckdb_v2_table_description_get_qname)
+	(duckdb_v2_table_description_handle desc, duckdb_v2_qname_handle *name, duckdb_v2_error_info_handle *err);
+	DUCKDB_V2_ERROR(*duckdb_v2_table_description_is_readonly)
+	(duckdb_v2_table_description_handle desc, bool *readonly, duckdb_v2_error_info_handle *err);
+	DUCKDB_V2_ERROR(*duckdb_v2_table_function_exec_get_column_count)
+	(duckdb_v2_table_function_exec_info_handle info, idx_t *count, duckdb_v2_error_info_handle *err);
+	DUCKDB_V2_ERROR(*duckdb_v2_table_function_exec_get_column_index)
+	(duckdb_v2_table_function_exec_info_handle info, idx_t index, idx_t *column_index,
+	 duckdb_v2_error_info_handle *err);
+	DUCKDB_V2_ERROR(*duckdb_v2_table_function_filter_pushdown_accept)
+	(duckdb_v2_table_function_filter_pushdown_info_handle info, idx_t index, duckdb_v2_error_info_handle *err);
+	DUCKDB_V2_ERROR(*duckdb_v2_table_function_filter_pushdown_get_bind_data)
+	(duckdb_v2_table_function_filter_pushdown_info_handle info, void **data, duckdb_v2_error_info_handle *err);
+	DUCKDB_V2_ERROR(*duckdb_v2_table_function_filter_pushdown_get_column_count)
+	(duckdb_v2_table_function_filter_pushdown_info_handle info, idx_t *count, duckdb_v2_error_info_handle *err);
+	DUCKDB_V2_ERROR(*duckdb_v2_table_function_filter_pushdown_get_column_index)
+	(duckdb_v2_table_function_filter_pushdown_info_handle info, idx_t index, idx_t *column_index,
+	 duckdb_v2_error_info_handle *err);
+	DUCKDB_V2_ERROR(*duckdb_v2_table_function_filter_pushdown_get_filter)
+	(duckdb_v2_table_function_filter_pushdown_info_handle info, idx_t index, duckdb_v2_expression_handle *filter,
+	 duckdb_v2_error_info_handle *err);
+	DUCKDB_V2_ERROR(*duckdb_v2_table_function_filter_pushdown_get_filter_count)
+	(duckdb_v2_table_function_filter_pushdown_info_handle info, idx_t *count, duckdb_v2_error_info_handle *err);
+	DUCKDB_V2_ERROR(*duckdb_v2_table_function_filter_pushdown_get_user_data)
+	(duckdb_v2_table_function_filter_pushdown_info_handle info, void **data, duckdb_v2_error_info_handle *err);
+	DUCKDB_V2_ERROR(*duckdb_v2_table_function_init_global_get_column_count)
+	(duckdb_v2_table_function_init_global_info_handle info, idx_t *count, duckdb_v2_error_info_handle *err);
+	DUCKDB_V2_ERROR(*duckdb_v2_table_function_init_global_get_column_index)
+	(duckdb_v2_table_function_init_global_info_handle info, idx_t index, idx_t *column_index,
+	 duckdb_v2_error_info_handle *err);
+	DUCKDB_V2_ERROR(*duckdb_v2_table_function_init_local_get_column_count)
+	(duckdb_v2_table_function_init_local_info_handle info, idx_t *count, duckdb_v2_error_info_handle *err);
+	DUCKDB_V2_ERROR(*duckdb_v2_table_function_init_local_get_column_index)
+	(duckdb_v2_table_function_init_local_info_handle info, idx_t index, idx_t *column_index,
+	 duckdb_v2_error_info_handle *err);
+	DUCKDB_V2_ERROR(*duckdb_v2_table_function_set_filter_pushdown_callback)
+	(duckdb_v2_table_function_handle function, duckdb_v2_table_function_filter_pushdown_callback_fn callback,
+	 duckdb_v2_error_info_handle *err);
+	DUCKDB_V2_ERROR(*duckdb_v2_table_function_set_projection_pushdown)
+	(duckdb_v2_table_function_handle function, bool enable, duckdb_v2_error_info_handle *err);
+	DUCKDB_V2_ERROR(*duckdb_v2_sql_statement_get_parameter_count)
+	(duckdb_v2_sql_statement_handle statement, idx_t *out_count, duckdb_v2_error_info_handle *err);
+	DUCKDB_V2_ERROR(*duckdb_v2_sql_statement_get_parameter_name)
+	(duckdb_v2_sql_statement_handle statement, idx_t index, duckdb_v2_identifier_t *out_name,
+	 duckdb_v2_error_info_handle *err);
+	DUCKDB_V2_ERROR(*duckdb_v2_sql_statement_get_text)
+	(duckdb_v2_sql_statement_handle statement, duckdb_v2_str *out_text, duckdb_v2_error_info_handle *err);
+	DUCKDB_V2_ERROR(*duckdb_v2_sql_statement_get_type)
+	(duckdb_v2_sql_statement_handle statement, DUCKDB_V2_STATEMENT_TYPE *out_type, duckdb_v2_error_info_handle *err);
+	DUCKDB_V2_ERROR (*duckdb_v2_token_iterator_destroy)(duckdb_v2_token_iterator_handle *iterator);
+	DUCKDB_V2_ERROR(*duckdb_v2_token_iterator_ends_unterminated)
+	(duckdb_v2_token_iterator_handle iterator, bool *out_ends_unterminated, duckdb_v2_error_info_handle *err);
+	DUCKDB_V2_ERROR(*duckdb_v2_token_iterator_next)
+	(duckdb_v2_token_iterator_handle iterator, DUCKDB_V2_TOKEN_TYPE *out_type, idx_t *out_start, idx_t *out_length,
+	 duckdb_v2_error_info_handle *err);
+	DUCKDB_V2_ERROR(*duckdb_v2_tokenize_sql)
+	(duckdb_v2_connection_handle conn, const duckdb_v2_str *sql, duckdb_v2_token_iterator_handle *out_iterator,
+	 duckdb_v2_error_info_handle *err);
+	DUCKDB_V2_ERROR(*duckdb_v2_attach_options_create)
+	(duckdb_v2_instance_handle instance, duckdb_v2_attach_options_handle *out_options,
+	 duckdb_v2_error_info_handle *err);
+	DUCKDB_V2_ERROR (*duckdb_v2_attach_options_destroy)(duckdb_v2_attach_options_handle *options);
+	DUCKDB_V2_ERROR(*duckdb_v2_attach_options_set)
+	(duckdb_v2_attach_options_handle options, const duckdb_v2_identifier_t *key, const duckdb_v2_str *setting,
+	 duckdb_v2_error_info_handle *err);
+	DUCKDB_V2_ERROR(*duckdb_v2_instance_set_default)
+	(duckdb_v2_instance_handle instance, const duckdb_v2_identifier_t *name, duckdb_v2_error_info_handle *err);
+	DUCKDB_V2_ERROR(*duckdb_v2_table_function_partition_data_get_bind_data)
+	(duckdb_v2_table_function_partition_data_info_handle info, void **data, duckdb_v2_error_info_handle *err);
+	DUCKDB_V2_ERROR(*duckdb_v2_table_function_partition_data_get_global_state)
+	(duckdb_v2_table_function_partition_data_info_handle info, void **data, duckdb_v2_error_info_handle *err);
+	DUCKDB_V2_ERROR(*duckdb_v2_table_function_partition_data_get_local_state)
+	(duckdb_v2_table_function_partition_data_info_handle info, void **data, duckdb_v2_error_info_handle *err);
+	DUCKDB_V2_ERROR(*duckdb_v2_table_function_partition_data_get_partition_column_count)
+	(duckdb_v2_table_function_partition_data_info_handle info, idx_t *count, duckdb_v2_error_info_handle *err);
+	DUCKDB_V2_ERROR(*duckdb_v2_table_function_partition_data_get_partition_column_index)
+	(duckdb_v2_table_function_partition_data_info_handle info, idx_t index, idx_t *column_index,
+	 duckdb_v2_error_info_handle *err);
+	DUCKDB_V2_ERROR(*duckdb_v2_table_function_partition_data_get_user_data)
+	(duckdb_v2_table_function_partition_data_info_handle info, void **data, duckdb_v2_error_info_handle *err);
+	DUCKDB_V2_ERROR(*duckdb_v2_table_function_partition_data_requires_batch_index)
+	(duckdb_v2_table_function_partition_data_info_handle info, bool *required, duckdb_v2_error_info_handle *err);
+	DUCKDB_V2_ERROR(*duckdb_v2_table_function_partition_data_requires_partition_columns)
+	(duckdb_v2_table_function_partition_data_info_handle info, bool *required, duckdb_v2_error_info_handle *err);
+	DUCKDB_V2_ERROR(*duckdb_v2_table_function_partition_data_set_batch_index)
+	(duckdb_v2_table_function_partition_data_info_handle info, idx_t batch_index, duckdb_v2_error_info_handle *err);
+	DUCKDB_V2_ERROR(*duckdb_v2_table_function_partition_data_set_partition_value)
+	(duckdb_v2_table_function_partition_data_info_handle info, idx_t index, duckdb_v2_value_handle value,
+	 duckdb_v2_error_info_handle *err);
+	DUCKDB_V2_ERROR(*duckdb_v2_table_function_partitioning_get_bind_data)
+	(duckdb_v2_table_function_partitioning_info_handle info, void **data, duckdb_v2_error_info_handle *err);
+	DUCKDB_V2_ERROR(*duckdb_v2_table_function_partitioning_get_partition_column_count)
+	(duckdb_v2_table_function_partitioning_info_handle info, idx_t *count, duckdb_v2_error_info_handle *err);
+	DUCKDB_V2_ERROR(*duckdb_v2_table_function_partitioning_get_partition_column_index)
+	(duckdb_v2_table_function_partitioning_info_handle info, idx_t index, idx_t *column_index,
+	 duckdb_v2_error_info_handle *err);
+	DUCKDB_V2_ERROR(*duckdb_v2_table_function_partitioning_get_user_data)
+	(duckdb_v2_table_function_partitioning_info_handle info, void **data, duckdb_v2_error_info_handle *err);
+	DUCKDB_V2_ERROR(*duckdb_v2_table_function_partitioning_set_partition_info)
+	(duckdb_v2_table_function_partitioning_info_handle info, DUCKDB_V2_TABLE_PARTITION_INFO partition_info,
+	 duckdb_v2_error_info_handle *err);
+	DUCKDB_V2_ERROR(*duckdb_v2_table_function_set_partition_data_callback)
+	(duckdb_v2_table_function_handle function, duckdb_v2_table_function_partition_data_callback_fn callback,
+	 duckdb_v2_error_info_handle *err);
+	DUCKDB_V2_ERROR(*duckdb_v2_table_function_set_partitioning_callback)
+	(duckdb_v2_table_function_handle function, duckdb_v2_table_function_partitioning_callback_fn callback,
+	 duckdb_v2_error_info_handle *err);
+	DUCKDB_V2_ERROR (*duckdb_v2_validate_utf8)(const duckdb_v2_str *text, duckdb_v2_error_info_handle *err);
+	DUCKDB_V2_ERROR(*duckdb_v2_connection_register_multi_file_function)
+	(duckdb_v2_connection_handle conn, duckdb_v2_multi_file_function_handle function, duckdb_v2_error_info_handle *err);
+	DUCKDB_V2_ERROR(*duckdb_v2_copy_to_set_statistics_callback)
+	(duckdb_v2_copy_function_handle function, duckdb_v2_copy_to_statistics_callback_fn callback,
+	 duckdb_v2_error_info_handle *err);
+	DUCKDB_V2_ERROR(*duckdb_v2_copy_to_statistics_get_bind_data)
+	(duckdb_v2_copy_to_statistics_info_handle info, void **data, duckdb_v2_error_info_handle *err);
+	DUCKDB_V2_ERROR(*duckdb_v2_copy_to_statistics_get_init_data)
+	(duckdb_v2_copy_to_statistics_info_handle info, void **data, duckdb_v2_error_info_handle *err);
+	DUCKDB_V2_ERROR(*duckdb_v2_copy_to_statistics_get_user_data)
+	(duckdb_v2_copy_to_statistics_info_handle info, void **data, duckdb_v2_error_info_handle *err);
+	DUCKDB_V2_ERROR(*duckdb_v2_copy_to_statistics_set_file_size)
+	(duckdb_v2_copy_to_statistics_info_handle info, idx_t file_size_bytes, duckdb_v2_error_info_handle *err);
+	DUCKDB_V2_ERROR(*duckdb_v2_copy_to_statistics_set_row_count)
+	(duckdb_v2_copy_to_statistics_info_handle info, idx_t row_count, duckdb_v2_error_info_handle *err);
+	DUCKDB_V2_ERROR(*duckdb_v2_data_chunk_get_capacity)
+	(duckdb_v2_data_chunk_handle chunk, idx_t *out_capacity, duckdb_v2_error_info_handle *err);
+	DUCKDB_V2_ERROR(*duckdb_v2_extension_register_multi_file_function)
+	(duckdb_v2_extension_handle extension, duckdb_v2_multi_file_function_handle function,
+	 duckdb_v2_error_info_handle *err);
+	DUCKDB_V2_ERROR(*duckdb_v2_multi_file_function_create)
+	(duckdb_v2_factory_handle factory, duckdb_v2_multi_file_function_handle *function,
+	 duckdb_v2_error_info_handle *err);
+	DUCKDB_V2_ERROR (*duckdb_v2_multi_file_function_destroy)(duckdb_v2_multi_file_function_handle *function);
+	DUCKDB_V2_ERROR(*duckdb_v2_multi_file_function_set_file_extension)
+	(duckdb_v2_multi_file_function_handle function, duckdb_v2_str *extension, duckdb_v2_error_info_handle *err);
+	DUCKDB_V2_ERROR(*duckdb_v2_multi_file_function_set_name)
+	(duckdb_v2_multi_file_function_handle function, duckdb_v2_str *name, duckdb_v2_error_info_handle *err);
+	DUCKDB_V2_ERROR(*duckdb_v2_multi_file_function_set_reader_type)
+	(duckdb_v2_multi_file_function_handle function, duckdb_v2_str *reader_type, duckdb_v2_error_info_handle *err);
+	DUCKDB_V2_ERROR(*duckdb_v2_multi_file_function_set_single_file_function)
+	(duckdb_v2_multi_file_function_handle function, duckdb_v2_str *name, duckdb_v2_error_info_handle *err);
+	DUCKDB_V2_ERROR(*duckdb_v2_table_function_claim_batch_get_bind_data)
+	(duckdb_v2_table_function_claim_batch_info_handle info, void **data, duckdb_v2_error_info_handle *err);
+	DUCKDB_V2_ERROR(*duckdb_v2_table_function_claim_batch_get_global_state)
+	(duckdb_v2_table_function_claim_batch_info_handle info, void **data, duckdb_v2_error_info_handle *err);
+	DUCKDB_V2_ERROR(*duckdb_v2_table_function_claim_batch_get_local_state)
+	(duckdb_v2_table_function_claim_batch_info_handle info, void **data, duckdb_v2_error_info_handle *err);
+	DUCKDB_V2_ERROR(*duckdb_v2_table_function_claim_batch_get_user_data)
+	(duckdb_v2_table_function_claim_batch_info_handle info, void **data, duckdb_v2_error_info_handle *err);
+	DUCKDB_V2_ERROR(*duckdb_v2_table_function_claim_batch_set_claimed)
+	(duckdb_v2_table_function_claim_batch_info_handle info, bool claimed, duckdb_v2_error_info_handle *err);
+	DUCKDB_V2_ERROR(*duckdb_v2_table_function_set_claim_batch_callback)
+	(duckdb_v2_table_function_handle function, duckdb_v2_table_function_claim_batch_callback_fn callback,
+	 duckdb_v2_error_info_handle *err);
+	DUCKDB_V2_ERROR(*duckdb_v2_function_bind_get_arg_count)
+	(duckdb_v2_function_bind_info_handle info, idx_t *positional_fixed, idx_t *positional_variadic, idx_t *named_fixed,
+	 idx_t *named_variadic, duckdb_v2_error_info_handle *err);
+	DUCKDB_V2_ERROR(*duckdb_v2_function_bind_get_arg_index)
+	(duckdb_v2_function_bind_info_handle info, const duckdb_v2_identifier_t *name, idx_t *index, bool *found,
+	 duckdb_v2_error_info_handle *err);
+	DUCKDB_V2_ERROR(*duckdb_v2_function_bind_get_arg_name)
+	(duckdb_v2_function_bind_info_handle info, idx_t index, duckdb_v2_identifier_t *name,
+	 duckdb_v2_error_info_handle *err);
+	DUCKDB_V2_ERROR(*duckdb_v2_function_bind_get_arg_type)
+	(duckdb_v2_function_bind_info_handle info, idx_t index, duckdb_v2_logical_type_handle *type,
+	 duckdb_v2_error_info_handle *err);
+	DUCKDB_V2_ERROR(*duckdb_v2_function_bind_get_arg_value)
+	(duckdb_v2_function_bind_info_handle info, idx_t index, duckdb_v2_value_handle *value,
+	 duckdb_v2_error_info_handle *err);
+	DUCKDB_V2_ERROR(*duckdb_v2_function_bind_get_user_data)
+	(duckdb_v2_function_bind_info_handle info, void **data, duckdb_v2_error_info_handle *err);
+	DUCKDB_V2_ERROR(*duckdb_v2_function_bind_set_bind_data)
+	(duckdb_v2_function_bind_info_handle info, duckdb_v2_opaque *data, duckdb_v2_error_info_handle *err);
+	DUCKDB_V2_ERROR(*duckdb_v2_table_function_bind_set_order_preservation)
+	(duckdb_v2_table_function_bind_info_handle info, DUCKDB_V2_ORDER_PRESERVATION order,
+	 duckdb_v2_error_info_handle *err);
+	DUCKDB_V2_ERROR (*duckdb_v2_arrow_result_destroy)(duckdb_v2_arrow_result_handle *result);
+	DUCKDB_V2_ERROR(*duckdb_v2_arrow_result_drain)
+	(duckdb_v2_arrow_result_handle result, idx_t *out_rows_changed, duckdb_v2_error_info_handle *err);
+	DUCKDB_V2_ERROR(*duckdb_v2_arrow_result_fetch_array)
+	(duckdb_v2_arrow_result_handle result, struct ArrowArray *out_array, duckdb_v2_error_info_handle *err);
+	DUCKDB_V2_ERROR(*duckdb_v2_arrow_result_get_result_type)
+	(duckdb_v2_arrow_result_handle result, DUCKDB_V2_RESULT_TYPE *out_type, duckdb_v2_error_info_handle *err);
+	DUCKDB_V2_ERROR(*duckdb_v2_arrow_result_get_schema)
+	(duckdb_v2_arrow_result_handle result, struct ArrowSchema *out_schema, duckdb_v2_error_info_handle *err);
+	DUCKDB_V2_ERROR(*duckdb_v2_arrow_result_get_statement_type)
+	(duckdb_v2_arrow_result_handle result, DUCKDB_V2_STATEMENT_TYPE *out_type, duckdb_v2_error_info_handle *err);
+	DUCKDB_V2_ERROR(*duckdb_v2_arrow_result_step)
+	(duckdb_v2_arrow_result_handle result, struct ArrowArray *out_array, DUCKDB_V2_RESULT_STEP_STATUS *out_status,
+	 duckdb_v2_error_info_handle *err);
+	DUCKDB_V2_ERROR(*duckdb_v2_arrow_result_to_arrow_c_stream)
+	(duckdb_v2_arrow_result_handle *result, struct ArrowArrayStream *out_stream, duckdb_v2_error_info_handle *err);
+	DUCKDB_V2_ERROR(*duckdb_v2_arrow_result_wait)
+	(duckdb_v2_arrow_result_handle result, duckdb_v2_error_info_handle *err);
+	DUCKDB_V2_ERROR(*duckdb_v2_prepared_statement_execute_arrow)
+	(duckdb_v2_prepared_statement_handle prepared, const duckdb_v2_identifier_t *parameter_names,
+	 const duckdb_v2_value_handle *parameter_values, idx_t parameter_count, idx_t batch_size,
+	 duckdb_v2_arrow_result_handle *out_result, duckdb_v2_error_info_handle *err);
+	DUCKDB_V2_ERROR(*duckdb_v2_statement_execute_arrow)
+	(duckdb_v2_connection_handle conn, duckdb_v2_sql_statement_handle statement,
+	 const duckdb_v2_identifier_t *parameter_names, const duckdb_v2_value_handle *parameter_values,
+	 idx_t parameter_count, idx_t batch_size, duckdb_v2_arrow_result_handle *out_result,
+	 duckdb_v2_error_info_handle *err);
+	DUCKDB_V2_ERROR(*duckdb_v2_scalar_function_resolve_types_set_return_type)
+	(duckdb_v2_scalar_function_resolve_types_info_handle info, duckdb_v2_logical_type_handle return_type,
+	 duckdb_v2_error_info_handle *err);
+	DUCKDB_V2_ERROR(*duckdb_v2_scalar_function_set_resolve_types_callback)
+	(duckdb_v2_scalar_function_handle function, duckdb_v2_scalar_function_resolve_types_callback_fn callback,
+	 duckdb_v2_error_info_handle *err);
+	DUCKDB_V2_ERROR(*duckdb_v2_table_function_get_bind_info_get_bind_data)
+	(duckdb_v2_table_function_get_bind_info_info_handle info, void **data, duckdb_v2_error_info_handle *err);
+	DUCKDB_V2_ERROR(*duckdb_v2_table_function_get_bind_info_get_user_data)
+	(duckdb_v2_table_function_get_bind_info_info_handle info, void **data, duckdb_v2_error_info_handle *err);
+	DUCKDB_V2_ERROR(*duckdb_v2_table_function_get_bind_info_set_column_identifier)
+	(duckdb_v2_table_function_get_bind_info_info_handle info, idx_t column_index, const idx_t *child_path,
+	 idx_t child_path_length, duckdb_v2_value_handle identifier, duckdb_v2_error_info_handle *err);
+	DUCKDB_V2_ERROR(*duckdb_v2_table_function_get_bind_info_set_option)
+	(duckdb_v2_table_function_get_bind_info_info_handle info, duckdb_v2_str *key, duckdb_v2_value_handle value,
+	 duckdb_v2_error_info_handle *err);
+	DUCKDB_V2_ERROR(*duckdb_v2_table_function_set_get_bind_info_callback)
+	(duckdb_v2_table_function_handle function, duckdb_v2_table_function_get_bind_info_callback_fn callback,
+	 duckdb_v2_error_info_handle *err);
+	DUCKDB_V2_ERROR(*duckdb_v2_connection_get_factory)
+	(duckdb_v2_connection_handle conn, duckdb_v2_factory_handle *out_factory, duckdb_v2_error_info_handle *err);
+	DUCKDB_V2_ERROR(*duckdb_v2_context_get_factory)
+	(duckdb_v2_context_handle ctx, duckdb_v2_factory_handle *out_factory, duckdb_v2_error_info_handle *err);
+	DUCKDB_V2_ERROR(*duckdb_v2_instance_get_factory)
+	(duckdb_v2_instance_handle instance, duckdb_v2_factory_handle *out_factory, duckdb_v2_error_info_handle *err);
+	DUCKDB_V2_ERROR(*duckdb_v2_scalar_function_bind_set_bind_data)
+	(duckdb_v2_scalar_function_bind_info_handle info, duckdb_v2_opaque *data, duckdb_v2_error_info_handle *err);
+	DUCKDB_V2_ERROR(*duckdb_v2_config_get_option_value)
+	(duckdb_v2_config_handle config, const duckdb_v2_identifier_t *name, duckdb_v2_value_handle *out_value,
+	 DUCKDB_V2_SETTING_SCOPE *out_scope, duckdb_v2_error_info_handle *err);
+	DUCKDB_V2_ERROR(*duckdb_v2_config_set_option_text)
+	(duckdb_v2_config_handle config, const duckdb_v2_identifier_t *name, const duckdb_v2_str *setting,
+	 DUCKDB_V2_SETTING_SCOPE scope, duckdb_v2_error_info_handle *err);
+	DUCKDB_V2_ERROR(*duckdb_v2_config_set_option_value)
+	(duckdb_v2_config_handle config, const duckdb_v2_identifier_t *name, duckdb_v2_value_handle value,
+	 DUCKDB_V2_SETTING_SCOPE scope, duckdb_v2_error_info_handle *err);
+	DUCKDB_V2_ERROR(*duckdb_v2_connection_get_config)
+	(duckdb_v2_connection_handle conn, duckdb_v2_config_handle *out_config, duckdb_v2_error_info_handle *err);
+	DUCKDB_V2_ERROR(*duckdb_v2_connection_get_file_system)
+	(duckdb_v2_connection_handle conn, duckdb_v2_file_system_handle *file_system, duckdb_v2_error_info_handle *err);
+	DUCKDB_V2_ERROR(*duckdb_v2_connection_log)
+	(duckdb_v2_connection_handle conn, DUCKDB_V2_LOG_LEVEL level, const duckdb_v2_str *log_type,
+	 const duckdb_v2_str *message, duckdb_v2_error_info_handle *err);
+	DUCKDB_V2_ERROR(*duckdb_v2_context_get_config)
+	(duckdb_v2_context_handle ctx, duckdb_v2_config_handle *out_config, duckdb_v2_error_info_handle *err);
+	DUCKDB_V2_ERROR(*duckdb_v2_instance_get_config)
+	(duckdb_v2_instance_handle instance, duckdb_v2_config_handle *out_config, duckdb_v2_error_info_handle *err);
+	DUCKDB_V2_ERROR(*duckdb_v2_instance_get_file_system)
+	(duckdb_v2_instance_handle instance, duckdb_v2_file_system_handle *file_system, duckdb_v2_error_info_handle *err);
+	DUCKDB_V2_ERROR(*duckdb_v2_instance_log)
+	(duckdb_v2_instance_handle instance, DUCKDB_V2_LOG_LEVEL level, const duckdb_v2_str *log_type,
+	 const duckdb_v2_str *message, duckdb_v2_error_info_handle *err);
+	DUCKDB_V2_ERROR(*duckdb_v2_option_get_default_scope)
+	(duckdb_v2_option_handle option, DUCKDB_V2_SETTING_SCOPE *out_scope, duckdb_v2_error_info_handle *err);
+	DUCKDB_V2_ERROR(*duckdb_v2_option_supports_scope)
+	(duckdb_v2_option_handle option, DUCKDB_V2_SETTING_SCOPE scope, bool *out_supported,
+	 duckdb_v2_error_info_handle *err);
+	DUCKDB_V2_ERROR(*duckdb_v2_aggregate_function_get_docs)
+	(duckdb_v2_aggregate_function_handle function, duckdb_v2_function_docs_handle *docs,
+	 duckdb_v2_error_info_handle *err);
+	DUCKDB_V2_ERROR(*duckdb_v2_connection_register_pragma_function)
+	(duckdb_v2_connection_handle conn, duckdb_v2_pragma_function_handle function, duckdb_v2_error_info_handle *err);
+	DUCKDB_V2_ERROR(*duckdb_v2_extension_register_pragma_function)
+	(duckdb_v2_extension_handle extension, duckdb_v2_pragma_function_handle function, duckdb_v2_error_info_handle *err);
+	DUCKDB_V2_ERROR(*duckdb_v2_factory_create_common_type)
+	(duckdb_v2_factory_handle factory, const duckdb_v2_logical_type_handle *types, idx_t type_count,
+	 duckdb_v2_logical_type_handle *out_type, duckdb_v2_error_info_handle *err);
+	DUCKDB_V2_ERROR(*duckdb_v2_function_docs_add_category)
+	(duckdb_v2_function_docs_handle docs, const duckdb_v2_str *category, duckdb_v2_error_info_handle *err);
+	DUCKDB_V2_ERROR(*duckdb_v2_function_docs_add_example)
+	(duckdb_v2_function_docs_handle docs, const duckdb_v2_str *title, const duckdb_v2_str *example,
+	 duckdb_v2_error_info_handle *err);
+	DUCKDB_V2_ERROR(*duckdb_v2_function_docs_set_description)
+	(duckdb_v2_function_docs_handle docs, const duckdb_v2_str *description, duckdb_v2_error_info_handle *err);
+	DUCKDB_V2_ERROR(*duckdb_v2_pragma_function_create)
+	(duckdb_v2_factory_handle factory, duckdb_v2_pragma_function_handle *function, duckdb_v2_error_info_handle *err);
+	DUCKDB_V2_ERROR (*duckdb_v2_pragma_function_destroy)(duckdb_v2_pragma_function_handle *function);
+	DUCKDB_V2_ERROR(*duckdb_v2_pragma_function_get_docs)
+	(duckdb_v2_pragma_function_handle function, duckdb_v2_function_docs_handle *docs, duckdb_v2_error_info_handle *err);
+	DUCKDB_V2_ERROR(*duckdb_v2_pragma_function_get_signature)
+	(duckdb_v2_pragma_function_handle function, duckdb_v2_function_signature_handle *sig,
+	 duckdb_v2_error_info_handle *err);
+	DUCKDB_V2_ERROR(*duckdb_v2_pragma_function_query_set_query)
+	(duckdb_v2_pragma_function_query_info_handle info, const duckdb_v2_str *query, duckdb_v2_error_info_handle *err);
+	DUCKDB_V2_ERROR(*duckdb_v2_pragma_function_set_exec_callback)
+	(duckdb_v2_pragma_function_handle function, duckdb_v2_pragma_function_exec_callback_fn callback,
+	 duckdb_v2_error_info_handle *err);
+	DUCKDB_V2_ERROR(*duckdb_v2_pragma_function_set_name)
+	(duckdb_v2_pragma_function_handle function, const duckdb_v2_identifier_t *name, duckdb_v2_error_info_handle *err);
+	DUCKDB_V2_ERROR(*duckdb_v2_pragma_function_set_query_callback)
+	(duckdb_v2_pragma_function_handle function, duckdb_v2_pragma_function_query_callback_fn callback,
+	 duckdb_v2_error_info_handle *err);
+	DUCKDB_V2_ERROR(*duckdb_v2_pragma_function_set_user_data)
+	(duckdb_v2_pragma_function_handle function, duckdb_v2_opaque *data, duckdb_v2_error_info_handle *err);
+	DUCKDB_V2_ERROR(*duckdb_v2_scalar_function_get_docs)
+	(duckdb_v2_scalar_function_handle function, duckdb_v2_function_docs_handle *docs, duckdb_v2_error_info_handle *err);
+	DUCKDB_V2_ERROR(*duckdb_v2_table_function_get_docs)
+	(duckdb_v2_table_function_handle function, duckdb_v2_function_docs_handle *docs, duckdb_v2_error_info_handle *err);
+	DUCKDB_V2_ERROR(*duckdb_v2_connection_register_custom_option)
+	(duckdb_v2_connection_handle conn, duckdb_v2_custom_option_handle option, duckdb_v2_error_info_handle *err);
+	DUCKDB_V2_ERROR(*duckdb_v2_custom_option_create)
+	(duckdb_v2_factory_handle factory, duckdb_v2_custom_option_handle *option, duckdb_v2_error_info_handle *err);
+	DUCKDB_V2_ERROR (*duckdb_v2_custom_option_destroy)(duckdb_v2_custom_option_handle *option);
+	DUCKDB_V2_ERROR(*duckdb_v2_custom_option_set_default_scope)
+	(duckdb_v2_custom_option_handle option, DUCKDB_V2_SETTING_SCOPE scope, duckdb_v2_error_info_handle *err);
+	DUCKDB_V2_ERROR(*duckdb_v2_custom_option_set_default_value)
+	(duckdb_v2_custom_option_handle option, duckdb_v2_value_handle value, duckdb_v2_error_info_handle *err);
+	DUCKDB_V2_ERROR(*duckdb_v2_custom_option_set_description)
+	(duckdb_v2_custom_option_handle option, const duckdb_v2_str *description, duckdb_v2_error_info_handle *err);
+	DUCKDB_V2_ERROR(*duckdb_v2_custom_option_set_name)
+	(duckdb_v2_custom_option_handle option, const duckdb_v2_identifier_t *name, duckdb_v2_error_info_handle *err);
+	DUCKDB_V2_ERROR(*duckdb_v2_custom_option_set_supports_scope)
+	(duckdb_v2_custom_option_handle option, DUCKDB_V2_SETTING_SCOPE scope, bool supported,
+	 duckdb_v2_error_info_handle *err);
+	DUCKDB_V2_ERROR(*duckdb_v2_custom_option_set_type)
+	(duckdb_v2_custom_option_handle option, duckdb_v2_logical_type_handle type, duckdb_v2_error_info_handle *err);
+	DUCKDB_V2_ERROR(*duckdb_v2_custom_option_set_update_callback)
+	(duckdb_v2_custom_option_handle option, duckdb_v2_custom_option_update_callback_fn callback,
+	 duckdb_v2_error_info_handle *err);
+	DUCKDB_V2_ERROR(*duckdb_v2_custom_option_set_user_data)
+	(duckdb_v2_custom_option_handle option, duckdb_v2_opaque *data, duckdb_v2_error_info_handle *err);
+	DUCKDB_V2_ERROR(*duckdb_v2_custom_option_update_get_scope)
+	(duckdb_v2_custom_option_update_info_handle info, DUCKDB_V2_SETTING_SCOPE *scope, duckdb_v2_error_info_handle *err);
+	DUCKDB_V2_ERROR(*duckdb_v2_custom_option_update_get_user_data)
+	(duckdb_v2_custom_option_update_info_handle info, void **data, duckdb_v2_error_info_handle *err);
+	DUCKDB_V2_ERROR(*duckdb_v2_custom_option_update_get_value)
+	(duckdb_v2_custom_option_update_info_handle info, duckdb_v2_value_handle *value, duckdb_v2_error_info_handle *err);
+	DUCKDB_V2_ERROR(*duckdb_v2_custom_option_update_is_reset)
+	(duckdb_v2_custom_option_update_info_handle info, bool *is_reset, duckdb_v2_error_info_handle *err);
+	DUCKDB_V2_ERROR(*duckdb_v2_custom_option_update_set_value)
+	(duckdb_v2_custom_option_update_info_handle info, duckdb_v2_value_handle value, duckdb_v2_error_info_handle *err);
+	DUCKDB_V2_ERROR(*duckdb_v2_extension_register_custom_option)
+	(duckdb_v2_extension_handle extension, duckdb_v2_custom_option_handle option, duckdb_v2_error_info_handle *err);
+	DUCKDB_V2_ERROR(*duckdb_v2_extension_register_log_sink)
+	(duckdb_v2_extension_handle extension, duckdb_v2_log_sink_handle sink, duckdb_v2_error_info_handle *err);
+	DUCKDB_V2_ERROR(*duckdb_v2_extension_register_macro_function)
+	(duckdb_v2_extension_handle extension, duckdb_v2_macro_function_handle function, duckdb_v2_error_info_handle *err);
+	DUCKDB_V2_ERROR(*duckdb_v2_file_system_path_exists)
+	(duckdb_v2_file_system_handle file_system, const duckdb_v2_str *path, bool *out_exists,
+	 duckdb_v2_error_info_handle *err);
+	DUCKDB_V2_ERROR(*duckdb_v2_file_system_path_expand)
+	(duckdb_v2_file_system_handle file_system, const duckdb_v2_str *path, duckdb_v2_text_sink_fn sink, void *user_data,
+	 duckdb_v2_error_info_handle *err);
+	DUCKDB_V2_ERROR(*duckdb_v2_file_system_path_is_remote)
+	(duckdb_v2_file_system_handle file_system, const duckdb_v2_str *path, bool *out_is_remote,
+	 duckdb_v2_error_info_handle *err);
+	DUCKDB_V2_ERROR(*duckdb_v2_instance_register_log_sink)
+	(duckdb_v2_instance_handle instance, duckdb_v2_log_sink_handle sink, duckdb_v2_error_info_handle *err);
+	DUCKDB_V2_ERROR(*duckdb_v2_log_sink_create)
+	(duckdb_v2_factory_handle factory, duckdb_v2_log_sink_handle *sink, duckdb_v2_error_info_handle *err);
+	DUCKDB_V2_ERROR (*duckdb_v2_log_sink_destroy)(duckdb_v2_log_sink_handle *sink);
+	DUCKDB_V2_ERROR(*duckdb_v2_log_sink_set_flush_callback)
+	(duckdb_v2_log_sink_handle sink, duckdb_v2_log_sink_flush_callback_fn callback, duckdb_v2_error_info_handle *err);
+	DUCKDB_V2_ERROR(*duckdb_v2_log_sink_set_name)
+	(duckdb_v2_log_sink_handle sink, const duckdb_v2_identifier_t *name, duckdb_v2_error_info_handle *err);
+	DUCKDB_V2_ERROR(*duckdb_v2_log_sink_set_user_data)
+	(duckdb_v2_log_sink_handle sink, duckdb_v2_opaque *data, duckdb_v2_error_info_handle *err);
+	DUCKDB_V2_ERROR(*duckdb_v2_log_sink_set_write_callback)
+	(duckdb_v2_log_sink_handle sink, duckdb_v2_log_sink_write_callback_fn callback, duckdb_v2_error_info_handle *err);
+	DUCKDB_V2_ERROR(*duckdb_v2_log_sink_write_info_get_connection_id)
+	(duckdb_v2_log_sink_write_info_handle info, idx_t *id, bool *present, duckdb_v2_error_info_handle *err);
+	DUCKDB_V2_ERROR(*duckdb_v2_log_sink_write_info_get_query_id)
+	(duckdb_v2_log_sink_write_info_handle info, idx_t *id, bool *present, duckdb_v2_error_info_handle *err);
+	DUCKDB_V2_ERROR(*duckdb_v2_log_sink_write_info_get_thread_id)
+	(duckdb_v2_log_sink_write_info_handle info, idx_t *id, bool *present, duckdb_v2_error_info_handle *err);
+	DUCKDB_V2_ERROR(*duckdb_v2_log_sink_write_info_get_transaction_id)
+	(duckdb_v2_log_sink_write_info_handle info, idx_t *id, bool *present, duckdb_v2_error_info_handle *err);
+	DUCKDB_V2_ERROR(*duckdb_v2_macro_function_create)
+	(duckdb_v2_factory_handle factory, DUCKDB_V2_MACRO_FUNCTION_TYPE type, duckdb_v2_macro_function_handle *function,
+	 duckdb_v2_error_info_handle *err);
+	DUCKDB_V2_ERROR (*duckdb_v2_macro_function_destroy)(duckdb_v2_macro_function_handle *function);
+	DUCKDB_V2_ERROR(*duckdb_v2_macro_function_get_docs)
+	(duckdb_v2_macro_function_handle function, duckdb_v2_function_docs_handle *docs, duckdb_v2_error_info_handle *err);
+	DUCKDB_V2_ERROR(*duckdb_v2_macro_function_get_signature)
+	(duckdb_v2_macro_function_handle function, duckdb_v2_function_signature_handle *sig,
+	 duckdb_v2_error_info_handle *err);
+	DUCKDB_V2_ERROR(*duckdb_v2_macro_function_set_body)
+	(duckdb_v2_macro_function_handle function, const duckdb_v2_str *body, duckdb_v2_error_info_handle *err);
+	DUCKDB_V2_ERROR(*duckdb_v2_macro_function_set_name)
+	(duckdb_v2_macro_function_handle function, const duckdb_v2_identifier_t *name, duckdb_v2_error_info_handle *err);
+	DUCKDB_V2_ERROR(*duckdb_v2_vector_cast)
+	(duckdb_v2_factory_handle factory, duckdb_v2_vector_handle source, duckdb_v2_vector_handle target,
+	 DUCKDB_V2_CAST_MODE mode, bool *out_converted, duckdb_v2_error_info_handle *cast_err,
+	 duckdb_v2_error_info_handle *err);
+	DUCKDB_V2_ERROR(*duckdb_v2_connection_enable_profiling)
+	(duckdb_v2_connection_handle conn, bool enabled, duckdb_v2_error_info_handle *err);
+	DUCKDB_V2_ERROR(*duckdb_v2_connection_get_query_metrics)
+	(duckdb_v2_connection_handle conn, duckdb_v2_query_metrics_handle *metrics, duckdb_v2_error_info_handle *err);
+	DUCKDB_V2_ERROR(*duckdb_v2_copy_function_set_file_extension)
+	(duckdb_v2_copy_function_handle function, const duckdb_v2_str *extension, duckdb_v2_error_info_handle *err);
+	DUCKDB_V2_ERROR (*duckdb_v2_data_chunk_clear)(duckdb_v2_data_chunk_handle chunk, duckdb_v2_error_info_handle *err);
+	DUCKDB_V2_ERROR(*duckdb_v2_file_system_path_glob)
+	(duckdb_v2_file_system_handle file_system, const duckdb_v2_str *pattern,
+	 duckdb_v2_file_system_path_glob_callback_fn callback, void *user_data, duckdb_v2_error_info_handle *err);
+	DUCKDB_V2_ERROR(*duckdb_v2_file_system_path_move)
+	(duckdb_v2_file_system_handle file_system, const duckdb_v2_str *source, const duckdb_v2_str *target,
+	 duckdb_v2_error_info_handle *err);
+	DUCKDB_V2_ERROR(*duckdb_v2_file_system_path_remove)
+	(duckdb_v2_file_system_handle file_system, const duckdb_v2_str *path, bool *out_removed,
+	 duckdb_v2_error_info_handle *err);
+	DUCKDB_V2_ERROR (*duckdb_v2_query_metrics_destroy)(duckdb_v2_query_metrics_handle *metrics);
+	DUCKDB_V2_ERROR(*duckdb_v2_query_metrics_get_root)
+	(duckdb_v2_query_metrics_handle metrics, duckdb_v2_query_metrics_node_handle *node,
+	 duckdb_v2_error_info_handle *err);
+	DUCKDB_V2_ERROR(*duckdb_v2_query_metrics_node_get_child)
+	(duckdb_v2_query_metrics_node_handle node, idx_t index, duckdb_v2_query_metrics_node_handle *child,
+	 duckdb_v2_error_info_handle *err);
+	DUCKDB_V2_ERROR(*duckdb_v2_query_metrics_node_get_child_count)
+	(duckdb_v2_query_metrics_node_handle node, idx_t *count, duckdb_v2_error_info_handle *err);
+	DUCKDB_V2_ERROR(*duckdb_v2_query_metrics_node_get_metric)
+	(duckdb_v2_query_metrics_node_handle node, const duckdb_v2_str *name, duckdb_v2_value_handle *value, bool *present,
+	 duckdb_v2_error_info_handle *err);
+	DUCKDB_V2_ERROR(*duckdb_v2_query_metrics_node_get_metric_count)
+	(duckdb_v2_query_metrics_node_handle node, idx_t *count, duckdb_v2_error_info_handle *err);
+	DUCKDB_V2_ERROR(*duckdb_v2_query_metrics_node_get_metric_name)
+	(duckdb_v2_query_metrics_node_handle node, idx_t index, duckdb_v2_str *name, duckdb_v2_error_info_handle *err);
+	DUCKDB_V2_ERROR(*duckdb_v2_query_metrics_node_get_metric_value)
+	(duckdb_v2_query_metrics_node_handle node, idx_t index, duckdb_v2_value_handle *value,
+	 duckdb_v2_error_info_handle *err);
+	DUCKDB_V2_ERROR(*duckdb_v2_query_metrics_node_get_name)
+	(duckdb_v2_query_metrics_node_handle node, duckdb_v2_str *name, duckdb_v2_error_info_handle *err);
+	DUCKDB_V2_ERROR(*duckdb_v2_statement_add_collection)
+	(duckdb_v2_sql_statement_handle statement, const duckdb_v2_identifier_t *name,
+	 duckdb_v2_column_data_collection_handle collection, const duckdb_v2_identifier_t *column_names, idx_t column_count,
+	 duckdb_v2_error_info_handle *err);
+#endif
+	// capigen:end appended
+} duckdb_ext_api_v2;
+
+//===--------------------------------------------------------------------===//
+// Typedefs mapping functions to struct entries
+//===--------------------------------------------------------------------===//
+// When building as a static extension, DuckDB symbols are resolved directly at link time.
+// The vtable (duckdb_ext_api) is not used - skip these macro redirections.
+#ifndef DUCKDB_BUILD_STATIC_EXTENSION
+// capigen:begin appended
+#if DUCKDB_V2_API_ALLOW_UNSTABLE
+#define duckdb_v2_arena_allocate duckdb_ext_api.duckdb_v2_arena_allocate
+#endif
+#if DUCKDB_V2_API_ALLOW_UNSTABLE
+#define duckdb_v2_bignum_decode duckdb_ext_api.duckdb_v2_bignum_decode
+#endif
+#if DUCKDB_V2_API_ALLOW_UNSTABLE
+#define duckdb_v2_bignum_encode duckdb_ext_api.duckdb_v2_bignum_encode
+#endif
+#if DUCKDB_V2_API_ALLOW_UNSTABLE
+#define duckdb_v2_column_data_collection_append duckdb_ext_api.duckdb_v2_column_data_collection_append
+#endif
+#if DUCKDB_V2_API_ALLOW_UNSTABLE
+#define duckdb_v2_column_data_collection_append_state_create                                                           \
+	duckdb_ext_api.duckdb_v2_column_data_collection_append_state_create
+#endif
+#if DUCKDB_V2_API_ALLOW_UNSTABLE
+#define duckdb_v2_column_data_collection_append_state_destroy                                                          \
+	duckdb_ext_api.duckdb_v2_column_data_collection_append_state_destroy
+#endif
+#if DUCKDB_V2_API_ALLOW_UNSTABLE
+#define duckdb_v2_column_data_collection_combine duckdb_ext_api.duckdb_v2_column_data_collection_combine
+#endif
+#if DUCKDB_V2_API_ALLOW_UNSTABLE
+#define duckdb_v2_column_data_collection_create duckdb_ext_api.duckdb_v2_column_data_collection_create
+#endif
+#if DUCKDB_V2_API_ALLOW_UNSTABLE
+#define duckdb_v2_column_data_collection_destroy duckdb_ext_api.duckdb_v2_column_data_collection_destroy
+#endif
+#if DUCKDB_V2_API_ALLOW_UNSTABLE
+#define duckdb_v2_column_data_collection_reset duckdb_ext_api.duckdb_v2_column_data_collection_reset
+#endif
+#if DUCKDB_V2_API_ALLOW_UNSTABLE
+#define duckdb_v2_column_data_collection_row_count duckdb_ext_api.duckdb_v2_column_data_collection_row_count
+#endif
+#if DUCKDB_V2_API_ALLOW_UNSTABLE
+#define duckdb_v2_column_data_collection_scan duckdb_ext_api.duckdb_v2_column_data_collection_scan
+#endif
+#if DUCKDB_V2_API_ALLOW_UNSTABLE
+#define duckdb_v2_column_data_collection_shared_scan_state_create                                                      \
+	duckdb_ext_api.duckdb_v2_column_data_collection_shared_scan_state_create
+#endif
+#if DUCKDB_V2_API_ALLOW_UNSTABLE
+#define duckdb_v2_column_data_collection_shared_scan_state_destroy                                                     \
+	duckdb_ext_api.duckdb_v2_column_data_collection_shared_scan_state_destroy
+#endif
+#if DUCKDB_V2_API_ALLOW_UNSTABLE
+#define duckdb_v2_column_data_collection_worker_scan_state_create                                                      \
+	duckdb_ext_api.duckdb_v2_column_data_collection_worker_scan_state_create
+#endif
+#if DUCKDB_V2_API_ALLOW_UNSTABLE
+#define duckdb_v2_column_data_collection_worker_scan_state_destroy                                                     \
+	duckdb_ext_api.duckdb_v2_column_data_collection_worker_scan_state_destroy
+#endif
+#if DUCKDB_V2_API_ALLOW_UNSTABLE
+#define duckdb_v2_config_get_option_by_index duckdb_ext_api.duckdb_v2_config_get_option_by_index
+#endif
+#if DUCKDB_V2_API_ALLOW_UNSTABLE
+#define duckdb_v2_config_get_option_by_name duckdb_ext_api.duckdb_v2_config_get_option_by_name
+#endif
+#if DUCKDB_V2_API_ALLOW_UNSTABLE
+#define duckdb_v2_config_get_option_count duckdb_ext_api.duckdb_v2_config_get_option_count
+#endif
+#if DUCKDB_V2_API_ALLOW_UNSTABLE
+#define duckdb_v2_connection_create duckdb_ext_api.duckdb_v2_connection_create
+#endif
+#if DUCKDB_V2_API_ALLOW_UNSTABLE
+#define duckdb_v2_connection_destroy duckdb_ext_api.duckdb_v2_connection_destroy
+#endif
+#if DUCKDB_V2_API_ALLOW_UNSTABLE
+#define duckdb_v2_connection_interrupt duckdb_ext_api.duckdb_v2_connection_interrupt
+#endif
+#if DUCKDB_V2_API_ALLOW_UNSTABLE
+#define duckdb_v2_connection_progress_get duckdb_ext_api.duckdb_v2_connection_progress_get
+#endif
+#if DUCKDB_V2_API_ALLOW_UNSTABLE
+#define duckdb_v2_data_chunk_copy duckdb_ext_api.duckdb_v2_data_chunk_copy
+#endif
+#if DUCKDB_V2_API_ALLOW_UNSTABLE
+#define duckdb_v2_data_chunk_create duckdb_ext_api.duckdb_v2_data_chunk_create
+#endif
+#if DUCKDB_V2_API_ALLOW_UNSTABLE
+#define duckdb_v2_data_chunk_destroy duckdb_ext_api.duckdb_v2_data_chunk_destroy
+#endif
+#if DUCKDB_V2_API_ALLOW_UNSTABLE
+#define duckdb_v2_data_chunk_get_size duckdb_ext_api.duckdb_v2_data_chunk_get_size
+#endif
+#if DUCKDB_V2_API_ALLOW_UNSTABLE
+#define duckdb_v2_data_chunk_get_vector duckdb_ext_api.duckdb_v2_data_chunk_get_vector
+#endif
+#if DUCKDB_V2_API_ALLOW_UNSTABLE
+#define duckdb_v2_data_chunk_get_vector_count duckdb_ext_api.duckdb_v2_data_chunk_get_vector_count
+#endif
+#if DUCKDB_V2_API_ALLOW_UNSTABLE
+#define duckdb_v2_environment_create duckdb_ext_api.duckdb_v2_environment_create
+#endif
+#if DUCKDB_V2_API_ALLOW_UNSTABLE
+#define duckdb_v2_environment_destroy duckdb_ext_api.duckdb_v2_environment_destroy
+#endif
+#if DUCKDB_V2_API_ALLOW_UNSTABLE
+#define duckdb_v2_environment_get_instance_count duckdb_ext_api.duckdb_v2_environment_get_instance_count
+#endif
+#if DUCKDB_V2_API_ALLOW_UNSTABLE
+#define duckdb_v2_error_info_destroy duckdb_ext_api.duckdb_v2_error_info_destroy
+#endif
+#if DUCKDB_V2_API_ALLOW_UNSTABLE
+#define duckdb_v2_error_info_get_code duckdb_ext_api.duckdb_v2_error_info_get_code
+#endif
+#if DUCKDB_V2_API_ALLOW_UNSTABLE
+#define duckdb_v2_error_info_get_raw_text duckdb_ext_api.duckdb_v2_error_info_get_raw_text
+#endif
+#if DUCKDB_V2_API_ALLOW_UNSTABLE
+#define duckdb_v2_error_info_get_text duckdb_ext_api.duckdb_v2_error_info_get_text
+#endif
+#if DUCKDB_V2_API_ALLOW_UNSTABLE
+#define duckdb_v2_error_info_set_code duckdb_ext_api.duckdb_v2_error_info_set_code
+#endif
+#if DUCKDB_V2_API_ALLOW_UNSTABLE
+#define duckdb_v2_error_info_set_text duckdb_ext_api.duckdb_v2_error_info_set_text
+#endif
+#if DUCKDB_V2_API_ALLOW_UNSTABLE
+#define duckdb_v2_factory_create_type_from_id duckdb_ext_api.duckdb_v2_factory_create_type_from_id
+#endif
+#if DUCKDB_V2_API_ALLOW_UNSTABLE
+#define duckdb_v2_factory_create_type_from_name duckdb_ext_api.duckdb_v2_factory_create_type_from_name
+#endif
+#if DUCKDB_V2_API_ALLOW_UNSTABLE
+#define duckdb_v2_factory_create_type_from_text duckdb_ext_api.duckdb_v2_factory_create_type_from_text
+#endif
+#if DUCKDB_V2_API_ALLOW_UNSTABLE
+#define duckdb_v2_factory_create_type_with_alias duckdb_ext_api.duckdb_v2_factory_create_type_with_alias
+#endif
+#if DUCKDB_V2_API_ALLOW_UNSTABLE
+#define duckdb_v2_instance_attach duckdb_ext_api.duckdb_v2_instance_attach
+#endif
+#if DUCKDB_V2_API_ALLOW_UNSTABLE
+#define duckdb_v2_instance_create duckdb_ext_api.duckdb_v2_instance_create
+#endif
+#if DUCKDB_V2_API_ALLOW_UNSTABLE
+#define duckdb_v2_instance_create_with_options duckdb_ext_api.duckdb_v2_instance_create_with_options
+#endif
+#if DUCKDB_V2_API_ALLOW_UNSTABLE
+#define duckdb_v2_instance_destroy duckdb_ext_api.duckdb_v2_instance_destroy
+#endif
+#if DUCKDB_V2_API_ALLOW_UNSTABLE
+#define duckdb_v2_instance_detach duckdb_ext_api.duckdb_v2_instance_detach
+#endif
+#if DUCKDB_V2_API_ALLOW_UNSTABLE
+#define duckdb_v2_library_version duckdb_ext_api.duckdb_v2_library_version
+#endif
+#if DUCKDB_V2_API_ALLOW_UNSTABLE
+#define duckdb_v2_logical_type_copy duckdb_ext_api.duckdb_v2_logical_type_copy
+#endif
+#if DUCKDB_V2_API_ALLOW_UNSTABLE
+#define duckdb_v2_logical_type_destroy duckdb_ext_api.duckdb_v2_logical_type_destroy
+#endif
+#if DUCKDB_V2_API_ALLOW_UNSTABLE
+#define duckdb_v2_logical_type_get_id duckdb_ext_api.duckdb_v2_logical_type_get_id
+#endif
+#if DUCKDB_V2_API_ALLOW_UNSTABLE
+#define duckdb_v2_logical_type_get_name duckdb_ext_api.duckdb_v2_logical_type_get_name
+#endif
+#if DUCKDB_V2_API_ALLOW_UNSTABLE
+#define duckdb_v2_logical_type_get_param duckdb_ext_api.duckdb_v2_logical_type_get_param
+#endif
+#if DUCKDB_V2_API_ALLOW_UNSTABLE
+#define duckdb_v2_logical_type_get_param_count duckdb_ext_api.duckdb_v2_logical_type_get_param_count
+#endif
+#if DUCKDB_V2_API_ALLOW_UNSTABLE
+#define duckdb_v2_logical_type_is_equal duckdb_ext_api.duckdb_v2_logical_type_is_equal
+#endif
+#if DUCKDB_V2_API_ALLOW_UNSTABLE
+#define duckdb_v2_logical_type_to_text duckdb_ext_api.duckdb_v2_logical_type_to_text
+#endif
+#if DUCKDB_V2_API_ALLOW_UNSTABLE
+#define duckdb_v2_option_destroy duckdb_ext_api.duckdb_v2_option_destroy
+#endif
+#if DUCKDB_V2_API_ALLOW_UNSTABLE
+#define duckdb_v2_option_get_alias duckdb_ext_api.duckdb_v2_option_get_alias
+#endif
+#if DUCKDB_V2_API_ALLOW_UNSTABLE
+#define duckdb_v2_option_get_alias_count duckdb_ext_api.duckdb_v2_option_get_alias_count
+#endif
+#if DUCKDB_V2_API_ALLOW_UNSTABLE
+#define duckdb_v2_option_get_default_value duckdb_ext_api.duckdb_v2_option_get_default_value
+#endif
+#if DUCKDB_V2_API_ALLOW_UNSTABLE
+#define duckdb_v2_option_get_description duckdb_ext_api.duckdb_v2_option_get_description
+#endif
+#if DUCKDB_V2_API_ALLOW_UNSTABLE
+#define duckdb_v2_option_get_name duckdb_ext_api.duckdb_v2_option_get_name
+#endif
+#if DUCKDB_V2_API_ALLOW_UNSTABLE
+#define duckdb_v2_parse_sql duckdb_ext_api.duckdb_v2_parse_sql
+#endif
+#if DUCKDB_V2_API_ALLOW_UNSTABLE
+#define duckdb_v2_result_destroy duckdb_ext_api.duckdb_v2_result_destroy
+#endif
+#if DUCKDB_V2_API_ALLOW_UNSTABLE
+#define duckdb_v2_result_drain duckdb_ext_api.duckdb_v2_result_drain
+#endif
+#if DUCKDB_V2_API_ALLOW_UNSTABLE
+#define duckdb_v2_result_fetch_chunk duckdb_ext_api.duckdb_v2_result_fetch_chunk
+#endif
+#if DUCKDB_V2_API_ALLOW_UNSTABLE
+#define duckdb_v2_result_get_result_type duckdb_ext_api.duckdb_v2_result_get_result_type
+#endif
+#if DUCKDB_V2_API_ALLOW_UNSTABLE
+#define duckdb_v2_result_get_schema duckdb_ext_api.duckdb_v2_result_get_schema
+#endif
+#if DUCKDB_V2_API_ALLOW_UNSTABLE
+#define duckdb_v2_result_get_statement_type duckdb_ext_api.duckdb_v2_result_get_statement_type
+#endif
+#if DUCKDB_V2_API_ALLOW_UNSTABLE
+#define duckdb_v2_result_render_box duckdb_ext_api.duckdb_v2_result_render_box
+#endif
+#if DUCKDB_V2_API_ALLOW_UNSTABLE
+#define duckdb_v2_result_step duckdb_ext_api.duckdb_v2_result_step
+#endif
+#if DUCKDB_V2_API_ALLOW_UNSTABLE
+#define duckdb_v2_result_wait duckdb_ext_api.duckdb_v2_result_wait
+#endif
+#if DUCKDB_V2_API_ALLOW_UNSTABLE
+#define duckdb_v2_schema_destroy duckdb_ext_api.duckdb_v2_schema_destroy
+#endif
+#if DUCKDB_V2_API_ALLOW_UNSTABLE
+#define duckdb_v2_schema_get_count duckdb_ext_api.duckdb_v2_schema_get_count
+#endif
+#if DUCKDB_V2_API_ALLOW_UNSTABLE
+#define duckdb_v2_schema_get_field duckdb_ext_api.duckdb_v2_schema_get_field
+#endif
+#if DUCKDB_V2_API_ALLOW_UNSTABLE
+#define duckdb_v2_sql_statement_destroy duckdb_ext_api.duckdb_v2_sql_statement_destroy
+#endif
+#if DUCKDB_V2_API_ALLOW_UNSTABLE
+#define duckdb_v2_statement_bind duckdb_ext_api.duckdb_v2_statement_bind
+#endif
+#if DUCKDB_V2_API_ALLOW_UNSTABLE
+#define duckdb_v2_statement_execute duckdb_ext_api.duckdb_v2_statement_execute
+#endif
+#if DUCKDB_V2_API_ALLOW_UNSTABLE
+#define duckdb_v2_statement_iterator_destroy duckdb_ext_api.duckdb_v2_statement_iterator_destroy
+#endif
+#if DUCKDB_V2_API_ALLOW_UNSTABLE
+#define duckdb_v2_statement_iterator_next duckdb_ext_api.duckdb_v2_statement_iterator_next
+#endif
+#if DUCKDB_V2_API_ALLOW_UNSTABLE
+#define duckdb_v2_value_cast duckdb_ext_api.duckdb_v2_value_cast
+#endif
+#if DUCKDB_V2_API_ALLOW_UNSTABLE
+#define duckdb_v2_value_create_array duckdb_ext_api.duckdb_v2_value_create_array
+#endif
+#if DUCKDB_V2_API_ALLOW_UNSTABLE
+#define duckdb_v2_value_create_bigint duckdb_ext_api.duckdb_v2_value_create_bigint
+#endif
+#if DUCKDB_V2_API_ALLOW_UNSTABLE
+#define duckdb_v2_value_create_bignum duckdb_ext_api.duckdb_v2_value_create_bignum
+#endif
+#if DUCKDB_V2_API_ALLOW_UNSTABLE
+#define duckdb_v2_value_create_bit duckdb_ext_api.duckdb_v2_value_create_bit
+#endif
+#if DUCKDB_V2_API_ALLOW_UNSTABLE
+#define duckdb_v2_value_create_blob duckdb_ext_api.duckdb_v2_value_create_blob
+#endif
+#if DUCKDB_V2_API_ALLOW_UNSTABLE
+#define duckdb_v2_value_create_bool duckdb_ext_api.duckdb_v2_value_create_bool
+#endif
+#if DUCKDB_V2_API_ALLOW_UNSTABLE
+#define duckdb_v2_value_create_date duckdb_ext_api.duckdb_v2_value_create_date
+#endif
+#if DUCKDB_V2_API_ALLOW_UNSTABLE
+#define duckdb_v2_value_create_decimal duckdb_ext_api.duckdb_v2_value_create_decimal
+#endif
+#if DUCKDB_V2_API_ALLOW_UNSTABLE
+#define duckdb_v2_value_create_double duckdb_ext_api.duckdb_v2_value_create_double
+#endif
+#if DUCKDB_V2_API_ALLOW_UNSTABLE
+#define duckdb_v2_value_create_float duckdb_ext_api.duckdb_v2_value_create_float
+#endif
+#if DUCKDB_V2_API_ALLOW_UNSTABLE
+#define duckdb_v2_value_create_hugeint duckdb_ext_api.duckdb_v2_value_create_hugeint
+#endif
+#if DUCKDB_V2_API_ALLOW_UNSTABLE
+#define duckdb_v2_value_create_int duckdb_ext_api.duckdb_v2_value_create_int
+#endif
+#if DUCKDB_V2_API_ALLOW_UNSTABLE
+#define duckdb_v2_value_create_interval duckdb_ext_api.duckdb_v2_value_create_interval
+#endif
+#if DUCKDB_V2_API_ALLOW_UNSTABLE
+#define duckdb_v2_value_create_list duckdb_ext_api.duckdb_v2_value_create_list
+#endif
+#if DUCKDB_V2_API_ALLOW_UNSTABLE
+#define duckdb_v2_value_create_map duckdb_ext_api.duckdb_v2_value_create_map
+#endif
+#if DUCKDB_V2_API_ALLOW_UNSTABLE
+#define duckdb_v2_value_create_null duckdb_ext_api.duckdb_v2_value_create_null
+#endif
+#if DUCKDB_V2_API_ALLOW_UNSTABLE
+#define duckdb_v2_value_create_smallint duckdb_ext_api.duckdb_v2_value_create_smallint
+#endif
+#if DUCKDB_V2_API_ALLOW_UNSTABLE
+#define duckdb_v2_value_create_struct duckdb_ext_api.duckdb_v2_value_create_struct
+#endif
+#if DUCKDB_V2_API_ALLOW_UNSTABLE
+#define duckdb_v2_value_create_time duckdb_ext_api.duckdb_v2_value_create_time
+#endif
+#if DUCKDB_V2_API_ALLOW_UNSTABLE
+#define duckdb_v2_value_create_time_ns duckdb_ext_api.duckdb_v2_value_create_time_ns
+#endif
+#if DUCKDB_V2_API_ALLOW_UNSTABLE
+#define duckdb_v2_value_create_time_tz duckdb_ext_api.duckdb_v2_value_create_time_tz
+#endif
+#if DUCKDB_V2_API_ALLOW_UNSTABLE
+#define duckdb_v2_value_create_timestamp duckdb_ext_api.duckdb_v2_value_create_timestamp
+#endif
+#if DUCKDB_V2_API_ALLOW_UNSTABLE
+#define duckdb_v2_value_create_timestamp_ms duckdb_ext_api.duckdb_v2_value_create_timestamp_ms
+#endif
+#if DUCKDB_V2_API_ALLOW_UNSTABLE
+#define duckdb_v2_value_create_timestamp_ns duckdb_ext_api.duckdb_v2_value_create_timestamp_ns
+#endif
+#if DUCKDB_V2_API_ALLOW_UNSTABLE
+#define duckdb_v2_value_create_timestamp_sec duckdb_ext_api.duckdb_v2_value_create_timestamp_sec
+#endif
+#if DUCKDB_V2_API_ALLOW_UNSTABLE
+#define duckdb_v2_value_create_timestamp_tz duckdb_ext_api.duckdb_v2_value_create_timestamp_tz
+#endif
+#if DUCKDB_V2_API_ALLOW_UNSTABLE
+#define duckdb_v2_value_create_timestamp_tz_ns duckdb_ext_api.duckdb_v2_value_create_timestamp_tz_ns
+#endif
+#if DUCKDB_V2_API_ALLOW_UNSTABLE
+#define duckdb_v2_value_create_tinyint duckdb_ext_api.duckdb_v2_value_create_tinyint
+#endif
+#if DUCKDB_V2_API_ALLOW_UNSTABLE
+#define duckdb_v2_value_create_tuple duckdb_ext_api.duckdb_v2_value_create_tuple
+#endif
+#if DUCKDB_V2_API_ALLOW_UNSTABLE
+#define duckdb_v2_value_create_type duckdb_ext_api.duckdb_v2_value_create_type
+#endif
+#if DUCKDB_V2_API_ALLOW_UNSTABLE
+#define duckdb_v2_value_create_ubigint duckdb_ext_api.duckdb_v2_value_create_ubigint
+#endif
+#if DUCKDB_V2_API_ALLOW_UNSTABLE
+#define duckdb_v2_value_create_uhugeint duckdb_ext_api.duckdb_v2_value_create_uhugeint
+#endif
+#if DUCKDB_V2_API_ALLOW_UNSTABLE
+#define duckdb_v2_value_create_uint duckdb_ext_api.duckdb_v2_value_create_uint
+#endif
+#if DUCKDB_V2_API_ALLOW_UNSTABLE
+#define duckdb_v2_value_create_usmallint duckdb_ext_api.duckdb_v2_value_create_usmallint
+#endif
+#if DUCKDB_V2_API_ALLOW_UNSTABLE
+#define duckdb_v2_value_create_utinyint duckdb_ext_api.duckdb_v2_value_create_utinyint
+#endif
+#if DUCKDB_V2_API_ALLOW_UNSTABLE
+#define duckdb_v2_value_create_uuid duckdb_ext_api.duckdb_v2_value_create_uuid
+#endif
+#if DUCKDB_V2_API_ALLOW_UNSTABLE
+#define duckdb_v2_value_create_varchar duckdb_ext_api.duckdb_v2_value_create_varchar
+#endif
+#if DUCKDB_V2_API_ALLOW_UNSTABLE
+#define duckdb_v2_value_destroy duckdb_ext_api.duckdb_v2_value_destroy
+#endif
+#if DUCKDB_V2_API_ALLOW_UNSTABLE
+#define duckdb_v2_value_get_bigint duckdb_ext_api.duckdb_v2_value_get_bigint
+#endif
+#if DUCKDB_V2_API_ALLOW_UNSTABLE
+#define duckdb_v2_value_get_blob duckdb_ext_api.duckdb_v2_value_get_blob
+#endif
+#if DUCKDB_V2_API_ALLOW_UNSTABLE
+#define duckdb_v2_value_get_bool duckdb_ext_api.duckdb_v2_value_get_bool
+#endif
+#if DUCKDB_V2_API_ALLOW_UNSTABLE
+#define duckdb_v2_value_get_child duckdb_ext_api.duckdb_v2_value_get_child
+#endif
+#if DUCKDB_V2_API_ALLOW_UNSTABLE
+#define duckdb_v2_value_get_child_count duckdb_ext_api.duckdb_v2_value_get_child_count
+#endif
+#if DUCKDB_V2_API_ALLOW_UNSTABLE
+#define duckdb_v2_value_get_date duckdb_ext_api.duckdb_v2_value_get_date
+#endif
+#if DUCKDB_V2_API_ALLOW_UNSTABLE
+#define duckdb_v2_value_get_decimal duckdb_ext_api.duckdb_v2_value_get_decimal
+#endif
+#if DUCKDB_V2_API_ALLOW_UNSTABLE
+#define duckdb_v2_value_get_double duckdb_ext_api.duckdb_v2_value_get_double
+#endif
+#if DUCKDB_V2_API_ALLOW_UNSTABLE
+#define duckdb_v2_value_get_float duckdb_ext_api.duckdb_v2_value_get_float
+#endif
+#if DUCKDB_V2_API_ALLOW_UNSTABLE
+#define duckdb_v2_value_get_hugeint duckdb_ext_api.duckdb_v2_value_get_hugeint
+#endif
+#if DUCKDB_V2_API_ALLOW_UNSTABLE
+#define duckdb_v2_value_get_int duckdb_ext_api.duckdb_v2_value_get_int
+#endif
+#if DUCKDB_V2_API_ALLOW_UNSTABLE
+#define duckdb_v2_value_get_interval duckdb_ext_api.duckdb_v2_value_get_interval
+#endif
+#if DUCKDB_V2_API_ALLOW_UNSTABLE
+#define duckdb_v2_value_get_logical_type duckdb_ext_api.duckdb_v2_value_get_logical_type
+#endif
+#if DUCKDB_V2_API_ALLOW_UNSTABLE
+#define duckdb_v2_value_get_smallint duckdb_ext_api.duckdb_v2_value_get_smallint
+#endif
+#if DUCKDB_V2_API_ALLOW_UNSTABLE
+#define duckdb_v2_value_get_time duckdb_ext_api.duckdb_v2_value_get_time
+#endif
+#if DUCKDB_V2_API_ALLOW_UNSTABLE
+#define duckdb_v2_value_get_time_ns duckdb_ext_api.duckdb_v2_value_get_time_ns
+#endif
+#if DUCKDB_V2_API_ALLOW_UNSTABLE
+#define duckdb_v2_value_get_time_tz duckdb_ext_api.duckdb_v2_value_get_time_tz
+#endif
+#if DUCKDB_V2_API_ALLOW_UNSTABLE
+#define duckdb_v2_value_get_timestamp duckdb_ext_api.duckdb_v2_value_get_timestamp
+#endif
+#if DUCKDB_V2_API_ALLOW_UNSTABLE
+#define duckdb_v2_value_get_timestamp_ms duckdb_ext_api.duckdb_v2_value_get_timestamp_ms
+#endif
+#if DUCKDB_V2_API_ALLOW_UNSTABLE
+#define duckdb_v2_value_get_timestamp_ns duckdb_ext_api.duckdb_v2_value_get_timestamp_ns
+#endif
+#if DUCKDB_V2_API_ALLOW_UNSTABLE
+#define duckdb_v2_value_get_timestamp_sec duckdb_ext_api.duckdb_v2_value_get_timestamp_sec
+#endif
+#if DUCKDB_V2_API_ALLOW_UNSTABLE
+#define duckdb_v2_value_get_timestamp_tz duckdb_ext_api.duckdb_v2_value_get_timestamp_tz
+#endif
+#if DUCKDB_V2_API_ALLOW_UNSTABLE
+#define duckdb_v2_value_get_timestamp_tz_ns duckdb_ext_api.duckdb_v2_value_get_timestamp_tz_ns
+#endif
+#if DUCKDB_V2_API_ALLOW_UNSTABLE
+#define duckdb_v2_value_get_tinyint duckdb_ext_api.duckdb_v2_value_get_tinyint
+#endif
+#if DUCKDB_V2_API_ALLOW_UNSTABLE
+#define duckdb_v2_value_get_type duckdb_ext_api.duckdb_v2_value_get_type
+#endif
+#if DUCKDB_V2_API_ALLOW_UNSTABLE
+#define duckdb_v2_value_get_ubigint duckdb_ext_api.duckdb_v2_value_get_ubigint
+#endif
+#if DUCKDB_V2_API_ALLOW_UNSTABLE
+#define duckdb_v2_value_get_uhugeint duckdb_ext_api.duckdb_v2_value_get_uhugeint
+#endif
+#if DUCKDB_V2_API_ALLOW_UNSTABLE
+#define duckdb_v2_value_get_uint duckdb_ext_api.duckdb_v2_value_get_uint
+#endif
+#if DUCKDB_V2_API_ALLOW_UNSTABLE
+#define duckdb_v2_value_get_usmallint duckdb_ext_api.duckdb_v2_value_get_usmallint
+#endif
+#if DUCKDB_V2_API_ALLOW_UNSTABLE
+#define duckdb_v2_value_get_utinyint duckdb_ext_api.duckdb_v2_value_get_utinyint
+#endif
+#if DUCKDB_V2_API_ALLOW_UNSTABLE
+#define duckdb_v2_value_get_uuid duckdb_ext_api.duckdb_v2_value_get_uuid
+#endif
+#if DUCKDB_V2_API_ALLOW_UNSTABLE
+#define duckdb_v2_value_get_varchar duckdb_ext_api.duckdb_v2_value_get_varchar
+#endif
+#if DUCKDB_V2_API_ALLOW_UNSTABLE
+#define duckdb_v2_value_is_null duckdb_ext_api.duckdb_v2_value_is_null
+#endif
+#if DUCKDB_V2_API_ALLOW_UNSTABLE
+#define duckdb_v2_value_to_string duckdb_ext_api.duckdb_v2_value_to_string
+#endif
+#if DUCKDB_V2_API_ALLOW_UNSTABLE
+#define duckdb_v2_vector_constant_set_valid duckdb_ext_api.duckdb_v2_vector_constant_set_valid
+#endif
+#if DUCKDB_V2_API_ALLOW_UNSTABLE
+#define duckdb_v2_vector_flat_get_validity_mutable duckdb_ext_api.duckdb_v2_vector_flat_get_validity_mutable
+#endif
+#if DUCKDB_V2_API_ALLOW_UNSTABLE
+#define duckdb_v2_vector_flatten duckdb_ext_api.duckdb_v2_vector_flatten
+#endif
+#if DUCKDB_V2_API_ALLOW_UNSTABLE
+#define duckdb_v2_vector_get_arena duckdb_ext_api.duckdb_v2_vector_get_arena
+#endif
+#if DUCKDB_V2_API_ALLOW_UNSTABLE
+#define duckdb_v2_vector_get_child duckdb_ext_api.duckdb_v2_vector_get_child
+#endif
+#if DUCKDB_V2_API_ALLOW_UNSTABLE
+#define duckdb_v2_vector_get_child_count duckdb_ext_api.duckdb_v2_vector_get_child_count
+#endif
+#if DUCKDB_V2_API_ALLOW_UNSTABLE
+#define duckdb_v2_vector_get_data_mutable duckdb_ext_api.duckdb_v2_vector_get_data_mutable
+#endif
+#if DUCKDB_V2_API_ALLOW_UNSTABLE
+#define duckdb_v2_vector_get_logical_type duckdb_ext_api.duckdb_v2_vector_get_logical_type
+#endif
+#if DUCKDB_V2_API_ALLOW_UNSTABLE
+#define duckdb_v2_vector_get_size duckdb_ext_api.duckdb_v2_vector_get_size
+#endif
+#if DUCKDB_V2_API_ALLOW_UNSTABLE
+#define duckdb_v2_vector_get_value duckdb_ext_api.duckdb_v2_vector_get_value
+#endif
+#if DUCKDB_V2_API_ALLOW_UNSTABLE
+#define duckdb_v2_vector_get_vector_type duckdb_ext_api.duckdb_v2_vector_get_vector_type
+#endif
+#if DUCKDB_V2_API_ALLOW_UNSTABLE
+#define duckdb_v2_vector_get_view duckdb_ext_api.duckdb_v2_vector_get_view
+#endif
+#if DUCKDB_V2_API_ALLOW_UNSTABLE
+#define duckdb_v2_vector_make_constant duckdb_ext_api.duckdb_v2_vector_make_constant
+#endif
+#if DUCKDB_V2_API_ALLOW_UNSTABLE
+#define duckdb_v2_vector_make_sequence duckdb_ext_api.duckdb_v2_vector_make_sequence
+#endif
+#if DUCKDB_V2_API_ALLOW_UNSTABLE
+#define duckdb_v2_vector_reference duckdb_ext_api.duckdb_v2_vector_reference
+#endif
+#if DUCKDB_V2_API_ALLOW_UNSTABLE
+#define duckdb_v2_vector_set_null duckdb_ext_api.duckdb_v2_vector_set_null
+#endif
+#if DUCKDB_V2_API_ALLOW_UNSTABLE
+#define duckdb_v2_vector_set_size duckdb_ext_api.duckdb_v2_vector_set_size
+#endif
+#if DUCKDB_V2_API_ALLOW_UNSTABLE
+#define duckdb_v2_vector_set_value duckdb_ext_api.duckdb_v2_vector_set_value
+#endif
+#if DUCKDB_V2_API_ALLOW_UNSTABLE
+#define duckdb_v2_connection_register_scalar_function duckdb_ext_api.duckdb_v2_connection_register_scalar_function
+#endif
+#if DUCKDB_V2_API_ALLOW_UNSTABLE
+#define duckdb_v2_context_log duckdb_ext_api.duckdb_v2_context_log
+#endif
+#if DUCKDB_V2_API_ALLOW_UNSTABLE
+#define duckdb_v2_extension_register_scalar_function duckdb_ext_api.duckdb_v2_extension_register_scalar_function
+#endif
+#if DUCKDB_V2_API_ALLOW_UNSTABLE
+#define duckdb_v2_function_signature_add_parameter duckdb_ext_api.duckdb_v2_function_signature_add_parameter
+#endif
+#if DUCKDB_V2_API_ALLOW_UNSTABLE
+#define duckdb_v2_function_signature_set_return_type duckdb_ext_api.duckdb_v2_function_signature_set_return_type
+#endif
+#if DUCKDB_V2_API_ALLOW_UNSTABLE
+#define duckdb_v2_scalar_function_create duckdb_ext_api.duckdb_v2_scalar_function_create
+#endif
+#if DUCKDB_V2_API_ALLOW_UNSTABLE
+#define duckdb_v2_scalar_function_destroy duckdb_ext_api.duckdb_v2_scalar_function_destroy
+#endif
+#if DUCKDB_V2_API_ALLOW_UNSTABLE
+#define duckdb_v2_scalar_function_exec_get_arg duckdb_ext_api.duckdb_v2_scalar_function_exec_get_arg
+#endif
+#if DUCKDB_V2_API_ALLOW_UNSTABLE
+#define duckdb_v2_scalar_function_exec_get_arg_count duckdb_ext_api.duckdb_v2_scalar_function_exec_get_arg_count
+#endif
+#if DUCKDB_V2_API_ALLOW_UNSTABLE
+#define duckdb_v2_scalar_function_exec_get_bind_data duckdb_ext_api.duckdb_v2_scalar_function_exec_get_bind_data
+#endif
+#if DUCKDB_V2_API_ALLOW_UNSTABLE
+#define duckdb_v2_scalar_function_exec_get_init_data duckdb_ext_api.duckdb_v2_scalar_function_exec_get_init_data
+#endif
+#if DUCKDB_V2_API_ALLOW_UNSTABLE
+#define duckdb_v2_scalar_function_exec_get_result duckdb_ext_api.duckdb_v2_scalar_function_exec_get_result
+#endif
+#if DUCKDB_V2_API_ALLOW_UNSTABLE
+#define duckdb_v2_scalar_function_exec_get_row_count duckdb_ext_api.duckdb_v2_scalar_function_exec_get_row_count
+#endif
+#if DUCKDB_V2_API_ALLOW_UNSTABLE
+#define duckdb_v2_scalar_function_exec_get_user_data duckdb_ext_api.duckdb_v2_scalar_function_exec_get_user_data
+#endif
+#if DUCKDB_V2_API_ALLOW_UNSTABLE
+#define duckdb_v2_scalar_function_get_signature duckdb_ext_api.duckdb_v2_scalar_function_get_signature
+#endif
+#if DUCKDB_V2_API_ALLOW_UNSTABLE
+#define duckdb_v2_scalar_function_init_get_bind_data duckdb_ext_api.duckdb_v2_scalar_function_init_get_bind_data
+#endif
+#if DUCKDB_V2_API_ALLOW_UNSTABLE
+#define duckdb_v2_scalar_function_init_get_user_data duckdb_ext_api.duckdb_v2_scalar_function_init_get_user_data
+#endif
+#if DUCKDB_V2_API_ALLOW_UNSTABLE
+#define duckdb_v2_scalar_function_init_set_init_data duckdb_ext_api.duckdb_v2_scalar_function_init_set_init_data
+#endif
+#if DUCKDB_V2_API_ALLOW_UNSTABLE
+#define duckdb_v2_scalar_function_set_bind_callback duckdb_ext_api.duckdb_v2_scalar_function_set_bind_callback
+#endif
+#if DUCKDB_V2_API_ALLOW_UNSTABLE
+#define duckdb_v2_scalar_function_set_exec_callback duckdb_ext_api.duckdb_v2_scalar_function_set_exec_callback
+#endif
+#if DUCKDB_V2_API_ALLOW_UNSTABLE
+#define duckdb_v2_scalar_function_set_init_callback duckdb_ext_api.duckdb_v2_scalar_function_set_init_callback
+#endif
+#if DUCKDB_V2_API_ALLOW_UNSTABLE
+#define duckdb_v2_scalar_function_set_name duckdb_ext_api.duckdb_v2_scalar_function_set_name
+#endif
+#if DUCKDB_V2_API_ALLOW_UNSTABLE
+#define duckdb_v2_scalar_function_set_user_data duckdb_ext_api.duckdb_v2_scalar_function_set_user_data
+#endif
+#if DUCKDB_V2_API_ALLOW_UNSTABLE
+#define duckdb_v2_aggregate_function_bind_set_return_type                                                              \
+	duckdb_ext_api.duckdb_v2_aggregate_function_bind_set_return_type
+#endif
+#if DUCKDB_V2_API_ALLOW_UNSTABLE
+#define duckdb_v2_aggregate_function_combine_get_bind_data                                                             \
+	duckdb_ext_api.duckdb_v2_aggregate_function_combine_get_bind_data
+#endif
+#if DUCKDB_V2_API_ALLOW_UNSTABLE
+#define duckdb_v2_aggregate_function_combine_get_sources duckdb_ext_api.duckdb_v2_aggregate_function_combine_get_sources
+#endif
+#if DUCKDB_V2_API_ALLOW_UNSTABLE
+#define duckdb_v2_aggregate_function_combine_get_state_count                                                           \
+	duckdb_ext_api.duckdb_v2_aggregate_function_combine_get_state_count
+#endif
+#if DUCKDB_V2_API_ALLOW_UNSTABLE
+#define duckdb_v2_aggregate_function_combine_get_targets duckdb_ext_api.duckdb_v2_aggregate_function_combine_get_targets
+#endif
+#if DUCKDB_V2_API_ALLOW_UNSTABLE
+#define duckdb_v2_aggregate_function_combine_get_user_data                                                             \
+	duckdb_ext_api.duckdb_v2_aggregate_function_combine_get_user_data
+#endif
+#if DUCKDB_V2_API_ALLOW_UNSTABLE
+#define duckdb_v2_aggregate_function_create duckdb_ext_api.duckdb_v2_aggregate_function_create
+#endif
+#if DUCKDB_V2_API_ALLOW_UNSTABLE
+#define duckdb_v2_aggregate_function_destroy duckdb_ext_api.duckdb_v2_aggregate_function_destroy
+#endif
+#if DUCKDB_V2_API_ALLOW_UNSTABLE
+#define duckdb_v2_aggregate_function_destroy_get_bind_data                                                             \
+	duckdb_ext_api.duckdb_v2_aggregate_function_destroy_get_bind_data
+#endif
+#if DUCKDB_V2_API_ALLOW_UNSTABLE
+#define duckdb_v2_aggregate_function_destroy_get_state_count                                                           \
+	duckdb_ext_api.duckdb_v2_aggregate_function_destroy_get_state_count
+#endif
+#if DUCKDB_V2_API_ALLOW_UNSTABLE
+#define duckdb_v2_aggregate_function_destroy_get_states duckdb_ext_api.duckdb_v2_aggregate_function_destroy_get_states
+#endif
+#if DUCKDB_V2_API_ALLOW_UNSTABLE
+#define duckdb_v2_aggregate_function_destroy_get_user_data                                                             \
+	duckdb_ext_api.duckdb_v2_aggregate_function_destroy_get_user_data
+#endif
+#if DUCKDB_V2_API_ALLOW_UNSTABLE
+#define duckdb_v2_aggregate_function_finalize_get_bind_data                                                            \
+	duckdb_ext_api.duckdb_v2_aggregate_function_finalize_get_bind_data
+#endif
+#if DUCKDB_V2_API_ALLOW_UNSTABLE
+#define duckdb_v2_aggregate_function_finalize_get_result duckdb_ext_api.duckdb_v2_aggregate_function_finalize_get_result
+#endif
+#if DUCKDB_V2_API_ALLOW_UNSTABLE
+#define duckdb_v2_aggregate_function_finalize_get_result_offset                                                        \
+	duckdb_ext_api.duckdb_v2_aggregate_function_finalize_get_result_offset
+#endif
+#if DUCKDB_V2_API_ALLOW_UNSTABLE
+#define duckdb_v2_aggregate_function_finalize_get_state_count                                                          \
+	duckdb_ext_api.duckdb_v2_aggregate_function_finalize_get_state_count
+#endif
+#if DUCKDB_V2_API_ALLOW_UNSTABLE
+#define duckdb_v2_aggregate_function_finalize_get_states duckdb_ext_api.duckdb_v2_aggregate_function_finalize_get_states
+#endif
+#if DUCKDB_V2_API_ALLOW_UNSTABLE
+#define duckdb_v2_aggregate_function_finalize_get_user_data                                                            \
+	duckdb_ext_api.duckdb_v2_aggregate_function_finalize_get_user_data
+#endif
+#if DUCKDB_V2_API_ALLOW_UNSTABLE
+#define duckdb_v2_aggregate_function_get_signature duckdb_ext_api.duckdb_v2_aggregate_function_get_signature
+#endif
+#if DUCKDB_V2_API_ALLOW_UNSTABLE
+#define duckdb_v2_aggregate_function_init_get_bind_data duckdb_ext_api.duckdb_v2_aggregate_function_init_get_bind_data
+#endif
+#if DUCKDB_V2_API_ALLOW_UNSTABLE
+#define duckdb_v2_aggregate_function_init_get_state_count                                                              \
+	duckdb_ext_api.duckdb_v2_aggregate_function_init_get_state_count
+#endif
+#if DUCKDB_V2_API_ALLOW_UNSTABLE
+#define duckdb_v2_aggregate_function_init_get_states duckdb_ext_api.duckdb_v2_aggregate_function_init_get_states
+#endif
+#if DUCKDB_V2_API_ALLOW_UNSTABLE
+#define duckdb_v2_aggregate_function_init_get_user_data duckdb_ext_api.duckdb_v2_aggregate_function_init_get_user_data
+#endif
+#if DUCKDB_V2_API_ALLOW_UNSTABLE
+#define duckdb_v2_aggregate_function_set_bind_callback duckdb_ext_api.duckdb_v2_aggregate_function_set_bind_callback
+#endif
+#if DUCKDB_V2_API_ALLOW_UNSTABLE
+#define duckdb_v2_aggregate_function_set_combine_callback                                                              \
+	duckdb_ext_api.duckdb_v2_aggregate_function_set_combine_callback
+#endif
+#if DUCKDB_V2_API_ALLOW_UNSTABLE
+#define duckdb_v2_aggregate_function_set_destroy_callback                                                              \
+	duckdb_ext_api.duckdb_v2_aggregate_function_set_destroy_callback
+#endif
+#if DUCKDB_V2_API_ALLOW_UNSTABLE
+#define duckdb_v2_aggregate_function_set_finalize_callback                                                             \
+	duckdb_ext_api.duckdb_v2_aggregate_function_set_finalize_callback
+#endif
+#if DUCKDB_V2_API_ALLOW_UNSTABLE
+#define duckdb_v2_aggregate_function_set_init_callback duckdb_ext_api.duckdb_v2_aggregate_function_set_init_callback
+#endif
+#if DUCKDB_V2_API_ALLOW_UNSTABLE
+#define duckdb_v2_aggregate_function_set_name duckdb_ext_api.duckdb_v2_aggregate_function_set_name
+#endif
+#if DUCKDB_V2_API_ALLOW_UNSTABLE
+#define duckdb_v2_aggregate_function_set_size_callback duckdb_ext_api.duckdb_v2_aggregate_function_set_size_callback
+#endif
+#if DUCKDB_V2_API_ALLOW_UNSTABLE
+#define duckdb_v2_aggregate_function_set_update_callback duckdb_ext_api.duckdb_v2_aggregate_function_set_update_callback
+#endif
+#if DUCKDB_V2_API_ALLOW_UNSTABLE
+#define duckdb_v2_aggregate_function_set_user_data duckdb_ext_api.duckdb_v2_aggregate_function_set_user_data
+#endif
+#if DUCKDB_V2_API_ALLOW_UNSTABLE
+#define duckdb_v2_aggregate_function_size_get_bind_data duckdb_ext_api.duckdb_v2_aggregate_function_size_get_bind_data
+#endif
+#if DUCKDB_V2_API_ALLOW_UNSTABLE
+#define duckdb_v2_aggregate_function_size_get_user_data duckdb_ext_api.duckdb_v2_aggregate_function_size_get_user_data
+#endif
+#if DUCKDB_V2_API_ALLOW_UNSTABLE
+#define duckdb_v2_aggregate_function_size_set_state_size duckdb_ext_api.duckdb_v2_aggregate_function_size_set_state_size
+#endif
+#if DUCKDB_V2_API_ALLOW_UNSTABLE
+#define duckdb_v2_aggregate_function_update_get_arg duckdb_ext_api.duckdb_v2_aggregate_function_update_get_arg
+#endif
+#if DUCKDB_V2_API_ALLOW_UNSTABLE
+#define duckdb_v2_aggregate_function_update_get_arg_count                                                              \
+	duckdb_ext_api.duckdb_v2_aggregate_function_update_get_arg_count
+#endif
+#if DUCKDB_V2_API_ALLOW_UNSTABLE
+#define duckdb_v2_aggregate_function_update_get_bind_data                                                              \
+	duckdb_ext_api.duckdb_v2_aggregate_function_update_get_bind_data
+#endif
+#if DUCKDB_V2_API_ALLOW_UNSTABLE
+#define duckdb_v2_aggregate_function_update_get_row_count                                                              \
+	duckdb_ext_api.duckdb_v2_aggregate_function_update_get_row_count
+#endif
+#if DUCKDB_V2_API_ALLOW_UNSTABLE
+#define duckdb_v2_aggregate_function_update_get_states duckdb_ext_api.duckdb_v2_aggregate_function_update_get_states
+#endif
+#if DUCKDB_V2_API_ALLOW_UNSTABLE
+#define duckdb_v2_aggregate_function_update_get_user_data                                                              \
+	duckdb_ext_api.duckdb_v2_aggregate_function_update_get_user_data
+#endif
+#if DUCKDB_V2_API_ALLOW_UNSTABLE
+#define duckdb_v2_connection_register_aggregate_function duckdb_ext_api.duckdb_v2_connection_register_aggregate_function
+#endif
+#if DUCKDB_V2_API_ALLOW_UNSTABLE
+#define duckdb_v2_extension_register_aggregate_function duckdb_ext_api.duckdb_v2_extension_register_aggregate_function
+#endif
+#if DUCKDB_V2_API_ALLOW_UNSTABLE
+#define duckdb_v2_aggregate_function_set_property duckdb_ext_api.duckdb_v2_aggregate_function_set_property
+#endif
+#if DUCKDB_V2_API_ALLOW_UNSTABLE
+#define duckdb_v2_scalar_function_set_property duckdb_ext_api.duckdb_v2_scalar_function_set_property
+#endif
+#if DUCKDB_V2_API_ALLOW_UNSTABLE
+#define duckdb_v2_connection_register_table_function duckdb_ext_api.duckdb_v2_connection_register_table_function
+#endif
+#if DUCKDB_V2_API_ALLOW_UNSTABLE
+#define duckdb_v2_extension_register_table_function duckdb_ext_api.duckdb_v2_extension_register_table_function
+#endif
+#if DUCKDB_V2_API_ALLOW_UNSTABLE
+#define duckdb_v2_table_function_bind_add_result_column duckdb_ext_api.duckdb_v2_table_function_bind_add_result_column
+#endif
+#if DUCKDB_V2_API_ALLOW_UNSTABLE
+#define duckdb_v2_table_function_bind_set_cardinality duckdb_ext_api.duckdb_v2_table_function_bind_set_cardinality
+#endif
+#if DUCKDB_V2_API_ALLOW_UNSTABLE
+#define duckdb_v2_table_function_create duckdb_ext_api.duckdb_v2_table_function_create
+#endif
+#if DUCKDB_V2_API_ALLOW_UNSTABLE
+#define duckdb_v2_table_function_destroy duckdb_ext_api.duckdb_v2_table_function_destroy
+#endif
+#if DUCKDB_V2_API_ALLOW_UNSTABLE
+#define duckdb_v2_table_function_exec_get_bind_data duckdb_ext_api.duckdb_v2_table_function_exec_get_bind_data
+#endif
+#if DUCKDB_V2_API_ALLOW_UNSTABLE
+#define duckdb_v2_table_function_exec_get_global_state duckdb_ext_api.duckdb_v2_table_function_exec_get_global_state
+#endif
+#if DUCKDB_V2_API_ALLOW_UNSTABLE
+#define duckdb_v2_table_function_exec_get_local_state duckdb_ext_api.duckdb_v2_table_function_exec_get_local_state
+#endif
+#if DUCKDB_V2_API_ALLOW_UNSTABLE
+#define duckdb_v2_table_function_exec_get_output_chunk duckdb_ext_api.duckdb_v2_table_function_exec_get_output_chunk
+#endif
+#if DUCKDB_V2_API_ALLOW_UNSTABLE
+#define duckdb_v2_table_function_exec_get_user_data duckdb_ext_api.duckdb_v2_table_function_exec_get_user_data
+#endif
+#if DUCKDB_V2_API_ALLOW_UNSTABLE
+#define duckdb_v2_table_function_get_signature duckdb_ext_api.duckdb_v2_table_function_get_signature
+#endif
+#if DUCKDB_V2_API_ALLOW_UNSTABLE
+#define duckdb_v2_table_function_init_global_get_bind_data                                                             \
+	duckdb_ext_api.duckdb_v2_table_function_init_global_get_bind_data
+#endif
+#if DUCKDB_V2_API_ALLOW_UNSTABLE
+#define duckdb_v2_table_function_init_global_get_user_data                                                             \
+	duckdb_ext_api.duckdb_v2_table_function_init_global_get_user_data
+#endif
+#if DUCKDB_V2_API_ALLOW_UNSTABLE
+#define duckdb_v2_table_function_init_global_set_global_state                                                          \
+	duckdb_ext_api.duckdb_v2_table_function_init_global_set_global_state
+#endif
+#if DUCKDB_V2_API_ALLOW_UNSTABLE
+#define duckdb_v2_table_function_init_global_set_max_threads                                                           \
+	duckdb_ext_api.duckdb_v2_table_function_init_global_set_max_threads
+#endif
+#if DUCKDB_V2_API_ALLOW_UNSTABLE
+#define duckdb_v2_table_function_init_local_get_bind_data                                                              \
+	duckdb_ext_api.duckdb_v2_table_function_init_local_get_bind_data
+#endif
+#if DUCKDB_V2_API_ALLOW_UNSTABLE
+#define duckdb_v2_table_function_init_local_get_global_state                                                           \
+	duckdb_ext_api.duckdb_v2_table_function_init_local_get_global_state
+#endif
+#if DUCKDB_V2_API_ALLOW_UNSTABLE
+#define duckdb_v2_table_function_init_local_get_user_data                                                              \
+	duckdb_ext_api.duckdb_v2_table_function_init_local_get_user_data
+#endif
+#if DUCKDB_V2_API_ALLOW_UNSTABLE
+#define duckdb_v2_table_function_init_local_set_local_state                                                            \
+	duckdb_ext_api.duckdb_v2_table_function_init_local_set_local_state
+#endif
+#if DUCKDB_V2_API_ALLOW_UNSTABLE
+#define duckdb_v2_table_function_progress_get_bind_data duckdb_ext_api.duckdb_v2_table_function_progress_get_bind_data
+#endif
+#if DUCKDB_V2_API_ALLOW_UNSTABLE
+#define duckdb_v2_table_function_progress_get_global_state                                                             \
+	duckdb_ext_api.duckdb_v2_table_function_progress_get_global_state
+#endif
+#if DUCKDB_V2_API_ALLOW_UNSTABLE
+#define duckdb_v2_table_function_progress_get_user_data duckdb_ext_api.duckdb_v2_table_function_progress_get_user_data
+#endif
+#if DUCKDB_V2_API_ALLOW_UNSTABLE
+#define duckdb_v2_table_function_progress_set_progress duckdb_ext_api.duckdb_v2_table_function_progress_set_progress
+#endif
+#if DUCKDB_V2_API_ALLOW_UNSTABLE
+#define duckdb_v2_table_function_set_bind_callback duckdb_ext_api.duckdb_v2_table_function_set_bind_callback
+#endif
+#if DUCKDB_V2_API_ALLOW_UNSTABLE
+#define duckdb_v2_table_function_set_exec_callback duckdb_ext_api.duckdb_v2_table_function_set_exec_callback
+#endif
+#if DUCKDB_V2_API_ALLOW_UNSTABLE
+#define duckdb_v2_table_function_set_init_global_callback                                                              \
+	duckdb_ext_api.duckdb_v2_table_function_set_init_global_callback
+#endif
+#if DUCKDB_V2_API_ALLOW_UNSTABLE
+#define duckdb_v2_table_function_set_init_local_callback duckdb_ext_api.duckdb_v2_table_function_set_init_local_callback
+#endif
+#if DUCKDB_V2_API_ALLOW_UNSTABLE
+#define duckdb_v2_table_function_set_name duckdb_ext_api.duckdb_v2_table_function_set_name
+#endif
+#if DUCKDB_V2_API_ALLOW_UNSTABLE
+#define duckdb_v2_table_function_set_progress_callback duckdb_ext_api.duckdb_v2_table_function_set_progress_callback
+#endif
+#if DUCKDB_V2_API_ALLOW_UNSTABLE
+#define duckdb_v2_table_function_set_user_data duckdb_ext_api.duckdb_v2_table_function_set_user_data
+#endif
+#if DUCKDB_V2_API_ALLOW_UNSTABLE
+#define duckdb_v2_cast_function_create duckdb_ext_api.duckdb_v2_cast_function_create
+#endif
+#if DUCKDB_V2_API_ALLOW_UNSTABLE
+#define duckdb_v2_cast_function_destroy duckdb_ext_api.duckdb_v2_cast_function_destroy
+#endif
+#if DUCKDB_V2_API_ALLOW_UNSTABLE
+#define duckdb_v2_cast_function_exec_get_input duckdb_ext_api.duckdb_v2_cast_function_exec_get_input
+#endif
+#if DUCKDB_V2_API_ALLOW_UNSTABLE
+#define duckdb_v2_cast_function_exec_get_mode duckdb_ext_api.duckdb_v2_cast_function_exec_get_mode
+#endif
+#if DUCKDB_V2_API_ALLOW_UNSTABLE
+#define duckdb_v2_cast_function_exec_get_output duckdb_ext_api.duckdb_v2_cast_function_exec_get_output
+#endif
+#if DUCKDB_V2_API_ALLOW_UNSTABLE
+#define duckdb_v2_cast_function_exec_get_row_count duckdb_ext_api.duckdb_v2_cast_function_exec_get_row_count
+#endif
+#if DUCKDB_V2_API_ALLOW_UNSTABLE
+#define duckdb_v2_cast_function_exec_get_user_data duckdb_ext_api.duckdb_v2_cast_function_exec_get_user_data
+#endif
+#if DUCKDB_V2_API_ALLOW_UNSTABLE
+#define duckdb_v2_cast_function_set_exec_callback duckdb_ext_api.duckdb_v2_cast_function_set_exec_callback
+#endif
+#if DUCKDB_V2_API_ALLOW_UNSTABLE
+#define duckdb_v2_cast_function_set_implicit_cast_cost duckdb_ext_api.duckdb_v2_cast_function_set_implicit_cast_cost
+#endif
+#if DUCKDB_V2_API_ALLOW_UNSTABLE
+#define duckdb_v2_cast_function_set_source_type duckdb_ext_api.duckdb_v2_cast_function_set_source_type
+#endif
+#if DUCKDB_V2_API_ALLOW_UNSTABLE
+#define duckdb_v2_cast_function_set_target_type duckdb_ext_api.duckdb_v2_cast_function_set_target_type
+#endif
+#if DUCKDB_V2_API_ALLOW_UNSTABLE
+#define duckdb_v2_cast_function_set_user_data duckdb_ext_api.duckdb_v2_cast_function_set_user_data
+#endif
+#if DUCKDB_V2_API_ALLOW_UNSTABLE
+#define duckdb_v2_column_data_collection_clear duckdb_ext_api.duckdb_v2_column_data_collection_clear
+#endif
+#if DUCKDB_V2_API_ALLOW_UNSTABLE
+#define duckdb_v2_connection_register_cast_function duckdb_ext_api.duckdb_v2_connection_register_cast_function
+#endif
+#if DUCKDB_V2_API_ALLOW_UNSTABLE
+#define duckdb_v2_connection_register_custom_type duckdb_ext_api.duckdb_v2_connection_register_custom_type
+#endif
+#if DUCKDB_V2_API_ALLOW_UNSTABLE
+#define duckdb_v2_connection_register_replacement_scan duckdb_ext_api.duckdb_v2_connection_register_replacement_scan
+#endif
+#if DUCKDB_V2_API_ALLOW_UNSTABLE
+#define duckdb_v2_context_get_file_system duckdb_ext_api.duckdb_v2_context_get_file_system
+#endif
+#if DUCKDB_V2_API_ALLOW_UNSTABLE
+#define duckdb_v2_custom_type_create duckdb_ext_api.duckdb_v2_custom_type_create
+#endif
+#if DUCKDB_V2_API_ALLOW_UNSTABLE
+#define duckdb_v2_custom_type_destroy duckdb_ext_api.duckdb_v2_custom_type_destroy
+#endif
+#if DUCKDB_V2_API_ALLOW_UNSTABLE
+#define duckdb_v2_custom_type_set_base_type duckdb_ext_api.duckdb_v2_custom_type_set_base_type
+#endif
+#if DUCKDB_V2_API_ALLOW_UNSTABLE
+#define duckdb_v2_custom_type_set_name duckdb_ext_api.duckdb_v2_custom_type_set_name
+#endif
+#if DUCKDB_V2_API_ALLOW_UNSTABLE
+#define duckdb_v2_extension_register_cast_function duckdb_ext_api.duckdb_v2_extension_register_cast_function
+#endif
+#if DUCKDB_V2_API_ALLOW_UNSTABLE
+#define duckdb_v2_extension_register_custom_type duckdb_ext_api.duckdb_v2_extension_register_custom_type
+#endif
+#if DUCKDB_V2_API_ALLOW_UNSTABLE
+#define duckdb_v2_extension_register_replacement_scan duckdb_ext_api.duckdb_v2_extension_register_replacement_scan
+#endif
+#if DUCKDB_V2_API_ALLOW_UNSTABLE
+#define duckdb_v2_file_close duckdb_ext_api.duckdb_v2_file_close
+#endif
+#if DUCKDB_V2_API_ALLOW_UNSTABLE
+#define duckdb_v2_file_destroy duckdb_ext_api.duckdb_v2_file_destroy
+#endif
+#if DUCKDB_V2_API_ALLOW_UNSTABLE
+#define duckdb_v2_file_open_options_create duckdb_ext_api.duckdb_v2_file_open_options_create
+#endif
+#if DUCKDB_V2_API_ALLOW_UNSTABLE
+#define duckdb_v2_file_open_options_destroy duckdb_ext_api.duckdb_v2_file_open_options_destroy
+#endif
+#if DUCKDB_V2_API_ALLOW_UNSTABLE
+#define duckdb_v2_file_open_options_set_flag duckdb_ext_api.duckdb_v2_file_open_options_set_flag
+#endif
+#if DUCKDB_V2_API_ALLOW_UNSTABLE
+#define duckdb_v2_file_open_options_set_value duckdb_ext_api.duckdb_v2_file_open_options_set_value
+#endif
+#if DUCKDB_V2_API_ALLOW_UNSTABLE
+#define duckdb_v2_file_read duckdb_ext_api.duckdb_v2_file_read
+#endif
+#if DUCKDB_V2_API_ALLOW_UNSTABLE
+#define duckdb_v2_file_read_at duckdb_ext_api.duckdb_v2_file_read_at
+#endif
+#if DUCKDB_V2_API_ALLOW_UNSTABLE
+#define duckdb_v2_file_seek duckdb_ext_api.duckdb_v2_file_seek
+#endif
+#if DUCKDB_V2_API_ALLOW_UNSTABLE
+#define duckdb_v2_file_size duckdb_ext_api.duckdb_v2_file_size
+#endif
+#if DUCKDB_V2_API_ALLOW_UNSTABLE
+#define duckdb_v2_file_sync duckdb_ext_api.duckdb_v2_file_sync
+#endif
+#if DUCKDB_V2_API_ALLOW_UNSTABLE
+#define duckdb_v2_file_system_open duckdb_ext_api.duckdb_v2_file_system_open
+#endif
+#if DUCKDB_V2_API_ALLOW_UNSTABLE
+#define duckdb_v2_file_tell duckdb_ext_api.duckdb_v2_file_tell
+#endif
+#if DUCKDB_V2_API_ALLOW_UNSTABLE
+#define duckdb_v2_file_write duckdb_ext_api.duckdb_v2_file_write
+#endif
+#if DUCKDB_V2_API_ALLOW_UNSTABLE
+#define duckdb_v2_file_write_at duckdb_ext_api.duckdb_v2_file_write_at
+#endif
+#if DUCKDB_V2_API_ALLOW_UNSTABLE
+#define duckdb_v2_instance_register_replacement_scan duckdb_ext_api.duckdb_v2_instance_register_replacement_scan
+#endif
+#if DUCKDB_V2_API_ALLOW_UNSTABLE
+#define duckdb_v2_qname_create duckdb_ext_api.duckdb_v2_qname_create
+#endif
+#if DUCKDB_V2_API_ALLOW_UNSTABLE
+#define duckdb_v2_qname_destroy duckdb_ext_api.duckdb_v2_qname_destroy
+#endif
+#if DUCKDB_V2_API_ALLOW_UNSTABLE
+#define duckdb_v2_qname_equals duckdb_ext_api.duckdb_v2_qname_equals
+#endif
+#if DUCKDB_V2_API_ALLOW_UNSTABLE
+#define duckdb_v2_qname_get_part duckdb_ext_api.duckdb_v2_qname_get_part
+#endif
+#if DUCKDB_V2_API_ALLOW_UNSTABLE
+#define duckdb_v2_qname_get_part_count duckdb_ext_api.duckdb_v2_qname_get_part_count
+#endif
+#if DUCKDB_V2_API_ALLOW_UNSTABLE
+#define duckdb_v2_qname_hash duckdb_ext_api.duckdb_v2_qname_hash
+#endif
+#if DUCKDB_V2_API_ALLOW_UNSTABLE
+#define duckdb_v2_qname_parse duckdb_ext_api.duckdb_v2_qname_parse
+#endif
+#if DUCKDB_V2_API_ALLOW_UNSTABLE
+#define duckdb_v2_qname_render duckdb_ext_api.duckdb_v2_qname_render
+#endif
+#if DUCKDB_V2_API_ALLOW_UNSTABLE
+#define duckdb_v2_replacement_scan_add_argument duckdb_ext_api.duckdb_v2_replacement_scan_add_argument
+#endif
+#if DUCKDB_V2_API_ALLOW_UNSTABLE
+#define duckdb_v2_replacement_scan_add_named_argument duckdb_ext_api.duckdb_v2_replacement_scan_add_named_argument
+#endif
+#if DUCKDB_V2_API_ALLOW_UNSTABLE
+#define duckdb_v2_replacement_scan_create duckdb_ext_api.duckdb_v2_replacement_scan_create
+#endif
+#if DUCKDB_V2_API_ALLOW_UNSTABLE
+#define duckdb_v2_replacement_scan_destroy duckdb_ext_api.duckdb_v2_replacement_scan_destroy
+#endif
+#if DUCKDB_V2_API_ALLOW_UNSTABLE
+#define duckdb_v2_replacement_scan_get_name duckdb_ext_api.duckdb_v2_replacement_scan_get_name
+#endif
+#if DUCKDB_V2_API_ALLOW_UNSTABLE
+#define duckdb_v2_replacement_scan_get_user_data duckdb_ext_api.duckdb_v2_replacement_scan_get_user_data
+#endif
+#if DUCKDB_V2_API_ALLOW_UNSTABLE
+#define duckdb_v2_replacement_scan_set_alias duckdb_ext_api.duckdb_v2_replacement_scan_set_alias
+#endif
+#if DUCKDB_V2_API_ALLOW_UNSTABLE
+#define duckdb_v2_replacement_scan_set_callback duckdb_ext_api.duckdb_v2_replacement_scan_set_callback
+#endif
+#if DUCKDB_V2_API_ALLOW_UNSTABLE
+#define duckdb_v2_replacement_scan_set_collection duckdb_ext_api.duckdb_v2_replacement_scan_set_collection
+#endif
+#if DUCKDB_V2_API_ALLOW_UNSTABLE
+#define duckdb_v2_replacement_scan_set_function_name duckdb_ext_api.duckdb_v2_replacement_scan_set_function_name
+#endif
+#if DUCKDB_V2_API_ALLOW_UNSTABLE
+#define duckdb_v2_replacement_scan_set_subquery duckdb_ext_api.duckdb_v2_replacement_scan_set_subquery
+#endif
+#if DUCKDB_V2_API_ALLOW_UNSTABLE
+#define duckdb_v2_replacement_scan_set_user_data duckdb_ext_api.duckdb_v2_replacement_scan_set_user_data
+#endif
+#if DUCKDB_V2_API_ALLOW_UNSTABLE
+#define duckdb_v2_arrow_exporter_append duckdb_ext_api.duckdb_v2_arrow_exporter_append
+#endif
+#if DUCKDB_V2_API_ALLOW_UNSTABLE
+#define duckdb_v2_arrow_exporter_create duckdb_ext_api.duckdb_v2_arrow_exporter_create
+#endif
+#if DUCKDB_V2_API_ALLOW_UNSTABLE
+#define duckdb_v2_arrow_exporter_destroy duckdb_ext_api.duckdb_v2_arrow_exporter_destroy
+#endif
+#if DUCKDB_V2_API_ALLOW_UNSTABLE
+#define duckdb_v2_arrow_exporter_get_schema duckdb_ext_api.duckdb_v2_arrow_exporter_get_schema
+#endif
+#if DUCKDB_V2_API_ALLOW_UNSTABLE
+#define duckdb_v2_arrow_exporter_next_array duckdb_ext_api.duckdb_v2_arrow_exporter_next_array
+#endif
+#if DUCKDB_V2_API_ALLOW_UNSTABLE
+#define duckdb_v2_arrow_importer_append duckdb_ext_api.duckdb_v2_arrow_importer_append
+#endif
+#if DUCKDB_V2_API_ALLOW_UNSTABLE
+#define duckdb_v2_arrow_importer_create duckdb_ext_api.duckdb_v2_arrow_importer_create
+#endif
+#if DUCKDB_V2_API_ALLOW_UNSTABLE
+#define duckdb_v2_arrow_importer_destroy duckdb_ext_api.duckdb_v2_arrow_importer_destroy
+#endif
+#if DUCKDB_V2_API_ALLOW_UNSTABLE
+#define duckdb_v2_arrow_importer_get_schema duckdb_ext_api.duckdb_v2_arrow_importer_get_schema
+#endif
+#if DUCKDB_V2_API_ALLOW_UNSTABLE
+#define duckdb_v2_arrow_importer_next_chunk duckdb_ext_api.duckdb_v2_arrow_importer_next_chunk
+#endif
+#if DUCKDB_V2_API_ALLOW_UNSTABLE
+#define duckdb_v2_column_description_destroy duckdb_ext_api.duckdb_v2_column_description_destroy
+#endif
+#if DUCKDB_V2_API_ALLOW_UNSTABLE
+#define duckdb_v2_column_description_get_name duckdb_ext_api.duckdb_v2_column_description_get_name
+#endif
+#if DUCKDB_V2_API_ALLOW_UNSTABLE
+#define duckdb_v2_column_description_get_type duckdb_ext_api.duckdb_v2_column_description_get_type
+#endif
+#if DUCKDB_V2_API_ALLOW_UNSTABLE
+#define duckdb_v2_column_description_has_default duckdb_ext_api.duckdb_v2_column_description_has_default
+#endif
+#if DUCKDB_V2_API_ALLOW_UNSTABLE
+#define duckdb_v2_column_description_has_generated duckdb_ext_api.duckdb_v2_column_description_has_generated
+#endif
+#if DUCKDB_V2_API_ALLOW_UNSTABLE
+#define duckdb_v2_connection_describe_table duckdb_ext_api.duckdb_v2_connection_describe_table
+#endif
+#if DUCKDB_V2_API_ALLOW_UNSTABLE
+#define duckdb_v2_connection_register_copy_function duckdb_ext_api.duckdb_v2_connection_register_copy_function
+#endif
+#if DUCKDB_V2_API_ALLOW_UNSTABLE
+#define duckdb_v2_copy_from_bind_get_column_count duckdb_ext_api.duckdb_v2_copy_from_bind_get_column_count
+#endif
+#if DUCKDB_V2_API_ALLOW_UNSTABLE
+#define duckdb_v2_copy_from_bind_get_column_name duckdb_ext_api.duckdb_v2_copy_from_bind_get_column_name
+#endif
+#if DUCKDB_V2_API_ALLOW_UNSTABLE
+#define duckdb_v2_copy_from_bind_get_column_type duckdb_ext_api.duckdb_v2_copy_from_bind_get_column_type
+#endif
+#if DUCKDB_V2_API_ALLOW_UNSTABLE
+#define duckdb_v2_copy_from_bind_get_file_path duckdb_ext_api.duckdb_v2_copy_from_bind_get_file_path
+#endif
+#if DUCKDB_V2_API_ALLOW_UNSTABLE
+#define duckdb_v2_copy_from_bind_get_option_count duckdb_ext_api.duckdb_v2_copy_from_bind_get_option_count
+#endif
+#if DUCKDB_V2_API_ALLOW_UNSTABLE
+#define duckdb_v2_copy_from_bind_get_option_name duckdb_ext_api.duckdb_v2_copy_from_bind_get_option_name
+#endif
+#if DUCKDB_V2_API_ALLOW_UNSTABLE
+#define duckdb_v2_copy_from_bind_get_option_value duckdb_ext_api.duckdb_v2_copy_from_bind_get_option_value
+#endif
+#if DUCKDB_V2_API_ALLOW_UNSTABLE
+#define duckdb_v2_copy_from_bind_get_user_data duckdb_ext_api.duckdb_v2_copy_from_bind_get_user_data
+#endif
+#if DUCKDB_V2_API_ALLOW_UNSTABLE
+#define duckdb_v2_copy_from_bind_set_bind_data duckdb_ext_api.duckdb_v2_copy_from_bind_set_bind_data
+#endif
+#if DUCKDB_V2_API_ALLOW_UNSTABLE
+#define duckdb_v2_copy_from_bind_set_cardinality duckdb_ext_api.duckdb_v2_copy_from_bind_set_cardinality
+#endif
+#if DUCKDB_V2_API_ALLOW_UNSTABLE
+#define duckdb_v2_copy_from_exec_get_bind_data duckdb_ext_api.duckdb_v2_copy_from_exec_get_bind_data
+#endif
+#if DUCKDB_V2_API_ALLOW_UNSTABLE
+#define duckdb_v2_copy_from_exec_get_global_state duckdb_ext_api.duckdb_v2_copy_from_exec_get_global_state
+#endif
+#if DUCKDB_V2_API_ALLOW_UNSTABLE
+#define duckdb_v2_copy_from_exec_get_local_state duckdb_ext_api.duckdb_v2_copy_from_exec_get_local_state
+#endif
+#if DUCKDB_V2_API_ALLOW_UNSTABLE
+#define duckdb_v2_copy_from_exec_get_output_chunk duckdb_ext_api.duckdb_v2_copy_from_exec_get_output_chunk
+#endif
+#if DUCKDB_V2_API_ALLOW_UNSTABLE
+#define duckdb_v2_copy_from_exec_get_user_data duckdb_ext_api.duckdb_v2_copy_from_exec_get_user_data
+#endif
+#if DUCKDB_V2_API_ALLOW_UNSTABLE
+#define duckdb_v2_copy_from_init_global_get_bind_data duckdb_ext_api.duckdb_v2_copy_from_init_global_get_bind_data
+#endif
+#if DUCKDB_V2_API_ALLOW_UNSTABLE
+#define duckdb_v2_copy_from_init_global_get_user_data duckdb_ext_api.duckdb_v2_copy_from_init_global_get_user_data
+#endif
+#if DUCKDB_V2_API_ALLOW_UNSTABLE
+#define duckdb_v2_copy_from_init_global_set_global_state duckdb_ext_api.duckdb_v2_copy_from_init_global_set_global_state
+#endif
+#if DUCKDB_V2_API_ALLOW_UNSTABLE
+#define duckdb_v2_copy_from_init_global_set_max_threads duckdb_ext_api.duckdb_v2_copy_from_init_global_set_max_threads
+#endif
+#if DUCKDB_V2_API_ALLOW_UNSTABLE
+#define duckdb_v2_copy_from_init_local_get_bind_data duckdb_ext_api.duckdb_v2_copy_from_init_local_get_bind_data
+#endif
+#if DUCKDB_V2_API_ALLOW_UNSTABLE
+#define duckdb_v2_copy_from_init_local_get_global_state duckdb_ext_api.duckdb_v2_copy_from_init_local_get_global_state
+#endif
+#if DUCKDB_V2_API_ALLOW_UNSTABLE
+#define duckdb_v2_copy_from_init_local_get_user_data duckdb_ext_api.duckdb_v2_copy_from_init_local_get_user_data
+#endif
+#if DUCKDB_V2_API_ALLOW_UNSTABLE
+#define duckdb_v2_copy_from_init_local_set_local_state duckdb_ext_api.duckdb_v2_copy_from_init_local_set_local_state
+#endif
+#if DUCKDB_V2_API_ALLOW_UNSTABLE
+#define duckdb_v2_copy_from_progress_get_bind_data duckdb_ext_api.duckdb_v2_copy_from_progress_get_bind_data
+#endif
+#if DUCKDB_V2_API_ALLOW_UNSTABLE
+#define duckdb_v2_copy_from_progress_get_global_state duckdb_ext_api.duckdb_v2_copy_from_progress_get_global_state
+#endif
+#if DUCKDB_V2_API_ALLOW_UNSTABLE
+#define duckdb_v2_copy_from_progress_get_user_data duckdb_ext_api.duckdb_v2_copy_from_progress_get_user_data
+#endif
+#if DUCKDB_V2_API_ALLOW_UNSTABLE
+#define duckdb_v2_copy_from_progress_set_progress duckdb_ext_api.duckdb_v2_copy_from_progress_set_progress
+#endif
+#if DUCKDB_V2_API_ALLOW_UNSTABLE
+#define duckdb_v2_copy_from_set_bind_callback duckdb_ext_api.duckdb_v2_copy_from_set_bind_callback
+#endif
+#if DUCKDB_V2_API_ALLOW_UNSTABLE
+#define duckdb_v2_copy_from_set_exec_callback duckdb_ext_api.duckdb_v2_copy_from_set_exec_callback
+#endif
+#if DUCKDB_V2_API_ALLOW_UNSTABLE
+#define duckdb_v2_copy_from_set_init_global_callback duckdb_ext_api.duckdb_v2_copy_from_set_init_global_callback
+#endif
+#if DUCKDB_V2_API_ALLOW_UNSTABLE
+#define duckdb_v2_copy_from_set_init_local_callback duckdb_ext_api.duckdb_v2_copy_from_set_init_local_callback
+#endif
+#if DUCKDB_V2_API_ALLOW_UNSTABLE
+#define duckdb_v2_copy_from_set_progress_callback duckdb_ext_api.duckdb_v2_copy_from_set_progress_callback
+#endif
+#if DUCKDB_V2_API_ALLOW_UNSTABLE
+#define duckdb_v2_copy_function_create duckdb_ext_api.duckdb_v2_copy_function_create
+#endif
+#if DUCKDB_V2_API_ALLOW_UNSTABLE
+#define duckdb_v2_copy_function_destroy duckdb_ext_api.duckdb_v2_copy_function_destroy
+#endif
+#if DUCKDB_V2_API_ALLOW_UNSTABLE
+#define duckdb_v2_copy_function_set_name duckdb_ext_api.duckdb_v2_copy_function_set_name
+#endif
+#if DUCKDB_V2_API_ALLOW_UNSTABLE
+#define duckdb_v2_copy_function_set_user_data duckdb_ext_api.duckdb_v2_copy_function_set_user_data
+#endif
+#if DUCKDB_V2_API_ALLOW_UNSTABLE
+#define duckdb_v2_copy_to_batch_get_bind_data duckdb_ext_api.duckdb_v2_copy_to_batch_get_bind_data
+#endif
+#if DUCKDB_V2_API_ALLOW_UNSTABLE
+#define duckdb_v2_copy_to_batch_get_init_data duckdb_ext_api.duckdb_v2_copy_to_batch_get_init_data
+#endif
+#if DUCKDB_V2_API_ALLOW_UNSTABLE
+#define duckdb_v2_copy_to_batch_get_user_data duckdb_ext_api.duckdb_v2_copy_to_batch_get_user_data
+#endif
+#if DUCKDB_V2_API_ALLOW_UNSTABLE
+#define duckdb_v2_copy_to_batch_set_batch_data duckdb_ext_api.duckdb_v2_copy_to_batch_set_batch_data
+#endif
+#if DUCKDB_V2_API_ALLOW_UNSTABLE
+#define duckdb_v2_copy_to_batch_size_get_bind_data duckdb_ext_api.duckdb_v2_copy_to_batch_size_get_bind_data
+#endif
+#if DUCKDB_V2_API_ALLOW_UNSTABLE
+#define duckdb_v2_copy_to_batch_size_get_user_data duckdb_ext_api.duckdb_v2_copy_to_batch_size_get_user_data
+#endif
+#if DUCKDB_V2_API_ALLOW_UNSTABLE
+#define duckdb_v2_copy_to_batch_size_set_target duckdb_ext_api.duckdb_v2_copy_to_batch_size_set_target
+#endif
+#if DUCKDB_V2_API_ALLOW_UNSTABLE
+#define duckdb_v2_copy_to_batch_take_input duckdb_ext_api.duckdb_v2_copy_to_batch_take_input
+#endif
+#if DUCKDB_V2_API_ALLOW_UNSTABLE
+#define duckdb_v2_copy_to_bind_get_column_count duckdb_ext_api.duckdb_v2_copy_to_bind_get_column_count
+#endif
+#if DUCKDB_V2_API_ALLOW_UNSTABLE
+#define duckdb_v2_copy_to_bind_get_column_name duckdb_ext_api.duckdb_v2_copy_to_bind_get_column_name
+#endif
+#if DUCKDB_V2_API_ALLOW_UNSTABLE
+#define duckdb_v2_copy_to_bind_get_column_type duckdb_ext_api.duckdb_v2_copy_to_bind_get_column_type
+#endif
+#if DUCKDB_V2_API_ALLOW_UNSTABLE
+#define duckdb_v2_copy_to_bind_get_file_path duckdb_ext_api.duckdb_v2_copy_to_bind_get_file_path
+#endif
+#if DUCKDB_V2_API_ALLOW_UNSTABLE
+#define duckdb_v2_copy_to_bind_get_option_count duckdb_ext_api.duckdb_v2_copy_to_bind_get_option_count
+#endif
+#if DUCKDB_V2_API_ALLOW_UNSTABLE
+#define duckdb_v2_copy_to_bind_get_option_name duckdb_ext_api.duckdb_v2_copy_to_bind_get_option_name
+#endif
+#if DUCKDB_V2_API_ALLOW_UNSTABLE
+#define duckdb_v2_copy_to_bind_get_option_value duckdb_ext_api.duckdb_v2_copy_to_bind_get_option_value
+#endif
+#if DUCKDB_V2_API_ALLOW_UNSTABLE
+#define duckdb_v2_copy_to_bind_get_user_data duckdb_ext_api.duckdb_v2_copy_to_bind_get_user_data
+#endif
+#if DUCKDB_V2_API_ALLOW_UNSTABLE
+#define duckdb_v2_copy_to_bind_set_bind_data duckdb_ext_api.duckdb_v2_copy_to_bind_set_bind_data
+#endif
+#if DUCKDB_V2_API_ALLOW_UNSTABLE
+#define duckdb_v2_copy_to_finalize_get_bind_data duckdb_ext_api.duckdb_v2_copy_to_finalize_get_bind_data
+#endif
+#if DUCKDB_V2_API_ALLOW_UNSTABLE
+#define duckdb_v2_copy_to_finalize_get_init_data duckdb_ext_api.duckdb_v2_copy_to_finalize_get_init_data
+#endif
+#if DUCKDB_V2_API_ALLOW_UNSTABLE
+#define duckdb_v2_copy_to_finalize_get_user_data duckdb_ext_api.duckdb_v2_copy_to_finalize_get_user_data
+#endif
+#if DUCKDB_V2_API_ALLOW_UNSTABLE
+#define duckdb_v2_copy_to_flush_get_batch_data duckdb_ext_api.duckdb_v2_copy_to_flush_get_batch_data
+#endif
+#if DUCKDB_V2_API_ALLOW_UNSTABLE
+#define duckdb_v2_copy_to_flush_get_bind_data duckdb_ext_api.duckdb_v2_copy_to_flush_get_bind_data
+#endif
+#if DUCKDB_V2_API_ALLOW_UNSTABLE
+#define duckdb_v2_copy_to_flush_get_init_data duckdb_ext_api.duckdb_v2_copy_to_flush_get_init_data
+#endif
+#if DUCKDB_V2_API_ALLOW_UNSTABLE
+#define duckdb_v2_copy_to_flush_get_user_data duckdb_ext_api.duckdb_v2_copy_to_flush_get_user_data
+#endif
+#if DUCKDB_V2_API_ALLOW_UNSTABLE
+#define duckdb_v2_copy_to_init_get_bind_data duckdb_ext_api.duckdb_v2_copy_to_init_get_bind_data
+#endif
+#if DUCKDB_V2_API_ALLOW_UNSTABLE
+#define duckdb_v2_copy_to_init_get_file_path duckdb_ext_api.duckdb_v2_copy_to_init_get_file_path
+#endif
+#if DUCKDB_V2_API_ALLOW_UNSTABLE
+#define duckdb_v2_copy_to_init_get_user_data duckdb_ext_api.duckdb_v2_copy_to_init_get_user_data
+#endif
+#if DUCKDB_V2_API_ALLOW_UNSTABLE
+#define duckdb_v2_copy_to_init_set_init_data duckdb_ext_api.duckdb_v2_copy_to_init_set_init_data
+#endif
+#if DUCKDB_V2_API_ALLOW_UNSTABLE
+#define duckdb_v2_copy_to_set_batch_callback duckdb_ext_api.duckdb_v2_copy_to_set_batch_callback
+#endif
+#if DUCKDB_V2_API_ALLOW_UNSTABLE
+#define duckdb_v2_copy_to_set_batch_size_callback duckdb_ext_api.duckdb_v2_copy_to_set_batch_size_callback
+#endif
+#if DUCKDB_V2_API_ALLOW_UNSTABLE
+#define duckdb_v2_copy_to_set_bind_callback duckdb_ext_api.duckdb_v2_copy_to_set_bind_callback
+#endif
+#if DUCKDB_V2_API_ALLOW_UNSTABLE
+#define duckdb_v2_copy_to_set_finalize_callback duckdb_ext_api.duckdb_v2_copy_to_set_finalize_callback
+#endif
+#if DUCKDB_V2_API_ALLOW_UNSTABLE
+#define duckdb_v2_copy_to_set_flush_callback duckdb_ext_api.duckdb_v2_copy_to_set_flush_callback
+#endif
+#if DUCKDB_V2_API_ALLOW_UNSTABLE
+#define duckdb_v2_copy_to_set_init_callback duckdb_ext_api.duckdb_v2_copy_to_set_init_callback
+#endif
+#if DUCKDB_V2_API_ALLOW_UNSTABLE
+#define duckdb_v2_expression_cast_get_mode duckdb_ext_api.duckdb_v2_expression_cast_get_mode
+#endif
+#if DUCKDB_V2_API_ALLOW_UNSTABLE
+#define duckdb_v2_expression_column_ref_get_index duckdb_ext_api.duckdb_v2_expression_column_ref_get_index
+#endif
+#if DUCKDB_V2_API_ALLOW_UNSTABLE
+#define duckdb_v2_expression_constant_get_value duckdb_ext_api.duckdb_v2_expression_constant_get_value
+#endif
+#if DUCKDB_V2_API_ALLOW_UNSTABLE
+#define duckdb_v2_expression_function_get_name duckdb_ext_api.duckdb_v2_expression_function_get_name
+#endif
+#if DUCKDB_V2_API_ALLOW_UNSTABLE
+#define duckdb_v2_expression_function_get_qname duckdb_ext_api.duckdb_v2_expression_function_get_qname
+#endif
+#if DUCKDB_V2_API_ALLOW_UNSTABLE
+#define duckdb_v2_expression_get_child duckdb_ext_api.duckdb_v2_expression_get_child
+#endif
+#if DUCKDB_V2_API_ALLOW_UNSTABLE
+#define duckdb_v2_expression_get_child_count duckdb_ext_api.duckdb_v2_expression_get_child_count
+#endif
+#if DUCKDB_V2_API_ALLOW_UNSTABLE
+#define duckdb_v2_expression_get_return_type duckdb_ext_api.duckdb_v2_expression_get_return_type
+#endif
+#if DUCKDB_V2_API_ALLOW_UNSTABLE
+#define duckdb_v2_expression_get_type duckdb_ext_api.duckdb_v2_expression_get_type
+#endif
+#if DUCKDB_V2_API_ALLOW_UNSTABLE
+#define duckdb_v2_extension_register_copy_function duckdb_ext_api.duckdb_v2_extension_register_copy_function
+#endif
+#if DUCKDB_V2_API_ALLOW_UNSTABLE
+#define duckdb_v2_identifier_render_quoted duckdb_ext_api.duckdb_v2_identifier_render_quoted
+#endif
+#if DUCKDB_V2_API_ALLOW_UNSTABLE
+#define duckdb_v2_prepared_statement_create duckdb_ext_api.duckdb_v2_prepared_statement_create
+#endif
+#if DUCKDB_V2_API_ALLOW_UNSTABLE
+#define duckdb_v2_prepared_statement_destroy duckdb_ext_api.duckdb_v2_prepared_statement_destroy
+#endif
+#if DUCKDB_V2_API_ALLOW_UNSTABLE
+#define duckdb_v2_prepared_statement_execute duckdb_ext_api.duckdb_v2_prepared_statement_execute
+#endif
+#if DUCKDB_V2_API_ALLOW_UNSTABLE
+#define duckdb_v2_prepared_statement_reuses_plan duckdb_ext_api.duckdb_v2_prepared_statement_reuses_plan
+#endif
+#if DUCKDB_V2_API_ALLOW_UNSTABLE
+#define duckdb_v2_table_description_destroy duckdb_ext_api.duckdb_v2_table_description_destroy
+#endif
+#if DUCKDB_V2_API_ALLOW_UNSTABLE
+#define duckdb_v2_table_description_get_column duckdb_ext_api.duckdb_v2_table_description_get_column
+#endif
+#if DUCKDB_V2_API_ALLOW_UNSTABLE
+#define duckdb_v2_table_description_get_column_count duckdb_ext_api.duckdb_v2_table_description_get_column_count
+#endif
+#if DUCKDB_V2_API_ALLOW_UNSTABLE
+#define duckdb_v2_table_description_get_qname duckdb_ext_api.duckdb_v2_table_description_get_qname
+#endif
+#if DUCKDB_V2_API_ALLOW_UNSTABLE
+#define duckdb_v2_table_description_is_readonly duckdb_ext_api.duckdb_v2_table_description_is_readonly
+#endif
+#if DUCKDB_V2_API_ALLOW_UNSTABLE
+#define duckdb_v2_table_function_exec_get_column_count duckdb_ext_api.duckdb_v2_table_function_exec_get_column_count
+#endif
+#if DUCKDB_V2_API_ALLOW_UNSTABLE
+#define duckdb_v2_table_function_exec_get_column_index duckdb_ext_api.duckdb_v2_table_function_exec_get_column_index
+#endif
+#if DUCKDB_V2_API_ALLOW_UNSTABLE
+#define duckdb_v2_table_function_filter_pushdown_accept duckdb_ext_api.duckdb_v2_table_function_filter_pushdown_accept
+#endif
+#if DUCKDB_V2_API_ALLOW_UNSTABLE
+#define duckdb_v2_table_function_filter_pushdown_get_bind_data                                                         \
+	duckdb_ext_api.duckdb_v2_table_function_filter_pushdown_get_bind_data
+#endif
+#if DUCKDB_V2_API_ALLOW_UNSTABLE
+#define duckdb_v2_table_function_filter_pushdown_get_column_count                                                      \
+	duckdb_ext_api.duckdb_v2_table_function_filter_pushdown_get_column_count
+#endif
+#if DUCKDB_V2_API_ALLOW_UNSTABLE
+#define duckdb_v2_table_function_filter_pushdown_get_column_index                                                      \
+	duckdb_ext_api.duckdb_v2_table_function_filter_pushdown_get_column_index
+#endif
+#if DUCKDB_V2_API_ALLOW_UNSTABLE
+#define duckdb_v2_table_function_filter_pushdown_get_filter                                                            \
+	duckdb_ext_api.duckdb_v2_table_function_filter_pushdown_get_filter
+#endif
+#if DUCKDB_V2_API_ALLOW_UNSTABLE
+#define duckdb_v2_table_function_filter_pushdown_get_filter_count                                                      \
+	duckdb_ext_api.duckdb_v2_table_function_filter_pushdown_get_filter_count
+#endif
+#if DUCKDB_V2_API_ALLOW_UNSTABLE
+#define duckdb_v2_table_function_filter_pushdown_get_user_data                                                         \
+	duckdb_ext_api.duckdb_v2_table_function_filter_pushdown_get_user_data
+#endif
+#if DUCKDB_V2_API_ALLOW_UNSTABLE
+#define duckdb_v2_table_function_init_global_get_column_count                                                          \
+	duckdb_ext_api.duckdb_v2_table_function_init_global_get_column_count
+#endif
+#if DUCKDB_V2_API_ALLOW_UNSTABLE
+#define duckdb_v2_table_function_init_global_get_column_index                                                          \
+	duckdb_ext_api.duckdb_v2_table_function_init_global_get_column_index
+#endif
+#if DUCKDB_V2_API_ALLOW_UNSTABLE
+#define duckdb_v2_table_function_init_local_get_column_count                                                           \
+	duckdb_ext_api.duckdb_v2_table_function_init_local_get_column_count
+#endif
+#if DUCKDB_V2_API_ALLOW_UNSTABLE
+#define duckdb_v2_table_function_init_local_get_column_index                                                           \
+	duckdb_ext_api.duckdb_v2_table_function_init_local_get_column_index
+#endif
+#if DUCKDB_V2_API_ALLOW_UNSTABLE
+#define duckdb_v2_table_function_set_filter_pushdown_callback                                                          \
+	duckdb_ext_api.duckdb_v2_table_function_set_filter_pushdown_callback
+#endif
+#if DUCKDB_V2_API_ALLOW_UNSTABLE
+#define duckdb_v2_table_function_set_projection_pushdown duckdb_ext_api.duckdb_v2_table_function_set_projection_pushdown
+#endif
+#if DUCKDB_V2_API_ALLOW_UNSTABLE
+#define duckdb_v2_sql_statement_get_parameter_count duckdb_ext_api.duckdb_v2_sql_statement_get_parameter_count
+#endif
+#if DUCKDB_V2_API_ALLOW_UNSTABLE
+#define duckdb_v2_sql_statement_get_parameter_name duckdb_ext_api.duckdb_v2_sql_statement_get_parameter_name
+#endif
+#if DUCKDB_V2_API_ALLOW_UNSTABLE
+#define duckdb_v2_sql_statement_get_text duckdb_ext_api.duckdb_v2_sql_statement_get_text
+#endif
+#if DUCKDB_V2_API_ALLOW_UNSTABLE
+#define duckdb_v2_sql_statement_get_type duckdb_ext_api.duckdb_v2_sql_statement_get_type
+#endif
+#if DUCKDB_V2_API_ALLOW_UNSTABLE
+#define duckdb_v2_token_iterator_destroy duckdb_ext_api.duckdb_v2_token_iterator_destroy
+#endif
+#if DUCKDB_V2_API_ALLOW_UNSTABLE
+#define duckdb_v2_token_iterator_ends_unterminated duckdb_ext_api.duckdb_v2_token_iterator_ends_unterminated
+#endif
+#if DUCKDB_V2_API_ALLOW_UNSTABLE
+#define duckdb_v2_token_iterator_next duckdb_ext_api.duckdb_v2_token_iterator_next
+#endif
+#if DUCKDB_V2_API_ALLOW_UNSTABLE
+#define duckdb_v2_tokenize_sql duckdb_ext_api.duckdb_v2_tokenize_sql
+#endif
+#if DUCKDB_V2_API_ALLOW_UNSTABLE
+#define duckdb_v2_attach_options_create duckdb_ext_api.duckdb_v2_attach_options_create
+#endif
+#if DUCKDB_V2_API_ALLOW_UNSTABLE
+#define duckdb_v2_attach_options_destroy duckdb_ext_api.duckdb_v2_attach_options_destroy
+#endif
+#if DUCKDB_V2_API_ALLOW_UNSTABLE
+#define duckdb_v2_attach_options_set duckdb_ext_api.duckdb_v2_attach_options_set
+#endif
+#if DUCKDB_V2_API_ALLOW_UNSTABLE
+#define duckdb_v2_instance_set_default duckdb_ext_api.duckdb_v2_instance_set_default
+#endif
+#if DUCKDB_V2_API_ALLOW_UNSTABLE
+#define duckdb_v2_table_function_partition_data_get_bind_data                                                          \
+	duckdb_ext_api.duckdb_v2_table_function_partition_data_get_bind_data
+#endif
+#if DUCKDB_V2_API_ALLOW_UNSTABLE
+#define duckdb_v2_table_function_partition_data_get_global_state                                                       \
+	duckdb_ext_api.duckdb_v2_table_function_partition_data_get_global_state
+#endif
+#if DUCKDB_V2_API_ALLOW_UNSTABLE
+#define duckdb_v2_table_function_partition_data_get_local_state                                                        \
+	duckdb_ext_api.duckdb_v2_table_function_partition_data_get_local_state
+#endif
+#if DUCKDB_V2_API_ALLOW_UNSTABLE
+#define duckdb_v2_table_function_partition_data_get_partition_column_count                                             \
+	duckdb_ext_api.duckdb_v2_table_function_partition_data_get_partition_column_count
+#endif
+#if DUCKDB_V2_API_ALLOW_UNSTABLE
+#define duckdb_v2_table_function_partition_data_get_partition_column_index                                             \
+	duckdb_ext_api.duckdb_v2_table_function_partition_data_get_partition_column_index
+#endif
+#if DUCKDB_V2_API_ALLOW_UNSTABLE
+#define duckdb_v2_table_function_partition_data_get_user_data                                                          \
+	duckdb_ext_api.duckdb_v2_table_function_partition_data_get_user_data
+#endif
+#if DUCKDB_V2_API_ALLOW_UNSTABLE
+#define duckdb_v2_table_function_partition_data_requires_batch_index                                                   \
+	duckdb_ext_api.duckdb_v2_table_function_partition_data_requires_batch_index
+#endif
+#if DUCKDB_V2_API_ALLOW_UNSTABLE
+#define duckdb_v2_table_function_partition_data_requires_partition_columns                                             \
+	duckdb_ext_api.duckdb_v2_table_function_partition_data_requires_partition_columns
+#endif
+#if DUCKDB_V2_API_ALLOW_UNSTABLE
+#define duckdb_v2_table_function_partition_data_set_batch_index                                                        \
+	duckdb_ext_api.duckdb_v2_table_function_partition_data_set_batch_index
+#endif
+#if DUCKDB_V2_API_ALLOW_UNSTABLE
+#define duckdb_v2_table_function_partition_data_set_partition_value                                                    \
+	duckdb_ext_api.duckdb_v2_table_function_partition_data_set_partition_value
+#endif
+#if DUCKDB_V2_API_ALLOW_UNSTABLE
+#define duckdb_v2_table_function_partitioning_get_bind_data                                                            \
+	duckdb_ext_api.duckdb_v2_table_function_partitioning_get_bind_data
+#endif
+#if DUCKDB_V2_API_ALLOW_UNSTABLE
+#define duckdb_v2_table_function_partitioning_get_partition_column_count                                               \
+	duckdb_ext_api.duckdb_v2_table_function_partitioning_get_partition_column_count
+#endif
+#if DUCKDB_V2_API_ALLOW_UNSTABLE
+#define duckdb_v2_table_function_partitioning_get_partition_column_index                                               \
+	duckdb_ext_api.duckdb_v2_table_function_partitioning_get_partition_column_index
+#endif
+#if DUCKDB_V2_API_ALLOW_UNSTABLE
+#define duckdb_v2_table_function_partitioning_get_user_data                                                            \
+	duckdb_ext_api.duckdb_v2_table_function_partitioning_get_user_data
+#endif
+#if DUCKDB_V2_API_ALLOW_UNSTABLE
+#define duckdb_v2_table_function_partitioning_set_partition_info                                                       \
+	duckdb_ext_api.duckdb_v2_table_function_partitioning_set_partition_info
+#endif
+#if DUCKDB_V2_API_ALLOW_UNSTABLE
+#define duckdb_v2_table_function_set_partition_data_callback                                                           \
+	duckdb_ext_api.duckdb_v2_table_function_set_partition_data_callback
+#endif
+#if DUCKDB_V2_API_ALLOW_UNSTABLE
+#define duckdb_v2_table_function_set_partitioning_callback                                                             \
+	duckdb_ext_api.duckdb_v2_table_function_set_partitioning_callback
+#endif
+#if DUCKDB_V2_API_ALLOW_UNSTABLE
+#define duckdb_v2_validate_utf8 duckdb_ext_api.duckdb_v2_validate_utf8
+#endif
+#if DUCKDB_V2_API_ALLOW_UNSTABLE
+#define duckdb_v2_connection_register_multi_file_function                                                              \
+	duckdb_ext_api.duckdb_v2_connection_register_multi_file_function
+#endif
+#if DUCKDB_V2_API_ALLOW_UNSTABLE
+#define duckdb_v2_copy_to_set_statistics_callback duckdb_ext_api.duckdb_v2_copy_to_set_statistics_callback
+#endif
+#if DUCKDB_V2_API_ALLOW_UNSTABLE
+#define duckdb_v2_copy_to_statistics_get_bind_data duckdb_ext_api.duckdb_v2_copy_to_statistics_get_bind_data
+#endif
+#if DUCKDB_V2_API_ALLOW_UNSTABLE
+#define duckdb_v2_copy_to_statistics_get_init_data duckdb_ext_api.duckdb_v2_copy_to_statistics_get_init_data
+#endif
+#if DUCKDB_V2_API_ALLOW_UNSTABLE
+#define duckdb_v2_copy_to_statistics_get_user_data duckdb_ext_api.duckdb_v2_copy_to_statistics_get_user_data
+#endif
+#if DUCKDB_V2_API_ALLOW_UNSTABLE
+#define duckdb_v2_copy_to_statistics_set_file_size duckdb_ext_api.duckdb_v2_copy_to_statistics_set_file_size
+#endif
+#if DUCKDB_V2_API_ALLOW_UNSTABLE
+#define duckdb_v2_copy_to_statistics_set_row_count duckdb_ext_api.duckdb_v2_copy_to_statistics_set_row_count
+#endif
+#if DUCKDB_V2_API_ALLOW_UNSTABLE
+#define duckdb_v2_data_chunk_get_capacity duckdb_ext_api.duckdb_v2_data_chunk_get_capacity
+#endif
+#if DUCKDB_V2_API_ALLOW_UNSTABLE
+#define duckdb_v2_extension_register_multi_file_function duckdb_ext_api.duckdb_v2_extension_register_multi_file_function
+#endif
+#if DUCKDB_V2_API_ALLOW_UNSTABLE
+#define duckdb_v2_multi_file_function_create duckdb_ext_api.duckdb_v2_multi_file_function_create
+#endif
+#if DUCKDB_V2_API_ALLOW_UNSTABLE
+#define duckdb_v2_multi_file_function_destroy duckdb_ext_api.duckdb_v2_multi_file_function_destroy
+#endif
+#if DUCKDB_V2_API_ALLOW_UNSTABLE
+#define duckdb_v2_multi_file_function_set_file_extension duckdb_ext_api.duckdb_v2_multi_file_function_set_file_extension
+#endif
+#if DUCKDB_V2_API_ALLOW_UNSTABLE
+#define duckdb_v2_multi_file_function_set_name duckdb_ext_api.duckdb_v2_multi_file_function_set_name
+#endif
+#if DUCKDB_V2_API_ALLOW_UNSTABLE
+#define duckdb_v2_multi_file_function_set_reader_type duckdb_ext_api.duckdb_v2_multi_file_function_set_reader_type
+#endif
+#if DUCKDB_V2_API_ALLOW_UNSTABLE
+#define duckdb_v2_multi_file_function_set_single_file_function                                                         \
+	duckdb_ext_api.duckdb_v2_multi_file_function_set_single_file_function
+#endif
+#if DUCKDB_V2_API_ALLOW_UNSTABLE
+#define duckdb_v2_table_function_claim_batch_get_bind_data                                                             \
+	duckdb_ext_api.duckdb_v2_table_function_claim_batch_get_bind_data
+#endif
+#if DUCKDB_V2_API_ALLOW_UNSTABLE
+#define duckdb_v2_table_function_claim_batch_get_global_state                                                          \
+	duckdb_ext_api.duckdb_v2_table_function_claim_batch_get_global_state
+#endif
+#if DUCKDB_V2_API_ALLOW_UNSTABLE
+#define duckdb_v2_table_function_claim_batch_get_local_state                                                           \
+	duckdb_ext_api.duckdb_v2_table_function_claim_batch_get_local_state
+#endif
+#if DUCKDB_V2_API_ALLOW_UNSTABLE
+#define duckdb_v2_table_function_claim_batch_get_user_data                                                             \
+	duckdb_ext_api.duckdb_v2_table_function_claim_batch_get_user_data
+#endif
+#if DUCKDB_V2_API_ALLOW_UNSTABLE
+#define duckdb_v2_table_function_claim_batch_set_claimed duckdb_ext_api.duckdb_v2_table_function_claim_batch_set_claimed
+#endif
+#if DUCKDB_V2_API_ALLOW_UNSTABLE
+#define duckdb_v2_table_function_set_claim_batch_callback                                                              \
+	duckdb_ext_api.duckdb_v2_table_function_set_claim_batch_callback
+#endif
+#if DUCKDB_V2_API_ALLOW_UNSTABLE
+#define duckdb_v2_function_bind_get_arg_count duckdb_ext_api.duckdb_v2_function_bind_get_arg_count
+#endif
+#if DUCKDB_V2_API_ALLOW_UNSTABLE
+#define duckdb_v2_function_bind_get_arg_index duckdb_ext_api.duckdb_v2_function_bind_get_arg_index
+#endif
+#if DUCKDB_V2_API_ALLOW_UNSTABLE
+#define duckdb_v2_function_bind_get_arg_name duckdb_ext_api.duckdb_v2_function_bind_get_arg_name
+#endif
+#if DUCKDB_V2_API_ALLOW_UNSTABLE
+#define duckdb_v2_function_bind_get_arg_type duckdb_ext_api.duckdb_v2_function_bind_get_arg_type
+#endif
+#if DUCKDB_V2_API_ALLOW_UNSTABLE
+#define duckdb_v2_function_bind_get_arg_value duckdb_ext_api.duckdb_v2_function_bind_get_arg_value
+#endif
+#if DUCKDB_V2_API_ALLOW_UNSTABLE
+#define duckdb_v2_function_bind_get_user_data duckdb_ext_api.duckdb_v2_function_bind_get_user_data
+#endif
+#if DUCKDB_V2_API_ALLOW_UNSTABLE
+#define duckdb_v2_function_bind_set_bind_data duckdb_ext_api.duckdb_v2_function_bind_set_bind_data
+#endif
+#if DUCKDB_V2_API_ALLOW_UNSTABLE
+#define duckdb_v2_table_function_bind_set_order_preservation                                                           \
+	duckdb_ext_api.duckdb_v2_table_function_bind_set_order_preservation
+#endif
+#if DUCKDB_V2_API_ALLOW_UNSTABLE
+#define duckdb_v2_arrow_result_destroy duckdb_ext_api.duckdb_v2_arrow_result_destroy
+#endif
+#if DUCKDB_V2_API_ALLOW_UNSTABLE
+#define duckdb_v2_arrow_result_drain duckdb_ext_api.duckdb_v2_arrow_result_drain
+#endif
+#if DUCKDB_V2_API_ALLOW_UNSTABLE
+#define duckdb_v2_arrow_result_fetch_array duckdb_ext_api.duckdb_v2_arrow_result_fetch_array
+#endif
+#if DUCKDB_V2_API_ALLOW_UNSTABLE
+#define duckdb_v2_arrow_result_get_result_type duckdb_ext_api.duckdb_v2_arrow_result_get_result_type
+#endif
+#if DUCKDB_V2_API_ALLOW_UNSTABLE
+#define duckdb_v2_arrow_result_get_schema duckdb_ext_api.duckdb_v2_arrow_result_get_schema
+#endif
+#if DUCKDB_V2_API_ALLOW_UNSTABLE
+#define duckdb_v2_arrow_result_get_statement_type duckdb_ext_api.duckdb_v2_arrow_result_get_statement_type
+#endif
+#if DUCKDB_V2_API_ALLOW_UNSTABLE
+#define duckdb_v2_arrow_result_step duckdb_ext_api.duckdb_v2_arrow_result_step
+#endif
+#if DUCKDB_V2_API_ALLOW_UNSTABLE
+#define duckdb_v2_arrow_result_to_arrow_c_stream duckdb_ext_api.duckdb_v2_arrow_result_to_arrow_c_stream
+#endif
+#if DUCKDB_V2_API_ALLOW_UNSTABLE
+#define duckdb_v2_arrow_result_wait duckdb_ext_api.duckdb_v2_arrow_result_wait
+#endif
+#if DUCKDB_V2_API_ALLOW_UNSTABLE
+#define duckdb_v2_prepared_statement_execute_arrow duckdb_ext_api.duckdb_v2_prepared_statement_execute_arrow
+#endif
+#if DUCKDB_V2_API_ALLOW_UNSTABLE
+#define duckdb_v2_statement_execute_arrow duckdb_ext_api.duckdb_v2_statement_execute_arrow
+#endif
+#if DUCKDB_V2_API_ALLOW_UNSTABLE
+#define duckdb_v2_scalar_function_resolve_types_set_return_type                                                        \
+	duckdb_ext_api.duckdb_v2_scalar_function_resolve_types_set_return_type
+#endif
+#if DUCKDB_V2_API_ALLOW_UNSTABLE
+#define duckdb_v2_scalar_function_set_resolve_types_callback                                                           \
+	duckdb_ext_api.duckdb_v2_scalar_function_set_resolve_types_callback
+#endif
+#if DUCKDB_V2_API_ALLOW_UNSTABLE
+#define duckdb_v2_table_function_get_bind_info_get_bind_data                                                           \
+	duckdb_ext_api.duckdb_v2_table_function_get_bind_info_get_bind_data
+#endif
+#if DUCKDB_V2_API_ALLOW_UNSTABLE
+#define duckdb_v2_table_function_get_bind_info_get_user_data                                                           \
+	duckdb_ext_api.duckdb_v2_table_function_get_bind_info_get_user_data
+#endif
+#if DUCKDB_V2_API_ALLOW_UNSTABLE
+#define duckdb_v2_table_function_get_bind_info_set_column_identifier                                                   \
+	duckdb_ext_api.duckdb_v2_table_function_get_bind_info_set_column_identifier
+#endif
+#if DUCKDB_V2_API_ALLOW_UNSTABLE
+#define duckdb_v2_table_function_get_bind_info_set_option                                                              \
+	duckdb_ext_api.duckdb_v2_table_function_get_bind_info_set_option
+#endif
+#if DUCKDB_V2_API_ALLOW_UNSTABLE
+#define duckdb_v2_table_function_set_get_bind_info_callback                                                            \
+	duckdb_ext_api.duckdb_v2_table_function_set_get_bind_info_callback
+#endif
+#if DUCKDB_V2_API_ALLOW_UNSTABLE
+#define duckdb_v2_connection_get_factory duckdb_ext_api.duckdb_v2_connection_get_factory
+#endif
+#if DUCKDB_V2_API_ALLOW_UNSTABLE
+#define duckdb_v2_context_get_factory duckdb_ext_api.duckdb_v2_context_get_factory
+#endif
+#if DUCKDB_V2_API_ALLOW_UNSTABLE
+#define duckdb_v2_instance_get_factory duckdb_ext_api.duckdb_v2_instance_get_factory
+#endif
+#if DUCKDB_V2_API_ALLOW_UNSTABLE
+#define duckdb_v2_scalar_function_bind_set_bind_data duckdb_ext_api.duckdb_v2_scalar_function_bind_set_bind_data
+#endif
+#if DUCKDB_V2_API_ALLOW_UNSTABLE
+#define duckdb_v2_config_get_option_value duckdb_ext_api.duckdb_v2_config_get_option_value
+#endif
+#if DUCKDB_V2_API_ALLOW_UNSTABLE
+#define duckdb_v2_config_set_option_text duckdb_ext_api.duckdb_v2_config_set_option_text
+#endif
+#if DUCKDB_V2_API_ALLOW_UNSTABLE
+#define duckdb_v2_config_set_option_value duckdb_ext_api.duckdb_v2_config_set_option_value
+#endif
+#if DUCKDB_V2_API_ALLOW_UNSTABLE
+#define duckdb_v2_connection_get_config duckdb_ext_api.duckdb_v2_connection_get_config
+#endif
+#if DUCKDB_V2_API_ALLOW_UNSTABLE
+#define duckdb_v2_connection_get_file_system duckdb_ext_api.duckdb_v2_connection_get_file_system
+#endif
+#if DUCKDB_V2_API_ALLOW_UNSTABLE
+#define duckdb_v2_connection_log duckdb_ext_api.duckdb_v2_connection_log
+#endif
+#if DUCKDB_V2_API_ALLOW_UNSTABLE
+#define duckdb_v2_context_get_config duckdb_ext_api.duckdb_v2_context_get_config
+#endif
+#if DUCKDB_V2_API_ALLOW_UNSTABLE
+#define duckdb_v2_instance_get_config duckdb_ext_api.duckdb_v2_instance_get_config
+#endif
+#if DUCKDB_V2_API_ALLOW_UNSTABLE
+#define duckdb_v2_instance_get_file_system duckdb_ext_api.duckdb_v2_instance_get_file_system
+#endif
+#if DUCKDB_V2_API_ALLOW_UNSTABLE
+#define duckdb_v2_instance_log duckdb_ext_api.duckdb_v2_instance_log
+#endif
+#if DUCKDB_V2_API_ALLOW_UNSTABLE
+#define duckdb_v2_option_get_default_scope duckdb_ext_api.duckdb_v2_option_get_default_scope
+#endif
+#if DUCKDB_V2_API_ALLOW_UNSTABLE
+#define duckdb_v2_option_supports_scope duckdb_ext_api.duckdb_v2_option_supports_scope
+#endif
+#if DUCKDB_V2_API_ALLOW_UNSTABLE
+#define duckdb_v2_aggregate_function_get_docs duckdb_ext_api.duckdb_v2_aggregate_function_get_docs
+#endif
+#if DUCKDB_V2_API_ALLOW_UNSTABLE
+#define duckdb_v2_connection_register_pragma_function duckdb_ext_api.duckdb_v2_connection_register_pragma_function
+#endif
+#if DUCKDB_V2_API_ALLOW_UNSTABLE
+#define duckdb_v2_extension_register_pragma_function duckdb_ext_api.duckdb_v2_extension_register_pragma_function
+#endif
+#if DUCKDB_V2_API_ALLOW_UNSTABLE
+#define duckdb_v2_factory_create_common_type duckdb_ext_api.duckdb_v2_factory_create_common_type
+#endif
+#if DUCKDB_V2_API_ALLOW_UNSTABLE
+#define duckdb_v2_function_docs_add_category duckdb_ext_api.duckdb_v2_function_docs_add_category
+#endif
+#if DUCKDB_V2_API_ALLOW_UNSTABLE
+#define duckdb_v2_function_docs_add_example duckdb_ext_api.duckdb_v2_function_docs_add_example
+#endif
+#if DUCKDB_V2_API_ALLOW_UNSTABLE
+#define duckdb_v2_function_docs_set_description duckdb_ext_api.duckdb_v2_function_docs_set_description
+#endif
+#if DUCKDB_V2_API_ALLOW_UNSTABLE
+#define duckdb_v2_pragma_function_create duckdb_ext_api.duckdb_v2_pragma_function_create
+#endif
+#if DUCKDB_V2_API_ALLOW_UNSTABLE
+#define duckdb_v2_pragma_function_destroy duckdb_ext_api.duckdb_v2_pragma_function_destroy
+#endif
+#if DUCKDB_V2_API_ALLOW_UNSTABLE
+#define duckdb_v2_pragma_function_get_docs duckdb_ext_api.duckdb_v2_pragma_function_get_docs
+#endif
+#if DUCKDB_V2_API_ALLOW_UNSTABLE
+#define duckdb_v2_pragma_function_get_signature duckdb_ext_api.duckdb_v2_pragma_function_get_signature
+#endif
+#if DUCKDB_V2_API_ALLOW_UNSTABLE
+#define duckdb_v2_pragma_function_query_set_query duckdb_ext_api.duckdb_v2_pragma_function_query_set_query
+#endif
+#if DUCKDB_V2_API_ALLOW_UNSTABLE
+#define duckdb_v2_pragma_function_set_exec_callback duckdb_ext_api.duckdb_v2_pragma_function_set_exec_callback
+#endif
+#if DUCKDB_V2_API_ALLOW_UNSTABLE
+#define duckdb_v2_pragma_function_set_name duckdb_ext_api.duckdb_v2_pragma_function_set_name
+#endif
+#if DUCKDB_V2_API_ALLOW_UNSTABLE
+#define duckdb_v2_pragma_function_set_query_callback duckdb_ext_api.duckdb_v2_pragma_function_set_query_callback
+#endif
+#if DUCKDB_V2_API_ALLOW_UNSTABLE
+#define duckdb_v2_pragma_function_set_user_data duckdb_ext_api.duckdb_v2_pragma_function_set_user_data
+#endif
+#if DUCKDB_V2_API_ALLOW_UNSTABLE
+#define duckdb_v2_scalar_function_get_docs duckdb_ext_api.duckdb_v2_scalar_function_get_docs
+#endif
+#if DUCKDB_V2_API_ALLOW_UNSTABLE
+#define duckdb_v2_table_function_get_docs duckdb_ext_api.duckdb_v2_table_function_get_docs
+#endif
+#if DUCKDB_V2_API_ALLOW_UNSTABLE
+#define duckdb_v2_connection_register_custom_option duckdb_ext_api.duckdb_v2_connection_register_custom_option
+#endif
+#if DUCKDB_V2_API_ALLOW_UNSTABLE
+#define duckdb_v2_custom_option_create duckdb_ext_api.duckdb_v2_custom_option_create
+#endif
+#if DUCKDB_V2_API_ALLOW_UNSTABLE
+#define duckdb_v2_custom_option_destroy duckdb_ext_api.duckdb_v2_custom_option_destroy
+#endif
+#if DUCKDB_V2_API_ALLOW_UNSTABLE
+#define duckdb_v2_custom_option_set_default_scope duckdb_ext_api.duckdb_v2_custom_option_set_default_scope
+#endif
+#if DUCKDB_V2_API_ALLOW_UNSTABLE
+#define duckdb_v2_custom_option_set_default_value duckdb_ext_api.duckdb_v2_custom_option_set_default_value
+#endif
+#if DUCKDB_V2_API_ALLOW_UNSTABLE
+#define duckdb_v2_custom_option_set_description duckdb_ext_api.duckdb_v2_custom_option_set_description
+#endif
+#if DUCKDB_V2_API_ALLOW_UNSTABLE
+#define duckdb_v2_custom_option_set_name duckdb_ext_api.duckdb_v2_custom_option_set_name
+#endif
+#if DUCKDB_V2_API_ALLOW_UNSTABLE
+#define duckdb_v2_custom_option_set_supports_scope duckdb_ext_api.duckdb_v2_custom_option_set_supports_scope
+#endif
+#if DUCKDB_V2_API_ALLOW_UNSTABLE
+#define duckdb_v2_custom_option_set_type duckdb_ext_api.duckdb_v2_custom_option_set_type
+#endif
+#if DUCKDB_V2_API_ALLOW_UNSTABLE
+#define duckdb_v2_custom_option_set_update_callback duckdb_ext_api.duckdb_v2_custom_option_set_update_callback
+#endif
+#if DUCKDB_V2_API_ALLOW_UNSTABLE
+#define duckdb_v2_custom_option_set_user_data duckdb_ext_api.duckdb_v2_custom_option_set_user_data
+#endif
+#if DUCKDB_V2_API_ALLOW_UNSTABLE
+#define duckdb_v2_custom_option_update_get_scope duckdb_ext_api.duckdb_v2_custom_option_update_get_scope
+#endif
+#if DUCKDB_V2_API_ALLOW_UNSTABLE
+#define duckdb_v2_custom_option_update_get_user_data duckdb_ext_api.duckdb_v2_custom_option_update_get_user_data
+#endif
+#if DUCKDB_V2_API_ALLOW_UNSTABLE
+#define duckdb_v2_custom_option_update_get_value duckdb_ext_api.duckdb_v2_custom_option_update_get_value
+#endif
+#if DUCKDB_V2_API_ALLOW_UNSTABLE
+#define duckdb_v2_custom_option_update_is_reset duckdb_ext_api.duckdb_v2_custom_option_update_is_reset
+#endif
+#if DUCKDB_V2_API_ALLOW_UNSTABLE
+#define duckdb_v2_custom_option_update_set_value duckdb_ext_api.duckdb_v2_custom_option_update_set_value
+#endif
+#if DUCKDB_V2_API_ALLOW_UNSTABLE
+#define duckdb_v2_extension_register_custom_option duckdb_ext_api.duckdb_v2_extension_register_custom_option
+#endif
+#if DUCKDB_V2_API_ALLOW_UNSTABLE
+#define duckdb_v2_extension_register_log_sink duckdb_ext_api.duckdb_v2_extension_register_log_sink
+#endif
+#if DUCKDB_V2_API_ALLOW_UNSTABLE
+#define duckdb_v2_extension_register_macro_function duckdb_ext_api.duckdb_v2_extension_register_macro_function
+#endif
+#if DUCKDB_V2_API_ALLOW_UNSTABLE
+#define duckdb_v2_file_system_path_exists duckdb_ext_api.duckdb_v2_file_system_path_exists
+#endif
+#if DUCKDB_V2_API_ALLOW_UNSTABLE
+#define duckdb_v2_file_system_path_expand duckdb_ext_api.duckdb_v2_file_system_path_expand
+#endif
+#if DUCKDB_V2_API_ALLOW_UNSTABLE
+#define duckdb_v2_file_system_path_is_remote duckdb_ext_api.duckdb_v2_file_system_path_is_remote
+#endif
+#if DUCKDB_V2_API_ALLOW_UNSTABLE
+#define duckdb_v2_instance_register_log_sink duckdb_ext_api.duckdb_v2_instance_register_log_sink
+#endif
+#if DUCKDB_V2_API_ALLOW_UNSTABLE
+#define duckdb_v2_log_sink_create duckdb_ext_api.duckdb_v2_log_sink_create
+#endif
+#if DUCKDB_V2_API_ALLOW_UNSTABLE
+#define duckdb_v2_log_sink_destroy duckdb_ext_api.duckdb_v2_log_sink_destroy
+#endif
+#if DUCKDB_V2_API_ALLOW_UNSTABLE
+#define duckdb_v2_log_sink_set_flush_callback duckdb_ext_api.duckdb_v2_log_sink_set_flush_callback
+#endif
+#if DUCKDB_V2_API_ALLOW_UNSTABLE
+#define duckdb_v2_log_sink_set_name duckdb_ext_api.duckdb_v2_log_sink_set_name
+#endif
+#if DUCKDB_V2_API_ALLOW_UNSTABLE
+#define duckdb_v2_log_sink_set_user_data duckdb_ext_api.duckdb_v2_log_sink_set_user_data
+#endif
+#if DUCKDB_V2_API_ALLOW_UNSTABLE
+#define duckdb_v2_log_sink_set_write_callback duckdb_ext_api.duckdb_v2_log_sink_set_write_callback
+#endif
+#if DUCKDB_V2_API_ALLOW_UNSTABLE
+#define duckdb_v2_log_sink_write_info_get_connection_id duckdb_ext_api.duckdb_v2_log_sink_write_info_get_connection_id
+#endif
+#if DUCKDB_V2_API_ALLOW_UNSTABLE
+#define duckdb_v2_log_sink_write_info_get_query_id duckdb_ext_api.duckdb_v2_log_sink_write_info_get_query_id
+#endif
+#if DUCKDB_V2_API_ALLOW_UNSTABLE
+#define duckdb_v2_log_sink_write_info_get_thread_id duckdb_ext_api.duckdb_v2_log_sink_write_info_get_thread_id
+#endif
+#if DUCKDB_V2_API_ALLOW_UNSTABLE
+#define duckdb_v2_log_sink_write_info_get_transaction_id duckdb_ext_api.duckdb_v2_log_sink_write_info_get_transaction_id
+#endif
+#if DUCKDB_V2_API_ALLOW_UNSTABLE
+#define duckdb_v2_macro_function_create duckdb_ext_api.duckdb_v2_macro_function_create
+#endif
+#if DUCKDB_V2_API_ALLOW_UNSTABLE
+#define duckdb_v2_macro_function_destroy duckdb_ext_api.duckdb_v2_macro_function_destroy
+#endif
+#if DUCKDB_V2_API_ALLOW_UNSTABLE
+#define duckdb_v2_macro_function_get_docs duckdb_ext_api.duckdb_v2_macro_function_get_docs
+#endif
+#if DUCKDB_V2_API_ALLOW_UNSTABLE
+#define duckdb_v2_macro_function_get_signature duckdb_ext_api.duckdb_v2_macro_function_get_signature
+#endif
+#if DUCKDB_V2_API_ALLOW_UNSTABLE
+#define duckdb_v2_macro_function_set_body duckdb_ext_api.duckdb_v2_macro_function_set_body
+#endif
+#if DUCKDB_V2_API_ALLOW_UNSTABLE
+#define duckdb_v2_macro_function_set_name duckdb_ext_api.duckdb_v2_macro_function_set_name
+#endif
+#if DUCKDB_V2_API_ALLOW_UNSTABLE
+#define duckdb_v2_vector_cast duckdb_ext_api.duckdb_v2_vector_cast
+#endif
+#if DUCKDB_V2_API_ALLOW_UNSTABLE
+#define duckdb_v2_connection_enable_profiling duckdb_ext_api.duckdb_v2_connection_enable_profiling
+#endif
+#if DUCKDB_V2_API_ALLOW_UNSTABLE
+#define duckdb_v2_connection_get_query_metrics duckdb_ext_api.duckdb_v2_connection_get_query_metrics
+#endif
+#if DUCKDB_V2_API_ALLOW_UNSTABLE
+#define duckdb_v2_copy_function_set_file_extension duckdb_ext_api.duckdb_v2_copy_function_set_file_extension
+#endif
+#if DUCKDB_V2_API_ALLOW_UNSTABLE
+#define duckdb_v2_data_chunk_clear duckdb_ext_api.duckdb_v2_data_chunk_clear
+#endif
+#if DUCKDB_V2_API_ALLOW_UNSTABLE
+#define duckdb_v2_file_system_path_glob duckdb_ext_api.duckdb_v2_file_system_path_glob
+#endif
+#if DUCKDB_V2_API_ALLOW_UNSTABLE
+#define duckdb_v2_file_system_path_move duckdb_ext_api.duckdb_v2_file_system_path_move
+#endif
+#if DUCKDB_V2_API_ALLOW_UNSTABLE
+#define duckdb_v2_file_system_path_remove duckdb_ext_api.duckdb_v2_file_system_path_remove
+#endif
+#if DUCKDB_V2_API_ALLOW_UNSTABLE
+#define duckdb_v2_query_metrics_destroy duckdb_ext_api.duckdb_v2_query_metrics_destroy
+#endif
+#if DUCKDB_V2_API_ALLOW_UNSTABLE
+#define duckdb_v2_query_metrics_get_root duckdb_ext_api.duckdb_v2_query_metrics_get_root
+#endif
+#if DUCKDB_V2_API_ALLOW_UNSTABLE
+#define duckdb_v2_query_metrics_node_get_child duckdb_ext_api.duckdb_v2_query_metrics_node_get_child
+#endif
+#if DUCKDB_V2_API_ALLOW_UNSTABLE
+#define duckdb_v2_query_metrics_node_get_child_count duckdb_ext_api.duckdb_v2_query_metrics_node_get_child_count
+#endif
+#if DUCKDB_V2_API_ALLOW_UNSTABLE
+#define duckdb_v2_query_metrics_node_get_metric duckdb_ext_api.duckdb_v2_query_metrics_node_get_metric
+#endif
+#if DUCKDB_V2_API_ALLOW_UNSTABLE
+#define duckdb_v2_query_metrics_node_get_metric_count duckdb_ext_api.duckdb_v2_query_metrics_node_get_metric_count
+#endif
+#if DUCKDB_V2_API_ALLOW_UNSTABLE
+#define duckdb_v2_query_metrics_node_get_metric_name duckdb_ext_api.duckdb_v2_query_metrics_node_get_metric_name
+#endif
+#if DUCKDB_V2_API_ALLOW_UNSTABLE
+#define duckdb_v2_query_metrics_node_get_metric_value duckdb_ext_api.duckdb_v2_query_metrics_node_get_metric_value
+#endif
+#if DUCKDB_V2_API_ALLOW_UNSTABLE
+#define duckdb_v2_query_metrics_node_get_name duckdb_ext_api.duckdb_v2_query_metrics_node_get_name
+#endif
+#if DUCKDB_V2_API_ALLOW_UNSTABLE
+#define duckdb_v2_statement_add_collection duckdb_ext_api.duckdb_v2_statement_add_collection
+#endif
+// capigen:end appended
+#endif // DUCKDB_BUILD_STATIC_EXTENSION
+
+//===--------------------------------------------------------------------===//
+// Struct Global Macros
+//===--------------------------------------------------------------------===//
+#ifdef DUCKDB_BUILD_STATIC_EXTENSION
+// No vtable global needed for static builds - DuckDB symbols are resolved directly at link time
+#define DUCKDB_EXTENSION_GLOBAL
+#define DUCKDB_EXTENSION_API_INIT(input, minimum_api_version)
+#else
+// This goes in the c/c++ file containing the entrypoint
+#define DUCKDB_EXTENSION_GLOBAL duckdb_ext_api_v2 duckdb_ext_api = {0};
+// Initializes the C Extension API: First thing to call in the extension entrypoint. Nothing else in the API may be
+// called before it succeeds, so a failure returns without touching the error slot: the library has already recorded
+// why get_api refused, and reports that.
+#define DUCKDB_EXTENSION_API_INIT(input, minimum_api_version)                                                          \
+	duckdb_ext_api_v2 *res = (duckdb_ext_api_v2 *)(input)->get_api((input)->extension, minimum_api_version);           \
+	if (!res) {                                                                                                        \
+		return;                                                                                                        \
+	};                                                                                                                 \
+	duckdb_ext_api = *res;
+#endif // DUCKDB_BUILD_STATIC_EXTENSION
+
+// Place in global scope of any C/C++ file that needs to access the extension API
+#define DUCKDB_EXTENSION_EXTERN extern duckdb_ext_api_v2 duckdb_ext_api;
+
+#ifdef _WIN32
+#define DUCKDB_CAPI_ENTRY_VISIBILITY __declspec(dllexport)
+#else
+#define DUCKDB_CAPI_ENTRY_VISIBILITY __attribute__((visibility("default")))
+#endif
+
+//===--------------------------------------------------------------------===//
+// Entrypoint Macros
+//===--------------------------------------------------------------------===//
+
+// Note: the DUCKDB_EXTENSION_ENTRYPOINT macro requires DUCKDB_EXTENSION_NAME to be set.
+
+#ifdef DUCKDB_EXTENSION_NAME
+
+// Main entrypoint: receives the extension being loaded to register functionality through, a context to read and run
+// queries through, and the error slot to report failure on. Write the body as
+//
+//		DUCKDB_EXTENSION_ENTRYPOINT(duckdb_v2_extension_handle extension, duckdb_v2_context_handle context,
+//		                            duckdb_v2_error_info_handle *err) {
+//			...
+//		}
+#define DUCKDB_EXTENSION_ENTRYPOINT                                                                                    \
+	DUCKDB_EXTENSION_GLOBAL static void DUCKDB_EXTENSION_GLUE(DUCKDB_EXTENSION_NAME, _init_c_api_v2_internal)(         \
+	    duckdb_v2_extension_handle extension, duckdb_v2_context_handle context, duckdb_v2_error_info_handle * err);    \
+	DUCKDB_EXTENSION_EXTERN_C_GUARD_OPEN DUCKDB_CAPI_ENTRY_VISIBILITY DUCKDB_EXTENSION_API void DUCKDB_EXTENSION_GLUE( \
+	    DUCKDB_EXTENSION_NAME, _init_c_api_v2)(struct duckdb_v2_extension_input * input) {                             \
+		DUCKDB_EXTENSION_API_INIT(input, DUCKDB_EXTENSION_API_VERSION_STRING);                                         \
+		DUCKDB_EXTENSION_GLUE(DUCKDB_EXTENSION_NAME, _init_c_api_v2_internal)                                          \
+		(input->extension, input->context, input->err);                                                                \
+	}                                                                                                                  \
+	DUCKDB_EXTENSION_EXTERN_C_GUARD_CLOSE static void DUCKDB_EXTENSION_GLUE(DUCKDB_EXTENSION_NAME,                     \
+	                                                                        _init_c_api_v2_internal)
+
+// Custom entrypoint: identical to the main entrypoint
+#define DUCKDB_EXTENSION_ENTRYPOINT_CUSTOM DUCKDB_EXTENSION_ENTRYPOINT
+#endif
diff --git a/cbits/duckdb_haskell_extension.h b/cbits/duckdb_haskell_extension.h
new file mode 100644
--- /dev/null
+++ b/cbits/duckdb_haskell_extension.h
@@ -0,0 +1,35 @@
+#ifndef DUCKDB_HASKELL_EXTENSION_H
+#define DUCKDB_HASKELL_EXTENSION_H
+
+/* Include this header before the generated V2 C wrappers. */
+#define DUCKDB_V2_API_ALLOW_UNSTABLE 1
+#include "duckdb_extension_v2.h"
+
+DUCKDB_EXTENSION_EXTERN_C_GUARD_OPEN
+
+/* Keep the dispatch table private to this duckdb-ffi library. */
+#if defined(__GNUC__) || defined(__clang__)
+#pragma GCC visibility push(hidden)
+#endif
+DUCKDB_EXTENSION_EXTERN
+#if defined(__GNUC__) || defined(__clang__)
+#pragma GCC visibility pop
+#endif
+
+/* The Haskell registration action of an extension. It receives the extension
+ * handle, the borrowed context, and the error slot of the load. */
+typedef void (*duckdb_haskell_extension_entry)(void *extension, void *context, void *err);
+
+/* Load a Haskell extension. Call this function from the C entry point
+ * NAME_init_c_api_v2 with the foreign export of the registration action. It
+ * negotiates and copies the host table, starts the threaded GHC runtime once
+ * for the process, and calls the entry. It reports a failure through
+ * input->err. Only this function is for use outside duckdb-ffi. The table is
+ * hidden in the duckdb-ffi library, so other C code cannot call DuckDB through
+ * the redirected names. */
+DUCKDB_EXTENSION_API void duckdb_haskell_extension_load(struct duckdb_v2_extension_input *input,
+                                                        duckdb_haskell_extension_entry entry);
+
+DUCKDB_EXTENSION_EXTERN_C_GUARD_CLOSE
+
+#endif
diff --git a/cbits/duckdb_stub.c b/cbits/duckdb_stub.c
deleted file mode 100644
--- a/cbits/duckdb_stub.c
+++ /dev/null
@@ -1,714 +0,0 @@
-#include "duckdb.h"
-#include "duckdb_arrow.h"
-#include <stdint.h>
-
-// duckdb_query_progress returns a struct by value; expose a pointer-based version
-// so the Haskell FFI can marshal the result and so we can gracefully handle NULL.
-void wrapped_duckdb_query_progress(duckdb_connection connection, duckdb_query_progress_type *out_progress) {
-  if (!out_progress) {
-    return;
-  }
-  *out_progress = duckdb_query_progress(connection);
-}
-
-// duckdb_result_statement_type consumes a duckdb_result by value; this wrapper lets
-// us pass a pointer from Haskell and returns a safe default when NULL is supplied.
-duckdb_statement_type wrapped_duckdb_result_statement_type(const duckdb_result *result) {
-  if (!result) {
-    return DUCKDB_STATEMENT_TYPE_INVALID;
-  }
-  return duckdb_result_statement_type(*result);
-}
-
-// duckdb_result_return_type also expects the result struct by value; wrap it so we
-// can call it from Haskell while avoiding undefined behaviour on NULL.
-duckdb_result_type wrapped_duckdb_result_return_type(const duckdb_result *result) {
-  if (!result) {
-    return DUCKDB_RESULT_TYPE_INVALID;
-  }
-  return duckdb_result_return_type(*result);
-}
-
-// duckdb_result_get_arrow_options mutates the result structure; we pass the pointer
-// through after checking for NULL and casting away const for the FFI surface.
-duckdb_arrow_options wrapped_duckdb_result_get_arrow_options(const duckdb_result *result) {
-  if (!result) {
-    return NULL;
-  }
-  return duckdb_result_get_arrow_options((duckdb_result *)result);
-}
-
-// duckdb_result_get_chunk takes the result by value; we provide a pointer-friendly
-// wrapper that also protects against accidental NULL dereferences.
-duckdb_data_chunk wrapped_duckdb_result_get_chunk(const duckdb_result *result, idx_t chunk_index) {
-  if (!result) {
-    return NULL;
-  }
-  return duckdb_result_get_chunk(*result, chunk_index);
-}
-
-// duckdb_result_chunk_count takes a duckdb_result by value; mirror it with pointer
-// semantics for the Haskell FFI.
-idx_t wrapped_duckdb_result_chunk_count(const duckdb_result *result) {
-  if (!result) {
-    return 0;
-  }
-  return duckdb_result_chunk_count(*result);
-}
-
-// duckdb_result_is_streaming takes the result by value; add a pointer-based shim
-// so we can pass NULL safely from the managed side.
-bool wrapped_duckdb_result_is_streaming(const duckdb_result *result) {
-  if (!result) {
-    return false;
-  }
-  return duckdb_result_is_streaming(*result);
-}
-
-// duckdb_value_hugeint returns a struct by value; expose an out-parameter variant
-// with NULL guards for easier use from Haskell.
-void wrapped_duckdb_value_hugeint(duckdb_result *result, idx_t col, idx_t row, duckdb_hugeint *out_value) {
-  if (!out_value) {
-    return;
-  }
-  *out_value = duckdb_value_hugeint(result, col, row);
-}
-
-// duckdb_value_uhugeint returns a struct by value; wrap it to write into caller-
-// supplied storage and to tolerate NULL pointers.
-void wrapped_duckdb_value_uhugeint(duckdb_result *result, idx_t col, idx_t row, duckdb_uhugeint *out_value) {
-  if (!out_value) {
-    return;
-  }
-  *out_value = duckdb_value_uhugeint(result, col, row);
-}
-
-// duckdb_value_decimal returns a struct by value; provide an out-parameter version
-// so we can marshal it easily.
-void wrapped_duckdb_value_decimal(duckdb_result *result, idx_t col, idx_t row, duckdb_decimal *out_value) {
-  if (!out_value) {
-    return;
-  }
-  *out_value = duckdb_value_decimal(result, col, row);
-}
-
-// duckdb_value_string returns a struct by value; expose a wrapper that fills a
-// duckdb_string for the caller if the output pointer is non-NULL.
-void wrapped_duckdb_value_string(duckdb_result *result, idx_t col, idx_t row, duckdb_string *out_value) {
-  if (!out_value) {
-    return;
-  }
-  *out_value = duckdb_value_string(result, col, row);
-}
-
-// duckdb_value_string_internal also returns a struct by value; same rationale as
-// wrapped_duckdb_value_string.
-void wrapped_duckdb_value_string_internal(duckdb_result *result, idx_t col, idx_t row, duckdb_string *out_value) {
-  if (!out_value) {
-    return;
-  }
-  *out_value = duckdb_value_string_internal(result, col, row);
-}
-
-// duckdb_value_blob returns a struct by value; copy into caller storage and guard
-// against NULL in the wrapper.
-void wrapped_duckdb_value_blob(duckdb_result *result, idx_t col, idx_t row, duckdb_blob *out_blob) {
-  if (!out_blob) {
-    return;
-  }
-  *out_blob = duckdb_value_blob(result, col, row);
-}
-
-// duckdb_value_interval returns a struct by value; expose pointer-friendly variant
-// for the managed bindings.
-void wrapped_duckdb_value_interval(duckdb_result *result, idx_t col, idx_t row, duckdb_interval *out_interval) {
-  if (!out_interval) {
-    return;
-  }
-  *out_interval = duckdb_value_interval(result, col, row);
-}
-
-// duckdb_string_is_inlined expects a struct by value; we pass a pointer and guard
-// against NULL before delegating.
-bool wrapped_duckdb_string_is_inlined(const duckdb_string_t *string) {
-  if (!string) {
-    return false;
-  }
-  return duckdb_string_is_inlined(*string);
-}
-
-// duckdb_string_t_length reads from duckdb_string_t by value; provide a pointer
-// based wrapper that handles NULL safely.
-uint32_t wrapped_duckdb_string_t_length(const duckdb_string_t *string) {
-  if (!string) {
-    return 0;
-  }
-  return duckdb_string_t_length(*string);
-}
-
-// duckdb_result_arrow_array modifies the arrow array; we add NULL checks so FFI
-// callers can omit either pointer without crashing the process.
-void wrapped_duckdb_result_arrow_array(const duckdb_result *result, duckdb_data_chunk chunk, duckdb_arrow_array *out_array) {
-  if (!result || !chunk || !out_array) {
-    return;
-  }
-  duckdb_result_arrow_array(*result, chunk, out_array);
-}
-
-// Deprecated Arrow handles point directly to Arrow C Data Interface structures.
-void *wrapped_duckdb_arrow_schema_internal_ptr(duckdb_arrow_schema handle) {
-  struct ArrowSchema *value = (struct ArrowSchema *)handle;
-  return value && value->release ? value : NULL;
-}
-
-void wrapped_duckdb_arrow_schema_clear_internal_ptr(duckdb_arrow_schema handle) {
-  struct ArrowSchema *value = (struct ArrowSchema *)handle;
-  if (value) {
-    value->release = NULL;
-  }
-}
-
-// Deprecated Arrow handles point directly to Arrow C Data Interface structures.
-void *wrapped_duckdb_arrow_array_internal_ptr(duckdb_arrow_array handle) {
-  struct ArrowArray *value = (struct ArrowArray *)handle;
-  return value && value->release ? value : NULL;
-}
-
-void wrapped_duckdb_arrow_array_clear_internal_ptr(duckdb_arrow_array handle) {
-  struct ArrowArray *value = (struct ArrowArray *)handle;
-  if (value) {
-    value->release = NULL;
-  }
-}
-
-// Deprecated Arrow handles point directly to Arrow C Data Interface structures.
-void *wrapped_duckdb_arrow_stream_internal_ptr(duckdb_arrow_stream handle) {
-  struct ArrowArrayStream *value = (struct ArrowArrayStream *)handle;
-  return value && value->release ? value : NULL;
-}
-
-void wrapped_duckdb_arrow_stream_clear_internal_ptr(duckdb_arrow_stream handle) {
-  struct ArrowArrayStream *value = (struct ArrowArrayStream *)handle;
-  if (value) {
-    value->release = NULL;
-  }
-}
-
-// duckdb_stream_fetch_chunk takes duckdb_result by value; provide a pointer form
-// so we can handle NULLs and avoid struct copies in the FFI.
-duckdb_data_chunk wrapped_duckdb_stream_fetch_chunk(const duckdb_result *result) {
-  if (!result) {
-    return NULL;
-  }
-  return duckdb_stream_fetch_chunk(*result);
-}
-
-// duckdb_fetch_chunk also expects duckdb_result by value; same pointer-friendly wrap
-// as above.
-duckdb_data_chunk wrapped_duckdb_fetch_chunk(const duckdb_result *result) {
-  if (!result) {
-    return NULL;
-  }
-  return duckdb_fetch_chunk(*result);
-}
-
-// duckdb_bind_interval consumes duckdb_interval by value; we copy from the pointer
-// so Haskell can pass NULL and avoid struct marshalling complexities.
-duckdb_state wrapped_duckdb_bind_interval(duckdb_prepared_statement statement, idx_t param_idx, const duckdb_interval *val) {
-  duckdb_interval interval_value = {0};
-  if (val) {
-    interval_value = *val;
-  }
-  return duckdb_bind_interval(statement, param_idx, interval_value);
-}
-
-// duckdb_bind_hugeint requires a struct by value; wrap to accept a pointer and
-// provide a zero-initialised default when NULL.
-duckdb_state wrapped_duckdb_bind_hugeint(duckdb_prepared_statement statement, idx_t param_idx, const duckdb_hugeint *val) {
-  duckdb_hugeint hugeint_value = {0};
-  if (val) {
-    hugeint_value = *val;
-  }
-  return duckdb_bind_hugeint(statement, param_idx, hugeint_value);
-}
-
-// duckdb_bind_uhugeint requires a struct by value; same pointer-based shim as for
-// duckdb_bind_hugeint.
-duckdb_state wrapped_duckdb_bind_uhugeint(duckdb_prepared_statement statement, idx_t param_idx, const duckdb_uhugeint *val) {
-  duckdb_uhugeint uhugeint_value = {0};
-  if (val) {
-    uhugeint_value = *val;
-  }
-  return duckdb_bind_uhugeint(statement, param_idx, uhugeint_value);
-}
-
-// duckdb_bind_decimal consumes duckdb_decimal by value; wrap it so we can accept a
-// pointer and default to zero when NULL arrives from Haskell.
-duckdb_state wrapped_duckdb_bind_decimal(duckdb_prepared_statement statement, idx_t param_idx, const duckdb_decimal *val) {
-  duckdb_decimal decimal_value = {0};
-  if (val) {
-    decimal_value = *val;
-  }
-  return duckdb_bind_decimal(statement, param_idx, decimal_value);
-}
-
-// duckdb_create_hugeint takes the struct by value; the wrapper copies from the
-// user pointer so Haskell can choose to pass NULL.
-duckdb_value wrapped_duckdb_create_hugeint(const duckdb_hugeint *input) {
-  duckdb_hugeint value = {0};
-  if (input) {
-    value = *input;
-  }
-  return duckdb_create_hugeint(value);
-}
-
-// duckdb_create_uhugeint takes the struct by value; wrap to accept optional pointer
-// input from the FFI.
-duckdb_value wrapped_duckdb_create_uhugeint(const duckdb_uhugeint *input) {
-  duckdb_uhugeint value = {0};
-  if (input) {
-    value = *input;
-  }
-  return duckdb_create_uhugeint(value);
-}
-
-// duckdb_create_bignum consumes duckdb_bignum by value; copy from pointer so the
-// managed caller can omit it.
-duckdb_value wrapped_duckdb_create_bignum(const duckdb_bignum *input) {
-  duckdb_bignum value = {0};
-  if (input) {
-    value = *input;
-  }
-  return duckdb_create_bignum(value);
-}
-
-// duckdb_create_decimal expects duckdb_decimal by value; pointer wrapper allows us
-// to default the argument and plays nicely with the FFI.
-duckdb_value wrapped_duckdb_create_decimal(const duckdb_decimal *input) {
-  duckdb_decimal value = {0};
-  if (input) {
-    value = *input;
-  }
-  return duckdb_create_decimal(value);
-}
-
-// duckdb_create_interval expects duckdb_interval by value; copy from pointer so
-// the managed caller can pass NULL and avoid struct marshalling.
-duckdb_value wrapped_duckdb_create_interval(const duckdb_interval *input) {
-  duckdb_interval value = {0};
-  if (input) {
-    value = *input;
-  }
-  return duckdb_create_interval(value);
-}
-
-// duckdb_create_bit requires duckdb_bit by value; copy from pointer for ease of use
-// on the Haskell side.
-duckdb_value wrapped_duckdb_create_bit(const duckdb_bit *input) {
-  duckdb_bit value = {0};
-  if (input) {
-    value = *input;
-  }
-  return duckdb_create_bit(value);
-}
-
-// duckdb_create_uuid expects a duckdb_uhugeint by value; wrap it so NULL pointers
-// are handled and the FFI can reuse the helper.
-duckdb_value wrapped_duckdb_create_uuid(const duckdb_uhugeint *input) {
-  duckdb_uhugeint value = {0};
-  if (input) {
-    value = *input;
-  }
-  return duckdb_create_uuid(value);
-}
-
-// duckdb_append_hugeint consumes a struct by value; copy from pointer before
-// delegating to avoid marshalling issues from Haskell.
-duckdb_state wrapped_duckdb_append_hugeint(duckdb_appender appender, const duckdb_hugeint *value) {
-  duckdb_hugeint tmp = {0};
-  if (value) {
-    tmp = *value;
-  }
-  return duckdb_append_hugeint(appender, tmp);
-}
-
-// duckdb_append_uhugeint also needs the value struct by copy; pointer wrapper keeps
-// the FFI simple and guards NULL.
-duckdb_state wrapped_duckdb_append_uhugeint(duckdb_appender appender, const duckdb_uhugeint *value) {
-  duckdb_uhugeint tmp = {0};
-  if (value) {
-    tmp = *value;
-  }
-  return duckdb_append_uhugeint(appender, tmp);
-}
-
-// duckdb_append_interval expects a duckdb_interval by value; use a pointer wrapper
-// to appease the Haskell FFI and handle absent values.
-duckdb_state wrapped_duckdb_append_interval(duckdb_appender appender, const duckdb_interval *value) {
-  duckdb_interval tmp = {0};
-  if (value) {
-    tmp = *value;
-  }
-  return duckdb_append_interval(appender, tmp);
-}
-
-// duckdb_get_hugeint returns a struct by value; write the result into caller
-// storage to avoid struct-return ABI issues in Haskell.
-void wrapped_duckdb_get_hugeint(duckdb_value val, duckdb_hugeint *out_value) {
-  if (!out_value) {
-    return;
-  }
-  *out_value = duckdb_get_hugeint(val);
-}
-
-// duckdb_get_uhugeint returns a struct by value; same pointer-based extraction as
-// wrapped_duckdb_get_hugeint.
-void wrapped_duckdb_get_uhugeint(duckdb_value val, duckdb_uhugeint *out_value) {
-  if (!out_value) {
-    return;
-  }
-  *out_value = duckdb_get_uhugeint(val);
-}
-
-// duckdb_get_bignum returns a struct by value; write the result into an out pointer
-// for the managed caller.
-void wrapped_duckdb_get_bignum(duckdb_value val, duckdb_bignum *out_value) {
-  if (!out_value) {
-    return;
-  }
-  *out_value = duckdb_get_bignum(val);
-}
-
-// duckdb_get_decimal returns a struct by value; provide the same pointer-based
-// access pattern as the other get wrappers.
-void wrapped_duckdb_get_decimal(duckdb_value val, duckdb_decimal *out_value) {
-  if (!out_value) {
-    return;
-  }
-  *out_value = duckdb_get_decimal(val);
-}
-
-// duckdb_get_interval returns a struct by value; wrap it to write into caller
-// memory.
-void wrapped_duckdb_get_interval(duckdb_value val, duckdb_interval *out_value) {
-  if (!out_value) {
-    return;
-  }
-  *out_value = duckdb_get_interval(val);
-}
-
-// duckdb_get_blob returns duckdb_blob by value; expose an out-parameter wrapper for
-// the FFI.
-void wrapped_duckdb_get_blob(duckdb_value val, duckdb_blob *out_value) {
-  if (!out_value) {
-    return;
-  }
-  *out_value = duckdb_get_blob(val);
-}
-
-// duckdb_get_bit returns duckdb_bit by value; wrap it to fill caller-provided
-// storage.
-void wrapped_duckdb_get_bit(duckdb_value val, duckdb_bit *out_value) {
-  if (!out_value) {
-    return;
-  }
-  *out_value = duckdb_get_bit(val);
-}
-
-// duckdb_get_uuid returns duckdb_uhugeint by value; write into an out pointer for
-// the managed binding.
-void wrapped_duckdb_get_uuid(duckdb_value val, duckdb_uhugeint *out_value) {
-  if (!out_value) {
-    return;
-  }
-  *out_value = duckdb_get_uuid(val);
-}
-
-// duckdb_hugeint_to_double consumes its argument by value; copy from pointer so we
-// can call it from Haskell without struct marshalling.
-double wrapped_duckdb_hugeint_to_double(const duckdb_hugeint *value) {
-  duckdb_hugeint tmp = {0};
-  if (value) {
-    tmp = *value;
-  }
-  return duckdb_hugeint_to_double(tmp);
-}
-
-// duckdb_double_to_hugeint returns a struct by value; provide an out pointer for
-// the managed side.
-void wrapped_duckdb_double_to_hugeint(double input, duckdb_hugeint *out_value) {
-  if (!out_value) {
-    return;
-  }
-  *out_value = duckdb_double_to_hugeint(input);
-}
-
-// duckdb_double_to_decimal returns duckdb_decimal by value; write into caller
-// storage instead.
-void wrapped_duckdb_double_to_decimal(double input, uint8_t width, uint8_t scale, duckdb_decimal *out_value) {
-  if (!out_value) {
-    return;
-  }
-  *out_value = duckdb_double_to_decimal(input, width, scale);
-}
-
-// duckdb_decimal_to_double consumes its argument by value; copy from pointer so
-// the FFI can pass nullable inputs.
-double wrapped_duckdb_decimal_to_double(const duckdb_decimal *value) {
-  duckdb_decimal tmp = {0};
-  if (value) {
-    tmp = *value;
-  }
-  return duckdb_decimal_to_double(tmp);
-}
-
-// duckdb_from_date returns a struct by value; emit the result through an
-// out-parameter to avoid struct-return plumbing on the Haskell side.
-void wrapped_duckdb_from_date(int32_t date, duckdb_date_struct *out_value) {
-  if (!out_value) {
-    return;
-  }
-  *out_value = duckdb_from_date((duckdb_date){date});
-}
-
-// duckdb_to_date expects a struct by value; copy from pointer so NULL can be passed
-// and so the ABI stays simple.
-int32_t wrapped_duckdb_to_date(const duckdb_date_struct *input) {
-  duckdb_date_struct tmp = {0};
-  if (input) {
-    tmp = *input;
-  }
-  return duckdb_to_date(tmp).days;
-}
-
-// duckdb_from_time returns a struct by value; wrap to emit via an out pointer.
-void wrapped_duckdb_from_time(int64_t time, duckdb_time_struct *out_value) {
-  if (!out_value) {
-    return;
-  }
-  *out_value = duckdb_from_time((duckdb_time){time});
-}
-
-// duckdb_from_time_tz returns a struct by value; provide pointer-based output.
-void wrapped_duckdb_from_time_tz(uint64_t micros, duckdb_time_tz_struct *out_value) {
-  if (!out_value) {
-    return;
-  }
-  *out_value = duckdb_from_time_tz((duckdb_time_tz){micros});
-}
-
-// duckdb_to_time expects a struct by value; copy from pointer for the bindings.
-int64_t wrapped_duckdb_to_time(const duckdb_time_struct *input) {
-  duckdb_time_struct tmp = {0};
-  if (input) {
-    tmp = *input;
-  }
-  return duckdb_to_time(tmp).micros;
-}
-
-// duckdb_from_timestamp returns a struct by value; write into caller-provided
-// storage instead.
-void wrapped_duckdb_from_timestamp(int64_t ts, duckdb_timestamp_struct *out_value) {
-  if (!out_value) {
-    return;
-  }
-  *out_value = duckdb_from_timestamp((duckdb_timestamp){ts});
-}
-
-// duckdb_to_timestamp expects a struct by value; copy from pointer before calling.
-int64_t wrapped_duckdb_to_timestamp(const duckdb_timestamp_struct *input) {
-  duckdb_timestamp_struct tmp = {0};
-  if (input) {
-    tmp = *input;
-  }
-  return duckdb_to_timestamp(tmp).micros;
-}
-
-// duckdb_uhugeint_to_double consumes its argument by value; copy from pointer to
-// make it callable from Haskell.
-double wrapped_duckdb_uhugeint_to_double(const duckdb_uhugeint *value) {
-  duckdb_uhugeint tmp = {0};
-  if (value) {
-    tmp = *value;
-  }
-  return duckdb_uhugeint_to_double(tmp);
-}
-
-// duckdb_double_to_uhugeint returns a struct by value; write the result into caller
-// storage instead of relying on struct-return ABI support.
-void wrapped_duckdb_double_to_uhugeint(double input, duckdb_uhugeint *out_value) {
-  if (!out_value) {
-    return;
-  }
-  *out_value = duckdb_double_to_uhugeint(input);
-}
-
-// Convert scalar fields at the C ABI boundary.
-bool wrapped_duckdb_is_finite_date(int32_t date) {
-  return duckdb_is_finite_date((duckdb_date){date});
-}
-
-// Convert scalar fields at the C ABI boundary.
-uint64_t wrapped_duckdb_create_time_tz(int64_t micros, int32_t offset) {
-  return duckdb_create_time_tz(micros, offset).bits;
-}
-
-// Convert scalar fields at the C ABI boundary.
-bool wrapped_duckdb_is_finite_timestamp(int64_t ts) {
-  return duckdb_is_finite_timestamp((duckdb_timestamp){ts});
-}
-
-// Convert scalar fields at the C ABI boundary.
-bool wrapped_duckdb_is_finite_timestamp_s(int64_t ts) {
-  return duckdb_is_finite_timestamp_s((duckdb_timestamp_s){ts});
-}
-
-// Convert scalar fields at the C ABI boundary.
-bool wrapped_duckdb_is_finite_timestamp_ms(int64_t ts) {
-  return duckdb_is_finite_timestamp_ms((duckdb_timestamp_ms){ts});
-}
-
-// Convert scalar fields at the C ABI boundary.
-bool wrapped_duckdb_is_finite_timestamp_ns(int64_t ts) {
-  return duckdb_is_finite_timestamp_ns((duckdb_timestamp_ns){ts});
-}
-
-// Convert scalar fields at the C ABI boundary.
-duckdb_state wrapped_duckdb_bind_date(duckdb_prepared_statement prepared_statement, idx_t param_idx, int32_t val) {
-  return duckdb_bind_date(prepared_statement, param_idx, (duckdb_date){val});
-}
-
-// Convert scalar fields at the C ABI boundary.
-duckdb_state wrapped_duckdb_bind_time(duckdb_prepared_statement prepared_statement, idx_t param_idx, int64_t val) {
-  return duckdb_bind_time(prepared_statement, param_idx, (duckdb_time){val});
-}
-
-// Convert scalar fields at the C ABI boundary.
-duckdb_state wrapped_duckdb_bind_timestamp(duckdb_prepared_statement prepared_statement, idx_t param_idx, int64_t val) {
-  return duckdb_bind_timestamp(prepared_statement, param_idx, (duckdb_timestamp){val});
-}
-
-// Convert scalar fields at the C ABI boundary.
-duckdb_state wrapped_duckdb_bind_timestamp_tz(duckdb_prepared_statement prepared_statement, idx_t param_idx, int64_t val) {
-  return duckdb_bind_timestamp_tz(prepared_statement, param_idx, (duckdb_timestamp){val});
-}
-
-// Convert scalar fields at the C ABI boundary.
-duckdb_value wrapped_duckdb_create_date(int32_t input) {
-  return duckdb_create_date((duckdb_date){input});
-}
-
-// Convert scalar fields at the C ABI boundary.
-duckdb_value wrapped_duckdb_create_time(int64_t input) {
-  return duckdb_create_time((duckdb_time){input});
-}
-
-// Convert scalar fields at the C ABI boundary.
-duckdb_value wrapped_duckdb_create_time_ns(int64_t input) {
-  return duckdb_create_time_ns((duckdb_time_ns){input});
-}
-
-// Convert scalar fields at the C ABI boundary.
-duckdb_value wrapped_duckdb_create_time_tz_value(uint64_t value) {
-  return duckdb_create_time_tz_value((duckdb_time_tz){value});
-}
-
-// Convert scalar fields at the C ABI boundary.
-duckdb_value wrapped_duckdb_create_timestamp(int64_t input) {
-  return duckdb_create_timestamp((duckdb_timestamp){input});
-}
-
-// Convert scalar fields at the C ABI boundary.
-duckdb_value wrapped_duckdb_create_timestamp_tz(int64_t input) {
-  return duckdb_create_timestamp_tz((duckdb_timestamp){input});
-}
-
-// Convert scalar fields at the C ABI boundary.
-duckdb_value wrapped_duckdb_create_timestamp_s(int64_t input) {
-  return duckdb_create_timestamp_s((duckdb_timestamp_s){input});
-}
-
-// Convert scalar fields at the C ABI boundary.
-duckdb_value wrapped_duckdb_create_timestamp_ms(int64_t input) {
-  return duckdb_create_timestamp_ms((duckdb_timestamp_ms){input});
-}
-
-// Convert scalar fields at the C ABI boundary.
-duckdb_value wrapped_duckdb_create_timestamp_ns(int64_t input) {
-  return duckdb_create_timestamp_ns((duckdb_timestamp_ns){input});
-}
-
-// Convert scalar fields at the C ABI boundary.
-int32_t wrapped_duckdb_get_date(duckdb_value val) {
-  return duckdb_get_date(val).days;
-}
-
-// Convert scalar fields at the C ABI boundary.
-int64_t wrapped_duckdb_get_time(duckdb_value val) {
-  return duckdb_get_time(val).micros;
-}
-
-// Convert scalar fields at the C ABI boundary.
-int64_t wrapped_duckdb_get_time_ns(duckdb_value val) {
-  return duckdb_get_time_ns(val).nanos;
-}
-
-// Convert scalar fields at the C ABI boundary.
-uint64_t wrapped_duckdb_get_time_tz(duckdb_value val) {
-  return duckdb_get_time_tz(val).bits;
-}
-
-// Convert scalar fields at the C ABI boundary.
-int64_t wrapped_duckdb_get_timestamp(duckdb_value val) {
-  return duckdb_get_timestamp(val).micros;
-}
-
-// Convert scalar fields at the C ABI boundary.
-int64_t wrapped_duckdb_get_timestamp_tz(duckdb_value val) {
-  return duckdb_get_timestamp_tz(val).micros;
-}
-
-// Convert scalar fields at the C ABI boundary.
-int64_t wrapped_duckdb_get_timestamp_s(duckdb_value val) {
-  return duckdb_get_timestamp_s(val).seconds;
-}
-
-// Convert scalar fields at the C ABI boundary.
-int64_t wrapped_duckdb_get_timestamp_ms(duckdb_value val) {
-  return duckdb_get_timestamp_ms(val).millis;
-}
-
-// Convert scalar fields at the C ABI boundary.
-int64_t wrapped_duckdb_get_timestamp_ns(duckdb_value val) {
-  return duckdb_get_timestamp_ns(val).nanos;
-}
-
-// Convert scalar fields at the C ABI boundary.
-duckdb_state wrapped_duckdb_append_date(duckdb_appender appender, int32_t value) {
-  return duckdb_append_date(appender, (duckdb_date){value});
-}
-
-// Convert scalar fields at the C ABI boundary.
-duckdb_state wrapped_duckdb_append_time(duckdb_appender appender, int64_t value) {
-  return duckdb_append_time(appender, (duckdb_time){value});
-}
-
-// Convert scalar fields at the C ABI boundary.
-duckdb_state wrapped_duckdb_append_timestamp(duckdb_appender appender, int64_t value) {
-  return duckdb_append_timestamp(appender, (duckdb_timestamp){value});
-}
-
-// Convert scalar fields at the C ABI boundary.
-int32_t wrapped_duckdb_value_date(duckdb_result *result, idx_t col, idx_t row) {
-  return duckdb_value_date(result, col, row).days;
-}
-
-// Convert scalar fields at the C ABI boundary.
-int64_t wrapped_duckdb_value_time(duckdb_result *result, idx_t col, idx_t row) {
-  return duckdb_value_time(result, col, row).micros;
-}
-
-// Convert scalar fields at the C ABI boundary.
-int64_t wrapped_duckdb_value_timestamp(duckdb_result *result, idx_t col, idx_t row) {
-  return duckdb_value_timestamp(result, col, row).micros;
-}
diff --git a/cbits/duckdb_v2.h b/cbits/duckdb_v2.h
new file mode 100644
--- /dev/null
+++ b/cbits/duckdb_v2.h
@@ -0,0 +1,16533 @@
+//===----------------------------------------------------------------------===//
+//
+//                         DuckDB
+//
+//
+//===----------------------------------------------------------------------===//
+//
+// !!!!!!!
+// WARNING: this file is autogenerated, manual changes will be overwritten
+// !!!!!!!
+
+#pragma once
+
+#include <stdbool.h>
+#include <stdint.h>
+#include <stddef.h>
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+#ifndef DUCKDB_C_API
+#ifdef _WIN32
+#ifdef DUCKDB_STATIC_BUILD
+#define DUCKDB_C_API
+#elif defined(DUCKDB_BUILD_LIBRARY) && !defined(DUCKDB_BUILD_LOADABLE_EXTENSION)
+#define DUCKDB_C_API __declspec(dllexport)
+#else
+#define DUCKDB_C_API __declspec(dllimport)
+#endif
+#else
+#if defined(__GNUC__) || defined(__clang__)
+#define DUCKDB_C_API __attribute__((visibility("default")))
+#else
+#define DUCKDB_C_API
+#endif
+#endif
+#endif
+
+#ifndef DUCKDB_EXTENSION_API
+#ifdef _WIN32
+#ifdef DUCKDB_STATIC_BUILD
+#define DUCKDB_EXTENSION_API
+#else
+#define DUCKDB_EXTENSION_API __declspec(dllexport)
+#endif
+#else
+#if defined(__GNUC__) || defined(__clang__)
+#define DUCKDB_EXTENSION_API __attribute__((visibility("default")))
+#else
+#define DUCKDB_EXTENSION_API
+#endif
+#endif
+#endif
+
+#if defined(__GNUC__) || defined(__clang__)
+#define DUCKDB_DEPRECATED                                                                                              \
+	__attribute__((deprecated("This function is deprecated and will be removed in a future version.")))
+#elif defined(_MSC_VER)
+#define DUCKDB_DEPRECATED __declspec(deprecated("This function is deprecated and will be removed in a future version."))
+#else
+#define DUCKDB_DEPRECATED
+#endif
+
+//===--------------------------------------------------------------------===//
+// API version
+//===--------------------------------------------------------------------===//
+//! The API version this translation unit targets. Define all three to compile against an
+//! older surface than the one this header describes.
+#if !defined(DUCKDB_V2_API_VERSION_MAJOR) && !defined(DUCKDB_V2_API_VERSION_MINOR) &&                                  \
+    !defined(DUCKDB_V2_API_VERSION_PATCH)
+#define DUCKDB_V2_API_VERSION_MAJOR 2
+#define DUCKDB_V2_API_VERSION_MINOR 0
+#define DUCKDB_V2_API_VERSION_PATCH 0
+#elif !(defined(DUCKDB_V2_API_VERSION_MAJOR) && defined(DUCKDB_V2_API_VERSION_MINOR) &&                                \
+        defined(DUCKDB_V2_API_VERSION_PATCH))
+#error "define all or none of the DUCKDB_V2_API_VERSION_MAJOR / _MINOR / _PATCH macros"
+#endif
+
+//! True when the targeted version is x.y.z or newer.
+#define DUCKDB_V2_API_VERSION_AT_LEAST(x, y, z)                                                                        \
+	(DUCKDB_V2_API_VERSION_MAJOR > (x) ||                                                                              \
+	 (DUCKDB_V2_API_VERSION_MAJOR == (x) &&                                                                            \
+	  (DUCKDB_V2_API_VERSION_MINOR > (y) ||                                                                            \
+	   (DUCKDB_V2_API_VERSION_MINOR == (y) && DUCKDB_V2_API_VERSION_PATCH >= (z)))))
+
+//! True when the targeted version is older than x.y.z.
+#define DUCKDB_V2_API_VERSION_BELOW(x, y, z) (!DUCKDB_V2_API_VERSION_AT_LEAST((x), (y), (z)))
+
+//===--------------------------------------------------------------------===//
+// Surface switches
+//===--------------------------------------------------------------------===//
+//! Set to 1 to compile the deprecated surface, 0 to omit it. Defaults from the
+//! older DUCKDB_API_NO_DEPRECATED macro when that is what the consumer defines.
+#if !defined(DUCKDB_V2_API_ALLOW_DEPRECATED)
+#ifdef DUCKDB_API_NO_DEPRECATED
+#define DUCKDB_V2_API_ALLOW_DEPRECATED 0
+#else
+#define DUCKDB_V2_API_ALLOW_DEPRECATED 1
+#endif
+#endif
+
+//! Set to 1 to compile the unstable surface, 0 to omit it. Defaults from the
+//! older DUCKDB_EXTENSION_API_VERSION_UNSTABLE macro when that is what the consumer defines.
+#if !defined(DUCKDB_V2_API_ALLOW_UNSTABLE)
+#ifdef DUCKDB_EXTENSION_API_VERSION_UNSTABLE
+#define DUCKDB_V2_API_ALLOW_UNSTABLE 1
+#else
+#define DUCKDB_V2_API_ALLOW_UNSTABLE 0
+#endif
+#endif
+
+//! The unstable surface is not a promise, so it is not part of any released
+//! version: its constructs may change shape or vanish. Targeting an older version
+//! while opting into it would hand back today's shapes under names that version
+//! never promised, so the two are mutually exclusive.
+#if DUCKDB_V2_API_ALLOW_UNSTABLE && !DUCKDB_V2_API_VERSION_AT_LEAST(2, 0, 0)
+#error "the unstable surface requires targeting the newest API version"
+#endif
+
+//===--------------------------------------------------------------------===//
+// General type definitions
+//===--------------------------------------------------------------------===//
+
+// Arrow C Data Interface (https://arrow.apache.org/docs/format/CDataInterface.html).
+// Defined here so this header is self-contained: a binding author can allocate
+// and fill an ArrowSchema / ArrowArray with only this header. Guarded by the
+// standard ARROW_C_DATA_INTERFACE / ARROW_C_STREAM_INTERFACE macros that
+// pyarrow / nanoarrow / arrow also use, so these definitions coexist with a
+// consumer's own Arrow headers (first definition wins; the layouts are
+// byte-identical by spec).
+#ifndef ARROW_C_DATA_INTERFACE
+#define ARROW_C_DATA_INTERFACE
+
+#define ARROW_FLAG_DICTIONARY_ORDERED 1
+#define ARROW_FLAG_NULLABLE           2
+#define ARROW_FLAG_MAP_KEYS_SORTED    4
+
+struct ArrowSchema {
+	const char *format;
+	const char *name;
+	const char *metadata;
+	int64_t flags;
+	int64_t n_children;
+	struct ArrowSchema **children;
+	struct ArrowSchema *dictionary;
+	void (*release)(struct ArrowSchema *);
+	void *private_data;
+};
+
+struct ArrowArray {
+	int64_t length;
+	int64_t null_count;
+	int64_t offset;
+	int64_t n_buffers;
+	int64_t n_children;
+	const void **buffers;
+	struct ArrowArray **children;
+	struct ArrowArray *dictionary;
+	void (*release)(struct ArrowArray *);
+	void *private_data;
+};
+
+#endif
+
+#ifndef ARROW_C_STREAM_INTERFACE
+#define ARROW_C_STREAM_INTERFACE
+
+struct ArrowArrayStream {
+	int (*get_schema)(struct ArrowArrayStream *, struct ArrowSchema *out);
+	int (*get_next)(struct ArrowArrayStream *, struct ArrowArray *out);
+	const char *(*get_last_error)(struct ArrowArrayStream *);
+	void (*release)(struct ArrowArrayStream *);
+	void *private_data;
+};
+
+#endif
+
+typedef uint64_t idx_t;
+typedef struct _duckdb_extension_info *duckdb_v2_extension_handle;
+
+/* ============================================================================
+ * MODULE: common
+ * ============================================================================ */
+
+/* --- Enums for common --- */
+
+/*!
+ * The order guarantee a producer of rows makes about its output, which decides whether the rows it produces must be
+ * kept in order downstream.
+ */
+typedef enum DUCKDB_V2_ORDER_PRESERVATION {
+	/*!
+	 * The rows have no meaningful order. The engine may reorder them freely, and consumers that otherwise keep
+	 * insertion order, such as query results, INSERT and COPY, run in parallel without ordering them.
+	 */
+	DUCKDB_V2_ORDER_PRESERVATION_NO_ORDER = 0,
+
+	/*!
+	 * The rows are produced in insertion order, which the engine keeps unless the `preserve_insertion_order` setting is
+	 * disabled.
+	 */
+	DUCKDB_V2_ORDER_PRESERVATION_INSERTION_ORDER = 1,
+
+	/*!
+	 * The rows are produced in an order that must be kept, as if sorted by an `ORDER BY`, even when the
+	 * `preserve_insertion_order` setting is disabled.
+	 */
+	DUCKDB_V2_ORDER_PRESERVATION_FIXED_ORDER = 2,
+	DUCKDB_V2_ORDER_PRESERVATION_MAX_ENUM = 0x7FFFFFFF,
+} DUCKDB_V2_ORDER_PRESERVATION;
+
+/* --- Struct forward declarations for common --- */
+
+typedef struct duckdb_v2_str duckdb_v2_str;
+
+typedef struct duckdb_v2_bytes duckdb_v2_bytes;
+
+typedef struct duckdb_v2_opaque duckdb_v2_opaque;
+
+/* --- Types for common --- */
+
+/*!
+ * An opaque, owned handle to the V2 environment: the required root through which instance handles are created. All
+ * instances under one environment share an instance cache, so file-level conflicts — the same database file opened
+ * twice — are detected across them. Destroying the environment refuses with ERROR_RESOURCE_IN_USE while any instance
+ * created through it is still alive; destroy those first.
+ */
+typedef struct _duckdb_v2_environment {
+	void *internal_ptr;
+} * duckdb_v2_environment_handle;
+
+/*!
+ * An opaque, owned handle to a DuckDB database instance: a buffer pool, a scheduler, a set of GLOBAL settings, and the
+ * databases attached to it. Created empty by `duckdb_v2_instance_create()`; databases are attached with
+ * `duckdb_v2_instance_attach()`, made the default with `duckdb_v2_instance_set_default()`, and detached with
+ * `duckdb_v2_instance_detach()`. Always destroy via `duckdb_v2_instance_destroy()`.
+ */
+typedef struct _duckdb_v2_instance {
+	void *internal_ptr;
+} * duckdb_v2_instance_handle;
+
+/*!
+ * An opaque, owned handle to a DuckDB connection: a session on a database instance with its own LOCAL settings and
+ * transaction state. Always destroy via `duckdb_v2_connection_destroy()`.
+ */
+typedef struct _duckdb_v2_connection {
+	void *internal_ptr;
+} * duckdb_v2_connection_handle;
+
+/*!
+ * A borrowed handle to the scope config options are read from and written at. Taken from an instance
+ * (`duckdb_v2_instance_get_config()`), a connection (`duckdb_v2_connection_get_config()`) or a context
+ * (`duckdb_v2_context_get_config()`), and valid for as long as its source is; the caller never destroys it. An
+ * instance's config is the GLOBAL scope alone; a connection's or a context's config reads that client's cascade (its
+ * SESSION value, else the GLOBAL one, else the default) and writes at any scope the option supports.
+ */
+typedef struct _duckdb_v2_config {
+	void *internal_ptr;
+} * duckdb_v2_config_handle;
+
+/*!
+ * An opaque, owned, read-only descriptor of a single config option as registered on an instance: its canonical name,
+ * default value, description, the scopes it may be written at, and aliases. It carries no current value: read that with
+ * the *_get_option_value functions, and write it with the *_set_option functions. Returned by the *_get_option_by_name
+ * and *_get_option_by_index functions; the caller always destroys it via `duckdb_v2_option_destroy()`.
+ */
+typedef struct _duckdb_v2_option {
+	void *internal_ptr;
+} * duckdb_v2_option_handle;
+
+//! Opaque detail for a failed call; destroy with `duckdb_v2_error_info_destroy()`.
+typedef struct _duckdb_v2_error_info {
+	void *internal_ptr;
+} * duckdb_v2_error_info_handle;
+
+/*!
+ * An opaque, owned handle to a logical type. Carries a type id plus any kind-specific metadata: decimal width and
+ * scale, enum dictionary, list / array / struct / map / union child types, alias. A type is read-only once constructed;
+ * instances arrive from a query result schema, or from one of the create_type_* constructors. Always destroy via
+ * `duckdb_v2_logical_type_destroy()`. Borrowed strings returned by the getters are valid only until then.
+ */
+typedef struct _duckdb_v2_logical_type {
+	void *internal_ptr;
+} * duckdb_v2_logical_type_handle;
+
+/*!
+ * An opaque, owned handle to a single SQL value: a logical type plus a typed payload. Always destroy via
+ * `duckdb_v2_value_destroy()`. The string returned by `duckdb_v2_value_get_varchar()` / `duckdb_v2_value_get_blob()` is
+ * borrowed and valid only until then. That holds for BIGNUM too, where what is borrowed is the opaque storage form;
+ * `duckdb_v2_bignum_decode()` translates it into a magnitude and a sign flag, writing into a buffer the caller
+ * supplies.
+ */
+typedef struct _duckdb_v2_value {
+	void *internal_ptr;
+} * duckdb_v2_value_handle;
+
+/*!
+ * An opaque, owned handle to the streaming result of a query. Carries the schema (column names and logical types), the
+ * statement type, and the result type from prepare time; row data is produced incrementally by stepping
+ * (`duckdb_v2_result_step()`) or draining (`duckdb_v2_result_fetch_chunk()`). Single consumer: step from one thread at
+ * a time.
+ *
+ * A result is a cursor on the connection's execution, not a box of data. While its statement runs — at most until it is
+ * finished, cancelled, errored, or destroyed — the connection refuses new queries with ERROR_RESOURCE_IN_USE, and the
+ * query's transaction stays open, deferring version cleanup and checkpointing, so drain or destroy it promptly.
+ * Side-effecting statements (PRAGMA, ALTER, ...) take effect only once the result is drained. Always destroy via
+ * `duckdb_v2_result_destroy()`, which is safe even on a partially consumed stream.
+ */
+typedef struct _duckdb_v2_result {
+	void *internal_ptr;
+} * duckdb_v2_result_handle;
+
+/*!
+ * An opaque, owned handle to a data chunk: a set of vectors of equal logical length plus a cardinality (row count).
+ *
+ * A data chunk is the main "unit of execution" in DuckDB, and the main unit of data transfer in the API. It may be
+ * owned or borrowed, depending on the context.
+ */
+typedef struct _duckdb_v2_data_chunk {
+	void *internal_ptr;
+} * duckdb_v2_data_chunk_handle;
+
+/*!
+ * A borrowed handle to a vector within a data chunk, carrying a part of a column's values. Vectors are always borrowed
+ * from a data chunk, and are valid only as long as their parent data chunk is alive.
+ */
+typedef struct _duckdb_v2_vector {
+	void *internal_ptr;
+} * duckdb_v2_vector_handle;
+
+/*!
+ * A borrowed handle to a "arena allocator".
+ *
+ * Bytes handed out by `duckdb_v2_arena_allocate()` share the same lifetime as the arena itself.
+ * `duckdb_v2_vector_get_arena()` yields the arena backing the out-of-line bytes of non-inlined VARCHAR / BLOB / BIT /
+ * BIGNUM values, valid until the owning vector is flattened, reallocated, or destroyed.
+ */
+typedef struct _duckdb_v2_arena {
+	void *internal_ptr;
+} * duckdb_v2_arena_handle;
+
+/*!
+ * A borrowed handle to a client context: a connection seen from inside DuckDB. Handed out within DuckDB-managed scopes
+ * — function bind / init / exec callbacks, replacement scans, and the extension entrypoint — and valid only for the
+ * duration of that scope; the caller never destroys it. Within that scope a transaction is already active. A context
+ * reaches the same capabilities a connection does, through `duckdb_v2_context_get_factory()`,
+ * `duckdb_v2_context_get_config()`, `duckdb_v2_context_get_file_system()` and `duckdb_v2_context_log()`.
+ */
+typedef struct _duckdb_v2_context {
+	void *internal_ptr;
+} * duckdb_v2_context_handle;
+
+/*!
+ * A borrowed handle to the scope values, types, data chunks and column data collections are created in. Taken from an
+ * instance (`duckdb_v2_instance_get_factory()`), a connection (`duckdb_v2_connection_get_factory()`) or a context
+ * (`duckdb_v2_context_get_factory()`), and valid for as long as its source is; the caller never destroys it. A factory
+ * resolves in the scope of its source: a connection's or a context's factory reaches the catalog and the client's
+ * settings, while an instance's factory knows only the built-in types and casts, with default settings, and refuses
+ * anything that needs a catalog.
+ */
+typedef struct _duckdb_v2_factory {
+	void *internal_ptr;
+} * duckdb_v2_factory_handle;
+
+/*!
+ * An entry in a selection-vector.
+ *
+ * A selection-vector is a "dictionary" represented as an array of indices (sel_t's) mapping "logical" row indices to
+ * the "physical" offsets in a vectors primary data buffer. Used by "dictionary vectors" to represent a filtered or
+ * "sparse" view of the vector's data.
+ */
+typedef uint32_t duckdb_v2_sel_t;
+
+//! VARCHAR storage. The bytes must contain valid UTF-8. Read the transparent bytes fields directly.
+typedef duckdb_v2_bytes duckdb_v2_varchar_t;
+
+//! BLOB storage. Read the transparent bytes fields directly.
+typedef duckdb_v2_bytes duckdb_v2_blob_t;
+
+//! BIT storage. Byte 0 is the padding-bit count, bytes 1.. the data.
+typedef duckdb_v2_bytes duckdb_v2_bit_t;
+
+//! BIGNUM storage. Decode via `duckdb_v2_bignum_decode()`.
+typedef duckdb_v2_bytes duckdb_v2_bignum_t;
+
+/*!
+ * A borrowed name view with the same layout as str, marking a string DuckDB treats as a SQL identifier: one matched
+ * case-insensitively. Compare two identifiers case-insensitively rather than byte for byte, and render one into SQL
+ * through the identifier-quoting entry point rather than embedding it raw. The catalog preserves casing; some
+ * registries (config settings) canonicalize to lowercase.
+ *
+ * An identifier passed into the API must be valid UTF-8; otherwise the call fails with `ERROR_INPUT_INVALID`.
+ */
+typedef duckdb_v2_str duckdb_v2_identifier_t;
+
+/* --- Constants for common --- */
+
+//! Inline cutoff for `bytes` storage: a value of at most this many bytes is stored inline.
+#define DUCKDB_V2_BYTES_INLINE_LENGTH 12
+
+/* --- Function pointer typedefs for common --- */
+
+/*!
+ * Receives text produced by DuckDB
+ *
+ * Invoked exactly once per producing call, with the complete text in a single view.
+ *
+ * The view is borrowed for the duration of the call only. Copy what you need before returning, and do not retain `text`
+ * or `text->ptr`. The bytes are NOT guaranteed to be null-terminated.
+ *
+ * `err` is a live error slot, never NULL. Populate it with `duckdb_v2_error_info_set_code()` /
+ * `duckdb_v2_error_info_set_text()` to signal failure to DuckDB. Do not destroy it yourself.
+ *
+ * The sink runs inside DuckDB's call frame: it must not throw or unwind across the boundary, and it must not re-enter
+ * the API on the handle being operated on.
+ */
+typedef void (*duckdb_v2_text_sink_fn)(const duckdb_v2_str *text, void *user_data, duckdb_v2_error_info_handle *err);
+
+/*!
+ * Compares two caller-defined resources for equality.
+ *
+ * Invoked when DuckDB needs to compare two opaque handles. The callback is responsible for interpreting the pointers
+ * and comparing the underlying resources. Return true if they are equal, false otherwise.
+ *
+ * The callback runs inside DuckDB's call frame: it must not throw or unwind across the boundary, and it must not
+ * re-enter the API on the handle being operated on.
+ */
+typedef bool (*duckdb_v2_opaque_equals_fn)(void *a, void *b);
+
+/*!
+ * Destroys a caller-defined resource.
+ *
+ * Invoked when DuckDB needs to destroy an opaque handle. The callback is responsible for interpreting the pointer and
+ * freeing the underlying resource.
+ *
+ * The callback runs inside DuckDB's call frame: it must not throw or unwind across the boundary, and it must not
+ * re-enter the API on the handle being operated on.
+ */
+typedef void (*duckdb_v2_opaque_destroy_fn)(void *data);
+
+/* --- Functions for common --- */
+
+/* --- Struct definitions for common --- */
+
+/*!
+ * A borrowed, length-delimited string view: `ptr` points at `len` bytes of character data. The bytes are NOT guaranteed
+ * to be null-terminated and may contain interior null bytes, so always honor `len` rather than scanning for a
+ * terminator. The view never owns its bytes; the function that produced it documents how long they live (typically
+ * "valid until the owning handle is destroyed"). `{NULL, 0}` is the canonical empty view, and `ptr` must not be
+ * dereferenced when `len` is 0. Not to be confused with `bytes`, the transparent 16-byte *storage* format for a
+ * variable-size value in a vector.
+ *
+ * Functions take an input view as a `const str *`, which must not be NULL; a NULL pointer, or a view whose `ptr` is
+ * NULL while `len` is nonzero, fails with ERROR_INPUT_INVALID. Point at a `{NULL, 0}` view to pass an empty string.
+ *
+ * Text inputs, such as VARCHAR values and names, must contain valid UTF-8. The caller is responsible for ensuring this;
+ * API functions do not necessarily validate the input. Binary inputs, such as BLOB values, do not require valid UTF-8.
+ */
+struct duckdb_v2_str {
+	const char *ptr;
+	idx_t len;
+};
+
+/*!
+ * 16-byte storage for a variable-size, byte-backed value: VARCHAR, BLOB, BIT, or BIGNUM. The bytes are inlined when the
+ * length is at most BYTES_INLINE_LENGTH, in value.inlined.inlined; otherwise value.pointer.ptr holds them and
+ * value.pointer.prefix repeats the first
+ * 4. The union is transparent, so read the fields directly. VARCHAR and
+ * BLOB carry no further encoding; BIT and BIGNUM do. For BIT, byte 0 is the padding-bit count and bytes 1.. are the
+ * data; BIGNUM is decoded via `duckdb_v2_bignum_decode()`.
+ */
+struct duckdb_v2_bytes {
+	union {
+		struct {
+			uint32_t length;
+			char prefix[4];
+			char *ptr;
+		} pointer;
+		struct {
+			uint32_t length;
+			char inlined[12];
+		} inlined;
+	} value;
+};
+
+/*!
+ * An opaque, owned handle to a caller-defined resource. Bundles the pointer with optional callbacks that destroy and
+ * compare the resource.
+ */
+struct duckdb_v2_opaque {
+	void *ptr;
+	duckdb_v2_opaque_destroy_fn destroy;
+	duckdb_v2_opaque_equals_fn equals;
+};
+
+/* ============================================================================
+ * MODULE: errors
+ * ============================================================================ */
+
+/* --- Enums for errors --- */
+
+//! Error codes for API calls.
+typedef enum DUCKDB_V2_ERROR {
+	//! Success.
+	DUCKDB_V2_ERROR_NONE = 0,
+
+	//! Generic API error.
+	DUCKDB_V2_ERROR_API = 1,
+
+	//! The specified file could not be found.
+	DUCKDB_V2_ERROR_IO_FILE_NOT_FOUND = 1001,
+
+	//! Failed to read from the storage device.
+	DUCKDB_V2_ERROR_IO_READ_FAILURE = 1002,
+
+	//! Unexpected end of file reached.
+	DUCKDB_V2_ERROR_IO_EOF = 1003,
+
+	//! A generic I/O error occurred while reading or writing data.
+	DUCKDB_V2_ERROR_IO_GENERAL = 1004,
+
+	//! A network-level failure occurred during an I/O operation.
+	DUCKDB_V2_ERROR_IO_NETWORK = 1005,
+
+	//! An HTTP request issued by the database failed.
+	DUCKDB_V2_ERROR_IO_HTTP = 1006,
+
+	//! General invalid input error.
+	DUCKDB_V2_ERROR_INPUT_INVALID = 2001,
+
+	//! A specific function parameter is malformed.
+	DUCKDB_V2_ERROR_INPUT_PARAMETER_INVALID = 2002,
+
+	//! A provided value is outside the acceptable range.
+	DUCKDB_V2_ERROR_INPUT_OUT_OF_RANGE = 2003,
+
+	//! An object exceeded its maximum permitted size.
+	DUCKDB_V2_ERROR_INPUT_OBJECT_SIZE = 2004,
+
+	/*!
+	 * The metadata asked for is known only once execution binds the statement that produces it, because the statement
+	 * expands into several. Step the result and ask again.
+	 */
+	DUCKDB_V2_ERROR_INPUT_METADATA_DEFERRED = 2005,
+
+	//! The requested resource is already in use.
+	DUCKDB_V2_ERROR_RESOURCE_IN_USE = 3001,
+
+	//! An allocation failed because the system ran out of memory.
+	DUCKDB_V2_ERROR_RESOURCE_OUT_OF_MEMORY = 3002,
+
+	//! A connection-level failure occurred (e.g. the connection has been closed or invalidated).
+	DUCKDB_V2_ERROR_RESOURCE_CONNECTION = 3003,
+
+	//! An operation failed because of an unresolved dependency between catalog objects.
+	DUCKDB_V2_ERROR_RESOURCE_DEPENDENCY = 3004,
+
+	//! An extension required by the operation is not loaded.
+	DUCKDB_V2_ERROR_RESOURCE_MISSING_EXTENSION = 3005,
+
+	//! Autoloading an extension failed.
+	DUCKDB_V2_ERROR_RESOURCE_AUTOLOAD = 3006,
+
+	//! A value could not be converted to the requested type.
+	DUCKDB_V2_ERROR_TYPE_CONVERSION = 4001,
+
+	//! An unknown or unsupported type was encountered.
+	DUCKDB_V2_ERROR_TYPE_UNKNOWN = 4002,
+
+	//! A type was used in a context where it is not valid.
+	DUCKDB_V2_ERROR_TYPE_INVALID = 4003,
+
+	//! Two values or expressions have incompatible types.
+	DUCKDB_V2_ERROR_TYPE_MISMATCH = 4004,
+
+	//! A decimal value is out of range or otherwise invalid.
+	DUCKDB_V2_ERROR_TYPE_DECIMAL = 4005,
+
+	//! Division by zero was attempted.
+	DUCKDB_V2_ERROR_TYPE_DIVIDE_BY_ZERO = 4006,
+
+	//! The query could not be parsed.
+	DUCKDB_V2_ERROR_QUERY_PARSER = 5001,
+
+	//! The query contains a syntax error.
+	DUCKDB_V2_ERROR_QUERY_SYNTAX = 5002,
+
+	//! Binding the query against the catalog failed (e.g. unknown column or table).
+	DUCKDB_V2_ERROR_QUERY_BINDER = 5003,
+
+	//! The query could not be translated into a logical plan.
+	DUCKDB_V2_ERROR_QUERY_PLANNER = 5004,
+
+	//! An error occurred during query optimization.
+	DUCKDB_V2_ERROR_QUERY_OPTIMIZER = 5005,
+
+	//! An expression in the query is invalid or could not be evaluated.
+	DUCKDB_V2_ERROR_QUERY_EXPRESSION = 5006,
+
+	//! An error occurred while executing the physical plan.
+	DUCKDB_V2_ERROR_QUERY_EXECUTOR = 5007,
+
+	//! The task scheduler reported an error while running the query.
+	DUCKDB_V2_ERROR_QUERY_SCHEDULER = 5008,
+
+	//! The requested feature or operation is not implemented.
+	DUCKDB_V2_ERROR_QUERY_NOT_IMPLEMENTED = 5009,
+
+	//! A prepared-statement parameter has not been bound to a value.
+	DUCKDB_V2_ERROR_QUERY_PARAMETER_NOT_RESOLVED = 5010,
+
+	//! A prepared-statement parameter was used in a position where it is not allowed.
+	DUCKDB_V2_ERROR_QUERY_PARAMETER_NOT_ALLOWED = 5011,
+
+	//! A catalog operation failed (e.g. object not found or already exists).
+	DUCKDB_V2_ERROR_DATABASE_CATALOG = 6001,
+
+	//! A transaction-level error occurred (e.g. conflict or aborted transaction).
+	DUCKDB_V2_ERROR_DATABASE_TRANSACTION = 6002,
+
+	//! A constraint (primary key, unique, foreign key, NOT NULL, check) was violated.
+	DUCKDB_V2_ERROR_DATABASE_CONSTRAINT = 6003,
+
+	//! An index operation failed.
+	DUCKDB_V2_ERROR_DATABASE_INDEX = 6004,
+
+	//! A sequence operation failed (e.g. overflow or invalid usage).
+	DUCKDB_V2_ERROR_DATABASE_SEQUENCE = 6005,
+
+	//! An error related to catalog statistics occurred.
+	DUCKDB_V2_ERROR_DATABASE_STATISTICS = 6006,
+
+	//! Serializing or deserializing a database object failed.
+	DUCKDB_V2_ERROR_DATABASE_SERIALIZATION = 6007,
+
+	//! A settings-related error occurred (e.g. setting an unknown option).
+	DUCKDB_V2_ERROR_CONFIGURATION_SETTINGS = 7001,
+
+	//! The database configuration is invalid.
+	DUCKDB_V2_ERROR_CONFIGURATION_INVALID = 7002,
+
+	//! The operation is not permitted under the current configuration.
+	DUCKDB_V2_ERROR_CONFIGURATION_PERMISSION = 7003,
+
+	//! An internal invariant was violated; this indicates a bug in DuckDB.
+	DUCKDB_V2_ERROR_RUNTIME_INTERNAL = 8001,
+
+	//! A fatal error occurred; the database is no longer usable.
+	DUCKDB_V2_ERROR_RUNTIME_FATAL = 8002,
+
+	//! The operation was interrupted (e.g. by a cancel request).
+	DUCKDB_V2_ERROR_RUNTIME_INTERRUPT = 8003,
+
+	//! A required pointer was unexpectedly null.
+	DUCKDB_V2_ERROR_RUNTIME_NULL_POINTER = 8004,
+	DUCKDB_V2_ERROR_MAX_ENUM = 0x7FFFFFFF,
+} DUCKDB_V2_ERROR;
+
+/* --- Struct forward declarations for errors --- */
+
+/* --- Types for errors --- */
+
+/* --- Constants for errors --- */
+
+/* --- Function pointer typedefs for errors --- */
+
+/* --- Functions for errors --- */
+
+/* --- Struct definitions for errors --- */
+
+/* ============================================================================
+ * MODULE: function properties
+ * ============================================================================ */
+
+/* --- Enums for function properties --- */
+
+/*!
+ * Identifies a configurable function property. Pass one of these to `duckdb_v2_scalar_function_set_property()` or
+ * `duckdb_v2_aggregate_function_set_property()` together with a matching `DUCKDB_V2_FUNCTION_PROPERTY_VALUE`. The high
+ * byte is the function-type group: COMMON (`0x01xxxx`) keys apply to all function types, while group-specific keys
+ * (e.g. aggregate `0x03xxxx`) are only valid for that function type and are rejected with an error otherwise.
+ */
+typedef enum DUCKDB_V2_FUNCTION_PROPERTY_KEY {
+	/*!
+	 * How stable/deterministic the function's result is across rows and queries. Accepts the
+	 * `FUNCTION_PROPERTY_STABILITY_*` values. Defaults to `CONSISTENT`.
+	 */
+	DUCKDB_V2_FUNCTION_PROPERTY_STABILITY = 65536,
+
+	/*!
+	 * Whether the function handles NULL inputs itself. Accepts the `FUNCTION_PROPERTY_NULL_HANDLING_*` values. Defaults
+	 * to `DEFAULT` (NULL in, NULL out).
+	 */
+	DUCKDB_V2_FUNCTION_PROPERTY_NULL_HANDLING = 65792,
+
+	/*!
+	 * Whether the function can raise a runtime error. Accepts the `FUNCTION_PROPERTY_FALLIBILITY_*` values. Functions
+	 * created through this API default to `FALLIBLE`, since their callbacks can report errors.
+	 */
+	DUCKDB_V2_FUNCTION_PROPERTY_FALLIBILITY = 66048,
+
+	/*!
+	 * How the function interacts with collations on its arguments. Accepts the `FUNCTION_PROPERTY_COLLATION_HANDLING_*`
+	 * values. Defaults to `PROPAGATE`.
+	 */
+	DUCKDB_V2_FUNCTION_PROPERTY_COLLATION_HANDLING = 66304,
+
+	/*!
+	 * Aggregate only. Whether the aggregate's result depends on the order in which rows are aggregated. Accepts the
+	 * `FUNCTION_PROPERTY_AGG_ORDER_DEPENDENT_*` values. Defaults to `YES`.
+	 */
+	DUCKDB_V2_FUNCTION_PROPERTY_AGG_ORDER_DEPENDENT = 196608,
+
+	/*!
+	 * Aggregate only. Whether the aggregate's result is affected by a DISTINCT modifier. Accepts the
+	 * `FUNCTION_PROPERTY_AGG_DISTINCT_DEPENDENT_*` values. Defaults to `YES`.
+	 */
+	DUCKDB_V2_FUNCTION_PROPERTY_AGG_DISTINCT_DEPENDENT = 196864,
+	DUCKDB_V2_FUNCTION_PROPERTY_KEY_MAX_ENUM = 0x7FFFFFFF,
+} DUCKDB_V2_FUNCTION_PROPERTY_KEY;
+
+/*!
+ * A value for a `DUCKDB_V2_FUNCTION_PROPERTY_KEY`. Each key owns a 256-value block: a value `V` is valid for key `K`
+ * iff `(V & 0xFFFF00) == K`, and shares the key's function-type group (`V & 0xFF0000`) in its high byte. Passing a
+ * value that does not match the key is rejected with an error. Boolean-like properties are expressed as named values so
+ * that additional values can be added later without breaking the ABI.
+ */
+typedef enum DUCKDB_V2_FUNCTION_PROPERTY_VALUE {
+	//! The function always returns the same result given the same input.
+	DUCKDB_V2_FUNCTION_PROPERTY_STABILITY_CONSISTENT = 65536,
+
+	//! The result may differ per row (e.g. random()).
+	DUCKDB_V2_FUNCTION_PROPERTY_STABILITY_VOLATILE = 65537,
+
+	//! The result is stable within a single query/transaction but may change across queries (e.g. now()).
+	DUCKDB_V2_FUNCTION_PROPERTY_STABILITY_CONSISTENT_WITHIN_QUERY = 65538,
+
+	//! Default NULL handling: if any argument is NULL the result is NULL and the function is not invoked for that row.
+	DUCKDB_V2_FUNCTION_PROPERTY_NULL_HANDLING_DEFAULT = 65792,
+
+	//! The function handles NULL inputs itself and is invoked even when arguments are NULL.
+	DUCKDB_V2_FUNCTION_PROPERTY_NULL_HANDLING_SPECIAL = 65793,
+
+	/*!
+	 * The function never raises a runtime error. Declaring this promises that the callbacks never report an error; an
+	 * error reported anyway becomes an internal error.
+	 */
+	DUCKDB_V2_FUNCTION_PROPERTY_FALLIBILITY_INFALLIBLE = 66048,
+
+	//! The function may raise a runtime error for some inputs.
+	DUCKDB_V2_FUNCTION_PROPERTY_FALLIBILITY_FALLIBLE = 66049,
+
+	//! The function combines collations from its inputs and propagates them to its result (default).
+	DUCKDB_V2_FUNCTION_PROPERTY_COLLATION_HANDLING_PROPAGATE = 66304,
+
+	//! Combinable collations are executed on the input arguments before the function runs.
+	DUCKDB_V2_FUNCTION_PROPERTY_COLLATION_HANDLING_PUSH_COMBINABLE = 66305,
+
+	//! Collations are ignored by the function.
+	DUCKDB_V2_FUNCTION_PROPERTY_COLLATION_HANDLING_IGNORE = 66306,
+
+	//! The aggregate's result depends on the order in which rows are aggregated (default).
+	DUCKDB_V2_FUNCTION_PROPERTY_AGG_ORDER_DEPENDENT_YES = 196608,
+
+	//! The aggregate's result does not depend on input order.
+	DUCKDB_V2_FUNCTION_PROPERTY_AGG_ORDER_DEPENDENT_NO = 196609,
+
+	//! The aggregate's result is affected by a DISTINCT modifier (default).
+	DUCKDB_V2_FUNCTION_PROPERTY_AGG_DISTINCT_DEPENDENT_YES = 196864,
+
+	//! The aggregate's result is not affected by a DISTINCT modifier.
+	DUCKDB_V2_FUNCTION_PROPERTY_AGG_DISTINCT_DEPENDENT_NO = 196865,
+	DUCKDB_V2_FUNCTION_PROPERTY_VALUE_MAX_ENUM = 0x7FFFFFFF,
+} DUCKDB_V2_FUNCTION_PROPERTY_VALUE;
+
+/* --- Struct forward declarations for function properties --- */
+
+/* --- Types for function properties --- */
+
+/* --- Constants for function properties --- */
+
+/* --- Function pointer typedefs for function properties --- */
+
+/* --- Functions for function properties --- */
+
+/* --- Struct definitions for function properties --- */
+
+/* ============================================================================
+ * MODULE: arena
+ * ============================================================================ */
+
+/* --- Enums for arena --- */
+
+/* --- Struct forward declarations for arena --- */
+
+/* --- Types for arena --- */
+
+/* --- Constants for arena --- */
+
+/* --- Function pointer typedefs for arena --- */
+
+/* --- Functions for arena --- */
+
+#if DUCKDB_V2_API_ALLOW_UNSTABLE
+/*!
+ * Allocate `byte_len` bytes from the arena.
+ *
+ * Returns a writable pointer to `byte_len` uninitialized bytes, valid for as long as the arena is. There is no minimum
+ * or maximum allocation size, and the arena may return a pointer to a block of memory that is larger than `byte_len`.
+ * The arena will free all allocated memory when it is destroyed, so the caller should not attempt to free the returned
+ * pointer themselves.
+ *
+ * history:
+ * - unstable: v2.0.0
+ *
+ * @param arena The arena to allocate from.
+ * @param byte_len Number of bytes to reserve. May be 0.
+ * @param out_ptr Receives a writable pointer to byte_len arena-owned bytes.
+ * @param err Optional. On failure, receives an opaque info handle the caller must destroy via error_info_destroy.
+ * @return DUCKDB_V2_ERROR
+ */
+DUCKDB_C_API DUCKDB_V2_ERROR duckdb_v2_arena_allocate(duckdb_v2_arena_handle arena, idx_t byte_len, uint8_t **out_ptr,
+                                                      duckdb_v2_error_info_handle *err);
+#endif
+
+/* --- Struct definitions for arena --- */
+
+/* ============================================================================
+ * MODULE: cast
+ * ============================================================================ */
+
+/* --- Enums for cast --- */
+
+/*!
+ * The mode a cast is being executed in. A normal cast must either succeed for every row or report an error, which
+ * aborts the query. A "try" cast (SQL TRY_CAST, and implicit casts the engine probes speculatively) tolerates per-row
+ * failures: the callback writes NULL for the rows it could not convert instead of aborting. Read with
+ * `duckdb_v2_cast_function_exec_get_mode()`, and passed to `duckdb_v2_vector_cast()`.
+ */
+typedef enum DUCKDB_V2_CAST_MODE {
+	//! A regular cast. A conversion failure reported through the error slot aborts the query.
+	DUCKDB_V2_CAST_MODE_NORMAL = 0,
+
+	/*!
+	 * A "try" cast. Conversion failures should be written as NULLs into the output vector; an error reported through
+	 * the slot is swallowed and the affected rows are left NULL.
+	 */
+	DUCKDB_V2_CAST_MODE_TRY = 1,
+	DUCKDB_V2_CAST_MODE_MAX_ENUM = 0x7FFFFFFF,
+} DUCKDB_V2_CAST_MODE;
+
+/* --- Struct forward declarations for cast --- */
+
+/* --- Types for cast --- */
+
+/*!
+ * An owned opaque handle to a cast function being built. Created with `duckdb_v2_cast_function_create()`, configured
+ * with the setter functions (e.g. `duckdb_v2_cast_function_set_source_type()`,
+ * `duckdb_v2_cast_function_set_exec_callback()`, etc.), made available with
+ * `duckdb_v2_connection_register_cast_function()` or `duckdb_v2_extension_register_cast_function()`, and destroyed with
+ * `duckdb_v2_cast_function_destroy()`.
+ */
+typedef struct _duckdb_v2_cast_function {
+	void *internal_ptr;
+} * duckdb_v2_cast_function_handle;
+
+/*!
+ * A borrowed opaque handle to the arguments supplied to a cast function during the execution "exec" phase. The "exec"
+ * callback receives this handle and can use it to access the input vector, the output vector to write into, the number
+ * of rows to convert, and the mode the cast is running in.
+ */
+typedef struct _duckdb_v2_cast_function_exec_info {
+	void *internal_ptr;
+} * duckdb_v2_cast_function_exec_info_handle;
+
+/* --- Constants for cast --- */
+
+/* --- Function pointer typedefs for cast --- */
+
+typedef void (*duckdb_v2_cast_function_exec_callback_fn)(duckdb_v2_cast_function_exec_info_handle info,
+                                                         duckdb_v2_context_handle context,
+                                                         duckdb_v2_error_info_handle *err);
+
+/* --- Functions for cast --- */
+
+#if DUCKDB_V2_API_ALLOW_UNSTABLE
+/*!
+ * Creates a new cast function through a factory.
+ *
+ * The function starts out empty: configure it with the setter functions (e.g.
+ * `duckdb_v2_cast_function_set_source_type()`, `duckdb_v2_cast_function_set_exec_callback()`, etc.), then make it
+ * available with `duckdb_v2_connection_register_cast_function()` or `duckdb_v2_extension_register_cast_function()`. The
+ * caller owns the returned handle and must destroy it with `duckdb_v2_cast_function_destroy()`, also after
+ * registration.
+ *
+ * The cast function can only be registered on the database the factory belongs to.
+ *
+ * history:
+ * - unstable: v2.0.0
+ *
+ * @param factory The factory to create the cast function through.
+ * @param function On success, receives the newly created cast function. Owned by the caller.
+ * @param err Optional. On failure, receives an opaque info handle the caller must destroy via
+ * `duckdb_v2_error_info_destroy()`.
+ * @return DUCKDB_V2_ERROR
+ */
+DUCKDB_C_API DUCKDB_V2_ERROR duckdb_v2_cast_function_create(duckdb_v2_factory_handle factory,
+                                                            duckdb_v2_cast_function_handle *function,
+                                                            duckdb_v2_error_info_handle *err);
+#endif
+
+#if DUCKDB_V2_API_ALLOW_UNSTABLE
+/*!
+ * Sets the type the cast converts from.
+ *
+ * The type is borrowed and copied. Calling this again replaces the previous source type. A source type must be set
+ * before registration, and it must be a fully defined concrete type.
+ *
+ * history:
+ * - unstable: v2.0.0
+ *
+ * @param function The function to set the source type of.
+ * @param source_type The type to cast from. Borrowed for the call only.
+ * @param err Optional. On failure, receives an opaque info handle the caller must destroy via
+ * `duckdb_v2_error_info_destroy()`.
+ * @return DUCKDB_V2_ERROR
+ */
+DUCKDB_C_API DUCKDB_V2_ERROR duckdb_v2_cast_function_set_source_type(duckdb_v2_cast_function_handle function,
+                                                                     duckdb_v2_logical_type_handle source_type,
+                                                                     duckdb_v2_error_info_handle *err);
+#endif
+
+#if DUCKDB_V2_API_ALLOW_UNSTABLE
+/*!
+ * Sets the type the cast converts to.
+ *
+ * The type is borrowed and copied. Calling this again replaces the previous target type. A target type must be set
+ * before registration, and it must be a fully defined concrete type.
+ *
+ * history:
+ * - unstable: v2.0.0
+ *
+ * @param function The function to set the target type of.
+ * @param target_type The type to cast to. Borrowed for the call only.
+ * @param err Optional. On failure, receives an opaque info handle the caller must destroy via
+ * `duckdb_v2_error_info_destroy()`.
+ * @return DUCKDB_V2_ERROR
+ */
+DUCKDB_C_API DUCKDB_V2_ERROR duckdb_v2_cast_function_set_target_type(duckdb_v2_cast_function_handle function,
+                                                                     duckdb_v2_logical_type_handle target_type,
+                                                                     duckdb_v2_error_info_handle *err);
+#endif
+
+#if DUCKDB_V2_API_ALLOW_UNSTABLE
+/*!
+ * Sets what it costs to apply this cast implicitly.
+ *
+ * The binder uses the cost to choose between candidate implicit casts: a lower non-negative cost makes the cast more
+ * likely to be picked, a higher one less likely. Built-in widening casts sit in the [0, 20] range, so a cost above 100
+ * effectively puts this cast last. A negative cost -- the default -- means the cast is never applied implicitly and is
+ * reached only through an explicit CAST or TRY_CAST.
+ *
+ * history:
+ * - unstable: v2.0.0
+ *
+ * @param function The function to set the implicit cast cost of.
+ * @param cost The cost. Negative disables implicit casting.
+ * @param err Optional. On failure, receives an opaque info handle the caller must destroy via
+ * `duckdb_v2_error_info_destroy()`.
+ * @return DUCKDB_V2_ERROR
+ */
+DUCKDB_C_API DUCKDB_V2_ERROR duckdb_v2_cast_function_set_implicit_cast_cost(duckdb_v2_cast_function_handle function,
+                                                                            int64_t cost,
+                                                                            duckdb_v2_error_info_handle *err);
+#endif
+
+#if DUCKDB_V2_API_ALLOW_UNSTABLE
+/*!
+ * Sets arbitrary user data on the cast function.
+ *
+ * Associates an opaque pointer with the function, retrievable from the exec callback via
+ * `duckdb_v2_cast_function_exec_get_user_data()`. The opaque handle bundles the pointer with an optional destructor,
+ * invoked when the data is no longer needed. The data is read-only during execution: the same pointer is shared by
+ * every thread running the cast.
+ *
+ * history:
+ * - unstable: v2.0.0
+ *
+ * @param function The function to set the user data of.
+ * @param data Opaque handle bundling the user data pointer plus an optional destructor.
+ * @param err Optional. On failure, receives an opaque info handle the caller must destroy via
+ * `duckdb_v2_error_info_destroy()`.
+ * @return DUCKDB_V2_ERROR
+ */
+DUCKDB_C_API DUCKDB_V2_ERROR duckdb_v2_cast_function_set_user_data(duckdb_v2_cast_function_handle function,
+                                                                   duckdb_v2_opaque *data,
+                                                                   duckdb_v2_error_info_handle *err);
+#endif
+
+#if DUCKDB_V2_API_ALLOW_UNSTABLE
+/*!
+ * Sets the exec callback of the cast function.
+ *
+ * The exec callback implements the conversion: it is invoked during query execution with a batch of input values and
+ * must fill the output vector. An exec callback must be set before registration.
+ *
+ * history:
+ * - unstable: v2.0.0
+ *
+ * @param function The function to set the exec callback of.
+ * @param callback The exec callback to set.
+ * @param err Optional. On failure, receives an opaque info handle the caller must destroy via
+ * `duckdb_v2_error_info_destroy()`.
+ * @return DUCKDB_V2_ERROR
+ */
+DUCKDB_C_API DUCKDB_V2_ERROR duckdb_v2_cast_function_set_exec_callback(
+    duckdb_v2_cast_function_handle function, duckdb_v2_cast_function_exec_callback_fn callback,
+    duckdb_v2_error_info_handle *err);
+#endif
+
+#if DUCKDB_V2_API_ALLOW_UNSTABLE
+/*!
+ * Retrieves the user data set via `duckdb_v2_cast_function_set_user_data()`.
+ *
+ * history:
+ * - unstable: v2.0.0
+ *
+ * @param info The exec info handle.
+ * @param data Receives the user data pointer, or null if none was set.
+ * @param err Optional. On failure, receives an opaque info handle the caller must destroy via
+ * `duckdb_v2_error_info_destroy()`.
+ * @return DUCKDB_V2_ERROR
+ */
+DUCKDB_C_API DUCKDB_V2_ERROR duckdb_v2_cast_function_exec_get_user_data(duckdb_v2_cast_function_exec_info_handle info,
+                                                                        void **data, duckdb_v2_error_info_handle *err);
+#endif
+
+#if DUCKDB_V2_API_ALLOW_UNSTABLE
+/*!
+ * Returns how many rows this execution must convert.
+ *
+ * The number of rows held by the input vector, and the number of entries the callback must write to the output vector.
+ * Note that this may be less than a full vector: a constant input is converted as a single row and the result is
+ * expanded by the engine.
+ *
+ * history:
+ * - unstable: v2.0.0
+ *
+ * @param info The exec info handle.
+ * @param count Receives the number of rows.
+ * @param err Optional. On failure, receives an opaque info handle the caller must destroy via
+ * `duckdb_v2_error_info_destroy()`.
+ * @return DUCKDB_V2_ERROR
+ */
+DUCKDB_C_API DUCKDB_V2_ERROR duckdb_v2_cast_function_exec_get_row_count(duckdb_v2_cast_function_exec_info_handle info,
+                                                                        idx_t *count, duckdb_v2_error_info_handle *err);
+#endif
+
+#if DUCKDB_V2_API_ALLOW_UNSTABLE
+/*!
+ * Retrieves the input vector holding the values to convert.
+ *
+ * The vector holds the source type's values for the current batch; use `duckdb_v2_cast_function_exec_get_row_count()`
+ * for the number of rows. Borrowed; valid only for the duration of the callback.
+ *
+ * history:
+ * - unstable: v2.0.0
+ *
+ * @param info The exec info handle.
+ * @param vector Receives the borrowed input vector.
+ * @param err Optional. On failure, receives an opaque info handle the caller must destroy via
+ * `duckdb_v2_error_info_destroy()`.
+ * @return DUCKDB_V2_ERROR
+ */
+DUCKDB_C_API DUCKDB_V2_ERROR duckdb_v2_cast_function_exec_get_input(duckdb_v2_cast_function_exec_info_handle info,
+                                                                    duckdb_v2_vector_handle *vector,
+                                                                    duckdb_v2_error_info_handle *err);
+#endif
+
+#if DUCKDB_V2_API_ALLOW_UNSTABLE
+/*!
+ * Retrieves the output vector the exec callback must write into.
+ *
+ * The callback must write one entry per input row; use `duckdb_v2_cast_function_exec_get_row_count()` for the number of
+ * rows. Borrowed; valid only for the duration of the callback.
+ *
+ * history:
+ * - unstable: v2.0.0
+ *
+ * @param info The exec info handle.
+ * @param vector Receives the borrowed output vector to write into.
+ * @param err Optional. On failure, receives an opaque info handle the caller must destroy via
+ * `duckdb_v2_error_info_destroy()`.
+ * @return DUCKDB_V2_ERROR
+ */
+DUCKDB_C_API DUCKDB_V2_ERROR duckdb_v2_cast_function_exec_get_output(duckdb_v2_cast_function_exec_info_handle info,
+                                                                     duckdb_v2_vector_handle *vector,
+                                                                     duckdb_v2_error_info_handle *err);
+#endif
+
+#if DUCKDB_V2_API_ALLOW_UNSTABLE
+/*!
+ * Returns the mode the cast is being executed in.
+ *
+ * In `CAST_MODE_TRY` a conversion failure should be written as a NULL into the output vector rather than reported
+ * through the error slot, since the engine discards the error and keeps whatever the callback left in the output.
+ *
+ * history:
+ * - unstable: v2.0.0
+ *
+ * @param info The exec info handle.
+ * @param mode Receives the cast mode.
+ * @param err Optional. On failure, receives an opaque info handle the caller must destroy via
+ * `duckdb_v2_error_info_destroy()`.
+ * @return DUCKDB_V2_ERROR
+ */
+DUCKDB_C_API DUCKDB_V2_ERROR duckdb_v2_cast_function_exec_get_mode(duckdb_v2_cast_function_exec_info_handle info,
+                                                                   DUCKDB_V2_CAST_MODE *mode,
+                                                                   duckdb_v2_error_info_handle *err);
+#endif
+
+#if DUCKDB_V2_API_ALLOW_UNSTABLE
+/*!
+ * Registers the cast function, making it available to CAST and TRY_CAST.
+ *
+ * The cast is registered on the connection's database and takes effect immediately for every connection; it is not part
+ * of the connection's transaction, so a rollback does not undo it. Registration requires a source type, a target type
+ * and an exec callback; both types must be fully defined concrete types. Registering a cast for a pair that already has
+ * one replaces it. The cast function must have been created through a factory of the same database. The caller still
+ * owns the handle after registration and must destroy it with `duckdb_v2_cast_function_destroy()`, which does not
+ * affect the registered function.
+ *
+ * history:
+ * - unstable: v2.0.0
+ *
+ * @param conn The connection to register on.
+ * @param function The cast function to register.
+ * @param err Optional. On failure, receives an opaque info handle the caller must destroy via
+ * `duckdb_v2_error_info_destroy()`.
+ * @return DUCKDB_V2_ERROR
+ */
+DUCKDB_C_API DUCKDB_V2_ERROR duckdb_v2_connection_register_cast_function(duckdb_v2_connection_handle conn,
+                                                                         duckdb_v2_cast_function_handle function,
+                                                                         duckdb_v2_error_info_handle *err);
+#endif
+
+#if DUCKDB_V2_API_ALLOW_UNSTABLE
+/*!
+ * Registers the cast function, making it available to CAST and TRY_CAST.
+ *
+ * The cast is registered on the loading extension's database. Use this from the extension's load callback. Registration
+ * requires a source type, a target type and an exec callback; both types must be fully defined concrete types.
+ * Registering a cast for a pair that already has one replaces it. The cast function must have been created through a
+ * factory of the same database. The caller still owns the handle after registration and must destroy it with
+ * `duckdb_v2_cast_function_destroy()`, which does not affect the registered function.
+ *
+ * history:
+ * - unstable: v2.0.0
+ *
+ * @param extension The loading extension.
+ * @param function The cast function to register.
+ * @param err Optional. On failure, receives an opaque info handle the caller must destroy via
+ * `duckdb_v2_error_info_destroy()`.
+ * @return DUCKDB_V2_ERROR
+ */
+DUCKDB_C_API DUCKDB_V2_ERROR duckdb_v2_extension_register_cast_function(duckdb_v2_extension_handle extension,
+                                                                        duckdb_v2_cast_function_handle function,
+                                                                        duckdb_v2_error_info_handle *err);
+#endif
+
+#if DUCKDB_V2_API_ALLOW_UNSTABLE
+/*!
+ * Destroys the cast function, releasing its resources.
+ *
+ * Null-safe: passing a null pointer or null handle is a no-op. The handle is set to null on return to prevent
+ * double-destruction. Destroying the handle after registration does not affect the registered function.
+ *
+ * history:
+ * - unstable: v2.0.0
+ *
+ * @param function The function to destroy.
+ * @return DUCKDB_V2_ERROR
+ */
+DUCKDB_C_API DUCKDB_V2_ERROR duckdb_v2_cast_function_destroy(duckdb_v2_cast_function_handle *function);
+#endif
+
+/* --- Struct definitions for cast --- */
+
+/* ============================================================================
+ * MODULE: column_data_collection
+ * ============================================================================ */
+
+/* --- Enums for column_data_collection --- */
+
+/* --- Struct forward declarations for column_data_collection --- */
+
+/* --- Types for column_data_collection --- */
+
+/*!
+ * A column data collection represents a set of (buffer-managed) data chunks.
+ *
+ * You can append chunks to the collection iteratively, and then scan the collection back to retrieve the chunks in
+ * order. DuckDB will manage the memory for the chunks, and transparently offload chunks to disk if necessary. A
+ * collection shall not be scanned while it is being appended to, and vice versa. A collection shall not be appended to
+ * concurrently, but it can be scanned concurrently by multiple threads using a shared scan state and per-thread worker
+ * scan states. For concurrent appends, consider creating multiple collections and "combining" them into one collection
+ * at the end.
+ */
+typedef struct _duckdb_v2_column_data_collection {
+	void *internal_ptr;
+} * duckdb_v2_column_data_collection_handle;
+
+/*!
+ * Opaque state handle for shared state across multiple threads scanning a column data collection. This is used to
+ * coordinate work distribution, track global progress, or store any other state that needs to be shared across threads
+ * during the scan of the collection.
+ */
+typedef struct _duckdb_v2_column_data_collection_shared_scan_state {
+	void *internal_ptr;
+} * duckdb_v2_column_data_collection_shared_scan_state_handle;
+
+/*!
+ * Opaque state handle for local state while scanning a column data collection. This is used to track progress and any
+ * other state that needs to be maintained on a per-thread basis across calls while scanning the collection. It also
+ * keeps the buffers backing the most recently scanned chunk alive: chunks are scanned zero-copy, so a scanned chunk's
+ * data is only valid until the worker state's next scan call or its destruction.
+ */
+typedef struct _duckdb_v2_column_data_collection_worker_scan_state {
+	void *internal_ptr;
+} * duckdb_v2_column_data_collection_worker_scan_state_handle;
+
+/*!
+ * Opaque state handle for appending to a column data collection. This is used to track progress and any other state
+ * that needs to be maintained across calls while appending to the collection.
+ */
+typedef struct _duckdb_v2_column_data_collection_append_state {
+	void *internal_ptr;
+} * duckdb_v2_column_data_collection_append_state_handle;
+
+/* --- Constants for column_data_collection --- */
+
+/* --- Function pointer typedefs for column_data_collection --- */
+
+/* --- Functions for column_data_collection --- */
+
+#if DUCKDB_V2_API_ALLOW_UNSTABLE
+/*!
+ * Creates an empty column data collection from a factory.
+ *
+ * Allocates a new, empty column data collection, drawing its buffers from the factory's database. The collection starts
+ * with no chunks and is ready to have chunks appended to it. A collection must have at least one column; an empty types
+ * array is rejected with INVALID_INPUT.
+ *
+ * history:
+ * - unstable: v2.0.0
+ *
+ * @param factory The factory to create with.
+ * @param types_array Pointer to an array of logical_type handles, one per column. This defines the schema for the
+ * chunks that will be stored in the collection. All chunks appended to this collection must have vectors that conform
+ * to these types.
+ * @param types_count Number of elements in the types_array.
+ * @param out_collection Receives the new collection handle.
+ * @param err Optional. On failure, receives an opaque info handle the caller must destroy via error_info_destroy.
+ * @return DUCKDB_V2_ERROR
+ */
+DUCKDB_C_API DUCKDB_V2_ERROR duckdb_v2_column_data_collection_create(
+    duckdb_v2_factory_handle factory, const duckdb_v2_logical_type_handle *types_array, idx_t types_count,
+    duckdb_v2_column_data_collection_handle *out_collection, duckdb_v2_error_info_handle *err);
+#endif
+
+#if DUCKDB_V2_API_ALLOW_UNSTABLE
+/*!
+ * Drops all buffered rows, keeping the column types.
+ *
+ * Drops all buffered rows and releases their memory. The column types are unchanged and the collection is immediately
+ * appendable again. Existing append and scan states are invalidated. Use `duckdb_v2_column_data_collection_clear()`
+ * instead to keep the memory for the next appends.
+ *
+ * history:
+ * - unstable: v2.0.0
+ *
+ * @param collection The collection to reset.
+ * @param err Optional. On failure, receives an opaque info handle the caller must destroy via error_info_destroy.
+ * @return DUCKDB_V2_ERROR
+ */
+DUCKDB_C_API DUCKDB_V2_ERROR duckdb_v2_column_data_collection_reset(duckdb_v2_column_data_collection_handle collection,
+                                                                    duckdb_v2_error_info_handle *err);
+#endif
+
+#if DUCKDB_V2_API_ALLOW_UNSTABLE
+/*!
+ * Drops all buffered rows, keeping the column types and the memory.
+ *
+ * Like `duckdb_v2_column_data_collection_reset()`, but the buffers are retained rather than released, so the next
+ * appends write into memory that is already allocated. Use this when the collection is refilled repeatedly. The column
+ * types are unchanged and the collection is immediately appendable again. Existing append and scan states are
+ * invalidated.
+ *
+ * history:
+ * - unstable: v2.0.0
+ *
+ * @param collection The collection to clear.
+ * @param err Optional. On failure, receives an opaque info handle the caller must destroy via error_info_destroy.
+ * @return DUCKDB_V2_ERROR
+ */
+DUCKDB_C_API DUCKDB_V2_ERROR duckdb_v2_column_data_collection_clear(duckdb_v2_column_data_collection_handle collection,
+                                                                    duckdb_v2_error_info_handle *err);
+#endif
+
+#if DUCKDB_V2_API_ALLOW_UNSTABLE
+/*!
+ * Destroys a column data collection and all its chunks.
+ *
+ * Cleans up the collection and all resources associated with it, including all contained chunks. Sets the collection
+ * handle to NULL.
+ *
+ * history:
+ * - unstable: v2.0.0
+ *
+ * @param collection The collection to destroy.
+ * @return DUCKDB_V2_ERROR
+ */
+DUCKDB_C_API DUCKDB_V2_ERROR
+duckdb_v2_column_data_collection_destroy(duckdb_v2_column_data_collection_handle *collection);
+#endif
+
+#if DUCKDB_V2_API_ALLOW_UNSTABLE
+/*!
+ * Merges the source collection into the target collection, consuming the source in the process.
+ *
+ * Transfers all chunks from the source collection to the target collection. This destroys the source collection,
+ * setting the source handle to NULL. The two collections must have the same column types, and must have been created
+ * from factories of the same database: the transferred chunks keep their original buffers, so combining collections
+ * from different databases would tie the target to a buffer manager it does not own.
+ *
+ * history:
+ * - unstable: v2.0.0
+ *
+ * @param target The collection to merge into. After the call, this collection will contain all chunks from both
+ * collections.
+ * @param source The collection to merge from. This collection will be destroyed by this operation and its handle set to
+ * NULL.
+ * @param err Optional. On failure, receives an opaque info handle the caller must destroy via error_info_destroy.
+ * @return DUCKDB_V2_ERROR
+ */
+DUCKDB_C_API DUCKDB_V2_ERROR duckdb_v2_column_data_collection_combine(duckdb_v2_column_data_collection_handle target,
+                                                                      duckdb_v2_column_data_collection_handle *source,
+                                                                      duckdb_v2_error_info_handle *err);
+#endif
+
+#if DUCKDB_V2_API_ALLOW_UNSTABLE
+/*!
+ * Returns the total number of rows across all chunks in the collection.
+ *
+ * Sums the row counts of all chunks in the collection. This is the total number of rows represented by the collection,
+ * which may be more than the number of rows in any individual chunk.
+ *
+ * history:
+ * - unstable: v2.0.0
+ *
+ * @param collection The collection to inspect.
+ * @param out_row_count Receives the total row count.
+ * @param err Optional. On failure, receives an opaque info handle the caller must destroy via error_info_destroy.
+ * @return DUCKDB_V2_ERROR
+ */
+DUCKDB_C_API DUCKDB_V2_ERROR duckdb_v2_column_data_collection_row_count(
+    duckdb_v2_column_data_collection_handle collection, idx_t *out_row_count, duckdb_v2_error_info_handle *err);
+#endif
+
+#if DUCKDB_V2_API_ALLOW_UNSTABLE
+/*!
+ * Initializes an append state for the collection.
+ *
+ * Returns an append state handle that can be used to append chunks to the collection while maintaining any necessary
+ * state across calls.
+ *
+ * history:
+ * - unstable: v2.0.0
+ *
+ * @param collection The collection to prepare for appending.
+ * @param out_state Receives the new append state handle.
+ * @param err Optional. On failure, receives an opaque info handle the caller must destroy via error_info_destroy.
+ * @return DUCKDB_V2_ERROR
+ */
+DUCKDB_C_API DUCKDB_V2_ERROR duckdb_v2_column_data_collection_append_state_create(
+    duckdb_v2_column_data_collection_handle collection, duckdb_v2_column_data_collection_append_state_handle *out_state,
+    duckdb_v2_error_info_handle *err);
+#endif
+
+#if DUCKDB_V2_API_ALLOW_UNSTABLE
+/*!
+ * Destroys an append state handle.
+ *
+ * Cleans up any resources associated with the append state. After this call, the state handle must not be used again.
+ *
+ * history:
+ * - unstable: v2.0.0
+ *
+ * @param state The append state to destroy.
+ * @return DUCKDB_V2_ERROR
+ */
+DUCKDB_C_API DUCKDB_V2_ERROR
+duckdb_v2_column_data_collection_append_state_destroy(duckdb_v2_column_data_collection_append_state_handle *state);
+#endif
+
+#if DUCKDB_V2_API_ALLOW_UNSTABLE
+/*!
+ * Appends a data chunk to the collection.
+ *
+ * Appends a copy of the given chunk to the end of the collection. The chunk's column count and types must equal the
+ * collection's exactly; a mismatch is rejected with INVALID_INPUT before anything is copied. VARCHAR values must
+ * already contain valid UTF-8; this function does not validate text. Complex-typed vectors may be flattened in place by
+ * the copy.
+ *
+ * history:
+ * - unstable: v2.0.0
+ *
+ * @param collection The collection to append to.
+ * @param state The append state to use this append operation.
+ * @param chunk The chunk to append.
+ * @param err Optional. On failure, receives an opaque info handle the caller must destroy via error_info_destroy.
+ * @return DUCKDB_V2_ERROR
+ */
+DUCKDB_C_API DUCKDB_V2_ERROR duckdb_v2_column_data_collection_append(
+    duckdb_v2_column_data_collection_handle collection, duckdb_v2_column_data_collection_append_state_handle state,
+    duckdb_v2_data_chunk_handle chunk, duckdb_v2_error_info_handle *err);
+#endif
+
+#if DUCKDB_V2_API_ALLOW_UNSTABLE
+/*!
+ * Initializes a shared scan state for the collection.
+ *
+ * Returns a shared scan state handle that can be used by multiple threads to coordinate scanning of the collection.
+ * Caller owns the returned state and must destroy it via column_data_collection_shared_scan_state_destroy when done.
+ *
+ * history:
+ * - unstable: v2.0.0
+ *
+ * @param collection The collection to prepare for shared scanning.
+ * @param out_state Receives the new shared scan state handle.
+ * @param err Optional. On failure, receives an opaque info handle the caller must destroy via error_info_destroy.
+ * @return DUCKDB_V2_ERROR
+ */
+DUCKDB_C_API DUCKDB_V2_ERROR duckdb_v2_column_data_collection_shared_scan_state_create(
+    duckdb_v2_column_data_collection_handle collection,
+    duckdb_v2_column_data_collection_shared_scan_state_handle *out_state, duckdb_v2_error_info_handle *err);
+#endif
+
+#if DUCKDB_V2_API_ALLOW_UNSTABLE
+/*!
+ * Destroys a shared scan state handle.
+ *
+ * Cleans up any resources associated with the shared scan state. After this call, the state handle must not be used
+ * again.
+ *
+ * history:
+ * - unstable: v2.0.0
+ *
+ * @param state The shared scan state to destroy.
+ * @return DUCKDB_V2_ERROR
+ */
+DUCKDB_C_API DUCKDB_V2_ERROR duckdb_v2_column_data_collection_shared_scan_state_destroy(
+    duckdb_v2_column_data_collection_shared_scan_state_handle *state);
+#endif
+
+#if DUCKDB_V2_API_ALLOW_UNSTABLE
+/*!
+ * Initializes a worker scan state for the collection.
+ *
+ * Returns a "local" scan state handle for a worker thread to use while scanning the collection. This allows each thread
+ * to maintain its own progress and any other necessary information across multiple scan calls, while still coordinating
+ * with other threads via the shared scan state.
+ *
+ * history:
+ * - unstable: v2.0.0
+ *
+ * @param collection The collection to prepare for worker scanning.
+ * @param out_state Receives the new worker scan state handle.
+ * @param err Optional. On failure, receives an opaque info handle the caller must destroy via error_info_destroy.
+ * @return DUCKDB_V2_ERROR
+ */
+DUCKDB_C_API DUCKDB_V2_ERROR duckdb_v2_column_data_collection_worker_scan_state_create(
+    duckdb_v2_column_data_collection_handle collection,
+    duckdb_v2_column_data_collection_worker_scan_state_handle *out_state, duckdb_v2_error_info_handle *err);
+#endif
+
+#if DUCKDB_V2_API_ALLOW_UNSTABLE
+/*!
+ * Destroys a worker scan state handle.
+ *
+ * Cleans up any resources associated with the worker scan state. After this call, the state handle must not be used
+ * again.
+ *
+ * history:
+ * - unstable: v2.0.0
+ *
+ * @param state The worker scan state to destroy.
+ * @return DUCKDB_V2_ERROR
+ */
+DUCKDB_C_API DUCKDB_V2_ERROR duckdb_v2_column_data_collection_worker_scan_state_destroy(
+    duckdb_v2_column_data_collection_worker_scan_state_handle *state);
+#endif
+
+#if DUCKDB_V2_API_ALLOW_UNSTABLE
+/*!
+ * Scans the collection to retrieve the next data chunk, using shared state for coordination across threads and
+ * worker-local state for individual progress tracking.
+ *
+ * Retrieves the next chunk of data from the collection based on the provided shared scan state and worker-local scan
+ * state. The output chunk's column count and types must equal the collection's exactly; a mismatch is rejected with
+ * INVALID_INPUT.
+ *
+ * The scan is zero-copy where possible: the output chunk's vectors may reference the collection's buffers, kept alive
+ * by the worker scan state. The chunk's data is therefore only valid until the next scan call with the same worker
+ * state, or until the worker state or the collection is destroyed, whichever comes first. Copy the data out (or append
+ * it to another collection) before continuing the scan if it must outlive that window.
+ *
+ * history:
+ * - unstable: v2.0.0
+ *
+ * @param collection The collection to scan.
+ * @param shared_state The shared scan state to use for coordinating across threads.
+ * @param worker_state The worker-local scan state to use for this thread's scan operation.
+ * @param out_chunk The output chunk to write to.
+ * @param did_produce_chunk Receives true when a chunk was produced by this call, or false when the scan has completed
+ * (the chunk is then reset to empty).
+ * @param err Optional. On failure, receives an opaque info handle the caller must destroy via error_info_destroy.
+ * @return DUCKDB_V2_ERROR
+ */
+DUCKDB_C_API DUCKDB_V2_ERROR duckdb_v2_column_data_collection_scan(
+    duckdb_v2_column_data_collection_handle collection,
+    duckdb_v2_column_data_collection_shared_scan_state_handle shared_state,
+    duckdb_v2_column_data_collection_worker_scan_state_handle worker_state, duckdb_v2_data_chunk_handle out_chunk,
+    bool *did_produce_chunk, duckdb_v2_error_info_handle *err);
+#endif
+
+/* --- Struct definitions for column_data_collection --- */
+
+/* ============================================================================
+ * MODULE: configuration
+ * ============================================================================ */
+
+/* --- Enums for configuration --- */
+
+/*!
+ * The scope of an option's value. Writes take DEFAULT, GLOBAL or SESSION: DEFAULT writes to the option's default scope
+ * (`duckdb_v2_option_get_default_scope()`), like SQL `SET name = value`; GLOBAL writes through to the instance, visible
+ * to all connections, like `SET GLOBAL`; SESSION writes to one connection's session only, like `SET SESSION`. Reads
+ * report GLOBAL or SESSION, as DuckDB attributes the value: an option no scope sets reads as GLOBAL, its default, and a
+ * legacy option read through a connection or context reads as SESSION.
+ */
+typedef enum DUCKDB_V2_SETTING_SCOPE {
+	//! Write only: the option's default scope (`duckdb_v2_option_get_default_scope()`), not its default value.
+	DUCKDB_V2_SETTING_SCOPE_DEFAULT = 0,
+
+	//! The instance's value, visible to all connections.
+	DUCKDB_V2_SETTING_SCOPE_GLOBAL = 1,
+
+	//! A connection's session value.
+	DUCKDB_V2_SETTING_SCOPE_SESSION = 2,
+	DUCKDB_V2_SETTING_SCOPE_MAX_ENUM = 0x7FFFFFFF,
+} DUCKDB_V2_SETTING_SCOPE;
+
+/* --- Struct forward declarations for configuration --- */
+
+/* --- Types for configuration --- */
+
+/* --- Constants for configuration --- */
+
+/* --- Function pointer typedefs for configuration --- */
+
+/* --- Functions for configuration --- */
+
+#if DUCKDB_V2_API_ALLOW_UNSTABLE
+/*!
+ * Borrows the config of an instance: the GLOBAL scope.
+ *
+ * Reads report GLOBAL, and writes are `SET GLOBAL`. Writing at SESSION scope returns ERROR_INPUT_INVALID: an instance
+ * has no session. Options that can only be chosen at startup are passed to `duckdb_v2_instance_create_with_options()`.
+ * The returned handle is borrowed: it is valid for as long as the instance is, and must not be destroyed.
+ *
+ * history:
+ * - unstable: v2.0.0
+ *
+ * @param instance The instance.
+ * @param out_config Receives the borrowed config.
+ * @param err Optional. On failure, receives an opaque info handle the caller must destroy via
+ * `duckdb_v2_error_info_destroy()`.
+ * @return DUCKDB_V2_ERROR
+ */
+DUCKDB_C_API DUCKDB_V2_ERROR duckdb_v2_instance_get_config(duckdb_v2_instance_handle instance,
+                                                           duckdb_v2_config_handle *out_config,
+                                                           duckdb_v2_error_info_handle *err);
+#endif
+
+#if DUCKDB_V2_API_ALLOW_UNSTABLE
+/*!
+ * Borrows the config of a connection.
+ *
+ * Reads follow the connection's cascade: its SESSION value if it set one, otherwise the GLOBAL value, otherwise the
+ * default. Writes accept any scope the option supports. The returned handle is borrowed: it is valid for as long as the
+ * connection is, and must not be destroyed.
+ *
+ * history:
+ * - unstable: v2.0.0
+ *
+ * @param conn The connection.
+ * @param out_config Receives the borrowed config.
+ * @param err Optional. On failure, receives an opaque info handle the caller must destroy via
+ * `duckdb_v2_error_info_destroy()`.
+ * @return DUCKDB_V2_ERROR
+ */
+DUCKDB_C_API DUCKDB_V2_ERROR duckdb_v2_connection_get_config(duckdb_v2_connection_handle conn,
+                                                             duckdb_v2_config_handle *out_config,
+                                                             duckdb_v2_error_info_handle *err);
+#endif
+
+#if DUCKDB_V2_API_ALLOW_UNSTABLE
+/*!
+ * Borrows the config of a context.
+ *
+ * The same scope `duckdb_v2_connection_get_config()` gives for the context's connection. The returned handle is
+ * borrowed: it is valid for as long as the context is, and must not be destroyed.
+ *
+ * history:
+ * - unstable: v2.0.0
+ *
+ * @param ctx The context.
+ * @param out_config Receives the borrowed config.
+ * @param err Optional. On failure, receives an opaque info handle the caller must destroy via
+ * `duckdb_v2_error_info_destroy()`.
+ * @return DUCKDB_V2_ERROR
+ */
+DUCKDB_C_API DUCKDB_V2_ERROR duckdb_v2_context_get_config(duckdb_v2_context_handle ctx,
+                                                          duckdb_v2_config_handle *out_config,
+                                                          duckdb_v2_error_info_handle *err);
+#endif
+
+#if DUCKDB_V2_API_ALLOW_UNSTABLE
+/*!
+ * Reads the effective value of an option in this config, and the scope it came from.
+ *
+ * Aliases resolve transparently, and an unknown name returns ERROR_INPUT_INVALID. The caller destroys the returned
+ * value.
+ *
+ * history:
+ * - unstable: v2.0.0
+ *
+ * @param config The config to read from.
+ * @param name Option name (canonical or alias).
+ * @param out_value Receives the value, typed as the option. Owned by the caller.
+ * @param out_scope Receives the scope the value came from.
+ * @param err Optional. On failure, receives an opaque info handle the caller must destroy via
+ * `duckdb_v2_error_info_destroy()`.
+ * @return DUCKDB_V2_ERROR
+ */
+DUCKDB_C_API DUCKDB_V2_ERROR duckdb_v2_config_get_option_value(duckdb_v2_config_handle config,
+                                                               const duckdb_v2_identifier_t *name,
+                                                               duckdb_v2_value_handle *out_value,
+                                                               DUCKDB_V2_SETTING_SCOPE *out_scope,
+                                                               duckdb_v2_error_info_handle *err);
+#endif
+
+#if DUCKDB_V2_API_ALLOW_UNSTABLE
+/*!
+ * Writes an option in this config.
+ *
+ * `scope` chooses the destination, mirroring SQL:
+ *   - DEFAULT writes to the option's default scope, like a bare `SET name = value`.
+ *   - GLOBAL writes through to the instance, visible to all connections, like `SET GLOBAL`.
+ *   - SESSION writes to one connection's session only, like `SET SESSION`.
+ * A scope neither the option (`duckdb_v2_option_supports_scope()`) nor the config supports returns ERROR_INPUT_INVALID;
+ * an instance's config supports only GLOBAL. The value is cast to the option's type as SQL `SET` does. An unknown name
+ * is rejected unless an extension that defines it can be autoloaded. An option that can only be chosen at startup is
+ * rejected: pass it to `duckdb_v2_instance_create_with_options()`.
+ *
+ * history:
+ * - unstable: v2.0.0
+ *
+ * @param config The config to write to.
+ * @param name Option name (canonical or alias).
+ * @param value The value, cast to the option's type as SQL `SET` does. Borrowed.
+ * @param scope Target scope: DEFAULT, GLOBAL, or SESSION.
+ * @param err Optional. On failure, receives an opaque info handle the caller must destroy via
+ * `duckdb_v2_error_info_destroy()`.
+ * @return DUCKDB_V2_ERROR
+ */
+DUCKDB_C_API DUCKDB_V2_ERROR duckdb_v2_config_set_option_value(duckdb_v2_config_handle config,
+                                                               const duckdb_v2_identifier_t *name,
+                                                               duckdb_v2_value_handle value,
+                                                               DUCKDB_V2_SETTING_SCOPE scope,
+                                                               duckdb_v2_error_info_handle *err);
+#endif
+
+#if DUCKDB_V2_API_ALLOW_UNSTABLE
+/*!
+ * Writes an option in this config from text, the form SQL `SET` accepts.
+ *
+ * `duckdb_v2_config_set_option_value()` with the text as a VARCHAR value: the engine casts it to the option's type, so
+ * this is the one-call form for a setting spelled the way SQL spells it, e.g. "1GB" for memory_limit. Scope handling
+ * and errors are `duckdb_v2_config_set_option_value()`'s.
+ *
+ * history:
+ * - unstable: v2.0.0
+ *
+ * @param config The config to write to.
+ * @param name Option name (canonical or alias).
+ * @param setting The setting, in the textual form SQL `SET` accepts.
+ * @param scope Target scope: DEFAULT, GLOBAL, or SESSION.
+ * @param err Optional. On failure, receives an opaque info handle the caller must destroy via
+ * `duckdb_v2_error_info_destroy()`.
+ * @return DUCKDB_V2_ERROR
+ */
+DUCKDB_C_API DUCKDB_V2_ERROR duckdb_v2_config_set_option_text(duckdb_v2_config_handle config,
+                                                              const duckdb_v2_identifier_t *name,
+                                                              const duckdb_v2_str *setting,
+                                                              DUCKDB_V2_SETTING_SCOPE scope,
+                                                              duckdb_v2_error_info_handle *err);
+#endif
+
+#if DUCKDB_V2_API_ALLOW_UNSTABLE
+/*!
+ * Describes a config option registered on this config's instance, by name.
+ *
+ * Allocates an option descriptor: canonical name, default value, description, supported and default scopes, and
+ * aliases. Aliases resolve transparently — passing an alias returns the canonical option, with the alias listed in its
+ * alias array. An unknown name returns ERROR_INPUT_INVALID, which includes an option of an extension that has not
+ * loaded yet. The caller destroys the returned option.
+ *
+ * history:
+ * - unstable: v2.0.0
+ *
+ * @param config The config whose instance registered the options.
+ * @param name Option name (canonical or alias).
+ * @param out_option Receives the option descriptor.
+ * @param err Optional. On failure, receives an opaque info handle the caller must destroy via
+ * `duckdb_v2_error_info_destroy()`.
+ * @return DUCKDB_V2_ERROR
+ */
+DUCKDB_C_API DUCKDB_V2_ERROR duckdb_v2_config_get_option_by_name(duckdb_v2_config_handle config,
+                                                                 const duckdb_v2_identifier_t *name,
+                                                                 duckdb_v2_option_handle *out_option,
+                                                                 duckdb_v2_error_info_handle *err);
+#endif
+
+#if DUCKDB_V2_API_ALLOW_UNSTABLE
+/*!
+ * Returns the number of config options registered on this config's instance.
+ *
+ * Counts core options plus the extension options registered on this instance. Aliases are NOT counted separately; each
+ * one is reachable through its canonical option's alias array.
+ *
+ * history:
+ * - unstable: v2.0.0
+ *
+ * @param config The config whose instance registered the options.
+ * @param out_count Receives the option count.
+ * @param err Optional. On failure, receives an opaque info handle the caller must destroy via
+ * `duckdb_v2_error_info_destroy()`.
+ * @return DUCKDB_V2_ERROR
+ */
+DUCKDB_C_API DUCKDB_V2_ERROR duckdb_v2_config_get_option_count(duckdb_v2_config_handle config, idx_t *out_count,
+                                                               duckdb_v2_error_info_handle *err);
+#endif
+
+#if DUCKDB_V2_API_ALLOW_UNSTABLE
+/*!
+ * Describes the config option at the given index on this config's instance.
+ *
+ * Index space: [0, core_count) addresses core options, [core_count, total) extension options. The mapping is stable for
+ * as long as no extension registers new options. An out-of-range index returns ERROR_INPUT_INVALID. The caller destroys
+ * the returned option.
+ *
+ * history:
+ * - unstable: v2.0.0
+ *
+ * @param config The config whose instance registered the options.
+ * @param index The option index, in [0, option_count).
+ * @param out_option Receives the option descriptor.
+ * @param err Optional. On failure, receives an opaque info handle the caller must destroy via
+ * `duckdb_v2_error_info_destroy()`.
+ * @return DUCKDB_V2_ERROR
+ */
+DUCKDB_C_API DUCKDB_V2_ERROR duckdb_v2_config_get_option_by_index(duckdb_v2_config_handle config, idx_t index,
+                                                                  duckdb_v2_option_handle *out_option,
+                                                                  duckdb_v2_error_info_handle *err);
+#endif
+
+#if DUCKDB_V2_API_ALLOW_UNSTABLE
+/*!
+ * Destroys an option descriptor.
+ *
+ * Frees the handle along with the strings it owns. On success the slot is set to null. Safe to call on an already-null
+ * slot.
+ *
+ * history:
+ * - unstable: v2.0.0
+ *
+ * @param option The option handle to destroy.
+ * @return DUCKDB_V2_ERROR
+ */
+DUCKDB_C_API DUCKDB_V2_ERROR duckdb_v2_option_destroy(duckdb_v2_option_handle *option);
+#endif
+
+#if DUCKDB_V2_API_ALLOW_UNSTABLE
+/*!
+ * Borrows the option's canonical name.
+ *
+ * When the option was resolved from an alias, this still reports the canonical name; the alias is reachable via
+ * `duckdb_v2_option_get_alias()`.
+ *
+ * history:
+ * - unstable: v2.0.0
+ *
+ * @param option The option.
+ * @param out_name Receives a borrowed view of the option name. Valid until the option is destroyed.
+ * @param err Optional. On failure, receives an opaque info handle the caller must destroy via
+ * `duckdb_v2_error_info_destroy()`.
+ * @return DUCKDB_V2_ERROR
+ */
+DUCKDB_C_API DUCKDB_V2_ERROR duckdb_v2_option_get_name(duckdb_v2_option_handle option, duckdb_v2_identifier_t *out_name,
+                                                       duckdb_v2_error_info_handle *err);
+#endif
+
+#if DUCKDB_V2_API_ALLOW_UNSTABLE
+/*!
+ * Returns the option's static default, as a value of the option's type.
+ *
+ * A NULL value for an option whose declaration has no default. The caller destroys the returned value.
+ *
+ * history:
+ * - unstable: v2.0.0
+ *
+ * @param option The option.
+ * @param out_value Receives the default value.
+ * @param err Optional. On failure, receives an opaque info handle the caller must destroy via
+ * `duckdb_v2_error_info_destroy()`.
+ * @return DUCKDB_V2_ERROR
+ */
+DUCKDB_C_API DUCKDB_V2_ERROR duckdb_v2_option_get_default_value(duckdb_v2_option_handle option,
+                                                                duckdb_v2_value_handle *out_value,
+                                                                duckdb_v2_error_info_handle *err);
+#endif
+
+#if DUCKDB_V2_API_ALLOW_UNSTABLE
+/*!
+ * Borrows the option's human-readable description.
+ *
+ * history:
+ * - unstable: v2.0.0
+ *
+ * @param option The option.
+ * @param out_description Receives a borrowed view of the description. Valid until the option is destroyed.
+ * @param err Optional. On failure, receives an opaque info handle the caller must destroy via
+ * `duckdb_v2_error_info_destroy()`.
+ * @return DUCKDB_V2_ERROR
+ */
+DUCKDB_C_API DUCKDB_V2_ERROR duckdb_v2_option_get_description(duckdb_v2_option_handle option,
+                                                              duckdb_v2_str *out_description,
+                                                              duckdb_v2_error_info_handle *err);
+#endif
+
+#if DUCKDB_V2_API_ALLOW_UNSTABLE
+/*!
+ * Reports whether the option may be written at a scope.
+ *
+ * GLOBAL and SESSION are the scopes to ask about; DEFAULT is supported by every option that supports either. A write at
+ * an unsupported scope returns ERROR_INPUT_INVALID.
+ *
+ * history:
+ * - unstable: v2.0.0
+ *
+ * @param option The option.
+ * @param scope The scope to ask about.
+ * @param out_supported Receives whether a write at the scope is accepted.
+ * @param err Optional. On failure, receives an opaque info handle the caller must destroy via
+ * `duckdb_v2_error_info_destroy()`.
+ * @return DUCKDB_V2_ERROR
+ */
+DUCKDB_C_API DUCKDB_V2_ERROR duckdb_v2_option_supports_scope(duckdb_v2_option_handle option,
+                                                             DUCKDB_V2_SETTING_SCOPE scope, bool *out_supported,
+                                                             duckdb_v2_error_info_handle *err);
+#endif
+
+#if DUCKDB_V2_API_ALLOW_UNSTABLE
+/*!
+ * Returns the scope a DEFAULT write of the option goes to: GLOBAL or SESSION.
+ *
+ * history:
+ * - unstable: v2.0.0
+ *
+ * @param option The option.
+ * @param out_scope Receives the default scope.
+ * @param err Optional. On failure, receives an opaque info handle the caller must destroy via
+ * `duckdb_v2_error_info_destroy()`.
+ * @return DUCKDB_V2_ERROR
+ */
+DUCKDB_C_API DUCKDB_V2_ERROR duckdb_v2_option_get_default_scope(duckdb_v2_option_handle option,
+                                                                DUCKDB_V2_SETTING_SCOPE *out_scope,
+                                                                duckdb_v2_error_info_handle *err);
+#endif
+
+#if DUCKDB_V2_API_ALLOW_UNSTABLE
+/*!
+ * Returns the number of aliases registered for this option.
+ *
+ * Zero for an extension option; extension options carry no aliases.
+ *
+ * history:
+ * - unstable: v2.0.0
+ *
+ * @param option The option.
+ * @param out_count Receives the alias count.
+ * @param err Optional. On failure, receives an opaque info handle the caller must destroy via
+ * `duckdb_v2_error_info_destroy()`.
+ * @return DUCKDB_V2_ERROR
+ */
+DUCKDB_C_API DUCKDB_V2_ERROR duckdb_v2_option_get_alias_count(duckdb_v2_option_handle option, idx_t *out_count,
+                                                              duckdb_v2_error_info_handle *err);
+#endif
+
+#if DUCKDB_V2_API_ALLOW_UNSTABLE
+/*!
+ * Borrows the alias name at the given index.
+ *
+ * An out-of-range index returns ERROR_INPUT_INVALID.
+ *
+ * history:
+ * - unstable: v2.0.0
+ *
+ * @param option The option.
+ * @param index The alias index, in [0, alias_count).
+ * @param out_alias Receives a borrowed view of the alias. Valid until the option is destroyed.
+ * @param err Optional. On failure, receives an opaque info handle the caller must destroy via
+ * `duckdb_v2_error_info_destroy()`.
+ * @return DUCKDB_V2_ERROR
+ */
+DUCKDB_C_API DUCKDB_V2_ERROR duckdb_v2_option_get_alias(duckdb_v2_option_handle option, idx_t index,
+                                                        duckdb_v2_identifier_t *out_alias,
+                                                        duckdb_v2_error_info_handle *err);
+#endif
+
+/* --- Struct definitions for configuration --- */
+
+/* ============================================================================
+ * MODULE: connection
+ * ============================================================================ */
+
+/* --- Enums for connection --- */
+
+/* --- Struct forward declarations for connection --- */
+
+/* --- Types for connection --- */
+
+/* --- Constants for connection --- */
+
+/* --- Function pointer typedefs for connection --- */
+
+/* --- Functions for connection --- */
+
+#if DUCKDB_V2_API_ALLOW_UNSTABLE
+/*!
+ * Opens a connection to an instance.
+ *
+ * Each connection carries its own client context and session-scoped (LOCAL) settings. Connections to the same instance
+ * share its catalog, buffer pool, and transaction manager. A connection may be created before any database is attached
+ * to the instance; until one is, only the system catalog and the connection's temporary catalog are visible. The caller
+ * destroys it via `duckdb_v2_connection_destroy()`.
+ *
+ * history:
+ * - unstable: v2.0.0
+ *
+ * @param instance The instance to connect to.
+ * @param out_conn Receives the new connection handle.
+ * @param err Optional. On failure, receives an opaque info handle the caller must destroy via
+ * `duckdb_v2_error_info_destroy()`.
+ * @return DUCKDB_V2_ERROR
+ */
+DUCKDB_C_API DUCKDB_V2_ERROR duckdb_v2_connection_create(duckdb_v2_instance_handle instance,
+                                                         duckdb_v2_connection_handle *out_conn,
+                                                         duckdb_v2_error_info_handle *err);
+#endif
+
+#if DUCKDB_V2_API_ALLOW_UNSTABLE
+/*!
+ * Destroys the connection.
+ *
+ * Always succeeds. Releases the connection's reference on the underlying database instance, which survives for as long
+ * as anything else still references it. On success the handle is set to null. Safe to call on an already-null slot.
+ *
+ * history:
+ * - unstable: v2.0.0
+ *
+ * @param conn The connection to destroy.
+ * @return DUCKDB_V2_ERROR
+ */
+DUCKDB_C_API DUCKDB_V2_ERROR duckdb_v2_connection_destroy(duckdb_v2_connection_handle *conn);
+#endif
+
+#if DUCKDB_V2_API_ALLOW_UNSTABLE
+/*!
+ * Interrupts the query currently executing on the connection.
+ *
+ * The cross-thread (but not cross-connection) cancellation entry point for streaming results: safe to call from any
+ * thread within the execution of a query through a connection, including while another thread steps the query's result.
+ * A no-op when no query is active. Cancellation surfaces on the consuming side as step status CANCELLED
+ * (`duckdb_v2_result_step()`), or as ERROR_RUNTIME_INTERRUPT (`duckdb_v2_result_fetch_chunk()`).
+ *
+ * history:
+ * - unstable: v2.0.0
+ *
+ * @param conn The connection whose active query to interrupt.
+ * @param err Optional. On failure, receives an opaque info handle the caller must destroy via
+ * `duckdb_v2_error_info_destroy()`.
+ * @return DUCKDB_V2_ERROR
+ */
+DUCKDB_C_API DUCKDB_V2_ERROR duckdb_v2_connection_interrupt(duckdb_v2_connection_handle conn,
+                                                            duckdb_v2_error_info_handle *err);
+#endif
+
+#if DUCKDB_V2_API_ALLOW_UNSTABLE
+/*!
+ * Captures a snapshot of the active query's execution progress.
+ *
+ * Reads the percentage and row counts from one consistent snapshot of the query currently executing on the connection.
+ * Safe to call from any thread, including while another thread steps the query's result.
+ *
+ * Progress is published only when the enable_progress_bar option is set; the bridge does not enable tracking itself.
+ * Both row counts are 0 when no information is available. The percentage is -1 when tracking is disabled, no query is
+ * active, or no progress has been published yet.
+ *
+ * history:
+ * - unstable: v2.0.0
+ *
+ * @param conn The connection.
+ * @param out_percentage Receives the percentage complete in [0, 100], -1 if tracking is disabled, no query is active,
+ * or no progress has been published yet.
+ * @param out_rows_processed Receives the number of rows processed so far.
+ * @param out_total_rows_to_process Receives the total number of rows the query will process.
+ * @param err Optional. On failure, receives an opaque info handle the caller must destroy via
+ * `duckdb_v2_error_info_destroy()`.
+ * @return DUCKDB_V2_ERROR
+ */
+DUCKDB_C_API DUCKDB_V2_ERROR duckdb_v2_connection_progress_get(duckdb_v2_connection_handle conn, double *out_percentage,
+                                                               uint64_t *out_rows_processed,
+                                                               uint64_t *out_total_rows_to_process,
+                                                               duckdb_v2_error_info_handle *err);
+#endif
+
+/* --- Struct definitions for connection --- */
+
+/* ============================================================================
+ * MODULE: custom type
+ * ============================================================================ */
+
+/* --- Enums for custom type --- */
+
+/* --- Struct forward declarations for custom type --- */
+
+/* --- Types for custom type --- */
+
+/*!
+ * An owned opaque handle to a custom type being built. Created with `duckdb_v2_custom_type_create()`, configured with
+ * `duckdb_v2_custom_type_set_name()` and `duckdb_v2_custom_type_set_base_type()`, made available with
+ * `duckdb_v2_connection_register_custom_type()` or `duckdb_v2_extension_register_custom_type()`, and destroyed with
+ * `duckdb_v2_custom_type_destroy()`.
+ */
+typedef struct _duckdb_v2_custom_type {
+	void *internal_ptr;
+} * duckdb_v2_custom_type_handle;
+
+/* --- Constants for custom type --- */
+
+/* --- Function pointer typedefs for custom type --- */
+
+/* --- Functions for custom type --- */
+
+#if DUCKDB_V2_API_ALLOW_UNSTABLE
+/*!
+ * Creates a new custom type through a factory.
+ *
+ * The type starts out empty: configure it with `duckdb_v2_custom_type_set_name()` and
+ * `duckdb_v2_custom_type_set_base_type()`, then make it available with `duckdb_v2_connection_register_custom_type()` or
+ * `duckdb_v2_extension_register_custom_type()`. The caller owns the returned handle and must destroy it with
+ * `duckdb_v2_custom_type_destroy()`, also after registration.
+ *
+ * The custom type can only be registered on the database the factory belongs to.
+ *
+ * history:
+ * - unstable: v2.0.0
+ *
+ * @param factory The factory to create the custom type through.
+ * @param type On success, receives the newly created custom type. Owned by the caller.
+ * @param err Optional. On failure, receives an opaque info handle the caller must destroy via
+ * `duckdb_v2_error_info_destroy()`.
+ * @return DUCKDB_V2_ERROR
+ */
+DUCKDB_C_API DUCKDB_V2_ERROR duckdb_v2_custom_type_create(duckdb_v2_factory_handle factory,
+                                                          duckdb_v2_custom_type_handle *type,
+                                                          duckdb_v2_error_info_handle *err);
+#endif
+
+#if DUCKDB_V2_API_ALLOW_UNSTABLE
+/*!
+ * Sets the name of the custom type.
+ *
+ * This is the name the type is referred to by in SQL, and the alias carried by every logical type instance of it. The
+ * name is borrowed and copied. Calling this again replaces the previous name. A name must be set before registration.
+ *
+ * history:
+ * - unstable: v2.0.0
+ *
+ * @param type The type to set the name of.
+ * @param name The name to set. Borrowed and copied.
+ * @param err Optional. On failure, receives an opaque info handle the caller must destroy via
+ * `duckdb_v2_error_info_destroy()`.
+ * @return DUCKDB_V2_ERROR
+ */
+DUCKDB_C_API DUCKDB_V2_ERROR duckdb_v2_custom_type_set_name(duckdb_v2_custom_type_handle type,
+                                                            const duckdb_v2_identifier_t *name,
+                                                            duckdb_v2_error_info_handle *err);
+#endif
+
+#if DUCKDB_V2_API_ALLOW_UNSTABLE
+/*!
+ * Sets the base type of the custom type.
+ *
+ * The custom type shares the base type's internal representation but is logically distinct, so it can carry its own
+ * cast functions. The type is borrowed and copied. Calling this again replaces the previous base type. A base type must
+ * be set before registration, and it must be a fully defined concrete type -- ANY is a signature wildcard, not
+ * something a registered type can be built on.
+ *
+ * history:
+ * - unstable: v2.0.0
+ *
+ * @param type The type to set the base type of.
+ * @param base_type The logical type to base the custom type on. Borrowed for the call only.
+ * @param err Optional. On failure, receives an opaque info handle the caller must destroy via
+ * `duckdb_v2_error_info_destroy()`.
+ * @return DUCKDB_V2_ERROR
+ */
+DUCKDB_C_API DUCKDB_V2_ERROR duckdb_v2_custom_type_set_base_type(duckdb_v2_custom_type_handle type,
+                                                                 duckdb_v2_logical_type_handle base_type,
+                                                                 duckdb_v2_error_info_handle *err);
+#endif
+
+#if DUCKDB_V2_API_ALLOW_UNSTABLE
+/*!
+ * Registers the custom type, making it available for use in SQL queries.
+ *
+ * The type is registered on the connection's database, visible to every connection, in the connection's transaction:
+ * inside an explicit transaction, it is invisible to other connections until the transaction commits, and a rollback
+ * undoes it. Registration requires a name and a complete base type. The custom type must have been created through a
+ * factory of the same database. The caller still owns the handle after registration and must destroy it with
+ * `duckdb_v2_custom_type_destroy()`, which does not affect the registered type.
+ *
+ * history:
+ * - unstable: v2.0.0
+ *
+ * @param conn The connection to register on.
+ * @param type The custom type to register.
+ * @param err Optional. On failure, receives an opaque info handle the caller must destroy via
+ * `duckdb_v2_error_info_destroy()`.
+ * @return DUCKDB_V2_ERROR
+ */
+DUCKDB_C_API DUCKDB_V2_ERROR duckdb_v2_connection_register_custom_type(duckdb_v2_connection_handle conn,
+                                                                       duckdb_v2_custom_type_handle type,
+                                                                       duckdb_v2_error_info_handle *err);
+#endif
+
+#if DUCKDB_V2_API_ALLOW_UNSTABLE
+/*!
+ * Registers the custom type, making it available for use in SQL queries.
+ *
+ * The type is registered on the loading extension's database and attributed to the extension. Use this from the
+ * extension's load callback. Registration requires a name and a complete base type. The custom type must have been
+ * created through a factory of the same database. The caller still owns the handle after registration and must destroy
+ * it with `duckdb_v2_custom_type_destroy()`, which does not affect the registered type.
+ *
+ * history:
+ * - unstable: v2.0.0
+ *
+ * @param extension The loading extension.
+ * @param type The custom type to register.
+ * @param err Optional. On failure, receives an opaque info handle the caller must destroy via
+ * `duckdb_v2_error_info_destroy()`.
+ * @return DUCKDB_V2_ERROR
+ */
+DUCKDB_C_API DUCKDB_V2_ERROR duckdb_v2_extension_register_custom_type(duckdb_v2_extension_handle extension,
+                                                                      duckdb_v2_custom_type_handle type,
+                                                                      duckdb_v2_error_info_handle *err);
+#endif
+
+#if DUCKDB_V2_API_ALLOW_UNSTABLE
+/*!
+ * Destroys the custom type, releasing its resources.
+ *
+ * Null-safe: passing a null pointer or null handle is a no-op. The handle is set to null on return to prevent
+ * double-destruction. Destroying the handle after registration does not affect the registered type.
+ *
+ * history:
+ * - unstable: v2.0.0
+ *
+ * @param type The type to destroy.
+ * @return DUCKDB_V2_ERROR
+ */
+DUCKDB_C_API DUCKDB_V2_ERROR duckdb_v2_custom_type_destroy(duckdb_v2_custom_type_handle *type);
+#endif
+
+/* --- Struct definitions for custom type --- */
+
+/* ============================================================================
+ * MODULE: data_chunk
+ * ============================================================================ */
+
+/* --- Enums for data_chunk --- */
+
+/* --- Struct forward declarations for data_chunk --- */
+
+/* --- Types for data_chunk --- */
+
+/* --- Constants for data_chunk --- */
+
+/* --- Function pointer typedefs for data_chunk --- */
+
+/* --- Functions for data_chunk --- */
+
+#if DUCKDB_V2_API_ALLOW_UNSTABLE
+/*!
+ * Creates an empty data chunk with the given column types, drawing its allocator from a factory.
+ *
+ * The chunk's vectors are allocated through the factory's database, so the memory is accounted to that database.
+ * Allocates one FLAT vector per element of the types array, each at default capacity. Every vector starts at size 0;
+ * set it with vector_set_size once the vector is populated. The chunk is caller-owned and must be destroyed via
+ * data_chunk_destroy.
+ *
+ * history:
+ * - unstable: v2.0.0
+ *
+ * @param factory The factory to create with.
+ * @param types Pointer to an array of logical_type handles, one per column.
+ * @param column_count Number of elements in the types array.
+ * @param out_chunk Receives the new chunk handle.
+ * @param err Optional. On failure, receives an opaque info handle the caller must destroy via error_info_destroy.
+ * @return DUCKDB_V2_ERROR
+ */
+DUCKDB_C_API DUCKDB_V2_ERROR duckdb_v2_data_chunk_create(duckdb_v2_factory_handle factory,
+                                                         const duckdb_v2_logical_type_handle *types, idx_t column_count,
+                                                         duckdb_v2_data_chunk_handle *out_chunk,
+                                                         duckdb_v2_error_info_handle *err);
+#endif
+
+#if DUCKDB_V2_API_ALLOW_UNSTABLE
+/*!
+ * Creates a deep copy of a data chunk, drawing its allocator from a factory.
+ *
+ * Allocates a new chunk with the source chunk's column types and copies all rows into it, through the factory's
+ * database. The copy is flattened and owns all its data, so it stays valid after the source chunk or whatever backs it
+ * (such as a column data collection scan state) is destroyed. The returned chunk is caller-owned and must be destroyed
+ * via data_chunk_destroy.
+ *
+ * history:
+ * - unstable: v2.0.0
+ *
+ * @param factory The factory to create with.
+ * @param chunk The chunk to copy. Left unchanged.
+ * @param out_chunk Receives the new chunk handle.
+ * @param err Optional. On failure, receives an opaque info handle the caller must destroy via error_info_destroy.
+ * @return DUCKDB_V2_ERROR
+ */
+DUCKDB_C_API DUCKDB_V2_ERROR duckdb_v2_data_chunk_copy(duckdb_v2_factory_handle factory,
+                                                       duckdb_v2_data_chunk_handle chunk,
+                                                       duckdb_v2_data_chunk_handle *out_chunk,
+                                                       duckdb_v2_error_info_handle *err);
+#endif
+
+#if DUCKDB_V2_API_ALLOW_UNSTABLE
+/*!
+ * Destroys a data chunk handle.
+ *
+ * Null-safe: passing nullptr or a slot already set to nullptr is a no-op. On success the slot is set to nullptr. Any
+ * vector previously borrowed from this chunk becomes invalid.
+ *
+ * history:
+ * - unstable: v2.0.0
+ *
+ * @param chunk The chunk to destroy.
+ * @return DUCKDB_V2_ERROR
+ */
+DUCKDB_C_API DUCKDB_V2_ERROR duckdb_v2_data_chunk_destroy(duckdb_v2_data_chunk_handle *chunk);
+#endif
+
+#if DUCKDB_V2_API_ALLOW_UNSTABLE
+/*!
+ * Empties a data chunk so it can be filled again.
+ *
+ * The chunk's size becomes 0, and each of its vectors becomes a writable FLAT vector of its type again, as on creation,
+ * so a chunk can be reused for one batch after another instead of being created for each. Data, views and pointers
+ * taken from the chunk or its vectors beforehand do not survive this. Must not be called on a chunk DuckDB lends to a
+ * callback for reading.
+ *
+ * history:
+ * - unstable: v2.0.0
+ *
+ * @param chunk The chunk to clear.
+ * @param err Optional. On failure, receives an opaque info handle the caller must destroy via error_info_destroy.
+ * @return DUCKDB_V2_ERROR
+ */
+DUCKDB_C_API DUCKDB_V2_ERROR duckdb_v2_data_chunk_clear(duckdb_v2_data_chunk_handle chunk,
+                                                        duckdb_v2_error_info_handle *err);
+#endif
+
+#if DUCKDB_V2_API_ALLOW_UNSTABLE
+/*!
+ * Returns the row count of a data chunk.
+ *
+ * history:
+ * - unstable: v2.0.0
+ *
+ * @param chunk The chunk.
+ * @param out_size Receives the row count.
+ * @param err Optional. On failure, receives an opaque info handle the caller must destroy via error_info_destroy.
+ * @return DUCKDB_V2_ERROR
+ */
+DUCKDB_C_API DUCKDB_V2_ERROR duckdb_v2_data_chunk_get_size(duckdb_v2_data_chunk_handle chunk, idx_t *out_size,
+                                                           duckdb_v2_error_info_handle *err);
+#endif
+
+#if DUCKDB_V2_API_ALLOW_UNSTABLE
+/*!
+ * Returns the number of rows a data chunk can hold, e.g. how many rows the exec callback of a table function may write
+ * into its output chunk in one call.
+ *
+ * history:
+ * - unstable: v2.0.0
+ *
+ * @param chunk The chunk.
+ * @param out_capacity Receives the number of rows the chunk can hold.
+ * @param err Optional. On failure, receives an opaque info handle the caller must destroy via error_info_destroy.
+ * @return DUCKDB_V2_ERROR
+ */
+DUCKDB_C_API DUCKDB_V2_ERROR duckdb_v2_data_chunk_get_capacity(duckdb_v2_data_chunk_handle chunk, idx_t *out_capacity,
+                                                               duckdb_v2_error_info_handle *err);
+#endif
+
+#if DUCKDB_V2_API_ALLOW_UNSTABLE
+/*!
+ * Returns the number of vectors in a data chunk.
+ *
+ * Equals the column count of the producing result.
+ *
+ * history:
+ * - unstable: v2.0.0
+ *
+ * @param chunk The chunk.
+ * @param out_count Receives the vector count.
+ * @param err Optional. On failure, receives an opaque info handle the caller must destroy via error_info_destroy.
+ * @return DUCKDB_V2_ERROR
+ */
+DUCKDB_C_API DUCKDB_V2_ERROR duckdb_v2_data_chunk_get_vector_count(duckdb_v2_data_chunk_handle chunk, idx_t *out_count,
+                                                                   duckdb_v2_error_info_handle *err);
+#endif
+
+#if DUCKDB_V2_API_ALLOW_UNSTABLE
+/*!
+ * Borrows the vector at the given index in a data chunk.
+ *
+ * The returned handle is borrowed and valid until the chunk is destroyed; do not destroy it. An out-of-range index
+ * returns ERROR_INPUT_INVALID.
+ *
+ * history:
+ * - unstable: v2.0.0
+ *
+ * @param chunk The chunk.
+ * @param index The vector index, in [0, vector_count).
+ * @param out_vector Receives the borrowed vector handle.
+ * @param err Optional. On failure, receives an opaque info handle the caller must destroy via error_info_destroy.
+ * @return DUCKDB_V2_ERROR
+ */
+DUCKDB_C_API DUCKDB_V2_ERROR duckdb_v2_data_chunk_get_vector(duckdb_v2_data_chunk_handle chunk, idx_t index,
+                                                             duckdb_v2_vector_handle *out_vector,
+                                                             duckdb_v2_error_info_handle *err);
+#endif
+
+/* --- Struct definitions for data_chunk --- */
+
+/* ============================================================================
+ * MODULE: environment
+ * ============================================================================ */
+
+/* --- Enums for environment --- */
+
+/* --- Struct forward declarations for environment --- */
+
+/* --- Types for environment --- */
+
+/* --- Constants for environment --- */
+
+/* --- Function pointer typedefs for environment --- */
+
+/* --- Functions for environment --- */
+
+#if DUCKDB_V2_API_ALLOW_UNSTABLE
+/*!
+ * Creates the V2 environment. Call once at program start.
+ *
+ * history:
+ * - unstable: v2.0.0
+ *
+ * @param out_env Receives the new environment handle.
+ * @param err Optional. On failure, receives an opaque info handle the caller must destroy via
+ * `duckdb_v2_error_info_destroy()`.
+ * @return DUCKDB_V2_ERROR
+ */
+DUCKDB_C_API DUCKDB_V2_ERROR duckdb_v2_environment_create(duckdb_v2_environment_handle *out_env,
+                                                          duckdb_v2_error_info_handle *err);
+#endif
+
+#if DUCKDB_V2_API_ALLOW_UNSTABLE
+/*!
+ * Destroys the environment.
+ *
+ * Refuses with ERROR_RESOURCE_IN_USE while any instance created through this environment is still alive; destroy those
+ * instances first, then retry. On success the handle is set to null.
+ *
+ * history:
+ * - unstable: v2.0.0
+ *
+ * @param env The environment.
+ * @return DUCKDB_V2_ERROR
+ */
+DUCKDB_C_API DUCKDB_V2_ERROR duckdb_v2_environment_destroy(duckdb_v2_environment_handle *env);
+#endif
+
+#if DUCKDB_V2_API_ALLOW_UNSTABLE
+/*!
+ * Returns the number of instances currently alive under the environment.
+ *
+ * A diagnostic accessor, for tracking down leaked instances when `duckdb_v2_environment_destroy()` returns
+ * ERROR_RESOURCE_IN_USE. The count is a snapshot and may change before the next call.
+ *
+ * history:
+ * - unstable: v2.0.0
+ *
+ * @param env The environment.
+ * @param out_count Receives the number of live instances.
+ * @param err Optional. On failure, receives an opaque info handle the caller must destroy via
+ * `duckdb_v2_error_info_destroy()`.
+ * @return DUCKDB_V2_ERROR
+ */
+DUCKDB_C_API DUCKDB_V2_ERROR duckdb_v2_environment_get_instance_count(duckdb_v2_environment_handle env,
+                                                                      idx_t *out_count,
+                                                                      duckdb_v2_error_info_handle *err);
+#endif
+
+/* --- Struct definitions for environment --- */
+
+/* ============================================================================
+ * MODULE: error
+ * ============================================================================ */
+
+/* --- Enums for error --- */
+
+/* --- Struct forward declarations for error --- */
+
+/* --- Types for error --- */
+
+/* --- Constants for error --- */
+
+/* --- Function pointer typedefs for error --- */
+
+/* --- Functions for error --- */
+
+#if DUCKDB_V2_API_ALLOW_UNSTABLE
+/*!
+ * Retrieves the error code associated with an error info handle.
+ *
+ * On success, writes the info's error code to `*out_code`. On failure (e.g. if `info` is invalid), leaves `*out_code`
+ * unchanged and returns a non-success error code.
+ *
+ * history:
+ * - unstable: v2.0.0
+ *
+ * @param info The error info handle to query.
+ * @param out_code The error code associated with the info, if the call succeeds.
+ * @return DUCKDB_V2_ERROR
+ */
+DUCKDB_C_API DUCKDB_V2_ERROR duckdb_v2_error_info_get_code(duckdb_v2_error_info_handle info, DUCKDB_V2_ERROR *out_code);
+#endif
+
+#if DUCKDB_V2_API_ALLOW_UNSTABLE
+/*!
+ * Retrieves the error text associated with an error info handle.
+ *
+ * Returns a borrowed pointer to the info's null-terminated error text. The pointer is owned by DuckDB and is valid
+ * until the info is destroyed or a new text is set; callers must not free it, and must not read it once the info has
+ * been destroyed.
+ *
+ * history:
+ * - unstable: v2.0.0
+ *
+ * @param info The error info handle to query.
+ * @param out_text Receives a borrowed view of the text. Owned by DuckDB; valid until the info handle is destroyed.
+ * @return DUCKDB_V2_ERROR
+ */
+DUCKDB_C_API DUCKDB_V2_ERROR duckdb_v2_error_info_get_text(duckdb_v2_error_info_handle info, duckdb_v2_str *out_text);
+#endif
+
+#if DUCKDB_V2_API_ALLOW_UNSTABLE
+/*!
+ * Retrieves the error text body without the leading category prefix.
+ *
+ * Returns a borrowed view of the same text error_info_get_text reports, minus the leading "<Type> Error: " prefix. This
+ * is the authoritative unprefixed body: the API exposes no type name, so the prefix cannot be reconstructed and the
+ * body cannot be derived from error_info_get_text. Unprefixed does not mean plain — the body keeps whatever form it was
+ * rendered in (a LINE/caret block by default, JSON under errors_as_json). `{NULL, 0}` when there is no text. The
+ * pointer is owned by DuckDB and valid until the info handle is destroyed.
+ *
+ * history:
+ * - unstable: v2.0.0
+ *
+ * @param info The error info handle to query.
+ * @param out_raw_text Receives a borrowed view of the raw text. Owned by DuckDB; valid until the info handle is
+ * destroyed.
+ * @return DUCKDB_V2_ERROR
+ */
+DUCKDB_C_API DUCKDB_V2_ERROR duckdb_v2_error_info_get_raw_text(duckdb_v2_error_info_handle info,
+                                                               duckdb_v2_str *out_raw_text);
+#endif
+
+#if DUCKDB_V2_API_ALLOW_UNSTABLE
+/*!
+ * Sets the error code for an error info handle.
+ *
+ * On success, replaces the info's error code with the provided one. On failure, nothing is changed. Accepts a `nullptr`
+ * info handle, in which case the call is a no-op and returns ERROR_NONE.
+ *
+ * history:
+ * - unstable: v2.0.0
+ *
+ * @param info The error info handle to set. On success, updated with the provided code.
+ * @param code The error code to set in the info.
+ * @return DUCKDB_V2_ERROR
+ */
+DUCKDB_C_API DUCKDB_V2_ERROR duckdb_v2_error_info_set_code(duckdb_v2_error_info_handle info, DUCKDB_V2_ERROR code);
+#endif
+
+#if DUCKDB_V2_API_ALLOW_UNSTABLE
+/*!
+ * Sets the error text for an error info handle.
+ *
+ * On success, replaces the info's text with the provided one; DuckDB allocates its own copy of the string. On failure,
+ * nothing is changed. Accepts a `nullptr` info handle, in which case the call is a no-op and returns ERROR_NONE.
+ *
+ * history:
+ * - unstable: v2.0.0
+ *
+ * @param info The error info handle to set. On success, updated with the provided text.
+ * @param text The error text to set in the info.
+ * @return DUCKDB_V2_ERROR
+ */
+DUCKDB_C_API DUCKDB_V2_ERROR duckdb_v2_error_info_set_text(duckdb_v2_error_info_handle info, const duckdb_v2_str *text);
+#endif
+
+#if DUCKDB_V2_API_ALLOW_UNSTABLE
+/*!
+ * Destroys an error info handle and frees its resources.
+ *
+ * Null-safe: calling with a null handle, or a null pointer-to-handle, is a no-op and returns ERROR_NONE. On return
+ * `*info` is set to nullptr. Safe to call on any info DuckDB returned.
+ *
+ * history:
+ * - unstable: v2.0.0
+ *
+ * @param info The error info handle to destroy. Set to nullptr on return.
+ * @return DUCKDB_V2_ERROR
+ */
+DUCKDB_C_API DUCKDB_V2_ERROR duckdb_v2_error_info_destroy(duckdb_v2_error_info_handle *info);
+#endif
+
+/* --- Struct definitions for error --- */
+
+/* ============================================================================
+ * MODULE: extension
+ * ============================================================================ */
+
+/* --- Enums for extension --- */
+
+/* --- Struct forward declarations for extension --- */
+
+typedef struct duckdb_v2_extension_input duckdb_v2_extension_input;
+
+/* --- Types for extension --- */
+
+/* --- Constants for extension --- */
+
+/* --- Function pointer typedefs for extension --- */
+
+/*!
+ * Hands back the function-pointer table for the API version the extension was built against, or NULL if this DuckDB
+ * cannot serve it.
+ *
+ * The extension calls it exactly once, first, through DUCKDB_EXTENSION_API_INIT; nothing else in the API may be called
+ * before it succeeds. A NULL return means the load has already failed and DuckDB has recorded why, so the entrypoint
+ * must return without touching the error slot. Statically linked extensions resolve DuckDB's symbols at link time and
+ * never call it, so for those the field is NULL.
+ */
+typedef const void *(*duckdb_v2_extension_get_api_fn)(duckdb_v2_extension_handle extension, const char *version);
+
+/* --- Functions for extension --- */
+
+/* --- Struct definitions for extension --- */
+
+/*!
+ * The single argument to a V2 C extension entrypoint. Borrowed for the duration of the call: none of its fields outlive
+ * the entrypoint, and the extension destroys none of them.
+ */
+struct duckdb_v2_extension_input {
+	//! Fetches the versioned function-pointer table. NULL for a statically linked extension.
+	duckdb_v2_extension_get_api_fn get_api;
+
+	//! The extension being loaded, and the token get_api takes.
+	duckdb_v2_extension_handle extension;
+
+	/*!
+	 * A borrowed context to read and run queries through, with a transaction already active. Valid only until the
+	 * extension entrypoint returns; do not retain or destroy it.
+	 */
+	duckdb_v2_context_handle context;
+
+	/*!
+	 * A live error slot: never NULL, and never pointing at NULL. Populate it with error_info_set_code, and optionally
+	 * error_info_set_text, to fail the load. Do not destroy it -- DuckDB owns it. Pass a slot of your own to calls
+	 * whose failure you intend to handle, so only a failure you mean to abort the load with lands here.
+	 */
+	duckdb_v2_error_info_handle *err;
+};
+
+/* ============================================================================
+ * MODULE: factory
+ * ============================================================================ */
+
+/* --- Enums for factory --- */
+
+/* --- Struct forward declarations for factory --- */
+
+/* --- Types for factory --- */
+
+/* --- Constants for factory --- */
+
+/* --- Function pointer typedefs for factory --- */
+
+/* --- Functions for factory --- */
+
+#if DUCKDB_V2_API_ALLOW_UNSTABLE
+/*!
+ * Borrows the factory of an instance.
+ *
+ * The factory creates the built-in types and their values, casts with the built-in casts only, and allocates data
+ * chunks and column data collections through the instance. Anything that needs a catalog — catalog-registered types,
+ * qualified type names — returns ERROR_INPUT_INVALID. The returned handle is borrowed: it is valid for as long as the
+ * instance is, and must not be destroyed.
+ *
+ * history:
+ * - unstable: v2.0.0
+ *
+ * @param instance The instance.
+ * @param out_factory Receives the borrowed factory.
+ * @param err Optional. On failure, receives an opaque info handle the caller must destroy via
+ * `duckdb_v2_error_info_destroy()`.
+ * @return DUCKDB_V2_ERROR
+ */
+DUCKDB_C_API DUCKDB_V2_ERROR duckdb_v2_instance_get_factory(duckdb_v2_instance_handle instance,
+                                                            duckdb_v2_factory_handle *out_factory,
+                                                            duckdb_v2_error_info_handle *err);
+#endif
+
+#if DUCKDB_V2_API_ALLOW_UNSTABLE
+/*!
+ * Borrows the factory of a connection.
+ *
+ * The factory reaches the connection's catalog and settings. Catalog lookups run in the connection's active
+ * transaction, or in a transaction of their own when none is open; nothing else opens a transaction. The returned
+ * handle is borrowed: it is valid for as long as the connection is, and must not be destroyed.
+ *
+ * history:
+ * - unstable: v2.0.0
+ *
+ * @param conn The connection.
+ * @param out_factory Receives the borrowed factory.
+ * @param err Optional. On failure, receives an opaque info handle the caller must destroy via
+ * `duckdb_v2_error_info_destroy()`.
+ * @return DUCKDB_V2_ERROR
+ */
+DUCKDB_C_API DUCKDB_V2_ERROR duckdb_v2_connection_get_factory(duckdb_v2_connection_handle conn,
+                                                              duckdb_v2_factory_handle *out_factory,
+                                                              duckdb_v2_error_info_handle *err);
+#endif
+
+#if DUCKDB_V2_API_ALLOW_UNSTABLE
+/*!
+ * Borrows the factory of a context.
+ *
+ * The factory reaches the context's catalog and settings, within the transaction the context already has. The returned
+ * handle is borrowed: it is valid for as long as the context is, and must not be destroyed.
+ *
+ * history:
+ * - unstable: v2.0.0
+ *
+ * @param ctx The context.
+ * @param out_factory Receives the borrowed factory.
+ * @param err Optional. On failure, receives an opaque info handle the caller must destroy via
+ * `duckdb_v2_error_info_destroy()`.
+ * @return DUCKDB_V2_ERROR
+ */
+DUCKDB_C_API DUCKDB_V2_ERROR duckdb_v2_context_get_factory(duckdb_v2_context_handle ctx,
+                                                           duckdb_v2_factory_handle *out_factory,
+                                                           duckdb_v2_error_info_handle *err);
+#endif
+
+/* --- Struct definitions for factory --- */
+
+/* ============================================================================
+ * MODULE: file system
+ * ============================================================================ */
+
+/* --- Enums for file system --- */
+
+/*!
+ * How `duckdb_v2_file_system_open()` opens a file. These are not a bitmask -- apply them one at a time with
+ * `duckdb_v2_file_open_options_set_flag()`, calling it once per behaviour you want, e.g. `FILE_FLAG_WRITE` then
+ * `FILE_FLAG_CREATE` to write to a file and create it when it does not exist.
+ */
+typedef enum DUCKDB_V2_FILE_FLAG {
+	//! Not a flag. The zero value, so that an uninitialized variable does not name a behaviour; applying it is an
+	//! error.
+	DUCKDB_V2_FILE_FLAG_INVALID = 0,
+
+	//! Open the file with "read" capabilities.
+	DUCKDB_V2_FILE_FLAG_READ = 1,
+
+	//! Open the file with "write" capabilities.
+	DUCKDB_V2_FILE_FLAG_WRITE = 2,
+
+	//! Create the file if it does not exist, and open it as it is if it does.
+	DUCKDB_V2_FILE_FLAG_CREATE = 3,
+
+	/*!
+	 * Create the file if it does not exist, and truncate it to empty if it does. To fail instead of truncating, combine
+	 * `FILE_FLAG_CREATE` with `FILE_FLAG_EXCLUSIVE_CREATE`.
+	 */
+	DUCKDB_V2_FILE_FLAG_CREATE_NEW = 4,
+
+	//! Open the file in "append" mode.
+	DUCKDB_V2_FILE_FLAG_APPEND = 5,
+
+	//! Fail if the file already exists. A modifier on `FILE_FLAG_CREATE`, and meaningless without it.
+	DUCKDB_V2_FILE_FLAG_EXCLUSIVE_CREATE = 6,
+
+	/*!
+	 * The file will be read and written at explicit offsets from several threads at once. Pass it whenever
+	 * `duckdb_v2_file_read_at()` or `duckdb_v2_file_write_at()` are used concurrently -- a file system that would
+	 * otherwise assume sequential access, by caching, buffering, or keeping a single cursor, needs to know not to.
+	 */
+	DUCKDB_V2_FILE_FLAG_PARALLEL_ACCESS = 7,
+
+	/*!
+	 * Read the file through DuckDB's external file cache, which keeps the bytes that were read in memory, so that later
+	 * reads of the same file - also by later queries - do not have to read them again. Whether a local file is cached
+	 * is decided by the `cache_local_files` setting. Only meaningful for reading.
+	 */
+	DUCKDB_V2_FILE_FLAG_EXTERNAL_FILE_CACHE = 8,
+	DUCKDB_V2_FILE_FLAG_MAX_ENUM = 0x7FFFFFFF,
+} DUCKDB_V2_FILE_FLAG;
+
+/* --- Struct forward declarations for file system --- */
+
+/* --- Types for file system --- */
+
+/*!
+ * A borrowed opaque handle to a file system. Obtained from `duckdb_v2_instance_get_file_system()`,
+ * `duckdb_v2_connection_get_file_system()` or `duckdb_v2_context_get_file_system()`, and used to open files with
+ * `duckdb_v2_file_system_open()`. Borrowed: the handle belongs to the instance, connection or context it came from, is
+ * valid only for as long as that is, and must not be destroyed.
+ */
+typedef struct _duckdb_v2_file_system {
+	void *internal_ptr;
+} * duckdb_v2_file_system_handle;
+
+/*!
+ * An owned opaque handle to the options a file is opened with. Created with `duckdb_v2_file_open_options_create()`,
+ * configured with `duckdb_v2_file_open_options_set_flag()` and `duckdb_v2_file_open_options_set_value()`, passed to
+ * `duckdb_v2_file_system_open()`, and destroyed with `duckdb_v2_file_open_options_destroy()`. One options object can
+ * open any number of files, and destroying it does not affect files already opened with it.
+ */
+typedef struct _duckdb_v2_file_open_options {
+	void *internal_ptr;
+} * duckdb_v2_file_open_options_handle;
+
+/*!
+ * An owned opaque handle to an open file, produced by `duckdb_v2_file_system_open()` and destroyed with
+ * `duckdb_v2_file_destroy()`. Read, write, seek and sync through the `file_*` functions. Only usable while the file
+ * system it was opened through is still valid.
+ */
+typedef struct _duckdb_v2_file {
+	void *internal_ptr;
+} * duckdb_v2_file_handle;
+
+/* --- Constants for file system --- */
+
+/* --- Function pointer typedefs for file system --- */
+
+/*!
+ * Receives one path matched by `duckdb_v2_file_system_path_glob()`.
+ *
+ * The view is borrowed for the duration of the call only, and is not guaranteed to be null-terminated. Report an error
+ * through `err`, a live slot that must not be destroyed, to stop the glob: `duckdb_v2_file_system_path_glob()` then
+ * fails with that error. The callback must not throw or unwind across the boundary.
+ */
+typedef void (*duckdb_v2_file_system_path_glob_callback_fn)(const duckdb_v2_str *path, void *user_data,
+                                                            duckdb_v2_error_info_handle *err);
+
+/* --- Functions for file system --- */
+
+#if DUCKDB_V2_API_ALLOW_UNSTABLE
+/*!
+ * Borrows the file system of a context.
+ *
+ * The returned handle is borrowed: it is valid only for as long as the context is, and must not be destroyed.
+ *
+ * history:
+ * - unstable: v2.0.0
+ *
+ * @param context The context to take the file system from.
+ * @param file_system Receives the borrowed file system.
+ * @param err Optional. On failure, receives an opaque info handle the caller must destroy via
+ * `duckdb_v2_error_info_destroy()`.
+ * @return DUCKDB_V2_ERROR
+ */
+DUCKDB_C_API DUCKDB_V2_ERROR duckdb_v2_context_get_file_system(duckdb_v2_context_handle context,
+                                                               duckdb_v2_file_system_handle *file_system,
+                                                               duckdb_v2_error_info_handle *err);
+#endif
+
+#if DUCKDB_V2_API_ALLOW_UNSTABLE
+/*!
+ * Borrows the file system of an instance.
+ *
+ * Paths are resolved with the instance's GLOBAL settings and secrets, and file I/O is not attributed to any query.
+ *
+ * The returned handle is borrowed: it is valid only for as long as the instance is, and must not be destroyed.
+ *
+ * history:
+ * - unstable: v2.0.0
+ *
+ * @param instance The instance to take the file system from.
+ * @param file_system Receives the borrowed file system.
+ * @param err Optional. On failure, receives an opaque info handle the caller must destroy via
+ * `duckdb_v2_error_info_destroy()`.
+ * @return DUCKDB_V2_ERROR
+ */
+DUCKDB_C_API DUCKDB_V2_ERROR duckdb_v2_instance_get_file_system(duckdb_v2_instance_handle instance,
+                                                                duckdb_v2_file_system_handle *file_system,
+                                                                duckdb_v2_error_info_handle *err);
+#endif
+
+#if DUCKDB_V2_API_ALLOW_UNSTABLE
+/*!
+ * Borrows the file system of a connection.
+ *
+ * Paths are resolved with the connection's settings and secrets, and file I/O is attributed to its running query, as
+ * through `duckdb_v2_context_get_file_system()` in a callback.
+ *
+ * The returned handle is borrowed: it is valid only for as long as the connection is, and must not be destroyed.
+ *
+ * history:
+ * - unstable: v2.0.0
+ *
+ * @param conn The connection to take the file system from.
+ * @param file_system Receives the borrowed file system.
+ * @param err Optional. On failure, receives an opaque info handle the caller must destroy via
+ * `duckdb_v2_error_info_destroy()`.
+ * @return DUCKDB_V2_ERROR
+ */
+DUCKDB_C_API DUCKDB_V2_ERROR duckdb_v2_connection_get_file_system(duckdb_v2_connection_handle conn,
+                                                                  duckdb_v2_file_system_handle *file_system,
+                                                                  duckdb_v2_error_info_handle *err);
+#endif
+
+#if DUCKDB_V2_API_ALLOW_UNSTABLE
+/*!
+ * Creates a set of open options for a file system.
+ *
+ * The options start out empty: give them flags with `duckdb_v2_file_open_options_set_flag()`, which is required, and
+ * optionally attach values with `duckdb_v2_file_open_options_set_value()`. They are then passed to
+ * `duckdb_v2_file_system_open()`, and can be reused for as many opens as you like. The caller owns the returned handle
+ * and must destroy it with `duckdb_v2_file_open_options_destroy()`.
+ *
+ * The options belong to the file system they were created from, since which values mean anything depends on which file
+ * system ends up handling the path.
+ *
+ * history:
+ * - unstable: v2.0.0
+ *
+ * @param file_system The file system the options are for.
+ * @param options On success, receives the new options. Owned by the caller; destroy via
+ * `duckdb_v2_file_open_options_destroy()`.
+ * @param err Optional. On failure, receives an opaque info handle the caller must destroy via
+ * `duckdb_v2_error_info_destroy()`.
+ * @return DUCKDB_V2_ERROR
+ */
+DUCKDB_C_API DUCKDB_V2_ERROR duckdb_v2_file_open_options_create(duckdb_v2_file_system_handle file_system,
+                                                                duckdb_v2_file_open_options_handle *options,
+                                                                duckdb_v2_error_info_handle *err);
+#endif
+
+#if DUCKDB_V2_API_ALLOW_UNSTABLE
+/*!
+ * Applies one flag to the options.
+ *
+ * Additive: call it once per behaviour you want, and applying the same flag twice is harmless. At least one flag must
+ * be applied before the options can open anything, since the flags are what say whether the file is being read or
+ * written. There is no way to take a flag back -- build a fresh set of options instead.
+ *
+ * `FILE_FLAG_INVALID` names no behaviour and is rejected, as is any value that is not a `DUCKDB_V2_FILE_FLAG`.
+ *
+ * history:
+ * - unstable: v2.0.0
+ *
+ * @param options The options to apply the flag to.
+ * @param flag The flag to apply.
+ * @param err Optional. On failure, receives an opaque info handle the caller must destroy via
+ * `duckdb_v2_error_info_destroy()`.
+ * @return DUCKDB_V2_ERROR
+ */
+DUCKDB_C_API DUCKDB_V2_ERROR duckdb_v2_file_open_options_set_flag(duckdb_v2_file_open_options_handle options,
+                                                                  DUCKDB_V2_FILE_FLAG flag,
+                                                                  duckdb_v2_error_info_handle *err);
+#endif
+
+#if DUCKDB_V2_API_ALLOW_UNSTABLE
+/*!
+ * Attaches a named value to the options.
+ *
+ * These are hints for whichever file system ends up handling the path, and what they mean is that file system's
+ * business: a value it does not recognise is ignored rather than rejected, and the same name can mean different things
+ * to different file systems. They are the same values a file system reports when listing files, so a known file size or
+ * modification time learned from a listing can be handed straight back to avoid re-reading it.
+ *
+ * The name and the value are borrowed and copied, so the caller may destroy the value immediately after. Setting the
+ * same name again replaces the previous value. Names are case-sensitive.
+ *
+ * history:
+ * - unstable: v2.0.0
+ *
+ * @param options The options to set the value on.
+ * @param name The name of the value. Borrowed and copied.
+ * @param value The value. Borrowed and copied.
+ * @param err Optional. On failure, receives an opaque info handle the caller must destroy via
+ * `duckdb_v2_error_info_destroy()`.
+ * @return DUCKDB_V2_ERROR
+ */
+DUCKDB_C_API DUCKDB_V2_ERROR duckdb_v2_file_open_options_set_value(duckdb_v2_file_open_options_handle options,
+                                                                   const duckdb_v2_str *name,
+                                                                   duckdb_v2_value_handle value,
+                                                                   duckdb_v2_error_info_handle *err);
+#endif
+
+#if DUCKDB_V2_API_ALLOW_UNSTABLE
+/*!
+ * Destroys the options, releasing their resources.
+ *
+ * Null-safe: passing a null pointer or null handle is a no-op. The handle is set to null on return to prevent
+ * double-destruction. Files already opened with these options are unaffected.
+ *
+ * history:
+ * - unstable: v2.0.0
+ *
+ * @param options The options to destroy.
+ * @return DUCKDB_V2_ERROR
+ */
+DUCKDB_C_API DUCKDB_V2_ERROR duckdb_v2_file_open_options_destroy(duckdb_v2_file_open_options_handle *options);
+#endif
+
+#if DUCKDB_V2_API_ALLOW_UNSTABLE
+/*!
+ * Opens a file.
+ *
+ * Opens the file at the given path through the file system, which routes it the way the engine would -- a path handled
+ * by a registered virtual or remote file system goes there rather than to local disk. The returned handle is owned by
+ * the caller and must be destroyed with `duckdb_v2_file_destroy()`.
+ *
+ * The options carry the flags and any file-system-specific values; see `duckdb_v2_file_open_options_create()`. Opening
+ * without having set flags fails, since the flags are what say whether the file is being read or written.
+ *
+ * Failure to open -- a missing file without `FILE_FLAG_CREATE`, insufficient permissions, an existing file under
+ * `FILE_FLAG_EXCLUSIVE_CREATE` -- is reported as an error.
+ *
+ * Flag combinations that contradict each other, such as naming neither read nor write or combining `FILE_FLAG_CREATE`
+ * with `FILE_FLAG_CREATE_NEW`, are a programming error rather than a supported input. An assertion build catches them;
+ * elsewhere the behaviour is whatever the underlying file system does with them.
+ *
+ * history:
+ * - unstable: v2.0.0
+ *
+ * @param file_system The file system to open the file through.
+ * @param file_path The path of the file to open. Borrowed for the call only.
+ * @param options How to open the file. Borrowed for the call only, and reusable across opens.
+ * @param file On success, receives the open file. Owned by the caller; destroy via `duckdb_v2_file_destroy()`.
+ * @param err Optional. On failure, receives an opaque info handle the caller must destroy via
+ * `duckdb_v2_error_info_destroy()`.
+ * @return DUCKDB_V2_ERROR
+ */
+DUCKDB_C_API DUCKDB_V2_ERROR duckdb_v2_file_system_open(duckdb_v2_file_system_handle file_system,
+                                                        const duckdb_v2_str *file_path,
+                                                        duckdb_v2_file_open_options_handle options,
+                                                        duckdb_v2_file_handle *file, duckdb_v2_error_info_handle *err);
+#endif
+
+#if DUCKDB_V2_API_ALLOW_UNSTABLE
+/*!
+ * Reports whether a file exists at the given path.
+ *
+ * The path is routed the way `duckdb_v2_file_system_open()` routes it, so asking about a path handled by a remote file
+ * system may reach out to it. A directory is not a file, and reports false.
+ *
+ * history:
+ * - unstable: v2.0.0
+ *
+ * @param file_system The file system to ask.
+ * @param path The path to check. Borrowed for the call only.
+ * @param out_exists Receives whether a file exists at the path.
+ * @param err Optional. On failure, receives an opaque info handle the caller must destroy via
+ * `duckdb_v2_error_info_destroy()`.
+ * @return DUCKDB_V2_ERROR
+ */
+DUCKDB_C_API DUCKDB_V2_ERROR duckdb_v2_file_system_path_exists(duckdb_v2_file_system_handle file_system,
+                                                               const duckdb_v2_str *path, bool *out_exists,
+                                                               duckdb_v2_error_info_handle *err);
+#endif
+
+#if DUCKDB_V2_API_ALLOW_UNSTABLE
+/*!
+ * Reports whether a path names a remote file, e.g. one under `s3://`, `https://`, `gcs://` or `azure://`.
+ *
+ * Decided from the path alone: no file system is consulted, so it answers even when the extension providing the remote
+ * file system is not loaded.
+ *
+ * history:
+ * - unstable: v2.0.0
+ *
+ * @param file_system The file system the path is meant for.
+ * @param path The path to check. Borrowed for the call only.
+ * @param out_is_remote Receives whether the path names a remote file.
+ * @param err Optional. On failure, receives an opaque info handle the caller must destroy via
+ * `duckdb_v2_error_info_destroy()`.
+ * @return DUCKDB_V2_ERROR
+ */
+DUCKDB_C_API DUCKDB_V2_ERROR duckdb_v2_file_system_path_is_remote(duckdb_v2_file_system_handle file_system,
+                                                                  const duckdb_v2_str *path, bool *out_is_remote,
+                                                                  duckdb_v2_error_info_handle *err);
+#endif
+
+#if DUCKDB_V2_API_ALLOW_UNSTABLE
+/*!
+ * Expands a path as the file system does when opening it: a leading `~` becomes the home directory, as the
+ * `home_directory` setting configures it.
+ *
+ * A path without anything to expand is handed back as it is. The expanded path is handed to `sink` in a single call.
+ *
+ * history:
+ * - unstable: v2.0.0
+ *
+ * @param file_system The file system whose settings expand the path.
+ * @param path The path to expand. Borrowed for the call only.
+ * @param sink Receives the expanded path in a single call. Borrowed for the duration of that call; see text_sink for
+ * the full contract.
+ * @param user_data Opaque pointer passed through to sink untouched. May be NULL.
+ * @param err Optional. On failure, receives an opaque info handle the caller must destroy via
+ * `duckdb_v2_error_info_destroy()`.
+ * @return DUCKDB_V2_ERROR
+ */
+DUCKDB_C_API DUCKDB_V2_ERROR duckdb_v2_file_system_path_expand(duckdb_v2_file_system_handle file_system,
+                                                               const duckdb_v2_str *path, duckdb_v2_text_sink_fn sink,
+                                                               void *user_data, duckdb_v2_error_info_handle *err);
+#endif
+
+#if DUCKDB_V2_API_ALLOW_UNSTABLE
+/*!
+ * Finds the files matching a glob pattern, e.g. `*.csv` or `data_?.json` in a directory, handing each matched path to
+ * `callback`.
+ *
+ * The pattern is routed the way `duckdb_v2_file_system_open()` routes a path, so globbing a remote path may reach out
+ * to the file system handling it, and is only supported where that file system supports it. A pattern without glob
+ * characters matches the file it names, if there is one. Matching nothing is not an error. In which order the paths are
+ * handed over is up to the file system.
+ *
+ * history:
+ * - unstable: v2.0.0
+ *
+ * @param file_system The file system to glob in.
+ * @param pattern The glob pattern. Borrowed for the call only.
+ * @param callback Invoked once per matched path.
+ * @param user_data Opaque pointer passed through to `callback` untouched. May be NULL.
+ * @param err Optional. On failure, receives an opaque info handle the caller must destroy via
+ * `duckdb_v2_error_info_destroy()`.
+ * @return DUCKDB_V2_ERROR
+ */
+DUCKDB_C_API DUCKDB_V2_ERROR duckdb_v2_file_system_path_glob(duckdb_v2_file_system_handle file_system,
+                                                             const duckdb_v2_str *pattern,
+                                                             duckdb_v2_file_system_path_glob_callback_fn callback,
+                                                             void *user_data, duckdb_v2_error_info_handle *err);
+#endif
+
+#if DUCKDB_V2_API_ALLOW_UNSTABLE
+/*!
+ * Moves, or renames, a file from one path to another.
+ *
+ * The move is handled by the file system `source` routes to, the way `duckdb_v2_file_system_open()` routes a path;
+ * moving a file between two file systems is not supported. Whether an existing file at `target` is replaced, and
+ * whether the move is atomic, is up to that file system.
+ *
+ * history:
+ * - unstable: v2.0.0
+ *
+ * @param file_system The file system to move the file in.
+ * @param source The path of the file to move. Borrowed for the call only.
+ * @param target The path to move the file to. Borrowed for the call only.
+ * @param err Optional. On failure, receives an opaque info handle the caller must destroy via
+ * `duckdb_v2_error_info_destroy()`.
+ * @return DUCKDB_V2_ERROR
+ */
+DUCKDB_C_API DUCKDB_V2_ERROR duckdb_v2_file_system_path_move(duckdb_v2_file_system_handle file_system,
+                                                             const duckdb_v2_str *source, const duckdb_v2_str *target,
+                                                             duckdb_v2_error_info_handle *err);
+#endif
+
+#if DUCKDB_V2_API_ALLOW_UNSTABLE
+/*!
+ * Removes the file at a path, if there is one.
+ *
+ * The path is routed the way `duckdb_v2_file_system_open()` routes it. A path with no file is not an error:
+ * `out_removed` then receives false. A file that exists but cannot be removed is.
+ *
+ * history:
+ * - unstable: v2.0.0
+ *
+ * @param file_system The file system to remove the file from.
+ * @param path The path of the file to remove. Borrowed for the call only.
+ * @param out_removed Optional. Receives whether a file was removed.
+ * @param err Optional. On failure, receives an opaque info handle the caller must destroy via
+ * `duckdb_v2_error_info_destroy()`.
+ * @return DUCKDB_V2_ERROR
+ */
+DUCKDB_C_API DUCKDB_V2_ERROR duckdb_v2_file_system_path_remove(duckdb_v2_file_system_handle file_system,
+                                                               const duckdb_v2_str *path, bool *out_removed,
+                                                               duckdb_v2_error_info_handle *err);
+#endif
+
+#if DUCKDB_V2_API_ALLOW_UNSTABLE
+/*!
+ * Reads from the file into a caller-supplied buffer.
+ *
+ * Reads up to `buffer_size` bytes from the file's current position, advancing it by however many were read. Fewer bytes
+ * than asked for is normal at the end of the file, and zero means there is nothing left; neither is an error. The file
+ * must have been opened with `FILE_FLAG_READ`.
+ *
+ * Use `duckdb_v2_file_read_at()` to read at an explicit offset instead, which leaves the position alone and so can run
+ * on several threads at once.
+ *
+ * history:
+ * - unstable: v2.0.0
+ *
+ * @param file The file to read from.
+ * @param buffer A caller-owned buffer of at least `buffer_size` bytes, receiving what was read.
+ * @param buffer_size The maximum number of bytes to read.
+ * @param bytes_read Receives how many bytes were actually read, which may be fewer than `buffer_size` at the end of the
+ * file.
+ * @param err Optional. On failure, receives an opaque info handle the caller must destroy via
+ * `duckdb_v2_error_info_destroy()`.
+ * @return DUCKDB_V2_ERROR
+ */
+DUCKDB_C_API DUCKDB_V2_ERROR duckdb_v2_file_read(duckdb_v2_file_handle file, void *buffer, idx_t buffer_size,
+                                                 idx_t *bytes_read, duckdb_v2_error_info_handle *err);
+#endif
+
+#if DUCKDB_V2_API_ALLOW_UNSTABLE
+/*!
+ * Writes a caller-supplied buffer to the file.
+ *
+ * Writes up to `buffer_size` bytes at the file's current position, advancing it by however many were written. The file
+ * must have been opened with `FILE_FLAG_WRITE` or `FILE_FLAG_APPEND`. Writes may be buffered; use
+ * `duckdb_v2_file_sync()` to force them out.
+ *
+ * Use `duckdb_v2_file_write_at()` to write at an explicit offset instead, which leaves the position alone and so can
+ * run on several threads at once.
+ *
+ * history:
+ * - unstable: v2.0.0
+ *
+ * @param file The file to write to.
+ * @param buffer A caller-owned buffer of at least `buffer_size` bytes, holding what to write.
+ * @param buffer_size The number of bytes to write.
+ * @param bytes_written Receives how many bytes were actually written.
+ * @param err Optional. On failure, receives an opaque info handle the caller must destroy via
+ * `duckdb_v2_error_info_destroy()`.
+ * @return DUCKDB_V2_ERROR
+ */
+DUCKDB_C_API DUCKDB_V2_ERROR duckdb_v2_file_write(duckdb_v2_file_handle file, const void *buffer, idx_t buffer_size,
+                                                  idx_t *bytes_written, duckdb_v2_error_info_handle *err);
+#endif
+
+#if DUCKDB_V2_API_ALLOW_UNSTABLE
+/*!
+ * Reads from a fixed offset, without moving the file's position.
+ *
+ * Reads exactly `buffer_size` bytes starting at `location`. Unlike `duckdb_v2_file_read()`, a short read is an error
+ * rather than a result: reaching the end of the file before `buffer_size` bytes fails, so there is no count to report
+ * back. The file's read/write position is untouched, which is what makes this safe to call from several threads at once
+ * -- provided the file was opened with `FILE_FLAG_PARALLEL_ACCESS`.
+ *
+ * The file must have been opened with `FILE_FLAG_READ`.
+ *
+ * history:
+ * - unstable: v2.0.0
+ *
+ * @param file The file to read from.
+ * @param buffer A caller-owned buffer of at least `buffer_size` bytes, receiving what was read.
+ * @param buffer_size The number of bytes to read. All of them are read, or the call fails.
+ * @param location The absolute byte offset to read from, measured from the start of the file.
+ * @param err Optional. On failure, receives an opaque info handle the caller must destroy via
+ * `duckdb_v2_error_info_destroy()`.
+ * @return DUCKDB_V2_ERROR
+ */
+DUCKDB_C_API DUCKDB_V2_ERROR duckdb_v2_file_read_at(duckdb_v2_file_handle file, void *buffer, idx_t buffer_size,
+                                                    idx_t location, duckdb_v2_error_info_handle *err);
+#endif
+
+#if DUCKDB_V2_API_ALLOW_UNSTABLE
+/*!
+ * Writes at a fixed offset, without moving the file's position.
+ *
+ * Writes exactly `buffer_size` bytes starting at `location`, extending the file when the offset is past its end. Unlike
+ * `duckdb_v2_file_write()` there is no count to report back: all of the bytes are written, or the call fails. The
+ * file's read/write position is untouched, which is what makes this safe to call from several threads at once --
+ * provided the file was opened with `FILE_FLAG_PARALLEL_ACCESS`, and that the threads write disjoint ranges.
+ *
+ * The file must have been opened with `FILE_FLAG_WRITE`. Writes may be buffered; use `duckdb_v2_file_sync()` to force
+ * them out.
+ *
+ * history:
+ * - unstable: v2.0.0
+ *
+ * @param file The file to write to.
+ * @param buffer A caller-owned buffer of at least `buffer_size` bytes, holding what to write.
+ * @param buffer_size The number of bytes to write. All of them are written, or the call fails.
+ * @param location The absolute byte offset to write at, measured from the start of the file.
+ * @param err Optional. On failure, receives an opaque info handle the caller must destroy via
+ * `duckdb_v2_error_info_destroy()`.
+ * @return DUCKDB_V2_ERROR
+ */
+DUCKDB_C_API DUCKDB_V2_ERROR duckdb_v2_file_write_at(duckdb_v2_file_handle file, const void *buffer, idx_t buffer_size,
+                                                     idx_t location, duckdb_v2_error_info_handle *err);
+#endif
+
+#if DUCKDB_V2_API_ALLOW_UNSTABLE
+/*!
+ * Returns the file's current read/write position, as a byte offset from the start of the file.
+ *
+ * history:
+ * - unstable: v2.0.0
+ *
+ * @param file The file to query.
+ * @param position Receives the current position, as a byte offset from the start of the file.
+ * @param err Optional. On failure, receives an opaque info handle the caller must destroy via
+ * `duckdb_v2_error_info_destroy()`.
+ * @return DUCKDB_V2_ERROR
+ */
+DUCKDB_C_API DUCKDB_V2_ERROR duckdb_v2_file_tell(duckdb_v2_file_handle file, idx_t *position,
+                                                 duckdb_v2_error_info_handle *err);
+#endif
+
+#if DUCKDB_V2_API_ALLOW_UNSTABLE
+/*!
+ * Returns the total size of the file in bytes.
+ *
+ * history:
+ * - unstable: v2.0.0
+ *
+ * @param file The file to query.
+ * @param size Receives the total size of the file in bytes.
+ * @param err Optional. On failure, receives an opaque info handle the caller must destroy via
+ * `duckdb_v2_error_info_destroy()`.
+ * @return DUCKDB_V2_ERROR
+ */
+DUCKDB_C_API DUCKDB_V2_ERROR duckdb_v2_file_size(duckdb_v2_file_handle file, idx_t *size,
+                                                 duckdb_v2_error_info_handle *err);
+#endif
+
+#if DUCKDB_V2_API_ALLOW_UNSTABLE
+/*!
+ * Moves the file's read/write position.
+ *
+ * Sets the position to an absolute byte offset from the start of the file; subsequent reads and writes start there.
+ * Seeking past the end is allowed, and reading from there yields nothing.
+ *
+ * history:
+ * - unstable: v2.0.0
+ *
+ * @param file The file to seek within.
+ * @param position The absolute byte offset to seek to, measured from the start of the file.
+ * @param err Optional. On failure, receives an opaque info handle the caller must destroy via
+ * `duckdb_v2_error_info_destroy()`.
+ * @return DUCKDB_V2_ERROR
+ */
+DUCKDB_C_API DUCKDB_V2_ERROR duckdb_v2_file_seek(duckdb_v2_file_handle file, idx_t position,
+                                                 duckdb_v2_error_info_handle *err);
+#endif
+
+#if DUCKDB_V2_API_ALLOW_UNSTABLE
+/*!
+ * Flushes buffered writes to persistent storage.
+ *
+ * Forces anything still buffered out to storage, which is what makes writes durable across a crash or a process exit.
+ * Closing or destroying the handle flushes as well.
+ *
+ * history:
+ * - unstable: v2.0.0
+ *
+ * @param file The file to synchronize.
+ * @param err Optional. On failure, receives an opaque info handle the caller must destroy via
+ * `duckdb_v2_error_info_destroy()`.
+ * @return DUCKDB_V2_ERROR
+ */
+DUCKDB_C_API DUCKDB_V2_ERROR duckdb_v2_file_sync(duckdb_v2_file_handle file, duckdb_v2_error_info_handle *err);
+#endif
+
+#if DUCKDB_V2_API_ALLOW_UNSTABLE
+/*!
+ * Closes the file without destroying the handle.
+ *
+ * Releases the operating-system resources behind the file, such as its descriptor. The handle itself stays valid and
+ * must still be destroyed with `duckdb_v2_file_destroy()`, but it can no longer read, write or seek.
+ *
+ * history:
+ * - unstable: v2.0.0
+ *
+ * @param file The file to close.
+ * @param err Optional. On failure, receives an opaque info handle the caller must destroy via
+ * `duckdb_v2_error_info_destroy()`.
+ * @return DUCKDB_V2_ERROR
+ */
+DUCKDB_C_API DUCKDB_V2_ERROR duckdb_v2_file_close(duckdb_v2_file_handle file, duckdb_v2_error_info_handle *err);
+#endif
+
+#if DUCKDB_V2_API_ALLOW_UNSTABLE
+/*!
+ * Destroys the file, closing it if it is still open.
+ *
+ * Null-safe: passing a null pointer or null handle is a no-op. The handle is set to null on return to prevent
+ * double-destruction.
+ *
+ * history:
+ * - unstable: v2.0.0
+ *
+ * @param file The file to destroy.
+ * @return DUCKDB_V2_ERROR
+ */
+DUCKDB_C_API DUCKDB_V2_ERROR duckdb_v2_file_destroy(duckdb_v2_file_handle *file);
+#endif
+
+/* --- Struct definitions for file system --- */
+
+/* ============================================================================
+ * MODULE: function
+ * ============================================================================ */
+
+/* --- Enums for function --- */
+
+/* --- Struct forward declarations for function --- */
+
+/* --- Types for function --- */
+
+/*!
+ * A borrowed opaque handle to the call site a bind callback is binding. Every function family's bind callback receives
+ * this handle next to its own bind info. It gives access to the arguments of the call, the function's user data, and
+ * the bind data.
+ *
+ * The arguments form one list in four parts, in this order: one argument per positional-only and standard parameter, in
+ * declaration order; the arguments `*args` received, in call order; one argument per named-only parameter, in
+ * declaration order; and the arguments `**kwargs` received, in call order. How the caller passed an argument does not
+ * matter: a standard parameter passed by name is at its declared position. A parameter the call omitted is present with
+ * its default value. See `duckdb_v2_function_bind_get_arg_count()` for the size of each part.
+ */
+typedef struct _duckdb_v2_function_bind_info {
+	void *internal_ptr;
+} * duckdb_v2_function_bind_info_handle;
+
+/* --- Constants for function --- */
+
+/* --- Function pointer typedefs for function --- */
+
+/* --- Functions for function --- */
+
+#if DUCKDB_V2_API_ALLOW_UNSTABLE
+/*!
+ * Retrieves the user data set on the function being bound, e.g. via `duckdb_v2_scalar_function_set_user_data()`.
+ *
+ * history:
+ * - unstable: v2.0.0
+ *
+ * @param info The bind info handle.
+ * @param data Receives the user data pointer, or null if none was set.
+ * @param err Optional. On failure, receives an opaque info handle the caller must destroy via
+ * `duckdb_v2_error_info_destroy()`.
+ * @return DUCKDB_V2_ERROR
+ */
+DUCKDB_C_API DUCKDB_V2_ERROR duckdb_v2_function_bind_get_user_data(duckdb_v2_function_bind_info_handle info,
+                                                                   void **data, duckdb_v2_error_info_handle *err);
+#endif
+
+#if DUCKDB_V2_API_ALLOW_UNSTABLE
+/*!
+ * Sets the function's "bind data" from the bind callback.
+ *
+ * The bind data is stored with the bound call site and retrievable from every later callback. The opaque handle bundles
+ * the pointer with an optional destructor, invoked when the bind data is no longer needed, and an optional equality
+ * callback used when comparing two bound call sites; without one, pointer equality is used. Scalar functions set their
+ * bind data through `duckdb_v2_scalar_function_bind_set_bind_data()` instead.
+ *
+ * history:
+ * - unstable: v2.0.0
+ *
+ * @param info The bind info handle.
+ * @param data Opaque handle bundling the bind data pointer plus optional destructor and equality callbacks.
+ * @param err Optional. On failure, receives an opaque info handle the caller must destroy via
+ * `duckdb_v2_error_info_destroy()`.
+ * @return DUCKDB_V2_ERROR
+ */
+DUCKDB_C_API DUCKDB_V2_ERROR duckdb_v2_function_bind_set_bind_data(duckdb_v2_function_bind_info_handle info,
+                                                                   duckdb_v2_opaque *data,
+                                                                   duckdb_v2_error_info_handle *err);
+#endif
+
+#if DUCKDB_V2_API_ALLOW_UNSTABLE
+/*!
+ * Returns the number of arguments of the call site being bound, split into the four parts of the argument list.
+ *
+ * The parts follow each other in this order: the positional-only and standard parameters, the arguments `*args`
+ * received, the named-only parameters, and the arguments `**kwargs` received. The argument at index `i` of the
+ * named-only part is therefore at index `positional_fixed + positional_variadic + i`. Valid indices for the other
+ * argument functions are [0, the sum of the four counts). Every out-parameter may be NULL, in which case nothing is
+ * written to it.
+ *
+ * history:
+ * - unstable: v2.0.0
+ *
+ * @param info The bind info handle.
+ * @param positional_fixed Optional. Receives the number of positional-only and standard parameters.
+ * @param positional_variadic Optional. Receives the number of arguments `*args` received, 0 when the signature has
+ * none.
+ * @param named_fixed Optional. Receives the number of named-only parameters.
+ * @param named_variadic Optional. Receives the number of arguments `**kwargs` received, 0 when the signature has none.
+ * @param err Optional. On failure, receives an opaque info handle the caller must destroy via
+ * `duckdb_v2_error_info_destroy()`.
+ * @return DUCKDB_V2_ERROR
+ */
+DUCKDB_C_API DUCKDB_V2_ERROR duckdb_v2_function_bind_get_arg_count(duckdb_v2_function_bind_info_handle info,
+                                                                   idx_t *positional_fixed, idx_t *positional_variadic,
+                                                                   idx_t *named_fixed, idx_t *named_variadic,
+                                                                   duckdb_v2_error_info_handle *err);
+#endif
+
+#if DUCKDB_V2_API_ALLOW_UNSTABLE
+/*!
+ * Retrieves the type of the argument at the given index.
+ *
+ * Fails if the index is out of bounds. The returned type is owned by the caller and must be destroyed via
+ * `duckdb_v2_logical_type_destroy()`.
+ *
+ * history:
+ * - unstable: v2.0.0
+ *
+ * @param info The bind info handle.
+ * @param index The index of the argument.
+ * @param type Receives the argument type. Owned by the caller; destroy via `duckdb_v2_logical_type_destroy()`.
+ * @param err Optional. On failure, receives an opaque info handle the caller must destroy via
+ * `duckdb_v2_error_info_destroy()`.
+ * @return DUCKDB_V2_ERROR
+ */
+DUCKDB_C_API DUCKDB_V2_ERROR duckdb_v2_function_bind_get_arg_type(duckdb_v2_function_bind_info_handle info, idx_t index,
+                                                                  duckdb_v2_logical_type_handle *type,
+                                                                  duckdb_v2_error_info_handle *err);
+#endif
+
+#if DUCKDB_V2_API_ALLOW_UNSTABLE
+/*!
+ * Folds the argument at the given index to a constant value.
+ *
+ * Fails if the argument is not constant, e.g. a column reference, or if the index is out of bounds. The arguments of a
+ * table or pragma function are always constant. The resulting value may be NULL. The returned value is owned by the
+ * caller and must be destroyed via `duckdb_v2_value_destroy()`.
+ *
+ * history:
+ * - unstable: v2.0.0
+ *
+ * @param info The bind info handle.
+ * @param index The index of the argument.
+ * @param value Receives the constant value. Owned by the caller; destroy via `duckdb_v2_value_destroy()`.
+ * @param err Optional. On failure, receives an opaque info handle the caller must destroy via
+ * `duckdb_v2_error_info_destroy()`.
+ * @return DUCKDB_V2_ERROR
+ */
+DUCKDB_C_API DUCKDB_V2_ERROR duckdb_v2_function_bind_get_arg_value(duckdb_v2_function_bind_info_handle info,
+                                                                   idx_t index, duckdb_v2_value_handle *value,
+                                                                   duckdb_v2_error_info_handle *err);
+#endif
+
+#if DUCKDB_V2_API_ALLOW_UNSTABLE
+/*!
+ * Retrieves the name of the argument at the given index.
+ *
+ * For an argument of a declared parameter, this is the parameter name. For an argument `**kwargs` received, it is the
+ * name the caller passed, which may be the name of a positional-only parameter. An argument `*args` received has no
+ * name, and yields an empty name. Fails if the index is out of bounds. The name is borrowed and valid only for the
+ * duration of the callback.
+ *
+ * history:
+ * - unstable: v2.0.0
+ *
+ * @param info The bind info handle.
+ * @param index The index of the argument.
+ * @param name Receives a borrowed view of the argument name. Valid only for the duration of the callback.
+ * @param err Optional. On failure, receives an opaque info handle the caller must destroy via
+ * `duckdb_v2_error_info_destroy()`.
+ * @return DUCKDB_V2_ERROR
+ */
+DUCKDB_C_API DUCKDB_V2_ERROR duckdb_v2_function_bind_get_arg_name(duckdb_v2_function_bind_info_handle info, idx_t index,
+                                                                  duckdb_v2_identifier_t *name,
+                                                                  duckdb_v2_error_info_handle *err);
+#endif
+
+#if DUCKDB_V2_API_ALLOW_UNSTABLE
+/*!
+ * Looks up the index of an argument by name.
+ *
+ * Names are matched case-insensitively, against the names a caller can pass an argument by: those of the standard and
+ * named-only parameters, and those `**kwargs` received. Positional-only parameters are skipped, so `f(1, x := 2)` with
+ * a positional-only `x` finds the argument `**kwargs` received. A name the call did not pass is not an error: `found`
+ * receives false and `index` is left untouched. A standard or named-only parameter is always found, as the call either
+ * passed it or it carries its default value.
+ *
+ * history:
+ * - unstable: v2.0.0
+ *
+ * @param info The bind info handle.
+ * @param name The name to look up. Borrowed for the call only.
+ * @param index Receives the index of the argument, if found.
+ * @param found Receives whether the call has an argument of that name.
+ * @param err Optional. On failure, receives an opaque info handle the caller must destroy via
+ * `duckdb_v2_error_info_destroy()`.
+ * @return DUCKDB_V2_ERROR
+ */
+DUCKDB_C_API DUCKDB_V2_ERROR duckdb_v2_function_bind_get_arg_index(duckdb_v2_function_bind_info_handle info,
+                                                                   const duckdb_v2_identifier_t *name, idx_t *index,
+                                                                   bool *found, duckdb_v2_error_info_handle *err);
+#endif
+
+/* --- Struct definitions for function --- */
+
+/* ============================================================================
+ * MODULE: function docs
+ * ============================================================================ */
+
+/* --- Enums for function docs --- */
+
+/* --- Struct forward declarations for function docs --- */
+
+/* --- Types for function docs --- */
+
+/*!
+ * A borrowed opaque handle to the documentation of a function overload. Taken from the function it documents with
+ * `duckdb_v2_scalar_function_get_docs()`, `duckdb_v2_aggregate_function_get_docs()`,
+ * `duckdb_v2_table_function_get_docs()`, `duckdb_v2_pragma_function_get_docs()` or
+ * `duckdb_v2_macro_function_get_docs()`, and valid for as long as that function handle is; the caller never destroys
+ * it.
+ */
+typedef struct _duckdb_v2_function_docs {
+	void *internal_ptr;
+} * duckdb_v2_function_docs_handle;
+
+/* --- Constants for function docs --- */
+
+/* --- Function pointer typedefs for function docs --- */
+
+/* --- Functions for function docs --- */
+
+#if DUCKDB_V2_API_ALLOW_UNSTABLE
+/*!
+ * Sets the description of the function overload.
+ *
+ * The description is borrowed and copied. Calling this again replaces the previous description.
+ *
+ * history:
+ * - unstable: v2.0.0
+ *
+ * @param docs The documentation to set the description of.
+ * @param description The description to set. Borrowed and copied.
+ * @param err Optional. On failure, receives an opaque info handle the caller must destroy via
+ * `duckdb_v2_error_info_destroy()`.
+ * @return DUCKDB_V2_ERROR
+ */
+DUCKDB_C_API DUCKDB_V2_ERROR duckdb_v2_function_docs_set_description(duckdb_v2_function_docs_handle docs,
+                                                                     const duckdb_v2_str *description,
+                                                                     duckdb_v2_error_info_handle *err);
+#endif
+
+#if DUCKDB_V2_API_ALLOW_UNSTABLE
+/*!
+ * Adds an example of calling the function overload.
+ *
+ * The title and the example are borrowed and copied, and examples are reported in the order they were added.
+ *
+ * history:
+ * - unstable: v2.0.0
+ *
+ * @param docs The documentation to add the example to.
+ * @param title Optional. The title of the example; NULL or an empty view for none. Borrowed and copied.
+ * @param example The example, e.g. a SQL expression calling the function. Borrowed and copied.
+ * @param err Optional. On failure, receives an opaque info handle the caller must destroy via
+ * `duckdb_v2_error_info_destroy()`.
+ * @return DUCKDB_V2_ERROR
+ */
+DUCKDB_C_API DUCKDB_V2_ERROR duckdb_v2_function_docs_add_example(duckdb_v2_function_docs_handle docs,
+                                                                 const duckdb_v2_str *title,
+                                                                 const duckdb_v2_str *example,
+                                                                 duckdb_v2_error_info_handle *err);
+#endif
+
+#if DUCKDB_V2_API_ALLOW_UNSTABLE
+/*!
+ * Adds a category the function overload belongs to, e.g. "string" or "aggregate".
+ *
+ * The category is borrowed and copied, and categories are reported in the order they were added.
+ *
+ * history:
+ * - unstable: v2.0.0
+ *
+ * @param docs The documentation to add the category to.
+ * @param category The category. Borrowed and copied.
+ * @param err Optional. On failure, receives an opaque info handle the caller must destroy via
+ * `duckdb_v2_error_info_destroy()`.
+ * @return DUCKDB_V2_ERROR
+ */
+DUCKDB_C_API DUCKDB_V2_ERROR duckdb_v2_function_docs_add_category(duckdb_v2_function_docs_handle docs,
+                                                                  const duckdb_v2_str *category,
+                                                                  duckdb_v2_error_info_handle *err);
+#endif
+
+/* --- Struct definitions for function docs --- */
+
+/* ============================================================================
+ * MODULE: function signature
+ * ============================================================================ */
+
+/* --- Enums for function signature --- */
+
+/*!
+ * How a caller passes the argument for a parameter, following Python's parameter kinds. A signature orders its
+ * parameters by kind, in the order the values are listed here. Pass one of these to
+ * `duckdb_v2_function_signature_add_parameter()`.
+ */
+typedef enum DUCKDB_V2_FUNCTION_PARAMETER_KIND {
+	/*!
+	 * Passed by position only. The name is invisible to a caller: a named argument with the same name is received by
+	 * `**kwargs`, or rejected when the signature has none.
+	 */
+	DUCKDB_V2_FUNCTION_PARAMETER_KIND_POSITIONAL_ONLY = 0,
+
+	//! Passed by position or by name.
+	DUCKDB_V2_FUNCTION_PARAMETER_KIND_STANDARD = 1,
+
+	/*!
+	 * `*args`: receives the positional arguments left over after the positional-only and standard parameters, each cast
+	 * to the parameter type. ANY leaves them un-cast.
+	 */
+	DUCKDB_V2_FUNCTION_PARAMETER_KIND_POSITIONAL_VARIADIC = 2,
+
+	//! Passed by name only.
+	DUCKDB_V2_FUNCTION_PARAMETER_KIND_NAMED_ONLY = 3,
+
+	/*!
+	 * `**kwargs`: receives the named arguments that match no other parameter, each cast to the parameter type. ANY
+	 * leaves them un-cast.
+	 */
+	DUCKDB_V2_FUNCTION_PARAMETER_KIND_NAMED_VARIADIC = 4,
+	DUCKDB_V2_FUNCTION_PARAMETER_KIND_MAX_ENUM = 0x7FFFFFFF,
+} DUCKDB_V2_FUNCTION_PARAMETER_KIND;
+
+/* --- Struct forward declarations for function signature --- */
+
+/* --- Types for function signature --- */
+
+//! An opaque handle to a function signature. Carries the function's parameters and return type.
+typedef struct _duckdb_v2_function_signature {
+	void *internal_ptr;
+} * duckdb_v2_function_signature_handle;
+
+/* --- Constants for function signature --- */
+
+/* --- Function pointer typedefs for function signature --- */
+
+/* --- Functions for function signature --- */
+
+#if DUCKDB_V2_API_ALLOW_UNSTABLE
+/*!
+ * Adds a parameter to a signature.
+ *
+ * The kind decides how a caller passes the argument; see `DUCKDB_V2_FUNCTION_PARAMETER_KIND`. The signature keeps its
+ * parameters ordered by kind, and parameters of the same kind in the order they were added, so parameters of different
+ * kinds can be added in any order. A default value makes the parameter optional; `*args` and `**kwargs` cannot have
+ * one.
+ *
+ * Registration fails when two parameters share a name, when the signature has more than one `*args` or `**kwargs`
+ * parameter, or when a standard parameter without a default value follows one with a default value.
+ *
+ * history:
+ * - unstable: v2.0.0
+ *
+ * @param sig The signature to configure.
+ * @param name The parameter name. Borrowed and copied.
+ * @param type The parameter type. ANY accepts an argument of any type without casting it. Borrowed and copied.
+ * @param value Optional default value, borrowed and copied. Will be cast to the parameter type.
+ * @param kind How a caller passes the argument for the parameter.
+ * @param err Optional. On failure, receives an opaque info handle the caller must destroy via
+ * `duckdb_v2_error_info_destroy()`.
+ * @return DUCKDB_V2_ERROR
+ */
+DUCKDB_C_API DUCKDB_V2_ERROR duckdb_v2_function_signature_add_parameter(
+    duckdb_v2_function_signature_handle sig, const duckdb_v2_identifier_t *name, duckdb_v2_logical_type_handle type,
+    duckdb_v2_value_handle value, DUCKDB_V2_FUNCTION_PARAMETER_KIND kind, duckdb_v2_error_info_handle *err);
+#endif
+
+#if DUCKDB_V2_API_ALLOW_UNSTABLE
+/*!
+ * Sets the return type of a signature.
+ *
+ * Sets the signature's return type. The type is borrowed and copied. Calling this again overwrites the previous return
+ * type. An INVALID type is rejected with ERROR_INPUT_INVALID. Whether a concrete return type is required, and whether
+ * ANY is accepted, depends on the function family and is enforced when the signature is registered with a builder.
+ *
+ * history:
+ * - unstable: v2.0.0
+ *
+ * @param sig The signature to configure.
+ * @param type The return type. Borrowed and copied.
+ * @param err Optional. On failure, receives an opaque info handle the caller must destroy via error_info_destroy.
+ * @return DUCKDB_V2_ERROR
+ */
+DUCKDB_C_API DUCKDB_V2_ERROR duckdb_v2_function_signature_set_return_type(duckdb_v2_function_signature_handle sig,
+                                                                          duckdb_v2_logical_type_handle type,
+                                                                          duckdb_v2_error_info_handle *err);
+#endif
+
+/* --- Struct definitions for function signature --- */
+
+/* ============================================================================
+ * MODULE: identifier
+ * ============================================================================ */
+
+/* --- Enums for identifier --- */
+
+/* --- Struct forward declarations for identifier --- */
+
+/* --- Types for identifier --- */
+
+/* --- Constants for identifier --- */
+
+/* --- Function pointer typedefs for identifier --- */
+
+/* --- Functions for identifier --- */
+
+#if DUCKDB_V2_API_ALLOW_UNSTABLE
+/*!
+ * Renders a name as a SQL identifier, quoting and escaping only when required.
+ *
+ * Produces the SQL text for the name: the name itself when it is already a legal bare identifier, or the name
+ * double-quoted with interior double quotes doubled when it is a keyword or contains characters that require quoting.
+ * This is the engine's own identifier rendering, so the result parses back to a name equal to the input.
+ *
+ * Writes into a caller-supplied buffer, so nothing is allocated on the caller's behalf and nothing has to be freed.
+ * Pass out_text = NULL to size the buffer without rendering into it: out_length then receives the length, and
+ * out_capacity is ignored. With out_text != NULL, out_capacity must be at least out_length + 1, or the call returns
+ * ERROR_INPUT_OBJECT_SIZE with out_length set to the required length and out_text left untouched.
+ *
+ * out_length never counts the terminator, but a successful write always appends one, so the buffer is usable as a C
+ * string.
+ *
+ * history:
+ * - unstable: v2.0.0
+ *
+ * @param name The name to render. Borrowed for the call only.
+ * @param out_text Caller-owned buffer receiving the text plus a null terminator, or NULL to only report the required
+ * length in out_length.
+ * @param out_capacity Bytes available in out_text, terminator included. Ignored when out_text is NULL.
+ * @param out_length Receives the text length excluding the null terminator — written on success and on
+ * ERROR_INPUT_OBJECT_SIZE.
+ * @param err Optional. On failure, receives an opaque info handle the caller must destroy via
+ * `duckdb_v2_error_info_destroy()`.
+ * @return DUCKDB_V2_ERROR
+ */
+DUCKDB_C_API DUCKDB_V2_ERROR duckdb_v2_identifier_render_quoted(const duckdb_v2_identifier_t *name, char *out_text,
+                                                                idx_t out_capacity, idx_t *out_length,
+                                                                duckdb_v2_error_info_handle *err);
+#endif
+
+/* --- Struct definitions for identifier --- */
+
+/* ============================================================================
+ * MODULE: instance
+ * ============================================================================ */
+
+/* --- Enums for instance --- */
+
+/* --- Struct forward declarations for instance --- */
+
+/* --- Types for instance --- */
+
+/*!
+ * An opaque, owned handle to the `(KEY value)` options of one `duckdb_v2_instance_attach()` call, as SQL `ATTACH`
+ * accepts them. Created from the instance handle it will be used with via `duckdb_v2_attach_options_create()`; destroy
+ * it via `duckdb_v2_attach_options_destroy()`.
+ */
+typedef struct _duckdb_v2_attach_options {
+	void *internal_ptr;
+} * duckdb_v2_attach_options_handle;
+
+/* --- Constants for instance --- */
+
+/* --- Function pointer typedefs for instance --- */
+
+/* --- Functions for instance --- */
+
+#if DUCKDB_V2_API_ALLOW_UNSTABLE
+/*!
+ * Creates an instance under the environment with no startup options.
+ *
+ * The instance is ready on return, with no database attached: attach one with `duckdb_v2_instance_attach()` and pick
+ * the default with `duckdb_v2_instance_set_default()`, or connect with `duckdb_v2_connection_create()`. To choose an
+ * option that cannot change once the instance exists, such as access_mode, use
+ * `duckdb_v2_instance_create_with_options()` instead. The caller destroys the instance via
+ * `duckdb_v2_instance_destroy()`.
+ *
+ * history:
+ * - unstable: v2.0.0
+ *
+ * @param env The environment.
+ * @param out_instance Receives the new instance handle.
+ * @param err Optional. On failure, receives an opaque info handle the caller must destroy via
+ * `duckdb_v2_error_info_destroy()`.
+ * @return DUCKDB_V2_ERROR
+ */
+DUCKDB_C_API DUCKDB_V2_ERROR duckdb_v2_instance_create(duckdb_v2_environment_handle env,
+                                                       duckdb_v2_instance_handle *out_instance,
+                                                       duckdb_v2_error_info_handle *err);
+#endif
+
+#if DUCKDB_V2_API_ALLOW_UNSTABLE
+/*!
+ * Creates an instance under the environment, configured with startup options.
+ *
+ * Behaves as `duckdb_v2_instance_create()`, applying the startup options first.
+ *
+ * Startup options are (name, value) pairs in two parallel arrays, the values in the textual form SQL `SET` accepts.
+ * They are the only way to choose an option that cannot change once the instance exists, such as access_mode or
+ * allow_unsigned_extensions; every other option can be written now or later through `duckdb_v2_instance_get_config()`.
+ * An option that needs a running instance (the logging options, allowed_directories, allowed_paths,
+ * disabled_filesystems) returns ERROR_INPUT_INVALID here: write it through the instance's config after creation. A name
+ * no core option or loaded extension defines is kept for an extension to consume while the instance starts up, and
+ * creation fails with the names none claimed. The caller destroys the instance via `duckdb_v2_instance_destroy()`.
+ *
+ * history:
+ * - unstable: v2.0.0
+ *
+ * @param env The environment.
+ * @param option_names Optional. An array of option_count option names (canonical or alias). Pass NULL when option_count
+ * is 0.
+ * @param option_values Optional. An array of option_count values, parallel to option_names, in the textual form SQL
+ * `SET` accepts. Pass NULL when option_count is 0.
+ * @param option_count The number of startup options.
+ * @param out_instance Receives the new instance handle.
+ * @param err Optional. On failure, receives an opaque info handle the caller must destroy via
+ * `duckdb_v2_error_info_destroy()`.
+ * @return DUCKDB_V2_ERROR
+ */
+DUCKDB_C_API DUCKDB_V2_ERROR duckdb_v2_instance_create_with_options(
+    duckdb_v2_environment_handle env, const duckdb_v2_str *option_names, const duckdb_v2_str *option_values,
+    idx_t option_count, duckdb_v2_instance_handle *out_instance, duckdb_v2_error_info_handle *err);
+#endif
+
+#if DUCKDB_V2_API_ALLOW_UNSTABLE
+/*!
+ * Destroys the instance handle.
+ *
+ * Always succeeds. Every attached database is closed with the instance. The instance itself stays alive for as long as
+ * any connection still references it; when the last reference drops, it is destroyed and its database files become
+ * available to open again. On success the handle is set to null. Safe to call on an already-null slot.
+ *
+ * history:
+ * - unstable: v2.0.0
+ *
+ * @param instance The instance handle to destroy.
+ * @return DUCKDB_V2_ERROR
+ */
+DUCKDB_C_API DUCKDB_V2_ERROR duckdb_v2_instance_destroy(duckdb_v2_instance_handle *instance);
+#endif
+
+#if DUCKDB_V2_API_ALLOW_UNSTABLE
+/*!
+ * Attaches a database to the instance.
+ *
+ * Attaches the database at `path` exactly like `ATTACH 'path'`:
+ *   - `:memory:` or an empty view attaches a fresh in-memory database.
+ *   - any other path attaches that file, creating it if it does not exist.
+ * `name` is the name to attach under, like `ATTACH ... AS name`; it is how `duckdb_v2_instance_detach()` and
+ * `duckdb_v2_instance_set_default()` refer to the database. Null, or an empty view, derives the name from the path the
+ * way SQL `ATTACH` without `AS` does:
+ *   - `memory` for `:memory:` or an empty view;
+ *   - otherwise the file name up to its first `.`, without any `?query` parameters (`/data/sales.2024.db` attaches as
+ * `sales`), with `_db` appended when that is a reserved name such as `system` or `temp`. Naming is how two files with
+ * the same base name, or `:memory:` twice, attach side by side. `options` may be null; it carries the `(KEY value)`
+ * options of SQL `ATTACH`, for per-database options such as READ_ONLY, BLOCK_SIZE or ENCRYPTION_KEY, and must have been
+ * created from this instance handle. `make_default` makes the attached database the default for connections created
+ * afterwards, exactly as a `duckdb_v2_instance_set_default()` call right after the attach would; otherwise the default
+ * is left alone. A path that is already attached on this or any other instance of the environment returns
+ * ERROR_RESOURCE_IN_USE, and a name that is already attached fails. Options that only apply at startup are passed to
+ * `duckdb_v2_instance_create_with_options()`.
+ *
+ * history:
+ * - unstable: v2.0.0
+ *
+ * @param instance The instance handle.
+ * @param name Optional. The name to attach under; null or an empty view for the name derived from the path. Borrowed
+ * and copied.
+ * @param path Path to the database file, or `:memory:` / an empty view for an in-memory database.
+ * @param options Optional attach options created from `instance`, or null to attach with defaults under the derived
+ * name.
+ * @param make_default Whether to make the attached database the default for connections created afterwards.
+ * @param err Optional. On failure, receives an opaque info handle the caller must destroy via
+ * `duckdb_v2_error_info_destroy()`.
+ * @return DUCKDB_V2_ERROR
+ */
+DUCKDB_C_API DUCKDB_V2_ERROR duckdb_v2_instance_attach(duckdb_v2_instance_handle instance,
+                                                       const duckdb_v2_identifier_t *name, const duckdb_v2_str *path,
+                                                       duckdb_v2_attach_options_handle options, bool make_default,
+                                                       duckdb_v2_error_info_handle *err);
+#endif
+
+#if DUCKDB_V2_API_ALLOW_UNSTABLE
+/*!
+ * Detaches the database attached under `name`.
+ *
+ * Detaches it like `DETACH`, checkpointing a file database first. Unlike SQL, the default database may be detached too;
+ * new connections then start without a default until `duckdb_v2_instance_set_default()` names another, and existing
+ * connections bound to it keep it alive until their transaction on it ends and fail unqualified DDL afterwards. Returns
+ * ERROR_INPUT_INVALID when no database is attached under that name. Connections that still reference the database keep
+ * it alive until they release it.
+ *
+ * history:
+ * - unstable: v2.0.0
+ *
+ * @param instance The instance handle.
+ * @param name The name the database is attached under. Borrowed.
+ * @param err Optional. On failure, receives an opaque info handle the caller must destroy via
+ * `duckdb_v2_error_info_destroy()`.
+ * @return DUCKDB_V2_ERROR
+ */
+DUCKDB_C_API DUCKDB_V2_ERROR duckdb_v2_instance_detach(duckdb_v2_instance_handle instance,
+                                                       const duckdb_v2_identifier_t *name,
+                                                       duckdb_v2_error_info_handle *err);
+#endif
+
+#if DUCKDB_V2_API_ALLOW_UNSTABLE
+/*!
+ * Makes the database attached under `name` the default database for connections created from now on.
+ *
+ * A connection binds to the default database when it is created, so this does not retarget existing connections: their
+ * default stays what it was when they connected, or what they chose with `USE`. The default is where unqualified DDL
+ * and unqualified table lookups that miss the temporary catalog go. It stays the default for new connections until
+ * another `duckdb_v2_instance_set_default()` call or until it is detached; a connection whose default has been detached
+ * fails unqualified DDL with a message saying so until it selects another with `USE`. Returns ERROR_INPUT_INVALID when
+ * no database is attached under that name.
+ *
+ * history:
+ * - unstable: v2.0.0
+ *
+ * @param instance The instance handle.
+ * @param name The name the database is attached under. Borrowed.
+ * @param err Optional. On failure, receives an opaque info handle the caller must destroy via
+ * `duckdb_v2_error_info_destroy()`.
+ * @return DUCKDB_V2_ERROR
+ */
+DUCKDB_C_API DUCKDB_V2_ERROR duckdb_v2_instance_set_default(duckdb_v2_instance_handle instance,
+                                                            const duckdb_v2_identifier_t *name,
+                                                            duckdb_v2_error_info_handle *err);
+#endif
+
+#if DUCKDB_V2_API_ALLOW_UNSTABLE
+/*!
+ * Creates an empty set of attach options for use with `duckdb_v2_instance_attach()` on `instance`.
+ *
+ * Starts empty. The caller destroys it via `duckdb_v2_attach_options_destroy()`; the options may be destroyed as soon
+ * as the attach call returns, and reused for further attaches before that.
+ *
+ * history:
+ * - unstable: v2.0.0
+ *
+ * @param instance The instance handle the options will be used with.
+ * @param out_options Receives the new options handle.
+ * @param err Optional. On failure, receives an opaque info handle the caller must destroy via
+ * `duckdb_v2_error_info_destroy()`.
+ * @return DUCKDB_V2_ERROR
+ */
+DUCKDB_C_API DUCKDB_V2_ERROR duckdb_v2_attach_options_create(duckdb_v2_instance_handle instance,
+                                                             duckdb_v2_attach_options_handle *out_options,
+                                                             duckdb_v2_error_info_handle *err);
+#endif
+
+#if DUCKDB_V2_API_ALLOW_UNSTABLE
+/*!
+ * Sets one attach option, like a `(KEY value)` entry of SQL `ATTACH`.
+ *
+ * The key is matched case-insensitively, as an unquoted SQL identifier is. The setting is passed on as the text a
+ * quoted SQL literal would produce: the engine casts the options it knows (READ_ONLY, RECOVERY_MODE, TYPE,
+ * DEFAULT_TABLE, VACUUM_REBUILD_INDEXES, BLOCK_SIZE, ENCRYPTION_KEY, ...) and hands the rest to the storage extension
+ * that ends up owning the database, which decides what they mean. Keys must be valid UTF-8; an unknown or ill-typed
+ * option fails the attach. Both views are borrowed and copied. Setting the same key again replaces it.
+ *
+ * history:
+ * - unstable: v2.0.0
+ *
+ * @param options The attach options.
+ * @param key The option name, e.g. READ_ONLY.
+ * @param setting The option value, in the textual form a quoted SQL literal would carry.
+ * @param err Optional. On failure, receives an opaque info handle the caller must destroy via
+ * `duckdb_v2_error_info_destroy()`.
+ * @return DUCKDB_V2_ERROR
+ */
+DUCKDB_C_API DUCKDB_V2_ERROR duckdb_v2_attach_options_set(duckdb_v2_attach_options_handle options,
+                                                          const duckdb_v2_identifier_t *key,
+                                                          const duckdb_v2_str *setting,
+                                                          duckdb_v2_error_info_handle *err);
+#endif
+
+#if DUCKDB_V2_API_ALLOW_UNSTABLE
+/*!
+ * Destroys an attach options handle.
+ *
+ * On success the slot is set to null. Safe to call on an already-null slot.
+ *
+ * history:
+ * - unstable: v2.0.0
+ *
+ * @param options The attach options to destroy.
+ * @return DUCKDB_V2_ERROR
+ */
+DUCKDB_C_API DUCKDB_V2_ERROR duckdb_v2_attach_options_destroy(duckdb_v2_attach_options_handle *options);
+#endif
+
+#if DUCKDB_V2_API_ALLOW_UNSTABLE
+/*!
+ * Returns the version of the linked DuckDB library.
+ *
+ * history:
+ * - unstable: v2.0.0
+ *
+ * @param out_version The version string.
+ * @param err Optional. On failure, receives an opaque info handle the caller must destroy via
+ * `duckdb_v2_error_info_destroy()`.
+ * @return DUCKDB_V2_ERROR
+ */
+DUCKDB_C_API DUCKDB_V2_ERROR duckdb_v2_library_version(duckdb_v2_str *out_version, duckdb_v2_error_info_handle *err);
+#endif
+
+/* --- Struct definitions for instance --- */
+
+/* ============================================================================
+ * MODULE: logging
+ * ============================================================================ */
+
+/* --- Enums for logging --- */
+
+/*!
+ * Severity of a log message. Mirrors DuckDB's own log levels, and is compared against the configured threshold: an
+ * entry below it is dropped.
+ */
+typedef enum DUCKDB_V2_LOG_LEVEL {
+	//! Finest detail; off in any default configuration.
+	DUCKDB_V2_LOG_LEVEL_TRACE = 10,
+
+	//! Diagnostic detail.
+	DUCKDB_V2_LOG_LEVEL_DEBUG = 20,
+
+	//! Ordinary progress information.
+	DUCKDB_V2_LOG_LEVEL_INFO = 30,
+
+	//! A recoverable problem.
+	DUCKDB_V2_LOG_LEVEL_WARNING = 40,
+
+	//! An operation failed.
+	DUCKDB_V2_LOG_LEVEL_ERROR = 50,
+
+	//! An unrecoverable failure.
+	DUCKDB_V2_LOG_LEVEL_FATAL = 60,
+	DUCKDB_V2_LOG_LEVEL_MAX_ENUM = 0x7FFFFFFF,
+} DUCKDB_V2_LOG_LEVEL;
+
+/* --- Struct forward declarations for logging --- */
+
+/* --- Types for logging --- */
+
+/* --- Constants for logging --- */
+
+/* --- Function pointer typedefs for logging --- */
+
+/* --- Functions for logging --- */
+
+#if DUCKDB_V2_API_ALLOW_UNSTABLE
+/*!
+ * Writes a message to DuckDB's log.
+ *
+ * The entry is attributed to the context's connection scope, so it carries that connection's ids. Whether it is
+ * recorded at all is up to the database's log configuration: if logging is off, or level is below the configured
+ * threshold, or log_type is not among the enabled types, the call succeeds and writes nothing. An empty log_type
+ * selects the default type. Read entries back with `SELECT * FROM duckdb_logs`.
+ *
+ * history:
+ * - unstable: v2.0.0
+ *
+ * @param ctx The context to log through.
+ * @param level Severity of the message.
+ * @param log_type The log type to record under, matched case-sensitively. Empty selects the default type.
+ * @param message The message body. Borrowed for the call only.
+ * @param err Optional. On failure, receives an opaque info handle the caller must destroy via error_info_destroy.
+ * @return DUCKDB_V2_ERROR
+ */
+DUCKDB_C_API DUCKDB_V2_ERROR duckdb_v2_context_log(duckdb_v2_context_handle ctx, DUCKDB_V2_LOG_LEVEL level,
+                                                   const duckdb_v2_str *log_type, const duckdb_v2_str *message,
+                                                   duckdb_v2_error_info_handle *err);
+#endif
+
+#if DUCKDB_V2_API_ALLOW_UNSTABLE
+/*!
+ * Writes a message to DuckDB's log.
+ *
+ * The entry is attributed to the database scope: it carries no connection or query ids. Whether it is recorded at all
+ * is up to the database's log configuration: if logging is off, or level is below the configured threshold, or log_type
+ * is not among the enabled types, the call succeeds and writes nothing. An empty log_type selects the default type.
+ * Read entries back with `SELECT * FROM duckdb_logs`.
+ *
+ * history:
+ * - unstable: v2.0.0
+ *
+ * @param instance The instance to log through.
+ * @param level Severity of the message.
+ * @param log_type The log type to record under, matched case-sensitively. Empty selects the default type.
+ * @param message The message body. Borrowed for the call only.
+ * @param err Optional. On failure, receives an opaque info handle the caller must destroy via error_info_destroy.
+ * @return DUCKDB_V2_ERROR
+ */
+DUCKDB_C_API DUCKDB_V2_ERROR duckdb_v2_instance_log(duckdb_v2_instance_handle instance, DUCKDB_V2_LOG_LEVEL level,
+                                                    const duckdb_v2_str *log_type, const duckdb_v2_str *message,
+                                                    duckdb_v2_error_info_handle *err);
+#endif
+
+#if DUCKDB_V2_API_ALLOW_UNSTABLE
+/*!
+ * Writes a message to DuckDB's log.
+ *
+ * The entry is attributed to the connection scope, so it carries the connection's ids. Whether it is recorded at all is
+ * up to the database's log configuration: if logging is off, or level is below the configured threshold, or log_type is
+ * not among the enabled types, the call succeeds and writes nothing. An empty log_type selects the default type. Read
+ * entries back with `SELECT * FROM duckdb_logs`.
+ *
+ * history:
+ * - unstable: v2.0.0
+ *
+ * @param conn The connection to log through.
+ * @param level Severity of the message.
+ * @param log_type The log type to record under, matched case-sensitively. Empty selects the default type.
+ * @param message The message body. Borrowed for the call only.
+ * @param err Optional. On failure, receives an opaque info handle the caller must destroy via error_info_destroy.
+ * @return DUCKDB_V2_ERROR
+ */
+DUCKDB_C_API DUCKDB_V2_ERROR duckdb_v2_connection_log(duckdb_v2_connection_handle conn, DUCKDB_V2_LOG_LEVEL level,
+                                                      const duckdb_v2_str *log_type, const duckdb_v2_str *message,
+                                                      duckdb_v2_error_info_handle *err);
+#endif
+
+/* --- Struct definitions for logging --- */
+
+/* ============================================================================
+ * MODULE: qname
+ * ============================================================================ */
+
+/* --- Enums for qname --- */
+
+/* --- Struct forward declarations for qname --- */
+
+/* --- Types for qname --- */
+
+/*!
+ * An owned qualified name: an ordered path of one to three non-empty identifier parts whose last element is the object
+ * name. Construct with `duckdb_v2_qname_parse()` or `duckdb_v2_qname_create()`, read with
+ * `duckdb_v2_qname_get_part_count()` and `duckdb_v2_qname_get_part()`, render back to SQL with
+ * `duckdb_v2_qname_render()`, compare with `duckdb_v2_qname_equals()`, and destroy with `duckdb_v2_qname_destroy()`.
+ * Two handles are compared with `duckdb_v2_qname_equals()`, never by pointer.
+ */
+typedef struct _duckdb_v2_qname {
+	void *internal_ptr;
+} * duckdb_v2_qname_handle;
+
+/* --- Constants for qname --- */
+
+/* --- Function pointer typedefs for qname --- */
+
+/* --- Functions for qname --- */
+
+#if DUCKDB_V2_API_ALLOW_UNSTABLE
+/*!
+ * Parses SQL text into a qualified name.
+ *
+ * Applies the engine's qualified-name rules: dots separate parts, and a double-quoted part may contain dots and doubled
+ * interior quotes. More than three parts and an unterminated quote are rejected with the parser's own error. Invalid
+ * UTF-8 and text without at least one non-empty part are rejected with `ERROR_INPUT_INVALID`. When the parts are
+ * already separate, build the name with `duckdb_v2_qname_create()` rather than joining them and parsing the result.
+ *
+ * history:
+ * - unstable: v2.0.0
+ *
+ * @param text The name text to parse. Borrowed for the call only.
+ * @param name On success, receives the qualified name. Owned by the caller; destroy via `duckdb_v2_qname_destroy()`.
+ * @param err Optional. On failure, receives an opaque info handle the caller must destroy via
+ * `duckdb_v2_error_info_destroy()`.
+ * @return DUCKDB_V2_ERROR
+ */
+DUCKDB_C_API DUCKDB_V2_ERROR duckdb_v2_qname_parse(const duckdb_v2_str *text, duckdb_v2_qname_handle *name,
+                                                   duckdb_v2_error_info_handle *err);
+#endif
+
+#if DUCKDB_V2_API_ALLOW_UNSTABLE
+/*!
+ * Creates a qualified name from its parts.
+ *
+ * The parts are ordered outermost first, so the last one is the object name. Between one and three parts are accepted
+ * -- the engine qualifies at most catalog.schema.name today -- and every part must be non-empty: partial qualification
+ * is expressed by passing fewer parts, never by empty placeholders. Zero parts, more than three, and an empty part are
+ * all rejected with `ERROR_INPUT_INVALID`. The parts are borrowed and copied.
+ *
+ * history:
+ * - unstable: v2.0.0
+ *
+ * @param parts An array of `part_count` non-empty identifier views, outermost first.
+ * @param part_count The number of parts, between one and three.
+ * @param name On success, receives the qualified name. Owned by the caller; destroy via `duckdb_v2_qname_destroy()`.
+ * @param err Optional. On failure, receives an opaque info handle the caller must destroy via
+ * `duckdb_v2_error_info_destroy()`.
+ * @return DUCKDB_V2_ERROR
+ */
+DUCKDB_C_API DUCKDB_V2_ERROR duckdb_v2_qname_create(const duckdb_v2_identifier_t *parts, idx_t part_count,
+                                                    duckdb_v2_qname_handle *name, duckdb_v2_error_info_handle *err);
+#endif
+
+#if DUCKDB_V2_API_ALLOW_UNSTABLE
+/*!
+ * Returns how many parts the qualified name has.
+ *
+ * Always at least one. Valid indices for `duckdb_v2_qname_get_part()` are [0, count), and the object name is the part
+ * at count - 1.
+ *
+ * history:
+ * - unstable: v2.0.0
+ *
+ * @param name The qualified name.
+ * @param count Receives the number of parts.
+ * @param err Optional. On failure, receives an opaque info handle the caller must destroy via
+ * `duckdb_v2_error_info_destroy()`.
+ * @return DUCKDB_V2_ERROR
+ */
+DUCKDB_C_API DUCKDB_V2_ERROR duckdb_v2_qname_get_part_count(duckdb_v2_qname_handle name, idx_t *count,
+                                                            duckdb_v2_error_info_handle *err);
+#endif
+
+#if DUCKDB_V2_API_ALLOW_UNSTABLE
+/*!
+ * Borrows one part of the qualified name.
+ *
+ * Parts are ordered outermost first, so the object name is the part at `duckdb_v2_qname_get_part_count()` - 1. The view
+ * is valid until the qualified name is destroyed. An index outside [0, count) is rejected with
+ * `ERROR_INPUT_OUT_OF_RANGE`.
+ *
+ * history:
+ * - unstable: v2.0.0
+ *
+ * @param name The qualified name.
+ * @param index Zero-based part index.
+ * @param part Receives a borrowed view of the part, valid until the qualified name is destroyed.
+ * @param err Optional. On failure, receives an opaque info handle the caller must destroy via
+ * `duckdb_v2_error_info_destroy()`.
+ * @return DUCKDB_V2_ERROR
+ */
+DUCKDB_C_API DUCKDB_V2_ERROR duckdb_v2_qname_get_part(duckdb_v2_qname_handle name, idx_t index,
+                                                      duckdb_v2_identifier_t *part, duckdb_v2_error_info_handle *err);
+#endif
+
+#if DUCKDB_V2_API_ALLOW_UNSTABLE
+/*!
+ * Renders the qualified name as SQL text.
+ *
+ * Joins the parts with dots, quoting and escaping each one only where the identifier requires it, so the result parses
+ * back through `duckdb_v2_qname_parse()` to an equal name.
+ *
+ * Writes into a caller-supplied buffer, so nothing is allocated on the caller's behalf and nothing has to be freed.
+ * Pass out_text = NULL to size the buffer without rendering into it: out_length then receives the length, and
+ * out_capacity is ignored. With out_text != NULL, out_capacity must be at least out_length + 1, or the call returns
+ * ERROR_INPUT_OBJECT_SIZE with out_length set to the required length and out_text left untouched.
+ *
+ * out_length never counts the terminator, but a successful write always appends one, so the buffer is usable as a C
+ * string.
+ *
+ * history:
+ * - unstable: v2.0.0
+ *
+ * @param name The qualified name to render.
+ * @param out_text Caller-owned buffer receiving the text plus a null terminator, or NULL to only report the required
+ * length in out_length.
+ * @param out_capacity Bytes available in out_text, terminator included. Ignored when out_text is NULL.
+ * @param out_length Receives the text length excluding the null terminator — written on success and on
+ * ERROR_INPUT_OBJECT_SIZE.
+ * @param err Optional. On failure, receives an opaque info handle the caller must destroy via
+ * `duckdb_v2_error_info_destroy()`.
+ * @return DUCKDB_V2_ERROR
+ */
+DUCKDB_C_API DUCKDB_V2_ERROR duckdb_v2_qname_render(duckdb_v2_qname_handle name, char *out_text, idx_t out_capacity,
+                                                    idx_t *out_length, duckdb_v2_error_info_handle *err);
+#endif
+
+#if DUCKDB_V2_API_ALLOW_UNSTABLE
+/*!
+ * Compares two qualified names.
+ *
+ * True when both have the same number of parts and every part matches case-insensitively, which is the engine's own
+ * identifier equality: casing never distinguishes two names. This is the only way to compare names; two handles holding
+ * equal names are still distinct pointers.
+ *
+ * history:
+ * - unstable: v2.0.0
+ *
+ * @param left The first qualified name.
+ * @param right The second qualified name.
+ * @param result Receives whether the two names are equal.
+ * @param err Optional. On failure, receives an opaque info handle the caller must destroy via
+ * `duckdb_v2_error_info_destroy()`.
+ * @return DUCKDB_V2_ERROR
+ */
+DUCKDB_C_API DUCKDB_V2_ERROR duckdb_v2_qname_equals(duckdb_v2_qname_handle left, duckdb_v2_qname_handle right,
+                                                    bool *result, duckdb_v2_error_info_handle *err);
+#endif
+
+#if DUCKDB_V2_API_ALLOW_UNSTABLE
+/*!
+ * Hashes a qualified name.
+ *
+ * Consistent with `duckdb_v2_qname_equals()`: names that compare equal hash equal, casing differences included. The
+ * value is not stable across processes or library versions, so use it for in-process lookup tables only and never
+ * persist it.
+ *
+ * history:
+ * - unstable: v2.0.0
+ *
+ * @param name The qualified name to hash.
+ * @param hash Receives the hash value.
+ * @param err Optional. On failure, receives an opaque info handle the caller must destroy via
+ * `duckdb_v2_error_info_destroy()`.
+ * @return DUCKDB_V2_ERROR
+ */
+DUCKDB_C_API DUCKDB_V2_ERROR duckdb_v2_qname_hash(duckdb_v2_qname_handle name, uint64_t *hash,
+                                                  duckdb_v2_error_info_handle *err);
+#endif
+
+#if DUCKDB_V2_API_ALLOW_UNSTABLE
+/*!
+ * Destroys the qualified name, releasing its resources.
+ *
+ * Null-safe: passing a null pointer or null handle is a no-op. The handle is set to null on return to prevent
+ * double-destruction. Any part views borrowed from it become dangling.
+ *
+ * history:
+ * - unstable: v2.0.0
+ *
+ * @param name The qualified name to destroy.
+ * @return DUCKDB_V2_ERROR
+ */
+DUCKDB_C_API DUCKDB_V2_ERROR duckdb_v2_qname_destroy(duckdb_v2_qname_handle *name);
+#endif
+
+/* --- Struct definitions for qname --- */
+
+/* ============================================================================
+ * MODULE: query metrics
+ * ============================================================================ */
+
+/* --- Enums for query metrics --- */
+
+/* --- Struct forward declarations for query metrics --- */
+
+/* --- Types for query metrics --- */
+
+/*!
+ * An owned snapshot of the metrics of a query. Taken with `duckdb_v2_connection_get_query_metrics()`, read from its
+ * root node via `duckdb_v2_query_metrics_get_root()`, and destroyed with `duckdb_v2_query_metrics_destroy()`. Later
+ * queries do not update it.
+ */
+typedef struct _duckdb_v2_query_metrics {
+	void *internal_ptr;
+} * duckdb_v2_query_metrics_handle;
+
+/*!
+ * A borrowed opaque handle to one node of a query metrics snapshot, valid for as long as the snapshot is. Read its name
+ * with `duckdb_v2_query_metrics_node_get_name()`, its metrics with `duckdb_v2_query_metrics_node_get_metric()` or by
+ * index, and its children with `duckdb_v2_query_metrics_node_get_child()`.
+ */
+typedef struct _duckdb_v2_query_metrics_node {
+	void *internal_ptr;
+} * duckdb_v2_query_metrics_node_handle;
+
+/* --- Constants for query metrics --- */
+
+/* --- Function pointer typedefs for query metrics --- */
+
+/* --- Functions for query metrics --- */
+
+#if DUCKDB_V2_API_ALLOW_UNSTABLE
+/*!
+ * Takes a snapshot of the metrics of the last query the connection finished.
+ *
+ * The snapshot is owned by the caller and does not change afterwards. It holds the metrics DuckDB's profiling
+ * configuration gathered: without profiling enabled, the root node carries no metrics and has no children. A snapshot
+ * is not promised to be complete; any metric, and any operator node, may be missing.
+ *
+ * Fails with `ERROR_RESOURCE_IN_USE` while a query is running on the connection, i.e. while a result of it has not yet
+ * been drained or destroyed.
+ *
+ * history:
+ * - unstable: v2.0.0
+ *
+ * @param conn The connection to take the snapshot of.
+ * @param metrics On success, receives the owned snapshot. Destroy via `duckdb_v2_query_metrics_destroy()`.
+ * @param err Optional. On failure, receives an opaque info handle the caller must destroy via
+ * `duckdb_v2_error_info_destroy()`.
+ * @return DUCKDB_V2_ERROR
+ */
+DUCKDB_C_API DUCKDB_V2_ERROR duckdb_v2_connection_get_query_metrics(duckdb_v2_connection_handle conn,
+                                                                    duckdb_v2_query_metrics_handle *metrics,
+                                                                    duckdb_v2_error_info_handle *err);
+#endif
+
+#if DUCKDB_V2_API_ALLOW_UNSTABLE
+/*!
+ * Enables or disables profiling for the queries the connection runs from now on.
+ *
+ * While profiling is enabled, DuckDB gathers the metrics `duckdb_v2_connection_get_query_metrics()` reports. Profiling
+ * also prints the profile of every query, as configured by the `enable_profiling` and `profiling_output` options, which
+ * by default print a query tree to the standard output: set `enable_profiling` to `no_output` to only gather the
+ * metrics. Disabling profiling stops both.
+ *
+ * history:
+ * - unstable: v2.0.0
+ *
+ * @param conn The connection to enable or disable profiling for.
+ * @param enabled Whether to enable profiling.
+ * @param err Optional. On failure, receives an opaque info handle the caller must destroy via
+ * `duckdb_v2_error_info_destroy()`.
+ * @return DUCKDB_V2_ERROR
+ */
+DUCKDB_C_API DUCKDB_V2_ERROR duckdb_v2_connection_enable_profiling(duckdb_v2_connection_handle conn, bool enabled,
+                                                                   duckdb_v2_error_info_handle *err);
+#endif
+
+#if DUCKDB_V2_API_ALLOW_UNSTABLE
+/*!
+ * Borrows the root node of the snapshot, which describes the query as a whole. Its children, if any, describe the
+ * operators that executed the query.
+ *
+ * history:
+ * - unstable: v2.0.0
+ *
+ * @param metrics The snapshot.
+ * @param node Receives the borrowed root node. Valid until the snapshot is destroyed.
+ * @param err Optional. On failure, receives an opaque info handle the caller must destroy via
+ * `duckdb_v2_error_info_destroy()`.
+ * @return DUCKDB_V2_ERROR
+ */
+DUCKDB_C_API DUCKDB_V2_ERROR duckdb_v2_query_metrics_get_root(duckdb_v2_query_metrics_handle metrics,
+                                                              duckdb_v2_query_metrics_node_handle *node,
+                                                              duckdb_v2_error_info_handle *err);
+#endif
+
+#if DUCKDB_V2_API_ALLOW_UNSTABLE
+/*!
+ * Borrows the name of the node: `QUERY` for the root node, and the name of the operator, e.g. `TABLE_SCAN`, for the
+ * other nodes.
+ *
+ * history:
+ * - unstable: v2.0.0
+ *
+ * @param node The node.
+ * @param name Receives a borrowed view of the name. Valid until the snapshot is destroyed.
+ * @param err Optional. On failure, receives an opaque info handle the caller must destroy via
+ * `duckdb_v2_error_info_destroy()`.
+ * @return DUCKDB_V2_ERROR
+ */
+DUCKDB_C_API DUCKDB_V2_ERROR duckdb_v2_query_metrics_node_get_name(duckdb_v2_query_metrics_node_handle node,
+                                                                   duckdb_v2_str *name,
+                                                                   duckdb_v2_error_info_handle *err);
+#endif
+
+#if DUCKDB_V2_API_ALLOW_UNSTABLE
+/*!
+ * Returns the number of children of the node. Valid indices for `duckdb_v2_query_metrics_node_get_child()` are [0,
+ * count).
+ *
+ * history:
+ * - unstable: v2.0.0
+ *
+ * @param node The node.
+ * @param count Receives the number of children.
+ * @param err Optional. On failure, receives an opaque info handle the caller must destroy via
+ * `duckdb_v2_error_info_destroy()`.
+ * @return DUCKDB_V2_ERROR
+ */
+DUCKDB_C_API DUCKDB_V2_ERROR duckdb_v2_query_metrics_node_get_child_count(duckdb_v2_query_metrics_node_handle node,
+                                                                          idx_t *count,
+                                                                          duckdb_v2_error_info_handle *err);
+#endif
+
+#if DUCKDB_V2_API_ALLOW_UNSTABLE
+/*!
+ * Borrows the child of the node at index. An out-of-range index is rejected with `ERROR_INPUT_OUT_OF_RANGE`.
+ *
+ * history:
+ * - unstable: v2.0.0
+ *
+ * @param node The node.
+ * @param index Zero-based child index.
+ * @param child Receives the borrowed child. Valid until the snapshot is destroyed.
+ * @param err Optional. On failure, receives an opaque info handle the caller must destroy via
+ * `duckdb_v2_error_info_destroy()`.
+ * @return DUCKDB_V2_ERROR
+ */
+DUCKDB_C_API DUCKDB_V2_ERROR duckdb_v2_query_metrics_node_get_child(duckdb_v2_query_metrics_node_handle node,
+                                                                    idx_t index,
+                                                                    duckdb_v2_query_metrics_node_handle *child,
+                                                                    duckdb_v2_error_info_handle *err);
+#endif
+
+#if DUCKDB_V2_API_ALLOW_UNSTABLE
+/*!
+ * Returns the number of metrics the node carries. Valid indices for `duckdb_v2_query_metrics_node_get_metric_name()`
+ * and `duckdb_v2_query_metrics_node_get_metric_value()` are [0, count); the order of the metrics is unspecified.
+ *
+ * history:
+ * - unstable: v2.0.0
+ *
+ * @param node The node.
+ * @param count Receives the number of metrics.
+ * @param err Optional. On failure, receives an opaque info handle the caller must destroy via
+ * `duckdb_v2_error_info_destroy()`.
+ * @return DUCKDB_V2_ERROR
+ */
+DUCKDB_C_API DUCKDB_V2_ERROR duckdb_v2_query_metrics_node_get_metric_count(duckdb_v2_query_metrics_node_handle node,
+                                                                           idx_t *count,
+                                                                           duckdb_v2_error_info_handle *err);
+#endif
+
+#if DUCKDB_V2_API_ALLOW_UNSTABLE
+/*!
+ * Borrows the name of the metric at index, e.g. `query.total_time`. An out-of-range index is rejected with
+ * `ERROR_INPUT_OUT_OF_RANGE`.
+ *
+ * history:
+ * - unstable: v2.0.0
+ *
+ * @param node The node.
+ * @param index Zero-based metric index.
+ * @param name Receives a borrowed view of the name. Valid until the snapshot is destroyed.
+ * @param err Optional. On failure, receives an opaque info handle the caller must destroy via
+ * `duckdb_v2_error_info_destroy()`.
+ * @return DUCKDB_V2_ERROR
+ */
+DUCKDB_C_API DUCKDB_V2_ERROR duckdb_v2_query_metrics_node_get_metric_name(duckdb_v2_query_metrics_node_handle node,
+                                                                          idx_t index, duckdb_v2_str *name,
+                                                                          duckdb_v2_error_info_handle *err);
+#endif
+
+#if DUCKDB_V2_API_ALLOW_UNSTABLE
+/*!
+ * Returns the value of the metric at index, a number such as a UBIGINT count or a DOUBLE duration. An out-of-range
+ * index is rejected with `ERROR_INPUT_OUT_OF_RANGE`.
+ *
+ * history:
+ * - unstable: v2.0.0
+ *
+ * @param node The node.
+ * @param index Zero-based metric index.
+ * @param value Receives the owned value. Destroy via `duckdb_v2_value_destroy()`.
+ * @param err Optional. On failure, receives an opaque info handle the caller must destroy via
+ * `duckdb_v2_error_info_destroy()`.
+ * @return DUCKDB_V2_ERROR
+ */
+DUCKDB_C_API DUCKDB_V2_ERROR duckdb_v2_query_metrics_node_get_metric_value(duckdb_v2_query_metrics_node_handle node,
+                                                                           idx_t index, duckdb_v2_value_handle *value,
+                                                                           duckdb_v2_error_info_handle *err);
+#endif
+
+#if DUCKDB_V2_API_ALLOW_UNSTABLE
+/*!
+ * Looks up a metric of the node by name, e.g. `query.total_time`. When the node does not carry it, `present` receives
+ * false and `value` receives null.
+ *
+ * history:
+ * - unstable: v2.0.0
+ *
+ * @param node The node.
+ * @param name The name of the metric, matched exactly. Borrowed for the call only.
+ * @param value Receives the owned value, if present. Destroy via `duckdb_v2_value_destroy()`.
+ * @param present Receives whether the node carries the metric.
+ * @param err Optional. On failure, receives an opaque info handle the caller must destroy via
+ * `duckdb_v2_error_info_destroy()`.
+ * @return DUCKDB_V2_ERROR
+ */
+DUCKDB_C_API DUCKDB_V2_ERROR duckdb_v2_query_metrics_node_get_metric(duckdb_v2_query_metrics_node_handle node,
+                                                                     const duckdb_v2_str *name,
+                                                                     duckdb_v2_value_handle *value, bool *present,
+                                                                     duckdb_v2_error_info_handle *err);
+#endif
+
+#if DUCKDB_V2_API_ALLOW_UNSTABLE
+/*!
+ * Destroys the snapshot, releasing its resources and invalidating the nodes borrowed from it.
+ *
+ * Null-safe: passing a null pointer or null handle is a no-op. The handle is set to null on return to prevent
+ * double-destruction.
+ *
+ * history:
+ * - unstable: v2.0.0
+ *
+ * @param metrics The snapshot to destroy.
+ * @return DUCKDB_V2_ERROR
+ */
+DUCKDB_C_API DUCKDB_V2_ERROR duckdb_v2_query_metrics_destroy(duckdb_v2_query_metrics_handle *metrics);
+#endif
+
+/* --- Struct definitions for query metrics --- */
+
+/* ============================================================================
+ * MODULE: schema
+ * ============================================================================ */
+
+/* --- Enums for schema --- */
+
+/* --- Struct forward declarations for schema --- */
+
+/* --- Types for schema --- */
+
+/*!
+ * An owned, ordered list of (name, type) fields. Read with schema_get_count and schema_get_field. Destroy via
+ * schema_destroy.
+ */
+typedef struct _duckdb_v2_schema {
+	void *internal_ptr;
+} * duckdb_v2_schema_handle;
+
+/* --- Constants for schema --- */
+
+/* --- Function pointer typedefs for schema --- */
+
+/* --- Functions for schema --- */
+
+#if DUCKDB_V2_API_ALLOW_UNSTABLE
+/*!
+ * Returns the number of fields in a schema.
+ *
+ * history:
+ * - unstable: v2.0.0
+ *
+ * @param schema The schema.
+ * @param out_count Receives the field count.
+ * @param err Optional. On failure, receives an opaque info handle the caller must destroy via error_info_destroy.
+ * @return DUCKDB_V2_ERROR
+ */
+DUCKDB_C_API DUCKDB_V2_ERROR duckdb_v2_schema_get_count(duckdb_v2_schema_handle schema, idx_t *out_count,
+                                                        duckdb_v2_error_info_handle *err);
+#endif
+
+#if DUCKDB_V2_API_ALLOW_UNSTABLE
+/*!
+ * Borrows the name and type of the field at the given index.
+ *
+ * out_name and out_type are valid only until the schema is destroyed, and out_type must not be destroyed. An
+ * out-of-range index is rejected with ERROR_INPUT_INVALID.
+ *
+ * history:
+ * - unstable: v2.0.0
+ *
+ * @param schema The schema.
+ * @param index Zero-based field index.
+ * @param out_name Receives a borrowed view of the field name. Valid until the schema is destroyed.
+ * @param out_type Receives a borrowed field type. Valid until the schema is destroyed; do not destroy it.
+ * @param err Optional. On failure, receives an opaque info handle the caller must destroy via error_info_destroy.
+ * @return DUCKDB_V2_ERROR
+ */
+DUCKDB_C_API DUCKDB_V2_ERROR duckdb_v2_schema_get_field(duckdb_v2_schema_handle schema, idx_t index,
+                                                        duckdb_v2_identifier_t *out_name,
+                                                        duckdb_v2_logical_type_handle *out_type,
+                                                        duckdb_v2_error_info_handle *err);
+#endif
+
+#if DUCKDB_V2_API_ALLOW_UNSTABLE
+/*!
+ * Destroys a schema handle.
+ *
+ * Frees the handle along with the names and types it owns. On success the slot is set to null. Safe to call on an
+ * already-null slot.
+ *
+ * history:
+ * - unstable: v2.0.0
+ *
+ * @param schema The schema handle to destroy.
+ * @return DUCKDB_V2_ERROR
+ */
+DUCKDB_C_API DUCKDB_V2_ERROR duckdb_v2_schema_destroy(duckdb_v2_schema_handle *schema);
+#endif
+
+/* --- Struct definitions for schema --- */
+
+/* ============================================================================
+ * MODULE: tokenizer
+ * ============================================================================ */
+
+/* --- Enums for tokenizer --- */
+
+//! The lexical class of a token.
+typedef enum DUCKDB_V2_TOKEN_TYPE {
+	//! Not an actual token class; out_type is set to this when `duckdb_v2_token_iterator_next()` fails.
+	DUCKDB_V2_TOKEN_TYPE_INVALID = 0,
+
+	//! A keyword of the connection's grammar.
+	DUCKDB_V2_TOKEN_TYPE_KEYWORD = 1,
+
+	//! A bare or double-quoted identifier, quotes included.
+	DUCKDB_V2_TOKEN_TYPE_IDENTIFIER = 2,
+
+	//! A quoted or dollar-quoted string, delimiters included.
+	DUCKDB_V2_TOKEN_TYPE_STRING_LITERAL = 3,
+
+	//! A numeric literal.
+	DUCKDB_V2_TOKEN_TYPE_NUMBER_LITERAL = 4,
+
+	//! An operator or punctuation run other than the statement terminator.
+	DUCKDB_V2_TOKEN_TYPE_OPERATOR = 5,
+
+	//! A line or block comment, delimiters included.
+	DUCKDB_V2_TOKEN_TYPE_COMMENT = 6,
+
+	//! A statement-terminating semicolon.
+	DUCKDB_V2_TOKEN_TYPE_TERMINATOR = 7,
+
+	/*!
+	 * Not a token; reported by token_iterator_next once the input is exhausted, with start equal to the input length
+	 * and length 0.
+	 */
+	DUCKDB_V2_TOKEN_TYPE_END_OF_INPUT = 8,
+	DUCKDB_V2_TOKEN_TYPE_MAX_ENUM = 0x7FFFFFFF,
+} DUCKDB_V2_TOKEN_TYPE;
+
+/* --- Struct forward declarations for tokenizer --- */
+
+/* --- Types for tokenizer --- */
+
+//! An opaque, owned handle to an iterator over the tokens of a SQL string, produced by tokenize_sql.
+typedef struct _duckdb_v2_token_iterator {
+	void *internal_ptr;
+} * duckdb_v2_token_iterator_handle;
+
+/* --- Constants for tokenizer --- */
+
+/* --- Function pointer typedefs for tokenizer --- */
+
+/* --- Functions for tokenizer --- */
+
+#if DUCKDB_V2_API_ALLOW_UNSTABLE
+/*!
+ * Tokenizes a SQL string into an iterator over its tokens.
+ *
+ * Lexical tokenization, in the context of whatever grammar extensions are loaded on the given connection. Closing the
+ * connection or changing settings afterwards does not affect the tokens. The SQL string is borrowed for the call only,
+ * the caller may free it once this call returns. Whitespace is not a token. Malformed input is not an error;
+ * `duckdb_v2_token_iterator_ends_unterminated()` reports whether the input ended inside an open token.
+ *
+ * *out_iterator is set to NULL on failure.
+ *
+ * history:
+ * - unstable: v2.0.0
+ *
+ * @param conn The connection supplying the grammar.
+ * @param sql The SQL text. Borrowed for the call only; may contain interior null bytes. {NULL, 0} is the empty input.
+ * @param out_iterator Receives the new iterator handle. Destroy via token_iterator_destroy.
+ * @param err Optional. On failure, receives an opaque info handle the caller must destroy via error_info_destroy.
+ * @return DUCKDB_V2_ERROR
+ */
+DUCKDB_C_API DUCKDB_V2_ERROR duckdb_v2_tokenize_sql(duckdb_v2_connection_handle conn, const duckdb_v2_str *sql,
+                                                    duckdb_v2_token_iterator_handle *out_iterator,
+                                                    duckdb_v2_error_info_handle *err);
+#endif
+
+#if DUCKDB_V2_API_ALLOW_UNSTABLE
+/*!
+ * Yields the next token, or END_OF_INPUT once exhausted.
+ *
+ * On success writes the token's class, byte offset and byte length into the out-parameters. The lexeme is the input
+ * bytes [start, start + length). Once the input is exhausted, every call gives TOKEN_TYPE_END_OF_INPUT with start equal
+ * to the input length and length 0. On failure out params are set to TOKEN_TYPE_INVALID, 0, 0.
+ *
+ * history:
+ * - unstable: v2.0.0
+ *
+ * @param iterator The iterator to advance.
+ * @param out_type Receives the token's class, or TOKEN_TYPE_END_OF_INPUT once exhausted.
+ * @param out_start Receives the token's byte offset into the input; the input length for END_OF_INPUT.
+ * @param out_length Receives the token's byte length; 0 for END_OF_INPUT.
+ * @param err Optional. On failure, receives an opaque info handle the caller must destroy via error_info_destroy.
+ * @return DUCKDB_V2_ERROR
+ */
+DUCKDB_C_API DUCKDB_V2_ERROR duckdb_v2_token_iterator_next(duckdb_v2_token_iterator_handle iterator,
+                                                           DUCKDB_V2_TOKEN_TYPE *out_type, idx_t *out_start,
+                                                           idx_t *out_length, duckdb_v2_error_info_handle *err);
+#endif
+
+#if DUCKDB_V2_API_ALLOW_UNSTABLE
+/*!
+ * Reports whether the input ended before the closing delimiter of its last token.
+ *
+ * True when the input ends inside an open string, quoted identifier, block comment or dollar-quoted string, or in a
+ * line comment with no trailing newline; false otherwise, including for empty or whitespace-only input. Equivalently,
+ * the last token `duckdb_v2_token_iterator_next()` yields before TOKEN_TYPE_END_OF_INPUT is the open one, so its class
+ * and lexeme say which delimiter is missing. A property of the input, not of the iterator position: the answer is the
+ * same before, during and after draining. The only failure is a null argument.
+ *
+ * history:
+ * - unstable: v2.0.0
+ *
+ * @param iterator The iterator.
+ * @param out_ends_unterminated Receives whether the input ended inside an open token.
+ * @param err Optional. On failure, receives an opaque info handle the caller must destroy via error_info_destroy.
+ * @return DUCKDB_V2_ERROR
+ */
+DUCKDB_C_API DUCKDB_V2_ERROR duckdb_v2_token_iterator_ends_unterminated(duckdb_v2_token_iterator_handle iterator,
+                                                                        bool *out_ends_unterminated,
+                                                                        duckdb_v2_error_info_handle *err);
+#endif
+
+#if DUCKDB_V2_API_ALLOW_UNSTABLE
+/*!
+ * Destroys a token iterator handle.
+ *
+ * history:
+ * - unstable: v2.0.0
+ *
+ * @param iterator The iterator to destroy.
+ * @return DUCKDB_V2_ERROR
+ */
+DUCKDB_C_API DUCKDB_V2_ERROR duckdb_v2_token_iterator_destroy(duckdb_v2_token_iterator_handle *iterator);
+#endif
+
+/* --- Struct definitions for tokenizer --- */
+
+/* ============================================================================
+ * MODULE: aggregate
+ * ============================================================================ */
+
+/* --- Enums for aggregate --- */
+
+/* --- Struct forward declarations for aggregate --- */
+
+/* --- Types for aggregate --- */
+
+/*!
+ * An owned opaque handle to a custom aggregate function being built. Created with
+ * `duckdb_v2_aggregate_function_create()`, configured with the setter functions (e.g.
+ * `duckdb_v2_aggregate_function_set_name()`, `duckdb_v2_aggregate_function_set_update_callback()`, etc.) and the
+ * signature obtained via `duckdb_v2_aggregate_function_get_signature()`, made available with
+ * `duckdb_v2_connection_register_aggregate_function()` or `duckdb_v2_extension_register_aggregate_function()`, and
+ * destroyed with `duckdb_v2_aggregate_function_destroy()`.
+ */
+typedef struct _duckdb_v2_aggregate_function {
+	void *internal_ptr;
+} * duckdb_v2_aggregate_function_handle;
+
+/*!
+ * A borrowed opaque handle to the result of an aggregate function's "bind" phase. The "bind" callback receives this
+ * handle next to a `duckdb_v2_function_bind_info_handle`, which gives access to the arguments, the user data and the
+ * bind data, and can use it to set the return type of the call site being bound.
+ */
+typedef struct _duckdb_v2_aggregate_function_bind_info {
+	void *internal_ptr;
+} * duckdb_v2_aggregate_function_bind_info_handle;
+
+/*!
+ * A borrowed opaque handle to the arguments supplied to an aggregate function during the state sizing "size" phase. The
+ * "size" callback receives this handle and must use it to report the size of a single aggregate state in bytes.
+ */
+typedef struct _duckdb_v2_aggregate_function_size_info {
+	void *internal_ptr;
+} * duckdb_v2_aggregate_function_size_info_handle;
+
+/*!
+ * A borrowed opaque handle to the arguments supplied to an aggregate function during the state initialization "init"
+ * phase. The "init" callback receives this handle and can use it to access the array of aggregate states it must
+ * initialize in place.
+ */
+typedef struct _duckdb_v2_aggregate_function_init_info {
+	void *internal_ptr;
+} * duckdb_v2_aggregate_function_init_info_handle;
+
+/*!
+ * A borrowed opaque handle to the arguments supplied to an aggregate function during the "update" phase. The "update"
+ * callback receives this handle and can use it to access the input argument vectors, the number of rows to process, and
+ * the aggregate state each row must be aggregated into.
+ */
+typedef struct _duckdb_v2_aggregate_function_update_info {
+	void *internal_ptr;
+} * duckdb_v2_aggregate_function_update_info_handle;
+
+/*!
+ * A borrowed opaque handle to the arguments supplied to an aggregate function during the "combine" phase. The "combine"
+ * callback receives this handle and can use it to access the source and target aggregate state arrays to merge.
+ */
+typedef struct _duckdb_v2_aggregate_function_combine_info {
+	void *internal_ptr;
+} * duckdb_v2_aggregate_function_combine_info_handle;
+
+/*!
+ * A borrowed opaque handle to the arguments supplied to an aggregate function during the "finalize" phase. The
+ * "finalize" callback receives this handle and can use it to access the aggregate states and the result vector and
+ * offset to write their final values to.
+ */
+typedef struct _duckdb_v2_aggregate_function_finalize_info {
+	void *internal_ptr;
+} * duckdb_v2_aggregate_function_finalize_info_handle;
+
+/*!
+ * A borrowed opaque handle to the arguments supplied to an aggregate function during the state destruction "destroy"
+ * phase. The "destroy" callback receives this handle and can use it to access the array of aggregate states whose
+ * resources must be released.
+ */
+typedef struct _duckdb_v2_aggregate_function_destroy_info {
+	void *internal_ptr;
+} * duckdb_v2_aggregate_function_destroy_info_handle;
+
+/* --- Constants for aggregate --- */
+
+/* --- Function pointer typedefs for aggregate --- */
+
+typedef void (*duckdb_v2_aggregate_function_bind_callback_fn)(duckdb_v2_function_bind_info_handle info,
+                                                              duckdb_v2_aggregate_function_bind_info_handle result,
+                                                              duckdb_v2_context_handle context,
+                                                              duckdb_v2_error_info_handle *err);
+
+typedef void (*duckdb_v2_aggregate_function_size_callback_fn)(duckdb_v2_aggregate_function_size_info_handle info,
+                                                              duckdb_v2_error_info_handle *err);
+
+typedef void (*duckdb_v2_aggregate_function_init_callback_fn)(duckdb_v2_aggregate_function_init_info_handle info,
+                                                              duckdb_v2_error_info_handle *err);
+
+typedef void (*duckdb_v2_aggregate_function_update_callback_fn)(duckdb_v2_aggregate_function_update_info_handle info,
+                                                                duckdb_v2_error_info_handle *err);
+
+typedef void (*duckdb_v2_aggregate_function_combine_callback_fn)(duckdb_v2_aggregate_function_combine_info_handle info,
+                                                                 duckdb_v2_error_info_handle *err);
+
+typedef void (*duckdb_v2_aggregate_function_finalize_callback_fn)(
+    duckdb_v2_aggregate_function_finalize_info_handle info, duckdb_v2_error_info_handle *err);
+
+typedef void (*duckdb_v2_aggregate_function_destroy_callback_fn)(duckdb_v2_aggregate_function_destroy_info_handle info,
+                                                                 duckdb_v2_error_info_handle *err);
+
+/* --- Functions for aggregate --- */
+
+#if DUCKDB_V2_API_ALLOW_UNSTABLE
+/*!
+ * Creates a new aggregate function through a factory.
+ *
+ * The function starts out empty: configure it with the setter functions (e.g.
+ * `duckdb_v2_aggregate_function_set_name()`, `duckdb_v2_aggregate_function_set_update_callback()`, etc.) and the
+ * signature obtained via `duckdb_v2_aggregate_function_get_signature()`, then make it available with
+ * `duckdb_v2_connection_register_aggregate_function()` or `duckdb_v2_extension_register_aggregate_function()`. The
+ * caller owns the returned handle and must destroy it with `duckdb_v2_aggregate_function_destroy()`, also after
+ * registration.
+ *
+ * The aggregate function can only be registered on the database the factory belongs to.
+ *
+ * history:
+ * - unstable: v2.0.0
+ *
+ * @param factory The factory to create the aggregate function through.
+ * @param function On success, receives the newly created aggregate function. Owned by the caller.
+ * @param err Optional. On failure, receives an opaque info handle the caller must destroy via
+ * `duckdb_v2_error_info_destroy()`.
+ * @return DUCKDB_V2_ERROR
+ */
+DUCKDB_C_API DUCKDB_V2_ERROR duckdb_v2_aggregate_function_create(duckdb_v2_factory_handle factory,
+                                                                 duckdb_v2_aggregate_function_handle *function,
+                                                                 duckdb_v2_error_info_handle *err);
+#endif
+
+#if DUCKDB_V2_API_ALLOW_UNSTABLE
+/*!
+ * Sets the name of the aggregate function.
+ *
+ * The name is borrowed and copied. Calling this again replaces the previous name. A name must be set before
+ * registration.
+ *
+ * history:
+ * - unstable: v2.0.0
+ *
+ * @param function The function to set the name of.
+ * @param name The name to set. Borrowed and copied.
+ * @param err Optional. On failure, receives an opaque info handle the caller must destroy via
+ * `duckdb_v2_error_info_destroy()`.
+ * @return DUCKDB_V2_ERROR
+ */
+DUCKDB_C_API DUCKDB_V2_ERROR duckdb_v2_aggregate_function_set_name(duckdb_v2_aggregate_function_handle function,
+                                                                   const duckdb_v2_identifier_t *name,
+                                                                   duckdb_v2_error_info_handle *err);
+#endif
+
+#if DUCKDB_V2_API_ALLOW_UNSTABLE
+/*!
+ * Returns the documentation of the function so it can be filled in.
+ *
+ * Set a description with `duckdb_v2_function_docs_set_description()`, and add examples and categories with
+ * `duckdb_v2_function_docs_add_example()` and `duckdb_v2_function_docs_add_category()`. The documentation is modified
+ * in place, describes this overload only, and is registered with the function. Optional.
+ *
+ * history:
+ * - unstable: v2.0.0
+ *
+ * @param function The function to get the documentation of.
+ * @param docs The returned documentation. Borrowed and valid for the lifetime of the function handle.
+ * @param err Optional. On failure, receives an opaque info handle the caller must destroy via
+ * `duckdb_v2_error_info_destroy()`.
+ * @return DUCKDB_V2_ERROR
+ */
+DUCKDB_C_API DUCKDB_V2_ERROR duckdb_v2_aggregate_function_get_docs(duckdb_v2_aggregate_function_handle function,
+                                                                   duckdb_v2_function_docs_handle *docs,
+                                                                   duckdb_v2_error_info_handle *err);
+#endif
+
+#if DUCKDB_V2_API_ALLOW_UNSTABLE
+/*!
+ * Returns the function's signature so it can be configured.
+ *
+ * Add parameters with `duckdb_v2_function_signature_add_parameter()` and set the return type with
+ * `duckdb_v2_function_signature_set_return_type()`. The signature is modified in place; the function must be given a
+ * signature with a return type before registration.
+ *
+ * history:
+ * - unstable: v2.0.0
+ *
+ * @param function The function to get the signature of.
+ * @param sig The returned signature. Borrowed and valid for the lifetime of the function handle.
+ * @param err Optional. On failure, receives an opaque info handle the caller must destroy via
+ * `duckdb_v2_error_info_destroy()`.
+ * @return DUCKDB_V2_ERROR
+ */
+DUCKDB_C_API DUCKDB_V2_ERROR duckdb_v2_aggregate_function_get_signature(duckdb_v2_aggregate_function_handle function,
+                                                                        duckdb_v2_function_signature_handle *sig,
+                                                                        duckdb_v2_error_info_handle *err);
+#endif
+
+#if DUCKDB_V2_API_ALLOW_UNSTABLE
+/*!
+ * Sets arbitrary user data on the aggregate function.
+ *
+ * Associates an opaque pointer with the function, retrievable from each callback via its user data accessor (e.g.
+ * `duckdb_v2_function_bind_get_user_data()`, `duckdb_v2_aggregate_function_update_get_user_data()`, etc.). The opaque
+ * handle bundles the pointer with an optional destructor, invoked when the data is no longer needed.
+ *
+ * history:
+ * - unstable: v2.0.0
+ *
+ * @param function The function to set the user data of.
+ * @param data Opaque handle bundling the user data pointer plus an optional destructor.
+ * @param err Optional. On failure, receives an opaque info handle the caller must destroy via
+ * `duckdb_v2_error_info_destroy()`.
+ * @return DUCKDB_V2_ERROR
+ */
+DUCKDB_C_API DUCKDB_V2_ERROR duckdb_v2_aggregate_function_set_user_data(duckdb_v2_aggregate_function_handle function,
+                                                                        duckdb_v2_opaque *data,
+                                                                        duckdb_v2_error_info_handle *err);
+#endif
+
+#if DUCKDB_V2_API_ALLOW_UNSTABLE
+/*!
+ * Sets a property on the aggregate function.
+ *
+ * Configures a function property that influences planning and execution, such as stability, NULL handling, fallibility,
+ * collation handling, or the aggregate-specific order/DISTINCT dependence. The value must be one of the
+ * `DUCKDB_V2_FUNCTION_PROPERTY_VALUE` entries belonging to `key`; passing a value that does not belong to the key, or a
+ * key that is not valid for aggregate functions, results in an error.
+ *
+ * history:
+ * - unstable: v2.0.0
+ *
+ * @param function The function to set the property of.
+ * @param key The property to set.
+ * @param value The value to set for the property. Must belong to `key`.
+ * @param err Optional. On failure, receives an opaque info handle the caller must destroy via
+ * `duckdb_v2_error_info_destroy()`.
+ * @return DUCKDB_V2_ERROR
+ */
+DUCKDB_C_API DUCKDB_V2_ERROR duckdb_v2_aggregate_function_set_property(duckdb_v2_aggregate_function_handle function,
+                                                                       DUCKDB_V2_FUNCTION_PROPERTY_KEY key,
+                                                                       DUCKDB_V2_FUNCTION_PROPERTY_VALUE value,
+                                                                       duckdb_v2_error_info_handle *err);
+#endif
+
+#if DUCKDB_V2_API_ALLOW_UNSTABLE
+/*!
+ * Sets the optional bind callback of the aggregate function.
+ *
+ * The bind callback is invoked during query planning for each call site of the function. Through its
+ * `duckdb_v2_function_bind_info_handle` it can inspect the argument types and constant argument values and set "bind
+ * data" that is shared with the other callbacks. Through its `duckdb_v2_aggregate_function_bind_info_handle` it can set
+ * a concrete return type.
+ *
+ * history:
+ * - unstable: v2.0.0
+ *
+ * @param function The function to set the bind callback of.
+ * @param callback The bind callback to set.
+ * @param err Optional. On failure, receives an opaque info handle the caller must destroy via
+ * `duckdb_v2_error_info_destroy()`.
+ * @return DUCKDB_V2_ERROR
+ */
+DUCKDB_C_API DUCKDB_V2_ERROR duckdb_v2_aggregate_function_set_bind_callback(
+    duckdb_v2_aggregate_function_handle function, duckdb_v2_aggregate_function_bind_callback_fn callback,
+    duckdb_v2_error_info_handle *err);
+#endif
+
+#if DUCKDB_V2_API_ALLOW_UNSTABLE
+/*!
+ * Sets the size callback of the aggregate function.
+ *
+ * The size callback reports the size of a single aggregate state in bytes via
+ * `duckdb_v2_aggregate_function_size_set_state_size()`; DuckDB uses it to allocate state memory. A size callback must
+ * be set before registration.
+ *
+ * history:
+ * - unstable: v2.0.0
+ *
+ * @param function The function to set the size callback of.
+ * @param callback The size callback to set.
+ * @param err Optional. On failure, receives an opaque info handle the caller must destroy via
+ * `duckdb_v2_error_info_destroy()`.
+ * @return DUCKDB_V2_ERROR
+ */
+DUCKDB_C_API DUCKDB_V2_ERROR duckdb_v2_aggregate_function_set_size_callback(
+    duckdb_v2_aggregate_function_handle function, duckdb_v2_aggregate_function_size_callback_fn callback,
+    duckdb_v2_error_info_handle *err);
+#endif
+
+#if DUCKDB_V2_API_ALLOW_UNSTABLE
+/*!
+ * Sets the init callback of the aggregate function.
+ *
+ * The init callback initializes freshly allocated aggregate states in place, obtained via
+ * `duckdb_v2_aggregate_function_init_get_states()`. An init callback must be set before registration.
+ *
+ * history:
+ * - unstable: v2.0.0
+ *
+ * @param function The function to set the init callback of.
+ * @param callback The init callback to set.
+ * @param err Optional. On failure, receives an opaque info handle the caller must destroy via
+ * `duckdb_v2_error_info_destroy()`.
+ * @return DUCKDB_V2_ERROR
+ */
+DUCKDB_C_API DUCKDB_V2_ERROR duckdb_v2_aggregate_function_set_init_callback(
+    duckdb_v2_aggregate_function_handle function, duckdb_v2_aggregate_function_init_callback_fn callback,
+    duckdb_v2_error_info_handle *err);
+#endif
+
+#if DUCKDB_V2_API_ALLOW_UNSTABLE
+/*!
+ * Sets the update callback of the aggregate function.
+ *
+ * The update callback is invoked during query execution with a batch of input rows: row i of every argument vector must
+ * be aggregated into state i of the state array. An update callback must be set before registration.
+ *
+ * history:
+ * - unstable: v2.0.0
+ *
+ * @param function The function to set the update callback of.
+ * @param callback The update callback to set.
+ * @param err Optional. On failure, receives an opaque info handle the caller must destroy via
+ * `duckdb_v2_error_info_destroy()`.
+ * @return DUCKDB_V2_ERROR
+ */
+DUCKDB_C_API DUCKDB_V2_ERROR duckdb_v2_aggregate_function_set_update_callback(
+    duckdb_v2_aggregate_function_handle function, duckdb_v2_aggregate_function_update_callback_fn callback,
+    duckdb_v2_error_info_handle *err);
+#endif
+
+#if DUCKDB_V2_API_ALLOW_UNSTABLE
+/*!
+ * Sets the combine callback of the aggregate function.
+ *
+ * The combine callback merges partial aggregate states computed in parallel: source state i must be combined into
+ * target state i. A combine callback must be set before registration.
+ *
+ * history:
+ * - unstable: v2.0.0
+ *
+ * @param function The function to set the combine callback of.
+ * @param callback The combine callback to set.
+ * @param err Optional. On failure, receives an opaque info handle the caller must destroy via
+ * `duckdb_v2_error_info_destroy()`.
+ * @return DUCKDB_V2_ERROR
+ */
+DUCKDB_C_API DUCKDB_V2_ERROR duckdb_v2_aggregate_function_set_combine_callback(
+    duckdb_v2_aggregate_function_handle function, duckdb_v2_aggregate_function_combine_callback_fn callback,
+    duckdb_v2_error_info_handle *err);
+#endif
+
+#if DUCKDB_V2_API_ALLOW_UNSTABLE
+/*!
+ * Sets the finalize callback of the aggregate function.
+ *
+ * The finalize callback produces the function's result: state i must be finalized into result row offset + i of the
+ * result vector. A finalize callback must be set before registration.
+ *
+ * history:
+ * - unstable: v2.0.0
+ *
+ * @param function The function to set the finalize callback of.
+ * @param callback The finalize callback to set.
+ * @param err Optional. On failure, receives an opaque info handle the caller must destroy via
+ * `duckdb_v2_error_info_destroy()`.
+ * @return DUCKDB_V2_ERROR
+ */
+DUCKDB_C_API DUCKDB_V2_ERROR duckdb_v2_aggregate_function_set_finalize_callback(
+    duckdb_v2_aggregate_function_handle function, duckdb_v2_aggregate_function_finalize_callback_fn callback,
+    duckdb_v2_error_info_handle *err);
+#endif
+
+#if DUCKDB_V2_API_ALLOW_UNSTABLE
+/*!
+ * Sets the destroy callback for the aggregate function. Optional: only needed when aggregate states own resources that
+ * must be released. The callback runs on states that are discarded without being finalized; it must not fail, an error
+ * reported through its error slot is ignored.
+ *
+ * history:
+ * - unstable: v2.0.0
+ *
+ * @param function The function to set the destroy callback of.
+ * @param callback The destroy callback to set.
+ * @param err Optional. On failure, receives an opaque info handle the caller must destroy via
+ * `duckdb_v2_error_info_destroy()`.
+ * @return DUCKDB_V2_ERROR
+ */
+DUCKDB_C_API DUCKDB_V2_ERROR duckdb_v2_aggregate_function_set_destroy_callback(
+    duckdb_v2_aggregate_function_handle function, duckdb_v2_aggregate_function_destroy_callback_fn callback,
+    duckdb_v2_error_info_handle *err);
+#endif
+
+#if DUCKDB_V2_API_ALLOW_UNSTABLE
+/*!
+ * Sets the concrete return type of the call site being bound.
+ *
+ * Overrides the return type declared in the signature. Register the function with an ANY return type and set the
+ * concrete type here, derived from the argument types, to build a function whose result type depends on its input. The
+ * type is borrowed and copied.
+ *
+ * history:
+ * - unstable: v2.0.0
+ *
+ * @param info The bind info handle.
+ * @param return_type The return type to set. Borrowed for the call only.
+ * @param err Optional. On failure, receives an opaque info handle the caller must destroy via
+ * `duckdb_v2_error_info_destroy()`.
+ * @return DUCKDB_V2_ERROR
+ */
+DUCKDB_C_API DUCKDB_V2_ERROR duckdb_v2_aggregate_function_bind_set_return_type(
+    duckdb_v2_aggregate_function_bind_info_handle info, duckdb_v2_logical_type_handle return_type,
+    duckdb_v2_error_info_handle *err);
+#endif
+
+#if DUCKDB_V2_API_ALLOW_UNSTABLE
+/*!
+ * Retrieves the user data set via `duckdb_v2_aggregate_function_set_user_data()`.
+ *
+ * history:
+ * - unstable: v2.0.0
+ *
+ * @param info The size info handle.
+ * @param data Receives the user data pointer, or null if none was set.
+ * @param err Optional. On failure, receives an opaque info handle the caller must destroy via
+ * `duckdb_v2_error_info_destroy()`.
+ * @return DUCKDB_V2_ERROR
+ */
+DUCKDB_C_API DUCKDB_V2_ERROR duckdb_v2_aggregate_function_size_get_user_data(
+    duckdb_v2_aggregate_function_size_info_handle info, void **data, duckdb_v2_error_info_handle *err);
+#endif
+
+#if DUCKDB_V2_API_ALLOW_UNSTABLE
+/*!
+ * Retrieves the bind data set by the function's bind callback.
+ *
+ * history:
+ * - unstable: v2.0.0
+ *
+ * @param info The size info handle.
+ * @param data Receives the bind data pointer, or null if none was set.
+ * @param err Optional. On failure, receives an opaque info handle the caller must destroy via
+ * `duckdb_v2_error_info_destroy()`.
+ * @return DUCKDB_V2_ERROR
+ */
+DUCKDB_C_API DUCKDB_V2_ERROR duckdb_v2_aggregate_function_size_get_bind_data(
+    duckdb_v2_aggregate_function_size_info_handle info, void **data, duckdb_v2_error_info_handle *err);
+#endif
+
+#if DUCKDB_V2_API_ALLOW_UNSTABLE
+/*!
+ * Sets the size of a single aggregate state, in bytes. The size callback must set this; DuckDB uses it to allocate
+ * state memory.
+ *
+ * history:
+ * - unstable: v2.0.0
+ *
+ * @param info The size info handle.
+ * @param size The size of a single aggregate state, in bytes.
+ * @param err Optional. On failure, receives an opaque info handle the caller must destroy via
+ * `duckdb_v2_error_info_destroy()`.
+ * @return DUCKDB_V2_ERROR
+ */
+DUCKDB_C_API DUCKDB_V2_ERROR duckdb_v2_aggregate_function_size_set_state_size(
+    duckdb_v2_aggregate_function_size_info_handle info, idx_t size, duckdb_v2_error_info_handle *err);
+#endif
+
+#if DUCKDB_V2_API_ALLOW_UNSTABLE
+/*!
+ * Retrieves the user data set via `duckdb_v2_aggregate_function_set_user_data()`.
+ *
+ * history:
+ * - unstable: v2.0.0
+ *
+ * @param info The init info handle.
+ * @param data Receives the user data pointer, or null if none was set.
+ * @param err Optional. On failure, receives an opaque info handle the caller must destroy via
+ * `duckdb_v2_error_info_destroy()`.
+ * @return DUCKDB_V2_ERROR
+ */
+DUCKDB_C_API DUCKDB_V2_ERROR duckdb_v2_aggregate_function_init_get_user_data(
+    duckdb_v2_aggregate_function_init_info_handle info, void **data, duckdb_v2_error_info_handle *err);
+#endif
+
+#if DUCKDB_V2_API_ALLOW_UNSTABLE
+/*!
+ * Retrieves the bind data set by the function's bind callback.
+ *
+ * history:
+ * - unstable: v2.0.0
+ *
+ * @param info The init info handle.
+ * @param data Receives the bind data pointer, or null if none was set.
+ * @param err Optional. On failure, receives an opaque info handle the caller must destroy via
+ * `duckdb_v2_error_info_destroy()`.
+ * @return DUCKDB_V2_ERROR
+ */
+DUCKDB_C_API DUCKDB_V2_ERROR duckdb_v2_aggregate_function_init_get_bind_data(
+    duckdb_v2_aggregate_function_init_info_handle info, void **data, duckdb_v2_error_info_handle *err);
+#endif
+
+#if DUCKDB_V2_API_ALLOW_UNSTABLE
+/*!
+ * Returns how many aggregate states this invocation must initialize. This is the length of the array returned by
+ * `duckdb_v2_aggregate_function_init_get_states()`.
+ *
+ * history:
+ * - unstable: v2.0.0
+ *
+ * @param info The init info handle.
+ * @param count Receives the number of states.
+ * @param err Optional. On failure, receives an opaque info handle the caller must destroy via
+ * `duckdb_v2_error_info_destroy()`.
+ * @return DUCKDB_V2_ERROR
+ */
+DUCKDB_C_API DUCKDB_V2_ERROR duckdb_v2_aggregate_function_init_get_state_count(
+    duckdb_v2_aggregate_function_init_info_handle info, idx_t *count, duckdb_v2_error_info_handle *err);
+#endif
+
+#if DUCKDB_V2_API_ALLOW_UNSTABLE
+/*!
+ * Returns the array of aggregate states to initialize, one pointer per state. Each state points to uninitialized memory
+ * of the size reported by the size callback; the init callback must initialize all of them in place.
+ *
+ * history:
+ * - unstable: v2.0.0
+ *
+ * @param info The init info handle.
+ * @param states Receives the array of aggregate state pointers. Borrowed; valid only for the duration of the callback.
+ * @param err Optional. On failure, receives an opaque info handle the caller must destroy via
+ * `duckdb_v2_error_info_destroy()`.
+ * @return DUCKDB_V2_ERROR
+ */
+DUCKDB_C_API DUCKDB_V2_ERROR duckdb_v2_aggregate_function_init_get_states(
+    duckdb_v2_aggregate_function_init_info_handle info, void ***states, duckdb_v2_error_info_handle *err);
+#endif
+
+#if DUCKDB_V2_API_ALLOW_UNSTABLE
+/*!
+ * Retrieves the user data set via `duckdb_v2_aggregate_function_set_user_data()`.
+ *
+ * history:
+ * - unstable: v2.0.0
+ *
+ * @param info The update info handle.
+ * @param data Receives the user data pointer, or null if none was set.
+ * @param err Optional. On failure, receives an opaque info handle the caller must destroy via
+ * `duckdb_v2_error_info_destroy()`.
+ * @return DUCKDB_V2_ERROR
+ */
+DUCKDB_C_API DUCKDB_V2_ERROR duckdb_v2_aggregate_function_update_get_user_data(
+    duckdb_v2_aggregate_function_update_info_handle info, void **data, duckdb_v2_error_info_handle *err);
+#endif
+
+#if DUCKDB_V2_API_ALLOW_UNSTABLE
+/*!
+ * Retrieves the bind data set by the function's bind callback.
+ *
+ * history:
+ * - unstable: v2.0.0
+ *
+ * @param info The update info handle.
+ * @param data Receives the bind data pointer, or null if none was set.
+ * @param err Optional. On failure, receives an opaque info handle the caller must destroy via
+ * `duckdb_v2_error_info_destroy()`.
+ * @return DUCKDB_V2_ERROR
+ */
+DUCKDB_C_API DUCKDB_V2_ERROR duckdb_v2_aggregate_function_update_get_bind_data(
+    duckdb_v2_aggregate_function_update_info_handle info, void **data, duckdb_v2_error_info_handle *err);
+#endif
+
+#if DUCKDB_V2_API_ALLOW_UNSTABLE
+/*!
+ * Returns how many input rows this invocation carries. This is the length of the argument vectors and of the state
+ * array: row i of every argument vector must be aggregated into state i.
+ *
+ * history:
+ * - unstable: v2.0.0
+ *
+ * @param info The update info handle.
+ * @param count Receives the number of rows.
+ * @param err Optional. On failure, receives an opaque info handle the caller must destroy via
+ * `duckdb_v2_error_info_destroy()`.
+ * @return DUCKDB_V2_ERROR
+ */
+DUCKDB_C_API DUCKDB_V2_ERROR duckdb_v2_aggregate_function_update_get_row_count(
+    duckdb_v2_aggregate_function_update_info_handle info, idx_t *count, duckdb_v2_error_info_handle *err);
+#endif
+
+#if DUCKDB_V2_API_ALLOW_UNSTABLE
+/*!
+ * Returns how many argument vectors this invocation carries, split into the four parts of the argument list.
+ *
+ * The parts and their order are those the bind callback saw through `duckdb_v2_function_bind_get_arg_count()`, and the
+ * vectors are at the same indices. Valid indices for `duckdb_v2_aggregate_function_update_get_arg()` are [0, the sum of
+ * the four counts). Every out-parameter may be NULL, in which case nothing is written to it.
+ *
+ * history:
+ * - unstable: v2.0.0
+ *
+ * @param info The update info handle.
+ * @param positional_fixed Optional. Receives the number of positional-only and standard parameters.
+ * @param positional_variadic Optional. Receives the number of arguments `*args` received, 0 when the signature has
+ * none.
+ * @param named_fixed Optional. Receives the number of named-only parameters.
+ * @param named_variadic Optional. Receives the number of arguments `**kwargs` received, 0 when the signature has none.
+ * @param err Optional. On failure, receives an opaque info handle the caller must destroy via
+ * `duckdb_v2_error_info_destroy()`.
+ * @return DUCKDB_V2_ERROR
+ */
+DUCKDB_C_API DUCKDB_V2_ERROR duckdb_v2_aggregate_function_update_get_arg_count(
+    duckdb_v2_aggregate_function_update_info_handle info, idx_t *positional_fixed, idx_t *positional_variadic,
+    idx_t *named_fixed, idx_t *named_variadic, duckdb_v2_error_info_handle *err);
+#endif
+
+#if DUCKDB_V2_API_ALLOW_UNSTABLE
+/*!
+ * Retrieves the argument vector at the given index.
+ *
+ * The index is the one the bind callback used for the argument, e.g. the index
+ * `duckdb_v2_function_bind_get_arg_index()` found for a name. The vector holds the argument's values for the current
+ * batch; use `duckdb_v2_aggregate_function_update_get_row_count()` for the number of rows. Fails if the index is out of
+ * bounds. Borrowed; valid only for the duration of the callback.
+ *
+ * history:
+ * - unstable: v2.0.0
+ *
+ * @param info The update info handle.
+ * @param index The index of the argument.
+ * @param vector Receives the borrowed argument vector.
+ * @param err Optional. On failure, receives an opaque info handle the caller must destroy via
+ * `duckdb_v2_error_info_destroy()`.
+ * @return DUCKDB_V2_ERROR
+ */
+DUCKDB_C_API DUCKDB_V2_ERROR
+duckdb_v2_aggregate_function_update_get_arg(duckdb_v2_aggregate_function_update_info_handle info, idx_t index,
+                                            duckdb_v2_vector_handle *vector, duckdb_v2_error_info_handle *err);
+#endif
+
+#if DUCKDB_V2_API_ALLOW_UNSTABLE
+/*!
+ * Returns the array of aggregate states to update, one pointer per input row: row i of every argument vector must be
+ * aggregated into state i. Different rows may point to the same state.
+ *
+ * history:
+ * - unstable: v2.0.0
+ *
+ * @param info The update info handle.
+ * @param states Receives the array of aggregate state pointers. Borrowed; valid only for the duration of the callback.
+ * @param err Optional. On failure, receives an opaque info handle the caller must destroy via
+ * `duckdb_v2_error_info_destroy()`.
+ * @return DUCKDB_V2_ERROR
+ */
+DUCKDB_C_API DUCKDB_V2_ERROR duckdb_v2_aggregate_function_update_get_states(
+    duckdb_v2_aggregate_function_update_info_handle info, void ***states, duckdb_v2_error_info_handle *err);
+#endif
+
+#if DUCKDB_V2_API_ALLOW_UNSTABLE
+/*!
+ * Retrieves the user data set via `duckdb_v2_aggregate_function_set_user_data()`.
+ *
+ * history:
+ * - unstable: v2.0.0
+ *
+ * @param info The combine info handle.
+ * @param data Receives the user data pointer, or null if none was set.
+ * @param err Optional. On failure, receives an opaque info handle the caller must destroy via
+ * `duckdb_v2_error_info_destroy()`.
+ * @return DUCKDB_V2_ERROR
+ */
+DUCKDB_C_API DUCKDB_V2_ERROR duckdb_v2_aggregate_function_combine_get_user_data(
+    duckdb_v2_aggregate_function_combine_info_handle info, void **data, duckdb_v2_error_info_handle *err);
+#endif
+
+#if DUCKDB_V2_API_ALLOW_UNSTABLE
+/*!
+ * Retrieves the bind data set by the function's bind callback.
+ *
+ * history:
+ * - unstable: v2.0.0
+ *
+ * @param info The combine info handle.
+ * @param data Receives the bind data pointer, or null if none was set.
+ * @param err Optional. On failure, receives an opaque info handle the caller must destroy via
+ * `duckdb_v2_error_info_destroy()`.
+ * @return DUCKDB_V2_ERROR
+ */
+DUCKDB_C_API DUCKDB_V2_ERROR duckdb_v2_aggregate_function_combine_get_bind_data(
+    duckdb_v2_aggregate_function_combine_info_handle info, void **data, duckdb_v2_error_info_handle *err);
+#endif
+
+#if DUCKDB_V2_API_ALLOW_UNSTABLE
+/*!
+ * Returns how many source/target state pairs this invocation must combine. This is the length of both the sources and
+ * the targets array.
+ *
+ * history:
+ * - unstable: v2.0.0
+ *
+ * @param info The combine info handle.
+ * @param count Receives the number of state pairs.
+ * @param err Optional. On failure, receives an opaque info handle the caller must destroy via
+ * `duckdb_v2_error_info_destroy()`.
+ * @return DUCKDB_V2_ERROR
+ */
+DUCKDB_C_API DUCKDB_V2_ERROR duckdb_v2_aggregate_function_combine_get_state_count(
+    duckdb_v2_aggregate_function_combine_info_handle info, idx_t *count, duckdb_v2_error_info_handle *err);
+#endif
+
+#if DUCKDB_V2_API_ALLOW_UNSTABLE
+/*!
+ * Returns the array of source aggregate states, one pointer per pair. Source i must be combined into target i; the
+ * source must not be modified.
+ *
+ * history:
+ * - unstable: v2.0.0
+ *
+ * @param info The combine info handle.
+ * @param states Receives the array of source aggregate state pointers. Borrowed; valid only for the duration of the
+ * callback.
+ * @param err Optional. On failure, receives an opaque info handle the caller must destroy via
+ * `duckdb_v2_error_info_destroy()`.
+ * @return DUCKDB_V2_ERROR
+ */
+DUCKDB_C_API DUCKDB_V2_ERROR duckdb_v2_aggregate_function_combine_get_sources(
+    duckdb_v2_aggregate_function_combine_info_handle info, void ***states, duckdb_v2_error_info_handle *err);
+#endif
+
+#if DUCKDB_V2_API_ALLOW_UNSTABLE
+/*!
+ * Returns the array of target aggregate states, one pointer per pair. Source i must be combined into target i.
+ *
+ * history:
+ * - unstable: v2.0.0
+ *
+ * @param info The combine info handle.
+ * @param states Receives the array of target aggregate state pointers. Borrowed; valid only for the duration of the
+ * callback.
+ * @param err Optional. On failure, receives an opaque info handle the caller must destroy via
+ * `duckdb_v2_error_info_destroy()`.
+ * @return DUCKDB_V2_ERROR
+ */
+DUCKDB_C_API DUCKDB_V2_ERROR duckdb_v2_aggregate_function_combine_get_targets(
+    duckdb_v2_aggregate_function_combine_info_handle info, void ***states, duckdb_v2_error_info_handle *err);
+#endif
+
+#if DUCKDB_V2_API_ALLOW_UNSTABLE
+/*!
+ * Retrieves the user data set via `duckdb_v2_aggregate_function_set_user_data()`.
+ *
+ * history:
+ * - unstable: v2.0.0
+ *
+ * @param info The finalize info handle.
+ * @param data Receives the user data pointer, or null if none was set.
+ * @param err Optional. On failure, receives an opaque info handle the caller must destroy via
+ * `duckdb_v2_error_info_destroy()`.
+ * @return DUCKDB_V2_ERROR
+ */
+DUCKDB_C_API DUCKDB_V2_ERROR duckdb_v2_aggregate_function_finalize_get_user_data(
+    duckdb_v2_aggregate_function_finalize_info_handle info, void **data, duckdb_v2_error_info_handle *err);
+#endif
+
+#if DUCKDB_V2_API_ALLOW_UNSTABLE
+/*!
+ * Retrieves the bind data set by the function's bind callback.
+ *
+ * history:
+ * - unstable: v2.0.0
+ *
+ * @param info The finalize info handle.
+ * @param data Receives the bind data pointer, or null if none was set.
+ * @param err Optional. On failure, receives an opaque info handle the caller must destroy via
+ * `duckdb_v2_error_info_destroy()`.
+ * @return DUCKDB_V2_ERROR
+ */
+DUCKDB_C_API DUCKDB_V2_ERROR duckdb_v2_aggregate_function_finalize_get_bind_data(
+    duckdb_v2_aggregate_function_finalize_info_handle info, void **data, duckdb_v2_error_info_handle *err);
+#endif
+
+#if DUCKDB_V2_API_ALLOW_UNSTABLE
+/*!
+ * Returns how many aggregate states this invocation must finalize. This is the length of the state array and the number
+ * of rows to write to the result vector.
+ *
+ * history:
+ * - unstable: v2.0.0
+ *
+ * @param info The finalize info handle.
+ * @param count Receives the number of states.
+ * @param err Optional. On failure, receives an opaque info handle the caller must destroy via
+ * `duckdb_v2_error_info_destroy()`.
+ * @return DUCKDB_V2_ERROR
+ */
+DUCKDB_C_API DUCKDB_V2_ERROR duckdb_v2_aggregate_function_finalize_get_state_count(
+    duckdb_v2_aggregate_function_finalize_info_handle info, idx_t *count, duckdb_v2_error_info_handle *err);
+#endif
+
+#if DUCKDB_V2_API_ALLOW_UNSTABLE
+/*!
+ * Returns the array of aggregate states to finalize, one pointer per state. State i must be finalized into result row
+ * offset + i.
+ *
+ * history:
+ * - unstable: v2.0.0
+ *
+ * @param info The finalize info handle.
+ * @param states Receives the array of aggregate state pointers. Borrowed; valid only for the duration of the callback.
+ * @param err Optional. On failure, receives an opaque info handle the caller must destroy via
+ * `duckdb_v2_error_info_destroy()`.
+ * @return DUCKDB_V2_ERROR
+ */
+DUCKDB_C_API DUCKDB_V2_ERROR duckdb_v2_aggregate_function_finalize_get_states(
+    duckdb_v2_aggregate_function_finalize_info_handle info, void ***states, duckdb_v2_error_info_handle *err);
+#endif
+
+#if DUCKDB_V2_API_ALLOW_UNSTABLE
+/*!
+ * Retrieves the result vector the finalize callback must write into.
+ *
+ * State i must be finalized into result row offset + i, with the offset from
+ * `duckdb_v2_aggregate_function_finalize_get_result_offset()`. Borrowed; valid only for the duration of the callback.
+ *
+ * history:
+ * - unstable: v2.0.0
+ *
+ * @param info The finalize info handle.
+ * @param vector Receives the borrowed result vector to write into.
+ * @param err Optional. On failure, receives an opaque info handle the caller must destroy via
+ * `duckdb_v2_error_info_destroy()`.
+ * @return DUCKDB_V2_ERROR
+ */
+DUCKDB_C_API DUCKDB_V2_ERROR
+duckdb_v2_aggregate_function_finalize_get_result(duckdb_v2_aggregate_function_finalize_info_handle info,
+                                                 duckdb_v2_vector_handle *vector, duckdb_v2_error_info_handle *err);
+#endif
+
+#if DUCKDB_V2_API_ALLOW_UNSTABLE
+/*!
+ * Returns the offset in the result vector at which to start writing: state i must be finalized into result row offset +
+ * i.
+ *
+ * history:
+ * - unstable: v2.0.0
+ *
+ * @param info The finalize info handle.
+ * @param offset Receives the result offset.
+ * @param err Optional. On failure, receives an opaque info handle the caller must destroy via
+ * `duckdb_v2_error_info_destroy()`.
+ * @return DUCKDB_V2_ERROR
+ */
+DUCKDB_C_API DUCKDB_V2_ERROR duckdb_v2_aggregate_function_finalize_get_result_offset(
+    duckdb_v2_aggregate_function_finalize_info_handle info, idx_t *offset, duckdb_v2_error_info_handle *err);
+#endif
+
+#if DUCKDB_V2_API_ALLOW_UNSTABLE
+/*!
+ * Retrieves the user data set via `duckdb_v2_aggregate_function_set_user_data()`.
+ *
+ * history:
+ * - unstable: v2.0.0
+ *
+ * @param info The destroy info handle.
+ * @param data Receives the user data pointer, or null if none was set.
+ * @param err Optional. On failure, receives an opaque info handle the caller must destroy via
+ * `duckdb_v2_error_info_destroy()`.
+ * @return DUCKDB_V2_ERROR
+ */
+DUCKDB_C_API DUCKDB_V2_ERROR duckdb_v2_aggregate_function_destroy_get_user_data(
+    duckdb_v2_aggregate_function_destroy_info_handle info, void **data, duckdb_v2_error_info_handle *err);
+#endif
+
+#if DUCKDB_V2_API_ALLOW_UNSTABLE
+/*!
+ * Retrieves the bind data set by the function's bind callback.
+ *
+ * history:
+ * - unstable: v2.0.0
+ *
+ * @param info The destroy info handle.
+ * @param data Receives the bind data pointer, or null if none was set.
+ * @param err Optional. On failure, receives an opaque info handle the caller must destroy via
+ * `duckdb_v2_error_info_destroy()`.
+ * @return DUCKDB_V2_ERROR
+ */
+DUCKDB_C_API DUCKDB_V2_ERROR duckdb_v2_aggregate_function_destroy_get_bind_data(
+    duckdb_v2_aggregate_function_destroy_info_handle info, void **data, duckdb_v2_error_info_handle *err);
+#endif
+
+#if DUCKDB_V2_API_ALLOW_UNSTABLE
+/*!
+ * Returns how many aggregate states this invocation must destroy. This is the length of the state array.
+ *
+ * history:
+ * - unstable: v2.0.0
+ *
+ * @param info The destroy info handle.
+ * @param count Receives the number of states.
+ * @param err Optional. On failure, receives an opaque info handle the caller must destroy via
+ * `duckdb_v2_error_info_destroy()`.
+ * @return DUCKDB_V2_ERROR
+ */
+DUCKDB_C_API DUCKDB_V2_ERROR duckdb_v2_aggregate_function_destroy_get_state_count(
+    duckdb_v2_aggregate_function_destroy_info_handle info, idx_t *count, duckdb_v2_error_info_handle *err);
+#endif
+
+#if DUCKDB_V2_API_ALLOW_UNSTABLE
+/*!
+ * Returns the array of aggregate states to destroy, one pointer per state. The callback must release any resources the
+ * states own.
+ *
+ * history:
+ * - unstable: v2.0.0
+ *
+ * @param info The destroy info handle.
+ * @param states Receives the array of aggregate state pointers. Borrowed; valid only for the duration of the callback.
+ * @param err Optional. On failure, receives an opaque info handle the caller must destroy via
+ * `duckdb_v2_error_info_destroy()`.
+ * @return DUCKDB_V2_ERROR
+ */
+DUCKDB_C_API DUCKDB_V2_ERROR duckdb_v2_aggregate_function_destroy_get_states(
+    duckdb_v2_aggregate_function_destroy_info_handle info, void ***states, duckdb_v2_error_info_handle *err);
+#endif
+
+#if DUCKDB_V2_API_ALLOW_UNSTABLE
+/*!
+ * Registers the aggregate function, making it available for use in SQL queries.
+ *
+ * The function is registered on the connection's database, visible to every connection, in the connection's
+ * transaction: inside an explicit transaction, it is invisible to other connections until the transaction commits, and
+ * a rollback undoes it. Registration requires a name, the size, init, update, combine and finalize callbacks, and a
+ * signature with a complete return type; an ANY return type is accepted only together with a bind callback that sets
+ * the concrete type per call site. The aggregate function must have been created through a factory of the same
+ * database. The caller still owns the handle after registration and must destroy it with
+ * `duckdb_v2_aggregate_function_destroy()`, which does not affect the registered function.
+ *
+ * history:
+ * - unstable: v2.0.0
+ *
+ * @param conn The connection to register on.
+ * @param function The aggregate function to register.
+ * @param err Optional. On failure, receives an opaque info handle the caller must destroy via
+ * `duckdb_v2_error_info_destroy()`.
+ * @return DUCKDB_V2_ERROR
+ */
+DUCKDB_C_API DUCKDB_V2_ERROR duckdb_v2_connection_register_aggregate_function(
+    duckdb_v2_connection_handle conn, duckdb_v2_aggregate_function_handle function, duckdb_v2_error_info_handle *err);
+#endif
+
+#if DUCKDB_V2_API_ALLOW_UNSTABLE
+/*!
+ * Registers the aggregate function, making it available for use in SQL queries.
+ *
+ * The function is registered on the loading extension's database and attributed to the extension. Use this from the
+ * extension's load callback. Registration requires a name, the size, init, update, combine and finalize callbacks, and
+ * a signature with a complete return type; an ANY return type is accepted only together with a bind callback that sets
+ * the concrete type per call site. The aggregate function must have been created through a factory of the same
+ * database. The caller still owns the handle after registration and must destroy it with
+ * `duckdb_v2_aggregate_function_destroy()`, which does not affect the registered function.
+ *
+ * history:
+ * - unstable: v2.0.0
+ *
+ * @param extension The loading extension.
+ * @param function The aggregate function to register.
+ * @param err Optional. On failure, receives an opaque info handle the caller must destroy via
+ * `duckdb_v2_error_info_destroy()`.
+ * @return DUCKDB_V2_ERROR
+ */
+DUCKDB_C_API DUCKDB_V2_ERROR duckdb_v2_extension_register_aggregate_function(
+    duckdb_v2_extension_handle extension, duckdb_v2_aggregate_function_handle function,
+    duckdb_v2_error_info_handle *err);
+#endif
+
+#if DUCKDB_V2_API_ALLOW_UNSTABLE
+/*!
+ * Destroys the aggregate function, releasing its resources.
+ *
+ * Null-safe: passing a null pointer or null handle is a no-op. The handle is set to null on return to prevent
+ * double-destruction. Destroying the handle after registration does not affect the registered function.
+ *
+ * history:
+ * - unstable: v2.0.0
+ *
+ * @param function The function to destroy.
+ * @return DUCKDB_V2_ERROR
+ */
+DUCKDB_C_API DUCKDB_V2_ERROR duckdb_v2_aggregate_function_destroy(duckdb_v2_aggregate_function_handle *function);
+#endif
+
+/* --- Struct definitions for aggregate --- */
+
+/* ============================================================================
+ * MODULE: catalog
+ * ============================================================================ */
+
+/* --- Enums for catalog --- */
+
+/* --- Struct forward declarations for catalog --- */
+
+/* --- Types for catalog --- */
+
+/*!
+ * An owned snapshot of one base table taken at creation: where the name resolved, the table's columns, and per-column
+ * catalog facts. Later DDL does not update it. Create with `duckdb_v2_connection_describe_table()`, read the resolved
+ * location via `duckdb_v2_table_description_get_qname()`, and the columns via
+ * `duckdb_v2_table_description_get_column_count()` and `duckdb_v2_table_description_get_column()`. Destroy via
+ * `duckdb_v2_table_description_destroy()`.
+ */
+typedef struct _duckdb_v2_table_description {
+	void *internal_ptr;
+} * duckdb_v2_table_description_handle;
+
+/*!
+ * An owned snapshot of one column of a described table: its name, type, and catalog facts. Obtain with
+ * `duckdb_v2_table_description_get_column()`, read with `duckdb_v2_column_description_get_name()`,
+ * `duckdb_v2_column_description_get_type()`, `duckdb_v2_column_description_has_default()` and
+ * `duckdb_v2_column_description_has_generated()`, and destroy with `duckdb_v2_column_description_destroy()`.
+ */
+typedef struct _duckdb_v2_column_description {
+	void *internal_ptr;
+} * duckdb_v2_column_description_handle;
+
+/* --- Constants for catalog --- */
+
+/* --- Function pointer typedefs for catalog --- */
+
+/* --- Functions for catalog --- */
+
+#if DUCKDB_V2_API_ALLOW_UNSTABLE
+/*!
+ * Resolves a table name and snapshots its description.
+ *
+ * Resolves name in the connection's catalogs and returns an owned description of the table it names. name may be
+ * partial: an unqualified or schema-qualified name resolves through the connection's search path, exactly as the same
+ * name resolves in SQL. A two-part name tries the first part as a schema and as an attached database, as SQL does, and
+ * is rejected when both readings exist. A name that resolves to nothing is rejected with the engine's missing-table
+ * error; a name that resolves to a view is rejected with the engine's not-a-table error, since a description snapshots
+ * a base table.
+ *
+ * history:
+ * - unstable: v2.0.0
+ *
+ * @param conn The connection whose catalogs and search path resolve the name.
+ * @param name The possibly partial table name to resolve. Borrowed for the call only.
+ * @param desc On success, receives the owned description. Destroy via `duckdb_v2_table_description_destroy()`.
+ * @param err Optional. On failure, receives an opaque info handle the caller must destroy via
+ * `duckdb_v2_error_info_destroy()`.
+ * @return DUCKDB_V2_ERROR
+ */
+DUCKDB_C_API DUCKDB_V2_ERROR duckdb_v2_connection_describe_table(duckdb_v2_connection_handle conn,
+                                                                 duckdb_v2_qname_handle name,
+                                                                 duckdb_v2_table_description_handle *desc,
+                                                                 duckdb_v2_error_info_handle *err);
+#endif
+
+#if DUCKDB_V2_API_ALLOW_UNSTABLE
+/*!
+ * Returns the resolved qualified name of the described table.
+ *
+ * Returns an owned copy of the fully resolved name: the catalog, schema, and table the lookup landed on, with the
+ * casing the table was created with, never an echo of the requested name. Rendering it produces SQL that pins the
+ * described table regardless of search path.
+ *
+ * history:
+ * - unstable: v2.0.0
+ *
+ * @param desc The description.
+ * @param name Receives the owned resolved name. Destroy via `duckdb_v2_qname_destroy()`.
+ * @param err Optional. On failure, receives an opaque info handle the caller must destroy via
+ * `duckdb_v2_error_info_destroy()`.
+ * @return DUCKDB_V2_ERROR
+ */
+DUCKDB_C_API DUCKDB_V2_ERROR duckdb_v2_table_description_get_qname(duckdb_v2_table_description_handle desc,
+                                                                   duckdb_v2_qname_handle *name,
+                                                                   duckdb_v2_error_info_handle *err);
+#endif
+
+#if DUCKDB_V2_API_ALLOW_UNSTABLE
+/*!
+ * Returns whether the described table's catalog is read-only.
+ *
+ * True when the catalog the name resolved into was attached read-only, in which case no write to the table can succeed.
+ * False does not by itself prove a write will succeed; it clears the catalog-level check only.
+ *
+ * history:
+ * - unstable: v2.0.0
+ *
+ * @param desc The description.
+ * @param readonly Receives whether the catalog is read-only.
+ * @param err Optional. On failure, receives an opaque info handle the caller must destroy via
+ * `duckdb_v2_error_info_destroy()`.
+ * @return DUCKDB_V2_ERROR
+ */
+DUCKDB_C_API DUCKDB_V2_ERROR duckdb_v2_table_description_is_readonly(duckdb_v2_table_description_handle desc,
+                                                                     bool *readonly, duckdb_v2_error_info_handle *err);
+#endif
+
+#if DUCKDB_V2_API_ALLOW_UNSTABLE
+/*!
+ * Returns the number of columns of the described table.
+ *
+ * Counts every column in declared order, generated columns included. Valid indices for
+ * `duckdb_v2_table_description_get_column()` are [0, count).
+ *
+ * history:
+ * - unstable: v2.0.0
+ *
+ * @param desc The description.
+ * @param count Receives the column count.
+ * @param err Optional. On failure, receives an opaque info handle the caller must destroy via
+ * `duckdb_v2_error_info_destroy()`.
+ * @return DUCKDB_V2_ERROR
+ */
+DUCKDB_C_API DUCKDB_V2_ERROR duckdb_v2_table_description_get_column_count(duckdb_v2_table_description_handle desc,
+                                                                          idx_t *count,
+                                                                          duckdb_v2_error_info_handle *err);
+#endif
+
+#if DUCKDB_V2_API_ALLOW_UNSTABLE
+/*!
+ * Returns an owned description of the column at index.
+ *
+ * Columns are numbered in declared order, generated columns included. An out-of-range index is rejected with
+ * `ERROR_INPUT_OUT_OF_RANGE`.
+ *
+ * history:
+ * - unstable: v2.0.0
+ *
+ * @param desc The description.
+ * @param index Zero-based column index.
+ * @param column Receives the owned column description. Destroy via `duckdb_v2_column_description_destroy()`.
+ * @param err Optional. On failure, receives an opaque info handle the caller must destroy via
+ * `duckdb_v2_error_info_destroy()`.
+ * @return DUCKDB_V2_ERROR
+ */
+DUCKDB_C_API DUCKDB_V2_ERROR duckdb_v2_table_description_get_column(duckdb_v2_table_description_handle desc,
+                                                                    idx_t index,
+                                                                    duckdb_v2_column_description_handle *column,
+                                                                    duckdb_v2_error_info_handle *err);
+#endif
+
+#if DUCKDB_V2_API_ALLOW_UNSTABLE
+/*!
+ * Destroys the table description, releasing its resources.
+ *
+ * Null-safe: passing a null pointer or null handle is a no-op. The handle is set to null on return to prevent
+ * double-destruction. Column descriptions obtained from it are independent and stay valid.
+ *
+ * history:
+ * - unstable: v2.0.0
+ *
+ * @param desc The description to destroy.
+ * @return DUCKDB_V2_ERROR
+ */
+DUCKDB_C_API DUCKDB_V2_ERROR duckdb_v2_table_description_destroy(duckdb_v2_table_description_handle *desc);
+#endif
+
+#if DUCKDB_V2_API_ALLOW_UNSTABLE
+/*!
+ * Borrows the name of the column.
+ *
+ * The name carries the casing the column was declared with.
+ *
+ * history:
+ * - unstable: v2.0.0
+ *
+ * @param column The column description.
+ * @param name Receives a borrowed view of the column name. Valid until the column description is destroyed.
+ * @param err Optional. On failure, receives an opaque info handle the caller must destroy via
+ * `duckdb_v2_error_info_destroy()`.
+ * @return DUCKDB_V2_ERROR
+ */
+DUCKDB_C_API DUCKDB_V2_ERROR duckdb_v2_column_description_get_name(duckdb_v2_column_description_handle column,
+                                                                   duckdb_v2_identifier_t *name,
+                                                                   duckdb_v2_error_info_handle *err);
+#endif
+
+#if DUCKDB_V2_API_ALLOW_UNSTABLE
+/*!
+ * Borrows the type of the column.
+ *
+ * history:
+ * - unstable: v2.0.0
+ *
+ * @param column The column description.
+ * @param type Receives the borrowed column type. Valid until the column description is destroyed; do not destroy it.
+ * @param err Optional. On failure, receives an opaque info handle the caller must destroy via
+ * `duckdb_v2_error_info_destroy()`.
+ * @return DUCKDB_V2_ERROR
+ */
+DUCKDB_C_API DUCKDB_V2_ERROR duckdb_v2_column_description_get_type(duckdb_v2_column_description_handle column,
+                                                                   duckdb_v2_logical_type_handle *type,
+                                                                   duckdb_v2_error_info_handle *err);
+#endif
+
+#if DUCKDB_V2_API_ALLOW_UNSTABLE
+/*!
+ * Returns whether the column has a default value.
+ *
+ * True when the column declares a default expression; the engine evaluates it for rows that omit the column. Generated
+ * columns report false.
+ *
+ * history:
+ * - unstable: v2.0.0
+ *
+ * @param column The column description.
+ * @param has_default Receives whether the column has a default value.
+ * @param err Optional. On failure, receives an opaque info handle the caller must destroy via
+ * `duckdb_v2_error_info_destroy()`.
+ * @return DUCKDB_V2_ERROR
+ */
+DUCKDB_C_API DUCKDB_V2_ERROR duckdb_v2_column_description_has_default(duckdb_v2_column_description_handle column,
+                                                                      bool *has_default,
+                                                                      duckdb_v2_error_info_handle *err);
+#endif
+
+#if DUCKDB_V2_API_ALLOW_UNSTABLE
+/*!
+ * Returns whether the column is generated.
+ *
+ * True when the column is a generated column, computed by the engine from a generation expression and not writable.
+ *
+ * history:
+ * - unstable: v2.0.0
+ *
+ * @param column The column description.
+ * @param has_generated Receives whether the column is generated.
+ * @param err Optional. On failure, receives an opaque info handle the caller must destroy via
+ * `duckdb_v2_error_info_destroy()`.
+ * @return DUCKDB_V2_ERROR
+ */
+DUCKDB_C_API DUCKDB_V2_ERROR duckdb_v2_column_description_has_generated(duckdb_v2_column_description_handle column,
+                                                                        bool *has_generated,
+                                                                        duckdb_v2_error_info_handle *err);
+#endif
+
+#if DUCKDB_V2_API_ALLOW_UNSTABLE
+/*!
+ * Destroys the column description, releasing its resources.
+ *
+ * Null-safe: passing a null pointer or null handle is a no-op. The handle is set to null on return to prevent
+ * double-destruction. Any name or type borrowed from it becomes dangling.
+ *
+ * history:
+ * - unstable: v2.0.0
+ *
+ * @param column The column description to destroy.
+ * @return DUCKDB_V2_ERROR
+ */
+DUCKDB_C_API DUCKDB_V2_ERROR duckdb_v2_column_description_destroy(duckdb_v2_column_description_handle *column);
+#endif
+
+/* --- Struct definitions for catalog --- */
+
+/* ============================================================================
+ * MODULE: copy
+ * ============================================================================ */
+
+/* --- Enums for copy --- */
+
+/* --- Struct forward declarations for copy --- */
+
+/* --- Types for copy --- */
+
+/*!
+ * An owned opaque handle to a custom copy function being built: an output format for `COPY ... TO`, an input format for
+ * `COPY ... FROM`, or both. Created with `duckdb_v2_copy_function_create()`, configured with the setter functions (e.g.
+ * `duckdb_v2_copy_function_set_name()`, `duckdb_v2_copy_to_set_batch_callback()`,
+ * `duckdb_v2_copy_from_set_exec_callback()`, etc.), made available with `duckdb_v2_connection_register_copy_function()`
+ * or `duckdb_v2_extension_register_copy_function()`, and destroyed with `duckdb_v2_copy_function_destroy()`.
+ */
+typedef struct _duckdb_v2_copy_function {
+	void *internal_ptr;
+} * duckdb_v2_copy_function_handle;
+
+/*!
+ * A borrowed opaque handle to the arguments supplied to a copy function during the query preparation "bind" phase of a
+ * `COPY ... TO` statement. The "bind" callback receives this handle and can use it to e.g. inspect the names and types
+ * of the columns being written, read the statement's options and initialize some constant state.
+ */
+typedef struct _duckdb_v2_copy_to_bind_info {
+	void *internal_ptr;
+} * duckdb_v2_copy_to_bind_info_handle;
+
+/*!
+ * A borrowed opaque handle to the arguments supplied to a copy function during the "batch size" phase of a `COPY ...
+ * TO` statement. The "batch size" callback receives this handle and must use it to report how many rows a batch should
+ * carry.
+ */
+typedef struct _duckdb_v2_copy_to_batch_size_info {
+	void *internal_ptr;
+} * duckdb_v2_copy_to_batch_size_info_handle;
+
+/*!
+ * A borrowed opaque handle to the arguments supplied to a copy function during the per-file "init" phase of a `COPY ...
+ * TO` statement. The "init" callback receives this handle and can use it to e.g. read the path of the file being
+ * written and set up the state shared by every batch written to that file.
+ */
+typedef struct _duckdb_v2_copy_to_init_info {
+	void *internal_ptr;
+} * duckdb_v2_copy_to_init_info_handle;
+
+/*!
+ * A borrowed opaque handle to the arguments supplied to a copy function during the "batch" phase of a `COPY ... TO`
+ * statement. The "batch" callback receives this handle and can use it to take ownership of the rows of the batch and to
+ * set the prepared form of the batch handed to the "flush" callback.
+ */
+typedef struct _duckdb_v2_copy_to_batch_info {
+	void *internal_ptr;
+} * duckdb_v2_copy_to_batch_info_handle;
+
+/*!
+ * A borrowed opaque handle to the arguments supplied to a copy function during the "flush" phase of a `COPY ... TO`
+ * statement. The "flush" callback receives this handle and can use it to access the prepared batch and write it to the
+ * output.
+ */
+typedef struct _duckdb_v2_copy_to_flush_info {
+	void *internal_ptr;
+} * duckdb_v2_copy_to_flush_info_handle;
+
+/*!
+ * A borrowed opaque handle to the arguments supplied to a copy function during the per-file "finalize" phase of a `COPY
+ * ... TO` statement. The "finalize" callback receives this handle and can use it to e.g. close the file after every
+ * batch has been flushed to it.
+ */
+typedef struct _duckdb_v2_copy_to_finalize_info {
+	void *internal_ptr;
+} * duckdb_v2_copy_to_finalize_info_handle;
+
+/*!
+ * A borrowed opaque handle to the arguments supplied to a copy function when a `COPY ... TO` statement reports
+ * statistics about the files it wrote (e.g. with `RETURN_STATS`). The "statistics" callback receives this handle and
+ * uses it to report the statistics of one written file.
+ */
+typedef struct _duckdb_v2_copy_to_statistics_info {
+	void *internal_ptr;
+} * duckdb_v2_copy_to_statistics_info_handle;
+
+/*!
+ * A borrowed opaque handle to the arguments supplied to a copy function during the query preparation "bind" phase of a
+ * `COPY ... FROM` statement. The "bind" callback receives this handle and can use it to e.g. read the path of the file
+ * to read, inspect the names and types of the columns the target table expects, read the statement's options, hint at
+ * the number of rows the read will produce and initialize some constant state.
+ */
+typedef struct _duckdb_v2_copy_from_bind_info {
+	void *internal_ptr;
+} * duckdb_v2_copy_from_bind_info_handle;
+
+/*!
+ * A borrowed opaque handle to the arguments supplied to a copy function during the global state initialization "init
+ * global" phase of a `COPY ... FROM` statement. The "init global" callback receives this handle and can use it to e.g.
+ * set up the state shared by every thread reading the file, and to declare how many threads may read it.
+ */
+typedef struct _duckdb_v2_copy_from_init_global_info {
+	void *internal_ptr;
+} * duckdb_v2_copy_from_init_global_info_handle;
+
+/*!
+ * A borrowed opaque handle to the arguments supplied to a copy function during the local state initialization "init
+ * local" phase of a `COPY ... FROM` statement. The "init local" callback receives this handle and can use it to e.g.
+ * set up worker-local state, typically by claiming work from the shared global state.
+ */
+typedef struct _duckdb_v2_copy_from_init_local_info {
+	void *internal_ptr;
+} * duckdb_v2_copy_from_init_local_info_handle;
+
+/*!
+ * A borrowed opaque handle to the arguments supplied to a copy function during the execution "exec" phase of a `COPY
+ * ... FROM` statement. The "exec" callback receives this handle and can use it to e.g. access the global and local
+ * state and write the next batch of rows to the output chunk.
+ */
+typedef struct _duckdb_v2_copy_from_exec_info {
+	void *internal_ptr;
+} * duckdb_v2_copy_from_exec_info_handle;
+
+/*!
+ * A borrowed opaque handle to the arguments supplied to a copy function during the "progress" phase of a `COPY ...
+ * FROM` statement. The "progress" callback receives this handle and can use it to report how far the read has advanced.
+ */
+typedef struct _duckdb_v2_copy_from_progress_info {
+	void *internal_ptr;
+} * duckdb_v2_copy_from_progress_info_handle;
+
+/* --- Constants for copy --- */
+
+/* --- Function pointer typedefs for copy --- */
+
+typedef void (*duckdb_v2_copy_to_bind_callback_fn)(duckdb_v2_copy_to_bind_info_handle info,
+                                                   duckdb_v2_context_handle context, duckdb_v2_error_info_handle *err);
+
+typedef void (*duckdb_v2_copy_to_batch_size_callback_fn)(duckdb_v2_copy_to_batch_size_info_handle info,
+                                                         duckdb_v2_context_handle context,
+                                                         duckdb_v2_error_info_handle *err);
+
+typedef void (*duckdb_v2_copy_to_init_callback_fn)(duckdb_v2_copy_to_init_info_handle info,
+                                                   duckdb_v2_context_handle context, duckdb_v2_error_info_handle *err);
+
+typedef void (*duckdb_v2_copy_to_batch_callback_fn)(duckdb_v2_copy_to_batch_info_handle info,
+                                                    duckdb_v2_context_handle context, duckdb_v2_error_info_handle *err);
+
+typedef void (*duckdb_v2_copy_to_flush_callback_fn)(duckdb_v2_copy_to_flush_info_handle info,
+                                                    duckdb_v2_context_handle context, duckdb_v2_error_info_handle *err);
+
+typedef void (*duckdb_v2_copy_to_finalize_callback_fn)(duckdb_v2_copy_to_finalize_info_handle info,
+                                                       duckdb_v2_context_handle context,
+                                                       duckdb_v2_error_info_handle *err);
+
+typedef void (*duckdb_v2_copy_to_statistics_callback_fn)(duckdb_v2_copy_to_statistics_info_handle info,
+                                                         duckdb_v2_context_handle context,
+                                                         duckdb_v2_error_info_handle *err);
+
+typedef void (*duckdb_v2_copy_from_bind_callback_fn)(duckdb_v2_copy_from_bind_info_handle info,
+                                                     duckdb_v2_context_handle context,
+                                                     duckdb_v2_error_info_handle *err);
+
+typedef void (*duckdb_v2_copy_from_init_global_callback_fn)(duckdb_v2_copy_from_init_global_info_handle info,
+                                                            duckdb_v2_context_handle context,
+                                                            duckdb_v2_error_info_handle *err);
+
+typedef void (*duckdb_v2_copy_from_init_local_callback_fn)(duckdb_v2_copy_from_init_local_info_handle info,
+                                                           duckdb_v2_context_handle context,
+                                                           duckdb_v2_error_info_handle *err);
+
+typedef void (*duckdb_v2_copy_from_exec_callback_fn)(duckdb_v2_copy_from_exec_info_handle info,
+                                                     duckdb_v2_context_handle context,
+                                                     duckdb_v2_error_info_handle *err);
+
+typedef void (*duckdb_v2_copy_from_progress_callback_fn)(duckdb_v2_copy_from_progress_info_handle info,
+                                                         duckdb_v2_context_handle context,
+                                                         duckdb_v2_error_info_handle *err);
+
+/* --- Functions for copy --- */
+
+#if DUCKDB_V2_API_ALLOW_UNSTABLE
+/*!
+ * Creates a new copy function through a factory.
+ *
+ * A copy function implements a file format for `COPY`: once registered, SQL reaches it with `COPY ... TO 'path' (FORMAT
+ * name)` and `COPY table FROM 'path' (FORMAT name)`. The function starts out empty: configure it with the setter
+ * functions (e.g. `duckdb_v2_copy_function_set_name()`, the `copy_to_set_*` callbacks for writing, the
+ * `copy_from_set_*` callbacks for reading, or both), then make it available with
+ * `duckdb_v2_connection_register_copy_function()` or `duckdb_v2_extension_register_copy_function()`. The caller owns
+ * the returned handle and must destroy it with `duckdb_v2_copy_function_destroy()`, also after registration.
+ *
+ * The copy function can only be registered on the database the factory belongs to.
+ *
+ * history:
+ * - unstable: v2.0.0
+ *
+ * @param factory The factory to create the copy function through.
+ * @param function On success, receives the newly created copy function. Owned by the caller.
+ * @param err Optional. On failure, receives an opaque info handle the caller must destroy via
+ * `duckdb_v2_error_info_destroy()`.
+ * @return DUCKDB_V2_ERROR
+ */
+DUCKDB_C_API DUCKDB_V2_ERROR duckdb_v2_copy_function_create(duckdb_v2_factory_handle factory,
+                                                            duckdb_v2_copy_function_handle *function,
+                                                            duckdb_v2_error_info_handle *err);
+#endif
+
+#if DUCKDB_V2_API_ALLOW_UNSTABLE
+/*!
+ * Sets the name of the copy function.
+ *
+ * The name is the format SQL selects the function with: `COPY ... TO 'path' (FORMAT name)` or `COPY table FROM 'path'
+ * (FORMAT name)`. It is borrowed and copied. Calling this again replaces the previous name. A name must be set before
+ * registration.
+ *
+ * history:
+ * - unstable: v2.0.0
+ *
+ * @param function The function to set the name of.
+ * @param name The name to set. Borrowed and copied.
+ * @param err Optional. On failure, receives an opaque info handle the caller must destroy via
+ * `duckdb_v2_error_info_destroy()`.
+ * @return DUCKDB_V2_ERROR
+ */
+DUCKDB_C_API DUCKDB_V2_ERROR duckdb_v2_copy_function_set_name(duckdb_v2_copy_function_handle function,
+                                                              const duckdb_v2_identifier_t *name,
+                                                              duckdb_v2_error_info_handle *err);
+#endif
+
+#if DUCKDB_V2_API_ALLOW_UNSTABLE
+/*!
+ * Sets the file extension of the files the copy function writes, without the leading dot, e.g. `parquet`.
+ *
+ * DuckDB uses it when it names files itself, e.g. the files of `COPY ... TO 'dir' (PARTITION_BY ...)` or
+ * `(PER_THREAD_OUTPUT)`. A statement can override it with the `FILE_EXTENSION` option. An extension starting with a dot
+ * is rejected. The extension is borrowed and copied. Calling this again replaces the previous extension. Optional, but
+ * without it the names DuckDB gives files end in a bare dot, e.g. `data_0.`.
+ *
+ * history:
+ * - unstable: v2.0.0
+ *
+ * @param function The function to set the file extension of.
+ * @param extension The extension to set, without the leading dot. Borrowed and copied.
+ * @param err Optional. On failure, receives an opaque info handle the caller must destroy via
+ * `duckdb_v2_error_info_destroy()`.
+ * @return DUCKDB_V2_ERROR
+ */
+DUCKDB_C_API DUCKDB_V2_ERROR duckdb_v2_copy_function_set_file_extension(duckdb_v2_copy_function_handle function,
+                                                                        const duckdb_v2_str *extension,
+                                                                        duckdb_v2_error_info_handle *err);
+#endif
+
+#if DUCKDB_V2_API_ALLOW_UNSTABLE
+/*!
+ * Sets arbitrary user data on the copy function.
+ *
+ * Associates an opaque pointer with the function, retrievable from each callback of either side via its user data
+ * accessor (e.g. `duckdb_v2_copy_to_bind_get_user_data()`, `duckdb_v2_copy_from_exec_get_user_data()`, etc.). The
+ * opaque handle bundles the pointer with an optional destructor, invoked when the data is no longer needed.
+ *
+ * history:
+ * - unstable: v2.0.0
+ *
+ * @param function The function to set the user data of.
+ * @param data Opaque handle bundling the user data pointer plus an optional destructor.
+ * @param err Optional. On failure, receives an opaque info handle the caller must destroy via
+ * `duckdb_v2_error_info_destroy()`.
+ * @return DUCKDB_V2_ERROR
+ */
+DUCKDB_C_API DUCKDB_V2_ERROR duckdb_v2_copy_function_set_user_data(duckdb_v2_copy_function_handle function,
+                                                                   duckdb_v2_opaque *data,
+                                                                   duckdb_v2_error_info_handle *err);
+#endif
+
+#if DUCKDB_V2_API_ALLOW_UNSTABLE
+/*!
+ * Sets the optional bind callback of the `COPY ... TO` side.
+ *
+ * The bind callback is invoked during query planning for each `COPY ... TO` statement that uses the function. It can
+ * inspect the names and types of the columns being written, read the statement's options and set "bind data" that is
+ * shared with the other `COPY ... TO` callbacks.
+ *
+ * history:
+ * - unstable: v2.0.0
+ *
+ * @param function The function to set the callback of.
+ * @param callback The callback to set.
+ * @param err Optional. On failure, receives an opaque info handle the caller must destroy via
+ * `duckdb_v2_error_info_destroy()`.
+ * @return DUCKDB_V2_ERROR
+ */
+DUCKDB_C_API DUCKDB_V2_ERROR duckdb_v2_copy_to_set_bind_callback(duckdb_v2_copy_function_handle function,
+                                                                 duckdb_v2_copy_to_bind_callback_fn callback,
+                                                                 duckdb_v2_error_info_handle *err);
+#endif
+
+#if DUCKDB_V2_API_ALLOW_UNSTABLE
+/*!
+ * Sets the optional batch size callback of the `COPY ... TO` side.
+ *
+ * The batch size callback is invoked during query planning, after the bind callback, for each `COPY ... TO` statement
+ * that does not set `BATCH_SIZE` itself. It should report how many rows a batch should carry via
+ * `duckdb_v2_copy_to_batch_size_set_target()`; the engine then cuts the rows being written into batches of that size
+ * and hands each to the batch callback. Without a batch size from either the statement or the callback, a batch is cut
+ * for every chunk of rows sunk, i.e. a vector at a time. A batch may still be smaller than the reported size (the last
+ * one of a file, or when `BATCH_SIZE_BYTES` cuts it first).
+ *
+ * history:
+ * - unstable: v2.0.0
+ *
+ * @param function The function to set the callback of.
+ * @param callback The callback to set.
+ * @param err Optional. On failure, receives an opaque info handle the caller must destroy via
+ * `duckdb_v2_error_info_destroy()`.
+ * @return DUCKDB_V2_ERROR
+ */
+DUCKDB_C_API DUCKDB_V2_ERROR duckdb_v2_copy_to_set_batch_size_callback(
+    duckdb_v2_copy_function_handle function, duckdb_v2_copy_to_batch_size_callback_fn callback,
+    duckdb_v2_error_info_handle *err);
+#endif
+
+#if DUCKDB_V2_API_ALLOW_UNSTABLE
+/*!
+ * Sets the optional init callback of the `COPY ... TO` side.
+ *
+ * The init callback is invoked once per output file, before any batch destined for that file is prepared. It can read
+ * the path of the file via `duckdb_v2_copy_to_init_get_file_path()` and set "init data" that is shared with the batch,
+ * flush and finalize callbacks of that file. A statement may write several files, e.g. when its output is partitioned;
+ * each gets its own init data.
+ *
+ * history:
+ * - unstable: v2.0.0
+ *
+ * @param function The function to set the callback of.
+ * @param callback The callback to set.
+ * @param err Optional. On failure, receives an opaque info handle the caller must destroy via
+ * `duckdb_v2_error_info_destroy()`.
+ * @return DUCKDB_V2_ERROR
+ */
+DUCKDB_C_API DUCKDB_V2_ERROR duckdb_v2_copy_to_set_init_callback(duckdb_v2_copy_function_handle function,
+                                                                 duckdb_v2_copy_to_init_callback_fn callback,
+                                                                 duckdb_v2_error_info_handle *err);
+#endif
+
+#if DUCKDB_V2_API_ALLOW_UNSTABLE
+/*!
+ * Sets the batch callback of the `COPY ... TO` side.
+ *
+ * The batch callback is invoked during query execution with a batch of the rows being written, taken via
+ * `duckdb_v2_copy_to_batch_take_input()`. It prepares the batch for writing, e.g. by encoding it into the output
+ * format, and sets "batch data" via `duckdb_v2_copy_to_batch_set_batch_data()` that is handed to the flush callback.
+ * Batches may be prepared by several threads at once, so the callback must synchronize its own access to the init data.
+ * A batch callback must be set for the `COPY ... TO` side to be registered.
+ *
+ * history:
+ * - unstable: v2.0.0
+ *
+ * @param function The function to set the callback of.
+ * @param callback The callback to set.
+ * @param err Optional. On failure, receives an opaque info handle the caller must destroy via
+ * `duckdb_v2_error_info_destroy()`.
+ * @return DUCKDB_V2_ERROR
+ */
+DUCKDB_C_API DUCKDB_V2_ERROR duckdb_v2_copy_to_set_batch_callback(duckdb_v2_copy_function_handle function,
+                                                                  duckdb_v2_copy_to_batch_callback_fn callback,
+                                                                  duckdb_v2_error_info_handle *err);
+#endif
+
+#if DUCKDB_V2_API_ALLOW_UNSTABLE
+/*!
+ * Sets the flush callback of the `COPY ... TO` side.
+ *
+ * The flush callback is invoked once per prepared batch to write its batch data, available via
+ * `duckdb_v2_copy_to_flush_get_batch_data()`, to the output. Flushes of the same file never run concurrently. A flush
+ * callback must be set for the `COPY ... TO` side to be registered.
+ *
+ * history:
+ * - unstable: v2.0.0
+ *
+ * @param function The function to set the callback of.
+ * @param callback The callback to set.
+ * @param err Optional. On failure, receives an opaque info handle the caller must destroy via
+ * `duckdb_v2_error_info_destroy()`.
+ * @return DUCKDB_V2_ERROR
+ */
+DUCKDB_C_API DUCKDB_V2_ERROR duckdb_v2_copy_to_set_flush_callback(duckdb_v2_copy_function_handle function,
+                                                                  duckdb_v2_copy_to_flush_callback_fn callback,
+                                                                  duckdb_v2_error_info_handle *err);
+#endif
+
+#if DUCKDB_V2_API_ALLOW_UNSTABLE
+/*!
+ * Sets the optional finalize callback of the `COPY ... TO` side.
+ *
+ * The finalize callback is invoked once per output file after the last batch destined for that file has been flushed.
+ * It can e.g. write a footer and close the file.
+ *
+ * history:
+ * - unstable: v2.0.0
+ *
+ * @param function The function to set the callback of.
+ * @param callback The callback to set.
+ * @param err Optional. On failure, receives an opaque info handle the caller must destroy via
+ * `duckdb_v2_error_info_destroy()`.
+ * @return DUCKDB_V2_ERROR
+ */
+DUCKDB_C_API DUCKDB_V2_ERROR duckdb_v2_copy_to_set_finalize_callback(duckdb_v2_copy_function_handle function,
+                                                                     duckdb_v2_copy_to_finalize_callback_fn callback,
+                                                                     duckdb_v2_error_info_handle *err);
+#endif
+
+#if DUCKDB_V2_API_ALLOW_UNSTABLE
+/*!
+ * Retrieves the user data set via `duckdb_v2_copy_function_set_user_data()`.
+ *
+ * history:
+ * - unstable: v2.0.0
+ *
+ * @param info The bind info handle.
+ * @param data Receives the user data pointer, or null if none was set.
+ * @param err Optional. On failure, receives an opaque info handle the caller must destroy via
+ * `duckdb_v2_error_info_destroy()`.
+ * @return DUCKDB_V2_ERROR
+ */
+DUCKDB_C_API DUCKDB_V2_ERROR duckdb_v2_copy_to_bind_get_user_data(duckdb_v2_copy_to_bind_info_handle info, void **data,
+                                                                  duckdb_v2_error_info_handle *err);
+#endif
+
+#if DUCKDB_V2_API_ALLOW_UNSTABLE
+/*!
+ * Sets the function's "bind data" from the bind callback.
+ *
+ * The bind data is stored with the bound statement and retrievable from the other callbacks of the same side. The
+ * opaque handle bundles the pointer with an optional destructor, invoked when the bind data is no longer needed, and an
+ * optional equality callback used when comparing two bound statements; without one, pointer equality is used.
+ *
+ * history:
+ * - unstable: v2.0.0
+ *
+ * @param info The bind info handle.
+ * @param data Opaque handle bundling the bind data pointer plus optional destructor and equality callbacks.
+ * @param err Optional. On failure, receives an opaque info handle the caller must destroy via
+ * `duckdb_v2_error_info_destroy()`.
+ * @return DUCKDB_V2_ERROR
+ */
+DUCKDB_C_API DUCKDB_V2_ERROR duckdb_v2_copy_to_bind_set_bind_data(duckdb_v2_copy_to_bind_info_handle info,
+                                                                  duckdb_v2_opaque *data,
+                                                                  duckdb_v2_error_info_handle *err);
+#endif
+
+#if DUCKDB_V2_API_ALLOW_UNSTABLE
+/*!
+ * Retrieves the path the `COPY ... TO` statement writes to, as written in the statement.
+ *
+ * This is the target before the engine's own rewrites: the path of each file actually being written, e.g. a temporary
+ * name or a per-partition path, is only known to the init callback via `duckdb_v2_copy_to_init_get_file_path()`. The
+ * path is borrowed and valid only for the duration of the callback.
+ *
+ * history:
+ * - unstable: v2.0.0
+ *
+ * @param info The bind info handle.
+ * @param path Receives a borrowed view of the file path. Valid only for the duration of the callback.
+ * @param err Optional. On failure, receives an opaque info handle the caller must destroy via
+ * `duckdb_v2_error_info_destroy()`.
+ * @return DUCKDB_V2_ERROR
+ */
+DUCKDB_C_API DUCKDB_V2_ERROR duckdb_v2_copy_to_bind_get_file_path(duckdb_v2_copy_to_bind_info_handle info,
+                                                                  duckdb_v2_str *path,
+                                                                  duckdb_v2_error_info_handle *err);
+#endif
+
+#if DUCKDB_V2_API_ALLOW_UNSTABLE
+/*!
+ * Returns the number of columns being written, i.e. the columns of the rows every batch carries.
+ *
+ * Valid indices for `duckdb_v2_copy_to_bind_get_column_type()` and `duckdb_v2_copy_to_bind_get_column_name()` are [0,
+ * count).
+ *
+ * history:
+ * - unstable: v2.0.0
+ *
+ * @param info The bind info handle.
+ * @param count Receives the number of columns.
+ * @param err Optional. On failure, receives an opaque info handle the caller must destroy via
+ * `duckdb_v2_error_info_destroy()`.
+ * @return DUCKDB_V2_ERROR
+ */
+DUCKDB_C_API DUCKDB_V2_ERROR duckdb_v2_copy_to_bind_get_column_count(duckdb_v2_copy_to_bind_info_handle info,
+                                                                     idx_t *count, duckdb_v2_error_info_handle *err);
+#endif
+
+#if DUCKDB_V2_API_ALLOW_UNSTABLE
+/*!
+ * Retrieves the type of the column at the given index.
+ *
+ * Fails if the index is out of bounds. The returned type is owned by the caller and must be destroyed via
+ * `duckdb_v2_logical_type_destroy()`.
+ *
+ * history:
+ * - unstable: v2.0.0
+ *
+ * @param info The bind info handle.
+ * @param index The index of the column to get the type of.
+ * @param type Receives the column type. Owned by the caller; destroy via `duckdb_v2_logical_type_destroy()`.
+ * @param err Optional. On failure, receives an opaque info handle the caller must destroy via
+ * `duckdb_v2_error_info_destroy()`.
+ * @return DUCKDB_V2_ERROR
+ */
+DUCKDB_C_API DUCKDB_V2_ERROR duckdb_v2_copy_to_bind_get_column_type(duckdb_v2_copy_to_bind_info_handle info,
+                                                                    idx_t index, duckdb_v2_logical_type_handle *type,
+                                                                    duckdb_v2_error_info_handle *err);
+#endif
+
+#if DUCKDB_V2_API_ALLOW_UNSTABLE
+/*!
+ * Retrieves the name of the column at the given index.
+ *
+ * Fails if the index is out of bounds. The name is borrowed and valid only for the duration of the callback.
+ *
+ * history:
+ * - unstable: v2.0.0
+ *
+ * @param info The bind info handle.
+ * @param index The index of the column to get the name of.
+ * @param name Receives a borrowed view of the column name. Valid only for the duration of the callback.
+ * @param err Optional. On failure, receives an opaque info handle the caller must destroy via
+ * `duckdb_v2_error_info_destroy()`.
+ * @return DUCKDB_V2_ERROR
+ */
+DUCKDB_C_API DUCKDB_V2_ERROR duckdb_v2_copy_to_bind_get_column_name(duckdb_v2_copy_to_bind_info_handle info,
+                                                                    idx_t index, duckdb_v2_identifier_t *name,
+                                                                    duckdb_v2_error_info_handle *err);
+#endif
+
+#if DUCKDB_V2_API_ALLOW_UNSTABLE
+/*!
+ * Returns the number of options the `COPY` statement passed to the function.
+ *
+ * The engine's own options (e.g. `USE_TMP_FILE` or `BATCH_SIZE`) are handled before the function sees the statement and
+ * are not included. Valid indices for `duckdb_v2_copy_to_bind_get_option_name()` and
+ * `duckdb_v2_copy_to_bind_get_option_value()` are [0, count). The options are ordered by name.
+ *
+ * history:
+ * - unstable: v2.0.0
+ *
+ * @param info The bind info handle.
+ * @param count Receives the number of options.
+ * @param err Optional. On failure, receives an opaque info handle the caller must destroy via
+ * `duckdb_v2_error_info_destroy()`.
+ * @return DUCKDB_V2_ERROR
+ */
+DUCKDB_C_API DUCKDB_V2_ERROR duckdb_v2_copy_to_bind_get_option_count(duckdb_v2_copy_to_bind_info_handle info,
+                                                                     idx_t *count, duckdb_v2_error_info_handle *err);
+#endif
+
+#if DUCKDB_V2_API_ALLOW_UNSTABLE
+/*!
+ * Retrieves the name of the option at the given index.
+ *
+ * Option names are SQL identifiers, matched case-insensitively. Fails if the index is out of bounds. The name is
+ * borrowed and valid only for the duration of the callback.
+ *
+ * history:
+ * - unstable: v2.0.0
+ *
+ * @param info The bind info handle.
+ * @param index The index of the option to get the name of.
+ * @param name Receives a borrowed view of the option name. Valid only for the duration of the callback.
+ * @param err Optional. On failure, receives an opaque info handle the caller must destroy via
+ * `duckdb_v2_error_info_destroy()`.
+ * @return DUCKDB_V2_ERROR
+ */
+DUCKDB_C_API DUCKDB_V2_ERROR duckdb_v2_copy_to_bind_get_option_name(duckdb_v2_copy_to_bind_info_handle info,
+                                                                    idx_t index, duckdb_v2_identifier_t *name,
+                                                                    duckdb_v2_error_info_handle *err);
+#endif
+
+#if DUCKDB_V2_API_ALLOW_UNSTABLE
+/*!
+ * Retrieves the value of the option at the given index.
+ *
+ * An option written with a single value (e.g. `DELIM ','`) yields that value. An option written as a bare name (e.g.
+ * `HEADER`) yields the BOOLEAN `true`. An option written with a parenthesized list (e.g. `KEYS (a, b)`) yields a tuple:
+ * an unnamed STRUCT with one field per element, in order. Fails if the index is out of bounds. The returned value is
+ * owned by the caller and must be destroyed via `duckdb_v2_value_destroy()`.
+ *
+ * history:
+ * - unstable: v2.0.0
+ *
+ * @param info The bind info handle.
+ * @param index The index of the option.
+ * @param value Receives the option's value. Owned by the caller; destroy via `duckdb_v2_value_destroy()`.
+ * @param err Optional. On failure, receives an opaque info handle the caller must destroy via
+ * `duckdb_v2_error_info_destroy()`.
+ * @return DUCKDB_V2_ERROR
+ */
+DUCKDB_C_API DUCKDB_V2_ERROR duckdb_v2_copy_to_bind_get_option_value(duckdb_v2_copy_to_bind_info_handle info,
+                                                                     idx_t index, duckdb_v2_value_handle *value,
+                                                                     duckdb_v2_error_info_handle *err);
+#endif
+
+#if DUCKDB_V2_API_ALLOW_UNSTABLE
+/*!
+ * Retrieves the user data set via `duckdb_v2_copy_function_set_user_data()`.
+ *
+ * history:
+ * - unstable: v2.0.0
+ *
+ * @param info The batch size info handle.
+ * @param data Receives the user data pointer, or null if none was set.
+ * @param err Optional. On failure, receives an opaque info handle the caller must destroy via
+ * `duckdb_v2_error_info_destroy()`.
+ * @return DUCKDB_V2_ERROR
+ */
+DUCKDB_C_API DUCKDB_V2_ERROR duckdb_v2_copy_to_batch_size_get_user_data(duckdb_v2_copy_to_batch_size_info_handle info,
+                                                                        void **data, duckdb_v2_error_info_handle *err);
+#endif
+
+#if DUCKDB_V2_API_ALLOW_UNSTABLE
+/*!
+ * Retrieves the bind data set by the function's `COPY ... TO` bind callback.
+ *
+ * history:
+ * - unstable: v2.0.0
+ *
+ * @param info The batch size info handle.
+ * @param data Receives the bind data pointer, or null if none was set.
+ * @param err Optional. On failure, receives an opaque info handle the caller must destroy via
+ * `duckdb_v2_error_info_destroy()`.
+ * @return DUCKDB_V2_ERROR
+ */
+DUCKDB_C_API DUCKDB_V2_ERROR duckdb_v2_copy_to_batch_size_get_bind_data(duckdb_v2_copy_to_batch_size_info_handle info,
+                                                                        void **data, duckdb_v2_error_info_handle *err);
+#endif
+
+#if DUCKDB_V2_API_ALLOW_UNSTABLE
+/*!
+ * Sets the number of rows a batch should carry, as the target the engine cuts batches at. The batch size callback must
+ * set this to a value greater than 0; the statement fails otherwise. DuckDB defines the `BATCH_SIZE` on omission of
+ * calling the function.
+ *
+ * history:
+ * - unstable: v2.0.0
+ *
+ * @param info The batch size info handle.
+ * @param rows The number of rows a batch should carry. Must be greater than 0.
+ * @param err Optional. On failure, receives an opaque info handle the caller must destroy via
+ * `duckdb_v2_error_info_destroy()`.
+ * @return DUCKDB_V2_ERROR
+ */
+DUCKDB_C_API DUCKDB_V2_ERROR duckdb_v2_copy_to_batch_size_set_target(duckdb_v2_copy_to_batch_size_info_handle info,
+                                                                     idx_t rows, duckdb_v2_error_info_handle *err);
+#endif
+
+#if DUCKDB_V2_API_ALLOW_UNSTABLE
+/*!
+ * Retrieves the user data set via `duckdb_v2_copy_function_set_user_data()`.
+ *
+ * history:
+ * - unstable: v2.0.0
+ *
+ * @param info The init info handle.
+ * @param data Receives the user data pointer, or null if none was set.
+ * @param err Optional. On failure, receives an opaque info handle the caller must destroy via
+ * `duckdb_v2_error_info_destroy()`.
+ * @return DUCKDB_V2_ERROR
+ */
+DUCKDB_C_API DUCKDB_V2_ERROR duckdb_v2_copy_to_init_get_user_data(duckdb_v2_copy_to_init_info_handle info, void **data,
+                                                                  duckdb_v2_error_info_handle *err);
+#endif
+
+#if DUCKDB_V2_API_ALLOW_UNSTABLE
+/*!
+ * Retrieves the bind data set by the function's `COPY ... TO` bind callback.
+ *
+ * history:
+ * - unstable: v2.0.0
+ *
+ * @param info The init info handle.
+ * @param data Receives the bind data pointer, or null if none was set.
+ * @param err Optional. On failure, receives an opaque info handle the caller must destroy via
+ * `duckdb_v2_error_info_destroy()`.
+ * @return DUCKDB_V2_ERROR
+ */
+DUCKDB_C_API DUCKDB_V2_ERROR duckdb_v2_copy_to_init_get_bind_data(duckdb_v2_copy_to_init_info_handle info, void **data,
+                                                                  duckdb_v2_error_info_handle *err);
+#endif
+
+#if DUCKDB_V2_API_ALLOW_UNSTABLE
+/*!
+ * Retrieves the path of the file the init callback is preparing.
+ *
+ * This is the path the batches of this file are to be written to, after the engine has applied its own rewrites (e.g. a
+ * temporary name while the file is being written, or a per-partition path). The path is borrowed and valid only for the
+ * duration of the callback.
+ *
+ * history:
+ * - unstable: v2.0.0
+ *
+ * @param info The init info handle.
+ * @param path Receives a borrowed view of the file path. Valid only for the duration of the callback.
+ * @param err Optional. On failure, receives an opaque info handle the caller must destroy via
+ * `duckdb_v2_error_info_destroy()`.
+ * @return DUCKDB_V2_ERROR
+ */
+DUCKDB_C_API DUCKDB_V2_ERROR duckdb_v2_copy_to_init_get_file_path(duckdb_v2_copy_to_init_info_handle info,
+                                                                  duckdb_v2_str *path,
+                                                                  duckdb_v2_error_info_handle *err);
+#endif
+
+#if DUCKDB_V2_API_ALLOW_UNSTABLE
+/*!
+ * Sets the function's "init data" from the init callback.
+ *
+ * The init data lives for the duration of the file being written and is retrievable from the batch, flush and finalize
+ * callbacks of that file. Batches may be prepared by several threads at once, so the function must synchronize its own
+ * access to it from the batch callback. The opaque handle bundles the pointer with an optional destructor, invoked when
+ * the file is done with the data.
+ *
+ * history:
+ * - unstable: v2.0.0
+ *
+ * @param info The init info handle.
+ * @param data Opaque handle bundling the init data pointer plus an optional destructor.
+ * @param err Optional. On failure, receives an opaque info handle the caller must destroy via
+ * `duckdb_v2_error_info_destroy()`.
+ * @return DUCKDB_V2_ERROR
+ */
+DUCKDB_C_API DUCKDB_V2_ERROR duckdb_v2_copy_to_init_set_init_data(duckdb_v2_copy_to_init_info_handle info,
+                                                                  duckdb_v2_opaque *data,
+                                                                  duckdb_v2_error_info_handle *err);
+#endif
+
+#if DUCKDB_V2_API_ALLOW_UNSTABLE
+/*!
+ * Retrieves the user data set via `duckdb_v2_copy_function_set_user_data()`.
+ *
+ * history:
+ * - unstable: v2.0.0
+ *
+ * @param info The batch info handle.
+ * @param data Receives the user data pointer, or null if none was set.
+ * @param err Optional. On failure, receives an opaque info handle the caller must destroy via
+ * `duckdb_v2_error_info_destroy()`.
+ * @return DUCKDB_V2_ERROR
+ */
+DUCKDB_C_API DUCKDB_V2_ERROR duckdb_v2_copy_to_batch_get_user_data(duckdb_v2_copy_to_batch_info_handle info,
+                                                                   void **data, duckdb_v2_error_info_handle *err);
+#endif
+
+#if DUCKDB_V2_API_ALLOW_UNSTABLE
+/*!
+ * Retrieves the bind data set by the function's `COPY ... TO` bind callback.
+ *
+ * history:
+ * - unstable: v2.0.0
+ *
+ * @param info The batch info handle.
+ * @param data Receives the bind data pointer, or null if none was set.
+ * @param err Optional. On failure, receives an opaque info handle the caller must destroy via
+ * `duckdb_v2_error_info_destroy()`.
+ * @return DUCKDB_V2_ERROR
+ */
+DUCKDB_C_API DUCKDB_V2_ERROR duckdb_v2_copy_to_batch_get_bind_data(duckdb_v2_copy_to_batch_info_handle info,
+                                                                   void **data, duckdb_v2_error_info_handle *err);
+#endif
+
+#if DUCKDB_V2_API_ALLOW_UNSTABLE
+/*!
+ * Retrieves the init data set by the function's `COPY ... TO` init callback for the file this batch belongs to.
+ *
+ * history:
+ * - unstable: v2.0.0
+ *
+ * @param info The batch info handle.
+ * @param data Receives the init data pointer, or null if none was set.
+ * @param err Optional. On failure, receives an opaque info handle the caller must destroy via
+ * `duckdb_v2_error_info_destroy()`.
+ * @return DUCKDB_V2_ERROR
+ */
+DUCKDB_C_API DUCKDB_V2_ERROR duckdb_v2_copy_to_batch_get_init_data(duckdb_v2_copy_to_batch_info_handle info,
+                                                                   void **data, duckdb_v2_error_info_handle *err);
+#endif
+
+#if DUCKDB_V2_API_ALLOW_UNSTABLE
+/*!
+ * Takes ownership of the rows of the batch to prepare.
+ *
+ * The collection holds one column per column reported by `duckdb_v2_copy_to_bind_get_column_count()`, in the same
+ * order, and can be scanned with `duckdb_v2_column_data_collection_scan()`. The batch can only be taken once: a second
+ * call fails. Once taken, the caller owns the collection and must destroy it via
+ * `duckdb_v2_column_data_collection_destroy()`, e.g. by keeping it as the batch data with that destructor. A batch that
+ * is never taken is destroyed when the callback returns.
+ *
+ * history:
+ * - unstable: v2.0.0
+ *
+ * @param info The batch info handle.
+ * @param collection Receives the collection holding the rows of the batch. Owned by the caller; destroy via
+ * `duckdb_v2_column_data_collection_destroy()`.
+ * @param err Optional. On failure, receives an opaque info handle the caller must destroy via
+ * `duckdb_v2_error_info_destroy()`.
+ * @return DUCKDB_V2_ERROR
+ */
+DUCKDB_C_API DUCKDB_V2_ERROR duckdb_v2_copy_to_batch_take_input(duckdb_v2_copy_to_batch_info_handle info,
+                                                                duckdb_v2_column_data_collection_handle *collection,
+                                                                duckdb_v2_error_info_handle *err);
+#endif
+
+#if DUCKDB_V2_API_ALLOW_UNSTABLE
+/*!
+ * Sets the prepared "batch data" from the batch callback.
+ *
+ * The batch data is the prepared form of the batch and is handed to the flush callback via
+ * `duckdb_v2_copy_to_flush_get_batch_data()`. The opaque handle bundles the pointer with an optional destructor,
+ * invoked once the batch has been flushed.
+ *
+ * history:
+ * - unstable: v2.0.0
+ *
+ * @param info The batch info handle.
+ * @param data Opaque handle bundling the batch data pointer plus an optional destructor.
+ * @param err Optional. On failure, receives an opaque info handle the caller must destroy via
+ * `duckdb_v2_error_info_destroy()`.
+ * @return DUCKDB_V2_ERROR
+ */
+DUCKDB_C_API DUCKDB_V2_ERROR duckdb_v2_copy_to_batch_set_batch_data(duckdb_v2_copy_to_batch_info_handle info,
+                                                                    duckdb_v2_opaque *data,
+                                                                    duckdb_v2_error_info_handle *err);
+#endif
+
+#if DUCKDB_V2_API_ALLOW_UNSTABLE
+/*!
+ * Retrieves the user data set via `duckdb_v2_copy_function_set_user_data()`.
+ *
+ * history:
+ * - unstable: v2.0.0
+ *
+ * @param info The flush info handle.
+ * @param data Receives the user data pointer, or null if none was set.
+ * @param err Optional. On failure, receives an opaque info handle the caller must destroy via
+ * `duckdb_v2_error_info_destroy()`.
+ * @return DUCKDB_V2_ERROR
+ */
+DUCKDB_C_API DUCKDB_V2_ERROR duckdb_v2_copy_to_flush_get_user_data(duckdb_v2_copy_to_flush_info_handle info,
+                                                                   void **data, duckdb_v2_error_info_handle *err);
+#endif
+
+#if DUCKDB_V2_API_ALLOW_UNSTABLE
+/*!
+ * Retrieves the bind data set by the function's `COPY ... TO` bind callback.
+ *
+ * history:
+ * - unstable: v2.0.0
+ *
+ * @param info The flush info handle.
+ * @param data Receives the bind data pointer, or null if none was set.
+ * @param err Optional. On failure, receives an opaque info handle the caller must destroy via
+ * `duckdb_v2_error_info_destroy()`.
+ * @return DUCKDB_V2_ERROR
+ */
+DUCKDB_C_API DUCKDB_V2_ERROR duckdb_v2_copy_to_flush_get_bind_data(duckdb_v2_copy_to_flush_info_handle info,
+                                                                   void **data, duckdb_v2_error_info_handle *err);
+#endif
+
+#if DUCKDB_V2_API_ALLOW_UNSTABLE
+/*!
+ * Retrieves the init data set by the function's `COPY ... TO` init callback for the file this batch belongs to.
+ *
+ * history:
+ * - unstable: v2.0.0
+ *
+ * @param info The flush info handle.
+ * @param data Receives the init data pointer, or null if none was set.
+ * @param err Optional. On failure, receives an opaque info handle the caller must destroy via
+ * `duckdb_v2_error_info_destroy()`.
+ * @return DUCKDB_V2_ERROR
+ */
+DUCKDB_C_API DUCKDB_V2_ERROR duckdb_v2_copy_to_flush_get_init_data(duckdb_v2_copy_to_flush_info_handle info,
+                                                                   void **data, duckdb_v2_error_info_handle *err);
+#endif
+
+#if DUCKDB_V2_API_ALLOW_UNSTABLE
+/*!
+ * Retrieves the batch data set by the function's batch callback for the batch being flushed.
+ *
+ * history:
+ * - unstable: v2.0.0
+ *
+ * @param info The flush info handle.
+ * @param data Receives the batch data pointer, or null if none was set.
+ * @param err Optional. On failure, receives an opaque info handle the caller must destroy via
+ * `duckdb_v2_error_info_destroy()`.
+ * @return DUCKDB_V2_ERROR
+ */
+DUCKDB_C_API DUCKDB_V2_ERROR duckdb_v2_copy_to_flush_get_batch_data(duckdb_v2_copy_to_flush_info_handle info,
+                                                                    void **data, duckdb_v2_error_info_handle *err);
+#endif
+
+#if DUCKDB_V2_API_ALLOW_UNSTABLE
+/*!
+ * Retrieves the user data set via `duckdb_v2_copy_function_set_user_data()`.
+ *
+ * history:
+ * - unstable: v2.0.0
+ *
+ * @param info The finalize info handle.
+ * @param data Receives the user data pointer, or null if none was set.
+ * @param err Optional. On failure, receives an opaque info handle the caller must destroy via
+ * `duckdb_v2_error_info_destroy()`.
+ * @return DUCKDB_V2_ERROR
+ */
+DUCKDB_C_API DUCKDB_V2_ERROR duckdb_v2_copy_to_finalize_get_user_data(duckdb_v2_copy_to_finalize_info_handle info,
+                                                                      void **data, duckdb_v2_error_info_handle *err);
+#endif
+
+#if DUCKDB_V2_API_ALLOW_UNSTABLE
+/*!
+ * Retrieves the bind data set by the function's `COPY ... TO` bind callback.
+ *
+ * history:
+ * - unstable: v2.0.0
+ *
+ * @param info The finalize info handle.
+ * @param data Receives the bind data pointer, or null if none was set.
+ * @param err Optional. On failure, receives an opaque info handle the caller must destroy via
+ * `duckdb_v2_error_info_destroy()`.
+ * @return DUCKDB_V2_ERROR
+ */
+DUCKDB_C_API DUCKDB_V2_ERROR duckdb_v2_copy_to_finalize_get_bind_data(duckdb_v2_copy_to_finalize_info_handle info,
+                                                                      void **data, duckdb_v2_error_info_handle *err);
+#endif
+
+#if DUCKDB_V2_API_ALLOW_UNSTABLE
+/*!
+ * Retrieves the init data set by the function's `COPY ... TO` init callback for the file being finalized.
+ *
+ * history:
+ * - unstable: v2.0.0
+ *
+ * @param info The finalize info handle.
+ * @param data Receives the init data pointer, or null if none was set.
+ * @param err Optional. On failure, receives an opaque info handle the caller must destroy via
+ * `duckdb_v2_error_info_destroy()`.
+ * @return DUCKDB_V2_ERROR
+ */
+DUCKDB_C_API DUCKDB_V2_ERROR duckdb_v2_copy_to_finalize_get_init_data(duckdb_v2_copy_to_finalize_info_handle info,
+                                                                      void **data, duckdb_v2_error_info_handle *err);
+#endif
+
+#if DUCKDB_V2_API_ALLOW_UNSTABLE
+/*!
+ * Sets the bind callback of the `COPY ... FROM` side.
+ *
+ * The bind callback is invoked during query planning for each `COPY ... FROM` statement that uses the function. It can
+ * read the path of the file to read and the statement's options, inspect the names and types of the columns the target
+ * table expects, hint at the number of rows the read will produce, and set "bind data" that is shared with the other
+ * `COPY ... FROM` callbacks. The columns are fixed by the target table: the function must produce them as they are. A
+ * bind callback must be set for the `COPY ... FROM` side to be registered.
+ *
+ * history:
+ * - unstable: v2.0.0
+ *
+ * @param function The function to set the callback of.
+ * @param callback The callback to set.
+ * @param err Optional. On failure, receives an opaque info handle the caller must destroy via
+ * `duckdb_v2_error_info_destroy()`.
+ * @return DUCKDB_V2_ERROR
+ */
+DUCKDB_C_API DUCKDB_V2_ERROR duckdb_v2_copy_from_set_bind_callback(duckdb_v2_copy_function_handle function,
+                                                                   duckdb_v2_copy_from_bind_callback_fn callback,
+                                                                   duckdb_v2_error_info_handle *err);
+#endif
+
+#if DUCKDB_V2_API_ALLOW_UNSTABLE
+/*!
+ * Sets the optional global init callback of the `COPY ... FROM` side.
+ *
+ * The global init callback is invoked once per statement, at the start of execution. It can set "global state" shared
+ * by every thread reading the file, and declare how many threads may read it in parallel via
+ * `duckdb_v2_copy_from_init_global_set_max_threads()`.
+ *
+ * history:
+ * - unstable: v2.0.0
+ *
+ * @param function The function to set the callback of.
+ * @param callback The callback to set.
+ * @param err Optional. On failure, receives an opaque info handle the caller must destroy via
+ * `duckdb_v2_error_info_destroy()`.
+ * @return DUCKDB_V2_ERROR
+ */
+DUCKDB_C_API DUCKDB_V2_ERROR duckdb_v2_copy_from_set_init_global_callback(
+    duckdb_v2_copy_function_handle function, duckdb_v2_copy_from_init_global_callback_fn callback,
+    duckdb_v2_error_info_handle *err);
+#endif
+
+#if DUCKDB_V2_API_ALLOW_UNSTABLE
+/*!
+ * Sets the optional local init callback of the `COPY ... FROM` side.
+ *
+ * The local init callback is invoked once per thread that will read the file. It can set worker-local "local state",
+ * retrievable from the exec callback, typically derived from the shared global state.
+ *
+ * history:
+ * - unstable: v2.0.0
+ *
+ * @param function The function to set the callback of.
+ * @param callback The callback to set.
+ * @param err Optional. On failure, receives an opaque info handle the caller must destroy via
+ * `duckdb_v2_error_info_destroy()`.
+ * @return DUCKDB_V2_ERROR
+ */
+DUCKDB_C_API DUCKDB_V2_ERROR duckdb_v2_copy_from_set_init_local_callback(
+    duckdb_v2_copy_function_handle function, duckdb_v2_copy_from_init_local_callback_fn callback,
+    duckdb_v2_error_info_handle *err);
+#endif
+
+#if DUCKDB_V2_API_ALLOW_UNSTABLE
+/*!
+ * Sets the exec callback of the `COPY ... FROM` side.
+ *
+ * The exec callback implements the read: it is invoked repeatedly during query execution and writes the next batch of
+ * rows to the output chunk, until it produces an empty batch to signal the end of the read. An exec callback must be
+ * set for the `COPY ... FROM` side to be registered.
+ *
+ * history:
+ * - unstable: v2.0.0
+ *
+ * @param function The function to set the callback of.
+ * @param callback The callback to set.
+ * @param err Optional. On failure, receives an opaque info handle the caller must destroy via
+ * `duckdb_v2_error_info_destroy()`.
+ * @return DUCKDB_V2_ERROR
+ */
+DUCKDB_C_API DUCKDB_V2_ERROR duckdb_v2_copy_from_set_exec_callback(duckdb_v2_copy_function_handle function,
+                                                                   duckdb_v2_copy_from_exec_callback_fn callback,
+                                                                   duckdb_v2_error_info_handle *err);
+#endif
+
+#if DUCKDB_V2_API_ALLOW_UNSTABLE
+/*!
+ * Sets the optional progress callback of the `COPY ... FROM` side.
+ *
+ * The progress callback is invoked on demand during execution to report how far the read has advanced, which the engine
+ * surfaces as the query's progress. It is invoked concurrently with the exec callback, so it must read the global state
+ * in a thread-safe way.
+ *
+ * history:
+ * - unstable: v2.0.0
+ *
+ * @param function The function to set the callback of.
+ * @param callback The callback to set.
+ * @param err Optional. On failure, receives an opaque info handle the caller must destroy via
+ * `duckdb_v2_error_info_destroy()`.
+ * @return DUCKDB_V2_ERROR
+ */
+DUCKDB_C_API DUCKDB_V2_ERROR duckdb_v2_copy_from_set_progress_callback(
+    duckdb_v2_copy_function_handle function, duckdb_v2_copy_from_progress_callback_fn callback,
+    duckdb_v2_error_info_handle *err);
+#endif
+
+#if DUCKDB_V2_API_ALLOW_UNSTABLE
+/*!
+ * Retrieves the user data set via `duckdb_v2_copy_function_set_user_data()`.
+ *
+ * history:
+ * - unstable: v2.0.0
+ *
+ * @param info The bind info handle.
+ * @param data Receives the user data pointer, or null if none was set.
+ * @param err Optional. On failure, receives an opaque info handle the caller must destroy via
+ * `duckdb_v2_error_info_destroy()`.
+ * @return DUCKDB_V2_ERROR
+ */
+DUCKDB_C_API DUCKDB_V2_ERROR duckdb_v2_copy_from_bind_get_user_data(duckdb_v2_copy_from_bind_info_handle info,
+                                                                    void **data, duckdb_v2_error_info_handle *err);
+#endif
+
+#if DUCKDB_V2_API_ALLOW_UNSTABLE
+/*!
+ * Sets the function's "bind data" from the bind callback.
+ *
+ * The bind data is stored with the bound statement and retrievable from the other callbacks of the same side. The
+ * opaque handle bundles the pointer with an optional destructor, invoked when the bind data is no longer needed, and an
+ * optional equality callback used when comparing two bound statements; without one, pointer equality is used.
+ *
+ * history:
+ * - unstable: v2.0.0
+ *
+ * @param info The bind info handle.
+ * @param data Opaque handle bundling the bind data pointer plus optional destructor and equality callbacks.
+ * @param err Optional. On failure, receives an opaque info handle the caller must destroy via
+ * `duckdb_v2_error_info_destroy()`.
+ * @return DUCKDB_V2_ERROR
+ */
+DUCKDB_C_API DUCKDB_V2_ERROR duckdb_v2_copy_from_bind_set_bind_data(duckdb_v2_copy_from_bind_info_handle info,
+                                                                    duckdb_v2_opaque *data,
+                                                                    duckdb_v2_error_info_handle *err);
+#endif
+
+#if DUCKDB_V2_API_ALLOW_UNSTABLE
+/*!
+ * Retrieves the path the `COPY ... FROM` statement reads from, as written in the statement.
+ *
+ * The engine does not expand globs or check that the file exists; both are left to the function. The path is borrowed
+ * and valid only for the duration of the callback.
+ *
+ * history:
+ * - unstable: v2.0.0
+ *
+ * @param info The bind info handle.
+ * @param path Receives a borrowed view of the file path. Valid only for the duration of the callback.
+ * @param err Optional. On failure, receives an opaque info handle the caller must destroy via
+ * `duckdb_v2_error_info_destroy()`.
+ * @return DUCKDB_V2_ERROR
+ */
+DUCKDB_C_API DUCKDB_V2_ERROR duckdb_v2_copy_from_bind_get_file_path(duckdb_v2_copy_from_bind_info_handle info,
+                                                                    duckdb_v2_str *path,
+                                                                    duckdb_v2_error_info_handle *err);
+#endif
+
+#if DUCKDB_V2_API_ALLOW_UNSTABLE
+/*!
+ * Returns the number of columns the target table expects, i.e. the columns every batch the exec callback produces must
+ * carry, in this order.
+ *
+ * Valid indices for `duckdb_v2_copy_from_bind_get_column_type()` and `duckdb_v2_copy_from_bind_get_column_name()` are
+ * [0, count).
+ *
+ * history:
+ * - unstable: v2.0.0
+ *
+ * @param info The bind info handle.
+ * @param count Receives the number of columns.
+ * @param err Optional. On failure, receives an opaque info handle the caller must destroy via
+ * `duckdb_v2_error_info_destroy()`.
+ * @return DUCKDB_V2_ERROR
+ */
+DUCKDB_C_API DUCKDB_V2_ERROR duckdb_v2_copy_from_bind_get_column_count(duckdb_v2_copy_from_bind_info_handle info,
+                                                                       idx_t *count, duckdb_v2_error_info_handle *err);
+#endif
+
+#if DUCKDB_V2_API_ALLOW_UNSTABLE
+/*!
+ * Retrieves the type of the column at the given index.
+ *
+ * Fails if the index is out of bounds. The returned type is owned by the caller and must be destroyed via
+ * `duckdb_v2_logical_type_destroy()`.
+ *
+ * history:
+ * - unstable: v2.0.0
+ *
+ * @param info The bind info handle.
+ * @param index The index of the column to get the type of.
+ * @param type Receives the column type. Owned by the caller; destroy via `duckdb_v2_logical_type_destroy()`.
+ * @param err Optional. On failure, receives an opaque info handle the caller must destroy via
+ * `duckdb_v2_error_info_destroy()`.
+ * @return DUCKDB_V2_ERROR
+ */
+DUCKDB_C_API DUCKDB_V2_ERROR duckdb_v2_copy_from_bind_get_column_type(duckdb_v2_copy_from_bind_info_handle info,
+                                                                      idx_t index, duckdb_v2_logical_type_handle *type,
+                                                                      duckdb_v2_error_info_handle *err);
+#endif
+
+#if DUCKDB_V2_API_ALLOW_UNSTABLE
+/*!
+ * Retrieves the name of the column at the given index.
+ *
+ * Fails if the index is out of bounds. The name is borrowed and valid only for the duration of the callback.
+ *
+ * history:
+ * - unstable: v2.0.0
+ *
+ * @param info The bind info handle.
+ * @param index The index of the column to get the name of.
+ * @param name Receives a borrowed view of the column name. Valid only for the duration of the callback.
+ * @param err Optional. On failure, receives an opaque info handle the caller must destroy via
+ * `duckdb_v2_error_info_destroy()`.
+ * @return DUCKDB_V2_ERROR
+ */
+DUCKDB_C_API DUCKDB_V2_ERROR duckdb_v2_copy_from_bind_get_column_name(duckdb_v2_copy_from_bind_info_handle info,
+                                                                      idx_t index, duckdb_v2_identifier_t *name,
+                                                                      duckdb_v2_error_info_handle *err);
+#endif
+
+#if DUCKDB_V2_API_ALLOW_UNSTABLE
+/*!
+ * Returns the number of options the `COPY` statement passed to the function.
+ *
+ * Every option other than `FORMAT` is included. Valid indices for `duckdb_v2_copy_from_bind_get_option_name()` and
+ * `duckdb_v2_copy_from_bind_get_option_value()` are [0, count). The options are ordered by name.
+ *
+ * history:
+ * - unstable: v2.0.0
+ *
+ * @param info The bind info handle.
+ * @param count Receives the number of options.
+ * @param err Optional. On failure, receives an opaque info handle the caller must destroy via
+ * `duckdb_v2_error_info_destroy()`.
+ * @return DUCKDB_V2_ERROR
+ */
+DUCKDB_C_API DUCKDB_V2_ERROR duckdb_v2_copy_from_bind_get_option_count(duckdb_v2_copy_from_bind_info_handle info,
+                                                                       idx_t *count, duckdb_v2_error_info_handle *err);
+#endif
+
+#if DUCKDB_V2_API_ALLOW_UNSTABLE
+/*!
+ * Retrieves the name of the option at the given index.
+ *
+ * Option names are SQL identifiers, matched case-insensitively. Fails if the index is out of bounds. The name is
+ * borrowed and valid only for the duration of the callback.
+ *
+ * history:
+ * - unstable: v2.0.0
+ *
+ * @param info The bind info handle.
+ * @param index The index of the option to get the name of.
+ * @param name Receives a borrowed view of the option name. Valid only for the duration of the callback.
+ * @param err Optional. On failure, receives an opaque info handle the caller must destroy via
+ * `duckdb_v2_error_info_destroy()`.
+ * @return DUCKDB_V2_ERROR
+ */
+DUCKDB_C_API DUCKDB_V2_ERROR duckdb_v2_copy_from_bind_get_option_name(duckdb_v2_copy_from_bind_info_handle info,
+                                                                      idx_t index, duckdb_v2_identifier_t *name,
+                                                                      duckdb_v2_error_info_handle *err);
+#endif
+
+#if DUCKDB_V2_API_ALLOW_UNSTABLE
+/*!
+ * Retrieves the value of the option at the given index.
+ *
+ * An option written with a single value (e.g. `DELIM ','`) yields that value. An option written as a bare name (e.g.
+ * `HEADER`) yields the BOOLEAN `true`. An option written with a parenthesized list (e.g. `KEYS (a, b)`) yields a tuple:
+ * an unnamed STRUCT with one field per element, in order. Fails if the index is out of bounds. The returned value is
+ * owned by the caller and must be destroyed via `duckdb_v2_value_destroy()`.
+ *
+ * history:
+ * - unstable: v2.0.0
+ *
+ * @param info The bind info handle.
+ * @param index The index of the option.
+ * @param value Receives the option's value. Owned by the caller; destroy via `duckdb_v2_value_destroy()`.
+ * @param err Optional. On failure, receives an opaque info handle the caller must destroy via
+ * `duckdb_v2_error_info_destroy()`.
+ * @return DUCKDB_V2_ERROR
+ */
+DUCKDB_C_API DUCKDB_V2_ERROR duckdb_v2_copy_from_bind_get_option_value(duckdb_v2_copy_from_bind_info_handle info,
+                                                                       idx_t index, duckdb_v2_value_handle *value,
+                                                                       duckdb_v2_error_info_handle *err);
+#endif
+
+#if DUCKDB_V2_API_ALLOW_UNSTABLE
+/*!
+ * Reports the estimated number of rows the read will produce.
+ *
+ * The estimate is a hint for the optimizer, not a limit: producing a different number of rows is not an error. Without
+ * it, the optimizer falls back on its own defaults.
+ *
+ * history:
+ * - unstable: v2.0.0
+ *
+ * @param info The bind info handle.
+ * @param cardinality The estimated number of rows.
+ * @param is_exact Whether the estimate is exact, which also makes it an upper bound on the row count.
+ * @param err Optional. On failure, receives an opaque info handle the caller must destroy via
+ * `duckdb_v2_error_info_destroy()`.
+ * @return DUCKDB_V2_ERROR
+ */
+DUCKDB_C_API DUCKDB_V2_ERROR duckdb_v2_copy_from_bind_set_cardinality(duckdb_v2_copy_from_bind_info_handle info,
+                                                                      idx_t cardinality, bool is_exact,
+                                                                      duckdb_v2_error_info_handle *err);
+#endif
+
+#if DUCKDB_V2_API_ALLOW_UNSTABLE
+/*!
+ * Retrieves the user data set via `duckdb_v2_copy_function_set_user_data()`.
+ *
+ * history:
+ * - unstable: v2.0.0
+ *
+ * @param info The global init info handle.
+ * @param data Receives the user data pointer, or null if none was set.
+ * @param err Optional. On failure, receives an opaque info handle the caller must destroy via
+ * `duckdb_v2_error_info_destroy()`.
+ * @return DUCKDB_V2_ERROR
+ */
+DUCKDB_C_API DUCKDB_V2_ERROR duckdb_v2_copy_from_init_global_get_user_data(
+    duckdb_v2_copy_from_init_global_info_handle info, void **data, duckdb_v2_error_info_handle *err);
+#endif
+
+#if DUCKDB_V2_API_ALLOW_UNSTABLE
+/*!
+ * Retrieves the bind data set by the function's `COPY ... FROM` bind callback.
+ *
+ * history:
+ * - unstable: v2.0.0
+ *
+ * @param info The global init info handle.
+ * @param data Receives the bind data pointer, or null if none was set.
+ * @param err Optional. On failure, receives an opaque info handle the caller must destroy via
+ * `duckdb_v2_error_info_destroy()`.
+ * @return DUCKDB_V2_ERROR
+ */
+DUCKDB_C_API DUCKDB_V2_ERROR duckdb_v2_copy_from_init_global_get_bind_data(
+    duckdb_v2_copy_from_init_global_info_handle info, void **data, duckdb_v2_error_info_handle *err);
+#endif
+
+#if DUCKDB_V2_API_ALLOW_UNSTABLE
+/*!
+ * Sets the function's "global state" from the global init callback.
+ *
+ * The global state lives for the duration of the read and is retrievable from the local init, exec and progress
+ * callbacks. Every thread reading the file shares it, so the function must synchronize its own access to it. The opaque
+ * handle bundles the pointer with an optional destructor, invoked when the read is done with the state.
+ *
+ * history:
+ * - unstable: v2.0.0
+ *
+ * @param info The global init info handle.
+ * @param data Opaque handle bundling the global state pointer plus an optional destructor.
+ * @param err Optional. On failure, receives an opaque info handle the caller must destroy via
+ * `duckdb_v2_error_info_destroy()`.
+ * @return DUCKDB_V2_ERROR
+ */
+DUCKDB_C_API DUCKDB_V2_ERROR duckdb_v2_copy_from_init_global_set_global_state(
+    duckdb_v2_copy_from_init_global_info_handle info, duckdb_v2_opaque *data, duckdb_v2_error_info_handle *err);
+#endif
+
+#if DUCKDB_V2_API_ALLOW_UNSTABLE
+/*!
+ * Sets how many threads may read the file in parallel.
+ *
+ * Defaults to 1, a single-threaded read. The engine creates at most this many local states, and therefore runs at most
+ * this many exec callbacks concurrently. It is an upper bound, not a request: the engine may use fewer threads.
+ *
+ * history:
+ * - unstable: v2.0.0
+ *
+ * @param info The global init info handle.
+ * @param max_threads The maximum number of threads. Must be at least 1.
+ * @param err Optional. On failure, receives an opaque info handle the caller must destroy via
+ * `duckdb_v2_error_info_destroy()`.
+ * @return DUCKDB_V2_ERROR
+ */
+DUCKDB_C_API DUCKDB_V2_ERROR duckdb_v2_copy_from_init_global_set_max_threads(
+    duckdb_v2_copy_from_init_global_info_handle info, idx_t max_threads, duckdb_v2_error_info_handle *err);
+#endif
+
+#if DUCKDB_V2_API_ALLOW_UNSTABLE
+/*!
+ * Retrieves the user data set via `duckdb_v2_copy_function_set_user_data()`.
+ *
+ * history:
+ * - unstable: v2.0.0
+ *
+ * @param info The local init info handle.
+ * @param data Receives the user data pointer, or null if none was set.
+ * @param err Optional. On failure, receives an opaque info handle the caller must destroy via
+ * `duckdb_v2_error_info_destroy()`.
+ * @return DUCKDB_V2_ERROR
+ */
+DUCKDB_C_API DUCKDB_V2_ERROR duckdb_v2_copy_from_init_local_get_user_data(
+    duckdb_v2_copy_from_init_local_info_handle info, void **data, duckdb_v2_error_info_handle *err);
+#endif
+
+#if DUCKDB_V2_API_ALLOW_UNSTABLE
+/*!
+ * Retrieves the bind data set by the function's `COPY ... FROM` bind callback.
+ *
+ * history:
+ * - unstable: v2.0.0
+ *
+ * @param info The local init info handle.
+ * @param data Receives the bind data pointer, or null if none was set.
+ * @param err Optional. On failure, receives an opaque info handle the caller must destroy via
+ * `duckdb_v2_error_info_destroy()`.
+ * @return DUCKDB_V2_ERROR
+ */
+DUCKDB_C_API DUCKDB_V2_ERROR duckdb_v2_copy_from_init_local_get_bind_data(
+    duckdb_v2_copy_from_init_local_info_handle info, void **data, duckdb_v2_error_info_handle *err);
+#endif
+
+#if DUCKDB_V2_API_ALLOW_UNSTABLE
+/*!
+ * Retrieves the global state set by the function's global init callback.
+ *
+ * Shared with every other thread reading the file; access to it must be synchronized by the function.
+ *
+ * history:
+ * - unstable: v2.0.0
+ *
+ * @param info The local init info handle.
+ * @param data Receives the global state pointer, or null if none was set.
+ * @param err Optional. On failure, receives an opaque info handle the caller must destroy via
+ * `duckdb_v2_error_info_destroy()`.
+ * @return DUCKDB_V2_ERROR
+ */
+DUCKDB_C_API DUCKDB_V2_ERROR duckdb_v2_copy_from_init_local_get_global_state(
+    duckdb_v2_copy_from_init_local_info_handle info, void **data, duckdb_v2_error_info_handle *err);
+#endif
+
+#if DUCKDB_V2_API_ALLOW_UNSTABLE
+/*!
+ * Sets the function's worker-local "local state" from the local init callback.
+ *
+ * The local state is associated with the executing thread for the duration of the read and retrievable from the exec
+ * callback via `duckdb_v2_copy_from_exec_get_local_state()`. No other thread observes it, so it needs no
+ * synchronization. The opaque handle bundles the pointer with an optional destructor, invoked when the local state is
+ * no longer needed.
+ *
+ * history:
+ * - unstable: v2.0.0
+ *
+ * @param info The local init info handle.
+ * @param data Opaque handle bundling the local state pointer plus an optional destructor.
+ * @param err Optional. On failure, receives an opaque info handle the caller must destroy via
+ * `duckdb_v2_error_info_destroy()`.
+ * @return DUCKDB_V2_ERROR
+ */
+DUCKDB_C_API DUCKDB_V2_ERROR duckdb_v2_copy_from_init_local_set_local_state(
+    duckdb_v2_copy_from_init_local_info_handle info, duckdb_v2_opaque *data, duckdb_v2_error_info_handle *err);
+#endif
+
+#if DUCKDB_V2_API_ALLOW_UNSTABLE
+/*!
+ * Retrieves the user data set via `duckdb_v2_copy_function_set_user_data()`.
+ *
+ * history:
+ * - unstable: v2.0.0
+ *
+ * @param info The exec info handle.
+ * @param data Receives the user data pointer, or null if none was set.
+ * @param err Optional. On failure, receives an opaque info handle the caller must destroy via
+ * `duckdb_v2_error_info_destroy()`.
+ * @return DUCKDB_V2_ERROR
+ */
+DUCKDB_C_API DUCKDB_V2_ERROR duckdb_v2_copy_from_exec_get_user_data(duckdb_v2_copy_from_exec_info_handle info,
+                                                                    void **data, duckdb_v2_error_info_handle *err);
+#endif
+
+#if DUCKDB_V2_API_ALLOW_UNSTABLE
+/*!
+ * Retrieves the bind data set by the function's `COPY ... FROM` bind callback.
+ *
+ * history:
+ * - unstable: v2.0.0
+ *
+ * @param info The exec info handle.
+ * @param data Receives the bind data pointer, or null if none was set.
+ * @param err Optional. On failure, receives an opaque info handle the caller must destroy via
+ * `duckdb_v2_error_info_destroy()`.
+ * @return DUCKDB_V2_ERROR
+ */
+DUCKDB_C_API DUCKDB_V2_ERROR duckdb_v2_copy_from_exec_get_bind_data(duckdb_v2_copy_from_exec_info_handle info,
+                                                                    void **data, duckdb_v2_error_info_handle *err);
+#endif
+
+#if DUCKDB_V2_API_ALLOW_UNSTABLE
+/*!
+ * Retrieves the global state set by the function's global init callback.
+ *
+ * Shared with every other thread reading the file; access to it must be synchronized by the function.
+ *
+ * history:
+ * - unstable: v2.0.0
+ *
+ * @param info The exec info handle.
+ * @param data Receives the global state pointer, or null if none was set.
+ * @param err Optional. On failure, receives an opaque info handle the caller must destroy via
+ * `duckdb_v2_error_info_destroy()`.
+ * @return DUCKDB_V2_ERROR
+ */
+DUCKDB_C_API DUCKDB_V2_ERROR duckdb_v2_copy_from_exec_get_global_state(duckdb_v2_copy_from_exec_info_handle info,
+                                                                       void **data, duckdb_v2_error_info_handle *err);
+#endif
+
+#if DUCKDB_V2_API_ALLOW_UNSTABLE
+/*!
+ * Retrieves the worker-local local state set by the function's local init callback.
+ *
+ * history:
+ * - unstable: v2.0.0
+ *
+ * @param info The exec info handle.
+ * @param data Receives the local state pointer for the executing thread, or null if none was set.
+ * @param err Optional. On failure, receives an opaque info handle the caller must destroy via
+ * `duckdb_v2_error_info_destroy()`.
+ * @return DUCKDB_V2_ERROR
+ */
+DUCKDB_C_API DUCKDB_V2_ERROR duckdb_v2_copy_from_exec_get_local_state(duckdb_v2_copy_from_exec_info_handle info,
+                                                                      void **data, duckdb_v2_error_info_handle *err);
+#endif
+
+#if DUCKDB_V2_API_ALLOW_UNSTABLE
+/*!
+ * Retrieves the output chunk the exec callback must write the next batch of rows into.
+ *
+ * The chunk holds one vector per column reported by `duckdb_v2_copy_from_bind_get_column_count()`, in the same order;
+ * reach them with `duckdb_v2_data_chunk_get_vector()`. The chunk starts out empty on every invocation: write the rows,
+ * then declare how many there are with `duckdb_v2_vector_set_size()` on the first vector, which the engine takes as the
+ * batch's row count and propagates to the other vectors. Producing an empty batch signals the end of the read, after
+ * which the callback is not invoked again on that thread. Borrowed; valid only for the duration of the callback.
+ *
+ * history:
+ * - unstable: v2.0.0
+ *
+ * @param info The exec info handle.
+ * @param chunk Receives the borrowed output chunk to write into.
+ * @param err Optional. On failure, receives an opaque info handle the caller must destroy via
+ * `duckdb_v2_error_info_destroy()`.
+ * @return DUCKDB_V2_ERROR
+ */
+DUCKDB_C_API DUCKDB_V2_ERROR duckdb_v2_copy_from_exec_get_output_chunk(duckdb_v2_copy_from_exec_info_handle info,
+                                                                       duckdb_v2_data_chunk_handle *chunk,
+                                                                       duckdb_v2_error_info_handle *err);
+#endif
+
+#if DUCKDB_V2_API_ALLOW_UNSTABLE
+/*!
+ * Retrieves the user data set via `duckdb_v2_copy_function_set_user_data()`.
+ *
+ * history:
+ * - unstable: v2.0.0
+ *
+ * @param info The progress info handle.
+ * @param data Receives the user data pointer, or null if none was set.
+ * @param err Optional. On failure, receives an opaque info handle the caller must destroy via
+ * `duckdb_v2_error_info_destroy()`.
+ * @return DUCKDB_V2_ERROR
+ */
+DUCKDB_C_API DUCKDB_V2_ERROR duckdb_v2_copy_from_progress_get_user_data(duckdb_v2_copy_from_progress_info_handle info,
+                                                                        void **data, duckdb_v2_error_info_handle *err);
+#endif
+
+#if DUCKDB_V2_API_ALLOW_UNSTABLE
+/*!
+ * Retrieves the bind data set by the function's `COPY ... FROM` bind callback.
+ *
+ * history:
+ * - unstable: v2.0.0
+ *
+ * @param info The progress info handle.
+ * @param data Receives the bind data pointer, or null if none was set.
+ * @param err Optional. On failure, receives an opaque info handle the caller must destroy via
+ * `duckdb_v2_error_info_destroy()`.
+ * @return DUCKDB_V2_ERROR
+ */
+DUCKDB_C_API DUCKDB_V2_ERROR duckdb_v2_copy_from_progress_get_bind_data(duckdb_v2_copy_from_progress_info_handle info,
+                                                                        void **data, duckdb_v2_error_info_handle *err);
+#endif
+
+#if DUCKDB_V2_API_ALLOW_UNSTABLE
+/*!
+ * Retrieves the global state set by the function's global init callback.
+ *
+ * The progress callback runs concurrently with the exec callbacks reading the file, so it must read the global state in
+ * a thread-safe way.
+ *
+ * history:
+ * - unstable: v2.0.0
+ *
+ * @param info The progress info handle.
+ * @param data Receives the global state pointer, or null if none was set.
+ * @param err Optional. On failure, receives an opaque info handle the caller must destroy via
+ * `duckdb_v2_error_info_destroy()`.
+ * @return DUCKDB_V2_ERROR
+ */
+DUCKDB_C_API DUCKDB_V2_ERROR duckdb_v2_copy_from_progress_get_global_state(
+    duckdb_v2_copy_from_progress_info_handle info, void **data, duckdb_v2_error_info_handle *err);
+#endif
+
+#if DUCKDB_V2_API_ALLOW_UNSTABLE
+/*!
+ * Reports how far the read has advanced.
+ *
+ * A fraction between 0.0 (nothing read yet) and 1.0 (done); values outside that range are clamped. A progress callback
+ * that returns without calling this reports no progress.
+ *
+ * history:
+ * - unstable: v2.0.0
+ *
+ * @param info The progress info handle.
+ * @param progress The fraction of the read that is complete, in [0.0, 1.0].
+ * @param err Optional. On failure, receives an opaque info handle the caller must destroy via
+ * `duckdb_v2_error_info_destroy()`.
+ * @return DUCKDB_V2_ERROR
+ */
+DUCKDB_C_API DUCKDB_V2_ERROR duckdb_v2_copy_from_progress_set_progress(duckdb_v2_copy_from_progress_info_handle info,
+                                                                       double progress,
+                                                                       duckdb_v2_error_info_handle *err);
+#endif
+
+#if DUCKDB_V2_API_ALLOW_UNSTABLE
+/*!
+ * Registers the copy function, making it available as a `COPY` format.
+ *
+ * The function is registered on the connection's database, visible to every connection, in the connection's
+ * transaction: inside an explicit transaction, it is invisible to other connections until the transaction commits, and
+ * a rollback undoes it. Registration requires a name and at least one configured side: a `COPY ... TO` side needs its
+ * batch and flush callbacks, a `COPY ... FROM` side needs its bind and exec callbacks. A statement in a direction the
+ * function does not implement fails with an error. The copy function must have been created through a factory of the
+ * same database. The caller still owns the handle after registration and must destroy it with
+ * `duckdb_v2_copy_function_destroy()`, which does not affect the registered function.
+ *
+ * history:
+ * - unstable: v2.0.0
+ *
+ * @param conn The connection to register on.
+ * @param function The copy function to register.
+ * @param err Optional. On failure, receives an opaque info handle the caller must destroy via
+ * `duckdb_v2_error_info_destroy()`.
+ * @return DUCKDB_V2_ERROR
+ */
+DUCKDB_C_API DUCKDB_V2_ERROR duckdb_v2_connection_register_copy_function(duckdb_v2_connection_handle conn,
+                                                                         duckdb_v2_copy_function_handle function,
+                                                                         duckdb_v2_error_info_handle *err);
+#endif
+
+#if DUCKDB_V2_API_ALLOW_UNSTABLE
+/*!
+ * Registers the copy function, making it available as a `COPY` format.
+ *
+ * The function is registered on the loading extension's database and attributed to the extension. Use this from the
+ * extension's load callback. Registration requires a name and at least one configured side: a `COPY ... TO` side needs
+ * its batch and flush callbacks, a `COPY ... FROM` side needs its bind and exec callbacks. A statement in a direction
+ * the function does not implement fails with an error. The copy function must have been created through a factory of
+ * the same database. The caller still owns the handle after registration and must destroy it with
+ * `duckdb_v2_copy_function_destroy()`, which does not affect the registered function.
+ *
+ * history:
+ * - unstable: v2.0.0
+ *
+ * @param extension The loading extension.
+ * @param function The copy function to register.
+ * @param err Optional. On failure, receives an opaque info handle the caller must destroy via
+ * `duckdb_v2_error_info_destroy()`.
+ * @return DUCKDB_V2_ERROR
+ */
+DUCKDB_C_API DUCKDB_V2_ERROR duckdb_v2_extension_register_copy_function(duckdb_v2_extension_handle extension,
+                                                                        duckdb_v2_copy_function_handle function,
+                                                                        duckdb_v2_error_info_handle *err);
+#endif
+
+#if DUCKDB_V2_API_ALLOW_UNSTABLE
+/*!
+ * Destroys the copy function, releasing its resources.
+ *
+ * Null-safe: passing a null pointer or null handle is a no-op. The handle is set to null on return to prevent
+ * double-destruction. Destroying the handle after registration does not affect the registered function.
+ *
+ * history:
+ * - unstable: v2.0.0
+ *
+ * @param function The function to destroy.
+ * @return DUCKDB_V2_ERROR
+ */
+DUCKDB_C_API DUCKDB_V2_ERROR duckdb_v2_copy_function_destroy(duckdb_v2_copy_function_handle *function);
+#endif
+
+#if DUCKDB_V2_API_ALLOW_UNSTABLE
+/*!
+ * Sets the optional statistics callback of the `COPY ... TO` side.
+ *
+ * The statistics callback reports statistics about a written file, such as the number of rows and bytes it holds, which
+ * `COPY ... TO` returns when the statement asks for them with `RETURN_STATS`. It is invoked once per output file, after
+ * the finalize callback of that file, and only when the statement asks for the statistics. Without a statistics
+ * callback, `RETURN_STATS` is rejected for the function.
+ *
+ * history:
+ * - unstable: v2.0.0
+ *
+ * @param function The function to set the callback of.
+ * @param callback The callback to set.
+ * @param err Optional. On failure, receives an opaque info handle the caller must destroy via
+ * `duckdb_v2_error_info_destroy()`.
+ * @return DUCKDB_V2_ERROR
+ */
+DUCKDB_C_API DUCKDB_V2_ERROR duckdb_v2_copy_to_set_statistics_callback(
+    duckdb_v2_copy_function_handle function, duckdb_v2_copy_to_statistics_callback_fn callback,
+    duckdb_v2_error_info_handle *err);
+#endif
+
+#if DUCKDB_V2_API_ALLOW_UNSTABLE
+/*!
+ * Retrieves the user data set on the copy function via `duckdb_v2_copy_function_set_user_data()`.
+ *
+ * history:
+ * - unstable: v2.0.0
+ *
+ * @param info The statistics info handle.
+ * @param data Receives the user data pointer, or null if none was set.
+ * @param err Optional. On failure, receives an opaque info handle the caller must destroy via
+ * `duckdb_v2_error_info_destroy()`.
+ * @return DUCKDB_V2_ERROR
+ */
+DUCKDB_C_API DUCKDB_V2_ERROR duckdb_v2_copy_to_statistics_get_user_data(duckdb_v2_copy_to_statistics_info_handle info,
+                                                                        void **data, duckdb_v2_error_info_handle *err);
+#endif
+
+#if DUCKDB_V2_API_ALLOW_UNSTABLE
+/*!
+ * Retrieves the bind data set by the function's `COPY ... TO` bind callback.
+ *
+ * history:
+ * - unstable: v2.0.0
+ *
+ * @param info The statistics info handle.
+ * @param data Receives the bind data pointer, or null if none was set.
+ * @param err Optional. On failure, receives an opaque info handle the caller must destroy via
+ * `duckdb_v2_error_info_destroy()`.
+ * @return DUCKDB_V2_ERROR
+ */
+DUCKDB_C_API DUCKDB_V2_ERROR duckdb_v2_copy_to_statistics_get_bind_data(duckdb_v2_copy_to_statistics_info_handle info,
+                                                                        void **data, duckdb_v2_error_info_handle *err);
+#endif
+
+#if DUCKDB_V2_API_ALLOW_UNSTABLE
+/*!
+ * Retrieves the init data set by the function's `COPY ... TO` init callback for the file being reported.
+ *
+ * history:
+ * - unstable: v2.0.0
+ *
+ * @param info The statistics info handle.
+ * @param data Receives the init data pointer, or null if none was set.
+ * @param err Optional. On failure, receives an opaque info handle the caller must destroy via
+ * `duckdb_v2_error_info_destroy()`.
+ * @return DUCKDB_V2_ERROR
+ */
+DUCKDB_C_API DUCKDB_V2_ERROR duckdb_v2_copy_to_statistics_get_init_data(duckdb_v2_copy_to_statistics_info_handle info,
+                                                                        void **data, duckdb_v2_error_info_handle *err);
+#endif
+
+#if DUCKDB_V2_API_ALLOW_UNSTABLE
+/*!
+ * Reports how many rows were written to the file. Reported as 0 when the callback does not set it.
+ *
+ * history:
+ * - unstable: v2.0.0
+ *
+ * @param info The statistics info handle.
+ * @param row_count The number of rows written to the file.
+ * @param err Optional. On failure, receives an opaque info handle the caller must destroy via
+ * `duckdb_v2_error_info_destroy()`.
+ * @return DUCKDB_V2_ERROR
+ */
+DUCKDB_C_API DUCKDB_V2_ERROR duckdb_v2_copy_to_statistics_set_row_count(duckdb_v2_copy_to_statistics_info_handle info,
+                                                                        idx_t row_count,
+                                                                        duckdb_v2_error_info_handle *err);
+#endif
+
+#if DUCKDB_V2_API_ALLOW_UNSTABLE
+/*!
+ * Reports the size of the written file in bytes. Reported as 0 when the callback does not set it.
+ *
+ * history:
+ * - unstable: v2.0.0
+ *
+ * @param info The statistics info handle.
+ * @param file_size_bytes The size of the file in bytes.
+ * @param err Optional. On failure, receives an opaque info handle the caller must destroy via
+ * `duckdb_v2_error_info_destroy()`.
+ * @return DUCKDB_V2_ERROR
+ */
+DUCKDB_C_API DUCKDB_V2_ERROR duckdb_v2_copy_to_statistics_set_file_size(duckdb_v2_copy_to_statistics_info_handle info,
+                                                                        idx_t file_size_bytes,
+                                                                        duckdb_v2_error_info_handle *err);
+#endif
+
+/* --- Struct definitions for copy --- */
+
+/* ============================================================================
+ * MODULE: custom_option
+ * ============================================================================ */
+
+/* --- Enums for custom_option --- */
+
+/* --- Struct forward declarations for custom_option --- */
+
+/* --- Types for custom_option --- */
+
+/*!
+ * An owned opaque handle to a custom option being built. Created with `duckdb_v2_custom_option_create()`, configured
+ * with the setter functions (e.g. `duckdb_v2_custom_option_set_name()`, `duckdb_v2_custom_option_set_type()`, etc.),
+ * made available with `duckdb_v2_connection_register_custom_option()` or
+ * `duckdb_v2_extension_register_custom_option()`, and destroyed with `duckdb_v2_custom_option_destroy()`.
+ */
+typedef struct _duckdb_v2_custom_option {
+	void *internal_ptr;
+} * duckdb_v2_custom_option_handle;
+
+/*!
+ * A borrowed opaque handle to an update of a custom option, received by its update callback. It gives access to the new
+ * value, the scope it is written at and the user data, and can replace the value.
+ */
+typedef struct _duckdb_v2_custom_option_update_info {
+	void *internal_ptr;
+} * duckdb_v2_custom_option_update_info_handle;
+
+/* --- Constants for custom_option --- */
+
+/* --- Function pointer typedefs for custom_option --- */
+
+typedef void (*duckdb_v2_custom_option_update_callback_fn)(duckdb_v2_custom_option_update_info_handle info,
+                                                           duckdb_v2_context_handle context,
+                                                           duckdb_v2_error_info_handle *err);
+
+/* --- Functions for custom_option --- */
+
+#if DUCKDB_V2_API_ALLOW_UNSTABLE
+/*!
+ * Creates a new custom option through a factory.
+ *
+ * The option starts out empty: configure it with the setter functions, then make it available with
+ * `duckdb_v2_connection_register_custom_option()` or `duckdb_v2_extension_register_custom_option()`. The caller owns
+ * the returned handle and must destroy it with `duckdb_v2_custom_option_destroy()`, also after registration.
+ *
+ * The custom option can only be registered on the instance the factory belongs to.
+ *
+ * history:
+ * - unstable: v2.0.0
+ *
+ * @param factory The factory to create the custom option through.
+ * @param option On success, receives the newly created custom option. Owned by the caller.
+ * @param err Optional. On failure, receives an opaque info handle the caller must destroy via
+ * `duckdb_v2_error_info_destroy()`.
+ * @return DUCKDB_V2_ERROR
+ */
+DUCKDB_C_API DUCKDB_V2_ERROR duckdb_v2_custom_option_create(duckdb_v2_factory_handle factory,
+                                                            duckdb_v2_custom_option_handle *option,
+                                                            duckdb_v2_error_info_handle *err);
+#endif
+
+#if DUCKDB_V2_API_ALLOW_UNSTABLE
+/*!
+ * Sets the name of the custom option, as `SET` and the config functions refer to it.
+ *
+ * The name is borrowed and copied. Calling this again replaces the previous name. A name must be set before
+ * registration.
+ *
+ * history:
+ * - unstable: v2.0.0
+ *
+ * @param option The option to set the name of.
+ * @param name The name to set. Borrowed and copied.
+ * @param err Optional. On failure, receives an opaque info handle the caller must destroy via
+ * `duckdb_v2_error_info_destroy()`.
+ * @return DUCKDB_V2_ERROR
+ */
+DUCKDB_C_API DUCKDB_V2_ERROR duckdb_v2_custom_option_set_name(duckdb_v2_custom_option_handle option,
+                                                              const duckdb_v2_identifier_t *name,
+                                                              duckdb_v2_error_info_handle *err);
+#endif
+
+#if DUCKDB_V2_API_ALLOW_UNSTABLE
+/*!
+ * Sets the type of the custom option. Every value written to the option is cast to it, as SQL `SET` does.
+ *
+ * The type is borrowed and copied. Optional when a default value is set, whose type the option then takes.
+ *
+ * history:
+ * - unstable: v2.0.0
+ *
+ * @param option The option to set the type of.
+ * @param type The type to set. Borrowed and copied.
+ * @param err Optional. On failure, receives an opaque info handle the caller must destroy via
+ * `duckdb_v2_error_info_destroy()`.
+ * @return DUCKDB_V2_ERROR
+ */
+DUCKDB_C_API DUCKDB_V2_ERROR duckdb_v2_custom_option_set_type(duckdb_v2_custom_option_handle option,
+                                                              duckdb_v2_logical_type_handle type,
+                                                              duckdb_v2_error_info_handle *err);
+#endif
+
+#if DUCKDB_V2_API_ALLOW_UNSTABLE
+/*!
+ * Sets the default value of the custom option: its value until it is set, and the value `RESET` restores.
+ *
+ * The value is borrowed and copied, and cast to the option's type at registration, which fails when the cast does.
+ * Without a default value the option reads as NULL until it is set.
+ *
+ * history:
+ * - unstable: v2.0.0
+ *
+ * @param option The option to set the default value of.
+ * @param value The default value. Borrowed and copied.
+ * @param err Optional. On failure, receives an opaque info handle the caller must destroy via
+ * `duckdb_v2_error_info_destroy()`.
+ * @return DUCKDB_V2_ERROR
+ */
+DUCKDB_C_API DUCKDB_V2_ERROR duckdb_v2_custom_option_set_default_value(duckdb_v2_custom_option_handle option,
+                                                                       duckdb_v2_value_handle value,
+                                                                       duckdb_v2_error_info_handle *err);
+#endif
+
+#if DUCKDB_V2_API_ALLOW_UNSTABLE
+/*!
+ * Sets the description of the custom option, as `duckdb_v2_option_get_description()` and `duckdb_settings()` report it.
+ *
+ * The description is borrowed and copied. Calling this again replaces the previous description.
+ *
+ * history:
+ * - unstable: v2.0.0
+ *
+ * @param option The option to set the description of.
+ * @param description The description to set. Borrowed and copied.
+ * @param err Optional. On failure, receives an opaque info handle the caller must destroy via
+ * `duckdb_v2_error_info_destroy()`.
+ * @return DUCKDB_V2_ERROR
+ */
+DUCKDB_C_API DUCKDB_V2_ERROR duckdb_v2_custom_option_set_description(duckdb_v2_custom_option_handle option,
+                                                                     const duckdb_v2_str *description,
+                                                                     duckdb_v2_error_info_handle *err);
+#endif
+
+#if DUCKDB_V2_API_ALLOW_UNSTABLE
+/*!
+ * Sets the scope a write at `SETTING_SCOPE_DEFAULT` goes to, like SQL `SET name = value`.
+ *
+ * Must be GLOBAL or SESSION, and a scope the option supports. Defaults to SESSION, or to GLOBAL when the option does
+ * not support SESSION.
+ *
+ * history:
+ * - unstable: v2.0.0
+ *
+ * @param option The option to set the default scope of.
+ * @param scope The default scope, GLOBAL or SESSION.
+ * @param err Optional. On failure, receives an opaque info handle the caller must destroy via
+ * `duckdb_v2_error_info_destroy()`.
+ * @return DUCKDB_V2_ERROR
+ */
+DUCKDB_C_API DUCKDB_V2_ERROR duckdb_v2_custom_option_set_default_scope(duckdb_v2_custom_option_handle option,
+                                                                       DUCKDB_V2_SETTING_SCOPE scope,
+                                                                       duckdb_v2_error_info_handle *err);
+#endif
+
+#if DUCKDB_V2_API_ALLOW_UNSTABLE
+/*!
+ * Sets whether the custom option can be written at a scope, as `duckdb_v2_option_supports_scope()` reports it.
+ *
+ * A custom option supports both GLOBAL and SESSION unless told otherwise. A write at a scope it does not support fails,
+ * from SQL as from `duckdb_v2_config_set_option_value()`. Registration fails when the option supports neither scope.
+ *
+ * history:
+ * - unstable: v2.0.0
+ *
+ * @param option The option to configure.
+ * @param scope The scope, GLOBAL or SESSION.
+ * @param supported Whether the option can be written at the scope.
+ * @param err Optional. On failure, receives an opaque info handle the caller must destroy via
+ * `duckdb_v2_error_info_destroy()`.
+ * @return DUCKDB_V2_ERROR
+ */
+DUCKDB_C_API DUCKDB_V2_ERROR duckdb_v2_custom_option_set_supports_scope(duckdb_v2_custom_option_handle option,
+                                                                        DUCKDB_V2_SETTING_SCOPE scope, bool supported,
+                                                                        duckdb_v2_error_info_handle *err);
+#endif
+
+#if DUCKDB_V2_API_ALLOW_UNSTABLE
+/*!
+ * Sets arbitrary user data on the custom option.
+ *
+ * Associates an opaque pointer with the option, retrievable from the update callback via
+ * `duckdb_v2_custom_option_update_get_user_data()`. The opaque handle bundles the pointer with an optional destructor,
+ * invoked when the data is no longer needed: once the custom option handle is destroyed and, if it was registered, the
+ * instance is too.
+ *
+ * history:
+ * - unstable: v2.0.0
+ *
+ * @param option The option to set the user data of.
+ * @param data Opaque handle bundling the user data pointer plus an optional destructor.
+ * @param err Optional. On failure, receives an opaque info handle the caller must destroy via
+ * `duckdb_v2_error_info_destroy()`.
+ * @return DUCKDB_V2_ERROR
+ */
+DUCKDB_C_API DUCKDB_V2_ERROR duckdb_v2_custom_option_set_user_data(duckdb_v2_custom_option_handle option,
+                                                                   duckdb_v2_opaque *data,
+                                                                   duckdb_v2_error_info_handle *err);
+#endif
+
+#if DUCKDB_V2_API_ALLOW_UNSTABLE
+/*!
+ * Sets the optional update callback of the custom option.
+ *
+ * The callback is invoked whenever the option is set or reset, from SQL as from `duckdb_v2_config_set_option_value()`,
+ * after the new value is cast to the option's type and before it is stored. It may replace the value with
+ * `duckdb_v2_custom_option_update_set_value()`, or refuse it by reporting an error. It is not invoked for the default
+ * value at registration, nor for a value given to the instance at startup. The callback must not write options itself.
+ *
+ * history:
+ * - unstable: v2.0.0
+ *
+ * @param option The option to set the update callback of.
+ * @param callback The update callback to set.
+ * @param err Optional. On failure, receives an opaque info handle the caller must destroy via
+ * `duckdb_v2_error_info_destroy()`.
+ * @return DUCKDB_V2_ERROR
+ */
+DUCKDB_C_API DUCKDB_V2_ERROR duckdb_v2_custom_option_set_update_callback(
+    duckdb_v2_custom_option_handle option, duckdb_v2_custom_option_update_callback_fn callback,
+    duckdb_v2_error_info_handle *err);
+#endif
+
+#if DUCKDB_V2_API_ALLOW_UNSTABLE
+/*!
+ * Retrieves the user data set via `duckdb_v2_custom_option_set_user_data()`.
+ *
+ * history:
+ * - unstable: v2.0.0
+ *
+ * @param info The update info handle.
+ * @param data Receives the user data pointer, or null if none was set.
+ * @param err Optional. On failure, receives an opaque info handle the caller must destroy via
+ * `duckdb_v2_error_info_destroy()`.
+ * @return DUCKDB_V2_ERROR
+ */
+DUCKDB_C_API DUCKDB_V2_ERROR duckdb_v2_custom_option_update_get_user_data(
+    duckdb_v2_custom_option_update_info_handle info, void **data, duckdb_v2_error_info_handle *err);
+#endif
+
+#if DUCKDB_V2_API_ALLOW_UNSTABLE
+/*!
+ * Retrieves the value the option is updated to, already cast to the option's type. On a reset this is the default
+ * value, which may be NULL. The returned value is owned by the caller and must be destroyed via
+ * `duckdb_v2_value_destroy()`.
+ *
+ * history:
+ * - unstable: v2.0.0
+ *
+ * @param info The update info handle.
+ * @param value Receives the new value. Owned by the caller; destroy via `duckdb_v2_value_destroy()`.
+ * @param err Optional. On failure, receives an opaque info handle the caller must destroy via
+ * `duckdb_v2_error_info_destroy()`.
+ * @return DUCKDB_V2_ERROR
+ */
+DUCKDB_C_API DUCKDB_V2_ERROR duckdb_v2_custom_option_update_get_value(duckdb_v2_custom_option_update_info_handle info,
+                                                                      duckdb_v2_value_handle *value,
+                                                                      duckdb_v2_error_info_handle *err);
+#endif
+
+#if DUCKDB_V2_API_ALLOW_UNSTABLE
+/*!
+ * Replaces the value the option is updated to, e.g. to normalize it. The value is borrowed and copied, and cast to the
+ * option's type, which fails when the cast does.
+ *
+ * history:
+ * - unstable: v2.0.0
+ *
+ * @param info The update info handle.
+ * @param value The value to store instead. Borrowed and copied.
+ * @param err Optional. On failure, receives an opaque info handle the caller must destroy via
+ * `duckdb_v2_error_info_destroy()`.
+ * @return DUCKDB_V2_ERROR
+ */
+DUCKDB_C_API DUCKDB_V2_ERROR duckdb_v2_custom_option_update_set_value(duckdb_v2_custom_option_update_info_handle info,
+                                                                      duckdb_v2_value_handle value,
+                                                                      duckdb_v2_error_info_handle *err);
+#endif
+
+#if DUCKDB_V2_API_ALLOW_UNSTABLE
+/*!
+ * Retrieves the scope the value is written at: GLOBAL or SESSION, a DEFAULT write already resolved to the option's
+ * default scope.
+ *
+ * history:
+ * - unstable: v2.0.0
+ *
+ * @param info The update info handle.
+ * @param scope Receives the scope.
+ * @param err Optional. On failure, receives an opaque info handle the caller must destroy via
+ * `duckdb_v2_error_info_destroy()`.
+ * @return DUCKDB_V2_ERROR
+ */
+DUCKDB_C_API DUCKDB_V2_ERROR duckdb_v2_custom_option_update_get_scope(duckdb_v2_custom_option_update_info_handle info,
+                                                                      DUCKDB_V2_SETTING_SCOPE *scope,
+                                                                      duckdb_v2_error_info_handle *err);
+#endif
+
+#if DUCKDB_V2_API_ALLOW_UNSTABLE
+/*!
+ * Retrieves whether the update is a reset to the default value, like SQL `RESET`.
+ *
+ * history:
+ * - unstable: v2.0.0
+ *
+ * @param info The update info handle.
+ * @param is_reset Receives whether the update is a reset.
+ * @param err Optional. On failure, receives an opaque info handle the caller must destroy via
+ * `duckdb_v2_error_info_destroy()`.
+ * @return DUCKDB_V2_ERROR
+ */
+DUCKDB_C_API DUCKDB_V2_ERROR duckdb_v2_custom_option_update_is_reset(duckdb_v2_custom_option_update_info_handle info,
+                                                                     bool *is_reset, duckdb_v2_error_info_handle *err);
+#endif
+
+#if DUCKDB_V2_API_ALLOW_UNSTABLE
+/*!
+ * Registers the custom option on the connection's instance, visible to every connection.
+ *
+ * Registration is not transactional: it takes effect at once, also inside an explicit transaction, and a rollback does
+ * not undo it. Registration requires a name and a type, or a default value to take the type from, and fails when an
+ * option of the same name already exists. A value given for the option at startup is picked up. The custom option must
+ * have been created through a factory of the same instance. The caller still owns the handle after registration and
+ * must destroy it with `duckdb_v2_custom_option_destroy()`, which does not affect the registered option.
+ *
+ * history:
+ * - unstable: v2.0.0
+ *
+ * @param conn The connection to register on.
+ * @param option The custom option to register.
+ * @param err Optional. On failure, receives an opaque info handle the caller must destroy via
+ * `duckdb_v2_error_info_destroy()`.
+ * @return DUCKDB_V2_ERROR
+ */
+DUCKDB_C_API DUCKDB_V2_ERROR duckdb_v2_connection_register_custom_option(duckdb_v2_connection_handle conn,
+                                                                         duckdb_v2_custom_option_handle option,
+                                                                         duckdb_v2_error_info_handle *err);
+#endif
+
+#if DUCKDB_V2_API_ALLOW_UNSTABLE
+/*!
+ * Registers the custom option on the loading extension's instance, visible to every connection.
+ *
+ * Use this from the extension's load callback. Registration is not transactional, requires a name and a type, or a
+ * default value to take the type from, and fails when an option of the same name already exists. A value given for the
+ * option at startup is picked up. The custom option must have been created through a factory of the same instance. The
+ * caller still owns the handle after registration and must destroy it with `duckdb_v2_custom_option_destroy()`, which
+ * does not affect the registered option.
+ *
+ * history:
+ * - unstable: v2.0.0
+ *
+ * @param extension The loading extension.
+ * @param option The custom option to register.
+ * @param err Optional. On failure, receives an opaque info handle the caller must destroy via
+ * `duckdb_v2_error_info_destroy()`.
+ * @return DUCKDB_V2_ERROR
+ */
+DUCKDB_C_API DUCKDB_V2_ERROR duckdb_v2_extension_register_custom_option(duckdb_v2_extension_handle extension,
+                                                                        duckdb_v2_custom_option_handle option,
+                                                                        duckdb_v2_error_info_handle *err);
+#endif
+
+#if DUCKDB_V2_API_ALLOW_UNSTABLE
+/*!
+ * Destroys the custom option, releasing its resources.
+ *
+ * Null-safe: passing a null pointer or null handle is a no-op. The handle is set to null on return to prevent
+ * double-destruction. Destroying the handle after registration does not affect the registered option.
+ *
+ * history:
+ * - unstable: v2.0.0
+ *
+ * @param option The option to destroy.
+ * @return DUCKDB_V2_ERROR
+ */
+DUCKDB_C_API DUCKDB_V2_ERROR duckdb_v2_custom_option_destroy(duckdb_v2_custom_option_handle *option);
+#endif
+
+/* --- Struct definitions for custom_option --- */
+
+/* ============================================================================
+ * MODULE: expression
+ * ============================================================================ */
+
+/* --- Enums for expression --- */
+
+/*!
+ * The type of a bound expression node. The values mirror the engine's own expression types, restricted to the node
+ * types a filter predicate can contain; every other node type is reported as `EXPRESSION_TYPE_INVALID`.
+ *
+ * Comparisons, `BETWEEN` and casts are regular scalar function calls once bound: they have the function's children and
+ * name, and only their type tells them apart from any other function. A `CAST` therefore has one child, the value being
+ * cast, and its target type is the node's return type.
+ */
+typedef enum DUCKDB_V2_EXPRESSION_TYPE {
+	//! A node type this API does not model. Its children can still be walked.
+	DUCKDB_V2_EXPRESSION_TYPE_INVALID = 0,
+
+	/*!
+	 * A cast. One child; the target type is the node's return type and `duckdb_v2_expression_cast_get_mode()` tells a
+	 * `TRY_CAST` apart.
+	 */
+	DUCKDB_V2_EXPRESSION_TYPE_OPERATOR_CAST = 12,
+
+	//! Logical `NOT`. One child.
+	DUCKDB_V2_EXPRESSION_TYPE_OPERATOR_NOT = 13,
+
+	//! `IS NULL`. One child.
+	DUCKDB_V2_EXPRESSION_TYPE_OPERATOR_IS_NULL = 14,
+
+	//! `IS NOT NULL`. One child.
+	DUCKDB_V2_EXPRESSION_TYPE_OPERATOR_IS_NOT_NULL = 15,
+
+	//! `=`. Two children.
+	DUCKDB_V2_EXPRESSION_TYPE_COMPARE_EQUAL = 25,
+
+	//! `<>`. Two children.
+	DUCKDB_V2_EXPRESSION_TYPE_COMPARE_NOTEQUAL = 26,
+
+	//! `<`. Two children.
+	DUCKDB_V2_EXPRESSION_TYPE_COMPARE_LESSTHAN = 27,
+
+	//! `>`. Two children.
+	DUCKDB_V2_EXPRESSION_TYPE_COMPARE_GREATERTHAN = 28,
+
+	//! `<=`. Two children.
+	DUCKDB_V2_EXPRESSION_TYPE_COMPARE_LESSTHANOREQUALTO = 29,
+
+	//! `>=`. Two children.
+	DUCKDB_V2_EXPRESSION_TYPE_COMPARE_GREATERTHANOREQUALTO = 30,
+
+	//! `IN`. The first child is the value tested, the remaining children are the candidates.
+	DUCKDB_V2_EXPRESSION_TYPE_COMPARE_IN = 35,
+
+	//! `NOT IN`. The first child is the value tested, the remaining children are the candidates.
+	DUCKDB_V2_EXPRESSION_TYPE_COMPARE_NOT_IN = 36,
+
+	//! `IS DISTINCT FROM`. Two children.
+	DUCKDB_V2_EXPRESSION_TYPE_COMPARE_DISTINCT_FROM = 37,
+
+	//! `BETWEEN`. Three children: the value tested, the lower bound and the upper bound.
+	DUCKDB_V2_EXPRESSION_TYPE_COMPARE_BETWEEN = 38,
+
+	//! `IS NOT DISTINCT FROM`. Two children.
+	DUCKDB_V2_EXPRESSION_TYPE_COMPARE_NOT_DISTINCT_FROM = 40,
+
+	//! Logical `AND`. Two or more children.
+	DUCKDB_V2_EXPRESSION_TYPE_CONJUNCTION_AND = 50,
+
+	//! Logical `OR`. Two or more children.
+	DUCKDB_V2_EXPRESSION_TYPE_CONJUNCTION_OR = 51,
+
+	//! A constant. No children; read it with `duckdb_v2_expression_constant_get_value()`.
+	DUCKDB_V2_EXPRESSION_TYPE_VALUE_CONSTANT = 75,
+
+	//! A prepared statement parameter whose value is not known yet. No children.
+	DUCKDB_V2_EXPRESSION_TYPE_VALUE_PARAMETER = 76,
+
+	/*!
+	 * A call to a scalar function other than the ones listed above. The children are its arguments; read the name with
+	 * `duckdb_v2_expression_function_get_name()`.
+	 */
+	DUCKDB_V2_EXPRESSION_TYPE_BOUND_FUNCTION = 141,
+
+	//! A `CASE` expression. The children are each `WHEN` condition followed by its `THEN` result, then the `ELSE`
+	//! result.
+	DUCKDB_V2_EXPRESSION_TYPE_CASE_EXPR = 150,
+
+	//! `COALESCE`. One or more children.
+	DUCKDB_V2_EXPRESSION_TYPE_OPERATOR_COALESCE = 152,
+
+	//! A reference to a column. No children; read it with `duckdb_v2_expression_column_ref_get_index()`.
+	DUCKDB_V2_EXPRESSION_TYPE_BOUND_COLUMN_REF = 228,
+	DUCKDB_V2_EXPRESSION_TYPE_MAX_ENUM = 0x7FFFFFFF,
+} DUCKDB_V2_EXPRESSION_TYPE;
+
+/* --- Struct forward declarations for expression --- */
+
+/* --- Types for expression --- */
+
+/*!
+ * A borrowed opaque handle to a node of a bound expression tree. Read-only and owned by the engine: valid only for the
+ * duration of the callback that handed it out, and never destroyed by the caller. Child nodes borrowed via
+ * `duckdb_v2_expression_get_child()` share their parent's lifetime.
+ */
+typedef struct _duckdb_v2_expression {
+	void *internal_ptr;
+} * duckdb_v2_expression_handle;
+
+/* --- Constants for expression --- */
+
+/* --- Function pointer typedefs for expression --- */
+
+/* --- Functions for expression --- */
+
+#if DUCKDB_V2_API_ALLOW_UNSTABLE
+/*!
+ * Returns the type of an expression node.
+ *
+ * The type decides which of the type-specific accessors apply, and what the node's children mean; see
+ * `EXPRESSION_TYPE`. A node of a type this API does not model reports `EXPRESSION_TYPE_INVALID`.
+ *
+ * history:
+ * - unstable: v2.0.0
+ *
+ * @param expression The expression node.
+ * @param type Receives the node type.
+ * @param err Optional. On failure, receives an opaque info handle the caller must destroy via
+ * `duckdb_v2_error_info_destroy()`.
+ * @return DUCKDB_V2_ERROR
+ */
+DUCKDB_C_API DUCKDB_V2_ERROR duckdb_v2_expression_get_type(duckdb_v2_expression_handle expression,
+                                                           DUCKDB_V2_EXPRESSION_TYPE *type,
+                                                           duckdb_v2_error_info_handle *err);
+#endif
+
+#if DUCKDB_V2_API_ALLOW_UNSTABLE
+/*!
+ * Returns the logical type the expression node evaluates to.
+ *
+ * For a cast this is the target type. The returned type is owned by the caller and must be destroyed via
+ * `duckdb_v2_logical_type_destroy()`.
+ *
+ * history:
+ * - unstable: v2.0.0
+ *
+ * @param expression The expression node.
+ * @param type Receives the owned logical type.
+ * @param err Optional. On failure, receives an opaque info handle the caller must destroy via
+ * `duckdb_v2_error_info_destroy()`.
+ * @return DUCKDB_V2_ERROR
+ */
+DUCKDB_C_API DUCKDB_V2_ERROR duckdb_v2_expression_get_return_type(duckdb_v2_expression_handle expression,
+                                                                  duckdb_v2_logical_type_handle *type,
+                                                                  duckdb_v2_error_info_handle *err);
+#endif
+
+#if DUCKDB_V2_API_ALLOW_UNSTABLE
+/*!
+ * Returns the number of child nodes of an expression node.
+ *
+ * Works for every node type, including `EXPRESSION_TYPE_INVALID`. Constants, parameters and column references have no
+ * children.
+ *
+ * history:
+ * - unstable: v2.0.0
+ *
+ * @param expression The expression node.
+ * @param count Receives the number of children.
+ * @param err Optional. On failure, receives an opaque info handle the caller must destroy via
+ * `duckdb_v2_error_info_destroy()`.
+ * @return DUCKDB_V2_ERROR
+ */
+DUCKDB_C_API DUCKDB_V2_ERROR duckdb_v2_expression_get_child_count(duckdb_v2_expression_handle expression, idx_t *count,
+                                                                  duckdb_v2_error_info_handle *err);
+#endif
+
+#if DUCKDB_V2_API_ALLOW_UNSTABLE
+/*!
+ * Retrieves a child node of an expression node by index.
+ *
+ * Fails if the index is out of bounds. Children are ordered as the node type describes (see `EXPRESSION_TYPE`). The
+ * child is borrowed and shares the lifetime of its parent.
+ *
+ * history:
+ * - unstable: v2.0.0
+ *
+ * @param expression The expression node.
+ * @param index The index of the child to retrieve.
+ * @param child Receives the borrowed child node.
+ * @param err Optional. On failure, receives an opaque info handle the caller must destroy via
+ * `duckdb_v2_error_info_destroy()`.
+ * @return DUCKDB_V2_ERROR
+ */
+DUCKDB_C_API DUCKDB_V2_ERROR duckdb_v2_expression_get_child(duckdb_v2_expression_handle expression, idx_t index,
+                                                            duckdb_v2_expression_handle *child,
+                                                            duckdb_v2_error_info_handle *err);
+#endif
+
+#if DUCKDB_V2_API_ALLOW_UNSTABLE
+/*!
+ * Returns the value of a constant node.
+ *
+ * Fails if the node is not of type `EXPRESSION_TYPE_VALUE_CONSTANT`. The returned value is owned by the caller and must
+ * be destroyed via `duckdb_v2_value_destroy()`.
+ *
+ * history:
+ * - unstable: v2.0.0
+ *
+ * @param expression The constant node.
+ * @param value Receives the owned constant value.
+ * @param err Optional. On failure, receives an opaque info handle the caller must destroy via
+ * `duckdb_v2_error_info_destroy()`.
+ * @return DUCKDB_V2_ERROR
+ */
+DUCKDB_C_API DUCKDB_V2_ERROR duckdb_v2_expression_constant_get_value(duckdb_v2_expression_handle expression,
+                                                                     duckdb_v2_value_handle *value,
+                                                                     duckdb_v2_error_info_handle *err);
+#endif
+
+#if DUCKDB_V2_API_ALLOW_UNSTABLE
+/*!
+ * Returns the column a column reference node points at.
+ *
+ * Fails if the node is not of type `EXPRESSION_TYPE_BOUND_COLUMN_REF`. The index counts the columns of the operator the
+ * predicate is evaluated against, which is not necessarily the full set of columns that operator can produce: a
+ * callback resolves it through whatever handed it the expression, e.g.
+ * `duckdb_v2_table_function_filter_pushdown_get_column_index()` for a filter offered to a table function.
+ *
+ * history:
+ * - unstable: v2.0.0
+ *
+ * @param expression The column reference node.
+ * @param index Receives the column index.
+ * @param err Optional. On failure, receives an opaque info handle the caller must destroy via
+ * `duckdb_v2_error_info_destroy()`.
+ * @return DUCKDB_V2_ERROR
+ */
+DUCKDB_C_API DUCKDB_V2_ERROR duckdb_v2_expression_column_ref_get_index(duckdb_v2_expression_handle expression,
+                                                                       idx_t *index, duckdb_v2_error_info_handle *err);
+#endif
+
+#if DUCKDB_V2_API_ALLOW_UNSTABLE
+/*!
+ * Returns the name of the scalar function a function node calls.
+ *
+ * Applies to `EXPRESSION_TYPE_BOUND_FUNCTION` and to the node types that are function calls underneath: the
+ * comparisons, `EXPRESSION_TYPE_COMPARE_BETWEEN` and `EXPRESSION_TYPE_OPERATOR_CAST`. Fails for any other node type.
+ * For a comparison the name is its operator, e.g. `<`; for `BETWEEN` and casts it is an internal name, so dispatch on
+ * the type rather than the name for those. The name is borrowed and shares the lifetime of the node.
+ *
+ * history:
+ * - unstable: v2.0.0
+ *
+ * @param expression The function node.
+ * @param name Receives a borrowed view of the function name.
+ * @param err Optional. On failure, receives an opaque info handle the caller must destroy via
+ * `duckdb_v2_error_info_destroy()`.
+ * @return DUCKDB_V2_ERROR
+ */
+DUCKDB_C_API DUCKDB_V2_ERROR duckdb_v2_expression_function_get_name(duckdb_v2_expression_handle expression,
+                                                                    duckdb_v2_identifier_t *name,
+                                                                    duckdb_v2_error_info_handle *err);
+#endif
+
+#if DUCKDB_V2_API_ALLOW_UNSTABLE
+/*!
+ * Returns the qualified name of the scalar function a function node calls.
+ *
+ * Applies to the same node types as `duckdb_v2_expression_function_get_name()`, and fails for any other. The name is
+ * qualified with the catalog and schema the function was resolved in, where known. The returned name is owned by the
+ * caller and must be destroyed via `duckdb_v2_qname_destroy()`.
+ *
+ * history:
+ * - unstable: v2.0.0
+ *
+ * @param expression The function node.
+ * @param name Receives the owned qualified name.
+ * @param err Optional. On failure, receives an opaque info handle the caller must destroy via
+ * `duckdb_v2_error_info_destroy()`.
+ * @return DUCKDB_V2_ERROR
+ */
+DUCKDB_C_API DUCKDB_V2_ERROR duckdb_v2_expression_function_get_qname(duckdb_v2_expression_handle expression,
+                                                                     duckdb_v2_qname_handle *name,
+                                                                     duckdb_v2_error_info_handle *err);
+#endif
+
+#if DUCKDB_V2_API_ALLOW_UNSTABLE
+/*!
+ * Returns whether a cast node is a regular `CAST` or a `TRY_CAST`.
+ *
+ * Fails if the node is not of type `EXPRESSION_TYPE_OPERATOR_CAST`. A `TRY_CAST` yields NULL for a value it cannot
+ * convert where a regular `CAST` would fail the query.
+ *
+ * history:
+ * - unstable: v2.0.0
+ *
+ * @param expression The cast node.
+ * @param mode Receives the cast mode.
+ * @param err Optional. On failure, receives an opaque info handle the caller must destroy via
+ * `duckdb_v2_error_info_destroy()`.
+ * @return DUCKDB_V2_ERROR
+ */
+DUCKDB_C_API DUCKDB_V2_ERROR duckdb_v2_expression_cast_get_mode(duckdb_v2_expression_handle expression,
+                                                                DUCKDB_V2_CAST_MODE *mode,
+                                                                duckdb_v2_error_info_handle *err);
+#endif
+
+/* --- Struct definitions for expression --- */
+
+/* ============================================================================
+ * MODULE: log sink
+ * ============================================================================ */
+
+/* --- Enums for log sink --- */
+
+//! The scope a log entry was written in, which decides which of its ids are present.
+typedef enum DUCKDB_V2_LOG_SCOPE {
+	//! Written for the database as a whole, carrying no connection, transaction or query id.
+	DUCKDB_V2_LOG_SCOPE_DATABASE = 10,
+
+	//! Written by a connection, carrying its connection id and, inside one, the transaction and query ids.
+	DUCKDB_V2_LOG_SCOPE_CONNECTION = 20,
+
+	//! Written by a thread executing a query, carrying the thread id next to the connection's ids.
+	DUCKDB_V2_LOG_SCOPE_THREAD = 30,
+	DUCKDB_V2_LOG_SCOPE_MAX_ENUM = 0x7FFFFFFF,
+} DUCKDB_V2_LOG_SCOPE;
+
+/* --- Struct forward declarations for log sink --- */
+
+/* --- Types for log sink --- */
+
+/*!
+ * An owned opaque handle to a log sink being built. Created with `duckdb_v2_log_sink_create()`, configured with
+ * `duckdb_v2_log_sink_set_name()`, `duckdb_v2_log_sink_set_write_callback()` and the other setters, made available with
+ * `duckdb_v2_instance_register_log_sink()` or `duckdb_v2_extension_register_log_sink()`, and destroyed with
+ * `duckdb_v2_log_sink_destroy()`.
+ */
+typedef struct _duckdb_v2_log_sink {
+	void *internal_ptr;
+} * duckdb_v2_log_sink_handle;
+
+/*!
+ * A borrowed opaque handle to the context of a log entry, received by a log sink's write callback next to the entry
+ * itself, and valid only for the duration of that call. Read the ids `duckdb_logs` reports for the entry through its
+ * getters, e.g. `duckdb_v2_log_sink_write_info_get_connection_id()`.
+ */
+typedef struct _duckdb_v2_log_sink_write_info {
+	void *internal_ptr;
+} * duckdb_v2_log_sink_write_info_handle;
+
+/*!
+ * A borrowed opaque handle received by a log sink's flush callback, and valid only for the duration of that call. It
+ * carries nothing yet.
+ */
+typedef struct _duckdb_v2_log_sink_flush_info {
+	void *internal_ptr;
+} * duckdb_v2_log_sink_flush_info_handle;
+
+/* --- Constants for log sink --- */
+
+/* --- Function pointer typedefs for log sink --- */
+
+typedef void (*duckdb_v2_log_sink_write_callback_fn)(duckdb_v2_log_sink_write_info_handle info, void *user_data,
+                                                     int64_t timestamp, DUCKDB_V2_LOG_LEVEL level,
+                                                     DUCKDB_V2_LOG_SCOPE scope, const duckdb_v2_str *type,
+                                                     const duckdb_v2_str *message, duckdb_v2_error_info_handle *err);
+
+typedef void (*duckdb_v2_log_sink_flush_callback_fn)(duckdb_v2_log_sink_flush_info_handle info, void *user_data,
+                                                     duckdb_v2_error_info_handle *err);
+
+/* --- Functions for log sink --- */
+
+#if DUCKDB_V2_API_ALLOW_UNSTABLE
+/*!
+ * Creates a new log sink through a factory.
+ *
+ * The log sink starts out empty: configure it with the setter functions, then make it available with
+ * `duckdb_v2_instance_register_log_sink()` or `duckdb_v2_extension_register_log_sink()`. The caller owns the returned
+ * handle and must destroy it with `duckdb_v2_log_sink_destroy()`, also after registration.
+ *
+ * The log sink can only be registered on the instance the factory belongs to.
+ *
+ * history:
+ * - unstable: v2.0.0
+ *
+ * @param factory The factory to create the log sink through.
+ * @param sink On success, receives the newly created log sink. Owned by the caller.
+ * @param err Optional. On failure, receives an opaque info handle the caller must destroy via
+ * `duckdb_v2_error_info_destroy()`.
+ * @return DUCKDB_V2_ERROR
+ */
+DUCKDB_C_API DUCKDB_V2_ERROR duckdb_v2_log_sink_create(duckdb_v2_factory_handle factory,
+                                                       duckdb_v2_log_sink_handle *sink,
+                                                       duckdb_v2_error_info_handle *err);
+#endif
+
+#if DUCKDB_V2_API_ALLOW_UNSTABLE
+/*!
+ * Sets the name the logging configuration refers to the log sink by.
+ *
+ * Names are matched case-insensitively. The name is borrowed and copied. Calling this again replaces the previous name.
+ * A name must be set before registration.
+ *
+ * history:
+ * - unstable: v2.0.0
+ *
+ * @param sink The log sink to set the name of.
+ * @param name The name to set. Borrowed and copied.
+ * @param err Optional. On failure, receives an opaque info handle the caller must destroy via
+ * `duckdb_v2_error_info_destroy()`.
+ * @return DUCKDB_V2_ERROR
+ */
+DUCKDB_C_API DUCKDB_V2_ERROR duckdb_v2_log_sink_set_name(duckdb_v2_log_sink_handle sink,
+                                                         const duckdb_v2_identifier_t *name,
+                                                         duckdb_v2_error_info_handle *err);
+#endif
+
+#if DUCKDB_V2_API_ALLOW_UNSTABLE
+/*!
+ * Sets arbitrary user data on the log sink.
+ *
+ * Associates an opaque pointer with the sink, handed to its write and flush callbacks. The opaque handle bundles the
+ * pointer with an optional destructor, invoked when the data is no longer needed: when the instance is destroyed if the
+ * sink was registered, else when the log sink handle is.
+ *
+ * history:
+ * - unstable: v2.0.0
+ *
+ * @param sink The log sink to set the user data of.
+ * @param data Opaque handle bundling the user data pointer plus an optional destructor.
+ * @param err Optional. On failure, receives an opaque info handle the caller must destroy via
+ * `duckdb_v2_error_info_destroy()`.
+ * @return DUCKDB_V2_ERROR
+ */
+DUCKDB_C_API DUCKDB_V2_ERROR duckdb_v2_log_sink_set_user_data(duckdb_v2_log_sink_handle sink, duckdb_v2_opaque *data,
+                                                              duckdb_v2_error_info_handle *err);
+#endif
+
+#if DUCKDB_V2_API_ALLOW_UNSTABLE
+/*!
+ * Sets the write callback of the log sink, invoked for every entry the logging configuration directs to the sink.
+ *
+ * The callback must return quickly, must be safe to run concurrently and on any thread, and must not log or change the
+ * logging configuration. A write callback must be set before registration.
+ *
+ * history:
+ * - unstable: v2.0.0
+ *
+ * @param sink The log sink to set the write callback of.
+ * @param callback The write callback to set.
+ * @param err Optional. On failure, receives an opaque info handle the caller must destroy via
+ * `duckdb_v2_error_info_destroy()`.
+ * @return DUCKDB_V2_ERROR
+ */
+DUCKDB_C_API DUCKDB_V2_ERROR duckdb_v2_log_sink_set_write_callback(duckdb_v2_log_sink_handle sink,
+                                                                   duckdb_v2_log_sink_write_callback_fn callback,
+                                                                   duckdb_v2_error_info_handle *err);
+#endif
+
+#if DUCKDB_V2_API_ALLOW_UNSTABLE
+/*!
+ * Sets the optional flush callback of the log sink, invoked when DuckDB flushes its log, so entries the sink holds on
+ * to can be written out. When DuckDB flushes is up to DuckDB; entries still held when the instance is destroyed are for
+ * the user data's destructor to write out.
+ *
+ * Like the write callback, it must be safe to run on any thread, and must not log or change the logging configuration.
+ *
+ * history:
+ * - unstable: v2.0.0
+ *
+ * @param sink The log sink to set the flush callback of.
+ * @param callback The flush callback to set.
+ * @param err Optional. On failure, receives an opaque info handle the caller must destroy via
+ * `duckdb_v2_error_info_destroy()`.
+ * @return DUCKDB_V2_ERROR
+ */
+DUCKDB_C_API DUCKDB_V2_ERROR duckdb_v2_log_sink_set_flush_callback(duckdb_v2_log_sink_handle sink,
+                                                                   duckdb_v2_log_sink_flush_callback_fn callback,
+                                                                   duckdb_v2_error_info_handle *err);
+#endif
+
+#if DUCKDB_V2_API_ALLOW_UNSTABLE
+/*!
+ * Retrieves the id of the connection that wrote the entry, as `duckdb_logs` reports it. An entry written for the
+ * database as a whole has none: `present` then receives false and `id` is left untouched.
+ *
+ * history:
+ * - unstable: v2.0.0
+ *
+ * @param info The write info handle of the entry.
+ * @param id Receives the connection id, if present.
+ * @param present Receives whether the entry has a connection id.
+ * @param err Optional. On failure, receives an opaque info handle the caller must destroy via
+ * `duckdb_v2_error_info_destroy()`.
+ * @return DUCKDB_V2_ERROR
+ */
+DUCKDB_C_API DUCKDB_V2_ERROR duckdb_v2_log_sink_write_info_get_connection_id(duckdb_v2_log_sink_write_info_handle info,
+                                                                             idx_t *id, bool *present,
+                                                                             duckdb_v2_error_info_handle *err);
+#endif
+
+#if DUCKDB_V2_API_ALLOW_UNSTABLE
+/*!
+ * Retrieves the id of the transaction the entry was written in, as `duckdb_logs` reports it. An entry written outside a
+ * transaction has none: `present` then receives false and `id` is left untouched.
+ *
+ * history:
+ * - unstable: v2.0.0
+ *
+ * @param info The write info handle of the entry.
+ * @param id Receives the transaction id, if present.
+ * @param present Receives whether the entry has a transaction id.
+ * @param err Optional. On failure, receives an opaque info handle the caller must destroy via
+ * `duckdb_v2_error_info_destroy()`.
+ * @return DUCKDB_V2_ERROR
+ */
+DUCKDB_C_API DUCKDB_V2_ERROR duckdb_v2_log_sink_write_info_get_transaction_id(duckdb_v2_log_sink_write_info_handle info,
+                                                                              idx_t *id, bool *present,
+                                                                              duckdb_v2_error_info_handle *err);
+#endif
+
+#if DUCKDB_V2_API_ALLOW_UNSTABLE
+/*!
+ * Retrieves the id of the query the entry was written for, as `duckdb_logs` reports it. An entry written outside a
+ * query has none: `present` then receives false and `id` is left untouched.
+ *
+ * history:
+ * - unstable: v2.0.0
+ *
+ * @param info The write info handle of the entry.
+ * @param id Receives the query id, if present.
+ * @param present Receives whether the entry has a query id.
+ * @param err Optional. On failure, receives an opaque info handle the caller must destroy via
+ * `duckdb_v2_error_info_destroy()`.
+ * @return DUCKDB_V2_ERROR
+ */
+DUCKDB_C_API DUCKDB_V2_ERROR duckdb_v2_log_sink_write_info_get_query_id(duckdb_v2_log_sink_write_info_handle info,
+                                                                        idx_t *id, bool *present,
+                                                                        duckdb_v2_error_info_handle *err);
+#endif
+
+#if DUCKDB_V2_API_ALLOW_UNSTABLE
+/*!
+ * Retrieves the id of the thread that wrote the entry, as `duckdb_logs` reports it. Only an entry written in the thread
+ * scope has one: otherwise `present` receives false and `id` is left untouched. The id identifies the thread that
+ * logged, which need not be the thread the write callback runs on.
+ *
+ * history:
+ * - unstable: v2.0.0
+ *
+ * @param info The write info handle of the entry.
+ * @param id Receives the thread id, if present.
+ * @param present Receives whether the entry has a thread id.
+ * @param err Optional. On failure, receives an opaque info handle the caller must destroy via
+ * `duckdb_v2_error_info_destroy()`.
+ * @return DUCKDB_V2_ERROR
+ */
+DUCKDB_C_API DUCKDB_V2_ERROR duckdb_v2_log_sink_write_info_get_thread_id(duckdb_v2_log_sink_write_info_handle info,
+                                                                         idx_t *id, bool *present,
+                                                                         duckdb_v2_error_info_handle *err);
+#endif
+
+#if DUCKDB_V2_API_ALLOW_UNSTABLE
+/*!
+ * Registers the log sink on the instance, making it available to the logging configuration under its name.
+ *
+ * Registering does not direct any entries to the sink by itself; the logging configuration does. Registration is not
+ * transactional, requires a name and a write callback, and fails when the name is taken: by a sink DuckDB provides
+ * itself, such as `memory`, `stdout` or `file`, or by a sink registered before. The log sink must have been created
+ * through a factory of the same instance. Its user data passes to the registered sink. The caller still owns the handle
+ * after registration and must destroy it with `duckdb_v2_log_sink_destroy()`, which does not affect the registered
+ * sink.
+ *
+ * history:
+ * - unstable: v2.0.0
+ *
+ * @param instance The instance to register on.
+ * @param sink The log sink to register.
+ * @param err Optional. On failure, receives an opaque info handle the caller must destroy via
+ * `duckdb_v2_error_info_destroy()`.
+ * @return DUCKDB_V2_ERROR
+ */
+DUCKDB_C_API DUCKDB_V2_ERROR duckdb_v2_instance_register_log_sink(duckdb_v2_instance_handle instance,
+                                                                  duckdb_v2_log_sink_handle sink,
+                                                                  duckdb_v2_error_info_handle *err);
+#endif
+
+#if DUCKDB_V2_API_ALLOW_UNSTABLE
+/*!
+ * Registers the log sink on the loading extension's instance, making it available to the logging configuration under
+ * its name.
+ *
+ * Use this from the extension's load callback. Registration follows the rules of
+ * `duckdb_v2_instance_register_log_sink()`.
+ *
+ * history:
+ * - unstable: v2.0.0
+ *
+ * @param extension The loading extension.
+ * @param sink The log sink to register.
+ * @param err Optional. On failure, receives an opaque info handle the caller must destroy via
+ * `duckdb_v2_error_info_destroy()`.
+ * @return DUCKDB_V2_ERROR
+ */
+DUCKDB_C_API DUCKDB_V2_ERROR duckdb_v2_extension_register_log_sink(duckdb_v2_extension_handle extension,
+                                                                   duckdb_v2_log_sink_handle sink,
+                                                                   duckdb_v2_error_info_handle *err);
+#endif
+
+#if DUCKDB_V2_API_ALLOW_UNSTABLE
+/*!
+ * Destroys the log sink, releasing its resources.
+ *
+ * Null-safe: passing a null pointer or null handle is a no-op. The handle is set to null on return to prevent
+ * double-destruction. Destroying the handle after registration does not affect the registered sink.
+ *
+ * history:
+ * - unstable: v2.0.0
+ *
+ * @param sink The log sink to destroy.
+ * @return DUCKDB_V2_ERROR
+ */
+DUCKDB_C_API DUCKDB_V2_ERROR duckdb_v2_log_sink_destroy(duckdb_v2_log_sink_handle *sink);
+#endif
+
+/* --- Struct definitions for log sink --- */
+
+/* ============================================================================
+ * MODULE: logical_type
+ * ============================================================================ */
+
+/* --- Enums for logical_type --- */
+
+/*!
+ * Logical type identifier. The values are the same integers DuckDB uses internally, so round-tripping is lossless. The
+ * bind- and UDF-only ids (UNKNOWN, ANY, TEMPLATE) appear here for completeness; they do not show up in result column
+ * types in practice.
+ */
+typedef enum DUCKDB_V2_LOGICAL_TYPE_ID {
+	//! Invalid / unset.
+	DUCKDB_V2_LOGICAL_TYPE_ID_INVALID = 0,
+
+	//! NULL constant type.
+	DUCKDB_V2_LOGICAL_TYPE_ID_SQLNULL = 1,
+
+	//! Unknown — used for unresolved parameter expressions.
+	DUCKDB_V2_LOGICAL_TYPE_ID_UNKNOWN = 2,
+
+	//! ANY — used for functions that accept any type.
+	DUCKDB_V2_LOGICAL_TYPE_ID_ANY = 3,
+
+	//! A type carried as a value (type parameters). Values of this type are built via value_create_type.
+	DUCKDB_V2_LOGICAL_TYPE_ID_TYPE = 6,
+	DUCKDB_V2_LOGICAL_TYPE_ID_BOOLEAN = 10,
+	DUCKDB_V2_LOGICAL_TYPE_ID_TINYINT = 11,
+	DUCKDB_V2_LOGICAL_TYPE_ID_SMALLINT = 12,
+	DUCKDB_V2_LOGICAL_TYPE_ID_INTEGER = 13,
+	DUCKDB_V2_LOGICAL_TYPE_ID_BIGINT = 14,
+
+	//! 32-bit days since epoch.
+	DUCKDB_V2_LOGICAL_TYPE_ID_DATE = 15,
+
+	//! 64-bit microseconds since midnight.
+	DUCKDB_V2_LOGICAL_TYPE_ID_TIME = 16,
+
+	//! 64-bit seconds since epoch.
+	DUCKDB_V2_LOGICAL_TYPE_ID_TIMESTAMP_SEC = 17,
+
+	//! 64-bit milliseconds since epoch.
+	DUCKDB_V2_LOGICAL_TYPE_ID_TIMESTAMP_MS = 18,
+
+	//! 64-bit microseconds since epoch.
+	DUCKDB_V2_LOGICAL_TYPE_ID_TIMESTAMP = 19,
+
+	//! 64-bit nanoseconds since epoch.
+	DUCKDB_V2_LOGICAL_TYPE_ID_TIMESTAMP_NS = 20,
+
+	//! Decimal with width and scale parameters.
+	DUCKDB_V2_LOGICAL_TYPE_ID_DECIMAL = 21,
+	DUCKDB_V2_LOGICAL_TYPE_ID_FLOAT = 22,
+	DUCKDB_V2_LOGICAL_TYPE_ID_DOUBLE = 23,
+	DUCKDB_V2_LOGICAL_TYPE_ID_VARCHAR = 25,
+	DUCKDB_V2_LOGICAL_TYPE_ID_BLOB = 26,
+	DUCKDB_V2_LOGICAL_TYPE_ID_INTERVAL = 27,
+	DUCKDB_V2_LOGICAL_TYPE_ID_UTINYINT = 28,
+	DUCKDB_V2_LOGICAL_TYPE_ID_USMALLINT = 29,
+	DUCKDB_V2_LOGICAL_TYPE_ID_UINTEGER = 30,
+	DUCKDB_V2_LOGICAL_TYPE_ID_UBIGINT = 31,
+
+	//! 64-bit microseconds since epoch, timezone-aware.
+	DUCKDB_V2_LOGICAL_TYPE_ID_TIMESTAMP_TZ = 32,
+
+	//! 64-bit nanoseconds since epoch, timezone-aware.
+	DUCKDB_V2_LOGICAL_TYPE_ID_TIMESTAMP_TZ_NS = 33,
+
+	//! 64-bit microseconds since midnight + 32-bit offset.
+	DUCKDB_V2_LOGICAL_TYPE_ID_TIME_TZ = 34,
+
+	//! 64-bit nanoseconds since midnight.
+	DUCKDB_V2_LOGICAL_TYPE_ID_TIME_NS = 35,
+	DUCKDB_V2_LOGICAL_TYPE_ID_BIT = 36,
+
+	//! Arbitrary-precision integer (VARINT-encoded).
+	DUCKDB_V2_LOGICAL_TYPE_ID_BIGNUM = 39,
+	DUCKDB_V2_LOGICAL_TYPE_ID_UHUGEINT = 49,
+	DUCKDB_V2_LOGICAL_TYPE_ID_HUGEINT = 50,
+	DUCKDB_V2_LOGICAL_TYPE_ID_UUID = 54,
+
+	//! Geometry (spatial extension).
+	DUCKDB_V2_LOGICAL_TYPE_ID_GEOMETRY = 60,
+	DUCKDB_V2_LOGICAL_TYPE_ID_STRUCT = 100,
+	DUCKDB_V2_LOGICAL_TYPE_ID_LIST = 101,
+	DUCKDB_V2_LOGICAL_TYPE_ID_MAP = 102,
+	DUCKDB_V2_LOGICAL_TYPE_ID_ENUM = 104,
+	DUCKDB_V2_LOGICAL_TYPE_ID_UNION = 107,
+	DUCKDB_V2_LOGICAL_TYPE_ID_ARRAY = 108,
+	DUCKDB_V2_LOGICAL_TYPE_ID_VARIANT = 109,
+
+	//! Unnamed struct; shares the physical representation of STRUCT.
+	DUCKDB_V2_LOGICAL_TYPE_ID_TUPLE = 110,
+	DUCKDB_V2_LOGICAL_TYPE_ID_MAX_ENUM = 0x7FFFFFFF,
+} DUCKDB_V2_LOGICAL_TYPE_ID;
+
+/* --- Struct forward declarations for logical_type --- */
+
+/* --- Types for logical_type --- */
+
+/* --- Constants for logical_type --- */
+
+/* --- Function pointer typedefs for logical_type --- */
+
+/* --- Functions for logical_type --- */
+
+#if DUCKDB_V2_API_ALLOW_UNSTABLE
+/*!
+ * Creates a logical type from a type id plus value parameters.
+ *
+ * The id-keyed twin of factory_create_type_from_name: the type id names the kind, and the parameters bind it. With
+ * param_count 0 it instantiates a primitive directly, without touching the catalog: BOOLEAN, TINYINT..BIGINT,
+ * UTINYINT..UBIGINT, HUGEINT, UHUGEINT, FLOAT, DOUBLE, DATE, every TIME and TIMESTAMP variant, INTERVAL, VARCHAR, BLOB,
+ * BIT, BIGNUM, and UUID. ANY is accepted as well.
+ *
+ * ANY is a function-signature wildcard, constructible here so it can be passed to the function parameter and varargs
+ * setters, as a fixed-arity ANY parameter or an ANY varargs type. Data-creating surfaces reject it: value and data
+ * chunk creation, scalar and aggregate return types, table function result columns, cast source and target types, and
+ * custom type registration.
+ *
+ * With parameters, the id resolves to its canonical built-in type and binds through the same constructors as
+ * factory_create_type_from_name, so the parameterized kinds construct here too: decimal(width, scale); list(T);
+ * array(T, size); map(K, V); struct(fields); union(members); enum(entries); and varchar with a named "collation"
+ * parameter. Parameters are (name, value) pairs in two parallel arrays, exactly as for factory_create_type_from_name.
+ *
+ * Returns ERROR_INPUT_INVALID when param_count is 0 and the id needs parameters (DECIMAL, LIST, STRUCT, TUPLE, MAP,
+ * ARRAY, UNION, ENUM, VARIANT, GEOMETRY), for the bind-time-only ids (SQLNULL, UNKNOWN), for TYPE — construct that via
+ * factory_create_type_from_text — and for INVALID.
+ *
+ * history:
+ * - unstable: v2.0.0
+ *
+ * @param factory The factory to resolve the type in.
+ * @param type_id The type id to instantiate.
+ * @param param_names Optional. An array of param_count parameter names; a {NULL, 0} entry is positional. Pass NULL for
+ * all-positional parameters.
+ * @param param_values An array of param_count parameter values. Borrowed (copied in). Pass NULL when param_count is 0.
+ * @param param_count The number of parameters. 0 instantiates a parameterless primitive.
+ * @param out_type Receives the new logical type handle.
+ * @param err Optional. On failure, receives an opaque info handle the caller must destroy via error_info_destroy.
+ * @return DUCKDB_V2_ERROR
+ */
+DUCKDB_C_API DUCKDB_V2_ERROR duckdb_v2_factory_create_type_from_id(
+    duckdb_v2_factory_handle factory, DUCKDB_V2_LOGICAL_TYPE_ID type_id, const duckdb_v2_identifier_t *param_names,
+    const duckdb_v2_value_handle *param_values, idx_t param_count, duckdb_v2_logical_type_handle *out_type,
+    duckdb_v2_error_info_handle *err);
+#endif
+
+#if DUCKDB_V2_API_ALLOW_UNSTABLE
+/*!
+ * Creates a logical type from a type name plus value parameters.
+ *
+ * The generic constructor: resolves the name in the factory's catalog and binds it with the given parameters, exactly
+ * as SQL binds a type expression. Built-in parameterized kinds and registered extension types construct through this
+ * same call.
+ *
+ * An unqualified name is resolved along the search path first and then in the system catalog, which is where the
+ * built-in kinds live. A qualified name is resolved exactly as written, with no system-catalog fallback, so it names
+ * the type in that catalog or schema or fails.
+ *
+ * Parameters are (name, value) pairs in two parallel arrays. param_names may be NULL to make every parameter
+ * positional, and a {NULL, 0} entry makes that one parameter positional. Child types cross as TYPE values, built with
+ * value_create_type. The built-in shapes are: decimal(width, scale); list(T); array(T, size); map(K, V); struct(fields,
+ * as named or all-positional TYPE values); union(members, as named TYPE values); enum(entries, as VARCHAR values); and
+ * varchar with a named "collation" VARCHAR parameter.
+ *
+ * A name that resolves to a type with no bind function takes no parameters, and passing any fails. Bind errors —
+ * unknown name, wrong parameter count or types — surface from the call.
+ *
+ * Resolves in the scope of the factory: a connection's or callback's factory reaches the catalog, an instance's factory
+ * knows only the built-in types. A connection's factory looks up catalog types in the connection's transaction, or in
+ * one of its own when none is open. Through an instance's factory, only an unqualified built-in name resolves.
+ *
+ * The returned logical type is caller-owned and must be destroyed via logical_type_destroy. A type resolved from the
+ * catalog shares database-owned storage, such as an ENUM dictionary, so destroy it before closing the database. This is
+ * the inverse of logical_type_get_param_count / logical_type_get_param.
+ *
+ * history:
+ * - unstable: v2.0.0
+ *
+ * @param factory The factory to resolve the type in.
+ * @param name The type name to resolve. Parts are matched case-insensitively; qualify it to name a type in a particular
+ * catalog or schema.
+ * @param param_names Optional. An array of param_count parameter names; a {NULL, 0} entry is positional. Pass NULL for
+ * all-positional parameters.
+ * @param param_values An array of param_count parameter values. Borrowed (copied in). Pass NULL when param_count is 0.
+ * @param param_count The number of parameters.
+ * @param out_type Receives the new logical type handle.
+ * @param err Optional. On failure, receives an opaque info handle the caller must destroy via error_info_destroy.
+ * @return DUCKDB_V2_ERROR
+ */
+DUCKDB_C_API DUCKDB_V2_ERROR duckdb_v2_factory_create_type_from_name(
+    duckdb_v2_factory_handle factory, duckdb_v2_qname_handle name, const duckdb_v2_identifier_t *param_names,
+    const duckdb_v2_value_handle *param_values, idx_t param_count, duckdb_v2_logical_type_handle *out_type,
+    duckdb_v2_error_info_handle *err);
+#endif
+
+#if DUCKDB_V2_API_ALLOW_UNSTABLE
+/*!
+ * Creates a logical type by parsing SQL text.
+ *
+ * Parses a SQL type expression and returns the bound logical type. It accepts primitives ("INTEGER"), parameterized
+ * kinds ("DECIMAL(18,3)", "INTEGER[]", "STRUCT(a INTEGER, b VARCHAR)", "MAP(VARCHAR, INTEGER)", "INTEGER[3]", "UNION(i
+ * INTEGER, s VARCHAR)", "ENUM('a', 'b')"), and catalog-registered type names, both user-defined and from extensions. A
+ * catalog type name binds to its structural type, and the name is not preserved as an alias. Names are
+ * case-insensitive. Parse and bind errors surface from the call.
+ *
+ * Resolves in the scope of the factory: a connection's or callback's factory reaches the catalog, an instance's factory
+ * knows only the built-in types. A connection's factory looks up catalog types in the connection's transaction, or in
+ * one of its own when none is open. Text naming only built-in types never touches the catalog.
+ *
+ * The returned logical type is caller-owned and must be destroyed via logical_type_destroy. A type resolved from the
+ * catalog shares database-owned storage, such as an ENUM dictionary, so destroy it before closing the database. This is
+ * the inverse of logical_type_to_text for every constructible kind.
+ *
+ * history:
+ * - unstable: v2.0.0
+ *
+ * @param factory The factory to resolve the type in.
+ * @param text View of the SQL type expression to parse.
+ * @param out_type Receives the new logical type handle.
+ * @param err Optional. On failure, receives an opaque info handle the caller must destroy via error_info_destroy.
+ * @return DUCKDB_V2_ERROR
+ */
+DUCKDB_C_API DUCKDB_V2_ERROR duckdb_v2_factory_create_type_from_text(duckdb_v2_factory_handle factory,
+                                                                     const duckdb_v2_str *text,
+                                                                     duckdb_v2_logical_type_handle *out_type,
+                                                                     duckdb_v2_error_info_handle *err);
+#endif
+
+#if DUCKDB_V2_API_ALLOW_UNSTABLE
+/*!
+ * Creates a copy of a logical type.
+ *
+ * On success, writes the new caller-owned handle into *out_type; destroy it via logical_type_destroy.
+ *
+ * history:
+ * - unstable: v2.0.0
+ *
+ * @param type The logical type to copy.
+ * @param out_type Receives the new logical type handle.
+ * @param err Optional. On failure, receives an opaque info handle the caller must destroy via error_info_destroy.
+ * @return DUCKDB_V2_ERROR
+ */
+DUCKDB_C_API DUCKDB_V2_ERROR duckdb_v2_logical_type_copy(duckdb_v2_logical_type_handle type,
+                                                         duckdb_v2_logical_type_handle *out_type,
+                                                         duckdb_v2_error_info_handle *err);
+#endif
+
+#if DUCKDB_V2_API_ALLOW_UNSTABLE
+/*!
+ * Destroys a logical type handle.
+ *
+ * Null-safe: passing nullptr or a slot already set to nullptr is a no-op. On success the slot is set to nullptr.
+ *
+ * history:
+ * - unstable: v2.0.0
+ *
+ * @param type The logical type to destroy.
+ * @return DUCKDB_V2_ERROR
+ */
+DUCKDB_C_API DUCKDB_V2_ERROR duckdb_v2_logical_type_destroy(duckdb_v2_logical_type_handle *type);
+#endif
+
+#if DUCKDB_V2_API_ALLOW_UNSTABLE
+/*!
+ * Compares two logical types for deep equality.
+ *
+ * Two types are equal when they agree in kind and in every parameter, recursively. DECIMAL(10, 2) equals DECIMAL(10,
+ * 2), but not DECIMAL(10, 3) and not FLOAT; two STRUCTs are equal when they have the same field names in the same order
+ * and equal field types.
+ *
+ * history:
+ * - unstable: v2.0.0
+ *
+ * @param left The first logical type.
+ * @param right The second logical type.
+ * @param result Receives the result of the comparison.
+ * @param err Optional. On failure, receives an opaque info handle the caller must destroy via error_info_destroy.
+ * @return DUCKDB_V2_ERROR
+ */
+DUCKDB_C_API DUCKDB_V2_ERROR duckdb_v2_logical_type_is_equal(duckdb_v2_logical_type_handle left,
+                                                             duckdb_v2_logical_type_handle right, bool *result,
+                                                             duckdb_v2_error_info_handle *err);
+#endif
+
+#if DUCKDB_V2_API_ALLOW_UNSTABLE
+/*!
+ * Returns the logical type id.
+ *
+ * history:
+ * - unstable: v2.0.0
+ *
+ * @param type The logical type.
+ * @param out_id Receives the type id.
+ * @param err Optional. On failure, receives an opaque info handle the caller must destroy via error_info_destroy.
+ * @return DUCKDB_V2_ERROR
+ */
+DUCKDB_C_API DUCKDB_V2_ERROR duckdb_v2_logical_type_get_id(duckdb_v2_logical_type_handle type,
+                                                           DUCKDB_V2_LOGICAL_TYPE_ID *out_id,
+                                                           duckdb_v2_error_info_handle *err);
+#endif
+
+#if DUCKDB_V2_API_ALLOW_UNSTABLE
+/*!
+ * Borrows the logical type's name.
+ *
+ * The alias when one is set — an extension or user-defined name such as "POINT_2D" — otherwise the canonical name of
+ * the type id, such as "INTEGER", "DECIMAL", or "TIMESTAMP WITH TIME ZONE". Never the empty view. This is exactly the
+ * name vocabulary create_type_from_name accepts. The view is valid until the logical type is destroyed; a canonical
+ * name points at static storage.
+ *
+ * history:
+ * - unstable: v2.0.0
+ *
+ * @param type The logical type.
+ * @param out_name Receives a borrowed view of the name (alias when set, else the id's canonical name).
+ * @param err Optional. On failure, receives an opaque info handle the caller must destroy via error_info_destroy.
+ * @return DUCKDB_V2_ERROR
+ */
+DUCKDB_C_API DUCKDB_V2_ERROR duckdb_v2_logical_type_get_name(duckdb_v2_logical_type_handle type,
+                                                             duckdb_v2_identifier_t *out_name,
+                                                             duckdb_v2_error_info_handle *err);
+#endif
+
+#if DUCKDB_V2_API_ALLOW_UNSTABLE
+/*!
+ * Renders a logical type as SQL text.
+ *
+ * An aliased type renders as its alias, and create_type_from_text resolves that spelling only when the name is
+ * registered in the factory's catalog. The text round-trips through create_type_from_text for every constructible kind,
+ * with one exception: ANY renders as "ANY", but create_type_from_text cannot parse it back, since ANY is a signature
+ * wildcard rather than a parseable SQL type.
+ *
+ * Writes into a caller-supplied buffer, so nothing is allocated on the caller's behalf and nothing has to be freed.
+ * Pass out_text = NULL to size the buffer without rendering into it: out_length then receives the length, and
+ * out_capacity is ignored. With out_text != NULL, out_capacity must be at least out_length + 1, or the call returns
+ * ERROR_INPUT_OBJECT_SIZE with out_length set to the required length and out_text left untouched.
+ *
+ * out_length never counts the terminator, but a successful write always appends one, so the buffer is usable as a C
+ * string.
+ *
+ * history:
+ * - unstable: v2.0.0
+ *
+ * @param type The logical type.
+ * @param out_text Caller-owned buffer receiving the text plus a null terminator, or NULL to only report the required
+ * length in out_length.
+ * @param out_capacity Bytes available in out_text, terminator included. Ignored when out_text is NULL.
+ * @param out_length Receives the text length excluding the null terminator — written on success and on
+ * ERROR_INPUT_OBJECT_SIZE.
+ * @param err Optional. On failure, receives an opaque info handle the caller must destroy via error_info_destroy.
+ * @return DUCKDB_V2_ERROR
+ */
+DUCKDB_C_API DUCKDB_V2_ERROR duckdb_v2_logical_type_to_text(duckdb_v2_logical_type_handle type, char *out_text,
+                                                            idx_t out_capacity, idx_t *out_length,
+                                                            duckdb_v2_error_info_handle *err);
+#endif
+
+#if DUCKDB_V2_API_ALLOW_UNSTABLE
+/*!
+ * Returns the number of value parameters of a logical type.
+ *
+ * The inspection dual of create_type_from_name: these are the parameters that reconstruct the type through it. Per
+ * kind: DECIMAL 2 (width, scale); LIST 1 (element type); ARRAY 2 (element type, size); MAP 2 (key type, value type);
+ * STRUCT and TUPLE one per field; UNION one per member; ENUM one per dictionary entry; VARCHAR 1 when a collation is
+ * set, else 0; GEOMETRY 1 when a coordinate system is set, else 0; everything else 0. A bound type reports only what it
+ * actually carries, so a bind-time modifier that is not retained — an ignored VARCHAR length, say — does not reappear.
+ *
+ * history:
+ * - unstable: v2.0.0
+ *
+ * @param type The logical type.
+ * @param out_count Receives the number of parameters.
+ * @param err Optional. On failure, receives an opaque info handle the caller must destroy via error_info_destroy.
+ * @return DUCKDB_V2_ERROR
+ */
+DUCKDB_C_API DUCKDB_V2_ERROR duckdb_v2_logical_type_get_param_count(duckdb_v2_logical_type_handle type,
+                                                                    idx_t *out_count, duckdb_v2_error_info_handle *err);
+#endif
+
+#if DUCKDB_V2_API_ALLOW_UNSTABLE
+/*!
+ * Returns one value parameter of a logical type.
+ *
+ * out_name receives a borrowed view of the parameter name — a STRUCT field name, a UNION member name, "collation" — or
+ * the empty view {NULL, 0} for a positional parameter. A non-empty view is valid until the logical type is destroyed.
+ * out_value receives an owned value, destroyed via value_destroy: child types come back as TYPE values (unwrap them
+ * with value_get_type), DECIMAL width and scale as UTINYINT, ARRAY size as BIGINT, and ENUM dictionary entries and
+ * collations as VARCHAR. An out-of-range index returns ERROR_INPUT_INVALID. Each call allocates one owned value.
+ *
+ * history:
+ * - unstable: v2.0.0
+ *
+ * @param type The logical type.
+ * @param index The parameter index, in [0, param_count).
+ * @param out_name Receives a borrowed view of the parameter name, or the empty view {NULL, 0} for a positional
+ * parameter.
+ * @param out_value Receives the owned parameter value.
+ * @param err Optional. On failure, receives an opaque info handle the caller must destroy via error_info_destroy.
+ * @return DUCKDB_V2_ERROR
+ */
+DUCKDB_C_API DUCKDB_V2_ERROR duckdb_v2_logical_type_get_param(duckdb_v2_logical_type_handle type, idx_t index,
+                                                              duckdb_v2_identifier_t *out_name,
+                                                              duckdb_v2_value_handle *out_value,
+                                                              duckdb_v2_error_info_handle *err);
+#endif
+
+#if DUCKDB_V2_API_ALLOW_UNSTABLE
+/*!
+ * Creates a logical type that is an alias of another logical type.
+ *
+ * The alias keeps the base type's internal representation, so executing against it needs no special handling, while
+ * remaining logically distinct from the base type. Intended for custom type bind callbacks, where both the base type
+ * and the name come from the bind info.
+ *
+ * The alias is not registered anywhere, so this works through any factory. An empty alias name returns
+ * ERROR_INPUT_INVALID.
+ *
+ * history:
+ * - unstable: v2.0.0
+ *
+ * @param factory The factory to resolve the type in.
+ * @param base_type The logical type to alias. Typically the base type supplied in the custom type bind info.
+ * @param alias_name The name for the resulting type. Typically the name of the custom type being constructed, also
+ * available from the bind info.
+ * @param out_type Receives the new type: the base type's internal representation under the given alias name.
+ * @param err Optional. On failure, receives an opaque info handle the caller must destroy via error_info_destroy.
+ * @return DUCKDB_V2_ERROR
+ */
+DUCKDB_C_API DUCKDB_V2_ERROR duckdb_v2_factory_create_type_with_alias(duckdb_v2_factory_handle factory,
+                                                                      duckdb_v2_logical_type_handle base_type,
+                                                                      const duckdb_v2_identifier_t *alias_name,
+                                                                      duckdb_v2_logical_type_handle *out_type,
+                                                                      duckdb_v2_error_info_handle *err);
+#endif
+
+#if DUCKDB_V2_API_ALLOW_UNSTABLE
+/*!
+ * Creates the common type of a set of logical types.
+ *
+ * The common type is the type every input implicitly casts to, resolved by the same rule a SQL list literal and
+ * value_create_list follow: INTEGER and BIGINT resolve to BIGINT, and DECIMAL(4,1) and DECIMAL(5,4) to DECIMAL(7,4).
+ * The types are combined pairwise from left to right, and the result is not guaranteed to be independent of their
+ * order.
+ *
+ * A connection's or a callback's factory also applies the casts that extensions registered, while an instance's factory
+ * knows only the built-in ones, so the two can resolve the same set differently. A single type resolves to a copy of
+ * itself.
+ *
+ * Returns ERROR_INPUT_INVALID for an empty set, for a NULL entry and for ANY, and ERROR_QUERY_NOT_IMPLEMENTED when the
+ * types have no common type.
+ *
+ * history:
+ * - unstable: v2.0.0
+ *
+ * @param factory The factory to resolve the type in.
+ * @param types An array of type_count logical types. Borrowed.
+ * @param type_count The number of types. Must be at least 1.
+ * @param out_type Receives the new logical type handle.
+ * @param err Optional. On failure, receives an opaque info handle the caller must destroy via error_info_destroy.
+ * @return DUCKDB_V2_ERROR
+ */
+DUCKDB_C_API DUCKDB_V2_ERROR duckdb_v2_factory_create_common_type(duckdb_v2_factory_handle factory,
+                                                                  const duckdb_v2_logical_type_handle *types,
+                                                                  idx_t type_count,
+                                                                  duckdb_v2_logical_type_handle *out_type,
+                                                                  duckdb_v2_error_info_handle *err);
+#endif
+
+/* --- Struct definitions for logical_type --- */
+
+/* ============================================================================
+ * MODULE: macro
+ * ============================================================================ */
+
+/* --- Enums for macro --- */
+
+//! The kind of a macro function, deciding how its body is read. Pass one to `duckdb_v2_macro_function_create()`.
+typedef enum DUCKDB_V2_MACRO_FUNCTION_TYPE {
+	//! A scalar macro. The body is a single expression, and the macro is called like a scalar function.
+	DUCKDB_V2_MACRO_FUNCTION_TYPE_SCALAR = 0,
+
+	//! A table macro. The body is a single SELECT query, and the macro is called like a table function.
+	DUCKDB_V2_MACRO_FUNCTION_TYPE_TABLE = 1,
+	DUCKDB_V2_MACRO_FUNCTION_TYPE_MAX_ENUM = 0x7FFFFFFF,
+} DUCKDB_V2_MACRO_FUNCTION_TYPE;
+
+/* --- Struct forward declarations for macro --- */
+
+/* --- Types for macro --- */
+
+/*!
+ * An owned opaque handle to a macro function being built. Created with `duckdb_v2_macro_function_create()`, configured
+ * with `duckdb_v2_macro_function_set_name()`, `duckdb_v2_macro_function_set_body()` and the signature obtained via
+ * `duckdb_v2_macro_function_get_signature()`, made available with `duckdb_v2_extension_register_macro_function()`, and
+ * destroyed with `duckdb_v2_macro_function_destroy()`.
+ */
+typedef struct _duckdb_v2_macro_function {
+	void *internal_ptr;
+} * duckdb_v2_macro_function_handle;
+
+/* --- Constants for macro --- */
+
+/* --- Function pointer typedefs for macro --- */
+
+/* --- Functions for macro --- */
+
+#if DUCKDB_V2_API_ALLOW_UNSTABLE
+/*!
+ * Creates a new macro function through a factory.
+ *
+ * The macro function starts out empty: configure it with the setter functions and the signature obtained via
+ * `duckdb_v2_macro_function_get_signature()`, then make it available with
+ * `duckdb_v2_extension_register_macro_function()`. The caller owns the returned handle and must destroy it with
+ * `duckdb_v2_macro_function_destroy()`, also after registration.
+ *
+ * The macro function can only be registered on the database the factory belongs to.
+ *
+ * history:
+ * - unstable: v2.0.0
+ *
+ * @param factory The factory to create the macro function through.
+ * @param type Whether the macro is a scalar or a table macro.
+ * @param function On success, receives the newly created macro function. Owned by the caller.
+ * @param err Optional. On failure, receives an opaque info handle the caller must destroy via
+ * `duckdb_v2_error_info_destroy()`.
+ * @return DUCKDB_V2_ERROR
+ */
+DUCKDB_C_API DUCKDB_V2_ERROR duckdb_v2_macro_function_create(duckdb_v2_factory_handle factory,
+                                                             DUCKDB_V2_MACRO_FUNCTION_TYPE type,
+                                                             duckdb_v2_macro_function_handle *function,
+                                                             duckdb_v2_error_info_handle *err);
+#endif
+
+#if DUCKDB_V2_API_ALLOW_UNSTABLE
+/*!
+ * Sets the name of the macro function, as SQL calls it.
+ *
+ * The name is borrowed and copied. Calling this again replaces the previous name. A name must be set before
+ * registration.
+ *
+ * history:
+ * - unstable: v2.0.0
+ *
+ * @param function The macro function to set the name of.
+ * @param name The name to set. Borrowed and copied.
+ * @param err Optional. On failure, receives an opaque info handle the caller must destroy via
+ * `duckdb_v2_error_info_destroy()`.
+ * @return DUCKDB_V2_ERROR
+ */
+DUCKDB_C_API DUCKDB_V2_ERROR duckdb_v2_macro_function_set_name(duckdb_v2_macro_function_handle function,
+                                                               const duckdb_v2_identifier_t *name,
+                                                               duckdb_v2_error_info_handle *err);
+#endif
+
+#if DUCKDB_V2_API_ALLOW_UNSTABLE
+/*!
+ * Sets the body of the macro function, as SQL text.
+ *
+ * For a scalar macro the body is a single expression, for a table macro a single SELECT query. It refers to the
+ * parameters by name. The body is parsed at registration, which fails on a syntax error; names in it are resolved only
+ * when the macro is called, as with SQL `CREATE MACRO`. The body is borrowed and copied. Calling this again replaces
+ * the previous body. A body must be set before registration.
+ *
+ * history:
+ * - unstable: v2.0.0
+ *
+ * @param function The macro function to set the body of.
+ * @param body The SQL text of the body. Borrowed and copied.
+ * @param err Optional. On failure, receives an opaque info handle the caller must destroy via
+ * `duckdb_v2_error_info_destroy()`.
+ * @return DUCKDB_V2_ERROR
+ */
+DUCKDB_C_API DUCKDB_V2_ERROR duckdb_v2_macro_function_set_body(duckdb_v2_macro_function_handle function,
+                                                               const duckdb_v2_str *body,
+                                                               duckdb_v2_error_info_handle *err);
+#endif
+
+#if DUCKDB_V2_API_ALLOW_UNSTABLE
+/*!
+ * Returns the macro function's signature so its parameters can be declared.
+ *
+ * Add parameters with `duckdb_v2_function_signature_add_parameter()`. A macro's parameters can always be passed by
+ * position or by name, so only `FUNCTION_PARAMETER_KIND_STANDARD` parameters are accepted; a macro has no variadic
+ * parameters. A parameter of type ANY is untyped, and a parameter with a default value can be omitted by a caller. A
+ * macro's result is decided by its body, so the signature cannot set a return type. Registration fails on a signature
+ * that does not follow these rules. The signature is modified in place.
+ *
+ * history:
+ * - unstable: v2.0.0
+ *
+ * @param function The macro function to get the signature of.
+ * @param sig The returned signature. Borrowed and valid for the lifetime of the macro function handle.
+ * @param err Optional. On failure, receives an opaque info handle the caller must destroy via
+ * `duckdb_v2_error_info_destroy()`.
+ * @return DUCKDB_V2_ERROR
+ */
+DUCKDB_C_API DUCKDB_V2_ERROR duckdb_v2_macro_function_get_signature(duckdb_v2_macro_function_handle function,
+                                                                    duckdb_v2_function_signature_handle *sig,
+                                                                    duckdb_v2_error_info_handle *err);
+#endif
+
+#if DUCKDB_V2_API_ALLOW_UNSTABLE
+/*!
+ * Returns the documentation of the macro function so it can be filled in.
+ *
+ * Set a description with `duckdb_v2_function_docs_set_description()`, and add examples and categories with
+ * `duckdb_v2_function_docs_add_example()` and `duckdb_v2_function_docs_add_category()`. The documentation is modified
+ * in place and registered with the macro function. Optional.
+ *
+ * history:
+ * - unstable: v2.0.0
+ *
+ * @param function The macro function to get the documentation of.
+ * @param docs The returned documentation. Borrowed and valid for the lifetime of the macro function handle.
+ * @param err Optional. On failure, receives an opaque info handle the caller must destroy via
+ * `duckdb_v2_error_info_destroy()`.
+ * @return DUCKDB_V2_ERROR
+ */
+DUCKDB_C_API DUCKDB_V2_ERROR duckdb_v2_macro_function_get_docs(duckdb_v2_macro_function_handle function,
+                                                               duckdb_v2_function_docs_handle *docs,
+                                                               duckdb_v2_error_info_handle *err);
+#endif
+
+#if DUCKDB_V2_API_ALLOW_UNSTABLE
+/*!
+ * Registers the macro function, making it available for use in SQL queries.
+ *
+ * The macro function is registered on the loading extension's database and attributed to the extension. Use this from
+ * the extension's load callback. Registration requires a name and a body that parses, and a signature that follows the
+ * rules of `duckdb_v2_macro_function_get_signature()`. It fails when a function of the same name already exists: a
+ * macro function has a single overload. The macro function must have been created through a factory of the same
+ * database. The caller still owns the handle after registration and must destroy it with
+ * `duckdb_v2_macro_function_destroy()`, which does not affect the registered macro function.
+ *
+ * history:
+ * - unstable: v2.0.0
+ *
+ * @param extension The loading extension.
+ * @param function The macro function to register.
+ * @param err Optional. On failure, receives an opaque info handle the caller must destroy via
+ * `duckdb_v2_error_info_destroy()`.
+ * @return DUCKDB_V2_ERROR
+ */
+DUCKDB_C_API DUCKDB_V2_ERROR duckdb_v2_extension_register_macro_function(duckdb_v2_extension_handle extension,
+                                                                         duckdb_v2_macro_function_handle function,
+                                                                         duckdb_v2_error_info_handle *err);
+#endif
+
+#if DUCKDB_V2_API_ALLOW_UNSTABLE
+/*!
+ * Destroys the macro function, releasing its resources.
+ *
+ * Null-safe: passing a null pointer or null handle is a no-op. The handle is set to null on return to prevent
+ * double-destruction. Destroying the handle after registration does not affect the registered macro function.
+ *
+ * history:
+ * - unstable: v2.0.0
+ *
+ * @param function The macro function to destroy.
+ * @return DUCKDB_V2_ERROR
+ */
+DUCKDB_C_API DUCKDB_V2_ERROR duckdb_v2_macro_function_destroy(duckdb_v2_macro_function_handle *function);
+#endif
+
+/* --- Struct definitions for macro --- */
+
+/* ============================================================================
+ * MODULE: pragma
+ * ============================================================================ */
+
+/* --- Enums for pragma --- */
+
+/* --- Struct forward declarations for pragma --- */
+
+/* --- Types for pragma --- */
+
+/*!
+ * An owned opaque handle to a custom pragma function being built. Created with `duckdb_v2_pragma_function_create()`,
+ * configured with the setter functions (e.g. `duckdb_v2_pragma_function_set_name()`,
+ * `duckdb_v2_pragma_function_set_query_callback()`, etc.) and the signature obtained via
+ * `duckdb_v2_pragma_function_get_signature()`, made available with `duckdb_v2_connection_register_pragma_function()` or
+ * `duckdb_v2_extension_register_pragma_function()`, and destroyed with `duckdb_v2_pragma_function_destroy()`.
+ */
+typedef struct _duckdb_v2_pragma_function {
+	void *internal_ptr;
+} * duckdb_v2_pragma_function_handle;
+
+/*!
+ * A borrowed opaque handle to the result of a pragma function's "query" callback. The query callback receives this
+ * handle next to a `duckdb_v2_function_bind_info_handle`, which gives access to the arguments and the user data, and
+ * uses it to set the query to run in place of the `PRAGMA` statement.
+ */
+typedef struct _duckdb_v2_pragma_function_query_info {
+	void *internal_ptr;
+} * duckdb_v2_pragma_function_query_info_handle;
+
+/* --- Constants for pragma --- */
+
+/* --- Function pointer typedefs for pragma --- */
+
+typedef void (*duckdb_v2_pragma_function_query_callback_fn)(duckdb_v2_function_bind_info_handle info,
+                                                            duckdb_v2_pragma_function_query_info_handle result,
+                                                            duckdb_v2_context_handle context,
+                                                            duckdb_v2_error_info_handle *err);
+
+typedef void (*duckdb_v2_pragma_function_exec_callback_fn)(duckdb_v2_function_bind_info_handle info,
+                                                           duckdb_v2_context_handle context,
+                                                           duckdb_v2_error_info_handle *err);
+
+/* --- Functions for pragma --- */
+
+#if DUCKDB_V2_API_ALLOW_UNSTABLE
+/*!
+ * Creates a new pragma function through a factory.
+ *
+ * The function starts out empty: configure it with the setter functions (e.g. `duckdb_v2_pragma_function_set_name()`,
+ * `duckdb_v2_pragma_function_set_query_callback()`, etc.) and the signature obtained via
+ * `duckdb_v2_pragma_function_get_signature()`, then make it available with
+ * `duckdb_v2_connection_register_pragma_function()` or `duckdb_v2_extension_register_pragma_function()`. The caller
+ * owns the returned handle and must destroy it with `duckdb_v2_pragma_function_destroy()`, also after registration.
+ *
+ * The pragma function can only be registered on the database the factory belongs to.
+ *
+ * history:
+ * - unstable: v2.0.0
+ *
+ * @param factory The factory to create the pragma function through.
+ * @param function On success, receives the newly created pragma function. Owned by the caller.
+ * @param err Optional. On failure, receives an opaque info handle the caller must destroy via
+ * `duckdb_v2_error_info_destroy()`.
+ * @return DUCKDB_V2_ERROR
+ */
+DUCKDB_C_API DUCKDB_V2_ERROR duckdb_v2_pragma_function_create(duckdb_v2_factory_handle factory,
+                                                              duckdb_v2_pragma_function_handle *function,
+                                                              duckdb_v2_error_info_handle *err);
+#endif
+
+#if DUCKDB_V2_API_ALLOW_UNSTABLE
+/*!
+ * Sets the name of the pragma function, as the `PRAGMA` statement calls it.
+ *
+ * The name is borrowed and copied. Calling this again replaces the previous name. A name must be set before
+ * registration.
+ *
+ * history:
+ * - unstable: v2.0.0
+ *
+ * @param function The function to set the name of.
+ * @param name The name to set. Borrowed and copied.
+ * @param err Optional. On failure, receives an opaque info handle the caller must destroy via
+ * `duckdb_v2_error_info_destroy()`.
+ * @return DUCKDB_V2_ERROR
+ */
+DUCKDB_C_API DUCKDB_V2_ERROR duckdb_v2_pragma_function_set_name(duckdb_v2_pragma_function_handle function,
+                                                                const duckdb_v2_identifier_t *name,
+                                                                duckdb_v2_error_info_handle *err);
+#endif
+
+#if DUCKDB_V2_API_ALLOW_UNSTABLE
+/*!
+ * Returns the documentation of the function so it can be filled in.
+ *
+ * Set a description with `duckdb_v2_function_docs_set_description()`, and add examples and categories with
+ * `duckdb_v2_function_docs_add_example()` and `duckdb_v2_function_docs_add_category()`. The documentation is modified
+ * in place and registered with the function. Optional.
+ *
+ * history:
+ * - unstable: v2.0.0
+ *
+ * @param function The function to get the documentation of.
+ * @param docs The returned documentation. Borrowed and valid for the lifetime of the function handle.
+ * @param err Optional. On failure, receives an opaque info handle the caller must destroy via
+ * `duckdb_v2_error_info_destroy()`.
+ * @return DUCKDB_V2_ERROR
+ */
+DUCKDB_C_API DUCKDB_V2_ERROR duckdb_v2_pragma_function_get_docs(duckdb_v2_pragma_function_handle function,
+                                                                duckdb_v2_function_docs_handle *docs,
+                                                                duckdb_v2_error_info_handle *err);
+#endif
+
+#if DUCKDB_V2_API_ALLOW_UNSTABLE
+/*!
+ * Returns the function's signature so it can be configured.
+ *
+ * Add parameters with `duckdb_v2_function_signature_add_parameter()`. A pragma produces no value, so its signature
+ * cannot set a return type. A signature without parameters makes a pragma called as `PRAGMA name`. The signature is
+ * modified in place.
+ *
+ * history:
+ * - unstable: v2.0.0
+ *
+ * @param function The function to get the signature of.
+ * @param sig The returned signature. Borrowed and valid for the lifetime of the function handle.
+ * @param err Optional. On failure, receives an opaque info handle the caller must destroy via
+ * `duckdb_v2_error_info_destroy()`.
+ * @return DUCKDB_V2_ERROR
+ */
+DUCKDB_C_API DUCKDB_V2_ERROR duckdb_v2_pragma_function_get_signature(duckdb_v2_pragma_function_handle function,
+                                                                     duckdb_v2_function_signature_handle *sig,
+                                                                     duckdb_v2_error_info_handle *err);
+#endif
+
+#if DUCKDB_V2_API_ALLOW_UNSTABLE
+/*!
+ * Sets arbitrary user data on the pragma function.
+ *
+ * Associates an opaque pointer with the function, retrievable from the callbacks via
+ * `duckdb_v2_function_bind_get_user_data()`. The opaque handle bundles the pointer with an optional destructor, invoked
+ * when the data is no longer needed.
+ *
+ * history:
+ * - unstable: v2.0.0
+ *
+ * @param function The function to set the user data of.
+ * @param data Opaque handle bundling the user data pointer plus an optional destructor.
+ * @param err Optional. On failure, receives an opaque info handle the caller must destroy via
+ * `duckdb_v2_error_info_destroy()`.
+ * @return DUCKDB_V2_ERROR
+ */
+DUCKDB_C_API DUCKDB_V2_ERROR duckdb_v2_pragma_function_set_user_data(duckdb_v2_pragma_function_handle function,
+                                                                     duckdb_v2_opaque *data,
+                                                                     duckdb_v2_error_info_handle *err);
+#endif
+
+#if DUCKDB_V2_API_ALLOW_UNSTABLE
+/*!
+ * Sets the query callback of the pragma function, making it a query pragma.
+ *
+ * The query callback is invoked before the `PRAGMA` statement is bound, and must set a SQL string through
+ * `duckdb_v2_pragma_function_query_set_query()`. The string is parsed and its statements run in place of the `PRAGMA`
+ * statement. A pragma function has either a query callback or an exec callback; registration fails when both or neither
+ * are set.
+ *
+ * history:
+ * - unstable: v2.0.0
+ *
+ * @param function The function to set the query callback of.
+ * @param callback The query callback to set.
+ * @param err Optional. On failure, receives an opaque info handle the caller must destroy via
+ * `duckdb_v2_error_info_destroy()`.
+ * @return DUCKDB_V2_ERROR
+ */
+DUCKDB_C_API DUCKDB_V2_ERROR duckdb_v2_pragma_function_set_query_callback(
+    duckdb_v2_pragma_function_handle function, duckdb_v2_pragma_function_query_callback_fn callback,
+    duckdb_v2_error_info_handle *err);
+#endif
+
+#if DUCKDB_V2_API_ALLOW_UNSTABLE
+/*!
+ * Sets the exec callback of the pragma function, making it an exec pragma.
+ *
+ * The exec callback is invoked when the `PRAGMA` statement executes, and runs for its side effects: the statement
+ * produces no rows. A pragma function has either a query callback or an exec callback; registration fails when both or
+ * neither are set.
+ *
+ * history:
+ * - unstable: v2.0.0
+ *
+ * @param function The function to set the exec callback of.
+ * @param callback The exec callback to set.
+ * @param err Optional. On failure, receives an opaque info handle the caller must destroy via
+ * `duckdb_v2_error_info_destroy()`.
+ * @return DUCKDB_V2_ERROR
+ */
+DUCKDB_C_API DUCKDB_V2_ERROR duckdb_v2_pragma_function_set_exec_callback(
+    duckdb_v2_pragma_function_handle function, duckdb_v2_pragma_function_exec_callback_fn callback,
+    duckdb_v2_error_info_handle *err);
+#endif
+
+#if DUCKDB_V2_API_ALLOW_UNSTABLE
+/*!
+ * Sets the SQL to run in place of the `PRAGMA` statement.
+ *
+ * The query may hold several statements, separated by semicolons. It is borrowed and copied. Calling this again
+ * replaces the previous query. The query callback must set a query.
+ *
+ * history:
+ * - unstable: v2.0.0
+ *
+ * @param info The query info handle.
+ * @param query The SQL to run. Borrowed and copied.
+ * @param err Optional. On failure, receives an opaque info handle the caller must destroy via
+ * `duckdb_v2_error_info_destroy()`.
+ * @return DUCKDB_V2_ERROR
+ */
+DUCKDB_C_API DUCKDB_V2_ERROR duckdb_v2_pragma_function_query_set_query(duckdb_v2_pragma_function_query_info_handle info,
+                                                                       const duckdb_v2_str *query,
+                                                                       duckdb_v2_error_info_handle *err);
+#endif
+
+#if DUCKDB_V2_API_ALLOW_UNSTABLE
+/*!
+ * Registers the pragma function, making it available to the `PRAGMA` statement.
+ *
+ * The function is registered on the connection's database, visible to every connection, in the connection's
+ * transaction: inside an explicit transaction, it is invisible to other connections until the transaction commits, and
+ * a rollback undoes it. Registration requires a name and exactly one of a query callback or an exec callback, and fails
+ * when a pragma of the same name already exists. The pragma function must have been created through a factory of the
+ * same database. The caller still owns the handle after registration and must destroy it with
+ * `duckdb_v2_pragma_function_destroy()`, which does not affect the registered function.
+ *
+ * history:
+ * - unstable: v2.0.0
+ *
+ * @param conn The connection to register on.
+ * @param function The pragma function to register.
+ * @param err Optional. On failure, receives an opaque info handle the caller must destroy via
+ * `duckdb_v2_error_info_destroy()`.
+ * @return DUCKDB_V2_ERROR
+ */
+DUCKDB_C_API DUCKDB_V2_ERROR duckdb_v2_connection_register_pragma_function(duckdb_v2_connection_handle conn,
+                                                                           duckdb_v2_pragma_function_handle function,
+                                                                           duckdb_v2_error_info_handle *err);
+#endif
+
+#if DUCKDB_V2_API_ALLOW_UNSTABLE
+/*!
+ * Registers the pragma function, making it available to the `PRAGMA` statement.
+ *
+ * The function is registered on the loading extension's database and attributed to the extension. Use this from the
+ * extension's load callback. Registration requires a name and exactly one of a query callback or an exec callback, and
+ * fails when a pragma of the same name already exists. The pragma function must have been created through a factory of
+ * the same database. The caller still owns the handle after registration and must destroy it with
+ * `duckdb_v2_pragma_function_destroy()`, which does not affect the registered function.
+ *
+ * history:
+ * - unstable: v2.0.0
+ *
+ * @param extension The loading extension.
+ * @param function The pragma function to register.
+ * @param err Optional. On failure, receives an opaque info handle the caller must destroy via
+ * `duckdb_v2_error_info_destroy()`.
+ * @return DUCKDB_V2_ERROR
+ */
+DUCKDB_C_API DUCKDB_V2_ERROR duckdb_v2_extension_register_pragma_function(duckdb_v2_extension_handle extension,
+                                                                          duckdb_v2_pragma_function_handle function,
+                                                                          duckdb_v2_error_info_handle *err);
+#endif
+
+#if DUCKDB_V2_API_ALLOW_UNSTABLE
+/*!
+ * Destroys the pragma function, releasing its resources.
+ *
+ * Null-safe: passing a null pointer or null handle is a no-op. The handle is set to null on return to prevent
+ * double-destruction. Destroying the handle after registration does not affect the registered function.
+ *
+ * history:
+ * - unstable: v2.0.0
+ *
+ * @param function The function to destroy.
+ * @return DUCKDB_V2_ERROR
+ */
+DUCKDB_C_API DUCKDB_V2_ERROR duckdb_v2_pragma_function_destroy(duckdb_v2_pragma_function_handle *function);
+#endif
+
+/* --- Struct definitions for pragma --- */
+
+/* ============================================================================
+ * MODULE: replacement scan
+ * ============================================================================ */
+
+/* --- Enums for replacement scan --- */
+
+/* --- Struct forward declarations for replacement scan --- */
+
+/* --- Types for replacement scan --- */
+
+/*!
+ * An owned opaque handle to a replacement scan being built. Created with `duckdb_v2_replacement_scan_create()`,
+ * configured with `duckdb_v2_replacement_scan_set_callback()` and `duckdb_v2_replacement_scan_set_user_data()`, made
+ * available with `duckdb_v2_connection_register_replacement_scan()`, `duckdb_v2_instance_register_replacement_scan()`
+ * or `duckdb_v2_extension_register_replacement_scan()`, and destroyed with `duckdb_v2_replacement_scan_destroy()`.
+ */
+typedef struct _duckdb_v2_replacement_scan {
+	void *internal_ptr;
+} * duckdb_v2_replacement_scan_handle;
+
+/*!
+ * A borrowed opaque handle to the arguments supplied to a replacement scan when the binder consults it. The callback
+ * receives this handle and can use it to inspect the unresolved name and to claim it by naming what to read instead.
+ * Valid only for the duration of the callback; the name it hands out is owned separately and outlives it.
+ */
+typedef struct _duckdb_v2_replacement_scan_info {
+	void *internal_ptr;
+} * duckdb_v2_replacement_scan_info_handle;
+
+/* --- Constants for replacement scan --- */
+
+/* --- Function pointer typedefs for replacement scan --- */
+
+typedef void (*duckdb_v2_replacement_scan_callback_fn)(duckdb_v2_replacement_scan_info_handle info,
+                                                       duckdb_v2_context_handle context,
+                                                       duckdb_v2_error_info_handle *err);
+
+/* --- Functions for replacement scan --- */
+
+#if DUCKDB_V2_API_ALLOW_UNSTABLE
+/*!
+ * Creates a new replacement scan through a factory.
+ *
+ * The scan starts out empty: configure it with `duckdb_v2_replacement_scan_set_callback()` and optionally
+ * `duckdb_v2_replacement_scan_set_user_data()`, then make it available with
+ * `duckdb_v2_connection_register_replacement_scan()`, `duckdb_v2_instance_register_replacement_scan()` or
+ * `duckdb_v2_extension_register_replacement_scan()`. The caller owns the returned handle and must destroy it with
+ * `duckdb_v2_replacement_scan_destroy()`, also after registration.
+ *
+ * The scan can only be registered on the database the factory belongs to.
+ *
+ * history:
+ * - unstable: v2.0.0
+ *
+ * @param factory The factory to create the scan through.
+ * @param scan On success, receives the newly created replacement scan. Owned by the caller.
+ * @param err Optional. On failure, receives an opaque info handle the caller must destroy via
+ * `duckdb_v2_error_info_destroy()`.
+ * @return DUCKDB_V2_ERROR
+ */
+DUCKDB_C_API DUCKDB_V2_ERROR duckdb_v2_replacement_scan_create(duckdb_v2_factory_handle factory,
+                                                               duckdb_v2_replacement_scan_handle *scan,
+                                                               duckdb_v2_error_info_handle *err);
+#endif
+
+#if DUCKDB_V2_API_ALLOW_UNSTABLE
+/*!
+ * Sets the callback of the replacement scan.
+ *
+ * The callback is invoked during query planning for each table reference the catalog could not resolve. It can inspect
+ * the unresolved name via `duckdb_v2_replacement_scan_get_name()`, and claim the reference via
+ * `duckdb_v2_replacement_scan_set_function_name()`, `duckdb_v2_replacement_scan_set_collection()` or
+ * `duckdb_v2_replacement_scan_set_subquery()`; returning without claiming declines it. The context passed to the
+ * callback may be used to read settings, but not to run queries. A callback must be set before registration.
+ *
+ * history:
+ * - unstable: v2.0.0
+ *
+ * @param scan The scan to set the callback of.
+ * @param callback The callback to set.
+ * @param err Optional. On failure, receives an opaque info handle the caller must destroy via
+ * `duckdb_v2_error_info_destroy()`.
+ * @return DUCKDB_V2_ERROR
+ */
+DUCKDB_C_API DUCKDB_V2_ERROR duckdb_v2_replacement_scan_set_callback(duckdb_v2_replacement_scan_handle scan,
+                                                                     duckdb_v2_replacement_scan_callback_fn callback,
+                                                                     duckdb_v2_error_info_handle *err);
+#endif
+
+#if DUCKDB_V2_API_ALLOW_UNSTABLE
+/*!
+ * Sets arbitrary user data on the replacement scan.
+ *
+ * Associates an opaque pointer with the scan, retrievable from the callback via
+ * `duckdb_v2_replacement_scan_get_user_data()`. The opaque handle bundles the pointer with an optional destructor,
+ * invoked when the data is no longer needed, at the latest when the scan's scope ends. The callback may be invoked from
+ * several connections at once, so the data must be safe to read concurrently.
+ *
+ * history:
+ * - unstable: v2.0.0
+ *
+ * @param scan The scan to set the user data of.
+ * @param data Opaque handle bundling the user data pointer plus an optional destructor.
+ * @param err Optional. On failure, receives an opaque info handle the caller must destroy via
+ * `duckdb_v2_error_info_destroy()`.
+ * @return DUCKDB_V2_ERROR
+ */
+DUCKDB_C_API DUCKDB_V2_ERROR duckdb_v2_replacement_scan_set_user_data(duckdb_v2_replacement_scan_handle scan,
+                                                                      duckdb_v2_opaque *data,
+                                                                      duckdb_v2_error_info_handle *err);
+#endif
+
+#if DUCKDB_V2_API_ALLOW_UNSTABLE
+/*!
+ * Retrieves the user data set via `duckdb_v2_replacement_scan_set_user_data()`.
+ *
+ * history:
+ * - unstable: v2.0.0
+ *
+ * @param info The info handle.
+ * @param data Receives the user data pointer, or null if none was set.
+ * @param err Optional. On failure, receives an opaque info handle the caller must destroy via
+ * `duckdb_v2_error_info_destroy()`.
+ * @return DUCKDB_V2_ERROR
+ */
+DUCKDB_C_API DUCKDB_V2_ERROR duckdb_v2_replacement_scan_get_user_data(duckdb_v2_replacement_scan_info_handle info,
+                                                                      void **data, duckdb_v2_error_info_handle *err);
+#endif
+
+#if DUCKDB_V2_API_ALLOW_UNSTABLE
+/*!
+ * Retrieves the name the catalog could not resolve.
+ *
+ * The name as written in the query, as a path: an unqualified reference has a single part, and a qualified one carries
+ * its catalog and schema before it -- see `duckdb_v2_qname_get_part()`. For a file-backed reference the single part is
+ * the path with the quotes stripped. The returned name is owned by the caller and must be destroyed via
+ * `duckdb_v2_qname_destroy()`; being owned, it may outlive the callback.
+ *
+ * history:
+ * - unstable: v2.0.0
+ *
+ * @param info The info handle.
+ * @param name Receives the unresolved name. Owned by the caller; destroy via `duckdb_v2_qname_destroy()`.
+ * @param err Optional. On failure, receives an opaque info handle the caller must destroy via
+ * `duckdb_v2_error_info_destroy()`.
+ * @return DUCKDB_V2_ERROR
+ */
+DUCKDB_C_API DUCKDB_V2_ERROR duckdb_v2_replacement_scan_get_name(duckdb_v2_replacement_scan_info_handle info,
+                                                                 duckdb_v2_qname_handle *name,
+                                                                 duckdb_v2_error_info_handle *err);
+#endif
+
+#if DUCKDB_V2_API_ALLOW_UNSTABLE
+/*!
+ * Claims the reference by naming a table function to read instead.
+ *
+ * Arguments to the function are added with `duckdb_v2_replacement_scan_add_argument()` and
+ * `duckdb_v2_replacement_scan_add_named_argument()`. The name is borrowed and copied, and its parts are matched
+ * case-insensitively. A qualified name targets a function in a particular schema or catalog, exactly as writing it out
+ * in SQL would. The name is not resolved here: an unknown function fails later, when the replacement is bound. Calling
+ * this again replaces the previous name and keeps the arguments added so far.
+ *
+ * The three claim forms, `duckdb_v2_replacement_scan_set_function_name()`,
+ * `duckdb_v2_replacement_scan_set_collection()` and `duckdb_v2_replacement_scan_set_subquery()`, are mutually
+ * exclusive: claiming the reference through a second, different form results in an error.
+ *
+ * history:
+ * - unstable: v2.0.0
+ *
+ * @param info The info handle.
+ * @param name The table function to read instead. Borrowed and copied.
+ * @param err Optional. On failure, receives an opaque info handle the caller must destroy via
+ * `duckdb_v2_error_info_destroy()`.
+ * @return DUCKDB_V2_ERROR
+ */
+DUCKDB_C_API DUCKDB_V2_ERROR duckdb_v2_replacement_scan_set_function_name(duckdb_v2_replacement_scan_info_handle info,
+                                                                          duckdb_v2_qname_handle name,
+                                                                          duckdb_v2_error_info_handle *err);
+#endif
+
+#if DUCKDB_V2_API_ALLOW_UNSTABLE
+/*!
+ * Appends a positional argument to the claimed table function.
+ *
+ * Positional arguments are passed in the order they are added, before any named ones. The value is borrowed and copied,
+ * so the caller may destroy it after the call. Requires `duckdb_v2_replacement_scan_set_function_name()` to have been
+ * called first; otherwise the call results in an error.
+ *
+ * history:
+ * - unstable: v2.0.0
+ *
+ * @param info The info handle.
+ * @param value The argument value. Borrowed and copied.
+ * @param err Optional. On failure, receives an opaque info handle the caller must destroy via
+ * `duckdb_v2_error_info_destroy()`.
+ * @return DUCKDB_V2_ERROR
+ */
+DUCKDB_C_API DUCKDB_V2_ERROR duckdb_v2_replacement_scan_add_argument(duckdb_v2_replacement_scan_info_handle info,
+                                                                     duckdb_v2_value_handle value,
+                                                                     duckdb_v2_error_info_handle *err);
+#endif
+
+#if DUCKDB_V2_API_ALLOW_UNSTABLE
+/*!
+ * Appends a named argument to the claimed table function.
+ *
+ * Equivalent to writing `name := value` at the call site. The name and the value are borrowed and copied, so the caller
+ * may destroy the value after the call. Requires `duckdb_v2_replacement_scan_set_function_name()` to have been called
+ * first; otherwise the call results in an error.
+ *
+ * history:
+ * - unstable: v2.0.0
+ *
+ * @param info The info handle.
+ * @param name The name of the parameter to bind the value to. Borrowed and copied.
+ * @param value The argument value. Borrowed and copied.
+ * @param err Optional. On failure, receives an opaque info handle the caller must destroy via
+ * `duckdb_v2_error_info_destroy()`.
+ * @return DUCKDB_V2_ERROR
+ */
+DUCKDB_C_API DUCKDB_V2_ERROR duckdb_v2_replacement_scan_add_named_argument(duckdb_v2_replacement_scan_info_handle info,
+                                                                           const duckdb_v2_identifier_t *name,
+                                                                           duckdb_v2_value_handle value,
+                                                                           duckdb_v2_error_info_handle *err);
+#endif
+
+#if DUCKDB_V2_API_ALLOW_UNSTABLE
+/*!
+ * Claims the reference by naming a column data collection to read instead.
+ *
+ * The collection is borrowed, not copied: the caller keeps ownership and must keep it alive, and must not clear, reset
+ * or destroy it, for as long as any result reading it is live, since the result scans its buffers directly.
+ *
+ * A prepared statement extends that lifetime well beyond its own results. Preparing a statement over a claimed name
+ * captures the borrow in the plan, and since a collection claim reads no database there is nothing to invalidate that
+ * plan: `duckdb_v2_prepared_statement_reuses_plan()` reports true, and every later execution reuses the captured borrow
+ * without consulting the callback again. So dropping the name from whatever the callback resolves against does not
+ * release the collection, and releasing it while such a statement is live leaves the next execution reading freed
+ * memory. Destroy every prepared statement over a claimed name before clearing, resetting or destroying the collection
+ * behind it.
+ *
+ * By default the collection's columns are named col1..colN. Pass `column_names` to name them instead. When supplied,
+ * `column_count` must equal the collection's column count and no name may be empty; pass NULL and 0 for the default
+ * names.
+ *
+ * The three claim forms, `duckdb_v2_replacement_scan_set_function_name()`,
+ * `duckdb_v2_replacement_scan_set_collection()` and `duckdb_v2_replacement_scan_set_subquery()`, are mutually
+ * exclusive: claiming the reference through a second, different form results in an error.
+ *
+ * history:
+ * - unstable: v2.0.0
+ *
+ * @param info The info handle.
+ * @param collection The collection to read instead. Borrowed; the caller keeps ownership and must keep it alive.
+ * @param column_names Optional. An array of `column_count` column names, in order. Pass NULL for the default names
+ * col1..colN.
+ * @param column_count The number of names in `column_names`. Must equal the collection's column count, or 0 for the
+ * default names.
+ * @param err Optional. On failure, receives an opaque info handle the caller must destroy via
+ * `duckdb_v2_error_info_destroy()`.
+ * @return DUCKDB_V2_ERROR
+ */
+DUCKDB_C_API DUCKDB_V2_ERROR duckdb_v2_replacement_scan_set_collection(
+    duckdb_v2_replacement_scan_info_handle info, duckdb_v2_column_data_collection_handle collection,
+    const duckdb_v2_identifier_t *column_names, idx_t column_count, duckdb_v2_error_info_handle *err);
+#endif
+
+#if DUCKDB_V2_API_ALLOW_UNSTABLE
+/*!
+ * Claims the reference by naming a query to read instead.
+ *
+ * The text is parsed at the call and must contain exactly one SELECT statement: a syntax error, several statements or a
+ * statement of another kind results in an error. The text is borrowed for the call only. Prefer
+ * `duckdb_v2_replacement_scan_set_function_name()` when a single table function call suffices, as it avoids the parse
+ * and keeps the plan flatter.
+ *
+ * The three claim forms, `duckdb_v2_replacement_scan_set_function_name()`,
+ * `duckdb_v2_replacement_scan_set_collection()` and `duckdb_v2_replacement_scan_set_subquery()`, are mutually
+ * exclusive: claiming the reference through a second, different form results in an error.
+ *
+ * history:
+ * - unstable: v2.0.0
+ *
+ * @param info The info handle.
+ * @param sql The SELECT statement to read instead. Borrowed for the call only.
+ * @param err Optional. On failure, receives an opaque info handle the caller must destroy via
+ * `duckdb_v2_error_info_destroy()`.
+ * @return DUCKDB_V2_ERROR
+ */
+DUCKDB_C_API DUCKDB_V2_ERROR duckdb_v2_replacement_scan_set_subquery(duckdb_v2_replacement_scan_info_handle info,
+                                                                     const duckdb_v2_str *sql,
+                                                                     duckdb_v2_error_info_handle *err);
+#endif
+
+#if DUCKDB_V2_API_ALLOW_UNSTABLE
+/*!
+ * Sets the alias the claimed replacement is bound under.
+ *
+ * Optional, and independent of the claim form. An alias written in the query takes precedence over this one; without
+ * either, the table name of the reference is used, which for a file-backed reference is the path. The alias is borrowed
+ * and copied.
+ *
+ * history:
+ * - unstable: v2.0.0
+ *
+ * @param info The info handle.
+ * @param alias The alias to bind the replacement under. Borrowed and copied.
+ * @param err Optional. On failure, receives an opaque info handle the caller must destroy via
+ * `duckdb_v2_error_info_destroy()`.
+ * @return DUCKDB_V2_ERROR
+ */
+DUCKDB_C_API DUCKDB_V2_ERROR duckdb_v2_replacement_scan_set_alias(duckdb_v2_replacement_scan_info_handle info,
+                                                                  const duckdb_v2_identifier_t *alias,
+                                                                  duckdb_v2_error_info_handle *err);
+#endif
+
+#if DUCKDB_V2_API_ALLOW_UNSTABLE
+/*!
+ * Registers the replacement scan, making it consulted for names the catalog cannot resolve.
+ *
+ * The scan is visible only to queries on this connection and is released when the connection is destroyed. It is
+ * consulted before every instance-wide scan, so it can claim a name that a built-in scan would otherwise take.
+ * Registration requires a callback. Scans are consulted in registration order within their scope, connection-scoped
+ * ones before instance-wide ones, and the first to claim a name wins. A scan cannot be registered twice, and a
+ * registered scan cannot be unregistered: it lives until its scope ends. The scan must have been created through a
+ * factory of the same database. The caller still owns the handle after registration and must destroy it with
+ * `duckdb_v2_replacement_scan_destroy()`, which does not affect the registered scan.
+ *
+ * history:
+ * - unstable: v2.0.0
+ *
+ * @param conn The connection to register on.
+ * @param scan The replacement scan to register.
+ * @param err Optional. On failure, receives an opaque info handle the caller must destroy via
+ * `duckdb_v2_error_info_destroy()`.
+ * @return DUCKDB_V2_ERROR
+ */
+DUCKDB_C_API DUCKDB_V2_ERROR duckdb_v2_connection_register_replacement_scan(duckdb_v2_connection_handle conn,
+                                                                            duckdb_v2_replacement_scan_handle scan,
+                                                                            duckdb_v2_error_info_handle *err);
+#endif
+
+#if DUCKDB_V2_API_ALLOW_UNSTABLE
+/*!
+ * Registers the replacement scan, making it consulted for names the catalog cannot resolve.
+ *
+ * The scan is visible to every connection to the instance and lives until the instance is destroyed. Registering it
+ * while queries are binding on other connections is not thread-safe: register before issuing queries. Registration
+ * requires a callback. Scans are consulted in registration order within their scope, connection-scoped ones before
+ * instance-wide ones, and the first to claim a name wins. A scan cannot be registered twice, and a registered scan
+ * cannot be unregistered: it lives until its scope ends. The scan must have been created through a factory of the same
+ * database. The caller still owns the handle after registration and must destroy it with
+ * `duckdb_v2_replacement_scan_destroy()`, which does not affect the registered scan.
+ *
+ * history:
+ * - unstable: v2.0.0
+ *
+ * @param instance The instance to register on.
+ * @param scan The replacement scan to register.
+ * @param err Optional. On failure, receives an opaque info handle the caller must destroy via
+ * `duckdb_v2_error_info_destroy()`.
+ * @return DUCKDB_V2_ERROR
+ */
+DUCKDB_C_API DUCKDB_V2_ERROR duckdb_v2_instance_register_replacement_scan(duckdb_v2_instance_handle instance,
+                                                                          duckdb_v2_replacement_scan_handle scan,
+                                                                          duckdb_v2_error_info_handle *err);
+#endif
+
+#if DUCKDB_V2_API_ALLOW_UNSTABLE
+/*!
+ * Registers the replacement scan, making it consulted for names the catalog cannot resolve.
+ *
+ * The scan is visible to every connection to the loading extension's instance and lives until the instance is
+ * destroyed. Use this from the extension's load callback. Registration requires a callback. Scans are consulted in
+ * registration order within their scope, connection-scoped ones before instance-wide ones, and the first to claim a
+ * name wins. A scan cannot be registered twice, and a registered scan cannot be unregistered: it lives until its scope
+ * ends. The scan must have been created through a factory of the same database. The caller still owns the handle after
+ * registration and must destroy it with `duckdb_v2_replacement_scan_destroy()`, which does not affect the registered
+ * scan.
+ *
+ * history:
+ * - unstable: v2.0.0
+ *
+ * @param extension The loading extension.
+ * @param scan The replacement scan to register.
+ * @param err Optional. On failure, receives an opaque info handle the caller must destroy via
+ * `duckdb_v2_error_info_destroy()`.
+ * @return DUCKDB_V2_ERROR
+ */
+DUCKDB_C_API DUCKDB_V2_ERROR duckdb_v2_extension_register_replacement_scan(duckdb_v2_extension_handle extension,
+                                                                           duckdb_v2_replacement_scan_handle scan,
+                                                                           duckdb_v2_error_info_handle *err);
+#endif
+
+#if DUCKDB_V2_API_ALLOW_UNSTABLE
+/*!
+ * Destroys the replacement scan, releasing its resources.
+ *
+ * Null-safe: passing a null pointer or null handle is a no-op. The handle is set to null on return to prevent
+ * double-destruction. Destroying the handle after registration does not affect the registered scan.
+ *
+ * history:
+ * - unstable: v2.0.0
+ *
+ * @param scan The scan to destroy.
+ * @return DUCKDB_V2_ERROR
+ */
+DUCKDB_C_API DUCKDB_V2_ERROR duckdb_v2_replacement_scan_destroy(duckdb_v2_replacement_scan_handle *scan);
+#endif
+
+/* --- Struct definitions for replacement scan --- */
+
+/* ============================================================================
+ * MODULE: scalar
+ * ============================================================================ */
+
+/* --- Enums for scalar --- */
+
+/* --- Struct forward declarations for scalar --- */
+
+/* --- Types for scalar --- */
+
+/*!
+ * An owned opaque handle to a custom scalar function being built. Created with `duckdb_v2_scalar_function_create()`,
+ * configured with the setter functions (e.g. `duckdb_v2_scalar_function_set_name()`,
+ * `duckdb_v2_scalar_function_set_exec_callback()`, etc.) and the signature obtained via
+ * `duckdb_v2_scalar_function_get_signature()`, made available with `duckdb_v2_connection_register_scalar_function()` or
+ * `duckdb_v2_extension_register_scalar_function()`, and destroyed with `duckdb_v2_scalar_function_destroy()`.
+ */
+typedef struct _duckdb_v2_scalar_function {
+	void *internal_ptr;
+} * duckdb_v2_scalar_function_handle;
+
+/*!
+ * A borrowed opaque handle to the result of a scalar function's "resolve types" phase. The "resolve types" callback
+ * receives this handle next to a `duckdb_v2_function_bind_info_handle`, which gives access to the arguments and the
+ * user data, and can use it to set the return type of the call site being bound.
+ */
+typedef struct _duckdb_v2_scalar_function_resolve_types_info {
+	void *internal_ptr;
+} * duckdb_v2_scalar_function_resolve_types_info_handle;
+
+/*!
+ * A borrowed opaque handle to the result of a scalar function's "bind" phase. The "bind" callback receives this handle
+ * next to a `duckdb_v2_function_bind_info_handle`, which gives access to the arguments and the user data, and can use
+ * it to set the bind data of the call site being bound.
+ */
+typedef struct _duckdb_v2_scalar_function_bind_info {
+	void *internal_ptr;
+} * duckdb_v2_scalar_function_bind_info_handle;
+
+/*!
+ * A borrowed opaque handle to the arguments supplied to a scalar function during the local state initialization "init"
+ * phase. The "init" callback receives this handle and can use it to e.g. set up local state reusable across invocations
+ * of the "exec" execution callback.
+ */
+typedef struct _duckdb_v2_scalar_function_init_info {
+	void *internal_ptr;
+} * duckdb_v2_scalar_function_init_info_handle;
+
+/*!
+ * A borrowed opaque handle to the arguments supplied to a scalar function during the execution "exec" phase. The "exec"
+ * callback receives this handle and can use it to e.g. access the input argument vectors, retrieve the number of rows
+ * to process, and write results to the output vector.
+ */
+typedef struct _duckdb_v2_scalar_function_exec_info {
+	void *internal_ptr;
+} * duckdb_v2_scalar_function_exec_info_handle;
+
+/* --- Constants for scalar --- */
+
+/* --- Function pointer typedefs for scalar --- */
+
+typedef void (*duckdb_v2_scalar_function_resolve_types_callback_fn)(
+    duckdb_v2_function_bind_info_handle info, duckdb_v2_scalar_function_resolve_types_info_handle result,
+    duckdb_v2_context_handle context, duckdb_v2_error_info_handle *err);
+
+typedef void (*duckdb_v2_scalar_function_bind_callback_fn)(duckdb_v2_function_bind_info_handle info,
+                                                           duckdb_v2_scalar_function_bind_info_handle result,
+                                                           duckdb_v2_context_handle context,
+                                                           duckdb_v2_error_info_handle *err);
+
+typedef void (*duckdb_v2_scalar_function_init_callback_fn)(duckdb_v2_scalar_function_init_info_handle info,
+                                                           duckdb_v2_context_handle context,
+                                                           duckdb_v2_error_info_handle *err);
+
+typedef void (*duckdb_v2_scalar_function_exec_callback_fn)(duckdb_v2_scalar_function_exec_info_handle info,
+                                                           duckdb_v2_context_handle context,
+                                                           duckdb_v2_error_info_handle *err);
+
+/* --- Functions for scalar --- */
+
+#if DUCKDB_V2_API_ALLOW_UNSTABLE
+/*!
+ * Creates a new scalar function through a factory.
+ *
+ * The function starts out empty: configure it with the setter functions (e.g. `duckdb_v2_scalar_function_set_name()`,
+ * `duckdb_v2_scalar_function_set_exec_callback()`, etc.) and the signature obtained via
+ * `duckdb_v2_scalar_function_get_signature()`, then make it available with
+ * `duckdb_v2_connection_register_scalar_function()` or `duckdb_v2_extension_register_scalar_function()`. The caller
+ * owns the returned handle and must destroy it with `duckdb_v2_scalar_function_destroy()`, also after registration.
+ *
+ * The scalar function can only be registered on the database the factory belongs to.
+ *
+ * history:
+ * - unstable: v2.0.0
+ *
+ * @param factory The factory to create the scalar function through.
+ * @param function On success, receives the newly created scalar function. Owned by the caller.
+ * @param err Optional. On failure, receives an opaque info handle the caller must destroy via
+ * `duckdb_v2_error_info_destroy()`.
+ * @return DUCKDB_V2_ERROR
+ */
+DUCKDB_C_API DUCKDB_V2_ERROR duckdb_v2_scalar_function_create(duckdb_v2_factory_handle factory,
+                                                              duckdb_v2_scalar_function_handle *function,
+                                                              duckdb_v2_error_info_handle *err);
+#endif
+
+#if DUCKDB_V2_API_ALLOW_UNSTABLE
+/*!
+ * Sets the name of the scalar function.
+ *
+ * The name is borrowed and copied. Calling this again replaces the previous name. A name must be set before
+ * registration.
+ *
+ * history:
+ * - unstable: v2.0.0
+ *
+ * @param function The function to set the name of.
+ * @param name The name to set. Borrowed and copied.
+ * @param err Optional. On failure, receives an opaque info handle the caller must destroy via
+ * `duckdb_v2_error_info_destroy()`.
+ * @return DUCKDB_V2_ERROR
+ */
+DUCKDB_C_API DUCKDB_V2_ERROR duckdb_v2_scalar_function_set_name(duckdb_v2_scalar_function_handle function,
+                                                                const duckdb_v2_identifier_t *name,
+                                                                duckdb_v2_error_info_handle *err);
+#endif
+
+#if DUCKDB_V2_API_ALLOW_UNSTABLE
+/*!
+ * Returns the documentation of the function so it can be filled in.
+ *
+ * Set a description with `duckdb_v2_function_docs_set_description()`, and add examples and categories with
+ * `duckdb_v2_function_docs_add_example()` and `duckdb_v2_function_docs_add_category()`. The documentation is modified
+ * in place, describes this overload only, and is registered with the function. Optional.
+ *
+ * history:
+ * - unstable: v2.0.0
+ *
+ * @param function The function to get the documentation of.
+ * @param docs The returned documentation. Borrowed and valid for the lifetime of the function handle.
+ * @param err Optional. On failure, receives an opaque info handle the caller must destroy via
+ * `duckdb_v2_error_info_destroy()`.
+ * @return DUCKDB_V2_ERROR
+ */
+DUCKDB_C_API DUCKDB_V2_ERROR duckdb_v2_scalar_function_get_docs(duckdb_v2_scalar_function_handle function,
+                                                                duckdb_v2_function_docs_handle *docs,
+                                                                duckdb_v2_error_info_handle *err);
+#endif
+
+#if DUCKDB_V2_API_ALLOW_UNSTABLE
+/*!
+ * Returns the function's signature so it can be configured.
+ *
+ * Add parameters with `duckdb_v2_function_signature_add_parameter()` and set the return type with
+ * `duckdb_v2_function_signature_set_return_type()`. The signature is modified in place; the function must be given a
+ * signature with a return type before registration.
+ *
+ * history:
+ * - unstable: v2.0.0
+ *
+ * @param function The function to get the signature of.
+ * @param sig The returned signature. Borrowed and valid for the lifetime of the function handle.
+ * @param err Optional. On failure, receives an opaque info handle the caller must destroy via
+ * `duckdb_v2_error_info_destroy()`.
+ * @return DUCKDB_V2_ERROR
+ */
+DUCKDB_C_API DUCKDB_V2_ERROR duckdb_v2_scalar_function_get_signature(duckdb_v2_scalar_function_handle function,
+                                                                     duckdb_v2_function_signature_handle *sig,
+                                                                     duckdb_v2_error_info_handle *err);
+#endif
+
+#if DUCKDB_V2_API_ALLOW_UNSTABLE
+/*!
+ * Sets arbitrary user data on the scalar function.
+ *
+ * Associates an opaque pointer with the function, retrievable from the callbacks via
+ * `duckdb_v2_function_bind_get_user_data()`, `duckdb_v2_scalar_function_init_get_user_data()` and
+ * `duckdb_v2_scalar_function_exec_get_user_data()`. The opaque handle bundles the pointer with an optional destructor,
+ * invoked when the data is no longer needed.
+ *
+ * history:
+ * - unstable: v2.0.0
+ *
+ * @param function The function to set the user data of.
+ * @param data Opaque handle bundling the user data pointer plus an optional destructor.
+ * @param err Optional. On failure, receives an opaque info handle the caller must destroy via
+ * `duckdb_v2_error_info_destroy()`.
+ * @return DUCKDB_V2_ERROR
+ */
+DUCKDB_C_API DUCKDB_V2_ERROR duckdb_v2_scalar_function_set_user_data(duckdb_v2_scalar_function_handle function,
+                                                                     duckdb_v2_opaque *data,
+                                                                     duckdb_v2_error_info_handle *err);
+#endif
+
+#if DUCKDB_V2_API_ALLOW_UNSTABLE
+/*!
+ * Sets a property on the scalar function.
+ *
+ * Configures a function property that influences planning and execution, such as stability, NULL handling, fallibility
+ * or collation handling. The value must be one of the `DUCKDB_V2_FUNCTION_PROPERTY_VALUE` entries belonging to `key`;
+ * passing a value that does not belong to the key, or a key that is not valid for scalar functions, results in an
+ * error.
+ *
+ * history:
+ * - unstable: v2.0.0
+ *
+ * @param function The function to set the property of.
+ * @param key The property to set.
+ * @param value The value to set for the property. Must belong to `key`.
+ * @param err Optional. On failure, receives an opaque info handle the caller must destroy via
+ * `duckdb_v2_error_info_destroy()`.
+ * @return DUCKDB_V2_ERROR
+ */
+DUCKDB_C_API DUCKDB_V2_ERROR duckdb_v2_scalar_function_set_property(duckdb_v2_scalar_function_handle function,
+                                                                    DUCKDB_V2_FUNCTION_PROPERTY_KEY key,
+                                                                    DUCKDB_V2_FUNCTION_PROPERTY_VALUE value,
+                                                                    duckdb_v2_error_info_handle *err);
+#endif
+
+#if DUCKDB_V2_API_ALLOW_UNSTABLE
+/*!
+ * Sets the optional resolve types callback of the scalar function.
+ *
+ * The resolve types callback is invoked during query planning for each call site of the function, before the arguments
+ * are cast to the parameter types of the signature. Through its `duckdb_v2_function_bind_info_handle` it can inspect
+ * the argument types as they were passed and constant argument values. Through its
+ * `duckdb_v2_scalar_function_resolve_types_info_handle` it can set a concrete return type. It cannot set "bind data",
+ * use the bind callback for that.
+ *
+ * history:
+ * - unstable: v2.0.0
+ *
+ * @param function The function to set the resolve types callback of.
+ * @param callback The resolve types callback to set.
+ * @param err Optional. On failure, receives an opaque info handle the caller must destroy via
+ * `duckdb_v2_error_info_destroy()`.
+ * @return DUCKDB_V2_ERROR
+ */
+DUCKDB_C_API DUCKDB_V2_ERROR duckdb_v2_scalar_function_set_resolve_types_callback(
+    duckdb_v2_scalar_function_handle function, duckdb_v2_scalar_function_resolve_types_callback_fn callback,
+    duckdb_v2_error_info_handle *err);
+#endif
+
+#if DUCKDB_V2_API_ALLOW_UNSTABLE
+/*!
+ * Sets the optional bind callback of the scalar function.
+ *
+ * The bind callback is invoked during query planning for each call site of the function, after the resolve types
+ * callback and after the arguments have been cast to the parameter types of the signature. Through its
+ * `duckdb_v2_function_bind_info_handle` it can inspect the argument types and constant argument values. Through its
+ * `duckdb_v2_scalar_function_bind_info_handle` it can set "bind data" that is shared with the init and exec callbacks.
+ * It cannot change the types of the call site, use the resolve types callback for that.
+ *
+ * history:
+ * - unstable: v2.0.0
+ *
+ * @param function The function to set the bind callback of.
+ * @param callback The bind callback to set.
+ * @param err Optional. On failure, receives an opaque info handle the caller must destroy via
+ * `duckdb_v2_error_info_destroy()`.
+ * @return DUCKDB_V2_ERROR
+ */
+DUCKDB_C_API DUCKDB_V2_ERROR duckdb_v2_scalar_function_set_bind_callback(
+    duckdb_v2_scalar_function_handle function, duckdb_v2_scalar_function_bind_callback_fn callback,
+    duckdb_v2_error_info_handle *err);
+#endif
+
+#if DUCKDB_V2_API_ALLOW_UNSTABLE
+/*!
+ * Sets the optional init callback of the scalar function.
+ *
+ * The init callback is invoked at the start of execution for each thread that will execute the function. It can set
+ * worker-local "init data", retrievable from the exec callback, to keep mutable state across invocations of the
+ * function.
+ *
+ * history:
+ * - unstable: v2.0.0
+ *
+ * @param function The function to set the init callback of.
+ * @param callback The init callback to set.
+ * @param err Optional. On failure, receives an opaque info handle the caller must destroy via
+ * `duckdb_v2_error_info_destroy()`.
+ * @return DUCKDB_V2_ERROR
+ */
+DUCKDB_C_API DUCKDB_V2_ERROR duckdb_v2_scalar_function_set_init_callback(
+    duckdb_v2_scalar_function_handle function, duckdb_v2_scalar_function_init_callback_fn callback,
+    duckdb_v2_error_info_handle *err);
+#endif
+
+#if DUCKDB_V2_API_ALLOW_UNSTABLE
+/*!
+ * Sets the exec callback of the scalar function.
+ *
+ * The exec callback implements the function's logic: it is invoked during query execution with a batch of input rows
+ * and must fill the result vector. An exec callback must be set before registration.
+ *
+ * history:
+ * - unstable: v2.0.0
+ *
+ * @param function The function to set the exec callback of.
+ * @param callback The exec callback to set.
+ * @param err Optional. On failure, receives an opaque info handle the caller must destroy via
+ * `duckdb_v2_error_info_destroy()`.
+ * @return DUCKDB_V2_ERROR
+ */
+DUCKDB_C_API DUCKDB_V2_ERROR duckdb_v2_scalar_function_set_exec_callback(
+    duckdb_v2_scalar_function_handle function, duckdb_v2_scalar_function_exec_callback_fn callback,
+    duckdb_v2_error_info_handle *err);
+#endif
+
+#if DUCKDB_V2_API_ALLOW_UNSTABLE
+/*!
+ * Sets the concrete return type of the call site being bound.
+ *
+ * Overrides the return type declared in the signature. Register the function with an ANY return type and set the
+ * concrete type here, derived from the argument types, to build a function whose result type depends on its input. The
+ * type is borrowed and copied.
+ *
+ * history:
+ * - unstable: v2.0.0
+ *
+ * @param info The resolve types info handle.
+ * @param return_type The return type to set. Borrowed for the call only.
+ * @param err Optional. On failure, receives an opaque info handle the caller must destroy via
+ * `duckdb_v2_error_info_destroy()`.
+ * @return DUCKDB_V2_ERROR
+ */
+DUCKDB_C_API DUCKDB_V2_ERROR duckdb_v2_scalar_function_resolve_types_set_return_type(
+    duckdb_v2_scalar_function_resolve_types_info_handle info, duckdb_v2_logical_type_handle return_type,
+    duckdb_v2_error_info_handle *err);
+#endif
+
+#if DUCKDB_V2_API_ALLOW_UNSTABLE
+/*!
+ * Sets the function's "bind data" from the bind callback.
+ *
+ * The bind data is stored with the bound call site and retrievable from the init and exec callbacks. The opaque handle
+ * bundles the pointer with an optional destructor, invoked when the bind data is no longer needed, and an optional
+ * equality callback used when comparing two bound call sites; without one, pointer equality is used. Scalar functions
+ * set their bind data through this function, `duckdb_v2_function_bind_set_bind_data()` is not available to them.
+ *
+ * history:
+ * - unstable: v2.0.0
+ *
+ * @param info The bind info handle.
+ * @param data Opaque handle bundling the bind data pointer plus optional destructor and equality callbacks.
+ * @param err Optional. On failure, receives an opaque info handle the caller must destroy via
+ * `duckdb_v2_error_info_destroy()`.
+ * @return DUCKDB_V2_ERROR
+ */
+DUCKDB_C_API DUCKDB_V2_ERROR duckdb_v2_scalar_function_bind_set_bind_data(
+    duckdb_v2_scalar_function_bind_info_handle info, duckdb_v2_opaque *data, duckdb_v2_error_info_handle *err);
+#endif
+
+#if DUCKDB_V2_API_ALLOW_UNSTABLE
+/*!
+ * Retrieves the user data set via `duckdb_v2_scalar_function_set_user_data()`.
+ *
+ * history:
+ * - unstable: v2.0.0
+ *
+ * @param info The init info handle.
+ * @param data Receives the user data pointer, or null if none was set.
+ * @param err Optional. On failure, receives an opaque info handle the caller must destroy via
+ * `duckdb_v2_error_info_destroy()`.
+ * @return DUCKDB_V2_ERROR
+ */
+DUCKDB_C_API DUCKDB_V2_ERROR duckdb_v2_scalar_function_init_get_user_data(
+    duckdb_v2_scalar_function_init_info_handle info, void **data, duckdb_v2_error_info_handle *err);
+#endif
+
+#if DUCKDB_V2_API_ALLOW_UNSTABLE
+/*!
+ * Retrieves the bind data set by the function's bind callback.
+ *
+ * history:
+ * - unstable: v2.0.0
+ *
+ * @param info The init info handle.
+ * @param data Receives the bind data pointer, or null if none was set.
+ * @param err Optional. On failure, receives an opaque info handle the caller must destroy via
+ * `duckdb_v2_error_info_destroy()`.
+ * @return DUCKDB_V2_ERROR
+ */
+DUCKDB_C_API DUCKDB_V2_ERROR duckdb_v2_scalar_function_init_get_bind_data(
+    duckdb_v2_scalar_function_init_info_handle info, void **data, duckdb_v2_error_info_handle *err);
+#endif
+
+#if DUCKDB_V2_API_ALLOW_UNSTABLE
+/*!
+ * Sets the function's worker-local "init data" from the init callback.
+ *
+ * The init data is associated with the executing thread for the duration of the query and retrievable from the exec
+ * callback via `duckdb_v2_scalar_function_exec_get_init_data()`. The opaque handle bundles the pointer with an optional
+ * destructor, invoked when the init data is no longer needed.
+ *
+ * history:
+ * - unstable: v2.0.0
+ *
+ * @param info The init info handle.
+ * @param data Opaque handle bundling the init data pointer plus an optional destructor.
+ * @param err Optional. On failure, receives an opaque info handle the caller must destroy via
+ * `duckdb_v2_error_info_destroy()`.
+ * @return DUCKDB_V2_ERROR
+ */
+DUCKDB_C_API DUCKDB_V2_ERROR duckdb_v2_scalar_function_init_set_init_data(
+    duckdb_v2_scalar_function_init_info_handle info, duckdb_v2_opaque *data, duckdb_v2_error_info_handle *err);
+#endif
+
+#if DUCKDB_V2_API_ALLOW_UNSTABLE
+/*!
+ * Retrieves the user data set via `duckdb_v2_scalar_function_set_user_data()`.
+ *
+ * history:
+ * - unstable: v2.0.0
+ *
+ * @param info The exec info handle.
+ * @param data Receives the user data pointer, or null if none was set.
+ * @param err Optional. On failure, receives an opaque info handle the caller must destroy via
+ * `duckdb_v2_error_info_destroy()`.
+ * @return DUCKDB_V2_ERROR
+ */
+DUCKDB_C_API DUCKDB_V2_ERROR duckdb_v2_scalar_function_exec_get_user_data(
+    duckdb_v2_scalar_function_exec_info_handle info, void **data, duckdb_v2_error_info_handle *err);
+#endif
+
+#if DUCKDB_V2_API_ALLOW_UNSTABLE
+/*!
+ * Retrieves the bind data set by the function's bind callback.
+ *
+ * history:
+ * - unstable: v2.0.0
+ *
+ * @param info The exec info handle.
+ * @param data Receives the bind data pointer, or null if none was set.
+ * @param err Optional. On failure, receives an opaque info handle the caller must destroy via
+ * `duckdb_v2_error_info_destroy()`.
+ * @return DUCKDB_V2_ERROR
+ */
+DUCKDB_C_API DUCKDB_V2_ERROR duckdb_v2_scalar_function_exec_get_bind_data(
+    duckdb_v2_scalar_function_exec_info_handle info, void **data, duckdb_v2_error_info_handle *err);
+#endif
+
+#if DUCKDB_V2_API_ALLOW_UNSTABLE
+/*!
+ * Retrieves the worker-local init data set by the function's init callback.
+ *
+ * history:
+ * - unstable: v2.0.0
+ *
+ * @param info The exec info handle.
+ * @param data Receives the init data pointer for the executing thread, or null if none was set.
+ * @param err Optional. On failure, receives an opaque info handle the caller must destroy via
+ * `duckdb_v2_error_info_destroy()`.
+ * @return DUCKDB_V2_ERROR
+ */
+DUCKDB_C_API DUCKDB_V2_ERROR duckdb_v2_scalar_function_exec_get_init_data(
+    duckdb_v2_scalar_function_exec_info_handle info, void **data, duckdb_v2_error_info_handle *err);
+#endif
+
+#if DUCKDB_V2_API_ALLOW_UNSTABLE
+/*!
+ * Returns how many rows this execution must produce. The exec callback must write exactly this many rows to the result
+ * vector. Note that this may be less than a full vector: with all-constant arguments the function is invoked for a
+ * single row and the result is expanded by the engine.
+ *
+ * history:
+ * - unstable: v2.0.0
+ *
+ * @param info The exec info handle.
+ * @param count Receives the number of rows.
+ * @param err Optional. On failure, receives an opaque info handle the caller must destroy via
+ * `duckdb_v2_error_info_destroy()`.
+ * @return DUCKDB_V2_ERROR
+ */
+DUCKDB_C_API DUCKDB_V2_ERROR duckdb_v2_scalar_function_exec_get_row_count(
+    duckdb_v2_scalar_function_exec_info_handle info, idx_t *count, duckdb_v2_error_info_handle *err);
+#endif
+
+#if DUCKDB_V2_API_ALLOW_UNSTABLE
+/*!
+ * Returns how many argument vectors this invocation carries, split into the four parts of the argument list.
+ *
+ * The parts and their order are those the bind callback saw through `duckdb_v2_function_bind_get_arg_count()`, and the
+ * vectors are at the same indices. Valid indices for `duckdb_v2_scalar_function_exec_get_arg()` are [0, the sum of the
+ * four counts). Every out-parameter may be NULL, in which case nothing is written to it.
+ *
+ * history:
+ * - unstable: v2.0.0
+ *
+ * @param info The exec info handle.
+ * @param positional_fixed Optional. Receives the number of positional-only and standard parameters.
+ * @param positional_variadic Optional. Receives the number of arguments `*args` received, 0 when the signature has
+ * none.
+ * @param named_fixed Optional. Receives the number of named-only parameters.
+ * @param named_variadic Optional. Receives the number of arguments `**kwargs` received, 0 when the signature has none.
+ * @param err Optional. On failure, receives an opaque info handle the caller must destroy via
+ * `duckdb_v2_error_info_destroy()`.
+ * @return DUCKDB_V2_ERROR
+ */
+DUCKDB_C_API DUCKDB_V2_ERROR duckdb_v2_scalar_function_exec_get_arg_count(
+    duckdb_v2_scalar_function_exec_info_handle info, idx_t *positional_fixed, idx_t *positional_variadic,
+    idx_t *named_fixed, idx_t *named_variadic, duckdb_v2_error_info_handle *err);
+#endif
+
+#if DUCKDB_V2_API_ALLOW_UNSTABLE
+/*!
+ * Retrieves the argument vector at the given index.
+ *
+ * The index is the one the bind callback used for the argument, e.g. the index
+ * `duckdb_v2_function_bind_get_arg_index()` found for a name. The vector holds the argument's values for the current
+ * batch; use `duckdb_v2_scalar_function_exec_get_row_count()` for the number of rows. Fails if the index is out of
+ * bounds. Borrowed; valid only for the duration of the callback.
+ *
+ * history:
+ * - unstable: v2.0.0
+ *
+ * @param info The exec info handle.
+ * @param index The index of the argument.
+ * @param vector Receives the borrowed argument vector.
+ * @param err Optional. On failure, receives an opaque info handle the caller must destroy via
+ * `duckdb_v2_error_info_destroy()`.
+ * @return DUCKDB_V2_ERROR
+ */
+DUCKDB_C_API DUCKDB_V2_ERROR duckdb_v2_scalar_function_exec_get_arg(duckdb_v2_scalar_function_exec_info_handle info,
+                                                                    idx_t index, duckdb_v2_vector_handle *vector,
+                                                                    duckdb_v2_error_info_handle *err);
+#endif
+
+#if DUCKDB_V2_API_ALLOW_UNSTABLE
+/*!
+ * Retrieves the result vector the exec callback must write into.
+ *
+ * The callback must write one entry per input row; use `duckdb_v2_scalar_function_exec_get_row_count()` for the number
+ * of rows. Borrowed; valid only for the duration of the callback.
+ *
+ * history:
+ * - unstable: v2.0.0
+ *
+ * @param info The exec info handle.
+ * @param vector Receives the borrowed result vector to write into.
+ * @param err Optional. On failure, receives an opaque info handle the caller must destroy via
+ * `duckdb_v2_error_info_destroy()`.
+ * @return DUCKDB_V2_ERROR
+ */
+DUCKDB_C_API DUCKDB_V2_ERROR duckdb_v2_scalar_function_exec_get_result(duckdb_v2_scalar_function_exec_info_handle info,
+                                                                       duckdb_v2_vector_handle *vector,
+                                                                       duckdb_v2_error_info_handle *err);
+#endif
+
+#if DUCKDB_V2_API_ALLOW_UNSTABLE
+/*!
+ * Registers the scalar function, making it available for use in SQL queries.
+ *
+ * The function is registered on the connection's database, visible to every connection, in the connection's
+ * transaction: inside an explicit transaction, it is invisible to other connections until the transaction commits, and
+ * a rollback undoes it. Registration requires a name, an exec callback, and a signature with a complete return type; an
+ * ANY return type is accepted only together with a resolve types callback that sets the concrete type per call site.
+ * The scalar function must have been created through a factory of the same database. The caller still owns the handle
+ * after registration and must destroy it with `duckdb_v2_scalar_function_destroy()`, which does not affect the
+ * registered function.
+ *
+ * history:
+ * - unstable: v2.0.0
+ *
+ * @param conn The connection to register on.
+ * @param function The scalar function to register.
+ * @param err Optional. On failure, receives an opaque info handle the caller must destroy via
+ * `duckdb_v2_error_info_destroy()`.
+ * @return DUCKDB_V2_ERROR
+ */
+DUCKDB_C_API DUCKDB_V2_ERROR duckdb_v2_connection_register_scalar_function(duckdb_v2_connection_handle conn,
+                                                                           duckdb_v2_scalar_function_handle function,
+                                                                           duckdb_v2_error_info_handle *err);
+#endif
+
+#if DUCKDB_V2_API_ALLOW_UNSTABLE
+/*!
+ * Registers the scalar function, making it available for use in SQL queries.
+ *
+ * The function is registered on the loading extension's database and attributed to the extension. Use this from the
+ * extension's load callback. Registration requires a name, an exec callback, and a signature with a complete return
+ * type; an ANY return type is accepted only together with a resolve types callback that sets the concrete type per call
+ * site. The scalar function must have been created through a factory of the same database. The caller still owns the
+ * handle after registration and must destroy it with `duckdb_v2_scalar_function_destroy()`, which does not affect the
+ * registered function.
+ *
+ * history:
+ * - unstable: v2.0.0
+ *
+ * @param extension The loading extension.
+ * @param function The scalar function to register.
+ * @param err Optional. On failure, receives an opaque info handle the caller must destroy via
+ * `duckdb_v2_error_info_destroy()`.
+ * @return DUCKDB_V2_ERROR
+ */
+DUCKDB_C_API DUCKDB_V2_ERROR duckdb_v2_extension_register_scalar_function(duckdb_v2_extension_handle extension,
+                                                                          duckdb_v2_scalar_function_handle function,
+                                                                          duckdb_v2_error_info_handle *err);
+#endif
+
+#if DUCKDB_V2_API_ALLOW_UNSTABLE
+/*!
+ * Destroys the scalar function, releasing its resources.
+ *
+ * Null-safe: passing a null pointer or null handle is a no-op. The handle is set to null on return to prevent
+ * double-destruction. Destroying the handle after registration does not affect the registered function.
+ *
+ * history:
+ * - unstable: v2.0.0
+ *
+ * @param function The function to destroy.
+ * @return DUCKDB_V2_ERROR
+ */
+DUCKDB_C_API DUCKDB_V2_ERROR duckdb_v2_scalar_function_destroy(duckdb_v2_scalar_function_handle *function);
+#endif
+
+/* --- Struct definitions for scalar --- */
+
+/* ============================================================================
+ * MODULE: sql_statement
+ * ============================================================================ */
+
+/* --- Enums for sql_statement --- */
+
+//! SQL statement type of a parsed statement or an executed query.
+typedef enum DUCKDB_V2_STATEMENT_TYPE {
+	DUCKDB_V2_STATEMENT_TYPE_INVALID = 0,
+	DUCKDB_V2_STATEMENT_TYPE_SELECT = 1,
+	DUCKDB_V2_STATEMENT_TYPE_INSERT = 2,
+	DUCKDB_V2_STATEMENT_TYPE_UPDATE = 3,
+	DUCKDB_V2_STATEMENT_TYPE_CREATE = 4,
+	DUCKDB_V2_STATEMENT_TYPE_DELETE = 5,
+	DUCKDB_V2_STATEMENT_TYPE_PREPARE = 6,
+	DUCKDB_V2_STATEMENT_TYPE_EXECUTE = 7,
+	DUCKDB_V2_STATEMENT_TYPE_ALTER = 8,
+	DUCKDB_V2_STATEMENT_TYPE_TRANSACTION = 9,
+	DUCKDB_V2_STATEMENT_TYPE_COPY = 10,
+	DUCKDB_V2_STATEMENT_TYPE_ANALYZE = 11,
+	DUCKDB_V2_STATEMENT_TYPE_VARIABLE_SET = 12,
+	DUCKDB_V2_STATEMENT_TYPE_CREATE_FUNC = 13,
+	DUCKDB_V2_STATEMENT_TYPE_EXPLAIN = 14,
+	DUCKDB_V2_STATEMENT_TYPE_DROP = 15,
+	DUCKDB_V2_STATEMENT_TYPE_EXPORT = 16,
+	DUCKDB_V2_STATEMENT_TYPE_PRAGMA = 17,
+	DUCKDB_V2_STATEMENT_TYPE_VACUUM = 18,
+	DUCKDB_V2_STATEMENT_TYPE_CALL = 19,
+	DUCKDB_V2_STATEMENT_TYPE_SET = 20,
+	DUCKDB_V2_STATEMENT_TYPE_LOAD = 21,
+	DUCKDB_V2_STATEMENT_TYPE_RELATION = 22,
+	DUCKDB_V2_STATEMENT_TYPE_EXTENSION = 23,
+	DUCKDB_V2_STATEMENT_TYPE_LOGICAL_PLAN = 24,
+	DUCKDB_V2_STATEMENT_TYPE_ATTACH = 25,
+	DUCKDB_V2_STATEMENT_TYPE_DETACH = 26,
+	DUCKDB_V2_STATEMENT_TYPE_MULTI = 27,
+	DUCKDB_V2_STATEMENT_TYPE_COPY_DATABASE = 28,
+	DUCKDB_V2_STATEMENT_TYPE_UPDATE_EXTENSIONS = 29,
+	DUCKDB_V2_STATEMENT_TYPE_MERGE_INTO = 30,
+	DUCKDB_V2_STATEMENT_TYPE_CONNECT = 31,
+	DUCKDB_V2_STATEMENT_TYPE_DISCONNECT = 32,
+	DUCKDB_V2_STATEMENT_TYPE_EXTERNAL_RESOURCE = 33,
+	DUCKDB_V2_STATEMENT_TYPE_PASSTHROUGH = 34,
+	DUCKDB_V2_STATEMENT_TYPE_MAX_ENUM = 0x7FFFFFFF,
+} DUCKDB_V2_STATEMENT_TYPE;
+
+/* --- Struct forward declarations for sql_statement --- */
+
+/* --- Types for sql_statement --- */
+
+/*!
+ * An opaque, owned handle to a single parsed SQL statement, produced by statement_iterator_next. statement_execute runs
+ * it without consuming it; the caller always destroys it via sql_statement_destroy.
+ */
+typedef struct _duckdb_v2_sql_statement {
+	void *internal_ptr;
+} * duckdb_v2_sql_statement_handle;
+
+/*!
+ * An opaque, owned handle to an iterator over the statements of a SQL string, produced by parse_sql. Destroy it via
+ * statement_iterator_destroy; statements it already yielded are independently owned and unaffected.
+ */
+typedef struct _duckdb_v2_statement_iterator {
+	void *internal_ptr;
+} * duckdb_v2_statement_iterator_handle;
+
+/* --- Constants for sql_statement --- */
+
+/* --- Function pointer typedefs for sql_statement --- */
+
+/* --- Functions for sql_statement --- */
+
+#if DUCKDB_V2_API_ALLOW_UNSTABLE
+/*!
+ * Parses a SQL string into an iterator over its statements.
+ *
+ * Parses and nothing more: no binding, no catalog access, no transaction. The connection supplies the parser options
+ * and parser extensions, and is not otherwise touched. Statements are raw parser output; statement-level rewrites
+ * happen inside statement_execute. The SQL string is copied, so the caller may free it once this call returns. An input
+ * with no statements — empty, whitespace, or separators only — yields an iterator that is immediately exhausted.
+ *
+ * history:
+ * - unstable: v2.0.0
+ *
+ * @param conn The connection supplying the parser configuration.
+ * @param sql Null-terminated SQL string; may contain any number of statements.
+ * @param out_iterator Receives the new iterator handle.
+ * @param err Optional. On failure, receives an opaque info handle the caller must destroy via error_info_destroy.
+ * @return DUCKDB_V2_ERROR
+ */
+DUCKDB_C_API DUCKDB_V2_ERROR duckdb_v2_parse_sql(duckdb_v2_connection_handle conn, const char *sql,
+                                                 duckdb_v2_statement_iterator_handle *out_iterator,
+                                                 duckdb_v2_error_info_handle *err);
+#endif
+
+#if DUCKDB_V2_API_ALLOW_UNSTABLE
+/*!
+ * Yields the next statement, or NULL when exhausted.
+ *
+ * On success *out_statement receives the next owned statement, or NULL once the iterator is exhausted — repeatedly, so
+ * calling again is harmless. A parse error within the input surfaces no later than the call that reaches the failing
+ * statement: an implementation that parses eagerly reports it from parse_sql instead and yields no statements at all,
+ * while an incremental one yields the statements ahead of the failure first. On failure *out_statement is set to NULL.
+ *
+ * history:
+ * - unstable: v2.0.0
+ *
+ * @param iterator The iterator to advance.
+ * @param out_statement Receives an owned statement, or NULL when the iterator is exhausted.
+ * @param err Optional. On failure, receives an opaque info handle the caller must destroy via error_info_destroy.
+ * @return DUCKDB_V2_ERROR
+ */
+DUCKDB_C_API DUCKDB_V2_ERROR duckdb_v2_statement_iterator_next(duckdb_v2_statement_iterator_handle iterator,
+                                                               duckdb_v2_sql_statement_handle *out_statement,
+                                                               duckdb_v2_error_info_handle *err);
+#endif
+
+#if DUCKDB_V2_API_ALLOW_UNSTABLE
+/*!
+ * Binds a parsed statement without executing, yielding its schema signature.
+ *
+ * Preprocesses and binds the statement exactly as execution would, but runs nothing: the result is the statement's
+ * signature as two schemas, not a query result. The statement is borrowed, not consumed, so it can be bound as often as
+ * you like and executed later. out_schema receives the output schema (result columns) and is never empty, since a
+ * non-SELECT reports a single status column: a BIGINT changed-rows count, or a BOOLEAN success. out_parameters, when
+ * non-NULL, receives the input schema (parameter types, ordered by binding index). Both are owned; destroy them via
+ * schema_destroy.
+ *
+ * Binding is read-only and does not disturb a live result: it begins no query, claims no cursor, reuses an active
+ * transaction read-only, and runs alongside a paused stream. It is single-consumer like the stepping functions, so bind
+ * concurrently only on a second connection. Prepare-time errors — binder, catalog, preprocessing — surface here. A
+ * statement that expands into a group (a dynamic PIVOT, or statement-expanding DDL such as ALTER ADD COLUMN with a
+ * non-constant DEFAULT) has a schema known only at execution, and is reported with ERROR_INPUT_METADATA_DEFERRED;
+ * execute it instead.
+ *
+ * *out_schema and *out_parameters are set to NULL on failure.
+ *
+ * history:
+ * - unstable: v2.0.0
+ *
+ * @param conn The connection supplying the catalog, transaction, and parser configuration.
+ * @param statement The statement to bind. Borrowed; not consumed.
+ * @param out_schema Receives the owned output schema (result columns). Destroy via schema_destroy.
+ * @param out_parameters Optional. When non-NULL, receives the owned input schema (parameter types, ordered by binding
+ * index). Destroy via schema_destroy.
+ * @param err Optional. On failure, receives an opaque info handle the caller must destroy via error_info_destroy.
+ * @return DUCKDB_V2_ERROR
+ */
+DUCKDB_C_API DUCKDB_V2_ERROR duckdb_v2_statement_bind(duckdb_v2_connection_handle conn,
+                                                      duckdb_v2_sql_statement_handle statement,
+                                                      duckdb_v2_schema_handle *out_schema,
+                                                      duckdb_v2_schema_handle *out_parameters,
+                                                      duckdb_v2_error_info_handle *err);
+#endif
+
+#if DUCKDB_V2_API_ALLOW_UNSTABLE
+/*!
+ * Binds a column data collection to the statement under a name.
+ *
+ * Makes the collection visible to the statement as a table named `name`, by adding a common table expression to the
+ * parsed statement. The statement can then be bound, prepared or executed as usual; each execution reads the
+ * collection's contents at that moment, so a prepared statement can be executed again after the collection was cleared
+ * and refilled. Supported statement types are SELECT, INSERT, UPDATE, DELETE and MERGE INTO; any other type is rejected
+ * with `ERROR_INPUT_INVALID`.
+ *
+ * A name the statement already defines as a common table expression, in its SQL text or by a prior call, is rejected
+ * with `ERROR_INPUT_INVALID`. The binding shadows any catalog table named `name`, as a common table expression does.
+ *
+ * By default the collection's columns are named col1..colN. Pass `column_names` to name them instead; when supplied,
+ * `column_count` must equal the collection's column count. Pass NULL and 0 for the default names.
+ *
+ * The collection is borrowed: the caller keeps ownership and must keep it alive, and must not clear, reset or destroy
+ * it, for as long as the statement, any statement copied or prepared from it, or any result executing it is live. An
+ * empty collection is a valid binding. Several collections can be bound under distinct names.
+ *
+ * history:
+ * - unstable: v2.0.0
+ *
+ * @param statement The statement to bind the collection to. Modified in place.
+ * @param name The non-empty name the statement refers to the collection by. Borrowed and copied.
+ * @param collection The collection to bind. Borrowed; the caller keeps ownership and must keep it alive.
+ * @param column_names Optional. An array of `column_count` names for the collection's columns, in order. Pass NULL for
+ * col1..colN.
+ * @param column_count The number of names in `column_names`. 0 for the default names; otherwise the collection's column
+ * count.
+ * @param err Optional. On failure, receives an opaque info handle the caller must destroy via
+ * `duckdb_v2_error_info_destroy()`.
+ * @return DUCKDB_V2_ERROR
+ */
+DUCKDB_C_API DUCKDB_V2_ERROR duckdb_v2_statement_add_collection(duckdb_v2_sql_statement_handle statement,
+                                                                const duckdb_v2_identifier_t *name,
+                                                                duckdb_v2_column_data_collection_handle collection,
+                                                                const duckdb_v2_identifier_t *column_names,
+                                                                idx_t column_count, duckdb_v2_error_info_handle *err);
+#endif
+
+#if DUCKDB_V2_API_ALLOW_UNSTABLE
+/*!
+ * Returns the statement's type as classified by the parser.
+ *
+ * This gives the type before the statement-level rewrites that `duckdb_v2_statement_execute()` applies, if any. So a
+ * PRAGMA reports PRAGMA even where execution rewrites it into a SELECT or a CALL.
+ * `duckdb_v2_result_get_statement_type()` on the executed result reports the rewritten type of a statement that
+ * rewrites into one. A statement the parser expands into a group reports MULTI, here and on its result. Its parts are
+ * not visible here, and statement_bind reports ERROR_INPUT_METADATA_DEFERRED for it.
+ *
+ * history:
+ * - unstable: v2.0.0
+ *
+ * @param statement The statement.
+ * @param out_type Receives the statement type.
+ * @param err Optional. On failure, receives an opaque info handle the caller must destroy via error_info_destroy.
+ * @return DUCKDB_V2_ERROR
+ */
+DUCKDB_C_API DUCKDB_V2_ERROR duckdb_v2_sql_statement_get_type(duckdb_v2_sql_statement_handle statement,
+                                                              DUCKDB_V2_STATEMENT_TYPE *out_type,
+                                                              duckdb_v2_error_info_handle *err);
+#endif
+
+#if DUCKDB_V2_API_ALLOW_UNSTABLE
+/*!
+ * Borrows the statement's own SQL text.
+ *
+ * The slice of the parsed string that belongs to this statement. A trailing terminator and the whitespace after it are
+ * included, whitespace and comments before the first token are not. The statement holds its own copy, so the view
+ * outlives the SQL string passed to parse_sql and the iterator, and stays valid until the statement is destroyed. A
+ * statement produced by a parser extension that overrides parsing carries whatever text the extension recorded.
+ *
+ * history:
+ * - unstable: v2.0.0
+ *
+ * @param statement The statement.
+ * @param out_text Receives a borrowed view of the statement text, valid until the statement is destroyed.
+ * @param err Optional. On failure, receives an opaque info handle the caller must destroy via error_info_destroy.
+ * @return DUCKDB_V2_ERROR
+ */
+DUCKDB_C_API DUCKDB_V2_ERROR duckdb_v2_sql_statement_get_text(duckdb_v2_sql_statement_handle statement,
+                                                              duckdb_v2_str *out_text,
+                                                              duckdb_v2_error_info_handle *err);
+#endif
+
+#if DUCKDB_V2_API_ALLOW_UNSTABLE
+/*!
+ * Returns the number of distinct parameters the statement declares.
+ *
+ * This counts the parameters the parser found ($1, ?, $name, ...), so it needs no catalog and no binding; only the
+ * parameter types wait for `duckdb_v2_statement_bind()`. Repeated uses of one parameter count once.
+ *
+ * history:
+ * - unstable: v2.0.0
+ *
+ * @param statement The statement.
+ * @param out_count Receives the number of distinct parameters.
+ * @param err Optional. On failure, receives an opaque info handle the caller must destroy via error_info_destroy.
+ * @return DUCKDB_V2_ERROR
+ */
+DUCKDB_C_API DUCKDB_V2_ERROR duckdb_v2_sql_statement_get_parameter_count(duckdb_v2_sql_statement_handle statement,
+                                                                         idx_t *out_count,
+                                                                         duckdb_v2_error_info_handle *err);
+#endif
+
+#if DUCKDB_V2_API_ALLOW_UNSTABLE
+/*!
+ * Borrows the name of one parameter, in binding order.
+ *
+ * Parse-time metadata. Positions follow the parameters' binding indices, the order of `duckdb_v2_statement_bind()`'s
+ * parameter schema, so position i here names field i there. The name is the binding key that
+ * `duckdb_v2_statement_execute()` accepts: "1", "2", ... for a positional parameter ($1 or ?), the identifier for a
+ * named one ($name). Positional indices may be gapped ($1 and $3 without $2), in which case the names are "1" and "3"
+ * at positions 0 and 1. The view is valid until the statement is destroyed. An index outside [0, count) is rejected
+ * with ERROR_INPUT_OUT_OF_RANGE.
+ *
+ * history:
+ * - unstable: v2.0.0
+ *
+ * @param statement The statement.
+ * @param index Zero-based position in binding order.
+ * @param out_name Receives a borrowed view of the parameter name, valid until the statement is destroyed.
+ * @param err Optional. On failure, receives an opaque info handle the caller must destroy via error_info_destroy.
+ * @return DUCKDB_V2_ERROR
+ */
+DUCKDB_C_API DUCKDB_V2_ERROR duckdb_v2_sql_statement_get_parameter_name(duckdb_v2_sql_statement_handle statement,
+                                                                        idx_t index, duckdb_v2_identifier_t *out_name,
+                                                                        duckdb_v2_error_info_handle *err);
+#endif
+
+#if DUCKDB_V2_API_ALLOW_UNSTABLE
+/*!
+ * Destroys a statement handle.
+ *
+ * Null-safe: passing nullptr or a slot already set to nullptr is a no-op. statement_execute does not consume a
+ * statement, so every statement is destroyed here once it is no longer needed. On success the slot is set to nullptr.
+ *
+ * history:
+ * - unstable: v2.0.0
+ *
+ * @param statement The statement to destroy.
+ * @return DUCKDB_V2_ERROR
+ */
+DUCKDB_C_API DUCKDB_V2_ERROR duckdb_v2_sql_statement_destroy(duckdb_v2_sql_statement_handle *statement);
+#endif
+
+#if DUCKDB_V2_API_ALLOW_UNSTABLE
+/*!
+ * Destroys a statement iterator handle.
+ *
+ * Null-safe: passing nullptr or a slot already set to nullptr is a no-op. Statements already yielded are independently
+ * owned and stay valid. On success the slot is set to nullptr.
+ *
+ * history:
+ * - unstable: v2.0.0
+ *
+ * @param iterator The iterator to destroy.
+ * @return DUCKDB_V2_ERROR
+ */
+DUCKDB_C_API DUCKDB_V2_ERROR duckdb_v2_statement_iterator_destroy(duckdb_v2_statement_iterator_handle *iterator);
+#endif
+
+/* --- Struct definitions for sql_statement --- */
+
+/* ============================================================================
+ * MODULE: vector
+ * ============================================================================ */
+
+/* --- Enums for vector --- */
+
+/*!
+ * Internal representation of a vector, with FSST / SEQUENCE / SHREDDED collapsed into OTHER: the view getter rejects
+ * those and requires an explicit vector_flatten first. OTHER is the 0-value, so a zero-initialized out-param reads as
+ * "unspecified, needs flatten" rather than silently looking like FLAT.
+ */
+typedef enum DUCKDB_V2_VECTOR_TYPE {
+	//! Default for zero-init. Covers FSST / SEQUENCE / SHREDDED — call vector_flatten first.
+	DUCKDB_V2_VECTOR_TYPE_OTHER = 0,
+
+	//! Standard per-row storage.
+	DUCKDB_V2_VECTOR_TYPE_FLAT = 1,
+
+	//! A single value applies to every row in the vector.
+	DUCKDB_V2_VECTOR_TYPE_CONSTANT = 2,
+
+	//! Data + selection vector indirection into another vector.
+	DUCKDB_V2_VECTOR_TYPE_DICTIONARY = 3,
+	DUCKDB_V2_VECTOR_TYPE_MAX_ENUM = 0x7FFFFFFF,
+} DUCKDB_V2_VECTOR_TYPE;
+
+/* --- Struct forward declarations for vector --- */
+
+typedef struct duckdb_v2_vector_view duckdb_v2_vector_view;
+
+typedef struct duckdb_v2_list_entry duckdb_v2_list_entry;
+
+typedef struct duckdb_v2_hugeint_t duckdb_v2_hugeint_t;
+
+typedef struct duckdb_v2_uhugeint_t duckdb_v2_uhugeint_t;
+
+typedef struct duckdb_v2_interval_t duckdb_v2_interval_t;
+
+/* --- Types for vector --- */
+
+/* --- Constants for vector --- */
+
+/* --- Function pointer typedefs for vector --- */
+
+/* --- Functions for vector --- */
+
+#if DUCKDB_V2_API_ALLOW_UNSTABLE
+/*!
+ * Returns the internal representation kind: flat, constant, or dictionary.
+ *
+ * Reports VECTOR_TYPE_OTHER for FSST / SEQUENCE / SHREDDED vectors, which must be passed through vector_flatten before
+ * vector_get_view will read them.
+ *
+ * history:
+ * - unstable: v2.0.0
+ *
+ * @param vector The vector.
+ * @param out_type Receives the representation kind.
+ * @param err Optional. On failure, receives an opaque info handle the caller must destroy via error_info_destroy.
+ * @return DUCKDB_V2_ERROR
+ */
+DUCKDB_C_API DUCKDB_V2_ERROR duckdb_v2_vector_get_vector_type(duckdb_v2_vector_handle vector,
+                                                              DUCKDB_V2_VECTOR_TYPE *out_type,
+                                                              duckdb_v2_error_info_handle *err);
+#endif
+
+#if DUCKDB_V2_API_ALLOW_UNSTABLE
+/*!
+ * Returns the vector's logical type.
+ *
+ * The returned logical type is the same type that was passed to vector_reference, or the type that was set on creation.
+ * It is caller-owned; destroy it via logical_type_destroy.
+ *
+ * history:
+ * - unstable: v2.0.0
+ *
+ * @param vector The vector.
+ * @param out_type Receives the caller-owned logical type handle. Destroy via logical_type_destroy.
+ * @param err Optional. On failure, receives an opaque info handle the caller must destroy via error_info_destroy.
+ * @return DUCKDB_V2_ERROR
+ */
+DUCKDB_C_API DUCKDB_V2_ERROR duckdb_v2_vector_get_logical_type(duckdb_v2_vector_handle vector,
+                                                               duckdb_v2_logical_type_handle *out_type,
+                                                               duckdb_v2_error_info_handle *err);
+#endif
+
+#if DUCKDB_V2_API_ALLOW_UNSTABLE
+/*!
+ * Reads a vector as a unified view of data, validity, selection, and count.
+ *
+ * Populates out_view with borrowed pointers, valid until the owning chunk is destroyed. view.data addresses the
+ * vector's elements, to be cast to the layout its logical type implies: a typed leaf array for the primitives,
+ * hugeint_t / uhugeint_t / interval_t for those kinds, bytes for VARCHAR / BLOB / BIT / BIGNUM, list_entry for LIST and
+ * MAP, and nothing at all for ARRAY / STRUCT / UNION, whose data lives in their children.
+ *
+ * DECIMAL and ENUM are typed leaf arrays too, over a storage tier that follows from the type; both mappings are
+ * contract. A DECIMAL of width <= 4 stores int16, <= 9 int32, <= 18 int64, and <= 38 int128, boundaries inclusive, with
+ * the width and scale available from logical_type_get_param. An ENUM stores its dictionary indices as uint8 for a
+ * dictionary of at most 255 entries, uint16 for at most 65535, and uint32 beyond that, boundaries inclusive and an
+ * empty dictionary uint8; logical_type_get_param resolves an index to its entry.
+ *
+ * Rejects VECTOR_TYPE_OTHER; call vector_flatten first.
+ *
+ * Reading a DICTIONARY vector has one side effect: the dictionary's underlying child is flattened in place if it is not
+ * already FLAT. The parent vector stays DICTIONARY, and only the child's storage shape changes, but any pointer
+ * previously borrowed into that child — from an earlier vector_get_view on a vector aliasing the same buffer, say — is
+ * invalidated. This is the only mutation vector_get_view performs; compare vector_flatten, which materializes the whole
+ * vector to FLAT.
+ *
+ * history:
+ * - unstable: v2.0.0
+ *
+ * @param vector The vector to read.
+ * @param out_view Receives the view. Its pointers are borrowed and valid until the owning chunk is destroyed.
+ * @param err Optional. On failure, receives an opaque info handle the caller must destroy via error_info_destroy.
+ * @return DUCKDB_V2_ERROR
+ */
+DUCKDB_C_API DUCKDB_V2_ERROR duckdb_v2_vector_get_view(duckdb_v2_vector_handle vector, duckdb_v2_vector_view *out_view,
+                                                       duckdb_v2_error_info_handle *err);
+#endif
+
+#if DUCKDB_V2_API_ALLOW_UNSTABLE
+/*!
+ * Returns the number of elements in the vector.
+ *
+ * The size is the number of logical elements the vector represents, which for a nested kind can differ from the size of
+ * its children. An ARRAY vector of size 10 whose array size is 3, for instance, has 10 logical elements while its
+ * single child vector has 30.
+ *
+ * history:
+ * - unstable: v2.0.0
+ *
+ * @param vector The vector.
+ * @param out_size Receives the number of elements.
+ * @param err Optional. On failure, receives an opaque info handle the caller must destroy via error_info_destroy.
+ * @return DUCKDB_V2_ERROR
+ */
+DUCKDB_C_API DUCKDB_V2_ERROR duckdb_v2_vector_get_size(duckdb_v2_vector_handle vector, idx_t *out_size,
+                                                       duckdb_v2_error_info_handle *err);
+#endif
+
+#if DUCKDB_V2_API_ALLOW_UNSTABLE
+/*!
+ * Sets the number of elements in the vector.
+ *
+ * The counterpart of vector_get_size: it declares how many logical elements the vector now holds. It reserves enough
+ * space for size logical elements.
+ *
+ * history:
+ * - unstable: v2.0.0
+ *
+ * @param vector The vector.
+ * @param size The new number of logical elements.
+ * @param err Optional. On failure, receives an opaque info handle the caller must destroy via error_info_destroy.
+ * @return DUCKDB_V2_ERROR
+ */
+DUCKDB_C_API DUCKDB_V2_ERROR duckdb_v2_vector_set_size(duckdb_v2_vector_handle vector, idx_t size,
+                                                       duckdb_v2_error_info_handle *err);
+#endif
+
+#if DUCKDB_V2_API_ALLOW_UNSTABLE
+/*!
+ * Reads one cell of a vector as an owned value.
+ *
+ * The total fallback reader. It reads any logical row of any vector representation without flattening — FLAT, CONSTANT,
+ * DICTIONARY, and the compressed kinds the view getter rejects — and covers every type kind, including those with no
+ * committed view layout (today VARIANT and GEOMETRY), where it is the only way to reach a cell.
+ *
+ * Each call allocates one owned value, which makes this a single-cell bridge rather than a per-row loop primitive; use
+ * vector_get_view on hot paths. The row index is logical and bounds-checked against vector_get_size. The returned value
+ * is caller-owned; destroy it via value_destroy.
+ *
+ * history:
+ * - unstable: v2.0.0
+ *
+ * @param vector The vector to read from.
+ * @param row The logical row index, in [0, vector_get_size).
+ * @param out_value Receives the owned cell value.
+ * @param err Optional. On failure, receives an opaque info handle the caller must destroy via error_info_destroy.
+ * @return DUCKDB_V2_ERROR
+ */
+DUCKDB_C_API DUCKDB_V2_ERROR duckdb_v2_vector_get_value(duckdb_v2_vector_handle vector, idx_t row,
+                                                        duckdb_v2_value_handle *out_value,
+                                                        duckdb_v2_error_info_handle *err);
+#endif
+
+#if DUCKDB_V2_API_ALLOW_UNSTABLE
+/*!
+ * Writes one cell of a FLAT vector from a value.
+ *
+ * The total fallback writer. It covers every type kind, including those with no committed view layout (today VARIANT
+ * and GEOMETRY), where it is the only way to write a cell. The value is borrowed and copied in, then cast to the
+ * vector's type through the non-strict default cast; a cast failure surfaces from the call. A NULL value clears the
+ * row's validity.
+ *
+ * Requires a FLAT vector: constant, dictionary, and compressed representations are not row-addressable, so call
+ * vector_flatten first. Each call performs one value write, which makes this a single-cell bridge rather than a per-row
+ * loop primitive; use the typed mutable-data paths on hot paths. The row index is logical and bounds-checked against
+ * vector_get_size.
+ *
+ * history:
+ * - unstable: v2.0.0
+ *
+ * @param vector The vector to write to.
+ * @param row The logical row index, in [0, vector_get_size).
+ * @param value The borrowed value to write. Copied in; cast to the vector's type.
+ * @param err Optional. On failure, receives an opaque info handle the caller must destroy via error_info_destroy.
+ * @return DUCKDB_V2_ERROR
+ */
+DUCKDB_C_API DUCKDB_V2_ERROR duckdb_v2_vector_set_value(duckdb_v2_vector_handle vector, idx_t row,
+                                                        duckdb_v2_value_handle value, duckdb_v2_error_info_handle *err);
+#endif
+
+#if DUCKDB_V2_API_ALLOW_UNSTABLE
+/*!
+ * Returns a mutable pointer to the data of a FLAT or CONSTANT vector.
+ *
+ * Any other representation returns ERROR_INPUT_INVALID. The pointer is valid until the owning chunk is destroyed, and
+ * the vector's storage shape must not change — through a flatten, say — while it is in use.
+ *
+ * When writing VARCHAR values, the caller must ensure that the bytes contain valid UTF-8.
+ *
+ * history:
+ * - unstable: v2.0.0
+ *
+ * @param vector The vector.
+ * @param out_data Receives a mutable pointer to the data.
+ * @param err Optional. On failure, receives an opaque info handle the caller must destroy via error_info_destroy.
+ * @return DUCKDB_V2_ERROR
+ */
+DUCKDB_C_API DUCKDB_V2_ERROR duckdb_v2_vector_get_data_mutable(duckdb_v2_vector_handle vector, void **out_data,
+                                                               duckdb_v2_error_info_handle *err);
+#endif
+
+#if DUCKDB_V2_API_ALLOW_UNSTABLE
+/*!
+ * Forces a vector into FLAT representation, in place.
+ *
+ * A no-op for a vector that is already FLAT. For a CONSTANT, DICTIONARY, FSST, SEQUENCE, or SHREDDED vector it
+ * materializes the per-row data and switches the representation to FLAT. Call it before vector_get_view if you would
+ * rather not handle CONSTANT and DICTIONARY semantics in the view; it is required for any vector reporting
+ * VECTOR_TYPE_OTHER.
+ *
+ * history:
+ * - unstable: v2.0.0
+ *
+ * @param vector The vector to flatten.
+ * @param err Optional. On failure, receives an opaque info handle the caller must destroy via error_info_destroy.
+ * @return DUCKDB_V2_ERROR
+ */
+DUCKDB_C_API DUCKDB_V2_ERROR duckdb_v2_vector_flatten(duckdb_v2_vector_handle vector, duckdb_v2_error_info_handle *err);
+#endif
+
+#if DUCKDB_V2_API_ALLOW_UNSTABLE
+/*!
+ * Casts every row of a vector into another vector, using a factory.
+ *
+ * The conversion is the one SQL `CAST` / `TRY_CAST` performs, registered custom casts included, from the type of
+ * `source` to the type of `target`. It covers as many rows as `source` holds (`duckdb_v2_vector_get_size()`), of any
+ * representation. `target` is replaced by the result, as `duckdb_v2_vector_reference()` would, taking its size: data
+ * and views taken from it beforehand do not survive the call, and nothing it held before carries over. In
+ * CAST_MODE_NORMAL a row that does not convert fails the call with the engine's conversion error, and the contents of
+ * `target` are unspecified. In CAST_MODE_TRY such rows are NULL in `target` instead and the call succeeds; compare the
+ * validity of `source` and `target` to find them. `cast_err` then receives the conversion error of one of them, e.g. to
+ * report why the cast did not convert every row.
+ *
+ * A connection's or callback's factory casts with that client's cast functions and settings (e.g. TimeZone). An
+ * instance's factory supports only the built-in casts, with default settings. `source` and `target` must be different
+ * vectors; `target` is typically a vector of a data chunk created by the caller, or the result vector of a callback.
+ *
+ * history:
+ * - unstable: v2.0.0
+ *
+ * @param factory The factory supplying the cast functions.
+ * @param source The vector to cast. Borrowed for the call only.
+ * @param target The vector to write the cast rows into. Its logical type is the target type.
+ * @param mode Whether a row that does not convert fails the call, or becomes NULL.
+ * @param out_converted Optional. Receives whether every row converted. Always true when a CAST_MODE_NORMAL cast
+ * succeeds.
+ * @param cast_err Optional. When a CAST_MODE_TRY cast succeeds without converting every row, receives an opaque info
+ * handle with the conversion error of one row that did not convert, which the caller must destroy via
+ * error_info_destroy. Otherwise receives NULL.
+ * @param err Optional. On failure, receives an opaque info handle the caller must destroy via error_info_destroy.
+ * @return DUCKDB_V2_ERROR
+ */
+DUCKDB_C_API DUCKDB_V2_ERROR duckdb_v2_vector_cast(duckdb_v2_factory_handle factory, duckdb_v2_vector_handle source,
+                                                   duckdb_v2_vector_handle target, DUCKDB_V2_CAST_MODE mode,
+                                                   bool *out_converted, duckdb_v2_error_info_handle *cast_err,
+                                                   duckdb_v2_error_info_handle *err);
+#endif
+
+#if DUCKDB_V2_API_ALLOW_UNSTABLE
+/*!
+ * Repoints a vector at another vector's data, without copying.
+ *
+ * `vector` takes on the storage of `source`: no data moves, and the two alias the same buffers until one of them is
+ * reset or re-referenced. Works for any type, including nested types. The source's logical type must equal the
+ * vector's; a mismatch returns ERROR_INPUT_INVALID. The source's data must outlive every read of `vector`. Use it to
+ * hand an already-materialized vector straight to an output vector without a per-row copy.
+ *
+ * history:
+ * - unstable: v2.0.0
+ *
+ * @param vector The vector to repoint at the source's data.
+ * @param source The vector whose data to reference. Its logical type must equal the vector's.
+ * @param err Optional. On failure, receives an opaque info handle the caller must destroy via error_info_destroy.
+ * @return DUCKDB_V2_ERROR
+ */
+DUCKDB_C_API DUCKDB_V2_ERROR duckdb_v2_vector_reference(duckdb_v2_vector_handle vector, duckdb_v2_vector_handle source,
+                                                        duckdb_v2_error_info_handle *err);
+#endif
+
+#if DUCKDB_V2_API_ALLOW_UNSTABLE
+/*!
+ * Turns the vector into a CONSTANT vector holding the given value.
+ *
+ * Afterwards the vector holds a single element that applies to every logical row; write it through
+ * vector_get_data_mutable, which returns a pointer to that one element. For a STRUCT vector the change propagates to
+ * every child. The value's logical type must equal the vector's; a mismatch returns ERROR_INPUT_INVALID.
+ *
+ * history:
+ * - unstable: v2.0.0
+ *
+ * @param vector The vector to make constant.
+ * @param value The value every row takes. Its logical type must equal the vector's.
+ * @param count The number of elements in the vector.
+ * @param err Optional. On failure, receives an opaque info handle the caller must destroy via error_info_destroy.
+ * @return DUCKDB_V2_ERROR
+ */
+DUCKDB_C_API DUCKDB_V2_ERROR duckdb_v2_vector_make_constant(duckdb_v2_vector_handle vector,
+                                                            duckdb_v2_value_handle value, idx_t count,
+                                                            duckdb_v2_error_info_handle *err);
+#endif
+
+#if DUCKDB_V2_API_ALLOW_UNSTABLE
+/*!
+ * Sets a vector to a SEQUENCE representation.
+ *
+ * Afterwards the vector represents the arithmetic sequence start, start+increment, start+2*increment, ... over count
+ * elements. No data pointer is involved; the three parameters describe the sequence completely.
+ *
+ * history:
+ * - unstable: v2.0.0
+ *
+ * @param vector The vector to turn into a sequence.
+ * @param start The first value of the sequence.
+ * @param increment The step between consecutive values.
+ * @param count The number of elements in the sequence.
+ * @param err Optional. On failure, receives an opaque info handle the caller must destroy via error_info_destroy.
+ * @return DUCKDB_V2_ERROR
+ */
+DUCKDB_C_API DUCKDB_V2_ERROR duckdb_v2_vector_make_sequence(duckdb_v2_vector_handle vector, int64_t start,
+                                                            int64_t increment, idx_t count,
+                                                            duckdb_v2_error_info_handle *err);
+#endif
+
+#if DUCKDB_V2_API_ALLOW_UNSTABLE
+/*!
+ * Sets one row of a FLAT vector to NULL, nested children included.
+ *
+ * Clears the row's validity and broadcasts the NULL recursively to every descendant element under that row — STRUCT
+ * fields, and ARRAY elements strided by the array size — maintaining DuckDB's nested NULL invariant: when a STRUCT or
+ * ARRAY row is NULL, every descendant element under it must be NULL too. LIST children are left untouched, since their
+ * consumers gate on the list's own validity. Which kinds propagate is normative DuckDB behavior that evolves with the
+ * type system, which makes this the total NULL write path: equivalent to vector_set_value with a NULL value, without
+ * the per-call value allocation.
+ *
+ * Requires a FLAT vector: constant, dictionary, and compressed representations are not row-addressable, so call
+ * vector_flatten first. The row index is logical and bounds-checked against vector_get_size.
+ *
+ * history:
+ * - unstable: v2.0.0
+ *
+ * @param vector The vector to write to.
+ * @param row The logical row index, in [0, vector_get_size).
+ * @param err Optional. On failure, receives an opaque info handle the caller must destroy via error_info_destroy.
+ * @return DUCKDB_V2_ERROR
+ */
+DUCKDB_C_API DUCKDB_V2_ERROR duckdb_v2_vector_set_null(duckdb_v2_vector_handle vector, idx_t row,
+                                                       duckdb_v2_error_info_handle *err);
+#endif
+
+#if DUCKDB_V2_API_ALLOW_UNSTABLE
+/*!
+ * Returns a mutable pointer to the validity mask of a FLAT vector.
+ *
+ * Allocates the mask on first use, so the returned pointer is always non-null. Each uint64_t word covers 64 rows: bit N
+ * of word W is row W*64+N. A set bit means valid; a cleared bit means NULL.
+ *
+ * A raw mask write marks only this vector's rows. Clearing a STRUCT or ARRAY parent bit leaves the descendant elements
+ * untouched, which violates DuckDB's nested NULL invariant — a NULL STRUCT or ARRAY row requires NULL descendants — so
+ * set nested rows NULL through vector_set_null instead. When writing nested masks raw anyway, invalidate the child
+ * masks up front and mark elements valid as the values are written.
+ *
+ * history:
+ * - unstable: v2.0.0
+ *
+ * @param vector The vector.
+ * @param out_validity Receives a mutable pointer to the validity mask.
+ * @param err Optional. On failure, receives an opaque info handle the caller must destroy via error_info_destroy.
+ * @return DUCKDB_V2_ERROR
+ */
+DUCKDB_C_API DUCKDB_V2_ERROR duckdb_v2_vector_flat_get_validity_mutable(duckdb_v2_vector_handle vector,
+                                                                        uint64_t **out_validity,
+                                                                        duckdb_v2_error_info_handle *err);
+#endif
+
+#if DUCKDB_V2_API_ALLOW_UNSTABLE
+/*!
+ * Sets the validity of a CONSTANT vector.
+ *
+ * A constant vector holds a single element, so one flag decides whether every row reads as the value or as NULL.
+ *
+ * history:
+ * - unstable: v2.0.0
+ *
+ * @param vector The constant vector.
+ * @param validity True to mark the vector's single element valid, false to mark it NULL.
+ * @param err Optional. On failure, receives an opaque info handle the caller must destroy via error_info_destroy.
+ * @return DUCKDB_V2_ERROR
+ */
+DUCKDB_C_API DUCKDB_V2_ERROR duckdb_v2_vector_constant_set_valid(duckdb_v2_vector_handle vector, bool validity,
+                                                                 duckdb_v2_error_info_handle *err);
+#endif
+
+#if DUCKDB_V2_API_ALLOW_UNSTABLE
+/*!
+ * Borrows a string-backed vector's arena for writing.
+ *
+ * Allocates the arena on first use. Valid for VARCHAR, BLOB, BIT, and BIGNUM vectors, and returns ERROR_INPUT_INVALID
+ * for anything else. This call is the single string-ness check, which is why arena_allocate itself performs none. The
+ * arena is borrowed — never destroy it — and stays valid until the vector is flattened, reallocated, or destroyed.
+ *
+ * history:
+ * - unstable: v2.0.0
+ *
+ * @param vector The string-backed vector whose arena to borrow.
+ * @param out_arena Receives the borrowed arena handle.
+ * @param err Optional. On failure, receives an opaque info handle the caller must destroy via error_info_destroy.
+ * @return DUCKDB_V2_ERROR
+ */
+DUCKDB_C_API DUCKDB_V2_ERROR duckdb_v2_vector_get_arena(duckdb_v2_vector_handle vector,
+                                                        duckdb_v2_arena_handle *out_arena,
+                                                        duckdb_v2_error_info_handle *err);
+#endif
+
+#if DUCKDB_V2_API_ALLOW_UNSTABLE
+/*!
+ * Returns the number of child vectors a nested vector exposes.
+ *
+ * 1 for LIST, MAP and ARRAY; the field count for STRUCT; member_count + 1 for UNION, the tag plus the members; and 0
+ * for any non-nested kind. vector_get_child documents what each index addresses.
+ *
+ * history:
+ * - unstable: v2.0.0
+ *
+ * @param vector The vector.
+ * @param out_count Receives the number of child vectors.
+ * @param err Optional. On failure, receives an opaque info handle the caller must destroy via error_info_destroy.
+ * @return DUCKDB_V2_ERROR
+ */
+DUCKDB_C_API DUCKDB_V2_ERROR duckdb_v2_vector_get_child_count(duckdb_v2_vector_handle vector, idx_t *out_count,
+                                                              duckdb_v2_error_info_handle *err);
+#endif
+
+#if DUCKDB_V2_API_ALLOW_UNSTABLE
+/*!
+ * Borrows a child vector by index.
+ *
+ * What each index addresses, by kind: LIST and ARRAY expose [0] = the elements; MAP [0] = the entries, a STRUCT(key,
+ * value) whose children are the keys and the values; STRUCT and TUPLE [i] = field i; and UNION [0] = the tag with
+ * [1..N] = the members. Note that value_get_child diverges on UNION, exposing only the active member.
+ *
+ * The returned child is borrowed and lives as long as the owning chunk. Returns ERROR_INPUT_INVALID if the vector has
+ * no children, or if the index is out of range.
+ *
+ * history:
+ * - unstable: v2.0.0
+ *
+ * @param vector The nested vector to descend into.
+ * @param index The child index, in [0, vector_get_child_count).
+ * @param out_child Receives the borrowed child vector.
+ * @param err Optional. On failure, receives an opaque info handle the caller must destroy via error_info_destroy.
+ * @return DUCKDB_V2_ERROR
+ */
+DUCKDB_C_API DUCKDB_V2_ERROR duckdb_v2_vector_get_child(duckdb_v2_vector_handle vector, idx_t index,
+                                                        duckdb_v2_vector_handle *out_child,
+                                                        duckdb_v2_error_info_handle *err);
+#endif
+
+#if DUCKDB_V2_API_ALLOW_UNSTABLE
+/*!
+ * Decodes BIGNUM storage bytes into a caller-supplied magnitude buffer + sign flag.
+ *
+ * in_data and in_length are the value's raw storage bytes, exactly as they sit in a vector's bignum payload or as
+ * value_get_blob reports them for a BIGNUM value. Those bytes are opaque: the storage encoding is not a committed part
+ * of this API, and this function is the only thing that interprets them.
+ *
+ * Writes the big-endian magnitude bytes into out_data and the sign flag into out_is_negative; reconstruct the integer
+ * as (-1)**out_is_negative * unsigned_big_endian(out_data[0..out_length]). Materializing the bytes is unavoidable,
+ * since a negative bignum stores its magnitude bit-inverted, but the buffer belongs to the caller: this function never
+ * allocates and hands back nothing to free.
+ *
+ * Pass out_data = NULL to size the buffer without decoding. out_length then receives the exact number of magnitude
+ * bytes and out_is_negative the sign, and out_capacity is ignored. The size comes straight out of the storage header,
+ * so the query is O(1) and exact — a size call followed by a decode call never needs a retry loop.
+ *
+ * With out_data != NULL, out_capacity must be at least out_length bytes, or the call returns ERROR_INPUT_OBJECT_SIZE
+ * with out_length set to the required size and out_data left untouched. On success exactly out_length bytes are
+ * written, and the rest of the buffer is not modified.
+ *
+ * Returns ERROR_INPUT_INVALID if in_data is NULL, or if in_length is too short to hold a bignum header.
+ *
+ * history:
+ * - unstable: v2.0.0
+ *
+ * @param in_data The value's raw BIGNUM storage bytes.
+ * @param in_length Size of in_data in bytes.
+ * @param out_data Caller-owned buffer receiving the magnitude bytes, or NULL to only report the required size in
+ * out_length.
+ * @param out_capacity Bytes available in out_data. Ignored when out_data is NULL.
+ * @param out_length Receives the magnitude size in bytes, written on success and on ERROR_INPUT_OBJECT_SIZE.
+ * @param out_is_negative Receives true if the value is negative, false otherwise.
+ * @param err Optional. On failure, receives an opaque info handle the caller must destroy via error_info_destroy.
+ * @return DUCKDB_V2_ERROR
+ */
+DUCKDB_C_API DUCKDB_V2_ERROR duckdb_v2_bignum_decode(const uint8_t *in_data, idx_t in_length, uint8_t *out_data,
+                                                     idx_t out_capacity, idx_t *out_length, bool *out_is_negative,
+                                                     duckdb_v2_error_info_handle *err);
+#endif
+
+#if DUCKDB_V2_API_ALLOW_UNSTABLE
+/*!
+ * Encodes a magnitude + sign flag into BIGNUM storage bytes.
+ *
+ * The inverse of bignum_decode. in_data and in_length are the big-endian magnitude bytes and is_negative the sign;
+ * out_data receives the raw storage bytes for that integer, in the form a BIGNUM vector payload expects. Those bytes
+ * are opaque: the storage encoding is not a committed part of this API.
+ *
+ * Pass out_data = NULL to size the buffer without encoding. out_length then receives the exact number of storage bytes,
+ * and out_capacity is ignored. The size is a fixed function of in_length, so the query is O(1) and exact.
+ *
+ * With out_data != NULL, out_capacity must be at least out_length bytes, or the call returns ERROR_INPUT_OBJECT_SIZE
+ * with out_length set to the required size and out_data left untouched. On success exactly out_length bytes are
+ * written, and the rest of the buffer is not modified.
+ *
+ * The magnitude must be canonical, matching what bignum_decode produces: in_length >= 1 with no leading zero bytes, so
+ * the value zero is the single byte 0x00 with is_negative = false. A NULL in_data, an in_length of 0, a leading zero
+ * byte, or a negative zero returns ERROR_INPUT_INVALID; a magnitude beyond the maximum bignum width returns
+ * ERROR_INPUT_OUT_OF_RANGE.
+ *
+ * history:
+ * - unstable: v2.0.0
+ *
+ * @param in_data Big-endian magnitude bytes, with no leading zero bytes.
+ * @param in_length Size of in_data in bytes. Must be >= 1.
+ * @param is_negative True to encode a negative value.
+ * @param out_data Caller-owned buffer receiving the storage bytes, or NULL to only report the required size in
+ * out_length.
+ * @param out_capacity Bytes available in out_data. Ignored when out_data is NULL.
+ * @param out_length Receives the storage size in bytes — written on success and on ERROR_INPUT_OBJECT_SIZE.
+ * @param err Optional. On failure, receives an opaque info handle the caller must destroy via error_info_destroy.
+ * @return DUCKDB_V2_ERROR
+ */
+DUCKDB_C_API DUCKDB_V2_ERROR duckdb_v2_bignum_encode(const uint8_t *in_data, idx_t in_length, bool is_negative,
+                                                     uint8_t *out_data, idx_t out_capacity, idx_t *out_length,
+                                                     duckdb_v2_error_info_handle *err);
+#endif
+
+#if DUCKDB_V2_API_ALLOW_UNSTABLE
+/*!
+ * Validates all text->len bytes as UTF-8, including bytes after embedded NUL characters.
+ *
+ * Returns ERROR_INPUT_INVALID if any of:
+ * - text is NULL.
+ * - text->ptr is NULL and text->len is nonzero.
+ * - The input contains malformed UTF-8.
+ *
+ * A view with a NULL ptr and zero length is valid.
+ *
+ * history:
+ * - unstable: v2.0.0
+ *
+ * @param text The bytes to validate.
+ * @param err Optional. On failure, receives an opaque info handle the caller must destroy via error_info_destroy.
+ * @return DUCKDB_V2_ERROR
+ */
+DUCKDB_C_API DUCKDB_V2_ERROR duckdb_v2_validate_utf8(const duckdb_v2_str *text, duckdb_v2_error_info_handle *err);
+#endif
+
+/* --- Struct definitions for vector --- */
+
+struct duckdb_v2_vector_view {
+	const void *data;
+	const uint64_t *validity;
+	const duckdb_v2_sel_t *sel;
+	idx_t count;
+};
+
+struct duckdb_v2_list_entry {
+	idx_t offset;
+	idx_t length;
+};
+
+struct duckdb_v2_hugeint_t {
+	uint64_t lower;
+	int64_t upper;
+};
+
+struct duckdb_v2_uhugeint_t {
+	uint64_t lower;
+	uint64_t upper;
+};
+
+struct duckdb_v2_interval_t {
+	int32_t months;
+	int32_t days;
+	int64_t micros;
+};
+
+/* ============================================================================
+ * MODULE: prepared_statement
+ * ============================================================================ */
+
+/* --- Enums for prepared_statement --- */
+
+/* --- Struct forward declarations for prepared_statement --- */
+
+/* --- Types for prepared_statement --- */
+
+/*!
+ * An owned handle to a statement bound and planned once, executable repeatedly via
+ * `duckdb_v2_prepared_statement_execute()`. Construct with `duckdb_v2_prepared_statement_create()` and destroy with
+ * `duckdb_v2_prepared_statement_destroy()`. It keeps its connection's session alive, so it stays usable across
+ * executions and even after the connection is disconnected.
+ */
+typedef struct _duckdb_v2_prepared_statement {
+	void *internal_ptr;
+} * duckdb_v2_prepared_statement_handle;
+
+/* --- Constants for prepared_statement --- */
+
+/* --- Function pointer typedefs for prepared_statement --- */
+
+/* --- Functions for prepared_statement --- */
+
+#if DUCKDB_V2_API_ALLOW_UNSTABLE
+/*!
+ * Prepares a parsed statement into a reusable handle. Non-consuming.
+ *
+ * Copies the statement's AST, then binds and plans it once. Binder and catalog errors surface here, exactly as they
+ * would from `duckdb_v2_statement_execute()`. The statement is borrowed rather than consumed, since a copy is what gets
+ * prepared, so it can be prepared again or executed directly; the caller destroys it with
+ * `duckdb_v2_sql_statement_destroy()`.
+ *
+ * By default this succeeds for any preparable statement, whether or not its plan will be reused; ask
+ * `duckdb_v2_prepared_statement_reuses_plan()` which one you got. Setting `require_cacheable` instead fails with
+ * `ERROR_INPUT_INVALID` when the plan would not be reused, so a caller who wants the handle only for the speedup finds
+ * out here rather than after silently taking the slow path.
+ *
+ * A statement that DuckDB expands into several, such as a dynamic PIVOT, is kept as written and expanded again at each
+ * execution, in the transaction state of that execution. It runs nothing here, its plan is never reused, and its
+ * result's metadata is deferred as for `duckdb_v2_statement_execute()`. Parameters on such a statement are refused with
+ * `ERROR_INPUT_INVALID`.
+ *
+ * Refuses with `ERROR_RESOURCE_IN_USE` while a statement on the connection is still running. Drain, destroy, or
+ * interrupt that result first, or prepare on another connection. `*out_prepared` is set to NULL on failure.
+ *
+ * history:
+ * - unstable: v2.0.0
+ *
+ * @param conn The connection supplying the catalog, transaction, and parser state. The prepared statement belongs to
+ * it.
+ * @param statement The statement to prepare. Borrowed and copied, not consumed; destroy it with
+ * `duckdb_v2_sql_statement_destroy()`.
+ * @param require_cacheable When true, fail with `ERROR_INPUT_INVALID` unless the prepared plan will be reused across
+ * executions, as `duckdb_v2_prepared_statement_reuses_plan()` would report it.
+ * @param out_prepared On success, receives the new prepared statement. Owned by the caller; destroy via
+ * `duckdb_v2_prepared_statement_destroy()`.
+ * @param err Optional. On failure, receives an opaque info handle the caller must destroy via
+ * `duckdb_v2_error_info_destroy()`.
+ * @return DUCKDB_V2_ERROR
+ */
+DUCKDB_C_API DUCKDB_V2_ERROR duckdb_v2_prepared_statement_create(duckdb_v2_connection_handle conn,
+                                                                 duckdb_v2_sql_statement_handle statement,
+                                                                 bool require_cacheable,
+                                                                 duckdb_v2_prepared_statement_handle *out_prepared,
+                                                                 duckdb_v2_error_info_handle *err);
+#endif
+
+#if DUCKDB_V2_API_ALLOW_UNSTABLE
+/*!
+ * Executes a prepared statement, streaming its result. Non-consuming.
+ *
+ * Returns a result without executing anything: execution happens incrementally as the result is stepped or drained,
+ * exactly as with `duckdb_v2_statement_execute()`. The handle returned is an ordinary result, with identical behaviour
+ * throughout -- streaming, draining, the changed-row count of a DML statement, the output schema, the statement type,
+ * and the result type.
+ *
+ * `parameter_values` binds the statement's parameters as constants for this execution. Binding is positional by default
+ * ($1 = element 0); supply `parameter_names` to bind by name instead, where a non-empty entry binds its value to that
+ * named parameter ($name, matched case-insensitively) and a {NULL, 0} entry stays positional. Pass NULL for both
+ * arrays, or a count of 0, for a statement without parameters. Both arrays are borrowed and copied in, so the caller
+ * still owns and destroys them. A key set that does not match the statement's parameters is rejected with
+ * `ERROR_INPUT_INVALID`, with one exception: a named parameter left without a value reads the session variable of the
+ * same name (`SET VARIABLE`) when one exists.
+ *
+ * Not consumed: execute the same handle again, with the same values or different ones, as often as you like. Values are
+ * bound per execution and nothing carries over between them. A catalog change since the statement was prepared, or a
+ * parameter type that differs from the one the cached plan assumed, triggers a re-bind that is invisible apart from its
+ * cost.
+ *
+ * Refuses with `ERROR_RESOURCE_IN_USE` while a statement on the connection is still running; drain, destroy, or
+ * interrupt that result first, or execute on another connection. A failed execution, at any stage, leaves the prepared
+ * statement usable. `*out_result` is set to NULL on failure.
+ *
+ * history:
+ * - unstable: v2.0.0
+ *
+ * @param prepared The prepared statement to execute. Borrowed; not consumed.
+ * @param parameter_names Optional. An array of `parameter_count` parameter names; a non-empty entry binds its value to
+ * the named parameter ($name, case-insensitive), a {NULL, 0} entry keeps it positional ($1 = element 0). Pass NULL to
+ * bind everything positionally.
+ * @param parameter_values Optional. An array of `parameter_count` values. Each binds by name when `parameter_names`
+ * supplies one, and positionally ($1 = element 0) otherwise. Borrowed and copied in. Pass NULL for a statement without
+ * parameters.
+ * @param parameter_count The number of entries in `parameter_names` and `parameter_values`. Pass 0 for a statement
+ * without parameters.
+ * @param out_result On success, receives the new result. Owned by the caller; destroy via `duckdb_v2_result_destroy()`.
+ * @param err Optional. On failure, receives an opaque info handle the caller must destroy via
+ * `duckdb_v2_error_info_destroy()`.
+ * @return DUCKDB_V2_ERROR
+ */
+DUCKDB_C_API DUCKDB_V2_ERROR duckdb_v2_prepared_statement_execute(duckdb_v2_prepared_statement_handle prepared,
+                                                                  const duckdb_v2_identifier_t *parameter_names,
+                                                                  const duckdb_v2_value_handle *parameter_values,
+                                                                  idx_t parameter_count,
+                                                                  duckdb_v2_result_handle *out_result,
+                                                                  duckdb_v2_error_info_handle *err);
+#endif
+
+#if DUCKDB_V2_API_ALLOW_UNSTABLE
+/*!
+ * Reports whether the prepared statement reuses its compiled plan across executions.
+ *
+ * True when executions reuse the plan built at prepare time, provided the supplied values match the planned parameter
+ * types and nothing the plan depends on has changed; false when the statement re-binds on every execution, making it no
+ * faster than `duckdb_v2_statement_execute()`. A plan is reused only when all parameter types were resolved at prepare
+ * time and the plan is cacheable: `SELECT 42` reuses, `SELECT $1::INTEGER + 1` reuses, a statement reading a base table
+ * does not (it re-binds so a catalog change is picked up), and `SELECT $1 + $2` does not (the types are unknown until
+ * values arrive).
+ *
+ * A static property of the built plan, fixed when the statement was prepared and independent of the values later passed
+ * to `duckdb_v2_prepared_statement_execute()`.
+ *
+ * history:
+ * - unstable: v2.0.0
+ *
+ * @param prepared The prepared statement to inspect.
+ * @param out_reuses Receives true when the compiled plan is reused across executions, false when the statement re-binds
+ * each time.
+ * @param err Optional. On failure, receives an opaque info handle the caller must destroy via
+ * `duckdb_v2_error_info_destroy()`.
+ * @return DUCKDB_V2_ERROR
+ */
+DUCKDB_C_API DUCKDB_V2_ERROR duckdb_v2_prepared_statement_reuses_plan(duckdb_v2_prepared_statement_handle prepared,
+                                                                      bool *out_reuses,
+                                                                      duckdb_v2_error_info_handle *err);
+#endif
+
+#if DUCKDB_V2_API_ALLOW_UNSTABLE
+/*!
+ * Destroys a prepared statement.
+ *
+ * Null-safe: passing NULL, or a slot already set to NULL, is a no-op. A result produced by
+ * `duckdb_v2_prepared_statement_execute()` is independently owned and keeps the session alive itself, so the prepared
+ * statement may be destroyed while results made from it are still live. On success the slot is set to NULL.
+ *
+ * history:
+ * - unstable: v2.0.0
+ *
+ * @param prepared The prepared statement to destroy.
+ * @return DUCKDB_V2_ERROR
+ */
+DUCKDB_C_API DUCKDB_V2_ERROR duckdb_v2_prepared_statement_destroy(duckdb_v2_prepared_statement_handle *prepared);
+#endif
+
+/* --- Struct definitions for prepared_statement --- */
+
+/* ============================================================================
+ * MODULE: query_result
+ * ============================================================================ */
+
+/* --- Enums for query_result --- */
+
+/*!
+ * Shape of a query result. QUERY_RESULT carries rows and columns; CHANGED_ROWS carries an affected row count, as an
+ * INSERT, UPDATE, or DELETE without RETURNING produces; NOTHING covers DDL and other statements with no row output.
+ */
+typedef enum DUCKDB_V2_RESULT_TYPE {
+	DUCKDB_V2_RESULT_TYPE_QUERY_RESULT = 0,
+	DUCKDB_V2_RESULT_TYPE_CHANGED_ROWS = 1,
+	DUCKDB_V2_RESULT_TYPE_NOTHING = 2,
+	DUCKDB_V2_RESULT_TYPE_MAX_ENUM = 0x7FFFFFFF,
+} DUCKDB_V2_RESULT_TYPE;
+
+/*!
+ * Outcome of a result_step call. WAITING is the 0-value, so a zero-initialized out-param reads as "no work product yet"
+ * rather than CHUNK, the same convention VECTOR_TYPE_OTHER follows. The four states are the ones a consumer acts on;
+ * they are deliberately not a projection of any internal enum.
+ */
+typedef enum DUCKDB_V2_RESULT_STEP_STATUS {
+	//! No chunk yet; step again, or block in result_wait.
+	DUCKDB_V2_RESULT_STEP_STATUS_WAITING = 0,
+
+	//! A caller-owned chunk was written to *out_chunk, or an array to *out_array.
+	DUCKDB_V2_RESULT_STEP_STATUS_CHUNK = 1,
+
+	//! Stream exhausted. Sticky.
+	DUCKDB_V2_RESULT_STEP_STATUS_FINISHED = 2,
+
+	//! Query was interrupted. Sticky.
+	DUCKDB_V2_RESULT_STEP_STATUS_CANCELLED = 3,
+	DUCKDB_V2_RESULT_STEP_STATUS_MAX_ENUM = 0x7FFFFFFF,
+} DUCKDB_V2_RESULT_STEP_STATUS;
+
+/* --- Struct forward declarations for query_result --- */
+
+/* --- Types for query_result --- */
+
+/* --- Constants for query_result --- */
+
+/* --- Function pointer typedefs for query_result --- */
+
+/* --- Functions for query_result --- */
+
+#if DUCKDB_V2_API_ALLOW_UNSTABLE
+/*!
+ * Executes a parsed statement on the connection, streaming its result. Non-consuming.
+ *
+ * Takes a statement produced by the sql_statement module (parse_sql / statement_iterator_next), preprocesses and
+ * prepares it, and returns a result handle without executing anything: execution happens incrementally as the result is
+ * stepped (result_step) or drained (result_fetch_chunk). This call reports only the errors detectable at prepare time —
+ * binder, catalog, pragma preprocessing — while errors raised during execution surface from the stepping functions.
+ *
+ * The statement is borrowed, not consumed, since a copy is what executes. It can be executed again, for example with a
+ * different set of values, and the caller destroys it with sql_statement_destroy.
+ *
+ * parameter_values binds the statement's parameters as constants for this execution. Binding is positional by default:
+ * the i-th value binds $(i+1), matching SQL's own convention, so dense $1..$N and ? placeholders work directly. Supply
+ * parameter_names to bind by name instead — a non-empty name binds its value to that named parameter ($name, matched
+ * case-insensitively), while a {NULL, 0} entry leaves that value positional. The parameter schema from statement_bind
+ * lists the names to use. Both arrays are borrowed and copied in; the caller still owns and destroys them. Pass NULL
+ * for both, or a count of 0, for an unparameterized statement. A key set that does not match the statement's parameters
+ * — names for a positional statement, or the reverse — is rejected with ERROR_INPUT_INVALID, and named and positional
+ * parameters cannot be mixed within one statement. Parameters and statement expansion are mutually exclusive: passing
+ * values for a statement that preprocesses into a group is rejected with ERROR_INPUT_INVALID.
+ *
+ * DuckDB can expand one statement into a group: a dynamic PIVOT, or statement-expanding DDL such as ALTER ... ADD
+ * COLUMN with a non-constant DEFAULT. The group executes as one result through the same steps, and the stream surfaces
+ * the rows of the first row-producing statement of the group. A row-producing statement followed by another cannot be
+ * served as a single result and reports ERROR_QUERY_NOT_IMPLEMENTED; no known expansion produces one.
+ *
+ * One running statement per connection: this refuses with ERROR_RESOURCE_IN_USE while a statement on the connection is
+ * still running. Drain, destroy, or interrupt that result first, or open another connection.
+ *
+ * Schema metadata — result type, statement type, column count, names, logical types — is available on the returned
+ * handle immediately, before the first step.
+ *
+ * *out_result is set to nullptr on failure.
+ *
+ * history:
+ * - unstable: v2.0.0
+ *
+ * @param conn The connection on which to execute the statement.
+ * @param statement The statement to execute. Borrowed and copied; not consumed. Destroy it with sql_statement_destroy.
+ * @param parameter_names Optional. An array of parameter_count parameter names; a non-empty entry binds its value to
+ * the named parameter ($name, case-insensitive), a {NULL, 0} entry keeps it positional ($1 = element 0). Pass NULL for
+ * all-positional binding. Named and positional parameters cannot be mixed within one statement.
+ * @param parameter_values Optional. An array of parameter_count value handles. Each binds by name when parameter_names
+ * supplies one, otherwise positionally ($1 = element 0). Borrowed (copied in). Pass NULL for an unparameterized
+ * statement.
+ * @param parameter_count The number of parameters in parameter_names and parameter_values. Pass 0 for an
+ * unparameterized statement.
+ * @param out_result Receives the new result handle.
+ * @param err Optional. On failure, receives an opaque info handle the caller must destroy via error_info_destroy.
+ * @return DUCKDB_V2_ERROR
+ */
+DUCKDB_C_API DUCKDB_V2_ERROR duckdb_v2_statement_execute(duckdb_v2_connection_handle conn,
+                                                         duckdb_v2_sql_statement_handle statement,
+                                                         const duckdb_v2_identifier_t *parameter_names,
+                                                         const duckdb_v2_value_handle *parameter_values,
+                                                         idx_t parameter_count, duckdb_v2_result_handle *out_result,
+                                                         duckdb_v2_error_info_handle *err);
+#endif
+
+#if DUCKDB_V2_API_ALLOW_UNSTABLE
+/*!
+ * Destroys a result handle.
+ *
+ * Null-safe: passing nullptr or a slot already set to nullptr is a no-op. Frees the memory the result owns and releases
+ * the connection for its next query. Safe at any point in the stream's life. Destroying a result before its statement
+ * ended (drained, or stepped to FINISHED) aborts the statement. On autocommit, its writes are rolled back. Inside a
+ * transaction, a statement that may write invalidates the transaction, and a read-only statement just stops. Chunks
+ * already fetched are caller-owned and stay valid. On success the slot is set to nullptr.
+ *
+ * history:
+ * - unstable: v2.0.0
+ *
+ * @param result The result to destroy.
+ * @return DUCKDB_V2_ERROR
+ */
+DUCKDB_C_API DUCKDB_V2_ERROR duckdb_v2_result_destroy(duckdb_v2_result_handle *result);
+#endif
+
+#if DUCKDB_V2_API_ALLOW_UNSTABLE
+/*!
+ * Runs one bounded unit of query execution and returns without blocking.
+ *
+ * The streaming primitive: a step does a bounded amount of execution work, mostly without blocking, and returns control
+ * to the caller, so an event loop stays responsive and can interleave other work between steps. The conveniences —
+ * result_wait, result_fetch_chunk, result_drain — block, and are for synchronous callers. out_status reports the
+ * outcome:
+ *
+ * - CHUNK: *out_chunk receives a caller-owned chunk (destroy via data_chunk_destroy). Written only for this status;
+ * nullptr otherwise.
+ * - WAITING: no chunk yet, but work was done. Transient: keep stepping and it resolves to CHUNK, FINISHED, CANCELLED,
+ * or an error. Block in result_wait rather than busy-stepping.
+ * - FINISHED: stream exhausted. Sticky.
+ * - CANCELLED: query interrupted via connection_interrupt. Sticky. Cancellation is a status here, not an error;
+ * result_fetch_chunk, which has no status out-param, reports it as ERROR_RUNTIME_INTERRUPT.
+ *
+ * Execution errors come back as the return code plus err, never as a status; out_status is then unspecified and
+ * *out_chunk is nullptr. Errors are sticky, so later steps report the same code.
+ *
+ * history:
+ * - unstable: v2.0.0
+ *
+ * @param result The result to step.
+ * @param out_chunk Receives an owned chunk if *out_status is CHUNK; set to nullptr otherwise.
+ * @param out_status Receives the step status.
+ * @param err Optional. On failure, receives an opaque info handle the caller must destroy via error_info_destroy.
+ * @return DUCKDB_V2_ERROR
+ */
+DUCKDB_C_API DUCKDB_V2_ERROR duckdb_v2_result_step(duckdb_v2_result_handle result,
+                                                   duckdb_v2_data_chunk_handle *out_chunk,
+                                                   DUCKDB_V2_RESULT_STEP_STATUS *out_status,
+                                                   duckdb_v2_error_info_handle *err);
+#endif
+
+#if DUCKDB_V2_API_ALLOW_UNSTABLE
+/*!
+ * Blocks until the next chunk is available and returns it.
+ *
+ * A convenience over result_step: blocks until a chunk is produced or the stream ends. On success *out_chunk receives a
+ * caller-owned chunk (destroy via data_chunk_destroy), or nullptr at end-of-stream. End-of-stream is sticky, so later
+ * calls keep succeeding with *out_chunk set to nullptr.
+ *
+ * An interrupted query returns ERROR_RUNTIME_INTERRUPT — the same event result_step reports as status CANCELLED,
+ * carried on the error channel because this function has no status out-param.
+ *
+ * On failure *out_chunk is set to nullptr. Errors are sticky, so later calls report the same code.
+ *
+ * history:
+ * - unstable: v2.0.0
+ *
+ * @param result The result to fetch from.
+ * @param out_chunk Receives an owned chunk, or nullptr at end-of-stream.
+ * @param err Optional. On failure, receives an opaque info handle the caller must destroy via error_info_destroy.
+ * @return DUCKDB_V2_ERROR
+ */
+DUCKDB_C_API DUCKDB_V2_ERROR duckdb_v2_result_fetch_chunk(duckdb_v2_result_handle result,
+                                                          duckdb_v2_data_chunk_handle *out_chunk,
+                                                          duckdb_v2_error_info_handle *err);
+#endif
+
+#if DUCKDB_V2_API_ALLOW_UNSTABLE
+/*!
+ * Blocks until result_step can make progress.
+ *
+ * A convenience over result_step: blocks until a step is worth issuing again, that is, until a unit of execution work
+ * can run on the calling thread. Never produces or consumes chunks. Waiting on a terminal result — FINISHED, CANCELLED,
+ * or a sticky error — returns immediately; it is a no-op, never an error.
+ *
+ * history:
+ * - unstable: v2.0.0
+ *
+ * @param result The result to wait on.
+ * @param err Optional. On failure, receives an opaque info handle the caller must destroy via error_info_destroy.
+ * @return DUCKDB_V2_ERROR
+ */
+DUCKDB_C_API DUCKDB_V2_ERROR duckdb_v2_result_wait(duckdb_v2_result_handle result, duckdb_v2_error_info_handle *err);
+#endif
+
+#if DUCKDB_V2_API_ALLOW_UNSTABLE
+/*!
+ * Renders the result as a box table, consuming it.
+ *
+ * Drains the result into a column data collection and renders it with the same renderer the DuckDB CLI uses, so every
+ * client displays results identically without reimplementing table formatting. The result is consumed by transfer: the
+ * slot is set to NULL on success and on failure alike. A partially consumed result is accepted, and the remainder is
+ * what gets rendered.
+ *
+ * The whole remaining result materializes in memory before rendering. max_rows bounds what is DISPLAYED, not what is
+ * read, so with limit 0 the footer's row count is exact. A caller who cannot afford full materialization should bound
+ * the query itself (e.g. LIMIT n) and pass n as limit; the footer then renders "? rows" whenever the result fills that
+ * bound, since the true total is unknown at that point.
+ *
+ * Zero selects the renderer default for each sizing knob: max_rows 20, max_width the probed terminal width or 80 when
+ * that is unavailable, max_col_width 20. An empty null_value renders NULL cells as the default "NULL" text.
+ *
+ * The rendered text goes to sink rather than being returned: a box can be large, and this way nothing allocates a
+ * buffer the caller has to free. The sink is called exactly once with the whole box, so its view carries the full
+ * length — write it straight to a stream, or copy it into your own string. sink must not be NULL.
+ *
+ * history:
+ * - unstable: v2.0.0
+ *
+ * @param result The result to render; consumed and set to NULL. Left intact only when the call rejects null arguments.
+ * @param max_rows Maximum rows displayed; 0 selects the renderer default (20).
+ * @param max_width Maximum total width in characters; 0 selects the renderer default.
+ * @param max_col_width Maximum width of one column; 0 selects the renderer default (20).
+ * @param null_value Text rendered for NULL cells; empty selects "NULL".
+ * @param render_mode 0 renders rows (records down the page); 1 renders columns; other values are rejected with
+ * INVALID_INPUT.
+ * @param limit The row limit the caller applied to the query before rendering; 0 means none. When the materialized
+ * result holds exactly this many rows the true total is unknown, so the footer renders "? rows" instead of an exact
+ * count.
+ * @param sink Receives the whole rendered box in a single call. Borrowed for the duration of that call; see text_sink
+ * for the full contract.
+ * @param user_data Opaque pointer passed through to sink untouched. May be NULL.
+ * @param err Optional. On failure, receives an opaque info handle the caller must destroy via error_info_destroy.
+ * @return DUCKDB_V2_ERROR
+ */
+DUCKDB_C_API DUCKDB_V2_ERROR duckdb_v2_result_render_box(duckdb_v2_result_handle *result, idx_t max_rows,
+                                                         idx_t max_width, idx_t max_col_width,
+                                                         const duckdb_v2_str *null_value, idx_t render_mode,
+                                                         idx_t limit, duckdb_v2_text_sink_fn sink, void *user_data,
+                                                         duckdb_v2_error_info_handle *err);
+#endif
+
+#if DUCKDB_V2_API_ALLOW_UNSTABLE
+/*!
+ * Runs the result to completion and reports the changed-row count.
+ *
+ * A convenience over result_step: blocks until the stream is fully consumed, so every side effect is applied. Rows of a
+ * row-producing result are discarded. For a CHANGED_ROWS result *out_rows_changed receives the affected row count; for
+ * every other result type, and for a stream whose Count chunk was already consumed, it receives 0.
+ *
+ * The result type (result_get_result_type) is prepare-time metadata, so a caller can choose between consuming rows and
+ * draining without inspecting the SQL. Draining an already FINISHED result succeeds. Cancellation surfaces as
+ * ERROR_RUNTIME_INTERRUPT; errors are sticky, and on failure *out_rows_changed is unspecified.
+ *
+ * history:
+ * - unstable: v2.0.0
+ *
+ * @param result The result to drain.
+ * @param out_rows_changed Receives the affected row count for CHANGED_ROWS results, 0 otherwise.
+ * @param err Optional. On failure, receives an opaque info handle the caller must destroy via error_info_destroy.
+ * @return DUCKDB_V2_ERROR
+ */
+DUCKDB_C_API DUCKDB_V2_ERROR duckdb_v2_result_drain(duckdb_v2_result_handle result, idx_t *out_rows_changed,
+                                                    duckdb_v2_error_info_handle *err);
+#endif
+
+#if DUCKDB_V2_API_ALLOW_UNSTABLE
+/*!
+ * Returns the shape of the result: query, changed rows, or nothing.
+ *
+ * QUERY_RESULT for statements that produce rows (SELECT, RETURNING, EXPLAIN), CHANGED_ROWS for an INSERT, UPDATE, or
+ * DELETE without RETURNING, NOTHING for DDL and other statements with no row output.
+ *
+ * Prepare-time metadata: available from statement_execute on, except for a statement that expands into a group, where
+ * it fails with ERROR_INPUT_METADATA_DEFERRED until stepping has bound the row-producing statement, or the group ended
+ * without one.
+ *
+ * history:
+ * - unstable: v2.0.0
+ *
+ * @param result The result.
+ * @param out_type Receives the result shape.
+ * @param err Optional. On failure, receives an opaque info handle the caller must destroy via error_info_destroy.
+ * @return DUCKDB_V2_ERROR
+ */
+DUCKDB_C_API DUCKDB_V2_ERROR duckdb_v2_result_get_result_type(duckdb_v2_result_handle result,
+                                                              DUCKDB_V2_RESULT_TYPE *out_type,
+                                                              duckdb_v2_error_info_handle *err);
+#endif
+
+#if DUCKDB_V2_API_ALLOW_UNSTABLE
+/*!
+ * Returns the SQL statement type that produced the result.
+ *
+ * Prepare-time metadata: available from statement_execute on. A statement that expands into a group reports its type as
+ * written: MULTI, or PRAGMA for a pragma such as IMPORT DATABASE.
+ *
+ * history:
+ * - unstable: v2.0.0
+ *
+ * @param result The result.
+ * @param out_type Receives the statement type.
+ * @param err Optional. On failure, receives an opaque info handle the caller must destroy via error_info_destroy.
+ * @return DUCKDB_V2_ERROR
+ */
+DUCKDB_C_API DUCKDB_V2_ERROR duckdb_v2_result_get_statement_type(duckdb_v2_result_handle result,
+                                                                 DUCKDB_V2_STATEMENT_TYPE *out_type,
+                                                                 duckdb_v2_error_info_handle *err);
+#endif
+
+#if DUCKDB_V2_API_ALLOW_UNSTABLE
+/*!
+ * Returns the result's output schema as a single schema handle.
+ *
+ * Builds an owned schema of the result's column names and types into *out_schema; destroy it via schema_destroy.
+ * Prepare-time metadata, available before the first step, or for an expanding statement once stepping has bound the
+ * row-producing statement (before that it fails with ERROR_INPUT_METADATA_DEFERRED). Never empty: a non-SELECT reports
+ * a single status column, either a BIGINT changed-rows count or a BOOLEAN success.
+ *
+ * This schema is the authoritative source for the column types of the chunks the result produces; vectors do not carry
+ * their own type.
+ *
+ * *out_schema is set to NULL on failure.
+ *
+ * history:
+ * - unstable: v2.0.0
+ *
+ * @param result The result.
+ * @param out_schema Receives the owned output schema. Destroy via schema_destroy.
+ * @param err Optional. On failure, receives an opaque info handle the caller must destroy via error_info_destroy.
+ * @return DUCKDB_V2_ERROR
+ */
+DUCKDB_C_API DUCKDB_V2_ERROR duckdb_v2_result_get_schema(duckdb_v2_result_handle result,
+                                                         duckdb_v2_schema_handle *out_schema,
+                                                         duckdb_v2_error_info_handle *err);
+#endif
+
+/* --- Struct definitions for query_result --- */
+
+/* ============================================================================
+ * MODULE: table
+ * ============================================================================ */
+
+/* --- Enums for table --- */
+
+/*!
+ * Whether a table function's scan is partitioned by a given set of columns, and how. Reported by
+ * `duckdb_v2_table_function_set_partitioning_callback()` via
+ * `duckdb_v2_table_function_partitioning_set_partition_info()`.
+ */
+typedef enum DUCKDB_V2_TABLE_PARTITION_INFO {
+	//! The scan is not known to be partitioned by the requested columns.
+	DUCKDB_V2_TABLE_PARTITION_INFO_NOT_PARTITIONED = 0,
+
+	//! Each partition the scan produces carries exactly one distinct value for the requested columns.
+	DUCKDB_V2_TABLE_PARTITION_INFO_SINGLE_VALUE_PARTITIONS = 1,
+
+	//! The partitions the scan produces overlap only at their boundaries.
+	DUCKDB_V2_TABLE_PARTITION_INFO_OVERLAPPING_PARTITIONS = 2,
+
+	//! The partitions the scan produces are disjoint ranges.
+	DUCKDB_V2_TABLE_PARTITION_INFO_DISJOINT_PARTITIONS = 3,
+	DUCKDB_V2_TABLE_PARTITION_INFO_MAX_ENUM = 0x7FFFFFFF,
+} DUCKDB_V2_TABLE_PARTITION_INFO;
+
+/* --- Struct forward declarations for table --- */
+
+/* --- Types for table --- */
+
+/*!
+ * An owned opaque handle to a custom table function being built. Created with `duckdb_v2_table_function_create()`,
+ * configured with the setter functions (e.g. `duckdb_v2_table_function_set_name()`,
+ * `duckdb_v2_table_function_set_exec_callback()`, etc.) and the signature obtained via
+ * `duckdb_v2_table_function_get_signature()`, made available with `duckdb_v2_connection_register_table_function()` or
+ * `duckdb_v2_extension_register_table_function()`, and destroyed with `duckdb_v2_table_function_destroy()`.
+ */
+typedef struct _duckdb_v2_table_function {
+	void *internal_ptr;
+} * duckdb_v2_table_function_handle;
+
+/*!
+ * A borrowed opaque handle to the result of a table function's "bind" phase. The "bind" callback receives this handle
+ * next to a `duckdb_v2_function_bind_info_handle`, which gives access to the arguments, the user data and the bind
+ * data. It must use this handle to declare the columns the function returns, and can use it to hint at the number of
+ * rows the scan will produce.
+ */
+typedef struct _duckdb_v2_table_function_bind_info {
+	void *internal_ptr;
+} * duckdb_v2_table_function_bind_info_handle;
+
+/*!
+ * A borrowed opaque handle to the arguments supplied to a table function during the global state initialization "init
+ * global" phase. The "init global" callback receives this handle and can use it to e.g. set up the state shared by
+ * every thread scanning the function, and to declare how many threads may scan it.
+ */
+typedef struct _duckdb_v2_table_function_init_global_info {
+	void *internal_ptr;
+} * duckdb_v2_table_function_init_global_info_handle;
+
+/*!
+ * A borrowed opaque handle to the arguments supplied to a table function during the local state initialization "init
+ * local" phase. The "init local" callback receives this handle and can use it to e.g. set up worker-local state,
+ * typically by claiming work from the shared global state.
+ */
+typedef struct _duckdb_v2_table_function_init_local_info {
+	void *internal_ptr;
+} * duckdb_v2_table_function_init_local_info_handle;
+
+/*!
+ * A borrowed opaque handle to the arguments supplied to a table function during the execution "exec" phase. The "exec"
+ * callback receives this handle and can use it to e.g. access the global and local state and write the next batch of
+ * rows to the output chunk.
+ */
+typedef struct _duckdb_v2_table_function_exec_info {
+	void *internal_ptr;
+} * duckdb_v2_table_function_exec_info_handle;
+
+/*!
+ * A borrowed opaque handle to the arguments supplied to a table function during the "progress" phase. The "progress"
+ * callback receives this handle and can use it to report how far the scan has advanced.
+ */
+typedef struct _duckdb_v2_table_function_progress_info {
+	void *internal_ptr;
+} * duckdb_v2_table_function_progress_info_handle;
+
+/*!
+ * A borrowed opaque handle to the arguments supplied to a table function during the "filter pushdown" phase of query
+ * optimization. The "filter pushdown" callback receives this handle and can use it to inspect the filter predicates the
+ * query applies to the function's rows, and to accept the ones it will apply itself.
+ */
+typedef struct _duckdb_v2_table_function_filter_pushdown_info {
+	void *internal_ptr;
+} * duckdb_v2_table_function_filter_pushdown_info_handle;
+
+/*!
+ * A borrowed opaque handle to the arguments supplied to a table function during the "partition data" phase. The engine
+ * invokes the callback on the worker thread that just produced a batch of rows, once per batch, only when a downstream
+ * operator needs to know the batch's ordering position, the values of a set of partitioning columns, or both; the
+ * handle reports which of those were actually requested and receives the answer.
+ */
+typedef struct _duckdb_v2_table_function_partition_data_info {
+	void *internal_ptr;
+} * duckdb_v2_table_function_partition_data_info_handle;
+
+/*!
+ * A borrowed opaque handle to the arguments supplied to a table function during the "partitioning" phase of query
+ * optimization. The engine invokes the callback once per candidate `GROUP BY` column set, before execution starts, to
+ * decide whether the scan can feed a partitioned aggregate directly instead of hashing.
+ */
+typedef struct _duckdb_v2_table_function_partitioning_info {
+	void *internal_ptr;
+} * duckdb_v2_table_function_partitioning_info_handle;
+
+/*!
+ * A borrowed opaque handle to the arguments supplied to a table function when a scanning thread claims its next batch
+ * of work. The "claim batch" callback receives this handle and can use it to claim the next part of the scan from the
+ * shared global state for the thread's local state, and to report whether it claimed one.
+ */
+typedef struct _duckdb_v2_table_function_claim_batch_info {
+	void *internal_ptr;
+} * duckdb_v2_table_function_claim_batch_info_handle;
+
+/*!
+ * A borrowed opaque handle to the arguments supplied to a table function when the engine asks it to describe a bound
+ * call. The "get bind info" callback receives this handle, and can use it to describe the call in more detail than its
+ * columns: with identifiers of its columns (e.g. field ids), and with options - key-value facts about what the call
+ * reads.
+ */
+typedef struct _duckdb_v2_table_function_get_bind_info_info {
+	void *internal_ptr;
+} * duckdb_v2_table_function_get_bind_info_info_handle;
+
+/*!
+ * An owned opaque handle to a multi-file table function being built. A multi-file function wraps an already registered
+ * table function that reads a single file, and adds everything that is needed to read many files at once on top of it:
+ * globbing, lists of files, hive partitioning, the `filename` column, `union_by_name` and the like. Created with
+ * `duckdb_v2_multi_file_function_create()`, configured with the setter functions (e.g.
+ * `duckdb_v2_multi_file_function_set_name()`, `duckdb_v2_multi_file_function_set_single_file_function()`), made
+ * available with `duckdb_v2_connection_register_multi_file_function()` or
+ * `duckdb_v2_extension_register_multi_file_function()`, and destroyed with `duckdb_v2_multi_file_function_destroy()`.
+ */
+typedef struct _duckdb_v2_multi_file_function {
+	void *internal_ptr;
+} * duckdb_v2_multi_file_function_handle;
+
+/* --- Constants for table --- */
+
+/* --- Function pointer typedefs for table --- */
+
+typedef void (*duckdb_v2_table_function_bind_callback_fn)(duckdb_v2_function_bind_info_handle info,
+                                                          duckdb_v2_table_function_bind_info_handle result,
+                                                          duckdb_v2_context_handle context,
+                                                          duckdb_v2_error_info_handle *err);
+
+typedef void (*duckdb_v2_table_function_init_global_callback_fn)(duckdb_v2_table_function_init_global_info_handle info,
+                                                                 duckdb_v2_context_handle context,
+                                                                 duckdb_v2_error_info_handle *err);
+
+typedef void (*duckdb_v2_table_function_init_local_callback_fn)(duckdb_v2_table_function_init_local_info_handle info,
+                                                                duckdb_v2_context_handle context,
+                                                                duckdb_v2_error_info_handle *err);
+
+typedef void (*duckdb_v2_table_function_exec_callback_fn)(duckdb_v2_table_function_exec_info_handle info,
+                                                          duckdb_v2_context_handle context,
+                                                          duckdb_v2_error_info_handle *err);
+
+typedef void (*duckdb_v2_table_function_progress_callback_fn)(duckdb_v2_table_function_progress_info_handle info,
+                                                              duckdb_v2_context_handle context,
+                                                              duckdb_v2_error_info_handle *err);
+
+typedef void (*duckdb_v2_table_function_filter_pushdown_callback_fn)(
+    duckdb_v2_table_function_filter_pushdown_info_handle info, duckdb_v2_context_handle context,
+    duckdb_v2_error_info_handle *err);
+
+typedef void (*duckdb_v2_table_function_partition_data_callback_fn)(
+    duckdb_v2_table_function_partition_data_info_handle info, duckdb_v2_context_handle context,
+    duckdb_v2_error_info_handle *err);
+
+typedef void (*duckdb_v2_table_function_partitioning_callback_fn)(
+    duckdb_v2_table_function_partitioning_info_handle info, duckdb_v2_context_handle context,
+    duckdb_v2_error_info_handle *err);
+
+typedef void (*duckdb_v2_table_function_claim_batch_callback_fn)(duckdb_v2_table_function_claim_batch_info_handle info,
+                                                                 duckdb_v2_context_handle context,
+                                                                 duckdb_v2_error_info_handle *err);
+
+typedef void (*duckdb_v2_table_function_get_bind_info_callback_fn)(
+    duckdb_v2_table_function_get_bind_info_info_handle info, duckdb_v2_context_handle context,
+    duckdb_v2_error_info_handle *err);
+
+/* --- Functions for table --- */
+
+#if DUCKDB_V2_API_ALLOW_UNSTABLE
+/*!
+ * Creates a new table function through a factory.
+ *
+ * The function starts out empty: configure it with the setter functions (e.g. `duckdb_v2_table_function_set_name()`,
+ * `duckdb_v2_table_function_set_exec_callback()`, etc.) and the signature obtained via
+ * `duckdb_v2_table_function_get_signature()`, then make it available with
+ * `duckdb_v2_connection_register_table_function()` or `duckdb_v2_extension_register_table_function()`. The caller owns
+ * the returned handle and must destroy it with `duckdb_v2_table_function_destroy()`, also after registration.
+ *
+ * The table function can only be registered on the database the factory belongs to.
+ *
+ * history:
+ * - unstable: v2.0.0
+ *
+ * @param factory The factory to create the table function through.
+ * @param function On success, receives the newly created table function. Owned by the caller.
+ * @param err Optional. On failure, receives an opaque info handle the caller must destroy via
+ * `duckdb_v2_error_info_destroy()`.
+ * @return DUCKDB_V2_ERROR
+ */
+DUCKDB_C_API DUCKDB_V2_ERROR duckdb_v2_table_function_create(duckdb_v2_factory_handle factory,
+                                                             duckdb_v2_table_function_handle *function,
+                                                             duckdb_v2_error_info_handle *err);
+#endif
+
+#if DUCKDB_V2_API_ALLOW_UNSTABLE
+/*!
+ * Sets the name of the table function.
+ *
+ * The name is borrowed and copied. Calling this again replaces the previous name. A name must be set before
+ * registration.
+ *
+ * history:
+ * - unstable: v2.0.0
+ *
+ * @param function The function to set the name of.
+ * @param name The name to set. Borrowed and copied.
+ * @param err Optional. On failure, receives an opaque info handle the caller must destroy via
+ * `duckdb_v2_error_info_destroy()`.
+ * @return DUCKDB_V2_ERROR
+ */
+DUCKDB_C_API DUCKDB_V2_ERROR duckdb_v2_table_function_set_name(duckdb_v2_table_function_handle function,
+                                                               const duckdb_v2_identifier_t *name,
+                                                               duckdb_v2_error_info_handle *err);
+#endif
+
+#if DUCKDB_V2_API_ALLOW_UNSTABLE
+/*!
+ * Returns the documentation of the function so it can be filled in.
+ *
+ * Set a description with `duckdb_v2_function_docs_set_description()`, and add examples and categories with
+ * `duckdb_v2_function_docs_add_example()` and `duckdb_v2_function_docs_add_category()`. The documentation is modified
+ * in place, describes this overload only, and is registered with the function. Optional.
+ *
+ * history:
+ * - unstable: v2.0.0
+ *
+ * @param function The function to get the documentation of.
+ * @param docs The returned documentation. Borrowed and valid for the lifetime of the function handle.
+ * @param err Optional. On failure, receives an opaque info handle the caller must destroy via
+ * `duckdb_v2_error_info_destroy()`.
+ * @return DUCKDB_V2_ERROR
+ */
+DUCKDB_C_API DUCKDB_V2_ERROR duckdb_v2_table_function_get_docs(duckdb_v2_table_function_handle function,
+                                                               duckdb_v2_function_docs_handle *docs,
+                                                               duckdb_v2_error_info_handle *err);
+#endif
+
+#if DUCKDB_V2_API_ALLOW_UNSTABLE
+/*!
+ * Returns the function's signature so it can be configured.
+ *
+ * Add parameters with `duckdb_v2_function_signature_add_parameter()`. The signature is modified in place. A table
+ * function declares the columns it returns from its bind callback instead of through a return type, so registration
+ * rejects a signature whose return type was set with `duckdb_v2_function_signature_set_return_type()`.
+ *
+ * history:
+ * - unstable: v2.0.0
+ *
+ * @param function The function to get the signature of.
+ * @param sig The returned signature. Borrowed and valid for the lifetime of the function handle.
+ * @param err Optional. On failure, receives an opaque info handle the caller must destroy via
+ * `duckdb_v2_error_info_destroy()`.
+ * @return DUCKDB_V2_ERROR
+ */
+DUCKDB_C_API DUCKDB_V2_ERROR duckdb_v2_table_function_get_signature(duckdb_v2_table_function_handle function,
+                                                                    duckdb_v2_function_signature_handle *sig,
+                                                                    duckdb_v2_error_info_handle *err);
+#endif
+
+#if DUCKDB_V2_API_ALLOW_UNSTABLE
+/*!
+ * Sets arbitrary user data on the table function.
+ *
+ * Associates an opaque pointer with the function, retrievable from the callbacks via
+ * `duckdb_v2_function_bind_get_user_data()`, `duckdb_v2_table_function_init_global_get_user_data()`,
+ * `duckdb_v2_table_function_exec_get_user_data()` and their counterparts on the other phases. The opaque handle bundles
+ * the pointer with an optional destructor, invoked when the data is no longer needed.
+ *
+ * history:
+ * - unstable: v2.0.0
+ *
+ * @param function The function to set the user data of.
+ * @param data Opaque handle bundling the user data pointer plus an optional destructor.
+ * @param err Optional. On failure, receives an opaque info handle the caller must destroy via
+ * `duckdb_v2_error_info_destroy()`.
+ * @return DUCKDB_V2_ERROR
+ */
+DUCKDB_C_API DUCKDB_V2_ERROR duckdb_v2_table_function_set_user_data(duckdb_v2_table_function_handle function,
+                                                                    duckdb_v2_opaque *data,
+                                                                    duckdb_v2_error_info_handle *err);
+#endif
+
+#if DUCKDB_V2_API_ALLOW_UNSTABLE
+/*!
+ * Sets the bind callback of the table function.
+ *
+ * The bind callback is invoked during query planning for each call site of the function. It must declare the columns
+ * the function returns via `duckdb_v2_table_function_bind_add_result_column()`. Through its
+ * `duckdb_v2_function_bind_info_handle` it can also inspect the constant argument values and set "bind data" that is
+ * shared with all later callbacks. A bind callback must be set before registration.
+ *
+ * history:
+ * - unstable: v2.0.0
+ *
+ * @param function The function to set the bind callback of.
+ * @param callback The bind callback to set.
+ * @param err Optional. On failure, receives an opaque info handle the caller must destroy via
+ * `duckdb_v2_error_info_destroy()`.
+ * @return DUCKDB_V2_ERROR
+ */
+DUCKDB_C_API DUCKDB_V2_ERROR duckdb_v2_table_function_set_bind_callback(
+    duckdb_v2_table_function_handle function, duckdb_v2_table_function_bind_callback_fn callback,
+    duckdb_v2_error_info_handle *err);
+#endif
+
+#if DUCKDB_V2_API_ALLOW_UNSTABLE
+/*!
+ * Sets the optional global init callback of the table function.
+ *
+ * The global init callback is invoked once per scan, at the start of execution. It can set "global state" shared by
+ * every thread scanning the function, and declare how many threads may scan it in parallel via
+ * `duckdb_v2_table_function_init_global_set_max_threads()`.
+ *
+ * history:
+ * - unstable: v2.0.0
+ *
+ * @param function The function to set the global init callback of.
+ * @param callback The global init callback to set.
+ * @param err Optional. On failure, receives an opaque info handle the caller must destroy via
+ * `duckdb_v2_error_info_destroy()`.
+ * @return DUCKDB_V2_ERROR
+ */
+DUCKDB_C_API DUCKDB_V2_ERROR duckdb_v2_table_function_set_init_global_callback(
+    duckdb_v2_table_function_handle function, duckdb_v2_table_function_init_global_callback_fn callback,
+    duckdb_v2_error_info_handle *err);
+#endif
+
+#if DUCKDB_V2_API_ALLOW_UNSTABLE
+/*!
+ * Sets the optional local init callback of the table function.
+ *
+ * The local init callback is invoked once per thread that will scan the function. It can set worker-local "local
+ * state", retrievable from the exec callback, typically derived from the shared global state.
+ *
+ * history:
+ * - unstable: v2.0.0
+ *
+ * @param function The function to set the local init callback of.
+ * @param callback The local init callback to set.
+ * @param err Optional. On failure, receives an opaque info handle the caller must destroy via
+ * `duckdb_v2_error_info_destroy()`.
+ * @return DUCKDB_V2_ERROR
+ */
+DUCKDB_C_API DUCKDB_V2_ERROR duckdb_v2_table_function_set_init_local_callback(
+    duckdb_v2_table_function_handle function, duckdb_v2_table_function_init_local_callback_fn callback,
+    duckdb_v2_error_info_handle *err);
+#endif
+
+#if DUCKDB_V2_API_ALLOW_UNSTABLE
+/*!
+ * Sets the exec callback of the table function.
+ *
+ * The exec callback implements the function's logic: it is invoked repeatedly during query execution and writes the
+ * next batch of rows to the output chunk, until it produces an empty batch to signal the end of the scan. An exec
+ * callback must be set before registration.
+ *
+ * history:
+ * - unstable: v2.0.0
+ *
+ * @param function The function to set the exec callback of.
+ * @param callback The exec callback to set.
+ * @param err Optional. On failure, receives an opaque info handle the caller must destroy via
+ * `duckdb_v2_error_info_destroy()`.
+ * @return DUCKDB_V2_ERROR
+ */
+DUCKDB_C_API DUCKDB_V2_ERROR duckdb_v2_table_function_set_exec_callback(
+    duckdb_v2_table_function_handle function, duckdb_v2_table_function_exec_callback_fn callback,
+    duckdb_v2_error_info_handle *err);
+#endif
+
+#if DUCKDB_V2_API_ALLOW_UNSTABLE
+/*!
+ * Sets the optional progress callback of the table function.
+ *
+ * The progress callback is invoked on demand during execution to report how far the scan has advanced, which the engine
+ * surfaces as the query's progress. It is invoked concurrently with the exec callback, so it must read the global state
+ * in a thread-safe way.
+ *
+ * history:
+ * - unstable: v2.0.0
+ *
+ * @param function The function to set the progress callback of.
+ * @param callback The progress callback to set.
+ * @param err Optional. On failure, receives an opaque info handle the caller must destroy via
+ * `duckdb_v2_error_info_destroy()`.
+ * @return DUCKDB_V2_ERROR
+ */
+DUCKDB_C_API DUCKDB_V2_ERROR duckdb_v2_table_function_set_progress_callback(
+    duckdb_v2_table_function_handle function, duckdb_v2_table_function_progress_callback_fn callback,
+    duckdb_v2_error_info_handle *err);
+#endif
+
+#if DUCKDB_V2_API_ALLOW_UNSTABLE
+/*!
+ * Sets whether the table function supports projection pushdown. Defaults to false.
+ *
+ * With projection pushdown, the engine asks the function for only the columns a query actually uses: the exec
+ * callback's output chunk holds one vector per requested column rather than one per column declared in bind, and the
+ * global init, local init and exec callbacks can look up which declared column each vector stands for via e.g.
+ * `duckdb_v2_table_function_exec_get_column_index()`. Without it the output chunk always holds every declared column,
+ * and the engine drops the unused ones itself.
+ *
+ * history:
+ * - unstable: v2.0.0
+ *
+ * @param function The function to configure.
+ * @param enable Whether the function supports projection pushdown.
+ * @param err Optional. On failure, receives an opaque info handle the caller must destroy via
+ * `duckdb_v2_error_info_destroy()`.
+ * @return DUCKDB_V2_ERROR
+ */
+DUCKDB_C_API DUCKDB_V2_ERROR duckdb_v2_table_function_set_projection_pushdown(duckdb_v2_table_function_handle function,
+                                                                              bool enable,
+                                                                              duckdb_v2_error_info_handle *err);
+#endif
+
+#if DUCKDB_V2_API_ALLOW_UNSTABLE
+/*!
+ * Sets the optional filter pushdown callback of the table function.
+ *
+ * The filter pushdown callback is invoked while the query is optimized, after the bind callback and before any init
+ * callback, with the filter predicates the query applies to the function's rows. Each predicate is a bound expression
+ * the callback can inspect with the `expression` functions; the callback accepts the predicates it will apply itself
+ * via `duckdb_v2_table_function_filter_pushdown_accept()`, typically after recording what they select in the bind data.
+ * The engine then stops applying the accepted predicates and keeps applying the rest above the scan, so accepting a
+ * predicate is a promise to filter the rows exactly as it would have. The optimizer may invoke the callback more than
+ * once for the same query, each time with the predicates not yet accepted; it is not invoked when there are none.
+ *
+ * history:
+ * - unstable: v2.0.0
+ *
+ * @param function The function to set the filter pushdown callback of.
+ * @param callback The filter pushdown callback to set.
+ * @param err Optional. On failure, receives an opaque info handle the caller must destroy via
+ * `duckdb_v2_error_info_destroy()`.
+ * @return DUCKDB_V2_ERROR
+ */
+DUCKDB_C_API DUCKDB_V2_ERROR duckdb_v2_table_function_set_filter_pushdown_callback(
+    duckdb_v2_table_function_handle function, duckdb_v2_table_function_filter_pushdown_callback_fn callback,
+    duckdb_v2_error_info_handle *err);
+#endif
+
+#if DUCKDB_V2_API_ALLOW_UNSTABLE
+/*!
+ * Sets the optional "partition data" callback of the table function.
+ *
+ * The callback reports, for the batch the exec callback just produced, an ordering batch index, the values of a set of
+ * partitioning columns, or both, depending on what a downstream operator requires; it runs on the worker thread that
+ * produced the batch. Set `duckdb_v2_table_function_set_partitioning_callback()` too when the function can answer
+ * partitioning-column requests, since the engine only asks a scan for those when that callback reports
+ * `TABLE_PARTITION_INFO_SINGLE_VALUE_PARTITIONS`.
+ *
+ * history:
+ * - unstable: v2.0.0
+ *
+ * @param function The function to set the partition data callback of.
+ * @param callback The partition data callback to set.
+ * @param err Optional. On failure, receives an opaque info handle the caller must destroy via
+ * `duckdb_v2_error_info_destroy()`.
+ * @return DUCKDB_V2_ERROR
+ */
+DUCKDB_C_API DUCKDB_V2_ERROR duckdb_v2_table_function_set_partition_data_callback(
+    duckdb_v2_table_function_handle function, duckdb_v2_table_function_partition_data_callback_fn callback,
+    duckdb_v2_error_info_handle *err);
+#endif
+
+#if DUCKDB_V2_API_ALLOW_UNSTABLE
+/*!
+ * Sets the optional "partitioning" callback of the table function.
+ *
+ * The callback tells the query optimizer, for a candidate `GROUP BY` column set, whether every partition the scan
+ * produces carries exactly one distinct value for those columns; only `TABLE_PARTITION_INFO_SINGLE_VALUE_PARTITIONS`
+ * unlocks the partitioned aggregate optimization; any other result, or leaving this callback unset, keeps the regular
+ * hash aggregate. It runs on the planning thread, before execution starts, and must be deterministic for a given column
+ * set since it may be called on a plan the optimizer later discards. Registration fails unless
+ * `duckdb_v2_table_function_set_partition_data_callback()` is set too, since the engine asks that callback for the
+ * partitioning column values once this one claims single-value partitions.
+ *
+ * history:
+ * - unstable: v2.0.0
+ *
+ * @param function The function to set the partitioning callback of.
+ * @param callback The partitioning callback to set.
+ * @param err Optional. On failure, receives an opaque info handle the caller must destroy via
+ * `duckdb_v2_error_info_destroy()`.
+ * @return DUCKDB_V2_ERROR
+ */
+DUCKDB_C_API DUCKDB_V2_ERROR duckdb_v2_table_function_set_partitioning_callback(
+    duckdb_v2_table_function_handle function, duckdb_v2_table_function_partitioning_callback_fn callback,
+    duckdb_v2_error_info_handle *err);
+#endif
+
+#if DUCKDB_V2_API_ALLOW_UNSTABLE
+/*!
+ * Declares one of the columns the function returns.
+ *
+ * Call this once per column, in order: the columns declared here are the columns of the table the function produces,
+ * and the vectors of the output chunk the exec callback fills follow the same order. At least one column must be
+ * declared. The type must be a fully defined concrete type; ANY is rejected, as a result column carries data. The name
+ * and type are borrowed and copied.
+ *
+ * history:
+ * - unstable: v2.0.0
+ *
+ * @param info The bind info handle.
+ * @param name The name of the column. Borrowed and copied.
+ * @param type The type of the column. Borrowed and copied.
+ * @param err Optional. On failure, receives an opaque info handle the caller must destroy via
+ * `duckdb_v2_error_info_destroy()`.
+ * @return DUCKDB_V2_ERROR
+ */
+DUCKDB_C_API DUCKDB_V2_ERROR duckdb_v2_table_function_bind_add_result_column(
+    duckdb_v2_table_function_bind_info_handle info, const duckdb_v2_identifier_t *name,
+    duckdb_v2_logical_type_handle type, duckdb_v2_error_info_handle *err);
+#endif
+
+#if DUCKDB_V2_API_ALLOW_UNSTABLE
+/*!
+ * Sets the estimated number of rows the scan will produce.
+ *
+ * The estimate is a hint for the optimizer, not a limit: producing a different number of rows is not an error. Without
+ * it, the optimizer falls back on its own defaults.
+ *
+ * history:
+ * - unstable: v2.0.0
+ *
+ * @param info The bind info handle.
+ * @param cardinality The estimated number of rows.
+ * @param is_exact Whether the estimate is exact, which also makes it an upper bound on the row count.
+ * @param err Optional. On failure, receives an opaque info handle the caller must destroy via
+ * `duckdb_v2_error_info_destroy()`.
+ * @return DUCKDB_V2_ERROR
+ */
+DUCKDB_C_API DUCKDB_V2_ERROR duckdb_v2_table_function_bind_set_cardinality(
+    duckdb_v2_table_function_bind_info_handle info, idx_t cardinality, bool is_exact, duckdb_v2_error_info_handle *err);
+#endif
+
+#if DUCKDB_V2_API_ALLOW_UNSTABLE
+/*!
+ * Sets the order guarantee of the rows this call of the function produces. Defaults to
+ * `ORDER_PRESERVATION_INSERTION_ORDER`.
+ *
+ * With `ORDER_PRESERVATION_NO_ORDER`, a scan that reports more than one thread via
+ * `duckdb_v2_table_function_init_global_set_max_threads()` runs in parallel into query results, INSERT and COPY without
+ * a `duckdb_v2_table_function_set_partition_data_callback()`, and the rows arrive in no particular order. With
+ * insertion order kept, those consumers need the partition data callback to run in parallel. Fails with
+ * `ERROR_INPUT_INVALID` when order is not one of the enum's declared values.
+ *
+ * history:
+ * - unstable: v2.0.0
+ *
+ * @param info The bind info handle.
+ * @param order The order guarantee of the produced rows.
+ * @param err Optional. On failure, receives an opaque info handle the caller must destroy via
+ * `duckdb_v2_error_info_destroy()`.
+ * @return DUCKDB_V2_ERROR
+ */
+DUCKDB_C_API DUCKDB_V2_ERROR duckdb_v2_table_function_bind_set_order_preservation(
+    duckdb_v2_table_function_bind_info_handle info, DUCKDB_V2_ORDER_PRESERVATION order,
+    duckdb_v2_error_info_handle *err);
+#endif
+
+#if DUCKDB_V2_API_ALLOW_UNSTABLE
+/*!
+ * Retrieves the user data set via `duckdb_v2_table_function_set_user_data()`.
+ *
+ * history:
+ * - unstable: v2.0.0
+ *
+ * @param info The global init info handle.
+ * @param data Receives the user data pointer, or null if none was set.
+ * @param err Optional. On failure, receives an opaque info handle the caller must destroy via
+ * `duckdb_v2_error_info_destroy()`.
+ * @return DUCKDB_V2_ERROR
+ */
+DUCKDB_C_API DUCKDB_V2_ERROR duckdb_v2_table_function_init_global_get_user_data(
+    duckdb_v2_table_function_init_global_info_handle info, void **data, duckdb_v2_error_info_handle *err);
+#endif
+
+#if DUCKDB_V2_API_ALLOW_UNSTABLE
+/*!
+ * Retrieves the bind data set by the function's bind callback.
+ *
+ * history:
+ * - unstable: v2.0.0
+ *
+ * @param info The global init info handle.
+ * @param data Receives the bind data pointer, or null if none was set.
+ * @param err Optional. On failure, receives an opaque info handle the caller must destroy via
+ * `duckdb_v2_error_info_destroy()`.
+ * @return DUCKDB_V2_ERROR
+ */
+DUCKDB_C_API DUCKDB_V2_ERROR duckdb_v2_table_function_init_global_get_bind_data(
+    duckdb_v2_table_function_init_global_info_handle info, void **data, duckdb_v2_error_info_handle *err);
+#endif
+
+#if DUCKDB_V2_API_ALLOW_UNSTABLE
+/*!
+ * Sets the function's "global state" from the global init callback.
+ *
+ * The global state lives for the duration of the scan and is retrievable from the local init, exec and progress
+ * callbacks. Every thread scanning the function shares it, so the function must synchronize its own access to it. The
+ * opaque handle bundles the pointer with an optional destructor, invoked when the scan is done with the state.
+ *
+ * history:
+ * - unstable: v2.0.0
+ *
+ * @param info The global init info handle.
+ * @param data Opaque handle bundling the global state pointer plus an optional destructor.
+ * @param err Optional. On failure, receives an opaque info handle the caller must destroy via
+ * `duckdb_v2_error_info_destroy()`.
+ * @return DUCKDB_V2_ERROR
+ */
+DUCKDB_C_API DUCKDB_V2_ERROR duckdb_v2_table_function_init_global_set_global_state(
+    duckdb_v2_table_function_init_global_info_handle info, duckdb_v2_opaque *data, duckdb_v2_error_info_handle *err);
+#endif
+
+#if DUCKDB_V2_API_ALLOW_UNSTABLE
+/*!
+ * Sets how many threads may scan the function in parallel.
+ *
+ * Defaults to 1, a single-threaded scan. The engine creates at most this many local states, and therefore runs at most
+ * this many exec callbacks concurrently. It is an upper bound, not a request: the engine may use fewer threads.
+ *
+ * history:
+ * - unstable: v2.0.0
+ *
+ * @param info The global init info handle.
+ * @param max_threads The maximum number of threads. Must be at least 1.
+ * @param err Optional. On failure, receives an opaque info handle the caller must destroy via
+ * `duckdb_v2_error_info_destroy()`.
+ * @return DUCKDB_V2_ERROR
+ */
+DUCKDB_C_API DUCKDB_V2_ERROR duckdb_v2_table_function_init_global_set_max_threads(
+    duckdb_v2_table_function_init_global_info_handle info, idx_t max_threads, duckdb_v2_error_info_handle *err);
+#endif
+
+#if DUCKDB_V2_API_ALLOW_UNSTABLE
+/*!
+ * Returns the number of columns the scan produces.
+ *
+ * With projection pushdown (see `duckdb_v2_table_function_set_projection_pushdown()`) this is the number of columns the
+ * query uses, which is the number of vectors in the exec callback's output chunk; without it, it is the number of
+ * columns declared in bind. Valid indices for `duckdb_v2_table_function_init_global_get_column_index()` are `0` up to
+ * (but excluding) this count.
+ *
+ * history:
+ * - unstable: v2.0.0
+ *
+ * @param info The global init info handle.
+ * @param count Receives the number of columns the scan produces.
+ * @param err Optional. On failure, receives an opaque info handle the caller must destroy via
+ * `duckdb_v2_error_info_destroy()`.
+ * @return DUCKDB_V2_ERROR
+ */
+DUCKDB_C_API DUCKDB_V2_ERROR duckdb_v2_table_function_init_global_get_column_count(
+    duckdb_v2_table_function_init_global_info_handle info, idx_t *count, duckdb_v2_error_info_handle *err);
+#endif
+
+#if DUCKDB_V2_API_ALLOW_UNSTABLE
+/*!
+ * Returns which declared column the scan's column at the given index stands for.
+ *
+ * The result indexes the columns declared with `duckdb_v2_table_function_bind_add_result_column()`, in declaration
+ * order: the exec callback fills the output chunk's vector at `index` with that column's data. Without projection
+ * pushdown the mapping is the identity. Fails if the index is out of bounds.
+ *
+ * history:
+ * - unstable: v2.0.0
+ *
+ * @param info The global init info handle.
+ * @param index The index of the column in the scan's output.
+ * @param column_index Receives the index of the declared column.
+ * @param err Optional. On failure, receives an opaque info handle the caller must destroy via
+ * `duckdb_v2_error_info_destroy()`.
+ * @return DUCKDB_V2_ERROR
+ */
+DUCKDB_C_API DUCKDB_V2_ERROR duckdb_v2_table_function_init_global_get_column_index(
+    duckdb_v2_table_function_init_global_info_handle info, idx_t index, idx_t *column_index,
+    duckdb_v2_error_info_handle *err);
+#endif
+
+#if DUCKDB_V2_API_ALLOW_UNSTABLE
+/*!
+ * Retrieves the user data set via `duckdb_v2_table_function_set_user_data()`.
+ *
+ * history:
+ * - unstable: v2.0.0
+ *
+ * @param info The local init info handle.
+ * @param data Receives the user data pointer, or null if none was set.
+ * @param err Optional. On failure, receives an opaque info handle the caller must destroy via
+ * `duckdb_v2_error_info_destroy()`.
+ * @return DUCKDB_V2_ERROR
+ */
+DUCKDB_C_API DUCKDB_V2_ERROR duckdb_v2_table_function_init_local_get_user_data(
+    duckdb_v2_table_function_init_local_info_handle info, void **data, duckdb_v2_error_info_handle *err);
+#endif
+
+#if DUCKDB_V2_API_ALLOW_UNSTABLE
+/*!
+ * Retrieves the bind data set by the function's bind callback.
+ *
+ * history:
+ * - unstable: v2.0.0
+ *
+ * @param info The local init info handle.
+ * @param data Receives the bind data pointer, or null if none was set.
+ * @param err Optional. On failure, receives an opaque info handle the caller must destroy via
+ * `duckdb_v2_error_info_destroy()`.
+ * @return DUCKDB_V2_ERROR
+ */
+DUCKDB_C_API DUCKDB_V2_ERROR duckdb_v2_table_function_init_local_get_bind_data(
+    duckdb_v2_table_function_init_local_info_handle info, void **data, duckdb_v2_error_info_handle *err);
+#endif
+
+#if DUCKDB_V2_API_ALLOW_UNSTABLE
+/*!
+ * Retrieves the global state set by the function's global init callback.
+ *
+ * Shared with every other thread scanning the function; access to it must be synchronized by the function.
+ *
+ * history:
+ * - unstable: v2.0.0
+ *
+ * @param info The local init info handle.
+ * @param data Receives the global state pointer, or null if none was set.
+ * @param err Optional. On failure, receives an opaque info handle the caller must destroy via
+ * `duckdb_v2_error_info_destroy()`.
+ * @return DUCKDB_V2_ERROR
+ */
+DUCKDB_C_API DUCKDB_V2_ERROR duckdb_v2_table_function_init_local_get_global_state(
+    duckdb_v2_table_function_init_local_info_handle info, void **data, duckdb_v2_error_info_handle *err);
+#endif
+
+#if DUCKDB_V2_API_ALLOW_UNSTABLE
+/*!
+ * Sets the function's worker-local "local state" from the local init callback.
+ *
+ * The local state is associated with the executing thread for the duration of the scan and retrievable from the exec
+ * callback via `duckdb_v2_table_function_exec_get_local_state()`. No other thread observes it, so it needs no
+ * synchronization. The opaque handle bundles the pointer with an optional destructor, invoked when the local state is
+ * no longer needed.
+ *
+ * history:
+ * - unstable: v2.0.0
+ *
+ * @param info The local init info handle.
+ * @param data Opaque handle bundling the local state pointer plus an optional destructor.
+ * @param err Optional. On failure, receives an opaque info handle the caller must destroy via
+ * `duckdb_v2_error_info_destroy()`.
+ * @return DUCKDB_V2_ERROR
+ */
+DUCKDB_C_API DUCKDB_V2_ERROR duckdb_v2_table_function_init_local_set_local_state(
+    duckdb_v2_table_function_init_local_info_handle info, duckdb_v2_opaque *data, duckdb_v2_error_info_handle *err);
+#endif
+
+#if DUCKDB_V2_API_ALLOW_UNSTABLE
+/*!
+ * Returns the number of columns the scan produces.
+ *
+ * With projection pushdown (see `duckdb_v2_table_function_set_projection_pushdown()`) this is the number of columns the
+ * query uses, which is the number of vectors in the exec callback's output chunk; without it, it is the number of
+ * columns declared in bind. Valid indices for `duckdb_v2_table_function_init_local_get_column_index()` are `0` up to
+ * (but excluding) this count.
+ *
+ * history:
+ * - unstable: v2.0.0
+ *
+ * @param info The local init info handle.
+ * @param count Receives the number of columns the scan produces.
+ * @param err Optional. On failure, receives an opaque info handle the caller must destroy via
+ * `duckdb_v2_error_info_destroy()`.
+ * @return DUCKDB_V2_ERROR
+ */
+DUCKDB_C_API DUCKDB_V2_ERROR duckdb_v2_table_function_init_local_get_column_count(
+    duckdb_v2_table_function_init_local_info_handle info, idx_t *count, duckdb_v2_error_info_handle *err);
+#endif
+
+#if DUCKDB_V2_API_ALLOW_UNSTABLE
+/*!
+ * Returns which declared column the scan's column at the given index stands for.
+ *
+ * The result indexes the columns declared with `duckdb_v2_table_function_bind_add_result_column()`, in declaration
+ * order: the exec callback fills the output chunk's vector at `index` with that column's data. Without projection
+ * pushdown the mapping is the identity. Fails if the index is out of bounds.
+ *
+ * history:
+ * - unstable: v2.0.0
+ *
+ * @param info The local init info handle.
+ * @param index The index of the column in the scan's output.
+ * @param column_index Receives the index of the declared column.
+ * @param err Optional. On failure, receives an opaque info handle the caller must destroy via
+ * `duckdb_v2_error_info_destroy()`.
+ * @return DUCKDB_V2_ERROR
+ */
+DUCKDB_C_API DUCKDB_V2_ERROR
+duckdb_v2_table_function_init_local_get_column_index(duckdb_v2_table_function_init_local_info_handle info, idx_t index,
+                                                     idx_t *column_index, duckdb_v2_error_info_handle *err);
+#endif
+
+#if DUCKDB_V2_API_ALLOW_UNSTABLE
+/*!
+ * Retrieves the user data set via `duckdb_v2_table_function_set_user_data()`.
+ *
+ * history:
+ * - unstable: v2.0.0
+ *
+ * @param info The exec info handle.
+ * @param data Receives the user data pointer, or null if none was set.
+ * @param err Optional. On failure, receives an opaque info handle the caller must destroy via
+ * `duckdb_v2_error_info_destroy()`.
+ * @return DUCKDB_V2_ERROR
+ */
+DUCKDB_C_API DUCKDB_V2_ERROR duckdb_v2_table_function_exec_get_user_data(duckdb_v2_table_function_exec_info_handle info,
+                                                                         void **data, duckdb_v2_error_info_handle *err);
+#endif
+
+#if DUCKDB_V2_API_ALLOW_UNSTABLE
+/*!
+ * Retrieves the bind data set by the function's bind callback.
+ *
+ * history:
+ * - unstable: v2.0.0
+ *
+ * @param info The exec info handle.
+ * @param data Receives the bind data pointer, or null if none was set.
+ * @param err Optional. On failure, receives an opaque info handle the caller must destroy via
+ * `duckdb_v2_error_info_destroy()`.
+ * @return DUCKDB_V2_ERROR
+ */
+DUCKDB_C_API DUCKDB_V2_ERROR duckdb_v2_table_function_exec_get_bind_data(duckdb_v2_table_function_exec_info_handle info,
+                                                                         void **data, duckdb_v2_error_info_handle *err);
+#endif
+
+#if DUCKDB_V2_API_ALLOW_UNSTABLE
+/*!
+ * Retrieves the global state set by the function's global init callback.
+ *
+ * Shared with every other thread scanning the function; access to it must be synchronized by the function.
+ *
+ * history:
+ * - unstable: v2.0.0
+ *
+ * @param info The exec info handle.
+ * @param data Receives the global state pointer, or null if none was set.
+ * @param err Optional. On failure, receives an opaque info handle the caller must destroy via
+ * `duckdb_v2_error_info_destroy()`.
+ * @return DUCKDB_V2_ERROR
+ */
+DUCKDB_C_API DUCKDB_V2_ERROR duckdb_v2_table_function_exec_get_global_state(
+    duckdb_v2_table_function_exec_info_handle info, void **data, duckdb_v2_error_info_handle *err);
+#endif
+
+#if DUCKDB_V2_API_ALLOW_UNSTABLE
+/*!
+ * Retrieves the worker-local local state set by the function's local init callback.
+ *
+ * history:
+ * - unstable: v2.0.0
+ *
+ * @param info The exec info handle.
+ * @param data Receives the local state pointer for the executing thread, or null if none was set.
+ * @param err Optional. On failure, receives an opaque info handle the caller must destroy via
+ * `duckdb_v2_error_info_destroy()`.
+ * @return DUCKDB_V2_ERROR
+ */
+DUCKDB_C_API DUCKDB_V2_ERROR duckdb_v2_table_function_exec_get_local_state(
+    duckdb_v2_table_function_exec_info_handle info, void **data, duckdb_v2_error_info_handle *err);
+#endif
+
+#if DUCKDB_V2_API_ALLOW_UNSTABLE
+/*!
+ * Retrieves the output chunk the exec callback must write the next batch of rows into.
+ *
+ * The chunk holds one vector per column declared with `duckdb_v2_table_function_bind_add_result_column()`, in the same
+ * order; reach them with `duckdb_v2_data_chunk_get_vector()`. The chunk starts out empty on every invocation: write the
+ * rows, then declare how many there are with `duckdb_v2_vector_set_size()` on the first vector, which the engine takes
+ * as the batch's row count and propagates to the other vectors. Producing an empty batch signals the end of the scan,
+ * after which the callback is not invoked again on that thread. Borrowed; valid only for the duration of the callback.
+ *
+ * history:
+ * - unstable: v2.0.0
+ *
+ * @param info The exec info handle.
+ * @param chunk Receives the borrowed output chunk to write into.
+ * @param err Optional. On failure, receives an opaque info handle the caller must destroy via
+ * `duckdb_v2_error_info_destroy()`.
+ * @return DUCKDB_V2_ERROR
+ */
+DUCKDB_C_API DUCKDB_V2_ERROR
+duckdb_v2_table_function_exec_get_output_chunk(duckdb_v2_table_function_exec_info_handle info,
+                                               duckdb_v2_data_chunk_handle *chunk, duckdb_v2_error_info_handle *err);
+#endif
+
+#if DUCKDB_V2_API_ALLOW_UNSTABLE
+/*!
+ * Returns the number of columns the scan produces.
+ *
+ * With projection pushdown (see `duckdb_v2_table_function_set_projection_pushdown()`) this is the number of columns the
+ * query uses, which is the number of vectors in the exec callback's output chunk; without it, it is the number of
+ * columns declared in bind. Valid indices for `duckdb_v2_table_function_exec_get_column_index()` are `0` up to (but
+ * excluding) this count.
+ *
+ * history:
+ * - unstable: v2.0.0
+ *
+ * @param info The exec info handle.
+ * @param count Receives the number of columns the scan produces.
+ * @param err Optional. On failure, receives an opaque info handle the caller must destroy via
+ * `duckdb_v2_error_info_destroy()`.
+ * @return DUCKDB_V2_ERROR
+ */
+DUCKDB_C_API DUCKDB_V2_ERROR duckdb_v2_table_function_exec_get_column_count(
+    duckdb_v2_table_function_exec_info_handle info, idx_t *count, duckdb_v2_error_info_handle *err);
+#endif
+
+#if DUCKDB_V2_API_ALLOW_UNSTABLE
+/*!
+ * Returns which declared column the scan's column at the given index stands for.
+ *
+ * The result indexes the columns declared with `duckdb_v2_table_function_bind_add_result_column()`, in declaration
+ * order: the exec callback fills the output chunk's vector at `index` with that column's data. Without projection
+ * pushdown the mapping is the identity. Fails if the index is out of bounds.
+ *
+ * history:
+ * - unstable: v2.0.0
+ *
+ * @param info The exec info handle.
+ * @param index The index of the column in the scan's output.
+ * @param column_index Receives the index of the declared column.
+ * @param err Optional. On failure, receives an opaque info handle the caller must destroy via
+ * `duckdb_v2_error_info_destroy()`.
+ * @return DUCKDB_V2_ERROR
+ */
+DUCKDB_C_API DUCKDB_V2_ERROR duckdb_v2_table_function_exec_get_column_index(
+    duckdb_v2_table_function_exec_info_handle info, idx_t index, idx_t *column_index, duckdb_v2_error_info_handle *err);
+#endif
+
+#if DUCKDB_V2_API_ALLOW_UNSTABLE
+/*!
+ * Retrieves the user data set via `duckdb_v2_table_function_set_user_data()`.
+ *
+ * history:
+ * - unstable: v2.0.0
+ *
+ * @param info The progress info handle.
+ * @param data Receives the user data pointer, or null if none was set.
+ * @param err Optional. On failure, receives an opaque info handle the caller must destroy via
+ * `duckdb_v2_error_info_destroy()`.
+ * @return DUCKDB_V2_ERROR
+ */
+DUCKDB_C_API DUCKDB_V2_ERROR duckdb_v2_table_function_progress_get_user_data(
+    duckdb_v2_table_function_progress_info_handle info, void **data, duckdb_v2_error_info_handle *err);
+#endif
+
+#if DUCKDB_V2_API_ALLOW_UNSTABLE
+/*!
+ * Retrieves the bind data set by the function's bind callback.
+ *
+ * history:
+ * - unstable: v2.0.0
+ *
+ * @param info The progress info handle.
+ * @param data Receives the bind data pointer, or null if none was set.
+ * @param err Optional. On failure, receives an opaque info handle the caller must destroy via
+ * `duckdb_v2_error_info_destroy()`.
+ * @return DUCKDB_V2_ERROR
+ */
+DUCKDB_C_API DUCKDB_V2_ERROR duckdb_v2_table_function_progress_get_bind_data(
+    duckdb_v2_table_function_progress_info_handle info, void **data, duckdb_v2_error_info_handle *err);
+#endif
+
+#if DUCKDB_V2_API_ALLOW_UNSTABLE
+/*!
+ * Retrieves the global state set by the function's global init callback.
+ *
+ * The progress callback runs concurrently with the exec callbacks scanning the function, so it must read the global
+ * state in a thread-safe way.
+ *
+ * history:
+ * - unstable: v2.0.0
+ *
+ * @param info The progress info handle.
+ * @param data Receives the global state pointer, or null if none was set.
+ * @param err Optional. On failure, receives an opaque info handle the caller must destroy via
+ * `duckdb_v2_error_info_destroy()`.
+ * @return DUCKDB_V2_ERROR
+ */
+DUCKDB_C_API DUCKDB_V2_ERROR duckdb_v2_table_function_progress_get_global_state(
+    duckdb_v2_table_function_progress_info_handle info, void **data, duckdb_v2_error_info_handle *err);
+#endif
+
+#if DUCKDB_V2_API_ALLOW_UNSTABLE
+/*!
+ * Reports how far the scan has advanced.
+ *
+ * A fraction between 0.0 (nothing scanned yet) and 1.0 (done); values outside that range are clamped. A progress
+ * callback that returns without calling this reports no progress.
+ *
+ * history:
+ * - unstable: v2.0.0
+ *
+ * @param info The progress info handle.
+ * @param progress The fraction of the scan that is complete, in [0.0, 1.0].
+ * @param err Optional. On failure, receives an opaque info handle the caller must destroy via
+ * `duckdb_v2_error_info_destroy()`.
+ * @return DUCKDB_V2_ERROR
+ */
+DUCKDB_C_API DUCKDB_V2_ERROR duckdb_v2_table_function_progress_set_progress(
+    duckdb_v2_table_function_progress_info_handle info, double progress, duckdb_v2_error_info_handle *err);
+#endif
+
+#if DUCKDB_V2_API_ALLOW_UNSTABLE
+/*!
+ * Retrieves the user data set via `duckdb_v2_table_function_set_user_data()`, or null if none was set.
+ *
+ * history:
+ * - unstable: v2.0.0
+ *
+ * @param info The filter pushdown info handle.
+ * @param data Receives the user data pointer.
+ * @param err Optional. On failure, receives an opaque info handle the caller must destroy via
+ * `duckdb_v2_error_info_destroy()`.
+ * @return DUCKDB_V2_ERROR
+ */
+DUCKDB_C_API DUCKDB_V2_ERROR duckdb_v2_table_function_filter_pushdown_get_user_data(
+    duckdb_v2_table_function_filter_pushdown_info_handle info, void **data, duckdb_v2_error_info_handle *err);
+#endif
+
+#if DUCKDB_V2_API_ALLOW_UNSTABLE
+/*!
+ * Retrieves the bind data set via `duckdb_v2_function_bind_set_bind_data()`, or null if none was set.
+ *
+ * This is the same object the init and exec callbacks later receive, so a predicate the callback accepts can be
+ * recorded in it for the scan to apply.
+ *
+ * history:
+ * - unstable: v2.0.0
+ *
+ * @param info The filter pushdown info handle.
+ * @param data Receives the bind data pointer.
+ * @param err Optional. On failure, receives an opaque info handle the caller must destroy via
+ * `duckdb_v2_error_info_destroy()`.
+ * @return DUCKDB_V2_ERROR
+ */
+DUCKDB_C_API DUCKDB_V2_ERROR duckdb_v2_table_function_filter_pushdown_get_bind_data(
+    duckdb_v2_table_function_filter_pushdown_info_handle info, void **data, duckdb_v2_error_info_handle *err);
+#endif
+
+#if DUCKDB_V2_API_ALLOW_UNSTABLE
+/*!
+ * Returns the number of filter predicates offered to the function.
+ *
+ * The predicates are combined with `AND`: every row the scan produces must satisfy all of them. Valid indices for
+ * `duckdb_v2_table_function_filter_pushdown_get_filter()` and `duckdb_v2_table_function_filter_pushdown_accept()` are
+ * `0` up to (but excluding) this count.
+ *
+ * history:
+ * - unstable: v2.0.0
+ *
+ * @param info The filter pushdown info handle.
+ * @param count Receives the number of predicates.
+ * @param err Optional. On failure, receives an opaque info handle the caller must destroy via
+ * `duckdb_v2_error_info_destroy()`.
+ * @return DUCKDB_V2_ERROR
+ */
+DUCKDB_C_API DUCKDB_V2_ERROR duckdb_v2_table_function_filter_pushdown_get_filter_count(
+    duckdb_v2_table_function_filter_pushdown_info_handle info, idx_t *count, duckdb_v2_error_info_handle *err);
+#endif
+
+#if DUCKDB_V2_API_ALLOW_UNSTABLE
+/*!
+ * Retrieves the filter predicate at the given index.
+ *
+ * Fails if the index is out of bounds. The predicate is a bound expression evaluating to `BOOLEAN`; inspect it with
+ * `duckdb_v2_expression_get_type()` and the other `expression` functions, and resolve the column references it contains
+ * via `duckdb_v2_table_function_filter_pushdown_get_column_index()`. Borrowed; valid only for the duration of the
+ * callback.
+ *
+ * history:
+ * - unstable: v2.0.0
+ *
+ * @param info The filter pushdown info handle.
+ * @param index The index of the predicate to retrieve.
+ * @param filter Receives the borrowed predicate.
+ * @param err Optional. On failure, receives an opaque info handle the caller must destroy via
+ * `duckdb_v2_error_info_destroy()`.
+ * @return DUCKDB_V2_ERROR
+ */
+DUCKDB_C_API DUCKDB_V2_ERROR duckdb_v2_table_function_filter_pushdown_get_filter(
+    duckdb_v2_table_function_filter_pushdown_info_handle info, idx_t index, duckdb_v2_expression_handle *filter,
+    duckdb_v2_error_info_handle *err);
+#endif
+
+#if DUCKDB_V2_API_ALLOW_UNSTABLE
+/*!
+ * Accepts the filter predicate at the given index: the function will apply it itself.
+ *
+ * The engine stops applying an accepted predicate, so the scan must produce only rows that satisfy it, or the query
+ * returns rows it should not. Predicates left unaccepted are applied by the engine as usual, so a callback that
+ * recognizes nothing can simply return. Fails if the index is out of bounds.
+ *
+ * history:
+ * - unstable: v2.0.0
+ *
+ * @param info The filter pushdown info handle.
+ * @param index The index of the predicate to accept.
+ * @param err Optional. On failure, receives an opaque info handle the caller must destroy via
+ * `duckdb_v2_error_info_destroy()`.
+ * @return DUCKDB_V2_ERROR
+ */
+DUCKDB_C_API DUCKDB_V2_ERROR duckdb_v2_table_function_filter_pushdown_accept(
+    duckdb_v2_table_function_filter_pushdown_info_handle info, idx_t index, duckdb_v2_error_info_handle *err);
+#endif
+
+#if DUCKDB_V2_API_ALLOW_UNSTABLE
+/*!
+ * Returns the number of columns the predicates can refer to.
+ *
+ * A column reference inside a predicate (`duckdb_v2_expression_column_ref_get_index()`) indexes the columns the query
+ * reads from the function, not the columns declared in bind. Valid indices for
+ * `duckdb_v2_table_function_filter_pushdown_get_column_index()` are `0` up to (but excluding) this count.
+ *
+ * history:
+ * - unstable: v2.0.0
+ *
+ * @param info The filter pushdown info handle.
+ * @param count Receives the number of referable columns.
+ * @param err Optional. On failure, receives an opaque info handle the caller must destroy via
+ * `duckdb_v2_error_info_destroy()`.
+ * @return DUCKDB_V2_ERROR
+ */
+DUCKDB_C_API DUCKDB_V2_ERROR duckdb_v2_table_function_filter_pushdown_get_column_count(
+    duckdb_v2_table_function_filter_pushdown_info_handle info, idx_t *count, duckdb_v2_error_info_handle *err);
+#endif
+
+#if DUCKDB_V2_API_ALLOW_UNSTABLE
+/*!
+ * Resolves a column reference found in a predicate to the declared column it refers to.
+ *
+ * Takes the index a `EXPRESSION_TYPE_BOUND_COLUMN_REF` node reports and returns the index of the column among the ones
+ * declared with `duckdb_v2_table_function_bind_add_result_column()`, in declaration order. Fails if the index is out of
+ * bounds.
+ *
+ * history:
+ * - unstable: v2.0.0
+ *
+ * @param info The filter pushdown info handle.
+ * @param index The column index reported by a column reference node.
+ * @param column_index Receives the index of the declared column.
+ * @param err Optional. On failure, receives an opaque info handle the caller must destroy via
+ * `duckdb_v2_error_info_destroy()`.
+ * @return DUCKDB_V2_ERROR
+ */
+DUCKDB_C_API DUCKDB_V2_ERROR duckdb_v2_table_function_filter_pushdown_get_column_index(
+    duckdb_v2_table_function_filter_pushdown_info_handle info, idx_t index, idx_t *column_index,
+    duckdb_v2_error_info_handle *err);
+#endif
+
+#if DUCKDB_V2_API_ALLOW_UNSTABLE
+/*!
+ * Retrieves the user data set via `duckdb_v2_table_function_set_user_data()`.
+ *
+ * history:
+ * - unstable: v2.0.0
+ *
+ * @param info The partition data info handle.
+ * @param data Receives the user data pointer, or null if none was set.
+ * @param err Optional. On failure, receives an opaque info handle the caller must destroy via
+ * `duckdb_v2_error_info_destroy()`.
+ * @return DUCKDB_V2_ERROR
+ */
+DUCKDB_C_API DUCKDB_V2_ERROR duckdb_v2_table_function_partition_data_get_user_data(
+    duckdb_v2_table_function_partition_data_info_handle info, void **data, duckdb_v2_error_info_handle *err);
+#endif
+
+#if DUCKDB_V2_API_ALLOW_UNSTABLE
+/*!
+ * Retrieves the bind data set by the function's bind callback.
+ *
+ * history:
+ * - unstable: v2.0.0
+ *
+ * @param info The partition data info handle.
+ * @param data Receives the bind data pointer, or null if none was set.
+ * @param err Optional. On failure, receives an opaque info handle the caller must destroy via
+ * `duckdb_v2_error_info_destroy()`.
+ * @return DUCKDB_V2_ERROR
+ */
+DUCKDB_C_API DUCKDB_V2_ERROR duckdb_v2_table_function_partition_data_get_bind_data(
+    duckdb_v2_table_function_partition_data_info_handle info, void **data, duckdb_v2_error_info_handle *err);
+#endif
+
+#if DUCKDB_V2_API_ALLOW_UNSTABLE
+/*!
+ * Retrieves the global state set by the function's global init callback.
+ *
+ * Shared with every other thread scanning the function; access to it must be synchronized by the function.
+ *
+ * history:
+ * - unstable: v2.0.0
+ *
+ * @param info The partition data info handle.
+ * @param data Receives the global state pointer, or null if none was set.
+ * @param err Optional. On failure, receives an opaque info handle the caller must destroy via
+ * `duckdb_v2_error_info_destroy()`.
+ * @return DUCKDB_V2_ERROR
+ */
+DUCKDB_C_API DUCKDB_V2_ERROR duckdb_v2_table_function_partition_data_get_global_state(
+    duckdb_v2_table_function_partition_data_info_handle info, void **data, duckdb_v2_error_info_handle *err);
+#endif
+
+#if DUCKDB_V2_API_ALLOW_UNSTABLE
+/*!
+ * Retrieves the worker-local local state set by the function's local init callback, for the thread that produced the
+ * batch this call reports on. No other thread observes it, so it needs no synchronization.
+ *
+ * history:
+ * - unstable: v2.0.0
+ *
+ * @param info The partition data info handle.
+ * @param data Receives the local state pointer, or null if none was set.
+ * @param err Optional. On failure, receives an opaque info handle the caller must destroy via
+ * `duckdb_v2_error_info_destroy()`.
+ * @return DUCKDB_V2_ERROR
+ */
+DUCKDB_C_API DUCKDB_V2_ERROR duckdb_v2_table_function_partition_data_get_local_state(
+    duckdb_v2_table_function_partition_data_info_handle info, void **data, duckdb_v2_error_info_handle *err);
+#endif
+
+#if DUCKDB_V2_API_ALLOW_UNSTABLE
+/*!
+ * Returns whether a downstream operator needs this batch's ordering position.
+ *
+ * `duckdb_v2_table_function_partition_data_set_batch_index()` must still be called even when this is false: the engine
+ * validates the reported value regardless of whether it is actually used for ordering, so `0` is always a safe answer
+ * when this reports false.
+ *
+ * history:
+ * - unstable: v2.0.0
+ *
+ * @param info The partition data info handle.
+ * @param required Receives whether a batch index is required.
+ * @param err Optional. On failure, receives an opaque info handle the caller must destroy via
+ * `duckdb_v2_error_info_destroy()`.
+ * @return DUCKDB_V2_ERROR
+ */
+DUCKDB_C_API DUCKDB_V2_ERROR duckdb_v2_table_function_partition_data_requires_batch_index(
+    duckdb_v2_table_function_partition_data_info_handle info, bool *required, duckdb_v2_error_info_handle *err);
+#endif
+
+#if DUCKDB_V2_API_ALLOW_UNSTABLE
+/*!
+ * Returns whether a downstream operator needs this batch's values for a set of partitioning columns.
+ *
+ * When true, call `duckdb_v2_table_function_partition_data_set_partition_value()` once for every index in `[0, count)`,
+ * where `count` comes from `duckdb_v2_table_function_partition_data_get_partition_column_count()`.
+ *
+ * history:
+ * - unstable: v2.0.0
+ *
+ * @param info The partition data info handle.
+ * @param required Receives whether partitioning column values are required.
+ * @param err Optional. On failure, receives an opaque info handle the caller must destroy via
+ * `duckdb_v2_error_info_destroy()`.
+ * @return DUCKDB_V2_ERROR
+ */
+DUCKDB_C_API DUCKDB_V2_ERROR duckdb_v2_table_function_partition_data_requires_partition_columns(
+    duckdb_v2_table_function_partition_data_info_handle info, bool *required, duckdb_v2_error_info_handle *err);
+#endif
+
+#if DUCKDB_V2_API_ALLOW_UNSTABLE
+/*!
+ * Returns the number of partitioning columns a downstream operator is requesting values for.
+ *
+ * `0` when `duckdb_v2_table_function_partition_data_requires_partition_columns()` is false. Valid indices for
+ * `duckdb_v2_table_function_partition_data_get_partition_column_index()` and
+ * `duckdb_v2_table_function_partition_data_set_partition_value()` are `0` up to (but excluding) this count.
+ *
+ * history:
+ * - unstable: v2.0.0
+ *
+ * @param info The partition data info handle.
+ * @param count Receives the number of requested partitioning columns.
+ * @param err Optional. On failure, receives an opaque info handle the caller must destroy via
+ * `duckdb_v2_error_info_destroy()`.
+ * @return DUCKDB_V2_ERROR
+ */
+DUCKDB_C_API DUCKDB_V2_ERROR duckdb_v2_table_function_partition_data_get_partition_column_count(
+    duckdb_v2_table_function_partition_data_info_handle info, idx_t *count, duckdb_v2_error_info_handle *err);
+#endif
+
+#if DUCKDB_V2_API_ALLOW_UNSTABLE
+/*!
+ * Returns which declared column the requested partitioning column at the given index stands for.
+ *
+ * The result indexes the columns declared with `duckdb_v2_table_function_bind_add_result_column()`, in declaration
+ * order. Fails if the index is out of bounds.
+ *
+ * history:
+ * - unstable: v2.0.0
+ *
+ * @param info The partition data info handle.
+ * @param index The index of the requested partitioning column.
+ * @param column_index Receives the index of the declared column.
+ * @param err Optional. On failure, receives an opaque info handle the caller must destroy via
+ * `duckdb_v2_error_info_destroy()`.
+ * @return DUCKDB_V2_ERROR
+ */
+DUCKDB_C_API DUCKDB_V2_ERROR duckdb_v2_table_function_partition_data_get_partition_column_index(
+    duckdb_v2_table_function_partition_data_info_handle info, idx_t index, idx_t *column_index,
+    duckdb_v2_error_info_handle *err);
+#endif
+
+#if DUCKDB_V2_API_ALLOW_UNSTABLE
+/*!
+ * Reports the ordering position of the batch the exec callback just produced.
+ *
+ * Required on every call, whether or not `duckdb_v2_table_function_partition_data_requires_batch_index()` is true: the
+ * engine validates the reported value regardless. Not calling this before the callback returns fails the query; `0` is
+ * always a safe answer when the batch index is not actually required. Must not decrease across successive calls on the
+ * same thread, must be unique across threads for the ordering to be meaningful, must be less than roughly `10^13`, and,
+ * when partitioning column values are also being reported, must change whenever those values change: the engine only
+ * re-reads them when the batch index changes, so reporting a new value under an unchanged batch index is treated as a
+ * caller error rather than applied. Fails with `ERROR_INPUT_INVALID` for an out-of-range value; a decreasing value or
+ * an unchanged value paired with changed partitioning columns fails the query once the callback returns.
+ *
+ * history:
+ * - unstable: v2.0.0
+ *
+ * @param info The partition data info handle.
+ * @param batch_index The batch's ordering position.
+ * @param err Optional. On failure, receives an opaque info handle the caller must destroy via
+ * `duckdb_v2_error_info_destroy()`.
+ * @return DUCKDB_V2_ERROR
+ */
+DUCKDB_C_API DUCKDB_V2_ERROR duckdb_v2_table_function_partition_data_set_batch_index(
+    duckdb_v2_table_function_partition_data_info_handle info, idx_t batch_index, duckdb_v2_error_info_handle *err);
+#endif
+
+#if DUCKDB_V2_API_ALLOW_UNSTABLE
+/*!
+ * Reports the single value of the partitioning column at the given index, for the batch the exec callback just
+ * produced.
+ *
+ * Every partition reported this way carries exactly one distinct value for the column, so the value serves as both the
+ * minimum and maximum of the partition's range. The value is borrowed and copied, and must be of the declared type of
+ * the corresponding result column. Required once for every index in `[0,
+ * `duckdb_v2_table_function_partition_data_get_partition_column_count()`)` before the callback returns; calling it
+ * again for the same index overwrites the previous value. The reported value only takes effect together with a changed
+ * `duckdb_v2_table_function_partition_data_set_batch_index()`: reporting a different value under an unchanged batch
+ * index fails the query once the callback returns. Fails with `ERROR_INPUT_INVALID` when the index is out of bounds or
+ * the value's type does not match.
+ *
+ * history:
+ * - unstable: v2.0.0
+ *
+ * @param info The partition data info handle.
+ * @param index The index of the partitioning column being reported.
+ * @param value The single value of the partitioning column. Borrowed and copied.
+ * @param err Optional. On failure, receives an opaque info handle the caller must destroy via
+ * `duckdb_v2_error_info_destroy()`.
+ * @return DUCKDB_V2_ERROR
+ */
+DUCKDB_C_API DUCKDB_V2_ERROR duckdb_v2_table_function_partition_data_set_partition_value(
+    duckdb_v2_table_function_partition_data_info_handle info, idx_t index, duckdb_v2_value_handle value,
+    duckdb_v2_error_info_handle *err);
+#endif
+
+#if DUCKDB_V2_API_ALLOW_UNSTABLE
+/*!
+ * Retrieves the user data set via `duckdb_v2_table_function_set_user_data()`.
+ *
+ * history:
+ * - unstable: v2.0.0
+ *
+ * @param info The partitioning info handle.
+ * @param data Receives the user data pointer, or null if none was set.
+ * @param err Optional. On failure, receives an opaque info handle the caller must destroy via
+ * `duckdb_v2_error_info_destroy()`.
+ * @return DUCKDB_V2_ERROR
+ */
+DUCKDB_C_API DUCKDB_V2_ERROR duckdb_v2_table_function_partitioning_get_user_data(
+    duckdb_v2_table_function_partitioning_info_handle info, void **data, duckdb_v2_error_info_handle *err);
+#endif
+
+#if DUCKDB_V2_API_ALLOW_UNSTABLE
+/*!
+ * Retrieves the bind data set by the function's bind callback.
+ *
+ * history:
+ * - unstable: v2.0.0
+ *
+ * @param info The partitioning info handle.
+ * @param data Receives the bind data pointer, or null if none was set.
+ * @param err Optional. On failure, receives an opaque info handle the caller must destroy via
+ * `duckdb_v2_error_info_destroy()`.
+ * @return DUCKDB_V2_ERROR
+ */
+DUCKDB_C_API DUCKDB_V2_ERROR duckdb_v2_table_function_partitioning_get_bind_data(
+    duckdb_v2_table_function_partitioning_info_handle info, void **data, duckdb_v2_error_info_handle *err);
+#endif
+
+#if DUCKDB_V2_API_ALLOW_UNSTABLE
+/*!
+ * Returns the number of columns the optimizer is asking about: the candidate `GROUP BY` column set.
+ *
+ * Valid indices for `duckdb_v2_table_function_partitioning_get_partition_column_index()` are `0` up to (but excluding)
+ * this count.
+ *
+ * history:
+ * - unstable: v2.0.0
+ *
+ * @param info The partitioning info handle.
+ * @param count Receives the number of columns in the candidate set.
+ * @param err Optional. On failure, receives an opaque info handle the caller must destroy via
+ * `duckdb_v2_error_info_destroy()`.
+ * @return DUCKDB_V2_ERROR
+ */
+DUCKDB_C_API DUCKDB_V2_ERROR duckdb_v2_table_function_partitioning_get_partition_column_count(
+    duckdb_v2_table_function_partitioning_info_handle info, idx_t *count, duckdb_v2_error_info_handle *err);
+#endif
+
+#if DUCKDB_V2_API_ALLOW_UNSTABLE
+/*!
+ * Returns which declared column the candidate `GROUP BY` column at the given index stands for.
+ *
+ * The result indexes the columns declared with `duckdb_v2_table_function_bind_add_result_column()`, in declaration
+ * order. Fails if the index is out of bounds.
+ *
+ * history:
+ * - unstable: v2.0.0
+ *
+ * @param info The partitioning info handle.
+ * @param index The index of the candidate column.
+ * @param column_index Receives the index of the declared column.
+ * @param err Optional. On failure, receives an opaque info handle the caller must destroy via
+ * `duckdb_v2_error_info_destroy()`.
+ * @return DUCKDB_V2_ERROR
+ */
+DUCKDB_C_API DUCKDB_V2_ERROR duckdb_v2_table_function_partitioning_get_partition_column_index(
+    duckdb_v2_table_function_partitioning_info_handle info, idx_t index, idx_t *column_index,
+    duckdb_v2_error_info_handle *err);
+#endif
+
+#if DUCKDB_V2_API_ALLOW_UNSTABLE
+/*!
+ * Reports whether every partition the scan produces carries exactly one distinct value for the candidate `GROUP BY`
+ * column set.
+ *
+ * Only `TABLE_PARTITION_INFO_SINGLE_VALUE_PARTITIONS` unlocks the partitioned aggregate optimization; any other value
+ * keeps the regular hash aggregate. A callback that never calls this is treated as reporting
+ * `TABLE_PARTITION_INFO_NOT_PARTITIONED`. Fails with `ERROR_INPUT_INVALID` when partition_info is not one of the enum's
+ * declared values.
+ *
+ * history:
+ * - unstable: v2.0.0
+ *
+ * @param info The partitioning info handle.
+ * @param partition_info Whether, and how, the scan is partitioned by the candidate column set.
+ * @param err Optional. On failure, receives an opaque info handle the caller must destroy via
+ * `duckdb_v2_error_info_destroy()`.
+ * @return DUCKDB_V2_ERROR
+ */
+DUCKDB_C_API DUCKDB_V2_ERROR duckdb_v2_table_function_partitioning_set_partition_info(
+    duckdb_v2_table_function_partitioning_info_handle info, DUCKDB_V2_TABLE_PARTITION_INFO partition_info,
+    duckdb_v2_error_info_handle *err);
+#endif
+
+#if DUCKDB_V2_API_ALLOW_UNSTABLE
+/*!
+ * Registers the table function, making it available for use in SQL queries.
+ *
+ * The function is registered on the connection's database, visible to every connection, in the connection's
+ * transaction: inside an explicit transaction, it is invisible to other connections until the transaction commits, and
+ * a rollback undoes it. Registration requires a name, a bind callback and an exec callback, and rejects a signature
+ * that declares a return type, since a table function declares the columns it returns from its bind callback. The table
+ * function must have been created through a factory of the same database. The caller still owns the handle after
+ * registration and must destroy it with `duckdb_v2_table_function_destroy()`, which does not affect the registered
+ * function.
+ *
+ * history:
+ * - unstable: v2.0.0
+ *
+ * @param conn The connection to register on.
+ * @param function The table function to register.
+ * @param err Optional. On failure, receives an opaque info handle the caller must destroy via
+ * `duckdb_v2_error_info_destroy()`.
+ * @return DUCKDB_V2_ERROR
+ */
+DUCKDB_C_API DUCKDB_V2_ERROR duckdb_v2_connection_register_table_function(duckdb_v2_connection_handle conn,
+                                                                          duckdb_v2_table_function_handle function,
+                                                                          duckdb_v2_error_info_handle *err);
+#endif
+
+#if DUCKDB_V2_API_ALLOW_UNSTABLE
+/*!
+ * Registers the table function, making it available for use in SQL queries.
+ *
+ * The function is registered on the loading extension's database and attributed to the extension. Use this from the
+ * extension's load callback. Registration requires a name, a bind callback and an exec callback, and rejects a
+ * signature that declares a return type, since a table function declares the columns it returns from its bind callback.
+ * The table function must have been created through a factory of the same database. The caller still owns the handle
+ * after registration and must destroy it with `duckdb_v2_table_function_destroy()`, which does not affect the
+ * registered function.
+ *
+ * history:
+ * - unstable: v2.0.0
+ *
+ * @param extension The loading extension.
+ * @param function The table function to register.
+ * @param err Optional. On failure, receives an opaque info handle the caller must destroy via
+ * `duckdb_v2_error_info_destroy()`.
+ * @return DUCKDB_V2_ERROR
+ */
+DUCKDB_C_API DUCKDB_V2_ERROR duckdb_v2_extension_register_table_function(duckdb_v2_extension_handle extension,
+                                                                         duckdb_v2_table_function_handle function,
+                                                                         duckdb_v2_error_info_handle *err);
+#endif
+
+#if DUCKDB_V2_API_ALLOW_UNSTABLE
+/*!
+ * Destroys the table function, releasing its resources.
+ *
+ * Null-safe: passing a null pointer or null handle is a no-op. The handle is set to null on return to prevent
+ * double-destruction. Destroying the handle after registration does not affect the registered function.
+ *
+ * history:
+ * - unstable: v2.0.0
+ *
+ * @param function The function to destroy.
+ * @return DUCKDB_V2_ERROR
+ */
+DUCKDB_C_API DUCKDB_V2_ERROR duckdb_v2_table_function_destroy(duckdb_v2_table_function_handle *function);
+#endif
+
+#if DUCKDB_V2_API_ALLOW_UNSTABLE
+/*!
+ * Sets the optional claim batch callback of the table function.
+ *
+ * With a claim batch callback, a scanning thread works through the scan one batch at a time: the callback claims the
+ * next batch of work (e.g. the next block of a file) for the thread's local state, typically from the shared global
+ * state, and the exec callback then produces the rows of that batch only, leaving the output chunk empty once the batch
+ * is exhausted. A batch is claimed before the exec callback first runs on a thread, and again whenever the exec
+ * callback leaves the output chunk empty; the scan ends for a thread once the claim batch callback does not claim a
+ * batch.
+ *
+ * Telling the batches apart lets a caller that scans several batches in parallel put their rows back in the order of
+ * the batches, e.g. a multi-file function registered with `duckdb_v2_connection_register_multi_file_function()` or
+ * `duckdb_v2_extension_register_multi_file_function()` claims the batches of the function itself, so that the rows of a
+ * file keep their order also when several threads scan it.
+ *
+ * The callback runs while the work of the scan is handed out to the threads, possibly while every other scanning thread
+ * waits for it. It should therefore only claim the work - e.g. reserve the number of the next block - and leave reading
+ * it to the exec callback.
+ *
+ * history:
+ * - unstable: v2.0.0
+ *
+ * @param function The function to set the claim batch callback of.
+ * @param callback The claim batch callback to set.
+ * @param err Optional. On failure, receives an opaque info handle the caller must destroy via
+ * `duckdb_v2_error_info_destroy()`.
+ * @return DUCKDB_V2_ERROR
+ */
+DUCKDB_C_API DUCKDB_V2_ERROR duckdb_v2_table_function_set_claim_batch_callback(
+    duckdb_v2_table_function_handle function, duckdb_v2_table_function_claim_batch_callback_fn callback,
+    duckdb_v2_error_info_handle *err);
+#endif
+
+#if DUCKDB_V2_API_ALLOW_UNSTABLE
+/*!
+ * Retrieves the user data set on the table function via `duckdb_v2_table_function_set_user_data()`.
+ *
+ * history:
+ * - unstable: v2.0.0
+ *
+ * @param info The claim batch info handle.
+ * @param data Receives the user data pointer, or null if none was set.
+ * @param err Optional. On failure, receives an opaque info handle the caller must destroy via
+ * `duckdb_v2_error_info_destroy()`.
+ * @return DUCKDB_V2_ERROR
+ */
+DUCKDB_C_API DUCKDB_V2_ERROR duckdb_v2_table_function_claim_batch_get_user_data(
+    duckdb_v2_table_function_claim_batch_info_handle info, void **data, duckdb_v2_error_info_handle *err);
+#endif
+
+#if DUCKDB_V2_API_ALLOW_UNSTABLE
+/*!
+ * Retrieves the bind data set by the function's bind callback.
+ *
+ * history:
+ * - unstable: v2.0.0
+ *
+ * @param info The claim batch info handle.
+ * @param data Receives the bind data pointer, or null if none was set.
+ * @param err Optional. On failure, receives an opaque info handle the caller must destroy via
+ * `duckdb_v2_error_info_destroy()`.
+ * @return DUCKDB_V2_ERROR
+ */
+DUCKDB_C_API DUCKDB_V2_ERROR duckdb_v2_table_function_claim_batch_get_bind_data(
+    duckdb_v2_table_function_claim_batch_info_handle info, void **data, duckdb_v2_error_info_handle *err);
+#endif
+
+#if DUCKDB_V2_API_ALLOW_UNSTABLE
+/*!
+ * Retrieves the global state set by the function's global init callback.
+ *
+ * Shared with every other thread scanning the function; access to it must be synchronized by the function.
+ *
+ * history:
+ * - unstable: v2.0.0
+ *
+ * @param info The claim batch info handle.
+ * @param data Receives the global state pointer, or null if none was set.
+ * @param err Optional. On failure, receives an opaque info handle the caller must destroy via
+ * `duckdb_v2_error_info_destroy()`.
+ * @return DUCKDB_V2_ERROR
+ */
+DUCKDB_C_API DUCKDB_V2_ERROR duckdb_v2_table_function_claim_batch_get_global_state(
+    duckdb_v2_table_function_claim_batch_info_handle info, void **data, duckdb_v2_error_info_handle *err);
+#endif
+
+#if DUCKDB_V2_API_ALLOW_UNSTABLE
+/*!
+ * Retrieves the local state set by the function's local init callback, for the thread claiming a batch.
+ *
+ * history:
+ * - unstable: v2.0.0
+ *
+ * @param info The claim batch info handle.
+ * @param data Receives the local state pointer for the claiming thread, or null if none was set.
+ * @param err Optional. On failure, receives an opaque info handle the caller must destroy via
+ * `duckdb_v2_error_info_destroy()`.
+ * @return DUCKDB_V2_ERROR
+ */
+DUCKDB_C_API DUCKDB_V2_ERROR duckdb_v2_table_function_claim_batch_get_local_state(
+    duckdb_v2_table_function_claim_batch_info_handle info, void **data, duckdb_v2_error_info_handle *err);
+#endif
+
+#if DUCKDB_V2_API_ALLOW_UNSTABLE
+/*!
+ * Reports whether the callback claimed a batch for the thread.
+ *
+ * A callback that returns without calling this claimed nothing, which ends the scan for the thread.
+ *
+ * history:
+ * - unstable: v2.0.0
+ *
+ * @param info The claim batch info handle.
+ * @param claimed Whether a batch was claimed.
+ * @param err Optional. On failure, receives an opaque info handle the caller must destroy via
+ * `duckdb_v2_error_info_destroy()`.
+ * @return DUCKDB_V2_ERROR
+ */
+DUCKDB_C_API DUCKDB_V2_ERROR duckdb_v2_table_function_claim_batch_set_claimed(
+    duckdb_v2_table_function_claim_batch_info_handle info, bool claimed, duckdb_v2_error_info_handle *err);
+#endif
+
+#if DUCKDB_V2_API_ALLOW_UNSTABLE
+/*!
+ * Sets the optional "get bind info" callback of the table function.
+ *
+ * The engine invokes the callback with the bind data of a bound call when it needs to know more about the call than its
+ * columns. E.g. a multi-file function registered with `duckdb_v2_connection_register_multi_file_function()` or
+ * `duckdb_v2_extension_register_multi_file_function()` asks the function it wraps for every file it binds: it maps the
+ * columns of the files onto the columns of its scan by the identifiers the callback reports, and exposes the options it
+ * reports as the metadata of the reader of the file. The callback may be invoked more than once for the same bind data,
+ * so it should only report what the bind already determined.
+ *
+ * history:
+ * - unstable: v2.0.0
+ *
+ * @param function The function to set the callback of.
+ * @param callback The "get bind info" callback to set.
+ * @param err Optional. On failure, receives an opaque info handle the caller must destroy via
+ * `duckdb_v2_error_info_destroy()`.
+ * @return DUCKDB_V2_ERROR
+ */
+DUCKDB_C_API DUCKDB_V2_ERROR duckdb_v2_table_function_set_get_bind_info_callback(
+    duckdb_v2_table_function_handle function, duckdb_v2_table_function_get_bind_info_callback_fn callback,
+    duckdb_v2_error_info_handle *err);
+#endif
+
+#if DUCKDB_V2_API_ALLOW_UNSTABLE
+/*!
+ * Retrieves the user data set via `duckdb_v2_table_function_set_user_data()`.
+ *
+ * history:
+ * - unstable: v2.0.0
+ *
+ * @param info The get bind info handle.
+ * @param data Receives the user data pointer, or null if none was set.
+ * @param err Optional. On failure, receives an opaque info handle the caller must destroy via
+ * `duckdb_v2_error_info_destroy()`.
+ * @return DUCKDB_V2_ERROR
+ */
+DUCKDB_C_API DUCKDB_V2_ERROR duckdb_v2_table_function_get_bind_info_get_user_data(
+    duckdb_v2_table_function_get_bind_info_info_handle info, void **data, duckdb_v2_error_info_handle *err);
+#endif
+
+#if DUCKDB_V2_API_ALLOW_UNSTABLE
+/*!
+ * Retrieves the bind data the function's bind callback set for the bound call being described.
+ *
+ * history:
+ * - unstable: v2.0.0
+ *
+ * @param info The get bind info handle.
+ * @param data Receives the bind data pointer, or null if none was set.
+ * @param err Optional. On failure, receives an opaque info handle the caller must destroy via
+ * `duckdb_v2_error_info_destroy()`.
+ * @return DUCKDB_V2_ERROR
+ */
+DUCKDB_C_API DUCKDB_V2_ERROR duckdb_v2_table_function_get_bind_info_get_bind_data(
+    duckdb_v2_table_function_get_bind_info_info_handle info, void **data, duckdb_v2_error_info_handle *err);
+#endif
+
+#if DUCKDB_V2_API_ALLOW_UNSTABLE
+/*!
+ * Attaches an identifier to a result column of the bound call, or to a field nested inside one.
+ *
+ * A multi-file reader can then map the columns of every file onto the columns of its scan by identifier rather than by
+ * name - e.g. by the field ids of a file format that carries them, so that renamed columns and fields are still found.
+ * An identifier is an INTEGER field id or a VARCHAR name.
+ *
+ * The nested field is addressed by a path of child indexes, starting at the result column at `column_index`: a STRUCT
+ * field by its index, the elements of a LIST or ARRAY by `0`, the keys of a MAP by `0` and its values by `1`, and a
+ * UNION member by its index. An empty path addresses the result column itself. Setting an identifier again for the same
+ * column or field replaces it. Fails with `ERROR_INPUT_INVALID` when the column index is out of range, or the path does
+ * not address a nested field of the column's type.
+ *
+ * history:
+ * - unstable: v2.0.0
+ *
+ * @param info The get bind info handle.
+ * @param column_index The index of the result column, in the order the bind callback declared the columns.
+ * @param child_path The path of child indexes addressing the nested field, or null for the column itself.
+ * @param child_path_length The number of entries in the path, 0 for the column itself.
+ * @param identifier The identifier, an INTEGER or VARCHAR value. Borrowed and copied.
+ * @param err Optional. On failure, receives an opaque info handle the caller must destroy via
+ * `duckdb_v2_error_info_destroy()`.
+ * @return DUCKDB_V2_ERROR
+ */
+DUCKDB_C_API DUCKDB_V2_ERROR duckdb_v2_table_function_get_bind_info_set_column_identifier(
+    duckdb_v2_table_function_get_bind_info_info_handle info, idx_t column_index, const idx_t *child_path,
+    idx_t child_path_length, duckdb_v2_value_handle identifier, duckdb_v2_error_info_handle *err);
+#endif
+
+#if DUCKDB_V2_API_ALLOW_UNSTABLE
+/*!
+ * Sets an option describing the bound call: a key-value fact about what the call reads, e.g. a property of the file it
+ * reads. Setting a key again replaces its value.
+ *
+ * A multi-file function registered with `duckdb_v2_connection_register_multi_file_function()` or
+ * `duckdb_v2_extension_register_multi_file_function()` exposes the options of the function it wraps as the metadata of
+ * the reader of each file, e.g. to a custom multi-file reader of another extension.
+ *
+ * history:
+ * - unstable: v2.0.0
+ *
+ * @param info The get bind info handle.
+ * @param key The key of the option. Borrowed and copied.
+ * @param value The value of the option. Borrowed and copied.
+ * @param err Optional. On failure, receives an opaque info handle the caller must destroy via
+ * `duckdb_v2_error_info_destroy()`.
+ * @return DUCKDB_V2_ERROR
+ */
+DUCKDB_C_API DUCKDB_V2_ERROR duckdb_v2_table_function_get_bind_info_set_option(
+    duckdb_v2_table_function_get_bind_info_info_handle info, duckdb_v2_str *key, duckdb_v2_value_handle value,
+    duckdb_v2_error_info_handle *err);
+#endif
+
+#if DUCKDB_V2_API_ALLOW_UNSTABLE
+/*!
+ * Creates a new multi-file function through a factory.
+ *
+ * The function starts out empty: give it a name with `duckdb_v2_multi_file_function_set_name()` and the single-file
+ * function it wraps with `duckdb_v2_multi_file_function_set_single_file_function()`, then make it available with
+ * `duckdb_v2_connection_register_multi_file_function()` or `duckdb_v2_extension_register_multi_file_function()`. The
+ * caller owns the returned handle and must destroy it with `duckdb_v2_multi_file_function_destroy()`, also after
+ * registration.
+ *
+ * The multi-file function can only be registered on the database the factory belongs to.
+ *
+ * history:
+ * - unstable: v2.0.0
+ *
+ * @param factory The factory to create the multi-file function through.
+ * @param function On success, receives the newly created multi-file function. Owned by the caller.
+ * @param err Optional. On failure, receives an opaque info handle the caller must destroy via
+ * `duckdb_v2_error_info_destroy()`.
+ * @return DUCKDB_V2_ERROR
+ */
+DUCKDB_C_API DUCKDB_V2_ERROR duckdb_v2_multi_file_function_create(duckdb_v2_factory_handle factory,
+                                                                  duckdb_v2_multi_file_function_handle *function,
+                                                                  duckdb_v2_error_info_handle *err);
+#endif
+
+#if DUCKDB_V2_API_ALLOW_UNSTABLE
+/*!
+ * Sets the name of the multi-file function, as SQL will call it.
+ *
+ * The name is borrowed and copied. Calling this again replaces the previous name. A name must be set before
+ * registration.
+ *
+ * history:
+ * - unstable: v2.0.0
+ *
+ * @param function The function to set the name of.
+ * @param name The name to set. Borrowed and copied.
+ * @param err Optional. On failure, receives an opaque info handle the caller must destroy via
+ * `duckdb_v2_error_info_destroy()`.
+ * @return DUCKDB_V2_ERROR
+ */
+DUCKDB_C_API DUCKDB_V2_ERROR duckdb_v2_multi_file_function_set_name(duckdb_v2_multi_file_function_handle function,
+                                                                    duckdb_v2_str *name,
+                                                                    duckdb_v2_error_info_handle *err);
+#endif
+
+#if DUCKDB_V2_API_ALLOW_UNSTABLE
+/*!
+ * Sets the name of the table function that reads a single file, which the multi-file function wraps.
+ *
+ * The single-file function must be registered before the multi-file function is, and must take the file to read as its
+ * only positional parameter, of type ANY. It is bound once for every file that is read, and receives the file the way a
+ * multi-file function takes one: as the VARCHAR path of the file when there is nothing more to know about it, and
+ * otherwise as a STRUCT holding the path in its `filename` field and the options to open the file with in its other
+ * fields - e.g. the size of the file, as a file system reported it while globbing, or the options a caller passed along
+ * with the file (`read_x([{'filename': 'f.x', 'file_size': 42}])`). Opening the file with those options, set with
+ * `duckdb_v2_file_open_options_set_value()`, lets the file system skip work it would otherwise repeat, such as asking a
+ * remote store for the size of the file. A single-file function that takes a VARCHAR parameter instead is still
+ * accepted, and only receives the path. Every named parameter the single-file function declares is also a named
+ * parameter of the multi-file function, forwarded to it as given. Everything that involves several files - globbing,
+ * lists of files, hive partitioning, the `filename` column, `union_by_name` and the like - is provided by the
+ * multi-file function on top of it. The name is borrowed and copied. A single-file function must be set before
+ * registration.
+ *
+ * history:
+ * - unstable: v2.0.0
+ *
+ * @param function The function to set the single-file function of.
+ * @param name The name of the registered single-file table function. Borrowed and copied.
+ * @param err Optional. On failure, receives an opaque info handle the caller must destroy via
+ * `duckdb_v2_error_info_destroy()`.
+ * @return DUCKDB_V2_ERROR
+ */
+DUCKDB_C_API DUCKDB_V2_ERROR duckdb_v2_multi_file_function_set_single_file_function(
+    duckdb_v2_multi_file_function_handle function, duckdb_v2_str *name, duckdb_v2_error_info_handle *err);
+#endif
+
+#if DUCKDB_V2_API_ALLOW_UNSTABLE
+/*!
+ * Sets how the files the function reads are referred to in messages, e.g. "Avro" or "JSON".
+ *
+ * Optional: without it, the files are referred to by the name of the multi-file function. The name is borrowed and
+ * copied.
+ *
+ * history:
+ * - unstable: v2.0.0
+ *
+ * @param function The function to set the reader type of.
+ * @param reader_type The reader type. Borrowed and copied.
+ * @param err Optional. On failure, receives an opaque info handle the caller must destroy via
+ * `duckdb_v2_error_info_destroy()`.
+ * @return DUCKDB_V2_ERROR
+ */
+DUCKDB_C_API DUCKDB_V2_ERROR duckdb_v2_multi_file_function_set_reader_type(
+    duckdb_v2_multi_file_function_handle function, duckdb_v2_str *reader_type, duckdb_v2_error_info_handle *err);
+#endif
+
+#if DUCKDB_V2_API_ALLOW_UNSTABLE
+/*!
+ * Sets the file extension of the files the function reads, e.g. "avro".
+ *
+ * Optional. With a file extension, a path that names a directory rather than a file reads the files with that extension
+ * inside it. Without one, the paths passed to the function must match at least one file. The extension is given without
+ * a leading dot, and is borrowed and copied.
+ *
+ * history:
+ * - unstable: v2.0.0
+ *
+ * @param function The function to set the file extension of.
+ * @param extension The file extension, without a leading dot. Borrowed and copied.
+ * @param err Optional. On failure, receives an opaque info handle the caller must destroy via
+ * `duckdb_v2_error_info_destroy()`.
+ * @return DUCKDB_V2_ERROR
+ */
+DUCKDB_C_API DUCKDB_V2_ERROR duckdb_v2_multi_file_function_set_file_extension(
+    duckdb_v2_multi_file_function_handle function, duckdb_v2_str *extension, duckdb_v2_error_info_handle *err);
+#endif
+
+#if DUCKDB_V2_API_ALLOW_UNSTABLE
+/*!
+ * Registers the multi-file function, making it available for use in SQL queries.
+ *
+ * The function is registered on the connection's database, visible to every connection, in the connection's
+ * transaction: inside an explicit transaction, it is invisible to other connections until the transaction commits, and
+ * a rollback undoes it. It can then be called with the path of a single file, a glob pattern, or a list of either, and
+ * accepts the options every multi-file function accepts (e.g. `filename`, `hive_partitioning`, `union_by_name`) next to
+ * the named parameters of the single-file function. Registration requires a name and a single-file function, and fails
+ * when no table function by that name is registered or it does not take the path of the file to read as its only
+ * positional parameter (see `duckdb_v2_multi_file_function_set_single_file_function()`). The multi-file function must
+ * have been created through a factory of the same database. The caller still owns the handle after registration and
+ * must destroy it with `duckdb_v2_multi_file_function_destroy()`, which does not affect the registered function.
+ *
+ * history:
+ * - unstable: v2.0.0
+ *
+ * @param conn The connection to register on.
+ * @param function The multi-file function to register.
+ * @param err Optional. On failure, receives an opaque info handle the caller must destroy via
+ * `duckdb_v2_error_info_destroy()`.
+ * @return DUCKDB_V2_ERROR
+ */
+DUCKDB_C_API DUCKDB_V2_ERROR duckdb_v2_connection_register_multi_file_function(
+    duckdb_v2_connection_handle conn, duckdb_v2_multi_file_function_handle function, duckdb_v2_error_info_handle *err);
+#endif
+
+#if DUCKDB_V2_API_ALLOW_UNSTABLE
+/*!
+ * Registers the multi-file function, making it available for use in SQL queries.
+ *
+ * The function is registered on the loading extension's database and attributed to the extension. Use this from the
+ * extension's load callback. It can then be called with the path of a single file, a glob pattern, or a list of either,
+ * and accepts the options every multi-file function accepts (e.g. `filename`, `hive_partitioning`, `union_by_name`)
+ * next to the named parameters of the single-file function. Registration requires a name and a single-file function,
+ * and fails when no table function by that name is registered or it does not take the path of the file to read as its
+ * only positional parameter (see `duckdb_v2_multi_file_function_set_single_file_function()`). The multi-file function
+ * must have been created through a factory of the same database. The caller still owns the handle after registration
+ * and must destroy it with `duckdb_v2_multi_file_function_destroy()`, which does not affect the registered function.
+ *
+ * history:
+ * - unstable: v2.0.0
+ *
+ * @param extension The loading extension.
+ * @param function The multi-file function to register.
+ * @param err Optional. On failure, receives an opaque info handle the caller must destroy via
+ * `duckdb_v2_error_info_destroy()`.
+ * @return DUCKDB_V2_ERROR
+ */
+DUCKDB_C_API DUCKDB_V2_ERROR duckdb_v2_extension_register_multi_file_function(
+    duckdb_v2_extension_handle extension, duckdb_v2_multi_file_function_handle function,
+    duckdb_v2_error_info_handle *err);
+#endif
+
+#if DUCKDB_V2_API_ALLOW_UNSTABLE
+/*!
+ * Destroys the multi-file function, releasing its resources.
+ *
+ * Null-safe: passing a null pointer or null handle is a no-op. The handle is set to null on return to prevent
+ * double-destruction. Destroying the handle after registration does not affect the registered function.
+ *
+ * history:
+ * - unstable: v2.0.0
+ *
+ * @param function The function to destroy.
+ * @return DUCKDB_V2_ERROR
+ */
+DUCKDB_C_API DUCKDB_V2_ERROR duckdb_v2_multi_file_function_destroy(duckdb_v2_multi_file_function_handle *function);
+#endif
+
+/* --- Struct definitions for table --- */
+
+/* ============================================================================
+ * MODULE: value
+ * ============================================================================ */
+
+/* --- Enums for value --- */
+
+/* --- Struct forward declarations for value --- */
+
+/* --- Types for value --- */
+
+/* --- Constants for value --- */
+
+/* --- Function pointer typedefs for value --- */
+
+/* --- Functions for value --- */
+
+#if DUCKDB_V2_API_ALLOW_UNSTABLE
+/*!
+ * Destroys a value handle.
+ *
+ * Null-safe: passing nullptr or a slot already set to nullptr is a no-op. On success the slot is set to nullptr.
+ *
+ * history:
+ * - unstable: v2.0.0
+ *
+ * @param value The value to destroy.
+ * @return DUCKDB_V2_ERROR
+ */
+DUCKDB_C_API DUCKDB_V2_ERROR duckdb_v2_value_destroy(duckdb_v2_value_handle *value);
+#endif
+
+#if DUCKDB_V2_API_ALLOW_UNSTABLE
+/*!
+ * Returns the value as a BOOLEAN.
+ *
+ * A value of a different type is converted through the default cast set, on a copy, so reading never alters the value.
+ * An unsupported conversion returns ERROR_INPUT_INVALID, as does a NULL value.
+ *
+ * history:
+ * - unstable: v2.0.0
+ *
+ * @param value The value to read.
+ * @param out Receives the payload as a bool.
+ * @param err Optional. On failure, receives an opaque info handle the caller must destroy via error_info_destroy.
+ * @return DUCKDB_V2_ERROR
+ */
+DUCKDB_C_API DUCKDB_V2_ERROR duckdb_v2_value_get_bool(duckdb_v2_value_handle value, bool *out,
+                                                      duckdb_v2_error_info_handle *err);
+#endif
+
+#if DUCKDB_V2_API_ALLOW_UNSTABLE
+/*!
+ * Returns the value as a UTINYINT.
+ *
+ * A value of a different type is converted through the default cast set, on a copy, so reading never alters the value.
+ * An unsupported conversion returns ERROR_INPUT_INVALID, as does a NULL value.
+ *
+ * history:
+ * - unstable: v2.0.0
+ *
+ * @param value The value to read.
+ * @param out Receives the payload as a uint8_t.
+ * @param err Optional. On failure, receives an opaque info handle the caller must destroy via error_info_destroy.
+ * @return DUCKDB_V2_ERROR
+ */
+DUCKDB_C_API DUCKDB_V2_ERROR duckdb_v2_value_get_utinyint(duckdb_v2_value_handle value, uint8_t *out,
+                                                          duckdb_v2_error_info_handle *err);
+#endif
+
+#if DUCKDB_V2_API_ALLOW_UNSTABLE
+/*!
+ * Returns the value as a USMALLINT.
+ *
+ * A value of a different type is converted through the default cast set, on a copy, so reading never alters the value.
+ * An unsupported conversion returns ERROR_INPUT_INVALID, as does a NULL value.
+ *
+ * history:
+ * - unstable: v2.0.0
+ *
+ * @param value The value to read.
+ * @param out Receives the payload as a uint16_t.
+ * @param err Optional. On failure, receives an opaque info handle the caller must destroy via error_info_destroy.
+ * @return DUCKDB_V2_ERROR
+ */
+DUCKDB_C_API DUCKDB_V2_ERROR duckdb_v2_value_get_usmallint(duckdb_v2_value_handle value, uint16_t *out,
+                                                           duckdb_v2_error_info_handle *err);
+#endif
+
+#if DUCKDB_V2_API_ALLOW_UNSTABLE
+/*!
+ * Returns the value as a UINTEGER.
+ *
+ * A value of a different type is converted through the default cast set, on a copy, so reading never alters the value.
+ * An unsupported conversion returns ERROR_INPUT_INVALID, as does a NULL value.
+ *
+ * history:
+ * - unstable: v2.0.0
+ *
+ * @param value The value to read.
+ * @param out Receives the payload as a uint32_t.
+ * @param err Optional. On failure, receives an opaque info handle the caller must destroy via error_info_destroy.
+ * @return DUCKDB_V2_ERROR
+ */
+DUCKDB_C_API DUCKDB_V2_ERROR duckdb_v2_value_get_uint(duckdb_v2_value_handle value, uint32_t *out,
+                                                      duckdb_v2_error_info_handle *err);
+#endif
+
+#if DUCKDB_V2_API_ALLOW_UNSTABLE
+/*!
+ * Returns the value as a UBIGINT.
+ *
+ * A value of a different type is converted through the default cast set, on a copy, so reading never alters the value.
+ * An unsupported conversion returns ERROR_INPUT_INVALID, as does a NULL value.
+ *
+ * history:
+ * - unstable: v2.0.0
+ *
+ * @param value The value to read.
+ * @param out Receives the payload as a uint64_t.
+ * @param err Optional. On failure, receives an opaque info handle the caller must destroy via error_info_destroy.
+ * @return DUCKDB_V2_ERROR
+ */
+DUCKDB_C_API DUCKDB_V2_ERROR duckdb_v2_value_get_ubigint(duckdb_v2_value_handle value, uint64_t *out,
+                                                         duckdb_v2_error_info_handle *err);
+#endif
+
+#if DUCKDB_V2_API_ALLOW_UNSTABLE
+/*!
+ * Returns the value as a UHUGEINT.
+ *
+ * A value of a different type is converted through the default cast set, on a copy, so reading never alters the value.
+ * An unsupported conversion returns ERROR_INPUT_INVALID, as does a NULL value.
+ *
+ * history:
+ * - unstable: v2.0.0
+ *
+ * @param value The value to read.
+ * @param out Receives the payload as a uint128_t.
+ * @param err Optional. On failure, receives an opaque info handle the caller must destroy via error_info_destroy.
+ * @return DUCKDB_V2_ERROR
+ */
+DUCKDB_C_API DUCKDB_V2_ERROR duckdb_v2_value_get_uhugeint(duckdb_v2_value_handle value, duckdb_v2_uhugeint_t *out,
+                                                          duckdb_v2_error_info_handle *err);
+#endif
+
+#if DUCKDB_V2_API_ALLOW_UNSTABLE
+/*!
+ * Returns the value as a TINYINT.
+ *
+ * A value of a different type is converted through the default cast set, on a copy, so reading never alters the value.
+ * An unsupported conversion returns ERROR_INPUT_INVALID, as does a NULL value.
+ *
+ * history:
+ * - unstable: v2.0.0
+ *
+ * @param value The value to read.
+ * @param out Receives the payload as an int8_t.
+ * @param err Optional. On failure, receives an opaque info handle the caller must destroy via error_info_destroy.
+ * @return DUCKDB_V2_ERROR
+ */
+DUCKDB_C_API DUCKDB_V2_ERROR duckdb_v2_value_get_tinyint(duckdb_v2_value_handle value, int8_t *out,
+                                                         duckdb_v2_error_info_handle *err);
+#endif
+
+#if DUCKDB_V2_API_ALLOW_UNSTABLE
+/*!
+ * Returns the value as a SMALLINT.
+ *
+ * A value of a different type is converted through the default cast set, on a copy, so reading never alters the value.
+ * An unsupported conversion returns ERROR_INPUT_INVALID, as does a NULL value.
+ *
+ * history:
+ * - unstable: v2.0.0
+ *
+ * @param value The value to read.
+ * @param out Receives the payload as an int16_t.
+ * @param err Optional. On failure, receives an opaque info handle the caller must destroy via error_info_destroy.
+ * @return DUCKDB_V2_ERROR
+ */
+DUCKDB_C_API DUCKDB_V2_ERROR duckdb_v2_value_get_smallint(duckdb_v2_value_handle value, int16_t *out,
+                                                          duckdb_v2_error_info_handle *err);
+#endif
+
+#if DUCKDB_V2_API_ALLOW_UNSTABLE
+/*!
+ * Returns the value as an INTEGER.
+ *
+ * A value of a different type is converted through the default cast set, on a copy, so reading never alters the value.
+ * An unsupported conversion returns ERROR_INPUT_INVALID, as does a NULL value.
+ *
+ * history:
+ * - unstable: v2.0.0
+ *
+ * @param value The value to read.
+ * @param out Receives the payload as an int32_t.
+ * @param err Optional. On failure, receives an opaque info handle the caller must destroy via error_info_destroy.
+ * @return DUCKDB_V2_ERROR
+ */
+DUCKDB_C_API DUCKDB_V2_ERROR duckdb_v2_value_get_int(duckdb_v2_value_handle value, int32_t *out,
+                                                     duckdb_v2_error_info_handle *err);
+#endif
+
+#if DUCKDB_V2_API_ALLOW_UNSTABLE
+/*!
+ * Returns the value as a BIGINT.
+ *
+ * A value of a different type is converted through the default cast set, on a copy, so reading never alters the value.
+ * An unsupported conversion returns ERROR_INPUT_INVALID, as does a NULL value.
+ *
+ * history:
+ * - unstable: v2.0.0
+ *
+ * @param value The value to read.
+ * @param out Receives the payload as an int64_t.
+ * @param err Optional. On failure, receives an opaque info handle the caller must destroy via error_info_destroy.
+ * @return DUCKDB_V2_ERROR
+ */
+DUCKDB_C_API DUCKDB_V2_ERROR duckdb_v2_value_get_bigint(duckdb_v2_value_handle value, int64_t *out,
+                                                        duckdb_v2_error_info_handle *err);
+#endif
+
+#if DUCKDB_V2_API_ALLOW_UNSTABLE
+/*!
+ * Returns the value as a HUGEINT.
+ *
+ * A value of a different type is converted through the default cast set, on a copy, so reading never alters the value.
+ * An unsupported conversion returns ERROR_INPUT_INVALID, as does a NULL value.
+ *
+ * history:
+ * - unstable: v2.0.0
+ *
+ * @param value The value to read.
+ * @param out Receives the payload as an int128_t.
+ * @param err Optional. On failure, receives an opaque info handle the caller must destroy via error_info_destroy.
+ * @return DUCKDB_V2_ERROR
+ */
+DUCKDB_C_API DUCKDB_V2_ERROR duckdb_v2_value_get_hugeint(duckdb_v2_value_handle value, duckdb_v2_hugeint_t *out,
+                                                         duckdb_v2_error_info_handle *err);
+#endif
+
+#if DUCKDB_V2_API_ALLOW_UNSTABLE
+/*!
+ * Returns the value as a VARCHAR.
+ *
+ * The string is borrowed from the value and stays valid until the value is destroyed. That borrow is why this getter
+ * does not convert: a converted copy would not outlive the call. A value of any other type id, and a NULL value, return
+ * ERROR_INPUT_INVALID.
+ *
+ * history:
+ * - unstable: v2.0.0
+ *
+ * @param value The value to read.
+ * @param out Receives the payload as a UTF-8 string. The returned string is borrowed and valid until the value handle
+ * is destroyed.
+ * @param err Optional. On failure, receives an opaque info handle the caller must destroy via error_info_destroy.
+ * @return DUCKDB_V2_ERROR
+ */
+DUCKDB_C_API DUCKDB_V2_ERROR duckdb_v2_value_get_varchar(duckdb_v2_value_handle value, duckdb_v2_str *out,
+                                                         duckdb_v2_error_info_handle *err);
+#endif
+
+#if DUCKDB_V2_API_ALLOW_UNSTABLE
+/*!
+ * Returns the value as a byte string: a BLOB, or the storage bytes of a BIT or BIGNUM.
+ *
+ * The string is borrowed from the value and stays valid until the value is destroyed. That borrow is why this getter
+ * does not convert: a converted copy would not outlive the call. A value of any other type id, and a NULL value, return
+ * ERROR_INPUT_INVALID.
+ *
+ * history:
+ * - unstable: v2.0.0
+ *
+ * @param value The value to read.
+ * @param out Receives the payload as a byte string. The returned string is borrowed and valid until the value handle is
+ * destroyed.
+ * @param err Optional. On failure, receives an opaque info handle the caller must destroy via error_info_destroy.
+ * @return DUCKDB_V2_ERROR
+ */
+DUCKDB_C_API DUCKDB_V2_ERROR duckdb_v2_value_get_blob(duckdb_v2_value_handle value, duckdb_v2_str *out,
+                                                      duckdb_v2_error_info_handle *err);
+#endif
+
+#if DUCKDB_V2_API_ALLOW_UNSTABLE
+/*!
+ * Returns the value as a FLOAT.
+ *
+ * A value of a different type is converted through the default cast set, on a copy, so reading never alters the value.
+ * An unsupported conversion returns ERROR_INPUT_INVALID, as does a NULL value.
+ *
+ * history:
+ * - unstable: v2.0.0
+ *
+ * @param value The value to read.
+ * @param out Receives the payload as a float.
+ * @param err Optional. On failure, receives an opaque info handle the caller must destroy via error_info_destroy.
+ * @return DUCKDB_V2_ERROR
+ */
+DUCKDB_C_API DUCKDB_V2_ERROR duckdb_v2_value_get_float(duckdb_v2_value_handle value, float *out,
+                                                       duckdb_v2_error_info_handle *err);
+#endif
+
+#if DUCKDB_V2_API_ALLOW_UNSTABLE
+/*!
+ * Returns the value as a DOUBLE.
+ *
+ * A value of a different type is converted through the default cast set, on a copy, so reading never alters the value.
+ * An unsupported conversion returns ERROR_INPUT_INVALID, as does a NULL value.
+ *
+ * history:
+ * - unstable: v2.0.0
+ *
+ * @param value The value to read.
+ * @param out Receives the payload as a double.
+ * @param err Optional. On failure, receives an opaque info handle the caller must destroy via error_info_destroy.
+ * @return DUCKDB_V2_ERROR
+ */
+DUCKDB_C_API DUCKDB_V2_ERROR duckdb_v2_value_get_double(duckdb_v2_value_handle value, double *out,
+                                                        duckdb_v2_error_info_handle *err);
+#endif
+
+#if DUCKDB_V2_API_ALLOW_UNSTABLE
+/*!
+ * Returns the value as a DATE.
+ *
+ * The payload is days since 1970-01-01, the same unit a vector of this type exposes.
+ *
+ * A value of a different type is converted through the default cast set, on a copy, so reading never alters the value.
+ * An unsupported conversion returns ERROR_INPUT_INVALID, as does a NULL value.
+ *
+ * history:
+ * - unstable: v2.0.0
+ *
+ * @param value The value to read.
+ * @param out Receives the payload.
+ * @param err Optional. On failure, receives an opaque info handle the caller must destroy via error_info_destroy.
+ * @return DUCKDB_V2_ERROR
+ */
+DUCKDB_C_API DUCKDB_V2_ERROR duckdb_v2_value_get_date(duckdb_v2_value_handle value, int32_t *out,
+                                                      duckdb_v2_error_info_handle *err);
+#endif
+
+#if DUCKDB_V2_API_ALLOW_UNSTABLE
+/*!
+ * Returns the value as a TIME.
+ *
+ * The payload is microseconds since midnight, the same unit a vector of this type exposes.
+ *
+ * A value of a different type is converted through the default cast set, on a copy, so reading never alters the value.
+ * An unsupported conversion returns ERROR_INPUT_INVALID, as does a NULL value.
+ *
+ * history:
+ * - unstable: v2.0.0
+ *
+ * @param value The value to read.
+ * @param out Receives the payload.
+ * @param err Optional. On failure, receives an opaque info handle the caller must destroy via error_info_destroy.
+ * @return DUCKDB_V2_ERROR
+ */
+DUCKDB_C_API DUCKDB_V2_ERROR duckdb_v2_value_get_time(duckdb_v2_value_handle value, int64_t *out,
+                                                      duckdb_v2_error_info_handle *err);
+#endif
+
+#if DUCKDB_V2_API_ALLOW_UNSTABLE
+/*!
+ * Returns the value as a TIME_NS.
+ *
+ * The payload is nanoseconds since midnight, the same unit a vector of this type exposes.
+ *
+ * A value of a different type is converted through the default cast set, on a copy, so reading never alters the value.
+ * An unsupported conversion returns ERROR_INPUT_INVALID, as does a NULL value.
+ *
+ * history:
+ * - unstable: v2.0.0
+ *
+ * @param value The value to read.
+ * @param out Receives the payload.
+ * @param err Optional. On failure, receives an opaque info handle the caller must destroy via error_info_destroy.
+ * @return DUCKDB_V2_ERROR
+ */
+DUCKDB_C_API DUCKDB_V2_ERROR duckdb_v2_value_get_time_ns(duckdb_v2_value_handle value, int64_t *out,
+                                                         duckdb_v2_error_info_handle *err);
+#endif
+
+#if DUCKDB_V2_API_ALLOW_UNSTABLE
+/*!
+ * Returns the value as a TIME_TZ.
+ *
+ * The payload packs the time of day and the UTC offset into one integer, in the committed layout: micros in the high 40
+ * bits, a biased offset in the low 24. The same form a vector of this type exposes.
+ *
+ * A value of a different type is converted through the default cast set, on a copy, so reading never alters the value.
+ * An unsupported conversion returns ERROR_INPUT_INVALID, as does a NULL value.
+ *
+ * history:
+ * - unstable: v2.0.0
+ *
+ * @param value The value to read.
+ * @param out Receives the payload.
+ * @param err Optional. On failure, receives an opaque info handle the caller must destroy via error_info_destroy.
+ * @return DUCKDB_V2_ERROR
+ */
+DUCKDB_C_API DUCKDB_V2_ERROR duckdb_v2_value_get_time_tz(duckdb_v2_value_handle value, uint64_t *out,
+                                                         duckdb_v2_error_info_handle *err);
+#endif
+
+#if DUCKDB_V2_API_ALLOW_UNSTABLE
+/*!
+ * Returns the value as a TIMESTAMP.
+ *
+ * The payload is microseconds since 1970-01-01, the same unit a vector of this type exposes.
+ *
+ * A value of a different type is converted through the default cast set, on a copy, so reading never alters the value.
+ * An unsupported conversion returns ERROR_INPUT_INVALID, as does a NULL value.
+ *
+ * history:
+ * - unstable: v2.0.0
+ *
+ * @param value The value to read.
+ * @param out Receives the payload.
+ * @param err Optional. On failure, receives an opaque info handle the caller must destroy via error_info_destroy.
+ * @return DUCKDB_V2_ERROR
+ */
+DUCKDB_C_API DUCKDB_V2_ERROR duckdb_v2_value_get_timestamp(duckdb_v2_value_handle value, int64_t *out,
+                                                           duckdb_v2_error_info_handle *err);
+#endif
+
+#if DUCKDB_V2_API_ALLOW_UNSTABLE
+/*!
+ * Returns the value as a TIMESTAMP_SEC.
+ *
+ * The payload is seconds since 1970-01-01, the same unit a vector of this type exposes.
+ *
+ * A value of a different type is converted through the default cast set, on a copy, so reading never alters the value.
+ * An unsupported conversion returns ERROR_INPUT_INVALID, as does a NULL value.
+ *
+ * history:
+ * - unstable: v2.0.0
+ *
+ * @param value The value to read.
+ * @param out Receives the payload.
+ * @param err Optional. On failure, receives an opaque info handle the caller must destroy via error_info_destroy.
+ * @return DUCKDB_V2_ERROR
+ */
+DUCKDB_C_API DUCKDB_V2_ERROR duckdb_v2_value_get_timestamp_sec(duckdb_v2_value_handle value, int64_t *out,
+                                                               duckdb_v2_error_info_handle *err);
+#endif
+
+#if DUCKDB_V2_API_ALLOW_UNSTABLE
+/*!
+ * Returns the value as a TIMESTAMP_MS.
+ *
+ * The payload is milliseconds since 1970-01-01, the same unit a vector of this type exposes.
+ *
+ * A value of a different type is converted through the default cast set, on a copy, so reading never alters the value.
+ * An unsupported conversion returns ERROR_INPUT_INVALID, as does a NULL value.
+ *
+ * history:
+ * - unstable: v2.0.0
+ *
+ * @param value The value to read.
+ * @param out Receives the payload.
+ * @param err Optional. On failure, receives an opaque info handle the caller must destroy via error_info_destroy.
+ * @return DUCKDB_V2_ERROR
+ */
+DUCKDB_C_API DUCKDB_V2_ERROR duckdb_v2_value_get_timestamp_ms(duckdb_v2_value_handle value, int64_t *out,
+                                                              duckdb_v2_error_info_handle *err);
+#endif
+
+#if DUCKDB_V2_API_ALLOW_UNSTABLE
+/*!
+ * Returns the value as a TIMESTAMP_NS.
+ *
+ * The payload is nanoseconds since 1970-01-01, the same unit a vector of this type exposes.
+ *
+ * A value of a different type is converted through the default cast set, on a copy, so reading never alters the value.
+ * An unsupported conversion returns ERROR_INPUT_INVALID, as does a NULL value.
+ *
+ * history:
+ * - unstable: v2.0.0
+ *
+ * @param value The value to read.
+ * @param out Receives the payload.
+ * @param err Optional. On failure, receives an opaque info handle the caller must destroy via error_info_destroy.
+ * @return DUCKDB_V2_ERROR
+ */
+DUCKDB_C_API DUCKDB_V2_ERROR duckdb_v2_value_get_timestamp_ns(duckdb_v2_value_handle value, int64_t *out,
+                                                              duckdb_v2_error_info_handle *err);
+#endif
+
+#if DUCKDB_V2_API_ALLOW_UNSTABLE
+/*!
+ * Returns the value as a TIMESTAMP_TZ.
+ *
+ * The payload is microseconds since 1970-01-01, in UTC, the same unit a vector of this type exposes.
+ *
+ * A value of a different type is converted through the default cast set, on a copy, so reading never alters the value.
+ * An unsupported conversion returns ERROR_INPUT_INVALID, as does a NULL value.
+ *
+ * history:
+ * - unstable: v2.0.0
+ *
+ * @param value The value to read.
+ * @param out Receives the payload.
+ * @param err Optional. On failure, receives an opaque info handle the caller must destroy via error_info_destroy.
+ * @return DUCKDB_V2_ERROR
+ */
+DUCKDB_C_API DUCKDB_V2_ERROR duckdb_v2_value_get_timestamp_tz(duckdb_v2_value_handle value, int64_t *out,
+                                                              duckdb_v2_error_info_handle *err);
+#endif
+
+#if DUCKDB_V2_API_ALLOW_UNSTABLE
+/*!
+ * Returns the value as a TIMESTAMP_TZ_NS.
+ *
+ * The payload is nanoseconds since 1970-01-01, in UTC, the same unit a vector of this type exposes.
+ *
+ * A value of a different type is converted through the default cast set, on a copy, so reading never alters the value.
+ * An unsupported conversion returns ERROR_INPUT_INVALID, as does a NULL value.
+ *
+ * history:
+ * - unstable: v2.0.0
+ *
+ * @param value The value to read.
+ * @param out Receives the payload.
+ * @param err Optional. On failure, receives an opaque info handle the caller must destroy via error_info_destroy.
+ * @return DUCKDB_V2_ERROR
+ */
+DUCKDB_C_API DUCKDB_V2_ERROR duckdb_v2_value_get_timestamp_tz_ns(duckdb_v2_value_handle value, int64_t *out,
+                                                                 duckdb_v2_error_info_handle *err);
+#endif
+
+#if DUCKDB_V2_API_ALLOW_UNSTABLE
+/*!
+ * Returns the value as an INTERVAL.
+ *
+ * The payload is the (months, days, micros) triple, the same unit a vector of this type exposes.
+ *
+ * A value of a different type is converted through the default cast set, on a copy, so reading never alters the value.
+ * An unsupported conversion returns ERROR_INPUT_INVALID, as does a NULL value.
+ *
+ * history:
+ * - unstable: v2.0.0
+ *
+ * @param value The value to read.
+ * @param out Receives the payload.
+ * @param err Optional. On failure, receives an opaque info handle the caller must destroy via error_info_destroy.
+ * @return DUCKDB_V2_ERROR
+ */
+DUCKDB_C_API DUCKDB_V2_ERROR duckdb_v2_value_get_interval(duckdb_v2_value_handle value, duckdb_v2_interval_t *out,
+                                                          duckdb_v2_error_info_handle *err);
+#endif
+
+#if DUCKDB_V2_API_ALLOW_UNSTABLE
+/*!
+ * Returns the value as a UUID, in its internal 128-bit form.
+ *
+ * The dual of value_create_uuid: the storage form a vector element holds, with the high bit flipped so the integer
+ * sorts, rather than the canonical byte order. A value of any other type id, and a NULL value, return
+ * ERROR_INPUT_INVALID.
+ *
+ * history:
+ * - unstable: v2.0.0
+ *
+ * @param value The value to read.
+ * @param out Receives the internal 128-bit storage form.
+ * @param err Optional. On failure, receives an opaque info handle the caller must destroy via error_info_destroy.
+ * @return DUCKDB_V2_ERROR
+ */
+DUCKDB_C_API DUCKDB_V2_ERROR duckdb_v2_value_get_uuid(duckdb_v2_value_handle value, duckdb_v2_hugeint_t *out,
+                                                      duckdb_v2_error_info_handle *err);
+#endif
+
+#if DUCKDB_V2_API_ALLOW_UNSTABLE
+/*!
+ * Returns the value as a DECIMAL: its backing integer plus the width and scale of its type.
+ *
+ * The integer is the value scaled by 10^scale — the dual of value_create_decimal — widened to 128 bits from whatever
+ * storage tier the width selects. The integer getters convert, so a DECIMAL read through value_get_bigint is its
+ * numeric value with the fraction dropped; this one always reports storage instead, together with the scale needed to
+ * interpret it. A value of any other type id, and a NULL value, return ERROR_INPUT_INVALID.
+ *
+ * history:
+ * - unstable: v2.0.0
+ *
+ * @param value The value to read.
+ * @param out Receives the backing integer, scaled by 10^scale.
+ * @param out_width Receives the total digit count of the value's type.
+ * @param out_scale Receives the digits after the decimal point.
+ * @param err Optional. On failure, receives an opaque info handle the caller must destroy via error_info_destroy.
+ * @return DUCKDB_V2_ERROR
+ */
+DUCKDB_C_API DUCKDB_V2_ERROR duckdb_v2_value_get_decimal(duckdb_v2_value_handle value, duckdb_v2_hugeint_t *out,
+                                                         uint8_t *out_width, uint8_t *out_scale,
+                                                         duckdb_v2_error_info_handle *err);
+#endif
+
+#if DUCKDB_V2_API_ALLOW_UNSTABLE
+/*!
+ * Unwraps the logical type carried by a TYPE value.
+ *
+ * Returns ERROR_INPUT_INVALID unless the value is a non-NULL TYPE value. The returned logical type is caller-owned and
+ * must be destroyed via logical_type_destroy.
+ *
+ * history:
+ * - unstable: v2.0.0
+ *
+ * @param value The value to read.
+ * @param out_type Receives the owned logical type.
+ * @param err Optional. On failure, receives an opaque info handle the caller must destroy via error_info_destroy.
+ * @return DUCKDB_V2_ERROR
+ */
+DUCKDB_C_API DUCKDB_V2_ERROR duckdb_v2_value_get_type(duckdb_v2_value_handle value,
+                                                      duckdb_v2_logical_type_handle *out_type,
+                                                      duckdb_v2_error_info_handle *err);
+#endif
+
+#if DUCKDB_V2_API_ALLOW_UNSTABLE
+/*!
+ * Creates a NULL value of the given logical type.
+ *
+ * The logical type is borrowed and copied into the value, so the caller can destroy it independently.
+ *
+ * history:
+ * - unstable: v2.0.0
+ *
+ * @param factory The factory to create with.
+ * @param type The borrowed logical type to attach to the NULL value.
+ * @param out_value Receives the new NULL value.
+ * @param err Optional. On failure, receives an opaque info handle the caller must destroy via error_info_destroy.
+ * @return DUCKDB_V2_ERROR
+ */
+DUCKDB_C_API DUCKDB_V2_ERROR duckdb_v2_value_create_null(duckdb_v2_factory_handle factory,
+                                                         duckdb_v2_logical_type_handle type,
+                                                         duckdb_v2_value_handle *out_value,
+                                                         duckdb_v2_error_info_handle *err);
+#endif
+
+#if DUCKDB_V2_API_ALLOW_UNSTABLE
+/*!
+ * Creates a BOOLEAN value from a bool.
+ *
+ * The input is copied in. The returned value is caller-owned; destroy it via value_destroy.
+ *
+ * history:
+ * - unstable: v2.0.0
+ *
+ * @param factory The factory to create with.
+ * @param in_value The bool to wrap.
+ * @param out_value Receives the new BOOLEAN value.
+ * @param err Optional. On failure, receives an opaque info handle the caller must destroy via error_info_destroy.
+ * @return DUCKDB_V2_ERROR
+ */
+DUCKDB_C_API DUCKDB_V2_ERROR duckdb_v2_value_create_bool(duckdb_v2_factory_handle factory, bool in_value,
+                                                         duckdb_v2_value_handle *out_value,
+                                                         duckdb_v2_error_info_handle *err);
+#endif
+
+#if DUCKDB_V2_API_ALLOW_UNSTABLE
+/*!
+ * Creates a UTINYINT value from a uint8_t.
+ *
+ * The input is copied in. The returned value is caller-owned; destroy it via value_destroy.
+ *
+ * history:
+ * - unstable: v2.0.0
+ *
+ * @param factory The factory to create with.
+ * @param in_value The uint8_t to wrap.
+ * @param out_value Receives the new UTINYINT value.
+ * @param err Optional. On failure, receives an opaque info handle the caller must destroy via error_info_destroy.
+ * @return DUCKDB_V2_ERROR
+ */
+DUCKDB_C_API DUCKDB_V2_ERROR duckdb_v2_value_create_utinyint(duckdb_v2_factory_handle factory, uint8_t in_value,
+                                                             duckdb_v2_value_handle *out_value,
+                                                             duckdb_v2_error_info_handle *err);
+#endif
+
+#if DUCKDB_V2_API_ALLOW_UNSTABLE
+/*!
+ * Creates a USMALLINT value from a uint16_t.
+ *
+ * The input is copied in. The returned value is caller-owned; destroy it via value_destroy.
+ *
+ * history:
+ * - unstable: v2.0.0
+ *
+ * @param factory The factory to create with.
+ * @param in_value The uint16_t to wrap.
+ * @param out_value Receives the new USMALLINT value.
+ * @param err Optional. On failure, receives an opaque info handle the caller must destroy via error_info_destroy.
+ * @return DUCKDB_V2_ERROR
+ */
+DUCKDB_C_API DUCKDB_V2_ERROR duckdb_v2_value_create_usmallint(duckdb_v2_factory_handle factory, uint16_t in_value,
+                                                              duckdb_v2_value_handle *out_value,
+                                                              duckdb_v2_error_info_handle *err);
+#endif
+
+#if DUCKDB_V2_API_ALLOW_UNSTABLE
+/*!
+ * Creates a UINTEGER value from a uint32_t.
+ *
+ * The input is copied in. The returned value is caller-owned; destroy it via value_destroy.
+ *
+ * history:
+ * - unstable: v2.0.0
+ *
+ * @param factory The factory to create with.
+ * @param in_value The uint32_t to wrap.
+ * @param out_value Receives the new UINTEGER value.
+ * @param err Optional. On failure, receives an opaque info handle the caller must destroy via error_info_destroy.
+ * @return DUCKDB_V2_ERROR
+ */
+DUCKDB_C_API DUCKDB_V2_ERROR duckdb_v2_value_create_uint(duckdb_v2_factory_handle factory, uint32_t in_value,
+                                                         duckdb_v2_value_handle *out_value,
+                                                         duckdb_v2_error_info_handle *err);
+#endif
+
+#if DUCKDB_V2_API_ALLOW_UNSTABLE
+/*!
+ * Creates a UBIGINT value from a uint64_t.
+ *
+ * The input is copied in. The returned value is caller-owned; destroy it via value_destroy.
+ *
+ * history:
+ * - unstable: v2.0.0
+ *
+ * @param factory The factory to create with.
+ * @param in_value The uint64_t to wrap.
+ * @param out_value Receives the new UBIGINT value.
+ * @param err Optional. On failure, receives an opaque info handle the caller must destroy via error_info_destroy.
+ * @return DUCKDB_V2_ERROR
+ */
+DUCKDB_C_API DUCKDB_V2_ERROR duckdb_v2_value_create_ubigint(duckdb_v2_factory_handle factory, uint64_t in_value,
+                                                            duckdb_v2_value_handle *out_value,
+                                                            duckdb_v2_error_info_handle *err);
+#endif
+
+#if DUCKDB_V2_API_ALLOW_UNSTABLE
+/*!
+ * Creates a UHUGEINT value from a uint128_t.
+ *
+ * The input is copied in. The returned value is caller-owned; destroy it via value_destroy.
+ *
+ * history:
+ * - unstable: v2.0.0
+ *
+ * @param factory The factory to create with.
+ * @param in_value The uint128_t to wrap.
+ * @param out_value Receives the new UHUGEINT value.
+ * @param err Optional. On failure, receives an opaque info handle the caller must destroy via error_info_destroy.
+ * @return DUCKDB_V2_ERROR
+ */
+DUCKDB_C_API DUCKDB_V2_ERROR duckdb_v2_value_create_uhugeint(duckdb_v2_factory_handle factory,
+                                                             const duckdb_v2_uhugeint_t *in_value,
+                                                             duckdb_v2_value_handle *out_value,
+                                                             duckdb_v2_error_info_handle *err);
+#endif
+
+#if DUCKDB_V2_API_ALLOW_UNSTABLE
+/*!
+ * Creates a TINYINT value from an int8_t.
+ *
+ * The input is copied in. The returned value is caller-owned; destroy it via value_destroy.
+ *
+ * history:
+ * - unstable: v2.0.0
+ *
+ * @param factory The factory to create with.
+ * @param in_value The int8_t to wrap.
+ * @param out_value Receives the new TINYINT value.
+ * @param err Optional. On failure, receives an opaque info handle the caller must destroy via error_info_destroy.
+ * @return DUCKDB_V2_ERROR
+ */
+DUCKDB_C_API DUCKDB_V2_ERROR duckdb_v2_value_create_tinyint(duckdb_v2_factory_handle factory, int8_t in_value,
+                                                            duckdb_v2_value_handle *out_value,
+                                                            duckdb_v2_error_info_handle *err);
+#endif
+
+#if DUCKDB_V2_API_ALLOW_UNSTABLE
+/*!
+ * Creates a SMALLINT value from an int16_t.
+ *
+ * The input is copied in. The returned value is caller-owned; destroy it via value_destroy.
+ *
+ * history:
+ * - unstable: v2.0.0
+ *
+ * @param factory The factory to create with.
+ * @param in_value The int16_t to wrap.
+ * @param out_value Receives the new SMALLINT value.
+ * @param err Optional. On failure, receives an opaque info handle the caller must destroy via error_info_destroy.
+ * @return DUCKDB_V2_ERROR
+ */
+DUCKDB_C_API DUCKDB_V2_ERROR duckdb_v2_value_create_smallint(duckdb_v2_factory_handle factory, int16_t in_value,
+                                                             duckdb_v2_value_handle *out_value,
+                                                             duckdb_v2_error_info_handle *err);
+#endif
+
+#if DUCKDB_V2_API_ALLOW_UNSTABLE
+/*!
+ * Creates an INTEGER value from an int32_t.
+ *
+ * The input is copied in. The returned value is caller-owned; destroy it via value_destroy.
+ *
+ * history:
+ * - unstable: v2.0.0
+ *
+ * @param factory The factory to create with.
+ * @param in_value The int32_t to wrap.
+ * @param out_value Receives the new INTEGER value.
+ * @param err Optional. On failure, receives an opaque info handle the caller must destroy via error_info_destroy.
+ * @return DUCKDB_V2_ERROR
+ */
+DUCKDB_C_API DUCKDB_V2_ERROR duckdb_v2_value_create_int(duckdb_v2_factory_handle factory, int32_t in_value,
+                                                        duckdb_v2_value_handle *out_value,
+                                                        duckdb_v2_error_info_handle *err);
+#endif
+
+#if DUCKDB_V2_API_ALLOW_UNSTABLE
+/*!
+ * Creates a BIGINT value from an int64_t.
+ *
+ * The input is copied in. The returned value is caller-owned; destroy it via value_destroy.
+ *
+ * history:
+ * - unstable: v2.0.0
+ *
+ * @param factory The factory to create with.
+ * @param in_value The int64_t to wrap.
+ * @param out_value Receives the new BIGINT value.
+ * @param err Optional. On failure, receives an opaque info handle the caller must destroy via error_info_destroy.
+ * @return DUCKDB_V2_ERROR
+ */
+DUCKDB_C_API DUCKDB_V2_ERROR duckdb_v2_value_create_bigint(duckdb_v2_factory_handle factory, int64_t in_value,
+                                                           duckdb_v2_value_handle *out_value,
+                                                           duckdb_v2_error_info_handle *err);
+#endif
+
+#if DUCKDB_V2_API_ALLOW_UNSTABLE
+/*!
+ * Creates a HUGEINT value from an int128_t.
+ *
+ * The input is copied in. The returned value is caller-owned; destroy it via value_destroy.
+ *
+ * history:
+ * - unstable: v2.0.0
+ *
+ * @param factory The factory to create with.
+ * @param in_value The int128_t to wrap.
+ * @param out_value Receives the new HUGEINT value.
+ * @param err Optional. On failure, receives an opaque info handle the caller must destroy via error_info_destroy.
+ * @return DUCKDB_V2_ERROR
+ */
+DUCKDB_C_API DUCKDB_V2_ERROR duckdb_v2_value_create_hugeint(duckdb_v2_factory_handle factory,
+                                                            const duckdb_v2_hugeint_t *in_value,
+                                                            duckdb_v2_value_handle *out_value,
+                                                            duckdb_v2_error_info_handle *err);
+#endif
+
+#if DUCKDB_V2_API_ALLOW_UNSTABLE
+/*!
+ * Creates a VARCHAR value from a UTF-8 string.
+ *
+ * The input is copied in. The returned value is caller-owned; destroy it via value_destroy.
+ *
+ * history:
+ * - unstable: v2.0.0
+ *
+ * @param factory The factory to create with.
+ * @param in_value The UTF-8 string to wrap. May be null only when len is 0 (empty string).
+ * @param out_value Receives the new VARCHAR value.
+ * @param err Optional. On failure, receives an opaque info handle the caller must destroy via error_info_destroy.
+ * @return DUCKDB_V2_ERROR
+ */
+DUCKDB_C_API DUCKDB_V2_ERROR duckdb_v2_value_create_varchar(duckdb_v2_factory_handle factory,
+                                                            const duckdb_v2_str *in_value,
+                                                            duckdb_v2_value_handle *out_value,
+                                                            duckdb_v2_error_info_handle *err);
+#endif
+
+#if DUCKDB_V2_API_ALLOW_UNSTABLE
+/*!
+ * Creates a BLOB value from a byte string.
+ *
+ * The input is copied in. The returned value is caller-owned; destroy it via value_destroy.
+ *
+ * history:
+ * - unstable: v2.0.0
+ *
+ * @param factory The factory to create with.
+ * @param in_value The byte string to wrap. May be null only when len is 0 (empty string).
+ * @param out_value Receives the new BLOB value.
+ * @param err Optional. On failure, receives an opaque info handle the caller must destroy via error_info_destroy.
+ * @return DUCKDB_V2_ERROR
+ */
+DUCKDB_C_API DUCKDB_V2_ERROR duckdb_v2_value_create_blob(duckdb_v2_factory_handle factory,
+                                                         const duckdb_v2_str *in_value,
+                                                         duckdb_v2_value_handle *out_value,
+                                                         duckdb_v2_error_info_handle *err);
+#endif
+
+#if DUCKDB_V2_API_ALLOW_UNSTABLE
+/*!
+ * Creates a FLOAT value from a float.
+ *
+ * The input is copied in. The returned value is caller-owned; destroy it via value_destroy.
+ *
+ * history:
+ * - unstable: v2.0.0
+ *
+ * @param factory The factory to create with.
+ * @param in_value The float to wrap.
+ * @param out_value Receives the new FLOAT value.
+ * @param err Optional. On failure, receives an opaque info handle the caller must destroy via error_info_destroy.
+ * @return DUCKDB_V2_ERROR
+ */
+DUCKDB_C_API DUCKDB_V2_ERROR duckdb_v2_value_create_float(duckdb_v2_factory_handle factory, float in_value,
+                                                          duckdb_v2_value_handle *out_value,
+                                                          duckdb_v2_error_info_handle *err);
+#endif
+
+#if DUCKDB_V2_API_ALLOW_UNSTABLE
+/*!
+ * Creates a DOUBLE value from a double.
+ *
+ * The input is copied in. The returned value is caller-owned; destroy it via value_destroy.
+ *
+ * history:
+ * - unstable: v2.0.0
+ *
+ * @param factory The factory to create with.
+ * @param in_value The double to wrap.
+ * @param out_value Receives the new DOUBLE value.
+ * @param err Optional. On failure, receives an opaque info handle the caller must destroy via error_info_destroy.
+ * @return DUCKDB_V2_ERROR
+ */
+DUCKDB_C_API DUCKDB_V2_ERROR duckdb_v2_value_create_double(duckdb_v2_factory_handle factory, double in_value,
+                                                           duckdb_v2_value_handle *out_value,
+                                                           duckdb_v2_error_info_handle *err);
+#endif
+
+#if DUCKDB_V2_API_ALLOW_UNSTABLE
+/*!
+ * Creates a TYPE value from a logical type.
+ *
+ * The logical type is borrowed and copied into the value, so the caller can destroy it independently.
+ *
+ * history:
+ * - unstable: v2.0.0
+ *
+ * @param factory The factory to create with.
+ * @param in_type The borrowed logical type to wrap.
+ * @param out_value Receives the new TYPE value.
+ * @param err Optional. On failure, receives an opaque info handle the caller must destroy via error_info_destroy.
+ * @return DUCKDB_V2_ERROR
+ */
+DUCKDB_C_API DUCKDB_V2_ERROR duckdb_v2_value_create_type(duckdb_v2_factory_handle factory,
+                                                         duckdb_v2_logical_type_handle in_type,
+                                                         duckdb_v2_value_handle *out_value,
+                                                         duckdb_v2_error_info_handle *err);
+#endif
+
+#if DUCKDB_V2_API_ALLOW_UNSTABLE
+/*!
+ * Creates a DATE value.
+ *
+ * The payload is days since 1970-01-01, the same unit value_get_date reports. It is not range-checked here; value_cast
+ * is the validating path. The returned value is caller-owned; destroy it via value_destroy.
+ *
+ * history:
+ * - unstable: v2.0.0
+ *
+ * @param factory The factory to create with.
+ * @param in_value The payload to wrap.
+ * @param out_value Receives the new DATE value.
+ * @param err Optional. On failure, receives an opaque info handle the caller must destroy via error_info_destroy.
+ * @return DUCKDB_V2_ERROR
+ */
+DUCKDB_C_API DUCKDB_V2_ERROR duckdb_v2_value_create_date(duckdb_v2_factory_handle factory, int32_t in_value,
+                                                         duckdb_v2_value_handle *out_value,
+                                                         duckdb_v2_error_info_handle *err);
+#endif
+
+#if DUCKDB_V2_API_ALLOW_UNSTABLE
+/*!
+ * Creates a TIME value.
+ *
+ * The payload is microseconds since midnight, the same unit value_get_time reports. It is not range-checked here;
+ * value_cast is the validating path. The returned value is caller-owned; destroy it via value_destroy.
+ *
+ * history:
+ * - unstable: v2.0.0
+ *
+ * @param factory The factory to create with.
+ * @param in_value The payload to wrap.
+ * @param out_value Receives the new TIME value.
+ * @param err Optional. On failure, receives an opaque info handle the caller must destroy via error_info_destroy.
+ * @return DUCKDB_V2_ERROR
+ */
+DUCKDB_C_API DUCKDB_V2_ERROR duckdb_v2_value_create_time(duckdb_v2_factory_handle factory, int64_t in_value,
+                                                         duckdb_v2_value_handle *out_value,
+                                                         duckdb_v2_error_info_handle *err);
+#endif
+
+#if DUCKDB_V2_API_ALLOW_UNSTABLE
+/*!
+ * Creates a TIME_NS value.
+ *
+ * The payload is nanoseconds since midnight, the same unit value_get_time_ns reports. It is not range-checked here;
+ * value_cast is the validating path. The returned value is caller-owned; destroy it via value_destroy.
+ *
+ * history:
+ * - unstable: v2.0.0
+ *
+ * @param factory The factory to create with.
+ * @param in_value The payload to wrap.
+ * @param out_value Receives the new TIME_NS value.
+ * @param err Optional. On failure, receives an opaque info handle the caller must destroy via error_info_destroy.
+ * @return DUCKDB_V2_ERROR
+ */
+DUCKDB_C_API DUCKDB_V2_ERROR duckdb_v2_value_create_time_ns(duckdb_v2_factory_handle factory, int64_t in_value,
+                                                            duckdb_v2_value_handle *out_value,
+                                                            duckdb_v2_error_info_handle *err);
+#endif
+
+#if DUCKDB_V2_API_ALLOW_UNSTABLE
+/*!
+ * Creates a TIME_TZ value.
+ *
+ * The payload packs the time of day and the UTC offset into one integer, in the committed layout: micros in the high 40
+ * bits, a biased offset in the low 24. The same form value_get_time_tz reports. It is not range-checked here;
+ * value_cast is the validating path. The returned value is caller-owned; destroy it via value_destroy.
+ *
+ * history:
+ * - unstable: v2.0.0
+ *
+ * @param factory The factory to create with.
+ * @param in_value The payload to wrap.
+ * @param out_value Receives the new TIME_TZ value.
+ * @param err Optional. On failure, receives an opaque info handle the caller must destroy via error_info_destroy.
+ * @return DUCKDB_V2_ERROR
+ */
+DUCKDB_C_API DUCKDB_V2_ERROR duckdb_v2_value_create_time_tz(duckdb_v2_factory_handle factory, uint64_t in_value,
+                                                            duckdb_v2_value_handle *out_value,
+                                                            duckdb_v2_error_info_handle *err);
+#endif
+
+#if DUCKDB_V2_API_ALLOW_UNSTABLE
+/*!
+ * Creates a TIMESTAMP value.
+ *
+ * The payload is microseconds since 1970-01-01, the same unit value_get_timestamp reports. It is not range-checked
+ * here; value_cast is the validating path. The returned value is caller-owned; destroy it via value_destroy.
+ *
+ * history:
+ * - unstable: v2.0.0
+ *
+ * @param factory The factory to create with.
+ * @param in_value The payload to wrap.
+ * @param out_value Receives the new TIMESTAMP value.
+ * @param err Optional. On failure, receives an opaque info handle the caller must destroy via error_info_destroy.
+ * @return DUCKDB_V2_ERROR
+ */
+DUCKDB_C_API DUCKDB_V2_ERROR duckdb_v2_value_create_timestamp(duckdb_v2_factory_handle factory, int64_t in_value,
+                                                              duckdb_v2_value_handle *out_value,
+                                                              duckdb_v2_error_info_handle *err);
+#endif
+
+#if DUCKDB_V2_API_ALLOW_UNSTABLE
+/*!
+ * Creates a TIMESTAMP_SEC value.
+ *
+ * The payload is seconds since 1970-01-01, the same unit value_get_timestamp_sec reports. It is not range-checked here;
+ * value_cast is the validating path. The returned value is caller-owned; destroy it via value_destroy.
+ *
+ * history:
+ * - unstable: v2.0.0
+ *
+ * @param factory The factory to create with.
+ * @param in_value The payload to wrap.
+ * @param out_value Receives the new TIMESTAMP_SEC value.
+ * @param err Optional. On failure, receives an opaque info handle the caller must destroy via error_info_destroy.
+ * @return DUCKDB_V2_ERROR
+ */
+DUCKDB_C_API DUCKDB_V2_ERROR duckdb_v2_value_create_timestamp_sec(duckdb_v2_factory_handle factory, int64_t in_value,
+                                                                  duckdb_v2_value_handle *out_value,
+                                                                  duckdb_v2_error_info_handle *err);
+#endif
+
+#if DUCKDB_V2_API_ALLOW_UNSTABLE
+/*!
+ * Creates a TIMESTAMP_MS value.
+ *
+ * The payload is milliseconds since 1970-01-01, the same unit value_get_timestamp_ms reports. It is not range-checked
+ * here; value_cast is the validating path. The returned value is caller-owned; destroy it via value_destroy.
+ *
+ * history:
+ * - unstable: v2.0.0
+ *
+ * @param factory The factory to create with.
+ * @param in_value The payload to wrap.
+ * @param out_value Receives the new TIMESTAMP_MS value.
+ * @param err Optional. On failure, receives an opaque info handle the caller must destroy via error_info_destroy.
+ * @return DUCKDB_V2_ERROR
+ */
+DUCKDB_C_API DUCKDB_V2_ERROR duckdb_v2_value_create_timestamp_ms(duckdb_v2_factory_handle factory, int64_t in_value,
+                                                                 duckdb_v2_value_handle *out_value,
+                                                                 duckdb_v2_error_info_handle *err);
+#endif
+
+#if DUCKDB_V2_API_ALLOW_UNSTABLE
+/*!
+ * Creates a TIMESTAMP_NS value.
+ *
+ * The payload is nanoseconds since 1970-01-01, the same unit value_get_timestamp_ns reports. It is not range-checked
+ * here; value_cast is the validating path. The returned value is caller-owned; destroy it via value_destroy.
+ *
+ * history:
+ * - unstable: v2.0.0
+ *
+ * @param factory The factory to create with.
+ * @param in_value The payload to wrap.
+ * @param out_value Receives the new TIMESTAMP_NS value.
+ * @param err Optional. On failure, receives an opaque info handle the caller must destroy via error_info_destroy.
+ * @return DUCKDB_V2_ERROR
+ */
+DUCKDB_C_API DUCKDB_V2_ERROR duckdb_v2_value_create_timestamp_ns(duckdb_v2_factory_handle factory, int64_t in_value,
+                                                                 duckdb_v2_value_handle *out_value,
+                                                                 duckdb_v2_error_info_handle *err);
+#endif
+
+#if DUCKDB_V2_API_ALLOW_UNSTABLE
+/*!
+ * Creates a TIMESTAMP_TZ value.
+ *
+ * The payload is microseconds since 1970-01-01, in UTC, the same unit value_get_timestamp_tz reports. It is not
+ * range-checked here; value_cast is the validating path. The returned value is caller-owned; destroy it via
+ * value_destroy.
+ *
+ * history:
+ * - unstable: v2.0.0
+ *
+ * @param factory The factory to create with.
+ * @param in_value The payload to wrap.
+ * @param out_value Receives the new TIMESTAMP_TZ value.
+ * @param err Optional. On failure, receives an opaque info handle the caller must destroy via error_info_destroy.
+ * @return DUCKDB_V2_ERROR
+ */
+DUCKDB_C_API DUCKDB_V2_ERROR duckdb_v2_value_create_timestamp_tz(duckdb_v2_factory_handle factory, int64_t in_value,
+                                                                 duckdb_v2_value_handle *out_value,
+                                                                 duckdb_v2_error_info_handle *err);
+#endif
+
+#if DUCKDB_V2_API_ALLOW_UNSTABLE
+/*!
+ * Creates a TIMESTAMP_TZ_NS value.
+ *
+ * The payload is nanoseconds since 1970-01-01, in UTC, the same unit value_get_timestamp_tz_ns reports. It is not
+ * range-checked here; value_cast is the validating path. The returned value is caller-owned; destroy it via
+ * value_destroy.
+ *
+ * history:
+ * - unstable: v2.0.0
+ *
+ * @param factory The factory to create with.
+ * @param in_value The payload to wrap.
+ * @param out_value Receives the new TIMESTAMP_TZ_NS value.
+ * @param err Optional. On failure, receives an opaque info handle the caller must destroy via error_info_destroy.
+ * @return DUCKDB_V2_ERROR
+ */
+DUCKDB_C_API DUCKDB_V2_ERROR duckdb_v2_value_create_timestamp_tz_ns(duckdb_v2_factory_handle factory, int64_t in_value,
+                                                                    duckdb_v2_value_handle *out_value,
+                                                                    duckdb_v2_error_info_handle *err);
+#endif
+
+#if DUCKDB_V2_API_ALLOW_UNSTABLE
+/*!
+ * Creates a INTERVAL value.
+ *
+ * The payload is the (months, days, micros) triple, the same unit value_get_interval reports. It is not range-checked
+ * here; value_cast is the validating path. The returned value is caller-owned; destroy it via value_destroy.
+ *
+ * history:
+ * - unstable: v2.0.0
+ *
+ * @param factory The factory to create with.
+ * @param in_value The payload to wrap.
+ * @param out_value Receives the new INTERVAL value.
+ * @param err Optional. On failure, receives an opaque info handle the caller must destroy via error_info_destroy.
+ * @return DUCKDB_V2_ERROR
+ */
+DUCKDB_C_API DUCKDB_V2_ERROR duckdb_v2_value_create_interval(duckdb_v2_factory_handle factory,
+                                                             const duckdb_v2_interval_t *in_value,
+                                                             duckdb_v2_value_handle *out_value,
+                                                             duckdb_v2_error_info_handle *err);
+#endif
+
+#if DUCKDB_V2_API_ALLOW_UNSTABLE
+/*!
+ * Creates a DECIMAL value from its backing integer.
+ *
+ * The value is scaled by 10^scale, so (18500, 18, 3) is 18.500. width is the total digit count and must be 1..38; scale
+ * is the number of digits after the point and must not exceed width. Violating either returns ERROR_INPUT_INVALID, as
+ * does a value too wide for the storage tier the width selects. The value itself is not range-checked against the
+ * width; value_cast is the validating path.
+ *
+ * history:
+ * - unstable: v2.0.0
+ *
+ * @param factory The factory to create with.
+ * @param in_value The backing integer, scaled by 10^scale.
+ * @param width Total digit count, 1..38.
+ * @param scale Digits after the decimal point; must not exceed width.
+ * @param out_value Receives the new DECIMAL value.
+ * @param err Optional. On failure, receives an opaque info handle the caller must destroy via error_info_destroy.
+ * @return DUCKDB_V2_ERROR
+ */
+DUCKDB_C_API DUCKDB_V2_ERROR duckdb_v2_value_create_decimal(duckdb_v2_factory_handle factory,
+                                                            const duckdb_v2_hugeint_t *in_value, uint8_t width,
+                                                            uint8_t scale, duckdb_v2_value_handle *out_value,
+                                                            duckdb_v2_error_info_handle *err);
+#endif
+
+#if DUCKDB_V2_API_ALLOW_UNSTABLE
+/*!
+ * Creates a UUID value from its internal 128-bit form.
+ *
+ * The payload is the storage form a vector element holds, not the canonical byte order: the high bit is flipped so the
+ * integer sorts. To build one from canonical text, cast a VARCHAR with value_cast instead, which is also how a UUID
+ * renders back.
+ *
+ * history:
+ * - unstable: v2.0.0
+ *
+ * @param factory The factory to create with.
+ * @param in_value The internal 128-bit storage form.
+ * @param out_value Receives the new UUID value.
+ * @param err Optional. On failure, receives an opaque info handle the caller must destroy via error_info_destroy.
+ * @return DUCKDB_V2_ERROR
+ */
+DUCKDB_C_API DUCKDB_V2_ERROR duckdb_v2_value_create_uuid(duckdb_v2_factory_handle factory,
+                                                         const duckdb_v2_hugeint_t *in_value,
+                                                         duckdb_v2_value_handle *out_value,
+                                                         duckdb_v2_error_info_handle *err);
+#endif
+
+#if DUCKDB_V2_API_ALLOW_UNSTABLE
+/*!
+ * Creates a BIT value from its wire bytes.
+ *
+ * The wire form is a mandatory padding-header byte — the count of leading bits in the first data byte that are not part
+ * of the bit string — followed by the data bytes, so the input must be at least 1 byte. These are the same bytes
+ * value_get_blob reports back.
+ *
+ * history:
+ * - unstable: v2.0.0
+ *
+ * @param factory The factory to create with.
+ * @param in_value The wire bytes, a padding header byte followed by data. Must be at least 1 byte.
+ * @param out_value Receives the new BIT value.
+ * @param err Optional. On failure, receives an opaque info handle the caller must destroy via error_info_destroy.
+ * @return DUCKDB_V2_ERROR
+ */
+DUCKDB_C_API DUCKDB_V2_ERROR duckdb_v2_value_create_bit(duckdb_v2_factory_handle factory, const duckdb_v2_str *in_value,
+                                                        duckdb_v2_value_handle *out_value,
+                                                        duckdb_v2_error_info_handle *err);
+#endif
+
+#if DUCKDB_V2_API_ALLOW_UNSTABLE
+/*!
+ * Creates a BIGNUM value from its storage bytes.
+ *
+ * The bytes are opaque storage, as produced by bignum_encode from a magnitude and a sign flag; a negative is stored
+ * bit-inverted behind a header, so these are not the magnitude bytes. The header plus at least one magnitude byte means
+ * the input must exceed 3 bytes. These are the same bytes value_get_blob reports back, for bignum_decode to translate.
+ *
+ * history:
+ * - unstable: v2.0.0
+ *
+ * @param factory The factory to create with.
+ * @param in_value The opaque storage bytes from bignum_encode. Must exceed 3 bytes.
+ * @param out_value Receives the new BIGNUM value.
+ * @param err Optional. On failure, receives an opaque info handle the caller must destroy via error_info_destroy.
+ * @return DUCKDB_V2_ERROR
+ */
+DUCKDB_C_API DUCKDB_V2_ERROR duckdb_v2_value_create_bignum(duckdb_v2_factory_handle factory,
+                                                           const duckdb_v2_str *in_value,
+                                                           duckdb_v2_value_handle *out_value,
+                                                           duckdb_v2_error_info_handle *err);
+#endif
+
+#if DUCKDB_V2_API_ALLOW_UNSTABLE
+/*!
+ * Creates a LIST value from its elements.
+ *
+ * The child type is the common type of the elements, resolved by the same rule a SQL list literal follows, and every
+ * element is cast to it; a set with no common type surfaces the cast error. Pass child_type to name the type instead,
+ * which is also how an empty list is built: with child_type NULL, an empty element array has no type to resolve and
+ * returns ERROR_INPUT_INVALID.
+ *
+ * The elements are borrowed and copied in, and a NULL element becomes a typed NULL. The type is rebuilt from its child,
+ * so an alias on the outer LIST type is not preserved; value_cast is the alias-preserving path.
+ *
+ * history:
+ * - unstable: v2.0.0
+ *
+ * @param factory The factory to create with.
+ * @param child_type Optional. The element type. Pass NULL to resolve it from the elements.
+ * @param children An array of child_count elements. Borrowed (copied in). Pass NULL when child_count is 0.
+ * @param child_count The number of elements.
+ * @param out_value Receives the new composite value.
+ * @param err Optional. On failure, receives an opaque info handle the caller must destroy via error_info_destroy.
+ * @return DUCKDB_V2_ERROR
+ */
+DUCKDB_C_API DUCKDB_V2_ERROR duckdb_v2_value_create_list(duckdb_v2_factory_handle factory,
+                                                         duckdb_v2_logical_type_handle child_type,
+                                                         const duckdb_v2_value_handle *children, idx_t child_count,
+                                                         duckdb_v2_value_handle *out_value,
+                                                         duckdb_v2_error_info_handle *err);
+#endif
+
+#if DUCKDB_V2_API_ALLOW_UNSTABLE
+/*!
+ * Creates an ARRAY value from its elements, sized by their count.
+ *
+ * The child type is resolved exactly as for value_create_list, and child_type names it explicitly the same way. The
+ * minimum array size is 1, so an empty element array returns ERROR_INPUT_INVALID whether or not child_type is given.
+ *
+ * The elements are borrowed and copied in, and a NULL element becomes a typed NULL.
+ *
+ * history:
+ * - unstable: v2.0.0
+ *
+ * @param factory The factory to create with.
+ * @param child_type Optional. The element type. Pass NULL to resolve it from the elements.
+ * @param children An array of child_count elements. Borrowed (copied in). Pass NULL when child_count is 0.
+ * @param child_count The number of elements.
+ * @param out_value Receives the new composite value.
+ * @param err Optional. On failure, receives an opaque info handle the caller must destroy via error_info_destroy.
+ * @return DUCKDB_V2_ERROR
+ */
+DUCKDB_C_API DUCKDB_V2_ERROR duckdb_v2_value_create_array(duckdb_v2_factory_handle factory,
+                                                          duckdb_v2_logical_type_handle child_type,
+                                                          const duckdb_v2_value_handle *children, idx_t child_count,
+                                                          duckdb_v2_value_handle *out_value,
+                                                          duckdb_v2_error_info_handle *err);
+#endif
+
+#if DUCKDB_V2_API_ALLOW_UNSTABLE
+/*!
+ * Creates a STRUCT value from named fields, in order.
+ *
+ * Each field keeps its own child's type, so there is nothing to resolve across them; names and children are parallel
+ * arrays of field_count entries. An empty field list builds the empty struct, which is a real type.
+ *
+ * The names and children are borrowed and copied in, and a NULL child becomes a typed NULL. Duplicate field names are
+ * rejected.
+ *
+ * history:
+ * - unstable: v2.0.0
+ *
+ * @param factory The factory to create with.
+ * @param names An array of field_count field names. Pass NULL when field_count is 0.
+ * @param children An array of field_count field values. Borrowed (copied in). Pass NULL when field_count is 0.
+ * @param field_count The number of fields.
+ * @param out_value Receives the new composite value.
+ * @param err Optional. On failure, receives an opaque info handle the caller must destroy via error_info_destroy.
+ * @return DUCKDB_V2_ERROR
+ */
+DUCKDB_C_API DUCKDB_V2_ERROR duckdb_v2_value_create_struct(duckdb_v2_factory_handle factory,
+                                                           const duckdb_v2_identifier_t *names,
+                                                           const duckdb_v2_value_handle *children, idx_t field_count,
+                                                           duckdb_v2_value_handle *out_value,
+                                                           duckdb_v2_error_info_handle *err);
+#endif
+
+#if DUCKDB_V2_API_ALLOW_UNSTABLE
+/*!
+ * Creates a TUPLE value from positional fields.
+ *
+ * TUPLE is the unnamed struct: the same positional children as value_create_struct, under a distinct type id and with
+ * no names. Each field keeps its own child's type. An empty field list builds the empty tuple, which is a real type.
+ *
+ * The children are borrowed and copied in, and a NULL child becomes a typed NULL.
+ *
+ * history:
+ * - unstable: v2.0.0
+ *
+ * @param factory The factory to create with.
+ * @param children An array of field_count field values. Borrowed (copied in). Pass NULL when field_count is 0.
+ * @param field_count The number of fields.
+ * @param out_value Receives the new composite value.
+ * @param err Optional. On failure, receives an opaque info handle the caller must destroy via error_info_destroy.
+ * @return DUCKDB_V2_ERROR
+ */
+DUCKDB_C_API DUCKDB_V2_ERROR duckdb_v2_value_create_tuple(duckdb_v2_factory_handle factory,
+                                                          const duckdb_v2_value_handle *children, idx_t field_count,
+                                                          duckdb_v2_value_handle *out_value,
+                                                          duckdb_v2_error_info_handle *err);
+#endif
+
+#if DUCKDB_V2_API_ALLOW_UNSTABLE
+/*!
+ * Creates a MAP value from parallel key and value arrays.
+ *
+ * The key and value types are the common types of the keys and of the values, resolved as for value_create_list, and
+ * every entry is cast to them. Pass key_type and value_type to name them instead, which is also how an empty map is
+ * built: with both NULL, empty key and value arrays have no types to resolve and return ERROR_INPUT_INVALID.
+ *
+ * Keys and values are borrowed and copied in, and the two arrays must be the same length. Keys must be non-NULL and
+ * unique; both are enforced.
+ *
+ * history:
+ * - unstable: v2.0.0
+ *
+ * @param factory The factory to create with.
+ * @param key_type Optional. The key type. Pass NULL to resolve it from the keys.
+ * @param value_type Optional. The value type. Pass NULL to resolve it from the values.
+ * @param keys An array of entry_count keys. Borrowed (copied in). Pass NULL when entry_count is 0.
+ * @param values An array of entry_count values, parallel to keys. Borrowed (copied in). Pass NULL when entry_count is
+ * 0.
+ * @param entry_count The number of entries.
+ * @param out_value Receives the new composite value.
+ * @param err Optional. On failure, receives an opaque info handle the caller must destroy via error_info_destroy.
+ * @return DUCKDB_V2_ERROR
+ */
+DUCKDB_C_API DUCKDB_V2_ERROR duckdb_v2_value_create_map(
+    duckdb_v2_factory_handle factory, duckdb_v2_logical_type_handle key_type, duckdb_v2_logical_type_handle value_type,
+    const duckdb_v2_value_handle *keys, const duckdb_v2_value_handle *values, idx_t entry_count,
+    duckdb_v2_value_handle *out_value, duckdb_v2_error_info_handle *err);
+#endif
+
+#if DUCKDB_V2_API_ALLOW_UNSTABLE
+/*!
+ * Returns the number of child values of a value.
+ *
+ * Per type kind: the element count for LIST and ARRAY; the field count for STRUCT and TUPLE; twice the entry count for
+ * MAP, whose children alternate key, value; and 2 for UNION, the tag plus the active member. Everything else reports 0,
+ * NULL values of any nested type included.
+ *
+ * history:
+ * - unstable: v2.0.0
+ *
+ * @param value The value to read.
+ * @param out_count Receives the number of children.
+ * @param err Optional. On failure, receives an opaque info handle the caller must destroy via error_info_destroy.
+ * @return DUCKDB_V2_ERROR
+ */
+DUCKDB_C_API DUCKDB_V2_ERROR duckdb_v2_value_get_child_count(duckdb_v2_value_handle value, idx_t *out_count,
+                                                             duckdb_v2_error_info_handle *err);
+#endif
+
+#if DUCKDB_V2_API_ALLOW_UNSTABLE
+/*!
+ * Returns one child of a composite value as an owned copy.
+ *
+ * LIST and ARRAY children are the elements. STRUCT and TUPLE children are the fields in declared order, and a STRUCT's
+ * field names come from its type, via logical_type_get_param. MAP children alternate key, value, symmetric with
+ * value_create_map. UNION children are [0] the tag, as a UTINYINT value, and [1] the active member, because a union
+ * value holds only that one member.
+ *
+ * Note the divergence from vector_get_child, which descends structurally and so exposes [0] = tag and [1..N] = ALL
+ * members. Code written to descend generically over both must account for that difference.
+ *
+ * An out-of-range index returns ERROR_INPUT_INVALID, as does any index on a non-composite or NULL value. The returned
+ * value is caller-owned; destroy it via value_destroy.
+ *
+ * history:
+ * - unstable: v2.0.0
+ *
+ * @param value The value to read.
+ * @param index The child index, in [0, child_count).
+ * @param out_child Receives the owned child value.
+ * @param err Optional. On failure, receives an opaque info handle the caller must destroy via error_info_destroy.
+ * @return DUCKDB_V2_ERROR
+ */
+DUCKDB_C_API DUCKDB_V2_ERROR duckdb_v2_value_get_child(duckdb_v2_value_handle value, idx_t index,
+                                                       duckdb_v2_value_handle *out_child,
+                                                       duckdb_v2_error_info_handle *err);
+#endif
+
+#if DUCKDB_V2_API_ALLOW_UNSTABLE
+/*!
+ * Casts a value to a target type, using a factory.
+ *
+ * The conversion is the SQL-faithful, non-strict one, registered custom casts included, and a cast failure surfaces
+ * from the call. Together with a VARCHAR built through value_create_varchar, this constructs any value from text,
+ * extension values included; casting a member value to a union type, or a VARCHAR to an enum type, is the sanctioned
+ * way to build UNION and ENUM values.
+ *
+ * A connection's or callback's factory casts with that client's cast functions and settings (e.g. TimeZone). An
+ * instance's factory supports only the built-in casts, with default settings.
+ *
+ * The input value and target type are borrowed. The returned value is caller-owned; destroy it via value_destroy.
+ *
+ * history:
+ * - unstable: v2.0.0
+ *
+ * @param factory The factory supplying the cast functions.
+ * @param value The borrowed value to cast.
+ * @param target_type The borrowed target logical type.
+ * @param out_value Receives the owned cast result.
+ * @param err Optional. On failure, receives an opaque info handle the caller must destroy via error_info_destroy.
+ * @return DUCKDB_V2_ERROR
+ */
+DUCKDB_C_API DUCKDB_V2_ERROR duckdb_v2_value_cast(duckdb_v2_factory_handle factory, duckdb_v2_value_handle value,
+                                                  duckdb_v2_logical_type_handle target_type,
+                                                  duckdb_v2_value_handle *out_value, duckdb_v2_error_info_handle *err);
+#endif
+
+#if DUCKDB_V2_API_ALLOW_UNSTABLE
+/*!
+ * Returns whether the value is NULL.
+ *
+ * history:
+ * - unstable: v2.0.0
+ *
+ * @param value The value to read.
+ * @param out_is_null Receives true if the value is NULL, false otherwise.
+ * @param err Optional. On failure, receives an opaque info handle the caller must destroy via error_info_destroy.
+ * @return DUCKDB_V2_ERROR
+ */
+DUCKDB_C_API DUCKDB_V2_ERROR duckdb_v2_value_is_null(duckdb_v2_value_handle value, bool *out_is_null,
+                                                     duckdb_v2_error_info_handle *err);
+#endif
+
+#if DUCKDB_V2_API_ALLOW_UNSTABLE
+/*!
+ * Returns the logical type of the value.
+ *
+ * The returned logical type is caller-owned; destroy it via logical_type_destroy.
+ *
+ * history:
+ * - unstable: v2.0.0
+ *
+ * @param value The value to read.
+ * @param out_type Receives the owned logical type.
+ * @param err Optional. On failure, receives an opaque info handle the caller must destroy via error_info_destroy.
+ * @return DUCKDB_V2_ERROR
+ */
+DUCKDB_C_API DUCKDB_V2_ERROR duckdb_v2_value_get_logical_type(duckdb_v2_value_handle value,
+                                                              duckdb_v2_logical_type_handle *out_type,
+                                                              duckdb_v2_error_info_handle *err);
+#endif
+
+#if DUCKDB_V2_API_ALLOW_UNSTABLE
+/*!
+ * Renders the value as a human-readable string. Diagnostic only.
+ *
+ * Writes into a caller-supplied buffer, so nothing is allocated on the caller's behalf and nothing has to be freed.
+ *
+ * Pass out_string = NULL to size the buffer without rendering into it: out_length then receives the length, and
+ * out_capacity is ignored. With out_string != NULL, out_capacity must be at least out_length + 1, or the call returns
+ * ERROR_INPUT_OBJECT_SIZE with out_length set to the required length and out_string left untouched.
+ *
+ * out_length never counts the terminator, but a successful write always appends one, so the buffer is usable as a C
+ * string.
+ *
+ * history:
+ * - unstable: v2.0.0
+ *
+ * @param value The value to read.
+ * @param out_string Caller-owned buffer receiving the text plus a null terminator, or NULL to only report the required
+ * length in out_length.
+ * @param out_capacity Bytes available in out_string, terminator included. Ignored when out_string is NULL.
+ * @param out_length Receives the text length excluding the null terminator — written on success and on
+ * ERROR_INPUT_OBJECT_SIZE.
+ * @param err Optional. On failure, receives an opaque info handle the caller must destroy via error_info_destroy.
+ * @return DUCKDB_V2_ERROR
+ */
+DUCKDB_C_API DUCKDB_V2_ERROR duckdb_v2_value_to_string(duckdb_v2_value_handle value, char *out_string,
+                                                       idx_t out_capacity, idx_t *out_length,
+                                                       duckdb_v2_error_info_handle *err);
+#endif
+
+/* --- Struct definitions for value --- */
+
+/* ============================================================================
+ * MODULE: arrow
+ * ============================================================================ */
+
+/* --- Enums for arrow --- */
+
+/* --- Struct forward declarations for arrow --- */
+
+/* --- Types for arrow --- */
+
+/*!
+ * Converts Arrow arrays into DuckDB data chunks, against one resolved ArrowSchema. Create it with
+ * `duckdb_v2_arrow_importer_create()`, which resolves every column's DuckDB type once, so the same importer serves any
+ * number of arrays of that shape. `duckdb_v2_arrow_importer_get_schema()` reports the resolved DuckDB schema.
+ * `duckdb_v2_arrow_importer_append()` takes an array, `duckdb_v2_arrow_importer_next_chunk()` produces chunks from it,
+ * and `duckdb_v2_arrow_importer_destroy()` frees the importer.
+ *
+ * The importer borrows the context it was created with and must not outlive it. One array is in flight at a time, and
+ * an importer must not be used from two threads at once.
+ */
+typedef struct _duckdb_v2_arrow_importer {
+	void *internal_ptr;
+} * duckdb_v2_arrow_importer_handle;
+
+/*!
+ * Converts DuckDB data chunks into Arrow arrays, for one fixed list of columns. Create it with
+ * `duckdb_v2_arrow_exporter_create()`, which captures the session's Arrow settings and resolves the extension types
+ * once. `duckdb_v2_arrow_exporter_get_schema()` reports the Arrow schema. `duckdb_v2_arrow_exporter_append()` takes a
+ * chunk, `duckdb_v2_arrow_exporter_next_array()` produces arrays from it, and `duckdb_v2_arrow_exporter_destroy()`
+ * frees the exporter.
+ *
+ * An exporter must not be used from two threads at once.
+ */
+typedef struct _duckdb_v2_arrow_exporter {
+	void *internal_ptr;
+} * duckdb_v2_arrow_exporter_handle;
+
+/*!
+ * A query result that produces Arrow arrays. Works like a result, which produces data chunks. Create it with
+ * `duckdb_v2_statement_execute_arrow()` or `duckdb_v2_prepared_statement_execute_arrow()`.
+ *
+ * - Use it from one thread at a time.
+ * - `duckdb_v2_connection_interrupt()` cancels it: `duckdb_v2_arrow_result_step()` reports `CANCELLED`, and
+ * `duckdb_v2_arrow_result_fetch_array()` and a stream's `get_next` fail.
+ * - Arrays and schemas it hands out belong to the caller and stay valid after the result is destroyed.
+ */
+typedef struct _duckdb_v2_arrow_result {
+	void *internal_ptr;
+} * duckdb_v2_arrow_result_handle;
+
+/* --- Constants for arrow --- */
+
+/* --- Function pointer typedefs for arrow --- */
+
+/* --- Functions for arrow --- */
+
+#if DUCKDB_V2_API_ALLOW_UNSTABLE
+/*!
+ * Resolves an Arrow schema into a reusable importer.
+ *
+ * Works out every column's DuckDB logical type and the Arrow type information the conversion needs, once, so any number
+ * of arrays of that shape can be imported without re-reading the schema. `schema` is read, not consumed: the caller
+ * keeps ownership and still releases it.
+ *
+ * `batch_size` caps the rows per produced chunk. A long array is split across several chunks. Rows left over that do
+ * not fill a batch are held back and joined with the next array, unless the append asked to flush. Pass 0 for no
+ * maximum: each array becomes one chunk, however long it is.
+ *
+ * Resolving reads the catalog for extension types, so `context` must have an active transaction. The importer keeps
+ * using that context for every conversion and must not outlive it. Within one connection the context is the same
+ * throughout, so an importer created in a bind callback is usable from the matching exec callback. `*out_importer` is
+ * set to NULL on failure.
+ *
+ * history:
+ * - unstable: v2.0.0
+ *
+ * @param context The context used to resolve the Arrow types, extension types included.
+ * @param schema The schema to resolve. Read, not consumed; the caller keeps ownership.
+ * @param batch_size Maximum rows per produced chunk, or 0 for no maximum.
+ * @param out_importer On success, receives the new importer. Owned by the caller; destroy via
+ * `duckdb_v2_arrow_importer_destroy()`.
+ * @param err Optional. On failure, receives an opaque info handle the caller must destroy via
+ * `duckdb_v2_error_info_destroy()`.
+ * @return DUCKDB_V2_ERROR
+ */
+DUCKDB_C_API DUCKDB_V2_ERROR duckdb_v2_arrow_importer_create(duckdb_v2_context_handle context,
+                                                             struct ArrowSchema *schema, idx_t batch_size,
+                                                             duckdb_v2_arrow_importer_handle *out_importer,
+                                                             duckdb_v2_error_info_handle *err);
+#endif
+
+#if DUCKDB_V2_API_ALLOW_UNSTABLE
+/*!
+ * Returns the resolved DuckDB schema.
+ *
+ * Writes an owned schema handle with the DuckDB name and logical type of every column the importer resolved. This is
+ * how a caller learns the DuckDB shape of an ArrowSchema, to declare a table function's result columns for instance,
+ * without reimplementing the mapping from Arrow format strings to logical types.
+ *
+ * The fields were resolved at creation, so this reads no catalog and needs no transaction. `*out_schema` is set to NULL
+ * on failure.
+ *
+ * history:
+ * - unstable: v2.0.0
+ *
+ * @param importer The importer to read.
+ * @param out_schema On success, receives an owned schema. Destroy via `duckdb_v2_schema_destroy()`.
+ * @param err Optional. On failure, receives an opaque info handle the caller must destroy via
+ * `duckdb_v2_error_info_destroy()`.
+ * @return DUCKDB_V2_ERROR
+ */
+DUCKDB_C_API DUCKDB_V2_ERROR duckdb_v2_arrow_importer_get_schema(duckdb_v2_arrow_importer_handle importer,
+                                                                 duckdb_v2_schema_handle *out_schema,
+                                                                 duckdb_v2_error_info_handle *err);
+#endif
+
+#if DUCKDB_V2_API_ALLOW_UNSTABLE
+/*!
+ * Gives the importer one array to convert.
+ *
+ * Take the chunks with `duckdb_v2_arrow_importer_next_chunk()` until that returns NULL. Appending while the previous
+ * array still has rows left is rejected with `ERROR_INPUT_INVALID`. An array whose shape does not match the resolved
+ * schema -- a different child count, a child whose length differs from the array's, a null or already-released child --
+ * is rejected the same way, before anything is read.
+ *
+ * `flush` marks the end of the input: rows that do not fill a batch then come out as a final short chunk instead of
+ * being held back for the next array. Pass NULL for `array` with `flush` set to release the held rows without supplying
+ * more input.
+ *
+ * `consume` decides what happens to the caller's array.
+ *
+ * When true, the importer takes over the array and sets its `release` to NULL; the caller must not release it
+ * afterwards. The produced chunks reference the Arrow buffers directly, without copying, and keep them alive, so the
+ * chunks stay valid after the importer is destroyed. Prefer this path.
+ *
+ * When false, the caller keeps the array and must keep it valid until the drain finishes. The produced chunks are
+ * copies, so they do not depend on the array, at the cost of one copy per chunk.
+ *
+ * Either way, a chunk that joins rows held back from the previous array is a copy, since it cannot reference two
+ * arrays.
+ *
+ * Only the default, dictionary-encoded and run-end-encoded Arrow layouts are supported. Any other layout reports
+ * `ERROR_QUERY_NOT_IMPLEMENTED` when the column is converted.
+ *
+ * history:
+ * - unstable: v2.0.0
+ *
+ * @param importer The importer to feed.
+ * @param array The array to convert. Its `release` is set to NULL when `consume` is true.
+ * @param consume True to hand the array over for a zero-copy import; false to keep it, in which case every produced
+ * chunk is a copy.
+ * @param flush True to mark the end of the input, releasing held rows as a final short chunk. Pass NULL for `array`
+ * with this set to flush without supplying more input.
+ * @param err Optional. On failure, receives an opaque info handle the caller must destroy via
+ * `duckdb_v2_error_info_destroy()`.
+ * @return DUCKDB_V2_ERROR
+ */
+DUCKDB_C_API DUCKDB_V2_ERROR duckdb_v2_arrow_importer_append(duckdb_v2_arrow_importer_handle importer,
+                                                             struct ArrowArray *array, bool consume, bool flush,
+                                                             duckdb_v2_error_info_handle *err);
+#endif
+
+#if DUCKDB_V2_API_ALLOW_UNSTABLE
+/*!
+ * Produces the next chunk of the appended array, or NULL once the array is drained.
+ *
+ * Call it in a loop until `*out_chunk` is NULL. An importer with no array appended also returns NULL. Each chunk holds
+ * at most the importer's `batch_size` rows, or the whole array when that is 0. A chunk may start with rows held back
+ * from the previous array, and rows that do not fill a batch are held back in turn unless the append asked to flush. So
+ * NULL means the array has been read, not that all of its rows have come out.
+ *
+ * The conversion runs under the context the importer was created with, which must still be alive. `*out_chunk` is set
+ * to NULL on failure.
+ *
+ * history:
+ * - unstable: v2.0.0
+ *
+ * @param importer The importer to drain.
+ * @param out_chunk On success, receives the next chunk, or NULL once the array is drained. Destroy via
+ * `duckdb_v2_data_chunk_destroy()`.
+ * @param err Optional. On failure, receives an opaque info handle the caller must destroy via
+ * `duckdb_v2_error_info_destroy()`.
+ * @return DUCKDB_V2_ERROR
+ */
+DUCKDB_C_API DUCKDB_V2_ERROR duckdb_v2_arrow_importer_next_chunk(duckdb_v2_arrow_importer_handle importer,
+                                                                 duckdb_v2_data_chunk_handle *out_chunk,
+                                                                 duckdb_v2_error_info_handle *err);
+#endif
+
+#if DUCKDB_V2_API_ALLOW_UNSTABLE
+/*!
+ * Destroys an importer.
+ *
+ * Null-safe: passing NULL, or a slot already set to NULL, is a no-op. Chunks already produced stay valid, including the
+ * zero-copy ones, which keep the Arrow buffers alive themselves. An array appended with `consume` true and not fully
+ * drained is released here. Rows held back for a next array are dropped. On success the slot is set to NULL.
+ *
+ * history:
+ * - unstable: v2.0.0
+ *
+ * @param importer The importer to destroy.
+ * @return DUCKDB_V2_ERROR
+ */
+DUCKDB_C_API DUCKDB_V2_ERROR duckdb_v2_arrow_importer_destroy(duckdb_v2_arrow_importer_handle *importer);
+#endif
+
+#if DUCKDB_V2_API_ALLOW_UNSTABLE
+/*!
+ * Creates an exporter for one fixed list of columns.
+ *
+ * Resolves the extension types and captures the session's Arrow settings, so every array this exporter produces matches
+ * the schema `duckdb_v2_arrow_exporter_get_schema()` reports, even if a setting changes afterwards.
+ *
+ * `batch_size` caps the rows per produced array. A long chunk is split across several arrays. Rows left over that do
+ * not fill a batch are held back and joined with the next chunk, unless the append asked to flush. Pass 0 for no
+ * maximum: each chunk becomes one array, however long it is.
+ *
+ * `types` and `names` are parallel arrays of `count` entries, borrowed and copied; they may be NULL only when `count`
+ * is 0. Resolving reads the catalog, so `context` must have an active transaction. `*out_exporter` is set to NULL on
+ * failure.
+ *
+ * history:
+ * - unstable: v2.0.0
+ *
+ * @param context The context whose Arrow settings are captured and whose transaction resolves the types.
+ * @param types An array of `count` column types. May be NULL only when `count` is 0.
+ * @param names An array of `count` column names, parallel to `types`. Each name must be valid UTF-8. May be NULL only
+ * when `count` is 0.
+ * @param count The number of columns, being the length of both `types` and `names`.
+ * @param batch_size Maximum rows per produced array, or 0 for no maximum.
+ * @param out_exporter On success, receives the new exporter. Owned by the caller; destroy via
+ * `duckdb_v2_arrow_exporter_destroy()`.
+ * @param err Optional. On failure, receives an opaque info handle the caller must destroy via
+ * `duckdb_v2_error_info_destroy()`.
+ * @return DUCKDB_V2_ERROR
+ */
+DUCKDB_C_API DUCKDB_V2_ERROR duckdb_v2_arrow_exporter_create(duckdb_v2_context_handle context,
+                                                             const duckdb_v2_logical_type_handle *types,
+                                                             const duckdb_v2_str *names, idx_t count, idx_t batch_size,
+                                                             duckdb_v2_arrow_exporter_handle *out_exporter,
+                                                             duckdb_v2_error_info_handle *err);
+#endif
+
+#if DUCKDB_V2_API_ALLOW_UNSTABLE
+/*!
+ * Returns the Arrow schema of the arrays this exporter produces.
+ *
+ * Fills the caller-allocated `out_schema`. The caller owns the result and releases it with
+ * `out_schema->release(out_schema)`. Callable at any point, and always returns the same schema, since it is built from
+ * the settings captured at creation.
+ *
+ * history:
+ * - unstable: v2.0.0
+ *
+ * @param exporter The exporter to read.
+ * @param out_schema Caller-allocated schema the library fills. Release it with `out_schema->release(out_schema)`.
+ * @param err Optional. On failure, receives an opaque info handle the caller must destroy via
+ * `duckdb_v2_error_info_destroy()`.
+ * @return DUCKDB_V2_ERROR
+ */
+DUCKDB_C_API DUCKDB_V2_ERROR duckdb_v2_arrow_exporter_get_schema(duckdb_v2_arrow_exporter_handle exporter,
+                                                                 struct ArrowSchema *out_schema,
+                                                                 duckdb_v2_error_info_handle *err);
+#endif
+
+#if DUCKDB_V2_API_ALLOW_UNSTABLE
+/*!
+ * Gives the exporter one chunk to convert.
+ *
+ * The chunk is converted in full before this returns. The conversion copies into freshly allocated Arrow buffers, so
+ * nothing of the caller's is retained. Every array completed by this chunk becomes available from
+ * `duckdb_v2_arrow_exporter_next_array()`; rows that do not complete a batch are held back and finished by the next
+ * chunk. Completed arrays queue up, so appending again before they are taken is allowed.
+ *
+ * `flush` marks the end of the input: the held rows are then finished as a final short array. Pass NULL for `chunk`
+ * with `flush` set to release the held rows without supplying more input.
+ *
+ * The chunk's types must match the ones the exporter was created with, or the call is rejected with
+ * `ERROR_INPUT_INVALID` before anything is read.
+ *
+ * `consume` decides only what happens to the caller's handle, since the data is copied either way. When true the chunk
+ * is destroyed and the slot set to NULL, saving a `duckdb_v2_data_chunk_destroy()` for a chunk the caller owns. When
+ * false the chunk is left untouched, which is what a chunk borrowed from a callback needs, such as the output chunk of
+ * a table function's exec callback, which the caller does not own and must not destroy.
+ *
+ * history:
+ * - unstable: v2.0.0
+ *
+ * @param exporter The exporter to feed.
+ * @param chunk The chunk to convert. Destroyed and set to NULL only when `consume` is true.
+ * @param consume True to hand the chunk over, destroying it; false to leave the caller's handle untouched.
+ * @param flush True to mark the end of the input, releasing the held rows as a final short array. Pass NULL for `chunk`
+ * with this set to flush without supplying more input.
+ * @param err Optional. On failure, receives an opaque info handle the caller must destroy via
+ * `duckdb_v2_error_info_destroy()`.
+ * @return DUCKDB_V2_ERROR
+ */
+DUCKDB_C_API DUCKDB_V2_ERROR duckdb_v2_arrow_exporter_append(duckdb_v2_arrow_exporter_handle exporter,
+                                                             duckdb_v2_data_chunk_handle *chunk, bool consume,
+                                                             bool flush, duckdb_v2_error_info_handle *err);
+#endif
+
+#if DUCKDB_V2_API_ALLOW_UNSTABLE
+/*!
+ * Takes the next completed array, or reports that none is ready.
+ *
+ * Call it in a loop after every `duckdb_v2_arrow_exporter_append()` until `out_array->release` is NULL, which is how
+ * the Arrow C Data Interface signals "no array" and what a stream's `get_next` does at end of input. Rows held back
+ * towards an unfinished batch are not an array yet; they come out after a further append or a flush.
+ *
+ * Each array is owned by the caller and released with `out_array->release(out_array)`, independently of the exporter
+ * and of every other array.
+ *
+ * history:
+ * - unstable: v2.0.0
+ *
+ * @param exporter The exporter to drain.
+ * @param out_array Caller-allocated array the library fills. Left released -- `release` NULL -- when none is ready.
+ * Release a filled one with `out_array->release(out_array)`.
+ * @param err Optional. On failure, receives an opaque info handle the caller must destroy via
+ * `duckdb_v2_error_info_destroy()`.
+ * @return DUCKDB_V2_ERROR
+ */
+DUCKDB_C_API DUCKDB_V2_ERROR duckdb_v2_arrow_exporter_next_array(duckdb_v2_arrow_exporter_handle exporter,
+                                                                 struct ArrowArray *out_array,
+                                                                 duckdb_v2_error_info_handle *err);
+#endif
+
+#if DUCKDB_V2_API_ALLOW_UNSTABLE
+/*!
+ * Destroys an exporter.
+ *
+ * Null-safe: passing NULL, or a slot already set to NULL, is a no-op. Arrays already taken stay valid. Arrays still
+ * queued inside are released here, and rows held back towards an unfinished batch are dropped. On success the slot is
+ * set to NULL.
+ *
+ * history:
+ * - unstable: v2.0.0
+ *
+ * @param exporter The exporter to destroy.
+ * @return DUCKDB_V2_ERROR
+ */
+DUCKDB_C_API DUCKDB_V2_ERROR duckdb_v2_arrow_exporter_destroy(duckdb_v2_arrow_exporter_handle *exporter);
+#endif
+
+#if DUCKDB_V2_API_ALLOW_UNSTABLE
+/*!
+ * Executes a parsed statement. The result produces Arrow arrays.
+ *
+ * Works like `duckdb_v2_statement_execute()`. `*out_result` is set to NULL on failure.
+ *
+ * history:
+ * - unstable: v2.0.0
+ *
+ * @param conn The connection to run the statement on.
+ * @param statement The statement to execute. Not consumed.
+ * @param parameter_names Optional. As in `duckdb_v2_statement_execute()`.
+ * @param parameter_values Optional. As in `duckdb_v2_statement_execute()`.
+ * @param parameter_count The number of parameters. 0 for none.
+ * @param batch_size Maximum rows per array. Arrays can be shorter. 0 means 131072.
+ * @param out_result Receives the new result. Destroy via `duckdb_v2_arrow_result_destroy()`.
+ * @param err Optional. On failure, receives an opaque info handle the caller must destroy via
+ * `duckdb_v2_error_info_destroy()`.
+ * @return DUCKDB_V2_ERROR
+ */
+DUCKDB_C_API DUCKDB_V2_ERROR duckdb_v2_statement_execute_arrow(duckdb_v2_connection_handle conn,
+                                                               duckdb_v2_sql_statement_handle statement,
+                                                               const duckdb_v2_identifier_t *parameter_names,
+                                                               const duckdb_v2_value_handle *parameter_values,
+                                                               idx_t parameter_count, idx_t batch_size,
+                                                               duckdb_v2_arrow_result_handle *out_result,
+                                                               duckdb_v2_error_info_handle *err);
+#endif
+
+#if DUCKDB_V2_API_ALLOW_UNSTABLE
+/*!
+ * Executes a prepared statement. The result produces Arrow arrays.
+ *
+ * Works like `duckdb_v2_prepared_statement_execute()`. `*out_result` is set to NULL on failure.
+ *
+ * history:
+ * - unstable: v2.0.0
+ *
+ * @param prepared The prepared statement to execute. Not consumed.
+ * @param parameter_names Optional. As in `duckdb_v2_prepared_statement_execute()`.
+ * @param parameter_values Optional. As in `duckdb_v2_prepared_statement_execute()`.
+ * @param parameter_count The number of parameters. 0 for none.
+ * @param batch_size Maximum rows per array. Arrays can be shorter. 0 means 131072.
+ * @param out_result Receives the new result. Destroy via `duckdb_v2_arrow_result_destroy()`.
+ * @param err Optional. On failure, receives an opaque info handle the caller must destroy via
+ * `duckdb_v2_error_info_destroy()`.
+ * @return DUCKDB_V2_ERROR
+ */
+DUCKDB_C_API DUCKDB_V2_ERROR duckdb_v2_prepared_statement_execute_arrow(duckdb_v2_prepared_statement_handle prepared,
+                                                                        const duckdb_v2_identifier_t *parameter_names,
+                                                                        const duckdb_v2_value_handle *parameter_values,
+                                                                        idx_t parameter_count, idx_t batch_size,
+                                                                        duckdb_v2_arrow_result_handle *out_result,
+                                                                        duckdb_v2_error_info_handle *err);
+#endif
+
+#if DUCKDB_V2_API_ALLOW_UNSTABLE
+/*!
+ * Destroys the result. Works like `duckdb_v2_result_destroy()`.
+ *
+ * history:
+ * - unstable: v2.0.0
+ *
+ * @param result The result to destroy.
+ * @return DUCKDB_V2_ERROR
+ */
+DUCKDB_C_API DUCKDB_V2_ERROR duckdb_v2_arrow_result_destroy(duckdb_v2_arrow_result_handle *result);
+#endif
+
+#if DUCKDB_V2_API_ALLOW_UNSTABLE
+/*!
+ * Runs a bounded amount of the query and returns without blocking.
+ *
+ * Works like `duckdb_v2_result_step()`. On status `CHUNK`, `out_array` holds the next array. Otherwise its `release` is
+ * NULL.
+ *
+ * history:
+ * - unstable: v2.0.0
+ *
+ * @param result The result to step.
+ * @param out_array Caller-allocated array the library fills. Release it with `out_array->release(out_array)`.
+ * @param out_status Receives the step status.
+ * @param err Optional. On failure, receives an opaque info handle the caller must destroy via
+ * `duckdb_v2_error_info_destroy()`.
+ * @return DUCKDB_V2_ERROR
+ */
+DUCKDB_C_API DUCKDB_V2_ERROR duckdb_v2_arrow_result_step(duckdb_v2_arrow_result_handle result,
+                                                         struct ArrowArray *out_array,
+                                                         DUCKDB_V2_RESULT_STEP_STATUS *out_status,
+                                                         duckdb_v2_error_info_handle *err);
+#endif
+
+#if DUCKDB_V2_API_ALLOW_UNSTABLE
+/*!
+ * Blocks until the next array is ready.
+ *
+ * Works like `duckdb_v2_result_fetch_chunk()`. At the end of the result, `out_array->release` is NULL.
+ *
+ * history:
+ * - unstable: v2.0.0
+ *
+ * @param result The result to fetch from.
+ * @param out_array Caller-allocated array the library fills. Release it with `out_array->release(out_array)`.
+ * @param err Optional. On failure, receives an opaque info handle the caller must destroy via
+ * `duckdb_v2_error_info_destroy()`.
+ * @return DUCKDB_V2_ERROR
+ */
+DUCKDB_C_API DUCKDB_V2_ERROR duckdb_v2_arrow_result_fetch_array(duckdb_v2_arrow_result_handle result,
+                                                                struct ArrowArray *out_array,
+                                                                duckdb_v2_error_info_handle *err);
+#endif
+
+#if DUCKDB_V2_API_ALLOW_UNSTABLE
+/*!
+ * Blocks until `duckdb_v2_arrow_result_step()` can make progress. Works like `duckdb_v2_result_wait()`.
+ *
+ * history:
+ * - unstable: v2.0.0
+ *
+ * @param result The result to wait on.
+ * @param err Optional. On failure, receives an opaque info handle the caller must destroy via
+ * `duckdb_v2_error_info_destroy()`.
+ * @return DUCKDB_V2_ERROR
+ */
+DUCKDB_C_API DUCKDB_V2_ERROR duckdb_v2_arrow_result_wait(duckdb_v2_arrow_result_handle result,
+                                                         duckdb_v2_error_info_handle *err);
+#endif
+
+#if DUCKDB_V2_API_ALLOW_UNSTABLE
+/*!
+ * Runs the query to the end and reports the changed-row count. Works like `duckdb_v2_result_drain()`.
+ *
+ * history:
+ * - unstable: v2.0.0
+ *
+ * @param result The result to drain.
+ * @param out_rows_changed Receives the changed-row count for an INSERT, UPDATE or DELETE, 0 otherwise.
+ * @param err Optional. On failure, receives an opaque info handle the caller must destroy via
+ * `duckdb_v2_error_info_destroy()`.
+ * @return DUCKDB_V2_ERROR
+ */
+DUCKDB_C_API DUCKDB_V2_ERROR duckdb_v2_arrow_result_drain(duckdb_v2_arrow_result_handle result, idx_t *out_rows_changed,
+                                                          duckdb_v2_error_info_handle *err);
+#endif
+
+#if DUCKDB_V2_API_ALLOW_UNSTABLE
+/*!
+ * Returns the shape of the result. Works like `duckdb_v2_result_get_result_type()`.
+ *
+ * history:
+ * - unstable: v2.0.0
+ *
+ * @param result The result.
+ * @param out_type Receives the result shape.
+ * @param err Optional. On failure, receives an opaque info handle the caller must destroy via
+ * `duckdb_v2_error_info_destroy()`.
+ * @return DUCKDB_V2_ERROR
+ */
+DUCKDB_C_API DUCKDB_V2_ERROR duckdb_v2_arrow_result_get_result_type(duckdb_v2_arrow_result_handle result,
+                                                                    DUCKDB_V2_RESULT_TYPE *out_type,
+                                                                    duckdb_v2_error_info_handle *err);
+#endif
+
+#if DUCKDB_V2_API_ALLOW_UNSTABLE
+/*!
+ * Returns the type of statement that produced the result. Works like `duckdb_v2_result_get_statement_type()`.
+ *
+ * history:
+ * - unstable: v2.0.0
+ *
+ * @param result The result.
+ * @param out_type Receives the statement type.
+ * @param err Optional. On failure, receives an opaque info handle the caller must destroy via
+ * `duckdb_v2_error_info_destroy()`.
+ * @return DUCKDB_V2_ERROR
+ */
+DUCKDB_C_API DUCKDB_V2_ERROR duckdb_v2_arrow_result_get_statement_type(duckdb_v2_arrow_result_handle result,
+                                                                       DUCKDB_V2_STATEMENT_TYPE *out_type,
+                                                                       duckdb_v2_error_info_handle *err);
+#endif
+
+#if DUCKDB_V2_API_ALLOW_UNSTABLE
+/*!
+ * Returns the Arrow schema of the result's arrays.
+ *
+ * Available whenever `duckdb_v2_result_get_schema()` would be.
+ *
+ * history:
+ * - unstable: v2.0.0
+ *
+ * @param result The result.
+ * @param out_schema Caller-allocated schema the library fills. Release it with `out_schema->release(out_schema)`.
+ * @param err Optional. On failure, receives an opaque info handle the caller must destroy via
+ * `duckdb_v2_error_info_destroy()`.
+ * @return DUCKDB_V2_ERROR
+ */
+DUCKDB_C_API DUCKDB_V2_ERROR duckdb_v2_arrow_result_get_schema(duckdb_v2_arrow_result_handle result,
+                                                               struct ArrowSchema *out_schema,
+                                                               duckdb_v2_error_info_handle *err);
+#endif
+
+#if DUCKDB_V2_API_ALLOW_UNSTABLE
+/*!
+ * Turns the result into an ArrowArrayStream.
+ *
+ * On success the stream takes over the result and `*result` is set to NULL. Each `get_next` returns the next array.
+ * Arrays already fetched are not repeated. Releasing the stream destroys the result.
+ *
+ * Converting runs no part of the query. The stream's `get_schema` can: for a statement that expands into several
+ * statements, such as PIVOT, it runs the ones before the statement that returns rows. A failing `get_next` or
+ * `get_schema` returns `EIO`; `get_last_error` has the message.
+ *
+ * history:
+ * - unstable: v2.0.0
+ *
+ * @param result The result to take over. Set to NULL on success.
+ * @param out_stream Caller-allocated stream the library fills. Release it with `out_stream->release(out_stream)`.
+ * @param err Optional. On failure, receives an opaque info handle the caller must destroy via
+ * `duckdb_v2_error_info_destroy()`.
+ * @return DUCKDB_V2_ERROR
+ */
+DUCKDB_C_API DUCKDB_V2_ERROR duckdb_v2_arrow_result_to_arrow_c_stream(duckdb_v2_arrow_result_handle *result,
+                                                                      struct ArrowArrayStream *out_stream,
+                                                                      duckdb_v2_error_info_handle *err);
+#endif
+
+/* --- Struct definitions for arrow --- */
+
+#ifdef __cplusplus
+}
+#endif
diff --git a/cbits/extension.c b/cbits/extension.c
new file mode 100644
--- /dev/null
+++ b/cbits/extension.c
@@ -0,0 +1,58 @@
+#include "duckdb_haskell_extension.h"
+#include "Rts.h"
+#include <pthread.h>
+
+DUCKDB_EXTENSION_GLOBAL
+
+static pthread_mutex_t api_mutex = PTHREAD_MUTEX_INITIALIZER;
+static int api_ready = 0;
+static pthread_once_t runtime_once = PTHREAD_ONCE_INIT;
+
+/* Negotiate and copy the host table before starting Haskell. */
+static int init_api(struct duckdb_v2_extension_input *input) {
+    /* DuckDB owns this temporary table. Do not retain its address. */
+    const duckdb_ext_api_v2 *api = input->get_api(input->extension, DUCKDB_EXTENSION_API_VERSION_STRING);
+    if (!api) {
+        /* DuckDB has recorded the negotiation error. Leave input->err alone. */
+        return 0;
+    }
+
+    /* Publish once. Later loads must not write over active callback readers. */
+    pthread_mutex_lock(&api_mutex);
+    if (!api_ready) {
+        duckdb_ext_api = *api;
+        api_ready = 1;
+    }
+    pthread_mutex_unlock(&api_mutex);
+    return 1;
+}
+
+/* Use private arguments, ignore GHCRTS, and keep the signal handlers of the host. */
+static void start_runtime(void) {
+    int argc = 1;
+    static char name[] = "duckdb_haskell_extension";
+    static char *arguments[] = {name, NULL};
+    char **argv = arguments;
+    RtsConfig config = defaultRtsConfig;
+    config.rts_hs_main = HS_BOOL_FALSE;
+    config.rts_opts_enabled = RtsOptsIgnoreAll;
+    config.rts_opts = "-N1 --install-signal-handlers=no";
+    hs_init_ghc(&argc, &argv, config);
+}
+
+void duckdb_haskell_extension_load(struct duckdb_v2_extension_input *input, duckdb_haskell_extension_entry entry) {
+    if (!init_api(input)) {
+        return;
+    }
+    if (!rtsSupportsBoundThreads()) {
+        /* The -N1 option ends the process when the runtime has no thread support. */
+        static const char message[] = "A Haskell extension requires the threaded GHC runtime. Link it with -threaded.";
+        duckdb_v2_str text = {message, sizeof(message) - 1};
+        duckdb_v2_error_info_set_code(*input->err, DUCKDB_V2_ERROR_API);
+        duckdb_v2_error_info_set_text(*input->err, &text);
+        return;
+    }
+    /* Keep the runtime alive while DuckDB owns Haskell callbacks and state. */
+    pthread_once(&runtime_once, start_runtime);
+    entry(input->extension, input->context, input->err);
+}
diff --git a/duckdb-ffi.cabal b/duckdb-ffi.cabal
--- a/duckdb-ffi.cabal
+++ b/duckdb-ffi.cabal
@@ -1,6 +1,6 @@
 cabal-version: 3.4
 name: duckdb-ffi
-version: 1.5.6.0
+version: 2.0.0.0
 author: Matthias Pall Gissurarson
 maintainer: mpg@mpg.is
 category: Database
@@ -18,14 +18,27 @@
 homepage: https://github.com/Tritlo/duckdb-haskell
 bug-reports: https://github.com/Tritlo/duckdb-haskell/issues
 description:
-  Haskell FFI bindings to the DuckDB C API.
-  Supports native DuckDB >= 1.5.3 and < 1.6. Tested with versions 1.5.3 through 1.5.6.
-  .
-  Downloads a verified native library to the user cache on Linux and macOS.
-  Uses an existing library when the user or Nix supplies it.
+  Haskell FFI bindings generated from the DuckDB 2.0 C APIs with hs-bindgen.
+  The retained API supports DuckDB 2.0.x releases. The V2 API requires
+  exactly DuckDB 2.0.0, because upstream marks it as unstable.
 
+  Downloads the verified DuckDB 2.0.0 release on supported Linux and macOS
+  systems. Also accepts a native library supplied by the user or Nix.
+
+  Includes the complete pinned DuckDB V2 C API.
+
 extra-doc-files: CHANGELOG.md
-extra-source-files: cbits/duckdb_arrow.h
+extra-source-files:
+  cbits/duckdb-LICENSE
+  cbits/duckdb.h
+  cbits/duckdb_arrow.h
+  cbits/duckdb_extension_v2.h
+  cbits/duckdb_haskell_extension.h
+  cbits/duckdb_v2.h
+  generated.sha256
+  native.sha256
+  vendor/duckdb-api.json
+  vendor/upstream.sha256
 
 source-repository head
   type: git
@@ -38,6 +51,11 @@
   default: False
   manual: True
 
+flag extension
+  description: Use the host V2 function table for a loadable extension.
+  default: False
+  manual: True
+
 custom-setup
   setup-depends:
     base >=4.18 && <4.23,
@@ -48,88 +66,86 @@
     temporary >=1.3 && <1.4,
 
 library
-  default-language:
-    Haskell2010
+  default-language: GHC2021
+  hs-source-dirs: generated
+  exposed-modules:
+    Database.DuckDB.FFI.V2
 
-  default-extensions:
-    AllowAmbiguousTypes
-    DataKinds
-    GADTs
-    GeneralizedNewtypeDeriving
-    ImportQualifiedPost
-    LambdaCase
-    MultiParamTypeClasses
-    OverloadedStrings
-    RankNTypes
-    ScopedTypeVariables
-    TypeApplications
+  include-dirs: cbits/
+  install-includes:
+    duckdb-LICENSE
+    duckdb.h
+    duckdb_arrow.h
+    duckdb_extension_v2.h
+    duckdb_haskell_extension.h
+    duckdb_v2.h
 
-  hs-source-dirs:
-    src
+  c-sources:
+    generated/abi-checks-v2.c
 
-  exposed-modules:
-    Database.DuckDB.FFI
-    Database.DuckDB.FFI.Deprecated
+  if flag(extension)
+    if os(linux) || os(osx)
+      cc-options:
+        -fvisibility=hidden
+        -include
+        duckdb_haskell_extension.h
 
+      -- Keep private C calls inside this shared library. GHC also compiles
+      -- the C wrappers emitted by Template Haskell.
+      ghc-options:
+        -fomit-interface-pragmas
+        -optc-fvisibility=hidden
+        -optc-include
+        -optcduckdb_haskell_extension.h
+
+      c-sources: cbits/extension.c
+      extra-libraries: pthread
+    else
+      buildable: False
+  else
+    exposed-modules: Database.DuckDB.FFI
+    c-sources: generated/abi-checks.c
+    extra-libraries: duckdb
+
+  build-depends:
+    base >=4.18 && <4.23,
+    hs-bindgen-runtime >=1.0.0.0 && <1.1,
+
+test-suite duckdb-ffi-v2-test
+  if flag(extension)
+    buildable: False
+  type: exitcode-stdio-1.0
+  hs-source-dirs: test
+  main-is: V2Main.hs
   other-modules:
-    Database.DuckDB.FFI.AggregateFunctions
-    Database.DuckDB.FFI.Appender
-    Database.DuckDB.FFI.Arrow
-    Database.DuckDB.FFI.BindValues
-    Database.DuckDB.FFI.CastFunctions
-    Database.DuckDB.FFI.Catalog
-    Database.DuckDB.FFI.Configuration
-    Database.DuckDB.FFI.CopyFunctions
-    Database.DuckDB.FFI.DataChunk
-    Database.DuckDB.FFI.Deprecated.Appender
-    Database.DuckDB.FFI.Deprecated.Arrow
-    Database.DuckDB.FFI.Deprecated.ExecutePrepared
-    Database.DuckDB.FFI.Deprecated.PendingResult
-    Database.DuckDB.FFI.Deprecated.QueryExecution
-    Database.DuckDB.FFI.Deprecated.ResultFunctions
-    Database.DuckDB.FFI.Deprecated.SafeFetch
-    Database.DuckDB.FFI.Deprecated.StreamingResult
-    Database.DuckDB.FFI.ErrorData
-    Database.DuckDB.FFI.ExecutePrepared
-    Database.DuckDB.FFI.Expression
-    Database.DuckDB.FFI.ExtractStatements
-    Database.DuckDB.FFI.FileSystem
-    Database.DuckDB.FFI.Helpers
-    Database.DuckDB.FFI.Logging
-    Database.DuckDB.FFI.LogicalTypes
-    Database.DuckDB.FFI.OpenConnect
-    Database.DuckDB.FFI.PendingResult
-    Database.DuckDB.FFI.PreparedStatements
-    Database.DuckDB.FFI.ProfilingInfo
-    Database.DuckDB.FFI.QueryExecution
-    Database.DuckDB.FFI.ReplacementScans
-    Database.DuckDB.FFI.ResultFunctions
-    Database.DuckDB.FFI.ScalarFunctions
-    Database.DuckDB.FFI.SelectionVector
-    Database.DuckDB.FFI.StreamingResult
-    Database.DuckDB.FFI.TableDescription
-    Database.DuckDB.FFI.TableFunctions
-    Database.DuckDB.FFI.Threading
-    Database.DuckDB.FFI.Types
-    Database.DuckDB.FFI.Validity
-    Database.DuckDB.FFI.ValueInterface
-    Database.DuckDB.FFI.Vector
+    V2AggregateTest
+    V2ArrowTest
+    V2AttachTest
+    V2CallbackTest
+    V2ChunkTest
+    V2CopyTest
+    V2FileSystemTest
+    V2FunctionDocsTest
+    V2MacroTest
+    V2ReplacementScanTest
+    V2StatementTest
+    V2TableFunctionTest
+    V2Test
+    V2TypeTest
+    V2ValueTest
 
-  include-dirs: cbits/
-  install-includes: duckdb.h
-  extra-libraries: duckdb
-  c-sources: cbits/duckdb_stub.c
+  default-language: Haskell2010
+  ghc-options: -threaded
   build-depends:
     base >=4.18 && <4.23,
-    bytestring >=0.11 && <0.13,
-    containers >=0.6 && <0.9,
-    exceptions >=0.10 && <0.11,
-    mtl >=2.3 && <2.4,
-    text >=2.0 && <2.2,
-    time >=1.12 && <1.16,
-    transformers >=0.6 && <0.7,
+    duckdb-ffi,
+    hs-bindgen-runtime >=1.0.0.0 && <1.1,
+    tasty >=1.5 && <1.6,
+    tasty-hunit >=0.10 && <0.11,
 
 test-suite duckdb-ffi-tests
+  if flag(extension)
+    buildable: False
   type: exitcode-stdio-1.0
   hs-source-dirs: test
   main-is: Main.hs
@@ -172,6 +188,7 @@
   build-depends:
     base >=4.18 && <4.23,
     duckdb-ffi,
+    hs-bindgen-runtime >=1.0.0.0 && <1.1,
     tasty >=1.5 && <1.6,
     tasty-expected-failure >=0.12 && <0.13,
     tasty-hunit >=0.10 && <0.11,
diff --git a/generated.sha256 b/generated.sha256
new file mode 100644
--- /dev/null
+++ b/generated.sha256
@@ -0,0 +1,4 @@
+e44197cc298a17e52ad61a3a1437e55db8edb26105f399886454e5e2d083315a  generated/Database/DuckDB/FFI.hs
+055c914460c03f3b6a1a31aab08762e7cad28a46ca6e9b091e83e1d2de15698d  generated/Database/DuckDB/FFI/V2.hs
+6a90a8786d4dac9590132b8821fa1471a628db75e317de8f7b231aa22493d466  generated/abi-checks.c
+16837d5322aeb5686b1288753cb332eb2074b72667ef4f37ff5a5d98fa70466e  generated/abi-checks-v2.c
diff --git a/generated/Database/DuckDB/FFI.hs b/generated/Database/DuckDB/FFI.hs
new file mode 100644
--- /dev/null
+++ b/generated/Database/DuckDB/FFI.hs
@@ -0,0 +1,46826 @@
+-- | Raw bindings to the DuckDB C API in @duckdb.h@ and @duckdb_arrow.h@.
+{-# LANGUAGE DataKinds #-}
+{-# LANGUAGE DeriveGeneric #-}
+{-# LANGUAGE DerivingStrategies #-}
+{-# LANGUAGE DerivingVia #-}
+{-# LANGUAGE DuplicateRecordFields #-}
+{-# LANGUAGE EmptyDataDecls #-}
+{-# LANGUAGE ExplicitForAll #-}
+{-# LANGUAGE FlexibleContexts #-}
+{-# LANGUAGE FlexibleInstances #-}
+{-# LANGUAGE ForeignFunctionInterface #-}
+{-# LANGUAGE GeneralizedNewtypeDeriving #-}
+{-# LANGUAGE MagicHash #-}
+{-# LANGUAGE MultiParamTypeClasses #-}
+{-# LANGUAGE NoFieldSelectors #-}
+{-# LANGUAGE NoImplicitPrelude #-}
+{-# LANGUAGE PatternSynonyms #-}
+{-# LANGUAGE StandaloneDeriving #-}
+{-# LANGUAGE TemplateHaskell #-}
+{-# LANGUAGE TypeApplications #-}
+{-# LANGUAGE TypeFamilies #-}
+{-# LANGUAGE TypeOperators #-}
+{-# LANGUAGE UnboxedTuples #-}
+{-# LANGUAGE UndecidableInstances #-}
+{-# OPTIONS_HADDOCK prune #-}
+
+module Database.DuckDB.FFI
+    ( Database.DuckDB.FFI.dUCKDB_API_VERSION_MAJOR
+    , Database.DuckDB.FFI.dUCKDB_API_VERSION_MINOR
+    , Database.DuckDB.FFI.dUCKDB_API_VERSION_PATCH
+    , Database.DuckDB.FFI.dUCKDB_API_ALLOW_DEPRECATED
+    , Database.DuckDB.FFI.dUCKDB_API_ALLOW_UNSTABLE
+    , Database.DuckDB.FFI.Duckdb_string_t_value_pointer(..)
+    , Database.DuckDB.FFI.Duckdb_string_t_value_inlined(..)
+    , Database.DuckDB.FFI.Duckdb_string_t_value(..)
+    , Database.DuckDB.FFI.DuckDBStringT(..)
+    , Database.DuckDB.FFI.DuckDBState(..)
+    , pattern Database.DuckDB.FFI.DuckDBSuccess
+    , pattern Database.DuckDB.FFI.DuckDBError
+    , Database.DuckDB.FFI.DuckDBIdx(..)
+    , Database.DuckDB.FFI.DuckDBType(..)
+    , pattern Database.DuckDB.FFI.DuckDBTypeInvalid
+    , pattern Database.DuckDB.FFI.DuckDBTypeBoolean
+    , pattern Database.DuckDB.FFI.DuckDBTypeTinyInt
+    , pattern Database.DuckDB.FFI.DuckDBTypeSmallInt
+    , pattern Database.DuckDB.FFI.DuckDBTypeInteger
+    , pattern Database.DuckDB.FFI.DuckDBTypeBigInt
+    , pattern Database.DuckDB.FFI.DuckDBTypeUTinyInt
+    , pattern Database.DuckDB.FFI.DuckDBTypeUSmallInt
+    , pattern Database.DuckDB.FFI.DuckDBTypeUInteger
+    , pattern Database.DuckDB.FFI.DuckDBTypeUBigInt
+    , pattern Database.DuckDB.FFI.DuckDBTypeFloat
+    , pattern Database.DuckDB.FFI.DuckDBTypeDouble
+    , pattern Database.DuckDB.FFI.DuckDBTypeTimestamp
+    , pattern Database.DuckDB.FFI.DuckDBTypeDate
+    , pattern Database.DuckDB.FFI.DuckDBTypeTime
+    , pattern Database.DuckDB.FFI.DuckDBTypeInterval
+    , pattern Database.DuckDB.FFI.DuckDBTypeHugeInt
+    , pattern Database.DuckDB.FFI.DuckDBTypeVarchar
+    , pattern Database.DuckDB.FFI.DuckDBTypeBlob
+    , pattern Database.DuckDB.FFI.DuckDBTypeDecimal
+    , pattern Database.DuckDB.FFI.DuckDBTypeTimestampS
+    , pattern Database.DuckDB.FFI.DuckDBTypeTimestampMs
+    , pattern Database.DuckDB.FFI.DuckDBTypeTimestampNs
+    , pattern Database.DuckDB.FFI.DuckDBTypeEnum
+    , pattern Database.DuckDB.FFI.DuckDBTypeList
+    , pattern Database.DuckDB.FFI.DuckDBTypeStruct
+    , pattern Database.DuckDB.FFI.DuckDBTypeMap
+    , pattern Database.DuckDB.FFI.DuckDBTypeUUID
+    , pattern Database.DuckDB.FFI.DuckDBTypeUnion
+    , pattern Database.DuckDB.FFI.DuckDBTypeBit
+    , pattern Database.DuckDB.FFI.DuckDBTypeTimeTz
+    , pattern Database.DuckDB.FFI.DuckDBTypeTimestampTz
+    , pattern Database.DuckDB.FFI.DuckDBTypeUHugeInt
+    , pattern Database.DuckDB.FFI.DuckDBTypeArray
+    , pattern Database.DuckDB.FFI.DuckDBTypeAny
+    , pattern Database.DuckDB.FFI.DuckDBTypeBigNum
+    , pattern Database.DuckDB.FFI.DuckDBTypeSQLNull
+    , pattern Database.DuckDB.FFI.DuckDBTypeStringLiteral
+    , pattern Database.DuckDB.FFI.DuckDBTypeIntegerLiteral
+    , pattern Database.DuckDB.FFI.DuckDBTypeTimeNs
+    , pattern Database.DuckDB.FFI.DuckDBTypeGeometry
+    , pattern Database.DuckDB.FFI.DuckDBTypeVariant
+    , pattern Database.DuckDB.FFI.DuckDBTypeTimestampTzNs
+    , Database.DuckDB.FFI.DuckDBPendingState(..)
+    , pattern Database.DuckDB.FFI.DuckDBPendingResultReady
+    , pattern Database.DuckDB.FFI.DuckDBPendingResultNotReady
+    , pattern Database.DuckDB.FFI.DuckDBPendingError
+    , pattern Database.DuckDB.FFI.DuckDBPendingNoTasksAvailable
+    , Database.DuckDB.FFI.DuckDBResultType(..)
+    , pattern Database.DuckDB.FFI.DuckDBResultTypeInvalid
+    , pattern Database.DuckDB.FFI.DuckDBResultTypeChangedRows
+    , pattern Database.DuckDB.FFI.DuckDBResultTypeNothing
+    , pattern Database.DuckDB.FFI.DuckDBResultTypeQueryResult
+    , Database.DuckDB.FFI.DuckDBStatementType(..)
+    , pattern Database.DuckDB.FFI.DuckDBStatementTypeInvalid
+    , pattern Database.DuckDB.FFI.DuckDBStatementTypeSelect
+    , pattern Database.DuckDB.FFI.DuckDBStatementTypeInsert
+    , pattern Database.DuckDB.FFI.DuckDBStatementTypeUpdate
+    , pattern Database.DuckDB.FFI.DuckDBStatementTypeExplain
+    , pattern Database.DuckDB.FFI.DuckDBStatementTypeDelete
+    , pattern Database.DuckDB.FFI.DuckDBStatementTypePrepare
+    , pattern Database.DuckDB.FFI.DuckDBStatementTypeCreate
+    , pattern Database.DuckDB.FFI.DuckDBStatementTypeExecute
+    , pattern Database.DuckDB.FFI.DuckDBStatementTypeAlter
+    , pattern Database.DuckDB.FFI.DuckDBStatementTypeTransaction
+    , pattern Database.DuckDB.FFI.DuckDBStatementTypeCopy
+    , pattern Database.DuckDB.FFI.DuckDBStatementTypeAnalyze
+    , pattern Database.DuckDB.FFI.DuckDBStatementTypeVariableSet
+    , pattern Database.DuckDB.FFI.DuckDBStatementTypeCreateFunc
+    , pattern Database.DuckDB.FFI.DuckDBStatementTypeDrop
+    , pattern Database.DuckDB.FFI.DuckDBStatementTypeExport
+    , pattern Database.DuckDB.FFI.DuckDBStatementTypePragma
+    , pattern Database.DuckDB.FFI.DuckDBStatementTypeVacuum
+    , pattern Database.DuckDB.FFI.DuckDBStatementTypeCall
+    , pattern Database.DuckDB.FFI.DuckDBStatementTypeSet
+    , pattern Database.DuckDB.FFI.DuckDBStatementTypeLoad
+    , pattern Database.DuckDB.FFI.DuckDBStatementTypeRelation
+    , pattern Database.DuckDB.FFI.DuckDBStatementTypeExtension
+    , pattern Database.DuckDB.FFI.DuckDBStatementTypeLogicalPlan
+    , pattern Database.DuckDB.FFI.DuckDBStatementTypeAttach
+    , pattern Database.DuckDB.FFI.DuckDBStatementTypeDetach
+    , pattern Database.DuckDB.FFI.DuckDBStatementTypeMulti
+    , pattern Database.DuckDB.FFI.DuckDBStatementTypeCopyDatabase
+    , pattern Database.DuckDB.FFI.DuckDBStatementTypeUpdateExtensions
+    , pattern Database.DuckDB.FFI.DuckDBStatementTypeMergeInto
+    , Database.DuckDB.FFI.DuckDBErrorType(..)
+    , pattern Database.DuckDB.FFI.DuckDBErrorInvalid
+    , pattern Database.DuckDB.FFI.DuckDBErrorOutOfRange
+    , pattern Database.DuckDB.FFI.DuckDBErrorConversion
+    , pattern Database.DuckDB.FFI.DuckDBErrorUnknownType
+    , pattern Database.DuckDB.FFI.DuckDBErrorDecimal
+    , pattern Database.DuckDB.FFI.DuckDBErrorMismatchType
+    , pattern Database.DuckDB.FFI.DuckDBErrorDivideByZero
+    , pattern Database.DuckDB.FFI.DuckDBErrorObjectSize
+    , pattern Database.DuckDB.FFI.DuckDBErrorInvalidType
+    , pattern Database.DuckDB.FFI.DuckDBErrorSerialization
+    , pattern Database.DuckDB.FFI.DuckDBErrorTransaction
+    , pattern Database.DuckDB.FFI.DuckDBErrorNotImplemented
+    , pattern Database.DuckDB.FFI.DuckDBErrorExpression
+    , pattern Database.DuckDB.FFI.DuckDBErrorCatalog
+    , pattern Database.DuckDB.FFI.DuckDBErrorParser
+    , pattern Database.DuckDB.FFI.DuckDBErrorPlanner
+    , pattern Database.DuckDB.FFI.DuckDBErrorScheduler
+    , pattern Database.DuckDB.FFI.DuckDBErrorExecutor
+    , pattern Database.DuckDB.FFI.DuckDBErrorConstraint
+    , pattern Database.DuckDB.FFI.DuckDBErrorIndex
+    , pattern Database.DuckDB.FFI.DuckDBErrorStat
+    , pattern Database.DuckDB.FFI.DuckDBErrorConnection
+    , pattern Database.DuckDB.FFI.DuckDBErrorSyntax
+    , pattern Database.DuckDB.FFI.DuckDBErrorSettings
+    , pattern Database.DuckDB.FFI.DuckDBErrorBinder
+    , pattern Database.DuckDB.FFI.DuckDBErrorNetwork
+    , pattern Database.DuckDB.FFI.DuckDBErrorOptimizer
+    , pattern Database.DuckDB.FFI.DuckDBErrorNullPointer
+    , pattern Database.DuckDB.FFI.DuckDBErrorIO
+    , pattern Database.DuckDB.FFI.DuckDBErrorInterrupt
+    , pattern Database.DuckDB.FFI.DuckDBErrorFatal
+    , pattern Database.DuckDB.FFI.DuckDBErrorInternal
+    , pattern Database.DuckDB.FFI.DuckDBErrorInvalidInput
+    , pattern Database.DuckDB.FFI.DuckDBErrorOutOfMemory
+    , pattern Database.DuckDB.FFI.DuckDBErrorPermission
+    , pattern Database.DuckDB.FFI.DuckDBErrorParameterNotResolved
+    , pattern Database.DuckDB.FFI.DuckDBErrorParameterNotAllowed
+    , pattern Database.DuckDB.FFI.DuckDBErrorDependency
+    , pattern Database.DuckDB.FFI.DuckDBErrorHTTP
+    , pattern Database.DuckDB.FFI.DuckDBErrorMissingExtension
+    , pattern Database.DuckDB.FFI.DuckDBErrorAutoload
+    , pattern Database.DuckDB.FFI.DuckDBErrorSequence
+    , pattern Database.DuckDB.FFI.DuckDBErrorDataCorruption
+    , pattern Database.DuckDB.FFI.DuckDBInvalidConfiguration
+    , pattern Database.DuckDB.FFI.DuckDBErrorResourceInUse
+    , Database.DuckDB.FFI.DuckDBCastMode(..)
+    , pattern Database.DuckDB.FFI.DuckDBCastNormal
+    , pattern Database.DuckDB.FFI.DuckDBCastTry
+    , Database.DuckDB.FFI.DuckDBFileFlag(..)
+    , pattern Database.DuckDB.FFI.DuckDBFileFlagInvalid
+    , pattern Database.DuckDB.FFI.DuckDBFileFlagRead
+    , pattern Database.DuckDB.FFI.DuckDBFileFlagWrite
+    , pattern Database.DuckDB.FFI.DuckDBFileFlagCreate
+    , pattern Database.DuckDB.FFI.DuckDBFileFlagCreateNew
+    , pattern Database.DuckDB.FFI.DuckDBFileFlagAppend
+    , Database.DuckDB.FFI.DuckDBConfigOptionScope(..)
+    , pattern Database.DuckDB.FFI.DuckDBConfigOptionScopeInvalid
+    , pattern Database.DuckDB.FFI.DuckDBConfigOptionScopeLocal
+    , pattern Database.DuckDB.FFI.DuckDBConfigOptionScopeSession
+    , pattern Database.DuckDB.FFI.DuckDBConfigOptionScopeGlobal
+    , Database.DuckDB.FFI.DuckDBCatalogEntryType(..)
+    , pattern Database.DuckDB.FFI.DuckDBCatalogEntryTypeInvalid
+    , pattern Database.DuckDB.FFI.DuckDBCatalogEntryTypeTable
+    , pattern Database.DuckDB.FFI.DuckDBCatalogEntryTypeSchema
+    , pattern Database.DuckDB.FFI.DuckDBCatalogEntryTypeView
+    , pattern Database.DuckDB.FFI.DuckDBCatalogEntryTypeIndex
+    , pattern Database.DuckDB.FFI.DuckDBCatalogEntryTypePreparedStatement
+    , pattern Database.DuckDB.FFI.DuckDBCatalogEntryTypeSequence
+    , pattern Database.DuckDB.FFI.DuckDBCatalogEntryTypeCollation
+    , pattern Database.DuckDB.FFI.DuckDBCatalogEntryTypeType
+    , pattern Database.DuckDB.FFI.DuckDBCatalogEntryTypeDatabase
+    , Database.DuckDB.FFI.DuckDBTypeAlias(..)
+    , Database.DuckDB.FFI.DuckDBDate(..)
+    , Database.DuckDB.FFI.DuckDBDateStruct(..)
+    , Database.DuckDB.FFI.DuckDBTime(..)
+    , Database.DuckDB.FFI.DuckDBTimeStruct(..)
+    , Database.DuckDB.FFI.DuckDBTimeNs(..)
+    , Database.DuckDB.FFI.DuckDBTimeTz(..)
+    , Database.DuckDB.FFI.DuckDBTimeTzStruct(..)
+    , Database.DuckDB.FFI.DuckDBTimestamp(..)
+    , Database.DuckDB.FFI.DuckDBTimestampStruct(..)
+    , Database.DuckDB.FFI.DuckDBTimestampS(..)
+    , Database.DuckDB.FFI.DuckDBTimestampMs(..)
+    , Database.DuckDB.FFI.DuckDBTimestampNs(..)
+    , Database.DuckDB.FFI.DuckDBInterval(..)
+    , Database.DuckDB.FFI.DuckDBHugeInt(..)
+    , Database.DuckDB.FFI.DuckDBUHugeInt(..)
+    , Database.DuckDB.FFI.DuckDBDecimal(..)
+    , Database.DuckDB.FFI.DuckDBQueryProgress(..)
+    , Database.DuckDB.FFI.DuckDBListEntry(..)
+    , Database.DuckDB.FFI.DuckDBColumn(..)
+    , Database.DuckDB.FFI.DuckDBString(..)
+    , Database.DuckDB.FFI.DuckDBBlob(..)
+    , Database.DuckDB.FFI.DuckDBBit(..)
+    , Database.DuckDB.FFI.DuckDBBignum(..)
+    , Database.DuckDB.FFI.DuckDBResult(..)
+    , Database.DuckDB.FFI.DuckDBInstanceCacheStruct
+    , Database.DuckDB.FFI.DuckDBInstanceCache(..)
+    , Database.DuckDB.FFI.DuckDBDatabaseStruct
+    , Database.DuckDB.FFI.DuckDBDatabase(..)
+    , Database.DuckDB.FFI.DuckDBConnectionStruct
+    , Database.DuckDB.FFI.DuckDBConnection(..)
+    , Database.DuckDB.FFI.DuckDBClientContextStruct
+    , Database.DuckDB.FFI.DuckDBClientContext(..)
+    , Database.DuckDB.FFI.DuckDBPreparedStatementStruct
+    , Database.DuckDB.FFI.DuckDBPreparedStatement(..)
+    , Database.DuckDB.FFI.DuckDBExtractedStatementsStruct
+    , Database.DuckDB.FFI.DuckDBExtractedStatements(..)
+    , Database.DuckDB.FFI.DuckDBPendingResultStruct
+    , Database.DuckDB.FFI.DuckDBPendingResult(..)
+    , Database.DuckDB.FFI.DuckDBAppenderStruct
+    , Database.DuckDB.FFI.DuckDBAppender(..)
+    , Database.DuckDB.FFI.DuckDBTableDescriptionStruct
+    , Database.DuckDB.FFI.DuckDBTableDescription(..)
+    , Database.DuckDB.FFI.DuckDBConfigStruct
+    , Database.DuckDB.FFI.DuckDBConfig(..)
+    , Database.DuckDB.FFI.DuckDBConfigOptionStruct
+    , Database.DuckDB.FFI.DuckDBConfigOption(..)
+    , Database.DuckDB.FFI.DuckDBLogicalTypeStruct
+    , Database.DuckDB.FFI.DuckDBLogicalType(..)
+    , Database.DuckDB.FFI.DuckDBCreateTypeInfoStruct
+    , Database.DuckDB.FFI.DuckDBCreateTypeInfo(..)
+    , Database.DuckDB.FFI.DuckDBDataChunkStruct
+    , Database.DuckDB.FFI.DuckDBDataChunk(..)
+    , Database.DuckDB.FFI.DuckDBValueStruct
+    , Database.DuckDB.FFI.DuckDBValue(..)
+    , Database.DuckDB.FFI.DuckDBProfilingInfoStruct
+    , Database.DuckDB.FFI.DuckDBProfilingInfo(..)
+    , Database.DuckDB.FFI.DuckDBErrorDataStruct
+    , Database.DuckDB.FFI.DuckDBErrorData(..)
+    , Database.DuckDB.FFI.DuckDBExpressionStruct
+    , Database.DuckDB.FFI.DuckDBExpression(..)
+    , Database.DuckDB.FFI.DuckDBVectorStruct
+    , Database.DuckDB.FFI.DuckDBVector(..)
+    , Database.DuckDB.FFI.DuckDBSelectionVectorStruct
+    , Database.DuckDB.FFI.DuckDBSelectionVector(..)
+    , Database.DuckDB.FFI.DuckDBArrowOptionsStruct
+    , Database.DuckDB.FFI.DuckDBArrowOptions(..)
+    , Database.DuckDB.FFI.DuckDBArrowStruct
+    , Database.DuckDB.FFI.DuckDBArrow(..)
+    , Database.DuckDB.FFI.DuckDBArrowStreamStruct
+    , Database.DuckDB.FFI.DuckDBArrowStream(..)
+    , Database.DuckDB.FFI.DuckDBArrowSchemaStruct
+    , Database.DuckDB.FFI.DuckDBArrowSchema(..)
+    , Database.DuckDB.FFI.DuckDBArrowArrayStruct
+    , Database.DuckDB.FFI.DuckDBArrowArray(..)
+    , Database.DuckDB.FFI.DuckDBArrowConvertedSchemaStruct
+    , Database.DuckDB.FFI.DuckDBArrowConvertedSchema(..)
+    , Database.DuckDB.FFI.DuckDBFileOpenOptionsStruct
+    , Database.DuckDB.FFI.DuckDBFileOpenOptions(..)
+    , Database.DuckDB.FFI.DuckDBFileSystemStruct
+    , Database.DuckDB.FFI.DuckDBFileSystem(..)
+    , Database.DuckDB.FFI.DuckDBFileHandleStruct
+    , Database.DuckDB.FFI.DuckDBFileHandle(..)
+    , Database.DuckDB.FFI.DuckDBCatalogStruct
+    , Database.DuckDB.FFI.DuckDBCatalog(..)
+    , Database.DuckDB.FFI.DuckDBCatalogEntryStruct
+    , Database.DuckDB.FFI.DuckDBCatalogEntry(..)
+    , Database.DuckDB.FFI.DuckDBTaskState(..)
+    , Database.DuckDB.FFI.DuckDBScalarFunctionStruct
+    , Database.DuckDB.FFI.DuckDBScalarFunction(..)
+    , Database.DuckDB.FFI.DuckDBScalarFunctionSetStruct
+    , Database.DuckDB.FFI.DuckDBScalarFunctionSet(..)
+    , Database.DuckDB.FFI.DuckDBAggregateFunctionStruct
+    , Database.DuckDB.FFI.DuckDBAggregateFunction(..)
+    , Database.DuckDB.FFI.DuckDBAggregateFunctionSetStruct
+    , Database.DuckDB.FFI.DuckDBAggregateFunctionSet(..)
+    , Database.DuckDB.FFI.DuckDBAggregateStateStruct
+    , Database.DuckDB.FFI.DuckDBAggregateState(..)
+    , Database.DuckDB.FFI.DuckDBTableFunctionStruct
+    , Database.DuckDB.FFI.DuckDBTableFunction(..)
+    , Database.DuckDB.FFI.DuckDBCastFunctionStruct
+    , Database.DuckDB.FFI.DuckDBCastFunction(..)
+    , Database.DuckDB.FFI.DuckDBCopyFunctionStruct
+    , Database.DuckDB.FFI.DuckDBCopyFunction(..)
+    , Database.DuckDB.FFI.DuckDBCopyFunctionBindInfoStruct
+    , Database.DuckDB.FFI.DuckDBCopyFunctionBindInfo(..)
+    , Database.DuckDB.FFI.DuckDBCopyFunctionGlobalInitInfoStruct
+    , Database.DuckDB.FFI.DuckDBCopyFunctionGlobalInitInfo(..)
+    , Database.DuckDB.FFI.DuckDBCopyFunctionSinkInfoStruct
+    , Database.DuckDB.FFI.DuckDBCopyFunctionSinkInfo(..)
+    , Database.DuckDB.FFI.DuckDBCopyFunctionFinalizeInfoStruct
+    , Database.DuckDB.FFI.DuckDBCopyFunctionFinalizeInfo(..)
+    , Database.DuckDB.FFI.DuckDBReplacementScanInfoStruct
+    , Database.DuckDB.FFI.DuckDBReplacementScanInfo(..)
+    , Database.DuckDB.FFI.DuckDBLogStorageStruct
+    , Database.DuckDB.FFI.DuckDBLogStorage(..)
+    , Database.DuckDB.FFI.DuckDBFunctionInfoStruct
+    , Database.DuckDB.FFI.DuckDBFunctionInfo(..)
+    , Database.DuckDB.FFI.DuckDBBindInfoStruct
+    , Database.DuckDB.FFI.DuckDBBindInfo(..)
+    , Database.DuckDB.FFI.DuckDBInitInfoStruct
+    , Database.DuckDB.FFI.DuckDBInitInfo(..)
+    , Database.DuckDB.FFI.DuckDBExtensionInfoStruct
+    , Database.DuckDB.FFI.DuckDBExtensionInfo(..)
+    , Database.DuckDB.FFI.DuckDBSel(..)
+    , Database.DuckDB.FFI.DuckDBDeleteCallback_Aux(..)
+    , Database.DuckDB.FFI.DuckDBDeleteCallback(..)
+    , Database.DuckDB.FFI.DuckDBCopyCallback_Aux(..)
+    , Database.DuckDB.FFI.DuckDBCopyCallback(..)
+    , Database.DuckDB.FFI.DuckDBTableFunctionBindFun_Aux(..)
+    , Database.DuckDB.FFI.DuckDBTableFunctionBindFun(..)
+    , Database.DuckDB.FFI.DuckDBTableFunctionInitFun_Aux(..)
+    , Database.DuckDB.FFI.DuckDBTableFunctionInitFun(..)
+    , Database.DuckDB.FFI.DuckDBTableFunctionFun_Aux(..)
+    , Database.DuckDB.FFI.DuckDBTableFunctionFun(..)
+    , Database.DuckDB.FFI.DuckDBReplacementCallback_Aux(..)
+    , Database.DuckDB.FFI.DuckDBReplacementCallback(..)
+    , Database.DuckDB.FFI.DuckDBLoggerWriteLogEntryFun_Aux(..)
+    , Database.DuckDB.FFI.DuckDBLoggerWriteLogEntryFun(..)
+    , Database.DuckDB.FFI.DuckDBCopyFunctionSinkFun_Aux(..)
+    , Database.DuckDB.FFI.DuckDBCopyFunctionSinkFun(..)
+    , Database.DuckDB.FFI.DuckDBCopyFunctionFinalizeFun_Aux(..)
+    , Database.DuckDB.FFI.DuckDBCopyFunctionFinalizeFun(..)
+    , Database.DuckDB.FFI.DuckDBAggregateStateSizeFun_Aux(..)
+    , Database.DuckDB.FFI.DuckDBAggregateStateSizeFun(..)
+    , Database.DuckDB.FFI.DuckDBAggregateInitFun_Aux(..)
+    , Database.DuckDB.FFI.DuckDBAggregateInitFun(..)
+    , Database.DuckDB.FFI.DuckDBAggregateDestroyFun_Aux(..)
+    , Database.DuckDB.FFI.DuckDBAggregateDestroyFun(..)
+    , Database.DuckDB.FFI.DuckDBAggregateUpdateFun_Aux(..)
+    , Database.DuckDB.FFI.DuckDBAggregateUpdateFun(..)
+    , Database.DuckDB.FFI.DuckDBAggregateCombineFun_Aux(..)
+    , Database.DuckDB.FFI.DuckDBAggregateCombineFun(..)
+    , Database.DuckDB.FFI.DuckDBAggregateFinalizeFun_Aux(..)
+    , Database.DuckDB.FFI.DuckDBAggregateFinalizeFun(..)
+    , Database.DuckDB.FFI.DuckDBScalarFunctionBindFun_Aux(..)
+    , Database.DuckDB.FFI.DuckDBScalarFunctionBindFun(..)
+    , Database.DuckDB.FFI.DuckDBScalarFunctionInitFun_Aux(..)
+    , Database.DuckDB.FFI.DuckDBScalarFunctionInitFun(..)
+    , Database.DuckDB.FFI.DuckDBScalarFunctionFun_Aux(..)
+    , Database.DuckDB.FFI.DuckDBScalarFunctionFun(..)
+    , Database.DuckDB.FFI.DuckDBCastFunctionFun_Aux(..)
+    , Database.DuckDB.FFI.DuckDBCastFunctionFun(..)
+    , Database.DuckDB.FFI.DuckDBCopyFunctionBindFun_Aux(..)
+    , Database.DuckDB.FFI.DuckDBCopyFunctionBindFun(..)
+    , Database.DuckDB.FFI.DuckDBCopyFunctionGlobalInitFun_Aux(..)
+    , Database.DuckDB.FFI.DuckDBCopyFunctionGlobalInitFun(..)
+    , Database.DuckDB.FFI.DuckDBExtensionAccess(..)
+    , Database.DuckDB.FFI.ArrowSchema(..)
+    , Database.DuckDB.FFI.ArrowArray(..)
+    , Database.DuckDB.FFI.ArrowArrayStream(..)
+    , Database.DuckDB.FFI.c_duckdb_from_date
+    , Database.DuckDB.FFI.c_duckdb_to_date
+    , Database.DuckDB.FFI.c_duckdb_is_finite_date
+    , Database.DuckDB.FFI.c_duckdb_from_time
+    , Database.DuckDB.FFI.c_duckdb_create_time_tz
+    , Database.DuckDB.FFI.c_duckdb_from_time_tz
+    , Database.DuckDB.FFI.c_duckdb_to_time
+    , Database.DuckDB.FFI.c_duckdb_from_timestamp
+    , Database.DuckDB.FFI.c_duckdb_to_timestamp
+    , Database.DuckDB.FFI.c_duckdb_is_finite_timestamp
+    , Database.DuckDB.FFI.c_duckdb_is_finite_timestamp_s
+    , Database.DuckDB.FFI.c_duckdb_is_finite_timestamp_ms
+    , Database.DuckDB.FFI.c_duckdb_is_finite_timestamp_ns
+    , Database.DuckDB.FFI.c_duckdb_hugeint_to_double
+    , Database.DuckDB.FFI.c_duckdb_double_to_hugeint
+    , Database.DuckDB.FFI.c_duckdb_uhugeint_to_double
+    , Database.DuckDB.FFI.c_duckdb_double_to_uhugeint
+    , Database.DuckDB.FFI.c_duckdb_double_to_decimal
+    , Database.DuckDB.FFI.c_duckdb_decimal_to_double
+    , Database.DuckDB.FFI.c_duckdb_create_aggregate_function
+    , Database.DuckDB.FFI.c_duckdb_destroy_aggregate_function
+    , Database.DuckDB.FFI.c_duckdb_aggregate_function_set_name
+    , Database.DuckDB.FFI.c_duckdb_aggregate_function_add_parameter
+    , Database.DuckDB.FFI.c_duckdb_aggregate_function_set_return_type
+    , Database.DuckDB.FFI.c_duckdb_aggregate_function_set_functions
+    , Database.DuckDB.FFI.c_duckdb_aggregate_function_set_destructor
+    , Database.DuckDB.FFI.c_duckdb_register_aggregate_function
+    , Database.DuckDB.FFI.c_duckdb_aggregate_function_set_special_handling
+    , Database.DuckDB.FFI.c_duckdb_aggregate_function_set_extra_info
+    , Database.DuckDB.FFI.c_duckdb_aggregate_function_get_extra_info
+    , Database.DuckDB.FFI.c_duckdb_aggregate_function_set_error
+    , Database.DuckDB.FFI.c_duckdb_create_aggregate_function_set
+    , Database.DuckDB.FFI.c_duckdb_destroy_aggregate_function_set
+    , Database.DuckDB.FFI.c_duckdb_add_aggregate_function_to_set
+    , Database.DuckDB.FFI.c_duckdb_register_aggregate_function_set
+    , Database.DuckDB.FFI.c_duckdb_appender_create
+    , Database.DuckDB.FFI.c_duckdb_appender_create_ext
+    , Database.DuckDB.FFI.c_duckdb_appender_create_query
+    , Database.DuckDB.FFI.c_duckdb_appender_column_count
+    , Database.DuckDB.FFI.c_duckdb_appender_column_type
+    , Database.DuckDB.FFI.c_duckdb_appender_error_data
+    , Database.DuckDB.FFI.c_duckdb_appender_flush
+    , Database.DuckDB.FFI.c_duckdb_appender_clear
+    , Database.DuckDB.FFI.c_duckdb_appender_close
+    , Database.DuckDB.FFI.c_duckdb_appender_destroy
+    , Database.DuckDB.FFI.c_duckdb_appender_add_column
+    , Database.DuckDB.FFI.c_duckdb_appender_clear_columns
+    , Database.DuckDB.FFI.c_duckdb_appender_begin_row
+    , Database.DuckDB.FFI.c_duckdb_appender_end_row
+    , Database.DuckDB.FFI.c_duckdb_append_default
+    , Database.DuckDB.FFI.c_duckdb_append_default_to_chunk
+    , Database.DuckDB.FFI.c_duckdb_append_bool
+    , Database.DuckDB.FFI.c_duckdb_append_int8
+    , Database.DuckDB.FFI.c_duckdb_append_int16
+    , Database.DuckDB.FFI.c_duckdb_append_int32
+    , Database.DuckDB.FFI.c_duckdb_append_int64
+    , Database.DuckDB.FFI.c_duckdb_append_hugeint
+    , Database.DuckDB.FFI.c_duckdb_append_uint8
+    , Database.DuckDB.FFI.c_duckdb_append_uint16
+    , Database.DuckDB.FFI.c_duckdb_append_uint32
+    , Database.DuckDB.FFI.c_duckdb_append_uint64
+    , Database.DuckDB.FFI.c_duckdb_append_uhugeint
+    , Database.DuckDB.FFI.c_duckdb_append_float
+    , Database.DuckDB.FFI.c_duckdb_append_double
+    , Database.DuckDB.FFI.c_duckdb_append_date
+    , Database.DuckDB.FFI.c_duckdb_append_time
+    , Database.DuckDB.FFI.c_duckdb_append_timestamp
+    , Database.DuckDB.FFI.c_duckdb_append_interval
+    , Database.DuckDB.FFI.c_duckdb_append_varchar
+    , Database.DuckDB.FFI.c_duckdb_append_varchar_length
+    , Database.DuckDB.FFI.c_duckdb_append_blob
+    , Database.DuckDB.FFI.c_duckdb_append_null
+    , Database.DuckDB.FFI.c_duckdb_append_value
+    , Database.DuckDB.FFI.c_duckdb_append_data_chunk
+    , Database.DuckDB.FFI.c_duckdb_appender_error
+    , Database.DuckDB.FFI.c_duckdb_to_arrow_schema
+    , Database.DuckDB.FFI.c_duckdb_data_chunk_to_arrow
+    , Database.DuckDB.FFI.c_duckdb_schema_from_arrow
+    , Database.DuckDB.FFI.c_duckdb_data_chunk_from_arrow
+    , Database.DuckDB.FFI.c_duckdb_destroy_arrow_converted_schema
+    , Database.DuckDB.FFI.c_duckdb_query_arrow
+    , Database.DuckDB.FFI.c_duckdb_query_arrow_schema
+    , Database.DuckDB.FFI.c_duckdb_prepared_arrow_schema
+    , Database.DuckDB.FFI.c_duckdb_result_arrow_array
+    , Database.DuckDB.FFI.c_duckdb_query_arrow_array
+    , Database.DuckDB.FFI.c_duckdb_arrow_column_count
+    , Database.DuckDB.FFI.c_duckdb_arrow_row_count
+    , Database.DuckDB.FFI.c_duckdb_arrow_rows_changed
+    , Database.DuckDB.FFI.c_duckdb_query_arrow_error
+    , Database.DuckDB.FFI.c_duckdb_destroy_arrow
+    , Database.DuckDB.FFI.c_duckdb_destroy_arrow_stream
+    , Database.DuckDB.FFI.c_duckdb_execute_prepared_arrow
+    , Database.DuckDB.FFI.c_duckdb_arrow_scan
+    , Database.DuckDB.FFI.c_duckdb_arrow_array_scan
+    , Database.DuckDB.FFI.c_duckdb_create_cast_function
+    , Database.DuckDB.FFI.c_duckdb_cast_function_set_source_type
+    , Database.DuckDB.FFI.c_duckdb_cast_function_set_target_type
+    , Database.DuckDB.FFI.c_duckdb_cast_function_set_implicit_cast_cost
+    , Database.DuckDB.FFI.c_duckdb_cast_function_set_function
+    , Database.DuckDB.FFI.c_duckdb_cast_function_set_extra_info
+    , Database.DuckDB.FFI.c_duckdb_cast_function_get_extra_info
+    , Database.DuckDB.FFI.c_duckdb_cast_function_get_cast_mode
+    , Database.DuckDB.FFI.c_duckdb_cast_function_set_error
+    , Database.DuckDB.FFI.c_duckdb_cast_function_set_row_error
+    , Database.DuckDB.FFI.c_duckdb_register_cast_function
+    , Database.DuckDB.FFI.c_duckdb_destroy_cast_function
+    , Database.DuckDB.FFI.c_duckdb_client_context_get_catalog
+    , Database.DuckDB.FFI.c_duckdb_catalog_get_type_name
+    , Database.DuckDB.FFI.c_duckdb_catalog_get_entry
+    , Database.DuckDB.FFI.c_duckdb_destroy_catalog
+    , Database.DuckDB.FFI.c_duckdb_catalog_entry_get_type
+    , Database.DuckDB.FFI.c_duckdb_catalog_entry_get_name
+    , Database.DuckDB.FFI.c_duckdb_destroy_catalog_entry
+    , Database.DuckDB.FFI.c_duckdb_create_config_option
+    , Database.DuckDB.FFI.c_duckdb_destroy_config_option
+    , Database.DuckDB.FFI.c_duckdb_config_option_set_name
+    , Database.DuckDB.FFI.c_duckdb_config_option_set_type
+    , Database.DuckDB.FFI.c_duckdb_config_option_set_default_value
+    , Database.DuckDB.FFI.c_duckdb_config_option_set_default_scope
+    , Database.DuckDB.FFI.c_duckdb_config_option_set_description
+    , Database.DuckDB.FFI.c_duckdb_register_config_option
+    , Database.DuckDB.FFI.c_duckdb_client_context_get_config_option
+    , Database.DuckDB.FFI.c_duckdb_get_profiling_info
+    , Database.DuckDB.FFI.c_duckdb_profiling_info_get_value
+    , Database.DuckDB.FFI.c_duckdb_profiling_info_get_metrics
+    , Database.DuckDB.FFI.c_duckdb_profiling_info_get_child_count
+    , Database.DuckDB.FFI.c_duckdb_profiling_info_get_child
+    , Database.DuckDB.FFI.c_duckdb_connect
+    , Database.DuckDB.FFI.c_duckdb_interrupt
+    , Database.DuckDB.FFI.c_duckdb_query_progress
+    , Database.DuckDB.FFI.c_duckdb_disconnect
+    , Database.DuckDB.FFI.c_duckdb_connection_get_client_context
+    , Database.DuckDB.FFI.c_duckdb_connection_get_arrow_options
+    , Database.DuckDB.FFI.c_duckdb_client_context_get_connection_id
+    , Database.DuckDB.FFI.c_duckdb_destroy_client_context
+    , Database.DuckDB.FFI.c_duckdb_destroy_arrow_options
+    , Database.DuckDB.FFI.c_duckdb_get_table_names
+    , Database.DuckDB.FFI.c_duckdb_create_copy_function
+    , Database.DuckDB.FFI.c_duckdb_copy_function_set_name
+    , Database.DuckDB.FFI.c_duckdb_copy_function_set_extra_info
+    , Database.DuckDB.FFI.c_duckdb_register_copy_function
+    , Database.DuckDB.FFI.c_duckdb_destroy_copy_function
+    , Database.DuckDB.FFI.c_duckdb_copy_function_set_bind
+    , Database.DuckDB.FFI.c_duckdb_copy_function_bind_set_error
+    , Database.DuckDB.FFI.c_duckdb_copy_function_bind_get_extra_info
+    , Database.DuckDB.FFI.c_duckdb_copy_function_bind_get_client_context
+    , Database.DuckDB.FFI.c_duckdb_copy_function_bind_get_column_count
+    , Database.DuckDB.FFI.c_duckdb_copy_function_bind_get_column_type
+    , Database.DuckDB.FFI.c_duckdb_copy_function_bind_get_options
+    , Database.DuckDB.FFI.c_duckdb_copy_function_bind_set_bind_data
+    , Database.DuckDB.FFI.c_duckdb_copy_function_set_global_init
+    , Database.DuckDB.FFI.c_duckdb_copy_function_global_init_set_error
+    , Database.DuckDB.FFI.c_duckdb_copy_function_global_init_get_extra_info
+    , Database.DuckDB.FFI.c_duckdb_copy_function_global_init_get_client_context
+    , Database.DuckDB.FFI.c_duckdb_copy_function_global_init_get_bind_data
+    , Database.DuckDB.FFI.c_duckdb_copy_function_global_init_get_file_path
+    , Database.DuckDB.FFI.c_duckdb_copy_function_global_init_set_global_state
+    , Database.DuckDB.FFI.c_duckdb_copy_function_set_sink
+    , Database.DuckDB.FFI.c_duckdb_copy_function_sink_set_error
+    , Database.DuckDB.FFI.c_duckdb_copy_function_sink_get_extra_info
+    , Database.DuckDB.FFI.c_duckdb_copy_function_sink_get_client_context
+    , Database.DuckDB.FFI.c_duckdb_copy_function_sink_get_bind_data
+    , Database.DuckDB.FFI.c_duckdb_copy_function_sink_get_global_state
+    , Database.DuckDB.FFI.c_duckdb_copy_function_set_finalize
+    , Database.DuckDB.FFI.c_duckdb_copy_function_finalize_set_error
+    , Database.DuckDB.FFI.c_duckdb_copy_function_finalize_get_extra_info
+    , Database.DuckDB.FFI.c_duckdb_copy_function_finalize_get_client_context
+    , Database.DuckDB.FFI.c_duckdb_copy_function_finalize_get_bind_data
+    , Database.DuckDB.FFI.c_duckdb_copy_function_finalize_get_global_state
+    , Database.DuckDB.FFI.c_duckdb_copy_function_set_copy_from_function
+    , Database.DuckDB.FFI.c_duckdb_create_data_chunk
+    , Database.DuckDB.FFI.c_duckdb_destroy_data_chunk
+    , Database.DuckDB.FFI.c_duckdb_data_chunk_reset
+    , Database.DuckDB.FFI.c_duckdb_data_chunk_get_column_count
+    , Database.DuckDB.FFI.c_duckdb_data_chunk_get_vector
+    , Database.DuckDB.FFI.c_duckdb_data_chunk_get_size
+    , Database.DuckDB.FFI.c_duckdb_data_chunk_set_size
+    , Database.DuckDB.FFI.c_duckdb_create_instance_cache
+    , Database.DuckDB.FFI.c_duckdb_get_or_create_from_cache
+    , Database.DuckDB.FFI.c_duckdb_destroy_instance_cache
+    , Database.DuckDB.FFI.c_duckdb_open
+    , Database.DuckDB.FFI.c_duckdb_open_ext
+    , Database.DuckDB.FFI.c_duckdb_close
+    , Database.DuckDB.FFI.c_duckdb_library_version
+    , Database.DuckDB.FFI.c_duckdb_create_config
+    , Database.DuckDB.FFI.c_duckdb_config_count
+    , Database.DuckDB.FFI.c_duckdb_get_config_flag
+    , Database.DuckDB.FFI.c_duckdb_set_config
+    , Database.DuckDB.FFI.c_duckdb_destroy_config
+    , Database.DuckDB.FFI.c_duckdb_destroy_expression
+    , Database.DuckDB.FFI.c_duckdb_expression_return_type
+    , Database.DuckDB.FFI.c_duckdb_expression_is_foldable
+    , Database.DuckDB.FFI.c_duckdb_expression_fold
+    , Database.DuckDB.FFI.c_duckdb_client_context_get_file_system
+    , Database.DuckDB.FFI.c_duckdb_destroy_file_system
+    , Database.DuckDB.FFI.c_duckdb_file_system_error_data
+    , Database.DuckDB.FFI.c_duckdb_file_system_open
+    , Database.DuckDB.FFI.c_duckdb_create_file_open_options
+    , Database.DuckDB.FFI.c_duckdb_file_open_options_set_flag
+    , Database.DuckDB.FFI.c_duckdb_destroy_file_open_options
+    , Database.DuckDB.FFI.c_duckdb_destroy_file_handle
+    , Database.DuckDB.FFI.c_duckdb_file_handle_error_data
+    , Database.DuckDB.FFI.c_duckdb_file_handle_read
+    , Database.DuckDB.FFI.c_duckdb_file_handle_write
+    , Database.DuckDB.FFI.c_duckdb_file_handle_tell
+    , Database.DuckDB.FFI.c_duckdb_file_handle_size
+    , Database.DuckDB.FFI.c_duckdb_file_handle_seek
+    , Database.DuckDB.FFI.c_duckdb_file_handle_sync
+    , Database.DuckDB.FFI.c_duckdb_file_handle_close
+    , Database.DuckDB.FFI.c_duckdb_create_log_storage
+    , Database.DuckDB.FFI.c_duckdb_destroy_log_storage
+    , Database.DuckDB.FFI.c_duckdb_log_storage_set_write_log_entry
+    , Database.DuckDB.FFI.c_duckdb_log_storage_set_extra_data
+    , Database.DuckDB.FFI.c_duckdb_log_storage_set_name
+    , Database.DuckDB.FFI.c_duckdb_register_log_storage
+    , Database.DuckDB.FFI.c_duckdb_create_logical_type
+    , Database.DuckDB.FFI.c_duckdb_logical_type_get_alias
+    , Database.DuckDB.FFI.c_duckdb_logical_type_set_alias
+    , Database.DuckDB.FFI.c_duckdb_create_list_type
+    , Database.DuckDB.FFI.c_duckdb_create_array_type
+    , Database.DuckDB.FFI.c_duckdb_create_map_type
+    , Database.DuckDB.FFI.c_duckdb_create_union_type
+    , Database.DuckDB.FFI.c_duckdb_create_struct_type
+    , Database.DuckDB.FFI.c_duckdb_create_enum_type
+    , Database.DuckDB.FFI.c_duckdb_create_decimal_type
+    , Database.DuckDB.FFI.c_duckdb_get_type_id
+    , Database.DuckDB.FFI.c_duckdb_decimal_width
+    , Database.DuckDB.FFI.c_duckdb_decimal_scale
+    , Database.DuckDB.FFI.c_duckdb_decimal_internal_type
+    , Database.DuckDB.FFI.c_duckdb_enum_internal_type
+    , Database.DuckDB.FFI.c_duckdb_enum_dictionary_size
+    , Database.DuckDB.FFI.c_duckdb_enum_dictionary_value
+    , Database.DuckDB.FFI.c_duckdb_list_type_child_type
+    , Database.DuckDB.FFI.c_duckdb_array_type_child_type
+    , Database.DuckDB.FFI.c_duckdb_array_type_array_size
+    , Database.DuckDB.FFI.c_duckdb_map_type_key_type
+    , Database.DuckDB.FFI.c_duckdb_map_type_value_type
+    , Database.DuckDB.FFI.c_duckdb_struct_type_child_count
+    , Database.DuckDB.FFI.c_duckdb_struct_type_child_name
+    , Database.DuckDB.FFI.c_duckdb_struct_type_child_type
+    , Database.DuckDB.FFI.c_duckdb_union_type_member_count
+    , Database.DuckDB.FFI.c_duckdb_union_type_member_name
+    , Database.DuckDB.FFI.c_duckdb_union_type_member_type
+    , Database.DuckDB.FFI.c_duckdb_destroy_logical_type
+    , Database.DuckDB.FFI.c_duckdb_register_logical_type
+    , Database.DuckDB.FFI.c_duckdb_geometry_type_get_crs
+    , Database.DuckDB.FFI.c_duckdb_pending_prepared
+    , Database.DuckDB.FFI.c_duckdb_destroy_pending
+    , Database.DuckDB.FFI.c_duckdb_pending_error
+    , Database.DuckDB.FFI.c_duckdb_pending_execute_task
+    , Database.DuckDB.FFI.c_duckdb_pending_execute_check_state
+    , Database.DuckDB.FFI.c_duckdb_execute_pending
+    , Database.DuckDB.FFI.c_duckdb_pending_execution_is_finished
+    , Database.DuckDB.FFI.c_duckdb_prepare
+    , Database.DuckDB.FFI.c_duckdb_destroy_prepare
+    , Database.DuckDB.FFI.c_duckdb_prepare_error
+    , Database.DuckDB.FFI.c_duckdb_nparams
+    , Database.DuckDB.FFI.c_duckdb_parameter_name
+    , Database.DuckDB.FFI.c_duckdb_param_type
+    , Database.DuckDB.FFI.c_duckdb_param_logical_type
+    , Database.DuckDB.FFI.c_duckdb_clear_bindings
+    , Database.DuckDB.FFI.c_duckdb_prepared_statement_type
+    , Database.DuckDB.FFI.c_duckdb_prepared_statement_column_count
+    , Database.DuckDB.FFI.c_duckdb_prepared_statement_column_name
+    , Database.DuckDB.FFI.c_duckdb_prepared_statement_column_logical_type
+    , Database.DuckDB.FFI.c_duckdb_prepared_statement_column_type
+    , Database.DuckDB.FFI.c_duckdb_bind_value
+    , Database.DuckDB.FFI.c_duckdb_bind_parameter_index
+    , Database.DuckDB.FFI.c_duckdb_bind_boolean
+    , Database.DuckDB.FFI.c_duckdb_bind_int8
+    , Database.DuckDB.FFI.c_duckdb_bind_int16
+    , Database.DuckDB.FFI.c_duckdb_bind_int32
+    , Database.DuckDB.FFI.c_duckdb_bind_int64
+    , Database.DuckDB.FFI.c_duckdb_bind_hugeint
+    , Database.DuckDB.FFI.c_duckdb_bind_uhugeint
+    , Database.DuckDB.FFI.c_duckdb_bind_decimal
+    , Database.DuckDB.FFI.c_duckdb_bind_uint8
+    , Database.DuckDB.FFI.c_duckdb_bind_uint16
+    , Database.DuckDB.FFI.c_duckdb_bind_uint32
+    , Database.DuckDB.FFI.c_duckdb_bind_uint64
+    , Database.DuckDB.FFI.c_duckdb_bind_float
+    , Database.DuckDB.FFI.c_duckdb_bind_double
+    , Database.DuckDB.FFI.c_duckdb_bind_date
+    , Database.DuckDB.FFI.c_duckdb_bind_time
+    , Database.DuckDB.FFI.c_duckdb_bind_timestamp
+    , Database.DuckDB.FFI.c_duckdb_bind_timestamp_tz
+    , Database.DuckDB.FFI.c_duckdb_bind_interval
+    , Database.DuckDB.FFI.c_duckdb_bind_varchar
+    , Database.DuckDB.FFI.c_duckdb_bind_varchar_length
+    , Database.DuckDB.FFI.c_duckdb_bind_blob
+    , Database.DuckDB.FFI.c_duckdb_bind_null
+    , Database.DuckDB.FFI.c_duckdb_execute_prepared
+    , Database.DuckDB.FFI.c_duckdb_extract_statements
+    , Database.DuckDB.FFI.c_duckdb_prepare_extracted_statement
+    , Database.DuckDB.FFI.c_duckdb_extract_statements_error
+    , Database.DuckDB.FFI.c_duckdb_destroy_extracted
+    , Database.DuckDB.FFI.c_duckdb_execute_prepared_streaming
+    , Database.DuckDB.FFI.c_duckdb_pending_prepared_streaming
+    , Database.DuckDB.FFI.c_duckdb_query
+    , Database.DuckDB.FFI.c_duckdb_destroy_result
+    , Database.DuckDB.FFI.c_duckdb_column_name
+    , Database.DuckDB.FFI.c_duckdb_column_type
+    , Database.DuckDB.FFI.c_duckdb_result_statement_type
+    , Database.DuckDB.FFI.c_duckdb_column_logical_type
+    , Database.DuckDB.FFI.c_duckdb_result_get_arrow_options
+    , Database.DuckDB.FFI.c_duckdb_column_count
+    , Database.DuckDB.FFI.c_duckdb_rows_changed
+    , Database.DuckDB.FFI.c_duckdb_result_error
+    , Database.DuckDB.FFI.c_duckdb_result_error_type
+    , Database.DuckDB.FFI.c_duckdb_result_return_type
+    , Database.DuckDB.FFI.c_duckdb_fetch_chunk
+    , Database.DuckDB.FFI.c_duckdb_create_error_data
+    , Database.DuckDB.FFI.c_duckdb_destroy_error_data
+    , Database.DuckDB.FFI.c_duckdb_error_data_error_type
+    , Database.DuckDB.FFI.c_duckdb_error_data_message
+    , Database.DuckDB.FFI.c_duckdb_error_data_has_error
+    , Database.DuckDB.FFI.c_duckdb_malloc
+    , Database.DuckDB.FFI.c_duckdb_free
+    , Database.DuckDB.FFI.c_duckdb_vector_size
+    , Database.DuckDB.FFI.c_duckdb_string_is_inlined
+    , Database.DuckDB.FFI.c_duckdb_string_t_length
+    , Database.DuckDB.FFI.c_duckdb_string_t_data
+    , Database.DuckDB.FFI.c_duckdb_valid_utf8_check
+    , Database.DuckDB.FFI.c_duckdb_row_count
+    , Database.DuckDB.FFI.c_duckdb_column_data
+    , Database.DuckDB.FFI.c_duckdb_nullmask_data
+    , Database.DuckDB.FFI.c_duckdb_result_get_chunk
+    , Database.DuckDB.FFI.c_duckdb_result_is_streaming
+    , Database.DuckDB.FFI.c_duckdb_result_chunk_count
+    , Database.DuckDB.FFI.c_duckdb_stream_fetch_chunk
+    , Database.DuckDB.FFI.c_duckdb_add_replacement_scan
+    , Database.DuckDB.FFI.c_duckdb_replacement_scan_set_function_name
+    , Database.DuckDB.FFI.c_duckdb_replacement_scan_add_parameter
+    , Database.DuckDB.FFI.c_duckdb_replacement_scan_set_error
+    , Database.DuckDB.FFI.c_duckdb_create_scalar_function
+    , Database.DuckDB.FFI.c_duckdb_destroy_scalar_function
+    , Database.DuckDB.FFI.c_duckdb_scalar_function_set_name
+    , Database.DuckDB.FFI.c_duckdb_scalar_function_set_varargs
+    , Database.DuckDB.FFI.c_duckdb_scalar_function_set_special_handling
+    , Database.DuckDB.FFI.c_duckdb_scalar_function_set_volatile
+    , Database.DuckDB.FFI.c_duckdb_scalar_function_add_parameter
+    , Database.DuckDB.FFI.c_duckdb_scalar_function_set_return_type
+    , Database.DuckDB.FFI.c_duckdb_scalar_function_set_extra_info
+    , Database.DuckDB.FFI.c_duckdb_scalar_function_set_bind
+    , Database.DuckDB.FFI.c_duckdb_scalar_function_set_bind_data
+    , Database.DuckDB.FFI.c_duckdb_scalar_function_set_bind_data_copy
+    , Database.DuckDB.FFI.c_duckdb_scalar_function_bind_set_error
+    , Database.DuckDB.FFI.c_duckdb_scalar_function_set_function
+    , Database.DuckDB.FFI.c_duckdb_register_scalar_function
+    , Database.DuckDB.FFI.c_duckdb_scalar_function_get_extra_info
+    , Database.DuckDB.FFI.c_duckdb_scalar_function_bind_get_extra_info
+    , Database.DuckDB.FFI.c_duckdb_scalar_function_get_bind_data
+    , Database.DuckDB.FFI.c_duckdb_scalar_function_get_client_context
+    , Database.DuckDB.FFI.c_duckdb_scalar_function_set_error
+    , Database.DuckDB.FFI.c_duckdb_create_scalar_function_set
+    , Database.DuckDB.FFI.c_duckdb_destroy_scalar_function_set
+    , Database.DuckDB.FFI.c_duckdb_add_scalar_function_to_set
+    , Database.DuckDB.FFI.c_duckdb_register_scalar_function_set
+    , Database.DuckDB.FFI.c_duckdb_scalar_function_bind_get_argument_count
+    , Database.DuckDB.FFI.c_duckdb_scalar_function_bind_get_argument
+    , Database.DuckDB.FFI.c_duckdb_scalar_function_get_state
+    , Database.DuckDB.FFI.c_duckdb_scalar_function_set_init
+    , Database.DuckDB.FFI.c_duckdb_scalar_function_init_set_error
+    , Database.DuckDB.FFI.c_duckdb_scalar_function_init_set_state
+    , Database.DuckDB.FFI.c_duckdb_scalar_function_init_get_client_context
+    , Database.DuckDB.FFI.c_duckdb_scalar_function_init_get_bind_data
+    , Database.DuckDB.FFI.c_duckdb_scalar_function_init_get_extra_info
+    , Database.DuckDB.FFI.c_duckdb_table_description_create
+    , Database.DuckDB.FFI.c_duckdb_table_description_create_ext
+    , Database.DuckDB.FFI.c_duckdb_table_description_destroy
+    , Database.DuckDB.FFI.c_duckdb_table_description_error
+    , Database.DuckDB.FFI.c_duckdb_column_has_default
+    , Database.DuckDB.FFI.c_duckdb_table_description_get_column_count
+    , Database.DuckDB.FFI.c_duckdb_table_description_get_column_name
+    , Database.DuckDB.FFI.c_duckdb_table_description_get_column_type
+    , Database.DuckDB.FFI.c_duckdb_create_table_function
+    , Database.DuckDB.FFI.c_duckdb_destroy_table_function
+    , Database.DuckDB.FFI.c_duckdb_table_function_set_name
+    , Database.DuckDB.FFI.c_duckdb_table_function_add_parameter
+    , Database.DuckDB.FFI.c_duckdb_table_function_add_named_parameter
+    , Database.DuckDB.FFI.c_duckdb_table_function_set_extra_info
+    , Database.DuckDB.FFI.c_duckdb_table_function_set_bind
+    , Database.DuckDB.FFI.c_duckdb_table_function_set_init
+    , Database.DuckDB.FFI.c_duckdb_table_function_set_local_init
+    , Database.DuckDB.FFI.c_duckdb_table_function_set_function
+    , Database.DuckDB.FFI.c_duckdb_table_function_supports_projection_pushdown
+    , Database.DuckDB.FFI.c_duckdb_register_table_function
+    , Database.DuckDB.FFI.c_duckdb_bind_get_extra_info
+    , Database.DuckDB.FFI.c_duckdb_table_function_get_client_context
+    , Database.DuckDB.FFI.c_duckdb_bind_add_result_column
+    , Database.DuckDB.FFI.c_duckdb_bind_get_parameter_count
+    , Database.DuckDB.FFI.c_duckdb_bind_get_parameter
+    , Database.DuckDB.FFI.c_duckdb_bind_get_named_parameter
+    , Database.DuckDB.FFI.c_duckdb_bind_set_bind_data
+    , Database.DuckDB.FFI.c_duckdb_bind_set_cardinality
+    , Database.DuckDB.FFI.c_duckdb_bind_set_error
+    , Database.DuckDB.FFI.c_duckdb_init_get_extra_info
+    , Database.DuckDB.FFI.c_duckdb_init_get_bind_data
+    , Database.DuckDB.FFI.c_duckdb_init_set_init_data
+    , Database.DuckDB.FFI.c_duckdb_init_get_column_count
+    , Database.DuckDB.FFI.c_duckdb_init_get_column_index
+    , Database.DuckDB.FFI.c_duckdb_init_set_max_threads
+    , Database.DuckDB.FFI.c_duckdb_init_set_error
+    , Database.DuckDB.FFI.c_duckdb_function_get_extra_info
+    , Database.DuckDB.FFI.c_duckdb_function_get_bind_data
+    , Database.DuckDB.FFI.c_duckdb_function_get_init_data
+    , Database.DuckDB.FFI.c_duckdb_function_get_local_init_data
+    , Database.DuckDB.FFI.c_duckdb_function_set_error
+    , Database.DuckDB.FFI.c_duckdb_table_function_bind_get_result_column_count
+    , Database.DuckDB.FFI.c_duckdb_table_function_bind_get_result_column_name
+    , Database.DuckDB.FFI.c_duckdb_table_function_bind_get_result_column_type
+    , Database.DuckDB.FFI.c_duckdb_execute_tasks
+    , Database.DuckDB.FFI.c_duckdb_create_task_state
+    , Database.DuckDB.FFI.c_duckdb_execute_tasks_state
+    , Database.DuckDB.FFI.c_duckdb_execute_n_tasks_state
+    , Database.DuckDB.FFI.c_duckdb_finish_execution
+    , Database.DuckDB.FFI.c_duckdb_task_state_is_finished
+    , Database.DuckDB.FFI.c_duckdb_destroy_task_state
+    , Database.DuckDB.FFI.c_duckdb_execution_is_finished
+    , Database.DuckDB.FFI.c_duckdb_destroy_value
+    , Database.DuckDB.FFI.c_duckdb_create_varchar
+    , Database.DuckDB.FFI.c_duckdb_create_varchar_length
+    , Database.DuckDB.FFI.c_duckdb_create_bool
+    , Database.DuckDB.FFI.c_duckdb_create_int8
+    , Database.DuckDB.FFI.c_duckdb_create_uint8
+    , Database.DuckDB.FFI.c_duckdb_create_int16
+    , Database.DuckDB.FFI.c_duckdb_create_uint16
+    , Database.DuckDB.FFI.c_duckdb_create_int32
+    , Database.DuckDB.FFI.c_duckdb_create_uint32
+    , Database.DuckDB.FFI.c_duckdb_create_uint64
+    , Database.DuckDB.FFI.c_duckdb_create_int64
+    , Database.DuckDB.FFI.c_duckdb_create_hugeint
+    , Database.DuckDB.FFI.c_duckdb_create_uhugeint
+    , Database.DuckDB.FFI.c_duckdb_create_bignum
+    , Database.DuckDB.FFI.c_duckdb_create_decimal
+    , Database.DuckDB.FFI.c_duckdb_create_float
+    , Database.DuckDB.FFI.c_duckdb_create_double
+    , Database.DuckDB.FFI.c_duckdb_create_date
+    , Database.DuckDB.FFI.c_duckdb_create_time
+    , Database.DuckDB.FFI.c_duckdb_create_time_ns
+    , Database.DuckDB.FFI.c_duckdb_create_time_tz_value
+    , Database.DuckDB.FFI.c_duckdb_create_timestamp
+    , Database.DuckDB.FFI.c_duckdb_create_timestamp_tz
+    , Database.DuckDB.FFI.c_duckdb_create_timestamp_tz_ns
+    , Database.DuckDB.FFI.c_duckdb_create_timestamp_s
+    , Database.DuckDB.FFI.c_duckdb_create_timestamp_ms
+    , Database.DuckDB.FFI.c_duckdb_create_timestamp_ns
+    , Database.DuckDB.FFI.c_duckdb_create_interval
+    , Database.DuckDB.FFI.c_duckdb_create_blob
+    , Database.DuckDB.FFI.c_duckdb_create_bit
+    , Database.DuckDB.FFI.c_duckdb_create_uuid
+    , Database.DuckDB.FFI.c_duckdb_get_bool
+    , Database.DuckDB.FFI.c_duckdb_get_int8
+    , Database.DuckDB.FFI.c_duckdb_get_uint8
+    , Database.DuckDB.FFI.c_duckdb_get_int16
+    , Database.DuckDB.FFI.c_duckdb_get_uint16
+    , Database.DuckDB.FFI.c_duckdb_get_int32
+    , Database.DuckDB.FFI.c_duckdb_get_uint32
+    , Database.DuckDB.FFI.c_duckdb_get_int64
+    , Database.DuckDB.FFI.c_duckdb_get_uint64
+    , Database.DuckDB.FFI.c_duckdb_get_hugeint
+    , Database.DuckDB.FFI.c_duckdb_get_uhugeint
+    , Database.DuckDB.FFI.c_duckdb_get_bignum
+    , Database.DuckDB.FFI.c_duckdb_get_decimal
+    , Database.DuckDB.FFI.c_duckdb_get_float
+    , Database.DuckDB.FFI.c_duckdb_get_double
+    , Database.DuckDB.FFI.c_duckdb_get_date
+    , Database.DuckDB.FFI.c_duckdb_get_time
+    , Database.DuckDB.FFI.c_duckdb_get_time_ns
+    , Database.DuckDB.FFI.c_duckdb_get_time_tz
+    , Database.DuckDB.FFI.c_duckdb_get_timestamp
+    , Database.DuckDB.FFI.c_duckdb_get_timestamp_tz
+    , Database.DuckDB.FFI.c_duckdb_get_timestamp_tz_ns
+    , Database.DuckDB.FFI.c_duckdb_get_timestamp_s
+    , Database.DuckDB.FFI.c_duckdb_get_timestamp_ms
+    , Database.DuckDB.FFI.c_duckdb_get_timestamp_ns
+    , Database.DuckDB.FFI.c_duckdb_get_interval
+    , Database.DuckDB.FFI.c_duckdb_get_value_type
+    , Database.DuckDB.FFI.c_duckdb_get_blob
+    , Database.DuckDB.FFI.c_duckdb_get_bit
+    , Database.DuckDB.FFI.c_duckdb_get_uuid
+    , Database.DuckDB.FFI.c_duckdb_get_varchar
+    , Database.DuckDB.FFI.c_duckdb_create_struct_value
+    , Database.DuckDB.FFI.c_duckdb_create_list_value
+    , Database.DuckDB.FFI.c_duckdb_create_array_value
+    , Database.DuckDB.FFI.c_duckdb_create_map_value
+    , Database.DuckDB.FFI.c_duckdb_create_union_value
+    , Database.DuckDB.FFI.c_duckdb_get_map_size
+    , Database.DuckDB.FFI.c_duckdb_get_map_key
+    , Database.DuckDB.FFI.c_duckdb_get_map_value
+    , Database.DuckDB.FFI.c_duckdb_is_null_value
+    , Database.DuckDB.FFI.c_duckdb_create_null_value
+    , Database.DuckDB.FFI.c_duckdb_get_list_size
+    , Database.DuckDB.FFI.c_duckdb_get_list_child
+    , Database.DuckDB.FFI.c_duckdb_create_enum_value
+    , Database.DuckDB.FFI.c_duckdb_get_enum_value
+    , Database.DuckDB.FFI.c_duckdb_get_struct_child
+    , Database.DuckDB.FFI.c_duckdb_value_to_string
+    , Database.DuckDB.FFI.c_duckdb_value_boolean
+    , Database.DuckDB.FFI.c_duckdb_value_int8
+    , Database.DuckDB.FFI.c_duckdb_value_int16
+    , Database.DuckDB.FFI.c_duckdb_value_int32
+    , Database.DuckDB.FFI.c_duckdb_value_int64
+    , Database.DuckDB.FFI.c_duckdb_value_hugeint
+    , Database.DuckDB.FFI.c_duckdb_value_uhugeint
+    , Database.DuckDB.FFI.c_duckdb_value_decimal
+    , Database.DuckDB.FFI.c_duckdb_value_uint8
+    , Database.DuckDB.FFI.c_duckdb_value_uint16
+    , Database.DuckDB.FFI.c_duckdb_value_uint32
+    , Database.DuckDB.FFI.c_duckdb_value_uint64
+    , Database.DuckDB.FFI.c_duckdb_value_float
+    , Database.DuckDB.FFI.c_duckdb_value_double
+    , Database.DuckDB.FFI.c_duckdb_value_date
+    , Database.DuckDB.FFI.c_duckdb_value_time
+    , Database.DuckDB.FFI.c_duckdb_value_timestamp
+    , Database.DuckDB.FFI.c_duckdb_value_interval
+    , Database.DuckDB.FFI.c_duckdb_value_varchar
+    , Database.DuckDB.FFI.c_duckdb_value_string
+    , Database.DuckDB.FFI.c_duckdb_value_varchar_internal
+    , Database.DuckDB.FFI.c_duckdb_value_string_internal
+    , Database.DuckDB.FFI.c_duckdb_value_blob
+    , Database.DuckDB.FFI.c_duckdb_value_is_null
+    , Database.DuckDB.FFI.c_duckdb_create_vector
+    , Database.DuckDB.FFI.c_duckdb_destroy_vector
+    , Database.DuckDB.FFI.c_duckdb_vector_get_column_type
+    , Database.DuckDB.FFI.c_duckdb_vector_get_data
+    , Database.DuckDB.FFI.c_duckdb_vector_get_validity
+    , Database.DuckDB.FFI.c_duckdb_vector_ensure_validity_writable
+    , Database.DuckDB.FFI.c_duckdb_vector_assign_string_element
+    , Database.DuckDB.FFI.c_duckdb_vector_assign_string_element_len
+    , Database.DuckDB.FFI.c_duckdb_unsafe_vector_assign_string_element_len
+    , Database.DuckDB.FFI.c_duckdb_list_vector_get_child
+    , Database.DuckDB.FFI.c_duckdb_list_vector_get_size
+    , Database.DuckDB.FFI.c_duckdb_list_vector_set_size
+    , Database.DuckDB.FFI.c_duckdb_list_vector_reserve
+    , Database.DuckDB.FFI.c_duckdb_struct_vector_get_child
+    , Database.DuckDB.FFI.c_duckdb_array_vector_get_child
+    , Database.DuckDB.FFI.c_duckdb_slice_vector
+    , Database.DuckDB.FFI.c_duckdb_vector_copy_sel
+    , Database.DuckDB.FFI.c_duckdb_vector_reference_value
+    , Database.DuckDB.FFI.c_duckdb_vector_reference_vector
+    , Database.DuckDB.FFI.c_duckdb_validity_row_is_valid
+    , Database.DuckDB.FFI.c_duckdb_validity_set_row_validity
+    , Database.DuckDB.FFI.c_duckdb_validity_set_row_invalid
+    , Database.DuckDB.FFI.c_duckdb_validity_set_row_valid
+    , Database.DuckDB.FFI.c_duckdb_create_selection_vector
+    , Database.DuckDB.FFI.c_duckdb_destroy_selection_vector
+    , Database.DuckDB.FFI.c_duckdb_selection_vector_get_data_ptr
+    )
+  where
+
+import qualified HsBindgen.Runtime.CEnum as CEnum
+import qualified HsBindgen.Runtime.ConstantArray as CA
+import qualified HsBindgen.Runtime.HasCField as HasCField
+import qualified HsBindgen.Runtime.LibC
+import qualified HsBindgen.Runtime.Marshal as Marshal
+import qualified HsBindgen.Runtime.PtrConst as PtrConst
+import qualified HsBindgen.Runtime.Struct as Struct
+import qualified HsBindgen.Runtime.Support as BG
+import qualified HsBindgen.Runtime.Support.CAPI
+import qualified HsBindgen.Runtime.Support.CompatHasField as BG.CompatHasField
+import qualified HsBindgen.Runtime.Union as Union
+import Prelude ((<*>), (>>), Bounded, Enum, Eq, IO, Int, Integral, Num, Ord, Read, Real, Show, fmap, pure, type (~))
+
+$(HsBindgen.Runtime.Support.CAPI.addCSource (HsBindgen.Runtime.Support.CAPI.unlines
+  [ "#include <duckdb.h>"
+  , "#include <duckdb_arrow.h>"
+  , "void hs_bindgen_153d18959d6bdde2 ("
+  , "  duckdb_date *arg1,"
+  , "  duckdb_date_struct *arg2"
+  , ")"
+  , "{"
+  , "  *arg2 = (duckdb_from_date)(*arg1);"
+  , "}"
+  , "void hs_bindgen_e8e2ae846bc846bd ("
+  , "  duckdb_date_struct *arg1,"
+  , "  duckdb_date *arg2"
+  , ")"
+  , "{"
+  , "  *arg2 = (duckdb_to_date)(*arg1);"
+  , "}"
+  , "_Bool hs_bindgen_0502603ff03a9a85 ("
+  , "  duckdb_date *arg1"
+  , ")"
+  , "{"
+  , "  return (duckdb_is_finite_date)(*arg1);"
+  , "}"
+  , "void hs_bindgen_6f585e0d38d45906 ("
+  , "  duckdb_time *arg1,"
+  , "  duckdb_time_struct *arg2"
+  , ")"
+  , "{"
+  , "  *arg2 = (duckdb_from_time)(*arg1);"
+  , "}"
+  , "void hs_bindgen_3895748c6e0f7040 ("
+  , "  int64_t arg1,"
+  , "  int32_t arg2,"
+  , "  duckdb_time_tz *arg3"
+  , ")"
+  , "{"
+  , "  *arg3 = (duckdb_create_time_tz)(arg1, arg2);"
+  , "}"
+  , "void hs_bindgen_a6d9dec3e303c7f7 ("
+  , "  duckdb_time_tz *arg1,"
+  , "  duckdb_time_tz_struct *arg2"
+  , ")"
+  , "{"
+  , "  *arg2 = (duckdb_from_time_tz)(*arg1);"
+  , "}"
+  , "void hs_bindgen_2bcbaabda02073ac ("
+  , "  duckdb_time_struct *arg1,"
+  , "  duckdb_time *arg2"
+  , ")"
+  , "{"
+  , "  *arg2 = (duckdb_to_time)(*arg1);"
+  , "}"
+  , "void hs_bindgen_53776ff8b2acd73e ("
+  , "  duckdb_timestamp *arg1,"
+  , "  duckdb_timestamp_struct *arg2"
+  , ")"
+  , "{"
+  , "  *arg2 = (duckdb_from_timestamp)(*arg1);"
+  , "}"
+  , "void hs_bindgen_2213a6caf7cf5a2a ("
+  , "  duckdb_timestamp_struct *arg1,"
+  , "  duckdb_timestamp *arg2"
+  , ")"
+  , "{"
+  , "  *arg2 = (duckdb_to_timestamp)(*arg1);"
+  , "}"
+  , "_Bool hs_bindgen_6bf40d2c8f650521 ("
+  , "  duckdb_timestamp *arg1"
+  , ")"
+  , "{"
+  , "  return (duckdb_is_finite_timestamp)(*arg1);"
+  , "}"
+  , "_Bool hs_bindgen_3de825c497718ef8 ("
+  , "  duckdb_timestamp_s *arg1"
+  , ")"
+  , "{"
+  , "  return (duckdb_is_finite_timestamp_s)(*arg1);"
+  , "}"
+  , "_Bool hs_bindgen_ddb9e22e35fce1f5 ("
+  , "  duckdb_timestamp_ms *arg1"
+  , ")"
+  , "{"
+  , "  return (duckdb_is_finite_timestamp_ms)(*arg1);"
+  , "}"
+  , "_Bool hs_bindgen_0f484f72b5cf1c3b ("
+  , "  duckdb_timestamp_ns *arg1"
+  , ")"
+  , "{"
+  , "  return (duckdb_is_finite_timestamp_ns)(*arg1);"
+  , "}"
+  , "double hs_bindgen_bbbbec73ad41a6be ("
+  , "  duckdb_hugeint *arg1"
+  , ")"
+  , "{"
+  , "  return (duckdb_hugeint_to_double)(*arg1);"
+  , "}"
+  , "void hs_bindgen_09890e1c7e06ce22 ("
+  , "  double arg1,"
+  , "  duckdb_hugeint *arg2"
+  , ")"
+  , "{"
+  , "  *arg2 = (duckdb_double_to_hugeint)(arg1);"
+  , "}"
+  , "double hs_bindgen_e347968d8ba72f9d ("
+  , "  duckdb_uhugeint *arg1"
+  , ")"
+  , "{"
+  , "  return (duckdb_uhugeint_to_double)(*arg1);"
+  , "}"
+  , "void hs_bindgen_ab63bc231e7c2083 ("
+  , "  double arg1,"
+  , "  duckdb_uhugeint *arg2"
+  , ")"
+  , "{"
+  , "  *arg2 = (duckdb_double_to_uhugeint)(arg1);"
+  , "}"
+  , "void hs_bindgen_2fd9e41f82130053 ("
+  , "  double arg1,"
+  , "  uint8_t arg2,"
+  , "  uint8_t arg3,"
+  , "  duckdb_decimal *arg4"
+  , ")"
+  , "{"
+  , "  *arg4 = (duckdb_double_to_decimal)(arg1, arg2, arg3);"
+  , "}"
+  , "double hs_bindgen_a897650e57b2e5dd ("
+  , "  duckdb_decimal *arg1"
+  , ")"
+  , "{"
+  , "  return (duckdb_decimal_to_double)(*arg1);"
+  , "}"
+  , "duckdb_aggregate_function hs_bindgen_a4213901f24a347c (void)"
+  , "{"
+  , "  return (duckdb_create_aggregate_function)();"
+  , "}"
+  , "void hs_bindgen_9a7ed57b62ba2830 ("
+  , "  duckdb_aggregate_function *arg1"
+  , ")"
+  , "{"
+  , "  (duckdb_destroy_aggregate_function)(arg1);"
+  , "}"
+  , "void hs_bindgen_6753d462db01c5d2 ("
+  , "  duckdb_aggregate_function arg1,"
+  , "  char const *arg2"
+  , ")"
+  , "{"
+  , "  (duckdb_aggregate_function_set_name)(arg1, arg2);"
+  , "}"
+  , "void hs_bindgen_c0953d002d635df8 ("
+  , "  duckdb_aggregate_function arg1,"
+  , "  duckdb_logical_type arg2"
+  , ")"
+  , "{"
+  , "  (duckdb_aggregate_function_add_parameter)(arg1, arg2);"
+  , "}"
+  , "void hs_bindgen_6058c453ace88380 ("
+  , "  duckdb_aggregate_function arg1,"
+  , "  duckdb_logical_type arg2"
+  , ")"
+  , "{"
+  , "  (duckdb_aggregate_function_set_return_type)(arg1, arg2);"
+  , "}"
+  , "void hs_bindgen_f14070593356a5b8 ("
+  , "  duckdb_aggregate_function arg1,"
+  , "  duckdb_aggregate_state_size arg2,"
+  , "  duckdb_aggregate_init_t arg3,"
+  , "  duckdb_aggregate_update_t arg4,"
+  , "  duckdb_aggregate_combine_t arg5,"
+  , "  duckdb_aggregate_finalize_t arg6"
+  , ")"
+  , "{"
+  , "  (duckdb_aggregate_function_set_functions)(arg1, arg2, arg3, arg4, arg5, arg6);"
+  , "}"
+  , "void hs_bindgen_d1d14d0757e28d95 ("
+  , "  duckdb_aggregate_function arg1,"
+  , "  duckdb_aggregate_destroy_t arg2"
+  , ")"
+  , "{"
+  , "  (duckdb_aggregate_function_set_destructor)(arg1, arg2);"
+  , "}"
+  , "duckdb_state hs_bindgen_73fd6a2b1ed3a19d ("
+  , "  duckdb_connection arg1,"
+  , "  duckdb_aggregate_function arg2"
+  , ")"
+  , "{"
+  , "  return (duckdb_register_aggregate_function)(arg1, arg2);"
+  , "}"
+  , "void hs_bindgen_fb32b51eb2673dfa ("
+  , "  duckdb_aggregate_function arg1"
+  , ")"
+  , "{"
+  , "  (duckdb_aggregate_function_set_special_handling)(arg1);"
+  , "}"
+  , "void hs_bindgen_bfde5b245fa2177b ("
+  , "  duckdb_aggregate_function arg1,"
+  , "  void *arg2,"
+  , "  duckdb_delete_callback_t arg3"
+  , ")"
+  , "{"
+  , "  (duckdb_aggregate_function_set_extra_info)(arg1, arg2, arg3);"
+  , "}"
+  , "void *hs_bindgen_4e9b0c1d3d06199e ("
+  , "  duckdb_function_info arg1"
+  , ")"
+  , "{"
+  , "  return (duckdb_aggregate_function_get_extra_info)(arg1);"
+  , "}"
+  , "void hs_bindgen_483e87ce1132f579 ("
+  , "  duckdb_function_info arg1,"
+  , "  char const *arg2"
+  , ")"
+  , "{"
+  , "  (duckdb_aggregate_function_set_error)(arg1, arg2);"
+  , "}"
+  , "duckdb_aggregate_function_set hs_bindgen_2c49e23b08d73926 ("
+  , "  char const *arg1"
+  , ")"
+  , "{"
+  , "  return (duckdb_create_aggregate_function_set)(arg1);"
+  , "}"
+  , "void hs_bindgen_bf434d41b82ac906 ("
+  , "  duckdb_aggregate_function_set *arg1"
+  , ")"
+  , "{"
+  , "  (duckdb_destroy_aggregate_function_set)(arg1);"
+  , "}"
+  , "duckdb_state hs_bindgen_8ac8412347b7e08f ("
+  , "  duckdb_aggregate_function_set arg1,"
+  , "  duckdb_aggregate_function arg2"
+  , ")"
+  , "{"
+  , "  return (duckdb_add_aggregate_function_to_set)(arg1, arg2);"
+  , "}"
+  , "duckdb_state hs_bindgen_642bec7c514572cd ("
+  , "  duckdb_connection arg1,"
+  , "  duckdb_aggregate_function_set arg2"
+  , ")"
+  , "{"
+  , "  return (duckdb_register_aggregate_function_set)(arg1, arg2);"
+  , "}"
+  , "duckdb_state hs_bindgen_aa07fd4356c6a064 ("
+  , "  duckdb_connection arg1,"
+  , "  char const *arg2,"
+  , "  char const *arg3,"
+  , "  duckdb_appender *arg4"
+  , ")"
+  , "{"
+  , "  return (duckdb_appender_create)(arg1, arg2, arg3, arg4);"
+  , "}"
+  , "duckdb_state hs_bindgen_63ef91b9ed96feb6 ("
+  , "  duckdb_connection arg1,"
+  , "  char const *arg2,"
+  , "  char const *arg3,"
+  , "  char const *arg4,"
+  , "  duckdb_appender *arg5"
+  , ")"
+  , "{"
+  , "  return (duckdb_appender_create_ext)(arg1, arg2, arg3, arg4, arg5);"
+  , "}"
+  , "duckdb_state hs_bindgen_f5f12003c5a6b74a ("
+  , "  duckdb_connection arg1,"
+  , "  char const *arg2,"
+  , "  idx_t arg3,"
+  , "  duckdb_logical_type *arg4,"
+  , "  char const *arg5,"
+  , "  char const **arg6,"
+  , "  duckdb_appender *arg7"
+  , ")"
+  , "{"
+  , "  return (duckdb_appender_create_query)(arg1, arg2, arg3, arg4, arg5, arg6, arg7);"
+  , "}"
+  , "idx_t hs_bindgen_d9adf614fa24a490 ("
+  , "  duckdb_appender arg1"
+  , ")"
+  , "{"
+  , "  return (duckdb_appender_column_count)(arg1);"
+  , "}"
+  , "duckdb_logical_type hs_bindgen_388a8d17efd22a63 ("
+  , "  duckdb_appender arg1,"
+  , "  idx_t arg2"
+  , ")"
+  , "{"
+  , "  return (duckdb_appender_column_type)(arg1, arg2);"
+  , "}"
+  , "duckdb_error_data hs_bindgen_0c7ec7ae5f924855 ("
+  , "  duckdb_appender arg1"
+  , ")"
+  , "{"
+  , "  return (duckdb_appender_error_data)(arg1);"
+  , "}"
+  , "duckdb_state hs_bindgen_440cae7db099b464 ("
+  , "  duckdb_appender arg1"
+  , ")"
+  , "{"
+  , "  return (duckdb_appender_flush)(arg1);"
+  , "}"
+  , "duckdb_state hs_bindgen_e89bd80516e6940c ("
+  , "  duckdb_appender arg1"
+  , ")"
+  , "{"
+  , "  return (duckdb_appender_clear)(arg1);"
+  , "}"
+  , "duckdb_state hs_bindgen_b6168be67cbde80f ("
+  , "  duckdb_appender arg1"
+  , ")"
+  , "{"
+  , "  return (duckdb_appender_close)(arg1);"
+  , "}"
+  , "duckdb_state hs_bindgen_bedb9203156b99bc ("
+  , "  duckdb_appender *arg1"
+  , ")"
+  , "{"
+  , "  return (duckdb_appender_destroy)(arg1);"
+  , "}"
+  , "duckdb_state hs_bindgen_fe61378b4ecf148e ("
+  , "  duckdb_appender arg1,"
+  , "  char const *arg2"
+  , ")"
+  , "{"
+  , "  return (duckdb_appender_add_column)(arg1, arg2);"
+  , "}"
+  , "duckdb_state hs_bindgen_0ceb19489a5e573e ("
+  , "  duckdb_appender arg1"
+  , ")"
+  , "{"
+  , "  return (duckdb_appender_clear_columns)(arg1);"
+  , "}"
+  , "duckdb_state hs_bindgen_a6075e071c58b503 ("
+  , "  duckdb_appender arg1"
+  , ")"
+  , "{"
+  , "  return (duckdb_appender_begin_row)(arg1);"
+  , "}"
+  , "duckdb_state hs_bindgen_3a0d96e4d1abcd7f ("
+  , "  duckdb_appender arg1"
+  , ")"
+  , "{"
+  , "  return (duckdb_appender_end_row)(arg1);"
+  , "}"
+  , "duckdb_state hs_bindgen_d604ee9d99caa6cb ("
+  , "  duckdb_appender arg1"
+  , ")"
+  , "{"
+  , "  return (duckdb_append_default)(arg1);"
+  , "}"
+  , "duckdb_state hs_bindgen_67cbddd0427ae7f8 ("
+  , "  duckdb_appender arg1,"
+  , "  duckdb_data_chunk arg2,"
+  , "  idx_t arg3,"
+  , "  idx_t arg4"
+  , ")"
+  , "{"
+  , "  return (duckdb_append_default_to_chunk)(arg1, arg2, arg3, arg4);"
+  , "}"
+  , "duckdb_state hs_bindgen_d0d8ffd6be52ff07 ("
+  , "  duckdb_appender arg1,"
+  , "  _Bool arg2"
+  , ")"
+  , "{"
+  , "  return (duckdb_append_bool)(arg1, arg2);"
+  , "}"
+  , "duckdb_state hs_bindgen_c51b55c873ce1e28 ("
+  , "  duckdb_appender arg1,"
+  , "  int8_t arg2"
+  , ")"
+  , "{"
+  , "  return (duckdb_append_int8)(arg1, arg2);"
+  , "}"
+  , "duckdb_state hs_bindgen_0ddaa75df3b9f58e ("
+  , "  duckdb_appender arg1,"
+  , "  int16_t arg2"
+  , ")"
+  , "{"
+  , "  return (duckdb_append_int16)(arg1, arg2);"
+  , "}"
+  , "duckdb_state hs_bindgen_6b7cb661bd8ea7df ("
+  , "  duckdb_appender arg1,"
+  , "  int32_t arg2"
+  , ")"
+  , "{"
+  , "  return (duckdb_append_int32)(arg1, arg2);"
+  , "}"
+  , "duckdb_state hs_bindgen_6cff86036743c55e ("
+  , "  duckdb_appender arg1,"
+  , "  int64_t arg2"
+  , ")"
+  , "{"
+  , "  return (duckdb_append_int64)(arg1, arg2);"
+  , "}"
+  , "duckdb_state hs_bindgen_765a56fbbd07717a ("
+  , "  duckdb_appender arg1,"
+  , "  duckdb_hugeint *arg2"
+  , ")"
+  , "{"
+  , "  return (duckdb_append_hugeint)(arg1, *arg2);"
+  , "}"
+  , "duckdb_state hs_bindgen_b214b9f8045936c1 ("
+  , "  duckdb_appender arg1,"
+  , "  uint8_t arg2"
+  , ")"
+  , "{"
+  , "  return (duckdb_append_uint8)(arg1, arg2);"
+  , "}"
+  , "duckdb_state hs_bindgen_e07db5d03eb1dd02 ("
+  , "  duckdb_appender arg1,"
+  , "  uint16_t arg2"
+  , ")"
+  , "{"
+  , "  return (duckdb_append_uint16)(arg1, arg2);"
+  , "}"
+  , "duckdb_state hs_bindgen_4b46ba5a5f4f7522 ("
+  , "  duckdb_appender arg1,"
+  , "  uint32_t arg2"
+  , ")"
+  , "{"
+  , "  return (duckdb_append_uint32)(arg1, arg2);"
+  , "}"
+  , "duckdb_state hs_bindgen_25fbe913db29848b ("
+  , "  duckdb_appender arg1,"
+  , "  uint64_t arg2"
+  , ")"
+  , "{"
+  , "  return (duckdb_append_uint64)(arg1, arg2);"
+  , "}"
+  , "duckdb_state hs_bindgen_62de5fc4f18c28c0 ("
+  , "  duckdb_appender arg1,"
+  , "  duckdb_uhugeint *arg2"
+  , ")"
+  , "{"
+  , "  return (duckdb_append_uhugeint)(arg1, *arg2);"
+  , "}"
+  , "duckdb_state hs_bindgen_96447ede7e23ec34 ("
+  , "  duckdb_appender arg1,"
+  , "  float arg2"
+  , ")"
+  , "{"
+  , "  return (duckdb_append_float)(arg1, arg2);"
+  , "}"
+  , "duckdb_state hs_bindgen_7c28467da6574418 ("
+  , "  duckdb_appender arg1,"
+  , "  double arg2"
+  , ")"
+  , "{"
+  , "  return (duckdb_append_double)(arg1, arg2);"
+  , "}"
+  , "duckdb_state hs_bindgen_9d8dbbd78f188e17 ("
+  , "  duckdb_appender arg1,"
+  , "  duckdb_date *arg2"
+  , ")"
+  , "{"
+  , "  return (duckdb_append_date)(arg1, *arg2);"
+  , "}"
+  , "duckdb_state hs_bindgen_2ce7a0f0da7fd624 ("
+  , "  duckdb_appender arg1,"
+  , "  duckdb_time *arg2"
+  , ")"
+  , "{"
+  , "  return (duckdb_append_time)(arg1, *arg2);"
+  , "}"
+  , "duckdb_state hs_bindgen_7a4497e32900cf81 ("
+  , "  duckdb_appender arg1,"
+  , "  duckdb_timestamp *arg2"
+  , ")"
+  , "{"
+  , "  return (duckdb_append_timestamp)(arg1, *arg2);"
+  , "}"
+  , "duckdb_state hs_bindgen_6c1faa62ed1e4792 ("
+  , "  duckdb_appender arg1,"
+  , "  duckdb_interval *arg2"
+  , ")"
+  , "{"
+  , "  return (duckdb_append_interval)(arg1, *arg2);"
+  , "}"
+  , "duckdb_state hs_bindgen_e5225654463f5192 ("
+  , "  duckdb_appender arg1,"
+  , "  char const *arg2"
+  , ")"
+  , "{"
+  , "  return (duckdb_append_varchar)(arg1, arg2);"
+  , "}"
+  , "duckdb_state hs_bindgen_a8ac491a9e08a58f ("
+  , "  duckdb_appender arg1,"
+  , "  char const *arg2,"
+  , "  idx_t arg3"
+  , ")"
+  , "{"
+  , "  return (duckdb_append_varchar_length)(arg1, arg2, arg3);"
+  , "}"
+  , "duckdb_state hs_bindgen_5fdc599752499241 ("
+  , "  duckdb_appender arg1,"
+  , "  void const *arg2,"
+  , "  idx_t arg3"
+  , ")"
+  , "{"
+  , "  return (duckdb_append_blob)(arg1, arg2, arg3);"
+  , "}"
+  , "duckdb_state hs_bindgen_51084ea4cd371420 ("
+  , "  duckdb_appender arg1"
+  , ")"
+  , "{"
+  , "  return (duckdb_append_null)(arg1);"
+  , "}"
+  , "duckdb_state hs_bindgen_25c7249abd4ef222 ("
+  , "  duckdb_appender arg1,"
+  , "  duckdb_value arg2"
+  , ")"
+  , "{"
+  , "  return (duckdb_append_value)(arg1, arg2);"
+  , "}"
+  , "duckdb_state hs_bindgen_7e1746e78ac83f6e ("
+  , "  duckdb_appender arg1,"
+  , "  duckdb_data_chunk arg2"
+  , ")"
+  , "{"
+  , "  return (duckdb_append_data_chunk)(arg1, arg2);"
+  , "}"
+  , "char const *hs_bindgen_96a3877ac37f908a ("
+  , "  duckdb_appender arg1"
+  , ")"
+  , "{"
+  , "  return (duckdb_appender_error)(arg1);"
+  , "}"
+  , "duckdb_error_data hs_bindgen_749f8639f0f92967 ("
+  , "  duckdb_arrow_options arg1,"
+  , "  duckdb_logical_type *arg2,"
+  , "  char const **arg3,"
+  , "  idx_t arg4,"
+  , "  struct ArrowSchema *arg5"
+  , ")"
+  , "{"
+  , "  return (duckdb_to_arrow_schema)(arg1, arg2, arg3, arg4, arg5);"
+  , "}"
+  , "duckdb_error_data hs_bindgen_3c0a13f88804c747 ("
+  , "  duckdb_arrow_options arg1,"
+  , "  duckdb_data_chunk arg2,"
+  , "  struct ArrowArray *arg3"
+  , ")"
+  , "{"
+  , "  return (duckdb_data_chunk_to_arrow)(arg1, arg2, arg3);"
+  , "}"
+  , "duckdb_error_data hs_bindgen_57a0f20883adc249 ("
+  , "  duckdb_connection arg1,"
+  , "  struct ArrowSchema *arg2,"
+  , "  duckdb_arrow_converted_schema *arg3"
+  , ")"
+  , "{"
+  , "  return (duckdb_schema_from_arrow)(arg1, arg2, arg3);"
+  , "}"
+  , "duckdb_error_data hs_bindgen_74a4bd664af946a0 ("
+  , "  duckdb_connection arg1,"
+  , "  struct ArrowArray *arg2,"
+  , "  duckdb_arrow_converted_schema arg3,"
+  , "  duckdb_data_chunk *arg4"
+  , ")"
+  , "{"
+  , "  return (duckdb_data_chunk_from_arrow)(arg1, arg2, arg3, arg4);"
+  , "}"
+  , "void hs_bindgen_d8f15a49df8ec50d ("
+  , "  duckdb_arrow_converted_schema *arg1"
+  , ")"
+  , "{"
+  , "  (duckdb_destroy_arrow_converted_schema)(arg1);"
+  , "}"
+  , "duckdb_state hs_bindgen_f542464e35ec578c ("
+  , "  duckdb_connection arg1,"
+  , "  char const *arg2,"
+  , "  duckdb_arrow *arg3"
+  , ")"
+  , "{"
+  , "  return (duckdb_query_arrow)(arg1, arg2, arg3);"
+  , "}"
+  , "duckdb_state hs_bindgen_c159419cb8a6a381 ("
+  , "  duckdb_arrow arg1,"
+  , "  duckdb_arrow_schema *arg2"
+  , ")"
+  , "{"
+  , "  return (duckdb_query_arrow_schema)(arg1, arg2);"
+  , "}"
+  , "duckdb_state hs_bindgen_ae5a517fcc0088ea ("
+  , "  duckdb_prepared_statement arg1,"
+  , "  duckdb_arrow_schema *arg2"
+  , ")"
+  , "{"
+  , "  return (duckdb_prepared_arrow_schema)(arg1, arg2);"
+  , "}"
+  , "void hs_bindgen_697c128584b3a452 ("
+  , "  duckdb_result *arg1,"
+  , "  duckdb_data_chunk arg2,"
+  , "  duckdb_arrow_array *arg3"
+  , ")"
+  , "{"
+  , "  (duckdb_result_arrow_array)(*arg1, arg2, arg3);"
+  , "}"
+  , "duckdb_state hs_bindgen_33505698f1fd3536 ("
+  , "  duckdb_arrow arg1,"
+  , "  duckdb_arrow_array *arg2"
+  , ")"
+  , "{"
+  , "  return (duckdb_query_arrow_array)(arg1, arg2);"
+  , "}"
+  , "idx_t hs_bindgen_35ad4e7c492cdfa8 ("
+  , "  duckdb_arrow arg1"
+  , ")"
+  , "{"
+  , "  return (duckdb_arrow_column_count)(arg1);"
+  , "}"
+  , "idx_t hs_bindgen_563d608c32762302 ("
+  , "  duckdb_arrow arg1"
+  , ")"
+  , "{"
+  , "  return (duckdb_arrow_row_count)(arg1);"
+  , "}"
+  , "idx_t hs_bindgen_6eb2e5dcab2741c1 ("
+  , "  duckdb_arrow arg1"
+  , ")"
+  , "{"
+  , "  return (duckdb_arrow_rows_changed)(arg1);"
+  , "}"
+  , "char const *hs_bindgen_ab8fa55204e6c826 ("
+  , "  duckdb_arrow arg1"
+  , ")"
+  , "{"
+  , "  return (duckdb_query_arrow_error)(arg1);"
+  , "}"
+  , "void hs_bindgen_d2c9f57314f0dc2e ("
+  , "  duckdb_arrow *arg1"
+  , ")"
+  , "{"
+  , "  (duckdb_destroy_arrow)(arg1);"
+  , "}"
+  , "void hs_bindgen_ac7e0c2d2bccc4ca ("
+  , "  duckdb_arrow_stream *arg1"
+  , ")"
+  , "{"
+  , "  (duckdb_destroy_arrow_stream)(arg1);"
+  , "}"
+  , "duckdb_state hs_bindgen_6a9394320a0add34 ("
+  , "  duckdb_prepared_statement arg1,"
+  , "  duckdb_arrow *arg2"
+  , ")"
+  , "{"
+  , "  return (duckdb_execute_prepared_arrow)(arg1, arg2);"
+  , "}"
+  , "duckdb_state hs_bindgen_23edfe0e6fb8b8cd ("
+  , "  duckdb_connection arg1,"
+  , "  char const *arg2,"
+  , "  duckdb_arrow_stream arg3"
+  , ")"
+  , "{"
+  , "  return (duckdb_arrow_scan)(arg1, arg2, arg3);"
+  , "}"
+  , "duckdb_state hs_bindgen_595da99ffd284fe9 ("
+  , "  duckdb_connection arg1,"
+  , "  char const *arg2,"
+  , "  duckdb_arrow_schema arg3,"
+  , "  duckdb_arrow_array arg4,"
+  , "  duckdb_arrow_stream *arg5"
+  , ")"
+  , "{"
+  , "  return (duckdb_arrow_array_scan)(arg1, arg2, arg3, arg4, arg5);"
+  , "}"
+  , "duckdb_cast_function hs_bindgen_530842d8bb740323 (void)"
+  , "{"
+  , "  return (duckdb_create_cast_function)();"
+  , "}"
+  , "void hs_bindgen_79a5b6e406da35c7 ("
+  , "  duckdb_cast_function arg1,"
+  , "  duckdb_logical_type arg2"
+  , ")"
+  , "{"
+  , "  (duckdb_cast_function_set_source_type)(arg1, arg2);"
+  , "}"
+  , "void hs_bindgen_e10f2f2c59c28010 ("
+  , "  duckdb_cast_function arg1,"
+  , "  duckdb_logical_type arg2"
+  , ")"
+  , "{"
+  , "  (duckdb_cast_function_set_target_type)(arg1, arg2);"
+  , "}"
+  , "void hs_bindgen_b91f08fa8ca3a98a ("
+  , "  duckdb_cast_function arg1,"
+  , "  int64_t arg2"
+  , ")"
+  , "{"
+  , "  (duckdb_cast_function_set_implicit_cast_cost)(arg1, arg2);"
+  , "}"
+  , "void hs_bindgen_b04584eb2fd6c16e ("
+  , "  duckdb_cast_function arg1,"
+  , "  duckdb_cast_function_t arg2"
+  , ")"
+  , "{"
+  , "  (duckdb_cast_function_set_function)(arg1, arg2);"
+  , "}"
+  , "void hs_bindgen_aa3d7539369988e9 ("
+  , "  duckdb_cast_function arg1,"
+  , "  void *arg2,"
+  , "  duckdb_delete_callback_t arg3"
+  , ")"
+  , "{"
+  , "  (duckdb_cast_function_set_extra_info)(arg1, arg2, arg3);"
+  , "}"
+  , "void *hs_bindgen_8d27e93926d18d88 ("
+  , "  duckdb_function_info arg1"
+  , ")"
+  , "{"
+  , "  return (duckdb_cast_function_get_extra_info)(arg1);"
+  , "}"
+  , "duckdb_cast_mode hs_bindgen_007c30c55010fd1b ("
+  , "  duckdb_function_info arg1"
+  , ")"
+  , "{"
+  , "  return (duckdb_cast_function_get_cast_mode)(arg1);"
+  , "}"
+  , "void hs_bindgen_224a31360352029c ("
+  , "  duckdb_function_info arg1,"
+  , "  char const *arg2"
+  , ")"
+  , "{"
+  , "  (duckdb_cast_function_set_error)(arg1, arg2);"
+  , "}"
+  , "void hs_bindgen_797b13ae1942639e ("
+  , "  duckdb_function_info arg1,"
+  , "  char const *arg2,"
+  , "  idx_t arg3,"
+  , "  duckdb_vector arg4"
+  , ")"
+  , "{"
+  , "  (duckdb_cast_function_set_row_error)(arg1, arg2, arg3, arg4);"
+  , "}"
+  , "duckdb_state hs_bindgen_0afe718cbb1361cb ("
+  , "  duckdb_connection arg1,"
+  , "  duckdb_cast_function arg2"
+  , ")"
+  , "{"
+  , "  return (duckdb_register_cast_function)(arg1, arg2);"
+  , "}"
+  , "void hs_bindgen_7586ad32fb8d02b1 ("
+  , "  duckdb_cast_function *arg1"
+  , ")"
+  , "{"
+  , "  (duckdb_destroy_cast_function)(arg1);"
+  , "}"
+  , "duckdb_catalog hs_bindgen_325fa3e1c034e2a4 ("
+  , "  duckdb_client_context arg1,"
+  , "  char const *arg2"
+  , ")"
+  , "{"
+  , "  return (duckdb_client_context_get_catalog)(arg1, arg2);"
+  , "}"
+  , "char const *hs_bindgen_dc671e8d1eacfa00 ("
+  , "  duckdb_catalog arg1"
+  , ")"
+  , "{"
+  , "  return (duckdb_catalog_get_type_name)(arg1);"
+  , "}"
+  , "duckdb_catalog_entry hs_bindgen_aba4dfe53d092aa4 ("
+  , "  duckdb_catalog arg1,"
+  , "  duckdb_client_context arg2,"
+  , "  duckdb_catalog_entry_type arg3,"
+  , "  char const *arg4,"
+  , "  char const *arg5"
+  , ")"
+  , "{"
+  , "  return (duckdb_catalog_get_entry)(arg1, arg2, arg3, arg4, arg5);"
+  , "}"
+  , "void hs_bindgen_e9ab59cc27549451 ("
+  , "  duckdb_catalog *arg1"
+  , ")"
+  , "{"
+  , "  (duckdb_destroy_catalog)(arg1);"
+  , "}"
+  , "duckdb_catalog_entry_type hs_bindgen_f9e87e4a2ae0ba89 ("
+  , "  duckdb_catalog_entry arg1"
+  , ")"
+  , "{"
+  , "  return (duckdb_catalog_entry_get_type)(arg1);"
+  , "}"
+  , "char const *hs_bindgen_430e74b8dedd2055 ("
+  , "  duckdb_catalog_entry arg1"
+  , ")"
+  , "{"
+  , "  return (duckdb_catalog_entry_get_name)(arg1);"
+  , "}"
+  , "void hs_bindgen_6189577693659118 ("
+  , "  duckdb_catalog_entry *arg1"
+  , ")"
+  , "{"
+  , "  (duckdb_destroy_catalog_entry)(arg1);"
+  , "}"
+  , "duckdb_config_option hs_bindgen_2904c2eb7d815ddd (void)"
+  , "{"
+  , "  return (duckdb_create_config_option)();"
+  , "}"
+  , "void hs_bindgen_cce3c5835cb3d7fb ("
+  , "  duckdb_config_option *arg1"
+  , ")"
+  , "{"
+  , "  (duckdb_destroy_config_option)(arg1);"
+  , "}"
+  , "void hs_bindgen_4a7b0eacb915b49c ("
+  , "  duckdb_config_option arg1,"
+  , "  char const *arg2"
+  , ")"
+  , "{"
+  , "  (duckdb_config_option_set_name)(arg1, arg2);"
+  , "}"
+  , "void hs_bindgen_55c7fda9341606d9 ("
+  , "  duckdb_config_option arg1,"
+  , "  duckdb_logical_type arg2"
+  , ")"
+  , "{"
+  , "  (duckdb_config_option_set_type)(arg1, arg2);"
+  , "}"
+  , "void hs_bindgen_5d743cd261c382bc ("
+  , "  duckdb_config_option arg1,"
+  , "  duckdb_value arg2"
+  , ")"
+  , "{"
+  , "  (duckdb_config_option_set_default_value)(arg1, arg2);"
+  , "}"
+  , "void hs_bindgen_669d84ce2f314ace ("
+  , "  duckdb_config_option arg1,"
+  , "  duckdb_config_option_scope arg2"
+  , ")"
+  , "{"
+  , "  (duckdb_config_option_set_default_scope)(arg1, arg2);"
+  , "}"
+  , "void hs_bindgen_434294888a548fc7 ("
+  , "  duckdb_config_option arg1,"
+  , "  char const *arg2"
+  , ")"
+  , "{"
+  , "  (duckdb_config_option_set_description)(arg1, arg2);"
+  , "}"
+  , "duckdb_state hs_bindgen_b14dc22384baf221 ("
+  , "  duckdb_connection arg1,"
+  , "  duckdb_config_option arg2"
+  , ")"
+  , "{"
+  , "  return (duckdb_register_config_option)(arg1, arg2);"
+  , "}"
+  , "duckdb_value hs_bindgen_6627c6206b1f1351 ("
+  , "  duckdb_client_context arg1,"
+  , "  char const *arg2,"
+  , "  duckdb_config_option_scope *arg3"
+  , ")"
+  , "{"
+  , "  return (duckdb_client_context_get_config_option)(arg1, arg2, arg3);"
+  , "}"
+  , "duckdb_profiling_info hs_bindgen_6cc9ce7e3e2cc49d ("
+  , "  duckdb_connection arg1"
+  , ")"
+  , "{"
+  , "  return (duckdb_get_profiling_info)(arg1);"
+  , "}"
+  , "duckdb_value hs_bindgen_ef170ac4012ec7c1 ("
+  , "  duckdb_profiling_info arg1,"
+  , "  char const *arg2"
+  , ")"
+  , "{"
+  , "  return (duckdb_profiling_info_get_value)(arg1, arg2);"
+  , "}"
+  , "duckdb_value hs_bindgen_28bc0ccb66ee250b ("
+  , "  duckdb_profiling_info arg1"
+  , ")"
+  , "{"
+  , "  return (duckdb_profiling_info_get_metrics)(arg1);"
+  , "}"
+  , "idx_t hs_bindgen_2535bc9e5898c5a1 ("
+  , "  duckdb_profiling_info arg1"
+  , ")"
+  , "{"
+  , "  return (duckdb_profiling_info_get_child_count)(arg1);"
+  , "}"
+  , "duckdb_profiling_info hs_bindgen_9eb0d1042926715f ("
+  , "  duckdb_profiling_info arg1,"
+  , "  idx_t arg2"
+  , ")"
+  , "{"
+  , "  return (duckdb_profiling_info_get_child)(arg1, arg2);"
+  , "}"
+  , "duckdb_state hs_bindgen_79d64eb1438eabb3 ("
+  , "  duckdb_database arg1,"
+  , "  duckdb_connection *arg2"
+  , ")"
+  , "{"
+  , "  return (duckdb_connect)(arg1, arg2);"
+  , "}"
+  , "void hs_bindgen_2a298bcc8a8bf16d ("
+  , "  duckdb_connection arg1"
+  , ")"
+  , "{"
+  , "  (duckdb_interrupt)(arg1);"
+  , "}"
+  , "void hs_bindgen_e9eec4b7b5ba0a85 ("
+  , "  duckdb_connection arg1,"
+  , "  duckdb_query_progress_type *arg2"
+  , ")"
+  , "{"
+  , "  *arg2 = (duckdb_query_progress)(arg1);"
+  , "}"
+  , "void hs_bindgen_cb610ade84b3a9cb ("
+  , "  duckdb_connection *arg1"
+  , ")"
+  , "{"
+  , "  (duckdb_disconnect)(arg1);"
+  , "}"
+  , "void hs_bindgen_8544c93f321dd6fd ("
+  , "  duckdb_connection arg1,"
+  , "  duckdb_client_context *arg2"
+  , ")"
+  , "{"
+  , "  (duckdb_connection_get_client_context)(arg1, arg2);"
+  , "}"
+  , "void hs_bindgen_90f6280aebaf736e ("
+  , "  duckdb_connection arg1,"
+  , "  duckdb_arrow_options *arg2"
+  , ")"
+  , "{"
+  , "  (duckdb_connection_get_arrow_options)(arg1, arg2);"
+  , "}"
+  , "idx_t hs_bindgen_4dce4d0b3eb0c45a ("
+  , "  duckdb_client_context arg1"
+  , ")"
+  , "{"
+  , "  return (duckdb_client_context_get_connection_id)(arg1);"
+  , "}"
+  , "void hs_bindgen_e1dcc582c6d3773d ("
+  , "  duckdb_client_context *arg1"
+  , ")"
+  , "{"
+  , "  (duckdb_destroy_client_context)(arg1);"
+  , "}"
+  , "void hs_bindgen_aa5e5b8ee750a275 ("
+  , "  duckdb_arrow_options *arg1"
+  , ")"
+  , "{"
+  , "  (duckdb_destroy_arrow_options)(arg1);"
+  , "}"
+  , "duckdb_value hs_bindgen_f77ead42500007ef ("
+  , "  duckdb_connection arg1,"
+  , "  char const *arg2,"
+  , "  _Bool arg3"
+  , ")"
+  , "{"
+  , "  return (duckdb_get_table_names)(arg1, arg2, arg3);"
+  , "}"
+  , "duckdb_copy_function hs_bindgen_9082e3375dc02c6b (void)"
+  , "{"
+  , "  return (duckdb_create_copy_function)();"
+  , "}"
+  , "void hs_bindgen_5dcabbbd6ea15759 ("
+  , "  duckdb_copy_function arg1,"
+  , "  char const *arg2"
+  , ")"
+  , "{"
+  , "  (duckdb_copy_function_set_name)(arg1, arg2);"
+  , "}"
+  , "void hs_bindgen_f11df37a3a7c9589 ("
+  , "  duckdb_copy_function arg1,"
+  , "  void *arg2,"
+  , "  duckdb_delete_callback_t arg3"
+  , ")"
+  , "{"
+  , "  (duckdb_copy_function_set_extra_info)(arg1, arg2, arg3);"
+  , "}"
+  , "duckdb_state hs_bindgen_ef2952af4d35b915 ("
+  , "  duckdb_connection arg1,"
+  , "  duckdb_copy_function arg2"
+  , ")"
+  , "{"
+  , "  return (duckdb_register_copy_function)(arg1, arg2);"
+  , "}"
+  , "void hs_bindgen_a8e7668d29c4444d ("
+  , "  duckdb_copy_function *arg1"
+  , ")"
+  , "{"
+  , "  (duckdb_destroy_copy_function)(arg1);"
+  , "}"
+  , "void hs_bindgen_87cf3467d4ff600f ("
+  , "  duckdb_copy_function arg1,"
+  , "  duckdb_copy_function_bind_t arg2"
+  , ")"
+  , "{"
+  , "  (duckdb_copy_function_set_bind)(arg1, arg2);"
+  , "}"
+  , "void hs_bindgen_524c0439f2a4c426 ("
+  , "  duckdb_copy_function_bind_info arg1,"
+  , "  char const *arg2"
+  , ")"
+  , "{"
+  , "  (duckdb_copy_function_bind_set_error)(arg1, arg2);"
+  , "}"
+  , "void *hs_bindgen_700aaa096e86aaf2 ("
+  , "  duckdb_copy_function_bind_info arg1"
+  , ")"
+  , "{"
+  , "  return (duckdb_copy_function_bind_get_extra_info)(arg1);"
+  , "}"
+  , "duckdb_client_context hs_bindgen_43ecba8b372ade77 ("
+  , "  duckdb_copy_function_bind_info arg1"
+  , ")"
+  , "{"
+  , "  return (duckdb_copy_function_bind_get_client_context)(arg1);"
+  , "}"
+  , "idx_t hs_bindgen_fded725200a8255d ("
+  , "  duckdb_copy_function_bind_info arg1"
+  , ")"
+  , "{"
+  , "  return (duckdb_copy_function_bind_get_column_count)(arg1);"
+  , "}"
+  , "duckdb_logical_type hs_bindgen_66ea23271c8a6bd0 ("
+  , "  duckdb_copy_function_bind_info arg1,"
+  , "  idx_t arg2"
+  , ")"
+  , "{"
+  , "  return (duckdb_copy_function_bind_get_column_type)(arg1, arg2);"
+  , "}"
+  , "duckdb_value hs_bindgen_7b77d6cb5cf0d60a ("
+  , "  duckdb_copy_function_bind_info arg1"
+  , ")"
+  , "{"
+  , "  return (duckdb_copy_function_bind_get_options)(arg1);"
+  , "}"
+  , "void hs_bindgen_fe305bbf1974a262 ("
+  , "  duckdb_copy_function_bind_info arg1,"
+  , "  void *arg2,"
+  , "  duckdb_delete_callback_t arg3"
+  , ")"
+  , "{"
+  , "  (duckdb_copy_function_bind_set_bind_data)(arg1, arg2, arg3);"
+  , "}"
+  , "void hs_bindgen_bdf653203b811426 ("
+  , "  duckdb_copy_function arg1,"
+  , "  duckdb_copy_function_global_init_t arg2"
+  , ")"
+  , "{"
+  , "  (duckdb_copy_function_set_global_init)(arg1, arg2);"
+  , "}"
+  , "void hs_bindgen_279e87fe6d40d247 ("
+  , "  duckdb_copy_function_global_init_info arg1,"
+  , "  char const *arg2"
+  , ")"
+  , "{"
+  , "  (duckdb_copy_function_global_init_set_error)(arg1, arg2);"
+  , "}"
+  , "void *hs_bindgen_7609546a5c22ffe0 ("
+  , "  duckdb_copy_function_global_init_info arg1"
+  , ")"
+  , "{"
+  , "  return (duckdb_copy_function_global_init_get_extra_info)(arg1);"
+  , "}"
+  , "duckdb_client_context hs_bindgen_43808cb7db79e801 ("
+  , "  duckdb_copy_function_global_init_info arg1"
+  , ")"
+  , "{"
+  , "  return (duckdb_copy_function_global_init_get_client_context)(arg1);"
+  , "}"
+  , "void *hs_bindgen_687b5ba8e888e959 ("
+  , "  duckdb_copy_function_global_init_info arg1"
+  , ")"
+  , "{"
+  , "  return (duckdb_copy_function_global_init_get_bind_data)(arg1);"
+  , "}"
+  , "char const *hs_bindgen_2114989eb445f973 ("
+  , "  duckdb_copy_function_global_init_info arg1"
+  , ")"
+  , "{"
+  , "  return (duckdb_copy_function_global_init_get_file_path)(arg1);"
+  , "}"
+  , "void hs_bindgen_ff12ab62e7e2b86d ("
+  , "  duckdb_copy_function_global_init_info arg1,"
+  , "  void *arg2,"
+  , "  duckdb_delete_callback_t arg3"
+  , ")"
+  , "{"
+  , "  (duckdb_copy_function_global_init_set_global_state)(arg1, arg2, arg3);"
+  , "}"
+  , "void hs_bindgen_5ba7790b6977f6f9 ("
+  , "  duckdb_copy_function arg1,"
+  , "  duckdb_copy_function_sink_t arg2"
+  , ")"
+  , "{"
+  , "  (duckdb_copy_function_set_sink)(arg1, arg2);"
+  , "}"
+  , "void hs_bindgen_6dcea9bdb2c64239 ("
+  , "  duckdb_copy_function_sink_info arg1,"
+  , "  char const *arg2"
+  , ")"
+  , "{"
+  , "  (duckdb_copy_function_sink_set_error)(arg1, arg2);"
+  , "}"
+  , "void *hs_bindgen_05b0c7709595cb8c ("
+  , "  duckdb_copy_function_sink_info arg1"
+  , ")"
+  , "{"
+  , "  return (duckdb_copy_function_sink_get_extra_info)(arg1);"
+  , "}"
+  , "duckdb_client_context hs_bindgen_c8d3a89903c0ed25 ("
+  , "  duckdb_copy_function_sink_info arg1"
+  , ")"
+  , "{"
+  , "  return (duckdb_copy_function_sink_get_client_context)(arg1);"
+  , "}"
+  , "void *hs_bindgen_0625cce1f60f4400 ("
+  , "  duckdb_copy_function_sink_info arg1"
+  , ")"
+  , "{"
+  , "  return (duckdb_copy_function_sink_get_bind_data)(arg1);"
+  , "}"
+  , "void *hs_bindgen_32ac91dc1a40c2e1 ("
+  , "  duckdb_copy_function_sink_info arg1"
+  , ")"
+  , "{"
+  , "  return (duckdb_copy_function_sink_get_global_state)(arg1);"
+  , "}"
+  , "void hs_bindgen_1aeb2ff33a42eb52 ("
+  , "  duckdb_copy_function arg1,"
+  , "  duckdb_copy_function_finalize_t arg2"
+  , ")"
+  , "{"
+  , "  (duckdb_copy_function_set_finalize)(arg1, arg2);"
+  , "}"
+  , "void hs_bindgen_1aff575b0b5aa442 ("
+  , "  duckdb_copy_function_finalize_info arg1,"
+  , "  char const *arg2"
+  , ")"
+  , "{"
+  , "  (duckdb_copy_function_finalize_set_error)(arg1, arg2);"
+  , "}"
+  , "void *hs_bindgen_eac875bdda3d01f5 ("
+  , "  duckdb_copy_function_finalize_info arg1"
+  , ")"
+  , "{"
+  , "  return (duckdb_copy_function_finalize_get_extra_info)(arg1);"
+  , "}"
+  , "duckdb_client_context hs_bindgen_624069d2f8a39d84 ("
+  , "  duckdb_copy_function_finalize_info arg1"
+  , ")"
+  , "{"
+  , "  return (duckdb_copy_function_finalize_get_client_context)(arg1);"
+  , "}"
+  , "void *hs_bindgen_3557b4da41c1a1b9 ("
+  , "  duckdb_copy_function_finalize_info arg1"
+  , ")"
+  , "{"
+  , "  return (duckdb_copy_function_finalize_get_bind_data)(arg1);"
+  , "}"
+  , "void *hs_bindgen_33a78a386647fcda ("
+  , "  duckdb_copy_function_finalize_info arg1"
+  , ")"
+  , "{"
+  , "  return (duckdb_copy_function_finalize_get_global_state)(arg1);"
+  , "}"
+  , "void hs_bindgen_168dd94dc4472ecc ("
+  , "  duckdb_copy_function arg1,"
+  , "  duckdb_table_function arg2"
+  , ")"
+  , "{"
+  , "  (duckdb_copy_function_set_copy_from_function)(arg1, arg2);"
+  , "}"
+  , "duckdb_data_chunk hs_bindgen_efb394485fc6a2bf ("
+  , "  duckdb_logical_type *arg1,"
+  , "  idx_t arg2"
+  , ")"
+  , "{"
+  , "  return (duckdb_create_data_chunk)(arg1, arg2);"
+  , "}"
+  , "void hs_bindgen_008e9a01c51088d0 ("
+  , "  duckdb_data_chunk *arg1"
+  , ")"
+  , "{"
+  , "  (duckdb_destroy_data_chunk)(arg1);"
+  , "}"
+  , "void hs_bindgen_f0ed12c45e7de137 ("
+  , "  duckdb_data_chunk arg1"
+  , ")"
+  , "{"
+  , "  (duckdb_data_chunk_reset)(arg1);"
+  , "}"
+  , "idx_t hs_bindgen_46e003c5051990e9 ("
+  , "  duckdb_data_chunk arg1"
+  , ")"
+  , "{"
+  , "  return (duckdb_data_chunk_get_column_count)(arg1);"
+  , "}"
+  , "duckdb_vector hs_bindgen_e612eec3607eea8a ("
+  , "  duckdb_data_chunk arg1,"
+  , "  idx_t arg2"
+  , ")"
+  , "{"
+  , "  return (duckdb_data_chunk_get_vector)(arg1, arg2);"
+  , "}"
+  , "idx_t hs_bindgen_ff8f64d484345bc6 ("
+  , "  duckdb_data_chunk arg1"
+  , ")"
+  , "{"
+  , "  return (duckdb_data_chunk_get_size)(arg1);"
+  , "}"
+  , "void hs_bindgen_2dd65b55bf219b31 ("
+  , "  duckdb_data_chunk arg1,"
+  , "  idx_t arg2"
+  , ")"
+  , "{"
+  , "  (duckdb_data_chunk_set_size)(arg1, arg2);"
+  , "}"
+  , "duckdb_instance_cache hs_bindgen_af9dc862cc92484d (void)"
+  , "{"
+  , "  return (duckdb_create_instance_cache)();"
+  , "}"
+  , "duckdb_state hs_bindgen_498dcd484fdb2257 ("
+  , "  duckdb_instance_cache arg1,"
+  , "  char const *arg2,"
+  , "  duckdb_database *arg3,"
+  , "  duckdb_config arg4,"
+  , "  char **arg5"
+  , ")"
+  , "{"
+  , "  return (duckdb_get_or_create_from_cache)(arg1, arg2, arg3, arg4, arg5);"
+  , "}"
+  , "void hs_bindgen_4880238d117a9624 ("
+  , "  duckdb_instance_cache *arg1"
+  , ")"
+  , "{"
+  , "  (duckdb_destroy_instance_cache)(arg1);"
+  , "}"
+  , "duckdb_state hs_bindgen_20ccd2dffd9e2deb ("
+  , "  char const *arg1,"
+  , "  duckdb_database *arg2"
+  , ")"
+  , "{"
+  , "  return (duckdb_open)(arg1, arg2);"
+  , "}"
+  , "duckdb_state hs_bindgen_29742fa56b59b577 ("
+  , "  char const *arg1,"
+  , "  duckdb_database *arg2,"
+  , "  duckdb_config arg3,"
+  , "  char **arg4"
+  , ")"
+  , "{"
+  , "  return (duckdb_open_ext)(arg1, arg2, arg3, arg4);"
+  , "}"
+  , "void hs_bindgen_9612218d8dfe8da0 ("
+  , "  duckdb_database *arg1"
+  , ")"
+  , "{"
+  , "  (duckdb_close)(arg1);"
+  , "}"
+  , "char const *hs_bindgen_6054bd05f5439f26 (void)"
+  , "{"
+  , "  return (duckdb_library_version)();"
+  , "}"
+  , "duckdb_state hs_bindgen_9952cdd696ea9b64 ("
+  , "  duckdb_config *arg1"
+  , ")"
+  , "{"
+  , "  return (duckdb_create_config)(arg1);"
+  , "}"
+  , "size_t hs_bindgen_716854cee27243ac (void)"
+  , "{"
+  , "  return (duckdb_config_count)();"
+  , "}"
+  , "duckdb_state hs_bindgen_9c4946fb7bbd79d4 ("
+  , "  size_t arg1,"
+  , "  char const **arg2,"
+  , "  char const **arg3"
+  , ")"
+  , "{"
+  , "  return (duckdb_get_config_flag)(arg1, arg2, arg3);"
+  , "}"
+  , "duckdb_state hs_bindgen_1d6e19093e0033ae ("
+  , "  duckdb_config arg1,"
+  , "  char const *arg2,"
+  , "  char const *arg3"
+  , ")"
+  , "{"
+  , "  return (duckdb_set_config)(arg1, arg2, arg3);"
+  , "}"
+  , "void hs_bindgen_2de3b7a816583458 ("
+  , "  duckdb_config *arg1"
+  , ")"
+  , "{"
+  , "  (duckdb_destroy_config)(arg1);"
+  , "}"
+  , "void hs_bindgen_b2793b95993b27a0 ("
+  , "  duckdb_expression *arg1"
+  , ")"
+  , "{"
+  , "  (duckdb_destroy_expression)(arg1);"
+  , "}"
+  , "duckdb_logical_type hs_bindgen_cdabf4b2938479e7 ("
+  , "  duckdb_expression arg1"
+  , ")"
+  , "{"
+  , "  return (duckdb_expression_return_type)(arg1);"
+  , "}"
+  , "_Bool hs_bindgen_5206a378aa1aed90 ("
+  , "  duckdb_expression arg1"
+  , ")"
+  , "{"
+  , "  return (duckdb_expression_is_foldable)(arg1);"
+  , "}"
+  , "duckdb_error_data hs_bindgen_218c780f483b4c25 ("
+  , "  duckdb_client_context arg1,"
+  , "  duckdb_expression arg2,"
+  , "  duckdb_value *arg3"
+  , ")"
+  , "{"
+  , "  return (duckdb_expression_fold)(arg1, arg2, arg3);"
+  , "}"
+  , "duckdb_file_system hs_bindgen_86de50508a218279 ("
+  , "  duckdb_client_context arg1"
+  , ")"
+  , "{"
+  , "  return (duckdb_client_context_get_file_system)(arg1);"
+  , "}"
+  , "void hs_bindgen_15fa74b0654878cf ("
+  , "  duckdb_file_system *arg1"
+  , ")"
+  , "{"
+  , "  (duckdb_destroy_file_system)(arg1);"
+  , "}"
+  , "duckdb_error_data hs_bindgen_69adcdaa1e007d5a ("
+  , "  duckdb_file_system arg1"
+  , ")"
+  , "{"
+  , "  return (duckdb_file_system_error_data)(arg1);"
+  , "}"
+  , "duckdb_state hs_bindgen_5751f4feb4d71533 ("
+  , "  duckdb_file_system arg1,"
+  , "  char const *arg2,"
+  , "  duckdb_file_open_options arg3,"
+  , "  duckdb_file_handle *arg4"
+  , ")"
+  , "{"
+  , "  return (duckdb_file_system_open)(arg1, arg2, arg3, arg4);"
+  , "}"
+  , "duckdb_file_open_options hs_bindgen_539de38e0bab26c5 (void)"
+  , "{"
+  , "  return (duckdb_create_file_open_options)();"
+  , "}"
+  , "duckdb_state hs_bindgen_ffd94c80e2976995 ("
+  , "  duckdb_file_open_options arg1,"
+  , "  duckdb_file_flag arg2,"
+  , "  _Bool arg3"
+  , ")"
+  , "{"
+  , "  return (duckdb_file_open_options_set_flag)(arg1, arg2, arg3);"
+  , "}"
+  , "void hs_bindgen_cf37e39c2d419a08 ("
+  , "  duckdb_file_open_options *arg1"
+  , ")"
+  , "{"
+  , "  (duckdb_destroy_file_open_options)(arg1);"
+  , "}"
+  , "void hs_bindgen_aad6fac9a0994e02 ("
+  , "  duckdb_file_handle *arg1"
+  , ")"
+  , "{"
+  , "  (duckdb_destroy_file_handle)(arg1);"
+  , "}"
+  , "duckdb_error_data hs_bindgen_5e1f67bf3efc2c36 ("
+  , "  duckdb_file_handle arg1"
+  , ")"
+  , "{"
+  , "  return (duckdb_file_handle_error_data)(arg1);"
+  , "}"
+  , "int64_t hs_bindgen_4b1fa3c92c7ccebd ("
+  , "  duckdb_file_handle arg1,"
+  , "  void *arg2,"
+  , "  int64_t arg3"
+  , ")"
+  , "{"
+  , "  return (duckdb_file_handle_read)(arg1, arg2, arg3);"
+  , "}"
+  , "int64_t hs_bindgen_b76782389ae4d98e ("
+  , "  duckdb_file_handle arg1,"
+  , "  void const *arg2,"
+  , "  int64_t arg3"
+  , ")"
+  , "{"
+  , "  return (duckdb_file_handle_write)(arg1, arg2, arg3);"
+  , "}"
+  , "int64_t hs_bindgen_aadecefadd076fa0 ("
+  , "  duckdb_file_handle arg1"
+  , ")"
+  , "{"
+  , "  return (duckdb_file_handle_tell)(arg1);"
+  , "}"
+  , "int64_t hs_bindgen_116d5a219fefe068 ("
+  , "  duckdb_file_handle arg1"
+  , ")"
+  , "{"
+  , "  return (duckdb_file_handle_size)(arg1);"
+  , "}"
+  , "duckdb_state hs_bindgen_0bc01ea1e012d827 ("
+  , "  duckdb_file_handle arg1,"
+  , "  int64_t arg2"
+  , ")"
+  , "{"
+  , "  return (duckdb_file_handle_seek)(arg1, arg2);"
+  , "}"
+  , "duckdb_state hs_bindgen_54f8658c443ae0c1 ("
+  , "  duckdb_file_handle arg1"
+  , ")"
+  , "{"
+  , "  return (duckdb_file_handle_sync)(arg1);"
+  , "}"
+  , "duckdb_state hs_bindgen_b5d3891ef9f994e8 ("
+  , "  duckdb_file_handle arg1"
+  , ")"
+  , "{"
+  , "  return (duckdb_file_handle_close)(arg1);"
+  , "}"
+  , "duckdb_log_storage hs_bindgen_f82dcf7bc4f9f778 (void)"
+  , "{"
+  , "  return (duckdb_create_log_storage)();"
+  , "}"
+  , "void hs_bindgen_88b771f8afe3bd0d ("
+  , "  duckdb_log_storage *arg1"
+  , ")"
+  , "{"
+  , "  (duckdb_destroy_log_storage)(arg1);"
+  , "}"
+  , "void hs_bindgen_b3f6a07d7d042e63 ("
+  , "  duckdb_log_storage arg1,"
+  , "  duckdb_logger_write_log_entry_t arg2"
+  , ")"
+  , "{"
+  , "  (duckdb_log_storage_set_write_log_entry)(arg1, arg2);"
+  , "}"
+  , "void hs_bindgen_b1b907492c570cdc ("
+  , "  duckdb_log_storage arg1,"
+  , "  void *arg2,"
+  , "  duckdb_delete_callback_t arg3"
+  , ")"
+  , "{"
+  , "  (duckdb_log_storage_set_extra_data)(arg1, arg2, arg3);"
+  , "}"
+  , "void hs_bindgen_c76226d0eeb4e836 ("
+  , "  duckdb_log_storage arg1,"
+  , "  char const *arg2"
+  , ")"
+  , "{"
+  , "  (duckdb_log_storage_set_name)(arg1, arg2);"
+  , "}"
+  , "duckdb_state hs_bindgen_0c9ec8ed934fd689 ("
+  , "  duckdb_database arg1,"
+  , "  duckdb_log_storage arg2"
+  , ")"
+  , "{"
+  , "  return (duckdb_register_log_storage)(arg1, arg2);"
+  , "}"
+  , "duckdb_logical_type hs_bindgen_6730a3125961d1ce ("
+  , "  duckdb_type arg1"
+  , ")"
+  , "{"
+  , "  return (duckdb_create_logical_type)(arg1);"
+  , "}"
+  , "char *hs_bindgen_8bf9efd96355ccc8 ("
+  , "  duckdb_logical_type arg1"
+  , ")"
+  , "{"
+  , "  return (duckdb_logical_type_get_alias)(arg1);"
+  , "}"
+  , "void hs_bindgen_4c81dd82a58eab6c ("
+  , "  duckdb_logical_type arg1,"
+  , "  char const *arg2"
+  , ")"
+  , "{"
+  , "  (duckdb_logical_type_set_alias)(arg1, arg2);"
+  , "}"
+  , "duckdb_logical_type hs_bindgen_be34c8f6b1b36ac2 ("
+  , "  duckdb_logical_type arg1"
+  , ")"
+  , "{"
+  , "  return (duckdb_create_list_type)(arg1);"
+  , "}"
+  , "duckdb_logical_type hs_bindgen_a29e6ca64067833a ("
+  , "  duckdb_logical_type arg1,"
+  , "  idx_t arg2"
+  , ")"
+  , "{"
+  , "  return (duckdb_create_array_type)(arg1, arg2);"
+  , "}"
+  , "duckdb_logical_type hs_bindgen_d8ad5b24cb72b954 ("
+  , "  duckdb_logical_type arg1,"
+  , "  duckdb_logical_type arg2"
+  , ")"
+  , "{"
+  , "  return (duckdb_create_map_type)(arg1, arg2);"
+  , "}"
+  , "duckdb_logical_type hs_bindgen_91bc78375b61b95b ("
+  , "  duckdb_logical_type *arg1,"
+  , "  char const **arg2,"
+  , "  idx_t arg3"
+  , ")"
+  , "{"
+  , "  return (duckdb_create_union_type)(arg1, arg2, arg3);"
+  , "}"
+  , "duckdb_logical_type hs_bindgen_0a08f82ca13a0b71 ("
+  , "  duckdb_logical_type *arg1,"
+  , "  char const **arg2,"
+  , "  idx_t arg3"
+  , ")"
+  , "{"
+  , "  return (duckdb_create_struct_type)(arg1, arg2, arg3);"
+  , "}"
+  , "duckdb_logical_type hs_bindgen_f7adf54f731b7fa6 ("
+  , "  char const **arg1,"
+  , "  idx_t arg2"
+  , ")"
+  , "{"
+  , "  return (duckdb_create_enum_type)(arg1, arg2);"
+  , "}"
+  , "duckdb_logical_type hs_bindgen_ab3461fd12251fa5 ("
+  , "  uint8_t arg1,"
+  , "  uint8_t arg2"
+  , ")"
+  , "{"
+  , "  return (duckdb_create_decimal_type)(arg1, arg2);"
+  , "}"
+  , "duckdb_type hs_bindgen_3c065a1280ea9665 ("
+  , "  duckdb_logical_type arg1"
+  , ")"
+  , "{"
+  , "  return (duckdb_get_type_id)(arg1);"
+  , "}"
+  , "uint8_t hs_bindgen_5cf2d0c9d544dd33 ("
+  , "  duckdb_logical_type arg1"
+  , ")"
+  , "{"
+  , "  return (duckdb_decimal_width)(arg1);"
+  , "}"
+  , "uint8_t hs_bindgen_98a72864c14469ab ("
+  , "  duckdb_logical_type arg1"
+  , ")"
+  , "{"
+  , "  return (duckdb_decimal_scale)(arg1);"
+  , "}"
+  , "duckdb_type hs_bindgen_fe2cf67b34d2f6cb ("
+  , "  duckdb_logical_type arg1"
+  , ")"
+  , "{"
+  , "  return (duckdb_decimal_internal_type)(arg1);"
+  , "}"
+  , "duckdb_type hs_bindgen_5155084716b3c35f ("
+  , "  duckdb_logical_type arg1"
+  , ")"
+  , "{"
+  , "  return (duckdb_enum_internal_type)(arg1);"
+  , "}"
+  , "uint32_t hs_bindgen_1e5564406f3fd9db ("
+  , "  duckdb_logical_type arg1"
+  , ")"
+  , "{"
+  , "  return (duckdb_enum_dictionary_size)(arg1);"
+  , "}"
+  , "char *hs_bindgen_9a20f17db8acbd70 ("
+  , "  duckdb_logical_type arg1,"
+  , "  idx_t arg2"
+  , ")"
+  , "{"
+  , "  return (duckdb_enum_dictionary_value)(arg1, arg2);"
+  , "}"
+  , "duckdb_logical_type hs_bindgen_4157ed3ba592d6c8 ("
+  , "  duckdb_logical_type arg1"
+  , ")"
+  , "{"
+  , "  return (duckdb_list_type_child_type)(arg1);"
+  , "}"
+  , "duckdb_logical_type hs_bindgen_2b8ef5e6bdecc75c ("
+  , "  duckdb_logical_type arg1"
+  , ")"
+  , "{"
+  , "  return (duckdb_array_type_child_type)(arg1);"
+  , "}"
+  , "idx_t hs_bindgen_f95f493b93895a3d ("
+  , "  duckdb_logical_type arg1"
+  , ")"
+  , "{"
+  , "  return (duckdb_array_type_array_size)(arg1);"
+  , "}"
+  , "duckdb_logical_type hs_bindgen_ba81e4d2dcf269b3 ("
+  , "  duckdb_logical_type arg1"
+  , ")"
+  , "{"
+  , "  return (duckdb_map_type_key_type)(arg1);"
+  , "}"
+  , "duckdb_logical_type hs_bindgen_2c5cd92bbe195c7d ("
+  , "  duckdb_logical_type arg1"
+  , ")"
+  , "{"
+  , "  return (duckdb_map_type_value_type)(arg1);"
+  , "}"
+  , "idx_t hs_bindgen_9470b8d41ff2de33 ("
+  , "  duckdb_logical_type arg1"
+  , ")"
+  , "{"
+  , "  return (duckdb_struct_type_child_count)(arg1);"
+  , "}"
+  , "char *hs_bindgen_b2175e8f7078654f ("
+  , "  duckdb_logical_type arg1,"
+  , "  idx_t arg2"
+  , ")"
+  , "{"
+  , "  return (duckdb_struct_type_child_name)(arg1, arg2);"
+  , "}"
+  , "duckdb_logical_type hs_bindgen_601601b3c2e40537 ("
+  , "  duckdb_logical_type arg1,"
+  , "  idx_t arg2"
+  , ")"
+  , "{"
+  , "  return (duckdb_struct_type_child_type)(arg1, arg2);"
+  , "}"
+  , "idx_t hs_bindgen_1e4a7d3a9bf6afa8 ("
+  , "  duckdb_logical_type arg1"
+  , ")"
+  , "{"
+  , "  return (duckdb_union_type_member_count)(arg1);"
+  , "}"
+  , "char *hs_bindgen_10b7095884bfd6c6 ("
+  , "  duckdb_logical_type arg1,"
+  , "  idx_t arg2"
+  , ")"
+  , "{"
+  , "  return (duckdb_union_type_member_name)(arg1, arg2);"
+  , "}"
+  , "duckdb_logical_type hs_bindgen_c51b0baa0c7acc2b ("
+  , "  duckdb_logical_type arg1,"
+  , "  idx_t arg2"
+  , ")"
+  , "{"
+  , "  return (duckdb_union_type_member_type)(arg1, arg2);"
+  , "}"
+  , "void hs_bindgen_ba9f691ab447b325 ("
+  , "  duckdb_logical_type *arg1"
+  , ")"
+  , "{"
+  , "  (duckdb_destroy_logical_type)(arg1);"
+  , "}"
+  , "duckdb_state hs_bindgen_04ac87cde857ea03 ("
+  , "  duckdb_connection arg1,"
+  , "  duckdb_logical_type arg2,"
+  , "  duckdb_create_type_info arg3"
+  , ")"
+  , "{"
+  , "  return (duckdb_register_logical_type)(arg1, arg2, arg3);"
+  , "}"
+  , "char *hs_bindgen_00c6f6b3b1a432f8 ("
+  , "  duckdb_logical_type arg1"
+  , ")"
+  , "{"
+  , "  return (duckdb_geometry_type_get_crs)(arg1);"
+  , "}"
+  , "duckdb_state hs_bindgen_140ec73cf4fe7786 ("
+  , "  duckdb_prepared_statement arg1,"
+  , "  duckdb_pending_result *arg2"
+  , ")"
+  , "{"
+  , "  return (duckdb_pending_prepared)(arg1, arg2);"
+  , "}"
+  , "void hs_bindgen_e37a6341372605d4 ("
+  , "  duckdb_pending_result *arg1"
+  , ")"
+  , "{"
+  , "  (duckdb_destroy_pending)(arg1);"
+  , "}"
+  , "char const *hs_bindgen_2de8c0baba09d111 ("
+  , "  duckdb_pending_result arg1"
+  , ")"
+  , "{"
+  , "  return (duckdb_pending_error)(arg1);"
+  , "}"
+  , "duckdb_pending_state hs_bindgen_2f6bf9a23cbb0cec ("
+  , "  duckdb_pending_result arg1"
+  , ")"
+  , "{"
+  , "  return (duckdb_pending_execute_task)(arg1);"
+  , "}"
+  , "duckdb_pending_state hs_bindgen_8846d60debc2282f ("
+  , "  duckdb_pending_result arg1"
+  , ")"
+  , "{"
+  , "  return (duckdb_pending_execute_check_state)(arg1);"
+  , "}"
+  , "duckdb_state hs_bindgen_8d348576f8547d1e ("
+  , "  duckdb_pending_result arg1,"
+  , "  duckdb_result *arg2"
+  , ")"
+  , "{"
+  , "  return (duckdb_execute_pending)(arg1, arg2);"
+  , "}"
+  , "_Bool hs_bindgen_5dc99c4c5e03476c ("
+  , "  duckdb_pending_state arg1"
+  , ")"
+  , "{"
+  , "  return (duckdb_pending_execution_is_finished)(arg1);"
+  , "}"
+  , "duckdb_state hs_bindgen_1bfada4bda17bfab ("
+  , "  duckdb_connection arg1,"
+  , "  char const *arg2,"
+  , "  duckdb_prepared_statement *arg3"
+  , ")"
+  , "{"
+  , "  return (duckdb_prepare)(arg1, arg2, arg3);"
+  , "}"
+  , "void hs_bindgen_26ae03c9c4c5e7c4 ("
+  , "  duckdb_prepared_statement *arg1"
+  , ")"
+  , "{"
+  , "  (duckdb_destroy_prepare)(arg1);"
+  , "}"
+  , "char const *hs_bindgen_b25b57b610531432 ("
+  , "  duckdb_prepared_statement arg1"
+  , ")"
+  , "{"
+  , "  return (duckdb_prepare_error)(arg1);"
+  , "}"
+  , "idx_t hs_bindgen_5fa1fd0511ab6da4 ("
+  , "  duckdb_prepared_statement arg1"
+  , ")"
+  , "{"
+  , "  return (duckdb_nparams)(arg1);"
+  , "}"
+  , "char const *hs_bindgen_eafa493aee3b4ab5 ("
+  , "  duckdb_prepared_statement arg1,"
+  , "  idx_t arg2"
+  , ")"
+  , "{"
+  , "  return (duckdb_parameter_name)(arg1, arg2);"
+  , "}"
+  , "duckdb_type hs_bindgen_c8918f417a9d0485 ("
+  , "  duckdb_prepared_statement arg1,"
+  , "  idx_t arg2"
+  , ")"
+  , "{"
+  , "  return (duckdb_param_type)(arg1, arg2);"
+  , "}"
+  , "duckdb_logical_type hs_bindgen_4bdfeba8a2577d7c ("
+  , "  duckdb_prepared_statement arg1,"
+  , "  idx_t arg2"
+  , ")"
+  , "{"
+  , "  return (duckdb_param_logical_type)(arg1, arg2);"
+  , "}"
+  , "duckdb_state hs_bindgen_0baec870a17b08f5 ("
+  , "  duckdb_prepared_statement arg1"
+  , ")"
+  , "{"
+  , "  return (duckdb_clear_bindings)(arg1);"
+  , "}"
+  , "duckdb_statement_type hs_bindgen_8d1f2852daa4baa8 ("
+  , "  duckdb_prepared_statement arg1"
+  , ")"
+  , "{"
+  , "  return (duckdb_prepared_statement_type)(arg1);"
+  , "}"
+  , "idx_t hs_bindgen_21b83c58e5576ccb ("
+  , "  duckdb_prepared_statement arg1"
+  , ")"
+  , "{"
+  , "  return (duckdb_prepared_statement_column_count)(arg1);"
+  , "}"
+  , "char const *hs_bindgen_2446429a160ae499 ("
+  , "  duckdb_prepared_statement arg1,"
+  , "  idx_t arg2"
+  , ")"
+  , "{"
+  , "  return (duckdb_prepared_statement_column_name)(arg1, arg2);"
+  , "}"
+  , "duckdb_logical_type hs_bindgen_ec1ee529d3d049b2 ("
+  , "  duckdb_prepared_statement arg1,"
+  , "  idx_t arg2"
+  , ")"
+  , "{"
+  , "  return (duckdb_prepared_statement_column_logical_type)(arg1, arg2);"
+  , "}"
+  , "duckdb_type hs_bindgen_735e0700d4547b98 ("
+  , "  duckdb_prepared_statement arg1,"
+  , "  idx_t arg2"
+  , ")"
+  , "{"
+  , "  return (duckdb_prepared_statement_column_type)(arg1, arg2);"
+  , "}"
+  , "duckdb_state hs_bindgen_a6297bae6e7d851e ("
+  , "  duckdb_prepared_statement arg1,"
+  , "  idx_t arg2,"
+  , "  duckdb_value arg3"
+  , ")"
+  , "{"
+  , "  return (duckdb_bind_value)(arg1, arg2, arg3);"
+  , "}"
+  , "duckdb_state hs_bindgen_246486cf8a18dc9c ("
+  , "  duckdb_prepared_statement arg1,"
+  , "  idx_t *arg2,"
+  , "  char const *arg3"
+  , ")"
+  , "{"
+  , "  return (duckdb_bind_parameter_index)(arg1, arg2, arg3);"
+  , "}"
+  , "duckdb_state hs_bindgen_de1a77f688a34f93 ("
+  , "  duckdb_prepared_statement arg1,"
+  , "  idx_t arg2,"
+  , "  _Bool arg3"
+  , ")"
+  , "{"
+  , "  return (duckdb_bind_boolean)(arg1, arg2, arg3);"
+  , "}"
+  , "duckdb_state hs_bindgen_eda830b5f9d73c28 ("
+  , "  duckdb_prepared_statement arg1,"
+  , "  idx_t arg2,"
+  , "  int8_t arg3"
+  , ")"
+  , "{"
+  , "  return (duckdb_bind_int8)(arg1, arg2, arg3);"
+  , "}"
+  , "duckdb_state hs_bindgen_0355aa2cb5b1fa2e ("
+  , "  duckdb_prepared_statement arg1,"
+  , "  idx_t arg2,"
+  , "  int16_t arg3"
+  , ")"
+  , "{"
+  , "  return (duckdb_bind_int16)(arg1, arg2, arg3);"
+  , "}"
+  , "duckdb_state hs_bindgen_a4f099fbb0a6ba13 ("
+  , "  duckdb_prepared_statement arg1,"
+  , "  idx_t arg2,"
+  , "  int32_t arg3"
+  , ")"
+  , "{"
+  , "  return (duckdb_bind_int32)(arg1, arg2, arg3);"
+  , "}"
+  , "duckdb_state hs_bindgen_2ec951c583ce8e04 ("
+  , "  duckdb_prepared_statement arg1,"
+  , "  idx_t arg2,"
+  , "  int64_t arg3"
+  , ")"
+  , "{"
+  , "  return (duckdb_bind_int64)(arg1, arg2, arg3);"
+  , "}"
+  , "duckdb_state hs_bindgen_8780a04bf33744c5 ("
+  , "  duckdb_prepared_statement arg1,"
+  , "  idx_t arg2,"
+  , "  duckdb_hugeint *arg3"
+  , ")"
+  , "{"
+  , "  return (duckdb_bind_hugeint)(arg1, arg2, *arg3);"
+  , "}"
+  , "duckdb_state hs_bindgen_5cb9ed525dffdba8 ("
+  , "  duckdb_prepared_statement arg1,"
+  , "  idx_t arg2,"
+  , "  duckdb_uhugeint *arg3"
+  , ")"
+  , "{"
+  , "  return (duckdb_bind_uhugeint)(arg1, arg2, *arg3);"
+  , "}"
+  , "duckdb_state hs_bindgen_c9b058b7b2cd21d0 ("
+  , "  duckdb_prepared_statement arg1,"
+  , "  idx_t arg2,"
+  , "  duckdb_decimal *arg3"
+  , ")"
+  , "{"
+  , "  return (duckdb_bind_decimal)(arg1, arg2, *arg3);"
+  , "}"
+  , "duckdb_state hs_bindgen_b5a38c6e6ecccd08 ("
+  , "  duckdb_prepared_statement arg1,"
+  , "  idx_t arg2,"
+  , "  uint8_t arg3"
+  , ")"
+  , "{"
+  , "  return (duckdb_bind_uint8)(arg1, arg2, arg3);"
+  , "}"
+  , "duckdb_state hs_bindgen_2e2738c0457ea47d ("
+  , "  duckdb_prepared_statement arg1,"
+  , "  idx_t arg2,"
+  , "  uint16_t arg3"
+  , ")"
+  , "{"
+  , "  return (duckdb_bind_uint16)(arg1, arg2, arg3);"
+  , "}"
+  , "duckdb_state hs_bindgen_90e699f0e6b9cd29 ("
+  , "  duckdb_prepared_statement arg1,"
+  , "  idx_t arg2,"
+  , "  uint32_t arg3"
+  , ")"
+  , "{"
+  , "  return (duckdb_bind_uint32)(arg1, arg2, arg3);"
+  , "}"
+  , "duckdb_state hs_bindgen_3ccb9401c1ebda08 ("
+  , "  duckdb_prepared_statement arg1,"
+  , "  idx_t arg2,"
+  , "  uint64_t arg3"
+  , ")"
+  , "{"
+  , "  return (duckdb_bind_uint64)(arg1, arg2, arg3);"
+  , "}"
+  , "duckdb_state hs_bindgen_9b6b761b5a1551ef ("
+  , "  duckdb_prepared_statement arg1,"
+  , "  idx_t arg2,"
+  , "  float arg3"
+  , ")"
+  , "{"
+  , "  return (duckdb_bind_float)(arg1, arg2, arg3);"
+  , "}"
+  , "duckdb_state hs_bindgen_e37b46704d10e1da ("
+  , "  duckdb_prepared_statement arg1,"
+  , "  idx_t arg2,"
+  , "  double arg3"
+  , ")"
+  , "{"
+  , "  return (duckdb_bind_double)(arg1, arg2, arg3);"
+  , "}"
+  , "duckdb_state hs_bindgen_f8785689f72e5b5d ("
+  , "  duckdb_prepared_statement arg1,"
+  , "  idx_t arg2,"
+  , "  duckdb_date *arg3"
+  , ")"
+  , "{"
+  , "  return (duckdb_bind_date)(arg1, arg2, *arg3);"
+  , "}"
+  , "duckdb_state hs_bindgen_1785c9c57c78cf3d ("
+  , "  duckdb_prepared_statement arg1,"
+  , "  idx_t arg2,"
+  , "  duckdb_time *arg3"
+  , ")"
+  , "{"
+  , "  return (duckdb_bind_time)(arg1, arg2, *arg3);"
+  , "}"
+  , "duckdb_state hs_bindgen_408ba78d5071e129 ("
+  , "  duckdb_prepared_statement arg1,"
+  , "  idx_t arg2,"
+  , "  duckdb_timestamp *arg3"
+  , ")"
+  , "{"
+  , "  return (duckdb_bind_timestamp)(arg1, arg2, *arg3);"
+  , "}"
+  , "duckdb_state hs_bindgen_e37f0c4d9ec67f72 ("
+  , "  duckdb_prepared_statement arg1,"
+  , "  idx_t arg2,"
+  , "  duckdb_timestamp *arg3"
+  , ")"
+  , "{"
+  , "  return (duckdb_bind_timestamp_tz)(arg1, arg2, *arg3);"
+  , "}"
+  , "duckdb_state hs_bindgen_60eda501a3472aa0 ("
+  , "  duckdb_prepared_statement arg1,"
+  , "  idx_t arg2,"
+  , "  duckdb_interval *arg3"
+  , ")"
+  , "{"
+  , "  return (duckdb_bind_interval)(arg1, arg2, *arg3);"
+  , "}"
+  , "duckdb_state hs_bindgen_6789c4064ae33dfd ("
+  , "  duckdb_prepared_statement arg1,"
+  , "  idx_t arg2,"
+  , "  char const *arg3"
+  , ")"
+  , "{"
+  , "  return (duckdb_bind_varchar)(arg1, arg2, arg3);"
+  , "}"
+  , "duckdb_state hs_bindgen_8da54da1c75fc6d7 ("
+  , "  duckdb_prepared_statement arg1,"
+  , "  idx_t arg2,"
+  , "  char const *arg3,"
+  , "  idx_t arg4"
+  , ")"
+  , "{"
+  , "  return (duckdb_bind_varchar_length)(arg1, arg2, arg3, arg4);"
+  , "}"
+  , "duckdb_state hs_bindgen_f3dfed4bc402c238 ("
+  , "  duckdb_prepared_statement arg1,"
+  , "  idx_t arg2,"
+  , "  void const *arg3,"
+  , "  idx_t arg4"
+  , ")"
+  , "{"
+  , "  return (duckdb_bind_blob)(arg1, arg2, arg3, arg4);"
+  , "}"
+  , "duckdb_state hs_bindgen_5ef44e468bc16aaa ("
+  , "  duckdb_prepared_statement arg1,"
+  , "  idx_t arg2"
+  , ")"
+  , "{"
+  , "  return (duckdb_bind_null)(arg1, arg2);"
+  , "}"
+  , "duckdb_state hs_bindgen_629c85be7284c355 ("
+  , "  duckdb_prepared_statement arg1,"
+  , "  duckdb_result *arg2"
+  , ")"
+  , "{"
+  , "  return (duckdb_execute_prepared)(arg1, arg2);"
+  , "}"
+  , "idx_t hs_bindgen_3a899fb5cfe65940 ("
+  , "  duckdb_connection arg1,"
+  , "  char const *arg2,"
+  , "  duckdb_extracted_statements *arg3"
+  , ")"
+  , "{"
+  , "  return (duckdb_extract_statements)(arg1, arg2, arg3);"
+  , "}"
+  , "duckdb_state hs_bindgen_c1d2b24650595603 ("
+  , "  duckdb_connection arg1,"
+  , "  duckdb_extracted_statements arg2,"
+  , "  idx_t arg3,"
+  , "  duckdb_prepared_statement *arg4"
+  , ")"
+  , "{"
+  , "  return (duckdb_prepare_extracted_statement)(arg1, arg2, arg3, arg4);"
+  , "}"
+  , "char const *hs_bindgen_d1cda79c464875a1 ("
+  , "  duckdb_extracted_statements arg1"
+  , ")"
+  , "{"
+  , "  return (duckdb_extract_statements_error)(arg1);"
+  , "}"
+  , "void hs_bindgen_b2c9b38c3dab239d ("
+  , "  duckdb_extracted_statements *arg1"
+  , ")"
+  , "{"
+  , "  (duckdb_destroy_extracted)(arg1);"
+  , "}"
+  , "duckdb_state hs_bindgen_d9a9d21987a2fe23 ("
+  , "  duckdb_prepared_statement arg1,"
+  , "  duckdb_result *arg2"
+  , ")"
+  , "{"
+  , "  return (duckdb_execute_prepared_streaming)(arg1, arg2);"
+  , "}"
+  , "duckdb_state hs_bindgen_5b8189ac2ab75aa9 ("
+  , "  duckdb_prepared_statement arg1,"
+  , "  duckdb_pending_result *arg2"
+  , ")"
+  , "{"
+  , "  return (duckdb_pending_prepared_streaming)(arg1, arg2);"
+  , "}"
+  , "duckdb_state hs_bindgen_71265af97d3a41d1 ("
+  , "  duckdb_connection arg1,"
+  , "  char const *arg2,"
+  , "  duckdb_result *arg3"
+  , ")"
+  , "{"
+  , "  return (duckdb_query)(arg1, arg2, arg3);"
+  , "}"
+  , "void hs_bindgen_b86dbae055869626 ("
+  , "  duckdb_result *arg1"
+  , ")"
+  , "{"
+  , "  (duckdb_destroy_result)(arg1);"
+  , "}"
+  , "char const *hs_bindgen_d23794402f3fe9a9 ("
+  , "  duckdb_result *arg1,"
+  , "  idx_t arg2"
+  , ")"
+  , "{"
+  , "  return (duckdb_column_name)(arg1, arg2);"
+  , "}"
+  , "duckdb_type hs_bindgen_15a95e7d7ac8efc1 ("
+  , "  duckdb_result *arg1,"
+  , "  idx_t arg2"
+  , ")"
+  , "{"
+  , "  return (duckdb_column_type)(arg1, arg2);"
+  , "}"
+  , "duckdb_statement_type hs_bindgen_8a124a1bd6d825dd ("
+  , "  duckdb_result *arg1"
+  , ")"
+  , "{"
+  , "  return (duckdb_result_statement_type)(*arg1);"
+  , "}"
+  , "duckdb_logical_type hs_bindgen_7a205ff70db1d914 ("
+  , "  duckdb_result *arg1,"
+  , "  idx_t arg2"
+  , ")"
+  , "{"
+  , "  return (duckdb_column_logical_type)(arg1, arg2);"
+  , "}"
+  , "duckdb_arrow_options hs_bindgen_64d7e2281fcc020a ("
+  , "  duckdb_result *arg1"
+  , ")"
+  , "{"
+  , "  return (duckdb_result_get_arrow_options)(arg1);"
+  , "}"
+  , "idx_t hs_bindgen_7041e53dc1f8b5e8 ("
+  , "  duckdb_result *arg1"
+  , ")"
+  , "{"
+  , "  return (duckdb_column_count)(arg1);"
+  , "}"
+  , "idx_t hs_bindgen_a04d4c381ef339ef ("
+  , "  duckdb_result *arg1"
+  , ")"
+  , "{"
+  , "  return (duckdb_rows_changed)(arg1);"
+  , "}"
+  , "char const *hs_bindgen_6a44049691a0d5ca ("
+  , "  duckdb_result *arg1"
+  , ")"
+  , "{"
+  , "  return (duckdb_result_error)(arg1);"
+  , "}"
+  , "duckdb_error_type hs_bindgen_192ec6d6ab754ea4 ("
+  , "  duckdb_result *arg1"
+  , ")"
+  , "{"
+  , "  return (duckdb_result_error_type)(arg1);"
+  , "}"
+  , "duckdb_result_type hs_bindgen_28c674c4821c15e7 ("
+  , "  duckdb_result *arg1"
+  , ")"
+  , "{"
+  , "  return (duckdb_result_return_type)(*arg1);"
+  , "}"
+  , "duckdb_data_chunk hs_bindgen_e0bcac4419c39797 ("
+  , "  duckdb_result *arg1"
+  , ")"
+  , "{"
+  , "  return (duckdb_fetch_chunk)(*arg1);"
+  , "}"
+  , "duckdb_error_data hs_bindgen_83b19aac8561d31d ("
+  , "  duckdb_error_type arg1,"
+  , "  char const *arg2"
+  , ")"
+  , "{"
+  , "  return (duckdb_create_error_data)(arg1, arg2);"
+  , "}"
+  , "void hs_bindgen_e557d66e3312baae ("
+  , "  duckdb_error_data *arg1"
+  , ")"
+  , "{"
+  , "  (duckdb_destroy_error_data)(arg1);"
+  , "}"
+  , "duckdb_error_type hs_bindgen_c1966ca80c0b4d76 ("
+  , "  duckdb_error_data arg1"
+  , ")"
+  , "{"
+  , "  return (duckdb_error_data_error_type)(arg1);"
+  , "}"
+  , "char const *hs_bindgen_787ec5c9b9236c65 ("
+  , "  duckdb_error_data arg1"
+  , ")"
+  , "{"
+  , "  return (duckdb_error_data_message)(arg1);"
+  , "}"
+  , "_Bool hs_bindgen_6ec4f19ab789994d ("
+  , "  duckdb_error_data arg1"
+  , ")"
+  , "{"
+  , "  return (duckdb_error_data_has_error)(arg1);"
+  , "}"
+  , "void *hs_bindgen_f1244214a8151e9a ("
+  , "  size_t arg1"
+  , ")"
+  , "{"
+  , "  return (duckdb_malloc)(arg1);"
+  , "}"
+  , "void hs_bindgen_bcf85a099654942f ("
+  , "  void *arg1"
+  , ")"
+  , "{"
+  , "  (duckdb_free)(arg1);"
+  , "}"
+  , "idx_t hs_bindgen_3618e0173ef20b47 (void)"
+  , "{"
+  , "  return (duckdb_vector_size)();"
+  , "}"
+  , "_Bool hs_bindgen_7db158389f9bbb5a ("
+  , "  duckdb_string_t *arg1"
+  , ")"
+  , "{"
+  , "  return (duckdb_string_is_inlined)(*arg1);"
+  , "}"
+  , "uint32_t hs_bindgen_370767e53933be13 ("
+  , "  duckdb_string_t *arg1"
+  , ")"
+  , "{"
+  , "  return (duckdb_string_t_length)(*arg1);"
+  , "}"
+  , "char const *hs_bindgen_4dec572fab160e21 ("
+  , "  duckdb_string_t *arg1"
+  , ")"
+  , "{"
+  , "  return (duckdb_string_t_data)(arg1);"
+  , "}"
+  , "duckdb_error_data hs_bindgen_98c8545376939a95 ("
+  , "  char const *arg1,"
+  , "  idx_t arg2"
+  , ")"
+  , "{"
+  , "  return (duckdb_valid_utf8_check)(arg1, arg2);"
+  , "}"
+  , "idx_t hs_bindgen_9c5e815dd04bdc70 ("
+  , "  duckdb_result *arg1"
+  , ")"
+  , "{"
+  , "  return (duckdb_row_count)(arg1);"
+  , "}"
+  , "void *hs_bindgen_6d8e96c1f8b5a7c4 ("
+  , "  duckdb_result *arg1,"
+  , "  idx_t arg2"
+  , ")"
+  , "{"
+  , "  return (duckdb_column_data)(arg1, arg2);"
+  , "}"
+  , "_Bool *hs_bindgen_d038d17542f439e3 ("
+  , "  duckdb_result *arg1,"
+  , "  idx_t arg2"
+  , ")"
+  , "{"
+  , "  return (duckdb_nullmask_data)(arg1, arg2);"
+  , "}"
+  , "duckdb_data_chunk hs_bindgen_5996d8c396e44345 ("
+  , "  duckdb_result *arg1,"
+  , "  idx_t arg2"
+  , ")"
+  , "{"
+  , "  return (duckdb_result_get_chunk)(*arg1, arg2);"
+  , "}"
+  , "_Bool hs_bindgen_95717693287571e0 ("
+  , "  duckdb_result *arg1"
+  , ")"
+  , "{"
+  , "  return (duckdb_result_is_streaming)(*arg1);"
+  , "}"
+  , "idx_t hs_bindgen_026a59d5dd8cd1d0 ("
+  , "  duckdb_result *arg1"
+  , ")"
+  , "{"
+  , "  return (duckdb_result_chunk_count)(*arg1);"
+  , "}"
+  , "duckdb_data_chunk hs_bindgen_1779194488609e3a ("
+  , "  duckdb_result *arg1"
+  , ")"
+  , "{"
+  , "  return (duckdb_stream_fetch_chunk)(*arg1);"
+  , "}"
+  , "void hs_bindgen_97d26f995cbfe9e1 ("
+  , "  duckdb_database arg1,"
+  , "  duckdb_replacement_callback_t arg2,"
+  , "  void *arg3,"
+  , "  duckdb_delete_callback_t arg4"
+  , ")"
+  , "{"
+  , "  (duckdb_add_replacement_scan)(arg1, arg2, arg3, arg4);"
+  , "}"
+  , "void hs_bindgen_9829208ce8f26461 ("
+  , "  duckdb_replacement_scan_info arg1,"
+  , "  char const *arg2"
+  , ")"
+  , "{"
+  , "  (duckdb_replacement_scan_set_function_name)(arg1, arg2);"
+  , "}"
+  , "void hs_bindgen_826fb92442cb041e ("
+  , "  duckdb_replacement_scan_info arg1,"
+  , "  duckdb_value arg2"
+  , ")"
+  , "{"
+  , "  (duckdb_replacement_scan_add_parameter)(arg1, arg2);"
+  , "}"
+  , "void hs_bindgen_19e43007fd1f8170 ("
+  , "  duckdb_replacement_scan_info arg1,"
+  , "  char const *arg2"
+  , ")"
+  , "{"
+  , "  (duckdb_replacement_scan_set_error)(arg1, arg2);"
+  , "}"
+  , "duckdb_scalar_function hs_bindgen_29f5e8082607c703 (void)"
+  , "{"
+  , "  return (duckdb_create_scalar_function)();"
+  , "}"
+  , "void hs_bindgen_057a4b9e9634d576 ("
+  , "  duckdb_scalar_function *arg1"
+  , ")"
+  , "{"
+  , "  (duckdb_destroy_scalar_function)(arg1);"
+  , "}"
+  , "void hs_bindgen_d70a7a97e2b89e4d ("
+  , "  duckdb_scalar_function arg1,"
+  , "  char const *arg2"
+  , ")"
+  , "{"
+  , "  (duckdb_scalar_function_set_name)(arg1, arg2);"
+  , "}"
+  , "void hs_bindgen_39e740d82a18ea0b ("
+  , "  duckdb_scalar_function arg1,"
+  , "  duckdb_logical_type arg2"
+  , ")"
+  , "{"
+  , "  (duckdb_scalar_function_set_varargs)(arg1, arg2);"
+  , "}"
+  , "void hs_bindgen_3d2dbabbd47f004c ("
+  , "  duckdb_scalar_function arg1"
+  , ")"
+  , "{"
+  , "  (duckdb_scalar_function_set_special_handling)(arg1);"
+  , "}"
+  , "void hs_bindgen_5bea12af803df42f ("
+  , "  duckdb_scalar_function arg1"
+  , ")"
+  , "{"
+  , "  (duckdb_scalar_function_set_volatile)(arg1);"
+  , "}"
+  , "void hs_bindgen_51818ec21303d214 ("
+  , "  duckdb_scalar_function arg1,"
+  , "  duckdb_logical_type arg2"
+  , ")"
+  , "{"
+  , "  (duckdb_scalar_function_add_parameter)(arg1, arg2);"
+  , "}"
+  , "void hs_bindgen_e1d8f6ace443646c ("
+  , "  duckdb_scalar_function arg1,"
+  , "  duckdb_logical_type arg2"
+  , ")"
+  , "{"
+  , "  (duckdb_scalar_function_set_return_type)(arg1, arg2);"
+  , "}"
+  , "void hs_bindgen_c93a9fd37fbf98d6 ("
+  , "  duckdb_scalar_function arg1,"
+  , "  void *arg2,"
+  , "  duckdb_delete_callback_t arg3"
+  , ")"
+  , "{"
+  , "  (duckdb_scalar_function_set_extra_info)(arg1, arg2, arg3);"
+  , "}"
+  , "void hs_bindgen_1c92902e5ed97bae ("
+  , "  duckdb_scalar_function arg1,"
+  , "  duckdb_scalar_function_bind_t arg2"
+  , ")"
+  , "{"
+  , "  (duckdb_scalar_function_set_bind)(arg1, arg2);"
+  , "}"
+  , "void hs_bindgen_161a5fe606050dea ("
+  , "  duckdb_bind_info arg1,"
+  , "  void *arg2,"
+  , "  duckdb_delete_callback_t arg3"
+  , ")"
+  , "{"
+  , "  (duckdb_scalar_function_set_bind_data)(arg1, arg2, arg3);"
+  , "}"
+  , "void hs_bindgen_83d27908da83f624 ("
+  , "  duckdb_bind_info arg1,"
+  , "  duckdb_copy_callback_t arg2"
+  , ")"
+  , "{"
+  , "  (duckdb_scalar_function_set_bind_data_copy)(arg1, arg2);"
+  , "}"
+  , "void hs_bindgen_d3eb9e966acdda11 ("
+  , "  duckdb_bind_info arg1,"
+  , "  char const *arg2"
+  , ")"
+  , "{"
+  , "  (duckdb_scalar_function_bind_set_error)(arg1, arg2);"
+  , "}"
+  , "void hs_bindgen_480557d5180f6227 ("
+  , "  duckdb_scalar_function arg1,"
+  , "  duckdb_scalar_function_t arg2"
+  , ")"
+  , "{"
+  , "  (duckdb_scalar_function_set_function)(arg1, arg2);"
+  , "}"
+  , "duckdb_state hs_bindgen_f58f0538c8a2c929 ("
+  , "  duckdb_connection arg1,"
+  , "  duckdb_scalar_function arg2"
+  , ")"
+  , "{"
+  , "  return (duckdb_register_scalar_function)(arg1, arg2);"
+  , "}"
+  , "void *hs_bindgen_8bb846e4c098cebe ("
+  , "  duckdb_function_info arg1"
+  , ")"
+  , "{"
+  , "  return (duckdb_scalar_function_get_extra_info)(arg1);"
+  , "}"
+  , "void *hs_bindgen_353d4b2c6989c18f ("
+  , "  duckdb_bind_info arg1"
+  , ")"
+  , "{"
+  , "  return (duckdb_scalar_function_bind_get_extra_info)(arg1);"
+  , "}"
+  , "void *hs_bindgen_7ee9535ddf4111aa ("
+  , "  duckdb_function_info arg1"
+  , ")"
+  , "{"
+  , "  return (duckdb_scalar_function_get_bind_data)(arg1);"
+  , "}"
+  , "void hs_bindgen_629abf4e5c702bde ("
+  , "  duckdb_bind_info arg1,"
+  , "  duckdb_client_context *arg2"
+  , ")"
+  , "{"
+  , "  (duckdb_scalar_function_get_client_context)(arg1, arg2);"
+  , "}"
+  , "void hs_bindgen_49dce543be61dc96 ("
+  , "  duckdb_function_info arg1,"
+  , "  char const *arg2"
+  , ")"
+  , "{"
+  , "  (duckdb_scalar_function_set_error)(arg1, arg2);"
+  , "}"
+  , "duckdb_scalar_function_set hs_bindgen_ac865eab110e40bc ("
+  , "  char const *arg1"
+  , ")"
+  , "{"
+  , "  return (duckdb_create_scalar_function_set)(arg1);"
+  , "}"
+  , "void hs_bindgen_967e6425d22f5053 ("
+  , "  duckdb_scalar_function_set *arg1"
+  , ")"
+  , "{"
+  , "  (duckdb_destroy_scalar_function_set)(arg1);"
+  , "}"
+  , "duckdb_state hs_bindgen_4de507eae58d6975 ("
+  , "  duckdb_scalar_function_set arg1,"
+  , "  duckdb_scalar_function arg2"
+  , ")"
+  , "{"
+  , "  return (duckdb_add_scalar_function_to_set)(arg1, arg2);"
+  , "}"
+  , "duckdb_state hs_bindgen_e4e7795c0415ab7b ("
+  , "  duckdb_connection arg1,"
+  , "  duckdb_scalar_function_set arg2"
+  , ")"
+  , "{"
+  , "  return (duckdb_register_scalar_function_set)(arg1, arg2);"
+  , "}"
+  , "idx_t hs_bindgen_63b454129d89f75f ("
+  , "  duckdb_bind_info arg1"
+  , ")"
+  , "{"
+  , "  return (duckdb_scalar_function_bind_get_argument_count)(arg1);"
+  , "}"
+  , "duckdb_expression hs_bindgen_5f7dc58f348f5029 ("
+  , "  duckdb_bind_info arg1,"
+  , "  idx_t arg2"
+  , ")"
+  , "{"
+  , "  return (duckdb_scalar_function_bind_get_argument)(arg1, arg2);"
+  , "}"
+  , "void *hs_bindgen_c9951a19c1a8f16b ("
+  , "  duckdb_function_info arg1"
+  , ")"
+  , "{"
+  , "  return (duckdb_scalar_function_get_state)(arg1);"
+  , "}"
+  , "void hs_bindgen_ac222a01dd370217 ("
+  , "  duckdb_scalar_function arg1,"
+  , "  duckdb_scalar_function_init_t arg2"
+  , ")"
+  , "{"
+  , "  (duckdb_scalar_function_set_init)(arg1, arg2);"
+  , "}"
+  , "void hs_bindgen_53b7cee299a379f8 ("
+  , "  duckdb_init_info arg1,"
+  , "  char const *arg2"
+  , ")"
+  , "{"
+  , "  (duckdb_scalar_function_init_set_error)(arg1, arg2);"
+  , "}"
+  , "void hs_bindgen_064ca7da09a75b71 ("
+  , "  duckdb_init_info arg1,"
+  , "  void *arg2,"
+  , "  duckdb_delete_callback_t arg3"
+  , ")"
+  , "{"
+  , "  (duckdb_scalar_function_init_set_state)(arg1, arg2, arg3);"
+  , "}"
+  , "void hs_bindgen_cc7cfdf590abe6a3 ("
+  , "  duckdb_init_info arg1,"
+  , "  duckdb_client_context *arg2"
+  , ")"
+  , "{"
+  , "  (duckdb_scalar_function_init_get_client_context)(arg1, arg2);"
+  , "}"
+  , "void *hs_bindgen_9b7c5e40eb1be92f ("
+  , "  duckdb_init_info arg1"
+  , ")"
+  , "{"
+  , "  return (duckdb_scalar_function_init_get_bind_data)(arg1);"
+  , "}"
+  , "void *hs_bindgen_c88ef758b0fa7ab3 ("
+  , "  duckdb_init_info arg1"
+  , ")"
+  , "{"
+  , "  return (duckdb_scalar_function_init_get_extra_info)(arg1);"
+  , "}"
+  , "duckdb_state hs_bindgen_0fc4104d01034d1a ("
+  , "  duckdb_connection arg1,"
+  , "  char const *arg2,"
+  , "  char const *arg3,"
+  , "  duckdb_table_description *arg4"
+  , ")"
+  , "{"
+  , "  return (duckdb_table_description_create)(arg1, arg2, arg3, arg4);"
+  , "}"
+  , "duckdb_state hs_bindgen_82a0c6b485d97488 ("
+  , "  duckdb_connection arg1,"
+  , "  char const *arg2,"
+  , "  char const *arg3,"
+  , "  char const *arg4,"
+  , "  duckdb_table_description *arg5"
+  , ")"
+  , "{"
+  , "  return (duckdb_table_description_create_ext)(arg1, arg2, arg3, arg4, arg5);"
+  , "}"
+  , "void hs_bindgen_84b027cfbe2f4401 ("
+  , "  duckdb_table_description *arg1"
+  , ")"
+  , "{"
+  , "  (duckdb_table_description_destroy)(arg1);"
+  , "}"
+  , "char const *hs_bindgen_6ac61bf6b8c77c47 ("
+  , "  duckdb_table_description arg1"
+  , ")"
+  , "{"
+  , "  return (duckdb_table_description_error)(arg1);"
+  , "}"
+  , "duckdb_state hs_bindgen_4d7369d3b81bfd4c ("
+  , "  duckdb_table_description arg1,"
+  , "  idx_t arg2,"
+  , "  _Bool *arg3"
+  , ")"
+  , "{"
+  , "  return (duckdb_column_has_default)(arg1, arg2, arg3);"
+  , "}"
+  , "idx_t hs_bindgen_8f13db0d61fbb2eb ("
+  , "  duckdb_table_description arg1"
+  , ")"
+  , "{"
+  , "  return (duckdb_table_description_get_column_count)(arg1);"
+  , "}"
+  , "char *hs_bindgen_1bd765f144498ef7 ("
+  , "  duckdb_table_description arg1,"
+  , "  idx_t arg2"
+  , ")"
+  , "{"
+  , "  return (duckdb_table_description_get_column_name)(arg1, arg2);"
+  , "}"
+  , "duckdb_logical_type hs_bindgen_1c6b54182f653add ("
+  , "  duckdb_table_description arg1,"
+  , "  idx_t arg2"
+  , ")"
+  , "{"
+  , "  return (duckdb_table_description_get_column_type)(arg1, arg2);"
+  , "}"
+  , "duckdb_table_function hs_bindgen_fc1c42be14fab1d7 (void)"
+  , "{"
+  , "  return (duckdb_create_table_function)();"
+  , "}"
+  , "void hs_bindgen_9bbeca3e14750ffd ("
+  , "  duckdb_table_function *arg1"
+  , ")"
+  , "{"
+  , "  (duckdb_destroy_table_function)(arg1);"
+  , "}"
+  , "void hs_bindgen_fa60b5782b676b1b ("
+  , "  duckdb_table_function arg1,"
+  , "  char const *arg2"
+  , ")"
+  , "{"
+  , "  (duckdb_table_function_set_name)(arg1, arg2);"
+  , "}"
+  , "void hs_bindgen_c2b43f04cbd5d423 ("
+  , "  duckdb_table_function arg1,"
+  , "  duckdb_logical_type arg2"
+  , ")"
+  , "{"
+  , "  (duckdb_table_function_add_parameter)(arg1, arg2);"
+  , "}"
+  , "void hs_bindgen_169c694648c6ccc1 ("
+  , "  duckdb_table_function arg1,"
+  , "  char const *arg2,"
+  , "  duckdb_logical_type arg3"
+  , ")"
+  , "{"
+  , "  (duckdb_table_function_add_named_parameter)(arg1, arg2, arg3);"
+  , "}"
+  , "void hs_bindgen_c980cb05cbc34a77 ("
+  , "  duckdb_table_function arg1,"
+  , "  void *arg2,"
+  , "  duckdb_delete_callback_t arg3"
+  , ")"
+  , "{"
+  , "  (duckdb_table_function_set_extra_info)(arg1, arg2, arg3);"
+  , "}"
+  , "void hs_bindgen_102b9bd82ea79e87 ("
+  , "  duckdb_table_function arg1,"
+  , "  duckdb_table_function_bind_t arg2"
+  , ")"
+  , "{"
+  , "  (duckdb_table_function_set_bind)(arg1, arg2);"
+  , "}"
+  , "void hs_bindgen_b853cf848e1dd32b ("
+  , "  duckdb_table_function arg1,"
+  , "  duckdb_table_function_init_t arg2"
+  , ")"
+  , "{"
+  , "  (duckdb_table_function_set_init)(arg1, arg2);"
+  , "}"
+  , "void hs_bindgen_6e9b24dd817b24cb ("
+  , "  duckdb_table_function arg1,"
+  , "  duckdb_table_function_init_t arg2"
+  , ")"
+  , "{"
+  , "  (duckdb_table_function_set_local_init)(arg1, arg2);"
+  , "}"
+  , "void hs_bindgen_02b30c88a74a7b32 ("
+  , "  duckdb_table_function arg1,"
+  , "  duckdb_table_function_t arg2"
+  , ")"
+  , "{"
+  , "  (duckdb_table_function_set_function)(arg1, arg2);"
+  , "}"
+  , "void hs_bindgen_7b6ddb914e22dc0c ("
+  , "  duckdb_table_function arg1,"
+  , "  _Bool arg2"
+  , ")"
+  , "{"
+  , "  (duckdb_table_function_supports_projection_pushdown)(arg1, arg2);"
+  , "}"
+  , "duckdb_state hs_bindgen_aad41a8c83d775f6 ("
+  , "  duckdb_connection arg1,"
+  , "  duckdb_table_function arg2"
+  , ")"
+  , "{"
+  , "  return (duckdb_register_table_function)(arg1, arg2);"
+  , "}"
+  , "void *hs_bindgen_6fab24b482a2ecea ("
+  , "  duckdb_bind_info arg1"
+  , ")"
+  , "{"
+  , "  return (duckdb_bind_get_extra_info)(arg1);"
+  , "}"
+  , "void hs_bindgen_ccf6e3d06befd12b ("
+  , "  duckdb_bind_info arg1,"
+  , "  duckdb_client_context *arg2"
+  , ")"
+  , "{"
+  , "  (duckdb_table_function_get_client_context)(arg1, arg2);"
+  , "}"
+  , "void hs_bindgen_7f781750bcf9c561 ("
+  , "  duckdb_bind_info arg1,"
+  , "  char const *arg2,"
+  , "  duckdb_logical_type arg3"
+  , ")"
+  , "{"
+  , "  (duckdb_bind_add_result_column)(arg1, arg2, arg3);"
+  , "}"
+  , "idx_t hs_bindgen_021eeb8fbfbce39a ("
+  , "  duckdb_bind_info arg1"
+  , ")"
+  , "{"
+  , "  return (duckdb_bind_get_parameter_count)(arg1);"
+  , "}"
+  , "duckdb_value hs_bindgen_ba87799ace861635 ("
+  , "  duckdb_bind_info arg1,"
+  , "  idx_t arg2"
+  , ")"
+  , "{"
+  , "  return (duckdb_bind_get_parameter)(arg1, arg2);"
+  , "}"
+  , "duckdb_value hs_bindgen_c914bc6228b6bee9 ("
+  , "  duckdb_bind_info arg1,"
+  , "  char const *arg2"
+  , ")"
+  , "{"
+  , "  return (duckdb_bind_get_named_parameter)(arg1, arg2);"
+  , "}"
+  , "void hs_bindgen_ae6dbca28237b618 ("
+  , "  duckdb_bind_info arg1,"
+  , "  void *arg2,"
+  , "  duckdb_delete_callback_t arg3"
+  , ")"
+  , "{"
+  , "  (duckdb_bind_set_bind_data)(arg1, arg2, arg3);"
+  , "}"
+  , "void hs_bindgen_78371efd83ac79c2 ("
+  , "  duckdb_bind_info arg1,"
+  , "  idx_t arg2,"
+  , "  _Bool arg3"
+  , ")"
+  , "{"
+  , "  (duckdb_bind_set_cardinality)(arg1, arg2, arg3);"
+  , "}"
+  , "void hs_bindgen_bc90a0043b0ab6d4 ("
+  , "  duckdb_bind_info arg1,"
+  , "  char const *arg2"
+  , ")"
+  , "{"
+  , "  (duckdb_bind_set_error)(arg1, arg2);"
+  , "}"
+  , "void *hs_bindgen_b7875ec01bf04915 ("
+  , "  duckdb_init_info arg1"
+  , ")"
+  , "{"
+  , "  return (duckdb_init_get_extra_info)(arg1);"
+  , "}"
+  , "void *hs_bindgen_a0d15cbe241999e8 ("
+  , "  duckdb_init_info arg1"
+  , ")"
+  , "{"
+  , "  return (duckdb_init_get_bind_data)(arg1);"
+  , "}"
+  , "void hs_bindgen_97fe52be38df4eb5 ("
+  , "  duckdb_init_info arg1,"
+  , "  void *arg2,"
+  , "  duckdb_delete_callback_t arg3"
+  , ")"
+  , "{"
+  , "  (duckdb_init_set_init_data)(arg1, arg2, arg3);"
+  , "}"
+  , "idx_t hs_bindgen_ed33dd34d691cba6 ("
+  , "  duckdb_init_info arg1"
+  , ")"
+  , "{"
+  , "  return (duckdb_init_get_column_count)(arg1);"
+  , "}"
+  , "idx_t hs_bindgen_315d90043ca10c52 ("
+  , "  duckdb_init_info arg1,"
+  , "  idx_t arg2"
+  , ")"
+  , "{"
+  , "  return (duckdb_init_get_column_index)(arg1, arg2);"
+  , "}"
+  , "void hs_bindgen_5b19cd9c0b08207e ("
+  , "  duckdb_init_info arg1,"
+  , "  idx_t arg2"
+  , ")"
+  , "{"
+  , "  (duckdb_init_set_max_threads)(arg1, arg2);"
+  , "}"
+  , "void hs_bindgen_7eed47dafd9844a0 ("
+  , "  duckdb_init_info arg1,"
+  , "  char const *arg2"
+  , ")"
+  , "{"
+  , "  (duckdb_init_set_error)(arg1, arg2);"
+  , "}"
+  , "void *hs_bindgen_4e748f1d10a395e9 ("
+  , "  duckdb_function_info arg1"
+  , ")"
+  , "{"
+  , "  return (duckdb_function_get_extra_info)(arg1);"
+  , "}"
+  , "void *hs_bindgen_cb63e00179906ca2 ("
+  , "  duckdb_function_info arg1"
+  , ")"
+  , "{"
+  , "  return (duckdb_function_get_bind_data)(arg1);"
+  , "}"
+  , "void *hs_bindgen_7ed5ee7b3e3d9999 ("
+  , "  duckdb_function_info arg1"
+  , ")"
+  , "{"
+  , "  return (duckdb_function_get_init_data)(arg1);"
+  , "}"
+  , "void *hs_bindgen_1f692b92cc709645 ("
+  , "  duckdb_function_info arg1"
+  , ")"
+  , "{"
+  , "  return (duckdb_function_get_local_init_data)(arg1);"
+  , "}"
+  , "void hs_bindgen_00bd4a7b01db4220 ("
+  , "  duckdb_function_info arg1,"
+  , "  char const *arg2"
+  , ")"
+  , "{"
+  , "  (duckdb_function_set_error)(arg1, arg2);"
+  , "}"
+  , "idx_t hs_bindgen_ddabbca5182a4296 ("
+  , "  duckdb_bind_info arg1"
+  , ")"
+  , "{"
+  , "  return (duckdb_table_function_bind_get_result_column_count)(arg1);"
+  , "}"
+  , "char const *hs_bindgen_6327aeb7a89bbc07 ("
+  , "  duckdb_bind_info arg1,"
+  , "  idx_t arg2"
+  , ")"
+  , "{"
+  , "  return (duckdb_table_function_bind_get_result_column_name)(arg1, arg2);"
+  , "}"
+  , "duckdb_logical_type hs_bindgen_7239677075fd2324 ("
+  , "  duckdb_bind_info arg1,"
+  , "  idx_t arg2"
+  , ")"
+  , "{"
+  , "  return (duckdb_table_function_bind_get_result_column_type)(arg1, arg2);"
+  , "}"
+  , "void hs_bindgen_33fd2a2a6fdd62ff ("
+  , "  duckdb_database arg1,"
+  , "  idx_t arg2"
+  , ")"
+  , "{"
+  , "  (duckdb_execute_tasks)(arg1, arg2);"
+  , "}"
+  , "duckdb_task_state hs_bindgen_75127cab362fdc65 ("
+  , "  duckdb_database arg1"
+  , ")"
+  , "{"
+  , "  return (duckdb_create_task_state)(arg1);"
+  , "}"
+  , "void hs_bindgen_c483eb3fcf9cced4 ("
+  , "  duckdb_task_state arg1"
+  , ")"
+  , "{"
+  , "  (duckdb_execute_tasks_state)(arg1);"
+  , "}"
+  , "idx_t hs_bindgen_a9f33b6e6c103bca ("
+  , "  duckdb_task_state arg1,"
+  , "  idx_t arg2"
+  , ")"
+  , "{"
+  , "  return (duckdb_execute_n_tasks_state)(arg1, arg2);"
+  , "}"
+  , "void hs_bindgen_d7af3b181ccdb7bc ("
+  , "  duckdb_task_state arg1"
+  , ")"
+  , "{"
+  , "  (duckdb_finish_execution)(arg1);"
+  , "}"
+  , "_Bool hs_bindgen_4a7f9cb6b99f4a2c ("
+  , "  duckdb_task_state arg1"
+  , ")"
+  , "{"
+  , "  return (duckdb_task_state_is_finished)(arg1);"
+  , "}"
+  , "void hs_bindgen_6b20c703713efbc1 ("
+  , "  duckdb_task_state arg1"
+  , ")"
+  , "{"
+  , "  (duckdb_destroy_task_state)(arg1);"
+  , "}"
+  , "_Bool hs_bindgen_b59088062cd376af ("
+  , "  duckdb_connection arg1"
+  , ")"
+  , "{"
+  , "  return (duckdb_execution_is_finished)(arg1);"
+  , "}"
+  , "void hs_bindgen_7416564ecbea2162 ("
+  , "  duckdb_value *arg1"
+  , ")"
+  , "{"
+  , "  (duckdb_destroy_value)(arg1);"
+  , "}"
+  , "duckdb_value hs_bindgen_b7a98388b23a9165 ("
+  , "  char const *arg1"
+  , ")"
+  , "{"
+  , "  return (duckdb_create_varchar)(arg1);"
+  , "}"
+  , "duckdb_value hs_bindgen_acf0e4b8713d5965 ("
+  , "  char const *arg1,"
+  , "  idx_t arg2"
+  , ")"
+  , "{"
+  , "  return (duckdb_create_varchar_length)(arg1, arg2);"
+  , "}"
+  , "duckdb_value hs_bindgen_545bb1b78145c2fd ("
+  , "  _Bool arg1"
+  , ")"
+  , "{"
+  , "  return (duckdb_create_bool)(arg1);"
+  , "}"
+  , "duckdb_value hs_bindgen_70b127e29e4eeeee ("
+  , "  int8_t arg1"
+  , ")"
+  , "{"
+  , "  return (duckdb_create_int8)(arg1);"
+  , "}"
+  , "duckdb_value hs_bindgen_d066824e23ecaa3b ("
+  , "  uint8_t arg1"
+  , ")"
+  , "{"
+  , "  return (duckdb_create_uint8)(arg1);"
+  , "}"
+  , "duckdb_value hs_bindgen_a6cfd909f3065e49 ("
+  , "  int16_t arg1"
+  , ")"
+  , "{"
+  , "  return (duckdb_create_int16)(arg1);"
+  , "}"
+  , "duckdb_value hs_bindgen_a9c685bd6504c27a ("
+  , "  uint16_t arg1"
+  , ")"
+  , "{"
+  , "  return (duckdb_create_uint16)(arg1);"
+  , "}"
+  , "duckdb_value hs_bindgen_5bec523c4d95699b ("
+  , "  int32_t arg1"
+  , ")"
+  , "{"
+  , "  return (duckdb_create_int32)(arg1);"
+  , "}"
+  , "duckdb_value hs_bindgen_f2c252bc8521c880 ("
+  , "  uint32_t arg1"
+  , ")"
+  , "{"
+  , "  return (duckdb_create_uint32)(arg1);"
+  , "}"
+  , "duckdb_value hs_bindgen_cac3b650cf37ffd2 ("
+  , "  uint64_t arg1"
+  , ")"
+  , "{"
+  , "  return (duckdb_create_uint64)(arg1);"
+  , "}"
+  , "duckdb_value hs_bindgen_5181d8fcad549863 ("
+  , "  int64_t arg1"
+  , ")"
+  , "{"
+  , "  return (duckdb_create_int64)(arg1);"
+  , "}"
+  , "duckdb_value hs_bindgen_f6246c4c29021491 ("
+  , "  duckdb_hugeint *arg1"
+  , ")"
+  , "{"
+  , "  return (duckdb_create_hugeint)(*arg1);"
+  , "}"
+  , "duckdb_value hs_bindgen_3e97e4ce6f3c80ac ("
+  , "  duckdb_uhugeint *arg1"
+  , ")"
+  , "{"
+  , "  return (duckdb_create_uhugeint)(*arg1);"
+  , "}"
+  , "duckdb_value hs_bindgen_d24ce08ffed3f6b6 ("
+  , "  duckdb_bignum *arg1"
+  , ")"
+  , "{"
+  , "  return (duckdb_create_bignum)(*arg1);"
+  , "}"
+  , "duckdb_value hs_bindgen_4ca0d4cd4553b621 ("
+  , "  duckdb_decimal *arg1"
+  , ")"
+  , "{"
+  , "  return (duckdb_create_decimal)(*arg1);"
+  , "}"
+  , "duckdb_value hs_bindgen_8e6cf7541c757947 ("
+  , "  float arg1"
+  , ")"
+  , "{"
+  , "  return (duckdb_create_float)(arg1);"
+  , "}"
+  , "duckdb_value hs_bindgen_6f0cb28a70d81ff7 ("
+  , "  double arg1"
+  , ")"
+  , "{"
+  , "  return (duckdb_create_double)(arg1);"
+  , "}"
+  , "duckdb_value hs_bindgen_4fc78acbb0d6f7d4 ("
+  , "  duckdb_date *arg1"
+  , ")"
+  , "{"
+  , "  return (duckdb_create_date)(*arg1);"
+  , "}"
+  , "duckdb_value hs_bindgen_b8abb38c489b45f3 ("
+  , "  duckdb_time *arg1"
+  , ")"
+  , "{"
+  , "  return (duckdb_create_time)(*arg1);"
+  , "}"
+  , "duckdb_value hs_bindgen_1e13f4e1b882a94b ("
+  , "  duckdb_time_ns *arg1"
+  , ")"
+  , "{"
+  , "  return (duckdb_create_time_ns)(*arg1);"
+  , "}"
+  , "duckdb_value hs_bindgen_23c57f1e364c528f ("
+  , "  duckdb_time_tz *arg1"
+  , ")"
+  , "{"
+  , "  return (duckdb_create_time_tz_value)(*arg1);"
+  , "}"
+  , "duckdb_value hs_bindgen_931d2c720adf9f32 ("
+  , "  duckdb_timestamp *arg1"
+  , ")"
+  , "{"
+  , "  return (duckdb_create_timestamp)(*arg1);"
+  , "}"
+  , "duckdb_value hs_bindgen_4bf48d5c47b0fd30 ("
+  , "  duckdb_timestamp *arg1"
+  , ")"
+  , "{"
+  , "  return (duckdb_create_timestamp_tz)(*arg1);"
+  , "}"
+  , "duckdb_value hs_bindgen_1fd8ec4cc5b7dd6c ("
+  , "  duckdb_timestamp_ns *arg1"
+  , ")"
+  , "{"
+  , "  return (duckdb_create_timestamp_tz_ns)(*arg1);"
+  , "}"
+  , "duckdb_value hs_bindgen_839b89f0c97b4b9c ("
+  , "  duckdb_timestamp_s *arg1"
+  , ")"
+  , "{"
+  , "  return (duckdb_create_timestamp_s)(*arg1);"
+  , "}"
+  , "duckdb_value hs_bindgen_6976ceed86104904 ("
+  , "  duckdb_timestamp_ms *arg1"
+  , ")"
+  , "{"
+  , "  return (duckdb_create_timestamp_ms)(*arg1);"
+  , "}"
+  , "duckdb_value hs_bindgen_60490049e30ac729 ("
+  , "  duckdb_timestamp_ns *arg1"
+  , ")"
+  , "{"
+  , "  return (duckdb_create_timestamp_ns)(*arg1);"
+  , "}"
+  , "duckdb_value hs_bindgen_83efabe4062e8681 ("
+  , "  duckdb_interval *arg1"
+  , ")"
+  , "{"
+  , "  return (duckdb_create_interval)(*arg1);"
+  , "}"
+  , "duckdb_value hs_bindgen_cf735e94c5bac60d ("
+  , "  uint8_t const *arg1,"
+  , "  idx_t arg2"
+  , ")"
+  , "{"
+  , "  return (duckdb_create_blob)(arg1, arg2);"
+  , "}"
+  , "duckdb_value hs_bindgen_c7b4b1a06cda2f10 ("
+  , "  duckdb_bit *arg1"
+  , ")"
+  , "{"
+  , "  return (duckdb_create_bit)(*arg1);"
+  , "}"
+  , "duckdb_value hs_bindgen_b9b73a0a629f9c40 ("
+  , "  duckdb_uhugeint *arg1"
+  , ")"
+  , "{"
+  , "  return (duckdb_create_uuid)(*arg1);"
+  , "}"
+  , "_Bool hs_bindgen_8daa08114c4aa357 ("
+  , "  duckdb_value arg1"
+  , ")"
+  , "{"
+  , "  return (duckdb_get_bool)(arg1);"
+  , "}"
+  , "int8_t hs_bindgen_8635bf99c840171b ("
+  , "  duckdb_value arg1"
+  , ")"
+  , "{"
+  , "  return (duckdb_get_int8)(arg1);"
+  , "}"
+  , "uint8_t hs_bindgen_9bcba9c2ddd830e0 ("
+  , "  duckdb_value arg1"
+  , ")"
+  , "{"
+  , "  return (duckdb_get_uint8)(arg1);"
+  , "}"
+  , "int16_t hs_bindgen_c63af2c95b187ed9 ("
+  , "  duckdb_value arg1"
+  , ")"
+  , "{"
+  , "  return (duckdb_get_int16)(arg1);"
+  , "}"
+  , "uint16_t hs_bindgen_b1dacf42f5095365 ("
+  , "  duckdb_value arg1"
+  , ")"
+  , "{"
+  , "  return (duckdb_get_uint16)(arg1);"
+  , "}"
+  , "int32_t hs_bindgen_6340bd0360a949a3 ("
+  , "  duckdb_value arg1"
+  , ")"
+  , "{"
+  , "  return (duckdb_get_int32)(arg1);"
+  , "}"
+  , "uint32_t hs_bindgen_2da280f7709cce18 ("
+  , "  duckdb_value arg1"
+  , ")"
+  , "{"
+  , "  return (duckdb_get_uint32)(arg1);"
+  , "}"
+  , "int64_t hs_bindgen_c2dd8141b4a3022f ("
+  , "  duckdb_value arg1"
+  , ")"
+  , "{"
+  , "  return (duckdb_get_int64)(arg1);"
+  , "}"
+  , "uint64_t hs_bindgen_6a3f2f6242c76931 ("
+  , "  duckdb_value arg1"
+  , ")"
+  , "{"
+  , "  return (duckdb_get_uint64)(arg1);"
+  , "}"
+  , "void hs_bindgen_1c6181d93fbc8796 ("
+  , "  duckdb_value arg1,"
+  , "  duckdb_hugeint *arg2"
+  , ")"
+  , "{"
+  , "  *arg2 = (duckdb_get_hugeint)(arg1);"
+  , "}"
+  , "void hs_bindgen_b5857fae8dc89273 ("
+  , "  duckdb_value arg1,"
+  , "  duckdb_uhugeint *arg2"
+  , ")"
+  , "{"
+  , "  *arg2 = (duckdb_get_uhugeint)(arg1);"
+  , "}"
+  , "void hs_bindgen_74fbc7e89c0460ed ("
+  , "  duckdb_value arg1,"
+  , "  duckdb_bignum *arg2"
+  , ")"
+  , "{"
+  , "  *arg2 = (duckdb_get_bignum)(arg1);"
+  , "}"
+  , "void hs_bindgen_84e4f424589f16de ("
+  , "  duckdb_value arg1,"
+  , "  duckdb_decimal *arg2"
+  , ")"
+  , "{"
+  , "  *arg2 = (duckdb_get_decimal)(arg1);"
+  , "}"
+  , "float hs_bindgen_615a351162dd38b0 ("
+  , "  duckdb_value arg1"
+  , ")"
+  , "{"
+  , "  return (duckdb_get_float)(arg1);"
+  , "}"
+  , "double hs_bindgen_3b54cae80b78d7a6 ("
+  , "  duckdb_value arg1"
+  , ")"
+  , "{"
+  , "  return (duckdb_get_double)(arg1);"
+  , "}"
+  , "void hs_bindgen_022973e5005ce823 ("
+  , "  duckdb_value arg1,"
+  , "  duckdb_date *arg2"
+  , ")"
+  , "{"
+  , "  *arg2 = (duckdb_get_date)(arg1);"
+  , "}"
+  , "void hs_bindgen_d90d0681c12eaba7 ("
+  , "  duckdb_value arg1,"
+  , "  duckdb_time *arg2"
+  , ")"
+  , "{"
+  , "  *arg2 = (duckdb_get_time)(arg1);"
+  , "}"
+  , "void hs_bindgen_5e6ada8cebf82fef ("
+  , "  duckdb_value arg1,"
+  , "  duckdb_time_ns *arg2"
+  , ")"
+  , "{"
+  , "  *arg2 = (duckdb_get_time_ns)(arg1);"
+  , "}"
+  , "void hs_bindgen_d756e565b6bce9f1 ("
+  , "  duckdb_value arg1,"
+  , "  duckdb_time_tz *arg2"
+  , ")"
+  , "{"
+  , "  *arg2 = (duckdb_get_time_tz)(arg1);"
+  , "}"
+  , "void hs_bindgen_d9df571bb20b335a ("
+  , "  duckdb_value arg1,"
+  , "  duckdb_timestamp *arg2"
+  , ")"
+  , "{"
+  , "  *arg2 = (duckdb_get_timestamp)(arg1);"
+  , "}"
+  , "void hs_bindgen_b755f602a03467f7 ("
+  , "  duckdb_value arg1,"
+  , "  duckdb_timestamp *arg2"
+  , ")"
+  , "{"
+  , "  *arg2 = (duckdb_get_timestamp_tz)(arg1);"
+  , "}"
+  , "void hs_bindgen_c0cc85ed29a0cab5 ("
+  , "  duckdb_value arg1,"
+  , "  duckdb_timestamp_ns *arg2"
+  , ")"
+  , "{"
+  , "  *arg2 = (duckdb_get_timestamp_tz_ns)(arg1);"
+  , "}"
+  , "void hs_bindgen_94661a923251c477 ("
+  , "  duckdb_value arg1,"
+  , "  duckdb_timestamp_s *arg2"
+  , ")"
+  , "{"
+  , "  *arg2 = (duckdb_get_timestamp_s)(arg1);"
+  , "}"
+  , "void hs_bindgen_ef716f499f99907a ("
+  , "  duckdb_value arg1,"
+  , "  duckdb_timestamp_ms *arg2"
+  , ")"
+  , "{"
+  , "  *arg2 = (duckdb_get_timestamp_ms)(arg1);"
+  , "}"
+  , "void hs_bindgen_7b25b0eed2d77001 ("
+  , "  duckdb_value arg1,"
+  , "  duckdb_timestamp_ns *arg2"
+  , ")"
+  , "{"
+  , "  *arg2 = (duckdb_get_timestamp_ns)(arg1);"
+  , "}"
+  , "void hs_bindgen_988b285b39137a9f ("
+  , "  duckdb_value arg1,"
+  , "  duckdb_interval *arg2"
+  , ")"
+  , "{"
+  , "  *arg2 = (duckdb_get_interval)(arg1);"
+  , "}"
+  , "duckdb_logical_type hs_bindgen_068c34db6e614c9a ("
+  , "  duckdb_value arg1"
+  , ")"
+  , "{"
+  , "  return (duckdb_get_value_type)(arg1);"
+  , "}"
+  , "void hs_bindgen_26638b96308a8043 ("
+  , "  duckdb_value arg1,"
+  , "  duckdb_blob *arg2"
+  , ")"
+  , "{"
+  , "  *arg2 = (duckdb_get_blob)(arg1);"
+  , "}"
+  , "void hs_bindgen_450ea2e919fd9d26 ("
+  , "  duckdb_value arg1,"
+  , "  duckdb_bit *arg2"
+  , ")"
+  , "{"
+  , "  *arg2 = (duckdb_get_bit)(arg1);"
+  , "}"
+  , "void hs_bindgen_4799e633564120e9 ("
+  , "  duckdb_value arg1,"
+  , "  duckdb_uhugeint *arg2"
+  , ")"
+  , "{"
+  , "  *arg2 = (duckdb_get_uuid)(arg1);"
+  , "}"
+  , "char *hs_bindgen_06b79afac44ffc3b ("
+  , "  duckdb_value arg1"
+  , ")"
+  , "{"
+  , "  return (duckdb_get_varchar)(arg1);"
+  , "}"
+  , "duckdb_value hs_bindgen_95eb7d0f1c818e7b ("
+  , "  duckdb_logical_type arg1,"
+  , "  duckdb_value *arg2"
+  , ")"
+  , "{"
+  , "  return (duckdb_create_struct_value)(arg1, arg2);"
+  , "}"
+  , "duckdb_value hs_bindgen_8b254090503c2df0 ("
+  , "  duckdb_logical_type arg1,"
+  , "  duckdb_value *arg2,"
+  , "  idx_t arg3"
+  , ")"
+  , "{"
+  , "  return (duckdb_create_list_value)(arg1, arg2, arg3);"
+  , "}"
+  , "duckdb_value hs_bindgen_d1f6dce6518d2db5 ("
+  , "  duckdb_logical_type arg1,"
+  , "  duckdb_value *arg2,"
+  , "  idx_t arg3"
+  , ")"
+  , "{"
+  , "  return (duckdb_create_array_value)(arg1, arg2, arg3);"
+  , "}"
+  , "duckdb_value hs_bindgen_fa95b21d02a873be ("
+  , "  duckdb_logical_type arg1,"
+  , "  duckdb_value *arg2,"
+  , "  duckdb_value *arg3,"
+  , "  idx_t arg4"
+  , ")"
+  , "{"
+  , "  return (duckdb_create_map_value)(arg1, arg2, arg3, arg4);"
+  , "}"
+  , "duckdb_value hs_bindgen_11c281d6e5e06b0d ("
+  , "  duckdb_logical_type arg1,"
+  , "  idx_t arg2,"
+  , "  duckdb_value arg3"
+  , ")"
+  , "{"
+  , "  return (duckdb_create_union_value)(arg1, arg2, arg3);"
+  , "}"
+  , "idx_t hs_bindgen_997728635cf0ac64 ("
+  , "  duckdb_value arg1"
+  , ")"
+  , "{"
+  , "  return (duckdb_get_map_size)(arg1);"
+  , "}"
+  , "duckdb_value hs_bindgen_4abc412f4cbf3b1c ("
+  , "  duckdb_value arg1,"
+  , "  idx_t arg2"
+  , ")"
+  , "{"
+  , "  return (duckdb_get_map_key)(arg1, arg2);"
+  , "}"
+  , "duckdb_value hs_bindgen_95db52b9cb363226 ("
+  , "  duckdb_value arg1,"
+  , "  idx_t arg2"
+  , ")"
+  , "{"
+  , "  return (duckdb_get_map_value)(arg1, arg2);"
+  , "}"
+  , "_Bool hs_bindgen_816a2cdca59a31ab ("
+  , "  duckdb_value arg1"
+  , ")"
+  , "{"
+  , "  return (duckdb_is_null_value)(arg1);"
+  , "}"
+  , "duckdb_value hs_bindgen_3e293eeed247ba3e (void)"
+  , "{"
+  , "  return (duckdb_create_null_value)();"
+  , "}"
+  , "idx_t hs_bindgen_014e65c8024e4108 ("
+  , "  duckdb_value arg1"
+  , ")"
+  , "{"
+  , "  return (duckdb_get_list_size)(arg1);"
+  , "}"
+  , "duckdb_value hs_bindgen_e73a36f9bfcfe5a0 ("
+  , "  duckdb_value arg1,"
+  , "  idx_t arg2"
+  , ")"
+  , "{"
+  , "  return (duckdb_get_list_child)(arg1, arg2);"
+  , "}"
+  , "duckdb_value hs_bindgen_76712e93d9d2ee84 ("
+  , "  duckdb_logical_type arg1,"
+  , "  uint64_t arg2"
+  , ")"
+  , "{"
+  , "  return (duckdb_create_enum_value)(arg1, arg2);"
+  , "}"
+  , "uint64_t hs_bindgen_f88bdd4fc6a804da ("
+  , "  duckdb_value arg1"
+  , ")"
+  , "{"
+  , "  return (duckdb_get_enum_value)(arg1);"
+  , "}"
+  , "duckdb_value hs_bindgen_bd541a73d7b73adb ("
+  , "  duckdb_value arg1,"
+  , "  idx_t arg2"
+  , ")"
+  , "{"
+  , "  return (duckdb_get_struct_child)(arg1, arg2);"
+  , "}"
+  , "char *hs_bindgen_3154db7693be8381 ("
+  , "  duckdb_value arg1"
+  , ")"
+  , "{"
+  , "  return (duckdb_value_to_string)(arg1);"
+  , "}"
+  , "_Bool hs_bindgen_6b857667aad1bb1a ("
+  , "  duckdb_result *arg1,"
+  , "  idx_t arg2,"
+  , "  idx_t arg3"
+  , ")"
+  , "{"
+  , "  return (duckdb_value_boolean)(arg1, arg2, arg3);"
+  , "}"
+  , "int8_t hs_bindgen_31a9050aade5103f ("
+  , "  duckdb_result *arg1,"
+  , "  idx_t arg2,"
+  , "  idx_t arg3"
+  , ")"
+  , "{"
+  , "  return (duckdb_value_int8)(arg1, arg2, arg3);"
+  , "}"
+  , "int16_t hs_bindgen_8f6b84207e5703cf ("
+  , "  duckdb_result *arg1,"
+  , "  idx_t arg2,"
+  , "  idx_t arg3"
+  , ")"
+  , "{"
+  , "  return (duckdb_value_int16)(arg1, arg2, arg3);"
+  , "}"
+  , "int32_t hs_bindgen_2a73adc304a9275f ("
+  , "  duckdb_result *arg1,"
+  , "  idx_t arg2,"
+  , "  idx_t arg3"
+  , ")"
+  , "{"
+  , "  return (duckdb_value_int32)(arg1, arg2, arg3);"
+  , "}"
+  , "int64_t hs_bindgen_666edda1d74b4198 ("
+  , "  duckdb_result *arg1,"
+  , "  idx_t arg2,"
+  , "  idx_t arg3"
+  , ")"
+  , "{"
+  , "  return (duckdb_value_int64)(arg1, arg2, arg3);"
+  , "}"
+  , "void hs_bindgen_02dd46eda1283da9 ("
+  , "  duckdb_result *arg1,"
+  , "  idx_t arg2,"
+  , "  idx_t arg3,"
+  , "  duckdb_hugeint *arg4"
+  , ")"
+  , "{"
+  , "  *arg4 = (duckdb_value_hugeint)(arg1, arg2, arg3);"
+  , "}"
+  , "void hs_bindgen_3b48fdeb7cde3ab3 ("
+  , "  duckdb_result *arg1,"
+  , "  idx_t arg2,"
+  , "  idx_t arg3,"
+  , "  duckdb_uhugeint *arg4"
+  , ")"
+  , "{"
+  , "  *arg4 = (duckdb_value_uhugeint)(arg1, arg2, arg3);"
+  , "}"
+  , "void hs_bindgen_bc05565e60bda0c6 ("
+  , "  duckdb_result *arg1,"
+  , "  idx_t arg2,"
+  , "  idx_t arg3,"
+  , "  duckdb_decimal *arg4"
+  , ")"
+  , "{"
+  , "  *arg4 = (duckdb_value_decimal)(arg1, arg2, arg3);"
+  , "}"
+  , "uint8_t hs_bindgen_fdfcd21851e7aa44 ("
+  , "  duckdb_result *arg1,"
+  , "  idx_t arg2,"
+  , "  idx_t arg3"
+  , ")"
+  , "{"
+  , "  return (duckdb_value_uint8)(arg1, arg2, arg3);"
+  , "}"
+  , "uint16_t hs_bindgen_33587e7ddcd16a45 ("
+  , "  duckdb_result *arg1,"
+  , "  idx_t arg2,"
+  , "  idx_t arg3"
+  , ")"
+  , "{"
+  , "  return (duckdb_value_uint16)(arg1, arg2, arg3);"
+  , "}"
+  , "uint32_t hs_bindgen_7af7c542181749f0 ("
+  , "  duckdb_result *arg1,"
+  , "  idx_t arg2,"
+  , "  idx_t arg3"
+  , ")"
+  , "{"
+  , "  return (duckdb_value_uint32)(arg1, arg2, arg3);"
+  , "}"
+  , "uint64_t hs_bindgen_30ad3196e505ee32 ("
+  , "  duckdb_result *arg1,"
+  , "  idx_t arg2,"
+  , "  idx_t arg3"
+  , ")"
+  , "{"
+  , "  return (duckdb_value_uint64)(arg1, arg2, arg3);"
+  , "}"
+  , "float hs_bindgen_848e3a7b82d399ae ("
+  , "  duckdb_result *arg1,"
+  , "  idx_t arg2,"
+  , "  idx_t arg3"
+  , ")"
+  , "{"
+  , "  return (duckdb_value_float)(arg1, arg2, arg3);"
+  , "}"
+  , "double hs_bindgen_80756391f00963b4 ("
+  , "  duckdb_result *arg1,"
+  , "  idx_t arg2,"
+  , "  idx_t arg3"
+  , ")"
+  , "{"
+  , "  return (duckdb_value_double)(arg1, arg2, arg3);"
+  , "}"
+  , "void hs_bindgen_b01230d807dca469 ("
+  , "  duckdb_result *arg1,"
+  , "  idx_t arg2,"
+  , "  idx_t arg3,"
+  , "  duckdb_date *arg4"
+  , ")"
+  , "{"
+  , "  *arg4 = (duckdb_value_date)(arg1, arg2, arg3);"
+  , "}"
+  , "void hs_bindgen_18390c0158b2c517 ("
+  , "  duckdb_result *arg1,"
+  , "  idx_t arg2,"
+  , "  idx_t arg3,"
+  , "  duckdb_time *arg4"
+  , ")"
+  , "{"
+  , "  *arg4 = (duckdb_value_time)(arg1, arg2, arg3);"
+  , "}"
+  , "void hs_bindgen_bd4e0af7e013790b ("
+  , "  duckdb_result *arg1,"
+  , "  idx_t arg2,"
+  , "  idx_t arg3,"
+  , "  duckdb_timestamp *arg4"
+  , ")"
+  , "{"
+  , "  *arg4 = (duckdb_value_timestamp)(arg1, arg2, arg3);"
+  , "}"
+  , "void hs_bindgen_646a763945377be5 ("
+  , "  duckdb_result *arg1,"
+  , "  idx_t arg2,"
+  , "  idx_t arg3,"
+  , "  duckdb_interval *arg4"
+  , ")"
+  , "{"
+  , "  *arg4 = (duckdb_value_interval)(arg1, arg2, arg3);"
+  , "}"
+  , "char *hs_bindgen_a9ba2c181c1b3356 ("
+  , "  duckdb_result *arg1,"
+  , "  idx_t arg2,"
+  , "  idx_t arg3"
+  , ")"
+  , "{"
+  , "  return (duckdb_value_varchar)(arg1, arg2, arg3);"
+  , "}"
+  , "void hs_bindgen_13010e42068fb039 ("
+  , "  duckdb_result *arg1,"
+  , "  idx_t arg2,"
+  , "  idx_t arg3,"
+  , "  duckdb_string *arg4"
+  , ")"
+  , "{"
+  , "  *arg4 = (duckdb_value_string)(arg1, arg2, arg3);"
+  , "}"
+  , "char *hs_bindgen_71da9a67e7c01761 ("
+  , "  duckdb_result *arg1,"
+  , "  idx_t arg2,"
+  , "  idx_t arg3"
+  , ")"
+  , "{"
+  , "  return (duckdb_value_varchar_internal)(arg1, arg2, arg3);"
+  , "}"
+  , "void hs_bindgen_65b73058a4eafeaa ("
+  , "  duckdb_result *arg1,"
+  , "  idx_t arg2,"
+  , "  idx_t arg3,"
+  , "  duckdb_string *arg4"
+  , ")"
+  , "{"
+  , "  *arg4 = (duckdb_value_string_internal)(arg1, arg2, arg3);"
+  , "}"
+  , "void hs_bindgen_d9b2a307bf4c994e ("
+  , "  duckdb_result *arg1,"
+  , "  idx_t arg2,"
+  , "  idx_t arg3,"
+  , "  duckdb_blob *arg4"
+  , ")"
+  , "{"
+  , "  *arg4 = (duckdb_value_blob)(arg1, arg2, arg3);"
+  , "}"
+  , "_Bool hs_bindgen_4f187070ae13bdb4 ("
+  , "  duckdb_result *arg1,"
+  , "  idx_t arg2,"
+  , "  idx_t arg3"
+  , ")"
+  , "{"
+  , "  return (duckdb_value_is_null)(arg1, arg2, arg3);"
+  , "}"
+  , "duckdb_vector hs_bindgen_5a72a174d3b35592 ("
+  , "  duckdb_logical_type arg1,"
+  , "  idx_t arg2"
+  , ")"
+  , "{"
+  , "  return (duckdb_create_vector)(arg1, arg2);"
+  , "}"
+  , "void hs_bindgen_b7d6d6c4c6a20da5 ("
+  , "  duckdb_vector *arg1"
+  , ")"
+  , "{"
+  , "  (duckdb_destroy_vector)(arg1);"
+  , "}"
+  , "duckdb_logical_type hs_bindgen_cf2be23e58c169ae ("
+  , "  duckdb_vector arg1"
+  , ")"
+  , "{"
+  , "  return (duckdb_vector_get_column_type)(arg1);"
+  , "}"
+  , "void *hs_bindgen_07e2e0f2f46d24a5 ("
+  , "  duckdb_vector arg1"
+  , ")"
+  , "{"
+  , "  return (duckdb_vector_get_data)(arg1);"
+  , "}"
+  , "uint64_t *hs_bindgen_28185ea7bb3758c3 ("
+  , "  duckdb_vector arg1"
+  , ")"
+  , "{"
+  , "  return (duckdb_vector_get_validity)(arg1);"
+  , "}"
+  , "void hs_bindgen_77e4922622421a6f ("
+  , "  duckdb_vector arg1"
+  , ")"
+  , "{"
+  , "  (duckdb_vector_ensure_validity_writable)(arg1);"
+  , "}"
+  , "void hs_bindgen_7236c6c4ac76f787 ("
+  , "  duckdb_vector arg1,"
+  , "  idx_t arg2,"
+  , "  char const *arg3"
+  , ")"
+  , "{"
+  , "  (duckdb_vector_assign_string_element)(arg1, arg2, arg3);"
+  , "}"
+  , "void hs_bindgen_d73453c618ddc22f ("
+  , "  duckdb_vector arg1,"
+  , "  idx_t arg2,"
+  , "  char const *arg3,"
+  , "  idx_t arg4"
+  , ")"
+  , "{"
+  , "  (duckdb_vector_assign_string_element_len)(arg1, arg2, arg3, arg4);"
+  , "}"
+  , "void hs_bindgen_17556343e48a077e ("
+  , "  duckdb_vector arg1,"
+  , "  idx_t arg2,"
+  , "  char const *arg3,"
+  , "  idx_t arg4"
+  , ")"
+  , "{"
+  , "  (duckdb_unsafe_vector_assign_string_element_len)(arg1, arg2, arg3, arg4);"
+  , "}"
+  , "duckdb_vector hs_bindgen_b10dc3841ec1d1ad ("
+  , "  duckdb_vector arg1"
+  , ")"
+  , "{"
+  , "  return (duckdb_list_vector_get_child)(arg1);"
+  , "}"
+  , "idx_t hs_bindgen_ec3353c36510d274 ("
+  , "  duckdb_vector arg1"
+  , ")"
+  , "{"
+  , "  return (duckdb_list_vector_get_size)(arg1);"
+  , "}"
+  , "duckdb_state hs_bindgen_87686fe663edd51f ("
+  , "  duckdb_vector arg1,"
+  , "  idx_t arg2"
+  , ")"
+  , "{"
+  , "  return (duckdb_list_vector_set_size)(arg1, arg2);"
+  , "}"
+  , "duckdb_state hs_bindgen_ccc0fe7414005ff4 ("
+  , "  duckdb_vector arg1,"
+  , "  idx_t arg2"
+  , ")"
+  , "{"
+  , "  return (duckdb_list_vector_reserve)(arg1, arg2);"
+  , "}"
+  , "duckdb_vector hs_bindgen_f99a59b3c10f16bc ("
+  , "  duckdb_vector arg1,"
+  , "  idx_t arg2"
+  , ")"
+  , "{"
+  , "  return (duckdb_struct_vector_get_child)(arg1, arg2);"
+  , "}"
+  , "duckdb_vector hs_bindgen_2b6cd48bef7c1c5a ("
+  , "  duckdb_vector arg1"
+  , ")"
+  , "{"
+  , "  return (duckdb_array_vector_get_child)(arg1);"
+  , "}"
+  , "void hs_bindgen_53d9e13117c90e3f ("
+  , "  duckdb_vector arg1,"
+  , "  duckdb_selection_vector arg2,"
+  , "  idx_t arg3"
+  , ")"
+  , "{"
+  , "  (duckdb_slice_vector)(arg1, arg2, arg3);"
+  , "}"
+  , "void hs_bindgen_d572a377573f3568 ("
+  , "  duckdb_vector arg1,"
+  , "  duckdb_vector arg2,"
+  , "  duckdb_selection_vector arg3,"
+  , "  idx_t arg4,"
+  , "  idx_t arg5,"
+  , "  idx_t arg6"
+  , ")"
+  , "{"
+  , "  (duckdb_vector_copy_sel)(arg1, arg2, arg3, arg4, arg5, arg6);"
+  , "}"
+  , "void hs_bindgen_eff3eb026da85750 ("
+  , "  duckdb_vector arg1,"
+  , "  duckdb_value arg2"
+  , ")"
+  , "{"
+  , "  (duckdb_vector_reference_value)(arg1, arg2);"
+  , "}"
+  , "void hs_bindgen_b59dd1dfed56f6d9 ("
+  , "  duckdb_vector arg1,"
+  , "  duckdb_vector arg2"
+  , ")"
+  , "{"
+  , "  (duckdb_vector_reference_vector)(arg1, arg2);"
+  , "}"
+  , "_Bool hs_bindgen_951c8fba6822ef9d ("
+  , "  uint64_t *arg1,"
+  , "  idx_t arg2"
+  , ")"
+  , "{"
+  , "  return (duckdb_validity_row_is_valid)(arg1, arg2);"
+  , "}"
+  , "void hs_bindgen_552c2923fb858ce4 ("
+  , "  uint64_t *arg1,"
+  , "  idx_t arg2,"
+  , "  _Bool arg3"
+  , ")"
+  , "{"
+  , "  (duckdb_validity_set_row_validity)(arg1, arg2, arg3);"
+  , "}"
+  , "void hs_bindgen_9e881366869db236 ("
+  , "  uint64_t *arg1,"
+  , "  idx_t arg2"
+  , ")"
+  , "{"
+  , "  (duckdb_validity_set_row_invalid)(arg1, arg2);"
+  , "}"
+  , "void hs_bindgen_1c76442784687a97 ("
+  , "  uint64_t *arg1,"
+  , "  idx_t arg2"
+  , ")"
+  , "{"
+  , "  (duckdb_validity_set_row_valid)(arg1, arg2);"
+  , "}"
+  , "duckdb_selection_vector hs_bindgen_e0f1c7465a41fac7 ("
+  , "  idx_t arg1"
+  , ")"
+  , "{"
+  , "  return (duckdb_create_selection_vector)(arg1);"
+  , "}"
+  , "void hs_bindgen_131b24a6de70ad66 ("
+  , "  duckdb_selection_vector arg1"
+  , ")"
+  , "{"
+  , "  (duckdb_destroy_selection_vector)(arg1);"
+  , "}"
+  , "sel_t *hs_bindgen_efad6679c4838832 ("
+  , "  duckdb_selection_vector arg1"
+  , ")"
+  , "{"
+  , "  return (duckdb_selection_vector_get_data_ptr)(arg1);"
+  , "}"
+  ]))
+
+{-| The API version this translation unit targets. Define all three to compile against an older surface than the one this header describes.
+
+    __C declaration:__ @macro DUCKDB_API_VERSION_MAJOR@
+
+    __defined at:__ @duckdb.h 71:9@
+
+    __exported by:__ @duckdb.h@
+-}
+dUCKDB_API_VERSION_MAJOR :: BG.CInt
+dUCKDB_API_VERSION_MAJOR = (1 :: BG.CInt)
+
+{-| __C declaration:__ @macro DUCKDB_API_VERSION_MINOR@
+
+    __defined at:__ @duckdb.h 72:9@
+
+    __exported by:__ @duckdb.h@
+-}
+dUCKDB_API_VERSION_MINOR :: BG.CInt
+dUCKDB_API_VERSION_MINOR = (5 :: BG.CInt)
+
+{-| __C declaration:__ @macro DUCKDB_API_VERSION_PATCH@
+
+    __defined at:__ @duckdb.h 73:9@
+
+    __exported by:__ @duckdb.h@
+-}
+dUCKDB_API_VERSION_PATCH :: BG.CInt
+dUCKDB_API_VERSION_PATCH = (6 :: BG.CInt)
+
+{-| Set to 1 to compile the deprecated surface, 0 to omit it. Defaults from the older DUCKDB_API_NO_DEPRECATED macro when that is what the consumer defines.
+
+    __C declaration:__ @macro DUCKDB_API_ALLOW_DEPRECATED@
+
+    __defined at:__ @duckdb.h 96:9@
+
+    __exported by:__ @duckdb.h@
+-}
+dUCKDB_API_ALLOW_DEPRECATED :: BG.CInt
+dUCKDB_API_ALLOW_DEPRECATED = (1 :: BG.CInt)
+
+{-| Set to 1 to compile the unstable surface, 0 to omit it. Defaults from the older DUCKDB_EXTENSION_API_VERSION_UNSTABLE macro when that is what the consumer defines.
+
+    __C declaration:__ @macro DUCKDB_API_ALLOW_UNSTABLE@
+
+    __defined at:__ @duckdb.h 106:9@
+
+    __exported by:__ @duckdb.h@
+-}
+dUCKDB_API_ALLOW_UNSTABLE :: BG.CInt
+dUCKDB_API_ALLOW_UNSTABLE = (0 :: BG.CInt)
+
+{-| __C declaration:__ @struct \@duckdb_string_t_value_pointer@
+
+    __defined at:__ @duckdb.h 128:3@
+
+    __exported by:__ @duckdb.h@
+-}
+data Duckdb_string_t_value_pointer = Duckdb_string_t_value_pointer
+  { length :: HsBindgen.Runtime.LibC.Word32
+    {- ^ __C declaration:__ @length@
+
+         __defined at:__ @duckdb.h 129:13@
+
+         __exported by:__ @duckdb.h@
+    -}
+  , prefix :: CA.ConstantArray 4 BG.CChar
+    {- ^ __C declaration:__ @prefix@
+
+         __defined at:__ @duckdb.h 130:9@
+
+         __exported by:__ @duckdb.h@
+    -}
+  , ptr :: BG.Ptr BG.CChar
+    {- ^ __C declaration:__ @ptr@
+
+         __defined at:__ @duckdb.h 131:10@
+
+         __exported by:__ @duckdb.h@
+    -}
+  }
+  deriving stock (Eq, BG.Generic, Show)
+
+instance Marshal.StaticSize Duckdb_string_t_value_pointer where
+
+  staticSizeOf = \_ -> (16 :: Int)
+
+  staticAlignment = \_ -> (8 :: Int)
+
+instance Marshal.ReadRaw Duckdb_string_t_value_pointer where
+
+  readRaw =
+    \ptr0 ->
+          pure Duckdb_string_t_value_pointer
+      <*> HasCField.readRaw (BG.Proxy @"length") ptr0
+      <*> HasCField.readRaw (BG.Proxy @"prefix") ptr0
+      <*> HasCField.readRaw (BG.Proxy @"ptr") ptr0
+
+instance Marshal.WriteRaw Duckdb_string_t_value_pointer where
+
+  writeRaw =
+    \ptr0 ->
+      \s1 ->
+        case s1 of
+          Duckdb_string_t_value_pointer length2 prefix3 ptr4 ->
+               HasCField.writeRaw (BG.Proxy @"length") ptr0 length2
+            >> HasCField.writeRaw (BG.Proxy @"prefix") ptr0 prefix3
+            >> HasCField.writeRaw (BG.Proxy @"ptr") ptr0 ptr4
+
+deriving via Marshal.EquivStorable Duckdb_string_t_value_pointer instance BG.Storable Duckdb_string_t_value_pointer
+
+deriving via Struct.IsStructViaReadRaw Duckdb_string_t_value_pointer instance Struct.IsStruct Duckdb_string_t_value_pointer
+
+{-| __C declaration:__ @length@
+
+    __defined at:__ @duckdb.h 129:13@
+
+    __exported by:__ @duckdb.h@
+-}
+instance ( ty ~ HsBindgen.Runtime.LibC.Word32
+         ) => BG.CompatHasField.HasField "length" Duckdb_string_t_value_pointer ty where
+
+  hasField =
+    \x0 ->
+      ( \y1 ->
+          Duckdb_string_t_value_pointer {length = y1, prefix = BG.getField @"prefix" x0, ptr = BG.getField @"ptr" x0}
+      , BG.getField @"length" x0
+      )
+
+instance ( ty ~ HsBindgen.Runtime.LibC.Word32
+         ) => BG.HasField "length" (BG.Ptr Duckdb_string_t_value_pointer) (BG.Ptr ty) where
+
+  getField = HasCField.fromPtr (BG.Proxy @"length")
+
+instance HasCField.HasCField Duckdb_string_t_value_pointer "length" where
+
+  type CFieldType Duckdb_string_t_value_pointer "length" =
+    HsBindgen.Runtime.LibC.Word32
+
+  offset# = \_ -> \_ -> 0
+
+{-| __C declaration:__ @prefix@
+
+    __defined at:__ @duckdb.h 130:9@
+
+    __exported by:__ @duckdb.h@
+-}
+instance ( ty ~ CA.ConstantArray 4 BG.CChar
+         ) => BG.CompatHasField.HasField "prefix" Duckdb_string_t_value_pointer ty where
+
+  hasField =
+    \x0 ->
+      ( \y1 ->
+          Duckdb_string_t_value_pointer {prefix = y1, length = BG.getField @"length" x0, ptr = BG.getField @"ptr" x0}
+      , BG.getField @"prefix" x0
+      )
+
+instance ( ty ~ CA.ConstantArray 4 BG.CChar
+         ) => BG.HasField "prefix" (BG.Ptr Duckdb_string_t_value_pointer) (BG.Ptr ty) where
+
+  getField = HasCField.fromPtr (BG.Proxy @"prefix")
+
+instance HasCField.HasCField Duckdb_string_t_value_pointer "prefix" where
+
+  type CFieldType Duckdb_string_t_value_pointer "prefix" =
+    CA.ConstantArray 4 BG.CChar
+
+  offset# = \_ -> \_ -> 4
+
+{-| __C declaration:__ @ptr@
+
+    __defined at:__ @duckdb.h 131:10@
+
+    __exported by:__ @duckdb.h@
+-}
+instance ( ty ~ BG.Ptr BG.CChar
+         ) => BG.CompatHasField.HasField "ptr" Duckdb_string_t_value_pointer ty where
+
+  hasField =
+    \x0 ->
+      ( \y1 ->
+          Duckdb_string_t_value_pointer {ptr = y1, length = BG.getField @"length" x0, prefix = BG.getField @"prefix" x0}
+      , BG.getField @"ptr" x0
+      )
+
+instance ( ty ~ BG.Ptr BG.CChar
+         ) => BG.HasField "ptr" (BG.Ptr Duckdb_string_t_value_pointer) (BG.Ptr ty) where
+
+  getField = HasCField.fromPtr (BG.Proxy @"ptr")
+
+instance HasCField.HasCField Duckdb_string_t_value_pointer "ptr" where
+
+  type CFieldType Duckdb_string_t_value_pointer "ptr" =
+    BG.Ptr BG.CChar
+
+  offset# = \_ -> \_ -> 8
+
+{-| __C declaration:__ @struct \@duckdb_string_t_value_inlined@
+
+    __defined at:__ @duckdb.h 133:3@
+
+    __exported by:__ @duckdb.h@
+-}
+data Duckdb_string_t_value_inlined = Duckdb_string_t_value_inlined
+  { length :: HsBindgen.Runtime.LibC.Word32
+    {- ^ __C declaration:__ @length@
+
+         __defined at:__ @duckdb.h 134:13@
+
+         __exported by:__ @duckdb.h@
+    -}
+  , inlined :: CA.ConstantArray 12 BG.CChar
+    {- ^ __C declaration:__ @inlined@
+
+         __defined at:__ @duckdb.h 135:9@
+
+         __exported by:__ @duckdb.h@
+    -}
+  }
+  deriving stock (Eq, BG.Generic, Show)
+
+instance Marshal.StaticSize Duckdb_string_t_value_inlined where
+
+  staticSizeOf = \_ -> (16 :: Int)
+
+  staticAlignment = \_ -> (4 :: Int)
+
+instance Marshal.ReadRaw Duckdb_string_t_value_inlined where
+
+  readRaw =
+    \ptr0 ->
+          pure Duckdb_string_t_value_inlined
+      <*> HasCField.readRaw (BG.Proxy @"length") ptr0
+      <*> HasCField.readRaw (BG.Proxy @"inlined") ptr0
+
+instance Marshal.WriteRaw Duckdb_string_t_value_inlined where
+
+  writeRaw =
+    \ptr0 ->
+      \s1 ->
+        case s1 of
+          Duckdb_string_t_value_inlined length2 inlined3 ->
+               HasCField.writeRaw (BG.Proxy @"length") ptr0 length2
+            >> HasCField.writeRaw (BG.Proxy @"inlined") ptr0 inlined3
+
+deriving via Marshal.EquivStorable Duckdb_string_t_value_inlined instance BG.Storable Duckdb_string_t_value_inlined
+
+deriving via Struct.IsStructViaReadRaw Duckdb_string_t_value_inlined instance Struct.IsStruct Duckdb_string_t_value_inlined
+
+{-| __C declaration:__ @length@
+
+    __defined at:__ @duckdb.h 134:13@
+
+    __exported by:__ @duckdb.h@
+-}
+instance ( ty ~ HsBindgen.Runtime.LibC.Word32
+         ) => BG.CompatHasField.HasField "length" Duckdb_string_t_value_inlined ty where
+
+  hasField =
+    \x0 ->
+      ( \y1 ->
+          Duckdb_string_t_value_inlined {length = y1, inlined = BG.getField @"inlined" x0}
+      , BG.getField @"length" x0
+      )
+
+instance ( ty ~ HsBindgen.Runtime.LibC.Word32
+         ) => BG.HasField "length" (BG.Ptr Duckdb_string_t_value_inlined) (BG.Ptr ty) where
+
+  getField = HasCField.fromPtr (BG.Proxy @"length")
+
+instance HasCField.HasCField Duckdb_string_t_value_inlined "length" where
+
+  type CFieldType Duckdb_string_t_value_inlined "length" =
+    HsBindgen.Runtime.LibC.Word32
+
+  offset# = \_ -> \_ -> 0
+
+{-| __C declaration:__ @inlined@
+
+    __defined at:__ @duckdb.h 135:9@
+
+    __exported by:__ @duckdb.h@
+-}
+instance ( ty ~ CA.ConstantArray 12 BG.CChar
+         ) => BG.CompatHasField.HasField "inlined" Duckdb_string_t_value_inlined ty where
+
+  hasField =
+    \x0 ->
+      ( \y1 ->
+          Duckdb_string_t_value_inlined {inlined = y1, length = BG.getField @"length" x0}
+      , BG.getField @"inlined" x0
+      )
+
+instance ( ty ~ CA.ConstantArray 12 BG.CChar
+         ) => BG.HasField "inlined" (BG.Ptr Duckdb_string_t_value_inlined) (BG.Ptr ty) where
+
+  getField = HasCField.fromPtr (BG.Proxy @"inlined")
+
+instance HasCField.HasCField Duckdb_string_t_value_inlined "inlined" where
+
+  type CFieldType Duckdb_string_t_value_inlined "inlined" =
+    CA.ConstantArray 12 BG.CChar
+
+  offset# = \_ -> \_ -> 4
+
+{-| __C declaration:__ @union \@duckdb_string_t_value@
+
+    __defined at:__ @duckdb.h 127:2@
+
+    __exported by:__ @duckdb.h@
+-}
+newtype Duckdb_string_t_value = Duckdb_string_t_value
+  { unwrap :: BG.ByteArray
+  }
+  deriving stock (BG.Generic)
+
+deriving via BG.SizedByteArray 16 8 instance Marshal.StaticSize Duckdb_string_t_value
+
+deriving via BG.SizedByteArray 16 8 instance Marshal.ReadRaw Duckdb_string_t_value
+
+deriving via BG.SizedByteArray 16 8 instance Marshal.WriteRaw Duckdb_string_t_value
+
+deriving via Marshal.EquivStorable Duckdb_string_t_value instance BG.Storable Duckdb_string_t_value
+
+deriving via BG.SizedByteArray 16 8 instance Union.IsUnion Duckdb_string_t_value
+
+{-| __C declaration:__ @pointer@
+
+    __defined at:__ @duckdb.h 132:5@
+
+    __exported by:__ @duckdb.h@
+-}
+instance ( ty ~ Duckdb_string_t_value_pointer
+         ) => BG.HasField "pointer" Duckdb_string_t_value ty where
+
+  getField = BG.getUnionPayload
+
+{-| __C declaration:__ @pointer@
+
+    __defined at:__ @duckdb.h 132:5@
+
+    __exported by:__ @duckdb.h@
+-}
+instance ( ty ~ Duckdb_string_t_value_pointer
+         ) => BG.CompatHasField.HasField "pointer" Duckdb_string_t_value ty where
+
+  hasField =
+    \x0 ->
+      (\y1 ->
+         BG.setUnionPayload y1 x0, BG.getField @"pointer" x0)
+
+instance ( ty ~ Duckdb_string_t_value_pointer
+         ) => BG.HasField "pointer" (BG.Ptr Duckdb_string_t_value) (BG.Ptr ty) where
+
+  getField = HasCField.fromPtr (BG.Proxy @"pointer")
+
+instance HasCField.HasCField Duckdb_string_t_value "pointer" where
+
+  type CFieldType Duckdb_string_t_value "pointer" =
+    Duckdb_string_t_value_pointer
+
+  offset# = \_ -> \_ -> 0
+
+{-| __C declaration:__ @inlined@
+
+    __defined at:__ @duckdb.h 136:5@
+
+    __exported by:__ @duckdb.h@
+-}
+instance ( ty ~ Duckdb_string_t_value_inlined
+         ) => BG.HasField "inlined" Duckdb_string_t_value ty where
+
+  getField = BG.getUnionPayload
+
+{-| __C declaration:__ @inlined@
+
+    __defined at:__ @duckdb.h 136:5@
+
+    __exported by:__ @duckdb.h@
+-}
+instance ( ty ~ Duckdb_string_t_value_inlined
+         ) => BG.CompatHasField.HasField "inlined" Duckdb_string_t_value ty where
+
+  hasField =
+    \x0 ->
+      (\y1 ->
+         BG.setUnionPayload y1 x0, BG.getField @"inlined" x0)
+
+instance ( ty ~ Duckdb_string_t_value_inlined
+         ) => BG.HasField "inlined" (BG.Ptr Duckdb_string_t_value) (BG.Ptr ty) where
+
+  getField = HasCField.fromPtr (BG.Proxy @"inlined")
+
+instance HasCField.HasCField Duckdb_string_t_value "inlined" where
+
+  type CFieldType Duckdb_string_t_value "inlined" =
+    Duckdb_string_t_value_inlined
+
+  offset# = \_ -> \_ -> 0
+
+{-| The unstable surface is not a promise, so it is not part of any released version: its constructs may change shape or vanish. Targeting an older version while opting into it would hand back today\'s shapes under names that version never promised, so the two are mutually exclusive.
+
+    The internal representation of a VARCHAR (string_t). If the VARCHAR does not exceed 12 characters, then we inline it. Otherwise, we inline a four-byte prefix for faster string comparisons and store a pointer to the remaining characters. This is a non- owning structure, i.e., it does not have to be freed.
+
+    __C declaration:__ @struct duckdb_string_t@
+
+    __defined at:__ @duckdb.h 126:9@
+
+    __exported by:__ @duckdb.h@
+-}
+data DuckDBStringT = DuckDBStringT
+  { value :: Duckdb_string_t_value
+    {- ^ __C declaration:__ @value@
+
+         __defined at:__ @duckdb.h 137:4@
+
+         __exported by:__ @duckdb.h@
+    -}
+  }
+  deriving stock (BG.Generic)
+
+instance Marshal.StaticSize DuckDBStringT where
+
+  staticSizeOf = \_ -> (16 :: Int)
+
+  staticAlignment = \_ -> (8 :: Int)
+
+instance Marshal.ReadRaw DuckDBStringT where
+
+  readRaw =
+    \ptr0 ->
+          pure DuckDBStringT
+      <*> HasCField.readRaw (BG.Proxy @"value") ptr0
+
+instance Marshal.WriteRaw DuckDBStringT where
+
+  writeRaw =
+    \ptr0 ->
+      \s1 ->
+        case s1 of
+          DuckDBStringT value2 ->
+            HasCField.writeRaw (BG.Proxy @"value") ptr0 value2
+
+deriving via Marshal.EquivStorable DuckDBStringT instance BG.Storable DuckDBStringT
+
+deriving via Struct.IsStructViaReadRaw DuckDBStringT instance Struct.IsStruct DuckDBStringT
+
+{-| __C declaration:__ @value@
+
+    __defined at:__ @duckdb.h 137:4@
+
+    __exported by:__ @duckdb.h@
+-}
+instance ( ty ~ Duckdb_string_t_value
+         ) => BG.CompatHasField.HasField "value" DuckDBStringT ty where
+
+  hasField =
+    \x0 ->
+      (\y1 ->
+         DuckDBStringT {value = y1}, BG.getField @"value" x0)
+
+instance ( ty ~ Duckdb_string_t_value
+         ) => BG.HasField "value" (BG.Ptr DuckDBStringT) (BG.Ptr ty) where
+
+  getField = HasCField.fromPtr (BG.Proxy @"value")
+
+instance HasCField.HasCField DuckDBStringT "value" where
+
+  type CFieldType DuckDBStringT "value" =
+    Duckdb_string_t_value
+
+  offset# = \_ -> \_ -> 0
+
+{-| The returned state of different functions. Legacy naming: values use DuckDB prefix without underscore.
+
+    __C declaration:__ @enum duckdb_state@
+
+    __defined at:__ @duckdb.h 141:14@
+
+    __exported by:__ @duckdb.h@
+-}
+newtype DuckDBState = DuckDBState
+  { unwrap :: BG.CUInt
+  }
+  deriving stock (Eq, BG.Generic, Ord)
+  deriving newtype (BG.HasFFIType)
+
+instance Marshal.StaticSize DuckDBState where
+
+  staticSizeOf = \_ -> (4 :: Int)
+
+  staticAlignment = \_ -> (4 :: Int)
+
+instance Marshal.ReadRaw DuckDBState where
+
+  readRaw =
+    \ptr0 ->
+          pure DuckDBState
+      <*> Marshal.readRawByteOff ptr0 (0 :: Int)
+
+instance Marshal.WriteRaw DuckDBState where
+
+  writeRaw =
+    \ptr0 ->
+      \s1 ->
+        case s1 of
+          DuckDBState unwrap2 ->
+            Marshal.writeRawByteOff ptr0 (0 :: Int) unwrap2
+
+deriving via Marshal.EquivStorable DuckDBState instance BG.Storable DuckDBState
+
+deriving via BG.CUInt instance BG.Prim DuckDBState
+
+instance CEnum.CEnum DuckDBState where
+
+  type CEnumZ DuckDBState = BG.CUInt
+
+  toCEnum = DuckDBState
+
+  fromCEnum = BG.getField @"unwrap"
+
+  declaredValues =
+    \_ ->
+      CEnum.declaredValuesFromList [(0, BG.singleton "DuckDBSuccess"), (1, BG.singleton "DuckDBError")]
+
+  showsUndeclared =
+    CEnum.showsWrappedUndeclared "DuckDBState"
+
+  readPrecUndeclared =
+    CEnum.readPrecWrappedUndeclared "DuckDBState"
+
+  isDeclared = CEnum.seqIsDeclared
+
+  mkDeclared = CEnum.seqMkDeclared
+
+instance CEnum.SequentialCEnum DuckDBState where
+
+  minDeclaredValue = DuckDBSuccess
+
+  maxDeclaredValue = DuckDBError
+
+instance Show DuckDBState where
+
+  showsPrec = CEnum.shows
+
+instance Read DuckDBState where
+
+  readPrec = CEnum.readPrec
+
+  readList = BG.readListDefault
+
+  readListPrec = BG.readListPrecDefault
+
+instance ( ty ~ BG.CUInt
+         ) => BG.CompatHasField.HasField "unwrap" DuckDBState ty where
+
+  hasField =
+    \x0 ->
+      (\y1 ->
+         DuckDBState {unwrap = y1}, BG.getField @"unwrap" x0)
+
+instance ( ty ~ BG.CUInt
+         ) => BG.HasField "unwrap" (BG.Ptr DuckDBState) (BG.Ptr ty) where
+
+  getField = HasCField.fromPtr (BG.Proxy @"unwrap")
+
+instance HasCField.HasCField DuckDBState "unwrap" where
+
+  type CFieldType DuckDBState "unwrap" = BG.CUInt
+
+  offset# = \_ -> \_ -> 0
+
+{-| __C declaration:__ @DuckDBSuccess@
+
+    __defined at:__ @duckdb.h 141:29@
+
+    __exported by:__ @duckdb.h@
+-}
+pattern DuckDBSuccess :: DuckDBState
+pattern DuckDBSuccess = DuckDBState 0
+
+{-| __C declaration:__ @DuckDBError@
+
+    __defined at:__ @duckdb.h 141:48@
+
+    __exported by:__ @duckdb.h@
+-}
+pattern DuckDBError :: DuckDBState
+pattern DuckDBError = DuckDBState 1
+
+{-| __C declaration:__ @idx_t@
+
+    __defined at:__ @duckdb.h 146:18@
+
+    __exported by:__ @duckdb.h@
+-}
+newtype DuckDBIdx = DuckDBIdx
+  { unwrap :: HsBindgen.Runtime.LibC.Word64
+  }
+  deriving stock (Eq, BG.Generic, Ord, Read, Show)
+  deriving newtype
+    ( BG.Bitfield
+    , BG.Bits
+    , Bounded
+    , Enum
+    , BG.FiniteBits
+    , BG.HasFFIType
+    , Integral
+    , BG.Ix
+    , Num
+    , BG.Prim
+    , Marshal.ReadRaw
+    , Real
+    , Marshal.StaticSize
+    , BG.Storable
+    , Marshal.WriteRaw
+    )
+
+instance ( ty ~ HsBindgen.Runtime.LibC.Word64
+         ) => BG.CompatHasField.HasField "unwrap" DuckDBIdx ty where
+
+  hasField =
+    \x0 ->
+      (\y1 ->
+         DuckDBIdx {unwrap = y1}, BG.getField @"unwrap" x0)
+
+instance ( ty ~ HsBindgen.Runtime.LibC.Word64
+         ) => BG.HasField "unwrap" (BG.Ptr DuckDBIdx) (BG.Ptr ty) where
+
+  getField = HasCField.fromPtr (BG.Proxy @"unwrap")
+
+instance HasCField.HasCField DuckDBIdx "unwrap" where
+
+  type CFieldType DuckDBIdx "unwrap" =
+    HsBindgen.Runtime.LibC.Word64
+
+  offset# = \_ -> \_ -> 0
+
+{-| An enum over DuckDB\'s internal types.
+
+    history:
+
+    * stable: v0.1.0
+
+    __C declaration:__ @enum DUCKDB_TYPE@
+
+    __defined at:__ @duckdb.h 160:14@
+
+    __exported by:__ @duckdb.h@
+-}
+newtype DuckDBType = DuckDBType
+  { unwrap :: BG.CUInt
+  }
+  deriving stock (Eq, BG.Generic, Ord)
+  deriving newtype (BG.HasFFIType)
+
+instance Marshal.StaticSize DuckDBType where
+
+  staticSizeOf = \_ -> (4 :: Int)
+
+  staticAlignment = \_ -> (4 :: Int)
+
+instance Marshal.ReadRaw DuckDBType where
+
+  readRaw =
+    \ptr0 ->
+          pure DuckDBType
+      <*> Marshal.readRawByteOff ptr0 (0 :: Int)
+
+instance Marshal.WriteRaw DuckDBType where
+
+  writeRaw =
+    \ptr0 ->
+      \s1 ->
+        case s1 of
+          DuckDBType unwrap2 ->
+            Marshal.writeRawByteOff ptr0 (0 :: Int) unwrap2
+
+deriving via Marshal.EquivStorable DuckDBType instance BG.Storable DuckDBType
+
+deriving via BG.CUInt instance BG.Prim DuckDBType
+
+instance CEnum.CEnum DuckDBType where
+
+  type CEnumZ DuckDBType = BG.CUInt
+
+  toCEnum = DuckDBType
+
+  fromCEnum = BG.getField @"unwrap"
+
+  declaredValues =
+    \_ ->
+      CEnum.declaredValuesFromList [ (0, BG.singleton "DuckDBTypeInvalid")
+                                   , (1, BG.singleton "DuckDBTypeBoolean")
+                                   , (2, BG.singleton "DuckDBTypeTinyInt")
+                                   , (3, BG.singleton "DuckDBTypeSmallInt")
+                                   , (4, BG.singleton "DuckDBTypeInteger")
+                                   , (5, BG.singleton "DuckDBTypeBigInt")
+                                   , (6, BG.singleton "DuckDBTypeUTinyInt")
+                                   , (7, BG.singleton "DuckDBTypeUSmallInt")
+                                   , (8, BG.singleton "DuckDBTypeUInteger")
+                                   , (9, BG.singleton "DuckDBTypeUBigInt")
+                                   , (10, BG.singleton "DuckDBTypeFloat")
+                                   , (11, BG.singleton "DuckDBTypeDouble")
+                                   , (12, BG.singleton "DuckDBTypeTimestamp")
+                                   , (13, BG.singleton "DuckDBTypeDate")
+                                   , (14, BG.singleton "DuckDBTypeTime")
+                                   , (15, BG.singleton "DuckDBTypeInterval")
+                                   , (16, BG.singleton "DuckDBTypeHugeInt")
+                                   , (17, BG.singleton "DuckDBTypeVarchar")
+                                   , (18, BG.singleton "DuckDBTypeBlob")
+                                   , (19, BG.singleton "DuckDBTypeDecimal")
+                                   , (20, BG.singleton "DuckDBTypeTimestampS")
+                                   , (21, BG.singleton "DuckDBTypeTimestampMs")
+                                   , (22, BG.singleton "DuckDBTypeTimestampNs")
+                                   , (23, BG.singleton "DuckDBTypeEnum")
+                                   , (24, BG.singleton "DuckDBTypeList")
+                                   , (25, BG.singleton "DuckDBTypeStruct")
+                                   , (26, BG.singleton "DuckDBTypeMap")
+                                   , (27, BG.singleton "DuckDBTypeUUID")
+                                   , (28, BG.singleton "DuckDBTypeUnion")
+                                   , (29, BG.singleton "DuckDBTypeBit")
+                                   , (30, BG.singleton "DuckDBTypeTimeTz")
+                                   , (31, BG.singleton "DuckDBTypeTimestampTz")
+                                   , (32, BG.singleton "DuckDBTypeUHugeInt")
+                                   , (33, BG.singleton "DuckDBTypeArray")
+                                   , (34, BG.singleton "DuckDBTypeAny")
+                                   , (35, BG.singleton "DuckDBTypeBigNum")
+                                   , (36, BG.singleton "DuckDBTypeSQLNull")
+                                   , (37, BG.singleton "DuckDBTypeStringLiteral")
+                                   , (38, BG.singleton "DuckDBTypeIntegerLiteral")
+                                   , (39, BG.singleton "DuckDBTypeTimeNs")
+                                   , (40, BG.singleton "DuckDBTypeGeometry")
+                                   , (41, BG.singleton "DuckDBTypeVariant")
+                                   , (42, BG.singleton "DuckDBTypeTimestampTzNs")
+                                   ]
+
+  showsUndeclared =
+    CEnum.showsWrappedUndeclared "DuckDBType"
+
+  readPrecUndeclared =
+    CEnum.readPrecWrappedUndeclared "DuckDBType"
+
+  isDeclared = CEnum.seqIsDeclared
+
+  mkDeclared = CEnum.seqMkDeclared
+
+instance CEnum.SequentialCEnum DuckDBType where
+
+  minDeclaredValue = DuckDBTypeInvalid
+
+  maxDeclaredValue = DuckDBTypeTimestampTzNs
+
+instance Show DuckDBType where
+
+  showsPrec = CEnum.shows
+
+instance Read DuckDBType where
+
+  readPrec = CEnum.readPrec
+
+  readList = BG.readListDefault
+
+  readListPrec = BG.readListPrecDefault
+
+instance ( ty ~ BG.CUInt
+         ) => BG.CompatHasField.HasField "unwrap" DuckDBType ty where
+
+  hasField =
+    \x0 ->
+      (\y1 ->
+         DuckDBType {unwrap = y1}, BG.getField @"unwrap" x0)
+
+instance ( ty ~ BG.CUInt
+         ) => BG.HasField "unwrap" (BG.Ptr DuckDBType) (BG.Ptr ty) where
+
+  getField = HasCField.fromPtr (BG.Proxy @"unwrap")
+
+instance HasCField.HasCField DuckDBType "unwrap" where
+
+  type CFieldType DuckDBType "unwrap" = BG.CUInt
+
+  offset# = \_ -> \_ -> 0
+
+{-| __C declaration:__ @DUCKDB_TYPE_INVALID@
+
+    __defined at:__ @duckdb.h 161:2@
+
+    __exported by:__ @duckdb.h@
+-}
+pattern DuckDBTypeInvalid :: DuckDBType
+pattern DuckDBTypeInvalid = DuckDBType 0
+
+{-| bool
+
+    __C declaration:__ @DUCKDB_TYPE_BOOLEAN@
+
+    __defined at:__ @duckdb.h 164:2@
+
+    __exported by:__ @duckdb.h@
+-}
+pattern DuckDBTypeBoolean :: DuckDBType
+pattern DuckDBTypeBoolean = DuckDBType 1
+
+{-| int8_t
+
+    __C declaration:__ @DUCKDB_TYPE_TINYINT@
+
+    __defined at:__ @duckdb.h 167:2@
+
+    __exported by:__ @duckdb.h@
+-}
+pattern DuckDBTypeTinyInt :: DuckDBType
+pattern DuckDBTypeTinyInt = DuckDBType 2
+
+{-| int16_t
+
+    __C declaration:__ @DUCKDB_TYPE_SMALLINT@
+
+    __defined at:__ @duckdb.h 170:2@
+
+    __exported by:__ @duckdb.h@
+-}
+pattern DuckDBTypeSmallInt :: DuckDBType
+pattern DuckDBTypeSmallInt = DuckDBType 3
+
+{-| int32_t
+
+    __C declaration:__ @DUCKDB_TYPE_INTEGER@
+
+    __defined at:__ @duckdb.h 173:2@
+
+    __exported by:__ @duckdb.h@
+-}
+pattern DuckDBTypeInteger :: DuckDBType
+pattern DuckDBTypeInteger = DuckDBType 4
+
+{-| int64_t
+
+    __C declaration:__ @DUCKDB_TYPE_BIGINT@
+
+    __defined at:__ @duckdb.h 176:2@
+
+    __exported by:__ @duckdb.h@
+-}
+pattern DuckDBTypeBigInt :: DuckDBType
+pattern DuckDBTypeBigInt = DuckDBType 5
+
+{-| uint8_t
+
+    __C declaration:__ @DUCKDB_TYPE_UTINYINT@
+
+    __defined at:__ @duckdb.h 179:2@
+
+    __exported by:__ @duckdb.h@
+-}
+pattern DuckDBTypeUTinyInt :: DuckDBType
+pattern DuckDBTypeUTinyInt = DuckDBType 6
+
+{-| uint16_t
+
+    __C declaration:__ @DUCKDB_TYPE_USMALLINT@
+
+    __defined at:__ @duckdb.h 182:2@
+
+    __exported by:__ @duckdb.h@
+-}
+pattern DuckDBTypeUSmallInt :: DuckDBType
+pattern DuckDBTypeUSmallInt = DuckDBType 7
+
+{-| uint32_t
+
+    __C declaration:__ @DUCKDB_TYPE_UINTEGER@
+
+    __defined at:__ @duckdb.h 185:2@
+
+    __exported by:__ @duckdb.h@
+-}
+pattern DuckDBTypeUInteger :: DuckDBType
+pattern DuckDBTypeUInteger = DuckDBType 8
+
+{-| uint64_t
+
+    __C declaration:__ @DUCKDB_TYPE_UBIGINT@
+
+    __defined at:__ @duckdb.h 188:2@
+
+    __exported by:__ @duckdb.h@
+-}
+pattern DuckDBTypeUBigInt :: DuckDBType
+pattern DuckDBTypeUBigInt = DuckDBType 9
+
+{-| float
+
+    __C declaration:__ @DUCKDB_TYPE_FLOAT@
+
+    __defined at:__ @duckdb.h 191:2@
+
+    __exported by:__ @duckdb.h@
+-}
+pattern DuckDBTypeFloat :: DuckDBType
+pattern DuckDBTypeFloat = DuckDBType 10
+
+{-| double
+
+    __C declaration:__ @DUCKDB_TYPE_DOUBLE@
+
+    __defined at:__ @duckdb.h 194:2@
+
+    __exported by:__ @duckdb.h@
+-}
+pattern DuckDBTypeDouble :: DuckDBType
+pattern DuckDBTypeDouble = DuckDBType 11
+
+{-| t'DuckDBTimestamp' (microseconds)
+
+    __C declaration:__ @DUCKDB_TYPE_TIMESTAMP@
+
+    __defined at:__ @duckdb.h 197:2@
+
+    __exported by:__ @duckdb.h@
+-}
+pattern DuckDBTypeTimestamp :: DuckDBType
+pattern DuckDBTypeTimestamp = DuckDBType 12
+
+{-| t'DuckDBDate'
+
+    __C declaration:__ @DUCKDB_TYPE_DATE@
+
+    __defined at:__ @duckdb.h 200:2@
+
+    __exported by:__ @duckdb.h@
+-}
+pattern DuckDBTypeDate :: DuckDBType
+pattern DuckDBTypeDate = DuckDBType 13
+
+{-| t'DuckDBTime'
+
+    __C declaration:__ @DUCKDB_TYPE_TIME@
+
+    __defined at:__ @duckdb.h 203:2@
+
+    __exported by:__ @duckdb.h@
+-}
+pattern DuckDBTypeTime :: DuckDBType
+pattern DuckDBTypeTime = DuckDBType 14
+
+{-| t'DuckDBInterval'
+
+    __C declaration:__ @DUCKDB_TYPE_INTERVAL@
+
+    __defined at:__ @duckdb.h 206:2@
+
+    __exported by:__ @duckdb.h@
+-}
+pattern DuckDBTypeInterval :: DuckDBType
+pattern DuckDBTypeInterval = DuckDBType 15
+
+{-| t'DuckDBHugeInt'
+
+    __C declaration:__ @DUCKDB_TYPE_HUGEINT@
+
+    __defined at:__ @duckdb.h 209:2@
+
+    __exported by:__ @duckdb.h@
+-}
+pattern DuckDBTypeHugeInt :: DuckDBType
+pattern DuckDBTypeHugeInt = DuckDBType 16
+
+{-| const char*
+
+    __C declaration:__ @DUCKDB_TYPE_VARCHAR@
+
+    __defined at:__ @duckdb.h 212:2@
+
+    __exported by:__ @duckdb.h@
+-}
+pattern DuckDBTypeVarchar :: DuckDBType
+pattern DuckDBTypeVarchar = DuckDBType 17
+
+{-| t'DuckDBBlob'
+
+    __C declaration:__ @DUCKDB_TYPE_BLOB@
+
+    __defined at:__ @duckdb.h 215:2@
+
+    __exported by:__ @duckdb.h@
+-}
+pattern DuckDBTypeBlob :: DuckDBType
+pattern DuckDBTypeBlob = DuckDBType 18
+
+{-| t'DuckDBDecimal'
+
+    __C declaration:__ @DUCKDB_TYPE_DECIMAL@
+
+    __defined at:__ @duckdb.h 218:2@
+
+    __exported by:__ @duckdb.h@
+-}
+pattern DuckDBTypeDecimal :: DuckDBType
+pattern DuckDBTypeDecimal = DuckDBType 19
+
+{-| t'DuckDBTimestampS' (seconds)
+
+    __C declaration:__ @DUCKDB_TYPE_TIMESTAMP_S@
+
+    __defined at:__ @duckdb.h 221:2@
+
+    __exported by:__ @duckdb.h@
+-}
+pattern DuckDBTypeTimestampS :: DuckDBType
+pattern DuckDBTypeTimestampS = DuckDBType 20
+
+{-| t'DuckDBTimestampMs' (milliseconds)
+
+    __C declaration:__ @DUCKDB_TYPE_TIMESTAMP_MS@
+
+    __defined at:__ @duckdb.h 224:2@
+
+    __exported by:__ @duckdb.h@
+-}
+pattern DuckDBTypeTimestampMs :: DuckDBType
+pattern DuckDBTypeTimestampMs = DuckDBType 21
+
+{-| t'DuckDBTimestampNs' (nanoseconds)
+
+    __C declaration:__ @DUCKDB_TYPE_TIMESTAMP_NS@
+
+    __defined at:__ @duckdb.h 227:2@
+
+    __exported by:__ @duckdb.h@
+-}
+pattern DuckDBTypeTimestampNs :: DuckDBType
+pattern DuckDBTypeTimestampNs = DuckDBType 22
+
+{-| enum type, only useful as logical type
+
+    __C declaration:__ @DUCKDB_TYPE_ENUM@
+
+    __defined at:__ @duckdb.h 230:2@
+
+    __exported by:__ @duckdb.h@
+-}
+pattern DuckDBTypeEnum :: DuckDBType
+pattern DuckDBTypeEnum = DuckDBType 23
+
+{-| list type, only useful as logical type
+
+    __C declaration:__ @DUCKDB_TYPE_LIST@
+
+    __defined at:__ @duckdb.h 233:2@
+
+    __exported by:__ @duckdb.h@
+-}
+pattern DuckDBTypeList :: DuckDBType
+pattern DuckDBTypeList = DuckDBType 24
+
+{-| struct type, only useful as logical type
+
+    __C declaration:__ @DUCKDB_TYPE_STRUCT@
+
+    __defined at:__ @duckdb.h 236:2@
+
+    __exported by:__ @duckdb.h@
+-}
+pattern DuckDBTypeStruct :: DuckDBType
+pattern DuckDBTypeStruct = DuckDBType 25
+
+{-| map type, only useful as logical type
+
+    __C declaration:__ @DUCKDB_TYPE_MAP@
+
+    __defined at:__ @duckdb.h 239:2@
+
+    __exported by:__ @duckdb.h@
+-}
+pattern DuckDBTypeMap :: DuckDBType
+pattern DuckDBTypeMap = DuckDBType 26
+
+{-| t'DuckDBHugeInt'
+
+    __C declaration:__ @DUCKDB_TYPE_UUID@
+
+    __defined at:__ @duckdb.h 242:2@
+
+    __exported by:__ @duckdb.h@
+-}
+pattern DuckDBTypeUUID :: DuckDBType
+pattern DuckDBTypeUUID = DuckDBType 27
+
+{-| union type, only useful as logical type
+
+    __C declaration:__ @DUCKDB_TYPE_UNION@
+
+    __defined at:__ @duckdb.h 245:2@
+
+    __exported by:__ @duckdb.h@
+-}
+pattern DuckDBTypeUnion :: DuckDBType
+pattern DuckDBTypeUnion = DuckDBType 28
+
+{-| t'DuckDBBit'
+
+    __C declaration:__ @DUCKDB_TYPE_BIT@
+
+    __defined at:__ @duckdb.h 248:2@
+
+    __exported by:__ @duckdb.h@
+-}
+pattern DuckDBTypeBit :: DuckDBType
+pattern DuckDBTypeBit = DuckDBType 29
+
+{-| t'DuckDBTimeTz'
+
+    __C declaration:__ @DUCKDB_TYPE_TIME_TZ@
+
+    __defined at:__ @duckdb.h 251:2@
+
+    __exported by:__ @duckdb.h@
+-}
+pattern DuckDBTypeTimeTz :: DuckDBType
+pattern DuckDBTypeTimeTz = DuckDBType 30
+
+{-| t'DuckDBTimestamp' (microseconds)
+
+    __C declaration:__ @DUCKDB_TYPE_TIMESTAMP_TZ@
+
+    __defined at:__ @duckdb.h 254:2@
+
+    __exported by:__ @duckdb.h@
+-}
+pattern DuckDBTypeTimestampTz :: DuckDBType
+pattern DuckDBTypeTimestampTz = DuckDBType 31
+
+{-| t'DuckDBUHugeInt'
+
+    __C declaration:__ @DUCKDB_TYPE_UHUGEINT@
+
+    __defined at:__ @duckdb.h 257:2@
+
+    __exported by:__ @duckdb.h@
+-}
+pattern DuckDBTypeUHugeInt :: DuckDBType
+pattern DuckDBTypeUHugeInt = DuckDBType 32
+
+{-| duckdb_array, only useful as logical type
+
+    __C declaration:__ @DUCKDB_TYPE_ARRAY@
+
+    __defined at:__ @duckdb.h 260:2@
+
+    __exported by:__ @duckdb.h@
+-}
+pattern DuckDBTypeArray :: DuckDBType
+pattern DuckDBTypeArray = DuckDBType 33
+
+{-| enum type, only useful as logical type
+
+    __C declaration:__ @DUCKDB_TYPE_ANY@
+
+    __defined at:__ @duckdb.h 263:2@
+
+    __exported by:__ @duckdb.h@
+-}
+pattern DuckDBTypeAny :: DuckDBType
+pattern DuckDBTypeAny = DuckDBType 34
+
+{-| t'DuckDBBignum'
+
+    __C declaration:__ @DUCKDB_TYPE_BIGNUM@
+
+    __defined at:__ @duckdb.h 266:2@
+
+    __exported by:__ @duckdb.h@
+-}
+pattern DuckDBTypeBigNum :: DuckDBType
+pattern DuckDBTypeBigNum = DuckDBType 35
+
+{-| enum type, only useful as logical type
+
+    __C declaration:__ @DUCKDB_TYPE_SQLNULL@
+
+    __defined at:__ @duckdb.h 269:2@
+
+    __exported by:__ @duckdb.h@
+-}
+pattern DuckDBTypeSQLNull :: DuckDBType
+pattern DuckDBTypeSQLNull = DuckDBType 36
+
+{-| enum type, only useful as logical type
+
+    __C declaration:__ @DUCKDB_TYPE_STRING_LITERAL@
+
+    __defined at:__ @duckdb.h 272:2@
+
+    __exported by:__ @duckdb.h@
+-}
+pattern DuckDBTypeStringLiteral :: DuckDBType
+pattern DuckDBTypeStringLiteral = DuckDBType 37
+
+{-| enum type, only useful as logical type
+
+    __C declaration:__ @DUCKDB_TYPE_INTEGER_LITERAL@
+
+    __defined at:__ @duckdb.h 275:2@
+
+    __exported by:__ @duckdb.h@
+-}
+pattern DuckDBTypeIntegerLiteral :: DuckDBType
+pattern DuckDBTypeIntegerLiteral = DuckDBType 38
+
+{-| t'DuckDBTimeNs' (nanoseconds)
+
+    __C declaration:__ @DUCKDB_TYPE_TIME_NS@
+
+    __defined at:__ @duckdb.h 278:2@
+
+    __exported by:__ @duckdb.h@
+-}
+pattern DuckDBTypeTimeNs :: DuckDBType
+pattern DuckDBTypeTimeNs = DuckDBType 39
+
+{-| GEOMETRY type, WKB blob.
+
+    __C declaration:__ @DUCKDB_TYPE_GEOMETRY@
+
+    __defined at:__ @duckdb.h 281:2@
+
+    __exported by:__ @duckdb.h@
+-}
+pattern DuckDBTypeGeometry :: DuckDBType
+pattern DuckDBTypeGeometry = DuckDBType 40
+
+{-| VARIANT type.
+
+    __C declaration:__ @DUCKDB_TYPE_VARIANT@
+
+    __defined at:__ @duckdb.h 284:2@
+
+    __exported by:__ @duckdb.h@
+-}
+pattern DuckDBTypeVariant :: DuckDBType
+pattern DuckDBTypeVariant = DuckDBType 41
+
+{-| t'DuckDBTimestamp' (nanoseconds)
+
+    __C declaration:__ @DUCKDB_TYPE_TIMESTAMP_TZ_NS@
+
+    __defined at:__ @duckdb.h 287:2@
+
+    __exported by:__ @duckdb.h@
+-}
+pattern DuckDBTypeTimestampTzNs :: DuckDBType
+pattern DuckDBTypeTimestampTzNs = DuckDBType 42
+
+{-| An enum over the pending state of a pending query result.
+
+    history:
+
+    * stable: v0.5.0
+
+    __C declaration:__ @enum duckdb_pending_state@
+
+    __defined at:__ @duckdb.h 296:14@
+
+    __exported by:__ @duckdb.h@
+-}
+newtype DuckDBPendingState = DuckDBPendingState
+  { unwrap :: BG.CUInt
+  }
+  deriving stock (Eq, BG.Generic, Ord)
+  deriving newtype (BG.HasFFIType)
+
+instance Marshal.StaticSize DuckDBPendingState where
+
+  staticSizeOf = \_ -> (4 :: Int)
+
+  staticAlignment = \_ -> (4 :: Int)
+
+instance Marshal.ReadRaw DuckDBPendingState where
+
+  readRaw =
+    \ptr0 ->
+          pure DuckDBPendingState
+      <*> Marshal.readRawByteOff ptr0 (0 :: Int)
+
+instance Marshal.WriteRaw DuckDBPendingState where
+
+  writeRaw =
+    \ptr0 ->
+      \s1 ->
+        case s1 of
+          DuckDBPendingState unwrap2 ->
+            Marshal.writeRawByteOff ptr0 (0 :: Int) unwrap2
+
+deriving via Marshal.EquivStorable DuckDBPendingState instance BG.Storable DuckDBPendingState
+
+deriving via BG.CUInt instance BG.Prim DuckDBPendingState
+
+instance CEnum.CEnum DuckDBPendingState where
+
+  type CEnumZ DuckDBPendingState = BG.CUInt
+
+  toCEnum = DuckDBPendingState
+
+  fromCEnum = BG.getField @"unwrap"
+
+  declaredValues =
+    \_ ->
+      CEnum.declaredValuesFromList [ (0, BG.singleton "DuckDBPendingResultReady")
+                                   , (1, BG.singleton "DuckDBPendingResultNotReady")
+                                   , (2, BG.singleton "DuckDBPendingError")
+                                   , (3, BG.singleton "DuckDBPendingNoTasksAvailable")
+                                   ]
+
+  showsUndeclared =
+    CEnum.showsWrappedUndeclared "DuckDBPendingState"
+
+  readPrecUndeclared =
+    CEnum.readPrecWrappedUndeclared "DuckDBPendingState"
+
+  isDeclared = CEnum.seqIsDeclared
+
+  mkDeclared = CEnum.seqMkDeclared
+
+instance CEnum.SequentialCEnum DuckDBPendingState where
+
+  minDeclaredValue = DuckDBPendingResultReady
+
+  maxDeclaredValue = DuckDBPendingNoTasksAvailable
+
+instance Show DuckDBPendingState where
+
+  showsPrec = CEnum.shows
+
+instance Read DuckDBPendingState where
+
+  readPrec = CEnum.readPrec
+
+  readList = BG.readListDefault
+
+  readListPrec = BG.readListPrecDefault
+
+instance ( ty ~ BG.CUInt
+         ) => BG.CompatHasField.HasField "unwrap" DuckDBPendingState ty where
+
+  hasField =
+    \x0 ->
+      (\y1 ->
+         DuckDBPendingState {unwrap = y1}, BG.getField @"unwrap" x0)
+
+instance ( ty ~ BG.CUInt
+         ) => BG.HasField "unwrap" (BG.Ptr DuckDBPendingState) (BG.Ptr ty) where
+
+  getField = HasCField.fromPtr (BG.Proxy @"unwrap")
+
+instance HasCField.HasCField DuckDBPendingState "unwrap" where
+
+  type CFieldType DuckDBPendingState "unwrap" =
+    BG.CUInt
+
+  offset# = \_ -> \_ -> 0
+
+{-| __C declaration:__ @DUCKDB_PENDING_RESULT_READY@
+
+    __defined at:__ @duckdb.h 297:2@
+
+    __exported by:__ @duckdb.h@
+-}
+pattern DuckDBPendingResultReady :: DuckDBPendingState
+pattern DuckDBPendingResultReady = DuckDBPendingState 0
+
+{-| __C declaration:__ @DUCKDB_PENDING_RESULT_NOT_READY@
+
+    __defined at:__ @duckdb.h 298:2@
+
+    __exported by:__ @duckdb.h@
+-}
+pattern DuckDBPendingResultNotReady :: DuckDBPendingState
+pattern DuckDBPendingResultNotReady = DuckDBPendingState 1
+
+{-| __C declaration:__ @DUCKDB_PENDING_ERROR@
+
+    __defined at:__ @duckdb.h 299:2@
+
+    __exported by:__ @duckdb.h@
+-}
+pattern DuckDBPendingError :: DuckDBPendingState
+pattern DuckDBPendingError = DuckDBPendingState 2
+
+{-| __C declaration:__ @DUCKDB_PENDING_NO_TASKS_AVAILABLE@
+
+    __defined at:__ @duckdb.h 300:2@
+
+    __exported by:__ @duckdb.h@
+-}
+pattern DuckDBPendingNoTasksAvailable :: DuckDBPendingState
+pattern DuckDBPendingNoTasksAvailable = DuckDBPendingState 3
+
+{-| An enum over DuckDB\'s different result types.
+
+    history:
+
+    * stable: v0.10.0
+
+    __C declaration:__ @enum duckdb_result_type@
+
+    __defined at:__ @duckdb.h 309:14@
+
+    __exported by:__ @duckdb.h@
+-}
+newtype DuckDBResultType = DuckDBResultType
+  { unwrap :: BG.CUInt
+  }
+  deriving stock (Eq, BG.Generic, Ord)
+  deriving newtype (BG.HasFFIType)
+
+instance Marshal.StaticSize DuckDBResultType where
+
+  staticSizeOf = \_ -> (4 :: Int)
+
+  staticAlignment = \_ -> (4 :: Int)
+
+instance Marshal.ReadRaw DuckDBResultType where
+
+  readRaw =
+    \ptr0 ->
+          pure DuckDBResultType
+      <*> Marshal.readRawByteOff ptr0 (0 :: Int)
+
+instance Marshal.WriteRaw DuckDBResultType where
+
+  writeRaw =
+    \ptr0 ->
+      \s1 ->
+        case s1 of
+          DuckDBResultType unwrap2 ->
+            Marshal.writeRawByteOff ptr0 (0 :: Int) unwrap2
+
+deriving via Marshal.EquivStorable DuckDBResultType instance BG.Storable DuckDBResultType
+
+deriving via BG.CUInt instance BG.Prim DuckDBResultType
+
+instance CEnum.CEnum DuckDBResultType where
+
+  type CEnumZ DuckDBResultType = BG.CUInt
+
+  toCEnum = DuckDBResultType
+
+  fromCEnum = BG.getField @"unwrap"
+
+  declaredValues =
+    \_ ->
+      CEnum.declaredValuesFromList [ (0, BG.singleton "DuckDBResultTypeInvalid")
+                                   , (1, BG.singleton "DuckDBResultTypeChangedRows")
+                                   , (2, BG.singleton "DuckDBResultTypeNothing")
+                                   , (3, BG.singleton "DuckDBResultTypeQueryResult")
+                                   ]
+
+  showsUndeclared =
+    CEnum.showsWrappedUndeclared "DuckDBResultType"
+
+  readPrecUndeclared =
+    CEnum.readPrecWrappedUndeclared "DuckDBResultType"
+
+  isDeclared = CEnum.seqIsDeclared
+
+  mkDeclared = CEnum.seqMkDeclared
+
+instance CEnum.SequentialCEnum DuckDBResultType where
+
+  minDeclaredValue = DuckDBResultTypeInvalid
+
+  maxDeclaredValue = DuckDBResultTypeQueryResult
+
+instance Show DuckDBResultType where
+
+  showsPrec = CEnum.shows
+
+instance Read DuckDBResultType where
+
+  readPrec = CEnum.readPrec
+
+  readList = BG.readListDefault
+
+  readListPrec = BG.readListPrecDefault
+
+instance ( ty ~ BG.CUInt
+         ) => BG.CompatHasField.HasField "unwrap" DuckDBResultType ty where
+
+  hasField =
+    \x0 ->
+      (\y1 ->
+         DuckDBResultType {unwrap = y1}, BG.getField @"unwrap" x0)
+
+instance ( ty ~ BG.CUInt
+         ) => BG.HasField "unwrap" (BG.Ptr DuckDBResultType) (BG.Ptr ty) where
+
+  getField = HasCField.fromPtr (BG.Proxy @"unwrap")
+
+instance HasCField.HasCField DuckDBResultType "unwrap" where
+
+  type CFieldType DuckDBResultType "unwrap" = BG.CUInt
+
+  offset# = \_ -> \_ -> 0
+
+{-| __C declaration:__ @DUCKDB_RESULT_TYPE_INVALID@
+
+    __defined at:__ @duckdb.h 310:2@
+
+    __exported by:__ @duckdb.h@
+-}
+pattern DuckDBResultTypeInvalid :: DuckDBResultType
+pattern DuckDBResultTypeInvalid = DuckDBResultType 0
+
+{-| __C declaration:__ @DUCKDB_RESULT_TYPE_CHANGED_ROWS@
+
+    __defined at:__ @duckdb.h 311:2@
+
+    __exported by:__ @duckdb.h@
+-}
+pattern DuckDBResultTypeChangedRows :: DuckDBResultType
+pattern DuckDBResultTypeChangedRows = DuckDBResultType 1
+
+{-| __C declaration:__ @DUCKDB_RESULT_TYPE_NOTHING@
+
+    __defined at:__ @duckdb.h 312:2@
+
+    __exported by:__ @duckdb.h@
+-}
+pattern DuckDBResultTypeNothing :: DuckDBResultType
+pattern DuckDBResultTypeNothing = DuckDBResultType 2
+
+{-| __C declaration:__ @DUCKDB_RESULT_TYPE_QUERY_RESULT@
+
+    __defined at:__ @duckdb.h 313:2@
+
+    __exported by:__ @duckdb.h@
+-}
+pattern DuckDBResultTypeQueryResult :: DuckDBResultType
+pattern DuckDBResultTypeQueryResult = DuckDBResultType 3
+
+{-| An enum over DuckDB\'s different statement types.
+
+    history:
+
+    * stable: v0.10.0
+
+    __C declaration:__ @enum duckdb_statement_type@
+
+    __defined at:__ @duckdb.h 322:14@
+
+    __exported by:__ @duckdb.h@
+-}
+newtype DuckDBStatementType = DuckDBStatementType
+  { unwrap :: BG.CUInt
+  }
+  deriving stock (Eq, BG.Generic, Ord)
+  deriving newtype (BG.HasFFIType)
+
+instance Marshal.StaticSize DuckDBStatementType where
+
+  staticSizeOf = \_ -> (4 :: Int)
+
+  staticAlignment = \_ -> (4 :: Int)
+
+instance Marshal.ReadRaw DuckDBStatementType where
+
+  readRaw =
+    \ptr0 ->
+          pure DuckDBStatementType
+      <*> Marshal.readRawByteOff ptr0 (0 :: Int)
+
+instance Marshal.WriteRaw DuckDBStatementType where
+
+  writeRaw =
+    \ptr0 ->
+      \s1 ->
+        case s1 of
+          DuckDBStatementType unwrap2 ->
+            Marshal.writeRawByteOff ptr0 (0 :: Int) unwrap2
+
+deriving via Marshal.EquivStorable DuckDBStatementType instance BG.Storable DuckDBStatementType
+
+deriving via BG.CUInt instance BG.Prim DuckDBStatementType
+
+instance CEnum.CEnum DuckDBStatementType where
+
+  type CEnumZ DuckDBStatementType = BG.CUInt
+
+  toCEnum = DuckDBStatementType
+
+  fromCEnum = BG.getField @"unwrap"
+
+  declaredValues =
+    \_ ->
+      CEnum.declaredValuesFromList [ (0, BG.singleton "DuckDBStatementTypeInvalid")
+                                   , (1, BG.singleton "DuckDBStatementTypeSelect")
+                                   , (2, BG.singleton "DuckDBStatementTypeInsert")
+                                   , (3, BG.singleton "DuckDBStatementTypeUpdate")
+                                   , (4, BG.singleton "DuckDBStatementTypeExplain")
+                                   , (5, BG.singleton "DuckDBStatementTypeDelete")
+                                   , (6, BG.singleton "DuckDBStatementTypePrepare")
+                                   , (7, BG.singleton "DuckDBStatementTypeCreate")
+                                   , (8, BG.singleton "DuckDBStatementTypeExecute")
+                                   , (9, BG.singleton "DuckDBStatementTypeAlter")
+                                   , (10, BG.singleton "DuckDBStatementTypeTransaction")
+                                   , (11, BG.singleton "DuckDBStatementTypeCopy")
+                                   , (12, BG.singleton "DuckDBStatementTypeAnalyze")
+                                   , (13, BG.singleton "DuckDBStatementTypeVariableSet")
+                                   , (14, BG.singleton "DuckDBStatementTypeCreateFunc")
+                                   , (15, BG.singleton "DuckDBStatementTypeDrop")
+                                   , (16, BG.singleton "DuckDBStatementTypeExport")
+                                   , (17, BG.singleton "DuckDBStatementTypePragma")
+                                   , (18, BG.singleton "DuckDBStatementTypeVacuum")
+                                   , (19, BG.singleton "DuckDBStatementTypeCall")
+                                   , (20, BG.singleton "DuckDBStatementTypeSet")
+                                   , (21, BG.singleton "DuckDBStatementTypeLoad")
+                                   , (22, BG.singleton "DuckDBStatementTypeRelation")
+                                   , (23, BG.singleton "DuckDBStatementTypeExtension")
+                                   , (24, BG.singleton "DuckDBStatementTypeLogicalPlan")
+                                   , (25, BG.singleton "DuckDBStatementTypeAttach")
+                                   , (26, BG.singleton "DuckDBStatementTypeDetach")
+                                   , (27, BG.singleton "DuckDBStatementTypeMulti")
+                                   , (28, BG.singleton "DuckDBStatementTypeCopyDatabase")
+                                   , (29, BG.singleton "DuckDBStatementTypeUpdateExtensions")
+                                   , (30, BG.singleton "DuckDBStatementTypeMergeInto")
+                                   ]
+
+  showsUndeclared =
+    CEnum.showsWrappedUndeclared "DuckDBStatementType"
+
+  readPrecUndeclared =
+    CEnum.readPrecWrappedUndeclared "DuckDBStatementType"
+
+  isDeclared = CEnum.seqIsDeclared
+
+  mkDeclared = CEnum.seqMkDeclared
+
+instance CEnum.SequentialCEnum DuckDBStatementType where
+
+  minDeclaredValue = DuckDBStatementTypeInvalid
+
+  maxDeclaredValue = DuckDBStatementTypeMergeInto
+
+instance Show DuckDBStatementType where
+
+  showsPrec = CEnum.shows
+
+instance Read DuckDBStatementType where
+
+  readPrec = CEnum.readPrec
+
+  readList = BG.readListDefault
+
+  readListPrec = BG.readListPrecDefault
+
+instance ( ty ~ BG.CUInt
+         ) => BG.CompatHasField.HasField "unwrap" DuckDBStatementType ty where
+
+  hasField =
+    \x0 ->
+      (\y1 ->
+         DuckDBStatementType {unwrap = y1}, BG.getField @"unwrap" x0)
+
+instance ( ty ~ BG.CUInt
+         ) => BG.HasField "unwrap" (BG.Ptr DuckDBStatementType) (BG.Ptr ty) where
+
+  getField = HasCField.fromPtr (BG.Proxy @"unwrap")
+
+instance HasCField.HasCField DuckDBStatementType "unwrap" where
+
+  type CFieldType DuckDBStatementType "unwrap" =
+    BG.CUInt
+
+  offset# = \_ -> \_ -> 0
+
+{-| __C declaration:__ @DUCKDB_STATEMENT_TYPE_INVALID@
+
+    __defined at:__ @duckdb.h 323:2@
+
+    __exported by:__ @duckdb.h@
+-}
+pattern DuckDBStatementTypeInvalid :: DuckDBStatementType
+pattern DuckDBStatementTypeInvalid = DuckDBStatementType 0
+
+{-| __C declaration:__ @DUCKDB_STATEMENT_TYPE_SELECT@
+
+    __defined at:__ @duckdb.h 324:2@
+
+    __exported by:__ @duckdb.h@
+-}
+pattern DuckDBStatementTypeSelect :: DuckDBStatementType
+pattern DuckDBStatementTypeSelect = DuckDBStatementType 1
+
+{-| __C declaration:__ @DUCKDB_STATEMENT_TYPE_INSERT@
+
+    __defined at:__ @duckdb.h 325:2@
+
+    __exported by:__ @duckdb.h@
+-}
+pattern DuckDBStatementTypeInsert :: DuckDBStatementType
+pattern DuckDBStatementTypeInsert = DuckDBStatementType 2
+
+{-| __C declaration:__ @DUCKDB_STATEMENT_TYPE_UPDATE@
+
+    __defined at:__ @duckdb.h 326:2@
+
+    __exported by:__ @duckdb.h@
+-}
+pattern DuckDBStatementTypeUpdate :: DuckDBStatementType
+pattern DuckDBStatementTypeUpdate = DuckDBStatementType 3
+
+{-| __C declaration:__ @DUCKDB_STATEMENT_TYPE_EXPLAIN@
+
+    __defined at:__ @duckdb.h 327:2@
+
+    __exported by:__ @duckdb.h@
+-}
+pattern DuckDBStatementTypeExplain :: DuckDBStatementType
+pattern DuckDBStatementTypeExplain = DuckDBStatementType 4
+
+{-| __C declaration:__ @DUCKDB_STATEMENT_TYPE_DELETE@
+
+    __defined at:__ @duckdb.h 328:2@
+
+    __exported by:__ @duckdb.h@
+-}
+pattern DuckDBStatementTypeDelete :: DuckDBStatementType
+pattern DuckDBStatementTypeDelete = DuckDBStatementType 5
+
+{-| __C declaration:__ @DUCKDB_STATEMENT_TYPE_PREPARE@
+
+    __defined at:__ @duckdb.h 329:2@
+
+    __exported by:__ @duckdb.h@
+-}
+pattern DuckDBStatementTypePrepare :: DuckDBStatementType
+pattern DuckDBStatementTypePrepare = DuckDBStatementType 6
+
+{-| __C declaration:__ @DUCKDB_STATEMENT_TYPE_CREATE@
+
+    __defined at:__ @duckdb.h 330:2@
+
+    __exported by:__ @duckdb.h@
+-}
+pattern DuckDBStatementTypeCreate :: DuckDBStatementType
+pattern DuckDBStatementTypeCreate = DuckDBStatementType 7
+
+{-| __C declaration:__ @DUCKDB_STATEMENT_TYPE_EXECUTE@
+
+    __defined at:__ @duckdb.h 331:2@
+
+    __exported by:__ @duckdb.h@
+-}
+pattern DuckDBStatementTypeExecute :: DuckDBStatementType
+pattern DuckDBStatementTypeExecute = DuckDBStatementType 8
+
+{-| __C declaration:__ @DUCKDB_STATEMENT_TYPE_ALTER@
+
+    __defined at:__ @duckdb.h 332:2@
+
+    __exported by:__ @duckdb.h@
+-}
+pattern DuckDBStatementTypeAlter :: DuckDBStatementType
+pattern DuckDBStatementTypeAlter = DuckDBStatementType 9
+
+{-| __C declaration:__ @DUCKDB_STATEMENT_TYPE_TRANSACTION@
+
+    __defined at:__ @duckdb.h 333:2@
+
+    __exported by:__ @duckdb.h@
+-}
+pattern DuckDBStatementTypeTransaction :: DuckDBStatementType
+pattern DuckDBStatementTypeTransaction = DuckDBStatementType 10
+
+{-| __C declaration:__ @DUCKDB_STATEMENT_TYPE_COPY@
+
+    __defined at:__ @duckdb.h 334:2@
+
+    __exported by:__ @duckdb.h@
+-}
+pattern DuckDBStatementTypeCopy :: DuckDBStatementType
+pattern DuckDBStatementTypeCopy = DuckDBStatementType 11
+
+{-| __C declaration:__ @DUCKDB_STATEMENT_TYPE_ANALYZE@
+
+    __defined at:__ @duckdb.h 335:2@
+
+    __exported by:__ @duckdb.h@
+-}
+pattern DuckDBStatementTypeAnalyze :: DuckDBStatementType
+pattern DuckDBStatementTypeAnalyze = DuckDBStatementType 12
+
+{-| __C declaration:__ @DUCKDB_STATEMENT_TYPE_VARIABLE_SET@
+
+    __defined at:__ @duckdb.h 336:2@
+
+    __exported by:__ @duckdb.h@
+-}
+pattern DuckDBStatementTypeVariableSet :: DuckDBStatementType
+pattern DuckDBStatementTypeVariableSet = DuckDBStatementType 13
+
+{-| __C declaration:__ @DUCKDB_STATEMENT_TYPE_CREATE_FUNC@
+
+    __defined at:__ @duckdb.h 337:2@
+
+    __exported by:__ @duckdb.h@
+-}
+pattern DuckDBStatementTypeCreateFunc :: DuckDBStatementType
+pattern DuckDBStatementTypeCreateFunc = DuckDBStatementType 14
+
+{-| __C declaration:__ @DUCKDB_STATEMENT_TYPE_DROP@
+
+    __defined at:__ @duckdb.h 338:2@
+
+    __exported by:__ @duckdb.h@
+-}
+pattern DuckDBStatementTypeDrop :: DuckDBStatementType
+pattern DuckDBStatementTypeDrop = DuckDBStatementType 15
+
+{-| __C declaration:__ @DUCKDB_STATEMENT_TYPE_EXPORT@
+
+    __defined at:__ @duckdb.h 339:2@
+
+    __exported by:__ @duckdb.h@
+-}
+pattern DuckDBStatementTypeExport :: DuckDBStatementType
+pattern DuckDBStatementTypeExport = DuckDBStatementType 16
+
+{-| __C declaration:__ @DUCKDB_STATEMENT_TYPE_PRAGMA@
+
+    __defined at:__ @duckdb.h 340:2@
+
+    __exported by:__ @duckdb.h@
+-}
+pattern DuckDBStatementTypePragma :: DuckDBStatementType
+pattern DuckDBStatementTypePragma = DuckDBStatementType 17
+
+{-| __C declaration:__ @DUCKDB_STATEMENT_TYPE_VACUUM@
+
+    __defined at:__ @duckdb.h 341:2@
+
+    __exported by:__ @duckdb.h@
+-}
+pattern DuckDBStatementTypeVacuum :: DuckDBStatementType
+pattern DuckDBStatementTypeVacuum = DuckDBStatementType 18
+
+{-| __C declaration:__ @DUCKDB_STATEMENT_TYPE_CALL@
+
+    __defined at:__ @duckdb.h 342:2@
+
+    __exported by:__ @duckdb.h@
+-}
+pattern DuckDBStatementTypeCall :: DuckDBStatementType
+pattern DuckDBStatementTypeCall = DuckDBStatementType 19
+
+{-| __C declaration:__ @DUCKDB_STATEMENT_TYPE_SET@
+
+    __defined at:__ @duckdb.h 343:2@
+
+    __exported by:__ @duckdb.h@
+-}
+pattern DuckDBStatementTypeSet :: DuckDBStatementType
+pattern DuckDBStatementTypeSet = DuckDBStatementType 20
+
+{-| __C declaration:__ @DUCKDB_STATEMENT_TYPE_LOAD@
+
+    __defined at:__ @duckdb.h 344:2@
+
+    __exported by:__ @duckdb.h@
+-}
+pattern DuckDBStatementTypeLoad :: DuckDBStatementType
+pattern DuckDBStatementTypeLoad = DuckDBStatementType 21
+
+{-| __C declaration:__ @DUCKDB_STATEMENT_TYPE_RELATION@
+
+    __defined at:__ @duckdb.h 345:2@
+
+    __exported by:__ @duckdb.h@
+-}
+pattern DuckDBStatementTypeRelation :: DuckDBStatementType
+pattern DuckDBStatementTypeRelation = DuckDBStatementType 22
+
+{-| __C declaration:__ @DUCKDB_STATEMENT_TYPE_EXTENSION@
+
+    __defined at:__ @duckdb.h 346:2@
+
+    __exported by:__ @duckdb.h@
+-}
+pattern DuckDBStatementTypeExtension :: DuckDBStatementType
+pattern DuckDBStatementTypeExtension = DuckDBStatementType 23
+
+{-| __C declaration:__ @DUCKDB_STATEMENT_TYPE_LOGICAL_PLAN@
+
+    __defined at:__ @duckdb.h 347:2@
+
+    __exported by:__ @duckdb.h@
+-}
+pattern DuckDBStatementTypeLogicalPlan :: DuckDBStatementType
+pattern DuckDBStatementTypeLogicalPlan = DuckDBStatementType 24
+
+{-| __C declaration:__ @DUCKDB_STATEMENT_TYPE_ATTACH@
+
+    __defined at:__ @duckdb.h 348:2@
+
+    __exported by:__ @duckdb.h@
+-}
+pattern DuckDBStatementTypeAttach :: DuckDBStatementType
+pattern DuckDBStatementTypeAttach = DuckDBStatementType 25
+
+{-| __C declaration:__ @DUCKDB_STATEMENT_TYPE_DETACH@
+
+    __defined at:__ @duckdb.h 349:2@
+
+    __exported by:__ @duckdb.h@
+-}
+pattern DuckDBStatementTypeDetach :: DuckDBStatementType
+pattern DuckDBStatementTypeDetach = DuckDBStatementType 26
+
+{-| __C declaration:__ @DUCKDB_STATEMENT_TYPE_MULTI@
+
+    __defined at:__ @duckdb.h 350:2@
+
+    __exported by:__ @duckdb.h@
+-}
+pattern DuckDBStatementTypeMulti :: DuckDBStatementType
+pattern DuckDBStatementTypeMulti = DuckDBStatementType 27
+
+{-| __C declaration:__ @DUCKDB_STATEMENT_TYPE_COPY_DATABASE@
+
+    __defined at:__ @duckdb.h 351:2@
+
+    __exported by:__ @duckdb.h@
+-}
+pattern DuckDBStatementTypeCopyDatabase :: DuckDBStatementType
+pattern DuckDBStatementTypeCopyDatabase = DuckDBStatementType 28
+
+{-| __C declaration:__ @DUCKDB_STATEMENT_TYPE_UPDATE_EXTENSIONS@
+
+    __defined at:__ @duckdb.h 352:2@
+
+    __exported by:__ @duckdb.h@
+-}
+pattern DuckDBStatementTypeUpdateExtensions :: DuckDBStatementType
+pattern DuckDBStatementTypeUpdateExtensions = DuckDBStatementType 29
+
+{-| __C declaration:__ @DUCKDB_STATEMENT_TYPE_MERGE_INTO@
+
+    __defined at:__ @duckdb.h 353:2@
+
+    __exported by:__ @duckdb.h@
+-}
+pattern DuckDBStatementTypeMergeInto :: DuckDBStatementType
+pattern DuckDBStatementTypeMergeInto = DuckDBStatementType 30
+
+{-| An enum over DuckDB\'s different error types.
+
+    history:
+
+    * stable: v1.1.0
+
+    __C declaration:__ @enum duckdb_error_type@
+
+    __defined at:__ @duckdb.h 362:14@
+
+    __exported by:__ @duckdb.h@
+-}
+newtype DuckDBErrorType = DuckDBErrorType
+  { unwrap :: BG.CUInt
+  }
+  deriving stock (Eq, BG.Generic, Ord)
+  deriving newtype (BG.HasFFIType)
+
+instance Marshal.StaticSize DuckDBErrorType where
+
+  staticSizeOf = \_ -> (4 :: Int)
+
+  staticAlignment = \_ -> (4 :: Int)
+
+instance Marshal.ReadRaw DuckDBErrorType where
+
+  readRaw =
+    \ptr0 ->
+          pure DuckDBErrorType
+      <*> Marshal.readRawByteOff ptr0 (0 :: Int)
+
+instance Marshal.WriteRaw DuckDBErrorType where
+
+  writeRaw =
+    \ptr0 ->
+      \s1 ->
+        case s1 of
+          DuckDBErrorType unwrap2 ->
+            Marshal.writeRawByteOff ptr0 (0 :: Int) unwrap2
+
+deriving via Marshal.EquivStorable DuckDBErrorType instance BG.Storable DuckDBErrorType
+
+deriving via BG.CUInt instance BG.Prim DuckDBErrorType
+
+instance CEnum.CEnum DuckDBErrorType where
+
+  type CEnumZ DuckDBErrorType = BG.CUInt
+
+  toCEnum = DuckDBErrorType
+
+  fromCEnum = BG.getField @"unwrap"
+
+  declaredValues =
+    \_ ->
+      CEnum.declaredValuesFromList [ (0, BG.singleton "DuckDBErrorInvalid")
+                                   , (1, BG.singleton "DuckDBErrorOutOfRange")
+                                   , (2, BG.singleton "DuckDBErrorConversion")
+                                   , (3, BG.singleton "DuckDBErrorUnknownType")
+                                   , (4, BG.singleton "DuckDBErrorDecimal")
+                                   , (5, BG.singleton "DuckDBErrorMismatchType")
+                                   , (6, BG.singleton "DuckDBErrorDivideByZero")
+                                   , (7, BG.singleton "DuckDBErrorObjectSize")
+                                   , (8, BG.singleton "DuckDBErrorInvalidType")
+                                   , (9, BG.singleton "DuckDBErrorSerialization")
+                                   , (10, BG.singleton "DuckDBErrorTransaction")
+                                   , (11, BG.singleton "DuckDBErrorNotImplemented")
+                                   , (12, BG.singleton "DuckDBErrorExpression")
+                                   , (13, BG.singleton "DuckDBErrorCatalog")
+                                   , (14, BG.singleton "DuckDBErrorParser")
+                                   , (15, BG.singleton "DuckDBErrorPlanner")
+                                   , (16, BG.singleton "DuckDBErrorScheduler")
+                                   , (17, BG.singleton "DuckDBErrorExecutor")
+                                   , (18, BG.singleton "DuckDBErrorConstraint")
+                                   , (19, BG.singleton "DuckDBErrorIndex")
+                                   , (20, BG.singleton "DuckDBErrorStat")
+                                   , (21, BG.singleton "DuckDBErrorConnection")
+                                   , (22, BG.singleton "DuckDBErrorSyntax")
+                                   , (23, BG.singleton "DuckDBErrorSettings")
+                                   , (24, BG.singleton "DuckDBErrorBinder")
+                                   , (25, BG.singleton "DuckDBErrorNetwork")
+                                   , (26, BG.singleton "DuckDBErrorOptimizer")
+                                   , (27, BG.singleton "DuckDBErrorNullPointer")
+                                   , (28, BG.singleton "DuckDBErrorIO")
+                                   , (29, BG.singleton "DuckDBErrorInterrupt")
+                                   , (30, BG.singleton "DuckDBErrorFatal")
+                                   , (31, BG.singleton "DuckDBErrorInternal")
+                                   , (32, BG.singleton "DuckDBErrorInvalidInput")
+                                   , (33, BG.singleton "DuckDBErrorOutOfMemory")
+                                   , (34, BG.singleton "DuckDBErrorPermission")
+                                   , (35, BG.singleton "DuckDBErrorParameterNotResolved")
+                                   , (36, BG.singleton "DuckDBErrorParameterNotAllowed")
+                                   , (37, BG.singleton "DuckDBErrorDependency")
+                                   , (38, BG.singleton "DuckDBErrorHTTP")
+                                   , (39, BG.singleton "DuckDBErrorMissingExtension")
+                                   , (40, BG.singleton "DuckDBErrorAutoload")
+                                   , (41, BG.singleton "DuckDBErrorSequence")
+                                   , (42, BG.singleton "DuckDBInvalidConfiguration")
+                                   , (43, BG.singleton "DuckDBErrorDataCorruption")
+                                   , (44, BG.singleton "DuckDBErrorResourceInUse")
+                                   ]
+
+  showsUndeclared =
+    CEnum.showsWrappedUndeclared "DuckDBErrorType"
+
+  readPrecUndeclared =
+    CEnum.readPrecWrappedUndeclared "DuckDBErrorType"
+
+  isDeclared = CEnum.seqIsDeclared
+
+  mkDeclared = CEnum.seqMkDeclared
+
+instance CEnum.SequentialCEnum DuckDBErrorType where
+
+  minDeclaredValue = DuckDBErrorInvalid
+
+  maxDeclaredValue = DuckDBErrorResourceInUse
+
+instance Show DuckDBErrorType where
+
+  showsPrec = CEnum.shows
+
+instance Read DuckDBErrorType where
+
+  readPrec = CEnum.readPrec
+
+  readList = BG.readListDefault
+
+  readListPrec = BG.readListPrecDefault
+
+instance ( ty ~ BG.CUInt
+         ) => BG.CompatHasField.HasField "unwrap" DuckDBErrorType ty where
+
+  hasField =
+    \x0 ->
+      (\y1 ->
+         DuckDBErrorType {unwrap = y1}, BG.getField @"unwrap" x0)
+
+instance ( ty ~ BG.CUInt
+         ) => BG.HasField "unwrap" (BG.Ptr DuckDBErrorType) (BG.Ptr ty) where
+
+  getField = HasCField.fromPtr (BG.Proxy @"unwrap")
+
+instance HasCField.HasCField DuckDBErrorType "unwrap" where
+
+  type CFieldType DuckDBErrorType "unwrap" = BG.CUInt
+
+  offset# = \_ -> \_ -> 0
+
+{-| __C declaration:__ @DUCKDB_ERROR_INVALID@
+
+    __defined at:__ @duckdb.h 363:2@
+
+    __exported by:__ @duckdb.h@
+-}
+pattern DuckDBErrorInvalid :: DuckDBErrorType
+pattern DuckDBErrorInvalid = DuckDBErrorType 0
+
+{-| __C declaration:__ @DUCKDB_ERROR_OUT_OF_RANGE@
+
+    __defined at:__ @duckdb.h 364:2@
+
+    __exported by:__ @duckdb.h@
+-}
+pattern DuckDBErrorOutOfRange :: DuckDBErrorType
+pattern DuckDBErrorOutOfRange = DuckDBErrorType 1
+
+{-| __C declaration:__ @DUCKDB_ERROR_CONVERSION@
+
+    __defined at:__ @duckdb.h 365:2@
+
+    __exported by:__ @duckdb.h@
+-}
+pattern DuckDBErrorConversion :: DuckDBErrorType
+pattern DuckDBErrorConversion = DuckDBErrorType 2
+
+{-| __C declaration:__ @DUCKDB_ERROR_UNKNOWN_TYPE@
+
+    __defined at:__ @duckdb.h 366:2@
+
+    __exported by:__ @duckdb.h@
+-}
+pattern DuckDBErrorUnknownType :: DuckDBErrorType
+pattern DuckDBErrorUnknownType = DuckDBErrorType 3
+
+{-| __C declaration:__ @DUCKDB_ERROR_DECIMAL@
+
+    __defined at:__ @duckdb.h 367:2@
+
+    __exported by:__ @duckdb.h@
+-}
+pattern DuckDBErrorDecimal :: DuckDBErrorType
+pattern DuckDBErrorDecimal = DuckDBErrorType 4
+
+{-| __C declaration:__ @DUCKDB_ERROR_MISMATCH_TYPE@
+
+    __defined at:__ @duckdb.h 368:2@
+
+    __exported by:__ @duckdb.h@
+-}
+pattern DuckDBErrorMismatchType :: DuckDBErrorType
+pattern DuckDBErrorMismatchType = DuckDBErrorType 5
+
+{-| __C declaration:__ @DUCKDB_ERROR_DIVIDE_BY_ZERO@
+
+    __defined at:__ @duckdb.h 369:2@
+
+    __exported by:__ @duckdb.h@
+-}
+pattern DuckDBErrorDivideByZero :: DuckDBErrorType
+pattern DuckDBErrorDivideByZero = DuckDBErrorType 6
+
+{-| __C declaration:__ @DUCKDB_ERROR_OBJECT_SIZE@
+
+    __defined at:__ @duckdb.h 370:2@
+
+    __exported by:__ @duckdb.h@
+-}
+pattern DuckDBErrorObjectSize :: DuckDBErrorType
+pattern DuckDBErrorObjectSize = DuckDBErrorType 7
+
+{-| __C declaration:__ @DUCKDB_ERROR_INVALID_TYPE@
+
+    __defined at:__ @duckdb.h 371:2@
+
+    __exported by:__ @duckdb.h@
+-}
+pattern DuckDBErrorInvalidType :: DuckDBErrorType
+pattern DuckDBErrorInvalidType = DuckDBErrorType 8
+
+{-| __C declaration:__ @DUCKDB_ERROR_SERIALIZATION@
+
+    __defined at:__ @duckdb.h 372:2@
+
+    __exported by:__ @duckdb.h@
+-}
+pattern DuckDBErrorSerialization :: DuckDBErrorType
+pattern DuckDBErrorSerialization = DuckDBErrorType 9
+
+{-| __C declaration:__ @DUCKDB_ERROR_TRANSACTION@
+
+    __defined at:__ @duckdb.h 373:2@
+
+    __exported by:__ @duckdb.h@
+-}
+pattern DuckDBErrorTransaction :: DuckDBErrorType
+pattern DuckDBErrorTransaction = DuckDBErrorType 10
+
+{-| __C declaration:__ @DUCKDB_ERROR_NOT_IMPLEMENTED@
+
+    __defined at:__ @duckdb.h 374:2@
+
+    __exported by:__ @duckdb.h@
+-}
+pattern DuckDBErrorNotImplemented :: DuckDBErrorType
+pattern DuckDBErrorNotImplemented = DuckDBErrorType 11
+
+{-| __C declaration:__ @DUCKDB_ERROR_EXPRESSION@
+
+    __defined at:__ @duckdb.h 375:2@
+
+    __exported by:__ @duckdb.h@
+-}
+pattern DuckDBErrorExpression :: DuckDBErrorType
+pattern DuckDBErrorExpression = DuckDBErrorType 12
+
+{-| __C declaration:__ @DUCKDB_ERROR_CATALOG@
+
+    __defined at:__ @duckdb.h 376:2@
+
+    __exported by:__ @duckdb.h@
+-}
+pattern DuckDBErrorCatalog :: DuckDBErrorType
+pattern DuckDBErrorCatalog = DuckDBErrorType 13
+
+{-| __C declaration:__ @DUCKDB_ERROR_PARSER@
+
+    __defined at:__ @duckdb.h 377:2@
+
+    __exported by:__ @duckdb.h@
+-}
+pattern DuckDBErrorParser :: DuckDBErrorType
+pattern DuckDBErrorParser = DuckDBErrorType 14
+
+{-| __C declaration:__ @DUCKDB_ERROR_PLANNER@
+
+    __defined at:__ @duckdb.h 378:2@
+
+    __exported by:__ @duckdb.h@
+-}
+pattern DuckDBErrorPlanner :: DuckDBErrorType
+pattern DuckDBErrorPlanner = DuckDBErrorType 15
+
+{-| __C declaration:__ @DUCKDB_ERROR_SCHEDULER@
+
+    __defined at:__ @duckdb.h 379:2@
+
+    __exported by:__ @duckdb.h@
+-}
+pattern DuckDBErrorScheduler :: DuckDBErrorType
+pattern DuckDBErrorScheduler = DuckDBErrorType 16
+
+{-| __C declaration:__ @DUCKDB_ERROR_EXECUTOR@
+
+    __defined at:__ @duckdb.h 380:2@
+
+    __exported by:__ @duckdb.h@
+-}
+pattern DuckDBErrorExecutor :: DuckDBErrorType
+pattern DuckDBErrorExecutor = DuckDBErrorType 17
+
+{-| __C declaration:__ @DUCKDB_ERROR_CONSTRAINT@
+
+    __defined at:__ @duckdb.h 381:2@
+
+    __exported by:__ @duckdb.h@
+-}
+pattern DuckDBErrorConstraint :: DuckDBErrorType
+pattern DuckDBErrorConstraint = DuckDBErrorType 18
+
+{-| __C declaration:__ @DUCKDB_ERROR_INDEX@
+
+    __defined at:__ @duckdb.h 382:2@
+
+    __exported by:__ @duckdb.h@
+-}
+pattern DuckDBErrorIndex :: DuckDBErrorType
+pattern DuckDBErrorIndex = DuckDBErrorType 19
+
+{-| __C declaration:__ @DUCKDB_ERROR_STAT@
+
+    __defined at:__ @duckdb.h 383:2@
+
+    __exported by:__ @duckdb.h@
+-}
+pattern DuckDBErrorStat :: DuckDBErrorType
+pattern DuckDBErrorStat = DuckDBErrorType 20
+
+{-| __C declaration:__ @DUCKDB_ERROR_CONNECTION@
+
+    __defined at:__ @duckdb.h 384:2@
+
+    __exported by:__ @duckdb.h@
+-}
+pattern DuckDBErrorConnection :: DuckDBErrorType
+pattern DuckDBErrorConnection = DuckDBErrorType 21
+
+{-| __C declaration:__ @DUCKDB_ERROR_SYNTAX@
+
+    __defined at:__ @duckdb.h 385:2@
+
+    __exported by:__ @duckdb.h@
+-}
+pattern DuckDBErrorSyntax :: DuckDBErrorType
+pattern DuckDBErrorSyntax = DuckDBErrorType 22
+
+{-| __C declaration:__ @DUCKDB_ERROR_SETTINGS@
+
+    __defined at:__ @duckdb.h 386:2@
+
+    __exported by:__ @duckdb.h@
+-}
+pattern DuckDBErrorSettings :: DuckDBErrorType
+pattern DuckDBErrorSettings = DuckDBErrorType 23
+
+{-| __C declaration:__ @DUCKDB_ERROR_BINDER@
+
+    __defined at:__ @duckdb.h 387:2@
+
+    __exported by:__ @duckdb.h@
+-}
+pattern DuckDBErrorBinder :: DuckDBErrorType
+pattern DuckDBErrorBinder = DuckDBErrorType 24
+
+{-| __C declaration:__ @DUCKDB_ERROR_NETWORK@
+
+    __defined at:__ @duckdb.h 388:2@
+
+    __exported by:__ @duckdb.h@
+-}
+pattern DuckDBErrorNetwork :: DuckDBErrorType
+pattern DuckDBErrorNetwork = DuckDBErrorType 25
+
+{-| __C declaration:__ @DUCKDB_ERROR_OPTIMIZER@
+
+    __defined at:__ @duckdb.h 389:2@
+
+    __exported by:__ @duckdb.h@
+-}
+pattern DuckDBErrorOptimizer :: DuckDBErrorType
+pattern DuckDBErrorOptimizer = DuckDBErrorType 26
+
+{-| __C declaration:__ @DUCKDB_ERROR_NULL_POINTER@
+
+    __defined at:__ @duckdb.h 390:2@
+
+    __exported by:__ @duckdb.h@
+-}
+pattern DuckDBErrorNullPointer :: DuckDBErrorType
+pattern DuckDBErrorNullPointer = DuckDBErrorType 27
+
+{-| __C declaration:__ @DUCKDB_ERROR_IO@
+
+    __defined at:__ @duckdb.h 391:2@
+
+    __exported by:__ @duckdb.h@
+-}
+pattern DuckDBErrorIO :: DuckDBErrorType
+pattern DuckDBErrorIO = DuckDBErrorType 28
+
+{-| __C declaration:__ @DUCKDB_ERROR_INTERRUPT@
+
+    __defined at:__ @duckdb.h 392:2@
+
+    __exported by:__ @duckdb.h@
+-}
+pattern DuckDBErrorInterrupt :: DuckDBErrorType
+pattern DuckDBErrorInterrupt = DuckDBErrorType 29
+
+{-| __C declaration:__ @DUCKDB_ERROR_FATAL@
+
+    __defined at:__ @duckdb.h 393:2@
+
+    __exported by:__ @duckdb.h@
+-}
+pattern DuckDBErrorFatal :: DuckDBErrorType
+pattern DuckDBErrorFatal = DuckDBErrorType 30
+
+{-| __C declaration:__ @DUCKDB_ERROR_INTERNAL@
+
+    __defined at:__ @duckdb.h 394:2@
+
+    __exported by:__ @duckdb.h@
+-}
+pattern DuckDBErrorInternal :: DuckDBErrorType
+pattern DuckDBErrorInternal = DuckDBErrorType 31
+
+{-| __C declaration:__ @DUCKDB_ERROR_INVALID_INPUT@
+
+    __defined at:__ @duckdb.h 395:2@
+
+    __exported by:__ @duckdb.h@
+-}
+pattern DuckDBErrorInvalidInput :: DuckDBErrorType
+pattern DuckDBErrorInvalidInput = DuckDBErrorType 32
+
+{-| __C declaration:__ @DUCKDB_ERROR_OUT_OF_MEMORY@
+
+    __defined at:__ @duckdb.h 396:2@
+
+    __exported by:__ @duckdb.h@
+-}
+pattern DuckDBErrorOutOfMemory :: DuckDBErrorType
+pattern DuckDBErrorOutOfMemory = DuckDBErrorType 33
+
+{-| __C declaration:__ @DUCKDB_ERROR_PERMISSION@
+
+    __defined at:__ @duckdb.h 397:2@
+
+    __exported by:__ @duckdb.h@
+-}
+pattern DuckDBErrorPermission :: DuckDBErrorType
+pattern DuckDBErrorPermission = DuckDBErrorType 34
+
+{-| __C declaration:__ @DUCKDB_ERROR_PARAMETER_NOT_RESOLVED@
+
+    __defined at:__ @duckdb.h 398:2@
+
+    __exported by:__ @duckdb.h@
+-}
+pattern DuckDBErrorParameterNotResolved :: DuckDBErrorType
+pattern DuckDBErrorParameterNotResolved = DuckDBErrorType 35
+
+{-| __C declaration:__ @DUCKDB_ERROR_PARAMETER_NOT_ALLOWED@
+
+    __defined at:__ @duckdb.h 399:2@
+
+    __exported by:__ @duckdb.h@
+-}
+pattern DuckDBErrorParameterNotAllowed :: DuckDBErrorType
+pattern DuckDBErrorParameterNotAllowed = DuckDBErrorType 36
+
+{-| __C declaration:__ @DUCKDB_ERROR_DEPENDENCY@
+
+    __defined at:__ @duckdb.h 400:2@
+
+    __exported by:__ @duckdb.h@
+-}
+pattern DuckDBErrorDependency :: DuckDBErrorType
+pattern DuckDBErrorDependency = DuckDBErrorType 37
+
+{-| __C declaration:__ @DUCKDB_ERROR_HTTP@
+
+    __defined at:__ @duckdb.h 401:2@
+
+    __exported by:__ @duckdb.h@
+-}
+pattern DuckDBErrorHTTP :: DuckDBErrorType
+pattern DuckDBErrorHTTP = DuckDBErrorType 38
+
+{-| __C declaration:__ @DUCKDB_ERROR_MISSING_EXTENSION@
+
+    __defined at:__ @duckdb.h 402:2@
+
+    __exported by:__ @duckdb.h@
+-}
+pattern DuckDBErrorMissingExtension :: DuckDBErrorType
+pattern DuckDBErrorMissingExtension = DuckDBErrorType 39
+
+{-| __C declaration:__ @DUCKDB_ERROR_AUTOLOAD@
+
+    __defined at:__ @duckdb.h 403:2@
+
+    __exported by:__ @duckdb.h@
+-}
+pattern DuckDBErrorAutoload :: DuckDBErrorType
+pattern DuckDBErrorAutoload = DuckDBErrorType 40
+
+{-| __C declaration:__ @DUCKDB_ERROR_SEQUENCE@
+
+    __defined at:__ @duckdb.h 404:2@
+
+    __exported by:__ @duckdb.h@
+-}
+pattern DuckDBErrorSequence :: DuckDBErrorType
+pattern DuckDBErrorSequence = DuckDBErrorType 41
+
+{-| __C declaration:__ @DUCKDB_ERROR_DATA_CORRUPTION@
+
+    __defined at:__ @duckdb.h 405:2@
+
+    __exported by:__ @duckdb.h@
+-}
+pattern DuckDBErrorDataCorruption :: DuckDBErrorType
+pattern DuckDBErrorDataCorruption = DuckDBErrorType 43
+
+{-| __C declaration:__ @DUCKDB_INVALID_CONFIGURATION@
+
+    __defined at:__ @duckdb.h 406:2@
+
+    __exported by:__ @duckdb.h@
+-}
+pattern DuckDBInvalidConfiguration :: DuckDBErrorType
+pattern DuckDBInvalidConfiguration = DuckDBErrorType 42
+
+{-| __C declaration:__ @DUCKDB_ERROR_RESOURCE_IN_USE@
+
+    __defined at:__ @duckdb.h 407:2@
+
+    __exported by:__ @duckdb.h@
+-}
+pattern DuckDBErrorResourceInUse :: DuckDBErrorType
+pattern DuckDBErrorResourceInUse = DuckDBErrorType 44
+
+{-| An enum over DuckDB\'s different cast modes.
+
+    history:
+
+    * stable: v1.1.0
+
+    __C declaration:__ @enum duckdb_cast_mode@
+
+    __defined at:__ @duckdb.h 416:14@
+
+    __exported by:__ @duckdb.h@
+-}
+newtype DuckDBCastMode = DuckDBCastMode
+  { unwrap :: BG.CUInt
+  }
+  deriving stock (Eq, BG.Generic, Ord)
+  deriving newtype (BG.HasFFIType)
+
+instance Marshal.StaticSize DuckDBCastMode where
+
+  staticSizeOf = \_ -> (4 :: Int)
+
+  staticAlignment = \_ -> (4 :: Int)
+
+instance Marshal.ReadRaw DuckDBCastMode where
+
+  readRaw =
+    \ptr0 ->
+          pure DuckDBCastMode
+      <*> Marshal.readRawByteOff ptr0 (0 :: Int)
+
+instance Marshal.WriteRaw DuckDBCastMode where
+
+  writeRaw =
+    \ptr0 ->
+      \s1 ->
+        case s1 of
+          DuckDBCastMode unwrap2 ->
+            Marshal.writeRawByteOff ptr0 (0 :: Int) unwrap2
+
+deriving via Marshal.EquivStorable DuckDBCastMode instance BG.Storable DuckDBCastMode
+
+deriving via BG.CUInt instance BG.Prim DuckDBCastMode
+
+instance CEnum.CEnum DuckDBCastMode where
+
+  type CEnumZ DuckDBCastMode = BG.CUInt
+
+  toCEnum = DuckDBCastMode
+
+  fromCEnum = BG.getField @"unwrap"
+
+  declaredValues =
+    \_ ->
+      CEnum.declaredValuesFromList [(0, BG.singleton "DuckDBCastNormal"), (1, BG.singleton "DuckDBCastTry")]
+
+  showsUndeclared =
+    CEnum.showsWrappedUndeclared "DuckDBCastMode"
+
+  readPrecUndeclared =
+    CEnum.readPrecWrappedUndeclared "DuckDBCastMode"
+
+  isDeclared = CEnum.seqIsDeclared
+
+  mkDeclared = CEnum.seqMkDeclared
+
+instance CEnum.SequentialCEnum DuckDBCastMode where
+
+  minDeclaredValue = DuckDBCastNormal
+
+  maxDeclaredValue = DuckDBCastTry
+
+instance Show DuckDBCastMode where
+
+  showsPrec = CEnum.shows
+
+instance Read DuckDBCastMode where
+
+  readPrec = CEnum.readPrec
+
+  readList = BG.readListDefault
+
+  readListPrec = BG.readListPrecDefault
+
+instance ( ty ~ BG.CUInt
+         ) => BG.CompatHasField.HasField "unwrap" DuckDBCastMode ty where
+
+  hasField =
+    \x0 ->
+      (\y1 ->
+         DuckDBCastMode {unwrap = y1}, BG.getField @"unwrap" x0)
+
+instance ( ty ~ BG.CUInt
+         ) => BG.HasField "unwrap" (BG.Ptr DuckDBCastMode) (BG.Ptr ty) where
+
+  getField = HasCField.fromPtr (BG.Proxy @"unwrap")
+
+instance HasCField.HasCField DuckDBCastMode "unwrap" where
+
+  type CFieldType DuckDBCastMode "unwrap" = BG.CUInt
+
+  offset# = \_ -> \_ -> 0
+
+{-| __C declaration:__ @DUCKDB_CAST_NORMAL@
+
+    __defined at:__ @duckdb.h 417:2@
+
+    __exported by:__ @duckdb.h@
+-}
+pattern DuckDBCastNormal :: DuckDBCastMode
+pattern DuckDBCastNormal = DuckDBCastMode 0
+
+{-| __C declaration:__ @DUCKDB_CAST_TRY@
+
+    __defined at:__ @duckdb.h 418:2@
+
+    __exported by:__ @duckdb.h@
+-}
+pattern DuckDBCastTry :: DuckDBCastMode
+pattern DuckDBCastTry = DuckDBCastMode 1
+
+{-| Flags for opening files.
+
+    history:
+
+    * unstable: v1.5.0
+
+    * stable: v1.5.6
+
+    __C declaration:__ @enum duckdb_file_flag@
+
+    __defined at:__ @duckdb.h 428:14@
+
+    __exported by:__ @duckdb.h@
+-}
+newtype DuckDBFileFlag = DuckDBFileFlag
+  { unwrap :: BG.CUInt
+  }
+  deriving stock (Eq, BG.Generic, Ord)
+  deriving newtype (BG.HasFFIType)
+
+instance Marshal.StaticSize DuckDBFileFlag where
+
+  staticSizeOf = \_ -> (4 :: Int)
+
+  staticAlignment = \_ -> (4 :: Int)
+
+instance Marshal.ReadRaw DuckDBFileFlag where
+
+  readRaw =
+    \ptr0 ->
+          pure DuckDBFileFlag
+      <*> Marshal.readRawByteOff ptr0 (0 :: Int)
+
+instance Marshal.WriteRaw DuckDBFileFlag where
+
+  writeRaw =
+    \ptr0 ->
+      \s1 ->
+        case s1 of
+          DuckDBFileFlag unwrap2 ->
+            Marshal.writeRawByteOff ptr0 (0 :: Int) unwrap2
+
+deriving via Marshal.EquivStorable DuckDBFileFlag instance BG.Storable DuckDBFileFlag
+
+deriving via BG.CUInt instance BG.Prim DuckDBFileFlag
+
+instance CEnum.CEnum DuckDBFileFlag where
+
+  type CEnumZ DuckDBFileFlag = BG.CUInt
+
+  toCEnum = DuckDBFileFlag
+
+  fromCEnum = BG.getField @"unwrap"
+
+  declaredValues =
+    \_ ->
+      CEnum.declaredValuesFromList [ (0, BG.singleton "DuckDBFileFlagInvalid")
+                                   , (1, BG.singleton "DuckDBFileFlagRead")
+                                   , (2, BG.singleton "DuckDBFileFlagWrite")
+                                   , (3, BG.singleton "DuckDBFileFlagCreate")
+                                   , (4, BG.singleton "DuckDBFileFlagCreateNew")
+                                   , (5, BG.singleton "DuckDBFileFlagAppend")
+                                   ]
+
+  showsUndeclared =
+    CEnum.showsWrappedUndeclared "DuckDBFileFlag"
+
+  readPrecUndeclared =
+    CEnum.readPrecWrappedUndeclared "DuckDBFileFlag"
+
+  isDeclared = CEnum.seqIsDeclared
+
+  mkDeclared = CEnum.seqMkDeclared
+
+instance CEnum.SequentialCEnum DuckDBFileFlag where
+
+  minDeclaredValue = DuckDBFileFlagInvalid
+
+  maxDeclaredValue = DuckDBFileFlagAppend
+
+instance Show DuckDBFileFlag where
+
+  showsPrec = CEnum.shows
+
+instance Read DuckDBFileFlag where
+
+  readPrec = CEnum.readPrec
+
+  readList = BG.readListDefault
+
+  readListPrec = BG.readListPrecDefault
+
+instance ( ty ~ BG.CUInt
+         ) => BG.CompatHasField.HasField "unwrap" DuckDBFileFlag ty where
+
+  hasField =
+    \x0 ->
+      (\y1 ->
+         DuckDBFileFlag {unwrap = y1}, BG.getField @"unwrap" x0)
+
+instance ( ty ~ BG.CUInt
+         ) => BG.HasField "unwrap" (BG.Ptr DuckDBFileFlag) (BG.Ptr ty) where
+
+  getField = HasCField.fromPtr (BG.Proxy @"unwrap")
+
+instance HasCField.HasCField DuckDBFileFlag "unwrap" where
+
+  type CFieldType DuckDBFileFlag "unwrap" = BG.CUInt
+
+  offset# = \_ -> \_ -> 0
+
+{-| __C declaration:__ @DUCKDB_FILE_FLAG_INVALID@
+
+    __defined at:__ @duckdb.h 429:2@
+
+    __exported by:__ @duckdb.h@
+-}
+pattern DuckDBFileFlagInvalid :: DuckDBFileFlag
+pattern DuckDBFileFlagInvalid = DuckDBFileFlag 0
+
+{-| Open the file with read capabilities.
+
+    __C declaration:__ @DUCKDB_FILE_FLAG_READ@
+
+    __defined at:__ @duckdb.h 432:2@
+
+    __exported by:__ @duckdb.h@
+-}
+pattern DuckDBFileFlagRead :: DuckDBFileFlag
+pattern DuckDBFileFlagRead = DuckDBFileFlag 1
+
+{-| Open the file with write capabilities.
+
+    __C declaration:__ @DUCKDB_FILE_FLAG_WRITE@
+
+    __defined at:__ @duckdb.h 435:2@
+
+    __exported by:__ @duckdb.h@
+-}
+pattern DuckDBFileFlagWrite :: DuckDBFileFlag
+pattern DuckDBFileFlagWrite = DuckDBFileFlag 2
+
+{-| Create a new file, or open if it already exists.
+
+    __C declaration:__ @DUCKDB_FILE_FLAG_CREATE@
+
+    __defined at:__ @duckdb.h 438:2@
+
+    __exported by:__ @duckdb.h@
+-}
+pattern DuckDBFileFlagCreate :: DuckDBFileFlag
+pattern DuckDBFileFlagCreate = DuckDBFileFlag 3
+
+{-| Create a new file, or fail if it already exists.
+
+    __C declaration:__ @DUCKDB_FILE_FLAG_CREATE_NEW@
+
+    __defined at:__ @duckdb.h 441:2@
+
+    __exported by:__ @duckdb.h@
+-}
+pattern DuckDBFileFlagCreateNew :: DuckDBFileFlag
+pattern DuckDBFileFlagCreateNew = DuckDBFileFlag 4
+
+{-| Open the file in append mode.
+
+    __C declaration:__ @DUCKDB_FILE_FLAG_APPEND@
+
+    __defined at:__ @duckdb.h 444:2@
+
+    __exported by:__ @duckdb.h@
+-}
+pattern DuckDBFileFlagAppend :: DuckDBFileFlag
+pattern DuckDBFileFlagAppend = DuckDBFileFlag 5
+
+{-| An enum over DuckDB\'s configuration option scopes.
+
+    history:
+
+    * unstable: v1.5.0
+
+    * stable: v1.5.6
+
+    __C declaration:__ @enum duckdb_config_option_scope@
+
+    __defined at:__ @duckdb.h 454:14@
+
+    __exported by:__ @duckdb.h@
+-}
+newtype DuckDBConfigOptionScope = DuckDBConfigOptionScope
+  { unwrap :: BG.CUInt
+  }
+  deriving stock (Eq, BG.Generic, Ord)
+  deriving newtype (BG.HasFFIType)
+
+instance Marshal.StaticSize DuckDBConfigOptionScope where
+
+  staticSizeOf = \_ -> (4 :: Int)
+
+  staticAlignment = \_ -> (4 :: Int)
+
+instance Marshal.ReadRaw DuckDBConfigOptionScope where
+
+  readRaw =
+    \ptr0 ->
+          pure DuckDBConfigOptionScope
+      <*> Marshal.readRawByteOff ptr0 (0 :: Int)
+
+instance Marshal.WriteRaw DuckDBConfigOptionScope where
+
+  writeRaw =
+    \ptr0 ->
+      \s1 ->
+        case s1 of
+          DuckDBConfigOptionScope unwrap2 ->
+            Marshal.writeRawByteOff ptr0 (0 :: Int) unwrap2
+
+deriving via Marshal.EquivStorable DuckDBConfigOptionScope instance BG.Storable DuckDBConfigOptionScope
+
+deriving via BG.CUInt instance BG.Prim DuckDBConfigOptionScope
+
+instance CEnum.CEnum DuckDBConfigOptionScope where
+
+  type CEnumZ DuckDBConfigOptionScope = BG.CUInt
+
+  toCEnum = DuckDBConfigOptionScope
+
+  fromCEnum = BG.getField @"unwrap"
+
+  declaredValues =
+    \_ ->
+      CEnum.declaredValuesFromList [ (0, BG.singleton "DuckDBConfigOptionScopeInvalid")
+                                   , (1, BG.singleton "DuckDBConfigOptionScopeLocal")
+                                   , (2, BG.singleton "DuckDBConfigOptionScopeSession")
+                                   , (3, BG.singleton "DuckDBConfigOptionScopeGlobal")
+                                   ]
+
+  showsUndeclared =
+    CEnum.showsWrappedUndeclared "DuckDBConfigOptionScope"
+
+  readPrecUndeclared =
+    CEnum.readPrecWrappedUndeclared "DuckDBConfigOptionScope"
+
+  isDeclared = CEnum.seqIsDeclared
+
+  mkDeclared = CEnum.seqMkDeclared
+
+instance CEnum.SequentialCEnum DuckDBConfigOptionScope where
+
+  minDeclaredValue = DuckDBConfigOptionScopeInvalid
+
+  maxDeclaredValue = DuckDBConfigOptionScopeGlobal
+
+instance Show DuckDBConfigOptionScope where
+
+  showsPrec = CEnum.shows
+
+instance Read DuckDBConfigOptionScope where
+
+  readPrec = CEnum.readPrec
+
+  readList = BG.readListDefault
+
+  readListPrec = BG.readListPrecDefault
+
+instance ( ty ~ BG.CUInt
+         ) => BG.CompatHasField.HasField "unwrap" DuckDBConfigOptionScope ty where
+
+  hasField =
+    \x0 ->
+      (\y1 ->
+         DuckDBConfigOptionScope {unwrap = y1}, BG.getField @"unwrap" x0)
+
+instance ( ty ~ BG.CUInt
+         ) => BG.HasField "unwrap" (BG.Ptr DuckDBConfigOptionScope) (BG.Ptr ty) where
+
+  getField = HasCField.fromPtr (BG.Proxy @"unwrap")
+
+instance HasCField.HasCField DuckDBConfigOptionScope "unwrap" where
+
+  type CFieldType DuckDBConfigOptionScope "unwrap" =
+    BG.CUInt
+
+  offset# = \_ -> \_ -> 0
+
+{-| __C declaration:__ @DUCKDB_CONFIG_OPTION_SCOPE_INVALID@
+
+    __defined at:__ @duckdb.h 455:2@
+
+    __exported by:__ @duckdb.h@
+-}
+pattern DuckDBConfigOptionScopeInvalid :: DuckDBConfigOptionScope
+pattern DuckDBConfigOptionScopeInvalid = DuckDBConfigOptionScope 0
+
+{-| The option is set for the duration of the current transaction only. CURRENTLY NOT IMPLEMENTED.
+
+    __C declaration:__ @DUCKDB_CONFIG_OPTION_SCOPE_LOCAL@
+
+    __defined at:__ @duckdb.h 458:2@
+
+    __exported by:__ @duckdb.h@
+-}
+pattern DuckDBConfigOptionScopeLocal :: DuckDBConfigOptionScope
+pattern DuckDBConfigOptionScopeLocal = DuckDBConfigOptionScope 1
+
+{-| The option is set for the current session/connection only.
+
+    __C declaration:__ @DUCKDB_CONFIG_OPTION_SCOPE_SESSION@
+
+    __defined at:__ @duckdb.h 461:2@
+
+    __exported by:__ @duckdb.h@
+-}
+pattern DuckDBConfigOptionScopeSession :: DuckDBConfigOptionScope
+pattern DuckDBConfigOptionScopeSession = DuckDBConfigOptionScope 2
+
+{-| Set the option globally for all sessions/connections.
+
+    __C declaration:__ @DUCKDB_CONFIG_OPTION_SCOPE_GLOBAL@
+
+    __defined at:__ @duckdb.h 464:2@
+
+    __exported by:__ @duckdb.h@
+-}
+pattern DuckDBConfigOptionScopeGlobal :: DuckDBConfigOptionScope
+pattern DuckDBConfigOptionScopeGlobal = DuckDBConfigOptionScope 3
+
+{-| An enum over DuckDB\'s catalog entry types.
+
+    history:
+
+    * unstable: v1.5.0
+
+    * stable: v1.5.6
+
+    __C declaration:__ @enum duckdb_catalog_entry_type@
+
+    __defined at:__ @duckdb.h 474:14@
+
+    __exported by:__ @duckdb.h@
+-}
+newtype DuckDBCatalogEntryType = DuckDBCatalogEntryType
+  { unwrap :: BG.CUInt
+  }
+  deriving stock (Eq, BG.Generic, Ord)
+  deriving newtype (BG.HasFFIType)
+
+instance Marshal.StaticSize DuckDBCatalogEntryType where
+
+  staticSizeOf = \_ -> (4 :: Int)
+
+  staticAlignment = \_ -> (4 :: Int)
+
+instance Marshal.ReadRaw DuckDBCatalogEntryType where
+
+  readRaw =
+    \ptr0 ->
+          pure DuckDBCatalogEntryType
+      <*> Marshal.readRawByteOff ptr0 (0 :: Int)
+
+instance Marshal.WriteRaw DuckDBCatalogEntryType where
+
+  writeRaw =
+    \ptr0 ->
+      \s1 ->
+        case s1 of
+          DuckDBCatalogEntryType unwrap2 ->
+            Marshal.writeRawByteOff ptr0 (0 :: Int) unwrap2
+
+deriving via Marshal.EquivStorable DuckDBCatalogEntryType instance BG.Storable DuckDBCatalogEntryType
+
+deriving via BG.CUInt instance BG.Prim DuckDBCatalogEntryType
+
+instance CEnum.CEnum DuckDBCatalogEntryType where
+
+  type CEnumZ DuckDBCatalogEntryType = BG.CUInt
+
+  toCEnum = DuckDBCatalogEntryType
+
+  fromCEnum = BG.getField @"unwrap"
+
+  declaredValues =
+    \_ ->
+      CEnum.declaredValuesFromList [ (0, BG.singleton "DuckDBCatalogEntryTypeInvalid")
+                                   , (1, BG.singleton "DuckDBCatalogEntryTypeTable")
+                                   , (2, BG.singleton "DuckDBCatalogEntryTypeSchema")
+                                   , (3, BG.singleton "DuckDBCatalogEntryTypeView")
+                                   , (4, BG.singleton "DuckDBCatalogEntryTypeIndex")
+                                   , (5, BG.singleton "DuckDBCatalogEntryTypePreparedStatement")
+                                   , (6, BG.singleton "DuckDBCatalogEntryTypeSequence")
+                                   , (7, BG.singleton "DuckDBCatalogEntryTypeCollation")
+                                   , (8, BG.singleton "DuckDBCatalogEntryTypeType")
+                                   , (9, BG.singleton "DuckDBCatalogEntryTypeDatabase")
+                                   ]
+
+  showsUndeclared =
+    CEnum.showsWrappedUndeclared "DuckDBCatalogEntryType"
+
+  readPrecUndeclared =
+    CEnum.readPrecWrappedUndeclared "DuckDBCatalogEntryType"
+
+  isDeclared = CEnum.seqIsDeclared
+
+  mkDeclared = CEnum.seqMkDeclared
+
+instance CEnum.SequentialCEnum DuckDBCatalogEntryType where
+
+  minDeclaredValue = DuckDBCatalogEntryTypeInvalid
+
+  maxDeclaredValue = DuckDBCatalogEntryTypeDatabase
+
+instance Show DuckDBCatalogEntryType where
+
+  showsPrec = CEnum.shows
+
+instance Read DuckDBCatalogEntryType where
+
+  readPrec = CEnum.readPrec
+
+  readList = BG.readListDefault
+
+  readListPrec = BG.readListPrecDefault
+
+instance ( ty ~ BG.CUInt
+         ) => BG.CompatHasField.HasField "unwrap" DuckDBCatalogEntryType ty where
+
+  hasField =
+    \x0 ->
+      (\y1 ->
+         DuckDBCatalogEntryType {unwrap = y1}, BG.getField @"unwrap" x0)
+
+instance ( ty ~ BG.CUInt
+         ) => BG.HasField "unwrap" (BG.Ptr DuckDBCatalogEntryType) (BG.Ptr ty) where
+
+  getField = HasCField.fromPtr (BG.Proxy @"unwrap")
+
+instance HasCField.HasCField DuckDBCatalogEntryType "unwrap" where
+
+  type CFieldType DuckDBCatalogEntryType "unwrap" =
+    BG.CUInt
+
+  offset# = \_ -> \_ -> 0
+
+{-| __C declaration:__ @DUCKDB_CATALOG_ENTRY_TYPE_INVALID@
+
+    __defined at:__ @duckdb.h 475:2@
+
+    __exported by:__ @duckdb.h@
+-}
+pattern DuckDBCatalogEntryTypeInvalid :: DuckDBCatalogEntryType
+pattern DuckDBCatalogEntryTypeInvalid = DuckDBCatalogEntryType 0
+
+{-| __C declaration:__ @DUCKDB_CATALOG_ENTRY_TYPE_TABLE@
+
+    __defined at:__ @duckdb.h 476:2@
+
+    __exported by:__ @duckdb.h@
+-}
+pattern DuckDBCatalogEntryTypeTable :: DuckDBCatalogEntryType
+pattern DuckDBCatalogEntryTypeTable = DuckDBCatalogEntryType 1
+
+{-| __C declaration:__ @DUCKDB_CATALOG_ENTRY_TYPE_SCHEMA@
+
+    __defined at:__ @duckdb.h 477:2@
+
+    __exported by:__ @duckdb.h@
+-}
+pattern DuckDBCatalogEntryTypeSchema :: DuckDBCatalogEntryType
+pattern DuckDBCatalogEntryTypeSchema = DuckDBCatalogEntryType 2
+
+{-| __C declaration:__ @DUCKDB_CATALOG_ENTRY_TYPE_VIEW@
+
+    __defined at:__ @duckdb.h 478:2@
+
+    __exported by:__ @duckdb.h@
+-}
+pattern DuckDBCatalogEntryTypeView :: DuckDBCatalogEntryType
+pattern DuckDBCatalogEntryTypeView = DuckDBCatalogEntryType 3
+
+{-| __C declaration:__ @DUCKDB_CATALOG_ENTRY_TYPE_INDEX@
+
+    __defined at:__ @duckdb.h 479:2@
+
+    __exported by:__ @duckdb.h@
+-}
+pattern DuckDBCatalogEntryTypeIndex :: DuckDBCatalogEntryType
+pattern DuckDBCatalogEntryTypeIndex = DuckDBCatalogEntryType 4
+
+{-| __C declaration:__ @DUCKDB_CATALOG_ENTRY_TYPE_PREPARED_STATEMENT@
+
+    __defined at:__ @duckdb.h 480:2@
+
+    __exported by:__ @duckdb.h@
+-}
+pattern DuckDBCatalogEntryTypePreparedStatement :: DuckDBCatalogEntryType
+pattern DuckDBCatalogEntryTypePreparedStatement = DuckDBCatalogEntryType 5
+
+{-| __C declaration:__ @DUCKDB_CATALOG_ENTRY_TYPE_SEQUENCE@
+
+    __defined at:__ @duckdb.h 481:2@
+
+    __exported by:__ @duckdb.h@
+-}
+pattern DuckDBCatalogEntryTypeSequence :: DuckDBCatalogEntryType
+pattern DuckDBCatalogEntryTypeSequence = DuckDBCatalogEntryType 6
+
+{-| __C declaration:__ @DUCKDB_CATALOG_ENTRY_TYPE_COLLATION@
+
+    __defined at:__ @duckdb.h 482:2@
+
+    __exported by:__ @duckdb.h@
+-}
+pattern DuckDBCatalogEntryTypeCollation :: DuckDBCatalogEntryType
+pattern DuckDBCatalogEntryTypeCollation = DuckDBCatalogEntryType 7
+
+{-| __C declaration:__ @DUCKDB_CATALOG_ENTRY_TYPE_TYPE@
+
+    __defined at:__ @duckdb.h 483:2@
+
+    __exported by:__ @duckdb.h@
+-}
+pattern DuckDBCatalogEntryTypeType :: DuckDBCatalogEntryType
+pattern DuckDBCatalogEntryTypeType = DuckDBCatalogEntryType 8
+
+{-| __C declaration:__ @DUCKDB_CATALOG_ENTRY_TYPE_DATABASE@
+
+    __defined at:__ @duckdb.h 484:2@
+
+    __exported by:__ @duckdb.h@
+-}
+pattern DuckDBCatalogEntryTypeDatabase :: DuckDBCatalogEntryType
+pattern DuckDBCatalogEntryTypeDatabase = DuckDBCatalogEntryType 9
+
+{-|
+
+    Alias for the t'DuckDBType' enum.
+
+    history:
+
+    * stable: v0.1.0
+
+    __C declaration:__ @duckdb_type@
+
+    __defined at:__ @duckdb.h 497:21@
+
+    __exported by:__ @duckdb.h@
+-}
+newtype DuckDBTypeAlias = DuckDBTypeAlias
+  { unwrap :: DuckDBType
+  }
+  deriving stock (Eq, BG.Generic, Ord, Read, Show)
+  deriving newtype
+    ( BG.HasFFIType
+    , BG.Prim
+    , Marshal.ReadRaw
+    , Marshal.StaticSize
+    , BG.Storable
+    , Marshal.WriteRaw
+    )
+
+instance ( ty ~ DuckDBType
+         ) => BG.CompatHasField.HasField "unwrap" DuckDBTypeAlias ty where
+
+  hasField =
+    \x0 ->
+      (\y1 ->
+         DuckDBTypeAlias {unwrap = y1}, BG.getField @"unwrap" x0)
+
+instance ( ty ~ DuckDBType
+         ) => BG.HasField "unwrap" (BG.Ptr DuckDBTypeAlias) (BG.Ptr ty) where
+
+  getField = HasCField.fromPtr (BG.Proxy @"unwrap")
+
+instance HasCField.HasCField DuckDBTypeAlias "unwrap" where
+
+  type CFieldType DuckDBTypeAlias "unwrap" = DuckDBType
+
+  offset# = \_ -> \_ -> 0
+
+{-| DATE is stored as days since 1970-01-01.
+
+    history:
+
+    * stable: v0.1.0
+
+    __C declaration:__ @struct duckdb_date@
+
+    __defined at:__ @duckdb.h 579:8@
+
+    __exported by:__ @duckdb.h@
+-}
+data DuckDBDate = DuckDBDate
+  { days :: HsBindgen.Runtime.LibC.Int32
+    {- ^ __C declaration:__ @days@
+
+         __defined at:__ @duckdb.h 580:10@
+
+         __exported by:__ @duckdb.h@
+    -}
+  }
+  deriving stock (Eq, BG.Generic, Show)
+
+instance Marshal.StaticSize DuckDBDate where
+
+  staticSizeOf = \_ -> (4 :: Int)
+
+  staticAlignment = \_ -> (4 :: Int)
+
+instance Marshal.ReadRaw DuckDBDate where
+
+  readRaw =
+    \ptr0 ->
+          pure DuckDBDate
+      <*> HasCField.readRaw (BG.Proxy @"days") ptr0
+
+instance Marshal.WriteRaw DuckDBDate where
+
+  writeRaw =
+    \ptr0 ->
+      \s1 ->
+        case s1 of
+          DuckDBDate days2 ->
+            HasCField.writeRaw (BG.Proxy @"days") ptr0 days2
+
+deriving via Marshal.EquivStorable DuckDBDate instance BG.Storable DuckDBDate
+
+deriving via Struct.IsStructViaReadRaw DuckDBDate instance Struct.IsStruct DuckDBDate
+
+{-| __C declaration:__ @days@
+
+    __defined at:__ @duckdb.h 580:10@
+
+    __exported by:__ @duckdb.h@
+-}
+instance ( ty ~ HsBindgen.Runtime.LibC.Int32
+         ) => BG.CompatHasField.HasField "days" DuckDBDate ty where
+
+  hasField =
+    \x0 ->
+      (\y1 ->
+         DuckDBDate {days = y1}, BG.getField @"days" x0)
+
+instance ( ty ~ HsBindgen.Runtime.LibC.Int32
+         ) => BG.HasField "days" (BG.Ptr DuckDBDate) (BG.Ptr ty) where
+
+  getField = HasCField.fromPtr (BG.Proxy @"days")
+
+instance HasCField.HasCField DuckDBDate "days" where
+
+  type CFieldType DuckDBDate "days" =
+    HsBindgen.Runtime.LibC.Int32
+
+  offset# = \_ -> \_ -> 0
+
+{-| Decomposed date components.
+
+    history:
+
+    * stable: v0.2.9
+
+    __C declaration:__ @struct duckdb_date_struct@
+
+    __defined at:__ @duckdb.h 589:8@
+
+    __exported by:__ @duckdb.h@
+-}
+data DuckDBDateStruct = DuckDBDateStruct
+  { year :: HsBindgen.Runtime.LibC.Int32
+    {- ^ __C declaration:__ @year@
+
+         __defined at:__ @duckdb.h 590:10@
+
+         __exported by:__ @duckdb.h@
+    -}
+  , month :: HsBindgen.Runtime.LibC.Int8
+    {- ^ __C declaration:__ @month@
+
+         __defined at:__ @duckdb.h 591:9@
+
+         __exported by:__ @duckdb.h@
+    -}
+  , day :: HsBindgen.Runtime.LibC.Int8
+    {- ^ __C declaration:__ @day@
+
+         __defined at:__ @duckdb.h 592:9@
+
+         __exported by:__ @duckdb.h@
+    -}
+  }
+  deriving stock (Eq, BG.Generic, Show)
+
+instance Marshal.StaticSize DuckDBDateStruct where
+
+  staticSizeOf = \_ -> (8 :: Int)
+
+  staticAlignment = \_ -> (4 :: Int)
+
+instance Marshal.ReadRaw DuckDBDateStruct where
+
+  readRaw =
+    \ptr0 ->
+          pure DuckDBDateStruct
+      <*> HasCField.readRaw (BG.Proxy @"year") ptr0
+      <*> HasCField.readRaw (BG.Proxy @"month") ptr0
+      <*> HasCField.readRaw (BG.Proxy @"day") ptr0
+
+instance Marshal.WriteRaw DuckDBDateStruct where
+
+  writeRaw =
+    \ptr0 ->
+      \s1 ->
+        case s1 of
+          DuckDBDateStruct year2 month3 day4 ->
+               HasCField.writeRaw (BG.Proxy @"year") ptr0 year2
+            >> HasCField.writeRaw (BG.Proxy @"month") ptr0 month3
+            >> HasCField.writeRaw (BG.Proxy @"day") ptr0 day4
+
+deriving via Marshal.EquivStorable DuckDBDateStruct instance BG.Storable DuckDBDateStruct
+
+deriving via Struct.IsStructViaReadRaw DuckDBDateStruct instance Struct.IsStruct DuckDBDateStruct
+
+{-| __C declaration:__ @year@
+
+    __defined at:__ @duckdb.h 590:10@
+
+    __exported by:__ @duckdb.h@
+-}
+instance ( ty ~ HsBindgen.Runtime.LibC.Int32
+         ) => BG.CompatHasField.HasField "year" DuckDBDateStruct ty where
+
+  hasField =
+    \x0 ->
+      ( \y1 ->
+          DuckDBDateStruct {year = y1, month = BG.getField @"month" x0, day = BG.getField @"day" x0}
+      , BG.getField @"year" x0
+      )
+
+instance ( ty ~ HsBindgen.Runtime.LibC.Int32
+         ) => BG.HasField "year" (BG.Ptr DuckDBDateStruct) (BG.Ptr ty) where
+
+  getField = HasCField.fromPtr (BG.Proxy @"year")
+
+instance HasCField.HasCField DuckDBDateStruct "year" where
+
+  type CFieldType DuckDBDateStruct "year" =
+    HsBindgen.Runtime.LibC.Int32
+
+  offset# = \_ -> \_ -> 0
+
+{-| __C declaration:__ @month@
+
+    __defined at:__ @duckdb.h 591:9@
+
+    __exported by:__ @duckdb.h@
+-}
+instance ( ty ~ HsBindgen.Runtime.LibC.Int8
+         ) => BG.CompatHasField.HasField "month" DuckDBDateStruct ty where
+
+  hasField =
+    \x0 ->
+      ( \y1 ->
+          DuckDBDateStruct {month = y1, year = BG.getField @"year" x0, day = BG.getField @"day" x0}
+      , BG.getField @"month" x0
+      )
+
+instance ( ty ~ HsBindgen.Runtime.LibC.Int8
+         ) => BG.HasField "month" (BG.Ptr DuckDBDateStruct) (BG.Ptr ty) where
+
+  getField = HasCField.fromPtr (BG.Proxy @"month")
+
+instance HasCField.HasCField DuckDBDateStruct "month" where
+
+  type CFieldType DuckDBDateStruct "month" =
+    HsBindgen.Runtime.LibC.Int8
+
+  offset# = \_ -> \_ -> 4
+
+{-| __C declaration:__ @day@
+
+    __defined at:__ @duckdb.h 592:9@
+
+    __exported by:__ @duckdb.h@
+-}
+instance ( ty ~ HsBindgen.Runtime.LibC.Int8
+         ) => BG.CompatHasField.HasField "day" DuckDBDateStruct ty where
+
+  hasField =
+    \x0 ->
+      ( \y1 ->
+          DuckDBDateStruct {day = y1, year = BG.getField @"year" x0, month = BG.getField @"month" x0}
+      , BG.getField @"day" x0
+      )
+
+instance ( ty ~ HsBindgen.Runtime.LibC.Int8
+         ) => BG.HasField "day" (BG.Ptr DuckDBDateStruct) (BG.Ptr ty) where
+
+  getField = HasCField.fromPtr (BG.Proxy @"day")
+
+instance HasCField.HasCField DuckDBDateStruct "day" where
+
+  type CFieldType DuckDBDateStruct "day" =
+    HsBindgen.Runtime.LibC.Int8
+
+  offset# = \_ -> \_ -> 5
+
+{-| TIME is stored as microseconds since 00:00:00.
+
+    history:
+
+    * stable: v0.1.0
+
+    __C declaration:__ @struct duckdb_time@
+
+    __defined at:__ @duckdb.h 601:8@
+
+    __exported by:__ @duckdb.h@
+-}
+data DuckDBTime = DuckDBTime
+  { micros :: HsBindgen.Runtime.LibC.Int64
+    {- ^ __C declaration:__ @micros@
+
+         __defined at:__ @duckdb.h 602:10@
+
+         __exported by:__ @duckdb.h@
+    -}
+  }
+  deriving stock (Eq, BG.Generic, Show)
+
+instance Marshal.StaticSize DuckDBTime where
+
+  staticSizeOf = \_ -> (8 :: Int)
+
+  staticAlignment = \_ -> (8 :: Int)
+
+instance Marshal.ReadRaw DuckDBTime where
+
+  readRaw =
+    \ptr0 ->
+          pure DuckDBTime
+      <*> HasCField.readRaw (BG.Proxy @"micros") ptr0
+
+instance Marshal.WriteRaw DuckDBTime where
+
+  writeRaw =
+    \ptr0 ->
+      \s1 ->
+        case s1 of
+          DuckDBTime micros2 ->
+            HasCField.writeRaw (BG.Proxy @"micros") ptr0 micros2
+
+deriving via Marshal.EquivStorable DuckDBTime instance BG.Storable DuckDBTime
+
+deriving via Struct.IsStructViaReadRaw DuckDBTime instance Struct.IsStruct DuckDBTime
+
+{-| __C declaration:__ @micros@
+
+    __defined at:__ @duckdb.h 602:10@
+
+    __exported by:__ @duckdb.h@
+-}
+instance ( ty ~ HsBindgen.Runtime.LibC.Int64
+         ) => BG.CompatHasField.HasField "micros" DuckDBTime ty where
+
+  hasField =
+    \x0 ->
+      (\y1 ->
+         DuckDBTime {micros = y1}, BG.getField @"micros" x0)
+
+instance ( ty ~ HsBindgen.Runtime.LibC.Int64
+         ) => BG.HasField "micros" (BG.Ptr DuckDBTime) (BG.Ptr ty) where
+
+  getField = HasCField.fromPtr (BG.Proxy @"micros")
+
+instance HasCField.HasCField DuckDBTime "micros" where
+
+  type CFieldType DuckDBTime "micros" =
+    HsBindgen.Runtime.LibC.Int64
+
+  offset# = \_ -> \_ -> 0
+
+{-| Decomposed time components.
+
+    history:
+
+    * stable: v0.2.9
+
+    __C declaration:__ @struct duckdb_time_struct@
+
+    __defined at:__ @duckdb.h 611:8@
+
+    __exported by:__ @duckdb.h@
+-}
+data DuckDBTimeStruct = DuckDBTimeStruct
+  { hour :: HsBindgen.Runtime.LibC.Int8
+    {- ^ __C declaration:__ @hour@
+
+         __defined at:__ @duckdb.h 612:9@
+
+         __exported by:__ @duckdb.h@
+    -}
+  , min :: HsBindgen.Runtime.LibC.Int8
+    {- ^ __C declaration:__ @min@
+
+         __defined at:__ @duckdb.h 613:9@
+
+         __exported by:__ @duckdb.h@
+    -}
+  , sec :: HsBindgen.Runtime.LibC.Int8
+    {- ^ __C declaration:__ @sec@
+
+         __defined at:__ @duckdb.h 614:9@
+
+         __exported by:__ @duckdb.h@
+    -}
+  , micros :: HsBindgen.Runtime.LibC.Int32
+    {- ^ __C declaration:__ @micros@
+
+         __defined at:__ @duckdb.h 615:10@
+
+         __exported by:__ @duckdb.h@
+    -}
+  }
+  deriving stock (Eq, BG.Generic, Show)
+
+instance Marshal.StaticSize DuckDBTimeStruct where
+
+  staticSizeOf = \_ -> (8 :: Int)
+
+  staticAlignment = \_ -> (4 :: Int)
+
+instance Marshal.ReadRaw DuckDBTimeStruct where
+
+  readRaw =
+    \ptr0 ->
+          pure DuckDBTimeStruct
+      <*> HasCField.readRaw (BG.Proxy @"hour") ptr0
+      <*> HasCField.readRaw (BG.Proxy @"min") ptr0
+      <*> HasCField.readRaw (BG.Proxy @"sec") ptr0
+      <*> HasCField.readRaw (BG.Proxy @"micros") ptr0
+
+instance Marshal.WriteRaw DuckDBTimeStruct where
+
+  writeRaw =
+    \ptr0 ->
+      \s1 ->
+        case s1 of
+          DuckDBTimeStruct hour2 min3 sec4 micros5 ->
+               HasCField.writeRaw (BG.Proxy @"hour") ptr0 hour2
+            >> HasCField.writeRaw (BG.Proxy @"min") ptr0 min3
+            >> HasCField.writeRaw (BG.Proxy @"sec") ptr0 sec4
+            >> HasCField.writeRaw (BG.Proxy @"micros") ptr0 micros5
+
+deriving via Marshal.EquivStorable DuckDBTimeStruct instance BG.Storable DuckDBTimeStruct
+
+deriving via Struct.IsStructViaReadRaw DuckDBTimeStruct instance Struct.IsStruct DuckDBTimeStruct
+
+{-| __C declaration:__ @hour@
+
+    __defined at:__ @duckdb.h 612:9@
+
+    __exported by:__ @duckdb.h@
+-}
+instance ( ty ~ HsBindgen.Runtime.LibC.Int8
+         ) => BG.CompatHasField.HasField "hour" DuckDBTimeStruct ty where
+
+  hasField =
+    \x0 ->
+      ( \y1 ->
+          DuckDBTimeStruct { hour = y1
+                           , min = BG.getField @"min" x0
+                           , sec = BG.getField @"sec" x0
+                           , micros = BG.getField @"micros" x0
+                           }
+      , BG.getField @"hour" x0
+      )
+
+instance ( ty ~ HsBindgen.Runtime.LibC.Int8
+         ) => BG.HasField "hour" (BG.Ptr DuckDBTimeStruct) (BG.Ptr ty) where
+
+  getField = HasCField.fromPtr (BG.Proxy @"hour")
+
+instance HasCField.HasCField DuckDBTimeStruct "hour" where
+
+  type CFieldType DuckDBTimeStruct "hour" =
+    HsBindgen.Runtime.LibC.Int8
+
+  offset# = \_ -> \_ -> 0
+
+{-| __C declaration:__ @min@
+
+    __defined at:__ @duckdb.h 613:9@
+
+    __exported by:__ @duckdb.h@
+-}
+instance ( ty ~ HsBindgen.Runtime.LibC.Int8
+         ) => BG.CompatHasField.HasField "min" DuckDBTimeStruct ty where
+
+  hasField =
+    \x0 ->
+      ( \y1 ->
+          DuckDBTimeStruct { min = y1
+                           , hour = BG.getField @"hour" x0
+                           , sec = BG.getField @"sec" x0
+                           , micros = BG.getField @"micros" x0
+                           }
+      , BG.getField @"min" x0
+      )
+
+instance ( ty ~ HsBindgen.Runtime.LibC.Int8
+         ) => BG.HasField "min" (BG.Ptr DuckDBTimeStruct) (BG.Ptr ty) where
+
+  getField = HasCField.fromPtr (BG.Proxy @"min")
+
+instance HasCField.HasCField DuckDBTimeStruct "min" where
+
+  type CFieldType DuckDBTimeStruct "min" =
+    HsBindgen.Runtime.LibC.Int8
+
+  offset# = \_ -> \_ -> 1
+
+{-| __C declaration:__ @sec@
+
+    __defined at:__ @duckdb.h 614:9@
+
+    __exported by:__ @duckdb.h@
+-}
+instance ( ty ~ HsBindgen.Runtime.LibC.Int8
+         ) => BG.CompatHasField.HasField "sec" DuckDBTimeStruct ty where
+
+  hasField =
+    \x0 ->
+      ( \y1 ->
+          DuckDBTimeStruct { sec = y1
+                           , hour = BG.getField @"hour" x0
+                           , min = BG.getField @"min" x0
+                           , micros = BG.getField @"micros" x0
+                           }
+      , BG.getField @"sec" x0
+      )
+
+instance ( ty ~ HsBindgen.Runtime.LibC.Int8
+         ) => BG.HasField "sec" (BG.Ptr DuckDBTimeStruct) (BG.Ptr ty) where
+
+  getField = HasCField.fromPtr (BG.Proxy @"sec")
+
+instance HasCField.HasCField DuckDBTimeStruct "sec" where
+
+  type CFieldType DuckDBTimeStruct "sec" =
+    HsBindgen.Runtime.LibC.Int8
+
+  offset# = \_ -> \_ -> 2
+
+{-| __C declaration:__ @micros@
+
+    __defined at:__ @duckdb.h 615:10@
+
+    __exported by:__ @duckdb.h@
+-}
+instance ( ty ~ HsBindgen.Runtime.LibC.Int32
+         ) => BG.CompatHasField.HasField "micros" DuckDBTimeStruct ty where
+
+  hasField =
+    \x0 ->
+      ( \y1 ->
+          DuckDBTimeStruct { micros = y1
+                           , hour = BG.getField @"hour" x0
+                           , min = BG.getField @"min" x0
+                           , sec = BG.getField @"sec" x0
+                           }
+      , BG.getField @"micros" x0
+      )
+
+instance ( ty ~ HsBindgen.Runtime.LibC.Int32
+         ) => BG.HasField "micros" (BG.Ptr DuckDBTimeStruct) (BG.Ptr ty) where
+
+  getField = HasCField.fromPtr (BG.Proxy @"micros")
+
+instance HasCField.HasCField DuckDBTimeStruct "micros" where
+
+  type CFieldType DuckDBTimeStruct "micros" =
+    HsBindgen.Runtime.LibC.Int32
+
+  offset# = \_ -> \_ -> 4
+
+{-| TIME_NS is stored as nanoseconds since 00:00:00.
+
+    history:
+
+    * unstable: v1.4.0
+
+    * stable: v1.5.6
+
+    __C declaration:__ @struct duckdb_time_ns@
+
+    __defined at:__ @duckdb.h 625:8@
+
+    __exported by:__ @duckdb.h@
+-}
+data DuckDBTimeNs = DuckDBTimeNs
+  { nanos :: HsBindgen.Runtime.LibC.Int64
+    {- ^ __C declaration:__ @nanos@
+
+         __defined at:__ @duckdb.h 626:10@
+
+         __exported by:__ @duckdb.h@
+    -}
+  }
+  deriving stock (Eq, BG.Generic, Show)
+
+instance Marshal.StaticSize DuckDBTimeNs where
+
+  staticSizeOf = \_ -> (8 :: Int)
+
+  staticAlignment = \_ -> (8 :: Int)
+
+instance Marshal.ReadRaw DuckDBTimeNs where
+
+  readRaw =
+    \ptr0 ->
+          pure DuckDBTimeNs
+      <*> HasCField.readRaw (BG.Proxy @"nanos") ptr0
+
+instance Marshal.WriteRaw DuckDBTimeNs where
+
+  writeRaw =
+    \ptr0 ->
+      \s1 ->
+        case s1 of
+          DuckDBTimeNs nanos2 ->
+            HasCField.writeRaw (BG.Proxy @"nanos") ptr0 nanos2
+
+deriving via Marshal.EquivStorable DuckDBTimeNs instance BG.Storable DuckDBTimeNs
+
+deriving via Struct.IsStructViaReadRaw DuckDBTimeNs instance Struct.IsStruct DuckDBTimeNs
+
+{-| __C declaration:__ @nanos@
+
+    __defined at:__ @duckdb.h 626:10@
+
+    __exported by:__ @duckdb.h@
+-}
+instance ( ty ~ HsBindgen.Runtime.LibC.Int64
+         ) => BG.CompatHasField.HasField "nanos" DuckDBTimeNs ty where
+
+  hasField =
+    \x0 ->
+      (\y1 ->
+         DuckDBTimeNs {nanos = y1}, BG.getField @"nanos" x0)
+
+instance ( ty ~ HsBindgen.Runtime.LibC.Int64
+         ) => BG.HasField "nanos" (BG.Ptr DuckDBTimeNs) (BG.Ptr ty) where
+
+  getField = HasCField.fromPtr (BG.Proxy @"nanos")
+
+instance HasCField.HasCField DuckDBTimeNs "nanos" where
+
+  type CFieldType DuckDBTimeNs "nanos" =
+    HsBindgen.Runtime.LibC.Int64
+
+  offset# = \_ -> \_ -> 0
+
+{-| TIME_TZ stored as 40 bits for microseconds and 24 bits for offset.
+
+    history:
+
+    * stable: v0.10.0
+
+    __C declaration:__ @struct duckdb_time_tz@
+
+    __defined at:__ @duckdb.h 635:8@
+
+    __exported by:__ @duckdb.h@
+-}
+data DuckDBTimeTz = DuckDBTimeTz
+  { bits :: HsBindgen.Runtime.LibC.Word64
+    {- ^ __C declaration:__ @bits@
+
+         __defined at:__ @duckdb.h 636:11@
+
+         __exported by:__ @duckdb.h@
+    -}
+  }
+  deriving stock (Eq, BG.Generic, Show)
+
+instance Marshal.StaticSize DuckDBTimeTz where
+
+  staticSizeOf = \_ -> (8 :: Int)
+
+  staticAlignment = \_ -> (8 :: Int)
+
+instance Marshal.ReadRaw DuckDBTimeTz where
+
+  readRaw =
+    \ptr0 ->
+          pure DuckDBTimeTz
+      <*> HasCField.readRaw (BG.Proxy @"bits") ptr0
+
+instance Marshal.WriteRaw DuckDBTimeTz where
+
+  writeRaw =
+    \ptr0 ->
+      \s1 ->
+        case s1 of
+          DuckDBTimeTz bits2 ->
+            HasCField.writeRaw (BG.Proxy @"bits") ptr0 bits2
+
+deriving via Marshal.EquivStorable DuckDBTimeTz instance BG.Storable DuckDBTimeTz
+
+deriving via Struct.IsStructViaReadRaw DuckDBTimeTz instance Struct.IsStruct DuckDBTimeTz
+
+{-| __C declaration:__ @bits@
+
+    __defined at:__ @duckdb.h 636:11@
+
+    __exported by:__ @duckdb.h@
+-}
+instance ( ty ~ HsBindgen.Runtime.LibC.Word64
+         ) => BG.CompatHasField.HasField "bits" DuckDBTimeTz ty where
+
+  hasField =
+    \x0 ->
+      (\y1 ->
+         DuckDBTimeTz {bits = y1}, BG.getField @"bits" x0)
+
+instance ( ty ~ HsBindgen.Runtime.LibC.Word64
+         ) => BG.HasField "bits" (BG.Ptr DuckDBTimeTz) (BG.Ptr ty) where
+
+  getField = HasCField.fromPtr (BG.Proxy @"bits")
+
+instance HasCField.HasCField DuckDBTimeTz "bits" where
+
+  type CFieldType DuckDBTimeTz "bits" =
+    HsBindgen.Runtime.LibC.Word64
+
+  offset# = \_ -> \_ -> 0
+
+{-| Decomposed TIME_TZ components.
+
+    history:
+
+    * stable: v0.10.0
+
+    __C declaration:__ @struct duckdb_time_tz_struct@
+
+    __defined at:__ @duckdb.h 645:8@
+
+    __exported by:__ @duckdb.h@
+-}
+data DuckDBTimeTzStruct = DuckDBTimeTzStruct
+  { time :: DuckDBTimeStruct
+    {- ^ __C declaration:__ @time@
+
+         __defined at:__ @duckdb.h 646:21@
+
+         __exported by:__ @duckdb.h@
+    -}
+  , offset :: HsBindgen.Runtime.LibC.Int32
+    {- ^ __C declaration:__ @offset@
+
+         __defined at:__ @duckdb.h 647:10@
+
+         __exported by:__ @duckdb.h@
+    -}
+  }
+  deriving stock (Eq, BG.Generic, Show)
+
+instance Marshal.StaticSize DuckDBTimeTzStruct where
+
+  staticSizeOf = \_ -> (12 :: Int)
+
+  staticAlignment = \_ -> (4 :: Int)
+
+instance Marshal.ReadRaw DuckDBTimeTzStruct where
+
+  readRaw =
+    \ptr0 ->
+          pure DuckDBTimeTzStruct
+      <*> HasCField.readRaw (BG.Proxy @"time") ptr0
+      <*> HasCField.readRaw (BG.Proxy @"offset") ptr0
+
+instance Marshal.WriteRaw DuckDBTimeTzStruct where
+
+  writeRaw =
+    \ptr0 ->
+      \s1 ->
+        case s1 of
+          DuckDBTimeTzStruct time2 offset3 ->
+               HasCField.writeRaw (BG.Proxy @"time") ptr0 time2
+            >> HasCField.writeRaw (BG.Proxy @"offset") ptr0 offset3
+
+deriving via Marshal.EquivStorable DuckDBTimeTzStruct instance BG.Storable DuckDBTimeTzStruct
+
+deriving via Struct.IsStructViaReadRaw DuckDBTimeTzStruct instance Struct.IsStruct DuckDBTimeTzStruct
+
+{-| __C declaration:__ @time@
+
+    __defined at:__ @duckdb.h 646:21@
+
+    __exported by:__ @duckdb.h@
+-}
+instance ( ty ~ DuckDBTimeStruct
+         ) => BG.CompatHasField.HasField "time" DuckDBTimeTzStruct ty where
+
+  hasField =
+    \x0 ->
+      ( \y1 ->
+          DuckDBTimeTzStruct {time = y1, offset = BG.getField @"offset" x0}
+      , BG.getField @"time" x0
+      )
+
+instance ( ty ~ DuckDBTimeStruct
+         ) => BG.HasField "time" (BG.Ptr DuckDBTimeTzStruct) (BG.Ptr ty) where
+
+  getField = HasCField.fromPtr (BG.Proxy @"time")
+
+instance HasCField.HasCField DuckDBTimeTzStruct "time" where
+
+  type CFieldType DuckDBTimeTzStruct "time" =
+    DuckDBTimeStruct
+
+  offset# = \_ -> \_ -> 0
+
+{-| __C declaration:__ @offset@
+
+    __defined at:__ @duckdb.h 647:10@
+
+    __exported by:__ @duckdb.h@
+-}
+instance ( ty ~ HsBindgen.Runtime.LibC.Int32
+         ) => BG.CompatHasField.HasField "offset" DuckDBTimeTzStruct ty where
+
+  hasField =
+    \x0 ->
+      ( \y1 ->
+          DuckDBTimeTzStruct {offset = y1, time = BG.getField @"time" x0}
+      , BG.getField @"offset" x0
+      )
+
+instance ( ty ~ HsBindgen.Runtime.LibC.Int32
+         ) => BG.HasField "offset" (BG.Ptr DuckDBTimeTzStruct) (BG.Ptr ty) where
+
+  getField = HasCField.fromPtr (BG.Proxy @"offset")
+
+instance HasCField.HasCField DuckDBTimeTzStruct "offset" where
+
+  type CFieldType DuckDBTimeTzStruct "offset" =
+    HsBindgen.Runtime.LibC.Int32
+
+  offset# = \_ -> \_ -> 8
+
+{-| TIMESTAMP is stored as microseconds since 1970-01-01.
+
+    history:
+
+    * stable: v0.1.0
+
+    __C declaration:__ @struct duckdb_timestamp@
+
+    __defined at:__ @duckdb.h 656:8@
+
+    __exported by:__ @duckdb.h@
+-}
+data DuckDBTimestamp = DuckDBTimestamp
+  { micros :: HsBindgen.Runtime.LibC.Int64
+    {- ^ __C declaration:__ @micros@
+
+         __defined at:__ @duckdb.h 657:10@
+
+         __exported by:__ @duckdb.h@
+    -}
+  }
+  deriving stock (Eq, BG.Generic, Show)
+
+instance Marshal.StaticSize DuckDBTimestamp where
+
+  staticSizeOf = \_ -> (8 :: Int)
+
+  staticAlignment = \_ -> (8 :: Int)
+
+instance Marshal.ReadRaw DuckDBTimestamp where
+
+  readRaw =
+    \ptr0 ->
+          pure DuckDBTimestamp
+      <*> HasCField.readRaw (BG.Proxy @"micros") ptr0
+
+instance Marshal.WriteRaw DuckDBTimestamp where
+
+  writeRaw =
+    \ptr0 ->
+      \s1 ->
+        case s1 of
+          DuckDBTimestamp micros2 ->
+            HasCField.writeRaw (BG.Proxy @"micros") ptr0 micros2
+
+deriving via Marshal.EquivStorable DuckDBTimestamp instance BG.Storable DuckDBTimestamp
+
+deriving via Struct.IsStructViaReadRaw DuckDBTimestamp instance Struct.IsStruct DuckDBTimestamp
+
+{-| __C declaration:__ @micros@
+
+    __defined at:__ @duckdb.h 657:10@
+
+    __exported by:__ @duckdb.h@
+-}
+instance ( ty ~ HsBindgen.Runtime.LibC.Int64
+         ) => BG.CompatHasField.HasField "micros" DuckDBTimestamp ty where
+
+  hasField =
+    \x0 ->
+      (\y1 ->
+         DuckDBTimestamp {micros = y1}, BG.getField @"micros" x0)
+
+instance ( ty ~ HsBindgen.Runtime.LibC.Int64
+         ) => BG.HasField "micros" (BG.Ptr DuckDBTimestamp) (BG.Ptr ty) where
+
+  getField = HasCField.fromPtr (BG.Proxy @"micros")
+
+instance HasCField.HasCField DuckDBTimestamp "micros" where
+
+  type CFieldType DuckDBTimestamp "micros" =
+    HsBindgen.Runtime.LibC.Int64
+
+  offset# = \_ -> \_ -> 0
+
+{-| Decomposed timestamp components.
+
+    history:
+
+    * stable: v0.2.9
+
+    __C declaration:__ @struct duckdb_timestamp_struct@
+
+    __defined at:__ @duckdb.h 666:8@
+
+    __exported by:__ @duckdb.h@
+-}
+data DuckDBTimestampStruct = DuckDBTimestampStruct
+  { date :: DuckDBDateStruct
+    {- ^ __C declaration:__ @date@
+
+         __defined at:__ @duckdb.h 667:21@
+
+         __exported by:__ @duckdb.h@
+    -}
+  , time :: DuckDBTimeStruct
+    {- ^ __C declaration:__ @time@
+
+         __defined at:__ @duckdb.h 668:21@
+
+         __exported by:__ @duckdb.h@
+    -}
+  }
+  deriving stock (Eq, BG.Generic, Show)
+
+instance Marshal.StaticSize DuckDBTimestampStruct where
+
+  staticSizeOf = \_ -> (16 :: Int)
+
+  staticAlignment = \_ -> (4 :: Int)
+
+instance Marshal.ReadRaw DuckDBTimestampStruct where
+
+  readRaw =
+    \ptr0 ->
+          pure DuckDBTimestampStruct
+      <*> HasCField.readRaw (BG.Proxy @"date") ptr0
+      <*> HasCField.readRaw (BG.Proxy @"time") ptr0
+
+instance Marshal.WriteRaw DuckDBTimestampStruct where
+
+  writeRaw =
+    \ptr0 ->
+      \s1 ->
+        case s1 of
+          DuckDBTimestampStruct date2 time3 ->
+               HasCField.writeRaw (BG.Proxy @"date") ptr0 date2
+            >> HasCField.writeRaw (BG.Proxy @"time") ptr0 time3
+
+deriving via Marshal.EquivStorable DuckDBTimestampStruct instance BG.Storable DuckDBTimestampStruct
+
+deriving via Struct.IsStructViaReadRaw DuckDBTimestampStruct instance Struct.IsStruct DuckDBTimestampStruct
+
+{-| __C declaration:__ @date@
+
+    __defined at:__ @duckdb.h 667:21@
+
+    __exported by:__ @duckdb.h@
+-}
+instance ( ty ~ DuckDBDateStruct
+         ) => BG.CompatHasField.HasField "date" DuckDBTimestampStruct ty where
+
+  hasField =
+    \x0 ->
+      ( \y1 ->
+          DuckDBTimestampStruct {date = y1, time = BG.getField @"time" x0}
+      , BG.getField @"date" x0
+      )
+
+instance ( ty ~ DuckDBDateStruct
+         ) => BG.HasField "date" (BG.Ptr DuckDBTimestampStruct) (BG.Ptr ty) where
+
+  getField = HasCField.fromPtr (BG.Proxy @"date")
+
+instance HasCField.HasCField DuckDBTimestampStruct "date" where
+
+  type CFieldType DuckDBTimestampStruct "date" =
+    DuckDBDateStruct
+
+  offset# = \_ -> \_ -> 0
+
+{-| __C declaration:__ @time@
+
+    __defined at:__ @duckdb.h 668:21@
+
+    __exported by:__ @duckdb.h@
+-}
+instance ( ty ~ DuckDBTimeStruct
+         ) => BG.CompatHasField.HasField "time" DuckDBTimestampStruct ty where
+
+  hasField =
+    \x0 ->
+      ( \y1 ->
+          DuckDBTimestampStruct {time = y1, date = BG.getField @"date" x0}
+      , BG.getField @"time" x0
+      )
+
+instance ( ty ~ DuckDBTimeStruct
+         ) => BG.HasField "time" (BG.Ptr DuckDBTimestampStruct) (BG.Ptr ty) where
+
+  getField = HasCField.fromPtr (BG.Proxy @"time")
+
+instance HasCField.HasCField DuckDBTimestampStruct "time" where
+
+  type CFieldType DuckDBTimestampStruct "time" =
+    DuckDBTimeStruct
+
+  offset# = \_ -> \_ -> 8
+
+{-| TIMESTAMP_S is stored as seconds since 1970-01-01.
+
+    history:
+
+    * stable: v1.2.0
+
+    __C declaration:__ @struct duckdb_timestamp_s@
+
+    __defined at:__ @duckdb.h 677:8@
+
+    __exported by:__ @duckdb.h@
+-}
+data DuckDBTimestampS = DuckDBTimestampS
+  { seconds :: HsBindgen.Runtime.LibC.Int64
+    {- ^ __C declaration:__ @seconds@
+
+         __defined at:__ @duckdb.h 678:10@
+
+         __exported by:__ @duckdb.h@
+    -}
+  }
+  deriving stock (Eq, BG.Generic, Show)
+
+instance Marshal.StaticSize DuckDBTimestampS where
+
+  staticSizeOf = \_ -> (8 :: Int)
+
+  staticAlignment = \_ -> (8 :: Int)
+
+instance Marshal.ReadRaw DuckDBTimestampS where
+
+  readRaw =
+    \ptr0 ->
+          pure DuckDBTimestampS
+      <*> HasCField.readRaw (BG.Proxy @"seconds") ptr0
+
+instance Marshal.WriteRaw DuckDBTimestampS where
+
+  writeRaw =
+    \ptr0 ->
+      \s1 ->
+        case s1 of
+          DuckDBTimestampS seconds2 ->
+            HasCField.writeRaw (BG.Proxy @"seconds") ptr0 seconds2
+
+deriving via Marshal.EquivStorable DuckDBTimestampS instance BG.Storable DuckDBTimestampS
+
+deriving via Struct.IsStructViaReadRaw DuckDBTimestampS instance Struct.IsStruct DuckDBTimestampS
+
+{-| __C declaration:__ @seconds@
+
+    __defined at:__ @duckdb.h 678:10@
+
+    __exported by:__ @duckdb.h@
+-}
+instance ( ty ~ HsBindgen.Runtime.LibC.Int64
+         ) => BG.CompatHasField.HasField "seconds" DuckDBTimestampS ty where
+
+  hasField =
+    \x0 ->
+      (\y1 ->
+         DuckDBTimestampS {seconds = y1}, BG.getField @"seconds" x0)
+
+instance ( ty ~ HsBindgen.Runtime.LibC.Int64
+         ) => BG.HasField "seconds" (BG.Ptr DuckDBTimestampS) (BG.Ptr ty) where
+
+  getField = HasCField.fromPtr (BG.Proxy @"seconds")
+
+instance HasCField.HasCField DuckDBTimestampS "seconds" where
+
+  type CFieldType DuckDBTimestampS "seconds" =
+    HsBindgen.Runtime.LibC.Int64
+
+  offset# = \_ -> \_ -> 0
+
+{-| TIMESTAMP_MS is stored as milliseconds since 1970-01-01.
+
+    history:
+
+    * stable: v1.2.0
+
+    __C declaration:__ @struct duckdb_timestamp_ms@
+
+    __defined at:__ @duckdb.h 687:8@
+
+    __exported by:__ @duckdb.h@
+-}
+data DuckDBTimestampMs = DuckDBTimestampMs
+  { millis :: HsBindgen.Runtime.LibC.Int64
+    {- ^ __C declaration:__ @millis@
+
+         __defined at:__ @duckdb.h 688:10@
+
+         __exported by:__ @duckdb.h@
+    -}
+  }
+  deriving stock (Eq, BG.Generic, Show)
+
+instance Marshal.StaticSize DuckDBTimestampMs where
+
+  staticSizeOf = \_ -> (8 :: Int)
+
+  staticAlignment = \_ -> (8 :: Int)
+
+instance Marshal.ReadRaw DuckDBTimestampMs where
+
+  readRaw =
+    \ptr0 ->
+          pure DuckDBTimestampMs
+      <*> HasCField.readRaw (BG.Proxy @"millis") ptr0
+
+instance Marshal.WriteRaw DuckDBTimestampMs where
+
+  writeRaw =
+    \ptr0 ->
+      \s1 ->
+        case s1 of
+          DuckDBTimestampMs millis2 ->
+            HasCField.writeRaw (BG.Proxy @"millis") ptr0 millis2
+
+deriving via Marshal.EquivStorable DuckDBTimestampMs instance BG.Storable DuckDBTimestampMs
+
+deriving via Struct.IsStructViaReadRaw DuckDBTimestampMs instance Struct.IsStruct DuckDBTimestampMs
+
+{-| __C declaration:__ @millis@
+
+    __defined at:__ @duckdb.h 688:10@
+
+    __exported by:__ @duckdb.h@
+-}
+instance ( ty ~ HsBindgen.Runtime.LibC.Int64
+         ) => BG.CompatHasField.HasField "millis" DuckDBTimestampMs ty where
+
+  hasField =
+    \x0 ->
+      (\y1 ->
+         DuckDBTimestampMs {millis = y1}, BG.getField @"millis" x0)
+
+instance ( ty ~ HsBindgen.Runtime.LibC.Int64
+         ) => BG.HasField "millis" (BG.Ptr DuckDBTimestampMs) (BG.Ptr ty) where
+
+  getField = HasCField.fromPtr (BG.Proxy @"millis")
+
+instance HasCField.HasCField DuckDBTimestampMs "millis" where
+
+  type CFieldType DuckDBTimestampMs "millis" =
+    HsBindgen.Runtime.LibC.Int64
+
+  offset# = \_ -> \_ -> 0
+
+{-| TIMESTAMP_NS is stored as nanoseconds since 1970-01-01.
+
+    history:
+
+    * stable: v1.2.0
+
+    __C declaration:__ @struct duckdb_timestamp_ns@
+
+    __defined at:__ @duckdb.h 697:8@
+
+    __exported by:__ @duckdb.h@
+-}
+data DuckDBTimestampNs = DuckDBTimestampNs
+  { nanos :: HsBindgen.Runtime.LibC.Int64
+    {- ^ __C declaration:__ @nanos@
+
+         __defined at:__ @duckdb.h 698:10@
+
+         __exported by:__ @duckdb.h@
+    -}
+  }
+  deriving stock (Eq, BG.Generic, Show)
+
+instance Marshal.StaticSize DuckDBTimestampNs where
+
+  staticSizeOf = \_ -> (8 :: Int)
+
+  staticAlignment = \_ -> (8 :: Int)
+
+instance Marshal.ReadRaw DuckDBTimestampNs where
+
+  readRaw =
+    \ptr0 ->
+          pure DuckDBTimestampNs
+      <*> HasCField.readRaw (BG.Proxy @"nanos") ptr0
+
+instance Marshal.WriteRaw DuckDBTimestampNs where
+
+  writeRaw =
+    \ptr0 ->
+      \s1 ->
+        case s1 of
+          DuckDBTimestampNs nanos2 ->
+            HasCField.writeRaw (BG.Proxy @"nanos") ptr0 nanos2
+
+deriving via Marshal.EquivStorable DuckDBTimestampNs instance BG.Storable DuckDBTimestampNs
+
+deriving via Struct.IsStructViaReadRaw DuckDBTimestampNs instance Struct.IsStruct DuckDBTimestampNs
+
+{-| __C declaration:__ @nanos@
+
+    __defined at:__ @duckdb.h 698:10@
+
+    __exported by:__ @duckdb.h@
+-}
+instance ( ty ~ HsBindgen.Runtime.LibC.Int64
+         ) => BG.CompatHasField.HasField "nanos" DuckDBTimestampNs ty where
+
+  hasField =
+    \x0 ->
+      (\y1 ->
+         DuckDBTimestampNs {nanos = y1}, BG.getField @"nanos" x0)
+
+instance ( ty ~ HsBindgen.Runtime.LibC.Int64
+         ) => BG.HasField "nanos" (BG.Ptr DuckDBTimestampNs) (BG.Ptr ty) where
+
+  getField = HasCField.fromPtr (BG.Proxy @"nanos")
+
+instance HasCField.HasCField DuckDBTimestampNs "nanos" where
+
+  type CFieldType DuckDBTimestampNs "nanos" =
+    HsBindgen.Runtime.LibC.Int64
+
+  offset# = \_ -> \_ -> 0
+
+{-| INTERVAL is stored in months, days, and micros.
+
+    history:
+
+    * stable: v0.2.1
+
+    __C declaration:__ @struct duckdb_interval@
+
+    __defined at:__ @duckdb.h 707:8@
+
+    __exported by:__ @duckdb.h@
+-}
+data DuckDBInterval = DuckDBInterval
+  { months :: HsBindgen.Runtime.LibC.Int32
+    {- ^ __C declaration:__ @months@
+
+         __defined at:__ @duckdb.h 708:10@
+
+         __exported by:__ @duckdb.h@
+    -}
+  , days :: HsBindgen.Runtime.LibC.Int32
+    {- ^ __C declaration:__ @days@
+
+         __defined at:__ @duckdb.h 709:10@
+
+         __exported by:__ @duckdb.h@
+    -}
+  , micros :: HsBindgen.Runtime.LibC.Int64
+    {- ^ __C declaration:__ @micros@
+
+         __defined at:__ @duckdb.h 710:10@
+
+         __exported by:__ @duckdb.h@
+    -}
+  }
+  deriving stock (Eq, BG.Generic, Show)
+
+instance Marshal.StaticSize DuckDBInterval where
+
+  staticSizeOf = \_ -> (16 :: Int)
+
+  staticAlignment = \_ -> (8 :: Int)
+
+instance Marshal.ReadRaw DuckDBInterval where
+
+  readRaw =
+    \ptr0 ->
+          pure DuckDBInterval
+      <*> HasCField.readRaw (BG.Proxy @"months") ptr0
+      <*> HasCField.readRaw (BG.Proxy @"days") ptr0
+      <*> HasCField.readRaw (BG.Proxy @"micros") ptr0
+
+instance Marshal.WriteRaw DuckDBInterval where
+
+  writeRaw =
+    \ptr0 ->
+      \s1 ->
+        case s1 of
+          DuckDBInterval months2 days3 micros4 ->
+               HasCField.writeRaw (BG.Proxy @"months") ptr0 months2
+            >> HasCField.writeRaw (BG.Proxy @"days") ptr0 days3
+            >> HasCField.writeRaw (BG.Proxy @"micros") ptr0 micros4
+
+deriving via Marshal.EquivStorable DuckDBInterval instance BG.Storable DuckDBInterval
+
+deriving via Struct.IsStructViaReadRaw DuckDBInterval instance Struct.IsStruct DuckDBInterval
+
+{-| __C declaration:__ @months@
+
+    __defined at:__ @duckdb.h 708:10@
+
+    __exported by:__ @duckdb.h@
+-}
+instance ( ty ~ HsBindgen.Runtime.LibC.Int32
+         ) => BG.CompatHasField.HasField "months" DuckDBInterval ty where
+
+  hasField =
+    \x0 ->
+      ( \y1 ->
+          DuckDBInterval {months = y1, days = BG.getField @"days" x0, micros = BG.getField @"micros" x0}
+      , BG.getField @"months" x0
+      )
+
+instance ( ty ~ HsBindgen.Runtime.LibC.Int32
+         ) => BG.HasField "months" (BG.Ptr DuckDBInterval) (BG.Ptr ty) where
+
+  getField = HasCField.fromPtr (BG.Proxy @"months")
+
+instance HasCField.HasCField DuckDBInterval "months" where
+
+  type CFieldType DuckDBInterval "months" =
+    HsBindgen.Runtime.LibC.Int32
+
+  offset# = \_ -> \_ -> 0
+
+{-| __C declaration:__ @days@
+
+    __defined at:__ @duckdb.h 709:10@
+
+    __exported by:__ @duckdb.h@
+-}
+instance ( ty ~ HsBindgen.Runtime.LibC.Int32
+         ) => BG.CompatHasField.HasField "days" DuckDBInterval ty where
+
+  hasField =
+    \x0 ->
+      ( \y1 ->
+          DuckDBInterval { days = y1
+                         , months = BG.getField @"months" x0
+                         , micros = BG.getField @"micros" x0
+                         }
+      , BG.getField @"days" x0
+      )
+
+instance ( ty ~ HsBindgen.Runtime.LibC.Int32
+         ) => BG.HasField "days" (BG.Ptr DuckDBInterval) (BG.Ptr ty) where
+
+  getField = HasCField.fromPtr (BG.Proxy @"days")
+
+instance HasCField.HasCField DuckDBInterval "days" where
+
+  type CFieldType DuckDBInterval "days" =
+    HsBindgen.Runtime.LibC.Int32
+
+  offset# = \_ -> \_ -> 4
+
+{-| __C declaration:__ @micros@
+
+    __defined at:__ @duckdb.h 710:10@
+
+    __exported by:__ @duckdb.h@
+-}
+instance ( ty ~ HsBindgen.Runtime.LibC.Int64
+         ) => BG.CompatHasField.HasField "micros" DuckDBInterval ty where
+
+  hasField =
+    \x0 ->
+      ( \y1 ->
+          DuckDBInterval {micros = y1, months = BG.getField @"months" x0, days = BG.getField @"days" x0}
+      , BG.getField @"micros" x0
+      )
+
+instance ( ty ~ HsBindgen.Runtime.LibC.Int64
+         ) => BG.HasField "micros" (BG.Ptr DuckDBInterval) (BG.Ptr ty) where
+
+  getField = HasCField.fromPtr (BG.Proxy @"micros")
+
+instance HasCField.HasCField DuckDBInterval "micros" where
+
+  type CFieldType DuckDBInterval "micros" =
+    HsBindgen.Runtime.LibC.Int64
+
+  offset# = \_ -> \_ -> 8
+
+{-| HUGEINT is composed of a lower and upper component. Value is upper * 2^64 + lower.
+
+    history:
+
+    * stable: v0.2.1
+
+    __C declaration:__ @struct duckdb_hugeint@
+
+    __defined at:__ @duckdb.h 719:8@
+
+    __exported by:__ @duckdb.h@
+-}
+data DuckDBHugeInt = DuckDBHugeInt
+  { lower :: HsBindgen.Runtime.LibC.Word64
+    {- ^ __C declaration:__ @lower@
+
+         __defined at:__ @duckdb.h 720:11@
+
+         __exported by:__ @duckdb.h@
+    -}
+  , upper :: HsBindgen.Runtime.LibC.Int64
+    {- ^ __C declaration:__ @upper@
+
+         __defined at:__ @duckdb.h 721:10@
+
+         __exported by:__ @duckdb.h@
+    -}
+  }
+  deriving stock (Eq, BG.Generic, Show)
+
+instance Marshal.StaticSize DuckDBHugeInt where
+
+  staticSizeOf = \_ -> (16 :: Int)
+
+  staticAlignment = \_ -> (8 :: Int)
+
+instance Marshal.ReadRaw DuckDBHugeInt where
+
+  readRaw =
+    \ptr0 ->
+          pure DuckDBHugeInt
+      <*> HasCField.readRaw (BG.Proxy @"lower") ptr0
+      <*> HasCField.readRaw (BG.Proxy @"upper") ptr0
+
+instance Marshal.WriteRaw DuckDBHugeInt where
+
+  writeRaw =
+    \ptr0 ->
+      \s1 ->
+        case s1 of
+          DuckDBHugeInt lower2 upper3 ->
+               HasCField.writeRaw (BG.Proxy @"lower") ptr0 lower2
+            >> HasCField.writeRaw (BG.Proxy @"upper") ptr0 upper3
+
+deriving via Marshal.EquivStorable DuckDBHugeInt instance BG.Storable DuckDBHugeInt
+
+deriving via Struct.IsStructViaReadRaw DuckDBHugeInt instance Struct.IsStruct DuckDBHugeInt
+
+{-| __C declaration:__ @lower@
+
+    __defined at:__ @duckdb.h 720:11@
+
+    __exported by:__ @duckdb.h@
+-}
+instance ( ty ~ HsBindgen.Runtime.LibC.Word64
+         ) => BG.CompatHasField.HasField "lower" DuckDBHugeInt ty where
+
+  hasField =
+    \x0 ->
+      ( \y1 ->
+          DuckDBHugeInt {lower = y1, upper = BG.getField @"upper" x0}
+      , BG.getField @"lower" x0
+      )
+
+instance ( ty ~ HsBindgen.Runtime.LibC.Word64
+         ) => BG.HasField "lower" (BG.Ptr DuckDBHugeInt) (BG.Ptr ty) where
+
+  getField = HasCField.fromPtr (BG.Proxy @"lower")
+
+instance HasCField.HasCField DuckDBHugeInt "lower" where
+
+  type CFieldType DuckDBHugeInt "lower" =
+    HsBindgen.Runtime.LibC.Word64
+
+  offset# = \_ -> \_ -> 0
+
+{-| __C declaration:__ @upper@
+
+    __defined at:__ @duckdb.h 721:10@
+
+    __exported by:__ @duckdb.h@
+-}
+instance ( ty ~ HsBindgen.Runtime.LibC.Int64
+         ) => BG.CompatHasField.HasField "upper" DuckDBHugeInt ty where
+
+  hasField =
+    \x0 ->
+      ( \y1 ->
+          DuckDBHugeInt {upper = y1, lower = BG.getField @"lower" x0}
+      , BG.getField @"upper" x0
+      )
+
+instance ( ty ~ HsBindgen.Runtime.LibC.Int64
+         ) => BG.HasField "upper" (BG.Ptr DuckDBHugeInt) (BG.Ptr ty) where
+
+  getField = HasCField.fromPtr (BG.Proxy @"upper")
+
+instance HasCField.HasCField DuckDBHugeInt "upper" where
+
+  type CFieldType DuckDBHugeInt "upper" =
+    HsBindgen.Runtime.LibC.Int64
+
+  offset# = \_ -> \_ -> 8
+
+{-| UHUGEINT is composed of a lower and upper component. Value is upper * 2^64 + lower.
+
+    history:
+
+    * stable: v0.10.0
+
+    __C declaration:__ @struct duckdb_uhugeint@
+
+    __defined at:__ @duckdb.h 730:8@
+
+    __exported by:__ @duckdb.h@
+-}
+data DuckDBUHugeInt = DuckDBUHugeInt
+  { lower :: HsBindgen.Runtime.LibC.Word64
+    {- ^ __C declaration:__ @lower@
+
+         __defined at:__ @duckdb.h 731:11@
+
+         __exported by:__ @duckdb.h@
+    -}
+  , upper :: HsBindgen.Runtime.LibC.Word64
+    {- ^ __C declaration:__ @upper@
+
+         __defined at:__ @duckdb.h 732:11@
+
+         __exported by:__ @duckdb.h@
+    -}
+  }
+  deriving stock (Eq, BG.Generic, Show)
+
+instance Marshal.StaticSize DuckDBUHugeInt where
+
+  staticSizeOf = \_ -> (16 :: Int)
+
+  staticAlignment = \_ -> (8 :: Int)
+
+instance Marshal.ReadRaw DuckDBUHugeInt where
+
+  readRaw =
+    \ptr0 ->
+          pure DuckDBUHugeInt
+      <*> HasCField.readRaw (BG.Proxy @"lower") ptr0
+      <*> HasCField.readRaw (BG.Proxy @"upper") ptr0
+
+instance Marshal.WriteRaw DuckDBUHugeInt where
+
+  writeRaw =
+    \ptr0 ->
+      \s1 ->
+        case s1 of
+          DuckDBUHugeInt lower2 upper3 ->
+               HasCField.writeRaw (BG.Proxy @"lower") ptr0 lower2
+            >> HasCField.writeRaw (BG.Proxy @"upper") ptr0 upper3
+
+deriving via Marshal.EquivStorable DuckDBUHugeInt instance BG.Storable DuckDBUHugeInt
+
+deriving via Struct.IsStructViaReadRaw DuckDBUHugeInt instance Struct.IsStruct DuckDBUHugeInt
+
+{-| __C declaration:__ @lower@
+
+    __defined at:__ @duckdb.h 731:11@
+
+    __exported by:__ @duckdb.h@
+-}
+instance ( ty ~ HsBindgen.Runtime.LibC.Word64
+         ) => BG.CompatHasField.HasField "lower" DuckDBUHugeInt ty where
+
+  hasField =
+    \x0 ->
+      ( \y1 ->
+          DuckDBUHugeInt {lower = y1, upper = BG.getField @"upper" x0}
+      , BG.getField @"lower" x0
+      )
+
+instance ( ty ~ HsBindgen.Runtime.LibC.Word64
+         ) => BG.HasField "lower" (BG.Ptr DuckDBUHugeInt) (BG.Ptr ty) where
+
+  getField = HasCField.fromPtr (BG.Proxy @"lower")
+
+instance HasCField.HasCField DuckDBUHugeInt "lower" where
+
+  type CFieldType DuckDBUHugeInt "lower" =
+    HsBindgen.Runtime.LibC.Word64
+
+  offset# = \_ -> \_ -> 0
+
+{-| __C declaration:__ @upper@
+
+    __defined at:__ @duckdb.h 732:11@
+
+    __exported by:__ @duckdb.h@
+-}
+instance ( ty ~ HsBindgen.Runtime.LibC.Word64
+         ) => BG.CompatHasField.HasField "upper" DuckDBUHugeInt ty where
+
+  hasField =
+    \x0 ->
+      ( \y1 ->
+          DuckDBUHugeInt {upper = y1, lower = BG.getField @"lower" x0}
+      , BG.getField @"upper" x0
+      )
+
+instance ( ty ~ HsBindgen.Runtime.LibC.Word64
+         ) => BG.HasField "upper" (BG.Ptr DuckDBUHugeInt) (BG.Ptr ty) where
+
+  getField = HasCField.fromPtr (BG.Proxy @"upper")
+
+instance HasCField.HasCField DuckDBUHugeInt "upper" where
+
+  type CFieldType DuckDBUHugeInt "upper" =
+    HsBindgen.Runtime.LibC.Word64
+
+  offset# = \_ -> \_ -> 8
+
+{-| DECIMAL is composed of a width and a scale. Value is stored in a HUGEINT.
+
+    history:
+
+    * stable: v0.3.3
+
+    __C declaration:__ @struct duckdb_decimal@
+
+    __defined at:__ @duckdb.h 741:8@
+
+    __exported by:__ @duckdb.h@
+-}
+data DuckDBDecimal = DuckDBDecimal
+  { width :: HsBindgen.Runtime.LibC.Word8
+    {- ^ __C declaration:__ @width@
+
+         __defined at:__ @duckdb.h 742:10@
+
+         __exported by:__ @duckdb.h@
+    -}
+  , scale :: HsBindgen.Runtime.LibC.Word8
+    {- ^ __C declaration:__ @scale@
+
+         __defined at:__ @duckdb.h 743:10@
+
+         __exported by:__ @duckdb.h@
+    -}
+  , value :: DuckDBHugeInt
+    {- ^ __C declaration:__ @value@
+
+         __defined at:__ @duckdb.h 744:17@
+
+         __exported by:__ @duckdb.h@
+    -}
+  }
+  deriving stock (Eq, BG.Generic, Show)
+
+instance Marshal.StaticSize DuckDBDecimal where
+
+  staticSizeOf = \_ -> (24 :: Int)
+
+  staticAlignment = \_ -> (8 :: Int)
+
+instance Marshal.ReadRaw DuckDBDecimal where
+
+  readRaw =
+    \ptr0 ->
+          pure DuckDBDecimal
+      <*> HasCField.readRaw (BG.Proxy @"width") ptr0
+      <*> HasCField.readRaw (BG.Proxy @"scale") ptr0
+      <*> HasCField.readRaw (BG.Proxy @"value") ptr0
+
+instance Marshal.WriteRaw DuckDBDecimal where
+
+  writeRaw =
+    \ptr0 ->
+      \s1 ->
+        case s1 of
+          DuckDBDecimal width2 scale3 value4 ->
+               HasCField.writeRaw (BG.Proxy @"width") ptr0 width2
+            >> HasCField.writeRaw (BG.Proxy @"scale") ptr0 scale3
+            >> HasCField.writeRaw (BG.Proxy @"value") ptr0 value4
+
+deriving via Marshal.EquivStorable DuckDBDecimal instance BG.Storable DuckDBDecimal
+
+deriving via Struct.IsStructViaReadRaw DuckDBDecimal instance Struct.IsStruct DuckDBDecimal
+
+{-| __C declaration:__ @width@
+
+    __defined at:__ @duckdb.h 742:10@
+
+    __exported by:__ @duckdb.h@
+-}
+instance ( ty ~ HsBindgen.Runtime.LibC.Word8
+         ) => BG.CompatHasField.HasField "width" DuckDBDecimal ty where
+
+  hasField =
+    \x0 ->
+      ( \y1 ->
+          DuckDBDecimal {width = y1, scale = BG.getField @"scale" x0, value = BG.getField @"value" x0}
+      , BG.getField @"width" x0
+      )
+
+instance ( ty ~ HsBindgen.Runtime.LibC.Word8
+         ) => BG.HasField "width" (BG.Ptr DuckDBDecimal) (BG.Ptr ty) where
+
+  getField = HasCField.fromPtr (BG.Proxy @"width")
+
+instance HasCField.HasCField DuckDBDecimal "width" where
+
+  type CFieldType DuckDBDecimal "width" =
+    HsBindgen.Runtime.LibC.Word8
+
+  offset# = \_ -> \_ -> 0
+
+{-| __C declaration:__ @scale@
+
+    __defined at:__ @duckdb.h 743:10@
+
+    __exported by:__ @duckdb.h@
+-}
+instance ( ty ~ HsBindgen.Runtime.LibC.Word8
+         ) => BG.CompatHasField.HasField "scale" DuckDBDecimal ty where
+
+  hasField =
+    \x0 ->
+      ( \y1 ->
+          DuckDBDecimal {scale = y1, width = BG.getField @"width" x0, value = BG.getField @"value" x0}
+      , BG.getField @"scale" x0
+      )
+
+instance ( ty ~ HsBindgen.Runtime.LibC.Word8
+         ) => BG.HasField "scale" (BG.Ptr DuckDBDecimal) (BG.Ptr ty) where
+
+  getField = HasCField.fromPtr (BG.Proxy @"scale")
+
+instance HasCField.HasCField DuckDBDecimal "scale" where
+
+  type CFieldType DuckDBDecimal "scale" =
+    HsBindgen.Runtime.LibC.Word8
+
+  offset# = \_ -> \_ -> 1
+
+{-| __C declaration:__ @value@
+
+    __defined at:__ @duckdb.h 744:17@
+
+    __exported by:__ @duckdb.h@
+-}
+instance ( ty ~ DuckDBHugeInt
+         ) => BG.CompatHasField.HasField "value" DuckDBDecimal ty where
+
+  hasField =
+    \x0 ->
+      ( \y1 ->
+          DuckDBDecimal {value = y1, width = BG.getField @"width" x0, scale = BG.getField @"scale" x0}
+      , BG.getField @"value" x0
+      )
+
+instance ( ty ~ DuckDBHugeInt
+         ) => BG.HasField "value" (BG.Ptr DuckDBDecimal) (BG.Ptr ty) where
+
+  getField = HasCField.fromPtr (BG.Proxy @"value")
+
+instance HasCField.HasCField DuckDBDecimal "value" where
+
+  type CFieldType DuckDBDecimal "value" = DuckDBHugeInt
+
+  offset# = \_ -> \_ -> 8
+
+{-| A type holding information about the query execution progress.
+
+    history:
+
+    * stable: v0.10.0
+
+    __C declaration:__ @struct duckdb_query_progress_type@
+
+    __defined at:__ @duckdb.h 753:8@
+
+    __exported by:__ @duckdb.h@
+-}
+data DuckDBQueryProgress = DuckDBQueryProgress
+  { percentage :: BG.CDouble
+    {- ^ __C declaration:__ @percentage@
+
+         __defined at:__ @duckdb.h 754:9@
+
+         __exported by:__ @duckdb.h@
+    -}
+  , rows_processed :: HsBindgen.Runtime.LibC.Word64
+    {- ^ __C declaration:__ @rows_processed@
+
+         __defined at:__ @duckdb.h 755:11@
+
+         __exported by:__ @duckdb.h@
+    -}
+  , total_rows_to_process :: HsBindgen.Runtime.LibC.Word64
+    {- ^ __C declaration:__ @total_rows_to_process@
+
+         __defined at:__ @duckdb.h 756:11@
+
+         __exported by:__ @duckdb.h@
+    -}
+  }
+  deriving stock (Eq, BG.Generic, Show)
+
+instance Marshal.StaticSize DuckDBQueryProgress where
+
+  staticSizeOf = \_ -> (24 :: Int)
+
+  staticAlignment = \_ -> (8 :: Int)
+
+instance Marshal.ReadRaw DuckDBQueryProgress where
+
+  readRaw =
+    \ptr0 ->
+          pure DuckDBQueryProgress
+      <*> HasCField.readRaw (BG.Proxy @"percentage") ptr0
+      <*> HasCField.readRaw (BG.Proxy @"rows_processed") ptr0
+      <*> HasCField.readRaw (BG.Proxy @"total_rows_to_process") ptr0
+
+instance Marshal.WriteRaw DuckDBQueryProgress where
+
+  writeRaw =
+    \ptr0 ->
+      \s1 ->
+        case s1 of
+          DuckDBQueryProgress percentage2 rows_processed3 total_rows_to_process4 ->
+               HasCField.writeRaw (BG.Proxy @"percentage") ptr0 percentage2
+            >> HasCField.writeRaw (BG.Proxy @"rows_processed") ptr0 rows_processed3
+            >> HasCField.writeRaw (BG.Proxy @"total_rows_to_process") ptr0 total_rows_to_process4
+
+deriving via Marshal.EquivStorable DuckDBQueryProgress instance BG.Storable DuckDBQueryProgress
+
+deriving via Struct.IsStructViaReadRaw DuckDBQueryProgress instance Struct.IsStruct DuckDBQueryProgress
+
+{-| __C declaration:__ @percentage@
+
+    __defined at:__ @duckdb.h 754:9@
+
+    __exported by:__ @duckdb.h@
+-}
+instance ( ty ~ BG.CDouble
+         ) => BG.CompatHasField.HasField "percentage" DuckDBQueryProgress ty where
+
+  hasField =
+    \x0 ->
+      ( \y1 ->
+          DuckDBQueryProgress { percentage = y1
+                              , rows_processed = BG.getField @"rows_processed" x0
+                              , total_rows_to_process = BG.getField @"total_rows_to_process" x0
+                              }
+      , BG.getField @"percentage" x0
+      )
+
+instance ( ty ~ BG.CDouble
+         ) => BG.HasField "percentage" (BG.Ptr DuckDBQueryProgress) (BG.Ptr ty) where
+
+  getField = HasCField.fromPtr (BG.Proxy @"percentage")
+
+instance HasCField.HasCField DuckDBQueryProgress "percentage" where
+
+  type CFieldType DuckDBQueryProgress "percentage" =
+    BG.CDouble
+
+  offset# = \_ -> \_ -> 0
+
+{-| __C declaration:__ @rows_processed@
+
+    __defined at:__ @duckdb.h 755:11@
+
+    __exported by:__ @duckdb.h@
+-}
+instance ( ty ~ HsBindgen.Runtime.LibC.Word64
+         ) => BG.CompatHasField.HasField "rows_processed" DuckDBQueryProgress ty where
+
+  hasField =
+    \x0 ->
+      ( \y1 ->
+          DuckDBQueryProgress { rows_processed = y1
+                              , percentage = BG.getField @"percentage" x0
+                              , total_rows_to_process = BG.getField @"total_rows_to_process" x0
+                              }
+      , BG.getField @"rows_processed" x0
+      )
+
+instance ( ty ~ HsBindgen.Runtime.LibC.Word64
+         ) => BG.HasField "rows_processed" (BG.Ptr DuckDBQueryProgress) (BG.Ptr ty) where
+
+  getField =
+    HasCField.fromPtr (BG.Proxy @"rows_processed")
+
+instance HasCField.HasCField DuckDBQueryProgress "rows_processed" where
+
+  type CFieldType DuckDBQueryProgress "rows_processed" =
+    HsBindgen.Runtime.LibC.Word64
+
+  offset# = \_ -> \_ -> 8
+
+{-| __C declaration:__ @total_rows_to_process@
+
+    __defined at:__ @duckdb.h 756:11@
+
+    __exported by:__ @duckdb.h@
+-}
+instance ( ty ~ HsBindgen.Runtime.LibC.Word64
+         ) => BG.CompatHasField.HasField "total_rows_to_process" DuckDBQueryProgress ty where
+
+  hasField =
+    \x0 ->
+      ( \y1 ->
+          DuckDBQueryProgress { total_rows_to_process = y1
+                              , percentage = BG.getField @"percentage" x0
+                              , rows_processed = BG.getField @"rows_processed" x0
+                              }
+      , BG.getField @"total_rows_to_process" x0
+      )
+
+instance ( ty ~ HsBindgen.Runtime.LibC.Word64
+         ) => BG.HasField "total_rows_to_process" (BG.Ptr DuckDBQueryProgress) (BG.Ptr ty) where
+
+  getField =
+    HasCField.fromPtr (BG.Proxy @"total_rows_to_process")
+
+instance HasCField.HasCField DuckDBQueryProgress "total_rows_to_process" where
+
+  type CFieldType DuckDBQueryProgress "total_rows_to_process" =
+    HsBindgen.Runtime.LibC.Word64
+
+  offset# = \_ -> \_ -> 16
+
+{-| Internal representation of a LIST metadata entry.
+
+    history:
+
+    * stable: v0.7.0
+
+    __C declaration:__ @struct duckdb_list_entry@
+
+    __defined at:__ @duckdb.h 765:8@
+
+    __exported by:__ @duckdb.h@
+-}
+data DuckDBListEntry = DuckDBListEntry
+  { offset :: HsBindgen.Runtime.LibC.Word64
+    {- ^ __C declaration:__ @offset@
+
+         __defined at:__ @duckdb.h 766:11@
+
+         __exported by:__ @duckdb.h@
+    -}
+  , length :: HsBindgen.Runtime.LibC.Word64
+    {- ^ __C declaration:__ @length@
+
+         __defined at:__ @duckdb.h 767:11@
+
+         __exported by:__ @duckdb.h@
+    -}
+  }
+  deriving stock (Eq, BG.Generic, Show)
+
+instance Marshal.StaticSize DuckDBListEntry where
+
+  staticSizeOf = \_ -> (16 :: Int)
+
+  staticAlignment = \_ -> (8 :: Int)
+
+instance Marshal.ReadRaw DuckDBListEntry where
+
+  readRaw =
+    \ptr0 ->
+          pure DuckDBListEntry
+      <*> HasCField.readRaw (BG.Proxy @"offset") ptr0
+      <*> HasCField.readRaw (BG.Proxy @"length") ptr0
+
+instance Marshal.WriteRaw DuckDBListEntry where
+
+  writeRaw =
+    \ptr0 ->
+      \s1 ->
+        case s1 of
+          DuckDBListEntry offset2 length3 ->
+               HasCField.writeRaw (BG.Proxy @"offset") ptr0 offset2
+            >> HasCField.writeRaw (BG.Proxy @"length") ptr0 length3
+
+deriving via Marshal.EquivStorable DuckDBListEntry instance BG.Storable DuckDBListEntry
+
+deriving via Struct.IsStructViaReadRaw DuckDBListEntry instance Struct.IsStruct DuckDBListEntry
+
+{-| __C declaration:__ @offset@
+
+    __defined at:__ @duckdb.h 766:11@
+
+    __exported by:__ @duckdb.h@
+-}
+instance ( ty ~ HsBindgen.Runtime.LibC.Word64
+         ) => BG.CompatHasField.HasField "offset" DuckDBListEntry ty where
+
+  hasField =
+    \x0 ->
+      ( \y1 ->
+          DuckDBListEntry {offset = y1, length = BG.getField @"length" x0}
+      , BG.getField @"offset" x0
+      )
+
+instance ( ty ~ HsBindgen.Runtime.LibC.Word64
+         ) => BG.HasField "offset" (BG.Ptr DuckDBListEntry) (BG.Ptr ty) where
+
+  getField = HasCField.fromPtr (BG.Proxy @"offset")
+
+instance HasCField.HasCField DuckDBListEntry "offset" where
+
+  type CFieldType DuckDBListEntry "offset" =
+    HsBindgen.Runtime.LibC.Word64
+
+  offset# = \_ -> \_ -> 0
+
+{-| __C declaration:__ @length@
+
+    __defined at:__ @duckdb.h 767:11@
+
+    __exported by:__ @duckdb.h@
+-}
+instance ( ty ~ HsBindgen.Runtime.LibC.Word64
+         ) => BG.CompatHasField.HasField "length" DuckDBListEntry ty where
+
+  hasField =
+    \x0 ->
+      ( \y1 ->
+          DuckDBListEntry {length = y1, offset = BG.getField @"offset" x0}
+      , BG.getField @"length" x0
+      )
+
+instance ( ty ~ HsBindgen.Runtime.LibC.Word64
+         ) => BG.HasField "length" (BG.Ptr DuckDBListEntry) (BG.Ptr ty) where
+
+  getField = HasCField.fromPtr (BG.Proxy @"length")
+
+instance HasCField.HasCField DuckDBListEntry "length" where
+
+  type CFieldType DuckDBListEntry "length" =
+    HsBindgen.Runtime.LibC.Word64
+
+  offset# = \_ -> \_ -> 8
+
+{-| A column in a result. Use accessor functions rather than accessing fields directly.
+
+    history:
+
+    * stable: v0.1.0
+
+    __C declaration:__ @struct duckdb_column@
+
+    __defined at:__ @duckdb.h 776:8@
+
+    __exported by:__ @duckdb.h@
+-}
+data DuckDBColumn = DuckDBColumn
+  { deprecated_data :: BG.Ptr BG.Void
+    {- ^ __C declaration:__ @deprecated_data@
+
+         __defined at:__ @duckdb.h 777:8@
+
+         __exported by:__ @duckdb.h@
+    -}
+  , deprecated_nullmask :: BG.Ptr BG.CBool
+    {- ^ __C declaration:__ @deprecated_nullmask@
+
+         __defined at:__ @duckdb.h 778:8@
+
+         __exported by:__ @duckdb.h@
+    -}
+  , deprecated_type :: DuckDBTypeAlias
+    {- ^ __C declaration:__ @deprecated_type@
+
+         __defined at:__ @duckdb.h 779:14@
+
+         __exported by:__ @duckdb.h@
+    -}
+  , deprecated_name :: BG.Ptr BG.CChar
+    {- ^ __C declaration:__ @deprecated_name@
+
+         __defined at:__ @duckdb.h 780:8@
+
+         __exported by:__ @duckdb.h@
+    -}
+  , internal_data :: BG.Ptr BG.Void
+    {- ^ __C declaration:__ @internal_data@
+
+         __defined at:__ @duckdb.h 781:8@
+
+         __exported by:__ @duckdb.h@
+    -}
+  }
+  deriving stock (Eq, BG.Generic, Show)
+
+instance Marshal.StaticSize DuckDBColumn where
+
+  staticSizeOf = \_ -> (40 :: Int)
+
+  staticAlignment = \_ -> (8 :: Int)
+
+instance Marshal.ReadRaw DuckDBColumn where
+
+  readRaw =
+    \ptr0 ->
+          pure DuckDBColumn
+      <*> HasCField.readRaw (BG.Proxy @"deprecated_data") ptr0
+      <*> HasCField.readRaw (BG.Proxy @"deprecated_nullmask") ptr0
+      <*> HasCField.readRaw (BG.Proxy @"deprecated_type") ptr0
+      <*> HasCField.readRaw (BG.Proxy @"deprecated_name") ptr0
+      <*> HasCField.readRaw (BG.Proxy @"internal_data") ptr0
+
+instance Marshal.WriteRaw DuckDBColumn where
+
+  writeRaw =
+    \ptr0 ->
+      \s1 ->
+        case s1 of
+          DuckDBColumn
+            deprecated_data2
+            deprecated_nullmask3
+            deprecated_type4
+            deprecated_name5
+            internal_data6 ->
+                 HasCField.writeRaw (BG.Proxy @"deprecated_data") ptr0 deprecated_data2
+              >> HasCField.writeRaw (BG.Proxy @"deprecated_nullmask") ptr0 deprecated_nullmask3
+              >> HasCField.writeRaw (BG.Proxy @"deprecated_type") ptr0 deprecated_type4
+              >> HasCField.writeRaw (BG.Proxy @"deprecated_name") ptr0 deprecated_name5
+              >> HasCField.writeRaw (BG.Proxy @"internal_data") ptr0 internal_data6
+
+deriving via Marshal.EquivStorable DuckDBColumn instance BG.Storable DuckDBColumn
+
+deriving via Struct.IsStructViaReadRaw DuckDBColumn instance Struct.IsStruct DuckDBColumn
+
+{-| __C declaration:__ @deprecated_data@
+
+    __defined at:__ @duckdb.h 777:8@
+
+    __exported by:__ @duckdb.h@
+-}
+instance ( ty ~ BG.Ptr BG.Void
+         ) => BG.CompatHasField.HasField "deprecated_data" DuckDBColumn ty where
+
+  hasField =
+    \x0 ->
+      ( \y1 ->
+          DuckDBColumn { deprecated_data = y1
+                       , deprecated_nullmask = BG.getField @"deprecated_nullmask" x0
+                       , deprecated_type = BG.getField @"deprecated_type" x0
+                       , deprecated_name = BG.getField @"deprecated_name" x0
+                       , internal_data = BG.getField @"internal_data" x0
+                       }
+      , BG.getField @"deprecated_data" x0
+      )
+
+instance ( ty ~ BG.Ptr BG.Void
+         ) => BG.HasField "deprecated_data" (BG.Ptr DuckDBColumn) (BG.Ptr ty) where
+
+  getField =
+    HasCField.fromPtr (BG.Proxy @"deprecated_data")
+
+instance HasCField.HasCField DuckDBColumn "deprecated_data" where
+
+  type CFieldType DuckDBColumn "deprecated_data" =
+    BG.Ptr BG.Void
+
+  offset# = \_ -> \_ -> 0
+
+{-| __C declaration:__ @deprecated_nullmask@
+
+    __defined at:__ @duckdb.h 778:8@
+
+    __exported by:__ @duckdb.h@
+-}
+instance ( ty ~ BG.Ptr BG.CBool
+         ) => BG.CompatHasField.HasField "deprecated_nullmask" DuckDBColumn ty where
+
+  hasField =
+    \x0 ->
+      ( \y1 ->
+          DuckDBColumn { deprecated_nullmask = y1
+                       , deprecated_data = BG.getField @"deprecated_data" x0
+                       , deprecated_type = BG.getField @"deprecated_type" x0
+                       , deprecated_name = BG.getField @"deprecated_name" x0
+                       , internal_data = BG.getField @"internal_data" x0
+                       }
+      , BG.getField @"deprecated_nullmask" x0
+      )
+
+instance ( ty ~ BG.Ptr BG.CBool
+         ) => BG.HasField "deprecated_nullmask" (BG.Ptr DuckDBColumn) (BG.Ptr ty) where
+
+  getField =
+    HasCField.fromPtr (BG.Proxy @"deprecated_nullmask")
+
+instance HasCField.HasCField DuckDBColumn "deprecated_nullmask" where
+
+  type CFieldType DuckDBColumn "deprecated_nullmask" =
+    BG.Ptr BG.CBool
+
+  offset# = \_ -> \_ -> 8
+
+{-| __C declaration:__ @deprecated_type@
+
+    __defined at:__ @duckdb.h 779:14@
+
+    __exported by:__ @duckdb.h@
+-}
+instance ( ty ~ DuckDBTypeAlias
+         ) => BG.CompatHasField.HasField "deprecated_type" DuckDBColumn ty where
+
+  hasField =
+    \x0 ->
+      ( \y1 ->
+          DuckDBColumn { deprecated_type = y1
+                       , deprecated_data = BG.getField @"deprecated_data" x0
+                       , deprecated_nullmask = BG.getField @"deprecated_nullmask" x0
+                       , deprecated_name = BG.getField @"deprecated_name" x0
+                       , internal_data = BG.getField @"internal_data" x0
+                       }
+      , BG.getField @"deprecated_type" x0
+      )
+
+instance ( ty ~ DuckDBTypeAlias
+         ) => BG.HasField "deprecated_type" (BG.Ptr DuckDBColumn) (BG.Ptr ty) where
+
+  getField =
+    HasCField.fromPtr (BG.Proxy @"deprecated_type")
+
+instance HasCField.HasCField DuckDBColumn "deprecated_type" where
+
+  type CFieldType DuckDBColumn "deprecated_type" =
+    DuckDBTypeAlias
+
+  offset# = \_ -> \_ -> 16
+
+{-| __C declaration:__ @deprecated_name@
+
+    __defined at:__ @duckdb.h 780:8@
+
+    __exported by:__ @duckdb.h@
+-}
+instance ( ty ~ BG.Ptr BG.CChar
+         ) => BG.CompatHasField.HasField "deprecated_name" DuckDBColumn ty where
+
+  hasField =
+    \x0 ->
+      ( \y1 ->
+          DuckDBColumn { deprecated_name = y1
+                       , deprecated_data = BG.getField @"deprecated_data" x0
+                       , deprecated_nullmask = BG.getField @"deprecated_nullmask" x0
+                       , deprecated_type = BG.getField @"deprecated_type" x0
+                       , internal_data = BG.getField @"internal_data" x0
+                       }
+      , BG.getField @"deprecated_name" x0
+      )
+
+instance ( ty ~ BG.Ptr BG.CChar
+         ) => BG.HasField "deprecated_name" (BG.Ptr DuckDBColumn) (BG.Ptr ty) where
+
+  getField =
+    HasCField.fromPtr (BG.Proxy @"deprecated_name")
+
+instance HasCField.HasCField DuckDBColumn "deprecated_name" where
+
+  type CFieldType DuckDBColumn "deprecated_name" =
+    BG.Ptr BG.CChar
+
+  offset# = \_ -> \_ -> 24
+
+{-| __C declaration:__ @internal_data@
+
+    __defined at:__ @duckdb.h 781:8@
+
+    __exported by:__ @duckdb.h@
+-}
+instance ( ty ~ BG.Ptr BG.Void
+         ) => BG.CompatHasField.HasField "internal_data" DuckDBColumn ty where
+
+  hasField =
+    \x0 ->
+      ( \y1 ->
+          DuckDBColumn { internal_data = y1
+                       , deprecated_data = BG.getField @"deprecated_data" x0
+                       , deprecated_nullmask = BG.getField @"deprecated_nullmask" x0
+                       , deprecated_type = BG.getField @"deprecated_type" x0
+                       , deprecated_name = BG.getField @"deprecated_name" x0
+                       }
+      , BG.getField @"internal_data" x0
+      )
+
+instance ( ty ~ BG.Ptr BG.Void
+         ) => BG.HasField "internal_data" (BG.Ptr DuckDBColumn) (BG.Ptr ty) where
+
+  getField =
+    HasCField.fromPtr (BG.Proxy @"internal_data")
+
+instance HasCField.HasCField DuckDBColumn "internal_data" where
+
+  type CFieldType DuckDBColumn "internal_data" =
+    BG.Ptr BG.Void
+
+  offset# = \_ -> \_ -> 32
+
+{-| A DuckDB string (char* + size). Free data with duckdb_free.
+
+    history:
+
+    * stable: v0.6.0
+
+    __C declaration:__ @struct duckdb_string@
+
+    __defined at:__ @duckdb.h 790:8@
+
+    __exported by:__ @duckdb.h@
+-}
+data DuckDBString = DuckDBString
+  { data' :: BG.Ptr BG.CChar
+    {- ^ __C declaration:__ @data@
+
+         __defined at:__ @duckdb.h 791:8@
+
+         __exported by:__ @duckdb.h@
+    -}
+  , size :: DuckDBIdx
+    {- ^ __C declaration:__ @size@
+
+         __defined at:__ @duckdb.h 792:8@
+
+         __exported by:__ @duckdb.h@
+    -}
+  }
+  deriving stock (Eq, BG.Generic, Show)
+
+instance Marshal.StaticSize DuckDBString where
+
+  staticSizeOf = \_ -> (16 :: Int)
+
+  staticAlignment = \_ -> (8 :: Int)
+
+instance Marshal.ReadRaw DuckDBString where
+
+  readRaw =
+    \ptr0 ->
+          pure DuckDBString
+      <*> HasCField.readRaw (BG.Proxy @"data'") ptr0
+      <*> HasCField.readRaw (BG.Proxy @"size") ptr0
+
+instance Marshal.WriteRaw DuckDBString where
+
+  writeRaw =
+    \ptr0 ->
+      \s1 ->
+        case s1 of
+          DuckDBString data'2 size3 ->
+               HasCField.writeRaw (BG.Proxy @"data'") ptr0 data'2
+            >> HasCField.writeRaw (BG.Proxy @"size") ptr0 size3
+
+deriving via Marshal.EquivStorable DuckDBString instance BG.Storable DuckDBString
+
+deriving via Struct.IsStructViaReadRaw DuckDBString instance Struct.IsStruct DuckDBString
+
+{-| __C declaration:__ @data@
+
+    __defined at:__ @duckdb.h 791:8@
+
+    __exported by:__ @duckdb.h@
+-}
+instance ( ty ~ BG.Ptr BG.CChar
+         ) => BG.CompatHasField.HasField "data'" DuckDBString ty where
+
+  hasField =
+    \x0 ->
+      ( \y1 ->
+          DuckDBString {data' = y1, size = BG.getField @"size" x0}
+      , BG.getField @"data'" x0
+      )
+
+instance ( ty ~ BG.Ptr BG.CChar
+         ) => BG.HasField "data'" (BG.Ptr DuckDBString) (BG.Ptr ty) where
+
+  getField = HasCField.fromPtr (BG.Proxy @"data'")
+
+instance HasCField.HasCField DuckDBString "data'" where
+
+  type CFieldType DuckDBString "data'" =
+    BG.Ptr BG.CChar
+
+  offset# = \_ -> \_ -> 0
+
+{-| __C declaration:__ @size@
+
+    __defined at:__ @duckdb.h 792:8@
+
+    __exported by:__ @duckdb.h@
+-}
+instance ( ty ~ DuckDBIdx
+         ) => BG.CompatHasField.HasField "size" DuckDBString ty where
+
+  hasField =
+    \x0 ->
+      ( \y1 ->
+          DuckDBString {size = y1, data' = BG.getField @"data'" x0}
+      , BG.getField @"size" x0
+      )
+
+instance ( ty ~ DuckDBIdx
+         ) => BG.HasField "size" (BG.Ptr DuckDBString) (BG.Ptr ty) where
+
+  getField = HasCField.fromPtr (BG.Proxy @"size")
+
+instance HasCField.HasCField DuckDBString "size" where
+
+  type CFieldType DuckDBString "size" = DuckDBIdx
+
+  offset# = \_ -> \_ -> 8
+
+{-| A DuckDB BLOB (void* + size). Free data with duckdb_free.
+
+    history:
+
+    * stable: v0.2.5
+
+    __C declaration:__ @struct duckdb_blob@
+
+    __defined at:__ @duckdb.h 801:8@
+
+    __exported by:__ @duckdb.h@
+-}
+data DuckDBBlob = DuckDBBlob
+  { data' :: BG.Ptr BG.Void
+    {- ^ __C declaration:__ @data@
+
+         __defined at:__ @duckdb.h 802:8@
+
+         __exported by:__ @duckdb.h@
+    -}
+  , size :: DuckDBIdx
+    {- ^ __C declaration:__ @size@
+
+         __defined at:__ @duckdb.h 803:8@
+
+         __exported by:__ @duckdb.h@
+    -}
+  }
+  deriving stock (Eq, BG.Generic, Show)
+
+instance Marshal.StaticSize DuckDBBlob where
+
+  staticSizeOf = \_ -> (16 :: Int)
+
+  staticAlignment = \_ -> (8 :: Int)
+
+instance Marshal.ReadRaw DuckDBBlob where
+
+  readRaw =
+    \ptr0 ->
+          pure DuckDBBlob
+      <*> HasCField.readRaw (BG.Proxy @"data'") ptr0
+      <*> HasCField.readRaw (BG.Proxy @"size") ptr0
+
+instance Marshal.WriteRaw DuckDBBlob where
+
+  writeRaw =
+    \ptr0 ->
+      \s1 ->
+        case s1 of
+          DuckDBBlob data'2 size3 ->
+               HasCField.writeRaw (BG.Proxy @"data'") ptr0 data'2
+            >> HasCField.writeRaw (BG.Proxy @"size") ptr0 size3
+
+deriving via Marshal.EquivStorable DuckDBBlob instance BG.Storable DuckDBBlob
+
+deriving via Struct.IsStructViaReadRaw DuckDBBlob instance Struct.IsStruct DuckDBBlob
+
+{-| __C declaration:__ @data@
+
+    __defined at:__ @duckdb.h 802:8@
+
+    __exported by:__ @duckdb.h@
+-}
+instance ( ty ~ BG.Ptr BG.Void
+         ) => BG.CompatHasField.HasField "data'" DuckDBBlob ty where
+
+  hasField =
+    \x0 ->
+      ( \y1 ->
+          DuckDBBlob {data' = y1, size = BG.getField @"size" x0}
+      , BG.getField @"data'" x0
+      )
+
+instance ( ty ~ BG.Ptr BG.Void
+         ) => BG.HasField "data'" (BG.Ptr DuckDBBlob) (BG.Ptr ty) where
+
+  getField = HasCField.fromPtr (BG.Proxy @"data'")
+
+instance HasCField.HasCField DuckDBBlob "data'" where
+
+  type CFieldType DuckDBBlob "data'" = BG.Ptr BG.Void
+
+  offset# = \_ -> \_ -> 0
+
+{-| __C declaration:__ @size@
+
+    __defined at:__ @duckdb.h 803:8@
+
+    __exported by:__ @duckdb.h@
+-}
+instance ( ty ~ DuckDBIdx
+         ) => BG.CompatHasField.HasField "size" DuckDBBlob ty where
+
+  hasField =
+    \x0 ->
+      ( \y1 ->
+          DuckDBBlob {size = y1, data' = BG.getField @"data'" x0}
+      , BG.getField @"size" x0
+      )
+
+instance ( ty ~ DuckDBIdx
+         ) => BG.HasField "size" (BG.Ptr DuckDBBlob) (BG.Ptr ty) where
+
+  getField = HasCField.fromPtr (BG.Proxy @"size")
+
+instance HasCField.HasCField DuckDBBlob "size" where
+
+  type CFieldType DuckDBBlob "size" = DuckDBIdx
+
+  offset# = \_ -> \_ -> 8
+
+{-| A DuckDB BIT (uint8_t* + size). Free data with duckdb_free.
+
+    history:
+
+    * stable: v1.2.0
+
+    __C declaration:__ @struct duckdb_bit@
+
+    __defined at:__ @duckdb.h 812:8@
+
+    __exported by:__ @duckdb.h@
+-}
+data DuckDBBit = DuckDBBit
+  { data' :: BG.Ptr HsBindgen.Runtime.LibC.Word8
+    {- ^ __C declaration:__ @data@
+
+         __defined at:__ @duckdb.h 813:11@
+
+         __exported by:__ @duckdb.h@
+    -}
+  , size :: DuckDBIdx
+    {- ^ __C declaration:__ @size@
+
+         __defined at:__ @duckdb.h 814:8@
+
+         __exported by:__ @duckdb.h@
+    -}
+  }
+  deriving stock (Eq, BG.Generic, Show)
+
+instance Marshal.StaticSize DuckDBBit where
+
+  staticSizeOf = \_ -> (16 :: Int)
+
+  staticAlignment = \_ -> (8 :: Int)
+
+instance Marshal.ReadRaw DuckDBBit where
+
+  readRaw =
+    \ptr0 ->
+          pure DuckDBBit
+      <*> HasCField.readRaw (BG.Proxy @"data'") ptr0
+      <*> HasCField.readRaw (BG.Proxy @"size") ptr0
+
+instance Marshal.WriteRaw DuckDBBit where
+
+  writeRaw =
+    \ptr0 ->
+      \s1 ->
+        case s1 of
+          DuckDBBit data'2 size3 ->
+               HasCField.writeRaw (BG.Proxy @"data'") ptr0 data'2
+            >> HasCField.writeRaw (BG.Proxy @"size") ptr0 size3
+
+deriving via Marshal.EquivStorable DuckDBBit instance BG.Storable DuckDBBit
+
+deriving via Struct.IsStructViaReadRaw DuckDBBit instance Struct.IsStruct DuckDBBit
+
+{-| __C declaration:__ @data@
+
+    __defined at:__ @duckdb.h 813:11@
+
+    __exported by:__ @duckdb.h@
+-}
+instance ( ty ~ BG.Ptr HsBindgen.Runtime.LibC.Word8
+         ) => BG.CompatHasField.HasField "data'" DuckDBBit ty where
+
+  hasField =
+    \x0 ->
+      ( \y1 ->
+          DuckDBBit {data' = y1, size = BG.getField @"size" x0}
+      , BG.getField @"data'" x0
+      )
+
+instance ( ty ~ BG.Ptr HsBindgen.Runtime.LibC.Word8
+         ) => BG.HasField "data'" (BG.Ptr DuckDBBit) (BG.Ptr ty) where
+
+  getField = HasCField.fromPtr (BG.Proxy @"data'")
+
+instance HasCField.HasCField DuckDBBit "data'" where
+
+  type CFieldType DuckDBBit "data'" =
+    BG.Ptr HsBindgen.Runtime.LibC.Word8
+
+  offset# = \_ -> \_ -> 0
+
+{-| __C declaration:__ @size@
+
+    __defined at:__ @duckdb.h 814:8@
+
+    __exported by:__ @duckdb.h@
+-}
+instance ( ty ~ DuckDBIdx
+         ) => BG.CompatHasField.HasField "size" DuckDBBit ty where
+
+  hasField =
+    \x0 ->
+      ( \y1 ->
+          DuckDBBit {size = y1, data' = BG.getField @"data'" x0}
+      , BG.getField @"size" x0
+      )
+
+instance ( ty ~ DuckDBIdx
+         ) => BG.HasField "size" (BG.Ptr DuckDBBit) (BG.Ptr ty) where
+
+  getField = HasCField.fromPtr (BG.Proxy @"size")
+
+instance HasCField.HasCField DuckDBBit "size" where
+
+  type CFieldType DuckDBBit "size" = DuckDBIdx
+
+  offset# = \_ -> \_ -> 8
+
+{-| A DuckDB BIGNUM (uint8_t* + size + is_negative). The absolute value is stored in data in big endian format. Free data with duckdb_free.
+
+    history:
+
+    * stable: v1.2.0
+
+    __C declaration:__ @struct duckdb_bignum@
+
+    __defined at:__ @duckdb.h 824:8@
+
+    __exported by:__ @duckdb.h@
+-}
+data DuckDBBignum = DuckDBBignum
+  { data' :: BG.Ptr HsBindgen.Runtime.LibC.Word8
+    {- ^ __C declaration:__ @data@
+
+         __defined at:__ @duckdb.h 825:11@
+
+         __exported by:__ @duckdb.h@
+    -}
+  , size :: DuckDBIdx
+    {- ^ __C declaration:__ @size@
+
+         __defined at:__ @duckdb.h 826:8@
+
+         __exported by:__ @duckdb.h@
+    -}
+  , is_negative :: BG.CBool
+    {- ^ __C declaration:__ @is_negative@
+
+         __defined at:__ @duckdb.h 827:7@
+
+         __exported by:__ @duckdb.h@
+    -}
+  }
+  deriving stock (Eq, BG.Generic, Show)
+
+instance Marshal.StaticSize DuckDBBignum where
+
+  staticSizeOf = \_ -> (24 :: Int)
+
+  staticAlignment = \_ -> (8 :: Int)
+
+instance Marshal.ReadRaw DuckDBBignum where
+
+  readRaw =
+    \ptr0 ->
+          pure DuckDBBignum
+      <*> HasCField.readRaw (BG.Proxy @"data'") ptr0
+      <*> HasCField.readRaw (BG.Proxy @"size") ptr0
+      <*> HasCField.readRaw (BG.Proxy @"is_negative") ptr0
+
+instance Marshal.WriteRaw DuckDBBignum where
+
+  writeRaw =
+    \ptr0 ->
+      \s1 ->
+        case s1 of
+          DuckDBBignum data'2 size3 is_negative4 ->
+               HasCField.writeRaw (BG.Proxy @"data'") ptr0 data'2
+            >> HasCField.writeRaw (BG.Proxy @"size") ptr0 size3
+            >> HasCField.writeRaw (BG.Proxy @"is_negative") ptr0 is_negative4
+
+deriving via Marshal.EquivStorable DuckDBBignum instance BG.Storable DuckDBBignum
+
+deriving via Struct.IsStructViaReadRaw DuckDBBignum instance Struct.IsStruct DuckDBBignum
+
+{-| __C declaration:__ @data@
+
+    __defined at:__ @duckdb.h 825:11@
+
+    __exported by:__ @duckdb.h@
+-}
+instance ( ty ~ BG.Ptr HsBindgen.Runtime.LibC.Word8
+         ) => BG.CompatHasField.HasField "data'" DuckDBBignum ty where
+
+  hasField =
+    \x0 ->
+      ( \y1 ->
+          DuckDBBignum { data' = y1
+                       , size = BG.getField @"size" x0
+                       , is_negative = BG.getField @"is_negative" x0
+                       }
+      , BG.getField @"data'" x0
+      )
+
+instance ( ty ~ BG.Ptr HsBindgen.Runtime.LibC.Word8
+         ) => BG.HasField "data'" (BG.Ptr DuckDBBignum) (BG.Ptr ty) where
+
+  getField = HasCField.fromPtr (BG.Proxy @"data'")
+
+instance HasCField.HasCField DuckDBBignum "data'" where
+
+  type CFieldType DuckDBBignum "data'" =
+    BG.Ptr HsBindgen.Runtime.LibC.Word8
+
+  offset# = \_ -> \_ -> 0
+
+{-| __C declaration:__ @size@
+
+    __defined at:__ @duckdb.h 826:8@
+
+    __exported by:__ @duckdb.h@
+-}
+instance ( ty ~ DuckDBIdx
+         ) => BG.CompatHasField.HasField "size" DuckDBBignum ty where
+
+  hasField =
+    \x0 ->
+      ( \y1 ->
+          DuckDBBignum { size = y1
+                       , data' = BG.getField @"data'" x0
+                       , is_negative = BG.getField @"is_negative" x0
+                       }
+      , BG.getField @"size" x0
+      )
+
+instance ( ty ~ DuckDBIdx
+         ) => BG.HasField "size" (BG.Ptr DuckDBBignum) (BG.Ptr ty) where
+
+  getField = HasCField.fromPtr (BG.Proxy @"size")
+
+instance HasCField.HasCField DuckDBBignum "size" where
+
+  type CFieldType DuckDBBignum "size" = DuckDBIdx
+
+  offset# = \_ -> \_ -> 8
+
+{-| __C declaration:__ @is_negative@
+
+    __defined at:__ @duckdb.h 827:7@
+
+    __exported by:__ @duckdb.h@
+-}
+instance ( ty ~ BG.CBool
+         ) => BG.CompatHasField.HasField "is_negative" DuckDBBignum ty where
+
+  hasField =
+    \x0 ->
+      ( \y1 ->
+          DuckDBBignum { is_negative = y1
+                       , data' = BG.getField @"data'" x0
+                       , size = BG.getField @"size" x0
+                       }
+      , BG.getField @"is_negative" x0
+      )
+
+instance ( ty ~ BG.CBool
+         ) => BG.HasField "is_negative" (BG.Ptr DuckDBBignum) (BG.Ptr ty) where
+
+  getField =
+    HasCField.fromPtr (BG.Proxy @"is_negative")
+
+instance HasCField.HasCField DuckDBBignum "is_negative" where
+
+  type CFieldType DuckDBBignum "is_negative" = BG.CBool
+
+  offset# = \_ -> \_ -> 16
+
+{-| A query result. Must be freed with duckdb_destroy_result.
+
+    history:
+
+    * stable: v0.1.0
+
+    __C declaration:__ @struct duckdb_result@
+
+    __defined at:__ @duckdb.h 836:8@
+
+    __exported by:__ @duckdb.h@
+-}
+data DuckDBResult = DuckDBResult
+  { deprecated_column_count :: DuckDBIdx
+    {- ^ __C declaration:__ @deprecated_column_count@
+
+         __defined at:__ @duckdb.h 837:8@
+
+         __exported by:__ @duckdb.h@
+    -}
+  , deprecated_row_count :: DuckDBIdx
+    {- ^ __C declaration:__ @deprecated_row_count@
+
+         __defined at:__ @duckdb.h 838:8@
+
+         __exported by:__ @duckdb.h@
+    -}
+  , deprecated_rows_changed :: DuckDBIdx
+    {- ^ __C declaration:__ @deprecated_rows_changed@
+
+         __defined at:__ @duckdb.h 839:8@
+
+         __exported by:__ @duckdb.h@
+    -}
+  , deprecated_columns :: BG.Ptr DuckDBColumn
+    {- ^ __C declaration:__ @deprecated_columns@
+
+         __defined at:__ @duckdb.h 840:17@
+
+         __exported by:__ @duckdb.h@
+    -}
+  , deprecated_error_message :: BG.Ptr BG.CChar
+    {- ^ __C declaration:__ @deprecated_error_message@
+
+         __defined at:__ @duckdb.h 841:8@
+
+         __exported by:__ @duckdb.h@
+    -}
+  , internal_data :: BG.Ptr BG.Void
+    {- ^ __C declaration:__ @internal_data@
+
+         __defined at:__ @duckdb.h 842:8@
+
+         __exported by:__ @duckdb.h@
+    -}
+  }
+  deriving stock (Eq, BG.Generic, Show)
+
+instance Marshal.StaticSize DuckDBResult where
+
+  staticSizeOf = \_ -> (48 :: Int)
+
+  staticAlignment = \_ -> (8 :: Int)
+
+instance Marshal.ReadRaw DuckDBResult where
+
+  readRaw =
+    \ptr0 ->
+          pure DuckDBResult
+      <*> HasCField.readRaw (BG.Proxy @"deprecated_column_count") ptr0
+      <*> HasCField.readRaw (BG.Proxy @"deprecated_row_count") ptr0
+      <*> HasCField.readRaw (BG.Proxy @"deprecated_rows_changed") ptr0
+      <*> HasCField.readRaw (BG.Proxy @"deprecated_columns") ptr0
+      <*> HasCField.readRaw (BG.Proxy @"deprecated_error_message") ptr0
+      <*> HasCField.readRaw (BG.Proxy @"internal_data") ptr0
+
+instance Marshal.WriteRaw DuckDBResult where
+
+  writeRaw =
+    \ptr0 ->
+      \s1 ->
+        case s1 of
+          DuckDBResult
+            deprecated_column_count2
+            deprecated_row_count3
+            deprecated_rows_changed4
+            deprecated_columns5
+            deprecated_error_message6
+            internal_data7 ->
+                 HasCField.writeRaw (BG.Proxy @"deprecated_column_count") ptr0 deprecated_column_count2
+              >> HasCField.writeRaw (BG.Proxy @"deprecated_row_count") ptr0 deprecated_row_count3
+              >> HasCField.writeRaw (BG.Proxy @"deprecated_rows_changed") ptr0 deprecated_rows_changed4
+              >> HasCField.writeRaw (BG.Proxy @"deprecated_columns") ptr0 deprecated_columns5
+              >> HasCField.writeRaw (BG.Proxy @"deprecated_error_message") ptr0 deprecated_error_message6
+              >> HasCField.writeRaw (BG.Proxy @"internal_data") ptr0 internal_data7
+
+deriving via Marshal.EquivStorable DuckDBResult instance BG.Storable DuckDBResult
+
+deriving via Struct.IsStructViaReadRaw DuckDBResult instance Struct.IsStruct DuckDBResult
+
+{-| __C declaration:__ @deprecated_column_count@
+
+    __defined at:__ @duckdb.h 837:8@
+
+    __exported by:__ @duckdb.h@
+-}
+instance ( ty ~ DuckDBIdx
+         ) => BG.CompatHasField.HasField "deprecated_column_count" DuckDBResult ty where
+
+  hasField =
+    \x0 ->
+      ( \y1 ->
+          DuckDBResult { deprecated_column_count = y1
+                       , deprecated_row_count = BG.getField @"deprecated_row_count" x0
+                       , deprecated_rows_changed = BG.getField @"deprecated_rows_changed" x0
+                       , deprecated_columns = BG.getField @"deprecated_columns" x0
+                       , deprecated_error_message = BG.getField @"deprecated_error_message" x0
+                       , internal_data = BG.getField @"internal_data" x0
+                       }
+      , BG.getField @"deprecated_column_count" x0
+      )
+
+instance ( ty ~ DuckDBIdx
+         ) => BG.HasField "deprecated_column_count" (BG.Ptr DuckDBResult) (BG.Ptr ty) where
+
+  getField =
+    HasCField.fromPtr (BG.Proxy @"deprecated_column_count")
+
+instance HasCField.HasCField DuckDBResult "deprecated_column_count" where
+
+  type CFieldType DuckDBResult "deprecated_column_count" =
+    DuckDBIdx
+
+  offset# = \_ -> \_ -> 0
+
+{-| __C declaration:__ @deprecated_row_count@
+
+    __defined at:__ @duckdb.h 838:8@
+
+    __exported by:__ @duckdb.h@
+-}
+instance ( ty ~ DuckDBIdx
+         ) => BG.CompatHasField.HasField "deprecated_row_count" DuckDBResult ty where
+
+  hasField =
+    \x0 ->
+      ( \y1 ->
+          DuckDBResult { deprecated_row_count = y1
+                       , deprecated_column_count = BG.getField @"deprecated_column_count" x0
+                       , deprecated_rows_changed = BG.getField @"deprecated_rows_changed" x0
+                       , deprecated_columns = BG.getField @"deprecated_columns" x0
+                       , deprecated_error_message = BG.getField @"deprecated_error_message" x0
+                       , internal_data = BG.getField @"internal_data" x0
+                       }
+      , BG.getField @"deprecated_row_count" x0
+      )
+
+instance ( ty ~ DuckDBIdx
+         ) => BG.HasField "deprecated_row_count" (BG.Ptr DuckDBResult) (BG.Ptr ty) where
+
+  getField =
+    HasCField.fromPtr (BG.Proxy @"deprecated_row_count")
+
+instance HasCField.HasCField DuckDBResult "deprecated_row_count" where
+
+  type CFieldType DuckDBResult "deprecated_row_count" =
+    DuckDBIdx
+
+  offset# = \_ -> \_ -> 8
+
+{-| __C declaration:__ @deprecated_rows_changed@
+
+    __defined at:__ @duckdb.h 839:8@
+
+    __exported by:__ @duckdb.h@
+-}
+instance ( ty ~ DuckDBIdx
+         ) => BG.CompatHasField.HasField "deprecated_rows_changed" DuckDBResult ty where
+
+  hasField =
+    \x0 ->
+      ( \y1 ->
+          DuckDBResult { deprecated_rows_changed = y1
+                       , deprecated_column_count = BG.getField @"deprecated_column_count" x0
+                       , deprecated_row_count = BG.getField @"deprecated_row_count" x0
+                       , deprecated_columns = BG.getField @"deprecated_columns" x0
+                       , deprecated_error_message = BG.getField @"deprecated_error_message" x0
+                       , internal_data = BG.getField @"internal_data" x0
+                       }
+      , BG.getField @"deprecated_rows_changed" x0
+      )
+
+instance ( ty ~ DuckDBIdx
+         ) => BG.HasField "deprecated_rows_changed" (BG.Ptr DuckDBResult) (BG.Ptr ty) where
+
+  getField =
+    HasCField.fromPtr (BG.Proxy @"deprecated_rows_changed")
+
+instance HasCField.HasCField DuckDBResult "deprecated_rows_changed" where
+
+  type CFieldType DuckDBResult "deprecated_rows_changed" =
+    DuckDBIdx
+
+  offset# = \_ -> \_ -> 16
+
+{-| __C declaration:__ @deprecated_columns@
+
+    __defined at:__ @duckdb.h 840:17@
+
+    __exported by:__ @duckdb.h@
+-}
+instance ( ty ~ BG.Ptr DuckDBColumn
+         ) => BG.CompatHasField.HasField "deprecated_columns" DuckDBResult ty where
+
+  hasField =
+    \x0 ->
+      ( \y1 ->
+          DuckDBResult { deprecated_columns = y1
+                       , deprecated_column_count = BG.getField @"deprecated_column_count" x0
+                       , deprecated_row_count = BG.getField @"deprecated_row_count" x0
+                       , deprecated_rows_changed = BG.getField @"deprecated_rows_changed" x0
+                       , deprecated_error_message = BG.getField @"deprecated_error_message" x0
+                       , internal_data = BG.getField @"internal_data" x0
+                       }
+      , BG.getField @"deprecated_columns" x0
+      )
+
+instance ( ty ~ BG.Ptr DuckDBColumn
+         ) => BG.HasField "deprecated_columns" (BG.Ptr DuckDBResult) (BG.Ptr ty) where
+
+  getField =
+    HasCField.fromPtr (BG.Proxy @"deprecated_columns")
+
+instance HasCField.HasCField DuckDBResult "deprecated_columns" where
+
+  type CFieldType DuckDBResult "deprecated_columns" =
+    BG.Ptr DuckDBColumn
+
+  offset# = \_ -> \_ -> 24
+
+{-| __C declaration:__ @deprecated_error_message@
+
+    __defined at:__ @duckdb.h 841:8@
+
+    __exported by:__ @duckdb.h@
+-}
+instance ( ty ~ BG.Ptr BG.CChar
+         ) => BG.CompatHasField.HasField "deprecated_error_message" DuckDBResult ty where
+
+  hasField =
+    \x0 ->
+      ( \y1 ->
+          DuckDBResult { deprecated_error_message = y1
+                       , deprecated_column_count = BG.getField @"deprecated_column_count" x0
+                       , deprecated_row_count = BG.getField @"deprecated_row_count" x0
+                       , deprecated_rows_changed = BG.getField @"deprecated_rows_changed" x0
+                       , deprecated_columns = BG.getField @"deprecated_columns" x0
+                       , internal_data = BG.getField @"internal_data" x0
+                       }
+      , BG.getField @"deprecated_error_message" x0
+      )
+
+instance ( ty ~ BG.Ptr BG.CChar
+         ) => BG.HasField "deprecated_error_message" (BG.Ptr DuckDBResult) (BG.Ptr ty) where
+
+  getField =
+    HasCField.fromPtr (BG.Proxy @"deprecated_error_message")
+
+instance HasCField.HasCField DuckDBResult "deprecated_error_message" where
+
+  type CFieldType DuckDBResult "deprecated_error_message" =
+    BG.Ptr BG.CChar
+
+  offset# = \_ -> \_ -> 32
+
+{-| __C declaration:__ @internal_data@
+
+    __defined at:__ @duckdb.h 842:8@
+
+    __exported by:__ @duckdb.h@
+-}
+instance ( ty ~ BG.Ptr BG.Void
+         ) => BG.CompatHasField.HasField "internal_data" DuckDBResult ty where
+
+  hasField =
+    \x0 ->
+      ( \y1 ->
+          DuckDBResult { internal_data = y1
+                       , deprecated_column_count = BG.getField @"deprecated_column_count" x0
+                       , deprecated_row_count = BG.getField @"deprecated_row_count" x0
+                       , deprecated_rows_changed = BG.getField @"deprecated_rows_changed" x0
+                       , deprecated_columns = BG.getField @"deprecated_columns" x0
+                       , deprecated_error_message = BG.getField @"deprecated_error_message" x0
+                       }
+      , BG.getField @"internal_data" x0
+      )
+
+instance ( ty ~ BG.Ptr BG.Void
+         ) => BG.HasField "internal_data" (BG.Ptr DuckDBResult) (BG.Ptr ty) where
+
+  getField =
+    HasCField.fromPtr (BG.Proxy @"internal_data")
+
+instance HasCField.HasCField DuckDBResult "internal_data" where
+
+  type CFieldType DuckDBResult "internal_data" =
+    BG.Ptr BG.Void
+
+  offset# = \_ -> \_ -> 40
+
+{-| A database instance cache. Must be destroyed with duckdb_destroy_instance_cache.
+
+    history:
+
+    * unstable: v1.2.0
+
+    * stable: v1.5.6
+
+    __C declaration:__ @struct _duckdb_instance_cache@
+
+    __defined at:__ @duckdb.h 862:16@
+
+    __exported by:__ @duckdb.h@
+-}
+data DuckDBInstanceCacheStruct
+
+instance Marshal.StaticSize DuckDBInstanceCacheStruct where
+
+  staticSizeOf = \_ -> (8 :: Int)
+
+  staticAlignment = \_ -> (8 :: Int)
+
+{-| A database instance cache. Must be destroyed with duckdb_destroy_instance_cache.
+
+    history:
+
+    * unstable: v1.2.0
+
+    * stable: v1.5.6
+
+    __C declaration:__ @duckdb_instance_cache@
+
+    __defined at:__ @duckdb.h 864:5@
+
+    __exported by:__ @duckdb.h@
+-}
+newtype DuckDBInstanceCache = DuckDBInstanceCache
+  { unwrap :: BG.Ptr DuckDBInstanceCacheStruct
+  }
+  deriving stock (Eq, BG.Generic, Ord, Show)
+  deriving newtype
+    ( BG.HasFFIType
+    , Marshal.ReadRaw
+    , Marshal.StaticSize
+    , BG.Storable
+    , Marshal.WriteRaw
+    )
+
+instance ( ty ~ BG.Ptr DuckDBInstanceCacheStruct
+         ) => BG.CompatHasField.HasField "unwrap" DuckDBInstanceCache ty where
+
+  hasField =
+    \x0 ->
+      (\y1 ->
+         DuckDBInstanceCache {unwrap = y1}, BG.getField @"unwrap" x0)
+
+instance ( ty ~ BG.Ptr DuckDBInstanceCacheStruct
+         ) => BG.HasField "unwrap" (BG.Ptr DuckDBInstanceCache) (BG.Ptr ty) where
+
+  getField = HasCField.fromPtr (BG.Proxy @"unwrap")
+
+instance HasCField.HasCField DuckDBInstanceCache "unwrap" where
+
+  type CFieldType DuckDBInstanceCache "unwrap" =
+    BG.Ptr DuckDBInstanceCacheStruct
+
+  offset# = \_ -> \_ -> 0
+
+{-| A database object. Must be closed with duckdb_close.
+
+    history:
+
+    * stable: v0.1.0
+
+    __C declaration:__ @struct _duckdb_database@
+
+    __defined at:__ @duckdb.h 872:16@
+
+    __exported by:__ @duckdb.h@
+-}
+data DuckDBDatabaseStruct
+
+instance Marshal.StaticSize DuckDBDatabaseStruct where
+
+  staticSizeOf = \_ -> (8 :: Int)
+
+  staticAlignment = \_ -> (8 :: Int)
+
+{-| A database object. Must be closed with duckdb_close.
+
+    history:
+
+    * stable: v0.1.0
+
+    __C declaration:__ @duckdb_database@
+
+    __defined at:__ @duckdb.h 874:5@
+
+    __exported by:__ @duckdb.h@
+-}
+newtype DuckDBDatabase = DuckDBDatabase
+  { unwrap :: BG.Ptr DuckDBDatabaseStruct
+  }
+  deriving stock (Eq, BG.Generic, Ord, Show)
+  deriving newtype
+    ( BG.HasFFIType
+    , Marshal.ReadRaw
+    , Marshal.StaticSize
+    , BG.Storable
+    , Marshal.WriteRaw
+    )
+
+instance ( ty ~ BG.Ptr DuckDBDatabaseStruct
+         ) => BG.CompatHasField.HasField "unwrap" DuckDBDatabase ty where
+
+  hasField =
+    \x0 ->
+      (\y1 ->
+         DuckDBDatabase {unwrap = y1}, BG.getField @"unwrap" x0)
+
+instance ( ty ~ BG.Ptr DuckDBDatabaseStruct
+         ) => BG.HasField "unwrap" (BG.Ptr DuckDBDatabase) (BG.Ptr ty) where
+
+  getField = HasCField.fromPtr (BG.Proxy @"unwrap")
+
+instance HasCField.HasCField DuckDBDatabase "unwrap" where
+
+  type CFieldType DuckDBDatabase "unwrap" =
+    BG.Ptr DuckDBDatabaseStruct
+
+  offset# = \_ -> \_ -> 0
+
+{-| A connection to a duckdb database. Must be closed with duckdb_disconnect.
+
+    history:
+
+    * stable: v0.1.0
+
+    __C declaration:__ @struct _duckdb_connection@
+
+    __defined at:__ @duckdb.h 882:16@
+
+    __exported by:__ @duckdb.h@
+-}
+data DuckDBConnectionStruct
+
+instance Marshal.StaticSize DuckDBConnectionStruct where
+
+  staticSizeOf = \_ -> (8 :: Int)
+
+  staticAlignment = \_ -> (8 :: Int)
+
+{-| A connection to a duckdb database. Must be closed with duckdb_disconnect.
+
+    history:
+
+    * stable: v0.1.0
+
+    __C declaration:__ @duckdb_connection@
+
+    __defined at:__ @duckdb.h 884:5@
+
+    __exported by:__ @duckdb.h@
+-}
+newtype DuckDBConnection = DuckDBConnection
+  { unwrap :: BG.Ptr DuckDBConnectionStruct
+  }
+  deriving stock (Eq, BG.Generic, Ord, Show)
+  deriving newtype
+    ( BG.HasFFIType
+    , Marshal.ReadRaw
+    , Marshal.StaticSize
+    , BG.Storable
+    , Marshal.WriteRaw
+    )
+
+instance ( ty ~ BG.Ptr DuckDBConnectionStruct
+         ) => BG.CompatHasField.HasField "unwrap" DuckDBConnection ty where
+
+  hasField =
+    \x0 ->
+      (\y1 ->
+         DuckDBConnection {unwrap = y1}, BG.getField @"unwrap" x0)
+
+instance ( ty ~ BG.Ptr DuckDBConnectionStruct
+         ) => BG.HasField "unwrap" (BG.Ptr DuckDBConnection) (BG.Ptr ty) where
+
+  getField = HasCField.fromPtr (BG.Proxy @"unwrap")
+
+instance HasCField.HasCField DuckDBConnection "unwrap" where
+
+  type CFieldType DuckDBConnection "unwrap" =
+    BG.Ptr DuckDBConnectionStruct
+
+  offset# = \_ -> \_ -> 0
+
+{-| A client context of a duckdb connection. Must be destroyed with duckdb_destroy_client_context.
+
+    history:
+
+    * unstable: v1.3.0
+
+    * stable: v1.5.6
+
+    __C declaration:__ @struct _duckdb_client_context@
+
+    __defined at:__ @duckdb.h 893:16@
+
+    __exported by:__ @duckdb.h@
+-}
+data DuckDBClientContextStruct
+
+instance Marshal.StaticSize DuckDBClientContextStruct where
+
+  staticSizeOf = \_ -> (8 :: Int)
+
+  staticAlignment = \_ -> (8 :: Int)
+
+{-| A client context of a duckdb connection. Must be destroyed with duckdb_destroy_client_context.
+
+    history:
+
+    * unstable: v1.3.0
+
+    * stable: v1.5.6
+
+    __C declaration:__ @duckdb_client_context@
+
+    __defined at:__ @duckdb.h 895:5@
+
+    __exported by:__ @duckdb.h@
+-}
+newtype DuckDBClientContext = DuckDBClientContext
+  { unwrap :: BG.Ptr DuckDBClientContextStruct
+  }
+  deriving stock (Eq, BG.Generic, Ord, Show)
+  deriving newtype
+    ( BG.HasFFIType
+    , Marshal.ReadRaw
+    , Marshal.StaticSize
+    , BG.Storable
+    , Marshal.WriteRaw
+    )
+
+instance ( ty ~ BG.Ptr DuckDBClientContextStruct
+         ) => BG.CompatHasField.HasField "unwrap" DuckDBClientContext ty where
+
+  hasField =
+    \x0 ->
+      (\y1 ->
+         DuckDBClientContext {unwrap = y1}, BG.getField @"unwrap" x0)
+
+instance ( ty ~ BG.Ptr DuckDBClientContextStruct
+         ) => BG.HasField "unwrap" (BG.Ptr DuckDBClientContext) (BG.Ptr ty) where
+
+  getField = HasCField.fromPtr (BG.Proxy @"unwrap")
+
+instance HasCField.HasCField DuckDBClientContext "unwrap" where
+
+  type CFieldType DuckDBClientContext "unwrap" =
+    BG.Ptr DuckDBClientContextStruct
+
+  offset# = \_ -> \_ -> 0
+
+{-| A prepared statement. Must be destroyed with duckdb_destroy_prepare.
+
+    history:
+
+    * stable: v0.1.0
+
+    __C declaration:__ @struct _duckdb_prepared_statement@
+
+    __defined at:__ @duckdb.h 903:16@
+
+    __exported by:__ @duckdb.h@
+-}
+data DuckDBPreparedStatementStruct
+
+instance Marshal.StaticSize DuckDBPreparedStatementStruct where
+
+  staticSizeOf = \_ -> (8 :: Int)
+
+  staticAlignment = \_ -> (8 :: Int)
+
+{-| A prepared statement. Must be destroyed with duckdb_destroy_prepare.
+
+    history:
+
+    * stable: v0.1.0
+
+    __C declaration:__ @duckdb_prepared_statement@
+
+    __defined at:__ @duckdb.h 905:5@
+
+    __exported by:__ @duckdb.h@
+-}
+newtype DuckDBPreparedStatement = DuckDBPreparedStatement
+  { unwrap :: BG.Ptr DuckDBPreparedStatementStruct
+  }
+  deriving stock (Eq, BG.Generic, Ord, Show)
+  deriving newtype
+    ( BG.HasFFIType
+    , Marshal.ReadRaw
+    , Marshal.StaticSize
+    , BG.Storable
+    , Marshal.WriteRaw
+    )
+
+instance ( ty ~ BG.Ptr DuckDBPreparedStatementStruct
+         ) => BG.CompatHasField.HasField "unwrap" DuckDBPreparedStatement ty where
+
+  hasField =
+    \x0 ->
+      (\y1 ->
+         DuckDBPreparedStatement {unwrap = y1}, BG.getField @"unwrap" x0)
+
+instance ( ty ~ BG.Ptr DuckDBPreparedStatementStruct
+         ) => BG.HasField "unwrap" (BG.Ptr DuckDBPreparedStatement) (BG.Ptr ty) where
+
+  getField = HasCField.fromPtr (BG.Proxy @"unwrap")
+
+instance HasCField.HasCField DuckDBPreparedStatement "unwrap" where
+
+  type CFieldType DuckDBPreparedStatement "unwrap" =
+    BG.Ptr DuckDBPreparedStatementStruct
+
+  offset# = \_ -> \_ -> 0
+
+{-| Extracted statements. Must be destroyed with duckdb_destroy_extracted.
+
+    history:
+
+    * stable: v0.7.0
+
+    __C declaration:__ @struct _duckdb_extracted_statements@
+
+    __defined at:__ @duckdb.h 913:16@
+
+    __exported by:__ @duckdb.h@
+-}
+data DuckDBExtractedStatementsStruct
+
+instance Marshal.StaticSize DuckDBExtractedStatementsStruct where
+
+  staticSizeOf = \_ -> (8 :: Int)
+
+  staticAlignment = \_ -> (8 :: Int)
+
+{-| Extracted statements. Must be destroyed with duckdb_destroy_extracted.
+
+    history:
+
+    * stable: v0.7.0
+
+    __C declaration:__ @duckdb_extracted_statements@
+
+    __defined at:__ @duckdb.h 915:5@
+
+    __exported by:__ @duckdb.h@
+-}
+newtype DuckDBExtractedStatements = DuckDBExtractedStatements
+  { unwrap :: BG.Ptr DuckDBExtractedStatementsStruct
+  }
+  deriving stock (Eq, BG.Generic, Ord, Show)
+  deriving newtype
+    ( BG.HasFFIType
+    , Marshal.ReadRaw
+    , Marshal.StaticSize
+    , BG.Storable
+    , Marshal.WriteRaw
+    )
+
+instance ( ty ~ BG.Ptr DuckDBExtractedStatementsStruct
+         ) => BG.CompatHasField.HasField "unwrap" DuckDBExtractedStatements ty where
+
+  hasField =
+    \x0 ->
+      (\y1 ->
+         DuckDBExtractedStatements {unwrap = y1}, BG.getField @"unwrap" x0)
+
+instance ( ty ~ BG.Ptr DuckDBExtractedStatementsStruct
+         ) => BG.HasField "unwrap" (BG.Ptr DuckDBExtractedStatements) (BG.Ptr ty) where
+
+  getField = HasCField.fromPtr (BG.Proxy @"unwrap")
+
+instance HasCField.HasCField DuckDBExtractedStatements "unwrap" where
+
+  type CFieldType DuckDBExtractedStatements "unwrap" =
+    BG.Ptr DuckDBExtractedStatementsStruct
+
+  offset# = \_ -> \_ -> 0
+
+{-| A pending query result. Must be destroyed with duckdb_destroy_pending.
+
+    history:
+
+    * stable: v0.5.0
+
+    __C declaration:__ @struct _duckdb_pending_result@
+
+    __defined at:__ @duckdb.h 923:16@
+
+    __exported by:__ @duckdb.h@
+-}
+data DuckDBPendingResultStruct
+
+instance Marshal.StaticSize DuckDBPendingResultStruct where
+
+  staticSizeOf = \_ -> (8 :: Int)
+
+  staticAlignment = \_ -> (8 :: Int)
+
+{-| A pending query result. Must be destroyed with duckdb_destroy_pending.
+
+    history:
+
+    * stable: v0.5.0
+
+    __C declaration:__ @duckdb_pending_result@
+
+    __defined at:__ @duckdb.h 925:5@
+
+    __exported by:__ @duckdb.h@
+-}
+newtype DuckDBPendingResult = DuckDBPendingResult
+  { unwrap :: BG.Ptr DuckDBPendingResultStruct
+  }
+  deriving stock (Eq, BG.Generic, Ord, Show)
+  deriving newtype
+    ( BG.HasFFIType
+    , Marshal.ReadRaw
+    , Marshal.StaticSize
+    , BG.Storable
+    , Marshal.WriteRaw
+    )
+
+instance ( ty ~ BG.Ptr DuckDBPendingResultStruct
+         ) => BG.CompatHasField.HasField "unwrap" DuckDBPendingResult ty where
+
+  hasField =
+    \x0 ->
+      (\y1 ->
+         DuckDBPendingResult {unwrap = y1}, BG.getField @"unwrap" x0)
+
+instance ( ty ~ BG.Ptr DuckDBPendingResultStruct
+         ) => BG.HasField "unwrap" (BG.Ptr DuckDBPendingResult) (BG.Ptr ty) where
+
+  getField = HasCField.fromPtr (BG.Proxy @"unwrap")
+
+instance HasCField.HasCField DuckDBPendingResult "unwrap" where
+
+  type CFieldType DuckDBPendingResult "unwrap" =
+    BG.Ptr DuckDBPendingResultStruct
+
+  offset# = \_ -> \_ -> 0
+
+{-| The appender enables fast data loading into DuckDB. Must be destroyed with duckdb_appender_destroy.
+
+    history:
+
+    * stable: v0.2.5
+
+    __C declaration:__ @struct _duckdb_appender@
+
+    __defined at:__ @duckdb.h 933:16@
+
+    __exported by:__ @duckdb.h@
+-}
+data DuckDBAppenderStruct
+
+instance Marshal.StaticSize DuckDBAppenderStruct where
+
+  staticSizeOf = \_ -> (8 :: Int)
+
+  staticAlignment = \_ -> (8 :: Int)
+
+{-| The appender enables fast data loading into DuckDB. Must be destroyed with duckdb_appender_destroy.
+
+    history:
+
+    * stable: v0.2.5
+
+    __C declaration:__ @duckdb_appender@
+
+    __defined at:__ @duckdb.h 935:5@
+
+    __exported by:__ @duckdb.h@
+-}
+newtype DuckDBAppender = DuckDBAppender
+  { unwrap :: BG.Ptr DuckDBAppenderStruct
+  }
+  deriving stock (Eq, BG.Generic, Ord, Show)
+  deriving newtype
+    ( BG.HasFFIType
+    , Marshal.ReadRaw
+    , Marshal.StaticSize
+    , BG.Storable
+    , Marshal.WriteRaw
+    )
+
+instance ( ty ~ BG.Ptr DuckDBAppenderStruct
+         ) => BG.CompatHasField.HasField "unwrap" DuckDBAppender ty where
+
+  hasField =
+    \x0 ->
+      (\y1 ->
+         DuckDBAppender {unwrap = y1}, BG.getField @"unwrap" x0)
+
+instance ( ty ~ BG.Ptr DuckDBAppenderStruct
+         ) => BG.HasField "unwrap" (BG.Ptr DuckDBAppender) (BG.Ptr ty) where
+
+  getField = HasCField.fromPtr (BG.Proxy @"unwrap")
+
+instance HasCField.HasCField DuckDBAppender "unwrap" where
+
+  type CFieldType DuckDBAppender "unwrap" =
+    BG.Ptr DuckDBAppenderStruct
+
+  offset# = \_ -> \_ -> 0
+
+{-| The table description allows querying information about the table. Must be destroyed with duckdb_table_description_destroy.
+
+    history:
+
+    * stable: v1.1.0
+
+    __C declaration:__ @struct _duckdb_table_description@
+
+    __defined at:__ @duckdb.h 944:16@
+
+    __exported by:__ @duckdb.h@
+-}
+data DuckDBTableDescriptionStruct
+
+instance Marshal.StaticSize DuckDBTableDescriptionStruct where
+
+  staticSizeOf = \_ -> (8 :: Int)
+
+  staticAlignment = \_ -> (8 :: Int)
+
+{-| The table description allows querying information about the table. Must be destroyed with duckdb_table_description_destroy.
+
+    history:
+
+    * stable: v1.1.0
+
+    __C declaration:__ @duckdb_table_description@
+
+    __defined at:__ @duckdb.h 946:5@
+
+    __exported by:__ @duckdb.h@
+-}
+newtype DuckDBTableDescription = DuckDBTableDescription
+  { unwrap :: BG.Ptr DuckDBTableDescriptionStruct
+  }
+  deriving stock (Eq, BG.Generic, Ord, Show)
+  deriving newtype
+    ( BG.HasFFIType
+    , Marshal.ReadRaw
+    , Marshal.StaticSize
+    , BG.Storable
+    , Marshal.WriteRaw
+    )
+
+instance ( ty ~ BG.Ptr DuckDBTableDescriptionStruct
+         ) => BG.CompatHasField.HasField "unwrap" DuckDBTableDescription ty where
+
+  hasField =
+    \x0 ->
+      (\y1 ->
+         DuckDBTableDescription {unwrap = y1}, BG.getField @"unwrap" x0)
+
+instance ( ty ~ BG.Ptr DuckDBTableDescriptionStruct
+         ) => BG.HasField "unwrap" (BG.Ptr DuckDBTableDescription) (BG.Ptr ty) where
+
+  getField = HasCField.fromPtr (BG.Proxy @"unwrap")
+
+instance HasCField.HasCField DuckDBTableDescription "unwrap" where
+
+  type CFieldType DuckDBTableDescription "unwrap" =
+    BG.Ptr DuckDBTableDescriptionStruct
+
+  offset# = \_ -> \_ -> 0
+
+{-| The configuration for opening a database. Must be destroyed with duckdb_destroy_config.
+
+    history:
+
+    * stable: v0.2.8
+
+    __C declaration:__ @struct _duckdb_config@
+
+    __defined at:__ @duckdb.h 954:16@
+
+    __exported by:__ @duckdb.h@
+-}
+data DuckDBConfigStruct
+
+instance Marshal.StaticSize DuckDBConfigStruct where
+
+  staticSizeOf = \_ -> (8 :: Int)
+
+  staticAlignment = \_ -> (8 :: Int)
+
+{-| The configuration for opening a database. Must be destroyed with duckdb_destroy_config.
+
+    history:
+
+    * stable: v0.2.8
+
+    __C declaration:__ @duckdb_config@
+
+    __defined at:__ @duckdb.h 956:5@
+
+    __exported by:__ @duckdb.h@
+-}
+newtype DuckDBConfig = DuckDBConfig
+  { unwrap :: BG.Ptr DuckDBConfigStruct
+  }
+  deriving stock (Eq, BG.Generic, Ord, Show)
+  deriving newtype
+    ( BG.HasFFIType
+    , Marshal.ReadRaw
+    , Marshal.StaticSize
+    , BG.Storable
+    , Marshal.WriteRaw
+    )
+
+instance ( ty ~ BG.Ptr DuckDBConfigStruct
+         ) => BG.CompatHasField.HasField "unwrap" DuckDBConfig ty where
+
+  hasField =
+    \x0 ->
+      (\y1 ->
+         DuckDBConfig {unwrap = y1}, BG.getField @"unwrap" x0)
+
+instance ( ty ~ BG.Ptr DuckDBConfigStruct
+         ) => BG.HasField "unwrap" (BG.Ptr DuckDBConfig) (BG.Ptr ty) where
+
+  getField = HasCField.fromPtr (BG.Proxy @"unwrap")
+
+instance HasCField.HasCField DuckDBConfig "unwrap" where
+
+  type CFieldType DuckDBConfig "unwrap" =
+    BG.Ptr DuckDBConfigStruct
+
+  offset# = \_ -> \_ -> 0
+
+{-| A custom configuration option instance. Must be destroyed with duckdb_destroy_config_option.
+
+    history:
+
+    * unstable: v1.5.0
+
+    * stable: v1.5.6
+
+    __C declaration:__ @struct _duckdb_config_option@
+
+    __defined at:__ @duckdb.h 965:16@
+
+    __exported by:__ @duckdb.h@
+-}
+data DuckDBConfigOptionStruct
+
+instance Marshal.StaticSize DuckDBConfigOptionStruct where
+
+  staticSizeOf = \_ -> (8 :: Int)
+
+  staticAlignment = \_ -> (8 :: Int)
+
+{-| A custom configuration option instance. Must be destroyed with duckdb_destroy_config_option.
+
+    history:
+
+    * unstable: v1.5.0
+
+    * stable: v1.5.6
+
+    __C declaration:__ @duckdb_config_option@
+
+    __defined at:__ @duckdb.h 967:5@
+
+    __exported by:__ @duckdb.h@
+-}
+newtype DuckDBConfigOption = DuckDBConfigOption
+  { unwrap :: BG.Ptr DuckDBConfigOptionStruct
+  }
+  deriving stock (Eq, BG.Generic, Ord, Show)
+  deriving newtype
+    ( BG.HasFFIType
+    , Marshal.ReadRaw
+    , Marshal.StaticSize
+    , BG.Storable
+    , Marshal.WriteRaw
+    )
+
+instance ( ty ~ BG.Ptr DuckDBConfigOptionStruct
+         ) => BG.CompatHasField.HasField "unwrap" DuckDBConfigOption ty where
+
+  hasField =
+    \x0 ->
+      (\y1 ->
+         DuckDBConfigOption {unwrap = y1}, BG.getField @"unwrap" x0)
+
+instance ( ty ~ BG.Ptr DuckDBConfigOptionStruct
+         ) => BG.HasField "unwrap" (BG.Ptr DuckDBConfigOption) (BG.Ptr ty) where
+
+  getField = HasCField.fromPtr (BG.Proxy @"unwrap")
+
+instance HasCField.HasCField DuckDBConfigOption "unwrap" where
+
+  type CFieldType DuckDBConfigOption "unwrap" =
+    BG.Ptr DuckDBConfigOptionStruct
+
+  offset# = \_ -> \_ -> 0
+
+{-| A logical type. Must be destroyed with duckdb_destroy_logical_type.
+
+    history:
+
+    * stable: v0.3.3
+
+    __C declaration:__ @struct _duckdb_logical_type@
+
+    __defined at:__ @duckdb.h 975:16@
+
+    __exported by:__ @duckdb.h@
+-}
+data DuckDBLogicalTypeStruct
+
+instance Marshal.StaticSize DuckDBLogicalTypeStruct where
+
+  staticSizeOf = \_ -> (8 :: Int)
+
+  staticAlignment = \_ -> (8 :: Int)
+
+{-| A logical type. Must be destroyed with duckdb_destroy_logical_type.
+
+    history:
+
+    * stable: v0.3.3
+
+    __C declaration:__ @duckdb_logical_type@
+
+    __defined at:__ @duckdb.h 977:5@
+
+    __exported by:__ @duckdb.h@
+-}
+newtype DuckDBLogicalType = DuckDBLogicalType
+  { unwrap :: BG.Ptr DuckDBLogicalTypeStruct
+  }
+  deriving stock (Eq, BG.Generic, Ord, Show)
+  deriving newtype
+    ( BG.HasFFIType
+    , Marshal.ReadRaw
+    , Marshal.StaticSize
+    , BG.Storable
+    , Marshal.WriteRaw
+    )
+
+instance ( ty ~ BG.Ptr DuckDBLogicalTypeStruct
+         ) => BG.CompatHasField.HasField "unwrap" DuckDBLogicalType ty where
+
+  hasField =
+    \x0 ->
+      (\y1 ->
+         DuckDBLogicalType {unwrap = y1}, BG.getField @"unwrap" x0)
+
+instance ( ty ~ BG.Ptr DuckDBLogicalTypeStruct
+         ) => BG.HasField "unwrap" (BG.Ptr DuckDBLogicalType) (BG.Ptr ty) where
+
+  getField = HasCField.fromPtr (BG.Proxy @"unwrap")
+
+instance HasCField.HasCField DuckDBLogicalType "unwrap" where
+
+  type CFieldType DuckDBLogicalType "unwrap" =
+    BG.Ptr DuckDBLogicalTypeStruct
+
+  offset# = \_ -> \_ -> 0
+
+{-| Holds extra information to register a custom logical type. Reserved for future use.
+
+    history:
+
+    * stable: v1.1.0
+
+    __C declaration:__ @struct _duckdb_create_type_info@
+
+    __defined at:__ @duckdb.h 985:16@
+
+    __exported by:__ @duckdb.h@
+-}
+data DuckDBCreateTypeInfoStruct
+
+instance Marshal.StaticSize DuckDBCreateTypeInfoStruct where
+
+  staticSizeOf = \_ -> (8 :: Int)
+
+  staticAlignment = \_ -> (8 :: Int)
+
+{-| Holds extra information to register a custom logical type. Reserved for future use.
+
+    history:
+
+    * stable: v1.1.0
+
+    __C declaration:__ @duckdb_create_type_info@
+
+    __defined at:__ @duckdb.h 987:5@
+
+    __exported by:__ @duckdb.h@
+-}
+newtype DuckDBCreateTypeInfo = DuckDBCreateTypeInfo
+  { unwrap :: BG.Ptr DuckDBCreateTypeInfoStruct
+  }
+  deriving stock (Eq, BG.Generic, Ord, Show)
+  deriving newtype
+    ( BG.HasFFIType
+    , Marshal.ReadRaw
+    , Marshal.StaticSize
+    , BG.Storable
+    , Marshal.WriteRaw
+    )
+
+instance ( ty ~ BG.Ptr DuckDBCreateTypeInfoStruct
+         ) => BG.CompatHasField.HasField "unwrap" DuckDBCreateTypeInfo ty where
+
+  hasField =
+    \x0 ->
+      (\y1 ->
+         DuckDBCreateTypeInfo {unwrap = y1}, BG.getField @"unwrap" x0)
+
+instance ( ty ~ BG.Ptr DuckDBCreateTypeInfoStruct
+         ) => BG.HasField "unwrap" (BG.Ptr DuckDBCreateTypeInfo) (BG.Ptr ty) where
+
+  getField = HasCField.fromPtr (BG.Proxy @"unwrap")
+
+instance HasCField.HasCField DuckDBCreateTypeInfo "unwrap" where
+
+  type CFieldType DuckDBCreateTypeInfo "unwrap" =
+    BG.Ptr DuckDBCreateTypeInfoStruct
+
+  offset# = \_ -> \_ -> 0
+
+{-|
+
+    Contains a data chunk of a t'DuckDBResult' . Must be destroyed with duckdb_destroy_data_chunk.
+
+    history:
+
+    * stable: v0.3.3
+
+    __C declaration:__ @struct _duckdb_data_chunk@
+
+    __defined at:__ @duckdb.h 995:16@
+
+    __exported by:__ @duckdb.h@
+-}
+data DuckDBDataChunkStruct
+
+instance Marshal.StaticSize DuckDBDataChunkStruct where
+
+  staticSizeOf = \_ -> (8 :: Int)
+
+  staticAlignment = \_ -> (8 :: Int)
+
+{-|
+
+    Contains a data chunk of a t'DuckDBResult' . Must be destroyed with duckdb_destroy_data_chunk.
+
+    history:
+
+    * stable: v0.3.3
+
+    __C declaration:__ @duckdb_data_chunk@
+
+    __defined at:__ @duckdb.h 997:5@
+
+    __exported by:__ @duckdb.h@
+-}
+newtype DuckDBDataChunk = DuckDBDataChunk
+  { unwrap :: BG.Ptr DuckDBDataChunkStruct
+  }
+  deriving stock (Eq, BG.Generic, Ord, Show)
+  deriving newtype
+    ( BG.HasFFIType
+    , Marshal.ReadRaw
+    , Marshal.StaticSize
+    , BG.Storable
+    , Marshal.WriteRaw
+    )
+
+instance ( ty ~ BG.Ptr DuckDBDataChunkStruct
+         ) => BG.CompatHasField.HasField "unwrap" DuckDBDataChunk ty where
+
+  hasField =
+    \x0 ->
+      (\y1 ->
+         DuckDBDataChunk {unwrap = y1}, BG.getField @"unwrap" x0)
+
+instance ( ty ~ BG.Ptr DuckDBDataChunkStruct
+         ) => BG.HasField "unwrap" (BG.Ptr DuckDBDataChunk) (BG.Ptr ty) where
+
+  getField = HasCField.fromPtr (BG.Proxy @"unwrap")
+
+instance HasCField.HasCField DuckDBDataChunk "unwrap" where
+
+  type CFieldType DuckDBDataChunk "unwrap" =
+    BG.Ptr DuckDBDataChunkStruct
+
+  offset# = \_ -> \_ -> 0
+
+{-| A value of a logical type. Must be destroyed with duckdb_destroy_value.
+
+    history:
+
+    * stable: v0.3.3
+
+    __C declaration:__ @struct _duckdb_value@
+
+    __defined at:__ @duckdb.h 1005:16@
+
+    __exported by:__ @duckdb.h@
+-}
+data DuckDBValueStruct
+
+instance Marshal.StaticSize DuckDBValueStruct where
+
+  staticSizeOf = \_ -> (8 :: Int)
+
+  staticAlignment = \_ -> (8 :: Int)
+
+{-| A value of a logical type. Must be destroyed with duckdb_destroy_value.
+
+    history:
+
+    * stable: v0.3.3
+
+    __C declaration:__ @duckdb_value@
+
+    __defined at:__ @duckdb.h 1007:5@
+
+    __exported by:__ @duckdb.h@
+-}
+newtype DuckDBValue = DuckDBValue
+  { unwrap :: BG.Ptr DuckDBValueStruct
+  }
+  deriving stock (Eq, BG.Generic, Ord, Show)
+  deriving newtype
+    ( BG.HasFFIType
+    , Marshal.ReadRaw
+    , Marshal.StaticSize
+    , BG.Storable
+    , Marshal.WriteRaw
+    )
+
+instance ( ty ~ BG.Ptr DuckDBValueStruct
+         ) => BG.CompatHasField.HasField "unwrap" DuckDBValue ty where
+
+  hasField =
+    \x0 ->
+      (\y1 ->
+         DuckDBValue {unwrap = y1}, BG.getField @"unwrap" x0)
+
+instance ( ty ~ BG.Ptr DuckDBValueStruct
+         ) => BG.HasField "unwrap" (BG.Ptr DuckDBValue) (BG.Ptr ty) where
+
+  getField = HasCField.fromPtr (BG.Proxy @"unwrap")
+
+instance HasCField.HasCField DuckDBValue "unwrap" where
+
+  type CFieldType DuckDBValue "unwrap" =
+    BG.Ptr DuckDBValueStruct
+
+  offset# = \_ -> \_ -> 0
+
+{-| Holds a recursive tree containing profiling metrics.
+
+    history:
+
+    * stable: v1.1.0
+
+    __C declaration:__ @struct _duckdb_profiling_info@
+
+    __defined at:__ @duckdb.h 1015:16@
+
+    __exported by:__ @duckdb.h@
+-}
+data DuckDBProfilingInfoStruct
+
+instance Marshal.StaticSize DuckDBProfilingInfoStruct where
+
+  staticSizeOf = \_ -> (8 :: Int)
+
+  staticAlignment = \_ -> (8 :: Int)
+
+{-| Holds a recursive tree containing profiling metrics.
+
+    history:
+
+    * stable: v1.1.0
+
+    __C declaration:__ @duckdb_profiling_info@
+
+    __defined at:__ @duckdb.h 1017:5@
+
+    __exported by:__ @duckdb.h@
+-}
+newtype DuckDBProfilingInfo = DuckDBProfilingInfo
+  { unwrap :: BG.Ptr DuckDBProfilingInfoStruct
+  }
+  deriving stock (Eq, BG.Generic, Ord, Show)
+  deriving newtype
+    ( BG.HasFFIType
+    , Marshal.ReadRaw
+    , Marshal.StaticSize
+    , BG.Storable
+    , Marshal.WriteRaw
+    )
+
+instance ( ty ~ BG.Ptr DuckDBProfilingInfoStruct
+         ) => BG.CompatHasField.HasField "unwrap" DuckDBProfilingInfo ty where
+
+  hasField =
+    \x0 ->
+      (\y1 ->
+         DuckDBProfilingInfo {unwrap = y1}, BG.getField @"unwrap" x0)
+
+instance ( ty ~ BG.Ptr DuckDBProfilingInfoStruct
+         ) => BG.HasField "unwrap" (BG.Ptr DuckDBProfilingInfo) (BG.Ptr ty) where
+
+  getField = HasCField.fromPtr (BG.Proxy @"unwrap")
+
+instance HasCField.HasCField DuckDBProfilingInfo "unwrap" where
+
+  type CFieldType DuckDBProfilingInfo "unwrap" =
+    BG.Ptr DuckDBProfilingInfoStruct
+
+  offset# = \_ -> \_ -> 0
+
+{-| Holds error data. Must be destroyed with duckdb_destroy_error_data.
+
+    history:
+
+    * unstable: v1.4.0
+
+    * stable: v1.5.6
+
+    __C declaration:__ @struct _duckdb_error_data@
+
+    __defined at:__ @duckdb.h 1026:16@
+
+    __exported by:__ @duckdb.h@
+-}
+data DuckDBErrorDataStruct
+
+instance Marshal.StaticSize DuckDBErrorDataStruct where
+
+  staticSizeOf = \_ -> (8 :: Int)
+
+  staticAlignment = \_ -> (8 :: Int)
+
+{-| Holds error data. Must be destroyed with duckdb_destroy_error_data.
+
+    history:
+
+    * unstable: v1.4.0
+
+    * stable: v1.5.6
+
+    __C declaration:__ @duckdb_error_data@
+
+    __defined at:__ @duckdb.h 1028:5@
+
+    __exported by:__ @duckdb.h@
+-}
+newtype DuckDBErrorData = DuckDBErrorData
+  { unwrap :: BG.Ptr DuckDBErrorDataStruct
+  }
+  deriving stock (Eq, BG.Generic, Ord, Show)
+  deriving newtype
+    ( BG.HasFFIType
+    , Marshal.ReadRaw
+    , Marshal.StaticSize
+    , BG.Storable
+    , Marshal.WriteRaw
+    )
+
+instance ( ty ~ BG.Ptr DuckDBErrorDataStruct
+         ) => BG.CompatHasField.HasField "unwrap" DuckDBErrorData ty where
+
+  hasField =
+    \x0 ->
+      (\y1 ->
+         DuckDBErrorData {unwrap = y1}, BG.getField @"unwrap" x0)
+
+instance ( ty ~ BG.Ptr DuckDBErrorDataStruct
+         ) => BG.HasField "unwrap" (BG.Ptr DuckDBErrorData) (BG.Ptr ty) where
+
+  getField = HasCField.fromPtr (BG.Proxy @"unwrap")
+
+instance HasCField.HasCField DuckDBErrorData "unwrap" where
+
+  type CFieldType DuckDBErrorData "unwrap" =
+    BG.Ptr DuckDBErrorDataStruct
+
+  offset# = \_ -> \_ -> 0
+
+{-| Holds a bound expression. Must be destroyed with duckdb_destroy_expression.
+
+    history:
+
+    * unstable: v1.4.0
+
+    * stable: v1.5.6
+
+    __C declaration:__ @struct _duckdb_expression@
+
+    __defined at:__ @duckdb.h 1037:16@
+
+    __exported by:__ @duckdb.h@
+-}
+data DuckDBExpressionStruct
+
+instance Marshal.StaticSize DuckDBExpressionStruct where
+
+  staticSizeOf = \_ -> (8 :: Int)
+
+  staticAlignment = \_ -> (8 :: Int)
+
+{-| Holds a bound expression. Must be destroyed with duckdb_destroy_expression.
+
+    history:
+
+    * unstable: v1.4.0
+
+    * stable: v1.5.6
+
+    __C declaration:__ @duckdb_expression@
+
+    __defined at:__ @duckdb.h 1039:5@
+
+    __exported by:__ @duckdb.h@
+-}
+newtype DuckDBExpression = DuckDBExpression
+  { unwrap :: BG.Ptr DuckDBExpressionStruct
+  }
+  deriving stock (Eq, BG.Generic, Ord, Show)
+  deriving newtype
+    ( BG.HasFFIType
+    , Marshal.ReadRaw
+    , Marshal.StaticSize
+    , BG.Storable
+    , Marshal.WriteRaw
+    )
+
+instance ( ty ~ BG.Ptr DuckDBExpressionStruct
+         ) => BG.CompatHasField.HasField "unwrap" DuckDBExpression ty where
+
+  hasField =
+    \x0 ->
+      (\y1 ->
+         DuckDBExpression {unwrap = y1}, BG.getField @"unwrap" x0)
+
+instance ( ty ~ BG.Ptr DuckDBExpressionStruct
+         ) => BG.HasField "unwrap" (BG.Ptr DuckDBExpression) (BG.Ptr ty) where
+
+  getField = HasCField.fromPtr (BG.Proxy @"unwrap")
+
+instance HasCField.HasCField DuckDBExpression "unwrap" where
+
+  type CFieldType DuckDBExpression "unwrap" =
+    BG.Ptr DuckDBExpressionStruct
+
+  offset# = \_ -> \_ -> 0
+
+{-| A vector, either standalone or a column in a data chunk.
+
+    history:
+
+    * stable: v0.3.3
+
+    __C declaration:__ @struct _duckdb_vector@
+
+    __defined at:__ @duckdb.h 1047:16@
+
+    __exported by:__ @duckdb.h@
+-}
+data DuckDBVectorStruct
+
+instance Marshal.StaticSize DuckDBVectorStruct where
+
+  staticSizeOf = \_ -> (8 :: Int)
+
+  staticAlignment = \_ -> (8 :: Int)
+
+{-| A vector, either standalone or a column in a data chunk.
+
+    history:
+
+    * stable: v0.3.3
+
+    __C declaration:__ @duckdb_vector@
+
+    __defined at:__ @duckdb.h 1049:5@
+
+    __exported by:__ @duckdb.h@
+-}
+newtype DuckDBVector = DuckDBVector
+  { unwrap :: BG.Ptr DuckDBVectorStruct
+  }
+  deriving stock (Eq, BG.Generic, Ord, Show)
+  deriving newtype
+    ( BG.HasFFIType
+    , Marshal.ReadRaw
+    , Marshal.StaticSize
+    , BG.Storable
+    , Marshal.WriteRaw
+    )
+
+instance ( ty ~ BG.Ptr DuckDBVectorStruct
+         ) => BG.CompatHasField.HasField "unwrap" DuckDBVector ty where
+
+  hasField =
+    \x0 ->
+      (\y1 ->
+         DuckDBVector {unwrap = y1}, BG.getField @"unwrap" x0)
+
+instance ( ty ~ BG.Ptr DuckDBVectorStruct
+         ) => BG.HasField "unwrap" (BG.Ptr DuckDBVector) (BG.Ptr ty) where
+
+  getField = HasCField.fromPtr (BG.Proxy @"unwrap")
+
+instance HasCField.HasCField DuckDBVector "unwrap" where
+
+  type CFieldType DuckDBVector "unwrap" =
+    BG.Ptr DuckDBVectorStruct
+
+  offset# = \_ -> \_ -> 0
+
+{-| A selection vector defining a selection on top of a vector. Must be destroyed with duckdb_destroy_selection_vector.
+
+    history:
+
+    * unstable: v1.3.0
+
+    * stable: v1.5.6
+
+    __C declaration:__ @struct _duckdb_selection_vector@
+
+    __defined at:__ @duckdb.h 1058:16@
+
+    __exported by:__ @duckdb.h@
+-}
+data DuckDBSelectionVectorStruct
+
+instance Marshal.StaticSize DuckDBSelectionVectorStruct where
+
+  staticSizeOf = \_ -> (8 :: Int)
+
+  staticAlignment = \_ -> (8 :: Int)
+
+{-| A selection vector defining a selection on top of a vector. Must be destroyed with duckdb_destroy_selection_vector.
+
+    history:
+
+    * unstable: v1.3.0
+
+    * stable: v1.5.6
+
+    __C declaration:__ @duckdb_selection_vector@
+
+    __defined at:__ @duckdb.h 1060:5@
+
+    __exported by:__ @duckdb.h@
+-}
+newtype DuckDBSelectionVector = DuckDBSelectionVector
+  { unwrap :: BG.Ptr DuckDBSelectionVectorStruct
+  }
+  deriving stock (Eq, BG.Generic, Ord, Show)
+  deriving newtype
+    ( BG.HasFFIType
+    , Marshal.ReadRaw
+    , Marshal.StaticSize
+    , BG.Storable
+    , Marshal.WriteRaw
+    )
+
+instance ( ty ~ BG.Ptr DuckDBSelectionVectorStruct
+         ) => BG.CompatHasField.HasField "unwrap" DuckDBSelectionVector ty where
+
+  hasField =
+    \x0 ->
+      (\y1 ->
+         DuckDBSelectionVector {unwrap = y1}, BG.getField @"unwrap" x0)
+
+instance ( ty ~ BG.Ptr DuckDBSelectionVectorStruct
+         ) => BG.HasField "unwrap" (BG.Ptr DuckDBSelectionVector) (BG.Ptr ty) where
+
+  getField = HasCField.fromPtr (BG.Proxy @"unwrap")
+
+instance HasCField.HasCField DuckDBSelectionVector "unwrap" where
+
+  type CFieldType DuckDBSelectionVector "unwrap" =
+    BG.Ptr DuckDBSelectionVectorStruct
+
+  offset# = \_ -> \_ -> 0
+
+{-| Arrow options for transforming DuckDB schema/chunks to Arrow. Must be destroyed with duckdb_destroy_arrow_options.
+
+    history:
+
+    * unstable: v1.4.0
+
+    * stable: v1.5.6
+
+    __C declaration:__ @struct _duckdb_arrow_options@
+
+    __defined at:__ @duckdb.h 1069:16@
+
+    __exported by:__ @duckdb.h@
+-}
+data DuckDBArrowOptionsStruct
+
+instance Marshal.StaticSize DuckDBArrowOptionsStruct where
+
+  staticSizeOf = \_ -> (8 :: Int)
+
+  staticAlignment = \_ -> (8 :: Int)
+
+{-| Arrow options for transforming DuckDB schema/chunks to Arrow. Must be destroyed with duckdb_destroy_arrow_options.
+
+    history:
+
+    * unstable: v1.4.0
+
+    * stable: v1.5.6
+
+    __C declaration:__ @duckdb_arrow_options@
+
+    __defined at:__ @duckdb.h 1071:5@
+
+    __exported by:__ @duckdb.h@
+-}
+newtype DuckDBArrowOptions = DuckDBArrowOptions
+  { unwrap :: BG.Ptr DuckDBArrowOptionsStruct
+  }
+  deriving stock (Eq, BG.Generic, Ord, Show)
+  deriving newtype
+    ( BG.HasFFIType
+    , Marshal.ReadRaw
+    , Marshal.StaticSize
+    , BG.Storable
+    , Marshal.WriteRaw
+    )
+
+instance ( ty ~ BG.Ptr DuckDBArrowOptionsStruct
+         ) => BG.CompatHasField.HasField "unwrap" DuckDBArrowOptions ty where
+
+  hasField =
+    \x0 ->
+      (\y1 ->
+         DuckDBArrowOptions {unwrap = y1}, BG.getField @"unwrap" x0)
+
+instance ( ty ~ BG.Ptr DuckDBArrowOptionsStruct
+         ) => BG.HasField "unwrap" (BG.Ptr DuckDBArrowOptions) (BG.Ptr ty) where
+
+  getField = HasCField.fromPtr (BG.Proxy @"unwrap")
+
+instance HasCField.HasCField DuckDBArrowOptions "unwrap" where
+
+  type CFieldType DuckDBArrowOptions "unwrap" =
+    BG.Ptr DuckDBArrowOptionsStruct
+
+  offset# = \_ -> \_ -> 0
+
+{-| An arrow result set. Must be destroyed with duckdb_destroy_arrow.
+
+    history:
+
+    * stable: v0.2.8
+
+    * deprecated: v1.5.6
+
+    __C declaration:__ @struct _duckdb_arrow@
+
+    __defined at:__ @duckdb.h 1080:16@
+
+    __exported by:__ @duckdb.h@
+-}
+data DuckDBArrowStruct
+
+instance Marshal.StaticSize DuckDBArrowStruct where
+
+  staticSizeOf = \_ -> (8 :: Int)
+
+  staticAlignment = \_ -> (8 :: Int)
+
+{-| An arrow result set. Must be destroyed with duckdb_destroy_arrow.
+
+    history:
+
+    * stable: v0.2.8
+
+    * deprecated: v1.5.6
+
+    __C declaration:__ @duckdb_arrow@
+
+    __defined at:__ @duckdb.h 1082:5@
+
+    __exported by:__ @duckdb.h@
+-}
+newtype DuckDBArrow = DuckDBArrow
+  { unwrap :: BG.Ptr DuckDBArrowStruct
+  }
+  deriving stock (Eq, BG.Generic, Ord, Show)
+  deriving newtype
+    ( BG.HasFFIType
+    , Marshal.ReadRaw
+    , Marshal.StaticSize
+    , BG.Storable
+    , Marshal.WriteRaw
+    )
+
+instance ( ty ~ BG.Ptr DuckDBArrowStruct
+         ) => BG.CompatHasField.HasField "unwrap" DuckDBArrow ty where
+
+  hasField =
+    \x0 ->
+      (\y1 ->
+         DuckDBArrow {unwrap = y1}, BG.getField @"unwrap" x0)
+
+instance ( ty ~ BG.Ptr DuckDBArrowStruct
+         ) => BG.HasField "unwrap" (BG.Ptr DuckDBArrow) (BG.Ptr ty) where
+
+  getField = HasCField.fromPtr (BG.Proxy @"unwrap")
+
+instance HasCField.HasCField DuckDBArrow "unwrap" where
+
+  type CFieldType DuckDBArrow "unwrap" =
+    BG.Ptr DuckDBArrowStruct
+
+  offset# = \_ -> \_ -> 0
+
+{-| An arrow stream wrapper. Must be destroyed with duckdb_destroy_arrow_stream.
+
+    history:
+
+    * stable: v0.9.0
+
+    * deprecated: v1.5.6
+
+    __C declaration:__ @struct _duckdb_arrow_stream@
+
+    __defined at:__ @duckdb.h 1091:16@
+
+    __exported by:__ @duckdb.h@
+-}
+data DuckDBArrowStreamStruct
+
+instance Marshal.StaticSize DuckDBArrowStreamStruct where
+
+  staticSizeOf = \_ -> (8 :: Int)
+
+  staticAlignment = \_ -> (8 :: Int)
+
+{-| An arrow stream wrapper. Must be destroyed with duckdb_destroy_arrow_stream.
+
+    history:
+
+    * stable: v0.9.0
+
+    * deprecated: v1.5.6
+
+    __C declaration:__ @duckdb_arrow_stream@
+
+    __defined at:__ @duckdb.h 1093:5@
+
+    __exported by:__ @duckdb.h@
+-}
+newtype DuckDBArrowStream = DuckDBArrowStream
+  { unwrap :: BG.Ptr DuckDBArrowStreamStruct
+  }
+  deriving stock (Eq, BG.Generic, Ord, Show)
+  deriving newtype
+    ( BG.HasFFIType
+    , Marshal.ReadRaw
+    , Marshal.StaticSize
+    , BG.Storable
+    , Marshal.WriteRaw
+    )
+
+instance ( ty ~ BG.Ptr DuckDBArrowStreamStruct
+         ) => BG.CompatHasField.HasField "unwrap" DuckDBArrowStream ty where
+
+  hasField =
+    \x0 ->
+      (\y1 ->
+         DuckDBArrowStream {unwrap = y1}, BG.getField @"unwrap" x0)
+
+instance ( ty ~ BG.Ptr DuckDBArrowStreamStruct
+         ) => BG.HasField "unwrap" (BG.Ptr DuckDBArrowStream) (BG.Ptr ty) where
+
+  getField = HasCField.fromPtr (BG.Proxy @"unwrap")
+
+instance HasCField.HasCField DuckDBArrowStream "unwrap" where
+
+  type CFieldType DuckDBArrowStream "unwrap" =
+    BG.Ptr DuckDBArrowStreamStruct
+
+  offset# = \_ -> \_ -> 0
+
+{-| An arrow schema wrapper.
+
+    history:
+
+    * stable: v0.2.8
+
+    * deprecated: v1.5.6
+
+    __C declaration:__ @struct _duckdb_arrow_schema@
+
+    __defined at:__ @duckdb.h 1102:16@
+
+    __exported by:__ @duckdb.h@
+-}
+data DuckDBArrowSchemaStruct
+
+instance Marshal.StaticSize DuckDBArrowSchemaStruct where
+
+  staticSizeOf = \_ -> (8 :: Int)
+
+  staticAlignment = \_ -> (8 :: Int)
+
+{-| An arrow schema wrapper.
+
+    history:
+
+    * stable: v0.2.8
+
+    * deprecated: v1.5.6
+
+    __C declaration:__ @duckdb_arrow_schema@
+
+    __defined at:__ @duckdb.h 1104:5@
+
+    __exported by:__ @duckdb.h@
+-}
+newtype DuckDBArrowSchema = DuckDBArrowSchema
+  { unwrap :: BG.Ptr DuckDBArrowSchemaStruct
+  }
+  deriving stock (Eq, BG.Generic, Ord, Show)
+  deriving newtype
+    ( BG.HasFFIType
+    , Marshal.ReadRaw
+    , Marshal.StaticSize
+    , BG.Storable
+    , Marshal.WriteRaw
+    )
+
+instance ( ty ~ BG.Ptr DuckDBArrowSchemaStruct
+         ) => BG.CompatHasField.HasField "unwrap" DuckDBArrowSchema ty where
+
+  hasField =
+    \x0 ->
+      (\y1 ->
+         DuckDBArrowSchema {unwrap = y1}, BG.getField @"unwrap" x0)
+
+instance ( ty ~ BG.Ptr DuckDBArrowSchemaStruct
+         ) => BG.HasField "unwrap" (BG.Ptr DuckDBArrowSchema) (BG.Ptr ty) where
+
+  getField = HasCField.fromPtr (BG.Proxy @"unwrap")
+
+instance HasCField.HasCField DuckDBArrowSchema "unwrap" where
+
+  type CFieldType DuckDBArrowSchema "unwrap" =
+    BG.Ptr DuckDBArrowSchemaStruct
+
+  offset# = \_ -> \_ -> 0
+
+{-| An arrow array wrapper.
+
+    history:
+
+    * stable: v0.2.8
+
+    * deprecated: v1.5.6
+
+    __C declaration:__ @struct _duckdb_arrow_array@
+
+    __defined at:__ @duckdb.h 1113:16@
+
+    __exported by:__ @duckdb.h@
+-}
+data DuckDBArrowArrayStruct
+
+instance Marshal.StaticSize DuckDBArrowArrayStruct where
+
+  staticSizeOf = \_ -> (8 :: Int)
+
+  staticAlignment = \_ -> (8 :: Int)
+
+{-| An arrow array wrapper.
+
+    history:
+
+    * stable: v0.2.8
+
+    * deprecated: v1.5.6
+
+    __C declaration:__ @duckdb_arrow_array@
+
+    __defined at:__ @duckdb.h 1115:5@
+
+    __exported by:__ @duckdb.h@
+-}
+newtype DuckDBArrowArray = DuckDBArrowArray
+  { unwrap :: BG.Ptr DuckDBArrowArrayStruct
+  }
+  deriving stock (Eq, BG.Generic, Ord, Show)
+  deriving newtype
+    ( BG.HasFFIType
+    , Marshal.ReadRaw
+    , Marshal.StaticSize
+    , BG.Storable
+    , Marshal.WriteRaw
+    )
+
+instance ( ty ~ BG.Ptr DuckDBArrowArrayStruct
+         ) => BG.CompatHasField.HasField "unwrap" DuckDBArrowArray ty where
+
+  hasField =
+    \x0 ->
+      (\y1 ->
+         DuckDBArrowArray {unwrap = y1}, BG.getField @"unwrap" x0)
+
+instance ( ty ~ BG.Ptr DuckDBArrowArrayStruct
+         ) => BG.HasField "unwrap" (BG.Ptr DuckDBArrowArray) (BG.Ptr ty) where
+
+  getField = HasCField.fromPtr (BG.Proxy @"unwrap")
+
+instance HasCField.HasCField DuckDBArrowArray "unwrap" where
+
+  type CFieldType DuckDBArrowArray "unwrap" =
+    BG.Ptr DuckDBArrowArrayStruct
+
+  offset# = \_ -> \_ -> 0
+
+{-| Holds a converted Arrow schema. Must be destroyed with duckdb_destroy_arrow_converted_schema.
+
+    history:
+
+    * unstable: v1.4.0
+
+    * stable: v1.5.6
+
+    __C declaration:__ @struct _duckdb_arrow_converted_schema@
+
+    __defined at:__ @duckdb.h 1124:16@
+
+    __exported by:__ @duckdb.h@
+-}
+data DuckDBArrowConvertedSchemaStruct
+
+instance Marshal.StaticSize DuckDBArrowConvertedSchemaStruct where
+
+  staticSizeOf = \_ -> (8 :: Int)
+
+  staticAlignment = \_ -> (8 :: Int)
+
+{-| Holds a converted Arrow schema. Must be destroyed with duckdb_destroy_arrow_converted_schema.
+
+    history:
+
+    * unstable: v1.4.0
+
+    * stable: v1.5.6
+
+    __C declaration:__ @duckdb_arrow_converted_schema@
+
+    __defined at:__ @duckdb.h 1126:5@
+
+    __exported by:__ @duckdb.h@
+-}
+newtype DuckDBArrowConvertedSchema = DuckDBArrowConvertedSchema
+  { unwrap :: BG.Ptr DuckDBArrowConvertedSchemaStruct
+  }
+  deriving stock (Eq, BG.Generic, Ord, Show)
+  deriving newtype
+    ( BG.HasFFIType
+    , Marshal.ReadRaw
+    , Marshal.StaticSize
+    , BG.Storable
+    , Marshal.WriteRaw
+    )
+
+instance ( ty ~ BG.Ptr DuckDBArrowConvertedSchemaStruct
+         ) => BG.CompatHasField.HasField "unwrap" DuckDBArrowConvertedSchema ty where
+
+  hasField =
+    \x0 ->
+      (\y1 ->
+         DuckDBArrowConvertedSchema {unwrap = y1}, BG.getField @"unwrap" x0)
+
+instance ( ty ~ BG.Ptr DuckDBArrowConvertedSchemaStruct
+         ) => BG.HasField "unwrap" (BG.Ptr DuckDBArrowConvertedSchema) (BG.Ptr ty) where
+
+  getField = HasCField.fromPtr (BG.Proxy @"unwrap")
+
+instance HasCField.HasCField DuckDBArrowConvertedSchema "unwrap" where
+
+  type CFieldType DuckDBArrowConvertedSchema "unwrap" =
+    BG.Ptr DuckDBArrowConvertedSchemaStruct
+
+  offset# = \_ -> \_ -> 0
+
+{-| File open options. Must be destroyed with duckdb_destroy_file_open_options.
+
+    history:
+
+    * unstable: v1.5.0
+
+    * stable: v1.5.6
+
+    __C declaration:__ @struct _duckdb_file_open_options@
+
+    __defined at:__ @duckdb.h 1135:16@
+
+    __exported by:__ @duckdb.h@
+-}
+data DuckDBFileOpenOptionsStruct
+
+instance Marshal.StaticSize DuckDBFileOpenOptionsStruct where
+
+  staticSizeOf = \_ -> (8 :: Int)
+
+  staticAlignment = \_ -> (8 :: Int)
+
+{-| File open options. Must be destroyed with duckdb_destroy_file_open_options.
+
+    history:
+
+    * unstable: v1.5.0
+
+    * stable: v1.5.6
+
+    __C declaration:__ @duckdb_file_open_options@
+
+    __defined at:__ @duckdb.h 1137:5@
+
+    __exported by:__ @duckdb.h@
+-}
+newtype DuckDBFileOpenOptions = DuckDBFileOpenOptions
+  { unwrap :: BG.Ptr DuckDBFileOpenOptionsStruct
+  }
+  deriving stock (Eq, BG.Generic, Ord, Show)
+  deriving newtype
+    ( BG.HasFFIType
+    , Marshal.ReadRaw
+    , Marshal.StaticSize
+    , BG.Storable
+    , Marshal.WriteRaw
+    )
+
+instance ( ty ~ BG.Ptr DuckDBFileOpenOptionsStruct
+         ) => BG.CompatHasField.HasField "unwrap" DuckDBFileOpenOptions ty where
+
+  hasField =
+    \x0 ->
+      (\y1 ->
+         DuckDBFileOpenOptions {unwrap = y1}, BG.getField @"unwrap" x0)
+
+instance ( ty ~ BG.Ptr DuckDBFileOpenOptionsStruct
+         ) => BG.HasField "unwrap" (BG.Ptr DuckDBFileOpenOptions) (BG.Ptr ty) where
+
+  getField = HasCField.fromPtr (BG.Proxy @"unwrap")
+
+instance HasCField.HasCField DuckDBFileOpenOptions "unwrap" where
+
+  type CFieldType DuckDBFileOpenOptions "unwrap" =
+    BG.Ptr DuckDBFileOpenOptionsStruct
+
+  offset# = \_ -> \_ -> 0
+
+{-| A file system instance. Must be destroyed with duckdb_destroy_file_system.
+
+    history:
+
+    * unstable: v1.5.0
+
+    * stable: v1.5.6
+
+    __C declaration:__ @struct _duckdb_file_system@
+
+    __defined at:__ @duckdb.h 1146:16@
+
+    __exported by:__ @duckdb.h@
+-}
+data DuckDBFileSystemStruct
+
+instance Marshal.StaticSize DuckDBFileSystemStruct where
+
+  staticSizeOf = \_ -> (8 :: Int)
+
+  staticAlignment = \_ -> (8 :: Int)
+
+{-| A file system instance. Must be destroyed with duckdb_destroy_file_system.
+
+    history:
+
+    * unstable: v1.5.0
+
+    * stable: v1.5.6
+
+    __C declaration:__ @duckdb_file_system@
+
+    __defined at:__ @duckdb.h 1148:5@
+
+    __exported by:__ @duckdb.h@
+-}
+newtype DuckDBFileSystem = DuckDBFileSystem
+  { unwrap :: BG.Ptr DuckDBFileSystemStruct
+  }
+  deriving stock (Eq, BG.Generic, Ord, Show)
+  deriving newtype
+    ( BG.HasFFIType
+    , Marshal.ReadRaw
+    , Marshal.StaticSize
+    , BG.Storable
+    , Marshal.WriteRaw
+    )
+
+instance ( ty ~ BG.Ptr DuckDBFileSystemStruct
+         ) => BG.CompatHasField.HasField "unwrap" DuckDBFileSystem ty where
+
+  hasField =
+    \x0 ->
+      (\y1 ->
+         DuckDBFileSystem {unwrap = y1}, BG.getField @"unwrap" x0)
+
+instance ( ty ~ BG.Ptr DuckDBFileSystemStruct
+         ) => BG.HasField "unwrap" (BG.Ptr DuckDBFileSystem) (BG.Ptr ty) where
+
+  getField = HasCField.fromPtr (BG.Proxy @"unwrap")
+
+instance HasCField.HasCField DuckDBFileSystem "unwrap" where
+
+  type CFieldType DuckDBFileSystem "unwrap" =
+    BG.Ptr DuckDBFileSystemStruct
+
+  offset# = \_ -> \_ -> 0
+
+{-| A file handle. Must be destroyed with duckdb_destroy_file_handle.
+
+    history:
+
+    * unstable: v1.5.0
+
+    * stable: v1.5.6
+
+    __C declaration:__ @struct _duckdb_file_handle@
+
+    __defined at:__ @duckdb.h 1157:16@
+
+    __exported by:__ @duckdb.h@
+-}
+data DuckDBFileHandleStruct
+
+instance Marshal.StaticSize DuckDBFileHandleStruct where
+
+  staticSizeOf = \_ -> (8 :: Int)
+
+  staticAlignment = \_ -> (8 :: Int)
+
+{-| A file handle. Must be destroyed with duckdb_destroy_file_handle.
+
+    history:
+
+    * unstable: v1.5.0
+
+    * stable: v1.5.6
+
+    __C declaration:__ @duckdb_file_handle@
+
+    __defined at:__ @duckdb.h 1159:5@
+
+    __exported by:__ @duckdb.h@
+-}
+newtype DuckDBFileHandle = DuckDBFileHandle
+  { unwrap :: BG.Ptr DuckDBFileHandleStruct
+  }
+  deriving stock (Eq, BG.Generic, Ord, Show)
+  deriving newtype
+    ( BG.HasFFIType
+    , Marshal.ReadRaw
+    , Marshal.StaticSize
+    , BG.Storable
+    , Marshal.WriteRaw
+    )
+
+instance ( ty ~ BG.Ptr DuckDBFileHandleStruct
+         ) => BG.CompatHasField.HasField "unwrap" DuckDBFileHandle ty where
+
+  hasField =
+    \x0 ->
+      (\y1 ->
+         DuckDBFileHandle {unwrap = y1}, BG.getField @"unwrap" x0)
+
+instance ( ty ~ BG.Ptr DuckDBFileHandleStruct
+         ) => BG.HasField "unwrap" (BG.Ptr DuckDBFileHandle) (BG.Ptr ty) where
+
+  getField = HasCField.fromPtr (BG.Proxy @"unwrap")
+
+instance HasCField.HasCField DuckDBFileHandle "unwrap" where
+
+  type CFieldType DuckDBFileHandle "unwrap" =
+    BG.Ptr DuckDBFileHandleStruct
+
+  offset# = \_ -> \_ -> 0
+
+{-| A handle to a database catalog. Must be destroyed with duckdb_destroy_catalog.
+
+    history:
+
+    * unstable: v1.5.0
+
+    * stable: v1.5.6
+
+    __C declaration:__ @struct _duckdb_catalog@
+
+    __defined at:__ @duckdb.h 1168:16@
+
+    __exported by:__ @duckdb.h@
+-}
+data DuckDBCatalogStruct
+
+instance Marshal.StaticSize DuckDBCatalogStruct where
+
+  staticSizeOf = \_ -> (8 :: Int)
+
+  staticAlignment = \_ -> (8 :: Int)
+
+{-| A handle to a database catalog. Must be destroyed with duckdb_destroy_catalog.
+
+    history:
+
+    * unstable: v1.5.0
+
+    * stable: v1.5.6
+
+    __C declaration:__ @duckdb_catalog@
+
+    __defined at:__ @duckdb.h 1170:5@
+
+    __exported by:__ @duckdb.h@
+-}
+newtype DuckDBCatalog = DuckDBCatalog
+  { unwrap :: BG.Ptr DuckDBCatalogStruct
+  }
+  deriving stock (Eq, BG.Generic, Ord, Show)
+  deriving newtype
+    ( BG.HasFFIType
+    , Marshal.ReadRaw
+    , Marshal.StaticSize
+    , BG.Storable
+    , Marshal.WriteRaw
+    )
+
+instance ( ty ~ BG.Ptr DuckDBCatalogStruct
+         ) => BG.CompatHasField.HasField "unwrap" DuckDBCatalog ty where
+
+  hasField =
+    \x0 ->
+      (\y1 ->
+         DuckDBCatalog {unwrap = y1}, BG.getField @"unwrap" x0)
+
+instance ( ty ~ BG.Ptr DuckDBCatalogStruct
+         ) => BG.HasField "unwrap" (BG.Ptr DuckDBCatalog) (BG.Ptr ty) where
+
+  getField = HasCField.fromPtr (BG.Proxy @"unwrap")
+
+instance HasCField.HasCField DuckDBCatalog "unwrap" where
+
+  type CFieldType DuckDBCatalog "unwrap" =
+    BG.Ptr DuckDBCatalogStruct
+
+  offset# = \_ -> \_ -> 0
+
+{-| A handle to a catalog entry. Must be destroyed with duckdb_destroy_catalog_entry.
+
+    history:
+
+    * unstable: v1.5.0
+
+    * stable: v1.5.6
+
+    __C declaration:__ @struct _duckdb_catalog_entry@
+
+    __defined at:__ @duckdb.h 1179:16@
+
+    __exported by:__ @duckdb.h@
+-}
+data DuckDBCatalogEntryStruct
+
+instance Marshal.StaticSize DuckDBCatalogEntryStruct where
+
+  staticSizeOf = \_ -> (8 :: Int)
+
+  staticAlignment = \_ -> (8 :: Int)
+
+{-| A handle to a catalog entry. Must be destroyed with duckdb_destroy_catalog_entry.
+
+    history:
+
+    * unstable: v1.5.0
+
+    * stable: v1.5.6
+
+    __C declaration:__ @duckdb_catalog_entry@
+
+    __defined at:__ @duckdb.h 1181:5@
+
+    __exported by:__ @duckdb.h@
+-}
+newtype DuckDBCatalogEntry = DuckDBCatalogEntry
+  { unwrap :: BG.Ptr DuckDBCatalogEntryStruct
+  }
+  deriving stock (Eq, BG.Generic, Ord, Show)
+  deriving newtype
+    ( BG.HasFFIType
+    , Marshal.ReadRaw
+    , Marshal.StaticSize
+    , BG.Storable
+    , Marshal.WriteRaw
+    )
+
+instance ( ty ~ BG.Ptr DuckDBCatalogEntryStruct
+         ) => BG.CompatHasField.HasField "unwrap" DuckDBCatalogEntry ty where
+
+  hasField =
+    \x0 ->
+      (\y1 ->
+         DuckDBCatalogEntry {unwrap = y1}, BG.getField @"unwrap" x0)
+
+instance ( ty ~ BG.Ptr DuckDBCatalogEntryStruct
+         ) => BG.HasField "unwrap" (BG.Ptr DuckDBCatalogEntry) (BG.Ptr ty) where
+
+  getField = HasCField.fromPtr (BG.Proxy @"unwrap")
+
+instance HasCField.HasCField DuckDBCatalogEntry "unwrap" where
+
+  type CFieldType DuckDBCatalogEntry "unwrap" =
+    BG.Ptr DuckDBCatalogEntryStruct
+
+  offset# = \_ -> \_ -> 0
+
+{-| Used for threading, contains a task state. Must be destroyed with duckdb_destroy_task_state.
+
+    history:
+
+    * stable: v0.5.0
+
+    __C declaration:__ @duckdb_task_state@
+
+    __defined at:__ @duckdb.h 1189:15@
+
+    __exported by:__ @duckdb.h@
+-}
+newtype DuckDBTaskState = DuckDBTaskState
+  { unwrap :: BG.Ptr BG.Void
+  }
+  deriving stock (Eq, BG.Generic, Ord, Show)
+  deriving newtype
+    ( BG.HasFFIType
+    , Marshal.ReadRaw
+    , Marshal.StaticSize
+    , BG.Storable
+    , Marshal.WriteRaw
+    )
+
+instance ( ty ~ BG.Ptr BG.Void
+         ) => BG.CompatHasField.HasField "unwrap" DuckDBTaskState ty where
+
+  hasField =
+    \x0 ->
+      (\y1 ->
+         DuckDBTaskState {unwrap = y1}, BG.getField @"unwrap" x0)
+
+instance ( ty ~ BG.Ptr BG.Void
+         ) => BG.HasField "unwrap" (BG.Ptr DuckDBTaskState) (BG.Ptr ty) where
+
+  getField = HasCField.fromPtr (BG.Proxy @"unwrap")
+
+instance HasCField.HasCField DuckDBTaskState "unwrap" where
+
+  type CFieldType DuckDBTaskState "unwrap" =
+    BG.Ptr BG.Void
+
+  offset# = \_ -> \_ -> 0
+
+{-| A scalar function. Must be destroyed with duckdb_destroy_scalar_function.
+
+    history:
+
+    * stable: v1.1.0
+
+    __C declaration:__ @struct _duckdb_scalar_function@
+
+    __defined at:__ @duckdb.h 1197:16@
+
+    __exported by:__ @duckdb.h@
+-}
+data DuckDBScalarFunctionStruct
+
+instance Marshal.StaticSize DuckDBScalarFunctionStruct where
+
+  staticSizeOf = \_ -> (8 :: Int)
+
+  staticAlignment = \_ -> (8 :: Int)
+
+{-| A scalar function. Must be destroyed with duckdb_destroy_scalar_function.
+
+    history:
+
+    * stable: v1.1.0
+
+    __C declaration:__ @duckdb_scalar_function@
+
+    __defined at:__ @duckdb.h 1199:5@
+
+    __exported by:__ @duckdb.h@
+-}
+newtype DuckDBScalarFunction = DuckDBScalarFunction
+  { unwrap :: BG.Ptr DuckDBScalarFunctionStruct
+  }
+  deriving stock (Eq, BG.Generic, Ord, Show)
+  deriving newtype
+    ( BG.HasFFIType
+    , Marshal.ReadRaw
+    , Marshal.StaticSize
+    , BG.Storable
+    , Marshal.WriteRaw
+    )
+
+instance ( ty ~ BG.Ptr DuckDBScalarFunctionStruct
+         ) => BG.CompatHasField.HasField "unwrap" DuckDBScalarFunction ty where
+
+  hasField =
+    \x0 ->
+      (\y1 ->
+         DuckDBScalarFunction {unwrap = y1}, BG.getField @"unwrap" x0)
+
+instance ( ty ~ BG.Ptr DuckDBScalarFunctionStruct
+         ) => BG.HasField "unwrap" (BG.Ptr DuckDBScalarFunction) (BG.Ptr ty) where
+
+  getField = HasCField.fromPtr (BG.Proxy @"unwrap")
+
+instance HasCField.HasCField DuckDBScalarFunction "unwrap" where
+
+  type CFieldType DuckDBScalarFunction "unwrap" =
+    BG.Ptr DuckDBScalarFunctionStruct
+
+  offset# = \_ -> \_ -> 0
+
+{-| A scalar function set. Must be destroyed with duckdb_destroy_scalar_function_set.
+
+    history:
+
+    * stable: v1.1.0
+
+    __C declaration:__ @struct _duckdb_scalar_function_set@
+
+    __defined at:__ @duckdb.h 1207:16@
+
+    __exported by:__ @duckdb.h@
+-}
+data DuckDBScalarFunctionSetStruct
+
+instance Marshal.StaticSize DuckDBScalarFunctionSetStruct where
+
+  staticSizeOf = \_ -> (8 :: Int)
+
+  staticAlignment = \_ -> (8 :: Int)
+
+{-| A scalar function set. Must be destroyed with duckdb_destroy_scalar_function_set.
+
+    history:
+
+    * stable: v1.1.0
+
+    __C declaration:__ @duckdb_scalar_function_set@
+
+    __defined at:__ @duckdb.h 1209:5@
+
+    __exported by:__ @duckdb.h@
+-}
+newtype DuckDBScalarFunctionSet = DuckDBScalarFunctionSet
+  { unwrap :: BG.Ptr DuckDBScalarFunctionSetStruct
+  }
+  deriving stock (Eq, BG.Generic, Ord, Show)
+  deriving newtype
+    ( BG.HasFFIType
+    , Marshal.ReadRaw
+    , Marshal.StaticSize
+    , BG.Storable
+    , Marshal.WriteRaw
+    )
+
+instance ( ty ~ BG.Ptr DuckDBScalarFunctionSetStruct
+         ) => BG.CompatHasField.HasField "unwrap" DuckDBScalarFunctionSet ty where
+
+  hasField =
+    \x0 ->
+      (\y1 ->
+         DuckDBScalarFunctionSet {unwrap = y1}, BG.getField @"unwrap" x0)
+
+instance ( ty ~ BG.Ptr DuckDBScalarFunctionSetStruct
+         ) => BG.HasField "unwrap" (BG.Ptr DuckDBScalarFunctionSet) (BG.Ptr ty) where
+
+  getField = HasCField.fromPtr (BG.Proxy @"unwrap")
+
+instance HasCField.HasCField DuckDBScalarFunctionSet "unwrap" where
+
+  type CFieldType DuckDBScalarFunctionSet "unwrap" =
+    BG.Ptr DuckDBScalarFunctionSetStruct
+
+  offset# = \_ -> \_ -> 0
+
+{-| An aggregate function. Must be destroyed with duckdb_destroy_aggregate_function.
+
+    history:
+
+    * stable: v1.1.0
+
+    __C declaration:__ @struct _duckdb_aggregate_function@
+
+    __defined at:__ @duckdb.h 1217:16@
+
+    __exported by:__ @duckdb.h@
+-}
+data DuckDBAggregateFunctionStruct
+
+instance Marshal.StaticSize DuckDBAggregateFunctionStruct where
+
+  staticSizeOf = \_ -> (8 :: Int)
+
+  staticAlignment = \_ -> (8 :: Int)
+
+{-| An aggregate function. Must be destroyed with duckdb_destroy_aggregate_function.
+
+    history:
+
+    * stable: v1.1.0
+
+    __C declaration:__ @duckdb_aggregate_function@
+
+    __defined at:__ @duckdb.h 1219:5@
+
+    __exported by:__ @duckdb.h@
+-}
+newtype DuckDBAggregateFunction = DuckDBAggregateFunction
+  { unwrap :: BG.Ptr DuckDBAggregateFunctionStruct
+  }
+  deriving stock (Eq, BG.Generic, Ord, Show)
+  deriving newtype
+    ( BG.HasFFIType
+    , Marshal.ReadRaw
+    , Marshal.StaticSize
+    , BG.Storable
+    , Marshal.WriteRaw
+    )
+
+instance ( ty ~ BG.Ptr DuckDBAggregateFunctionStruct
+         ) => BG.CompatHasField.HasField "unwrap" DuckDBAggregateFunction ty where
+
+  hasField =
+    \x0 ->
+      (\y1 ->
+         DuckDBAggregateFunction {unwrap = y1}, BG.getField @"unwrap" x0)
+
+instance ( ty ~ BG.Ptr DuckDBAggregateFunctionStruct
+         ) => BG.HasField "unwrap" (BG.Ptr DuckDBAggregateFunction) (BG.Ptr ty) where
+
+  getField = HasCField.fromPtr (BG.Proxy @"unwrap")
+
+instance HasCField.HasCField DuckDBAggregateFunction "unwrap" where
+
+  type CFieldType DuckDBAggregateFunction "unwrap" =
+    BG.Ptr DuckDBAggregateFunctionStruct
+
+  offset# = \_ -> \_ -> 0
+
+{-| An aggregate function set. Must be destroyed with duckdb_destroy_aggregate_function_set.
+
+    history:
+
+    * stable: v1.1.0
+
+    __C declaration:__ @struct _duckdb_aggregate_function_set@
+
+    __defined at:__ @duckdb.h 1227:16@
+
+    __exported by:__ @duckdb.h@
+-}
+data DuckDBAggregateFunctionSetStruct
+
+instance Marshal.StaticSize DuckDBAggregateFunctionSetStruct where
+
+  staticSizeOf = \_ -> (8 :: Int)
+
+  staticAlignment = \_ -> (8 :: Int)
+
+{-| An aggregate function set. Must be destroyed with duckdb_destroy_aggregate_function_set.
+
+    history:
+
+    * stable: v1.1.0
+
+    __C declaration:__ @duckdb_aggregate_function_set@
+
+    __defined at:__ @duckdb.h 1229:5@
+
+    __exported by:__ @duckdb.h@
+-}
+newtype DuckDBAggregateFunctionSet = DuckDBAggregateFunctionSet
+  { unwrap :: BG.Ptr DuckDBAggregateFunctionSetStruct
+  }
+  deriving stock (Eq, BG.Generic, Ord, Show)
+  deriving newtype
+    ( BG.HasFFIType
+    , Marshal.ReadRaw
+    , Marshal.StaticSize
+    , BG.Storable
+    , Marshal.WriteRaw
+    )
+
+instance ( ty ~ BG.Ptr DuckDBAggregateFunctionSetStruct
+         ) => BG.CompatHasField.HasField "unwrap" DuckDBAggregateFunctionSet ty where
+
+  hasField =
+    \x0 ->
+      (\y1 ->
+         DuckDBAggregateFunctionSet {unwrap = y1}, BG.getField @"unwrap" x0)
+
+instance ( ty ~ BG.Ptr DuckDBAggregateFunctionSetStruct
+         ) => BG.HasField "unwrap" (BG.Ptr DuckDBAggregateFunctionSet) (BG.Ptr ty) where
+
+  getField = HasCField.fromPtr (BG.Proxy @"unwrap")
+
+instance HasCField.HasCField DuckDBAggregateFunctionSet "unwrap" where
+
+  type CFieldType DuckDBAggregateFunctionSet "unwrap" =
+    BG.Ptr DuckDBAggregateFunctionSetStruct
+
+  offset# = \_ -> \_ -> 0
+
+{-| The state of an aggregate function.
+
+    history:
+
+    * stable: v1.1.0
+
+    __C declaration:__ @struct _duckdb_aggregate_state@
+
+    __defined at:__ @duckdb.h 1237:16@
+
+    __exported by:__ @duckdb.h@
+-}
+data DuckDBAggregateStateStruct
+
+instance Marshal.StaticSize DuckDBAggregateStateStruct where
+
+  staticSizeOf = \_ -> (8 :: Int)
+
+  staticAlignment = \_ -> (8 :: Int)
+
+{-| The state of an aggregate function.
+
+    history:
+
+    * stable: v1.1.0
+
+    __C declaration:__ @duckdb_aggregate_state@
+
+    __defined at:__ @duckdb.h 1239:5@
+
+    __exported by:__ @duckdb.h@
+-}
+newtype DuckDBAggregateState = DuckDBAggregateState
+  { unwrap :: BG.Ptr DuckDBAggregateStateStruct
+  }
+  deriving stock (Eq, BG.Generic, Ord, Show)
+  deriving newtype
+    ( BG.HasFFIType
+    , Marshal.ReadRaw
+    , Marshal.StaticSize
+    , BG.Storable
+    , Marshal.WriteRaw
+    )
+
+instance ( ty ~ BG.Ptr DuckDBAggregateStateStruct
+         ) => BG.CompatHasField.HasField "unwrap" DuckDBAggregateState ty where
+
+  hasField =
+    \x0 ->
+      (\y1 ->
+         DuckDBAggregateState {unwrap = y1}, BG.getField @"unwrap" x0)
+
+instance ( ty ~ BG.Ptr DuckDBAggregateStateStruct
+         ) => BG.HasField "unwrap" (BG.Ptr DuckDBAggregateState) (BG.Ptr ty) where
+
+  getField = HasCField.fromPtr (BG.Proxy @"unwrap")
+
+instance HasCField.HasCField DuckDBAggregateState "unwrap" where
+
+  type CFieldType DuckDBAggregateState "unwrap" =
+    BG.Ptr DuckDBAggregateStateStruct
+
+  offset# = \_ -> \_ -> 0
+
+{-| A table function. Must be destroyed with duckdb_destroy_table_function.
+
+    history:
+
+    * stable: v0.3.3
+
+    __C declaration:__ @struct _duckdb_table_function@
+
+    __defined at:__ @duckdb.h 1247:16@
+
+    __exported by:__ @duckdb.h@
+-}
+data DuckDBTableFunctionStruct
+
+instance Marshal.StaticSize DuckDBTableFunctionStruct where
+
+  staticSizeOf = \_ -> (8 :: Int)
+
+  staticAlignment = \_ -> (8 :: Int)
+
+{-| A table function. Must be destroyed with duckdb_destroy_table_function.
+
+    history:
+
+    * stable: v0.3.3
+
+    __C declaration:__ @duckdb_table_function@
+
+    __defined at:__ @duckdb.h 1249:5@
+
+    __exported by:__ @duckdb.h@
+-}
+newtype DuckDBTableFunction = DuckDBTableFunction
+  { unwrap :: BG.Ptr DuckDBTableFunctionStruct
+  }
+  deriving stock (Eq, BG.Generic, Ord, Show)
+  deriving newtype
+    ( BG.HasFFIType
+    , Marshal.ReadRaw
+    , Marshal.StaticSize
+    , BG.Storable
+    , Marshal.WriteRaw
+    )
+
+instance ( ty ~ BG.Ptr DuckDBTableFunctionStruct
+         ) => BG.CompatHasField.HasField "unwrap" DuckDBTableFunction ty where
+
+  hasField =
+    \x0 ->
+      (\y1 ->
+         DuckDBTableFunction {unwrap = y1}, BG.getField @"unwrap" x0)
+
+instance ( ty ~ BG.Ptr DuckDBTableFunctionStruct
+         ) => BG.HasField "unwrap" (BG.Ptr DuckDBTableFunction) (BG.Ptr ty) where
+
+  getField = HasCField.fromPtr (BG.Proxy @"unwrap")
+
+instance HasCField.HasCField DuckDBTableFunction "unwrap" where
+
+  type CFieldType DuckDBTableFunction "unwrap" =
+    BG.Ptr DuckDBTableFunctionStruct
+
+  offset# = \_ -> \_ -> 0
+
+{-| A cast function. Must be destroyed with duckdb_destroy_cast_function.
+
+    history:
+
+    * stable: v1.1.0
+
+    __C declaration:__ @struct _duckdb_cast_function@
+
+    __defined at:__ @duckdb.h 1257:16@
+
+    __exported by:__ @duckdb.h@
+-}
+data DuckDBCastFunctionStruct
+
+instance Marshal.StaticSize DuckDBCastFunctionStruct where
+
+  staticSizeOf = \_ -> (8 :: Int)
+
+  staticAlignment = \_ -> (8 :: Int)
+
+{-| A cast function. Must be destroyed with duckdb_destroy_cast_function.
+
+    history:
+
+    * stable: v1.1.0
+
+    __C declaration:__ @duckdb_cast_function@
+
+    __defined at:__ @duckdb.h 1259:5@
+
+    __exported by:__ @duckdb.h@
+-}
+newtype DuckDBCastFunction = DuckDBCastFunction
+  { unwrap :: BG.Ptr DuckDBCastFunctionStruct
+  }
+  deriving stock (Eq, BG.Generic, Ord, Show)
+  deriving newtype
+    ( BG.HasFFIType
+    , Marshal.ReadRaw
+    , Marshal.StaticSize
+    , BG.Storable
+    , Marshal.WriteRaw
+    )
+
+instance ( ty ~ BG.Ptr DuckDBCastFunctionStruct
+         ) => BG.CompatHasField.HasField "unwrap" DuckDBCastFunction ty where
+
+  hasField =
+    \x0 ->
+      (\y1 ->
+         DuckDBCastFunction {unwrap = y1}, BG.getField @"unwrap" x0)
+
+instance ( ty ~ BG.Ptr DuckDBCastFunctionStruct
+         ) => BG.HasField "unwrap" (BG.Ptr DuckDBCastFunction) (BG.Ptr ty) where
+
+  getField = HasCField.fromPtr (BG.Proxy @"unwrap")
+
+instance HasCField.HasCField DuckDBCastFunction "unwrap" where
+
+  type CFieldType DuckDBCastFunction "unwrap" =
+    BG.Ptr DuckDBCastFunctionStruct
+
+  offset# = \_ -> \_ -> 0
+
+{-| A COPY function. Must be destroyed with duckdb_destroy_copy_function.
+
+    history:
+
+    * unstable: v1.5.0
+
+    * stable: v1.5.6
+
+    __C declaration:__ @struct _duckdb_copy_function@
+
+    __defined at:__ @duckdb.h 1268:16@
+
+    __exported by:__ @duckdb.h@
+-}
+data DuckDBCopyFunctionStruct
+
+instance Marshal.StaticSize DuckDBCopyFunctionStruct where
+
+  staticSizeOf = \_ -> (8 :: Int)
+
+  staticAlignment = \_ -> (8 :: Int)
+
+{-| A COPY function. Must be destroyed with duckdb_destroy_copy_function.
+
+    history:
+
+    * unstable: v1.5.0
+
+    * stable: v1.5.6
+
+    __C declaration:__ @duckdb_copy_function@
+
+    __defined at:__ @duckdb.h 1270:5@
+
+    __exported by:__ @duckdb.h@
+-}
+newtype DuckDBCopyFunction = DuckDBCopyFunction
+  { unwrap :: BG.Ptr DuckDBCopyFunctionStruct
+  }
+  deriving stock (Eq, BG.Generic, Ord, Show)
+  deriving newtype
+    ( BG.HasFFIType
+    , Marshal.ReadRaw
+    , Marshal.StaticSize
+    , BG.Storable
+    , Marshal.WriteRaw
+    )
+
+instance ( ty ~ BG.Ptr DuckDBCopyFunctionStruct
+         ) => BG.CompatHasField.HasField "unwrap" DuckDBCopyFunction ty where
+
+  hasField =
+    \x0 ->
+      (\y1 ->
+         DuckDBCopyFunction {unwrap = y1}, BG.getField @"unwrap" x0)
+
+instance ( ty ~ BG.Ptr DuckDBCopyFunctionStruct
+         ) => BG.HasField "unwrap" (BG.Ptr DuckDBCopyFunction) (BG.Ptr ty) where
+
+  getField = HasCField.fromPtr (BG.Proxy @"unwrap")
+
+instance HasCField.HasCField DuckDBCopyFunction "unwrap" where
+
+  type CFieldType DuckDBCopyFunction "unwrap" =
+    BG.Ptr DuckDBCopyFunctionStruct
+
+  offset# = \_ -> \_ -> 0
+
+{-| Info for the bind function of a COPY function.
+
+    history:
+
+    * unstable: v1.5.0
+
+    * stable: v1.5.6
+
+    __C declaration:__ @struct _duckdb_copy_function_bind_info@
+
+    __defined at:__ @duckdb.h 1279:16@
+
+    __exported by:__ @duckdb.h@
+-}
+data DuckDBCopyFunctionBindInfoStruct
+
+instance Marshal.StaticSize DuckDBCopyFunctionBindInfoStruct where
+
+  staticSizeOf = \_ -> (8 :: Int)
+
+  staticAlignment = \_ -> (8 :: Int)
+
+{-| Info for the bind function of a COPY function.
+
+    history:
+
+    * unstable: v1.5.0
+
+    * stable: v1.5.6
+
+    __C declaration:__ @duckdb_copy_function_bind_info@
+
+    __defined at:__ @duckdb.h 1281:5@
+
+    __exported by:__ @duckdb.h@
+-}
+newtype DuckDBCopyFunctionBindInfo = DuckDBCopyFunctionBindInfo
+  { unwrap :: BG.Ptr DuckDBCopyFunctionBindInfoStruct
+  }
+  deriving stock (Eq, BG.Generic, Ord, Show)
+  deriving newtype
+    ( BG.HasFFIType
+    , Marshal.ReadRaw
+    , Marshal.StaticSize
+    , BG.Storable
+    , Marshal.WriteRaw
+    )
+
+instance ( ty ~ BG.Ptr DuckDBCopyFunctionBindInfoStruct
+         ) => BG.CompatHasField.HasField "unwrap" DuckDBCopyFunctionBindInfo ty where
+
+  hasField =
+    \x0 ->
+      (\y1 ->
+         DuckDBCopyFunctionBindInfo {unwrap = y1}, BG.getField @"unwrap" x0)
+
+instance ( ty ~ BG.Ptr DuckDBCopyFunctionBindInfoStruct
+         ) => BG.HasField "unwrap" (BG.Ptr DuckDBCopyFunctionBindInfo) (BG.Ptr ty) where
+
+  getField = HasCField.fromPtr (BG.Proxy @"unwrap")
+
+instance HasCField.HasCField DuckDBCopyFunctionBindInfo "unwrap" where
+
+  type CFieldType DuckDBCopyFunctionBindInfo "unwrap" =
+    BG.Ptr DuckDBCopyFunctionBindInfoStruct
+
+  offset# = \_ -> \_ -> 0
+
+{-| Info for the global initialization function of a COPY function.
+
+    history:
+
+    * unstable: v1.5.0
+
+    * stable: v1.5.6
+
+    __C declaration:__ @struct _duckdb_copy_function_global_init_info@
+
+    __defined at:__ @duckdb.h 1290:16@
+
+    __exported by:__ @duckdb.h@
+-}
+data DuckDBCopyFunctionGlobalInitInfoStruct
+
+instance Marshal.StaticSize DuckDBCopyFunctionGlobalInitInfoStruct where
+
+  staticSizeOf = \_ -> (8 :: Int)
+
+  staticAlignment = \_ -> (8 :: Int)
+
+{-| Info for the global initialization function of a COPY function.
+
+    history:
+
+    * unstable: v1.5.0
+
+    * stable: v1.5.6
+
+    __C declaration:__ @duckdb_copy_function_global_init_info@
+
+    __defined at:__ @duckdb.h 1292:5@
+
+    __exported by:__ @duckdb.h@
+-}
+newtype DuckDBCopyFunctionGlobalInitInfo = DuckDBCopyFunctionGlobalInitInfo
+  { unwrap :: BG.Ptr DuckDBCopyFunctionGlobalInitInfoStruct
+  }
+  deriving stock (Eq, BG.Generic, Ord, Show)
+  deriving newtype
+    ( BG.HasFFIType
+    , Marshal.ReadRaw
+    , Marshal.StaticSize
+    , BG.Storable
+    , Marshal.WriteRaw
+    )
+
+instance ( ty ~ BG.Ptr DuckDBCopyFunctionGlobalInitInfoStruct
+         ) => BG.CompatHasField.HasField "unwrap" DuckDBCopyFunctionGlobalInitInfo ty where
+
+  hasField =
+    \x0 ->
+      ( \y1 ->
+          DuckDBCopyFunctionGlobalInitInfo {unwrap = y1}
+      , BG.getField @"unwrap" x0
+      )
+
+instance ( ty ~ BG.Ptr DuckDBCopyFunctionGlobalInitInfoStruct
+         ) => BG.HasField "unwrap" (BG.Ptr DuckDBCopyFunctionGlobalInitInfo) (BG.Ptr ty) where
+
+  getField = HasCField.fromPtr (BG.Proxy @"unwrap")
+
+instance HasCField.HasCField DuckDBCopyFunctionGlobalInitInfo "unwrap" where
+
+  type CFieldType DuckDBCopyFunctionGlobalInitInfo "unwrap" =
+    BG.Ptr DuckDBCopyFunctionGlobalInitInfoStruct
+
+  offset# = \_ -> \_ -> 0
+
+{-| Info for the sink function of a COPY function.
+
+    history:
+
+    * unstable: v1.5.0
+
+    * stable: v1.5.6
+
+    __C declaration:__ @struct _duckdb_copy_function_sink_info@
+
+    __defined at:__ @duckdb.h 1301:16@
+
+    __exported by:__ @duckdb.h@
+-}
+data DuckDBCopyFunctionSinkInfoStruct
+
+instance Marshal.StaticSize DuckDBCopyFunctionSinkInfoStruct where
+
+  staticSizeOf = \_ -> (8 :: Int)
+
+  staticAlignment = \_ -> (8 :: Int)
+
+{-| Info for the sink function of a COPY function.
+
+    history:
+
+    * unstable: v1.5.0
+
+    * stable: v1.5.6
+
+    __C declaration:__ @duckdb_copy_function_sink_info@
+
+    __defined at:__ @duckdb.h 1303:5@
+
+    __exported by:__ @duckdb.h@
+-}
+newtype DuckDBCopyFunctionSinkInfo = DuckDBCopyFunctionSinkInfo
+  { unwrap :: BG.Ptr DuckDBCopyFunctionSinkInfoStruct
+  }
+  deriving stock (Eq, BG.Generic, Ord, Show)
+  deriving newtype
+    ( BG.HasFFIType
+    , Marshal.ReadRaw
+    , Marshal.StaticSize
+    , BG.Storable
+    , Marshal.WriteRaw
+    )
+
+instance ( ty ~ BG.Ptr DuckDBCopyFunctionSinkInfoStruct
+         ) => BG.CompatHasField.HasField "unwrap" DuckDBCopyFunctionSinkInfo ty where
+
+  hasField =
+    \x0 ->
+      (\y1 ->
+         DuckDBCopyFunctionSinkInfo {unwrap = y1}, BG.getField @"unwrap" x0)
+
+instance ( ty ~ BG.Ptr DuckDBCopyFunctionSinkInfoStruct
+         ) => BG.HasField "unwrap" (BG.Ptr DuckDBCopyFunctionSinkInfo) (BG.Ptr ty) where
+
+  getField = HasCField.fromPtr (BG.Proxy @"unwrap")
+
+instance HasCField.HasCField DuckDBCopyFunctionSinkInfo "unwrap" where
+
+  type CFieldType DuckDBCopyFunctionSinkInfo "unwrap" =
+    BG.Ptr DuckDBCopyFunctionSinkInfoStruct
+
+  offset# = \_ -> \_ -> 0
+
+{-| Info for the finalize function of a COPY function.
+
+    history:
+
+    * unstable: v1.5.0
+
+    * stable: v1.5.6
+
+    __C declaration:__ @struct _duckdb_copy_function_finalize_info@
+
+    __defined at:__ @duckdb.h 1312:16@
+
+    __exported by:__ @duckdb.h@
+-}
+data DuckDBCopyFunctionFinalizeInfoStruct
+
+instance Marshal.StaticSize DuckDBCopyFunctionFinalizeInfoStruct where
+
+  staticSizeOf = \_ -> (8 :: Int)
+
+  staticAlignment = \_ -> (8 :: Int)
+
+{-| Info for the finalize function of a COPY function.
+
+    history:
+
+    * unstable: v1.5.0
+
+    * stable: v1.5.6
+
+    __C declaration:__ @duckdb_copy_function_finalize_info@
+
+    __defined at:__ @duckdb.h 1314:5@
+
+    __exported by:__ @duckdb.h@
+-}
+newtype DuckDBCopyFunctionFinalizeInfo = DuckDBCopyFunctionFinalizeInfo
+  { unwrap :: BG.Ptr DuckDBCopyFunctionFinalizeInfoStruct
+  }
+  deriving stock (Eq, BG.Generic, Ord, Show)
+  deriving newtype
+    ( BG.HasFFIType
+    , Marshal.ReadRaw
+    , Marshal.StaticSize
+    , BG.Storable
+    , Marshal.WriteRaw
+    )
+
+instance ( ty ~ BG.Ptr DuckDBCopyFunctionFinalizeInfoStruct
+         ) => BG.CompatHasField.HasField "unwrap" DuckDBCopyFunctionFinalizeInfo ty where
+
+  hasField =
+    \x0 ->
+      ( \y1 -> DuckDBCopyFunctionFinalizeInfo {unwrap = y1}
+      , BG.getField @"unwrap" x0
+      )
+
+instance ( ty ~ BG.Ptr DuckDBCopyFunctionFinalizeInfoStruct
+         ) => BG.HasField "unwrap" (BG.Ptr DuckDBCopyFunctionFinalizeInfo) (BG.Ptr ty) where
+
+  getField = HasCField.fromPtr (BG.Proxy @"unwrap")
+
+instance HasCField.HasCField DuckDBCopyFunctionFinalizeInfo "unwrap" where
+
+  type CFieldType DuckDBCopyFunctionFinalizeInfo "unwrap" =
+    BG.Ptr DuckDBCopyFunctionFinalizeInfoStruct
+
+  offset# = \_ -> \_ -> 0
+
+{-| Info passed to a replacement scan callback.
+
+    history:
+
+    * stable: v0.3.3
+
+    __C declaration:__ @struct _duckdb_replacement_scan_info@
+
+    __defined at:__ @duckdb.h 1322:16@
+
+    __exported by:__ @duckdb.h@
+-}
+data DuckDBReplacementScanInfoStruct
+
+instance Marshal.StaticSize DuckDBReplacementScanInfoStruct where
+
+  staticSizeOf = \_ -> (8 :: Int)
+
+  staticAlignment = \_ -> (8 :: Int)
+
+{-| Info passed to a replacement scan callback.
+
+    history:
+
+    * stable: v0.3.3
+
+    __C declaration:__ @duckdb_replacement_scan_info@
+
+    __defined at:__ @duckdb.h 1324:5@
+
+    __exported by:__ @duckdb.h@
+-}
+newtype DuckDBReplacementScanInfo = DuckDBReplacementScanInfo
+  { unwrap :: BG.Ptr DuckDBReplacementScanInfoStruct
+  }
+  deriving stock (Eq, BG.Generic, Ord, Show)
+  deriving newtype
+    ( BG.HasFFIType
+    , Marshal.ReadRaw
+    , Marshal.StaticSize
+    , BG.Storable
+    , Marshal.WriteRaw
+    )
+
+instance ( ty ~ BG.Ptr DuckDBReplacementScanInfoStruct
+         ) => BG.CompatHasField.HasField "unwrap" DuckDBReplacementScanInfo ty where
+
+  hasField =
+    \x0 ->
+      (\y1 ->
+         DuckDBReplacementScanInfo {unwrap = y1}, BG.getField @"unwrap" x0)
+
+instance ( ty ~ BG.Ptr DuckDBReplacementScanInfoStruct
+         ) => BG.HasField "unwrap" (BG.Ptr DuckDBReplacementScanInfo) (BG.Ptr ty) where
+
+  getField = HasCField.fromPtr (BG.Proxy @"unwrap")
+
+instance HasCField.HasCField DuckDBReplacementScanInfo "unwrap" where
+
+  type CFieldType DuckDBReplacementScanInfo "unwrap" =
+    BG.Ptr DuckDBReplacementScanInfoStruct
+
+  offset# = \_ -> \_ -> 0
+
+{-| A log storage instance. Must be destroyed with duckdb_destroy_log_storage.
+
+    history:
+
+    * unstable: v1.5.0
+
+    * stable: v1.5.6
+
+    __C declaration:__ @struct _duckdb_log_storage@
+
+    __defined at:__ @duckdb.h 1333:16@
+
+    __exported by:__ @duckdb.h@
+-}
+data DuckDBLogStorageStruct
+
+instance Marshal.StaticSize DuckDBLogStorageStruct where
+
+  staticSizeOf = \_ -> (8 :: Int)
+
+  staticAlignment = \_ -> (8 :: Int)
+
+{-| A log storage instance. Must be destroyed with duckdb_destroy_log_storage.
+
+    history:
+
+    * unstable: v1.5.0
+
+    * stable: v1.5.6
+
+    __C declaration:__ @duckdb_log_storage@
+
+    __defined at:__ @duckdb.h 1335:5@
+
+    __exported by:__ @duckdb.h@
+-}
+newtype DuckDBLogStorage = DuckDBLogStorage
+  { unwrap :: BG.Ptr DuckDBLogStorageStruct
+  }
+  deriving stock (Eq, BG.Generic, Ord, Show)
+  deriving newtype
+    ( BG.HasFFIType
+    , Marshal.ReadRaw
+    , Marshal.StaticSize
+    , BG.Storable
+    , Marshal.WriteRaw
+    )
+
+instance ( ty ~ BG.Ptr DuckDBLogStorageStruct
+         ) => BG.CompatHasField.HasField "unwrap" DuckDBLogStorage ty where
+
+  hasField =
+    \x0 ->
+      (\y1 ->
+         DuckDBLogStorage {unwrap = y1}, BG.getField @"unwrap" x0)
+
+instance ( ty ~ BG.Ptr DuckDBLogStorageStruct
+         ) => BG.HasField "unwrap" (BG.Ptr DuckDBLogStorage) (BG.Ptr ty) where
+
+  getField = HasCField.fromPtr (BG.Proxy @"unwrap")
+
+instance HasCField.HasCField DuckDBLogStorage "unwrap" where
+
+  type CFieldType DuckDBLogStorage "unwrap" =
+    BG.Ptr DuckDBLogStorageStruct
+
+  offset# = \_ -> \_ -> 0
+
+{-| Additional function info.
+
+    history:
+
+    * stable: v0.3.3
+
+    __C declaration:__ @struct _duckdb_function_info@
+
+    __defined at:__ @duckdb.h 1343:16@
+
+    __exported by:__ @duckdb.h@
+-}
+data DuckDBFunctionInfoStruct
+
+instance Marshal.StaticSize DuckDBFunctionInfoStruct where
+
+  staticSizeOf = \_ -> (8 :: Int)
+
+  staticAlignment = \_ -> (8 :: Int)
+
+{-| Additional function info.
+
+    history:
+
+    * stable: v0.3.3
+
+    __C declaration:__ @duckdb_function_info@
+
+    __defined at:__ @duckdb.h 1345:5@
+
+    __exported by:__ @duckdb.h@
+-}
+newtype DuckDBFunctionInfo = DuckDBFunctionInfo
+  { unwrap :: BG.Ptr DuckDBFunctionInfoStruct
+  }
+  deriving stock (Eq, BG.Generic, Ord, Show)
+  deriving newtype
+    ( BG.HasFFIType
+    , Marshal.ReadRaw
+    , Marshal.StaticSize
+    , BG.Storable
+    , Marshal.WriteRaw
+    )
+
+instance ( ty ~ BG.Ptr DuckDBFunctionInfoStruct
+         ) => BG.CompatHasField.HasField "unwrap" DuckDBFunctionInfo ty where
+
+  hasField =
+    \x0 ->
+      (\y1 ->
+         DuckDBFunctionInfo {unwrap = y1}, BG.getField @"unwrap" x0)
+
+instance ( ty ~ BG.Ptr DuckDBFunctionInfoStruct
+         ) => BG.HasField "unwrap" (BG.Ptr DuckDBFunctionInfo) (BG.Ptr ty) where
+
+  getField = HasCField.fromPtr (BG.Proxy @"unwrap")
+
+instance HasCField.HasCField DuckDBFunctionInfo "unwrap" where
+
+  type CFieldType DuckDBFunctionInfo "unwrap" =
+    BG.Ptr DuckDBFunctionInfoStruct
+
+  offset# = \_ -> \_ -> 0
+
+{-| The bind info of a function.
+
+    history:
+
+    * stable: v0.3.3
+
+    __C declaration:__ @struct _duckdb_bind_info@
+
+    __defined at:__ @duckdb.h 1353:16@
+
+    __exported by:__ @duckdb.h@
+-}
+data DuckDBBindInfoStruct
+
+instance Marshal.StaticSize DuckDBBindInfoStruct where
+
+  staticSizeOf = \_ -> (8 :: Int)
+
+  staticAlignment = \_ -> (8 :: Int)
+
+{-| The bind info of a function.
+
+    history:
+
+    * stable: v0.3.3
+
+    __C declaration:__ @duckdb_bind_info@
+
+    __defined at:__ @duckdb.h 1355:5@
+
+    __exported by:__ @duckdb.h@
+-}
+newtype DuckDBBindInfo = DuckDBBindInfo
+  { unwrap :: BG.Ptr DuckDBBindInfoStruct
+  }
+  deriving stock (Eq, BG.Generic, Ord, Show)
+  deriving newtype
+    ( BG.HasFFIType
+    , Marshal.ReadRaw
+    , Marshal.StaticSize
+    , BG.Storable
+    , Marshal.WriteRaw
+    )
+
+instance ( ty ~ BG.Ptr DuckDBBindInfoStruct
+         ) => BG.CompatHasField.HasField "unwrap" DuckDBBindInfo ty where
+
+  hasField =
+    \x0 ->
+      (\y1 ->
+         DuckDBBindInfo {unwrap = y1}, BG.getField @"unwrap" x0)
+
+instance ( ty ~ BG.Ptr DuckDBBindInfoStruct
+         ) => BG.HasField "unwrap" (BG.Ptr DuckDBBindInfo) (BG.Ptr ty) where
+
+  getField = HasCField.fromPtr (BG.Proxy @"unwrap")
+
+instance HasCField.HasCField DuckDBBindInfo "unwrap" where
+
+  type CFieldType DuckDBBindInfo "unwrap" =
+    BG.Ptr DuckDBBindInfoStruct
+
+  offset# = \_ -> \_ -> 0
+
+{-| Additional function initialization info.
+
+    history:
+
+    * stable: v0.3.3
+
+    __C declaration:__ @struct _duckdb_init_info@
+
+    __defined at:__ @duckdb.h 1363:16@
+
+    __exported by:__ @duckdb.h@
+-}
+data DuckDBInitInfoStruct
+
+instance Marshal.StaticSize DuckDBInitInfoStruct where
+
+  staticSizeOf = \_ -> (8 :: Int)
+
+  staticAlignment = \_ -> (8 :: Int)
+
+{-| Additional function initialization info.
+
+    history:
+
+    * stable: v0.3.3
+
+    __C declaration:__ @duckdb_init_info@
+
+    __defined at:__ @duckdb.h 1365:5@
+
+    __exported by:__ @duckdb.h@
+-}
+newtype DuckDBInitInfo = DuckDBInitInfo
+  { unwrap :: BG.Ptr DuckDBInitInfoStruct
+  }
+  deriving stock (Eq, BG.Generic, Ord, Show)
+  deriving newtype
+    ( BG.HasFFIType
+    , Marshal.ReadRaw
+    , Marshal.StaticSize
+    , BG.Storable
+    , Marshal.WriteRaw
+    )
+
+instance ( ty ~ BG.Ptr DuckDBInitInfoStruct
+         ) => BG.CompatHasField.HasField "unwrap" DuckDBInitInfo ty where
+
+  hasField =
+    \x0 ->
+      (\y1 ->
+         DuckDBInitInfo {unwrap = y1}, BG.getField @"unwrap" x0)
+
+instance ( ty ~ BG.Ptr DuckDBInitInfoStruct
+         ) => BG.HasField "unwrap" (BG.Ptr DuckDBInitInfo) (BG.Ptr ty) where
+
+  getField = HasCField.fromPtr (BG.Proxy @"unwrap")
+
+instance HasCField.HasCField DuckDBInitInfo "unwrap" where
+
+  type CFieldType DuckDBInitInfo "unwrap" =
+    BG.Ptr DuckDBInitInfoStruct
+
+  offset# = \_ -> \_ -> 0
+
+{-| Holds the state of the C API extension initialization process.
+
+    history:
+
+    * stable: v1.1.0
+
+    __C declaration:__ @struct _duckdb_extension_info@
+
+    __defined at:__ @duckdb.h 1373:16@
+
+    __exported by:__ @duckdb.h@
+-}
+data DuckDBExtensionInfoStruct
+
+instance Marshal.StaticSize DuckDBExtensionInfoStruct where
+
+  staticSizeOf = \_ -> (8 :: Int)
+
+  staticAlignment = \_ -> (8 :: Int)
+
+{-| Holds the state of the C API extension initialization process.
+
+    history:
+
+    * stable: v1.1.0
+
+    __C declaration:__ @duckdb_extension_info@
+
+    __defined at:__ @duckdb.h 1375:5@
+
+    __exported by:__ @duckdb.h@
+-}
+newtype DuckDBExtensionInfo = DuckDBExtensionInfo
+  { unwrap :: BG.Ptr DuckDBExtensionInfoStruct
+  }
+  deriving stock (Eq, BG.Generic, Ord, Show)
+  deriving newtype
+    ( BG.HasFFIType
+    , Marshal.ReadRaw
+    , Marshal.StaticSize
+    , BG.Storable
+    , Marshal.WriteRaw
+    )
+
+instance ( ty ~ BG.Ptr DuckDBExtensionInfoStruct
+         ) => BG.CompatHasField.HasField "unwrap" DuckDBExtensionInfo ty where
+
+  hasField =
+    \x0 ->
+      (\y1 ->
+         DuckDBExtensionInfo {unwrap = y1}, BG.getField @"unwrap" x0)
+
+instance ( ty ~ BG.Ptr DuckDBExtensionInfoStruct
+         ) => BG.HasField "unwrap" (BG.Ptr DuckDBExtensionInfo) (BG.Ptr ty) where
+
+  getField = HasCField.fromPtr (BG.Proxy @"unwrap")
+
+instance HasCField.HasCField DuckDBExtensionInfo "unwrap" where
+
+  type CFieldType DuckDBExtensionInfo "unwrap" =
+    BG.Ptr DuckDBExtensionInfoStruct
+
+  offset# = \_ -> \_ -> 0
+
+{-| __C declaration:__ @sel_t@
+
+    __defined at:__ @duckdb.h 1386:18@
+
+    __exported by:__ @duckdb.h@
+-}
+newtype DuckDBSel = DuckDBSel
+  { unwrap :: HsBindgen.Runtime.LibC.Word32
+  }
+  deriving stock (Eq, BG.Generic, Ord, Read, Show)
+  deriving newtype
+    ( BG.Bitfield
+    , BG.Bits
+    , Bounded
+    , Enum
+    , BG.FiniteBits
+    , BG.HasFFIType
+    , Integral
+    , BG.Ix
+    , Num
+    , BG.Prim
+    , Marshal.ReadRaw
+    , Real
+    , Marshal.StaticSize
+    , BG.Storable
+    , Marshal.WriteRaw
+    )
+
+instance ( ty ~ HsBindgen.Runtime.LibC.Word32
+         ) => BG.CompatHasField.HasField "unwrap" DuckDBSel ty where
+
+  hasField =
+    \x0 ->
+      (\y1 ->
+         DuckDBSel {unwrap = y1}, BG.getField @"unwrap" x0)
+
+instance ( ty ~ HsBindgen.Runtime.LibC.Word32
+         ) => BG.HasField "unwrap" (BG.Ptr DuckDBSel) (BG.Ptr ty) where
+
+  getField = HasCField.fromPtr (BG.Proxy @"unwrap")
+
+instance HasCField.HasCField DuckDBSel "unwrap" where
+
+  type CFieldType DuckDBSel "unwrap" =
+    HsBindgen.Runtime.LibC.Word32
+
+  offset# = \_ -> \_ -> 0
+
+{-| Auxiliary type used by t'DuckDBDeleteCallback'
+
+    __C declaration:__ @duckdb_delete_callback_t@
+
+    __defined at:__ @duckdb.h 1399:16@
+
+    __exported by:__ @duckdb.h@
+-}
+newtype DuckDBDeleteCallback_Aux = DuckDBDeleteCallback_Aux
+  { unwrap :: BG.Ptr BG.Void -> IO ()
+  }
+  deriving stock (BG.Generic)
+
+-- __unique:__ @toDuckDBDeleteCallback_Aux@
+foreign import ccall safe "wrapper" hs_bindgen_088c55413de95db1_base ::
+     (BG.Ptr BG.Void -> IO ())
+  -> IO (BG.FunPtr (BG.Ptr BG.Void -> IO ()))
+
+-- __unique:__ @toDuckDBDeleteCallback_Aux@
+hs_bindgen_088c55413de95db1 ::
+     DuckDBDeleteCallback_Aux
+  -> IO (BG.FunPtr DuckDBDeleteCallback_Aux)
+hs_bindgen_088c55413de95db1 =
+  \fun0 ->
+    fmap BG.castFunPtr (hs_bindgen_088c55413de95db1_base (\x1 ->
+                                                            BG.getField @"unwrap" fun0 (BG.fromFFIType x1)))
+
+-- __unique:__ @fromDuckDBDeleteCallback_Aux@
+foreign import ccall safe "dynamic" hs_bindgen_bc8843f2f2a2a638_base ::
+     BG.FunPtr (BG.Ptr BG.Void -> IO ())
+  -> BG.Ptr BG.Void -> IO ()
+
+-- __unique:__ @fromDuckDBDeleteCallback_Aux@
+hs_bindgen_bc8843f2f2a2a638 ::
+     BG.FunPtr DuckDBDeleteCallback_Aux
+  -> DuckDBDeleteCallback_Aux
+hs_bindgen_bc8843f2f2a2a638 =
+  \funPtr0 ->
+    DuckDBDeleteCallback_Aux (\x1 ->
+                                hs_bindgen_bc8843f2f2a2a638_base (BG.castFunPtr funPtr0) (BG.toFFIType x1))
+
+instance BG.ToFunPtr DuckDBDeleteCallback_Aux where
+
+  toFunPtr = hs_bindgen_088c55413de95db1
+
+instance BG.FromFunPtr DuckDBDeleteCallback_Aux where
+
+  fromFunPtr = hs_bindgen_bc8843f2f2a2a638
+
+instance ( ty ~ (BG.Ptr BG.Void -> IO ())
+         ) => BG.CompatHasField.HasField "unwrap" DuckDBDeleteCallback_Aux ty where
+
+  hasField =
+    \x0 ->
+      (\y1 ->
+         DuckDBDeleteCallback_Aux {unwrap = y1}, BG.getField @"unwrap" x0)
+
+instance ( ty ~ (BG.Ptr BG.Void -> IO ())
+         ) => BG.HasField "unwrap" (BG.Ptr DuckDBDeleteCallback_Aux) (BG.Ptr ty) where
+
+  getField = HasCField.fromPtr (BG.Proxy @"unwrap")
+
+instance HasCField.HasCField DuckDBDeleteCallback_Aux "unwrap" where
+
+  type CFieldType DuckDBDeleteCallback_Aux "unwrap" =
+    BG.Ptr BG.Void -> IO ()
+
+  offset# = \_ -> \_ -> 0
+
+{-| The callback to destroy data.
+
+    history:
+
+    * stable: v0.3.3
+
+    __C declaration:__ @duckdb_delete_callback_t@
+
+    __defined at:__ @duckdb.h 1399:16@
+
+    __exported by:__ @duckdb.h@
+-}
+newtype DuckDBDeleteCallback = DuckDBDeleteCallback
+  { unwrap :: BG.FunPtr DuckDBDeleteCallback_Aux
+  }
+  deriving stock (Eq, BG.Generic, Ord, Show)
+  deriving newtype
+    ( BG.HasFFIType
+    , Marshal.ReadRaw
+    , Marshal.StaticSize
+    , BG.Storable
+    , Marshal.WriteRaw
+    )
+
+instance ( ty ~ BG.FunPtr DuckDBDeleteCallback_Aux
+         ) => BG.CompatHasField.HasField "unwrap" DuckDBDeleteCallback ty where
+
+  hasField =
+    \x0 ->
+      (\y1 ->
+         DuckDBDeleteCallback {unwrap = y1}, BG.getField @"unwrap" x0)
+
+instance ( ty ~ BG.FunPtr DuckDBDeleteCallback_Aux
+         ) => BG.HasField "unwrap" (BG.Ptr DuckDBDeleteCallback) (BG.Ptr ty) where
+
+  getField = HasCField.fromPtr (BG.Proxy @"unwrap")
+
+instance HasCField.HasCField DuckDBDeleteCallback "unwrap" where
+
+  type CFieldType DuckDBDeleteCallback "unwrap" =
+    BG.FunPtr DuckDBDeleteCallback_Aux
+
+  offset# = \_ -> \_ -> 0
+
+{-| Auxiliary type used by t'DuckDBCopyCallback'
+
+    __C declaration:__ @duckdb_copy_callback_t@
+
+    __defined at:__ @duckdb.h 1408:17@
+
+    __exported by:__ @duckdb.h@
+-}
+newtype DuckDBCopyCallback_Aux = DuckDBCopyCallback_Aux
+  { unwrap :: BG.Ptr BG.Void -> IO (BG.Ptr BG.Void)
+  }
+  deriving stock (BG.Generic)
+
+-- __unique:__ @toDuckDBCopyCallback_Aux@
+foreign import ccall safe "wrapper" hs_bindgen_edeef2eec728e6e2_base ::
+     (BG.Ptr BG.Void -> IO (BG.Ptr BG.Void))
+  -> IO (BG.FunPtr (BG.Ptr BG.Void -> IO (BG.Ptr BG.Void)))
+
+-- __unique:__ @toDuckDBCopyCallback_Aux@
+hs_bindgen_edeef2eec728e6e2 ::
+     DuckDBCopyCallback_Aux
+  -> IO (BG.FunPtr DuckDBCopyCallback_Aux)
+hs_bindgen_edeef2eec728e6e2 =
+  \fun0 ->
+    fmap BG.castFunPtr (hs_bindgen_edeef2eec728e6e2_base (\x1 ->
+                                                            fmap BG.toFFIType (BG.getField @"unwrap" fun0 (BG.fromFFIType x1))))
+
+-- __unique:__ @fromDuckDBCopyCallback_Aux@
+foreign import ccall safe "dynamic" hs_bindgen_05b2b99ed7267c75_base ::
+     BG.FunPtr (BG.Ptr BG.Void -> IO (BG.Ptr BG.Void))
+  -> BG.Ptr BG.Void -> IO (BG.Ptr BG.Void)
+
+-- __unique:__ @fromDuckDBCopyCallback_Aux@
+hs_bindgen_05b2b99ed7267c75 ::
+     BG.FunPtr DuckDBCopyCallback_Aux
+  -> DuckDBCopyCallback_Aux
+hs_bindgen_05b2b99ed7267c75 =
+  \funPtr0 ->
+    DuckDBCopyCallback_Aux (\x1 ->
+                              fmap BG.fromFFIType (hs_bindgen_05b2b99ed7267c75_base (BG.castFunPtr funPtr0) (BG.toFFIType x1)))
+
+instance BG.ToFunPtr DuckDBCopyCallback_Aux where
+
+  toFunPtr = hs_bindgen_edeef2eec728e6e2
+
+instance BG.FromFunPtr DuckDBCopyCallback_Aux where
+
+  fromFunPtr = hs_bindgen_05b2b99ed7267c75
+
+instance ( ty ~ (BG.Ptr BG.Void -> IO (BG.Ptr BG.Void))
+         ) => BG.CompatHasField.HasField "unwrap" DuckDBCopyCallback_Aux ty where
+
+  hasField =
+    \x0 ->
+      (\y1 ->
+         DuckDBCopyCallback_Aux {unwrap = y1}, BG.getField @"unwrap" x0)
+
+instance ( ty ~ (BG.Ptr BG.Void -> IO (BG.Ptr BG.Void))
+         ) => BG.HasField "unwrap" (BG.Ptr DuckDBCopyCallback_Aux) (BG.Ptr ty) where
+
+  getField = HasCField.fromPtr (BG.Proxy @"unwrap")
+
+instance HasCField.HasCField DuckDBCopyCallback_Aux "unwrap" where
+
+  type CFieldType DuckDBCopyCallback_Aux "unwrap" =
+    BG.Ptr BG.Void -> IO (BG.Ptr BG.Void)
+
+  offset# = \_ -> \_ -> 0
+
+{-| The callback to copy data.
+
+    history:
+
+    * unstable: v1.4.0
+
+    * stable: v1.5.6
+
+    __C declaration:__ @duckdb_copy_callback_t@
+
+    __defined at:__ @duckdb.h 1408:17@
+
+    __exported by:__ @duckdb.h@
+-}
+newtype DuckDBCopyCallback = DuckDBCopyCallback
+  { unwrap :: BG.FunPtr DuckDBCopyCallback_Aux
+  }
+  deriving stock (Eq, BG.Generic, Ord, Show)
+  deriving newtype
+    ( BG.HasFFIType
+    , Marshal.ReadRaw
+    , Marshal.StaticSize
+    , BG.Storable
+    , Marshal.WriteRaw
+    )
+
+instance ( ty ~ BG.FunPtr DuckDBCopyCallback_Aux
+         ) => BG.CompatHasField.HasField "unwrap" DuckDBCopyCallback ty where
+
+  hasField =
+    \x0 ->
+      (\y1 ->
+         DuckDBCopyCallback {unwrap = y1}, BG.getField @"unwrap" x0)
+
+instance ( ty ~ BG.FunPtr DuckDBCopyCallback_Aux
+         ) => BG.HasField "unwrap" (BG.Ptr DuckDBCopyCallback) (BG.Ptr ty) where
+
+  getField = HasCField.fromPtr (BG.Proxy @"unwrap")
+
+instance HasCField.HasCField DuckDBCopyCallback "unwrap" where
+
+  type CFieldType DuckDBCopyCallback "unwrap" =
+    BG.FunPtr DuckDBCopyCallback_Aux
+
+  offset# = \_ -> \_ -> 0
+
+{-| Auxiliary type used by t'DuckDBTableFunctionBindFun'
+
+    __C declaration:__ @duckdb_table_function_bind_t@
+
+    __defined at:__ @duckdb.h 1416:16@
+
+    __exported by:__ @duckdb.h@
+-}
+newtype DuckDBTableFunctionBindFun_Aux = DuckDBTableFunctionBindFun_Aux
+  { unwrap :: DuckDBBindInfo -> IO ()
+  }
+  deriving stock (BG.Generic)
+
+-- __unique:__ @toDuckDBTableFunctionBindFun_Aux@
+foreign import ccall safe "wrapper" hs_bindgen_b9cffd5e02c3fac5_base ::
+     (BG.Ptr BG.Void -> IO ())
+  -> IO (BG.FunPtr (BG.Ptr BG.Void -> IO ()))
+
+-- __unique:__ @toDuckDBTableFunctionBindFun_Aux@
+hs_bindgen_b9cffd5e02c3fac5 ::
+     DuckDBTableFunctionBindFun_Aux
+  -> IO (BG.FunPtr DuckDBTableFunctionBindFun_Aux)
+hs_bindgen_b9cffd5e02c3fac5 =
+  \fun0 ->
+    fmap BG.castFunPtr (hs_bindgen_b9cffd5e02c3fac5_base (\x1 ->
+                                                            BG.getField @"unwrap" fun0 (BG.fromFFIType x1)))
+
+-- __unique:__ @fromDuckDBTableFunctionBindFun_Aux@
+foreign import ccall safe "dynamic" hs_bindgen_798fc7d822fb3036_base ::
+     BG.FunPtr (BG.Ptr BG.Void -> IO ())
+  -> BG.Ptr BG.Void -> IO ()
+
+-- __unique:__ @fromDuckDBTableFunctionBindFun_Aux@
+hs_bindgen_798fc7d822fb3036 ::
+     BG.FunPtr DuckDBTableFunctionBindFun_Aux
+  -> DuckDBTableFunctionBindFun_Aux
+hs_bindgen_798fc7d822fb3036 =
+  \funPtr0 ->
+    DuckDBTableFunctionBindFun_Aux (\x1 ->
+                                      hs_bindgen_798fc7d822fb3036_base (BG.castFunPtr funPtr0) (BG.toFFIType x1))
+
+instance BG.ToFunPtr DuckDBTableFunctionBindFun_Aux where
+
+  toFunPtr = hs_bindgen_b9cffd5e02c3fac5
+
+instance BG.FromFunPtr DuckDBTableFunctionBindFun_Aux where
+
+  fromFunPtr = hs_bindgen_798fc7d822fb3036
+
+instance ( ty ~ (DuckDBBindInfo -> IO ())
+         ) => BG.CompatHasField.HasField "unwrap" DuckDBTableFunctionBindFun_Aux ty where
+
+  hasField =
+    \x0 ->
+      ( \y1 -> DuckDBTableFunctionBindFun_Aux {unwrap = y1}
+      , BG.getField @"unwrap" x0
+      )
+
+instance ( ty ~ (DuckDBBindInfo -> IO ())
+         ) => BG.HasField "unwrap" (BG.Ptr DuckDBTableFunctionBindFun_Aux) (BG.Ptr ty) where
+
+  getField = HasCField.fromPtr (BG.Proxy @"unwrap")
+
+instance HasCField.HasCField DuckDBTableFunctionBindFun_Aux "unwrap" where
+
+  type CFieldType DuckDBTableFunctionBindFun_Aux "unwrap" =
+    DuckDBBindInfo -> IO ()
+
+  offset# = \_ -> \_ -> 0
+
+{-| The bind function of a table function.
+
+    history:
+
+    * stable: v0.3.3
+
+    __C declaration:__ @duckdb_table_function_bind_t@
+
+    __defined at:__ @duckdb.h 1416:16@
+
+    __exported by:__ @duckdb.h@
+-}
+newtype DuckDBTableFunctionBindFun = DuckDBTableFunctionBindFun
+  { unwrap :: BG.FunPtr DuckDBTableFunctionBindFun_Aux
+  }
+  deriving stock (Eq, BG.Generic, Ord, Show)
+  deriving newtype
+    ( BG.HasFFIType
+    , Marshal.ReadRaw
+    , Marshal.StaticSize
+    , BG.Storable
+    , Marshal.WriteRaw
+    )
+
+instance ( ty ~ BG.FunPtr DuckDBTableFunctionBindFun_Aux
+         ) => BG.CompatHasField.HasField "unwrap" DuckDBTableFunctionBindFun ty where
+
+  hasField =
+    \x0 ->
+      (\y1 ->
+         DuckDBTableFunctionBindFun {unwrap = y1}, BG.getField @"unwrap" x0)
+
+instance ( ty ~ BG.FunPtr DuckDBTableFunctionBindFun_Aux
+         ) => BG.HasField "unwrap" (BG.Ptr DuckDBTableFunctionBindFun) (BG.Ptr ty) where
+
+  getField = HasCField.fromPtr (BG.Proxy @"unwrap")
+
+instance HasCField.HasCField DuckDBTableFunctionBindFun "unwrap" where
+
+  type CFieldType DuckDBTableFunctionBindFun "unwrap" =
+    BG.FunPtr DuckDBTableFunctionBindFun_Aux
+
+  offset# = \_ -> \_ -> 0
+
+{-| Auxiliary type used by t'DuckDBTableFunctionInitFun'
+
+    __C declaration:__ @duckdb_table_function_init_t@
+
+    __defined at:__ @duckdb.h 1424:16@
+
+    __exported by:__ @duckdb.h@
+-}
+newtype DuckDBTableFunctionInitFun_Aux = DuckDBTableFunctionInitFun_Aux
+  { unwrap :: DuckDBInitInfo -> IO ()
+  }
+  deriving stock (BG.Generic)
+
+-- __unique:__ @toDuckDBTableFunctionInitFun_Aux@
+foreign import ccall safe "wrapper" hs_bindgen_7fb60608b369dd4b_base ::
+     (BG.Ptr BG.Void -> IO ())
+  -> IO (BG.FunPtr (BG.Ptr BG.Void -> IO ()))
+
+-- __unique:__ @toDuckDBTableFunctionInitFun_Aux@
+hs_bindgen_7fb60608b369dd4b ::
+     DuckDBTableFunctionInitFun_Aux
+  -> IO (BG.FunPtr DuckDBTableFunctionInitFun_Aux)
+hs_bindgen_7fb60608b369dd4b =
+  \fun0 ->
+    fmap BG.castFunPtr (hs_bindgen_7fb60608b369dd4b_base (\x1 ->
+                                                            BG.getField @"unwrap" fun0 (BG.fromFFIType x1)))
+
+-- __unique:__ @fromDuckDBTableFunctionInitFun_Aux@
+foreign import ccall safe "dynamic" hs_bindgen_b7d67ef3d038a116_base ::
+     BG.FunPtr (BG.Ptr BG.Void -> IO ())
+  -> BG.Ptr BG.Void -> IO ()
+
+-- __unique:__ @fromDuckDBTableFunctionInitFun_Aux@
+hs_bindgen_b7d67ef3d038a116 ::
+     BG.FunPtr DuckDBTableFunctionInitFun_Aux
+  -> DuckDBTableFunctionInitFun_Aux
+hs_bindgen_b7d67ef3d038a116 =
+  \funPtr0 ->
+    DuckDBTableFunctionInitFun_Aux (\x1 ->
+                                      hs_bindgen_b7d67ef3d038a116_base (BG.castFunPtr funPtr0) (BG.toFFIType x1))
+
+instance BG.ToFunPtr DuckDBTableFunctionInitFun_Aux where
+
+  toFunPtr = hs_bindgen_7fb60608b369dd4b
+
+instance BG.FromFunPtr DuckDBTableFunctionInitFun_Aux where
+
+  fromFunPtr = hs_bindgen_b7d67ef3d038a116
+
+instance ( ty ~ (DuckDBInitInfo -> IO ())
+         ) => BG.CompatHasField.HasField "unwrap" DuckDBTableFunctionInitFun_Aux ty where
+
+  hasField =
+    \x0 ->
+      ( \y1 -> DuckDBTableFunctionInitFun_Aux {unwrap = y1}
+      , BG.getField @"unwrap" x0
+      )
+
+instance ( ty ~ (DuckDBInitInfo -> IO ())
+         ) => BG.HasField "unwrap" (BG.Ptr DuckDBTableFunctionInitFun_Aux) (BG.Ptr ty) where
+
+  getField = HasCField.fromPtr (BG.Proxy @"unwrap")
+
+instance HasCField.HasCField DuckDBTableFunctionInitFun_Aux "unwrap" where
+
+  type CFieldType DuckDBTableFunctionInitFun_Aux "unwrap" =
+    DuckDBInitInfo -> IO ()
+
+  offset# = \_ -> \_ -> 0
+
+{-| The init function of a table function.
+
+    history:
+
+    * stable: v0.3.3
+
+    __C declaration:__ @duckdb_table_function_init_t@
+
+    __defined at:__ @duckdb.h 1424:16@
+
+    __exported by:__ @duckdb.h@
+-}
+newtype DuckDBTableFunctionInitFun = DuckDBTableFunctionInitFun
+  { unwrap :: BG.FunPtr DuckDBTableFunctionInitFun_Aux
+  }
+  deriving stock (Eq, BG.Generic, Ord, Show)
+  deriving newtype
+    ( BG.HasFFIType
+    , Marshal.ReadRaw
+    , Marshal.StaticSize
+    , BG.Storable
+    , Marshal.WriteRaw
+    )
+
+instance ( ty ~ BG.FunPtr DuckDBTableFunctionInitFun_Aux
+         ) => BG.CompatHasField.HasField "unwrap" DuckDBTableFunctionInitFun ty where
+
+  hasField =
+    \x0 ->
+      (\y1 ->
+         DuckDBTableFunctionInitFun {unwrap = y1}, BG.getField @"unwrap" x0)
+
+instance ( ty ~ BG.FunPtr DuckDBTableFunctionInitFun_Aux
+         ) => BG.HasField "unwrap" (BG.Ptr DuckDBTableFunctionInitFun) (BG.Ptr ty) where
+
+  getField = HasCField.fromPtr (BG.Proxy @"unwrap")
+
+instance HasCField.HasCField DuckDBTableFunctionInitFun "unwrap" where
+
+  type CFieldType DuckDBTableFunctionInitFun "unwrap" =
+    BG.FunPtr DuckDBTableFunctionInitFun_Aux
+
+  offset# = \_ -> \_ -> 0
+
+{-| Auxiliary type used by t'DuckDBTableFunctionFun'
+
+    __C declaration:__ @duckdb_table_function_t@
+
+    __defined at:__ @duckdb.h 1432:16@
+
+    __exported by:__ @duckdb.h@
+-}
+newtype DuckDBTableFunctionFun_Aux = DuckDBTableFunctionFun_Aux
+  { unwrap :: DuckDBFunctionInfo -> DuckDBDataChunk -> IO ()
+  }
+  deriving stock (BG.Generic)
+
+-- __unique:__ @toDuckDBTableFunctionFun_Aux@
+foreign import ccall safe "wrapper" hs_bindgen_53d8e71eff3b0bb4_base ::
+     (BG.Ptr BG.Void -> BG.Ptr BG.Void -> IO ())
+  -> IO (BG.FunPtr (BG.Ptr BG.Void -> BG.Ptr BG.Void -> IO ()))
+
+-- __unique:__ @toDuckDBTableFunctionFun_Aux@
+hs_bindgen_53d8e71eff3b0bb4 ::
+     DuckDBTableFunctionFun_Aux
+  -> IO (BG.FunPtr DuckDBTableFunctionFun_Aux)
+hs_bindgen_53d8e71eff3b0bb4 =
+  \fun0 ->
+    fmap BG.castFunPtr (hs_bindgen_53d8e71eff3b0bb4_base (\x1 ->
+                                                            \x2 ->
+                                                              BG.getField @"unwrap" fun0 (BG.fromFFIType x1) (BG.fromFFIType x2)))
+
+-- __unique:__ @fromDuckDBTableFunctionFun_Aux@
+foreign import ccall safe "dynamic" hs_bindgen_226eeecfc5e200d9_base ::
+     BG.FunPtr (BG.Ptr BG.Void -> BG.Ptr BG.Void -> IO ())
+  -> BG.Ptr BG.Void -> BG.Ptr BG.Void -> IO ()
+
+-- __unique:__ @fromDuckDBTableFunctionFun_Aux@
+hs_bindgen_226eeecfc5e200d9 ::
+     BG.FunPtr DuckDBTableFunctionFun_Aux
+  -> DuckDBTableFunctionFun_Aux
+hs_bindgen_226eeecfc5e200d9 =
+  \funPtr0 ->
+    DuckDBTableFunctionFun_Aux (\x1 ->
+                                  \x2 ->
+                                    hs_bindgen_226eeecfc5e200d9_base (BG.castFunPtr funPtr0) (BG.toFFIType x1) (BG.toFFIType x2))
+
+instance BG.ToFunPtr DuckDBTableFunctionFun_Aux where
+
+  toFunPtr = hs_bindgen_53d8e71eff3b0bb4
+
+instance BG.FromFunPtr DuckDBTableFunctionFun_Aux where
+
+  fromFunPtr = hs_bindgen_226eeecfc5e200d9
+
+instance ( ty ~ (DuckDBFunctionInfo -> DuckDBDataChunk -> IO ())
+         ) => BG.CompatHasField.HasField "unwrap" DuckDBTableFunctionFun_Aux ty where
+
+  hasField =
+    \x0 ->
+      (\y1 ->
+         DuckDBTableFunctionFun_Aux {unwrap = y1}, BG.getField @"unwrap" x0)
+
+instance ( ty ~ (DuckDBFunctionInfo -> DuckDBDataChunk -> IO ())
+         ) => BG.HasField "unwrap" (BG.Ptr DuckDBTableFunctionFun_Aux) (BG.Ptr ty) where
+
+  getField = HasCField.fromPtr (BG.Proxy @"unwrap")
+
+instance HasCField.HasCField DuckDBTableFunctionFun_Aux "unwrap" where
+
+  type CFieldType DuckDBTableFunctionFun_Aux "unwrap" =
+    DuckDBFunctionInfo -> DuckDBDataChunk -> IO ()
+
+  offset# = \_ -> \_ -> 0
+
+{-| The main function of a table function.
+
+    history:
+
+    * stable: v0.3.3
+
+    __C declaration:__ @duckdb_table_function_t@
+
+    __defined at:__ @duckdb.h 1432:16@
+
+    __exported by:__ @duckdb.h@
+-}
+newtype DuckDBTableFunctionFun = DuckDBTableFunctionFun
+  { unwrap :: BG.FunPtr DuckDBTableFunctionFun_Aux
+  }
+  deriving stock (Eq, BG.Generic, Ord, Show)
+  deriving newtype
+    ( BG.HasFFIType
+    , Marshal.ReadRaw
+    , Marshal.StaticSize
+    , BG.Storable
+    , Marshal.WriteRaw
+    )
+
+instance ( ty ~ BG.FunPtr DuckDBTableFunctionFun_Aux
+         ) => BG.CompatHasField.HasField "unwrap" DuckDBTableFunctionFun ty where
+
+  hasField =
+    \x0 ->
+      (\y1 ->
+         DuckDBTableFunctionFun {unwrap = y1}, BG.getField @"unwrap" x0)
+
+instance ( ty ~ BG.FunPtr DuckDBTableFunctionFun_Aux
+         ) => BG.HasField "unwrap" (BG.Ptr DuckDBTableFunctionFun) (BG.Ptr ty) where
+
+  getField = HasCField.fromPtr (BG.Proxy @"unwrap")
+
+instance HasCField.HasCField DuckDBTableFunctionFun "unwrap" where
+
+  type CFieldType DuckDBTableFunctionFun "unwrap" =
+    BG.FunPtr DuckDBTableFunctionFun_Aux
+
+  offset# = \_ -> \_ -> 0
+
+{-| Auxiliary type used by t'DuckDBReplacementCallback'
+
+    __C declaration:__ @duckdb_replacement_callback_t@
+
+    __defined at:__ @duckdb.h 1440:16@
+
+    __exported by:__ @duckdb.h@
+-}
+newtype DuckDBReplacementCallback_Aux = DuckDBReplacementCallback_Aux
+  { unwrap :: DuckDBReplacementScanInfo -> PtrConst.PtrConst BG.CChar -> BG.Ptr BG.Void -> IO ()
+  }
+  deriving stock (BG.Generic)
+
+-- __unique:__ @toDuckDBReplacementCallback_Aux@
+foreign import ccall safe "wrapper" hs_bindgen_b4d89b8f0853ff56_base ::
+     (BG.Ptr BG.Void -> BG.Ptr BG.Void -> BG.Ptr BG.Void -> IO ())
+  -> IO (BG.FunPtr (BG.Ptr BG.Void -> BG.Ptr BG.Void -> BG.Ptr BG.Void -> IO ()))
+
+-- __unique:__ @toDuckDBReplacementCallback_Aux@
+hs_bindgen_b4d89b8f0853ff56 ::
+     DuckDBReplacementCallback_Aux
+  -> IO (BG.FunPtr DuckDBReplacementCallback_Aux)
+hs_bindgen_b4d89b8f0853ff56 =
+  \fun0 ->
+    fmap BG.castFunPtr (hs_bindgen_b4d89b8f0853ff56_base (\x1 ->
+                                                            \x2 ->
+                                                              \x3 ->
+                                                                BG.getField @"unwrap" fun0 (BG.fromFFIType x1) (BG.fromFFIType x2) (BG.fromFFIType x3)))
+
+-- __unique:__ @fromDuckDBReplacementCallback_Aux@
+foreign import ccall safe "dynamic" hs_bindgen_4e157a67ceab2edc_base ::
+     BG.FunPtr (BG.Ptr BG.Void -> BG.Ptr BG.Void -> BG.Ptr BG.Void -> IO ())
+  -> BG.Ptr BG.Void -> BG.Ptr BG.Void -> BG.Ptr BG.Void -> IO ()
+
+-- __unique:__ @fromDuckDBReplacementCallback_Aux@
+hs_bindgen_4e157a67ceab2edc ::
+     BG.FunPtr DuckDBReplacementCallback_Aux
+  -> DuckDBReplacementCallback_Aux
+hs_bindgen_4e157a67ceab2edc =
+  \funPtr0 ->
+    DuckDBReplacementCallback_Aux (\x1 ->
+                                     \x2 ->
+                                       \x3 ->
+                                         hs_bindgen_4e157a67ceab2edc_base (BG.castFunPtr funPtr0) (BG.toFFIType x1) (BG.toFFIType x2) (BG.toFFIType x3))
+
+instance BG.ToFunPtr DuckDBReplacementCallback_Aux where
+
+  toFunPtr = hs_bindgen_b4d89b8f0853ff56
+
+instance BG.FromFunPtr DuckDBReplacementCallback_Aux where
+
+  fromFunPtr = hs_bindgen_4e157a67ceab2edc
+
+instance ( ty ~ (DuckDBReplacementScanInfo -> PtrConst.PtrConst BG.CChar -> BG.Ptr BG.Void -> IO ())
+         ) => BG.CompatHasField.HasField "unwrap" DuckDBReplacementCallback_Aux ty where
+
+  hasField =
+    \x0 ->
+      ( \y1 -> DuckDBReplacementCallback_Aux {unwrap = y1}
+      , BG.getField @"unwrap" x0
+      )
+
+instance ( ty ~ (DuckDBReplacementScanInfo -> PtrConst.PtrConst BG.CChar -> BG.Ptr BG.Void -> IO ())
+         ) => BG.HasField "unwrap" (BG.Ptr DuckDBReplacementCallback_Aux) (BG.Ptr ty) where
+
+  getField = HasCField.fromPtr (BG.Proxy @"unwrap")
+
+instance HasCField.HasCField DuckDBReplacementCallback_Aux "unwrap" where
+
+  type CFieldType DuckDBReplacementCallback_Aux "unwrap" =
+    DuckDBReplacementScanInfo -> PtrConst.PtrConst BG.CChar -> BG.Ptr BG.Void -> IO ()
+
+  offset# = \_ -> \_ -> 0
+
+{-| The callback function for replacement scans.
+
+    history:
+
+    * stable: v0.3.3
+
+    __C declaration:__ @duckdb_replacement_callback_t@
+
+    __defined at:__ @duckdb.h 1440:16@
+
+    __exported by:__ @duckdb.h@
+-}
+newtype DuckDBReplacementCallback = DuckDBReplacementCallback
+  { unwrap :: BG.FunPtr DuckDBReplacementCallback_Aux
+  }
+  deriving stock (Eq, BG.Generic, Ord, Show)
+  deriving newtype
+    ( BG.HasFFIType
+    , Marshal.ReadRaw
+    , Marshal.StaticSize
+    , BG.Storable
+    , Marshal.WriteRaw
+    )
+
+instance ( ty ~ BG.FunPtr DuckDBReplacementCallback_Aux
+         ) => BG.CompatHasField.HasField "unwrap" DuckDBReplacementCallback ty where
+
+  hasField =
+    \x0 ->
+      (\y1 ->
+         DuckDBReplacementCallback {unwrap = y1}, BG.getField @"unwrap" x0)
+
+instance ( ty ~ BG.FunPtr DuckDBReplacementCallback_Aux
+         ) => BG.HasField "unwrap" (BG.Ptr DuckDBReplacementCallback) (BG.Ptr ty) where
+
+  getField = HasCField.fromPtr (BG.Proxy @"unwrap")
+
+instance HasCField.HasCField DuckDBReplacementCallback "unwrap" where
+
+  type CFieldType DuckDBReplacementCallback "unwrap" =
+    BG.FunPtr DuckDBReplacementCallback_Aux
+
+  offset# = \_ -> \_ -> 0
+
+{-| Auxiliary type used by t'DuckDBLoggerWriteLogEntryFun'
+
+    __C declaration:__ @duckdb_logger_write_log_entry_t@
+
+    __defined at:__ @duckdb.h 1449:16@
+
+    __exported by:__ @duckdb.h@
+-}
+newtype DuckDBLoggerWriteLogEntryFun_Aux = DuckDBLoggerWriteLogEntryFun_Aux
+  { unwrap :: BG.Ptr BG.Void -> BG.Ptr DuckDBTimestamp -> PtrConst.PtrConst BG.CChar -> PtrConst.PtrConst BG.CChar -> PtrConst.PtrConst BG.CChar -> IO ()
+  }
+  deriving stock (BG.Generic)
+
+-- __unique:__ @toDuckDBLoggerWriteLogEntryFun_Aux@
+foreign import ccall safe "wrapper" hs_bindgen_ea7c4e837c257e90_base ::
+     (BG.Ptr BG.Void -> BG.Ptr BG.Void -> BG.Ptr BG.Void -> BG.Ptr BG.Void -> BG.Ptr BG.Void -> IO ())
+  -> IO (BG.FunPtr (BG.Ptr BG.Void -> BG.Ptr BG.Void -> BG.Ptr BG.Void -> BG.Ptr BG.Void -> BG.Ptr BG.Void -> IO ()))
+
+-- __unique:__ @toDuckDBLoggerWriteLogEntryFun_Aux@
+hs_bindgen_ea7c4e837c257e90 ::
+     DuckDBLoggerWriteLogEntryFun_Aux
+  -> IO (BG.FunPtr DuckDBLoggerWriteLogEntryFun_Aux)
+hs_bindgen_ea7c4e837c257e90 =
+  \fun0 ->
+    fmap BG.castFunPtr (hs_bindgen_ea7c4e837c257e90_base (\x1 ->
+                                                            \x2 ->
+                                                              \x3 ->
+                                                                \x4 ->
+                                                                  \x5 ->
+                                                                    BG.getField @"unwrap" fun0 (BG.fromFFIType x1) (BG.fromFFIType x2) (BG.fromFFIType x3) (BG.fromFFIType x4) (BG.fromFFIType x5)))
+
+-- __unique:__ @fromDuckDBLoggerWriteLogEntryFun_Aux@
+foreign import ccall safe "dynamic" hs_bindgen_8d44e6357922aee3_base ::
+     BG.FunPtr (BG.Ptr BG.Void -> BG.Ptr BG.Void -> BG.Ptr BG.Void -> BG.Ptr BG.Void -> BG.Ptr BG.Void -> IO ())
+  -> BG.Ptr BG.Void -> BG.Ptr BG.Void -> BG.Ptr BG.Void -> BG.Ptr BG.Void -> BG.Ptr BG.Void -> IO ()
+
+-- __unique:__ @fromDuckDBLoggerWriteLogEntryFun_Aux@
+hs_bindgen_8d44e6357922aee3 ::
+     BG.FunPtr DuckDBLoggerWriteLogEntryFun_Aux
+  -> DuckDBLoggerWriteLogEntryFun_Aux
+hs_bindgen_8d44e6357922aee3 =
+  \funPtr0 ->
+    DuckDBLoggerWriteLogEntryFun_Aux (\x1 ->
+                                        \x2 ->
+                                          \x3 ->
+                                            \x4 ->
+                                              \x5 ->
+                                                hs_bindgen_8d44e6357922aee3_base (BG.castFunPtr funPtr0) (BG.toFFIType x1) (BG.toFFIType x2) (BG.toFFIType x3) (BG.toFFIType x4) (BG.toFFIType x5))
+
+instance BG.ToFunPtr DuckDBLoggerWriteLogEntryFun_Aux where
+
+  toFunPtr = hs_bindgen_ea7c4e837c257e90
+
+instance BG.FromFunPtr DuckDBLoggerWriteLogEntryFun_Aux where
+
+  fromFunPtr = hs_bindgen_8d44e6357922aee3
+
+instance ( ty ~ (BG.Ptr BG.Void -> BG.Ptr DuckDBTimestamp -> PtrConst.PtrConst BG.CChar -> PtrConst.PtrConst BG.CChar -> PtrConst.PtrConst BG.CChar -> IO ())
+         ) => BG.CompatHasField.HasField "unwrap" DuckDBLoggerWriteLogEntryFun_Aux ty where
+
+  hasField =
+    \x0 ->
+      ( \y1 ->
+          DuckDBLoggerWriteLogEntryFun_Aux {unwrap = y1}
+      , BG.getField @"unwrap" x0
+      )
+
+instance ( ty ~ (BG.Ptr BG.Void -> BG.Ptr DuckDBTimestamp -> PtrConst.PtrConst BG.CChar -> PtrConst.PtrConst BG.CChar -> PtrConst.PtrConst BG.CChar -> IO ())
+         ) => BG.HasField "unwrap" (BG.Ptr DuckDBLoggerWriteLogEntryFun_Aux) (BG.Ptr ty) where
+
+  getField = HasCField.fromPtr (BG.Proxy @"unwrap")
+
+instance HasCField.HasCField DuckDBLoggerWriteLogEntryFun_Aux "unwrap" where
+
+  type CFieldType DuckDBLoggerWriteLogEntryFun_Aux "unwrap" =
+    BG.Ptr BG.Void -> BG.Ptr DuckDBTimestamp -> PtrConst.PtrConst BG.CChar -> PtrConst.PtrConst BG.CChar -> PtrConst.PtrConst BG.CChar -> IO ()
+
+  offset# = \_ -> \_ -> 0
+
+{-| The callback to write a log entry.
+
+    history:
+
+    * unstable: v1.5.0
+
+    * stable: v1.5.6
+
+    __C declaration:__ @duckdb_logger_write_log_entry_t@
+
+    __defined at:__ @duckdb.h 1449:16@
+
+    __exported by:__ @duckdb.h@
+-}
+newtype DuckDBLoggerWriteLogEntryFun = DuckDBLoggerWriteLogEntryFun
+  { unwrap :: BG.FunPtr DuckDBLoggerWriteLogEntryFun_Aux
+  }
+  deriving stock (Eq, BG.Generic, Ord, Show)
+  deriving newtype
+    ( BG.HasFFIType
+    , Marshal.ReadRaw
+    , Marshal.StaticSize
+    , BG.Storable
+    , Marshal.WriteRaw
+    )
+
+instance ( ty ~ BG.FunPtr DuckDBLoggerWriteLogEntryFun_Aux
+         ) => BG.CompatHasField.HasField "unwrap" DuckDBLoggerWriteLogEntryFun ty where
+
+  hasField =
+    \x0 ->
+      (\y1 ->
+         DuckDBLoggerWriteLogEntryFun {unwrap = y1}, BG.getField @"unwrap" x0)
+
+instance ( ty ~ BG.FunPtr DuckDBLoggerWriteLogEntryFun_Aux
+         ) => BG.HasField "unwrap" (BG.Ptr DuckDBLoggerWriteLogEntryFun) (BG.Ptr ty) where
+
+  getField = HasCField.fromPtr (BG.Proxy @"unwrap")
+
+instance HasCField.HasCField DuckDBLoggerWriteLogEntryFun "unwrap" where
+
+  type CFieldType DuckDBLoggerWriteLogEntryFun "unwrap" =
+    BG.FunPtr DuckDBLoggerWriteLogEntryFun_Aux
+
+  offset# = \_ -> \_ -> 0
+
+{-| Auxiliary type used by t'DuckDBCopyFunctionSinkFun'
+
+    __C declaration:__ @duckdb_copy_function_sink_t@
+
+    __defined at:__ @duckdb.h 1459:16@
+
+    __exported by:__ @duckdb.h@
+-}
+newtype DuckDBCopyFunctionSinkFun_Aux = DuckDBCopyFunctionSinkFun_Aux
+  { unwrap :: DuckDBCopyFunctionSinkInfo -> DuckDBDataChunk -> IO ()
+  }
+  deriving stock (BG.Generic)
+
+-- __unique:__ @toDuckDBCopyFunctionSinkFun_Aux@
+foreign import ccall safe "wrapper" hs_bindgen_65cd6c9e5697a4db_base ::
+     (BG.Ptr BG.Void -> BG.Ptr BG.Void -> IO ())
+  -> IO (BG.FunPtr (BG.Ptr BG.Void -> BG.Ptr BG.Void -> IO ()))
+
+-- __unique:__ @toDuckDBCopyFunctionSinkFun_Aux@
+hs_bindgen_65cd6c9e5697a4db ::
+     DuckDBCopyFunctionSinkFun_Aux
+  -> IO (BG.FunPtr DuckDBCopyFunctionSinkFun_Aux)
+hs_bindgen_65cd6c9e5697a4db =
+  \fun0 ->
+    fmap BG.castFunPtr (hs_bindgen_65cd6c9e5697a4db_base (\x1 ->
+                                                            \x2 ->
+                                                              BG.getField @"unwrap" fun0 (BG.fromFFIType x1) (BG.fromFFIType x2)))
+
+-- __unique:__ @fromDuckDBCopyFunctionSinkFun_Aux@
+foreign import ccall safe "dynamic" hs_bindgen_27010a41023bec9f_base ::
+     BG.FunPtr (BG.Ptr BG.Void -> BG.Ptr BG.Void -> IO ())
+  -> BG.Ptr BG.Void -> BG.Ptr BG.Void -> IO ()
+
+-- __unique:__ @fromDuckDBCopyFunctionSinkFun_Aux@
+hs_bindgen_27010a41023bec9f ::
+     BG.FunPtr DuckDBCopyFunctionSinkFun_Aux
+  -> DuckDBCopyFunctionSinkFun_Aux
+hs_bindgen_27010a41023bec9f =
+  \funPtr0 ->
+    DuckDBCopyFunctionSinkFun_Aux (\x1 ->
+                                     \x2 ->
+                                       hs_bindgen_27010a41023bec9f_base (BG.castFunPtr funPtr0) (BG.toFFIType x1) (BG.toFFIType x2))
+
+instance BG.ToFunPtr DuckDBCopyFunctionSinkFun_Aux where
+
+  toFunPtr = hs_bindgen_65cd6c9e5697a4db
+
+instance BG.FromFunPtr DuckDBCopyFunctionSinkFun_Aux where
+
+  fromFunPtr = hs_bindgen_27010a41023bec9f
+
+instance ( ty ~ (DuckDBCopyFunctionSinkInfo -> DuckDBDataChunk -> IO ())
+         ) => BG.CompatHasField.HasField "unwrap" DuckDBCopyFunctionSinkFun_Aux ty where
+
+  hasField =
+    \x0 ->
+      ( \y1 -> DuckDBCopyFunctionSinkFun_Aux {unwrap = y1}
+      , BG.getField @"unwrap" x0
+      )
+
+instance ( ty ~ (DuckDBCopyFunctionSinkInfo -> DuckDBDataChunk -> IO ())
+         ) => BG.HasField "unwrap" (BG.Ptr DuckDBCopyFunctionSinkFun_Aux) (BG.Ptr ty) where
+
+  getField = HasCField.fromPtr (BG.Proxy @"unwrap")
+
+instance HasCField.HasCField DuckDBCopyFunctionSinkFun_Aux "unwrap" where
+
+  type CFieldType DuckDBCopyFunctionSinkFun_Aux "unwrap" =
+    DuckDBCopyFunctionSinkInfo -> DuckDBDataChunk -> IO ()
+
+  offset# = \_ -> \_ -> 0
+
+{-| The sink function of a copy function.
+
+    history:
+
+    * unstable: v1.5.0
+
+    * stable: v1.5.6
+
+    __C declaration:__ @duckdb_copy_function_sink_t@
+
+    __defined at:__ @duckdb.h 1459:16@
+
+    __exported by:__ @duckdb.h@
+-}
+newtype DuckDBCopyFunctionSinkFun = DuckDBCopyFunctionSinkFun
+  { unwrap :: BG.FunPtr DuckDBCopyFunctionSinkFun_Aux
+  }
+  deriving stock (Eq, BG.Generic, Ord, Show)
+  deriving newtype
+    ( BG.HasFFIType
+    , Marshal.ReadRaw
+    , Marshal.StaticSize
+    , BG.Storable
+    , Marshal.WriteRaw
+    )
+
+instance ( ty ~ BG.FunPtr DuckDBCopyFunctionSinkFun_Aux
+         ) => BG.CompatHasField.HasField "unwrap" DuckDBCopyFunctionSinkFun ty where
+
+  hasField =
+    \x0 ->
+      (\y1 ->
+         DuckDBCopyFunctionSinkFun {unwrap = y1}, BG.getField @"unwrap" x0)
+
+instance ( ty ~ BG.FunPtr DuckDBCopyFunctionSinkFun_Aux
+         ) => BG.HasField "unwrap" (BG.Ptr DuckDBCopyFunctionSinkFun) (BG.Ptr ty) where
+
+  getField = HasCField.fromPtr (BG.Proxy @"unwrap")
+
+instance HasCField.HasCField DuckDBCopyFunctionSinkFun "unwrap" where
+
+  type CFieldType DuckDBCopyFunctionSinkFun "unwrap" =
+    BG.FunPtr DuckDBCopyFunctionSinkFun_Aux
+
+  offset# = \_ -> \_ -> 0
+
+{-| Auxiliary type used by t'DuckDBCopyFunctionFinalizeFun'
+
+    __C declaration:__ @duckdb_copy_function_finalize_t@
+
+    __defined at:__ @duckdb.h 1468:16@
+
+    __exported by:__ @duckdb.h@
+-}
+newtype DuckDBCopyFunctionFinalizeFun_Aux = DuckDBCopyFunctionFinalizeFun_Aux
+  { unwrap :: DuckDBCopyFunctionFinalizeInfo -> IO ()
+  }
+  deriving stock (BG.Generic)
+
+-- __unique:__ @toDuckDBCopyFunctionFinalizeFun_Aux@
+foreign import ccall safe "wrapper" hs_bindgen_a0c65c3d04272ccd_base ::
+     (BG.Ptr BG.Void -> IO ())
+  -> IO (BG.FunPtr (BG.Ptr BG.Void -> IO ()))
+
+-- __unique:__ @toDuckDBCopyFunctionFinalizeFun_Aux@
+hs_bindgen_a0c65c3d04272ccd ::
+     DuckDBCopyFunctionFinalizeFun_Aux
+  -> IO (BG.FunPtr DuckDBCopyFunctionFinalizeFun_Aux)
+hs_bindgen_a0c65c3d04272ccd =
+  \fun0 ->
+    fmap BG.castFunPtr (hs_bindgen_a0c65c3d04272ccd_base (\x1 ->
+                                                            BG.getField @"unwrap" fun0 (BG.fromFFIType x1)))
+
+-- __unique:__ @fromDuckDBCopyFunctionFinalizeFun_Aux@
+foreign import ccall safe "dynamic" hs_bindgen_58cc1a6f629467fc_base ::
+     BG.FunPtr (BG.Ptr BG.Void -> IO ())
+  -> BG.Ptr BG.Void -> IO ()
+
+-- __unique:__ @fromDuckDBCopyFunctionFinalizeFun_Aux@
+hs_bindgen_58cc1a6f629467fc ::
+     BG.FunPtr DuckDBCopyFunctionFinalizeFun_Aux
+  -> DuckDBCopyFunctionFinalizeFun_Aux
+hs_bindgen_58cc1a6f629467fc =
+  \funPtr0 ->
+    DuckDBCopyFunctionFinalizeFun_Aux (\x1 ->
+                                         hs_bindgen_58cc1a6f629467fc_base (BG.castFunPtr funPtr0) (BG.toFFIType x1))
+
+instance BG.ToFunPtr DuckDBCopyFunctionFinalizeFun_Aux where
+
+  toFunPtr = hs_bindgen_a0c65c3d04272ccd
+
+instance BG.FromFunPtr DuckDBCopyFunctionFinalizeFun_Aux where
+
+  fromFunPtr = hs_bindgen_58cc1a6f629467fc
+
+instance ( ty ~ (DuckDBCopyFunctionFinalizeInfo -> IO ())
+         ) => BG.CompatHasField.HasField "unwrap" DuckDBCopyFunctionFinalizeFun_Aux ty where
+
+  hasField =
+    \x0 ->
+      ( \y1 ->
+          DuckDBCopyFunctionFinalizeFun_Aux {unwrap = y1}
+      , BG.getField @"unwrap" x0
+      )
+
+instance ( ty ~ (DuckDBCopyFunctionFinalizeInfo -> IO ())
+         ) => BG.HasField "unwrap" (BG.Ptr DuckDBCopyFunctionFinalizeFun_Aux) (BG.Ptr ty) where
+
+  getField = HasCField.fromPtr (BG.Proxy @"unwrap")
+
+instance HasCField.HasCField DuckDBCopyFunctionFinalizeFun_Aux "unwrap" where
+
+  type CFieldType DuckDBCopyFunctionFinalizeFun_Aux "unwrap" =
+    DuckDBCopyFunctionFinalizeInfo -> IO ()
+
+  offset# = \_ -> \_ -> 0
+
+{-| The finalize function of a copy function.
+
+    history:
+
+    * unstable: v1.5.0
+
+    * stable: v1.5.6
+
+    __C declaration:__ @duckdb_copy_function_finalize_t@
+
+    __defined at:__ @duckdb.h 1468:16@
+
+    __exported by:__ @duckdb.h@
+-}
+newtype DuckDBCopyFunctionFinalizeFun = DuckDBCopyFunctionFinalizeFun
+  { unwrap :: BG.FunPtr DuckDBCopyFunctionFinalizeFun_Aux
+  }
+  deriving stock (Eq, BG.Generic, Ord, Show)
+  deriving newtype
+    ( BG.HasFFIType
+    , Marshal.ReadRaw
+    , Marshal.StaticSize
+    , BG.Storable
+    , Marshal.WriteRaw
+    )
+
+instance ( ty ~ BG.FunPtr DuckDBCopyFunctionFinalizeFun_Aux
+         ) => BG.CompatHasField.HasField "unwrap" DuckDBCopyFunctionFinalizeFun ty where
+
+  hasField =
+    \x0 ->
+      ( \y1 -> DuckDBCopyFunctionFinalizeFun {unwrap = y1}
+      , BG.getField @"unwrap" x0
+      )
+
+instance ( ty ~ BG.FunPtr DuckDBCopyFunctionFinalizeFun_Aux
+         ) => BG.HasField "unwrap" (BG.Ptr DuckDBCopyFunctionFinalizeFun) (BG.Ptr ty) where
+
+  getField = HasCField.fromPtr (BG.Proxy @"unwrap")
+
+instance HasCField.HasCField DuckDBCopyFunctionFinalizeFun "unwrap" where
+
+  type CFieldType DuckDBCopyFunctionFinalizeFun "unwrap" =
+    BG.FunPtr DuckDBCopyFunctionFinalizeFun_Aux
+
+  offset# = \_ -> \_ -> 0
+
+{-| Auxiliary type used by t'DuckDBAggregateStateSizeFun'
+
+    __C declaration:__ @duckdb_aggregate_state_size@
+
+    __defined at:__ @duckdb.h 1476:17@
+
+    __exported by:__ @duckdb.h@
+-}
+newtype DuckDBAggregateStateSizeFun_Aux = DuckDBAggregateStateSizeFun_Aux
+  { unwrap :: DuckDBFunctionInfo -> IO DuckDBIdx
+  }
+  deriving stock (BG.Generic)
+
+-- __unique:__ @toDuckDBAggregateStateSizeFun_Aux@
+foreign import ccall safe "wrapper" hs_bindgen_72af9c6ff78a0cab_base ::
+     (BG.Ptr BG.Void -> IO HsBindgen.Runtime.LibC.Word64)
+  -> IO (BG.FunPtr (BG.Ptr BG.Void -> IO HsBindgen.Runtime.LibC.Word64))
+
+-- __unique:__ @toDuckDBAggregateStateSizeFun_Aux@
+hs_bindgen_72af9c6ff78a0cab ::
+     DuckDBAggregateStateSizeFun_Aux
+  -> IO (BG.FunPtr DuckDBAggregateStateSizeFun_Aux)
+hs_bindgen_72af9c6ff78a0cab =
+  \fun0 ->
+    fmap BG.castFunPtr (hs_bindgen_72af9c6ff78a0cab_base (\x1 ->
+                                                            fmap BG.toFFIType (BG.getField @"unwrap" fun0 (BG.fromFFIType x1))))
+
+-- __unique:__ @fromDuckDBAggregateStateSizeFun_Aux@
+foreign import ccall safe "dynamic" hs_bindgen_9b6685daa72b6ee0_base ::
+     BG.FunPtr (BG.Ptr BG.Void -> IO HsBindgen.Runtime.LibC.Word64)
+  -> BG.Ptr BG.Void -> IO HsBindgen.Runtime.LibC.Word64
+
+-- __unique:__ @fromDuckDBAggregateStateSizeFun_Aux@
+hs_bindgen_9b6685daa72b6ee0 ::
+     BG.FunPtr DuckDBAggregateStateSizeFun_Aux
+  -> DuckDBAggregateStateSizeFun_Aux
+hs_bindgen_9b6685daa72b6ee0 =
+  \funPtr0 ->
+    DuckDBAggregateStateSizeFun_Aux (\x1 ->
+                                       fmap BG.fromFFIType (hs_bindgen_9b6685daa72b6ee0_base (BG.castFunPtr funPtr0) (BG.toFFIType x1)))
+
+instance BG.ToFunPtr DuckDBAggregateStateSizeFun_Aux where
+
+  toFunPtr = hs_bindgen_72af9c6ff78a0cab
+
+instance BG.FromFunPtr DuckDBAggregateStateSizeFun_Aux where
+
+  fromFunPtr = hs_bindgen_9b6685daa72b6ee0
+
+instance ( ty ~ (DuckDBFunctionInfo -> IO DuckDBIdx)
+         ) => BG.CompatHasField.HasField "unwrap" DuckDBAggregateStateSizeFun_Aux ty where
+
+  hasField =
+    \x0 ->
+      ( \y1 ->
+          DuckDBAggregateStateSizeFun_Aux {unwrap = y1}
+      , BG.getField @"unwrap" x0
+      )
+
+instance ( ty ~ (DuckDBFunctionInfo -> IO DuckDBIdx)
+         ) => BG.HasField "unwrap" (BG.Ptr DuckDBAggregateStateSizeFun_Aux) (BG.Ptr ty) where
+
+  getField = HasCField.fromPtr (BG.Proxy @"unwrap")
+
+instance HasCField.HasCField DuckDBAggregateStateSizeFun_Aux "unwrap" where
+
+  type CFieldType DuckDBAggregateStateSizeFun_Aux "unwrap" =
+    DuckDBFunctionInfo -> IO DuckDBIdx
+
+  offset# = \_ -> \_ -> 0
+
+{-| A function to get the size of an aggregate state.
+
+    history:
+
+    * stable: v1.1.0
+
+    __C declaration:__ @duckdb_aggregate_state_size@
+
+    __defined at:__ @duckdb.h 1476:17@
+
+    __exported by:__ @duckdb.h@
+-}
+newtype DuckDBAggregateStateSizeFun = DuckDBAggregateStateSizeFun
+  { unwrap :: BG.FunPtr DuckDBAggregateStateSizeFun_Aux
+  }
+  deriving stock (Eq, BG.Generic, Ord, Show)
+  deriving newtype
+    ( BG.HasFFIType
+    , Marshal.ReadRaw
+    , Marshal.StaticSize
+    , BG.Storable
+    , Marshal.WriteRaw
+    )
+
+instance ( ty ~ BG.FunPtr DuckDBAggregateStateSizeFun_Aux
+         ) => BG.CompatHasField.HasField "unwrap" DuckDBAggregateStateSizeFun ty where
+
+  hasField =
+    \x0 ->
+      (\y1 ->
+         DuckDBAggregateStateSizeFun {unwrap = y1}, BG.getField @"unwrap" x0)
+
+instance ( ty ~ BG.FunPtr DuckDBAggregateStateSizeFun_Aux
+         ) => BG.HasField "unwrap" (BG.Ptr DuckDBAggregateStateSizeFun) (BG.Ptr ty) where
+
+  getField = HasCField.fromPtr (BG.Proxy @"unwrap")
+
+instance HasCField.HasCField DuckDBAggregateStateSizeFun "unwrap" where
+
+  type CFieldType DuckDBAggregateStateSizeFun "unwrap" =
+    BG.FunPtr DuckDBAggregateStateSizeFun_Aux
+
+  offset# = \_ -> \_ -> 0
+
+{-| Auxiliary type used by t'DuckDBAggregateInitFun'
+
+    __C declaration:__ @duckdb_aggregate_init_t@
+
+    __defined at:__ @duckdb.h 1484:16@
+
+    __exported by:__ @duckdb.h@
+-}
+newtype DuckDBAggregateInitFun_Aux = DuckDBAggregateInitFun_Aux
+  { unwrap :: DuckDBFunctionInfo -> DuckDBAggregateState -> IO ()
+  }
+  deriving stock (BG.Generic)
+
+-- __unique:__ @toDuckDBAggregateInitFun_Aux@
+foreign import ccall safe "wrapper" hs_bindgen_112ee1a46eac440d_base ::
+     (BG.Ptr BG.Void -> BG.Ptr BG.Void -> IO ())
+  -> IO (BG.FunPtr (BG.Ptr BG.Void -> BG.Ptr BG.Void -> IO ()))
+
+-- __unique:__ @toDuckDBAggregateInitFun_Aux@
+hs_bindgen_112ee1a46eac440d ::
+     DuckDBAggregateInitFun_Aux
+  -> IO (BG.FunPtr DuckDBAggregateInitFun_Aux)
+hs_bindgen_112ee1a46eac440d =
+  \fun0 ->
+    fmap BG.castFunPtr (hs_bindgen_112ee1a46eac440d_base (\x1 ->
+                                                            \x2 ->
+                                                              BG.getField @"unwrap" fun0 (BG.fromFFIType x1) (BG.fromFFIType x2)))
+
+-- __unique:__ @fromDuckDBAggregateInitFun_Aux@
+foreign import ccall safe "dynamic" hs_bindgen_06d2cdb271ba2e4b_base ::
+     BG.FunPtr (BG.Ptr BG.Void -> BG.Ptr BG.Void -> IO ())
+  -> BG.Ptr BG.Void -> BG.Ptr BG.Void -> IO ()
+
+-- __unique:__ @fromDuckDBAggregateInitFun_Aux@
+hs_bindgen_06d2cdb271ba2e4b ::
+     BG.FunPtr DuckDBAggregateInitFun_Aux
+  -> DuckDBAggregateInitFun_Aux
+hs_bindgen_06d2cdb271ba2e4b =
+  \funPtr0 ->
+    DuckDBAggregateInitFun_Aux (\x1 ->
+                                  \x2 ->
+                                    hs_bindgen_06d2cdb271ba2e4b_base (BG.castFunPtr funPtr0) (BG.toFFIType x1) (BG.toFFIType x2))
+
+instance BG.ToFunPtr DuckDBAggregateInitFun_Aux where
+
+  toFunPtr = hs_bindgen_112ee1a46eac440d
+
+instance BG.FromFunPtr DuckDBAggregateInitFun_Aux where
+
+  fromFunPtr = hs_bindgen_06d2cdb271ba2e4b
+
+instance ( ty ~ (DuckDBFunctionInfo -> DuckDBAggregateState -> IO ())
+         ) => BG.CompatHasField.HasField "unwrap" DuckDBAggregateInitFun_Aux ty where
+
+  hasField =
+    \x0 ->
+      (\y1 ->
+         DuckDBAggregateInitFun_Aux {unwrap = y1}, BG.getField @"unwrap" x0)
+
+instance ( ty ~ (DuckDBFunctionInfo -> DuckDBAggregateState -> IO ())
+         ) => BG.HasField "unwrap" (BG.Ptr DuckDBAggregateInitFun_Aux) (BG.Ptr ty) where
+
+  getField = HasCField.fromPtr (BG.Proxy @"unwrap")
+
+instance HasCField.HasCField DuckDBAggregateInitFun_Aux "unwrap" where
+
+  type CFieldType DuckDBAggregateInitFun_Aux "unwrap" =
+    DuckDBFunctionInfo -> DuckDBAggregateState -> IO ()
+
+  offset# = \_ -> \_ -> 0
+
+{-| A function to initialize an aggregate state.
+
+    history:
+
+    * stable: v1.1.0
+
+    __C declaration:__ @duckdb_aggregate_init_t@
+
+    __defined at:__ @duckdb.h 1484:16@
+
+    __exported by:__ @duckdb.h@
+-}
+newtype DuckDBAggregateInitFun = DuckDBAggregateInitFun
+  { unwrap :: BG.FunPtr DuckDBAggregateInitFun_Aux
+  }
+  deriving stock (Eq, BG.Generic, Ord, Show)
+  deriving newtype
+    ( BG.HasFFIType
+    , Marshal.ReadRaw
+    , Marshal.StaticSize
+    , BG.Storable
+    , Marshal.WriteRaw
+    )
+
+instance ( ty ~ BG.FunPtr DuckDBAggregateInitFun_Aux
+         ) => BG.CompatHasField.HasField "unwrap" DuckDBAggregateInitFun ty where
+
+  hasField =
+    \x0 ->
+      (\y1 ->
+         DuckDBAggregateInitFun {unwrap = y1}, BG.getField @"unwrap" x0)
+
+instance ( ty ~ BG.FunPtr DuckDBAggregateInitFun_Aux
+         ) => BG.HasField "unwrap" (BG.Ptr DuckDBAggregateInitFun) (BG.Ptr ty) where
+
+  getField = HasCField.fromPtr (BG.Proxy @"unwrap")
+
+instance HasCField.HasCField DuckDBAggregateInitFun "unwrap" where
+
+  type CFieldType DuckDBAggregateInitFun "unwrap" =
+    BG.FunPtr DuckDBAggregateInitFun_Aux
+
+  offset# = \_ -> \_ -> 0
+
+{-| Auxiliary type used by t'DuckDBAggregateDestroyFun'
+
+    __C declaration:__ @duckdb_aggregate_destroy_t@
+
+    __defined at:__ @duckdb.h 1492:16@
+
+    __exported by:__ @duckdb.h@
+-}
+newtype DuckDBAggregateDestroyFun_Aux = DuckDBAggregateDestroyFun_Aux
+  { unwrap :: BG.Ptr DuckDBAggregateState -> DuckDBIdx -> IO ()
+  }
+  deriving stock (BG.Generic)
+
+-- __unique:__ @toDuckDBAggregateDestroyFun_Aux@
+foreign import ccall safe "wrapper" hs_bindgen_7d4ad922621df3cd_base ::
+     (BG.Ptr BG.Void -> HsBindgen.Runtime.LibC.Word64 -> IO ())
+  -> IO (BG.FunPtr (BG.Ptr BG.Void -> HsBindgen.Runtime.LibC.Word64 -> IO ()))
+
+-- __unique:__ @toDuckDBAggregateDestroyFun_Aux@
+hs_bindgen_7d4ad922621df3cd ::
+     DuckDBAggregateDestroyFun_Aux
+  -> IO (BG.FunPtr DuckDBAggregateDestroyFun_Aux)
+hs_bindgen_7d4ad922621df3cd =
+  \fun0 ->
+    fmap BG.castFunPtr (hs_bindgen_7d4ad922621df3cd_base (\x1 ->
+                                                            \x2 ->
+                                                              BG.getField @"unwrap" fun0 (BG.fromFFIType x1) (BG.fromFFIType x2)))
+
+-- __unique:__ @fromDuckDBAggregateDestroyFun_Aux@
+foreign import ccall safe "dynamic" hs_bindgen_72792d9b3626d47e_base ::
+     BG.FunPtr (BG.Ptr BG.Void -> HsBindgen.Runtime.LibC.Word64 -> IO ())
+  -> BG.Ptr BG.Void -> HsBindgen.Runtime.LibC.Word64 -> IO ()
+
+-- __unique:__ @fromDuckDBAggregateDestroyFun_Aux@
+hs_bindgen_72792d9b3626d47e ::
+     BG.FunPtr DuckDBAggregateDestroyFun_Aux
+  -> DuckDBAggregateDestroyFun_Aux
+hs_bindgen_72792d9b3626d47e =
+  \funPtr0 ->
+    DuckDBAggregateDestroyFun_Aux (\x1 ->
+                                     \x2 ->
+                                       hs_bindgen_72792d9b3626d47e_base (BG.castFunPtr funPtr0) (BG.toFFIType x1) (BG.toFFIType x2))
+
+instance BG.ToFunPtr DuckDBAggregateDestroyFun_Aux where
+
+  toFunPtr = hs_bindgen_7d4ad922621df3cd
+
+instance BG.FromFunPtr DuckDBAggregateDestroyFun_Aux where
+
+  fromFunPtr = hs_bindgen_72792d9b3626d47e
+
+instance ( ty ~ (BG.Ptr DuckDBAggregateState -> DuckDBIdx -> IO ())
+         ) => BG.CompatHasField.HasField "unwrap" DuckDBAggregateDestroyFun_Aux ty where
+
+  hasField =
+    \x0 ->
+      ( \y1 -> DuckDBAggregateDestroyFun_Aux {unwrap = y1}
+      , BG.getField @"unwrap" x0
+      )
+
+instance ( ty ~ (BG.Ptr DuckDBAggregateState -> DuckDBIdx -> IO ())
+         ) => BG.HasField "unwrap" (BG.Ptr DuckDBAggregateDestroyFun_Aux) (BG.Ptr ty) where
+
+  getField = HasCField.fromPtr (BG.Proxy @"unwrap")
+
+instance HasCField.HasCField DuckDBAggregateDestroyFun_Aux "unwrap" where
+
+  type CFieldType DuckDBAggregateDestroyFun_Aux "unwrap" =
+    BG.Ptr DuckDBAggregateState -> DuckDBIdx -> IO ()
+
+  offset# = \_ -> \_ -> 0
+
+{-| An optional function to destroy an aggregate state.
+
+    history:
+
+    * stable: v1.1.0
+
+    __C declaration:__ @duckdb_aggregate_destroy_t@
+
+    __defined at:__ @duckdb.h 1492:16@
+
+    __exported by:__ @duckdb.h@
+-}
+newtype DuckDBAggregateDestroyFun = DuckDBAggregateDestroyFun
+  { unwrap :: BG.FunPtr DuckDBAggregateDestroyFun_Aux
+  }
+  deriving stock (Eq, BG.Generic, Ord, Show)
+  deriving newtype
+    ( BG.HasFFIType
+    , Marshal.ReadRaw
+    , Marshal.StaticSize
+    , BG.Storable
+    , Marshal.WriteRaw
+    )
+
+instance ( ty ~ BG.FunPtr DuckDBAggregateDestroyFun_Aux
+         ) => BG.CompatHasField.HasField "unwrap" DuckDBAggregateDestroyFun ty where
+
+  hasField =
+    \x0 ->
+      (\y1 ->
+         DuckDBAggregateDestroyFun {unwrap = y1}, BG.getField @"unwrap" x0)
+
+instance ( ty ~ BG.FunPtr DuckDBAggregateDestroyFun_Aux
+         ) => BG.HasField "unwrap" (BG.Ptr DuckDBAggregateDestroyFun) (BG.Ptr ty) where
+
+  getField = HasCField.fromPtr (BG.Proxy @"unwrap")
+
+instance HasCField.HasCField DuckDBAggregateDestroyFun "unwrap" where
+
+  type CFieldType DuckDBAggregateDestroyFun "unwrap" =
+    BG.FunPtr DuckDBAggregateDestroyFun_Aux
+
+  offset# = \_ -> \_ -> 0
+
+{-| Auxiliary type used by t'DuckDBAggregateUpdateFun'
+
+    __C declaration:__ @duckdb_aggregate_update_t@
+
+    __defined at:__ @duckdb.h 1500:16@
+
+    __exported by:__ @duckdb.h@
+-}
+newtype DuckDBAggregateUpdateFun_Aux = DuckDBAggregateUpdateFun_Aux
+  { unwrap :: DuckDBFunctionInfo -> DuckDBDataChunk -> BG.Ptr DuckDBAggregateState -> IO ()
+  }
+  deriving stock (BG.Generic)
+
+-- __unique:__ @toDuckDBAggregateUpdateFun_Aux@
+foreign import ccall safe "wrapper" hs_bindgen_d4fd9371233e285c_base ::
+     (BG.Ptr BG.Void -> BG.Ptr BG.Void -> BG.Ptr BG.Void -> IO ())
+  -> IO (BG.FunPtr (BG.Ptr BG.Void -> BG.Ptr BG.Void -> BG.Ptr BG.Void -> IO ()))
+
+-- __unique:__ @toDuckDBAggregateUpdateFun_Aux@
+hs_bindgen_d4fd9371233e285c ::
+     DuckDBAggregateUpdateFun_Aux
+  -> IO (BG.FunPtr DuckDBAggregateUpdateFun_Aux)
+hs_bindgen_d4fd9371233e285c =
+  \fun0 ->
+    fmap BG.castFunPtr (hs_bindgen_d4fd9371233e285c_base (\x1 ->
+                                                            \x2 ->
+                                                              \x3 ->
+                                                                BG.getField @"unwrap" fun0 (BG.fromFFIType x1) (BG.fromFFIType x2) (BG.fromFFIType x3)))
+
+-- __unique:__ @fromDuckDBAggregateUpdateFun_Aux@
+foreign import ccall safe "dynamic" hs_bindgen_908fd23c59acf55b_base ::
+     BG.FunPtr (BG.Ptr BG.Void -> BG.Ptr BG.Void -> BG.Ptr BG.Void -> IO ())
+  -> BG.Ptr BG.Void -> BG.Ptr BG.Void -> BG.Ptr BG.Void -> IO ()
+
+-- __unique:__ @fromDuckDBAggregateUpdateFun_Aux@
+hs_bindgen_908fd23c59acf55b ::
+     BG.FunPtr DuckDBAggregateUpdateFun_Aux
+  -> DuckDBAggregateUpdateFun_Aux
+hs_bindgen_908fd23c59acf55b =
+  \funPtr0 ->
+    DuckDBAggregateUpdateFun_Aux (\x1 ->
+                                    \x2 ->
+                                      \x3 ->
+                                        hs_bindgen_908fd23c59acf55b_base (BG.castFunPtr funPtr0) (BG.toFFIType x1) (BG.toFFIType x2) (BG.toFFIType x3))
+
+instance BG.ToFunPtr DuckDBAggregateUpdateFun_Aux where
+
+  toFunPtr = hs_bindgen_d4fd9371233e285c
+
+instance BG.FromFunPtr DuckDBAggregateUpdateFun_Aux where
+
+  fromFunPtr = hs_bindgen_908fd23c59acf55b
+
+instance ( ty ~ (DuckDBFunctionInfo -> DuckDBDataChunk -> BG.Ptr DuckDBAggregateState -> IO ())
+         ) => BG.CompatHasField.HasField "unwrap" DuckDBAggregateUpdateFun_Aux ty where
+
+  hasField =
+    \x0 ->
+      (\y1 ->
+         DuckDBAggregateUpdateFun_Aux {unwrap = y1}, BG.getField @"unwrap" x0)
+
+instance ( ty ~ (DuckDBFunctionInfo -> DuckDBDataChunk -> BG.Ptr DuckDBAggregateState -> IO ())
+         ) => BG.HasField "unwrap" (BG.Ptr DuckDBAggregateUpdateFun_Aux) (BG.Ptr ty) where
+
+  getField = HasCField.fromPtr (BG.Proxy @"unwrap")
+
+instance HasCField.HasCField DuckDBAggregateUpdateFun_Aux "unwrap" where
+
+  type CFieldType DuckDBAggregateUpdateFun_Aux "unwrap" =
+    DuckDBFunctionInfo -> DuckDBDataChunk -> BG.Ptr DuckDBAggregateState -> IO ()
+
+  offset# = \_ -> \_ -> 0
+
+{-| A function to update a set of aggregate states with new values.
+
+    history:
+
+    * stable: v1.1.0
+
+    __C declaration:__ @duckdb_aggregate_update_t@
+
+    __defined at:__ @duckdb.h 1500:16@
+
+    __exported by:__ @duckdb.h@
+-}
+newtype DuckDBAggregateUpdateFun = DuckDBAggregateUpdateFun
+  { unwrap :: BG.FunPtr DuckDBAggregateUpdateFun_Aux
+  }
+  deriving stock (Eq, BG.Generic, Ord, Show)
+  deriving newtype
+    ( BG.HasFFIType
+    , Marshal.ReadRaw
+    , Marshal.StaticSize
+    , BG.Storable
+    , Marshal.WriteRaw
+    )
+
+instance ( ty ~ BG.FunPtr DuckDBAggregateUpdateFun_Aux
+         ) => BG.CompatHasField.HasField "unwrap" DuckDBAggregateUpdateFun ty where
+
+  hasField =
+    \x0 ->
+      (\y1 ->
+         DuckDBAggregateUpdateFun {unwrap = y1}, BG.getField @"unwrap" x0)
+
+instance ( ty ~ BG.FunPtr DuckDBAggregateUpdateFun_Aux
+         ) => BG.HasField "unwrap" (BG.Ptr DuckDBAggregateUpdateFun) (BG.Ptr ty) where
+
+  getField = HasCField.fromPtr (BG.Proxy @"unwrap")
+
+instance HasCField.HasCField DuckDBAggregateUpdateFun "unwrap" where
+
+  type CFieldType DuckDBAggregateUpdateFun "unwrap" =
+    BG.FunPtr DuckDBAggregateUpdateFun_Aux
+
+  offset# = \_ -> \_ -> 0
+
+{-| Auxiliary type used by t'DuckDBAggregateCombineFun'
+
+    __C declaration:__ @duckdb_aggregate_combine_t@
+
+    __defined at:__ @duckdb.h 1509:16@
+
+    __exported by:__ @duckdb.h@
+-}
+newtype DuckDBAggregateCombineFun_Aux = DuckDBAggregateCombineFun_Aux
+  { unwrap :: DuckDBFunctionInfo -> BG.Ptr DuckDBAggregateState -> BG.Ptr DuckDBAggregateState -> DuckDBIdx -> IO ()
+  }
+  deriving stock (BG.Generic)
+
+-- __unique:__ @toDuckDBAggregateCombineFun_Aux@
+foreign import ccall safe "wrapper" hs_bindgen_1161e149188b237c_base ::
+     (BG.Ptr BG.Void -> BG.Ptr BG.Void -> BG.Ptr BG.Void -> HsBindgen.Runtime.LibC.Word64 -> IO ())
+  -> IO (BG.FunPtr (BG.Ptr BG.Void -> BG.Ptr BG.Void -> BG.Ptr BG.Void -> HsBindgen.Runtime.LibC.Word64 -> IO ()))
+
+-- __unique:__ @toDuckDBAggregateCombineFun_Aux@
+hs_bindgen_1161e149188b237c ::
+     DuckDBAggregateCombineFun_Aux
+  -> IO (BG.FunPtr DuckDBAggregateCombineFun_Aux)
+hs_bindgen_1161e149188b237c =
+  \fun0 ->
+    fmap BG.castFunPtr (hs_bindgen_1161e149188b237c_base (\x1 ->
+                                                            \x2 ->
+                                                              \x3 ->
+                                                                \x4 ->
+                                                                  BG.getField @"unwrap" fun0 (BG.fromFFIType x1) (BG.fromFFIType x2) (BG.fromFFIType x3) (BG.fromFFIType x4)))
+
+-- __unique:__ @fromDuckDBAggregateCombineFun_Aux@
+foreign import ccall safe "dynamic" hs_bindgen_8bb9fd204182e149_base ::
+     BG.FunPtr (BG.Ptr BG.Void -> BG.Ptr BG.Void -> BG.Ptr BG.Void -> HsBindgen.Runtime.LibC.Word64 -> IO ())
+  -> BG.Ptr BG.Void -> BG.Ptr BG.Void -> BG.Ptr BG.Void -> HsBindgen.Runtime.LibC.Word64 -> IO ()
+
+-- __unique:__ @fromDuckDBAggregateCombineFun_Aux@
+hs_bindgen_8bb9fd204182e149 ::
+     BG.FunPtr DuckDBAggregateCombineFun_Aux
+  -> DuckDBAggregateCombineFun_Aux
+hs_bindgen_8bb9fd204182e149 =
+  \funPtr0 ->
+    DuckDBAggregateCombineFun_Aux (\x1 ->
+                                     \x2 ->
+                                       \x3 ->
+                                         \x4 ->
+                                           hs_bindgen_8bb9fd204182e149_base (BG.castFunPtr funPtr0) (BG.toFFIType x1) (BG.toFFIType x2) (BG.toFFIType x3) (BG.toFFIType x4))
+
+instance BG.ToFunPtr DuckDBAggregateCombineFun_Aux where
+
+  toFunPtr = hs_bindgen_1161e149188b237c
+
+instance BG.FromFunPtr DuckDBAggregateCombineFun_Aux where
+
+  fromFunPtr = hs_bindgen_8bb9fd204182e149
+
+instance ( ty ~ (DuckDBFunctionInfo -> BG.Ptr DuckDBAggregateState -> BG.Ptr DuckDBAggregateState -> DuckDBIdx -> IO ())
+         ) => BG.CompatHasField.HasField "unwrap" DuckDBAggregateCombineFun_Aux ty where
+
+  hasField =
+    \x0 ->
+      ( \y1 -> DuckDBAggregateCombineFun_Aux {unwrap = y1}
+      , BG.getField @"unwrap" x0
+      )
+
+instance ( ty ~ (DuckDBFunctionInfo -> BG.Ptr DuckDBAggregateState -> BG.Ptr DuckDBAggregateState -> DuckDBIdx -> IO ())
+         ) => BG.HasField "unwrap" (BG.Ptr DuckDBAggregateCombineFun_Aux) (BG.Ptr ty) where
+
+  getField = HasCField.fromPtr (BG.Proxy @"unwrap")
+
+instance HasCField.HasCField DuckDBAggregateCombineFun_Aux "unwrap" where
+
+  type CFieldType DuckDBAggregateCombineFun_Aux "unwrap" =
+    DuckDBFunctionInfo -> BG.Ptr DuckDBAggregateState -> BG.Ptr DuckDBAggregateState -> DuckDBIdx -> IO ()
+
+  offset# = \_ -> \_ -> 0
+
+{-| A function to combine aggregate states.
+
+    history:
+
+    * stable: v1.1.0
+
+    __C declaration:__ @duckdb_aggregate_combine_t@
+
+    __defined at:__ @duckdb.h 1509:16@
+
+    __exported by:__ @duckdb.h@
+-}
+newtype DuckDBAggregateCombineFun = DuckDBAggregateCombineFun
+  { unwrap :: BG.FunPtr DuckDBAggregateCombineFun_Aux
+  }
+  deriving stock (Eq, BG.Generic, Ord, Show)
+  deriving newtype
+    ( BG.HasFFIType
+    , Marshal.ReadRaw
+    , Marshal.StaticSize
+    , BG.Storable
+    , Marshal.WriteRaw
+    )
+
+instance ( ty ~ BG.FunPtr DuckDBAggregateCombineFun_Aux
+         ) => BG.CompatHasField.HasField "unwrap" DuckDBAggregateCombineFun ty where
+
+  hasField =
+    \x0 ->
+      (\y1 ->
+         DuckDBAggregateCombineFun {unwrap = y1}, BG.getField @"unwrap" x0)
+
+instance ( ty ~ BG.FunPtr DuckDBAggregateCombineFun_Aux
+         ) => BG.HasField "unwrap" (BG.Ptr DuckDBAggregateCombineFun) (BG.Ptr ty) where
+
+  getField = HasCField.fromPtr (BG.Proxy @"unwrap")
+
+instance HasCField.HasCField DuckDBAggregateCombineFun "unwrap" where
+
+  type CFieldType DuckDBAggregateCombineFun "unwrap" =
+    BG.FunPtr DuckDBAggregateCombineFun_Aux
+
+  offset# = \_ -> \_ -> 0
+
+{-| Auxiliary type used by t'DuckDBAggregateFinalizeFun'
+
+    __C declaration:__ @duckdb_aggregate_finalize_t@
+
+    __defined at:__ @duckdb.h 1518:16@
+
+    __exported by:__ @duckdb.h@
+-}
+newtype DuckDBAggregateFinalizeFun_Aux = DuckDBAggregateFinalizeFun_Aux
+  { unwrap :: DuckDBFunctionInfo -> BG.Ptr DuckDBAggregateState -> DuckDBVector -> DuckDBIdx -> DuckDBIdx -> IO ()
+  }
+  deriving stock (BG.Generic)
+
+-- __unique:__ @toDuckDBAggregateFinalizeFun_Aux@
+foreign import ccall safe "wrapper" hs_bindgen_75fe0b8164aa4652_base ::
+     (BG.Ptr BG.Void -> BG.Ptr BG.Void -> BG.Ptr BG.Void -> HsBindgen.Runtime.LibC.Word64 -> HsBindgen.Runtime.LibC.Word64 -> IO ())
+  -> IO (BG.FunPtr (BG.Ptr BG.Void -> BG.Ptr BG.Void -> BG.Ptr BG.Void -> HsBindgen.Runtime.LibC.Word64 -> HsBindgen.Runtime.LibC.Word64 -> IO ()))
+
+-- __unique:__ @toDuckDBAggregateFinalizeFun_Aux@
+hs_bindgen_75fe0b8164aa4652 ::
+     DuckDBAggregateFinalizeFun_Aux
+  -> IO (BG.FunPtr DuckDBAggregateFinalizeFun_Aux)
+hs_bindgen_75fe0b8164aa4652 =
+  \fun0 ->
+    fmap BG.castFunPtr (hs_bindgen_75fe0b8164aa4652_base (\x1 ->
+                                                            \x2 ->
+                                                              \x3 ->
+                                                                \x4 ->
+                                                                  \x5 ->
+                                                                    BG.getField @"unwrap" fun0 (BG.fromFFIType x1) (BG.fromFFIType x2) (BG.fromFFIType x3) (BG.fromFFIType x4) (BG.fromFFIType x5)))
+
+-- __unique:__ @fromDuckDBAggregateFinalizeFun_Aux@
+foreign import ccall safe "dynamic" hs_bindgen_4f85ea442f82149c_base ::
+     BG.FunPtr (BG.Ptr BG.Void -> BG.Ptr BG.Void -> BG.Ptr BG.Void -> HsBindgen.Runtime.LibC.Word64 -> HsBindgen.Runtime.LibC.Word64 -> IO ())
+  -> BG.Ptr BG.Void -> BG.Ptr BG.Void -> BG.Ptr BG.Void -> HsBindgen.Runtime.LibC.Word64 -> HsBindgen.Runtime.LibC.Word64 -> IO ()
+
+-- __unique:__ @fromDuckDBAggregateFinalizeFun_Aux@
+hs_bindgen_4f85ea442f82149c ::
+     BG.FunPtr DuckDBAggregateFinalizeFun_Aux
+  -> DuckDBAggregateFinalizeFun_Aux
+hs_bindgen_4f85ea442f82149c =
+  \funPtr0 ->
+    DuckDBAggregateFinalizeFun_Aux (\x1 ->
+                                      \x2 ->
+                                        \x3 ->
+                                          \x4 ->
+                                            \x5 ->
+                                              hs_bindgen_4f85ea442f82149c_base (BG.castFunPtr funPtr0) (BG.toFFIType x1) (BG.toFFIType x2) (BG.toFFIType x3) (BG.toFFIType x4) (BG.toFFIType x5))
+
+instance BG.ToFunPtr DuckDBAggregateFinalizeFun_Aux where
+
+  toFunPtr = hs_bindgen_75fe0b8164aa4652
+
+instance BG.FromFunPtr DuckDBAggregateFinalizeFun_Aux where
+
+  fromFunPtr = hs_bindgen_4f85ea442f82149c
+
+instance ( ty ~ (DuckDBFunctionInfo -> BG.Ptr DuckDBAggregateState -> DuckDBVector -> DuckDBIdx -> DuckDBIdx -> IO ())
+         ) => BG.CompatHasField.HasField "unwrap" DuckDBAggregateFinalizeFun_Aux ty where
+
+  hasField =
+    \x0 ->
+      ( \y1 -> DuckDBAggregateFinalizeFun_Aux {unwrap = y1}
+      , BG.getField @"unwrap" x0
+      )
+
+instance ( ty ~ (DuckDBFunctionInfo -> BG.Ptr DuckDBAggregateState -> DuckDBVector -> DuckDBIdx -> DuckDBIdx -> IO ())
+         ) => BG.HasField "unwrap" (BG.Ptr DuckDBAggregateFinalizeFun_Aux) (BG.Ptr ty) where
+
+  getField = HasCField.fromPtr (BG.Proxy @"unwrap")
+
+instance HasCField.HasCField DuckDBAggregateFinalizeFun_Aux "unwrap" where
+
+  type CFieldType DuckDBAggregateFinalizeFun_Aux "unwrap" =
+    DuckDBFunctionInfo -> BG.Ptr DuckDBAggregateState -> DuckDBVector -> DuckDBIdx -> DuckDBIdx -> IO ()
+
+  offset# = \_ -> \_ -> 0
+
+{-| A function to finalize aggregate states into a result vector.
+
+    history:
+
+    * stable: v1.1.0
+
+    __C declaration:__ @duckdb_aggregate_finalize_t@
+
+    __defined at:__ @duckdb.h 1518:16@
+
+    __exported by:__ @duckdb.h@
+-}
+newtype DuckDBAggregateFinalizeFun = DuckDBAggregateFinalizeFun
+  { unwrap :: BG.FunPtr DuckDBAggregateFinalizeFun_Aux
+  }
+  deriving stock (Eq, BG.Generic, Ord, Show)
+  deriving newtype
+    ( BG.HasFFIType
+    , Marshal.ReadRaw
+    , Marshal.StaticSize
+    , BG.Storable
+    , Marshal.WriteRaw
+    )
+
+instance ( ty ~ BG.FunPtr DuckDBAggregateFinalizeFun_Aux
+         ) => BG.CompatHasField.HasField "unwrap" DuckDBAggregateFinalizeFun ty where
+
+  hasField =
+    \x0 ->
+      (\y1 ->
+         DuckDBAggregateFinalizeFun {unwrap = y1}, BG.getField @"unwrap" x0)
+
+instance ( ty ~ BG.FunPtr DuckDBAggregateFinalizeFun_Aux
+         ) => BG.HasField "unwrap" (BG.Ptr DuckDBAggregateFinalizeFun) (BG.Ptr ty) where
+
+  getField = HasCField.fromPtr (BG.Proxy @"unwrap")
+
+instance HasCField.HasCField DuckDBAggregateFinalizeFun "unwrap" where
+
+  type CFieldType DuckDBAggregateFinalizeFun "unwrap" =
+    BG.FunPtr DuckDBAggregateFinalizeFun_Aux
+
+  offset# = \_ -> \_ -> 0
+
+{-| Auxiliary type used by t'DuckDBScalarFunctionBindFun'
+
+    __C declaration:__ @duckdb_scalar_function_bind_t@
+
+    __defined at:__ @duckdb.h 1528:16@
+
+    __exported by:__ @duckdb.h@
+-}
+newtype DuckDBScalarFunctionBindFun_Aux = DuckDBScalarFunctionBindFun_Aux
+  { unwrap :: DuckDBBindInfo -> IO ()
+  }
+  deriving stock (BG.Generic)
+
+-- __unique:__ @toDuckDBScalarFunctionBindFun_Aux@
+foreign import ccall safe "wrapper" hs_bindgen_b447efceabd3b194_base ::
+     (BG.Ptr BG.Void -> IO ())
+  -> IO (BG.FunPtr (BG.Ptr BG.Void -> IO ()))
+
+-- __unique:__ @toDuckDBScalarFunctionBindFun_Aux@
+hs_bindgen_b447efceabd3b194 ::
+     DuckDBScalarFunctionBindFun_Aux
+  -> IO (BG.FunPtr DuckDBScalarFunctionBindFun_Aux)
+hs_bindgen_b447efceabd3b194 =
+  \fun0 ->
+    fmap BG.castFunPtr (hs_bindgen_b447efceabd3b194_base (\x1 ->
+                                                            BG.getField @"unwrap" fun0 (BG.fromFFIType x1)))
+
+-- __unique:__ @fromDuckDBScalarFunctionBindFun_Aux@
+foreign import ccall safe "dynamic" hs_bindgen_baa1cac10cd218b0_base ::
+     BG.FunPtr (BG.Ptr BG.Void -> IO ())
+  -> BG.Ptr BG.Void -> IO ()
+
+-- __unique:__ @fromDuckDBScalarFunctionBindFun_Aux@
+hs_bindgen_baa1cac10cd218b0 ::
+     BG.FunPtr DuckDBScalarFunctionBindFun_Aux
+  -> DuckDBScalarFunctionBindFun_Aux
+hs_bindgen_baa1cac10cd218b0 =
+  \funPtr0 ->
+    DuckDBScalarFunctionBindFun_Aux (\x1 ->
+                                       hs_bindgen_baa1cac10cd218b0_base (BG.castFunPtr funPtr0) (BG.toFFIType x1))
+
+instance BG.ToFunPtr DuckDBScalarFunctionBindFun_Aux where
+
+  toFunPtr = hs_bindgen_b447efceabd3b194
+
+instance BG.FromFunPtr DuckDBScalarFunctionBindFun_Aux where
+
+  fromFunPtr = hs_bindgen_baa1cac10cd218b0
+
+instance ( ty ~ (DuckDBBindInfo -> IO ())
+         ) => BG.CompatHasField.HasField "unwrap" DuckDBScalarFunctionBindFun_Aux ty where
+
+  hasField =
+    \x0 ->
+      ( \y1 ->
+          DuckDBScalarFunctionBindFun_Aux {unwrap = y1}
+      , BG.getField @"unwrap" x0
+      )
+
+instance ( ty ~ (DuckDBBindInfo -> IO ())
+         ) => BG.HasField "unwrap" (BG.Ptr DuckDBScalarFunctionBindFun_Aux) (BG.Ptr ty) where
+
+  getField = HasCField.fromPtr (BG.Proxy @"unwrap")
+
+instance HasCField.HasCField DuckDBScalarFunctionBindFun_Aux "unwrap" where
+
+  type CFieldType DuckDBScalarFunctionBindFun_Aux "unwrap" =
+    DuckDBBindInfo -> IO ()
+
+  offset# = \_ -> \_ -> 0
+
+{-| The bind function of a scalar function.
+
+    history:
+
+    * unstable: v1.3.0
+
+    * stable: v1.5.6
+
+    __C declaration:__ @duckdb_scalar_function_bind_t@
+
+    __defined at:__ @duckdb.h 1528:16@
+
+    __exported by:__ @duckdb.h@
+-}
+newtype DuckDBScalarFunctionBindFun = DuckDBScalarFunctionBindFun
+  { unwrap :: BG.FunPtr DuckDBScalarFunctionBindFun_Aux
+  }
+  deriving stock (Eq, BG.Generic, Ord, Show)
+  deriving newtype
+    ( BG.HasFFIType
+    , Marshal.ReadRaw
+    , Marshal.StaticSize
+    , BG.Storable
+    , Marshal.WriteRaw
+    )
+
+instance ( ty ~ BG.FunPtr DuckDBScalarFunctionBindFun_Aux
+         ) => BG.CompatHasField.HasField "unwrap" DuckDBScalarFunctionBindFun ty where
+
+  hasField =
+    \x0 ->
+      (\y1 ->
+         DuckDBScalarFunctionBindFun {unwrap = y1}, BG.getField @"unwrap" x0)
+
+instance ( ty ~ BG.FunPtr DuckDBScalarFunctionBindFun_Aux
+         ) => BG.HasField "unwrap" (BG.Ptr DuckDBScalarFunctionBindFun) (BG.Ptr ty) where
+
+  getField = HasCField.fromPtr (BG.Proxy @"unwrap")
+
+instance HasCField.HasCField DuckDBScalarFunctionBindFun "unwrap" where
+
+  type CFieldType DuckDBScalarFunctionBindFun "unwrap" =
+    BG.FunPtr DuckDBScalarFunctionBindFun_Aux
+
+  offset# = \_ -> \_ -> 0
+
+{-| Auxiliary type used by t'DuckDBScalarFunctionInitFun'
+
+    __C declaration:__ @duckdb_scalar_function_init_t@
+
+    __defined at:__ @duckdb.h 1537:16@
+
+    __exported by:__ @duckdb.h@
+-}
+newtype DuckDBScalarFunctionInitFun_Aux = DuckDBScalarFunctionInitFun_Aux
+  { unwrap :: DuckDBInitInfo -> IO ()
+  }
+  deriving stock (BG.Generic)
+
+-- __unique:__ @toDuckDBScalarFunctionInitFun_Aux@
+foreign import ccall safe "wrapper" hs_bindgen_a710dd27822696d0_base ::
+     (BG.Ptr BG.Void -> IO ())
+  -> IO (BG.FunPtr (BG.Ptr BG.Void -> IO ()))
+
+-- __unique:__ @toDuckDBScalarFunctionInitFun_Aux@
+hs_bindgen_a710dd27822696d0 ::
+     DuckDBScalarFunctionInitFun_Aux
+  -> IO (BG.FunPtr DuckDBScalarFunctionInitFun_Aux)
+hs_bindgen_a710dd27822696d0 =
+  \fun0 ->
+    fmap BG.castFunPtr (hs_bindgen_a710dd27822696d0_base (\x1 ->
+                                                            BG.getField @"unwrap" fun0 (BG.fromFFIType x1)))
+
+-- __unique:__ @fromDuckDBScalarFunctionInitFun_Aux@
+foreign import ccall safe "dynamic" hs_bindgen_71d6ff240a569772_base ::
+     BG.FunPtr (BG.Ptr BG.Void -> IO ())
+  -> BG.Ptr BG.Void -> IO ()
+
+-- __unique:__ @fromDuckDBScalarFunctionInitFun_Aux@
+hs_bindgen_71d6ff240a569772 ::
+     BG.FunPtr DuckDBScalarFunctionInitFun_Aux
+  -> DuckDBScalarFunctionInitFun_Aux
+hs_bindgen_71d6ff240a569772 =
+  \funPtr0 ->
+    DuckDBScalarFunctionInitFun_Aux (\x1 ->
+                                       hs_bindgen_71d6ff240a569772_base (BG.castFunPtr funPtr0) (BG.toFFIType x1))
+
+instance BG.ToFunPtr DuckDBScalarFunctionInitFun_Aux where
+
+  toFunPtr = hs_bindgen_a710dd27822696d0
+
+instance BG.FromFunPtr DuckDBScalarFunctionInitFun_Aux where
+
+  fromFunPtr = hs_bindgen_71d6ff240a569772
+
+instance ( ty ~ (DuckDBInitInfo -> IO ())
+         ) => BG.CompatHasField.HasField "unwrap" DuckDBScalarFunctionInitFun_Aux ty where
+
+  hasField =
+    \x0 ->
+      ( \y1 ->
+          DuckDBScalarFunctionInitFun_Aux {unwrap = y1}
+      , BG.getField @"unwrap" x0
+      )
+
+instance ( ty ~ (DuckDBInitInfo -> IO ())
+         ) => BG.HasField "unwrap" (BG.Ptr DuckDBScalarFunctionInitFun_Aux) (BG.Ptr ty) where
+
+  getField = HasCField.fromPtr (BG.Proxy @"unwrap")
+
+instance HasCField.HasCField DuckDBScalarFunctionInitFun_Aux "unwrap" where
+
+  type CFieldType DuckDBScalarFunctionInitFun_Aux "unwrap" =
+    DuckDBInitInfo -> IO ()
+
+  offset# = \_ -> \_ -> 0
+
+{-| The init function of a scalar function.
+
+    history:
+
+    * unstable: v1.5.0
+
+    * stable: v1.5.6
+
+    __C declaration:__ @duckdb_scalar_function_init_t@
+
+    __defined at:__ @duckdb.h 1537:16@
+
+    __exported by:__ @duckdb.h@
+-}
+newtype DuckDBScalarFunctionInitFun = DuckDBScalarFunctionInitFun
+  { unwrap :: BG.FunPtr DuckDBScalarFunctionInitFun_Aux
+  }
+  deriving stock (Eq, BG.Generic, Ord, Show)
+  deriving newtype
+    ( BG.HasFFIType
+    , Marshal.ReadRaw
+    , Marshal.StaticSize
+    , BG.Storable
+    , Marshal.WriteRaw
+    )
+
+instance ( ty ~ BG.FunPtr DuckDBScalarFunctionInitFun_Aux
+         ) => BG.CompatHasField.HasField "unwrap" DuckDBScalarFunctionInitFun ty where
+
+  hasField =
+    \x0 ->
+      (\y1 ->
+         DuckDBScalarFunctionInitFun {unwrap = y1}, BG.getField @"unwrap" x0)
+
+instance ( ty ~ BG.FunPtr DuckDBScalarFunctionInitFun_Aux
+         ) => BG.HasField "unwrap" (BG.Ptr DuckDBScalarFunctionInitFun) (BG.Ptr ty) where
+
+  getField = HasCField.fromPtr (BG.Proxy @"unwrap")
+
+instance HasCField.HasCField DuckDBScalarFunctionInitFun "unwrap" where
+
+  type CFieldType DuckDBScalarFunctionInitFun "unwrap" =
+    BG.FunPtr DuckDBScalarFunctionInitFun_Aux
+
+  offset# = \_ -> \_ -> 0
+
+{-| Auxiliary type used by t'DuckDBScalarFunctionFun'
+
+    __C declaration:__ @duckdb_scalar_function_t@
+
+    __defined at:__ @duckdb.h 1545:16@
+
+    __exported by:__ @duckdb.h@
+-}
+newtype DuckDBScalarFunctionFun_Aux = DuckDBScalarFunctionFun_Aux
+  { unwrap :: DuckDBFunctionInfo -> DuckDBDataChunk -> DuckDBVector -> IO ()
+  }
+  deriving stock (BG.Generic)
+
+-- __unique:__ @toDuckDBScalarFunctionFun_Aux@
+foreign import ccall safe "wrapper" hs_bindgen_eda963ff265a4fb9_base ::
+     (BG.Ptr BG.Void -> BG.Ptr BG.Void -> BG.Ptr BG.Void -> IO ())
+  -> IO (BG.FunPtr (BG.Ptr BG.Void -> BG.Ptr BG.Void -> BG.Ptr BG.Void -> IO ()))
+
+-- __unique:__ @toDuckDBScalarFunctionFun_Aux@
+hs_bindgen_eda963ff265a4fb9 ::
+     DuckDBScalarFunctionFun_Aux
+  -> IO (BG.FunPtr DuckDBScalarFunctionFun_Aux)
+hs_bindgen_eda963ff265a4fb9 =
+  \fun0 ->
+    fmap BG.castFunPtr (hs_bindgen_eda963ff265a4fb9_base (\x1 ->
+                                                            \x2 ->
+                                                              \x3 ->
+                                                                BG.getField @"unwrap" fun0 (BG.fromFFIType x1) (BG.fromFFIType x2) (BG.fromFFIType x3)))
+
+-- __unique:__ @fromDuckDBScalarFunctionFun_Aux@
+foreign import ccall safe "dynamic" hs_bindgen_a054f63c36dae166_base ::
+     BG.FunPtr (BG.Ptr BG.Void -> BG.Ptr BG.Void -> BG.Ptr BG.Void -> IO ())
+  -> BG.Ptr BG.Void -> BG.Ptr BG.Void -> BG.Ptr BG.Void -> IO ()
+
+-- __unique:__ @fromDuckDBScalarFunctionFun_Aux@
+hs_bindgen_a054f63c36dae166 ::
+     BG.FunPtr DuckDBScalarFunctionFun_Aux
+  -> DuckDBScalarFunctionFun_Aux
+hs_bindgen_a054f63c36dae166 =
+  \funPtr0 ->
+    DuckDBScalarFunctionFun_Aux (\x1 ->
+                                   \x2 ->
+                                     \x3 ->
+                                       hs_bindgen_a054f63c36dae166_base (BG.castFunPtr funPtr0) (BG.toFFIType x1) (BG.toFFIType x2) (BG.toFFIType x3))
+
+instance BG.ToFunPtr DuckDBScalarFunctionFun_Aux where
+
+  toFunPtr = hs_bindgen_eda963ff265a4fb9
+
+instance BG.FromFunPtr DuckDBScalarFunctionFun_Aux where
+
+  fromFunPtr = hs_bindgen_a054f63c36dae166
+
+instance ( ty ~ (DuckDBFunctionInfo -> DuckDBDataChunk -> DuckDBVector -> IO ())
+         ) => BG.CompatHasField.HasField "unwrap" DuckDBScalarFunctionFun_Aux ty where
+
+  hasField =
+    \x0 ->
+      (\y1 ->
+         DuckDBScalarFunctionFun_Aux {unwrap = y1}, BG.getField @"unwrap" x0)
+
+instance ( ty ~ (DuckDBFunctionInfo -> DuckDBDataChunk -> DuckDBVector -> IO ())
+         ) => BG.HasField "unwrap" (BG.Ptr DuckDBScalarFunctionFun_Aux) (BG.Ptr ty) where
+
+  getField = HasCField.fromPtr (BG.Proxy @"unwrap")
+
+instance HasCField.HasCField DuckDBScalarFunctionFun_Aux "unwrap" where
+
+  type CFieldType DuckDBScalarFunctionFun_Aux "unwrap" =
+    DuckDBFunctionInfo -> DuckDBDataChunk -> DuckDBVector -> IO ()
+
+  offset# = \_ -> \_ -> 0
+
+{-| The main function of a scalar function.
+
+    history:
+
+    * stable: v1.1.0
+
+    __C declaration:__ @duckdb_scalar_function_t@
+
+    __defined at:__ @duckdb.h 1545:16@
+
+    __exported by:__ @duckdb.h@
+-}
+newtype DuckDBScalarFunctionFun = DuckDBScalarFunctionFun
+  { unwrap :: BG.FunPtr DuckDBScalarFunctionFun_Aux
+  }
+  deriving stock (Eq, BG.Generic, Ord, Show)
+  deriving newtype
+    ( BG.HasFFIType
+    , Marshal.ReadRaw
+    , Marshal.StaticSize
+    , BG.Storable
+    , Marshal.WriteRaw
+    )
+
+instance ( ty ~ BG.FunPtr DuckDBScalarFunctionFun_Aux
+         ) => BG.CompatHasField.HasField "unwrap" DuckDBScalarFunctionFun ty where
+
+  hasField =
+    \x0 ->
+      (\y1 ->
+         DuckDBScalarFunctionFun {unwrap = y1}, BG.getField @"unwrap" x0)
+
+instance ( ty ~ BG.FunPtr DuckDBScalarFunctionFun_Aux
+         ) => BG.HasField "unwrap" (BG.Ptr DuckDBScalarFunctionFun) (BG.Ptr ty) where
+
+  getField = HasCField.fromPtr (BG.Proxy @"unwrap")
+
+instance HasCField.HasCField DuckDBScalarFunctionFun "unwrap" where
+
+  type CFieldType DuckDBScalarFunctionFun "unwrap" =
+    BG.FunPtr DuckDBScalarFunctionFun_Aux
+
+  offset# = \_ -> \_ -> 0
+
+{-| Auxiliary type used by t'DuckDBCastFunctionFun'
+
+    __C declaration:__ @duckdb_cast_function_t@
+
+    __defined at:__ @duckdb.h 1553:16@
+
+    __exported by:__ @duckdb.h@
+-}
+newtype DuckDBCastFunctionFun_Aux = DuckDBCastFunctionFun_Aux
+  { unwrap :: DuckDBFunctionInfo -> DuckDBIdx -> DuckDBVector -> DuckDBVector -> IO BG.CBool
+  }
+  deriving stock (BG.Generic)
+
+-- __unique:__ @toDuckDBCastFunctionFun_Aux@
+foreign import ccall safe "wrapper" hs_bindgen_9cc1e81196c8aecb_base ::
+     (BG.Ptr BG.Void -> HsBindgen.Runtime.LibC.Word64 -> BG.Ptr BG.Void -> BG.Ptr BG.Void -> IO BG.CBool)
+  -> IO (BG.FunPtr (BG.Ptr BG.Void -> HsBindgen.Runtime.LibC.Word64 -> BG.Ptr BG.Void -> BG.Ptr BG.Void -> IO BG.CBool))
+
+-- __unique:__ @toDuckDBCastFunctionFun_Aux@
+hs_bindgen_9cc1e81196c8aecb ::
+     DuckDBCastFunctionFun_Aux
+  -> IO (BG.FunPtr DuckDBCastFunctionFun_Aux)
+hs_bindgen_9cc1e81196c8aecb =
+  \fun0 ->
+    fmap BG.castFunPtr (hs_bindgen_9cc1e81196c8aecb_base (\x1 ->
+                                                            \x2 ->
+                                                              \x3 ->
+                                                                \x4 ->
+                                                                  fmap BG.toFFIType (BG.getField @"unwrap" fun0 (BG.fromFFIType x1) (BG.fromFFIType x2) (BG.fromFFIType x3) (BG.fromFFIType x4))))
+
+-- __unique:__ @fromDuckDBCastFunctionFun_Aux@
+foreign import ccall safe "dynamic" hs_bindgen_e59e3217c0179ffd_base ::
+     BG.FunPtr (BG.Ptr BG.Void -> HsBindgen.Runtime.LibC.Word64 -> BG.Ptr BG.Void -> BG.Ptr BG.Void -> IO BG.CBool)
+  -> BG.Ptr BG.Void -> HsBindgen.Runtime.LibC.Word64 -> BG.Ptr BG.Void -> BG.Ptr BG.Void -> IO BG.CBool
+
+-- __unique:__ @fromDuckDBCastFunctionFun_Aux@
+hs_bindgen_e59e3217c0179ffd ::
+     BG.FunPtr DuckDBCastFunctionFun_Aux
+  -> DuckDBCastFunctionFun_Aux
+hs_bindgen_e59e3217c0179ffd =
+  \funPtr0 ->
+    DuckDBCastFunctionFun_Aux (\x1 ->
+                                 \x2 ->
+                                   \x3 ->
+                                     \x4 ->
+                                       fmap BG.fromFFIType (hs_bindgen_e59e3217c0179ffd_base (BG.castFunPtr funPtr0) (BG.toFFIType x1) (BG.toFFIType x2) (BG.toFFIType x3) (BG.toFFIType x4)))
+
+instance BG.ToFunPtr DuckDBCastFunctionFun_Aux where
+
+  toFunPtr = hs_bindgen_9cc1e81196c8aecb
+
+instance BG.FromFunPtr DuckDBCastFunctionFun_Aux where
+
+  fromFunPtr = hs_bindgen_e59e3217c0179ffd
+
+instance ( ty ~ (DuckDBFunctionInfo -> DuckDBIdx -> DuckDBVector -> DuckDBVector -> IO BG.CBool)
+         ) => BG.CompatHasField.HasField "unwrap" DuckDBCastFunctionFun_Aux ty where
+
+  hasField =
+    \x0 ->
+      (\y1 ->
+         DuckDBCastFunctionFun_Aux {unwrap = y1}, BG.getField @"unwrap" x0)
+
+instance ( ty ~ (DuckDBFunctionInfo -> DuckDBIdx -> DuckDBVector -> DuckDBVector -> IO BG.CBool)
+         ) => BG.HasField "unwrap" (BG.Ptr DuckDBCastFunctionFun_Aux) (BG.Ptr ty) where
+
+  getField = HasCField.fromPtr (BG.Proxy @"unwrap")
+
+instance HasCField.HasCField DuckDBCastFunctionFun_Aux "unwrap" where
+
+  type CFieldType DuckDBCastFunctionFun_Aux "unwrap" =
+    DuckDBFunctionInfo -> DuckDBIdx -> DuckDBVector -> DuckDBVector -> IO BG.CBool
+
+  offset# = \_ -> \_ -> 0
+
+{-| The function to cast from an input vector to an output vector.
+
+    history:
+
+    * stable: v1.1.0
+
+    __C declaration:__ @duckdb_cast_function_t@
+
+    __defined at:__ @duckdb.h 1553:16@
+
+    __exported by:__ @duckdb.h@
+-}
+newtype DuckDBCastFunctionFun = DuckDBCastFunctionFun
+  { unwrap :: BG.FunPtr DuckDBCastFunctionFun_Aux
+  }
+  deriving stock (Eq, BG.Generic, Ord, Show)
+  deriving newtype
+    ( BG.HasFFIType
+    , Marshal.ReadRaw
+    , Marshal.StaticSize
+    , BG.Storable
+    , Marshal.WriteRaw
+    )
+
+instance ( ty ~ BG.FunPtr DuckDBCastFunctionFun_Aux
+         ) => BG.CompatHasField.HasField "unwrap" DuckDBCastFunctionFun ty where
+
+  hasField =
+    \x0 ->
+      (\y1 ->
+         DuckDBCastFunctionFun {unwrap = y1}, BG.getField @"unwrap" x0)
+
+instance ( ty ~ BG.FunPtr DuckDBCastFunctionFun_Aux
+         ) => BG.HasField "unwrap" (BG.Ptr DuckDBCastFunctionFun) (BG.Ptr ty) where
+
+  getField = HasCField.fromPtr (BG.Proxy @"unwrap")
+
+instance HasCField.HasCField DuckDBCastFunctionFun "unwrap" where
+
+  type CFieldType DuckDBCastFunctionFun "unwrap" =
+    BG.FunPtr DuckDBCastFunctionFun_Aux
+
+  offset# = \_ -> \_ -> 0
+
+{-| Auxiliary type used by t'DuckDBCopyFunctionBindFun'
+
+    __C declaration:__ @duckdb_copy_function_bind_t@
+
+    __defined at:__ @duckdb.h 1563:16@
+
+    __exported by:__ @duckdb.h@
+-}
+newtype DuckDBCopyFunctionBindFun_Aux = DuckDBCopyFunctionBindFun_Aux
+  { unwrap :: DuckDBCopyFunctionBindInfo -> IO ()
+  }
+  deriving stock (BG.Generic)
+
+-- __unique:__ @toDuckDBCopyFunctionBindFun_Aux@
+foreign import ccall safe "wrapper" hs_bindgen_3b4ab83fb44c89b2_base ::
+     (BG.Ptr BG.Void -> IO ())
+  -> IO (BG.FunPtr (BG.Ptr BG.Void -> IO ()))
+
+-- __unique:__ @toDuckDBCopyFunctionBindFun_Aux@
+hs_bindgen_3b4ab83fb44c89b2 ::
+     DuckDBCopyFunctionBindFun_Aux
+  -> IO (BG.FunPtr DuckDBCopyFunctionBindFun_Aux)
+hs_bindgen_3b4ab83fb44c89b2 =
+  \fun0 ->
+    fmap BG.castFunPtr (hs_bindgen_3b4ab83fb44c89b2_base (\x1 ->
+                                                            BG.getField @"unwrap" fun0 (BG.fromFFIType x1)))
+
+-- __unique:__ @fromDuckDBCopyFunctionBindFun_Aux@
+foreign import ccall safe "dynamic" hs_bindgen_22dfbb4393b5f8b4_base ::
+     BG.FunPtr (BG.Ptr BG.Void -> IO ())
+  -> BG.Ptr BG.Void -> IO ()
+
+-- __unique:__ @fromDuckDBCopyFunctionBindFun_Aux@
+hs_bindgen_22dfbb4393b5f8b4 ::
+     BG.FunPtr DuckDBCopyFunctionBindFun_Aux
+  -> DuckDBCopyFunctionBindFun_Aux
+hs_bindgen_22dfbb4393b5f8b4 =
+  \funPtr0 ->
+    DuckDBCopyFunctionBindFun_Aux (\x1 ->
+                                     hs_bindgen_22dfbb4393b5f8b4_base (BG.castFunPtr funPtr0) (BG.toFFIType x1))
+
+instance BG.ToFunPtr DuckDBCopyFunctionBindFun_Aux where
+
+  toFunPtr = hs_bindgen_3b4ab83fb44c89b2
+
+instance BG.FromFunPtr DuckDBCopyFunctionBindFun_Aux where
+
+  fromFunPtr = hs_bindgen_22dfbb4393b5f8b4
+
+instance ( ty ~ (DuckDBCopyFunctionBindInfo -> IO ())
+         ) => BG.CompatHasField.HasField "unwrap" DuckDBCopyFunctionBindFun_Aux ty where
+
+  hasField =
+    \x0 ->
+      ( \y1 -> DuckDBCopyFunctionBindFun_Aux {unwrap = y1}
+      , BG.getField @"unwrap" x0
+      )
+
+instance ( ty ~ (DuckDBCopyFunctionBindInfo -> IO ())
+         ) => BG.HasField "unwrap" (BG.Ptr DuckDBCopyFunctionBindFun_Aux) (BG.Ptr ty) where
+
+  getField = HasCField.fromPtr (BG.Proxy @"unwrap")
+
+instance HasCField.HasCField DuckDBCopyFunctionBindFun_Aux "unwrap" where
+
+  type CFieldType DuckDBCopyFunctionBindFun_Aux "unwrap" =
+    DuckDBCopyFunctionBindInfo -> IO ()
+
+  offset# = \_ -> \_ -> 0
+
+{-| The bind function of a copy function.
+
+    history:
+
+    * unstable: v1.5.0
+
+    * stable: v1.5.6
+
+    __C declaration:__ @duckdb_copy_function_bind_t@
+
+    __defined at:__ @duckdb.h 1563:16@
+
+    __exported by:__ @duckdb.h@
+-}
+newtype DuckDBCopyFunctionBindFun = DuckDBCopyFunctionBindFun
+  { unwrap :: BG.FunPtr DuckDBCopyFunctionBindFun_Aux
+  }
+  deriving stock (Eq, BG.Generic, Ord, Show)
+  deriving newtype
+    ( BG.HasFFIType
+    , Marshal.ReadRaw
+    , Marshal.StaticSize
+    , BG.Storable
+    , Marshal.WriteRaw
+    )
+
+instance ( ty ~ BG.FunPtr DuckDBCopyFunctionBindFun_Aux
+         ) => BG.CompatHasField.HasField "unwrap" DuckDBCopyFunctionBindFun ty where
+
+  hasField =
+    \x0 ->
+      (\y1 ->
+         DuckDBCopyFunctionBindFun {unwrap = y1}, BG.getField @"unwrap" x0)
+
+instance ( ty ~ BG.FunPtr DuckDBCopyFunctionBindFun_Aux
+         ) => BG.HasField "unwrap" (BG.Ptr DuckDBCopyFunctionBindFun) (BG.Ptr ty) where
+
+  getField = HasCField.fromPtr (BG.Proxy @"unwrap")
+
+instance HasCField.HasCField DuckDBCopyFunctionBindFun "unwrap" where
+
+  type CFieldType DuckDBCopyFunctionBindFun "unwrap" =
+    BG.FunPtr DuckDBCopyFunctionBindFun_Aux
+
+  offset# = \_ -> \_ -> 0
+
+{-| Auxiliary type used by t'DuckDBCopyFunctionGlobalInitFun'
+
+    __C declaration:__ @duckdb_copy_function_global_init_t@
+
+    __defined at:__ @duckdb.h 1572:16@
+
+    __exported by:__ @duckdb.h@
+-}
+newtype DuckDBCopyFunctionGlobalInitFun_Aux = DuckDBCopyFunctionGlobalInitFun_Aux
+  { unwrap :: DuckDBCopyFunctionGlobalInitInfo -> IO ()
+  }
+  deriving stock (BG.Generic)
+
+-- __unique:__ @toDuckDBCopyFunctionGlobalInitFun_Aux@
+foreign import ccall safe "wrapper" hs_bindgen_abbe705cb454d925_base ::
+     (BG.Ptr BG.Void -> IO ())
+  -> IO (BG.FunPtr (BG.Ptr BG.Void -> IO ()))
+
+-- __unique:__ @toDuckDBCopyFunctionGlobalInitFun_Aux@
+hs_bindgen_abbe705cb454d925 ::
+     DuckDBCopyFunctionGlobalInitFun_Aux
+  -> IO (BG.FunPtr DuckDBCopyFunctionGlobalInitFun_Aux)
+hs_bindgen_abbe705cb454d925 =
+  \fun0 ->
+    fmap BG.castFunPtr (hs_bindgen_abbe705cb454d925_base (\x1 ->
+                                                            BG.getField @"unwrap" fun0 (BG.fromFFIType x1)))
+
+-- __unique:__ @fromDuckDBCopyFunctionGlobalInitFun_Aux@
+foreign import ccall safe "dynamic" hs_bindgen_4e8879a33da29a88_base ::
+     BG.FunPtr (BG.Ptr BG.Void -> IO ())
+  -> BG.Ptr BG.Void -> IO ()
+
+-- __unique:__ @fromDuckDBCopyFunctionGlobalInitFun_Aux@
+hs_bindgen_4e8879a33da29a88 ::
+     BG.FunPtr DuckDBCopyFunctionGlobalInitFun_Aux
+  -> DuckDBCopyFunctionGlobalInitFun_Aux
+hs_bindgen_4e8879a33da29a88 =
+  \funPtr0 ->
+    DuckDBCopyFunctionGlobalInitFun_Aux (\x1 ->
+                                           hs_bindgen_4e8879a33da29a88_base (BG.castFunPtr funPtr0) (BG.toFFIType x1))
+
+instance BG.ToFunPtr DuckDBCopyFunctionGlobalInitFun_Aux where
+
+  toFunPtr = hs_bindgen_abbe705cb454d925
+
+instance BG.FromFunPtr DuckDBCopyFunctionGlobalInitFun_Aux where
+
+  fromFunPtr = hs_bindgen_4e8879a33da29a88
+
+instance ( ty ~ (DuckDBCopyFunctionGlobalInitInfo -> IO ())
+         ) => BG.CompatHasField.HasField "unwrap" DuckDBCopyFunctionGlobalInitFun_Aux ty where
+
+  hasField =
+    \x0 ->
+      ( \y1 ->
+          DuckDBCopyFunctionGlobalInitFun_Aux {unwrap = y1}
+      , BG.getField @"unwrap" x0
+      )
+
+instance ( ty ~ (DuckDBCopyFunctionGlobalInitInfo -> IO ())
+         ) => BG.HasField "unwrap" (BG.Ptr DuckDBCopyFunctionGlobalInitFun_Aux) (BG.Ptr ty) where
+
+  getField = HasCField.fromPtr (BG.Proxy @"unwrap")
+
+instance HasCField.HasCField DuckDBCopyFunctionGlobalInitFun_Aux "unwrap" where
+
+  type CFieldType DuckDBCopyFunctionGlobalInitFun_Aux "unwrap" =
+    DuckDBCopyFunctionGlobalInitInfo -> IO ()
+
+  offset# = \_ -> \_ -> 0
+
+{-| The global initialization function of a copy function.
+
+    history:
+
+    * unstable: v1.5.0
+
+    * stable: v1.5.6
+
+    __C declaration:__ @duckdb_copy_function_global_init_t@
+
+    __defined at:__ @duckdb.h 1572:16@
+
+    __exported by:__ @duckdb.h@
+-}
+newtype DuckDBCopyFunctionGlobalInitFun = DuckDBCopyFunctionGlobalInitFun
+  { unwrap :: BG.FunPtr DuckDBCopyFunctionGlobalInitFun_Aux
+  }
+  deriving stock (Eq, BG.Generic, Ord, Show)
+  deriving newtype
+    ( BG.HasFFIType
+    , Marshal.ReadRaw
+    , Marshal.StaticSize
+    , BG.Storable
+    , Marshal.WriteRaw
+    )
+
+instance ( ty ~ BG.FunPtr DuckDBCopyFunctionGlobalInitFun_Aux
+         ) => BG.CompatHasField.HasField "unwrap" DuckDBCopyFunctionGlobalInitFun ty where
+
+  hasField =
+    \x0 ->
+      ( \y1 ->
+          DuckDBCopyFunctionGlobalInitFun {unwrap = y1}
+      , BG.getField @"unwrap" x0
+      )
+
+instance ( ty ~ BG.FunPtr DuckDBCopyFunctionGlobalInitFun_Aux
+         ) => BG.HasField "unwrap" (BG.Ptr DuckDBCopyFunctionGlobalInitFun) (BG.Ptr ty) where
+
+  getField = HasCField.fromPtr (BG.Proxy @"unwrap")
+
+instance HasCField.HasCField DuckDBCopyFunctionGlobalInitFun "unwrap" where
+
+  type CFieldType DuckDBCopyFunctionGlobalInitFun "unwrap" =
+    BG.FunPtr DuckDBCopyFunctionGlobalInitFun_Aux
+
+  offset# = \_ -> \_ -> 0
+
+{-| __C declaration:__ @struct duckdb_extension_access@
+
+    __defined at:__ @duckdb.h 10379:8@
+
+    __exported by:__ @duckdb.h@
+-}
+data DuckDBExtensionAccess = DuckDBExtensionAccess
+  { set_error :: BG.FunPtr (DuckDBExtensionInfo -> PtrConst.PtrConst BG.CChar -> IO ())
+    {- ^ __C declaration:__ @set_error@
+
+         __defined at:__ @duckdb.h 10381:9@
+
+         __exported by:__ @duckdb.h@
+    -}
+  , get_database :: BG.FunPtr (DuckDBExtensionInfo -> IO (BG.Ptr DuckDBDatabase))
+    {- ^ __C declaration:__ @get_database@
+
+         __defined at:__ @duckdb.h 10383:21@
+
+         __exported by:__ @duckdb.h@
+    -}
+  , get_api :: BG.FunPtr (DuckDBExtensionInfo -> PtrConst.PtrConst BG.CChar -> IO (PtrConst.PtrConst BG.Void))
+    {- ^ __C declaration:__ @get_api@
+
+         __defined at:__ @duckdb.h 10385:16@
+
+         __exported by:__ @duckdb.h@
+    -}
+  }
+  deriving stock (Eq, BG.Generic, Show)
+
+instance Marshal.StaticSize DuckDBExtensionAccess where
+
+  staticSizeOf = \_ -> (24 :: Int)
+
+  staticAlignment = \_ -> (8 :: Int)
+
+instance Marshal.ReadRaw DuckDBExtensionAccess where
+
+  readRaw =
+    \ptr0 ->
+          pure DuckDBExtensionAccess
+      <*> HasCField.readRaw (BG.Proxy @"set_error") ptr0
+      <*> HasCField.readRaw (BG.Proxy @"get_database") ptr0
+      <*> HasCField.readRaw (BG.Proxy @"get_api") ptr0
+
+instance Marshal.WriteRaw DuckDBExtensionAccess where
+
+  writeRaw =
+    \ptr0 ->
+      \s1 ->
+        case s1 of
+          DuckDBExtensionAccess set_error2 get_database3 get_api4 ->
+               HasCField.writeRaw (BG.Proxy @"set_error") ptr0 set_error2
+            >> HasCField.writeRaw (BG.Proxy @"get_database") ptr0 get_database3
+            >> HasCField.writeRaw (BG.Proxy @"get_api") ptr0 get_api4
+
+deriving via Marshal.EquivStorable DuckDBExtensionAccess instance BG.Storable DuckDBExtensionAccess
+
+deriving via Struct.IsStructViaReadRaw DuckDBExtensionAccess instance Struct.IsStruct DuckDBExtensionAccess
+
+{-| __C declaration:__ @set_error@
+
+    __defined at:__ @duckdb.h 10381:9@
+
+    __exported by:__ @duckdb.h@
+-}
+instance ( ty ~ BG.FunPtr (DuckDBExtensionInfo -> PtrConst.PtrConst BG.CChar -> IO ())
+         ) => BG.CompatHasField.HasField "set_error" DuckDBExtensionAccess ty where
+
+  hasField =
+    \x0 ->
+      ( \y1 ->
+          DuckDBExtensionAccess { set_error = y1
+                                , get_database = BG.getField @"get_database" x0
+                                , get_api = BG.getField @"get_api" x0
+                                }
+      , BG.getField @"set_error" x0
+      )
+
+instance ( ty ~ BG.FunPtr (DuckDBExtensionInfo -> PtrConst.PtrConst BG.CChar -> IO ())
+         ) => BG.HasField "set_error" (BG.Ptr DuckDBExtensionAccess) (BG.Ptr ty) where
+
+  getField = HasCField.fromPtr (BG.Proxy @"set_error")
+
+instance HasCField.HasCField DuckDBExtensionAccess "set_error" where
+
+  type CFieldType DuckDBExtensionAccess "set_error" =
+    BG.FunPtr (DuckDBExtensionInfo -> PtrConst.PtrConst BG.CChar -> IO ())
+
+  offset# = \_ -> \_ -> 0
+
+{-| __C declaration:__ @get_database@
+
+    __defined at:__ @duckdb.h 10383:21@
+
+    __exported by:__ @duckdb.h@
+-}
+instance ( ty ~ BG.FunPtr (DuckDBExtensionInfo -> IO (BG.Ptr DuckDBDatabase))
+         ) => BG.CompatHasField.HasField "get_database" DuckDBExtensionAccess ty where
+
+  hasField =
+    \x0 ->
+      ( \y1 ->
+          DuckDBExtensionAccess { get_database = y1
+                                , set_error = BG.getField @"set_error" x0
+                                , get_api = BG.getField @"get_api" x0
+                                }
+      , BG.getField @"get_database" x0
+      )
+
+instance ( ty ~ BG.FunPtr (DuckDBExtensionInfo -> IO (BG.Ptr DuckDBDatabase))
+         ) => BG.HasField "get_database" (BG.Ptr DuckDBExtensionAccess) (BG.Ptr ty) where
+
+  getField =
+    HasCField.fromPtr (BG.Proxy @"get_database")
+
+instance HasCField.HasCField DuckDBExtensionAccess "get_database" where
+
+  type CFieldType DuckDBExtensionAccess "get_database" =
+    BG.FunPtr (DuckDBExtensionInfo -> IO (BG.Ptr DuckDBDatabase))
+
+  offset# = \_ -> \_ -> 8
+
+{-| __C declaration:__ @get_api@
+
+    __defined at:__ @duckdb.h 10385:16@
+
+    __exported by:__ @duckdb.h@
+-}
+instance ( ty ~ BG.FunPtr (DuckDBExtensionInfo -> PtrConst.PtrConst BG.CChar -> IO (PtrConst.PtrConst BG.Void))
+         ) => BG.CompatHasField.HasField "get_api" DuckDBExtensionAccess ty where
+
+  hasField =
+    \x0 ->
+      ( \y1 ->
+          DuckDBExtensionAccess { get_api = y1
+                                , set_error = BG.getField @"set_error" x0
+                                , get_database = BG.getField @"get_database" x0
+                                }
+      , BG.getField @"get_api" x0
+      )
+
+instance ( ty ~ BG.FunPtr (DuckDBExtensionInfo -> PtrConst.PtrConst BG.CChar -> IO (PtrConst.PtrConst BG.Void))
+         ) => BG.HasField "get_api" (BG.Ptr DuckDBExtensionAccess) (BG.Ptr ty) where
+
+  getField = HasCField.fromPtr (BG.Proxy @"get_api")
+
+instance HasCField.HasCField DuckDBExtensionAccess "get_api" where
+
+  type CFieldType DuckDBExtensionAccess "get_api" =
+    BG.FunPtr (DuckDBExtensionInfo -> PtrConst.PtrConst BG.CChar -> IO (PtrConst.PtrConst BG.Void))
+
+  offset# = \_ -> \_ -> 16
+
+{-| __C declaration:__ @struct ArrowSchema@
+
+    __defined at:__ @duckdb_arrow.h 10:8@
+
+    __exported by:__ @duckdb_arrow.h@
+-}
+data ArrowSchema = ArrowSchema
+  { format :: PtrConst.PtrConst BG.CChar
+    {- ^ __C declaration:__ @format@
+
+         __defined at:__ @duckdb_arrow.h 11:15@
+
+         __exported by:__ @duckdb_arrow.h@
+    -}
+  , name :: PtrConst.PtrConst BG.CChar
+    {- ^ __C declaration:__ @name@
+
+         __defined at:__ @duckdb_arrow.h 12:15@
+
+         __exported by:__ @duckdb_arrow.h@
+    -}
+  , metadata :: PtrConst.PtrConst BG.CChar
+    {- ^ __C declaration:__ @metadata@
+
+         __defined at:__ @duckdb_arrow.h 13:15@
+
+         __exported by:__ @duckdb_arrow.h@
+    -}
+  , flags :: HsBindgen.Runtime.LibC.Int64
+    {- ^ __C declaration:__ @flags@
+
+         __defined at:__ @duckdb_arrow.h 14:11@
+
+         __exported by:__ @duckdb_arrow.h@
+    -}
+  , n_children :: HsBindgen.Runtime.LibC.Int64
+    {- ^ __C declaration:__ @n_children@
+
+         __defined at:__ @duckdb_arrow.h 15:11@
+
+         __exported by:__ @duckdb_arrow.h@
+    -}
+  , children :: BG.Ptr (BG.Ptr ArrowSchema)
+    {- ^ __C declaration:__ @children@
+
+         __defined at:__ @duckdb_arrow.h 16:24@
+
+         __exported by:__ @duckdb_arrow.h@
+    -}
+  , dictionary :: BG.Ptr ArrowSchema
+    {- ^ __C declaration:__ @dictionary@
+
+         __defined at:__ @duckdb_arrow.h 17:23@
+
+         __exported by:__ @duckdb_arrow.h@
+    -}
+  , release :: BG.FunPtr (BG.Ptr ArrowSchema -> IO ())
+    {- ^ __C declaration:__ @release@
+
+         __defined at:__ @duckdb_arrow.h 18:10@
+
+         __exported by:__ @duckdb_arrow.h@
+    -}
+  , private_data :: BG.Ptr BG.Void
+    {- ^ __C declaration:__ @private_data@
+
+         __defined at:__ @duckdb_arrow.h 19:9@
+
+         __exported by:__ @duckdb_arrow.h@
+    -}
+  }
+  deriving stock (Eq, BG.Generic, Show)
+
+instance Marshal.StaticSize ArrowSchema where
+
+  staticSizeOf = \_ -> (72 :: Int)
+
+  staticAlignment = \_ -> (8 :: Int)
+
+instance Marshal.ReadRaw ArrowSchema where
+
+  readRaw =
+    \ptr0 ->
+          pure ArrowSchema
+      <*> HasCField.readRaw (BG.Proxy @"format") ptr0
+      <*> HasCField.readRaw (BG.Proxy @"name") ptr0
+      <*> HasCField.readRaw (BG.Proxy @"metadata") ptr0
+      <*> HasCField.readRaw (BG.Proxy @"flags") ptr0
+      <*> HasCField.readRaw (BG.Proxy @"n_children") ptr0
+      <*> HasCField.readRaw (BG.Proxy @"children") ptr0
+      <*> HasCField.readRaw (BG.Proxy @"dictionary") ptr0
+      <*> HasCField.readRaw (BG.Proxy @"release") ptr0
+      <*> HasCField.readRaw (BG.Proxy @"private_data") ptr0
+
+instance Marshal.WriteRaw ArrowSchema where
+
+  writeRaw =
+    \ptr0 ->
+      \s1 ->
+        case s1 of
+          ArrowSchema
+            format2
+            name3
+            metadata4
+            flags5
+            n_children6
+            children7
+            dictionary8
+            release9
+            private_data10 ->
+                 HasCField.writeRaw (BG.Proxy @"format") ptr0 format2
+              >> HasCField.writeRaw (BG.Proxy @"name") ptr0 name3
+              >> HasCField.writeRaw (BG.Proxy @"metadata") ptr0 metadata4
+              >> HasCField.writeRaw (BG.Proxy @"flags") ptr0 flags5
+              >> HasCField.writeRaw (BG.Proxy @"n_children") ptr0 n_children6
+              >> HasCField.writeRaw (BG.Proxy @"children") ptr0 children7
+              >> HasCField.writeRaw (BG.Proxy @"dictionary") ptr0 dictionary8
+              >> HasCField.writeRaw (BG.Proxy @"release") ptr0 release9
+              >> HasCField.writeRaw (BG.Proxy @"private_data") ptr0 private_data10
+
+deriving via Marshal.EquivStorable ArrowSchema instance BG.Storable ArrowSchema
+
+deriving via Struct.IsStructViaReadRaw ArrowSchema instance Struct.IsStruct ArrowSchema
+
+{-| __C declaration:__ @format@
+
+    __defined at:__ @duckdb_arrow.h 11:15@
+
+    __exported by:__ @duckdb_arrow.h@
+-}
+instance ( ty ~ PtrConst.PtrConst BG.CChar
+         ) => BG.CompatHasField.HasField "format" ArrowSchema ty where
+
+  hasField =
+    \x0 ->
+      ( \y1 ->
+          ArrowSchema { format = y1
+                      , name = BG.getField @"name" x0
+                      , metadata = BG.getField @"metadata" x0
+                      , flags = BG.getField @"flags" x0
+                      , n_children = BG.getField @"n_children" x0
+                      , children = BG.getField @"children" x0
+                      , dictionary = BG.getField @"dictionary" x0
+                      , release = BG.getField @"release" x0
+                      , private_data = BG.getField @"private_data" x0
+                      }
+      , BG.getField @"format" x0
+      )
+
+instance ( ty ~ PtrConst.PtrConst BG.CChar
+         ) => BG.HasField "format" (BG.Ptr ArrowSchema) (BG.Ptr ty) where
+
+  getField = HasCField.fromPtr (BG.Proxy @"format")
+
+instance HasCField.HasCField ArrowSchema "format" where
+
+  type CFieldType ArrowSchema "format" =
+    PtrConst.PtrConst BG.CChar
+
+  offset# = \_ -> \_ -> 0
+
+{-| __C declaration:__ @name@
+
+    __defined at:__ @duckdb_arrow.h 12:15@
+
+    __exported by:__ @duckdb_arrow.h@
+-}
+instance ( ty ~ PtrConst.PtrConst BG.CChar
+         ) => BG.CompatHasField.HasField "name" ArrowSchema ty where
+
+  hasField =
+    \x0 ->
+      ( \y1 ->
+          ArrowSchema { name = y1
+                      , format = BG.getField @"format" x0
+                      , metadata = BG.getField @"metadata" x0
+                      , flags = BG.getField @"flags" x0
+                      , n_children = BG.getField @"n_children" x0
+                      , children = BG.getField @"children" x0
+                      , dictionary = BG.getField @"dictionary" x0
+                      , release = BG.getField @"release" x0
+                      , private_data = BG.getField @"private_data" x0
+                      }
+      , BG.getField @"name" x0
+      )
+
+instance ( ty ~ PtrConst.PtrConst BG.CChar
+         ) => BG.HasField "name" (BG.Ptr ArrowSchema) (BG.Ptr ty) where
+
+  getField = HasCField.fromPtr (BG.Proxy @"name")
+
+instance HasCField.HasCField ArrowSchema "name" where
+
+  type CFieldType ArrowSchema "name" =
+    PtrConst.PtrConst BG.CChar
+
+  offset# = \_ -> \_ -> 8
+
+{-| __C declaration:__ @metadata@
+
+    __defined at:__ @duckdb_arrow.h 13:15@
+
+    __exported by:__ @duckdb_arrow.h@
+-}
+instance ( ty ~ PtrConst.PtrConst BG.CChar
+         ) => BG.CompatHasField.HasField "metadata" ArrowSchema ty where
+
+  hasField =
+    \x0 ->
+      ( \y1 ->
+          ArrowSchema { metadata = y1
+                      , format = BG.getField @"format" x0
+                      , name = BG.getField @"name" x0
+                      , flags = BG.getField @"flags" x0
+                      , n_children = BG.getField @"n_children" x0
+                      , children = BG.getField @"children" x0
+                      , dictionary = BG.getField @"dictionary" x0
+                      , release = BG.getField @"release" x0
+                      , private_data = BG.getField @"private_data" x0
+                      }
+      , BG.getField @"metadata" x0
+      )
+
+instance ( ty ~ PtrConst.PtrConst BG.CChar
+         ) => BG.HasField "metadata" (BG.Ptr ArrowSchema) (BG.Ptr ty) where
+
+  getField = HasCField.fromPtr (BG.Proxy @"metadata")
+
+instance HasCField.HasCField ArrowSchema "metadata" where
+
+  type CFieldType ArrowSchema "metadata" =
+    PtrConst.PtrConst BG.CChar
+
+  offset# = \_ -> \_ -> 16
+
+{-| __C declaration:__ @flags@
+
+    __defined at:__ @duckdb_arrow.h 14:11@
+
+    __exported by:__ @duckdb_arrow.h@
+-}
+instance ( ty ~ HsBindgen.Runtime.LibC.Int64
+         ) => BG.CompatHasField.HasField "flags" ArrowSchema ty where
+
+  hasField =
+    \x0 ->
+      ( \y1 ->
+          ArrowSchema { flags = y1
+                      , format = BG.getField @"format" x0
+                      , name = BG.getField @"name" x0
+                      , metadata = BG.getField @"metadata" x0
+                      , n_children = BG.getField @"n_children" x0
+                      , children = BG.getField @"children" x0
+                      , dictionary = BG.getField @"dictionary" x0
+                      , release = BG.getField @"release" x0
+                      , private_data = BG.getField @"private_data" x0
+                      }
+      , BG.getField @"flags" x0
+      )
+
+instance ( ty ~ HsBindgen.Runtime.LibC.Int64
+         ) => BG.HasField "flags" (BG.Ptr ArrowSchema) (BG.Ptr ty) where
+
+  getField = HasCField.fromPtr (BG.Proxy @"flags")
+
+instance HasCField.HasCField ArrowSchema "flags" where
+
+  type CFieldType ArrowSchema "flags" =
+    HsBindgen.Runtime.LibC.Int64
+
+  offset# = \_ -> \_ -> 24
+
+{-| __C declaration:__ @n_children@
+
+    __defined at:__ @duckdb_arrow.h 15:11@
+
+    __exported by:__ @duckdb_arrow.h@
+-}
+instance ( ty ~ HsBindgen.Runtime.LibC.Int64
+         ) => BG.CompatHasField.HasField "n_children" ArrowSchema ty where
+
+  hasField =
+    \x0 ->
+      ( \y1 ->
+          ArrowSchema { n_children = y1
+                      , format = BG.getField @"format" x0
+                      , name = BG.getField @"name" x0
+                      , metadata = BG.getField @"metadata" x0
+                      , flags = BG.getField @"flags" x0
+                      , children = BG.getField @"children" x0
+                      , dictionary = BG.getField @"dictionary" x0
+                      , release = BG.getField @"release" x0
+                      , private_data = BG.getField @"private_data" x0
+                      }
+      , BG.getField @"n_children" x0
+      )
+
+instance ( ty ~ HsBindgen.Runtime.LibC.Int64
+         ) => BG.HasField "n_children" (BG.Ptr ArrowSchema) (BG.Ptr ty) where
+
+  getField = HasCField.fromPtr (BG.Proxy @"n_children")
+
+instance HasCField.HasCField ArrowSchema "n_children" where
+
+  type CFieldType ArrowSchema "n_children" =
+    HsBindgen.Runtime.LibC.Int64
+
+  offset# = \_ -> \_ -> 32
+
+{-| __C declaration:__ @children@
+
+    __defined at:__ @duckdb_arrow.h 16:24@
+
+    __exported by:__ @duckdb_arrow.h@
+-}
+instance ( ty ~ BG.Ptr (BG.Ptr ArrowSchema)
+         ) => BG.CompatHasField.HasField "children" ArrowSchema ty where
+
+  hasField =
+    \x0 ->
+      ( \y1 ->
+          ArrowSchema { children = y1
+                      , format = BG.getField @"format" x0
+                      , name = BG.getField @"name" x0
+                      , metadata = BG.getField @"metadata" x0
+                      , flags = BG.getField @"flags" x0
+                      , n_children = BG.getField @"n_children" x0
+                      , dictionary = BG.getField @"dictionary" x0
+                      , release = BG.getField @"release" x0
+                      , private_data = BG.getField @"private_data" x0
+                      }
+      , BG.getField @"children" x0
+      )
+
+instance ( ty ~ BG.Ptr (BG.Ptr ArrowSchema)
+         ) => BG.HasField "children" (BG.Ptr ArrowSchema) (BG.Ptr ty) where
+
+  getField = HasCField.fromPtr (BG.Proxy @"children")
+
+instance HasCField.HasCField ArrowSchema "children" where
+
+  type CFieldType ArrowSchema "children" =
+    BG.Ptr (BG.Ptr ArrowSchema)
+
+  offset# = \_ -> \_ -> 40
+
+{-| __C declaration:__ @dictionary@
+
+    __defined at:__ @duckdb_arrow.h 17:23@
+
+    __exported by:__ @duckdb_arrow.h@
+-}
+instance ( ty ~ BG.Ptr ArrowSchema
+         ) => BG.CompatHasField.HasField "dictionary" ArrowSchema ty where
+
+  hasField =
+    \x0 ->
+      ( \y1 ->
+          ArrowSchema { dictionary = y1
+                      , format = BG.getField @"format" x0
+                      , name = BG.getField @"name" x0
+                      , metadata = BG.getField @"metadata" x0
+                      , flags = BG.getField @"flags" x0
+                      , n_children = BG.getField @"n_children" x0
+                      , children = BG.getField @"children" x0
+                      , release = BG.getField @"release" x0
+                      , private_data = BG.getField @"private_data" x0
+                      }
+      , BG.getField @"dictionary" x0
+      )
+
+instance ( ty ~ BG.Ptr ArrowSchema
+         ) => BG.HasField "dictionary" (BG.Ptr ArrowSchema) (BG.Ptr ty) where
+
+  getField = HasCField.fromPtr (BG.Proxy @"dictionary")
+
+instance HasCField.HasCField ArrowSchema "dictionary" where
+
+  type CFieldType ArrowSchema "dictionary" =
+    BG.Ptr ArrowSchema
+
+  offset# = \_ -> \_ -> 48
+
+{-| __C declaration:__ @release@
+
+    __defined at:__ @duckdb_arrow.h 18:10@
+
+    __exported by:__ @duckdb_arrow.h@
+-}
+instance ( ty ~ BG.FunPtr (BG.Ptr ArrowSchema -> IO ())
+         ) => BG.CompatHasField.HasField "release" ArrowSchema ty where
+
+  hasField =
+    \x0 ->
+      ( \y1 ->
+          ArrowSchema { release = y1
+                      , format = BG.getField @"format" x0
+                      , name = BG.getField @"name" x0
+                      , metadata = BG.getField @"metadata" x0
+                      , flags = BG.getField @"flags" x0
+                      , n_children = BG.getField @"n_children" x0
+                      , children = BG.getField @"children" x0
+                      , dictionary = BG.getField @"dictionary" x0
+                      , private_data = BG.getField @"private_data" x0
+                      }
+      , BG.getField @"release" x0
+      )
+
+instance ( ty ~ BG.FunPtr (BG.Ptr ArrowSchema -> IO ())
+         ) => BG.HasField "release" (BG.Ptr ArrowSchema) (BG.Ptr ty) where
+
+  getField = HasCField.fromPtr (BG.Proxy @"release")
+
+instance HasCField.HasCField ArrowSchema "release" where
+
+  type CFieldType ArrowSchema "release" =
+    BG.FunPtr (BG.Ptr ArrowSchema -> IO ())
+
+  offset# = \_ -> \_ -> 56
+
+{-| __C declaration:__ @private_data@
+
+    __defined at:__ @duckdb_arrow.h 19:9@
+
+    __exported by:__ @duckdb_arrow.h@
+-}
+instance ( ty ~ BG.Ptr BG.Void
+         ) => BG.CompatHasField.HasField "private_data" ArrowSchema ty where
+
+  hasField =
+    \x0 ->
+      ( \y1 ->
+          ArrowSchema { private_data = y1
+                      , format = BG.getField @"format" x0
+                      , name = BG.getField @"name" x0
+                      , metadata = BG.getField @"metadata" x0
+                      , flags = BG.getField @"flags" x0
+                      , n_children = BG.getField @"n_children" x0
+                      , children = BG.getField @"children" x0
+                      , dictionary = BG.getField @"dictionary" x0
+                      , release = BG.getField @"release" x0
+                      }
+      , BG.getField @"private_data" x0
+      )
+
+instance ( ty ~ BG.Ptr BG.Void
+         ) => BG.HasField "private_data" (BG.Ptr ArrowSchema) (BG.Ptr ty) where
+
+  getField =
+    HasCField.fromPtr (BG.Proxy @"private_data")
+
+instance HasCField.HasCField ArrowSchema "private_data" where
+
+  type CFieldType ArrowSchema "private_data" =
+    BG.Ptr BG.Void
+
+  offset# = \_ -> \_ -> 64
+
+{-| __C declaration:__ @struct ArrowArray@
+
+    __defined at:__ @duckdb_arrow.h 22:8@
+
+    __exported by:__ @duckdb_arrow.h@
+-}
+data ArrowArray = ArrowArray
+  { length :: HsBindgen.Runtime.LibC.Int64
+    {- ^ __C declaration:__ @length@
+
+         __defined at:__ @duckdb_arrow.h 23:11@
+
+         __exported by:__ @duckdb_arrow.h@
+    -}
+  , null_count :: HsBindgen.Runtime.LibC.Int64
+    {- ^ __C declaration:__ @null_count@
+
+         __defined at:__ @duckdb_arrow.h 24:11@
+
+         __exported by:__ @duckdb_arrow.h@
+    -}
+  , offset :: HsBindgen.Runtime.LibC.Int64
+    {- ^ __C declaration:__ @offset@
+
+         __defined at:__ @duckdb_arrow.h 25:11@
+
+         __exported by:__ @duckdb_arrow.h@
+    -}
+  , n_buffers :: HsBindgen.Runtime.LibC.Int64
+    {- ^ __C declaration:__ @n_buffers@
+
+         __defined at:__ @duckdb_arrow.h 26:11@
+
+         __exported by:__ @duckdb_arrow.h@
+    -}
+  , n_children :: HsBindgen.Runtime.LibC.Int64
+    {- ^ __C declaration:__ @n_children@
+
+         __defined at:__ @duckdb_arrow.h 27:11@
+
+         __exported by:__ @duckdb_arrow.h@
+    -}
+  , buffers :: BG.Ptr (PtrConst.PtrConst BG.Void)
+    {- ^ __C declaration:__ @buffers@
+
+         __defined at:__ @duckdb_arrow.h 28:16@
+
+         __exported by:__ @duckdb_arrow.h@
+    -}
+  , children :: BG.Ptr (BG.Ptr ArrowArray)
+    {- ^ __C declaration:__ @children@
+
+         __defined at:__ @duckdb_arrow.h 29:23@
+
+         __exported by:__ @duckdb_arrow.h@
+    -}
+  , dictionary :: BG.Ptr ArrowArray
+    {- ^ __C declaration:__ @dictionary@
+
+         __defined at:__ @duckdb_arrow.h 30:22@
+
+         __exported by:__ @duckdb_arrow.h@
+    -}
+  , release :: BG.FunPtr (BG.Ptr ArrowArray -> IO ())
+    {- ^ __C declaration:__ @release@
+
+         __defined at:__ @duckdb_arrow.h 31:10@
+
+         __exported by:__ @duckdb_arrow.h@
+    -}
+  , private_data :: BG.Ptr BG.Void
+    {- ^ __C declaration:__ @private_data@
+
+         __defined at:__ @duckdb_arrow.h 32:9@
+
+         __exported by:__ @duckdb_arrow.h@
+    -}
+  }
+  deriving stock (Eq, BG.Generic, Show)
+
+instance Marshal.StaticSize ArrowArray where
+
+  staticSizeOf = \_ -> (80 :: Int)
+
+  staticAlignment = \_ -> (8 :: Int)
+
+instance Marshal.ReadRaw ArrowArray where
+
+  readRaw =
+    \ptr0 ->
+          pure ArrowArray
+      <*> HasCField.readRaw (BG.Proxy @"length") ptr0
+      <*> HasCField.readRaw (BG.Proxy @"null_count") ptr0
+      <*> HasCField.readRaw (BG.Proxy @"offset") ptr0
+      <*> HasCField.readRaw (BG.Proxy @"n_buffers") ptr0
+      <*> HasCField.readRaw (BG.Proxy @"n_children") ptr0
+      <*> HasCField.readRaw (BG.Proxy @"buffers") ptr0
+      <*> HasCField.readRaw (BG.Proxy @"children") ptr0
+      <*> HasCField.readRaw (BG.Proxy @"dictionary") ptr0
+      <*> HasCField.readRaw (BG.Proxy @"release") ptr0
+      <*> HasCField.readRaw (BG.Proxy @"private_data") ptr0
+
+instance Marshal.WriteRaw ArrowArray where
+
+  writeRaw =
+    \ptr0 ->
+      \s1 ->
+        case s1 of
+          ArrowArray
+            length2
+            null_count3
+            offset4
+            n_buffers5
+            n_children6
+            buffers7
+            children8
+            dictionary9
+            release10
+            private_data11 ->
+                 HasCField.writeRaw (BG.Proxy @"length") ptr0 length2
+              >> HasCField.writeRaw (BG.Proxy @"null_count") ptr0 null_count3
+              >> HasCField.writeRaw (BG.Proxy @"offset") ptr0 offset4
+              >> HasCField.writeRaw (BG.Proxy @"n_buffers") ptr0 n_buffers5
+              >> HasCField.writeRaw (BG.Proxy @"n_children") ptr0 n_children6
+              >> HasCField.writeRaw (BG.Proxy @"buffers") ptr0 buffers7
+              >> HasCField.writeRaw (BG.Proxy @"children") ptr0 children8
+              >> HasCField.writeRaw (BG.Proxy @"dictionary") ptr0 dictionary9
+              >> HasCField.writeRaw (BG.Proxy @"release") ptr0 release10
+              >> HasCField.writeRaw (BG.Proxy @"private_data") ptr0 private_data11
+
+deriving via Marshal.EquivStorable ArrowArray instance BG.Storable ArrowArray
+
+deriving via Struct.IsStructViaReadRaw ArrowArray instance Struct.IsStruct ArrowArray
+
+{-| __C declaration:__ @length@
+
+    __defined at:__ @duckdb_arrow.h 23:11@
+
+    __exported by:__ @duckdb_arrow.h@
+-}
+instance ( ty ~ HsBindgen.Runtime.LibC.Int64
+         ) => BG.CompatHasField.HasField "length" ArrowArray ty where
+
+  hasField =
+    \x0 ->
+      ( \y1 ->
+          ArrowArray { length = y1
+                     , null_count = BG.getField @"null_count" x0
+                     , offset = BG.getField @"offset" x0
+                     , n_buffers = BG.getField @"n_buffers" x0
+                     , n_children = BG.getField @"n_children" x0
+                     , buffers = BG.getField @"buffers" x0
+                     , children = BG.getField @"children" x0
+                     , dictionary = BG.getField @"dictionary" x0
+                     , release = BG.getField @"release" x0
+                     , private_data = BG.getField @"private_data" x0
+                     }
+      , BG.getField @"length" x0
+      )
+
+instance ( ty ~ HsBindgen.Runtime.LibC.Int64
+         ) => BG.HasField "length" (BG.Ptr ArrowArray) (BG.Ptr ty) where
+
+  getField = HasCField.fromPtr (BG.Proxy @"length")
+
+instance HasCField.HasCField ArrowArray "length" where
+
+  type CFieldType ArrowArray "length" =
+    HsBindgen.Runtime.LibC.Int64
+
+  offset# = \_ -> \_ -> 0
+
+{-| __C declaration:__ @null_count@
+
+    __defined at:__ @duckdb_arrow.h 24:11@
+
+    __exported by:__ @duckdb_arrow.h@
+-}
+instance ( ty ~ HsBindgen.Runtime.LibC.Int64
+         ) => BG.CompatHasField.HasField "null_count" ArrowArray ty where
+
+  hasField =
+    \x0 ->
+      ( \y1 ->
+          ArrowArray { null_count = y1
+                     , length = BG.getField @"length" x0
+                     , offset = BG.getField @"offset" x0
+                     , n_buffers = BG.getField @"n_buffers" x0
+                     , n_children = BG.getField @"n_children" x0
+                     , buffers = BG.getField @"buffers" x0
+                     , children = BG.getField @"children" x0
+                     , dictionary = BG.getField @"dictionary" x0
+                     , release = BG.getField @"release" x0
+                     , private_data = BG.getField @"private_data" x0
+                     }
+      , BG.getField @"null_count" x0
+      )
+
+instance ( ty ~ HsBindgen.Runtime.LibC.Int64
+         ) => BG.HasField "null_count" (BG.Ptr ArrowArray) (BG.Ptr ty) where
+
+  getField = HasCField.fromPtr (BG.Proxy @"null_count")
+
+instance HasCField.HasCField ArrowArray "null_count" where
+
+  type CFieldType ArrowArray "null_count" =
+    HsBindgen.Runtime.LibC.Int64
+
+  offset# = \_ -> \_ -> 8
+
+{-| __C declaration:__ @offset@
+
+    __defined at:__ @duckdb_arrow.h 25:11@
+
+    __exported by:__ @duckdb_arrow.h@
+-}
+instance ( ty ~ HsBindgen.Runtime.LibC.Int64
+         ) => BG.CompatHasField.HasField "offset" ArrowArray ty where
+
+  hasField =
+    \x0 ->
+      ( \y1 ->
+          ArrowArray { offset = y1
+                     , length = BG.getField @"length" x0
+                     , null_count = BG.getField @"null_count" x0
+                     , n_buffers = BG.getField @"n_buffers" x0
+                     , n_children = BG.getField @"n_children" x0
+                     , buffers = BG.getField @"buffers" x0
+                     , children = BG.getField @"children" x0
+                     , dictionary = BG.getField @"dictionary" x0
+                     , release = BG.getField @"release" x0
+                     , private_data = BG.getField @"private_data" x0
+                     }
+      , BG.getField @"offset" x0
+      )
+
+instance ( ty ~ HsBindgen.Runtime.LibC.Int64
+         ) => BG.HasField "offset" (BG.Ptr ArrowArray) (BG.Ptr ty) where
+
+  getField = HasCField.fromPtr (BG.Proxy @"offset")
+
+instance HasCField.HasCField ArrowArray "offset" where
+
+  type CFieldType ArrowArray "offset" =
+    HsBindgen.Runtime.LibC.Int64
+
+  offset# = \_ -> \_ -> 16
+
+{-| __C declaration:__ @n_buffers@
+
+    __defined at:__ @duckdb_arrow.h 26:11@
+
+    __exported by:__ @duckdb_arrow.h@
+-}
+instance ( ty ~ HsBindgen.Runtime.LibC.Int64
+         ) => BG.CompatHasField.HasField "n_buffers" ArrowArray ty where
+
+  hasField =
+    \x0 ->
+      ( \y1 ->
+          ArrowArray { n_buffers = y1
+                     , length = BG.getField @"length" x0
+                     , null_count = BG.getField @"null_count" x0
+                     , offset = BG.getField @"offset" x0
+                     , n_children = BG.getField @"n_children" x0
+                     , buffers = BG.getField @"buffers" x0
+                     , children = BG.getField @"children" x0
+                     , dictionary = BG.getField @"dictionary" x0
+                     , release = BG.getField @"release" x0
+                     , private_data = BG.getField @"private_data" x0
+                     }
+      , BG.getField @"n_buffers" x0
+      )
+
+instance ( ty ~ HsBindgen.Runtime.LibC.Int64
+         ) => BG.HasField "n_buffers" (BG.Ptr ArrowArray) (BG.Ptr ty) where
+
+  getField = HasCField.fromPtr (BG.Proxy @"n_buffers")
+
+instance HasCField.HasCField ArrowArray "n_buffers" where
+
+  type CFieldType ArrowArray "n_buffers" =
+    HsBindgen.Runtime.LibC.Int64
+
+  offset# = \_ -> \_ -> 24
+
+{-| __C declaration:__ @n_children@
+
+    __defined at:__ @duckdb_arrow.h 27:11@
+
+    __exported by:__ @duckdb_arrow.h@
+-}
+instance ( ty ~ HsBindgen.Runtime.LibC.Int64
+         ) => BG.CompatHasField.HasField "n_children" ArrowArray ty where
+
+  hasField =
+    \x0 ->
+      ( \y1 ->
+          ArrowArray { n_children = y1
+                     , length = BG.getField @"length" x0
+                     , null_count = BG.getField @"null_count" x0
+                     , offset = BG.getField @"offset" x0
+                     , n_buffers = BG.getField @"n_buffers" x0
+                     , buffers = BG.getField @"buffers" x0
+                     , children = BG.getField @"children" x0
+                     , dictionary = BG.getField @"dictionary" x0
+                     , release = BG.getField @"release" x0
+                     , private_data = BG.getField @"private_data" x0
+                     }
+      , BG.getField @"n_children" x0
+      )
+
+instance ( ty ~ HsBindgen.Runtime.LibC.Int64
+         ) => BG.HasField "n_children" (BG.Ptr ArrowArray) (BG.Ptr ty) where
+
+  getField = HasCField.fromPtr (BG.Proxy @"n_children")
+
+instance HasCField.HasCField ArrowArray "n_children" where
+
+  type CFieldType ArrowArray "n_children" =
+    HsBindgen.Runtime.LibC.Int64
+
+  offset# = \_ -> \_ -> 32
+
+{-| __C declaration:__ @buffers@
+
+    __defined at:__ @duckdb_arrow.h 28:16@
+
+    __exported by:__ @duckdb_arrow.h@
+-}
+instance ( ty ~ BG.Ptr (PtrConst.PtrConst BG.Void)
+         ) => BG.CompatHasField.HasField "buffers" ArrowArray ty where
+
+  hasField =
+    \x0 ->
+      ( \y1 ->
+          ArrowArray { buffers = y1
+                     , length = BG.getField @"length" x0
+                     , null_count = BG.getField @"null_count" x0
+                     , offset = BG.getField @"offset" x0
+                     , n_buffers = BG.getField @"n_buffers" x0
+                     , n_children = BG.getField @"n_children" x0
+                     , children = BG.getField @"children" x0
+                     , dictionary = BG.getField @"dictionary" x0
+                     , release = BG.getField @"release" x0
+                     , private_data = BG.getField @"private_data" x0
+                     }
+      , BG.getField @"buffers" x0
+      )
+
+instance ( ty ~ BG.Ptr (PtrConst.PtrConst BG.Void)
+         ) => BG.HasField "buffers" (BG.Ptr ArrowArray) (BG.Ptr ty) where
+
+  getField = HasCField.fromPtr (BG.Proxy @"buffers")
+
+instance HasCField.HasCField ArrowArray "buffers" where
+
+  type CFieldType ArrowArray "buffers" =
+    BG.Ptr (PtrConst.PtrConst BG.Void)
+
+  offset# = \_ -> \_ -> 40
+
+{-| __C declaration:__ @children@
+
+    __defined at:__ @duckdb_arrow.h 29:23@
+
+    __exported by:__ @duckdb_arrow.h@
+-}
+instance ( ty ~ BG.Ptr (BG.Ptr ArrowArray)
+         ) => BG.CompatHasField.HasField "children" ArrowArray ty where
+
+  hasField =
+    \x0 ->
+      ( \y1 ->
+          ArrowArray { children = y1
+                     , length = BG.getField @"length" x0
+                     , null_count = BG.getField @"null_count" x0
+                     , offset = BG.getField @"offset" x0
+                     , n_buffers = BG.getField @"n_buffers" x0
+                     , n_children = BG.getField @"n_children" x0
+                     , buffers = BG.getField @"buffers" x0
+                     , dictionary = BG.getField @"dictionary" x0
+                     , release = BG.getField @"release" x0
+                     , private_data = BG.getField @"private_data" x0
+                     }
+      , BG.getField @"children" x0
+      )
+
+instance ( ty ~ BG.Ptr (BG.Ptr ArrowArray)
+         ) => BG.HasField "children" (BG.Ptr ArrowArray) (BG.Ptr ty) where
+
+  getField = HasCField.fromPtr (BG.Proxy @"children")
+
+instance HasCField.HasCField ArrowArray "children" where
+
+  type CFieldType ArrowArray "children" =
+    BG.Ptr (BG.Ptr ArrowArray)
+
+  offset# = \_ -> \_ -> 48
+
+{-| __C declaration:__ @dictionary@
+
+    __defined at:__ @duckdb_arrow.h 30:22@
+
+    __exported by:__ @duckdb_arrow.h@
+-}
+instance ( ty ~ BG.Ptr ArrowArray
+         ) => BG.CompatHasField.HasField "dictionary" ArrowArray ty where
+
+  hasField =
+    \x0 ->
+      ( \y1 ->
+          ArrowArray { dictionary = y1
+                     , length = BG.getField @"length" x0
+                     , null_count = BG.getField @"null_count" x0
+                     , offset = BG.getField @"offset" x0
+                     , n_buffers = BG.getField @"n_buffers" x0
+                     , n_children = BG.getField @"n_children" x0
+                     , buffers = BG.getField @"buffers" x0
+                     , children = BG.getField @"children" x0
+                     , release = BG.getField @"release" x0
+                     , private_data = BG.getField @"private_data" x0
+                     }
+      , BG.getField @"dictionary" x0
+      )
+
+instance ( ty ~ BG.Ptr ArrowArray
+         ) => BG.HasField "dictionary" (BG.Ptr ArrowArray) (BG.Ptr ty) where
+
+  getField = HasCField.fromPtr (BG.Proxy @"dictionary")
+
+instance HasCField.HasCField ArrowArray "dictionary" where
+
+  type CFieldType ArrowArray "dictionary" =
+    BG.Ptr ArrowArray
+
+  offset# = \_ -> \_ -> 56
+
+{-| __C declaration:__ @release@
+
+    __defined at:__ @duckdb_arrow.h 31:10@
+
+    __exported by:__ @duckdb_arrow.h@
+-}
+instance ( ty ~ BG.FunPtr (BG.Ptr ArrowArray -> IO ())
+         ) => BG.CompatHasField.HasField "release" ArrowArray ty where
+
+  hasField =
+    \x0 ->
+      ( \y1 ->
+          ArrowArray { release = y1
+                     , length = BG.getField @"length" x0
+                     , null_count = BG.getField @"null_count" x0
+                     , offset = BG.getField @"offset" x0
+                     , n_buffers = BG.getField @"n_buffers" x0
+                     , n_children = BG.getField @"n_children" x0
+                     , buffers = BG.getField @"buffers" x0
+                     , children = BG.getField @"children" x0
+                     , dictionary = BG.getField @"dictionary" x0
+                     , private_data = BG.getField @"private_data" x0
+                     }
+      , BG.getField @"release" x0
+      )
+
+instance ( ty ~ BG.FunPtr (BG.Ptr ArrowArray -> IO ())
+         ) => BG.HasField "release" (BG.Ptr ArrowArray) (BG.Ptr ty) where
+
+  getField = HasCField.fromPtr (BG.Proxy @"release")
+
+instance HasCField.HasCField ArrowArray "release" where
+
+  type CFieldType ArrowArray "release" =
+    BG.FunPtr (BG.Ptr ArrowArray -> IO ())
+
+  offset# = \_ -> \_ -> 64
+
+{-| __C declaration:__ @private_data@
+
+    __defined at:__ @duckdb_arrow.h 32:9@
+
+    __exported by:__ @duckdb_arrow.h@
+-}
+instance ( ty ~ BG.Ptr BG.Void
+         ) => BG.CompatHasField.HasField "private_data" ArrowArray ty where
+
+  hasField =
+    \x0 ->
+      ( \y1 ->
+          ArrowArray { private_data = y1
+                     , length = BG.getField @"length" x0
+                     , null_count = BG.getField @"null_count" x0
+                     , offset = BG.getField @"offset" x0
+                     , n_buffers = BG.getField @"n_buffers" x0
+                     , n_children = BG.getField @"n_children" x0
+                     , buffers = BG.getField @"buffers" x0
+                     , children = BG.getField @"children" x0
+                     , dictionary = BG.getField @"dictionary" x0
+                     , release = BG.getField @"release" x0
+                     }
+      , BG.getField @"private_data" x0
+      )
+
+instance ( ty ~ BG.Ptr BG.Void
+         ) => BG.HasField "private_data" (BG.Ptr ArrowArray) (BG.Ptr ty) where
+
+  getField =
+    HasCField.fromPtr (BG.Proxy @"private_data")
+
+instance HasCField.HasCField ArrowArray "private_data" where
+
+  type CFieldType ArrowArray "private_data" =
+    BG.Ptr BG.Void
+
+  offset# = \_ -> \_ -> 72
+
+{-| __C declaration:__ @struct ArrowArrayStream@
+
+    __defined at:__ @duckdb_arrow.h 39:8@
+
+    __exported by:__ @duckdb_arrow.h@
+-}
+data ArrowArrayStream = ArrowArrayStream
+  { get_schema :: BG.FunPtr (BG.Ptr ArrowArrayStream -> BG.Ptr ArrowSchema -> IO BG.CInt)
+    {- ^ __C declaration:__ @get_schema@
+
+         __defined at:__ @duckdb_arrow.h 40:9@
+
+         __exported by:__ @duckdb_arrow.h@
+    -}
+  , get_next :: BG.FunPtr (BG.Ptr ArrowArrayStream -> BG.Ptr ArrowArray -> IO BG.CInt)
+    {- ^ __C declaration:__ @get_next@
+
+         __defined at:__ @duckdb_arrow.h 41:9@
+
+         __exported by:__ @duckdb_arrow.h@
+    -}
+  , get_last_error :: BG.FunPtr (BG.Ptr ArrowArrayStream -> IO (PtrConst.PtrConst BG.CChar))
+    {- ^ __C declaration:__ @get_last_error@
+
+         __defined at:__ @duckdb_arrow.h 42:17@
+
+         __exported by:__ @duckdb_arrow.h@
+    -}
+  , release :: BG.FunPtr (BG.Ptr ArrowArrayStream -> IO ())
+    {- ^ __C declaration:__ @release@
+
+         __defined at:__ @duckdb_arrow.h 43:10@
+
+         __exported by:__ @duckdb_arrow.h@
+    -}
+  , private_data :: BG.Ptr BG.Void
+    {- ^ __C declaration:__ @private_data@
+
+         __defined at:__ @duckdb_arrow.h 44:9@
+
+         __exported by:__ @duckdb_arrow.h@
+    -}
+  }
+  deriving stock (Eq, BG.Generic, Show)
+
+instance Marshal.StaticSize ArrowArrayStream where
+
+  staticSizeOf = \_ -> (40 :: Int)
+
+  staticAlignment = \_ -> (8 :: Int)
+
+instance Marshal.ReadRaw ArrowArrayStream where
+
+  readRaw =
+    \ptr0 ->
+          pure ArrowArrayStream
+      <*> HasCField.readRaw (BG.Proxy @"get_schema") ptr0
+      <*> HasCField.readRaw (BG.Proxy @"get_next") ptr0
+      <*> HasCField.readRaw (BG.Proxy @"get_last_error") ptr0
+      <*> HasCField.readRaw (BG.Proxy @"release") ptr0
+      <*> HasCField.readRaw (BG.Proxy @"private_data") ptr0
+
+instance Marshal.WriteRaw ArrowArrayStream where
+
+  writeRaw =
+    \ptr0 ->
+      \s1 ->
+        case s1 of
+          ArrowArrayStream get_schema2 get_next3 get_last_error4 release5 private_data6 ->
+               HasCField.writeRaw (BG.Proxy @"get_schema") ptr0 get_schema2
+            >> HasCField.writeRaw (BG.Proxy @"get_next") ptr0 get_next3
+            >> HasCField.writeRaw (BG.Proxy @"get_last_error") ptr0 get_last_error4
+            >> HasCField.writeRaw (BG.Proxy @"release") ptr0 release5
+            >> HasCField.writeRaw (BG.Proxy @"private_data") ptr0 private_data6
+
+deriving via Marshal.EquivStorable ArrowArrayStream instance BG.Storable ArrowArrayStream
+
+deriving via Struct.IsStructViaReadRaw ArrowArrayStream instance Struct.IsStruct ArrowArrayStream
+
+{-| __C declaration:__ @get_schema@
+
+    __defined at:__ @duckdb_arrow.h 40:9@
+
+    __exported by:__ @duckdb_arrow.h@
+-}
+instance ( ty ~ BG.FunPtr (BG.Ptr ArrowArrayStream -> BG.Ptr ArrowSchema -> IO BG.CInt)
+         ) => BG.CompatHasField.HasField "get_schema" ArrowArrayStream ty where
+
+  hasField =
+    \x0 ->
+      ( \y1 ->
+          ArrowArrayStream { get_schema = y1
+                           , get_next = BG.getField @"get_next" x0
+                           , get_last_error = BG.getField @"get_last_error" x0
+                           , release = BG.getField @"release" x0
+                           , private_data = BG.getField @"private_data" x0
+                           }
+      , BG.getField @"get_schema" x0
+      )
+
+instance ( ty ~ BG.FunPtr (BG.Ptr ArrowArrayStream -> BG.Ptr ArrowSchema -> IO BG.CInt)
+         ) => BG.HasField "get_schema" (BG.Ptr ArrowArrayStream) (BG.Ptr ty) where
+
+  getField = HasCField.fromPtr (BG.Proxy @"get_schema")
+
+instance HasCField.HasCField ArrowArrayStream "get_schema" where
+
+  type CFieldType ArrowArrayStream "get_schema" =
+    BG.FunPtr (BG.Ptr ArrowArrayStream -> BG.Ptr ArrowSchema -> IO BG.CInt)
+
+  offset# = \_ -> \_ -> 0
+
+{-| __C declaration:__ @get_next@
+
+    __defined at:__ @duckdb_arrow.h 41:9@
+
+    __exported by:__ @duckdb_arrow.h@
+-}
+instance ( ty ~ BG.FunPtr (BG.Ptr ArrowArrayStream -> BG.Ptr ArrowArray -> IO BG.CInt)
+         ) => BG.CompatHasField.HasField "get_next" ArrowArrayStream ty where
+
+  hasField =
+    \x0 ->
+      ( \y1 ->
+          ArrowArrayStream { get_next = y1
+                           , get_schema = BG.getField @"get_schema" x0
+                           , get_last_error = BG.getField @"get_last_error" x0
+                           , release = BG.getField @"release" x0
+                           , private_data = BG.getField @"private_data" x0
+                           }
+      , BG.getField @"get_next" x0
+      )
+
+instance ( ty ~ BG.FunPtr (BG.Ptr ArrowArrayStream -> BG.Ptr ArrowArray -> IO BG.CInt)
+         ) => BG.HasField "get_next" (BG.Ptr ArrowArrayStream) (BG.Ptr ty) where
+
+  getField = HasCField.fromPtr (BG.Proxy @"get_next")
+
+instance HasCField.HasCField ArrowArrayStream "get_next" where
+
+  type CFieldType ArrowArrayStream "get_next" =
+    BG.FunPtr (BG.Ptr ArrowArrayStream -> BG.Ptr ArrowArray -> IO BG.CInt)
+
+  offset# = \_ -> \_ -> 8
+
+{-| __C declaration:__ @get_last_error@
+
+    __defined at:__ @duckdb_arrow.h 42:17@
+
+    __exported by:__ @duckdb_arrow.h@
+-}
+instance ( ty ~ BG.FunPtr (BG.Ptr ArrowArrayStream -> IO (PtrConst.PtrConst BG.CChar))
+         ) => BG.CompatHasField.HasField "get_last_error" ArrowArrayStream ty where
+
+  hasField =
+    \x0 ->
+      ( \y1 ->
+          ArrowArrayStream { get_last_error = y1
+                           , get_schema = BG.getField @"get_schema" x0
+                           , get_next = BG.getField @"get_next" x0
+                           , release = BG.getField @"release" x0
+                           , private_data = BG.getField @"private_data" x0
+                           }
+      , BG.getField @"get_last_error" x0
+      )
+
+instance ( ty ~ BG.FunPtr (BG.Ptr ArrowArrayStream -> IO (PtrConst.PtrConst BG.CChar))
+         ) => BG.HasField "get_last_error" (BG.Ptr ArrowArrayStream) (BG.Ptr ty) where
+
+  getField =
+    HasCField.fromPtr (BG.Proxy @"get_last_error")
+
+instance HasCField.HasCField ArrowArrayStream "get_last_error" where
+
+  type CFieldType ArrowArrayStream "get_last_error" =
+    BG.FunPtr (BG.Ptr ArrowArrayStream -> IO (PtrConst.PtrConst BG.CChar))
+
+  offset# = \_ -> \_ -> 16
+
+{-| __C declaration:__ @release@
+
+    __defined at:__ @duckdb_arrow.h 43:10@
+
+    __exported by:__ @duckdb_arrow.h@
+-}
+instance ( ty ~ BG.FunPtr (BG.Ptr ArrowArrayStream -> IO ())
+         ) => BG.CompatHasField.HasField "release" ArrowArrayStream ty where
+
+  hasField =
+    \x0 ->
+      ( \y1 ->
+          ArrowArrayStream { release = y1
+                           , get_schema = BG.getField @"get_schema" x0
+                           , get_next = BG.getField @"get_next" x0
+                           , get_last_error = BG.getField @"get_last_error" x0
+                           , private_data = BG.getField @"private_data" x0
+                           }
+      , BG.getField @"release" x0
+      )
+
+instance ( ty ~ BG.FunPtr (BG.Ptr ArrowArrayStream -> IO ())
+         ) => BG.HasField "release" (BG.Ptr ArrowArrayStream) (BG.Ptr ty) where
+
+  getField = HasCField.fromPtr (BG.Proxy @"release")
+
+instance HasCField.HasCField ArrowArrayStream "release" where
+
+  type CFieldType ArrowArrayStream "release" =
+    BG.FunPtr (BG.Ptr ArrowArrayStream -> IO ())
+
+  offset# = \_ -> \_ -> 24
+
+{-| __C declaration:__ @private_data@
+
+    __defined at:__ @duckdb_arrow.h 44:9@
+
+    __exported by:__ @duckdb_arrow.h@
+-}
+instance ( ty ~ BG.Ptr BG.Void
+         ) => BG.CompatHasField.HasField "private_data" ArrowArrayStream ty where
+
+  hasField =
+    \x0 ->
+      ( \y1 ->
+          ArrowArrayStream { private_data = y1
+                           , get_schema = BG.getField @"get_schema" x0
+                           , get_next = BG.getField @"get_next" x0
+                           , get_last_error = BG.getField @"get_last_error" x0
+                           , release = BG.getField @"release" x0
+                           }
+      , BG.getField @"private_data" x0
+      )
+
+instance ( ty ~ BG.Ptr BG.Void
+         ) => BG.HasField "private_data" (BG.Ptr ArrowArrayStream) (BG.Ptr ty) where
+
+  getField =
+    HasCField.fromPtr (BG.Proxy @"private_data")
+
+instance HasCField.HasCField ArrowArrayStream "private_data" where
+
+  type CFieldType ArrowArrayStream "private_data" =
+    BG.Ptr BG.Void
+
+  offset# = \_ -> \_ -> 32
+
+-- __unique:__ @instance ToFunPtr (DuckDBExtensionInfo -> IO (BG.Ptr DuckDBDatabase))@
+foreign import ccall safe "wrapper" hs_bindgen_48c5f906dd22ccd7_base ::
+     (BG.Ptr BG.Void -> IO (BG.Ptr BG.Void))
+  -> IO (BG.FunPtr (BG.Ptr BG.Void -> IO (BG.Ptr BG.Void)))
+
+-- __unique:__ @instance ToFunPtr (DuckDBExtensionInfo -> IO (BG.Ptr DuckDBDatabase))@
+hs_bindgen_48c5f906dd22ccd7 ::
+     (DuckDBExtensionInfo -> IO (BG.Ptr DuckDBDatabase))
+  -> IO (BG.FunPtr (DuckDBExtensionInfo -> IO (BG.Ptr DuckDBDatabase)))
+hs_bindgen_48c5f906dd22ccd7 =
+  \fun0 ->
+    fmap BG.castFunPtr (hs_bindgen_48c5f906dd22ccd7_base (\x1 ->
+                                                            fmap BG.toFFIType (fun0 (BG.fromFFIType x1))))
+
+-- __unique:__ @instance FromFunPtr (DuckDBExtensionInfo -> IO (BG.Ptr DuckDBDatabase))@
+foreign import ccall safe "dynamic" hs_bindgen_370a996b813960f9_base ::
+     BG.FunPtr (BG.Ptr BG.Void -> IO (BG.Ptr BG.Void))
+  -> BG.Ptr BG.Void -> IO (BG.Ptr BG.Void)
+
+-- __unique:__ @instance FromFunPtr (DuckDBExtensionInfo -> IO (BG.Ptr DuckDBDatabase))@
+hs_bindgen_370a996b813960f9 ::
+     BG.FunPtr (DuckDBExtensionInfo -> IO (BG.Ptr DuckDBDatabase))
+  -> DuckDBExtensionInfo -> IO (BG.Ptr DuckDBDatabase)
+hs_bindgen_370a996b813960f9 =
+  \funPtr0 ->
+    \x1 ->
+      fmap BG.fromFFIType (hs_bindgen_370a996b813960f9_base (BG.castFunPtr funPtr0) (BG.toFFIType x1))
+
+instance BG.ToFunPtr (DuckDBExtensionInfo -> IO (BG.Ptr DuckDBDatabase)) where
+
+  toFunPtr = hs_bindgen_48c5f906dd22ccd7
+
+instance BG.FromFunPtr (DuckDBExtensionInfo -> IO (BG.Ptr DuckDBDatabase)) where
+
+  fromFunPtr = hs_bindgen_370a996b813960f9
+
+-- __unique:__ @instance ToFunPtr (DuckDBExtensionInfo -> PtrConst.PtrConst BG.CChar -> IO (PtrConst.PtrConst BG.Void))@
+foreign import ccall safe "wrapper" hs_bindgen_92ad7a7b5f490754_base ::
+     (BG.Ptr BG.Void -> BG.Ptr BG.Void -> IO (BG.Ptr BG.Void))
+  -> IO (BG.FunPtr (BG.Ptr BG.Void -> BG.Ptr BG.Void -> IO (BG.Ptr BG.Void)))
+
+-- __unique:__ @instance ToFunPtr (DuckDBExtensionInfo -> PtrConst.PtrConst BG.CChar -> IO (PtrConst.PtrConst BG.Void))@
+hs_bindgen_92ad7a7b5f490754 ::
+     (DuckDBExtensionInfo -> PtrConst.PtrConst BG.CChar -> IO (PtrConst.PtrConst BG.Void))
+  -> IO (BG.FunPtr (DuckDBExtensionInfo -> PtrConst.PtrConst BG.CChar -> IO (PtrConst.PtrConst BG.Void)))
+hs_bindgen_92ad7a7b5f490754 =
+  \fun0 ->
+    fmap BG.castFunPtr (hs_bindgen_92ad7a7b5f490754_base (\x1 ->
+                                                            \x2 ->
+                                                              fmap BG.toFFIType (fun0 (BG.fromFFIType x1) (BG.fromFFIType x2))))
+
+-- __unique:__ @instance FromFunPtr (DuckDBExtensionInfo -> PtrConst.PtrConst BG.CChar -> IO (PtrConst.PtrConst BG.Void))@
+foreign import ccall safe "dynamic" hs_bindgen_03c1795e92dc3294_base ::
+     BG.FunPtr (BG.Ptr BG.Void -> BG.Ptr BG.Void -> IO (BG.Ptr BG.Void))
+  -> BG.Ptr BG.Void -> BG.Ptr BG.Void -> IO (BG.Ptr BG.Void)
+
+-- __unique:__ @instance FromFunPtr (DuckDBExtensionInfo -> PtrConst.PtrConst BG.CChar -> IO (PtrConst.PtrConst BG.Void))@
+hs_bindgen_03c1795e92dc3294 ::
+     BG.FunPtr (DuckDBExtensionInfo -> PtrConst.PtrConst BG.CChar -> IO (PtrConst.PtrConst BG.Void))
+  -> DuckDBExtensionInfo -> PtrConst.PtrConst BG.CChar -> IO (PtrConst.PtrConst BG.Void)
+hs_bindgen_03c1795e92dc3294 =
+  \funPtr0 ->
+    \x1 ->
+      \x2 ->
+        fmap BG.fromFFIType (hs_bindgen_03c1795e92dc3294_base (BG.castFunPtr funPtr0) (BG.toFFIType x1) (BG.toFFIType x2))
+
+instance BG.ToFunPtr (DuckDBExtensionInfo -> PtrConst.PtrConst BG.CChar -> IO (PtrConst.PtrConst BG.Void)) where
+
+  toFunPtr = hs_bindgen_92ad7a7b5f490754
+
+instance BG.FromFunPtr (DuckDBExtensionInfo -> PtrConst.PtrConst BG.CChar -> IO (PtrConst.PtrConst BG.Void)) where
+
+  fromFunPtr = hs_bindgen_03c1795e92dc3294
+
+-- __unique:__ @instance ToFunPtr (DuckDBExtensionInfo -> PtrConst.PtrConst BG.CChar -> IO ())@
+foreign import ccall safe "wrapper" hs_bindgen_2aa79b5f9f4ab491_base ::
+     (BG.Ptr BG.Void -> BG.Ptr BG.Void -> IO ())
+  -> IO (BG.FunPtr (BG.Ptr BG.Void -> BG.Ptr BG.Void -> IO ()))
+
+-- __unique:__ @instance ToFunPtr (DuckDBExtensionInfo -> PtrConst.PtrConst BG.CChar -> IO ())@
+hs_bindgen_2aa79b5f9f4ab491 ::
+     (DuckDBExtensionInfo -> PtrConst.PtrConst BG.CChar -> IO ())
+  -> IO (BG.FunPtr (DuckDBExtensionInfo -> PtrConst.PtrConst BG.CChar -> IO ()))
+hs_bindgen_2aa79b5f9f4ab491 =
+  \fun0 ->
+    fmap BG.castFunPtr (hs_bindgen_2aa79b5f9f4ab491_base (\x1 ->
+                                                            \x2 ->
+                                                              fun0 (BG.fromFFIType x1) (BG.fromFFIType x2)))
+
+-- __unique:__ @instance FromFunPtr (DuckDBExtensionInfo -> PtrConst.PtrConst BG.CChar -> IO ())@
+foreign import ccall safe "dynamic" hs_bindgen_13a4c88fcbc780df_base ::
+     BG.FunPtr (BG.Ptr BG.Void -> BG.Ptr BG.Void -> IO ())
+  -> BG.Ptr BG.Void -> BG.Ptr BG.Void -> IO ()
+
+-- __unique:__ @instance FromFunPtr (DuckDBExtensionInfo -> PtrConst.PtrConst BG.CChar -> IO ())@
+hs_bindgen_13a4c88fcbc780df ::
+     BG.FunPtr (DuckDBExtensionInfo -> PtrConst.PtrConst BG.CChar -> IO ())
+  -> DuckDBExtensionInfo -> PtrConst.PtrConst BG.CChar -> IO ()
+hs_bindgen_13a4c88fcbc780df =
+  \funPtr0 ->
+    \x1 ->
+      \x2 ->
+        hs_bindgen_13a4c88fcbc780df_base (BG.castFunPtr funPtr0) (BG.toFFIType x1) (BG.toFFIType x2)
+
+instance BG.ToFunPtr (DuckDBExtensionInfo -> PtrConst.PtrConst BG.CChar -> IO ()) where
+
+  toFunPtr = hs_bindgen_2aa79b5f9f4ab491
+
+instance BG.FromFunPtr (DuckDBExtensionInfo -> PtrConst.PtrConst BG.CChar -> IO ()) where
+
+  fromFunPtr = hs_bindgen_13a4c88fcbc780df
+
+-- __unique:__ @instance ToFunPtr (BG.Ptr ArrowArray -> IO ())@
+foreign import ccall safe "wrapper" hs_bindgen_4d336e4487b32130_base ::
+     (BG.Ptr BG.Void -> IO ())
+  -> IO (BG.FunPtr (BG.Ptr BG.Void -> IO ()))
+
+-- __unique:__ @instance ToFunPtr (BG.Ptr ArrowArray -> IO ())@
+hs_bindgen_4d336e4487b32130 ::
+     (BG.Ptr ArrowArray -> IO ())
+  -> IO (BG.FunPtr (BG.Ptr ArrowArray -> IO ()))
+hs_bindgen_4d336e4487b32130 =
+  \fun0 ->
+    fmap BG.castFunPtr (hs_bindgen_4d336e4487b32130_base (\x1 ->
+                                                            fun0 (BG.fromFFIType x1)))
+
+-- __unique:__ @instance FromFunPtr (BG.Ptr ArrowArray -> IO ())@
+foreign import ccall safe "dynamic" hs_bindgen_0b7012dfcd502374_base ::
+     BG.FunPtr (BG.Ptr BG.Void -> IO ())
+  -> BG.Ptr BG.Void -> IO ()
+
+-- __unique:__ @instance FromFunPtr (BG.Ptr ArrowArray -> IO ())@
+hs_bindgen_0b7012dfcd502374 ::
+     BG.FunPtr (BG.Ptr ArrowArray -> IO ())
+  -> BG.Ptr ArrowArray -> IO ()
+hs_bindgen_0b7012dfcd502374 =
+  \funPtr0 ->
+    \x1 ->
+      hs_bindgen_0b7012dfcd502374_base (BG.castFunPtr funPtr0) (BG.toFFIType x1)
+
+instance BG.ToFunPtr (BG.Ptr ArrowArray -> IO ()) where
+
+  toFunPtr = hs_bindgen_4d336e4487b32130
+
+instance BG.FromFunPtr (BG.Ptr ArrowArray -> IO ()) where
+
+  fromFunPtr = hs_bindgen_0b7012dfcd502374
+
+-- __unique:__ @instance ToFunPtr (BG.Ptr ArrowArrayStream -> IO (PtrConst.PtrConst BG.CChar))@
+foreign import ccall safe "wrapper" hs_bindgen_6b9c94c9d66ac396_base ::
+     (BG.Ptr BG.Void -> IO (BG.Ptr BG.Void))
+  -> IO (BG.FunPtr (BG.Ptr BG.Void -> IO (BG.Ptr BG.Void)))
+
+-- __unique:__ @instance ToFunPtr (BG.Ptr ArrowArrayStream -> IO (PtrConst.PtrConst BG.CChar))@
+hs_bindgen_6b9c94c9d66ac396 ::
+     (BG.Ptr ArrowArrayStream -> IO (PtrConst.PtrConst BG.CChar))
+  -> IO (BG.FunPtr (BG.Ptr ArrowArrayStream -> IO (PtrConst.PtrConst BG.CChar)))
+hs_bindgen_6b9c94c9d66ac396 =
+  \fun0 ->
+    fmap BG.castFunPtr (hs_bindgen_6b9c94c9d66ac396_base (\x1 ->
+                                                            fmap BG.toFFIType (fun0 (BG.fromFFIType x1))))
+
+-- __unique:__ @instance FromFunPtr (BG.Ptr ArrowArrayStream -> IO (PtrConst.PtrConst BG.CChar))@
+foreign import ccall safe "dynamic" hs_bindgen_46babed99c1d98c8_base ::
+     BG.FunPtr (BG.Ptr BG.Void -> IO (BG.Ptr BG.Void))
+  -> BG.Ptr BG.Void -> IO (BG.Ptr BG.Void)
+
+-- __unique:__ @instance FromFunPtr (BG.Ptr ArrowArrayStream -> IO (PtrConst.PtrConst BG.CChar))@
+hs_bindgen_46babed99c1d98c8 ::
+     BG.FunPtr (BG.Ptr ArrowArrayStream -> IO (PtrConst.PtrConst BG.CChar))
+  -> BG.Ptr ArrowArrayStream -> IO (PtrConst.PtrConst BG.CChar)
+hs_bindgen_46babed99c1d98c8 =
+  \funPtr0 ->
+    \x1 ->
+      fmap BG.fromFFIType (hs_bindgen_46babed99c1d98c8_base (BG.castFunPtr funPtr0) (BG.toFFIType x1))
+
+instance BG.ToFunPtr (BG.Ptr ArrowArrayStream -> IO (PtrConst.PtrConst BG.CChar)) where
+
+  toFunPtr = hs_bindgen_6b9c94c9d66ac396
+
+instance BG.FromFunPtr (BG.Ptr ArrowArrayStream -> IO (PtrConst.PtrConst BG.CChar)) where
+
+  fromFunPtr = hs_bindgen_46babed99c1d98c8
+
+-- __unique:__ @instance ToFunPtr (BG.Ptr ArrowArrayStream -> IO ())@
+foreign import ccall safe "wrapper" hs_bindgen_53ecea872b08397c_base ::
+     (BG.Ptr BG.Void -> IO ())
+  -> IO (BG.FunPtr (BG.Ptr BG.Void -> IO ()))
+
+-- __unique:__ @instance ToFunPtr (BG.Ptr ArrowArrayStream -> IO ())@
+hs_bindgen_53ecea872b08397c ::
+     (BG.Ptr ArrowArrayStream -> IO ())
+  -> IO (BG.FunPtr (BG.Ptr ArrowArrayStream -> IO ()))
+hs_bindgen_53ecea872b08397c =
+  \fun0 ->
+    fmap BG.castFunPtr (hs_bindgen_53ecea872b08397c_base (\x1 ->
+                                                            fun0 (BG.fromFFIType x1)))
+
+-- __unique:__ @instance FromFunPtr (BG.Ptr ArrowArrayStream -> IO ())@
+foreign import ccall safe "dynamic" hs_bindgen_eaa751fcbe96e4a5_base ::
+     BG.FunPtr (BG.Ptr BG.Void -> IO ())
+  -> BG.Ptr BG.Void -> IO ()
+
+-- __unique:__ @instance FromFunPtr (BG.Ptr ArrowArrayStream -> IO ())@
+hs_bindgen_eaa751fcbe96e4a5 ::
+     BG.FunPtr (BG.Ptr ArrowArrayStream -> IO ())
+  -> BG.Ptr ArrowArrayStream -> IO ()
+hs_bindgen_eaa751fcbe96e4a5 =
+  \funPtr0 ->
+    \x1 ->
+      hs_bindgen_eaa751fcbe96e4a5_base (BG.castFunPtr funPtr0) (BG.toFFIType x1)
+
+instance BG.ToFunPtr (BG.Ptr ArrowArrayStream -> IO ()) where
+
+  toFunPtr = hs_bindgen_53ecea872b08397c
+
+instance BG.FromFunPtr (BG.Ptr ArrowArrayStream -> IO ()) where
+
+  fromFunPtr = hs_bindgen_eaa751fcbe96e4a5
+
+-- __unique:__ @instance ToFunPtr (BG.Ptr ArrowArrayStream -> BG.Ptr ArrowArray -> IO BG.CInt)@
+foreign import ccall safe "wrapper" hs_bindgen_2a3259863e5e2fb9_base ::
+     (BG.Ptr BG.Void -> BG.Ptr BG.Void -> IO BG.CInt)
+  -> IO (BG.FunPtr (BG.Ptr BG.Void -> BG.Ptr BG.Void -> IO BG.CInt))
+
+-- __unique:__ @instance ToFunPtr (BG.Ptr ArrowArrayStream -> BG.Ptr ArrowArray -> IO BG.CInt)@
+hs_bindgen_2a3259863e5e2fb9 ::
+     (BG.Ptr ArrowArrayStream -> BG.Ptr ArrowArray -> IO BG.CInt)
+  -> IO (BG.FunPtr (BG.Ptr ArrowArrayStream -> BG.Ptr ArrowArray -> IO BG.CInt))
+hs_bindgen_2a3259863e5e2fb9 =
+  \fun0 ->
+    fmap BG.castFunPtr (hs_bindgen_2a3259863e5e2fb9_base (\x1 ->
+                                                            \x2 ->
+                                                              fmap BG.toFFIType (fun0 (BG.fromFFIType x1) (BG.fromFFIType x2))))
+
+-- __unique:__ @instance FromFunPtr (BG.Ptr ArrowArrayStream -> BG.Ptr ArrowArray -> IO BG.CInt)@
+foreign import ccall safe "dynamic" hs_bindgen_b8c200d6c217e573_base ::
+     BG.FunPtr (BG.Ptr BG.Void -> BG.Ptr BG.Void -> IO BG.CInt)
+  -> BG.Ptr BG.Void -> BG.Ptr BG.Void -> IO BG.CInt
+
+-- __unique:__ @instance FromFunPtr (BG.Ptr ArrowArrayStream -> BG.Ptr ArrowArray -> IO BG.CInt)@
+hs_bindgen_b8c200d6c217e573 ::
+     BG.FunPtr (BG.Ptr ArrowArrayStream -> BG.Ptr ArrowArray -> IO BG.CInt)
+  -> BG.Ptr ArrowArrayStream -> BG.Ptr ArrowArray -> IO BG.CInt
+hs_bindgen_b8c200d6c217e573 =
+  \funPtr0 ->
+    \x1 ->
+      \x2 ->
+        fmap BG.fromFFIType (hs_bindgen_b8c200d6c217e573_base (BG.castFunPtr funPtr0) (BG.toFFIType x1) (BG.toFFIType x2))
+
+instance BG.ToFunPtr (BG.Ptr ArrowArrayStream -> BG.Ptr ArrowArray -> IO BG.CInt) where
+
+  toFunPtr = hs_bindgen_2a3259863e5e2fb9
+
+instance BG.FromFunPtr (BG.Ptr ArrowArrayStream -> BG.Ptr ArrowArray -> IO BG.CInt) where
+
+  fromFunPtr = hs_bindgen_b8c200d6c217e573
+
+-- __unique:__ @instance ToFunPtr (BG.Ptr ArrowArrayStream -> BG.Ptr ArrowSchema -> IO BG.CInt)@
+foreign import ccall safe "wrapper" hs_bindgen_1bd5acba953515a9_base ::
+     (BG.Ptr BG.Void -> BG.Ptr BG.Void -> IO BG.CInt)
+  -> IO (BG.FunPtr (BG.Ptr BG.Void -> BG.Ptr BG.Void -> IO BG.CInt))
+
+-- __unique:__ @instance ToFunPtr (BG.Ptr ArrowArrayStream -> BG.Ptr ArrowSchema -> IO BG.CInt)@
+hs_bindgen_1bd5acba953515a9 ::
+     (BG.Ptr ArrowArrayStream -> BG.Ptr ArrowSchema -> IO BG.CInt)
+  -> IO (BG.FunPtr (BG.Ptr ArrowArrayStream -> BG.Ptr ArrowSchema -> IO BG.CInt))
+hs_bindgen_1bd5acba953515a9 =
+  \fun0 ->
+    fmap BG.castFunPtr (hs_bindgen_1bd5acba953515a9_base (\x1 ->
+                                                            \x2 ->
+                                                              fmap BG.toFFIType (fun0 (BG.fromFFIType x1) (BG.fromFFIType x2))))
+
+-- __unique:__ @instance FromFunPtr (BG.Ptr ArrowArrayStream -> BG.Ptr ArrowSchema -> IO BG.CInt)@
+foreign import ccall safe "dynamic" hs_bindgen_be93abfc8b9e05df_base ::
+     BG.FunPtr (BG.Ptr BG.Void -> BG.Ptr BG.Void -> IO BG.CInt)
+  -> BG.Ptr BG.Void -> BG.Ptr BG.Void -> IO BG.CInt
+
+-- __unique:__ @instance FromFunPtr (BG.Ptr ArrowArrayStream -> BG.Ptr ArrowSchema -> IO BG.CInt)@
+hs_bindgen_be93abfc8b9e05df ::
+     BG.FunPtr (BG.Ptr ArrowArrayStream -> BG.Ptr ArrowSchema -> IO BG.CInt)
+  -> BG.Ptr ArrowArrayStream -> BG.Ptr ArrowSchema -> IO BG.CInt
+hs_bindgen_be93abfc8b9e05df =
+  \funPtr0 ->
+    \x1 ->
+      \x2 ->
+        fmap BG.fromFFIType (hs_bindgen_be93abfc8b9e05df_base (BG.castFunPtr funPtr0) (BG.toFFIType x1) (BG.toFFIType x2))
+
+instance BG.ToFunPtr (BG.Ptr ArrowArrayStream -> BG.Ptr ArrowSchema -> IO BG.CInt) where
+
+  toFunPtr = hs_bindgen_1bd5acba953515a9
+
+instance BG.FromFunPtr (BG.Ptr ArrowArrayStream -> BG.Ptr ArrowSchema -> IO BG.CInt) where
+
+  fromFunPtr = hs_bindgen_be93abfc8b9e05df
+
+-- __unique:__ @instance ToFunPtr (BG.Ptr ArrowSchema -> IO ())@
+foreign import ccall safe "wrapper" hs_bindgen_eb4670e8ca3edb75_base ::
+     (BG.Ptr BG.Void -> IO ())
+  -> IO (BG.FunPtr (BG.Ptr BG.Void -> IO ()))
+
+-- __unique:__ @instance ToFunPtr (BG.Ptr ArrowSchema -> IO ())@
+hs_bindgen_eb4670e8ca3edb75 ::
+     (BG.Ptr ArrowSchema -> IO ())
+  -> IO (BG.FunPtr (BG.Ptr ArrowSchema -> IO ()))
+hs_bindgen_eb4670e8ca3edb75 =
+  \fun0 ->
+    fmap BG.castFunPtr (hs_bindgen_eb4670e8ca3edb75_base (\x1 ->
+                                                            fun0 (BG.fromFFIType x1)))
+
+-- __unique:__ @instance FromFunPtr (BG.Ptr ArrowSchema -> IO ())@
+foreign import ccall safe "dynamic" hs_bindgen_cf541a6b0d109282_base ::
+     BG.FunPtr (BG.Ptr BG.Void -> IO ())
+  -> BG.Ptr BG.Void -> IO ()
+
+-- __unique:__ @instance FromFunPtr (BG.Ptr ArrowSchema -> IO ())@
+hs_bindgen_cf541a6b0d109282 ::
+     BG.FunPtr (BG.Ptr ArrowSchema -> IO ())
+  -> BG.Ptr ArrowSchema -> IO ()
+hs_bindgen_cf541a6b0d109282 =
+  \funPtr0 ->
+    \x1 ->
+      hs_bindgen_cf541a6b0d109282_base (BG.castFunPtr funPtr0) (BG.toFFIType x1)
+
+instance BG.ToFunPtr (BG.Ptr ArrowSchema -> IO ()) where
+
+  toFunPtr = hs_bindgen_eb4670e8ca3edb75
+
+instance BG.FromFunPtr (BG.Ptr ArrowSchema -> IO ()) where
+
+  fromFunPtr = hs_bindgen_cf541a6b0d109282
+
+-- __unique:__ @Database_DuckDB_FFI_Database.DuckDB.FFI_Safe_duckdb_from_date@
+foreign import ccall safe "hs_bindgen_153d18959d6bdde2" hs_bindgen_153d18959d6bdde2_base ::
+     BG.Ptr BG.Void
+  -> BG.Ptr BG.Void
+  -> IO ()
+
+-- __unique:__ @Database_DuckDB_FFI_Database.DuckDB.FFI_Safe_duckdb_from_date@
+hs_bindgen_153d18959d6bdde2 ::
+     BG.Ptr DuckDBDate
+  -> BG.Ptr DuckDBDateStruct
+  -> IO ()
+hs_bindgen_153d18959d6bdde2 =
+  \x0 ->
+    \x1 ->
+      hs_bindgen_153d18959d6bdde2_base (BG.toFFIType x0) (BG.toFFIType x1)
+
+{-| Decompose a @t'DuckDBDate'@ object into year, month and date (stored as @t'DuckDBDateStruct'@ ).
+
+    history:
+
+    * stable: v0.2.9
+
+    [__@date@__]: The date object, as obtained from a @@DUCKDB_TYPE_DATE@@ column.
+
+    __Returns:__ t'DuckDBDateStruct'
+
+    __C declaration:__ @duckdb_from_date@
+
+    __defined at:__ @duckdb.h 1604:33@
+
+    __exported by:__ @duckdb.h@
+-}
+c_duckdb_from_date ::
+     DuckDBDate
+     {- ^
+
+          [__@date@__]: The date object, as obtained from a @@DUCKDB_TYPE_DATE@@ column.
+
+          __C declaration:__ @date@
+     -}
+  -> IO DuckDBDateStruct
+c_duckdb_from_date =
+  \date0 ->
+    BG.with date0 (\date1 ->
+                     BG.allocaAndPeek (\res2 ->
+                                         hs_bindgen_153d18959d6bdde2 date1 res2))
+
+-- __unique:__ @Database_DuckDB_FFI_Database.DuckDB.FFI_Safe_duckdb_to_date@
+foreign import ccall safe "hs_bindgen_e8e2ae846bc846bd" hs_bindgen_e8e2ae846bc846bd_base ::
+     BG.Ptr BG.Void
+  -> BG.Ptr BG.Void
+  -> IO ()
+
+-- __unique:__ @Database_DuckDB_FFI_Database.DuckDB.FFI_Safe_duckdb_to_date@
+hs_bindgen_e8e2ae846bc846bd ::
+     BG.Ptr DuckDBDateStruct
+  -> BG.Ptr DuckDBDate
+  -> IO ()
+hs_bindgen_e8e2ae846bc846bd =
+  \x0 ->
+    \x1 ->
+      hs_bindgen_e8e2ae846bc846bd_base (BG.toFFIType x0) (BG.toFFIType x1)
+
+{-| Re-compose a @t'DuckDBDate'@ from year, month and date ( @t'DuckDBDateStruct'@ ).
+
+    history:
+
+    * stable: v0.2.9
+
+    [__@date@__]: The year, month and date stored in a @t'DuckDBDateStruct'@ .
+
+    __Returns:__ t'DuckDBDate'
+
+    __C declaration:__ @duckdb_to_date@
+
+    __defined at:__ @duckdb.h 1617:26@
+
+    __exported by:__ @duckdb.h@
+-}
+c_duckdb_to_date ::
+     DuckDBDateStruct
+     {- ^
+
+          [__@date@__]: The year, month and date stored in a @t'DuckDBDateStruct'@ .
+
+          __C declaration:__ @date@
+     -}
+  -> IO DuckDBDate
+c_duckdb_to_date =
+  \date0 ->
+    BG.with date0 (\date1 ->
+                     BG.allocaAndPeek (\res2 ->
+                                         hs_bindgen_e8e2ae846bc846bd date1 res2))
+
+-- __unique:__ @Database_DuckDB_FFI_Database.DuckDB.FFI_Safe_duckdb_is_finite_date@
+foreign import ccall safe "hs_bindgen_0502603ff03a9a85" hs_bindgen_0502603ff03a9a85_base ::
+     BG.Ptr BG.Void
+  -> IO BG.CBool
+
+-- __unique:__ @Database_DuckDB_FFI_Database.DuckDB.FFI_Safe_duckdb_is_finite_date@
+hs_bindgen_0502603ff03a9a85 ::
+     BG.Ptr DuckDBDate
+  -> IO BG.CBool
+hs_bindgen_0502603ff03a9a85 =
+  \x0 ->
+    fmap BG.fromFFIType (hs_bindgen_0502603ff03a9a85_base (BG.toFFIType x0))
+
+{-| Test a @t'DuckDBDate'@ to see if it is a finite value.
+
+    history:
+
+    * stable: v0.10.0
+
+    [__@date@__]: The date object, as obtained from a @@DUCKDB_TYPE_DATE@@ column.
+
+    __Returns:__ bool
+
+    __C declaration:__ @duckdb_is_finite_date@
+
+    __defined at:__ @duckdb.h 1630:19@
+
+    __exported by:__ @duckdb.h@
+-}
+c_duckdb_is_finite_date ::
+     DuckDBDate
+     {- ^
+
+          [__@date@__]: The date object, as obtained from a @@DUCKDB_TYPE_DATE@@ column.
+
+          __C declaration:__ @date@
+     -}
+  -> IO BG.CBool
+c_duckdb_is_finite_date =
+  \date0 ->
+    BG.with date0 (\date1 ->
+                     hs_bindgen_0502603ff03a9a85 date1)
+
+-- __unique:__ @Database_DuckDB_FFI_Database.DuckDB.FFI_Safe_duckdb_from_time@
+foreign import ccall safe "hs_bindgen_6f585e0d38d45906" hs_bindgen_6f585e0d38d45906_base ::
+     BG.Ptr BG.Void
+  -> BG.Ptr BG.Void
+  -> IO ()
+
+-- __unique:__ @Database_DuckDB_FFI_Database.DuckDB.FFI_Safe_duckdb_from_time@
+hs_bindgen_6f585e0d38d45906 ::
+     BG.Ptr DuckDBTime
+  -> BG.Ptr DuckDBTimeStruct
+  -> IO ()
+hs_bindgen_6f585e0d38d45906 =
+  \x0 ->
+    \x1 ->
+      hs_bindgen_6f585e0d38d45906_base (BG.toFFIType x0) (BG.toFFIType x1)
+
+{-| Decompose a @t'DuckDBTime'@ object into hour, minute, second and microsecond (stored as @t'DuckDBTimeStruct'@ ).
+
+    history:
+
+    * stable: v0.2.9
+
+    [__@time@__]: The time object, as obtained from a @@DUCKDB_TYPE_TIME@@ column.
+
+    __Returns:__ t'DuckDBTimeStruct'
+
+    __C declaration:__ @duckdb_from_time@
+
+    __defined at:__ @duckdb.h 1643:33@
+
+    __exported by:__ @duckdb.h@
+-}
+c_duckdb_from_time ::
+     DuckDBTime
+     {- ^
+
+          [__@time@__]: The time object, as obtained from a @@DUCKDB_TYPE_TIME@@ column.
+
+          __C declaration:__ @time@
+     -}
+  -> IO DuckDBTimeStruct
+c_duckdb_from_time =
+  \time0 ->
+    BG.with time0 (\time1 ->
+                     BG.allocaAndPeek (\res2 ->
+                                         hs_bindgen_6f585e0d38d45906 time1 res2))
+
+-- __unique:__ @Database_DuckDB_FFI_Database.DuckDB.FFI_Safe_duckdb_create_time_tz@
+foreign import ccall safe "hs_bindgen_3895748c6e0f7040" hs_bindgen_3895748c6e0f7040_base ::
+     HsBindgen.Runtime.LibC.Int64
+  -> HsBindgen.Runtime.LibC.Int32
+  -> BG.Ptr BG.Void
+  -> IO ()
+
+-- __unique:__ @Database_DuckDB_FFI_Database.DuckDB.FFI_Safe_duckdb_create_time_tz@
+hs_bindgen_3895748c6e0f7040 ::
+     HsBindgen.Runtime.LibC.Int64
+  -> HsBindgen.Runtime.LibC.Int32
+  -> BG.Ptr DuckDBTimeTz
+  -> IO ()
+hs_bindgen_3895748c6e0f7040 =
+  \x0 ->
+    \x1 ->
+      \x2 ->
+        hs_bindgen_3895748c6e0f7040_base (BG.toFFIType x0) (BG.toFFIType x1) (BG.toFFIType x2)
+
+{-| Create a @t'DuckDBTimeTz'@ object from micros and a timezone offset.
+
+    history:
+
+    * stable: v0.10.0
+
+    [__@micros@__]: The microsecond component of the time.
+
+    [__@offset@__]: The timezone offset component of the time.
+
+    __Returns:__ t'DuckDBTimeTz'
+
+    __C declaration:__ @duckdb_create_time_tz@
+
+    __defined at:__ @duckdb.h 1657:29@
+
+    __exported by:__ @duckdb.h@
+-}
+c_duckdb_create_time_tz ::
+     HsBindgen.Runtime.LibC.Int64
+     {- ^
+
+          [__@micros@__]: The microsecond component of the time.
+
+          __C declaration:__ @micros@
+     -}
+  -> HsBindgen.Runtime.LibC.Int32
+     {- ^
+
+          [__@offset@__]: The timezone offset component of the time.
+
+          __C declaration:__ @offset@
+     -}
+  -> IO DuckDBTimeTz
+c_duckdb_create_time_tz =
+  \micros0 ->
+    \offset1 ->
+      BG.allocaAndPeek (\res2 ->
+                          hs_bindgen_3895748c6e0f7040 micros0 offset1 res2)
+
+-- __unique:__ @Database_DuckDB_FFI_Database.DuckDB.FFI_Safe_duckdb_from_time_tz@
+foreign import ccall safe "hs_bindgen_a6d9dec3e303c7f7" hs_bindgen_a6d9dec3e303c7f7_base ::
+     BG.Ptr BG.Void
+  -> BG.Ptr BG.Void
+  -> IO ()
+
+-- __unique:__ @Database_DuckDB_FFI_Database.DuckDB.FFI_Safe_duckdb_from_time_tz@
+hs_bindgen_a6d9dec3e303c7f7 ::
+     BG.Ptr DuckDBTimeTz
+  -> BG.Ptr DuckDBTimeTzStruct
+  -> IO ()
+hs_bindgen_a6d9dec3e303c7f7 =
+  \x0 ->
+    \x1 ->
+      hs_bindgen_a6d9dec3e303c7f7_base (BG.toFFIType x0) (BG.toFFIType x1)
+
+{-| Decompose a TIME_TZ objects into micros and a timezone offset.
+
+    Use @'c_duckdb_from_time'@ to further decompose the micros into hour, minute, second and microsecond.
+
+    history:
+
+    * stable: v0.10.0
+
+    [__@micros@__]: The time object, as obtained from a @@DUCKDB_TYPE_TIME_TZ@@ column.
+
+    __Returns:__ t'DuckDBTimeTzStruct'
+
+    __C declaration:__ @duckdb_from_time_tz@
+
+    __defined at:__ @duckdb.h 1672:36@
+
+    __exported by:__ @duckdb.h@
+-}
+c_duckdb_from_time_tz ::
+     DuckDBTimeTz
+     {- ^
+
+          [__@micros@__]: The time object, as obtained from a @@DUCKDB_TYPE_TIME_TZ@@ column.
+
+          __C declaration:__ @micros@
+     -}
+  -> IO DuckDBTimeTzStruct
+c_duckdb_from_time_tz =
+  \micros0 ->
+    BG.with micros0 (\micros1 ->
+                       BG.allocaAndPeek (\res2 ->
+                                           hs_bindgen_a6d9dec3e303c7f7 micros1 res2))
+
+-- __unique:__ @Database_DuckDB_FFI_Database.DuckDB.FFI_Safe_duckdb_to_time@
+foreign import ccall safe "hs_bindgen_2bcbaabda02073ac" hs_bindgen_2bcbaabda02073ac_base ::
+     BG.Ptr BG.Void
+  -> BG.Ptr BG.Void
+  -> IO ()
+
+-- __unique:__ @Database_DuckDB_FFI_Database.DuckDB.FFI_Safe_duckdb_to_time@
+hs_bindgen_2bcbaabda02073ac ::
+     BG.Ptr DuckDBTimeStruct
+  -> BG.Ptr DuckDBTime
+  -> IO ()
+hs_bindgen_2bcbaabda02073ac =
+  \x0 ->
+    \x1 ->
+      hs_bindgen_2bcbaabda02073ac_base (BG.toFFIType x0) (BG.toFFIType x1)
+
+{-| Re-compose a @t'DuckDBTime'@ from hour, minute, second and microsecond ( @t'DuckDBTimeStruct'@ ).
+
+    history:
+
+    * stable: v0.2.9
+
+    [__@time@__]: The hour, minute, second and microsecond in a @t'DuckDBTimeStruct'@ .
+
+    __Returns:__ t'DuckDBTime'
+
+    __C declaration:__ @duckdb_to_time@
+
+    __defined at:__ @duckdb.h 1685:26@
+
+    __exported by:__ @duckdb.h@
+-}
+c_duckdb_to_time ::
+     DuckDBTimeStruct
+     {- ^
+
+          [__@time@__]: The hour, minute, second and microsecond in a @t'DuckDBTimeStruct'@ .
+
+          __C declaration:__ @time@
+     -}
+  -> IO DuckDBTime
+c_duckdb_to_time =
+  \time0 ->
+    BG.with time0 (\time1 ->
+                     BG.allocaAndPeek (\res2 ->
+                                         hs_bindgen_2bcbaabda02073ac time1 res2))
+
+-- __unique:__ @Database_DuckDB_FFI_Database.DuckDB.FFI_Safe_duckdb_from_timestamp@
+foreign import ccall safe "hs_bindgen_53776ff8b2acd73e" hs_bindgen_53776ff8b2acd73e_base ::
+     BG.Ptr BG.Void
+  -> BG.Ptr BG.Void
+  -> IO ()
+
+-- __unique:__ @Database_DuckDB_FFI_Database.DuckDB.FFI_Safe_duckdb_from_timestamp@
+hs_bindgen_53776ff8b2acd73e ::
+     BG.Ptr DuckDBTimestamp
+  -> BG.Ptr DuckDBTimestampStruct
+  -> IO ()
+hs_bindgen_53776ff8b2acd73e =
+  \x0 ->
+    \x1 ->
+      hs_bindgen_53776ff8b2acd73e_base (BG.toFFIType x0) (BG.toFFIType x1)
+
+{-| Decompose a @t'DuckDBTimestamp'@ object into a @t'DuckDBTimestampStruct'@ .
+
+    history:
+
+    * stable: v0.2.9
+
+    [__@ts@__]: The ts object, as obtained from a @@DUCKDB_TYPE_TIMESTAMP@@ column.
+
+    __Returns:__ t'DuckDBTimestampStruct'
+
+    __C declaration:__ @duckdb_from_timestamp@
+
+    __defined at:__ @duckdb.h 1698:38@
+
+    __exported by:__ @duckdb.h@
+-}
+c_duckdb_from_timestamp ::
+     DuckDBTimestamp
+     {- ^
+
+          [__@ts@__]: The ts object, as obtained from a @@DUCKDB_TYPE_TIMESTAMP@@ column.
+
+          __C declaration:__ @ts@
+     -}
+  -> IO DuckDBTimestampStruct
+c_duckdb_from_timestamp =
+  \ts0 ->
+    BG.with ts0 (\ts1 ->
+                   BG.allocaAndPeek (\res2 ->
+                                       hs_bindgen_53776ff8b2acd73e ts1 res2))
+
+-- __unique:__ @Database_DuckDB_FFI_Database.DuckDB.FFI_Safe_duckdb_to_timestamp@
+foreign import ccall safe "hs_bindgen_2213a6caf7cf5a2a" hs_bindgen_2213a6caf7cf5a2a_base ::
+     BG.Ptr BG.Void
+  -> BG.Ptr BG.Void
+  -> IO ()
+
+-- __unique:__ @Database_DuckDB_FFI_Database.DuckDB.FFI_Safe_duckdb_to_timestamp@
+hs_bindgen_2213a6caf7cf5a2a ::
+     BG.Ptr DuckDBTimestampStruct
+  -> BG.Ptr DuckDBTimestamp
+  -> IO ()
+hs_bindgen_2213a6caf7cf5a2a =
+  \x0 ->
+    \x1 ->
+      hs_bindgen_2213a6caf7cf5a2a_base (BG.toFFIType x0) (BG.toFFIType x1)
+
+{-|
+
+    Re-compose a @t'DuckDBTimestamp'@ from a t'DuckDBTimestampStruct' .
+
+    history:
+
+    * stable: v0.2.9
+
+    [__@ts@__]: The de-composed elements in a @t'DuckDBTimestampStruct'@ .
+
+    __Returns:__ t'DuckDBTimestamp'
+
+    __C declaration:__ @duckdb_to_timestamp@
+
+    __defined at:__ @duckdb.h 1711:31@
+
+    __exported by:__ @duckdb.h@
+-}
+c_duckdb_to_timestamp ::
+     DuckDBTimestampStruct
+     {- ^
+
+          [__@ts@__]: The de-composed elements in a @t'DuckDBTimestampStruct'@ .
+
+          __C declaration:__ @ts@
+     -}
+  -> IO DuckDBTimestamp
+c_duckdb_to_timestamp =
+  \ts0 ->
+    BG.with ts0 (\ts1 ->
+                   BG.allocaAndPeek (\res2 ->
+                                       hs_bindgen_2213a6caf7cf5a2a ts1 res2))
+
+-- __unique:__ @Database_DuckDB_FFI_Database.DuckDB.FFI_Safe_duckdb_is_finite_timestamp@
+foreign import ccall safe "hs_bindgen_6bf40d2c8f650521" hs_bindgen_6bf40d2c8f650521_base ::
+     BG.Ptr BG.Void
+  -> IO BG.CBool
+
+-- __unique:__ @Database_DuckDB_FFI_Database.DuckDB.FFI_Safe_duckdb_is_finite_timestamp@
+hs_bindgen_6bf40d2c8f650521 ::
+     BG.Ptr DuckDBTimestamp
+  -> IO BG.CBool
+hs_bindgen_6bf40d2c8f650521 =
+  \x0 ->
+    fmap BG.fromFFIType (hs_bindgen_6bf40d2c8f650521_base (BG.toFFIType x0))
+
+{-| Test a @t'DuckDBTimestamp'@ to see if it is a finite value.
+
+    history:
+
+    * stable: v0.10.0
+
+    [__@ts@__]: The t'DuckDBTimestamp' object, as obtained from a @@DUCKDB_TYPE_TIMESTAMP@@ column.
+
+    __Returns:__ bool
+
+    __C declaration:__ @duckdb_is_finite_timestamp@
+
+    __defined at:__ @duckdb.h 1724:19@
+
+    __exported by:__ @duckdb.h@
+-}
+c_duckdb_is_finite_timestamp ::
+     DuckDBTimestamp
+     {- ^
+
+          [__@ts@__]: The t'DuckDBTimestamp' object, as obtained from a @@DUCKDB_TYPE_TIMESTAMP@@ column.
+
+          __C declaration:__ @ts@
+     -}
+  -> IO BG.CBool
+c_duckdb_is_finite_timestamp =
+  \ts0 ->
+    BG.with ts0 (\ts1 -> hs_bindgen_6bf40d2c8f650521 ts1)
+
+-- __unique:__ @Database_DuckDB_FFI_Database.DuckDB.FFI_Safe_duckdb_is_finite_timestamp_s@
+foreign import ccall safe "hs_bindgen_3de825c497718ef8" hs_bindgen_3de825c497718ef8_base ::
+     BG.Ptr BG.Void
+  -> IO BG.CBool
+
+-- __unique:__ @Database_DuckDB_FFI_Database.DuckDB.FFI_Safe_duckdb_is_finite_timestamp_s@
+hs_bindgen_3de825c497718ef8 ::
+     BG.Ptr DuckDBTimestampS
+  -> IO BG.CBool
+hs_bindgen_3de825c497718ef8 =
+  \x0 ->
+    fmap BG.fromFFIType (hs_bindgen_3de825c497718ef8_base (BG.toFFIType x0))
+
+{-| Test a @t'DuckDBTimestampS'@ to see if it is a finite value.
+
+    history:
+
+    * stable: v1.2.0
+
+    [__@ts@__]: The t'DuckDBTimestampS' object, as obtained from a @@DUCKDB_TYPE_TIMESTAMP_S@@ column.
+
+    __Returns:__ bool
+
+    __C declaration:__ @duckdb_is_finite_timestamp_s@
+
+    __defined at:__ @duckdb.h 1737:19@
+
+    __exported by:__ @duckdb.h@
+-}
+c_duckdb_is_finite_timestamp_s ::
+     DuckDBTimestampS
+     {- ^
+
+          [__@ts@__]: The t'DuckDBTimestampS' object, as obtained from a @@DUCKDB_TYPE_TIMESTAMP_S@@ column.
+
+          __C declaration:__ @ts@
+     -}
+  -> IO BG.CBool
+c_duckdb_is_finite_timestamp_s =
+  \ts0 ->
+    BG.with ts0 (\ts1 -> hs_bindgen_3de825c497718ef8 ts1)
+
+-- __unique:__ @Database_DuckDB_FFI_Database.DuckDB.FFI_Safe_duckdb_is_finite_timestamp_ms@
+foreign import ccall safe "hs_bindgen_ddb9e22e35fce1f5" hs_bindgen_ddb9e22e35fce1f5_base ::
+     BG.Ptr BG.Void
+  -> IO BG.CBool
+
+-- __unique:__ @Database_DuckDB_FFI_Database.DuckDB.FFI_Safe_duckdb_is_finite_timestamp_ms@
+hs_bindgen_ddb9e22e35fce1f5 ::
+     BG.Ptr DuckDBTimestampMs
+  -> IO BG.CBool
+hs_bindgen_ddb9e22e35fce1f5 =
+  \x0 ->
+    fmap BG.fromFFIType (hs_bindgen_ddb9e22e35fce1f5_base (BG.toFFIType x0))
+
+{-| Test a @t'DuckDBTimestampMs'@ to see if it is a finite value.
+
+    history:
+
+    * stable: v1.2.0
+
+    [__@ts@__]: The t'DuckDBTimestampMs' object, as obtained from a @@DUCKDB_TYPE_TIMESTAMP_MS@@ column.
+
+    __Returns:__ bool
+
+    __C declaration:__ @duckdb_is_finite_timestamp_ms@
+
+    __defined at:__ @duckdb.h 1750:19@
+
+    __exported by:__ @duckdb.h@
+-}
+c_duckdb_is_finite_timestamp_ms ::
+     DuckDBTimestampMs
+     {- ^
+
+          [__@ts@__]: The t'DuckDBTimestampMs' object, as obtained from a @@DUCKDB_TYPE_TIMESTAMP_MS@@ column.
+
+          __C declaration:__ @ts@
+     -}
+  -> IO BG.CBool
+c_duckdb_is_finite_timestamp_ms =
+  \ts0 ->
+    BG.with ts0 (\ts1 -> hs_bindgen_ddb9e22e35fce1f5 ts1)
+
+-- __unique:__ @Database_DuckDB_FFI_Database.DuckDB.FFI_Safe_duckdb_is_finite_timestamp_ns@
+foreign import ccall safe "hs_bindgen_0f484f72b5cf1c3b" hs_bindgen_0f484f72b5cf1c3b_base ::
+     BG.Ptr BG.Void
+  -> IO BG.CBool
+
+-- __unique:__ @Database_DuckDB_FFI_Database.DuckDB.FFI_Safe_duckdb_is_finite_timestamp_ns@
+hs_bindgen_0f484f72b5cf1c3b ::
+     BG.Ptr DuckDBTimestampNs
+  -> IO BG.CBool
+hs_bindgen_0f484f72b5cf1c3b =
+  \x0 ->
+    fmap BG.fromFFIType (hs_bindgen_0f484f72b5cf1c3b_base (BG.toFFIType x0))
+
+{-| Test a @t'DuckDBTimestampNs'@ to see if it is a finite value.
+
+    history:
+
+    * stable: v1.2.0
+
+    [__@ts@__]: The t'DuckDBTimestampNs' object, as obtained from a @@DUCKDB_TYPE_TIMESTAMP_NS@@ column.
+
+    __Returns:__ bool
+
+    __C declaration:__ @duckdb_is_finite_timestamp_ns@
+
+    __defined at:__ @duckdb.h 1763:19@
+
+    __exported by:__ @duckdb.h@
+-}
+c_duckdb_is_finite_timestamp_ns ::
+     DuckDBTimestampNs
+     {- ^
+
+          [__@ts@__]: The t'DuckDBTimestampNs' object, as obtained from a @@DUCKDB_TYPE_TIMESTAMP_NS@@ column.
+
+          __C declaration:__ @ts@
+     -}
+  -> IO BG.CBool
+c_duckdb_is_finite_timestamp_ns =
+  \ts0 ->
+    BG.with ts0 (\ts1 -> hs_bindgen_0f484f72b5cf1c3b ts1)
+
+-- __unique:__ @Database_DuckDB_FFI_Database.DuckDB.FFI_Safe_duckdb_hugeint_to_double@
+foreign import ccall safe "hs_bindgen_bbbbec73ad41a6be" hs_bindgen_bbbbec73ad41a6be_base ::
+     BG.Ptr BG.Void
+  -> IO BG.CDouble
+
+-- __unique:__ @Database_DuckDB_FFI_Database.DuckDB.FFI_Safe_duckdb_hugeint_to_double@
+hs_bindgen_bbbbec73ad41a6be ::
+     BG.Ptr DuckDBHugeInt
+  -> IO BG.CDouble
+hs_bindgen_bbbbec73ad41a6be =
+  \x0 ->
+    fmap BG.fromFFIType (hs_bindgen_bbbbec73ad41a6be_base (BG.toFFIType x0))
+
+{-|
+
+    Converts a t'DuckDBHugeInt' object (as obtained from a @@DUCKDB_TYPE_HUGEINT@@ column) into a double.
+
+    history:
+
+    * stable: v0.2.9
+
+    [__@val@__]: The hugeint value.
+
+    __Returns:__ double
+
+    __C declaration:__ @duckdb_hugeint_to_double@
+
+    __defined at:__ @duckdb.h 1776:21@
+
+    __exported by:__ @duckdb.h@
+-}
+c_duckdb_hugeint_to_double ::
+     DuckDBHugeInt
+     {- ^
+
+          [__@val@__]: The hugeint value.
+
+          __C declaration:__ @val@
+     -}
+  -> IO BG.CDouble
+c_duckdb_hugeint_to_double =
+  \val0 ->
+    BG.with val0 (\val1 ->
+                    hs_bindgen_bbbbec73ad41a6be val1)
+
+-- __unique:__ @Database_DuckDB_FFI_Database.DuckDB.FFI_Safe_duckdb_double_to_hugeint@
+foreign import ccall safe "hs_bindgen_09890e1c7e06ce22" hs_bindgen_09890e1c7e06ce22_base ::
+     BG.CDouble
+  -> BG.Ptr BG.Void
+  -> IO ()
+
+-- __unique:__ @Database_DuckDB_FFI_Database.DuckDB.FFI_Safe_duckdb_double_to_hugeint@
+hs_bindgen_09890e1c7e06ce22 ::
+     BG.CDouble
+  -> BG.Ptr DuckDBHugeInt
+  -> IO ()
+hs_bindgen_09890e1c7e06ce22 =
+  \x0 ->
+    \x1 ->
+      hs_bindgen_09890e1c7e06ce22_base (BG.toFFIType x0) (BG.toFFIType x1)
+
+{-|
+
+    Converts a double value to a t'DuckDBHugeInt' object.
+
+    If the conversion fails because the double value is too big the result will be 0.
+
+    history:
+
+    * stable: v0.2.9
+
+    [__@val@__]: The double value.
+
+    __Returns:__ t'DuckDBHugeInt'
+
+    __C declaration:__ @duckdb_double_to_hugeint@
+
+    __defined at:__ @duckdb.h 1791:29@
+
+    __exported by:__ @duckdb.h@
+-}
+c_duckdb_double_to_hugeint ::
+     BG.CDouble
+     {- ^
+
+          [__@val@__]: The double value.
+
+          __C declaration:__ @val@
+     -}
+  -> IO DuckDBHugeInt
+c_duckdb_double_to_hugeint =
+  \val0 ->
+    BG.allocaAndPeek (\res1 ->
+                        hs_bindgen_09890e1c7e06ce22 val0 res1)
+
+-- __unique:__ @Database_DuckDB_FFI_Database.DuckDB.FFI_Safe_duckdb_uhugeint_to_double@
+foreign import ccall safe "hs_bindgen_e347968d8ba72f9d" hs_bindgen_e347968d8ba72f9d_base ::
+     BG.Ptr BG.Void
+  -> IO BG.CDouble
+
+-- __unique:__ @Database_DuckDB_FFI_Database.DuckDB.FFI_Safe_duckdb_uhugeint_to_double@
+hs_bindgen_e347968d8ba72f9d ::
+     BG.Ptr DuckDBUHugeInt
+  -> IO BG.CDouble
+hs_bindgen_e347968d8ba72f9d =
+  \x0 ->
+    fmap BG.fromFFIType (hs_bindgen_e347968d8ba72f9d_base (BG.toFFIType x0))
+
+{-|
+
+    Converts a t'DuckDBUHugeInt' object (as obtained from a @@DUCKDB_TYPE_UHUGEINT@@ column) into a double.
+
+    history:
+
+    * stable: v0.10.0
+
+    [__@val@__]: The uhugeint value.
+
+    __Returns:__ double
+
+    __C declaration:__ @duckdb_uhugeint_to_double@
+
+    __defined at:__ @duckdb.h 1804:21@
+
+    __exported by:__ @duckdb.h@
+-}
+c_duckdb_uhugeint_to_double ::
+     DuckDBUHugeInt
+     {- ^
+
+          [__@val@__]: The uhugeint value.
+
+          __C declaration:__ @val@
+     -}
+  -> IO BG.CDouble
+c_duckdb_uhugeint_to_double =
+  \val0 ->
+    BG.with val0 (\val1 ->
+                    hs_bindgen_e347968d8ba72f9d val1)
+
+-- __unique:__ @Database_DuckDB_FFI_Database.DuckDB.FFI_Safe_duckdb_double_to_uhugeint@
+foreign import ccall safe "hs_bindgen_ab63bc231e7c2083" hs_bindgen_ab63bc231e7c2083_base ::
+     BG.CDouble
+  -> BG.Ptr BG.Void
+  -> IO ()
+
+-- __unique:__ @Database_DuckDB_FFI_Database.DuckDB.FFI_Safe_duckdb_double_to_uhugeint@
+hs_bindgen_ab63bc231e7c2083 ::
+     BG.CDouble
+  -> BG.Ptr DuckDBUHugeInt
+  -> IO ()
+hs_bindgen_ab63bc231e7c2083 =
+  \x0 ->
+    \x1 ->
+      hs_bindgen_ab63bc231e7c2083_base (BG.toFFIType x0) (BG.toFFIType x1)
+
+{-|
+
+    Converts a double value to a t'DuckDBUHugeInt' object.
+
+    If the conversion fails because the double value is too big the result will be 0.
+
+    history:
+
+    * stable: v0.10.0
+
+    [__@val@__]: The double value.
+
+    __Returns:__ t'DuckDBUHugeInt'
+
+    __C declaration:__ @duckdb_double_to_uhugeint@
+
+    __defined at:__ @duckdb.h 1819:30@
+
+    __exported by:__ @duckdb.h@
+-}
+c_duckdb_double_to_uhugeint ::
+     BG.CDouble
+     {- ^
+
+          [__@val@__]: The double value.
+
+          __C declaration:__ @val@
+     -}
+  -> IO DuckDBUHugeInt
+c_duckdb_double_to_uhugeint =
+  \val0 ->
+    BG.allocaAndPeek (\res1 ->
+                        hs_bindgen_ab63bc231e7c2083 val0 res1)
+
+-- __unique:__ @Database_DuckDB_FFI_Database.DuckDB.FFI_Safe_duckdb_double_to_decimal@
+foreign import ccall safe "hs_bindgen_2fd9e41f82130053" hs_bindgen_2fd9e41f82130053_base ::
+     BG.CDouble
+  -> HsBindgen.Runtime.LibC.Word8
+  -> HsBindgen.Runtime.LibC.Word8
+  -> BG.Ptr BG.Void
+  -> IO ()
+
+-- __unique:__ @Database_DuckDB_FFI_Database.DuckDB.FFI_Safe_duckdb_double_to_decimal@
+hs_bindgen_2fd9e41f82130053 ::
+     BG.CDouble
+  -> HsBindgen.Runtime.LibC.Word8
+  -> HsBindgen.Runtime.LibC.Word8
+  -> BG.Ptr DuckDBDecimal
+  -> IO ()
+hs_bindgen_2fd9e41f82130053 =
+  \x0 ->
+    \x1 ->
+      \x2 ->
+        \x3 ->
+          hs_bindgen_2fd9e41f82130053_base (BG.toFFIType x0) (BG.toFFIType x1) (BG.toFFIType x2) (BG.toFFIType x3)
+
+{-|
+
+    Converts a double value to a t'DuckDBDecimal' object.
+
+    If the conversion fails because the double value is too big, or the width/scale are invalid the result will be 0.
+
+    history:
+
+    * stable: v0.6.0
+
+    [__@val@__]: The double value.
+
+    [__@width@__]:
+
+    [__@scale@__]:
+
+    __Returns:__ t'DuckDBDecimal'
+
+    __C declaration:__ @duckdb_double_to_decimal@
+
+    __defined at:__ @duckdb.h 1836:29@
+
+    __exported by:__ @duckdb.h@
+-}
+c_duckdb_double_to_decimal ::
+     BG.CDouble
+     {- ^
+
+          [__@val@__]: The double value.
+
+          __C declaration:__ @val@
+     -}
+  -> HsBindgen.Runtime.LibC.Word8
+     {- ^
+
+          [__@width@__]:
+
+          __C declaration:__ @width@
+     -}
+  -> HsBindgen.Runtime.LibC.Word8
+     {- ^
+
+          [__@scale@__]:
+
+          __C declaration:__ @scale@
+     -}
+  -> IO DuckDBDecimal
+c_duckdb_double_to_decimal =
+  \val0 ->
+    \width1 ->
+      \scale2 ->
+        BG.allocaAndPeek (\res3 ->
+                            hs_bindgen_2fd9e41f82130053 val0 width1 scale2 res3)
+
+-- __unique:__ @Database_DuckDB_FFI_Database.DuckDB.FFI_Safe_duckdb_decimal_to_double@
+foreign import ccall safe "hs_bindgen_a897650e57b2e5dd" hs_bindgen_a897650e57b2e5dd_base ::
+     BG.Ptr BG.Void
+  -> IO BG.CDouble
+
+-- __unique:__ @Database_DuckDB_FFI_Database.DuckDB.FFI_Safe_duckdb_decimal_to_double@
+hs_bindgen_a897650e57b2e5dd ::
+     BG.Ptr DuckDBDecimal
+  -> IO BG.CDouble
+hs_bindgen_a897650e57b2e5dd =
+  \x0 ->
+    fmap BG.fromFFIType (hs_bindgen_a897650e57b2e5dd_base (BG.toFFIType x0))
+
+{-|
+
+    Converts a t'DuckDBDecimal' object (as obtained from a @@DUCKDB_TYPE_DECIMAL@@ column) into a double.
+
+    history:
+
+    * stable: v0.3.3
+
+    [__@val@__]: The decimal value.
+
+    __Returns:__ double
+
+    __C declaration:__ @duckdb_decimal_to_double@
+
+    __defined at:__ @duckdb.h 1849:21@
+
+    __exported by:__ @duckdb.h@
+-}
+c_duckdb_decimal_to_double ::
+     DuckDBDecimal
+     {- ^
+
+          [__@val@__]: The decimal value.
+
+          __C declaration:__ @val@
+     -}
+  -> IO BG.CDouble
+c_duckdb_decimal_to_double =
+  \val0 ->
+    BG.with val0 (\val1 ->
+                    hs_bindgen_a897650e57b2e5dd val1)
+
+-- __unique:__ @Database_DuckDB_FFI_Database.DuckDB.FFI_Safe_duckdb_create_aggregate_function@
+foreign import ccall safe "hs_bindgen_a4213901f24a347c" hs_bindgen_a4213901f24a347c_base ::
+     IO (BG.Ptr BG.Void)
+
+-- __unique:__ @Database_DuckDB_FFI_Database.DuckDB.FFI_Safe_duckdb_create_aggregate_function@
+hs_bindgen_a4213901f24a347c :: IO DuckDBAggregateFunction
+hs_bindgen_a4213901f24a347c =
+  fmap BG.fromFFIType hs_bindgen_a4213901f24a347c_base
+
+{-| Creates a new empty aggregate function.
+
+    The return value should be destroyed with @'c_duckdb_destroy_aggregate_function'@ .
+
+    history:
+
+    * stable: v1.1.0
+
+    __Returns:__ t'DuckDBAggregateFunction'
+
+    __C declaration:__ @duckdb_create_aggregate_function@
+
+    __defined at:__ @duckdb.h 1881:40@
+
+    __exported by:__ @duckdb.h@
+-}
+c_duckdb_create_aggregate_function :: IO DuckDBAggregateFunction
+c_duckdb_create_aggregate_function =
+  hs_bindgen_a4213901f24a347c
+
+-- __unique:__ @Database_DuckDB_FFI_Database.DuckDB.FFI_Safe_duckdb_destroy_aggregate_function@
+foreign import ccall safe "hs_bindgen_9a7ed57b62ba2830" hs_bindgen_9a7ed57b62ba2830_base ::
+     BG.Ptr BG.Void
+  -> IO ()
+
+-- __unique:__ @Database_DuckDB_FFI_Database.DuckDB.FFI_Safe_duckdb_destroy_aggregate_function@
+hs_bindgen_9a7ed57b62ba2830 ::
+     BG.Ptr DuckDBAggregateFunction
+  -> IO ()
+hs_bindgen_9a7ed57b62ba2830 =
+  \x0 ->
+    hs_bindgen_9a7ed57b62ba2830_base (BG.toFFIType x0)
+
+{-| Destroys the given aggregate function object.
+
+    history:
+
+    * stable: v1.1.0
+
+    [__@aggregate_function@__]:
+
+    __Returns:__ void
+
+    __C declaration:__ @duckdb_destroy_aggregate_function@
+
+    __defined at:__ @duckdb.h 1894:19@
+
+    __exported by:__ @duckdb.h@
+-}
+c_duckdb_destroy_aggregate_function ::
+     BG.Ptr DuckDBAggregateFunction
+     {- ^
+
+          [__@aggregate_function@__]:
+
+          __C declaration:__ @aggregate_function@
+     -}
+  -> IO ()
+c_duckdb_destroy_aggregate_function =
+  hs_bindgen_9a7ed57b62ba2830
+
+-- __unique:__ @Database_DuckDB_FFI_Database.DuckDB.FFI_Safe_duckdb_aggregate_function_set_name@
+foreign import ccall safe "hs_bindgen_6753d462db01c5d2" hs_bindgen_6753d462db01c5d2_base ::
+     BG.Ptr BG.Void
+  -> BG.Ptr BG.Void
+  -> IO ()
+
+-- __unique:__ @Database_DuckDB_FFI_Database.DuckDB.FFI_Safe_duckdb_aggregate_function_set_name@
+hs_bindgen_6753d462db01c5d2 ::
+     DuckDBAggregateFunction
+  -> PtrConst.PtrConst BG.CChar
+  -> IO ()
+hs_bindgen_6753d462db01c5d2 =
+  \x0 ->
+    \x1 ->
+      hs_bindgen_6753d462db01c5d2_base (BG.toFFIType x0) (BG.toFFIType x1)
+
+{-| Sets the name of the given aggregate function.
+
+    history:
+
+    * stable: v1.1.0
+
+    [__@aggregate_function@__]: The aggregate function
+
+    [__@name@__]: The name of the aggregate function
+
+    __Returns:__ void
+
+    __C declaration:__ @duckdb_aggregate_function_set_name@
+
+    __defined at:__ @duckdb.h 1908:19@
+
+    __exported by:__ @duckdb.h@
+-}
+c_duckdb_aggregate_function_set_name ::
+     DuckDBAggregateFunction
+     {- ^
+
+          [__@aggregate_function@__]: The aggregate function
+
+          __C declaration:__ @aggregate_function@
+     -}
+  -> PtrConst.PtrConst BG.CChar
+     {- ^
+
+          [__@name@__]: The name of the aggregate function
+
+          __C declaration:__ @name@
+     -}
+  -> IO ()
+c_duckdb_aggregate_function_set_name =
+  hs_bindgen_6753d462db01c5d2
+
+-- __unique:__ @Database_DuckDB_FFI_Database.DuckDB.FFI_Safe_duckdb_aggregate_function_add_parameter@
+foreign import ccall safe "hs_bindgen_c0953d002d635df8" hs_bindgen_c0953d002d635df8_base ::
+     BG.Ptr BG.Void
+  -> BG.Ptr BG.Void
+  -> IO ()
+
+-- __unique:__ @Database_DuckDB_FFI_Database.DuckDB.FFI_Safe_duckdb_aggregate_function_add_parameter@
+hs_bindgen_c0953d002d635df8 ::
+     DuckDBAggregateFunction
+  -> DuckDBLogicalType
+  -> IO ()
+hs_bindgen_c0953d002d635df8 =
+  \x0 ->
+    \x1 ->
+      hs_bindgen_c0953d002d635df8_base (BG.toFFIType x0) (BG.toFFIType x1)
+
+{-| Adds a parameter to the aggregate function.
+
+    history:
+
+    * stable: v1.1.0
+
+    [__@aggregate_function@__]: The aggregate function.
+
+    [__@type@__]: The parameter type. Cannot contain INVALID.
+
+    __Returns:__ void
+
+    __C declaration:__ @duckdb_aggregate_function_add_parameter@
+
+    __defined at:__ @duckdb.h 1922:19@
+
+    __exported by:__ @duckdb.h@
+-}
+c_duckdb_aggregate_function_add_parameter ::
+     DuckDBAggregateFunction
+     {- ^
+
+          [__@aggregate_function@__]: The aggregate function.
+
+          __C declaration:__ @aggregate_function@
+     -}
+  -> DuckDBLogicalType
+     {- ^
+
+          [__@type@__]: The parameter type. Cannot contain INVALID.
+
+          __C declaration:__ @type@
+     -}
+  -> IO ()
+c_duckdb_aggregate_function_add_parameter =
+  hs_bindgen_c0953d002d635df8
+
+-- __unique:__ @Database_DuckDB_FFI_Database.DuckDB.FFI_Safe_duckdb_aggregate_function_set_return_type@
+foreign import ccall safe "hs_bindgen_6058c453ace88380" hs_bindgen_6058c453ace88380_base ::
+     BG.Ptr BG.Void
+  -> BG.Ptr BG.Void
+  -> IO ()
+
+-- __unique:__ @Database_DuckDB_FFI_Database.DuckDB.FFI_Safe_duckdb_aggregate_function_set_return_type@
+hs_bindgen_6058c453ace88380 ::
+     DuckDBAggregateFunction
+  -> DuckDBLogicalType
+  -> IO ()
+hs_bindgen_6058c453ace88380 =
+  \x0 ->
+    \x1 ->
+      hs_bindgen_6058c453ace88380_base (BG.toFFIType x0) (BG.toFFIType x1)
+
+{-| Sets the return type of the aggregate function.
+
+    history:
+
+    * stable: v1.1.0
+
+    [__@aggregate_function@__]: The aggregate function.
+
+    [__@type@__]: The return type. Cannot contain INVALID or ANY.
+
+    __Returns:__ void
+
+    __C declaration:__ @duckdb_aggregate_function_set_return_type@
+
+    __defined at:__ @duckdb.h 1937:19@
+
+    __exported by:__ @duckdb.h@
+-}
+c_duckdb_aggregate_function_set_return_type ::
+     DuckDBAggregateFunction
+     {- ^
+
+          [__@aggregate_function@__]: The aggregate function.
+
+          __C declaration:__ @aggregate_function@
+     -}
+  -> DuckDBLogicalType
+     {- ^
+
+          [__@type@__]: The return type. Cannot contain INVALID or ANY.
+
+          __C declaration:__ @type@
+     -}
+  -> IO ()
+c_duckdb_aggregate_function_set_return_type =
+  hs_bindgen_6058c453ace88380
+
+-- __unique:__ @Database_DuckDB_FFI_Database.DuckDB.FFI_Safe_duckdb_aggregate_function_set_functions@
+foreign import ccall safe "hs_bindgen_f14070593356a5b8" hs_bindgen_f14070593356a5b8_base ::
+     BG.Ptr BG.Void
+  -> BG.FunPtr BG.Void
+  -> BG.FunPtr BG.Void
+  -> BG.FunPtr BG.Void
+  -> BG.FunPtr BG.Void
+  -> BG.FunPtr BG.Void
+  -> IO ()
+
+-- __unique:__ @Database_DuckDB_FFI_Database.DuckDB.FFI_Safe_duckdb_aggregate_function_set_functions@
+hs_bindgen_f14070593356a5b8 ::
+     DuckDBAggregateFunction
+  -> DuckDBAggregateStateSizeFun
+  -> DuckDBAggregateInitFun
+  -> DuckDBAggregateUpdateFun
+  -> DuckDBAggregateCombineFun
+  -> DuckDBAggregateFinalizeFun
+  -> IO ()
+hs_bindgen_f14070593356a5b8 =
+  \x0 ->
+    \x1 ->
+      \x2 ->
+        \x3 ->
+          \x4 ->
+            \x5 ->
+              hs_bindgen_f14070593356a5b8_base (BG.toFFIType x0) (BG.toFFIType x1) (BG.toFFIType x2) (BG.toFFIType x3) (BG.toFFIType x4) (BG.toFFIType x5)
+
+{-| Sets the main functions of the aggregate function.
+
+    history:
+
+    * stable: v1.1.0
+
+    [__@aggregate_function@__]: The aggregate function
+
+    [__@state_size@__]: state size
+
+    [__@state_init@__]: state init function
+
+    [__@update@__]: update states
+
+    [__@combine@__]: combine states
+
+    [__@finalize@__]: finalize states
+
+    __Returns:__ void
+
+    __C declaration:__ @duckdb_aggregate_function_set_functions@
+
+    __defined at:__ @duckdb.h 1956:19@
+
+    __exported by:__ @duckdb.h@
+-}
+c_duckdb_aggregate_function_set_functions ::
+     DuckDBAggregateFunction
+     {- ^
+
+          [__@aggregate_function@__]: The aggregate function
+
+          __C declaration:__ @aggregate_function@
+     -}
+  -> DuckDBAggregateStateSizeFun
+     {- ^
+
+          [__@state_size@__]: state size
+
+          __C declaration:__ @state_size@
+     -}
+  -> DuckDBAggregateInitFun
+     {- ^
+
+          [__@state_init@__]: state init function
+
+          __C declaration:__ @state_init@
+     -}
+  -> DuckDBAggregateUpdateFun
+     {- ^
+
+          [__@update@__]: update states
+
+          __C declaration:__ @update@
+     -}
+  -> DuckDBAggregateCombineFun
+     {- ^
+
+          [__@combine@__]: combine states
+
+          __C declaration:__ @combine@
+     -}
+  -> DuckDBAggregateFinalizeFun
+     {- ^
+
+          [__@finalize@__]: finalize states
+
+          __C declaration:__ @finalize@
+     -}
+  -> IO ()
+c_duckdb_aggregate_function_set_functions =
+  hs_bindgen_f14070593356a5b8
+
+-- __unique:__ @Database_DuckDB_FFI_Database.DuckDB.FFI_Safe_duckdb_aggregate_function_set_destructor@
+foreign import ccall safe "hs_bindgen_d1d14d0757e28d95" hs_bindgen_d1d14d0757e28d95_base ::
+     BG.Ptr BG.Void
+  -> BG.FunPtr BG.Void
+  -> IO ()
+
+-- __unique:__ @Database_DuckDB_FFI_Database.DuckDB.FFI_Safe_duckdb_aggregate_function_set_destructor@
+hs_bindgen_d1d14d0757e28d95 ::
+     DuckDBAggregateFunction
+  -> DuckDBAggregateDestroyFun
+  -> IO ()
+hs_bindgen_d1d14d0757e28d95 =
+  \x0 ->
+    \x1 ->
+      hs_bindgen_d1d14d0757e28d95_base (BG.toFFIType x0) (BG.toFFIType x1)
+
+{-| Sets the state destructor callback of the aggregate function (optional)
+
+    history:
+
+    * stable: v1.1.0
+
+    [__@aggregate_function@__]: The aggregate function
+
+    [__@destroy@__]: state destroy callback
+
+    __Returns:__ void
+
+    __C declaration:__ @duckdb_aggregate_function_set_destructor@
+
+    __defined at:__ @duckdb.h 1975:19@
+
+    __exported by:__ @duckdb.h@
+-}
+c_duckdb_aggregate_function_set_destructor ::
+     DuckDBAggregateFunction
+     {- ^
+
+          [__@aggregate_function@__]: The aggregate function
+
+          __C declaration:__ @aggregate_function@
+     -}
+  -> DuckDBAggregateDestroyFun
+     {- ^
+
+          [__@destroy@__]: state destroy callback
+
+          __C declaration:__ @destroy@
+     -}
+  -> IO ()
+c_duckdb_aggregate_function_set_destructor =
+  hs_bindgen_d1d14d0757e28d95
+
+-- __unique:__ @Database_DuckDB_FFI_Database.DuckDB.FFI_Safe_duckdb_register_aggregate_function@
+foreign import ccall safe "hs_bindgen_73fd6a2b1ed3a19d" hs_bindgen_73fd6a2b1ed3a19d_base ::
+     BG.Ptr BG.Void
+  -> BG.Ptr BG.Void
+  -> IO BG.CUInt
+
+-- __unique:__ @Database_DuckDB_FFI_Database.DuckDB.FFI_Safe_duckdb_register_aggregate_function@
+hs_bindgen_73fd6a2b1ed3a19d ::
+     DuckDBConnection
+  -> DuckDBAggregateFunction
+  -> IO DuckDBState
+hs_bindgen_73fd6a2b1ed3a19d =
+  \x0 ->
+    \x1 ->
+      fmap BG.fromFFIType (hs_bindgen_73fd6a2b1ed3a19d_base (BG.toFFIType x0) (BG.toFFIType x1))
+
+{-| Register the aggregate function object within the given connection.
+
+    The function requires at least a name, functions and a return type.
+
+    If the function is incomplete or a function with this name already exists DuckDBError is returned.
+
+    history:
+
+    * stable: v1.1.0
+
+    [__@con@__]: The connection to register it in.
+
+    [__@aggregate_function@__]:
+
+    __Returns:__ t'DuckDBState'
+
+    __C declaration:__ @duckdb_register_aggregate_function@
+
+    __defined at:__ @duckdb.h 1994:27@
+
+    __exported by:__ @duckdb.h@
+-}
+c_duckdb_register_aggregate_function ::
+     DuckDBConnection
+     {- ^
+
+          [__@con@__]: The connection to register it in.
+
+          __C declaration:__ @con@
+     -}
+  -> DuckDBAggregateFunction
+     {- ^
+
+          [__@aggregate_function@__]:
+
+          __C declaration:__ @aggregate_function@
+     -}
+  -> IO DuckDBState
+c_duckdb_register_aggregate_function =
+  hs_bindgen_73fd6a2b1ed3a19d
+
+-- __unique:__ @Database_DuckDB_FFI_Database.DuckDB.FFI_Safe_duckdb_aggregate_function_set_special_handling@
+foreign import ccall safe "hs_bindgen_fb32b51eb2673dfa" hs_bindgen_fb32b51eb2673dfa_base ::
+     BG.Ptr BG.Void
+  -> IO ()
+
+-- __unique:__ @Database_DuckDB_FFI_Database.DuckDB.FFI_Safe_duckdb_aggregate_function_set_special_handling@
+hs_bindgen_fb32b51eb2673dfa ::
+     DuckDBAggregateFunction
+  -> IO ()
+hs_bindgen_fb32b51eb2673dfa =
+  \x0 ->
+    hs_bindgen_fb32b51eb2673dfa_base (BG.toFFIType x0)
+
+{-| Sets the NULL handling of the aggregate function to SPECIAL_HANDLING.
+
+    history:
+
+    * stable: v1.1.0
+
+    [__@aggregate_function@__]: The aggregate function
+
+    __Returns:__ void
+
+    __C declaration:__ @duckdb_aggregate_function_set_special_handling@
+
+    __defined at:__ @duckdb.h 2008:19@
+
+    __exported by:__ @duckdb.h@
+-}
+c_duckdb_aggregate_function_set_special_handling ::
+     DuckDBAggregateFunction
+     {- ^
+
+          [__@aggregate_function@__]: The aggregate function
+
+          __C declaration:__ @aggregate_function@
+     -}
+  -> IO ()
+c_duckdb_aggregate_function_set_special_handling =
+  hs_bindgen_fb32b51eb2673dfa
+
+-- __unique:__ @Database_DuckDB_FFI_Database.DuckDB.FFI_Safe_duckdb_aggregate_function_set_extra_info@
+foreign import ccall safe "hs_bindgen_bfde5b245fa2177b" hs_bindgen_bfde5b245fa2177b_base ::
+     BG.Ptr BG.Void
+  -> BG.Ptr BG.Void
+  -> BG.FunPtr BG.Void
+  -> IO ()
+
+-- __unique:__ @Database_DuckDB_FFI_Database.DuckDB.FFI_Safe_duckdb_aggregate_function_set_extra_info@
+hs_bindgen_bfde5b245fa2177b ::
+     DuckDBAggregateFunction
+  -> BG.Ptr BG.Void
+  -> DuckDBDeleteCallback
+  -> IO ()
+hs_bindgen_bfde5b245fa2177b =
+  \x0 ->
+    \x1 ->
+      \x2 ->
+        hs_bindgen_bfde5b245fa2177b_base (BG.toFFIType x0) (BG.toFFIType x1) (BG.toFFIType x2)
+
+{-| Assigns extra information to the scalar function that can be fetched during binding, etc.
+
+    history:
+
+    * stable: v1.1.0
+
+    [__@aggregate_function@__]: The aggregate function
+
+    [__@extra_info@__]: The extra information
+
+    [__@destroy@__]: The callback that will be called to destroy the extra information (if any)
+
+    __Returns:__ void
+
+    __C declaration:__ @duckdb_aggregate_function_set_extra_info@
+
+    __defined at:__ @duckdb.h 2023:19@
+
+    __exported by:__ @duckdb.h@
+-}
+c_duckdb_aggregate_function_set_extra_info ::
+     DuckDBAggregateFunction
+     {- ^
+
+          [__@aggregate_function@__]: The aggregate function
+
+          __C declaration:__ @aggregate_function@
+     -}
+  -> BG.Ptr BG.Void
+     {- ^
+
+          [__@extra_info@__]: The extra information
+
+          __C declaration:__ @extra_info@
+     -}
+  -> DuckDBDeleteCallback
+     {- ^
+
+          [__@destroy@__]: The callback that will be called to destroy the extra information (if any)
+
+          __C declaration:__ @destroy@
+     -}
+  -> IO ()
+c_duckdb_aggregate_function_set_extra_info =
+  hs_bindgen_bfde5b245fa2177b
+
+-- __unique:__ @Database_DuckDB_FFI_Database.DuckDB.FFI_Safe_duckdb_aggregate_function_get_extra_info@
+foreign import ccall safe "hs_bindgen_4e9b0c1d3d06199e" hs_bindgen_4e9b0c1d3d06199e_base ::
+     BG.Ptr BG.Void
+  -> IO (BG.Ptr BG.Void)
+
+-- __unique:__ @Database_DuckDB_FFI_Database.DuckDB.FFI_Safe_duckdb_aggregate_function_get_extra_info@
+hs_bindgen_4e9b0c1d3d06199e ::
+     DuckDBFunctionInfo
+  -> IO (BG.Ptr BG.Void)
+hs_bindgen_4e9b0c1d3d06199e =
+  \x0 ->
+    fmap BG.fromFFIType (hs_bindgen_4e9b0c1d3d06199e_base (BG.toFFIType x0))
+
+{-| Retrieves the extra info of the function as set in @'c_duckdb_aggregate_function_set_extra_info'@ .
+
+    history:
+
+    * stable: v1.1.0
+
+    [__@info@__]: The info object
+
+    __Returns:__ void*
+
+    __C declaration:__ @duckdb_aggregate_function_get_extra_info@
+
+    __defined at:__ @duckdb.h 2037:20@
+
+    __exported by:__ @duckdb.h@
+-}
+c_duckdb_aggregate_function_get_extra_info ::
+     DuckDBFunctionInfo
+     {- ^
+
+          [__@info@__]: The info object
+
+          __C declaration:__ @info@
+     -}
+  -> IO (BG.Ptr BG.Void)
+c_duckdb_aggregate_function_get_extra_info =
+  hs_bindgen_4e9b0c1d3d06199e
+
+-- __unique:__ @Database_DuckDB_FFI_Database.DuckDB.FFI_Safe_duckdb_aggregate_function_set_error@
+foreign import ccall safe "hs_bindgen_483e87ce1132f579" hs_bindgen_483e87ce1132f579_base ::
+     BG.Ptr BG.Void
+  -> BG.Ptr BG.Void
+  -> IO ()
+
+-- __unique:__ @Database_DuckDB_FFI_Database.DuckDB.FFI_Safe_duckdb_aggregate_function_set_error@
+hs_bindgen_483e87ce1132f579 ::
+     DuckDBFunctionInfo
+  -> PtrConst.PtrConst BG.CChar
+  -> IO ()
+hs_bindgen_483e87ce1132f579 =
+  \x0 ->
+    \x1 ->
+      hs_bindgen_483e87ce1132f579_base (BG.toFFIType x0) (BG.toFFIType x1)
+
+{-| Report that an error has occurred while executing the aggregate function.
+
+    history:
+
+    * stable: v1.1.0
+
+    [__@info@__]: The info object
+
+    [__@error@__]: The error message
+
+    __Returns:__ void
+
+    __C declaration:__ @duckdb_aggregate_function_set_error@
+
+    __defined at:__ @duckdb.h 2051:19@
+
+    __exported by:__ @duckdb.h@
+-}
+c_duckdb_aggregate_function_set_error ::
+     DuckDBFunctionInfo
+     {- ^
+
+          [__@info@__]: The info object
+
+          __C declaration:__ @info@
+     -}
+  -> PtrConst.PtrConst BG.CChar
+     {- ^
+
+          [__@error@__]: The error message
+
+          __C declaration:__ @error@
+     -}
+  -> IO ()
+c_duckdb_aggregate_function_set_error =
+  hs_bindgen_483e87ce1132f579
+
+-- __unique:__ @Database_DuckDB_FFI_Database.DuckDB.FFI_Safe_duckdb_create_aggregate_function_set@
+foreign import ccall safe "hs_bindgen_2c49e23b08d73926" hs_bindgen_2c49e23b08d73926_base ::
+     BG.Ptr BG.Void
+  -> IO (BG.Ptr BG.Void)
+
+-- __unique:__ @Database_DuckDB_FFI_Database.DuckDB.FFI_Safe_duckdb_create_aggregate_function_set@
+hs_bindgen_2c49e23b08d73926 ::
+     PtrConst.PtrConst BG.CChar
+  -> IO DuckDBAggregateFunctionSet
+hs_bindgen_2c49e23b08d73926 =
+  \x0 ->
+    fmap BG.fromFFIType (hs_bindgen_2c49e23b08d73926_base (BG.toFFIType x0))
+
+{-| Creates a new empty aggregate function set.
+
+    The return value should be destroyed with @'c_duckdb_destroy_aggregate_function_set'@ .
+
+    history:
+
+    * stable: v1.1.0
+
+    [__@name@__]:
+
+    __Returns:__ t'DuckDBAggregateFunctionSet'
+
+    __C declaration:__ @duckdb_create_aggregate_function_set@
+
+    __defined at:__ @duckdb.h 2066:44@
+
+    __exported by:__ @duckdb.h@
+-}
+c_duckdb_create_aggregate_function_set ::
+     PtrConst.PtrConst BG.CChar
+     {- ^
+
+          [__@name@__]:
+
+          __C declaration:__ @name@
+     -}
+  -> IO DuckDBAggregateFunctionSet
+c_duckdb_create_aggregate_function_set =
+  hs_bindgen_2c49e23b08d73926
+
+-- __unique:__ @Database_DuckDB_FFI_Database.DuckDB.FFI_Safe_duckdb_destroy_aggregate_function_set@
+foreign import ccall safe "hs_bindgen_bf434d41b82ac906" hs_bindgen_bf434d41b82ac906_base ::
+     BG.Ptr BG.Void
+  -> IO ()
+
+-- __unique:__ @Database_DuckDB_FFI_Database.DuckDB.FFI_Safe_duckdb_destroy_aggregate_function_set@
+hs_bindgen_bf434d41b82ac906 ::
+     BG.Ptr DuckDBAggregateFunctionSet
+  -> IO ()
+hs_bindgen_bf434d41b82ac906 =
+  \x0 ->
+    hs_bindgen_bf434d41b82ac906_base (BG.toFFIType x0)
+
+{-| Destroys the given aggregate function set object.
+
+    history:
+
+    * stable: v1.1.0
+
+    [__@aggregate_function_set@__]:
+
+    __Returns:__ void
+
+    __C declaration:__ @duckdb_destroy_aggregate_function_set@
+
+    __defined at:__ @duckdb.h 2079:19@
+
+    __exported by:__ @duckdb.h@
+-}
+c_duckdb_destroy_aggregate_function_set ::
+     BG.Ptr DuckDBAggregateFunctionSet
+     {- ^
+
+          [__@aggregate_function_set@__]:
+
+          __C declaration:__ @aggregate_function_set@
+     -}
+  -> IO ()
+c_duckdb_destroy_aggregate_function_set =
+  hs_bindgen_bf434d41b82ac906
+
+-- __unique:__ @Database_DuckDB_FFI_Database.DuckDB.FFI_Safe_duckdb_add_aggregate_function_to_set@
+foreign import ccall safe "hs_bindgen_8ac8412347b7e08f" hs_bindgen_8ac8412347b7e08f_base ::
+     BG.Ptr BG.Void
+  -> BG.Ptr BG.Void
+  -> IO BG.CUInt
+
+-- __unique:__ @Database_DuckDB_FFI_Database.DuckDB.FFI_Safe_duckdb_add_aggregate_function_to_set@
+hs_bindgen_8ac8412347b7e08f ::
+     DuckDBAggregateFunctionSet
+  -> DuckDBAggregateFunction
+  -> IO DuckDBState
+hs_bindgen_8ac8412347b7e08f =
+  \x0 ->
+    \x1 ->
+      fmap BG.fromFFIType (hs_bindgen_8ac8412347b7e08f_base (BG.toFFIType x0) (BG.toFFIType x1))
+
+{-| Adds the aggregate function as a new overload to the aggregate function set.
+
+    Returns DuckDBError if the function could not be added, for example if the overload already exists.
+
+    history:
+
+    * stable: v1.1.0
+
+    [__@set@__]: The aggregate function set
+
+    [__@function@__]: The function to add
+
+    __Returns:__ t'DuckDBState'
+
+    __C declaration:__ @duckdb_add_aggregate_function_to_set@
+
+    __defined at:__ @duckdb.h 2095:27@
+
+    __exported by:__ @duckdb.h@
+-}
+c_duckdb_add_aggregate_function_to_set ::
+     DuckDBAggregateFunctionSet
+     {- ^
+
+          [__@set@__]: The aggregate function set
+
+          __C declaration:__ @set@
+     -}
+  -> DuckDBAggregateFunction
+     {- ^
+
+          [__@function@__]: The function to add
+
+          __C declaration:__ @function@
+     -}
+  -> IO DuckDBState
+c_duckdb_add_aggregate_function_to_set =
+  hs_bindgen_8ac8412347b7e08f
+
+-- __unique:__ @Database_DuckDB_FFI_Database.DuckDB.FFI_Safe_duckdb_register_aggregate_function_set@
+foreign import ccall safe "hs_bindgen_642bec7c514572cd" hs_bindgen_642bec7c514572cd_base ::
+     BG.Ptr BG.Void
+  -> BG.Ptr BG.Void
+  -> IO BG.CUInt
+
+-- __unique:__ @Database_DuckDB_FFI_Database.DuckDB.FFI_Safe_duckdb_register_aggregate_function_set@
+hs_bindgen_642bec7c514572cd ::
+     DuckDBConnection
+  -> DuckDBAggregateFunctionSet
+  -> IO DuckDBState
+hs_bindgen_642bec7c514572cd =
+  \x0 ->
+    \x1 ->
+      fmap BG.fromFFIType (hs_bindgen_642bec7c514572cd_base (BG.toFFIType x0) (BG.toFFIType x1))
+
+{-| Register the aggregate function set within the given connection.
+
+    The set requires at least a single valid overload.
+
+    If the set is incomplete or a function with this name already exists DuckDBError is returned.
+
+    history:
+
+    * stable: v1.1.0
+
+    [__@con@__]: The connection to register it in.
+
+    [__@set@__]: The function set to register
+
+    __Returns:__ t'DuckDBState'
+
+    __C declaration:__ @duckdb_register_aggregate_function_set@
+
+    __defined at:__ @duckdb.h 2114:27@
+
+    __exported by:__ @duckdb.h@
+-}
+c_duckdb_register_aggregate_function_set ::
+     DuckDBConnection
+     {- ^
+
+          [__@con@__]: The connection to register it in.
+
+          __C declaration:__ @con@
+     -}
+  -> DuckDBAggregateFunctionSet
+     {- ^
+
+          [__@set@__]: The function set to register
+
+          __C declaration:__ @set@
+     -}
+  -> IO DuckDBState
+c_duckdb_register_aggregate_function_set =
+  hs_bindgen_642bec7c514572cd
+
+-- __unique:__ @Database_DuckDB_FFI_Database.DuckDB.FFI_Safe_duckdb_appender_create@
+foreign import ccall safe "hs_bindgen_aa07fd4356c6a064" hs_bindgen_aa07fd4356c6a064_base ::
+     BG.Ptr BG.Void
+  -> BG.Ptr BG.Void
+  -> BG.Ptr BG.Void
+  -> BG.Ptr BG.Void
+  -> IO BG.CUInt
+
+-- __unique:__ @Database_DuckDB_FFI_Database.DuckDB.FFI_Safe_duckdb_appender_create@
+hs_bindgen_aa07fd4356c6a064 ::
+     DuckDBConnection
+  -> PtrConst.PtrConst BG.CChar
+  -> PtrConst.PtrConst BG.CChar
+  -> BG.Ptr DuckDBAppender
+  -> IO DuckDBState
+hs_bindgen_aa07fd4356c6a064 =
+  \x0 ->
+    \x1 ->
+      \x2 ->
+        \x3 ->
+          fmap BG.fromFFIType (hs_bindgen_aa07fd4356c6a064_base (BG.toFFIType x0) (BG.toFFIType x1) (BG.toFFIType x2) (BG.toFFIType x3))
+
+{-| Creates an appender object.
+
+    Note that the object must be destroyed with @'c_duckdb_appender_destroy'@ .
+
+    history:
+
+    * stable: v0.2.5
+
+    [__@connection@__]: The connection context to create the appender in.
+
+    [__@schema@__]: The schema of the table to append to, or @nullptr@ for the default schema.
+
+    [__@table@__]: The table name to append to.
+
+    [__@out_appender@__]: The resulting appender object.
+
+    __Returns:__ t'DuckDBState'
+
+    __C declaration:__ @duckdb_appender_create@
+
+    __defined at:__ @duckdb.h 2151:27@
+
+    __exported by:__ @duckdb.h@
+-}
+c_duckdb_appender_create ::
+     DuckDBConnection
+     {- ^
+
+          [__@connection@__]: The connection context to create the appender in.
+
+          __C declaration:__ @connection@
+     -}
+  -> PtrConst.PtrConst BG.CChar
+     {- ^
+
+          [__@schema@__]: The schema of the table to append to, or @nullptr@ for the default schema.
+
+          __C declaration:__ @schema@
+     -}
+  -> PtrConst.PtrConst BG.CChar
+     {- ^
+
+          [__@table@__]: The table name to append to.
+
+          __C declaration:__ @table@
+     -}
+  -> BG.Ptr DuckDBAppender
+     {- ^
+
+          [__@out_appender@__]: The resulting appender object.
+
+          __C declaration:__ @out_appender@
+     -}
+  -> IO DuckDBState
+c_duckdb_appender_create =
+  hs_bindgen_aa07fd4356c6a064
+
+-- __unique:__ @Database_DuckDB_FFI_Database.DuckDB.FFI_Safe_duckdb_appender_create_ext@
+foreign import ccall safe "hs_bindgen_63ef91b9ed96feb6" hs_bindgen_63ef91b9ed96feb6_base ::
+     BG.Ptr BG.Void
+  -> BG.Ptr BG.Void
+  -> BG.Ptr BG.Void
+  -> BG.Ptr BG.Void
+  -> BG.Ptr BG.Void
+  -> IO BG.CUInt
+
+-- __unique:__ @Database_DuckDB_FFI_Database.DuckDB.FFI_Safe_duckdb_appender_create_ext@
+hs_bindgen_63ef91b9ed96feb6 ::
+     DuckDBConnection
+  -> PtrConst.PtrConst BG.CChar
+  -> PtrConst.PtrConst BG.CChar
+  -> PtrConst.PtrConst BG.CChar
+  -> BG.Ptr DuckDBAppender
+  -> IO DuckDBState
+hs_bindgen_63ef91b9ed96feb6 =
+  \x0 ->
+    \x1 ->
+      \x2 ->
+        \x3 ->
+          \x4 ->
+            fmap BG.fromFFIType (hs_bindgen_63ef91b9ed96feb6_base (BG.toFFIType x0) (BG.toFFIType x1) (BG.toFFIType x2) (BG.toFFIType x3) (BG.toFFIType x4))
+
+{-| Creates an appender object.
+
+    Note that the object must be destroyed with @'c_duckdb_appender_destroy'@ .
+
+    history:
+
+    * stable: v1.2.0
+
+    [__@connection@__]: The connection context to create the appender in.
+
+    [__@catalog@__]: The catalog of the table to append to, or @nullptr@ for the default catalog.
+
+    [__@schema@__]: The schema of the table to append to, or @nullptr@ for the default schema.
+
+    [__@table@__]: The table name to append to.
+
+    [__@out_appender@__]: The resulting appender object.
+
+    __Returns:__ t'DuckDBState'
+
+    __C declaration:__ @duckdb_appender_create_ext@
+
+    __defined at:__ @duckdb.h 2171:27@
+
+    __exported by:__ @duckdb.h@
+-}
+c_duckdb_appender_create_ext ::
+     DuckDBConnection
+     {- ^
+
+          [__@connection@__]: The connection context to create the appender in.
+
+          __C declaration:__ @connection@
+     -}
+  -> PtrConst.PtrConst BG.CChar
+     {- ^
+
+          [__@catalog@__]: The catalog of the table to append to, or @nullptr@ for the default catalog.
+
+          __C declaration:__ @catalog@
+     -}
+  -> PtrConst.PtrConst BG.CChar
+     {- ^
+
+          [__@schema@__]: The schema of the table to append to, or @nullptr@ for the default schema.
+
+          __C declaration:__ @schema@
+     -}
+  -> PtrConst.PtrConst BG.CChar
+     {- ^
+
+          [__@table@__]: The table name to append to.
+
+          __C declaration:__ @table@
+     -}
+  -> BG.Ptr DuckDBAppender
+     {- ^
+
+          [__@out_appender@__]: The resulting appender object.
+
+          __C declaration:__ @out_appender@
+     -}
+  -> IO DuckDBState
+c_duckdb_appender_create_ext =
+  hs_bindgen_63ef91b9ed96feb6
+
+-- __unique:__ @Database_DuckDB_FFI_Database.DuckDB.FFI_Safe_duckdb_appender_create_query@
+foreign import ccall safe "hs_bindgen_f5f12003c5a6b74a" hs_bindgen_f5f12003c5a6b74a_base ::
+     BG.Ptr BG.Void
+  -> BG.Ptr BG.Void
+  -> HsBindgen.Runtime.LibC.Word64
+  -> BG.Ptr BG.Void
+  -> BG.Ptr BG.Void
+  -> BG.Ptr BG.Void
+  -> BG.Ptr BG.Void
+  -> IO BG.CUInt
+
+-- __unique:__ @Database_DuckDB_FFI_Database.DuckDB.FFI_Safe_duckdb_appender_create_query@
+hs_bindgen_f5f12003c5a6b74a ::
+     DuckDBConnection
+  -> PtrConst.PtrConst BG.CChar
+  -> DuckDBIdx
+  -> BG.Ptr DuckDBLogicalType
+  -> PtrConst.PtrConst BG.CChar
+  -> BG.Ptr (PtrConst.PtrConst BG.CChar)
+  -> BG.Ptr DuckDBAppender
+  -> IO DuckDBState
+hs_bindgen_f5f12003c5a6b74a =
+  \x0 ->
+    \x1 ->
+      \x2 ->
+        \x3 ->
+          \x4 ->
+            \x5 ->
+              \x6 ->
+                fmap BG.fromFFIType (hs_bindgen_f5f12003c5a6b74a_base (BG.toFFIType x0) (BG.toFFIType x1) (BG.toFFIType x2) (BG.toFFIType x3) (BG.toFFIType x4) (BG.toFFIType x5) (BG.toFFIType x6))
+
+{-| Creates an appender object that executes the given query with any data appended to it.
+
+    Note that the object must be destroyed with @'c_duckdb_appender_destroy'@ .
+
+    history:
+
+    * unstable: v1.4.0
+
+    * stable: v1.5.6
+
+    [__@connection@__]: The connection context to create the appender in.
+
+    [__@query@__]: The query to execute, can be an INSERT, DELETE, UPDATE or MERGE INTO statement.
+
+    [__@column_count@__]: The number of columns to append.
+
+    [__@types@__]: The types of the columns to append.
+
+    [__@table_name@__]: (optionally) the table name used to refer to the appended data, defaults to "appended_data".
+
+    [__@column_names@__]: (optionally) the list of column names, defaults to "col1", "col2", ...
+
+    [__@out_appender@__]: The resulting appender object.
+
+    __Returns:__ t'DuckDBState'
+
+    __C declaration:__ @duckdb_appender_create_query@
+
+    __defined at:__ @duckdb.h 2195:27@
+
+    __exported by:__ @duckdb.h@
+-}
+c_duckdb_appender_create_query ::
+     DuckDBConnection
+     {- ^
+
+          [__@connection@__]: The connection context to create the appender in.
+
+          __C declaration:__ @connection@
+     -}
+  -> PtrConst.PtrConst BG.CChar
+     {- ^
+
+          [__@query@__]: The query to execute, can be an INSERT, DELETE, UPDATE or MERGE INTO statement.
+
+          __C declaration:__ @query@
+     -}
+  -> DuckDBIdx
+     {- ^
+
+          [__@column_count@__]: The number of columns to append.
+
+          __C declaration:__ @column_count@
+     -}
+  -> BG.Ptr DuckDBLogicalType
+     {- ^
+
+          [__@types@__]: The types of the columns to append.
+
+          __C declaration:__ @types@
+     -}
+  -> PtrConst.PtrConst BG.CChar
+     {- ^
+
+          [__@table_name@__]: (optionally) the table name used to refer to the appended data, defaults to "appended_data".
+
+          __C declaration:__ @table_name@
+     -}
+  -> BG.Ptr (PtrConst.PtrConst BG.CChar)
+     {- ^
+
+          [__@column_names@__]: (optionally) the list of column names, defaults to "col1", "col2", ...
+
+          __C declaration:__ @column_names@
+     -}
+  -> BG.Ptr DuckDBAppender
+     {- ^
+
+          [__@out_appender@__]: The resulting appender object.
+
+          __C declaration:__ @out_appender@
+     -}
+  -> IO DuckDBState
+c_duckdb_appender_create_query =
+  hs_bindgen_f5f12003c5a6b74a
+
+-- __unique:__ @Database_DuckDB_FFI_Database.DuckDB.FFI_Safe_duckdb_appender_column_count@
+foreign import ccall safe "hs_bindgen_d9adf614fa24a490" hs_bindgen_d9adf614fa24a490_base ::
+     BG.Ptr BG.Void
+  -> IO HsBindgen.Runtime.LibC.Word64
+
+-- __unique:__ @Database_DuckDB_FFI_Database.DuckDB.FFI_Safe_duckdb_appender_column_count@
+hs_bindgen_d9adf614fa24a490 ::
+     DuckDBAppender
+  -> IO DuckDBIdx
+hs_bindgen_d9adf614fa24a490 =
+  \x0 ->
+    fmap BG.fromFFIType (hs_bindgen_d9adf614fa24a490_base (BG.toFFIType x0))
+
+{-| Returns the number of columns that belong to the appender. If there is no active column list, then this equals the table\'s physical columns.
+
+    history:
+
+    * stable: v0.10.0
+
+    [__@appender@__]: The appender to get the column count from.
+
+    __Returns:__ t'DuckDBIdx'
+
+    __C declaration:__ @duckdb_appender_column_count@
+
+    __defined at:__ @duckdb.h 2212:20@
+
+    __exported by:__ @duckdb.h@
+-}
+c_duckdb_appender_column_count ::
+     DuckDBAppender
+     {- ^
+
+          [__@appender@__]: The appender to get the column count from.
+
+          __C declaration:__ @appender@
+     -}
+  -> IO DuckDBIdx
+c_duckdb_appender_column_count =
+  hs_bindgen_d9adf614fa24a490
+
+-- __unique:__ @Database_DuckDB_FFI_Database.DuckDB.FFI_Safe_duckdb_appender_column_type@
+foreign import ccall safe "hs_bindgen_388a8d17efd22a63" hs_bindgen_388a8d17efd22a63_base ::
+     BG.Ptr BG.Void
+  -> HsBindgen.Runtime.LibC.Word64
+  -> IO (BG.Ptr BG.Void)
+
+-- __unique:__ @Database_DuckDB_FFI_Database.DuckDB.FFI_Safe_duckdb_appender_column_type@
+hs_bindgen_388a8d17efd22a63 ::
+     DuckDBAppender
+  -> DuckDBIdx
+  -> IO DuckDBLogicalType
+hs_bindgen_388a8d17efd22a63 =
+  \x0 ->
+    \x1 ->
+      fmap BG.fromFFIType (hs_bindgen_388a8d17efd22a63_base (BG.toFFIType x0) (BG.toFFIType x1))
+
+{-| Returns the type of the column at the specified index. This is either a type in the active column list, or the same type as a column in the receiving table.
+
+    Note: The resulting type must be destroyed with @'c_duckdb_destroy_logical_type'@ .
+
+    history:
+
+    * stable: v0.10.0
+
+    [__@appender@__]: The appender to get the column type from.
+
+    [__@col_idx@__]: The index of the column to get the type of.
+
+    __Returns:__ t'DuckDBLogicalType'
+
+    __C declaration:__ @duckdb_appender_column_type@
+
+    __defined at:__ @duckdb.h 2229:34@
+
+    __exported by:__ @duckdb.h@
+-}
+c_duckdb_appender_column_type ::
+     DuckDBAppender
+     {- ^
+
+          [__@appender@__]: The appender to get the column type from.
+
+          __C declaration:__ @appender@
+     -}
+  -> DuckDBIdx
+     {- ^
+
+          [__@col_idx@__]: The index of the column to get the type of.
+
+          __C declaration:__ @col_idx@
+     -}
+  -> IO DuckDBLogicalType
+c_duckdb_appender_column_type =
+  hs_bindgen_388a8d17efd22a63
+
+-- __unique:__ @Database_DuckDB_FFI_Database.DuckDB.FFI_Safe_duckdb_appender_error_data@
+foreign import ccall safe "hs_bindgen_0c7ec7ae5f924855" hs_bindgen_0c7ec7ae5f924855_base ::
+     BG.Ptr BG.Void
+  -> IO (BG.Ptr BG.Void)
+
+-- __unique:__ @Database_DuckDB_FFI_Database.DuckDB.FFI_Safe_duckdb_appender_error_data@
+hs_bindgen_0c7ec7ae5f924855 ::
+     DuckDBAppender
+  -> IO DuckDBErrorData
+hs_bindgen_0c7ec7ae5f924855 =
+  \x0 ->
+    fmap BG.fromFFIType (hs_bindgen_0c7ec7ae5f924855_base (BG.toFFIType x0))
+
+{-| Returns the error data associated with the appender. Must be destroyed with duckdb_destroy_error_data.
+
+    history:
+
+    * unstable: v1.4.0
+
+    * stable: v1.5.6
+
+    [__@appender@__]: The appender to get the error data from.
+
+    __Returns:__ t'DuckDBErrorData'
+
+    __C declaration:__ @duckdb_appender_error_data@
+
+    __defined at:__ @duckdb.h 2243:32@
+
+    __exported by:__ @duckdb.h@
+-}
+c_duckdb_appender_error_data ::
+     DuckDBAppender
+     {- ^
+
+          [__@appender@__]: The appender to get the error data from.
+
+          __C declaration:__ @appender@
+     -}
+  -> IO DuckDBErrorData
+c_duckdb_appender_error_data =
+  hs_bindgen_0c7ec7ae5f924855
+
+-- __unique:__ @Database_DuckDB_FFI_Database.DuckDB.FFI_Safe_duckdb_appender_flush@
+foreign import ccall safe "hs_bindgen_440cae7db099b464" hs_bindgen_440cae7db099b464_base ::
+     BG.Ptr BG.Void
+  -> IO BG.CUInt
+
+-- __unique:__ @Database_DuckDB_FFI_Database.DuckDB.FFI_Safe_duckdb_appender_flush@
+hs_bindgen_440cae7db099b464 ::
+     DuckDBAppender
+  -> IO DuckDBState
+hs_bindgen_440cae7db099b464 =
+  \x0 ->
+    fmap BG.fromFFIType (hs_bindgen_440cae7db099b464_base (BG.toFFIType x0))
+
+{-| Flush the appender to the table, forcing the cache of the appender to be cleared. Requires a connection with no open result. If flushing the data triggers a constraint violation or any other error, then all data is invalidated, and this function returns DuckDBError. It is not possible to append more values. Call duckdb_appender_error_data to obtain the error data followed by duckdb_appender_destroy to destroy the invalidated appender.
+
+    history:
+
+    * stable: v0.2.5
+
+    [__@appender@__]: The appender to flush.
+
+    __Returns:__ t'DuckDBState'
+
+    __C declaration:__ @duckdb_appender_flush@
+
+    __defined at:__ @duckdb.h 2259:27@
+
+    __exported by:__ @duckdb.h@
+-}
+c_duckdb_appender_flush ::
+     DuckDBAppender
+     {- ^
+
+          [__@appender@__]: The appender to flush.
+
+          __C declaration:__ @appender@
+     -}
+  -> IO DuckDBState
+c_duckdb_appender_flush = hs_bindgen_440cae7db099b464
+
+-- __unique:__ @Database_DuckDB_FFI_Database.DuckDB.FFI_Safe_duckdb_appender_clear@
+foreign import ccall safe "hs_bindgen_e89bd80516e6940c" hs_bindgen_e89bd80516e6940c_base ::
+     BG.Ptr BG.Void
+  -> IO BG.CUInt
+
+-- __unique:__ @Database_DuckDB_FFI_Database.DuckDB.FFI_Safe_duckdb_appender_clear@
+hs_bindgen_e89bd80516e6940c ::
+     DuckDBAppender
+  -> IO DuckDBState
+hs_bindgen_e89bd80516e6940c =
+  \x0 ->
+    fmap BG.fromFFIType (hs_bindgen_e89bd80516e6940c_base (BG.toFFIType x0))
+
+{-| Clears all buffered data from the appender without flushing it to the table. This discards any data that has been appended but not yet written. The appender can continue to be used after clearing.
+
+    history:
+
+    * unstable: v1.5.0
+
+    * stable: v1.5.6
+
+    [__@appender@__]: The appender to clear.
+
+    __Returns:__ t'DuckDBState'
+
+    __C declaration:__ @duckdb_appender_clear@
+
+    __defined at:__ @duckdb.h 2274:27@
+
+    __exported by:__ @duckdb.h@
+-}
+c_duckdb_appender_clear ::
+     DuckDBAppender
+     {- ^
+
+          [__@appender@__]: The appender to clear.
+
+          __C declaration:__ @appender@
+     -}
+  -> IO DuckDBState
+c_duckdb_appender_clear = hs_bindgen_e89bd80516e6940c
+
+-- __unique:__ @Database_DuckDB_FFI_Database.DuckDB.FFI_Safe_duckdb_appender_close@
+foreign import ccall safe "hs_bindgen_b6168be67cbde80f" hs_bindgen_b6168be67cbde80f_base ::
+     BG.Ptr BG.Void
+  -> IO BG.CUInt
+
+-- __unique:__ @Database_DuckDB_FFI_Database.DuckDB.FFI_Safe_duckdb_appender_close@
+hs_bindgen_b6168be67cbde80f ::
+     DuckDBAppender
+  -> IO DuckDBState
+hs_bindgen_b6168be67cbde80f =
+  \x0 ->
+    fmap BG.fromFFIType (hs_bindgen_b6168be67cbde80f_base (BG.toFFIType x0))
+
+{-| Closes the appender by flushing all intermediate states and closing it for further appends. If flushing the data triggers a constraint violation or any other error, then all data is invalidated, and this function returns DuckDBError. Call duckdb_appender_error_data to obtain the error data followed by duckdb_appender_destroy to destroy the invalidated appender.
+
+    history:
+
+    * stable: v0.2.5
+
+    [__@appender@__]: The appender to flush and close.
+
+    __Returns:__ t'DuckDBState'
+
+    __C declaration:__ @duckdb_appender_close@
+
+    __defined at:__ @duckdb.h 2290:27@
+
+    __exported by:__ @duckdb.h@
+-}
+c_duckdb_appender_close ::
+     DuckDBAppender
+     {- ^
+
+          [__@appender@__]: The appender to flush and close.
+
+          __C declaration:__ @appender@
+     -}
+  -> IO DuckDBState
+c_duckdb_appender_close = hs_bindgen_b6168be67cbde80f
+
+-- __unique:__ @Database_DuckDB_FFI_Database.DuckDB.FFI_Safe_duckdb_appender_destroy@
+foreign import ccall safe "hs_bindgen_bedb9203156b99bc" hs_bindgen_bedb9203156b99bc_base ::
+     BG.Ptr BG.Void
+  -> IO BG.CUInt
+
+-- __unique:__ @Database_DuckDB_FFI_Database.DuckDB.FFI_Safe_duckdb_appender_destroy@
+hs_bindgen_bedb9203156b99bc ::
+     BG.Ptr DuckDBAppender
+  -> IO DuckDBState
+hs_bindgen_bedb9203156b99bc =
+  \x0 ->
+    fmap BG.fromFFIType (hs_bindgen_bedb9203156b99bc_base (BG.toFFIType x0))
+
+{-| Closes the appender by flushing all intermediate states to the table and destroying it. By destroying it, this function de-allocates all memory associated with the appender. If flushing the data triggers a constraint violation, then all data is invalidated, and this function returns DuckDBError. Due to the destruction of the appender, it is no longer possible to obtain the specific error message with duckdb_appender_error. Therefore, call duckdb_appender_close before destroying the appender, if you need insights into the specific error.
+
+    history:
+
+    * stable: v0.2.5
+
+    [__@appender@__]: The appender to flush, close and destroy.
+
+    __Returns:__ t'DuckDBState'
+
+    __C declaration:__ @duckdb_appender_destroy@
+
+    __defined at:__ @duckdb.h 2307:27@
+
+    __exported by:__ @duckdb.h@
+-}
+c_duckdb_appender_destroy ::
+     BG.Ptr DuckDBAppender
+     {- ^
+
+          [__@appender@__]: The appender to flush, close and destroy.
+
+          __C declaration:__ @appender@
+     -}
+  -> IO DuckDBState
+c_duckdb_appender_destroy =
+  hs_bindgen_bedb9203156b99bc
+
+-- __unique:__ @Database_DuckDB_FFI_Database.DuckDB.FFI_Safe_duckdb_appender_add_column@
+foreign import ccall safe "hs_bindgen_fe61378b4ecf148e" hs_bindgen_fe61378b4ecf148e_base ::
+     BG.Ptr BG.Void
+  -> BG.Ptr BG.Void
+  -> IO BG.CUInt
+
+-- __unique:__ @Database_DuckDB_FFI_Database.DuckDB.FFI_Safe_duckdb_appender_add_column@
+hs_bindgen_fe61378b4ecf148e ::
+     DuckDBAppender
+  -> PtrConst.PtrConst BG.CChar
+  -> IO DuckDBState
+hs_bindgen_fe61378b4ecf148e =
+  \x0 ->
+    \x1 ->
+      fmap BG.fromFFIType (hs_bindgen_fe61378b4ecf148e_base (BG.toFFIType x0) (BG.toFFIType x1))
+
+{-| Appends a column to the active column list of the appender. Immediately flushes all previous data.
+
+    The active column list specifies all columns that are expected when flushing the data. Any non-active columns are filled with their default values, or NULL.
+
+    history:
+
+    * stable: v1.2.0
+
+    [__@appender@__]: The appender to add the column to.
+
+    [__@name@__]:
+
+    __Returns:__ t'DuckDBState'
+
+    __C declaration:__ @duckdb_appender_add_column@
+
+    __defined at:__ @duckdb.h 2324:27@
+
+    __exported by:__ @duckdb.h@
+-}
+c_duckdb_appender_add_column ::
+     DuckDBAppender
+     {- ^
+
+          [__@appender@__]: The appender to add the column to.
+
+          __C declaration:__ @appender@
+     -}
+  -> PtrConst.PtrConst BG.CChar
+     {- ^
+
+          [__@name@__]:
+
+          __C declaration:__ @name@
+     -}
+  -> IO DuckDBState
+c_duckdb_appender_add_column =
+  hs_bindgen_fe61378b4ecf148e
+
+-- __unique:__ @Database_DuckDB_FFI_Database.DuckDB.FFI_Safe_duckdb_appender_clear_columns@
+foreign import ccall safe "hs_bindgen_0ceb19489a5e573e" hs_bindgen_0ceb19489a5e573e_base ::
+     BG.Ptr BG.Void
+  -> IO BG.CUInt
+
+-- __unique:__ @Database_DuckDB_FFI_Database.DuckDB.FFI_Safe_duckdb_appender_clear_columns@
+hs_bindgen_0ceb19489a5e573e ::
+     DuckDBAppender
+  -> IO DuckDBState
+hs_bindgen_0ceb19489a5e573e =
+  \x0 ->
+    fmap BG.fromFFIType (hs_bindgen_0ceb19489a5e573e_base (BG.toFFIType x0))
+
+{-| Removes all columns from the active column list of the appender, resetting the appender to treat all columns as active. Immediately flushes all previous data.
+
+    history:
+
+    * stable: v1.2.0
+
+    [__@appender@__]: The appender to clear the columns from.
+
+    __Returns:__ t'DuckDBState'
+
+    __C declaration:__ @duckdb_appender_clear_columns@
+
+    __defined at:__ @duckdb.h 2338:27@
+
+    __exported by:__ @duckdb.h@
+-}
+c_duckdb_appender_clear_columns ::
+     DuckDBAppender
+     {- ^
+
+          [__@appender@__]: The appender to clear the columns from.
+
+          __C declaration:__ @appender@
+     -}
+  -> IO DuckDBState
+c_duckdb_appender_clear_columns =
+  hs_bindgen_0ceb19489a5e573e
+
+-- __unique:__ @Database_DuckDB_FFI_Database.DuckDB.FFI_Safe_duckdb_appender_begin_row@
+foreign import ccall safe "hs_bindgen_a6075e071c58b503" hs_bindgen_a6075e071c58b503_base ::
+     BG.Ptr BG.Void
+  -> IO BG.CUInt
+
+-- __unique:__ @Database_DuckDB_FFI_Database.DuckDB.FFI_Safe_duckdb_appender_begin_row@
+hs_bindgen_a6075e071c58b503 ::
+     DuckDBAppender
+  -> IO DuckDBState
+hs_bindgen_a6075e071c58b503 =
+  \x0 ->
+    fmap BG.fromFFIType (hs_bindgen_a6075e071c58b503_base (BG.toFFIType x0))
+
+{-| A nop function, provided for backwards compatibility reasons. Does nothing. Only @'c_duckdb_appender_end_row'@ is required.
+
+    history:
+
+    * stable: v0.2.5
+
+    [__@appender@__]:
+
+    __Returns:__ t'DuckDBState'
+
+    __C declaration:__ @duckdb_appender_begin_row@
+
+    __defined at:__ @duckdb.h 2352:27@
+
+    __exported by:__ @duckdb.h@
+-}
+c_duckdb_appender_begin_row ::
+     DuckDBAppender
+     {- ^
+
+          [__@appender@__]:
+
+          __C declaration:__ @appender@
+     -}
+  -> IO DuckDBState
+c_duckdb_appender_begin_row =
+  hs_bindgen_a6075e071c58b503
+
+-- __unique:__ @Database_DuckDB_FFI_Database.DuckDB.FFI_Safe_duckdb_appender_end_row@
+foreign import ccall safe "hs_bindgen_3a0d96e4d1abcd7f" hs_bindgen_3a0d96e4d1abcd7f_base ::
+     BG.Ptr BG.Void
+  -> IO BG.CUInt
+
+-- __unique:__ @Database_DuckDB_FFI_Database.DuckDB.FFI_Safe_duckdb_appender_end_row@
+hs_bindgen_3a0d96e4d1abcd7f ::
+     DuckDBAppender
+  -> IO DuckDBState
+hs_bindgen_3a0d96e4d1abcd7f =
+  \x0 ->
+    fmap BG.fromFFIType (hs_bindgen_3a0d96e4d1abcd7f_base (BG.toFFIType x0))
+
+{-| Finish the current row of appends. After end_row is called, the next row can be appended.
+
+    history:
+
+    * stable: v0.2.5
+
+    [__@appender@__]: The appender.
+
+    __Returns:__ t'DuckDBState'
+
+    __C declaration:__ @duckdb_appender_end_row@
+
+    __defined at:__ @duckdb.h 2365:27@
+
+    __exported by:__ @duckdb.h@
+-}
+c_duckdb_appender_end_row ::
+     DuckDBAppender
+     {- ^
+
+          [__@appender@__]: The appender.
+
+          __C declaration:__ @appender@
+     -}
+  -> IO DuckDBState
+c_duckdb_appender_end_row =
+  hs_bindgen_3a0d96e4d1abcd7f
+
+-- __unique:__ @Database_DuckDB_FFI_Database.DuckDB.FFI_Safe_duckdb_append_default@
+foreign import ccall safe "hs_bindgen_d604ee9d99caa6cb" hs_bindgen_d604ee9d99caa6cb_base ::
+     BG.Ptr BG.Void
+  -> IO BG.CUInt
+
+-- __unique:__ @Database_DuckDB_FFI_Database.DuckDB.FFI_Safe_duckdb_append_default@
+hs_bindgen_d604ee9d99caa6cb ::
+     DuckDBAppender
+  -> IO DuckDBState
+hs_bindgen_d604ee9d99caa6cb =
+  \x0 ->
+    fmap BG.fromFFIType (hs_bindgen_d604ee9d99caa6cb_base (BG.toFFIType x0))
+
+{-| Append a DEFAULT value (NULL if DEFAULT not available for column) to the appender.
+
+    history:
+
+    * stable: v1.1.0
+
+    [__@appender@__]:
+
+    __Returns:__ t'DuckDBState'
+
+    __C declaration:__ @duckdb_append_default@
+
+    __defined at:__ @duckdb.h 2378:27@
+
+    __exported by:__ @duckdb.h@
+-}
+c_duckdb_append_default ::
+     DuckDBAppender
+     {- ^
+
+          [__@appender@__]:
+
+          __C declaration:__ @appender@
+     -}
+  -> IO DuckDBState
+c_duckdb_append_default = hs_bindgen_d604ee9d99caa6cb
+
+-- __unique:__ @Database_DuckDB_FFI_Database.DuckDB.FFI_Safe_duckdb_append_default_to_chunk@
+foreign import ccall safe "hs_bindgen_67cbddd0427ae7f8" hs_bindgen_67cbddd0427ae7f8_base ::
+     BG.Ptr BG.Void
+  -> BG.Ptr BG.Void
+  -> HsBindgen.Runtime.LibC.Word64
+  -> HsBindgen.Runtime.LibC.Word64
+  -> IO BG.CUInt
+
+-- __unique:__ @Database_DuckDB_FFI_Database.DuckDB.FFI_Safe_duckdb_append_default_to_chunk@
+hs_bindgen_67cbddd0427ae7f8 ::
+     DuckDBAppender
+  -> DuckDBDataChunk
+  -> DuckDBIdx
+  -> DuckDBIdx
+  -> IO DuckDBState
+hs_bindgen_67cbddd0427ae7f8 =
+  \x0 ->
+    \x1 ->
+      \x2 ->
+        \x3 ->
+          fmap BG.fromFFIType (hs_bindgen_67cbddd0427ae7f8_base (BG.toFFIType x0) (BG.toFFIType x1) (BG.toFFIType x2) (BG.toFFIType x3))
+
+{-| Append a DEFAULT value, at the specified row and column, (NULL if DEFAULT not available for column) to the chunk created from the specified appender. The default value of the column must be a constant value. Non-deterministic expressions like nextval(\'seq\') or random() are not supported.
+
+    history:
+
+    * unstable: v1.2.0
+
+    * stable: v1.5.6
+
+    [__@appender@__]: The appender to get the default value from.
+
+    [__@chunk@__]: The data chunk to append the default value to.
+
+    [__@col@__]: The chunk column index to append the default value to.
+
+    [__@row@__]: The chunk row index to append the default value to.
+
+    __Returns:__ t'DuckDBState'
+
+    __C declaration:__ @duckdb_append_default_to_chunk@
+
+    __defined at:__ @duckdb.h 2397:27@
+
+    __exported by:__ @duckdb.h@
+-}
+c_duckdb_append_default_to_chunk ::
+     DuckDBAppender
+     {- ^
+
+          [__@appender@__]: The appender to get the default value from.
+
+          __C declaration:__ @appender@
+     -}
+  -> DuckDBDataChunk
+     {- ^
+
+          [__@chunk@__]: The data chunk to append the default value to.
+
+          __C declaration:__ @chunk@
+     -}
+  -> DuckDBIdx
+     {- ^
+
+          [__@col@__]: The chunk column index to append the default value to.
+
+          __C declaration:__ @col@
+     -}
+  -> DuckDBIdx
+     {- ^
+
+          [__@row@__]: The chunk row index to append the default value to.
+
+          __C declaration:__ @row@
+     -}
+  -> IO DuckDBState
+c_duckdb_append_default_to_chunk =
+  hs_bindgen_67cbddd0427ae7f8
+
+-- __unique:__ @Database_DuckDB_FFI_Database.DuckDB.FFI_Safe_duckdb_append_bool@
+foreign import ccall safe "hs_bindgen_d0d8ffd6be52ff07" hs_bindgen_d0d8ffd6be52ff07_base ::
+     BG.Ptr BG.Void
+  -> BG.CBool
+  -> IO BG.CUInt
+
+-- __unique:__ @Database_DuckDB_FFI_Database.DuckDB.FFI_Safe_duckdb_append_bool@
+hs_bindgen_d0d8ffd6be52ff07 ::
+     DuckDBAppender
+  -> BG.CBool
+  -> IO DuckDBState
+hs_bindgen_d0d8ffd6be52ff07 =
+  \x0 ->
+    \x1 ->
+      fmap BG.fromFFIType (hs_bindgen_d0d8ffd6be52ff07_base (BG.toFFIType x0) (BG.toFFIType x1))
+
+{-| Append a bool value to the appender.
+
+    history:
+
+    * stable: v0.2.5
+
+    [__@appender@__]:
+
+    [__@value@__]:
+
+    __Returns:__ t'DuckDBState'
+
+    __C declaration:__ @duckdb_append_bool@
+
+    __defined at:__ @duckdb.h 2412:27@
+
+    __exported by:__ @duckdb.h@
+-}
+c_duckdb_append_bool ::
+     DuckDBAppender
+     {- ^
+
+          [__@appender@__]:
+
+          __C declaration:__ @appender@
+     -}
+  -> BG.CBool
+     {- ^
+
+          [__@value@__]:
+
+          __C declaration:__ @value@
+     -}
+  -> IO DuckDBState
+c_duckdb_append_bool = hs_bindgen_d0d8ffd6be52ff07
+
+-- __unique:__ @Database_DuckDB_FFI_Database.DuckDB.FFI_Safe_duckdb_append_int8@
+foreign import ccall safe "hs_bindgen_c51b55c873ce1e28" hs_bindgen_c51b55c873ce1e28_base ::
+     BG.Ptr BG.Void
+  -> HsBindgen.Runtime.LibC.Int8
+  -> IO BG.CUInt
+
+-- __unique:__ @Database_DuckDB_FFI_Database.DuckDB.FFI_Safe_duckdb_append_int8@
+hs_bindgen_c51b55c873ce1e28 ::
+     DuckDBAppender
+  -> HsBindgen.Runtime.LibC.Int8
+  -> IO DuckDBState
+hs_bindgen_c51b55c873ce1e28 =
+  \x0 ->
+    \x1 ->
+      fmap BG.fromFFIType (hs_bindgen_c51b55c873ce1e28_base (BG.toFFIType x0) (BG.toFFIType x1))
+
+{-| Append an int8_t value to the appender.
+
+    history:
+
+    * stable: v0.2.5
+
+    [__@appender@__]:
+
+    [__@value@__]:
+
+    __Returns:__ t'DuckDBState'
+
+    __C declaration:__ @duckdb_append_int8@
+
+    __defined at:__ @duckdb.h 2426:27@
+
+    __exported by:__ @duckdb.h@
+-}
+c_duckdb_append_int8 ::
+     DuckDBAppender
+     {- ^
+
+          [__@appender@__]:
+
+          __C declaration:__ @appender@
+     -}
+  -> HsBindgen.Runtime.LibC.Int8
+     {- ^
+
+          [__@value@__]:
+
+          __C declaration:__ @value@
+     -}
+  -> IO DuckDBState
+c_duckdb_append_int8 = hs_bindgen_c51b55c873ce1e28
+
+-- __unique:__ @Database_DuckDB_FFI_Database.DuckDB.FFI_Safe_duckdb_append_int16@
+foreign import ccall safe "hs_bindgen_0ddaa75df3b9f58e" hs_bindgen_0ddaa75df3b9f58e_base ::
+     BG.Ptr BG.Void
+  -> HsBindgen.Runtime.LibC.Int16
+  -> IO BG.CUInt
+
+-- __unique:__ @Database_DuckDB_FFI_Database.DuckDB.FFI_Safe_duckdb_append_int16@
+hs_bindgen_0ddaa75df3b9f58e ::
+     DuckDBAppender
+  -> HsBindgen.Runtime.LibC.Int16
+  -> IO DuckDBState
+hs_bindgen_0ddaa75df3b9f58e =
+  \x0 ->
+    \x1 ->
+      fmap BG.fromFFIType (hs_bindgen_0ddaa75df3b9f58e_base (BG.toFFIType x0) (BG.toFFIType x1))
+
+{-| Append an int16_t value to the appender.
+
+    history:
+
+    * stable: v0.2.5
+
+    [__@appender@__]:
+
+    [__@value@__]:
+
+    __Returns:__ t'DuckDBState'
+
+    __C declaration:__ @duckdb_append_int16@
+
+    __defined at:__ @duckdb.h 2440:27@
+
+    __exported by:__ @duckdb.h@
+-}
+c_duckdb_append_int16 ::
+     DuckDBAppender
+     {- ^
+
+          [__@appender@__]:
+
+          __C declaration:__ @appender@
+     -}
+  -> HsBindgen.Runtime.LibC.Int16
+     {- ^
+
+          [__@value@__]:
+
+          __C declaration:__ @value@
+     -}
+  -> IO DuckDBState
+c_duckdb_append_int16 = hs_bindgen_0ddaa75df3b9f58e
+
+-- __unique:__ @Database_DuckDB_FFI_Database.DuckDB.FFI_Safe_duckdb_append_int32@
+foreign import ccall safe "hs_bindgen_6b7cb661bd8ea7df" hs_bindgen_6b7cb661bd8ea7df_base ::
+     BG.Ptr BG.Void
+  -> HsBindgen.Runtime.LibC.Int32
+  -> IO BG.CUInt
+
+-- __unique:__ @Database_DuckDB_FFI_Database.DuckDB.FFI_Safe_duckdb_append_int32@
+hs_bindgen_6b7cb661bd8ea7df ::
+     DuckDBAppender
+  -> HsBindgen.Runtime.LibC.Int32
+  -> IO DuckDBState
+hs_bindgen_6b7cb661bd8ea7df =
+  \x0 ->
+    \x1 ->
+      fmap BG.fromFFIType (hs_bindgen_6b7cb661bd8ea7df_base (BG.toFFIType x0) (BG.toFFIType x1))
+
+{-| Append an int32_t value to the appender.
+
+    history:
+
+    * stable: v0.2.5
+
+    [__@appender@__]:
+
+    [__@value@__]:
+
+    __Returns:__ t'DuckDBState'
+
+    __C declaration:__ @duckdb_append_int32@
+
+    __defined at:__ @duckdb.h 2454:27@
+
+    __exported by:__ @duckdb.h@
+-}
+c_duckdb_append_int32 ::
+     DuckDBAppender
+     {- ^
+
+          [__@appender@__]:
+
+          __C declaration:__ @appender@
+     -}
+  -> HsBindgen.Runtime.LibC.Int32
+     {- ^
+
+          [__@value@__]:
+
+          __C declaration:__ @value@
+     -}
+  -> IO DuckDBState
+c_duckdb_append_int32 = hs_bindgen_6b7cb661bd8ea7df
+
+-- __unique:__ @Database_DuckDB_FFI_Database.DuckDB.FFI_Safe_duckdb_append_int64@
+foreign import ccall safe "hs_bindgen_6cff86036743c55e" hs_bindgen_6cff86036743c55e_base ::
+     BG.Ptr BG.Void
+  -> HsBindgen.Runtime.LibC.Int64
+  -> IO BG.CUInt
+
+-- __unique:__ @Database_DuckDB_FFI_Database.DuckDB.FFI_Safe_duckdb_append_int64@
+hs_bindgen_6cff86036743c55e ::
+     DuckDBAppender
+  -> HsBindgen.Runtime.LibC.Int64
+  -> IO DuckDBState
+hs_bindgen_6cff86036743c55e =
+  \x0 ->
+    \x1 ->
+      fmap BG.fromFFIType (hs_bindgen_6cff86036743c55e_base (BG.toFFIType x0) (BG.toFFIType x1))
+
+{-| Append an int64_t value to the appender.
+
+    history:
+
+    * stable: v0.2.5
+
+    [__@appender@__]:
+
+    [__@value@__]:
+
+    __Returns:__ t'DuckDBState'
+
+    __C declaration:__ @duckdb_append_int64@
+
+    __defined at:__ @duckdb.h 2468:27@
+
+    __exported by:__ @duckdb.h@
+-}
+c_duckdb_append_int64 ::
+     DuckDBAppender
+     {- ^
+
+          [__@appender@__]:
+
+          __C declaration:__ @appender@
+     -}
+  -> HsBindgen.Runtime.LibC.Int64
+     {- ^
+
+          [__@value@__]:
+
+          __C declaration:__ @value@
+     -}
+  -> IO DuckDBState
+c_duckdb_append_int64 = hs_bindgen_6cff86036743c55e
+
+-- __unique:__ @Database_DuckDB_FFI_Database.DuckDB.FFI_Safe_duckdb_append_hugeint@
+foreign import ccall safe "hs_bindgen_765a56fbbd07717a" hs_bindgen_765a56fbbd07717a_base ::
+     BG.Ptr BG.Void
+  -> BG.Ptr BG.Void
+  -> IO BG.CUInt
+
+-- __unique:__ @Database_DuckDB_FFI_Database.DuckDB.FFI_Safe_duckdb_append_hugeint@
+hs_bindgen_765a56fbbd07717a ::
+     DuckDBAppender
+  -> BG.Ptr DuckDBHugeInt
+  -> IO DuckDBState
+hs_bindgen_765a56fbbd07717a =
+  \x0 ->
+    \x1 ->
+      fmap BG.fromFFIType (hs_bindgen_765a56fbbd07717a_base (BG.toFFIType x0) (BG.toFFIType x1))
+
+{-|
+
+    Append a t'DuckDBHugeInt' value to the appender.
+
+    history:
+
+    * stable: v0.2.9
+
+    [__@appender@__]:
+
+    [__@value@__]:
+
+    __Returns:__ t'DuckDBState'
+
+    __C declaration:__ @duckdb_append_hugeint@
+
+    __defined at:__ @duckdb.h 2482:27@
+
+    __exported by:__ @duckdb.h@
+-}
+c_duckdb_append_hugeint ::
+     DuckDBAppender
+     {- ^
+
+          [__@appender@__]:
+
+          __C declaration:__ @appender@
+     -}
+  -> DuckDBHugeInt
+     {- ^
+
+          [__@value@__]:
+
+          __C declaration:__ @value@
+     -}
+  -> IO DuckDBState
+c_duckdb_append_hugeint =
+  \appender0 ->
+    \value1 ->
+      BG.with value1 (\value2 ->
+                        hs_bindgen_765a56fbbd07717a appender0 value2)
+
+-- __unique:__ @Database_DuckDB_FFI_Database.DuckDB.FFI_Safe_duckdb_append_uint8@
+foreign import ccall safe "hs_bindgen_b214b9f8045936c1" hs_bindgen_b214b9f8045936c1_base ::
+     BG.Ptr BG.Void
+  -> HsBindgen.Runtime.LibC.Word8
+  -> IO BG.CUInt
+
+-- __unique:__ @Database_DuckDB_FFI_Database.DuckDB.FFI_Safe_duckdb_append_uint8@
+hs_bindgen_b214b9f8045936c1 ::
+     DuckDBAppender
+  -> HsBindgen.Runtime.LibC.Word8
+  -> IO DuckDBState
+hs_bindgen_b214b9f8045936c1 =
+  \x0 ->
+    \x1 ->
+      fmap BG.fromFFIType (hs_bindgen_b214b9f8045936c1_base (BG.toFFIType x0) (BG.toFFIType x1))
+
+{-| Append a uint8_t value to the appender.
+
+    history:
+
+    * stable: v0.2.5
+
+    [__@appender@__]:
+
+    [__@value@__]:
+
+    __Returns:__ t'DuckDBState'
+
+    __C declaration:__ @duckdb_append_uint8@
+
+    __defined at:__ @duckdb.h 2496:27@
+
+    __exported by:__ @duckdb.h@
+-}
+c_duckdb_append_uint8 ::
+     DuckDBAppender
+     {- ^
+
+          [__@appender@__]:
+
+          __C declaration:__ @appender@
+     -}
+  -> HsBindgen.Runtime.LibC.Word8
+     {- ^
+
+          [__@value@__]:
+
+          __C declaration:__ @value@
+     -}
+  -> IO DuckDBState
+c_duckdb_append_uint8 = hs_bindgen_b214b9f8045936c1
+
+-- __unique:__ @Database_DuckDB_FFI_Database.DuckDB.FFI_Safe_duckdb_append_uint16@
+foreign import ccall safe "hs_bindgen_e07db5d03eb1dd02" hs_bindgen_e07db5d03eb1dd02_base ::
+     BG.Ptr BG.Void
+  -> HsBindgen.Runtime.LibC.Word16
+  -> IO BG.CUInt
+
+-- __unique:__ @Database_DuckDB_FFI_Database.DuckDB.FFI_Safe_duckdb_append_uint16@
+hs_bindgen_e07db5d03eb1dd02 ::
+     DuckDBAppender
+  -> HsBindgen.Runtime.LibC.Word16
+  -> IO DuckDBState
+hs_bindgen_e07db5d03eb1dd02 =
+  \x0 ->
+    \x1 ->
+      fmap BG.fromFFIType (hs_bindgen_e07db5d03eb1dd02_base (BG.toFFIType x0) (BG.toFFIType x1))
+
+{-| Append a uint16_t value to the appender.
+
+    history:
+
+    * stable: v0.2.5
+
+    [__@appender@__]:
+
+    [__@value@__]:
+
+    __Returns:__ t'DuckDBState'
+
+    __C declaration:__ @duckdb_append_uint16@
+
+    __defined at:__ @duckdb.h 2510:27@
+
+    __exported by:__ @duckdb.h@
+-}
+c_duckdb_append_uint16 ::
+     DuckDBAppender
+     {- ^
+
+          [__@appender@__]:
+
+          __C declaration:__ @appender@
+     -}
+  -> HsBindgen.Runtime.LibC.Word16
+     {- ^
+
+          [__@value@__]:
+
+          __C declaration:__ @value@
+     -}
+  -> IO DuckDBState
+c_duckdb_append_uint16 = hs_bindgen_e07db5d03eb1dd02
+
+-- __unique:__ @Database_DuckDB_FFI_Database.DuckDB.FFI_Safe_duckdb_append_uint32@
+foreign import ccall safe "hs_bindgen_4b46ba5a5f4f7522" hs_bindgen_4b46ba5a5f4f7522_base ::
+     BG.Ptr BG.Void
+  -> HsBindgen.Runtime.LibC.Word32
+  -> IO BG.CUInt
+
+-- __unique:__ @Database_DuckDB_FFI_Database.DuckDB.FFI_Safe_duckdb_append_uint32@
+hs_bindgen_4b46ba5a5f4f7522 ::
+     DuckDBAppender
+  -> HsBindgen.Runtime.LibC.Word32
+  -> IO DuckDBState
+hs_bindgen_4b46ba5a5f4f7522 =
+  \x0 ->
+    \x1 ->
+      fmap BG.fromFFIType (hs_bindgen_4b46ba5a5f4f7522_base (BG.toFFIType x0) (BG.toFFIType x1))
+
+{-| Append a uint32_t value to the appender.
+
+    history:
+
+    * stable: v0.2.5
+
+    [__@appender@__]:
+
+    [__@value@__]:
+
+    __Returns:__ t'DuckDBState'
+
+    __C declaration:__ @duckdb_append_uint32@
+
+    __defined at:__ @duckdb.h 2524:27@
+
+    __exported by:__ @duckdb.h@
+-}
+c_duckdb_append_uint32 ::
+     DuckDBAppender
+     {- ^
+
+          [__@appender@__]:
+
+          __C declaration:__ @appender@
+     -}
+  -> HsBindgen.Runtime.LibC.Word32
+     {- ^
+
+          [__@value@__]:
+
+          __C declaration:__ @value@
+     -}
+  -> IO DuckDBState
+c_duckdb_append_uint32 = hs_bindgen_4b46ba5a5f4f7522
+
+-- __unique:__ @Database_DuckDB_FFI_Database.DuckDB.FFI_Safe_duckdb_append_uint64@
+foreign import ccall safe "hs_bindgen_25fbe913db29848b" hs_bindgen_25fbe913db29848b_base ::
+     BG.Ptr BG.Void
+  -> HsBindgen.Runtime.LibC.Word64
+  -> IO BG.CUInt
+
+-- __unique:__ @Database_DuckDB_FFI_Database.DuckDB.FFI_Safe_duckdb_append_uint64@
+hs_bindgen_25fbe913db29848b ::
+     DuckDBAppender
+  -> HsBindgen.Runtime.LibC.Word64
+  -> IO DuckDBState
+hs_bindgen_25fbe913db29848b =
+  \x0 ->
+    \x1 ->
+      fmap BG.fromFFIType (hs_bindgen_25fbe913db29848b_base (BG.toFFIType x0) (BG.toFFIType x1))
+
+{-| Append a uint64_t value to the appender.
+
+    history:
+
+    * stable: v0.2.5
+
+    [__@appender@__]:
+
+    [__@value@__]:
+
+    __Returns:__ t'DuckDBState'
+
+    __C declaration:__ @duckdb_append_uint64@
+
+    __defined at:__ @duckdb.h 2538:27@
+
+    __exported by:__ @duckdb.h@
+-}
+c_duckdb_append_uint64 ::
+     DuckDBAppender
+     {- ^
+
+          [__@appender@__]:
+
+          __C declaration:__ @appender@
+     -}
+  -> HsBindgen.Runtime.LibC.Word64
+     {- ^
+
+          [__@value@__]:
+
+          __C declaration:__ @value@
+     -}
+  -> IO DuckDBState
+c_duckdb_append_uint64 = hs_bindgen_25fbe913db29848b
+
+-- __unique:__ @Database_DuckDB_FFI_Database.DuckDB.FFI_Safe_duckdb_append_uhugeint@
+foreign import ccall safe "hs_bindgen_62de5fc4f18c28c0" hs_bindgen_62de5fc4f18c28c0_base ::
+     BG.Ptr BG.Void
+  -> BG.Ptr BG.Void
+  -> IO BG.CUInt
+
+-- __unique:__ @Database_DuckDB_FFI_Database.DuckDB.FFI_Safe_duckdb_append_uhugeint@
+hs_bindgen_62de5fc4f18c28c0 ::
+     DuckDBAppender
+  -> BG.Ptr DuckDBUHugeInt
+  -> IO DuckDBState
+hs_bindgen_62de5fc4f18c28c0 =
+  \x0 ->
+    \x1 ->
+      fmap BG.fromFFIType (hs_bindgen_62de5fc4f18c28c0_base (BG.toFFIType x0) (BG.toFFIType x1))
+
+{-|
+
+    Append a t'DuckDBUHugeInt' value to the appender.
+
+    history:
+
+    * stable: v0.10.0
+
+    [__@appender@__]:
+
+    [__@value@__]:
+
+    __Returns:__ t'DuckDBState'
+
+    __C declaration:__ @duckdb_append_uhugeint@
+
+    __defined at:__ @duckdb.h 2552:27@
+
+    __exported by:__ @duckdb.h@
+-}
+c_duckdb_append_uhugeint ::
+     DuckDBAppender
+     {- ^
+
+          [__@appender@__]:
+
+          __C declaration:__ @appender@
+     -}
+  -> DuckDBUHugeInt
+     {- ^
+
+          [__@value@__]:
+
+          __C declaration:__ @value@
+     -}
+  -> IO DuckDBState
+c_duckdb_append_uhugeint =
+  \appender0 ->
+    \value1 ->
+      BG.with value1 (\value2 ->
+                        hs_bindgen_62de5fc4f18c28c0 appender0 value2)
+
+-- __unique:__ @Database_DuckDB_FFI_Database.DuckDB.FFI_Safe_duckdb_append_float@
+foreign import ccall safe "hs_bindgen_96447ede7e23ec34" hs_bindgen_96447ede7e23ec34_base ::
+     BG.Ptr BG.Void
+  -> BG.CFloat
+  -> IO BG.CUInt
+
+-- __unique:__ @Database_DuckDB_FFI_Database.DuckDB.FFI_Safe_duckdb_append_float@
+hs_bindgen_96447ede7e23ec34 ::
+     DuckDBAppender
+  -> BG.CFloat
+  -> IO DuckDBState
+hs_bindgen_96447ede7e23ec34 =
+  \x0 ->
+    \x1 ->
+      fmap BG.fromFFIType (hs_bindgen_96447ede7e23ec34_base (BG.toFFIType x0) (BG.toFFIType x1))
+
+{-| Append a float value to the appender.
+
+    history:
+
+    * stable: v0.2.5
+
+    [__@appender@__]:
+
+    [__@value@__]:
+
+    __Returns:__ t'DuckDBState'
+
+    __C declaration:__ @duckdb_append_float@
+
+    __defined at:__ @duckdb.h 2566:27@
+
+    __exported by:__ @duckdb.h@
+-}
+c_duckdb_append_float ::
+     DuckDBAppender
+     {- ^
+
+          [__@appender@__]:
+
+          __C declaration:__ @appender@
+     -}
+  -> BG.CFloat
+     {- ^
+
+          [__@value@__]:
+
+          __C declaration:__ @value@
+     -}
+  -> IO DuckDBState
+c_duckdb_append_float = hs_bindgen_96447ede7e23ec34
+
+-- __unique:__ @Database_DuckDB_FFI_Database.DuckDB.FFI_Safe_duckdb_append_double@
+foreign import ccall safe "hs_bindgen_7c28467da6574418" hs_bindgen_7c28467da6574418_base ::
+     BG.Ptr BG.Void
+  -> BG.CDouble
+  -> IO BG.CUInt
+
+-- __unique:__ @Database_DuckDB_FFI_Database.DuckDB.FFI_Safe_duckdb_append_double@
+hs_bindgen_7c28467da6574418 ::
+     DuckDBAppender
+  -> BG.CDouble
+  -> IO DuckDBState
+hs_bindgen_7c28467da6574418 =
+  \x0 ->
+    \x1 ->
+      fmap BG.fromFFIType (hs_bindgen_7c28467da6574418_base (BG.toFFIType x0) (BG.toFFIType x1))
+
+{-| Append a double value to the appender.
+
+    history:
+
+    * stable: v0.2.5
+
+    [__@appender@__]:
+
+    [__@value@__]:
+
+    __Returns:__ t'DuckDBState'
+
+    __C declaration:__ @duckdb_append_double@
+
+    __defined at:__ @duckdb.h 2580:27@
+
+    __exported by:__ @duckdb.h@
+-}
+c_duckdb_append_double ::
+     DuckDBAppender
+     {- ^
+
+          [__@appender@__]:
+
+          __C declaration:__ @appender@
+     -}
+  -> BG.CDouble
+     {- ^
+
+          [__@value@__]:
+
+          __C declaration:__ @value@
+     -}
+  -> IO DuckDBState
+c_duckdb_append_double = hs_bindgen_7c28467da6574418
+
+-- __unique:__ @Database_DuckDB_FFI_Database.DuckDB.FFI_Safe_duckdb_append_date@
+foreign import ccall safe "hs_bindgen_9d8dbbd78f188e17" hs_bindgen_9d8dbbd78f188e17_base ::
+     BG.Ptr BG.Void
+  -> BG.Ptr BG.Void
+  -> IO BG.CUInt
+
+-- __unique:__ @Database_DuckDB_FFI_Database.DuckDB.FFI_Safe_duckdb_append_date@
+hs_bindgen_9d8dbbd78f188e17 ::
+     DuckDBAppender
+  -> BG.Ptr DuckDBDate
+  -> IO DuckDBState
+hs_bindgen_9d8dbbd78f188e17 =
+  \x0 ->
+    \x1 ->
+      fmap BG.fromFFIType (hs_bindgen_9d8dbbd78f188e17_base (BG.toFFIType x0) (BG.toFFIType x1))
+
+{-|
+
+    Append a t'DuckDBDate' value to the appender.
+
+    history:
+
+    * stable: v0.2.9
+
+    [__@appender@__]:
+
+    [__@value@__]:
+
+    __Returns:__ t'DuckDBState'
+
+    __C declaration:__ @duckdb_append_date@
+
+    __defined at:__ @duckdb.h 2594:27@
+
+    __exported by:__ @duckdb.h@
+-}
+c_duckdb_append_date ::
+     DuckDBAppender
+     {- ^
+
+          [__@appender@__]:
+
+          __C declaration:__ @appender@
+     -}
+  -> DuckDBDate
+     {- ^
+
+          [__@value@__]:
+
+          __C declaration:__ @value@
+     -}
+  -> IO DuckDBState
+c_duckdb_append_date =
+  \appender0 ->
+    \value1 ->
+      BG.with value1 (\value2 ->
+                        hs_bindgen_9d8dbbd78f188e17 appender0 value2)
+
+-- __unique:__ @Database_DuckDB_FFI_Database.DuckDB.FFI_Safe_duckdb_append_time@
+foreign import ccall safe "hs_bindgen_2ce7a0f0da7fd624" hs_bindgen_2ce7a0f0da7fd624_base ::
+     BG.Ptr BG.Void
+  -> BG.Ptr BG.Void
+  -> IO BG.CUInt
+
+-- __unique:__ @Database_DuckDB_FFI_Database.DuckDB.FFI_Safe_duckdb_append_time@
+hs_bindgen_2ce7a0f0da7fd624 ::
+     DuckDBAppender
+  -> BG.Ptr DuckDBTime
+  -> IO DuckDBState
+hs_bindgen_2ce7a0f0da7fd624 =
+  \x0 ->
+    \x1 ->
+      fmap BG.fromFFIType (hs_bindgen_2ce7a0f0da7fd624_base (BG.toFFIType x0) (BG.toFFIType x1))
+
+{-|
+
+    Append a t'DuckDBTime' value to the appender.
+
+    history:
+
+    * stable: v0.2.9
+
+    [__@appender@__]:
+
+    [__@value@__]:
+
+    __Returns:__ t'DuckDBState'
+
+    __C declaration:__ @duckdb_append_time@
+
+    __defined at:__ @duckdb.h 2608:27@
+
+    __exported by:__ @duckdb.h@
+-}
+c_duckdb_append_time ::
+     DuckDBAppender
+     {- ^
+
+          [__@appender@__]:
+
+          __C declaration:__ @appender@
+     -}
+  -> DuckDBTime
+     {- ^
+
+          [__@value@__]:
+
+          __C declaration:__ @value@
+     -}
+  -> IO DuckDBState
+c_duckdb_append_time =
+  \appender0 ->
+    \value1 ->
+      BG.with value1 (\value2 ->
+                        hs_bindgen_2ce7a0f0da7fd624 appender0 value2)
+
+-- __unique:__ @Database_DuckDB_FFI_Database.DuckDB.FFI_Safe_duckdb_append_timestamp@
+foreign import ccall safe "hs_bindgen_7a4497e32900cf81" hs_bindgen_7a4497e32900cf81_base ::
+     BG.Ptr BG.Void
+  -> BG.Ptr BG.Void
+  -> IO BG.CUInt
+
+-- __unique:__ @Database_DuckDB_FFI_Database.DuckDB.FFI_Safe_duckdb_append_timestamp@
+hs_bindgen_7a4497e32900cf81 ::
+     DuckDBAppender
+  -> BG.Ptr DuckDBTimestamp
+  -> IO DuckDBState
+hs_bindgen_7a4497e32900cf81 =
+  \x0 ->
+    \x1 ->
+      fmap BG.fromFFIType (hs_bindgen_7a4497e32900cf81_base (BG.toFFIType x0) (BG.toFFIType x1))
+
+{-|
+
+    Append a t'DuckDBTimestamp' value to the appender.
+
+    history:
+
+    * stable: v0.2.9
+
+    [__@appender@__]:
+
+    [__@value@__]:
+
+    __Returns:__ t'DuckDBState'
+
+    __C declaration:__ @duckdb_append_timestamp@
+
+    __defined at:__ @duckdb.h 2622:27@
+
+    __exported by:__ @duckdb.h@
+-}
+c_duckdb_append_timestamp ::
+     DuckDBAppender
+     {- ^
+
+          [__@appender@__]:
+
+          __C declaration:__ @appender@
+     -}
+  -> DuckDBTimestamp
+     {- ^
+
+          [__@value@__]:
+
+          __C declaration:__ @value@
+     -}
+  -> IO DuckDBState
+c_duckdb_append_timestamp =
+  \appender0 ->
+    \value1 ->
+      BG.with value1 (\value2 ->
+                        hs_bindgen_7a4497e32900cf81 appender0 value2)
+
+-- __unique:__ @Database_DuckDB_FFI_Database.DuckDB.FFI_Safe_duckdb_append_interval@
+foreign import ccall safe "hs_bindgen_6c1faa62ed1e4792" hs_bindgen_6c1faa62ed1e4792_base ::
+     BG.Ptr BG.Void
+  -> BG.Ptr BG.Void
+  -> IO BG.CUInt
+
+-- __unique:__ @Database_DuckDB_FFI_Database.DuckDB.FFI_Safe_duckdb_append_interval@
+hs_bindgen_6c1faa62ed1e4792 ::
+     DuckDBAppender
+  -> BG.Ptr DuckDBInterval
+  -> IO DuckDBState
+hs_bindgen_6c1faa62ed1e4792 =
+  \x0 ->
+    \x1 ->
+      fmap BG.fromFFIType (hs_bindgen_6c1faa62ed1e4792_base (BG.toFFIType x0) (BG.toFFIType x1))
+
+{-|
+
+    Append a t'DuckDBInterval' value to the appender.
+
+    history:
+
+    * stable: v0.2.9
+
+    [__@appender@__]:
+
+    [__@value@__]:
+
+    __Returns:__ t'DuckDBState'
+
+    __C declaration:__ @duckdb_append_interval@
+
+    __defined at:__ @duckdb.h 2636:27@
+
+    __exported by:__ @duckdb.h@
+-}
+c_duckdb_append_interval ::
+     DuckDBAppender
+     {- ^
+
+          [__@appender@__]:
+
+          __C declaration:__ @appender@
+     -}
+  -> DuckDBInterval
+     {- ^
+
+          [__@value@__]:
+
+          __C declaration:__ @value@
+     -}
+  -> IO DuckDBState
+c_duckdb_append_interval =
+  \appender0 ->
+    \value1 ->
+      BG.with value1 (\value2 ->
+                        hs_bindgen_6c1faa62ed1e4792 appender0 value2)
+
+-- __unique:__ @Database_DuckDB_FFI_Database.DuckDB.FFI_Safe_duckdb_append_varchar@
+foreign import ccall safe "hs_bindgen_e5225654463f5192" hs_bindgen_e5225654463f5192_base ::
+     BG.Ptr BG.Void
+  -> BG.Ptr BG.Void
+  -> IO BG.CUInt
+
+-- __unique:__ @Database_DuckDB_FFI_Database.DuckDB.FFI_Safe_duckdb_append_varchar@
+hs_bindgen_e5225654463f5192 ::
+     DuckDBAppender
+  -> PtrConst.PtrConst BG.CChar
+  -> IO DuckDBState
+hs_bindgen_e5225654463f5192 =
+  \x0 ->
+    \x1 ->
+      fmap BG.fromFFIType (hs_bindgen_e5225654463f5192_base (BG.toFFIType x0) (BG.toFFIType x1))
+
+{-| Append a varchar value to the appender.
+
+    history:
+
+    * stable: v0.2.5
+
+    [__@appender@__]:
+
+    [__@val@__]:
+
+    __Returns:__ t'DuckDBState'
+
+    __C declaration:__ @duckdb_append_varchar@
+
+    __defined at:__ @duckdb.h 2650:27@
+
+    __exported by:__ @duckdb.h@
+-}
+c_duckdb_append_varchar ::
+     DuckDBAppender
+     {- ^
+
+          [__@appender@__]:
+
+          __C declaration:__ @appender@
+     -}
+  -> PtrConst.PtrConst BG.CChar
+     {- ^
+
+          [__@val@__]:
+
+          __C declaration:__ @val@
+     -}
+  -> IO DuckDBState
+c_duckdb_append_varchar = hs_bindgen_e5225654463f5192
+
+-- __unique:__ @Database_DuckDB_FFI_Database.DuckDB.FFI_Safe_duckdb_append_varchar_length@
+foreign import ccall safe "hs_bindgen_a8ac491a9e08a58f" hs_bindgen_a8ac491a9e08a58f_base ::
+     BG.Ptr BG.Void
+  -> BG.Ptr BG.Void
+  -> HsBindgen.Runtime.LibC.Word64
+  -> IO BG.CUInt
+
+-- __unique:__ @Database_DuckDB_FFI_Database.DuckDB.FFI_Safe_duckdb_append_varchar_length@
+hs_bindgen_a8ac491a9e08a58f ::
+     DuckDBAppender
+  -> PtrConst.PtrConst BG.CChar
+  -> DuckDBIdx
+  -> IO DuckDBState
+hs_bindgen_a8ac491a9e08a58f =
+  \x0 ->
+    \x1 ->
+      \x2 ->
+        fmap BG.fromFFIType (hs_bindgen_a8ac491a9e08a58f_base (BG.toFFIType x0) (BG.toFFIType x1) (BG.toFFIType x2))
+
+{-| Append a varchar value to the appender.
+
+    history:
+
+    * stable: v0.2.5
+
+    [__@appender@__]:
+
+    [__@val@__]:
+
+    [__@length@__]:
+
+    __Returns:__ t'DuckDBState'
+
+    __C declaration:__ @duckdb_append_varchar_length@
+
+    __defined at:__ @duckdb.h 2665:27@
+
+    __exported by:__ @duckdb.h@
+-}
+c_duckdb_append_varchar_length ::
+     DuckDBAppender
+     {- ^
+
+          [__@appender@__]:
+
+          __C declaration:__ @appender@
+     -}
+  -> PtrConst.PtrConst BG.CChar
+     {- ^
+
+          [__@val@__]:
+
+          __C declaration:__ @val@
+     -}
+  -> DuckDBIdx
+     {- ^
+
+          [__@length@__]:
+
+          __C declaration:__ @length@
+     -}
+  -> IO DuckDBState
+c_duckdb_append_varchar_length =
+  hs_bindgen_a8ac491a9e08a58f
+
+-- __unique:__ @Database_DuckDB_FFI_Database.DuckDB.FFI_Safe_duckdb_append_blob@
+foreign import ccall safe "hs_bindgen_5fdc599752499241" hs_bindgen_5fdc599752499241_base ::
+     BG.Ptr BG.Void
+  -> BG.Ptr BG.Void
+  -> HsBindgen.Runtime.LibC.Word64
+  -> IO BG.CUInt
+
+-- __unique:__ @Database_DuckDB_FFI_Database.DuckDB.FFI_Safe_duckdb_append_blob@
+hs_bindgen_5fdc599752499241 ::
+     DuckDBAppender
+  -> PtrConst.PtrConst BG.Void
+  -> DuckDBIdx
+  -> IO DuckDBState
+hs_bindgen_5fdc599752499241 =
+  \x0 ->
+    \x1 ->
+      \x2 ->
+        fmap BG.fromFFIType (hs_bindgen_5fdc599752499241_base (BG.toFFIType x0) (BG.toFFIType x1) (BG.toFFIType x2))
+
+{-| Append a blob value to the appender.
+
+    history:
+
+    * stable: v0.2.5
+
+    [__@appender@__]:
+
+    [__@data@__]:
+
+    [__@length@__]:
+
+    __Returns:__ t'DuckDBState'
+
+    __C declaration:__ @duckdb_append_blob@
+
+    __defined at:__ @duckdb.h 2680:27@
+
+    __exported by:__ @duckdb.h@
+-}
+c_duckdb_append_blob ::
+     DuckDBAppender
+     {- ^
+
+          [__@appender@__]:
+
+          __C declaration:__ @appender@
+     -}
+  -> PtrConst.PtrConst BG.Void
+     {- ^
+
+          [__@data@__]:
+
+          __C declaration:__ @data@
+     -}
+  -> DuckDBIdx
+     {- ^
+
+          [__@length@__]:
+
+          __C declaration:__ @length@
+     -}
+  -> IO DuckDBState
+c_duckdb_append_blob = hs_bindgen_5fdc599752499241
+
+-- __unique:__ @Database_DuckDB_FFI_Database.DuckDB.FFI_Safe_duckdb_append_null@
+foreign import ccall safe "hs_bindgen_51084ea4cd371420" hs_bindgen_51084ea4cd371420_base ::
+     BG.Ptr BG.Void
+  -> IO BG.CUInt
+
+-- __unique:__ @Database_DuckDB_FFI_Database.DuckDB.FFI_Safe_duckdb_append_null@
+hs_bindgen_51084ea4cd371420 ::
+     DuckDBAppender
+  -> IO DuckDBState
+hs_bindgen_51084ea4cd371420 =
+  \x0 ->
+    fmap BG.fromFFIType (hs_bindgen_51084ea4cd371420_base (BG.toFFIType x0))
+
+{-| Append a NULL value to the appender (of any type).
+
+    history:
+
+    * stable: v0.2.5
+
+    [__@appender@__]:
+
+    __Returns:__ t'DuckDBState'
+
+    __C declaration:__ @duckdb_append_null@
+
+    __defined at:__ @duckdb.h 2693:27@
+
+    __exported by:__ @duckdb.h@
+-}
+c_duckdb_append_null ::
+     DuckDBAppender
+     {- ^
+
+          [__@appender@__]:
+
+          __C declaration:__ @appender@
+     -}
+  -> IO DuckDBState
+c_duckdb_append_null = hs_bindgen_51084ea4cd371420
+
+-- __unique:__ @Database_DuckDB_FFI_Database.DuckDB.FFI_Safe_duckdb_append_value@
+foreign import ccall safe "hs_bindgen_25c7249abd4ef222" hs_bindgen_25c7249abd4ef222_base ::
+     BG.Ptr BG.Void
+  -> BG.Ptr BG.Void
+  -> IO BG.CUInt
+
+-- __unique:__ @Database_DuckDB_FFI_Database.DuckDB.FFI_Safe_duckdb_append_value@
+hs_bindgen_25c7249abd4ef222 ::
+     DuckDBAppender
+  -> DuckDBValue
+  -> IO DuckDBState
+hs_bindgen_25c7249abd4ef222 =
+  \x0 ->
+    \x1 ->
+      fmap BG.fromFFIType (hs_bindgen_25c7249abd4ef222_base (BG.toFFIType x0) (BG.toFFIType x1))
+
+{-|
+
+    Append a t'DuckDBValue' to the appender.
+
+    history:
+
+    * stable: v1.2.0
+
+    [__@appender@__]:
+
+    [__@value@__]:
+
+    __Returns:__ t'DuckDBState'
+
+    __C declaration:__ @duckdb_append_value@
+
+    __defined at:__ @duckdb.h 2707:27@
+
+    __exported by:__ @duckdb.h@
+-}
+c_duckdb_append_value ::
+     DuckDBAppender
+     {- ^
+
+          [__@appender@__]:
+
+          __C declaration:__ @appender@
+     -}
+  -> DuckDBValue
+     {- ^
+
+          [__@value@__]:
+
+          __C declaration:__ @value@
+     -}
+  -> IO DuckDBState
+c_duckdb_append_value = hs_bindgen_25c7249abd4ef222
+
+-- __unique:__ @Database_DuckDB_FFI_Database.DuckDB.FFI_Safe_duckdb_append_data_chunk@
+foreign import ccall safe "hs_bindgen_7e1746e78ac83f6e" hs_bindgen_7e1746e78ac83f6e_base ::
+     BG.Ptr BG.Void
+  -> BG.Ptr BG.Void
+  -> IO BG.CUInt
+
+-- __unique:__ @Database_DuckDB_FFI_Database.DuckDB.FFI_Safe_duckdb_append_data_chunk@
+hs_bindgen_7e1746e78ac83f6e ::
+     DuckDBAppender
+  -> DuckDBDataChunk
+  -> IO DuckDBState
+hs_bindgen_7e1746e78ac83f6e =
+  \x0 ->
+    \x1 ->
+      fmap BG.fromFFIType (hs_bindgen_7e1746e78ac83f6e_base (BG.toFFIType x0) (BG.toFFIType x1))
+
+{-| Appends a pre-filled data chunk to the specified appender. Attempts casting, if the data chunk types do not match the active appender types.
+
+    history:
+
+    * stable: v0.3.3
+
+    [__@appender@__]: The appender to append to.
+
+    [__@chunk@__]: The data chunk to append.
+
+    __Returns:__ t'DuckDBState'
+
+    __C declaration:__ @duckdb_append_data_chunk@
+
+    __defined at:__ @duckdb.h 2722:27@
+
+    __exported by:__ @duckdb.h@
+-}
+c_duckdb_append_data_chunk ::
+     DuckDBAppender
+     {- ^
+
+          [__@appender@__]: The appender to append to.
+
+          __C declaration:__ @appender@
+     -}
+  -> DuckDBDataChunk
+     {- ^
+
+          [__@chunk@__]: The data chunk to append.
+
+          __C declaration:__ @chunk@
+     -}
+  -> IO DuckDBState
+c_duckdb_append_data_chunk =
+  hs_bindgen_7e1746e78ac83f6e
+
+-- __unique:__ @Database_DuckDB_FFI_Database.DuckDB.FFI_Safe_duckdb_appender_error@
+foreign import ccall safe "hs_bindgen_96a3877ac37f908a" hs_bindgen_96a3877ac37f908a_base ::
+     BG.Ptr BG.Void
+  -> IO (BG.Ptr BG.Void)
+
+-- __unique:__ @Database_DuckDB_FFI_Database.DuckDB.FFI_Safe_duckdb_appender_error@
+hs_bindgen_96a3877ac37f908a ::
+     DuckDBAppender
+  -> IO (PtrConst.PtrConst BG.CChar)
+hs_bindgen_96a3877ac37f908a =
+  \x0 ->
+    fmap BG.fromFFIType (hs_bindgen_96a3877ac37f908a_base (BG.toFFIType x0))
+
+{-| __DEPRECATION NOTICE__ : This method is scheduled for removal in a future release. Use duckdb_appender_error_data instead.
+
+    Returns the error message associated with the appender. If the appender has no error message, this returns @nullptr@ instead.
+
+    The error message should not be freed. It will be de-allocated when @'c_duckdb_appender_destroy'@ is called.
+
+    history:
+
+    * stable: v0.2.9
+
+    * deprecated: v1.4.0
+
+    [__@appender@__]: The appender to get the error from.
+
+    __Returns:__ const char*
+
+    __C declaration:__ @duckdb_appender_error@
+
+    __defined at:__ @duckdb.h 2742:26@
+
+    __exported by:__ @duckdb.h@
+-}
+c_duckdb_appender_error ::
+     DuckDBAppender
+     {- ^
+
+          [__@appender@__]: The appender to get the error from.
+
+          __C declaration:__ @appender@
+     -}
+  -> IO (PtrConst.PtrConst BG.CChar)
+c_duckdb_appender_error = hs_bindgen_96a3877ac37f908a
+
+-- __unique:__ @Database_DuckDB_FFI_Database.DuckDB.FFI_Safe_duckdb_to_arrow_schema@
+foreign import ccall safe "hs_bindgen_749f8639f0f92967" hs_bindgen_749f8639f0f92967_base ::
+     BG.Ptr BG.Void
+  -> BG.Ptr BG.Void
+  -> BG.Ptr BG.Void
+  -> HsBindgen.Runtime.LibC.Word64
+  -> BG.Ptr BG.Void
+  -> IO (BG.Ptr BG.Void)
+
+-- __unique:__ @Database_DuckDB_FFI_Database.DuckDB.FFI_Safe_duckdb_to_arrow_schema@
+hs_bindgen_749f8639f0f92967 ::
+     DuckDBArrowOptions
+  -> BG.Ptr DuckDBLogicalType
+  -> BG.Ptr (PtrConst.PtrConst BG.CChar)
+  -> DuckDBIdx
+  -> BG.Ptr ArrowSchema
+  -> IO DuckDBErrorData
+hs_bindgen_749f8639f0f92967 =
+  \x0 ->
+    \x1 ->
+      \x2 ->
+        \x3 ->
+          \x4 ->
+            fmap BG.fromFFIType (hs_bindgen_749f8639f0f92967_base (BG.toFFIType x0) (BG.toFFIType x1) (BG.toFFIType x2) (BG.toFFIType x3) (BG.toFFIType x4))
+
+{-| Transforms a DuckDB Schema into an Arrow Schema
+
+    history:
+
+    * unstable: v1.4.0
+
+    * stable: v1.5.6
+
+    [__@arrow_options@__]: The Arrow settings used to produce arrow.
+
+    [__@types@__]: The DuckDB logical types for each column in the schema.
+
+    [__@names@__]: The names for each column in the schema.
+
+    [__@column_count@__]: The number of columns that exist in the schema.
+
+    [__@out_schema@__]: The resulting arrow schema. Must be destroyed with @out_schema->release(out_schema)@ .
+
+    __Returns:__ t'DuckDBErrorData'
+
+    __C declaration:__ @duckdb_to_arrow_schema@
+
+    __defined at:__ @duckdb.h 2778:32@
+
+    __exported by:__ @duckdb.h@
+-}
+c_duckdb_to_arrow_schema ::
+     DuckDBArrowOptions
+     {- ^
+
+          [__@arrow_options@__]: The Arrow settings used to produce arrow.
+
+          __C declaration:__ @arrow_options@
+     -}
+  -> BG.Ptr DuckDBLogicalType
+     {- ^
+
+          [__@types@__]: The DuckDB logical types for each column in the schema.
+
+          __C declaration:__ @types@
+     -}
+  -> BG.Ptr (PtrConst.PtrConst BG.CChar)
+     {- ^
+
+          [__@names@__]: The names for each column in the schema.
+
+          __C declaration:__ @names@
+     -}
+  -> DuckDBIdx
+     {- ^
+
+          [__@column_count@__]: The number of columns that exist in the schema.
+
+          __C declaration:__ @column_count@
+     -}
+  -> BG.Ptr ArrowSchema
+     {- ^
+
+          [__@out_schema@__]: The resulting arrow schema. Must be destroyed with @out_schema->release(out_schema)@ .
+
+          __C declaration:__ @out_schema@
+     -}
+  -> IO DuckDBErrorData
+c_duckdb_to_arrow_schema =
+  hs_bindgen_749f8639f0f92967
+
+-- __unique:__ @Database_DuckDB_FFI_Database.DuckDB.FFI_Safe_duckdb_data_chunk_to_arrow@
+foreign import ccall safe "hs_bindgen_3c0a13f88804c747" hs_bindgen_3c0a13f88804c747_base ::
+     BG.Ptr BG.Void
+  -> BG.Ptr BG.Void
+  -> BG.Ptr BG.Void
+  -> IO (BG.Ptr BG.Void)
+
+-- __unique:__ @Database_DuckDB_FFI_Database.DuckDB.FFI_Safe_duckdb_data_chunk_to_arrow@
+hs_bindgen_3c0a13f88804c747 ::
+     DuckDBArrowOptions
+  -> DuckDBDataChunk
+  -> BG.Ptr ArrowArray
+  -> IO DuckDBErrorData
+hs_bindgen_3c0a13f88804c747 =
+  \x0 ->
+    \x1 ->
+      \x2 ->
+        fmap BG.fromFFIType (hs_bindgen_3c0a13f88804c747_base (BG.toFFIType x0) (BG.toFFIType x1) (BG.toFFIType x2))
+
+{-| Transforms a DuckDB data chunk into an Arrow array.
+
+    history:
+
+    * unstable: v1.4.0
+
+    * stable: v1.5.6
+
+    [__@arrow_options@__]: The Arrow settings used to produce arrow.
+
+    [__@chunk@__]: The DuckDB data chunk to convert.
+
+    [__@out_arrow_array@__]: The output Arrow structure that will hold the converted data. Must be released with @out_arrow_array->release(out_arrow_array)@
+
+    __Returns:__ t'DuckDBErrorData'
+
+    __C declaration:__ @duckdb_data_chunk_to_arrow@
+
+    __defined at:__ @duckdb.h 2797:32@
+
+    __exported by:__ @duckdb.h@
+-}
+c_duckdb_data_chunk_to_arrow ::
+     DuckDBArrowOptions
+     {- ^
+
+          [__@arrow_options@__]: The Arrow settings used to produce arrow.
+
+          __C declaration:__ @arrow_options@
+     -}
+  -> DuckDBDataChunk
+     {- ^
+
+          [__@chunk@__]: The DuckDB data chunk to convert.
+
+          __C declaration:__ @chunk@
+     -}
+  -> BG.Ptr ArrowArray
+     {- ^
+
+          [__@out_arrow_array@__]: The output Arrow structure that will hold the converted data. Must be released with @out_arrow_array->release(out_arrow_array)@
+
+          __C declaration:__ @out_arrow_array@
+     -}
+  -> IO DuckDBErrorData
+c_duckdb_data_chunk_to_arrow =
+  hs_bindgen_3c0a13f88804c747
+
+-- __unique:__ @Database_DuckDB_FFI_Database.DuckDB.FFI_Safe_duckdb_schema_from_arrow@
+foreign import ccall safe "hs_bindgen_57a0f20883adc249" hs_bindgen_57a0f20883adc249_base ::
+     BG.Ptr BG.Void
+  -> BG.Ptr BG.Void
+  -> BG.Ptr BG.Void
+  -> IO (BG.Ptr BG.Void)
+
+-- __unique:__ @Database_DuckDB_FFI_Database.DuckDB.FFI_Safe_duckdb_schema_from_arrow@
+hs_bindgen_57a0f20883adc249 ::
+     DuckDBConnection
+  -> BG.Ptr ArrowSchema
+  -> BG.Ptr DuckDBArrowConvertedSchema
+  -> IO DuckDBErrorData
+hs_bindgen_57a0f20883adc249 =
+  \x0 ->
+    \x1 ->
+      \x2 ->
+        fmap BG.fromFFIType (hs_bindgen_57a0f20883adc249_base (BG.toFFIType x0) (BG.toFFIType x1) (BG.toFFIType x2))
+
+{-| Transforms an Arrow Schema into a DuckDB Schema.
+
+    history:
+
+    * unstable: v1.4.0
+
+    * stable: v1.5.6
+
+    [__@connection@__]: The connection to get the transformation settings from.
+
+    [__@schema@__]: The input Arrow schema. Must be released with @schema->release(schema)@ .
+
+    [__@out_types@__]: The Arrow converted schema with extra information about the arrow types. Must be destroyed with @'c_duckdb_destroy_arrow_converted_schema'@ .
+
+    __Returns:__ t'DuckDBErrorData'
+
+    __C declaration:__ @duckdb_schema_from_arrow@
+
+    __defined at:__ @duckdb.h 2815:32@
+
+    __exported by:__ @duckdb.h@
+-}
+c_duckdb_schema_from_arrow ::
+     DuckDBConnection
+     {- ^
+
+          [__@connection@__]: The connection to get the transformation settings from.
+
+          __C declaration:__ @connection@
+     -}
+  -> BG.Ptr ArrowSchema
+     {- ^
+
+          [__@schema@__]: The input Arrow schema. Must be released with @schema->release(schema)@ .
+
+          __C declaration:__ @schema@
+     -}
+  -> BG.Ptr DuckDBArrowConvertedSchema
+     {- ^
+
+          [__@out_types@__]: The Arrow converted schema with extra information about the arrow types. Must be destroyed with @'c_duckdb_destroy_arrow_converted_schema'@ .
+
+          __C declaration:__ @out_types@
+     -}
+  -> IO DuckDBErrorData
+c_duckdb_schema_from_arrow =
+  hs_bindgen_57a0f20883adc249
+
+-- __unique:__ @Database_DuckDB_FFI_Database.DuckDB.FFI_Safe_duckdb_data_chunk_from_arrow@
+foreign import ccall safe "hs_bindgen_74a4bd664af946a0" hs_bindgen_74a4bd664af946a0_base ::
+     BG.Ptr BG.Void
+  -> BG.Ptr BG.Void
+  -> BG.Ptr BG.Void
+  -> BG.Ptr BG.Void
+  -> IO (BG.Ptr BG.Void)
+
+-- __unique:__ @Database_DuckDB_FFI_Database.DuckDB.FFI_Safe_duckdb_data_chunk_from_arrow@
+hs_bindgen_74a4bd664af946a0 ::
+     DuckDBConnection
+  -> BG.Ptr ArrowArray
+  -> DuckDBArrowConvertedSchema
+  -> BG.Ptr DuckDBDataChunk
+  -> IO DuckDBErrorData
+hs_bindgen_74a4bd664af946a0 =
+  \x0 ->
+    \x1 ->
+      \x2 ->
+        \x3 ->
+          fmap BG.fromFFIType (hs_bindgen_74a4bd664af946a0_base (BG.toFFIType x0) (BG.toFFIType x1) (BG.toFFIType x2) (BG.toFFIType x3))
+
+{-| Transforms an Arrow array into a DuckDB data chunk. The data chunk will retain ownership of the underlying Arrow data.
+
+    history:
+
+    * unstable: v1.4.0
+
+    * stable: v1.5.6
+
+    [__@connection@__]: The connection to get the transformation settings from.
+
+    [__@arrow_array@__]: The input Arrow array. Data ownership is passed on to DuckDB\'s DataChunk, the underlying object does not need to be released and won\'t have ownership of the data.
+
+    [__@converted_schema@__]: The Arrow converted schema with extra information about the arrow types.
+
+    [__@out_chunk@__]: The resulting DuckDB data chunk. Must be destroyed by duckdb_destroy_data_chunk.
+
+    __Returns:__ t'DuckDBErrorData'
+
+    __C declaration:__ @duckdb_data_chunk_from_arrow@
+
+    __defined at:__ @duckdb.h 2835:32@
+
+    __exported by:__ @duckdb.h@
+-}
+c_duckdb_data_chunk_from_arrow ::
+     DuckDBConnection
+     {- ^
+
+          [__@connection@__]: The connection to get the transformation settings from.
+
+          __C declaration:__ @connection@
+     -}
+  -> BG.Ptr ArrowArray
+     {- ^
+
+          [__@arrow_array@__]: The input Arrow array. Data ownership is passed on to DuckDB\'s DataChunk, the underlying object does not need to be released and won\'t have ownership of the data.
+
+          __C declaration:__ @arrow_array@
+     -}
+  -> DuckDBArrowConvertedSchema
+     {- ^
+
+          [__@converted_schema@__]: The Arrow converted schema with extra information about the arrow types.
+
+          __C declaration:__ @converted_schema@
+     -}
+  -> BG.Ptr DuckDBDataChunk
+     {- ^
+
+          [__@out_chunk@__]: The resulting DuckDB data chunk. Must be destroyed by duckdb_destroy_data_chunk.
+
+          __C declaration:__ @out_chunk@
+     -}
+  -> IO DuckDBErrorData
+c_duckdb_data_chunk_from_arrow =
+  hs_bindgen_74a4bd664af946a0
+
+-- __unique:__ @Database_DuckDB_FFI_Database.DuckDB.FFI_Safe_duckdb_destroy_arrow_converted_schema@
+foreign import ccall safe "hs_bindgen_d8f15a49df8ec50d" hs_bindgen_d8f15a49df8ec50d_base ::
+     BG.Ptr BG.Void
+  -> IO ()
+
+-- __unique:__ @Database_DuckDB_FFI_Database.DuckDB.FFI_Safe_duckdb_destroy_arrow_converted_schema@
+hs_bindgen_d8f15a49df8ec50d ::
+     BG.Ptr DuckDBArrowConvertedSchema
+  -> IO ()
+hs_bindgen_d8f15a49df8ec50d =
+  \x0 ->
+    hs_bindgen_d8f15a49df8ec50d_base (BG.toFFIType x0)
+
+{-| Destroys the arrow converted schema and de-allocates all memory allocated for that arrow converted schema.
+
+    history:
+
+    * unstable: v1.4.0
+
+    * stable: v1.5.6
+
+    [__@arrow_converted_schema@__]: The arrow converted schema to destroy.
+
+    __Returns:__ void
+
+    __C declaration:__ @duckdb_destroy_arrow_converted_schema@
+
+    __defined at:__ @duckdb.h 2852:19@
+
+    __exported by:__ @duckdb.h@
+-}
+c_duckdb_destroy_arrow_converted_schema ::
+     BG.Ptr DuckDBArrowConvertedSchema
+     {- ^
+
+          [__@arrow_converted_schema@__]: The arrow converted schema to destroy.
+
+          __C declaration:__ @arrow_converted_schema@
+     -}
+  -> IO ()
+c_duckdb_destroy_arrow_converted_schema =
+  hs_bindgen_d8f15a49df8ec50d
+
+-- __unique:__ @Database_DuckDB_FFI_Database.DuckDB.FFI_Safe_duckdb_query_arrow@
+foreign import ccall safe "hs_bindgen_f542464e35ec578c" hs_bindgen_f542464e35ec578c_base ::
+     BG.Ptr BG.Void
+  -> BG.Ptr BG.Void
+  -> BG.Ptr BG.Void
+  -> IO BG.CUInt
+
+-- __unique:__ @Database_DuckDB_FFI_Database.DuckDB.FFI_Safe_duckdb_query_arrow@
+hs_bindgen_f542464e35ec578c ::
+     DuckDBConnection
+  -> PtrConst.PtrConst BG.CChar
+  -> BG.Ptr DuckDBArrow
+  -> IO DuckDBState
+hs_bindgen_f542464e35ec578c =
+  \x0 ->
+    \x1 ->
+      \x2 ->
+        fmap BG.fromFFIType (hs_bindgen_f542464e35ec578c_base (BG.toFFIType x0) (BG.toFFIType x1) (BG.toFFIType x2))
+
+{-| __DEPRECATION NOTICE__ : This method is scheduled for removal in a future release.
+
+    Executes a SQL query within a connection and stores the full (materialized) result in an arrow structure. If the query fails to execute, DuckDBError is returned and the error message can be retrieved by calling @'c_duckdb_query_arrow_error'@ .
+
+    Note that after running @'c_duckdb_query_arrow'@ , @'c_duckdb_destroy_arrow'@ must be called on the result object even if the query fails, otherwise the error stored within the result will not be freed correctly.
+
+    history:
+
+    * stable: v0.2.8
+
+    * deprecated: v1.0.0
+
+    [__@connection@__]: The connection to perform the query in.
+
+    [__@query@__]: The SQL query to run.
+
+    [__@out_result@__]: The query result.
+
+    __Returns:__ t'DuckDBState'
+
+    __C declaration:__ @duckdb_query_arrow@
+
+    __defined at:__ @duckdb.h 2875:27@
+
+    __exported by:__ @duckdb.h@
+-}
+c_duckdb_query_arrow ::
+     DuckDBConnection
+     {- ^
+
+          [__@connection@__]: The connection to perform the query in.
+
+          __C declaration:__ @connection@
+     -}
+  -> PtrConst.PtrConst BG.CChar
+     {- ^
+
+          [__@query@__]: The SQL query to run.
+
+          __C declaration:__ @query@
+     -}
+  -> BG.Ptr DuckDBArrow
+     {- ^
+
+          [__@out_result@__]: The query result.
+
+          __C declaration:__ @out_result@
+     -}
+  -> IO DuckDBState
+c_duckdb_query_arrow = hs_bindgen_f542464e35ec578c
+
+-- __unique:__ @Database_DuckDB_FFI_Database.DuckDB.FFI_Safe_duckdb_query_arrow_schema@
+foreign import ccall safe "hs_bindgen_c159419cb8a6a381" hs_bindgen_c159419cb8a6a381_base ::
+     BG.Ptr BG.Void
+  -> BG.Ptr BG.Void
+  -> IO BG.CUInt
+
+-- __unique:__ @Database_DuckDB_FFI_Database.DuckDB.FFI_Safe_duckdb_query_arrow_schema@
+hs_bindgen_c159419cb8a6a381 ::
+     DuckDBArrow
+  -> BG.Ptr DuckDBArrowSchema
+  -> IO DuckDBState
+hs_bindgen_c159419cb8a6a381 =
+  \x0 ->
+    \x1 ->
+      fmap BG.fromFFIType (hs_bindgen_c159419cb8a6a381_base (BG.toFFIType x0) (BG.toFFIType x1))
+
+{-| __DEPRECATION NOTICE__ : This method is scheduled for removal in a future release.
+
+    Fetch the internal arrow schema from the arrow result. Remember to call release on the respective t'ArrowSchema' object.
+
+    history:
+
+    * stable: v0.2.8
+
+    * deprecated: v1.0.0
+
+    [__@result@__]: The result to fetch the schema from.
+
+    [__@out_schema@__]: The output schema.
+
+    __Returns:__ t'DuckDBState'
+
+    __C declaration:__ @duckdb_query_arrow_schema@
+
+    __defined at:__ @duckdb.h 2892:27@
+
+    __exported by:__ @duckdb.h@
+-}
+c_duckdb_query_arrow_schema ::
+     DuckDBArrow
+     {- ^
+
+          [__@result@__]: The result to fetch the schema from.
+
+          __C declaration:__ @result@
+     -}
+  -> BG.Ptr DuckDBArrowSchema
+     {- ^
+
+          [__@out_schema@__]: The output schema.
+
+          __C declaration:__ @out_schema@
+     -}
+  -> IO DuckDBState
+c_duckdb_query_arrow_schema =
+  hs_bindgen_c159419cb8a6a381
+
+-- __unique:__ @Database_DuckDB_FFI_Database.DuckDB.FFI_Safe_duckdb_prepared_arrow_schema@
+foreign import ccall safe "hs_bindgen_ae5a517fcc0088ea" hs_bindgen_ae5a517fcc0088ea_base ::
+     BG.Ptr BG.Void
+  -> BG.Ptr BG.Void
+  -> IO BG.CUInt
+
+-- __unique:__ @Database_DuckDB_FFI_Database.DuckDB.FFI_Safe_duckdb_prepared_arrow_schema@
+hs_bindgen_ae5a517fcc0088ea ::
+     DuckDBPreparedStatement
+  -> BG.Ptr DuckDBArrowSchema
+  -> IO DuckDBState
+hs_bindgen_ae5a517fcc0088ea =
+  \x0 ->
+    \x1 ->
+      fmap BG.fromFFIType (hs_bindgen_ae5a517fcc0088ea_base (BG.toFFIType x0) (BG.toFFIType x1))
+
+{-| __DEPRECATION NOTICE__ : This method is scheduled for removal in a future release.
+
+    Fetch the internal arrow schema from the prepared statement. Remember to call release on the respective t'ArrowSchema' object.
+
+    history:
+
+    * stable: v0.9.0
+
+    * deprecated: v1.0.0
+
+    [__@prepared@__]: The prepared statement to fetch the schema from.
+
+    [__@out_schema@__]: The output schema.
+
+    __Returns:__ t'DuckDBState'
+
+    __C declaration:__ @duckdb_prepared_arrow_schema@
+
+    __defined at:__ @duckdb.h 2910:27@
+
+    __exported by:__ @duckdb.h@
+-}
+c_duckdb_prepared_arrow_schema ::
+     DuckDBPreparedStatement
+     {- ^
+
+          [__@prepared@__]: The prepared statement to fetch the schema from.
+
+          __C declaration:__ @prepared@
+     -}
+  -> BG.Ptr DuckDBArrowSchema
+     {- ^
+
+          [__@out_schema@__]: The output schema.
+
+          __C declaration:__ @out_schema@
+     -}
+  -> IO DuckDBState
+c_duckdb_prepared_arrow_schema =
+  hs_bindgen_ae5a517fcc0088ea
+
+-- __unique:__ @Database_DuckDB_FFI_Database.DuckDB.FFI_Safe_duckdb_result_arrow_array@
+foreign import ccall safe "hs_bindgen_697c128584b3a452" hs_bindgen_697c128584b3a452_base ::
+     BG.Ptr BG.Void
+  -> BG.Ptr BG.Void
+  -> BG.Ptr BG.Void
+  -> IO ()
+
+-- __unique:__ @Database_DuckDB_FFI_Database.DuckDB.FFI_Safe_duckdb_result_arrow_array@
+hs_bindgen_697c128584b3a452 ::
+     BG.Ptr DuckDBResult
+  -> DuckDBDataChunk
+  -> BG.Ptr DuckDBArrowArray
+  -> IO ()
+hs_bindgen_697c128584b3a452 =
+  \x0 ->
+    \x1 ->
+      \x2 ->
+        hs_bindgen_697c128584b3a452_base (BG.toFFIType x0) (BG.toFFIType x1) (BG.toFFIType x2)
+
+{-| __DEPRECATION NOTICE__ : This method is scheduled for removal in a future release.
+
+    Convert a data chunk into an arrow struct array. Remember to call release on the respective t'ArrowArray' object.
+
+    history:
+
+    * stable: v0.10.0
+
+    * deprecated: v1.0.0
+
+    [__@result@__]: The result object the data chunk have been fetched from.
+
+    [__@chunk@__]: The data chunk to convert.
+
+    [__@out_array@__]: The output array.
+
+    __Returns:__ void
+
+    __C declaration:__ @duckdb_result_arrow_array@
+
+    __defined at:__ @duckdb.h 2929:19@
+
+    __exported by:__ @duckdb.h@
+-}
+c_duckdb_result_arrow_array ::
+     DuckDBResult
+     {- ^
+
+          [__@result@__]: The result object the data chunk have been fetched from.
+
+          __C declaration:__ @result@
+     -}
+  -> DuckDBDataChunk
+     {- ^
+
+          [__@chunk@__]: The data chunk to convert.
+
+          __C declaration:__ @chunk@
+     -}
+  -> BG.Ptr DuckDBArrowArray
+     {- ^
+
+          [__@out_array@__]: The output array.
+
+          __C declaration:__ @out_array@
+     -}
+  -> IO ()
+c_duckdb_result_arrow_array =
+  \result0 ->
+    \chunk1 ->
+      \out_array2 ->
+        BG.with result0 (\result3 ->
+                           hs_bindgen_697c128584b3a452 result3 chunk1 out_array2)
+
+-- __unique:__ @Database_DuckDB_FFI_Database.DuckDB.FFI_Safe_duckdb_query_arrow_array@
+foreign import ccall safe "hs_bindgen_33505698f1fd3536" hs_bindgen_33505698f1fd3536_base ::
+     BG.Ptr BG.Void
+  -> BG.Ptr BG.Void
+  -> IO BG.CUInt
+
+-- __unique:__ @Database_DuckDB_FFI_Database.DuckDB.FFI_Safe_duckdb_query_arrow_array@
+hs_bindgen_33505698f1fd3536 ::
+     DuckDBArrow
+  -> BG.Ptr DuckDBArrowArray
+  -> IO DuckDBState
+hs_bindgen_33505698f1fd3536 =
+  \x0 ->
+    \x1 ->
+      fmap BG.fromFFIType (hs_bindgen_33505698f1fd3536_base (BG.toFFIType x0) (BG.toFFIType x1))
+
+{-| __DEPRECATION NOTICE__ : This method is scheduled for removal in a future release.
+
+    Fetch an internal arrow struct array from the arrow result. Remember to call release on the respective t'ArrowArray' object.
+
+    This function can be called multiple time to get next chunks, which will free the previous out_array. So consume the out_array before calling this function again.
+
+    history:
+
+    * stable: v0.2.8
+
+    * deprecated: v1.0.0
+
+    [__@result@__]: The result to fetch the array from.
+
+    [__@out_array@__]: The output array.
+
+    __Returns:__ t'DuckDBState'
+
+    __C declaration:__ @duckdb_query_arrow_array@
+
+    __defined at:__ @duckdb.h 2951:27@
+
+    __exported by:__ @duckdb.h@
+-}
+c_duckdb_query_arrow_array ::
+     DuckDBArrow
+     {- ^
+
+          [__@result@__]: The result to fetch the array from.
+
+          __C declaration:__ @result@
+     -}
+  -> BG.Ptr DuckDBArrowArray
+     {- ^
+
+          [__@out_array@__]: The output array.
+
+          __C declaration:__ @out_array@
+     -}
+  -> IO DuckDBState
+c_duckdb_query_arrow_array =
+  hs_bindgen_33505698f1fd3536
+
+-- __unique:__ @Database_DuckDB_FFI_Database.DuckDB.FFI_Safe_duckdb_arrow_column_count@
+foreign import ccall safe "hs_bindgen_35ad4e7c492cdfa8" hs_bindgen_35ad4e7c492cdfa8_base ::
+     BG.Ptr BG.Void
+  -> IO HsBindgen.Runtime.LibC.Word64
+
+-- __unique:__ @Database_DuckDB_FFI_Database.DuckDB.FFI_Safe_duckdb_arrow_column_count@
+hs_bindgen_35ad4e7c492cdfa8 ::
+     DuckDBArrow
+  -> IO DuckDBIdx
+hs_bindgen_35ad4e7c492cdfa8 =
+  \x0 ->
+    fmap BG.fromFFIType (hs_bindgen_35ad4e7c492cdfa8_base (BG.toFFIType x0))
+
+{-| __DEPRECATION NOTICE__ : This method is scheduled for removal in a future release.
+
+    Returns the number of columns present in the arrow result object.
+
+    history:
+
+    * stable: v0.2.8
+
+    * deprecated: v1.0.0
+
+    [__@result@__]: The result object.
+
+    __Returns:__ t'DuckDBIdx'
+
+    __C declaration:__ @duckdb_arrow_column_count@
+
+    __defined at:__ @duckdb.h 2967:20@
+
+    __exported by:__ @duckdb.h@
+-}
+c_duckdb_arrow_column_count ::
+     DuckDBArrow
+     {- ^
+
+          [__@result@__]: The result object.
+
+          __C declaration:__ @result@
+     -}
+  -> IO DuckDBIdx
+c_duckdb_arrow_column_count =
+  hs_bindgen_35ad4e7c492cdfa8
+
+-- __unique:__ @Database_DuckDB_FFI_Database.DuckDB.FFI_Safe_duckdb_arrow_row_count@
+foreign import ccall safe "hs_bindgen_563d608c32762302" hs_bindgen_563d608c32762302_base ::
+     BG.Ptr BG.Void
+  -> IO HsBindgen.Runtime.LibC.Word64
+
+-- __unique:__ @Database_DuckDB_FFI_Database.DuckDB.FFI_Safe_duckdb_arrow_row_count@
+hs_bindgen_563d608c32762302 ::
+     DuckDBArrow
+  -> IO DuckDBIdx
+hs_bindgen_563d608c32762302 =
+  \x0 ->
+    fmap BG.fromFFIType (hs_bindgen_563d608c32762302_base (BG.toFFIType x0))
+
+{-| __DEPRECATION NOTICE__ : This method is scheduled for removal in a future release.
+
+    Returns the number of rows present in the arrow result object.
+
+    history:
+
+    * stable: v0.2.8
+
+    * deprecated: v1.0.0
+
+    [__@result@__]: The result object.
+
+    __Returns:__ t'DuckDBIdx'
+
+    __C declaration:__ @duckdb_arrow_row_count@
+
+    __defined at:__ @duckdb.h 2983:20@
+
+    __exported by:__ @duckdb.h@
+-}
+c_duckdb_arrow_row_count ::
+     DuckDBArrow
+     {- ^
+
+          [__@result@__]: The result object.
+
+          __C declaration:__ @result@
+     -}
+  -> IO DuckDBIdx
+c_duckdb_arrow_row_count =
+  hs_bindgen_563d608c32762302
+
+-- __unique:__ @Database_DuckDB_FFI_Database.DuckDB.FFI_Safe_duckdb_arrow_rows_changed@
+foreign import ccall safe "hs_bindgen_6eb2e5dcab2741c1" hs_bindgen_6eb2e5dcab2741c1_base ::
+     BG.Ptr BG.Void
+  -> IO HsBindgen.Runtime.LibC.Word64
+
+-- __unique:__ @Database_DuckDB_FFI_Database.DuckDB.FFI_Safe_duckdb_arrow_rows_changed@
+hs_bindgen_6eb2e5dcab2741c1 ::
+     DuckDBArrow
+  -> IO DuckDBIdx
+hs_bindgen_6eb2e5dcab2741c1 =
+  \x0 ->
+    fmap BG.fromFFIType (hs_bindgen_6eb2e5dcab2741c1_base (BG.toFFIType x0))
+
+{-| __DEPRECATION NOTICE__ : This method is scheduled for removal in a future release.
+
+    Returns the number of rows changed by the query stored in the arrow result. This is relevant only for INSERT/UPDATE/DELETE queries. For other queries the rows_changed will be 0.
+
+    history:
+
+    * stable: v0.2.8
+
+    * deprecated: v1.0.0
+
+    [__@result@__]: The result object.
+
+    __Returns:__ t'DuckDBIdx'
+
+    __C declaration:__ @duckdb_arrow_rows_changed@
+
+    __defined at:__ @duckdb.h 3000:20@
+
+    __exported by:__ @duckdb.h@
+-}
+c_duckdb_arrow_rows_changed ::
+     DuckDBArrow
+     {- ^
+
+          [__@result@__]: The result object.
+
+          __C declaration:__ @result@
+     -}
+  -> IO DuckDBIdx
+c_duckdb_arrow_rows_changed =
+  hs_bindgen_6eb2e5dcab2741c1
+
+-- __unique:__ @Database_DuckDB_FFI_Database.DuckDB.FFI_Safe_duckdb_query_arrow_error@
+foreign import ccall safe "hs_bindgen_ab8fa55204e6c826" hs_bindgen_ab8fa55204e6c826_base ::
+     BG.Ptr BG.Void
+  -> IO (BG.Ptr BG.Void)
+
+-- __unique:__ @Database_DuckDB_FFI_Database.DuckDB.FFI_Safe_duckdb_query_arrow_error@
+hs_bindgen_ab8fa55204e6c826 ::
+     DuckDBArrow
+  -> IO (PtrConst.PtrConst BG.CChar)
+hs_bindgen_ab8fa55204e6c826 =
+  \x0 ->
+    fmap BG.fromFFIType (hs_bindgen_ab8fa55204e6c826_base (BG.toFFIType x0))
+
+{-| __DEPRECATION NOTICE__ : This method is scheduled for removal in a future release.
+
+    Returns the error message contained within the result. The error is only set if @'c_duckdb_query_arrow'@ returns @@DuckDBError@@ .
+
+    The error message should not be freed. It will be de-allocated when @'c_duckdb_destroy_arrow'@ is called.
+
+    history:
+
+    * stable: v0.2.8
+
+    * deprecated: v1.0.0
+
+    [__@result@__]: The result object to fetch the error from.
+
+    __Returns:__ const char*
+
+    __C declaration:__ @duckdb_query_arrow_error@
+
+    __defined at:__ @duckdb.h 3019:26@
+
+    __exported by:__ @duckdb.h@
+-}
+c_duckdb_query_arrow_error ::
+     DuckDBArrow
+     {- ^
+
+          [__@result@__]: The result object to fetch the error from.
+
+          __C declaration:__ @result@
+     -}
+  -> IO (PtrConst.PtrConst BG.CChar)
+c_duckdb_query_arrow_error =
+  hs_bindgen_ab8fa55204e6c826
+
+-- __unique:__ @Database_DuckDB_FFI_Database.DuckDB.FFI_Safe_duckdb_destroy_arrow@
+foreign import ccall safe "hs_bindgen_d2c9f57314f0dc2e" hs_bindgen_d2c9f57314f0dc2e_base ::
+     BG.Ptr BG.Void
+  -> IO ()
+
+-- __unique:__ @Database_DuckDB_FFI_Database.DuckDB.FFI_Safe_duckdb_destroy_arrow@
+hs_bindgen_d2c9f57314f0dc2e ::
+     BG.Ptr DuckDBArrow
+  -> IO ()
+hs_bindgen_d2c9f57314f0dc2e =
+  \x0 ->
+    hs_bindgen_d2c9f57314f0dc2e_base (BG.toFFIType x0)
+
+{-| __DEPRECATION NOTICE__ : This method is scheduled for removal in a future release.
+
+    Closes the result and de-allocates all memory allocated for the arrow result.
+
+    history:
+
+    * stable: v0.2.8
+
+    * deprecated: v1.0.0
+
+    [__@result@__]: The result to destroy.
+
+    __Returns:__ void
+
+    __C declaration:__ @duckdb_destroy_arrow@
+
+    __defined at:__ @duckdb.h 3035:19@
+
+    __exported by:__ @duckdb.h@
+-}
+c_duckdb_destroy_arrow ::
+     BG.Ptr DuckDBArrow
+     {- ^
+
+          [__@result@__]: The result to destroy.
+
+          __C declaration:__ @result@
+     -}
+  -> IO ()
+c_duckdb_destroy_arrow = hs_bindgen_d2c9f57314f0dc2e
+
+-- __unique:__ @Database_DuckDB_FFI_Database.DuckDB.FFI_Safe_duckdb_destroy_arrow_stream@
+foreign import ccall safe "hs_bindgen_ac7e0c2d2bccc4ca" hs_bindgen_ac7e0c2d2bccc4ca_base ::
+     BG.Ptr BG.Void
+  -> IO ()
+
+-- __unique:__ @Database_DuckDB_FFI_Database.DuckDB.FFI_Safe_duckdb_destroy_arrow_stream@
+hs_bindgen_ac7e0c2d2bccc4ca ::
+     BG.Ptr DuckDBArrowStream
+  -> IO ()
+hs_bindgen_ac7e0c2d2bccc4ca =
+  \x0 ->
+    hs_bindgen_ac7e0c2d2bccc4ca_base (BG.toFFIType x0)
+
+{-| __DEPRECATION NOTICE__ : This method is scheduled for removal in a future release.
+
+    Releases the arrow array stream and de-allocates its memory.
+
+    history:
+
+    * stable: v0.10.0
+
+    * deprecated: v1.0.0
+
+    [__@stream_p@__]: The arrow array stream to destroy.
+
+    __Returns:__ void
+
+    __C declaration:__ @duckdb_destroy_arrow_stream@
+
+    __defined at:__ @duckdb.h 3051:19@
+
+    __exported by:__ @duckdb.h@
+-}
+c_duckdb_destroy_arrow_stream ::
+     BG.Ptr DuckDBArrowStream
+     {- ^
+
+          [__@stream_p@__]: The arrow array stream to destroy.
+
+          __C declaration:__ @stream_p@
+     -}
+  -> IO ()
+c_duckdb_destroy_arrow_stream =
+  hs_bindgen_ac7e0c2d2bccc4ca
+
+-- __unique:__ @Database_DuckDB_FFI_Database.DuckDB.FFI_Safe_duckdb_execute_prepared_arrow@
+foreign import ccall safe "hs_bindgen_6a9394320a0add34" hs_bindgen_6a9394320a0add34_base ::
+     BG.Ptr BG.Void
+  -> BG.Ptr BG.Void
+  -> IO BG.CUInt
+
+-- __unique:__ @Database_DuckDB_FFI_Database.DuckDB.FFI_Safe_duckdb_execute_prepared_arrow@
+hs_bindgen_6a9394320a0add34 ::
+     DuckDBPreparedStatement
+  -> BG.Ptr DuckDBArrow
+  -> IO DuckDBState
+hs_bindgen_6a9394320a0add34 =
+  \x0 ->
+    \x1 ->
+      fmap BG.fromFFIType (hs_bindgen_6a9394320a0add34_base (BG.toFFIType x0) (BG.toFFIType x1))
+
+{-| __DEPRECATION NOTICE__ : This method is scheduled for removal in a future release.
+
+    Executes the prepared statement with the given bound parameters, and returns an arrow query result. Note that after running @'c_duckdb_execute_prepared_arrow'@ , @'c_duckdb_destroy_arrow'@ must be called on the result object.
+
+    history:
+
+    * stable: v0.2.8
+
+    * deprecated: v1.0.0
+
+    [__@prepared_statement@__]: The prepared statement to execute.
+
+    [__@out_result@__]: The query result.
+
+    __Returns:__ t'DuckDBState'
+
+    __C declaration:__ @duckdb_execute_prepared_arrow@
+
+    __defined at:__ @duckdb.h 3069:27@
+
+    __exported by:__ @duckdb.h@
+-}
+c_duckdb_execute_prepared_arrow ::
+     DuckDBPreparedStatement
+     {- ^
+
+          [__@prepared_statement@__]: The prepared statement to execute.
+
+          __C declaration:__ @prepared_statement@
+     -}
+  -> BG.Ptr DuckDBArrow
+     {- ^
+
+          [__@out_result@__]: The query result.
+
+          __C declaration:__ @out_result@
+     -}
+  -> IO DuckDBState
+c_duckdb_execute_prepared_arrow =
+  hs_bindgen_6a9394320a0add34
+
+-- __unique:__ @Database_DuckDB_FFI_Database.DuckDB.FFI_Safe_duckdb_arrow_scan@
+foreign import ccall safe "hs_bindgen_23edfe0e6fb8b8cd" hs_bindgen_23edfe0e6fb8b8cd_base ::
+     BG.Ptr BG.Void
+  -> BG.Ptr BG.Void
+  -> BG.Ptr BG.Void
+  -> IO BG.CUInt
+
+-- __unique:__ @Database_DuckDB_FFI_Database.DuckDB.FFI_Safe_duckdb_arrow_scan@
+hs_bindgen_23edfe0e6fb8b8cd ::
+     DuckDBConnection
+  -> PtrConst.PtrConst BG.CChar
+  -> DuckDBArrowStream
+  -> IO DuckDBState
+hs_bindgen_23edfe0e6fb8b8cd =
+  \x0 ->
+    \x1 ->
+      \x2 ->
+        fmap BG.fromFFIType (hs_bindgen_23edfe0e6fb8b8cd_base (BG.toFFIType x0) (BG.toFFIType x1) (BG.toFFIType x2))
+
+{-| __DEPRECATION NOTICE__ : This method is scheduled for removal in a future release.
+
+    Scans the Arrow stream and creates a view with the given name.
+
+    history:
+
+    * stable: v0.9.0
+
+    * deprecated: v1.0.0
+
+    [__@connection@__]: The connection on which to execute the scan.
+
+    [__@table_name@__]: Name of the temporary view to create.
+
+    [__@arrow@__]: Arrow stream wrapper.
+
+    __Returns:__ t'DuckDBState'
+
+    __C declaration:__ @duckdb_arrow_scan@
+
+    __defined at:__ @duckdb.h 3088:27@
+
+    __exported by:__ @duckdb.h@
+-}
+c_duckdb_arrow_scan ::
+     DuckDBConnection
+     {- ^
+
+          [__@connection@__]: The connection on which to execute the scan.
+
+          __C declaration:__ @connection@
+     -}
+  -> PtrConst.PtrConst BG.CChar
+     {- ^
+
+          [__@table_name@__]: Name of the temporary view to create.
+
+          __C declaration:__ @table_name@
+     -}
+  -> DuckDBArrowStream
+     {- ^
+
+          [__@arrow@__]: Arrow stream wrapper.
+
+          __C declaration:__ @arrow@
+     -}
+  -> IO DuckDBState
+c_duckdb_arrow_scan = hs_bindgen_23edfe0e6fb8b8cd
+
+-- __unique:__ @Database_DuckDB_FFI_Database.DuckDB.FFI_Safe_duckdb_arrow_array_scan@
+foreign import ccall safe "hs_bindgen_595da99ffd284fe9" hs_bindgen_595da99ffd284fe9_base ::
+     BG.Ptr BG.Void
+  -> BG.Ptr BG.Void
+  -> BG.Ptr BG.Void
+  -> BG.Ptr BG.Void
+  -> BG.Ptr BG.Void
+  -> IO BG.CUInt
+
+-- __unique:__ @Database_DuckDB_FFI_Database.DuckDB.FFI_Safe_duckdb_arrow_array_scan@
+hs_bindgen_595da99ffd284fe9 ::
+     DuckDBConnection
+  -> PtrConst.PtrConst BG.CChar
+  -> DuckDBArrowSchema
+  -> DuckDBArrowArray
+  -> BG.Ptr DuckDBArrowStream
+  -> IO DuckDBState
+hs_bindgen_595da99ffd284fe9 =
+  \x0 ->
+    \x1 ->
+      \x2 ->
+        \x3 ->
+          \x4 ->
+            fmap BG.fromFFIType (hs_bindgen_595da99ffd284fe9_base (BG.toFFIType x0) (BG.toFFIType x1) (BG.toFFIType x2) (BG.toFFIType x3) (BG.toFFIType x4))
+
+{-| __DEPRECATION NOTICE__ : This method is scheduled for removal in a future release.
+
+    Scans the Arrow array and creates a view with the given name. Note that after running @'c_duckdb_arrow_array_scan'@ , @'c_duckdb_destroy_arrow_stream'@ must be called on the out stream.
+
+    history:
+
+    * stable: v0.9.0
+
+    * deprecated: v1.0.0
+
+    [__@connection@__]: The connection on which to execute the scan.
+
+    [__@table_name@__]: Name of the temporary view to create.
+
+    [__@arrow_schema@__]: Arrow schema wrapper.
+
+    [__@arrow_array@__]: Arrow array wrapper.
+
+    [__@out_stream@__]: Output array stream that wraps around the passed schema, for releasing/deleting once done.
+
+    __Returns:__ t'DuckDBState'
+
+    __C declaration:__ @duckdb_arrow_array_scan@
+
+    __defined at:__ @duckdb.h 3110:27@
+
+    __exported by:__ @duckdb.h@
+-}
+c_duckdb_arrow_array_scan ::
+     DuckDBConnection
+     {- ^
+
+          [__@connection@__]: The connection on which to execute the scan.
+
+          __C declaration:__ @connection@
+     -}
+  -> PtrConst.PtrConst BG.CChar
+     {- ^
+
+          [__@table_name@__]: Name of the temporary view to create.
+
+          __C declaration:__ @table_name@
+     -}
+  -> DuckDBArrowSchema
+     {- ^
+
+          [__@arrow_schema@__]: Arrow schema wrapper.
+
+          __C declaration:__ @arrow_schema@
+     -}
+  -> DuckDBArrowArray
+     {- ^
+
+          [__@arrow_array@__]: Arrow array wrapper.
+
+          __C declaration:__ @arrow_array@
+     -}
+  -> BG.Ptr DuckDBArrowStream
+     {- ^
+
+          [__@out_stream@__]: Output array stream that wraps around the passed schema, for releasing/deleting once done.
+
+          __C declaration:__ @out_stream@
+     -}
+  -> IO DuckDBState
+c_duckdb_arrow_array_scan =
+  hs_bindgen_595da99ffd284fe9
+
+-- __unique:__ @Database_DuckDB_FFI_Database.DuckDB.FFI_Safe_duckdb_create_cast_function@
+foreign import ccall safe "hs_bindgen_530842d8bb740323" hs_bindgen_530842d8bb740323_base ::
+     IO (BG.Ptr BG.Void)
+
+-- __unique:__ @Database_DuckDB_FFI_Database.DuckDB.FFI_Safe_duckdb_create_cast_function@
+hs_bindgen_530842d8bb740323 :: IO DuckDBCastFunction
+hs_bindgen_530842d8bb740323 =
+  fmap BG.fromFFIType hs_bindgen_530842d8bb740323_base
+
+{-| Creates a new cast function object.
+
+    history:
+
+    * stable: v1.1.0
+
+    __Returns:__ t'DuckDBCastFunction'
+
+    __C declaration:__ @duckdb_create_cast_function@
+
+    __defined at:__ @duckdb.h 3142:35@
+
+    __exported by:__ @duckdb.h@
+-}
+c_duckdb_create_cast_function :: IO DuckDBCastFunction
+c_duckdb_create_cast_function =
+  hs_bindgen_530842d8bb740323
+
+-- __unique:__ @Database_DuckDB_FFI_Database.DuckDB.FFI_Safe_duckdb_cast_function_set_source_type@
+foreign import ccall safe "hs_bindgen_79a5b6e406da35c7" hs_bindgen_79a5b6e406da35c7_base ::
+     BG.Ptr BG.Void
+  -> BG.Ptr BG.Void
+  -> IO ()
+
+-- __unique:__ @Database_DuckDB_FFI_Database.DuckDB.FFI_Safe_duckdb_cast_function_set_source_type@
+hs_bindgen_79a5b6e406da35c7 ::
+     DuckDBCastFunction
+  -> DuckDBLogicalType
+  -> IO ()
+hs_bindgen_79a5b6e406da35c7 =
+  \x0 ->
+    \x1 ->
+      hs_bindgen_79a5b6e406da35c7_base (BG.toFFIType x0) (BG.toFFIType x1)
+
+{-| Sets the source type of the cast function.
+
+    history:
+
+    * stable: v1.1.0
+
+    [__@cast_function@__]: The cast function object.
+
+    [__@source_type@__]: The source type to set.
+
+    __Returns:__ void
+
+    __C declaration:__ @duckdb_cast_function_set_source_type@
+
+    __defined at:__ @duckdb.h 3156:19@
+
+    __exported by:__ @duckdb.h@
+-}
+c_duckdb_cast_function_set_source_type ::
+     DuckDBCastFunction
+     {- ^
+
+          [__@cast_function@__]: The cast function object.
+
+          __C declaration:__ @cast_function@
+     -}
+  -> DuckDBLogicalType
+     {- ^
+
+          [__@source_type@__]: The source type to set.
+
+          __C declaration:__ @source_type@
+     -}
+  -> IO ()
+c_duckdb_cast_function_set_source_type =
+  hs_bindgen_79a5b6e406da35c7
+
+-- __unique:__ @Database_DuckDB_FFI_Database.DuckDB.FFI_Safe_duckdb_cast_function_set_target_type@
+foreign import ccall safe "hs_bindgen_e10f2f2c59c28010" hs_bindgen_e10f2f2c59c28010_base ::
+     BG.Ptr BG.Void
+  -> BG.Ptr BG.Void
+  -> IO ()
+
+-- __unique:__ @Database_DuckDB_FFI_Database.DuckDB.FFI_Safe_duckdb_cast_function_set_target_type@
+hs_bindgen_e10f2f2c59c28010 ::
+     DuckDBCastFunction
+  -> DuckDBLogicalType
+  -> IO ()
+hs_bindgen_e10f2f2c59c28010 =
+  \x0 ->
+    \x1 ->
+      hs_bindgen_e10f2f2c59c28010_base (BG.toFFIType x0) (BG.toFFIType x1)
+
+{-| Sets the target type of the cast function.
+
+    history:
+
+    * stable: v1.1.0
+
+    [__@cast_function@__]: The cast function object.
+
+    [__@target_type@__]: The target type to set.
+
+    __Returns:__ void
+
+    __C declaration:__ @duckdb_cast_function_set_target_type@
+
+    __defined at:__ @duckdb.h 3171:19@
+
+    __exported by:__ @duckdb.h@
+-}
+c_duckdb_cast_function_set_target_type ::
+     DuckDBCastFunction
+     {- ^
+
+          [__@cast_function@__]: The cast function object.
+
+          __C declaration:__ @cast_function@
+     -}
+  -> DuckDBLogicalType
+     {- ^
+
+          [__@target_type@__]: The target type to set.
+
+          __C declaration:__ @target_type@
+     -}
+  -> IO ()
+c_duckdb_cast_function_set_target_type =
+  hs_bindgen_e10f2f2c59c28010
+
+-- __unique:__ @Database_DuckDB_FFI_Database.DuckDB.FFI_Safe_duckdb_cast_function_set_implicit_cast_cost@
+foreign import ccall safe "hs_bindgen_b91f08fa8ca3a98a" hs_bindgen_b91f08fa8ca3a98a_base ::
+     BG.Ptr BG.Void
+  -> HsBindgen.Runtime.LibC.Int64
+  -> IO ()
+
+-- __unique:__ @Database_DuckDB_FFI_Database.DuckDB.FFI_Safe_duckdb_cast_function_set_implicit_cast_cost@
+hs_bindgen_b91f08fa8ca3a98a ::
+     DuckDBCastFunction
+  -> HsBindgen.Runtime.LibC.Int64
+  -> IO ()
+hs_bindgen_b91f08fa8ca3a98a =
+  \x0 ->
+    \x1 ->
+      hs_bindgen_b91f08fa8ca3a98a_base (BG.toFFIType x0) (BG.toFFIType x1)
+
+{-| Sets the "cost" of implicitly casting the source type to the target type using this function.
+
+    history:
+
+    * stable: v1.1.0
+
+    [__@cast_function@__]: The cast function object.
+
+    [__@cost@__]: The cost to set.
+
+    __Returns:__ void
+
+    __C declaration:__ @duckdb_cast_function_set_implicit_cast_cost@
+
+    __defined at:__ @duckdb.h 3186:19@
+
+    __exported by:__ @duckdb.h@
+-}
+c_duckdb_cast_function_set_implicit_cast_cost ::
+     DuckDBCastFunction
+     {- ^
+
+          [__@cast_function@__]: The cast function object.
+
+          __C declaration:__ @cast_function@
+     -}
+  -> HsBindgen.Runtime.LibC.Int64
+     {- ^
+
+          [__@cost@__]: The cost to set.
+
+          __C declaration:__ @cost@
+     -}
+  -> IO ()
+c_duckdb_cast_function_set_implicit_cast_cost =
+  hs_bindgen_b91f08fa8ca3a98a
+
+-- __unique:__ @Database_DuckDB_FFI_Database.DuckDB.FFI_Safe_duckdb_cast_function_set_function@
+foreign import ccall safe "hs_bindgen_b04584eb2fd6c16e" hs_bindgen_b04584eb2fd6c16e_base ::
+     BG.Ptr BG.Void
+  -> BG.FunPtr BG.Void
+  -> IO ()
+
+-- __unique:__ @Database_DuckDB_FFI_Database.DuckDB.FFI_Safe_duckdb_cast_function_set_function@
+hs_bindgen_b04584eb2fd6c16e ::
+     DuckDBCastFunction
+  -> DuckDBCastFunctionFun
+  -> IO ()
+hs_bindgen_b04584eb2fd6c16e =
+  \x0 ->
+    \x1 ->
+      hs_bindgen_b04584eb2fd6c16e_base (BG.toFFIType x0) (BG.toFFIType x1)
+
+{-| Sets the actual cast function to use.
+
+    history:
+
+    * stable: v1.1.0
+
+    [__@cast_function@__]: The cast function object.
+
+    [__@function@__]: The function to set.
+
+    __Returns:__ void
+
+    __C declaration:__ @duckdb_cast_function_set_function@
+
+    __defined at:__ @duckdb.h 3200:19@
+
+    __exported by:__ @duckdb.h@
+-}
+c_duckdb_cast_function_set_function ::
+     DuckDBCastFunction
+     {- ^
+
+          [__@cast_function@__]: The cast function object.
+
+          __C declaration:__ @cast_function@
+     -}
+  -> DuckDBCastFunctionFun
+     {- ^
+
+          [__@function@__]: The function to set.
+
+          __C declaration:__ @function@
+     -}
+  -> IO ()
+c_duckdb_cast_function_set_function =
+  hs_bindgen_b04584eb2fd6c16e
+
+-- __unique:__ @Database_DuckDB_FFI_Database.DuckDB.FFI_Safe_duckdb_cast_function_set_extra_info@
+foreign import ccall safe "hs_bindgen_aa3d7539369988e9" hs_bindgen_aa3d7539369988e9_base ::
+     BG.Ptr BG.Void
+  -> BG.Ptr BG.Void
+  -> BG.FunPtr BG.Void
+  -> IO ()
+
+-- __unique:__ @Database_DuckDB_FFI_Database.DuckDB.FFI_Safe_duckdb_cast_function_set_extra_info@
+hs_bindgen_aa3d7539369988e9 ::
+     DuckDBCastFunction
+  -> BG.Ptr BG.Void
+  -> DuckDBDeleteCallback
+  -> IO ()
+hs_bindgen_aa3d7539369988e9 =
+  \x0 ->
+    \x1 ->
+      \x2 ->
+        hs_bindgen_aa3d7539369988e9_base (BG.toFFIType x0) (BG.toFFIType x1) (BG.toFFIType x2)
+
+{-| Assigns extra information to the cast function that can be fetched during execution, etc.
+
+    history:
+
+    * stable: v1.1.0
+
+    [__@cast_function@__]:
+
+    [__@extra_info@__]: The extra information
+
+    [__@destroy@__]: The callback that will be called to destroy the extra information (if any)
+
+    __Returns:__ void
+
+    __C declaration:__ @duckdb_cast_function_set_extra_info@
+
+    __defined at:__ @duckdb.h 3216:19@
+
+    __exported by:__ @duckdb.h@
+-}
+c_duckdb_cast_function_set_extra_info ::
+     DuckDBCastFunction
+     {- ^
+
+          [__@cast_function@__]:
+
+          __C declaration:__ @cast_function@
+     -}
+  -> BG.Ptr BG.Void
+     {- ^
+
+          [__@extra_info@__]: The extra information
+
+          __C declaration:__ @extra_info@
+     -}
+  -> DuckDBDeleteCallback
+     {- ^
+
+          [__@destroy@__]: The callback that will be called to destroy the extra information (if any)
+
+          __C declaration:__ @destroy@
+     -}
+  -> IO ()
+c_duckdb_cast_function_set_extra_info =
+  hs_bindgen_aa3d7539369988e9
+
+-- __unique:__ @Database_DuckDB_FFI_Database.DuckDB.FFI_Safe_duckdb_cast_function_get_extra_info@
+foreign import ccall safe "hs_bindgen_8d27e93926d18d88" hs_bindgen_8d27e93926d18d88_base ::
+     BG.Ptr BG.Void
+  -> IO (BG.Ptr BG.Void)
+
+-- __unique:__ @Database_DuckDB_FFI_Database.DuckDB.FFI_Safe_duckdb_cast_function_get_extra_info@
+hs_bindgen_8d27e93926d18d88 ::
+     DuckDBFunctionInfo
+  -> IO (BG.Ptr BG.Void)
+hs_bindgen_8d27e93926d18d88 =
+  \x0 ->
+    fmap BG.fromFFIType (hs_bindgen_8d27e93926d18d88_base (BG.toFFIType x0))
+
+{-| Retrieves the extra info of the function as set in @'c_duckdb_cast_function_set_extra_info'@ .
+
+    history:
+
+    * stable: v1.1.0
+
+    [__@info@__]: The info object.
+
+    __Returns:__ void*
+
+    __C declaration:__ @duckdb_cast_function_get_extra_info@
+
+    __defined at:__ @duckdb.h 3230:20@
+
+    __exported by:__ @duckdb.h@
+-}
+c_duckdb_cast_function_get_extra_info ::
+     DuckDBFunctionInfo
+     {- ^
+
+          [__@info@__]: The info object.
+
+          __C declaration:__ @info@
+     -}
+  -> IO (BG.Ptr BG.Void)
+c_duckdb_cast_function_get_extra_info =
+  hs_bindgen_8d27e93926d18d88
+
+-- __unique:__ @Database_DuckDB_FFI_Database.DuckDB.FFI_Safe_duckdb_cast_function_get_cast_mode@
+foreign import ccall safe "hs_bindgen_007c30c55010fd1b" hs_bindgen_007c30c55010fd1b_base ::
+     BG.Ptr BG.Void
+  -> IO BG.CUInt
+
+-- __unique:__ @Database_DuckDB_FFI_Database.DuckDB.FFI_Safe_duckdb_cast_function_get_cast_mode@
+hs_bindgen_007c30c55010fd1b ::
+     DuckDBFunctionInfo
+  -> IO DuckDBCastMode
+hs_bindgen_007c30c55010fd1b =
+  \x0 ->
+    fmap BG.fromFFIType (hs_bindgen_007c30c55010fd1b_base (BG.toFFIType x0))
+
+{-| Get the cast execution mode from the given function info.
+
+    history:
+
+    * stable: v1.1.0
+
+    [__@info@__]: The info object.
+
+    __Returns:__ t'DuckDBCastMode'
+
+    __C declaration:__ @duckdb_cast_function_get_cast_mode@
+
+    __defined at:__ @duckdb.h 3243:31@
+
+    __exported by:__ @duckdb.h@
+-}
+c_duckdb_cast_function_get_cast_mode ::
+     DuckDBFunctionInfo
+     {- ^
+
+          [__@info@__]: The info object.
+
+          __C declaration:__ @info@
+     -}
+  -> IO DuckDBCastMode
+c_duckdb_cast_function_get_cast_mode =
+  hs_bindgen_007c30c55010fd1b
+
+-- __unique:__ @Database_DuckDB_FFI_Database.DuckDB.FFI_Safe_duckdb_cast_function_set_error@
+foreign import ccall safe "hs_bindgen_224a31360352029c" hs_bindgen_224a31360352029c_base ::
+     BG.Ptr BG.Void
+  -> BG.Ptr BG.Void
+  -> IO ()
+
+-- __unique:__ @Database_DuckDB_FFI_Database.DuckDB.FFI_Safe_duckdb_cast_function_set_error@
+hs_bindgen_224a31360352029c ::
+     DuckDBFunctionInfo
+  -> PtrConst.PtrConst BG.CChar
+  -> IO ()
+hs_bindgen_224a31360352029c =
+  \x0 ->
+    \x1 ->
+      hs_bindgen_224a31360352029c_base (BG.toFFIType x0) (BG.toFFIType x1)
+
+{-| Report that an error has occurred while executing the cast function.
+
+    history:
+
+    * stable: v1.1.0
+
+    [__@info@__]: The info object.
+
+    [__@error@__]: The error message.
+
+    __Returns:__ void
+
+    __C declaration:__ @duckdb_cast_function_set_error@
+
+    __defined at:__ @duckdb.h 3257:19@
+
+    __exported by:__ @duckdb.h@
+-}
+c_duckdb_cast_function_set_error ::
+     DuckDBFunctionInfo
+     {- ^
+
+          [__@info@__]: The info object.
+
+          __C declaration:__ @info@
+     -}
+  -> PtrConst.PtrConst BG.CChar
+     {- ^
+
+          [__@error@__]: The error message.
+
+          __C declaration:__ @error@
+     -}
+  -> IO ()
+c_duckdb_cast_function_set_error =
+  hs_bindgen_224a31360352029c
+
+-- __unique:__ @Database_DuckDB_FFI_Database.DuckDB.FFI_Safe_duckdb_cast_function_set_row_error@
+foreign import ccall safe "hs_bindgen_797b13ae1942639e" hs_bindgen_797b13ae1942639e_base ::
+     BG.Ptr BG.Void
+  -> BG.Ptr BG.Void
+  -> HsBindgen.Runtime.LibC.Word64
+  -> BG.Ptr BG.Void
+  -> IO ()
+
+-- __unique:__ @Database_DuckDB_FFI_Database.DuckDB.FFI_Safe_duckdb_cast_function_set_row_error@
+hs_bindgen_797b13ae1942639e ::
+     DuckDBFunctionInfo
+  -> PtrConst.PtrConst BG.CChar
+  -> DuckDBIdx
+  -> DuckDBVector
+  -> IO ()
+hs_bindgen_797b13ae1942639e =
+  \x0 ->
+    \x1 ->
+      \x2 ->
+        \x3 ->
+          hs_bindgen_797b13ae1942639e_base (BG.toFFIType x0) (BG.toFFIType x1) (BG.toFFIType x2) (BG.toFFIType x3)
+
+{-| Report that an error has occurred while executing the cast function, setting the corresponding output row to NULL.
+
+    history:
+
+    * stable: v1.1.0
+
+    [__@info@__]: The info object.
+
+    [__@error@__]: The error message.
+
+    [__@row@__]: The index of the row within the output vector to set to NULL.
+
+    [__@output@__]: The output vector.
+
+    __Returns:__ void
+
+    __C declaration:__ @duckdb_cast_function_set_row_error@
+
+    __defined at:__ @duckdb.h 3273:19@
+
+    __exported by:__ @duckdb.h@
+-}
+c_duckdb_cast_function_set_row_error ::
+     DuckDBFunctionInfo
+     {- ^
+
+          [__@info@__]: The info object.
+
+          __C declaration:__ @info@
+     -}
+  -> PtrConst.PtrConst BG.CChar
+     {- ^
+
+          [__@error@__]: The error message.
+
+          __C declaration:__ @error@
+     -}
+  -> DuckDBIdx
+     {- ^
+
+          [__@row@__]: The index of the row within the output vector to set to NULL.
+
+          __C declaration:__ @row@
+     -}
+  -> DuckDBVector
+     {- ^
+
+          [__@output@__]: The output vector.
+
+          __C declaration:__ @output@
+     -}
+  -> IO ()
+c_duckdb_cast_function_set_row_error =
+  hs_bindgen_797b13ae1942639e
+
+-- __unique:__ @Database_DuckDB_FFI_Database.DuckDB.FFI_Safe_duckdb_register_cast_function@
+foreign import ccall safe "hs_bindgen_0afe718cbb1361cb" hs_bindgen_0afe718cbb1361cb_base ::
+     BG.Ptr BG.Void
+  -> BG.Ptr BG.Void
+  -> IO BG.CUInt
+
+-- __unique:__ @Database_DuckDB_FFI_Database.DuckDB.FFI_Safe_duckdb_register_cast_function@
+hs_bindgen_0afe718cbb1361cb ::
+     DuckDBConnection
+  -> DuckDBCastFunction
+  -> IO DuckDBState
+hs_bindgen_0afe718cbb1361cb =
+  \x0 ->
+    \x1 ->
+      fmap BG.fromFFIType (hs_bindgen_0afe718cbb1361cb_base (BG.toFFIType x0) (BG.toFFIType x1))
+
+{-| Registers a cast function within the given connection.
+
+    history:
+
+    * stable: v1.1.0
+
+    [__@con@__]: The connection to use.
+
+    [__@cast_function@__]: The cast function to register.
+
+    __Returns:__ t'DuckDBState'
+
+    __C declaration:__ @duckdb_register_cast_function@
+
+    __defined at:__ @duckdb.h 3288:27@
+
+    __exported by:__ @duckdb.h@
+-}
+c_duckdb_register_cast_function ::
+     DuckDBConnection
+     {- ^
+
+          [__@con@__]: The connection to use.
+
+          __C declaration:__ @con@
+     -}
+  -> DuckDBCastFunction
+     {- ^
+
+          [__@cast_function@__]: The cast function to register.
+
+          __C declaration:__ @cast_function@
+     -}
+  -> IO DuckDBState
+c_duckdb_register_cast_function =
+  hs_bindgen_0afe718cbb1361cb
+
+-- __unique:__ @Database_DuckDB_FFI_Database.DuckDB.FFI_Safe_duckdb_destroy_cast_function@
+foreign import ccall safe "hs_bindgen_7586ad32fb8d02b1" hs_bindgen_7586ad32fb8d02b1_base ::
+     BG.Ptr BG.Void
+  -> IO ()
+
+-- __unique:__ @Database_DuckDB_FFI_Database.DuckDB.FFI_Safe_duckdb_destroy_cast_function@
+hs_bindgen_7586ad32fb8d02b1 ::
+     BG.Ptr DuckDBCastFunction
+  -> IO ()
+hs_bindgen_7586ad32fb8d02b1 =
+  \x0 ->
+    hs_bindgen_7586ad32fb8d02b1_base (BG.toFFIType x0)
+
+{-| Destroys the cast function object.
+
+    history:
+
+    * stable: v1.1.0
+
+    [__@cast_function@__]: The cast function object.
+
+    __Returns:__ void
+
+    __C declaration:__ @duckdb_destroy_cast_function@
+
+    __defined at:__ @duckdb.h 3301:19@
+
+    __exported by:__ @duckdb.h@
+-}
+c_duckdb_destroy_cast_function ::
+     BG.Ptr DuckDBCastFunction
+     {- ^
+
+          [__@cast_function@__]: The cast function object.
+
+          __C declaration:__ @cast_function@
+     -}
+  -> IO ()
+c_duckdb_destroy_cast_function =
+  hs_bindgen_7586ad32fb8d02b1
+
+-- __unique:__ @Database_DuckDB_FFI_Database.DuckDB.FFI_Safe_duckdb_client_context_get_catalog@
+foreign import ccall safe "hs_bindgen_325fa3e1c034e2a4" hs_bindgen_325fa3e1c034e2a4_base ::
+     BG.Ptr BG.Void
+  -> BG.Ptr BG.Void
+  -> IO (BG.Ptr BG.Void)
+
+-- __unique:__ @Database_DuckDB_FFI_Database.DuckDB.FFI_Safe_duckdb_client_context_get_catalog@
+hs_bindgen_325fa3e1c034e2a4 ::
+     DuckDBClientContext
+  -> PtrConst.PtrConst BG.CChar
+  -> IO DuckDBCatalog
+hs_bindgen_325fa3e1c034e2a4 =
+  \x0 ->
+    \x1 ->
+      fmap BG.fromFFIType (hs_bindgen_325fa3e1c034e2a4_base (BG.toFFIType x0) (BG.toFFIType x1))
+
+{-| Retrieve a database catalog instance by name. This function can only be called from within the context of an active transaction, e.g. during execution of a registered function callback. Otherwise returns @nullptr@ .
+
+    history:
+
+    * unstable: v1.5.0
+
+    * stable: v1.5.6
+
+    [__@context@__]: The client context.
+
+    [__@catalog_name@__]: The name of the catalog.
+
+    __Returns:__ t'DuckDBCatalog'
+
+    __C declaration:__ @duckdb_client_context_get_catalog@
+
+    __defined at:__ @duckdb.h 3335:29@
+
+    __exported by:__ @duckdb.h@
+-}
+c_duckdb_client_context_get_catalog ::
+     DuckDBClientContext
+     {- ^
+
+          [__@context@__]: The client context.
+
+          __C declaration:__ @context@
+     -}
+  -> PtrConst.PtrConst BG.CChar
+     {- ^
+
+          [__@catalog_name@__]: The name of the catalog.
+
+          __C declaration:__ @catalog_name@
+     -}
+  -> IO DuckDBCatalog
+c_duckdb_client_context_get_catalog =
+  hs_bindgen_325fa3e1c034e2a4
+
+-- __unique:__ @Database_DuckDB_FFI_Database.DuckDB.FFI_Safe_duckdb_catalog_get_type_name@
+foreign import ccall safe "hs_bindgen_dc671e8d1eacfa00" hs_bindgen_dc671e8d1eacfa00_base ::
+     BG.Ptr BG.Void
+  -> IO (BG.Ptr BG.Void)
+
+-- __unique:__ @Database_DuckDB_FFI_Database.DuckDB.FFI_Safe_duckdb_catalog_get_type_name@
+hs_bindgen_dc671e8d1eacfa00 ::
+     DuckDBCatalog
+  -> IO (PtrConst.PtrConst BG.CChar)
+hs_bindgen_dc671e8d1eacfa00 =
+  \x0 ->
+    fmap BG.fromFFIType (hs_bindgen_dc671e8d1eacfa00_base (BG.toFFIType x0))
+
+{-| Retrieve the "type name" of the given catalog. E.g. for a DuckDB database, this returns \'duckdb\'. The returned string is owned by the catalog and remains valid until the catalog is destroyed.
+
+    history:
+
+    * unstable: v1.5.0
+
+    * stable: v1.5.6
+
+    [__@catalog@__]: The catalog.
+
+    __Returns:__ const char*
+
+    __C declaration:__ @duckdb_catalog_get_type_name@
+
+    __defined at:__ @duckdb.h 3350:26@
+
+    __exported by:__ @duckdb.h@
+-}
+c_duckdb_catalog_get_type_name ::
+     DuckDBCatalog
+     {- ^
+
+          [__@catalog@__]: The catalog.
+
+          __C declaration:__ @catalog@
+     -}
+  -> IO (PtrConst.PtrConst BG.CChar)
+c_duckdb_catalog_get_type_name =
+  hs_bindgen_dc671e8d1eacfa00
+
+-- __unique:__ @Database_DuckDB_FFI_Database.DuckDB.FFI_Safe_duckdb_catalog_get_entry@
+foreign import ccall safe "hs_bindgen_aba4dfe53d092aa4" hs_bindgen_aba4dfe53d092aa4_base ::
+     BG.Ptr BG.Void
+  -> BG.Ptr BG.Void
+  -> BG.CUInt
+  -> BG.Ptr BG.Void
+  -> BG.Ptr BG.Void
+  -> IO (BG.Ptr BG.Void)
+
+-- __unique:__ @Database_DuckDB_FFI_Database.DuckDB.FFI_Safe_duckdb_catalog_get_entry@
+hs_bindgen_aba4dfe53d092aa4 ::
+     DuckDBCatalog
+  -> DuckDBClientContext
+  -> DuckDBCatalogEntryType
+  -> PtrConst.PtrConst BG.CChar
+  -> PtrConst.PtrConst BG.CChar
+  -> IO DuckDBCatalogEntry
+hs_bindgen_aba4dfe53d092aa4 =
+  \x0 ->
+    \x1 ->
+      \x2 ->
+        \x3 ->
+          \x4 ->
+            fmap BG.fromFFIType (hs_bindgen_aba4dfe53d092aa4_base (BG.toFFIType x0) (BG.toFFIType x1) (BG.toFFIType x2) (BG.toFFIType x3) (BG.toFFIType x4))
+
+{-| Retrieve a catalog entry from the given catalog by type, schema name and entry name. The returned catalog entry remains valid for the duration of the current transaction.
+
+    history:
+
+    * unstable: v1.5.0
+
+    * stable: v1.5.6
+
+    [__@catalog@__]: The catalog.
+
+    [__@context@__]: The client context.
+
+    [__@entry_type@__]: The type of the catalog entry to retrieve.
+
+    [__@schema_name@__]: The schema name of the catalog entry.
+
+    [__@entry_name@__]: The name of the catalog entry.
+
+    __Returns:__ t'DuckDBCatalogEntry'
+
+    __C declaration:__ @duckdb_catalog_get_entry@
+
+    __defined at:__ @duckdb.h 3369:35@
+
+    __exported by:__ @duckdb.h@
+-}
+c_duckdb_catalog_get_entry ::
+     DuckDBCatalog
+     {- ^
+
+          [__@catalog@__]: The catalog.
+
+          __C declaration:__ @catalog@
+     -}
+  -> DuckDBClientContext
+     {- ^
+
+          [__@context@__]: The client context.
+
+          __C declaration:__ @context@
+     -}
+  -> DuckDBCatalogEntryType
+     {- ^
+
+          [__@entry_type@__]: The type of the catalog entry to retrieve.
+
+          __C declaration:__ @entry_type@
+     -}
+  -> PtrConst.PtrConst BG.CChar
+     {- ^
+
+          [__@schema_name@__]: The schema name of the catalog entry.
+
+          __C declaration:__ @schema_name@
+     -}
+  -> PtrConst.PtrConst BG.CChar
+     {- ^
+
+          [__@entry_name@__]: The name of the catalog entry.
+
+          __C declaration:__ @entry_name@
+     -}
+  -> IO DuckDBCatalogEntry
+c_duckdb_catalog_get_entry =
+  hs_bindgen_aba4dfe53d092aa4
+
+-- __unique:__ @Database_DuckDB_FFI_Database.DuckDB.FFI_Safe_duckdb_destroy_catalog@
+foreign import ccall safe "hs_bindgen_e9ab59cc27549451" hs_bindgen_e9ab59cc27549451_base ::
+     BG.Ptr BG.Void
+  -> IO ()
+
+-- __unique:__ @Database_DuckDB_FFI_Database.DuckDB.FFI_Safe_duckdb_destroy_catalog@
+hs_bindgen_e9ab59cc27549451 ::
+     BG.Ptr DuckDBCatalog
+  -> IO ()
+hs_bindgen_e9ab59cc27549451 =
+  \x0 ->
+    hs_bindgen_e9ab59cc27549451_base (BG.toFFIType x0)
+
+{-| Destroys the given catalog instance.
+
+    Note that this does not actually "drop" the contents of the catalog; it merely frees the C API handle.
+
+    history:
+
+    * unstable: v1.5.0
+
+    * stable: v1.5.6
+
+    [__@catalog@__]: The catalog instance to destroy.
+
+    __Returns:__ void
+
+    __C declaration:__ @duckdb_destroy_catalog@
+
+    __defined at:__ @duckdb.h 3387:19@
+
+    __exported by:__ @duckdb.h@
+-}
+c_duckdb_destroy_catalog ::
+     BG.Ptr DuckDBCatalog
+     {- ^
+
+          [__@catalog@__]: The catalog instance to destroy.
+
+          __C declaration:__ @catalog@
+     -}
+  -> IO ()
+c_duckdb_destroy_catalog =
+  hs_bindgen_e9ab59cc27549451
+
+-- __unique:__ @Database_DuckDB_FFI_Database.DuckDB.FFI_Safe_duckdb_catalog_entry_get_type@
+foreign import ccall safe "hs_bindgen_f9e87e4a2ae0ba89" hs_bindgen_f9e87e4a2ae0ba89_base ::
+     BG.Ptr BG.Void
+  -> IO BG.CUInt
+
+-- __unique:__ @Database_DuckDB_FFI_Database.DuckDB.FFI_Safe_duckdb_catalog_entry_get_type@
+hs_bindgen_f9e87e4a2ae0ba89 ::
+     DuckDBCatalogEntry
+  -> IO DuckDBCatalogEntryType
+hs_bindgen_f9e87e4a2ae0ba89 =
+  \x0 ->
+    fmap BG.fromFFIType (hs_bindgen_f9e87e4a2ae0ba89_base (BG.toFFIType x0))
+
+{-| Get the type of the given catalog entry.
+
+    history:
+
+    * unstable: v1.5.0
+
+    * stable: v1.5.6
+
+    [__@entry@__]: The catalog entry.
+
+    __Returns:__ t'DuckDBCatalogEntryType'
+
+    __C declaration:__ @duckdb_catalog_entry_get_type@
+
+    __defined at:__ @duckdb.h 3401:40@
+
+    __exported by:__ @duckdb.h@
+-}
+c_duckdb_catalog_entry_get_type ::
+     DuckDBCatalogEntry
+     {- ^
+
+          [__@entry@__]: The catalog entry.
+
+          __C declaration:__ @entry@
+     -}
+  -> IO DuckDBCatalogEntryType
+c_duckdb_catalog_entry_get_type =
+  hs_bindgen_f9e87e4a2ae0ba89
+
+-- __unique:__ @Database_DuckDB_FFI_Database.DuckDB.FFI_Safe_duckdb_catalog_entry_get_name@
+foreign import ccall safe "hs_bindgen_430e74b8dedd2055" hs_bindgen_430e74b8dedd2055_base ::
+     BG.Ptr BG.Void
+  -> IO (BG.Ptr BG.Void)
+
+-- __unique:__ @Database_DuckDB_FFI_Database.DuckDB.FFI_Safe_duckdb_catalog_entry_get_name@
+hs_bindgen_430e74b8dedd2055 ::
+     DuckDBCatalogEntry
+  -> IO (PtrConst.PtrConst BG.CChar)
+hs_bindgen_430e74b8dedd2055 =
+  \x0 ->
+    fmap BG.fromFFIType (hs_bindgen_430e74b8dedd2055_base (BG.toFFIType x0))
+
+{-| Get the name of the given catalog entry.
+
+    history:
+
+    * unstable: v1.5.0
+
+    * stable: v1.5.6
+
+    [__@entry@__]: The catalog entry.
+
+    __Returns:__ const char*
+
+    __C declaration:__ @duckdb_catalog_entry_get_name@
+
+    __defined at:__ @duckdb.h 3415:26@
+
+    __exported by:__ @duckdb.h@
+-}
+c_duckdb_catalog_entry_get_name ::
+     DuckDBCatalogEntry
+     {- ^
+
+          [__@entry@__]: The catalog entry.
+
+          __C declaration:__ @entry@
+     -}
+  -> IO (PtrConst.PtrConst BG.CChar)
+c_duckdb_catalog_entry_get_name =
+  hs_bindgen_430e74b8dedd2055
+
+-- __unique:__ @Database_DuckDB_FFI_Database.DuckDB.FFI_Safe_duckdb_destroy_catalog_entry@
+foreign import ccall safe "hs_bindgen_6189577693659118" hs_bindgen_6189577693659118_base ::
+     BG.Ptr BG.Void
+  -> IO ()
+
+-- __unique:__ @Database_DuckDB_FFI_Database.DuckDB.FFI_Safe_duckdb_destroy_catalog_entry@
+hs_bindgen_6189577693659118 ::
+     BG.Ptr DuckDBCatalogEntry
+  -> IO ()
+hs_bindgen_6189577693659118 =
+  \x0 ->
+    hs_bindgen_6189577693659118_base (BG.toFFIType x0)
+
+{-| Destroys the given catalog entry instance.
+
+    Note that this does not actually "drop" the catalog entry from the database catalog; it merely frees the C API handle.
+
+    history:
+
+    * unstable: v1.5.0
+
+    * stable: v1.5.6
+
+    [__@entry@__]: The catalog entry instance to destroy.
+
+    __Returns:__ void
+
+    __C declaration:__ @duckdb_destroy_catalog_entry@
+
+    __defined at:__ @duckdb.h 3432:19@
+
+    __exported by:__ @duckdb.h@
+-}
+c_duckdb_destroy_catalog_entry ::
+     BG.Ptr DuckDBCatalogEntry
+     {- ^
+
+          [__@entry@__]: The catalog entry instance to destroy.
+
+          __C declaration:__ @entry@
+     -}
+  -> IO ()
+c_duckdb_destroy_catalog_entry =
+  hs_bindgen_6189577693659118
+
+-- __unique:__ @Database_DuckDB_FFI_Database.DuckDB.FFI_Safe_duckdb_create_config_option@
+foreign import ccall safe "hs_bindgen_2904c2eb7d815ddd" hs_bindgen_2904c2eb7d815ddd_base ::
+     IO (BG.Ptr BG.Void)
+
+-- __unique:__ @Database_DuckDB_FFI_Database.DuckDB.FFI_Safe_duckdb_create_config_option@
+hs_bindgen_2904c2eb7d815ddd :: IO DuckDBConfigOption
+hs_bindgen_2904c2eb7d815ddd =
+  fmap BG.fromFFIType hs_bindgen_2904c2eb7d815ddd_base
+
+{-| Creates a configuration option instance.
+
+    history:
+
+    * unstable: v1.5.0
+
+    * stable: v1.5.6
+
+    __Returns:__ t'DuckDBConfigOption'
+
+    __C declaration:__ @duckdb_create_config_option@
+
+    __defined at:__ @duckdb.h 3463:35@
+
+    __exported by:__ @duckdb.h@
+-}
+c_duckdb_create_config_option :: IO DuckDBConfigOption
+c_duckdb_create_config_option =
+  hs_bindgen_2904c2eb7d815ddd
+
+-- __unique:__ @Database_DuckDB_FFI_Database.DuckDB.FFI_Safe_duckdb_destroy_config_option@
+foreign import ccall safe "hs_bindgen_cce3c5835cb3d7fb" hs_bindgen_cce3c5835cb3d7fb_base ::
+     BG.Ptr BG.Void
+  -> IO ()
+
+-- __unique:__ @Database_DuckDB_FFI_Database.DuckDB.FFI_Safe_duckdb_destroy_config_option@
+hs_bindgen_cce3c5835cb3d7fb ::
+     BG.Ptr DuckDBConfigOption
+  -> IO ()
+hs_bindgen_cce3c5835cb3d7fb =
+  \x0 ->
+    hs_bindgen_cce3c5835cb3d7fb_base (BG.toFFIType x0)
+
+{-| Destroys the given configuration option instance.
+
+    history:
+
+    * unstable: v1.5.0
+
+    * stable: v1.5.6
+
+    [__@option@__]: The configuration option instance to destroy.
+
+    __Returns:__ void
+
+    __C declaration:__ @duckdb_destroy_config_option@
+
+    __defined at:__ @duckdb.h 3477:19@
+
+    __exported by:__ @duckdb.h@
+-}
+c_duckdb_destroy_config_option ::
+     BG.Ptr DuckDBConfigOption
+     {- ^
+
+          [__@option@__]: The configuration option instance to destroy.
+
+          __C declaration:__ @option@
+     -}
+  -> IO ()
+c_duckdb_destroy_config_option =
+  hs_bindgen_cce3c5835cb3d7fb
+
+-- __unique:__ @Database_DuckDB_FFI_Database.DuckDB.FFI_Safe_duckdb_config_option_set_name@
+foreign import ccall safe "hs_bindgen_4a7b0eacb915b49c" hs_bindgen_4a7b0eacb915b49c_base ::
+     BG.Ptr BG.Void
+  -> BG.Ptr BG.Void
+  -> IO ()
+
+-- __unique:__ @Database_DuckDB_FFI_Database.DuckDB.FFI_Safe_duckdb_config_option_set_name@
+hs_bindgen_4a7b0eacb915b49c ::
+     DuckDBConfigOption
+  -> PtrConst.PtrConst BG.CChar
+  -> IO ()
+hs_bindgen_4a7b0eacb915b49c =
+  \x0 ->
+    \x1 ->
+      hs_bindgen_4a7b0eacb915b49c_base (BG.toFFIType x0) (BG.toFFIType x1)
+
+{-| Sets the name of the configuration option.
+
+    history:
+
+    * unstable: v1.5.0
+
+    * stable: v1.5.6
+
+    [__@option@__]: The configuration option instance.
+
+    [__@name@__]: The name to set.
+
+    __Returns:__ void
+
+    __C declaration:__ @duckdb_config_option_set_name@
+
+    __defined at:__ @duckdb.h 3492:19@
+
+    __exported by:__ @duckdb.h@
+-}
+c_duckdb_config_option_set_name ::
+     DuckDBConfigOption
+     {- ^
+
+          [__@option@__]: The configuration option instance.
+
+          __C declaration:__ @option@
+     -}
+  -> PtrConst.PtrConst BG.CChar
+     {- ^
+
+          [__@name@__]: The name to set.
+
+          __C declaration:__ @name@
+     -}
+  -> IO ()
+c_duckdb_config_option_set_name =
+  hs_bindgen_4a7b0eacb915b49c
+
+-- __unique:__ @Database_DuckDB_FFI_Database.DuckDB.FFI_Safe_duckdb_config_option_set_type@
+foreign import ccall safe "hs_bindgen_55c7fda9341606d9" hs_bindgen_55c7fda9341606d9_base ::
+     BG.Ptr BG.Void
+  -> BG.Ptr BG.Void
+  -> IO ()
+
+-- __unique:__ @Database_DuckDB_FFI_Database.DuckDB.FFI_Safe_duckdb_config_option_set_type@
+hs_bindgen_55c7fda9341606d9 ::
+     DuckDBConfigOption
+  -> DuckDBLogicalType
+  -> IO ()
+hs_bindgen_55c7fda9341606d9 =
+  \x0 ->
+    \x1 ->
+      hs_bindgen_55c7fda9341606d9_base (BG.toFFIType x0) (BG.toFFIType x1)
+
+{-| Sets the type of the configuration option.
+
+    history:
+
+    * unstable: v1.5.0
+
+    * stable: v1.5.6
+
+    [__@option@__]: The configuration option instance.
+
+    [__@type@__]: The type to set.
+
+    __Returns:__ void
+
+    __C declaration:__ @duckdb_config_option_set_type@
+
+    __defined at:__ @duckdb.h 3507:19@
+
+    __exported by:__ @duckdb.h@
+-}
+c_duckdb_config_option_set_type ::
+     DuckDBConfigOption
+     {- ^
+
+          [__@option@__]: The configuration option instance.
+
+          __C declaration:__ @option@
+     -}
+  -> DuckDBLogicalType
+     {- ^
+
+          [__@type@__]: The type to set.
+
+          __C declaration:__ @type@
+     -}
+  -> IO ()
+c_duckdb_config_option_set_type =
+  hs_bindgen_55c7fda9341606d9
+
+-- __unique:__ @Database_DuckDB_FFI_Database.DuckDB.FFI_Safe_duckdb_config_option_set_default_value@
+foreign import ccall safe "hs_bindgen_5d743cd261c382bc" hs_bindgen_5d743cd261c382bc_base ::
+     BG.Ptr BG.Void
+  -> BG.Ptr BG.Void
+  -> IO ()
+
+-- __unique:__ @Database_DuckDB_FFI_Database.DuckDB.FFI_Safe_duckdb_config_option_set_default_value@
+hs_bindgen_5d743cd261c382bc ::
+     DuckDBConfigOption
+  -> DuckDBValue
+  -> IO ()
+hs_bindgen_5d743cd261c382bc =
+  \x0 ->
+    \x1 ->
+      hs_bindgen_5d743cd261c382bc_base (BG.toFFIType x0) (BG.toFFIType x1)
+
+{-| Sets the default value of the configuration option. If the type of this option has already been set with @'c_duckdb_config_option_set_type'@ , the value is cast to the type. Otherwise, the type is inferred from the value.
+
+    history:
+
+    * unstable: v1.5.0
+
+    * stable: v1.5.6
+
+    [__@option@__]: The configuration option instance.
+
+    [__@default_value@__]: The default value to set.
+
+    __Returns:__ void
+
+    __C declaration:__ @duckdb_config_option_set_default_value@
+
+    __defined at:__ @duckdb.h 3523:19@
+
+    __exported by:__ @duckdb.h@
+-}
+c_duckdb_config_option_set_default_value ::
+     DuckDBConfigOption
+     {- ^
+
+          [__@option@__]: The configuration option instance.
+
+          __C declaration:__ @option@
+     -}
+  -> DuckDBValue
+     {- ^
+
+          [__@default_value@__]: The default value to set.
+
+          __C declaration:__ @default_value@
+     -}
+  -> IO ()
+c_duckdb_config_option_set_default_value =
+  hs_bindgen_5d743cd261c382bc
+
+-- __unique:__ @Database_DuckDB_FFI_Database.DuckDB.FFI_Safe_duckdb_config_option_set_default_scope@
+foreign import ccall safe "hs_bindgen_669d84ce2f314ace" hs_bindgen_669d84ce2f314ace_base ::
+     BG.Ptr BG.Void
+  -> BG.CUInt
+  -> IO ()
+
+-- __unique:__ @Database_DuckDB_FFI_Database.DuckDB.FFI_Safe_duckdb_config_option_set_default_scope@
+hs_bindgen_669d84ce2f314ace ::
+     DuckDBConfigOption
+  -> DuckDBConfigOptionScope
+  -> IO ()
+hs_bindgen_669d84ce2f314ace =
+  \x0 ->
+    \x1 ->
+      hs_bindgen_669d84ce2f314ace_base (BG.toFFIType x0) (BG.toFFIType x1)
+
+{-| Sets the default scope of the configuration option. If not set, this defaults to @@DUCKDB_CONFIG_OPTION_SCOPE_SESSION@@ .
+
+    history:
+
+    * unstable: v1.5.0
+
+    * stable: v1.5.6
+
+    [__@option@__]: The configuration option instance.
+
+    [__@default_scope@__]: The default scope to set.
+
+    __Returns:__ void
+
+    __C declaration:__ @duckdb_config_option_set_default_scope@
+
+    __defined at:__ @duckdb.h 3539:19@
+
+    __exported by:__ @duckdb.h@
+-}
+c_duckdb_config_option_set_default_scope ::
+     DuckDBConfigOption
+     {- ^
+
+          [__@option@__]: The configuration option instance.
+
+          __C declaration:__ @option@
+     -}
+  -> DuckDBConfigOptionScope
+     {- ^
+
+          [__@default_scope@__]: The default scope to set.
+
+          __C declaration:__ @default_scope@
+     -}
+  -> IO ()
+c_duckdb_config_option_set_default_scope =
+  hs_bindgen_669d84ce2f314ace
+
+-- __unique:__ @Database_DuckDB_FFI_Database.DuckDB.FFI_Safe_duckdb_config_option_set_description@
+foreign import ccall safe "hs_bindgen_434294888a548fc7" hs_bindgen_434294888a548fc7_base ::
+     BG.Ptr BG.Void
+  -> BG.Ptr BG.Void
+  -> IO ()
+
+-- __unique:__ @Database_DuckDB_FFI_Database.DuckDB.FFI_Safe_duckdb_config_option_set_description@
+hs_bindgen_434294888a548fc7 ::
+     DuckDBConfigOption
+  -> PtrConst.PtrConst BG.CChar
+  -> IO ()
+hs_bindgen_434294888a548fc7 =
+  \x0 ->
+    \x1 ->
+      hs_bindgen_434294888a548fc7_base (BG.toFFIType x0) (BG.toFFIType x1)
+
+{-| Sets the description of the configuration option.
+
+    history:
+
+    * unstable: v1.5.0
+
+    * stable: v1.5.6
+
+    [__@option@__]: The configuration option instance.
+
+    [__@description@__]: The description to set.
+
+    __Returns:__ void
+
+    __C declaration:__ @duckdb_config_option_set_description@
+
+    __defined at:__ @duckdb.h 3555:19@
+
+    __exported by:__ @duckdb.h@
+-}
+c_duckdb_config_option_set_description ::
+     DuckDBConfigOption
+     {- ^
+
+          [__@option@__]: The configuration option instance.
+
+          __C declaration:__ @option@
+     -}
+  -> PtrConst.PtrConst BG.CChar
+     {- ^
+
+          [__@description@__]: The description to set.
+
+          __C declaration:__ @description@
+     -}
+  -> IO ()
+c_duckdb_config_option_set_description =
+  hs_bindgen_434294888a548fc7
+
+-- __unique:__ @Database_DuckDB_FFI_Database.DuckDB.FFI_Safe_duckdb_register_config_option@
+foreign import ccall safe "hs_bindgen_b14dc22384baf221" hs_bindgen_b14dc22384baf221_base ::
+     BG.Ptr BG.Void
+  -> BG.Ptr BG.Void
+  -> IO BG.CUInt
+
+-- __unique:__ @Database_DuckDB_FFI_Database.DuckDB.FFI_Safe_duckdb_register_config_option@
+hs_bindgen_b14dc22384baf221 ::
+     DuckDBConnection
+  -> DuckDBConfigOption
+  -> IO DuckDBState
+hs_bindgen_b14dc22384baf221 =
+  \x0 ->
+    \x1 ->
+      fmap BG.fromFFIType (hs_bindgen_b14dc22384baf221_base (BG.toFFIType x0) (BG.toFFIType x1))
+
+{-| Registers the given configuration option on the specified connection.
+
+    history:
+
+    * unstable: v1.5.0
+
+    * stable: v1.5.6
+
+    [__@connection@__]: The connection to register the option on.
+
+    [__@option@__]: The configuration option instance to register.
+
+    __Returns:__ t'DuckDBState'
+
+    __C declaration:__ @duckdb_register_config_option@
+
+    __defined at:__ @duckdb.h 3570:27@
+
+    __exported by:__ @duckdb.h@
+-}
+c_duckdb_register_config_option ::
+     DuckDBConnection
+     {- ^
+
+          [__@connection@__]: The connection to register the option on.
+
+          __C declaration:__ @connection@
+     -}
+  -> DuckDBConfigOption
+     {- ^
+
+          [__@option@__]: The configuration option instance to register.
+
+          __C declaration:__ @option@
+     -}
+  -> IO DuckDBState
+c_duckdb_register_config_option =
+  hs_bindgen_b14dc22384baf221
+
+-- __unique:__ @Database_DuckDB_FFI_Database.DuckDB.FFI_Safe_duckdb_client_context_get_config_option@
+foreign import ccall safe "hs_bindgen_6627c6206b1f1351" hs_bindgen_6627c6206b1f1351_base ::
+     BG.Ptr BG.Void
+  -> BG.Ptr BG.Void
+  -> BG.Ptr BG.Void
+  -> IO (BG.Ptr BG.Void)
+
+-- __unique:__ @Database_DuckDB_FFI_Database.DuckDB.FFI_Safe_duckdb_client_context_get_config_option@
+hs_bindgen_6627c6206b1f1351 ::
+     DuckDBClientContext
+  -> PtrConst.PtrConst BG.CChar
+  -> BG.Ptr DuckDBConfigOptionScope
+  -> IO DuckDBValue
+hs_bindgen_6627c6206b1f1351 =
+  \x0 ->
+    \x1 ->
+      \x2 ->
+        fmap BG.fromFFIType (hs_bindgen_6627c6206b1f1351_base (BG.toFFIType x0) (BG.toFFIType x1) (BG.toFFIType x2))
+
+{-| Retrieves the value of a configuration option by name from the given client context.
+
+    history:
+
+    * unstable: v1.5.0
+
+    * stable: v1.5.6
+
+    [__@context@__]: The client context.
+
+    [__@name@__]: The name of the configuration option to retrieve.
+
+    [__@out_scope@__]: Output parameter to optionally store the scope that the configuration option was retrieved from. If this is @nullptr@ , the scope is not returned. If the requested option does not exist the scope is set to @@DUCKDB_CONFIG_OPTION_SCOPE_INVALID@@ .
+
+    __Returns:__ t'DuckDBValue'
+
+    __C declaration:__ @duckdb_client_context_get_config_option@
+
+    __defined at:__ @duckdb.h 3588:27@
+
+    __exported by:__ @duckdb.h@
+-}
+c_duckdb_client_context_get_config_option ::
+     DuckDBClientContext
+     {- ^
+
+          [__@context@__]: The client context.
+
+          __C declaration:__ @context@
+     -}
+  -> PtrConst.PtrConst BG.CChar
+     {- ^
+
+          [__@name@__]: The name of the configuration option to retrieve.
+
+          __C declaration:__ @name@
+     -}
+  -> BG.Ptr DuckDBConfigOptionScope
+     {- ^
+
+          [__@out_scope@__]: Output parameter to optionally store the scope that the configuration option was retrieved from. If this is @nullptr@ , the scope is not returned. If the requested option does not exist the scope is set to @@DUCKDB_CONFIG_OPTION_SCOPE_INVALID@@ .
+
+          __C declaration:__ @out_scope@
+     -}
+  -> IO DuckDBValue
+c_duckdb_client_context_get_config_option =
+  hs_bindgen_6627c6206b1f1351
+
+-- __unique:__ @Database_DuckDB_FFI_Database.DuckDB.FFI_Safe_duckdb_get_profiling_info@
+foreign import ccall safe "hs_bindgen_6cc9ce7e3e2cc49d" hs_bindgen_6cc9ce7e3e2cc49d_base ::
+     BG.Ptr BG.Void
+  -> IO (BG.Ptr BG.Void)
+
+-- __unique:__ @Database_DuckDB_FFI_Database.DuckDB.FFI_Safe_duckdb_get_profiling_info@
+hs_bindgen_6cc9ce7e3e2cc49d ::
+     DuckDBConnection
+  -> IO DuckDBProfilingInfo
+hs_bindgen_6cc9ce7e3e2cc49d =
+  \x0 ->
+    fmap BG.fromFFIType (hs_bindgen_6cc9ce7e3e2cc49d_base (BG.toFFIType x0))
+
+{-| Returns the root node of the profiling information. Returns nullptr, if profiling is not enabled.
+
+    history:
+
+    * stable: v1.1.0
+
+    [__@connection@__]: A connection object.
+
+    __Returns:__ t'DuckDBProfilingInfo'
+
+    __C declaration:__ @duckdb_get_profiling_info@
+
+    __defined at:__ @duckdb.h 3602:36@
+
+    __exported by:__ @duckdb.h@
+-}
+c_duckdb_get_profiling_info ::
+     DuckDBConnection
+     {- ^
+
+          [__@connection@__]: A connection object.
+
+          __C declaration:__ @connection@
+     -}
+  -> IO DuckDBProfilingInfo
+c_duckdb_get_profiling_info =
+  hs_bindgen_6cc9ce7e3e2cc49d
+
+-- __unique:__ @Database_DuckDB_FFI_Database.DuckDB.FFI_Safe_duckdb_profiling_info_get_value@
+foreign import ccall safe "hs_bindgen_ef170ac4012ec7c1" hs_bindgen_ef170ac4012ec7c1_base ::
+     BG.Ptr BG.Void
+  -> BG.Ptr BG.Void
+  -> IO (BG.Ptr BG.Void)
+
+-- __unique:__ @Database_DuckDB_FFI_Database.DuckDB.FFI_Safe_duckdb_profiling_info_get_value@
+hs_bindgen_ef170ac4012ec7c1 ::
+     DuckDBProfilingInfo
+  -> PtrConst.PtrConst BG.CChar
+  -> IO DuckDBValue
+hs_bindgen_ef170ac4012ec7c1 =
+  \x0 ->
+    \x1 ->
+      fmap BG.fromFFIType (hs_bindgen_ef170ac4012ec7c1_base (BG.toFFIType x0) (BG.toFFIType x1))
+
+{-|
+
+    Returns the value of the metric of the current profiling info node. Returns nullptr, if the metric does not exist or is not enabled. Currently, the value holds a string, and you can retrieve the string by calling the corresponding function: char *duckdb_get_varchar( t'DuckDBValue' value).
+
+    history:
+
+    * stable: v1.1.0
+
+    [__@info@__]: A profiling information object.
+
+    [__@key@__]: The name of the requested metric.
+
+    __Returns:__ t'DuckDBValue'
+
+    __C declaration:__ @duckdb_profiling_info_get_value@
+
+    __defined at:__ @duckdb.h 3618:27@
+
+    __exported by:__ @duckdb.h@
+-}
+c_duckdb_profiling_info_get_value ::
+     DuckDBProfilingInfo
+     {- ^
+
+          [__@info@__]: A profiling information object.
+
+          __C declaration:__ @info@
+     -}
+  -> PtrConst.PtrConst BG.CChar
+     {- ^
+
+          [__@key@__]: The name of the requested metric.
+
+          __C declaration:__ @key@
+     -}
+  -> IO DuckDBValue
+c_duckdb_profiling_info_get_value =
+  hs_bindgen_ef170ac4012ec7c1
+
+-- __unique:__ @Database_DuckDB_FFI_Database.DuckDB.FFI_Safe_duckdb_profiling_info_get_metrics@
+foreign import ccall safe "hs_bindgen_28bc0ccb66ee250b" hs_bindgen_28bc0ccb66ee250b_base ::
+     BG.Ptr BG.Void
+  -> IO (BG.Ptr BG.Void)
+
+-- __unique:__ @Database_DuckDB_FFI_Database.DuckDB.FFI_Safe_duckdb_profiling_info_get_metrics@
+hs_bindgen_28bc0ccb66ee250b ::
+     DuckDBProfilingInfo
+  -> IO DuckDBValue
+hs_bindgen_28bc0ccb66ee250b =
+  \x0 ->
+    fmap BG.fromFFIType (hs_bindgen_28bc0ccb66ee250b_base (BG.toFFIType x0))
+
+{-|
+
+    Returns the key-value metric map of this profiling node as a MAP t'DuckDBValue' . The individual elements are accessible via the t'DuckDBValue' MAP functions.
+
+    history:
+
+    * stable: v1.1.0
+
+    [__@info@__]: A profiling information object.
+
+    __Returns:__ t'DuckDBValue'
+
+    __C declaration:__ @duckdb_profiling_info_get_metrics@
+
+    __defined at:__ @duckdb.h 3632:27@
+
+    __exported by:__ @duckdb.h@
+-}
+c_duckdb_profiling_info_get_metrics ::
+     DuckDBProfilingInfo
+     {- ^
+
+          [__@info@__]: A profiling information object.
+
+          __C declaration:__ @info@
+     -}
+  -> IO DuckDBValue
+c_duckdb_profiling_info_get_metrics =
+  hs_bindgen_28bc0ccb66ee250b
+
+-- __unique:__ @Database_DuckDB_FFI_Database.DuckDB.FFI_Safe_duckdb_profiling_info_get_child_count@
+foreign import ccall safe "hs_bindgen_2535bc9e5898c5a1" hs_bindgen_2535bc9e5898c5a1_base ::
+     BG.Ptr BG.Void
+  -> IO HsBindgen.Runtime.LibC.Word64
+
+-- __unique:__ @Database_DuckDB_FFI_Database.DuckDB.FFI_Safe_duckdb_profiling_info_get_child_count@
+hs_bindgen_2535bc9e5898c5a1 ::
+     DuckDBProfilingInfo
+  -> IO DuckDBIdx
+hs_bindgen_2535bc9e5898c5a1 =
+  \x0 ->
+    fmap BG.fromFFIType (hs_bindgen_2535bc9e5898c5a1_base (BG.toFFIType x0))
+
+{-| Returns the number of children in the current profiling info node.
+
+    history:
+
+    * stable: v1.1.0
+
+    [__@info@__]: A profiling information object.
+
+    __Returns:__ t'DuckDBIdx'
+
+    __C declaration:__ @duckdb_profiling_info_get_child_count@
+
+    __defined at:__ @duckdb.h 3645:20@
+
+    __exported by:__ @duckdb.h@
+-}
+c_duckdb_profiling_info_get_child_count ::
+     DuckDBProfilingInfo
+     {- ^
+
+          [__@info@__]: A profiling information object.
+
+          __C declaration:__ @info@
+     -}
+  -> IO DuckDBIdx
+c_duckdb_profiling_info_get_child_count =
+  hs_bindgen_2535bc9e5898c5a1
+
+-- __unique:__ @Database_DuckDB_FFI_Database.DuckDB.FFI_Safe_duckdb_profiling_info_get_child@
+foreign import ccall safe "hs_bindgen_9eb0d1042926715f" hs_bindgen_9eb0d1042926715f_base ::
+     BG.Ptr BG.Void
+  -> HsBindgen.Runtime.LibC.Word64
+  -> IO (BG.Ptr BG.Void)
+
+-- __unique:__ @Database_DuckDB_FFI_Database.DuckDB.FFI_Safe_duckdb_profiling_info_get_child@
+hs_bindgen_9eb0d1042926715f ::
+     DuckDBProfilingInfo
+  -> DuckDBIdx
+  -> IO DuckDBProfilingInfo
+hs_bindgen_9eb0d1042926715f =
+  \x0 ->
+    \x1 ->
+      fmap BG.fromFFIType (hs_bindgen_9eb0d1042926715f_base (BG.toFFIType x0) (BG.toFFIType x1))
+
+{-| Returns the child node at the specified index.
+
+    history:
+
+    * stable: v1.1.0
+
+    [__@info@__]: A profiling information object.
+
+    [__@index@__]: The index of the child node.
+
+    __Returns:__ t'DuckDBProfilingInfo'
+
+    __C declaration:__ @duckdb_profiling_info_get_child@
+
+    __defined at:__ @duckdb.h 3659:36@
+
+    __exported by:__ @duckdb.h@
+-}
+c_duckdb_profiling_info_get_child ::
+     DuckDBProfilingInfo
+     {- ^
+
+          [__@info@__]: A profiling information object.
+
+          __C declaration:__ @info@
+     -}
+  -> DuckDBIdx
+     {- ^
+
+          [__@index@__]: The index of the child node.
+
+          __C declaration:__ @index@
+     -}
+  -> IO DuckDBProfilingInfo
+c_duckdb_profiling_info_get_child =
+  hs_bindgen_9eb0d1042926715f
+
+-- __unique:__ @Database_DuckDB_FFI_Database.DuckDB.FFI_Safe_duckdb_connect@
+foreign import ccall safe "hs_bindgen_79d64eb1438eabb3" hs_bindgen_79d64eb1438eabb3_base ::
+     BG.Ptr BG.Void
+  -> BG.Ptr BG.Void
+  -> IO BG.CUInt
+
+-- __unique:__ @Database_DuckDB_FFI_Database.DuckDB.FFI_Safe_duckdb_connect@
+hs_bindgen_79d64eb1438eabb3 ::
+     DuckDBDatabase
+  -> BG.Ptr DuckDBConnection
+  -> IO DuckDBState
+hs_bindgen_79d64eb1438eabb3 =
+  \x0 ->
+    \x1 ->
+      fmap BG.fromFFIType (hs_bindgen_79d64eb1438eabb3_base (BG.toFFIType x0) (BG.toFFIType x1))
+
+{-| Opens a connection to a database. Connections are required to query the database, and store transactional state associated with the connection. The instantiated connection should be closed using \'duckdb_disconnect\'.
+
+    history:
+
+    * stable: v0.1.0
+
+    [__@database@__]: The database file to connect to.
+
+    [__@out_connection@__]: The result connection object.
+
+    __Returns:__ t'DuckDBState'
+
+    __C declaration:__ @duckdb_connect@
+
+    __defined at:__ @duckdb.h 3691:27@
+
+    __exported by:__ @duckdb.h@
+-}
+c_duckdb_connect ::
+     DuckDBDatabase
+     {- ^
+
+          [__@database@__]: The database file to connect to.
+
+          __C declaration:__ @database@
+     -}
+  -> BG.Ptr DuckDBConnection
+     {- ^
+
+          [__@out_connection@__]: The result connection object.
+
+          __C declaration:__ @out_connection@
+     -}
+  -> IO DuckDBState
+c_duckdb_connect = hs_bindgen_79d64eb1438eabb3
+
+-- __unique:__ @Database_DuckDB_FFI_Database.DuckDB.FFI_Safe_duckdb_interrupt@
+foreign import ccall safe "hs_bindgen_2a298bcc8a8bf16d" hs_bindgen_2a298bcc8a8bf16d_base ::
+     BG.Ptr BG.Void
+  -> IO ()
+
+-- __unique:__ @Database_DuckDB_FFI_Database.DuckDB.FFI_Safe_duckdb_interrupt@
+hs_bindgen_2a298bcc8a8bf16d ::
+     DuckDBConnection
+  -> IO ()
+hs_bindgen_2a298bcc8a8bf16d =
+  \x0 ->
+    hs_bindgen_2a298bcc8a8bf16d_base (BG.toFFIType x0)
+
+{-| Interrupt running query
+
+    history:
+
+    * stable: v0.9.0
+
+    [__@connection@__]: The connection to interrupt
+
+    __Returns:__ void
+
+    __C declaration:__ @duckdb_interrupt@
+
+    __defined at:__ @duckdb.h 3703:19@
+
+    __exported by:__ @duckdb.h@
+-}
+c_duckdb_interrupt ::
+     DuckDBConnection
+     {- ^
+
+          [__@connection@__]: The connection to interrupt
+
+          __C declaration:__ @connection@
+     -}
+  -> IO ()
+c_duckdb_interrupt = hs_bindgen_2a298bcc8a8bf16d
+
+-- __unique:__ @Database_DuckDB_FFI_Database.DuckDB.FFI_Safe_duckdb_query_progress@
+foreign import ccall safe "hs_bindgen_e9eec4b7b5ba0a85" hs_bindgen_e9eec4b7b5ba0a85_base ::
+     BG.Ptr BG.Void
+  -> BG.Ptr BG.Void
+  -> IO ()
+
+-- __unique:__ @Database_DuckDB_FFI_Database.DuckDB.FFI_Safe_duckdb_query_progress@
+hs_bindgen_e9eec4b7b5ba0a85 ::
+     DuckDBConnection
+  -> BG.Ptr DuckDBQueryProgress
+  -> IO ()
+hs_bindgen_e9eec4b7b5ba0a85 =
+  \x0 ->
+    \x1 ->
+      hs_bindgen_e9eec4b7b5ba0a85_base (BG.toFFIType x0) (BG.toFFIType x1)
+
+{-| Get the progress of the running query.
+
+    history:
+
+    * stable: v0.10.0
+
+    [__@connection@__]: The connection running the query.
+
+    __Returns:__ t'DuckDBQueryProgress'
+
+    __C declaration:__ @duckdb_query_progress@
+
+    __defined at:__ @duckdb.h 3716:41@
+
+    __exported by:__ @duckdb.h@
+-}
+c_duckdb_query_progress ::
+     DuckDBConnection
+     {- ^
+
+          [__@connection@__]: The connection running the query.
+
+          __C declaration:__ @connection@
+     -}
+  -> IO DuckDBQueryProgress
+c_duckdb_query_progress =
+  \connection0 ->
+    BG.allocaAndPeek (\res1 ->
+                        hs_bindgen_e9eec4b7b5ba0a85 connection0 res1)
+
+-- __unique:__ @Database_DuckDB_FFI_Database.DuckDB.FFI_Safe_duckdb_disconnect@
+foreign import ccall safe "hs_bindgen_cb610ade84b3a9cb" hs_bindgen_cb610ade84b3a9cb_base ::
+     BG.Ptr BG.Void
+  -> IO ()
+
+-- __unique:__ @Database_DuckDB_FFI_Database.DuckDB.FFI_Safe_duckdb_disconnect@
+hs_bindgen_cb610ade84b3a9cb ::
+     BG.Ptr DuckDBConnection
+  -> IO ()
+hs_bindgen_cb610ade84b3a9cb =
+  \x0 ->
+    hs_bindgen_cb610ade84b3a9cb_base (BG.toFFIType x0)
+
+{-| Closes the specified connection and de-allocates all memory allocated for that connection.
+
+    history:
+
+    * stable: v0.1.0
+
+    [__@connection@__]: The connection to close.
+
+    __Returns:__ void
+
+    __C declaration:__ @duckdb_disconnect@
+
+    __defined at:__ @duckdb.h 3728:19@
+
+    __exported by:__ @duckdb.h@
+-}
+c_duckdb_disconnect ::
+     BG.Ptr DuckDBConnection
+     {- ^
+
+          [__@connection@__]: The connection to close.
+
+          __C declaration:__ @connection@
+     -}
+  -> IO ()
+c_duckdb_disconnect = hs_bindgen_cb610ade84b3a9cb
+
+-- __unique:__ @Database_DuckDB_FFI_Database.DuckDB.FFI_Safe_duckdb_connection_get_client_context@
+foreign import ccall safe "hs_bindgen_8544c93f321dd6fd" hs_bindgen_8544c93f321dd6fd_base ::
+     BG.Ptr BG.Void
+  -> BG.Ptr BG.Void
+  -> IO ()
+
+-- __unique:__ @Database_DuckDB_FFI_Database.DuckDB.FFI_Safe_duckdb_connection_get_client_context@
+hs_bindgen_8544c93f321dd6fd ::
+     DuckDBConnection
+  -> BG.Ptr DuckDBClientContext
+  -> IO ()
+hs_bindgen_8544c93f321dd6fd =
+  \x0 ->
+    \x1 ->
+      hs_bindgen_8544c93f321dd6fd_base (BG.toFFIType x0) (BG.toFFIType x1)
+
+{-| Retrieves the client context of the connection.
+
+    history:
+
+    * unstable: v1.3.0
+
+    * stable: v1.5.6
+
+    [__@connection@__]: The connection.
+
+    [__@out_context@__]: The client context of the connection. Must be destroyed with @'c_duckdb_destroy_client_context'@ .
+
+    __Returns:__ void
+
+    __C declaration:__ @duckdb_connection_get_client_context@
+
+    __defined at:__ @duckdb.h 3742:19@
+
+    __exported by:__ @duckdb.h@
+-}
+c_duckdb_connection_get_client_context ::
+     DuckDBConnection
+     {- ^
+
+          [__@connection@__]: The connection.
+
+          __C declaration:__ @connection@
+     -}
+  -> BG.Ptr DuckDBClientContext
+     {- ^
+
+          [__@out_context@__]: The client context of the connection. Must be destroyed with @'c_duckdb_destroy_client_context'@ .
+
+          __C declaration:__ @out_context@
+     -}
+  -> IO ()
+c_duckdb_connection_get_client_context =
+  hs_bindgen_8544c93f321dd6fd
+
+-- __unique:__ @Database_DuckDB_FFI_Database.DuckDB.FFI_Safe_duckdb_connection_get_arrow_options@
+foreign import ccall safe "hs_bindgen_90f6280aebaf736e" hs_bindgen_90f6280aebaf736e_base ::
+     BG.Ptr BG.Void
+  -> BG.Ptr BG.Void
+  -> IO ()
+
+-- __unique:__ @Database_DuckDB_FFI_Database.DuckDB.FFI_Safe_duckdb_connection_get_arrow_options@
+hs_bindgen_90f6280aebaf736e ::
+     DuckDBConnection
+  -> BG.Ptr DuckDBArrowOptions
+  -> IO ()
+hs_bindgen_90f6280aebaf736e =
+  \x0 ->
+    \x1 ->
+      hs_bindgen_90f6280aebaf736e_base (BG.toFFIType x0) (BG.toFFIType x1)
+
+{-| Retrieves the arrow options of the connection.
+
+    history:
+
+    * unstable: v1.4.0
+
+    * stable: v1.5.6
+
+    [__@connection@__]: The connection.
+
+    [__@out_arrow_options@__]:
+
+    __Returns:__ void
+
+    __C declaration:__ @duckdb_connection_get_arrow_options@
+
+    __defined at:__ @duckdb.h 3758:19@
+
+    __exported by:__ @duckdb.h@
+-}
+c_duckdb_connection_get_arrow_options ::
+     DuckDBConnection
+     {- ^
+
+          [__@connection@__]: The connection.
+
+          __C declaration:__ @connection@
+     -}
+  -> BG.Ptr DuckDBArrowOptions
+     {- ^
+
+          [__@out_arrow_options@__]:
+
+          __C declaration:__ @out_arrow_options@
+     -}
+  -> IO ()
+c_duckdb_connection_get_arrow_options =
+  hs_bindgen_90f6280aebaf736e
+
+-- __unique:__ @Database_DuckDB_FFI_Database.DuckDB.FFI_Safe_duckdb_client_context_get_connection_id@
+foreign import ccall safe "hs_bindgen_4dce4d0b3eb0c45a" hs_bindgen_4dce4d0b3eb0c45a_base ::
+     BG.Ptr BG.Void
+  -> IO HsBindgen.Runtime.LibC.Word64
+
+-- __unique:__ @Database_DuckDB_FFI_Database.DuckDB.FFI_Safe_duckdb_client_context_get_connection_id@
+hs_bindgen_4dce4d0b3eb0c45a ::
+     DuckDBClientContext
+  -> IO DuckDBIdx
+hs_bindgen_4dce4d0b3eb0c45a =
+  \x0 ->
+    fmap BG.fromFFIType (hs_bindgen_4dce4d0b3eb0c45a_base (BG.toFFIType x0))
+
+{-| Returns the connection id of the client context.
+
+    history:
+
+    * unstable: v1.3.0
+
+    * stable: v1.5.6
+
+    [__@context@__]: The client context.
+
+    __Returns:__ t'DuckDBIdx'
+
+    __C declaration:__ @duckdb_client_context_get_connection_id@
+
+    __defined at:__ @duckdb.h 3773:20@
+
+    __exported by:__ @duckdb.h@
+-}
+c_duckdb_client_context_get_connection_id ::
+     DuckDBClientContext
+     {- ^
+
+          [__@context@__]: The client context.
+
+          __C declaration:__ @context@
+     -}
+  -> IO DuckDBIdx
+c_duckdb_client_context_get_connection_id =
+  hs_bindgen_4dce4d0b3eb0c45a
+
+-- __unique:__ @Database_DuckDB_FFI_Database.DuckDB.FFI_Safe_duckdb_destroy_client_context@
+foreign import ccall safe "hs_bindgen_e1dcc582c6d3773d" hs_bindgen_e1dcc582c6d3773d_base ::
+     BG.Ptr BG.Void
+  -> IO ()
+
+-- __unique:__ @Database_DuckDB_FFI_Database.DuckDB.FFI_Safe_duckdb_destroy_client_context@
+hs_bindgen_e1dcc582c6d3773d ::
+     BG.Ptr DuckDBClientContext
+  -> IO ()
+hs_bindgen_e1dcc582c6d3773d =
+  \x0 ->
+    hs_bindgen_e1dcc582c6d3773d_base (BG.toFFIType x0)
+
+{-| Destroys the client context and deallocates its memory.
+
+    history:
+
+    * unstable: v1.3.0
+
+    * stable: v1.5.6
+
+    [__@context@__]: The client context to destroy.
+
+    __Returns:__ void
+
+    __C declaration:__ @duckdb_destroy_client_context@
+
+    __defined at:__ @duckdb.h 3787:19@
+
+    __exported by:__ @duckdb.h@
+-}
+c_duckdb_destroy_client_context ::
+     BG.Ptr DuckDBClientContext
+     {- ^
+
+          [__@context@__]: The client context to destroy.
+
+          __C declaration:__ @context@
+     -}
+  -> IO ()
+c_duckdb_destroy_client_context =
+  hs_bindgen_e1dcc582c6d3773d
+
+-- __unique:__ @Database_DuckDB_FFI_Database.DuckDB.FFI_Safe_duckdb_destroy_arrow_options@
+foreign import ccall safe "hs_bindgen_aa5e5b8ee750a275" hs_bindgen_aa5e5b8ee750a275_base ::
+     BG.Ptr BG.Void
+  -> IO ()
+
+-- __unique:__ @Database_DuckDB_FFI_Database.DuckDB.FFI_Safe_duckdb_destroy_arrow_options@
+hs_bindgen_aa5e5b8ee750a275 ::
+     BG.Ptr DuckDBArrowOptions
+  -> IO ()
+hs_bindgen_aa5e5b8ee750a275 =
+  \x0 ->
+    hs_bindgen_aa5e5b8ee750a275_base (BG.toFFIType x0)
+
+{-| Destroys the arrow options and deallocates its memory.
+
+    history:
+
+    * unstable: v1.4.0
+
+    * stable: v1.5.6
+
+    [__@arrow_options@__]: The arrow options to destroy.
+
+    __Returns:__ void
+
+    __C declaration:__ @duckdb_destroy_arrow_options@
+
+    __defined at:__ @duckdb.h 3801:19@
+
+    __exported by:__ @duckdb.h@
+-}
+c_duckdb_destroy_arrow_options ::
+     BG.Ptr DuckDBArrowOptions
+     {- ^
+
+          [__@arrow_options@__]: The arrow options to destroy.
+
+          __C declaration:__ @arrow_options@
+     -}
+  -> IO ()
+c_duckdb_destroy_arrow_options =
+  hs_bindgen_aa5e5b8ee750a275
+
+-- __unique:__ @Database_DuckDB_FFI_Database.DuckDB.FFI_Safe_duckdb_get_table_names@
+foreign import ccall safe "hs_bindgen_f77ead42500007ef" hs_bindgen_f77ead42500007ef_base ::
+     BG.Ptr BG.Void
+  -> BG.Ptr BG.Void
+  -> BG.CBool
+  -> IO (BG.Ptr BG.Void)
+
+-- __unique:__ @Database_DuckDB_FFI_Database.DuckDB.FFI_Safe_duckdb_get_table_names@
+hs_bindgen_f77ead42500007ef ::
+     DuckDBConnection
+  -> PtrConst.PtrConst BG.CChar
+  -> BG.CBool
+  -> IO DuckDBValue
+hs_bindgen_f77ead42500007ef =
+  \x0 ->
+    \x1 ->
+      \x2 ->
+        fmap BG.fromFFIType (hs_bindgen_f77ead42500007ef_base (BG.toFFIType x0) (BG.toFFIType x1) (BG.toFFIType x2))
+
+{-| Get the list of (fully qualified) table names of the query.
+
+    history:
+
+    * unstable: v1.3.0
+
+    * stable: v1.5.6
+
+    [__@connection@__]: The connection for which to get the table names.
+
+    [__@query@__]: The query for which to get the table names.
+
+    [__@qualified@__]: Returns fully qualified table names (catalog.schema.table), if set to true, else only the (not escaped) table names.
+
+    __Returns:__ t'DuckDBValue'
+
+    __C declaration:__ @duckdb_get_table_names@
+
+    __defined at:__ @duckdb.h 3818:27@
+
+    __exported by:__ @duckdb.h@
+-}
+c_duckdb_get_table_names ::
+     DuckDBConnection
+     {- ^
+
+          [__@connection@__]: The connection for which to get the table names.
+
+          __C declaration:__ @connection@
+     -}
+  -> PtrConst.PtrConst BG.CChar
+     {- ^
+
+          [__@query@__]: The query for which to get the table names.
+
+          __C declaration:__ @query@
+     -}
+  -> BG.CBool
+     {- ^
+
+          [__@qualified@__]: Returns fully qualified table names (catalog.schema.table), if set to true, else only the (not escaped) table names.
+
+          __C declaration:__ @qualified@
+     -}
+  -> IO DuckDBValue
+c_duckdb_get_table_names =
+  hs_bindgen_f77ead42500007ef
+
+-- __unique:__ @Database_DuckDB_FFI_Database.DuckDB.FFI_Safe_duckdb_create_copy_function@
+foreign import ccall safe "hs_bindgen_9082e3375dc02c6b" hs_bindgen_9082e3375dc02c6b_base ::
+     IO (BG.Ptr BG.Void)
+
+-- __unique:__ @Database_DuckDB_FFI_Database.DuckDB.FFI_Safe_duckdb_create_copy_function@
+hs_bindgen_9082e3375dc02c6b :: IO DuckDBCopyFunction
+hs_bindgen_9082e3375dc02c6b =
+  fmap BG.fromFFIType hs_bindgen_9082e3375dc02c6b_base
+
+{-| Creates a new empty copy function.
+
+    The return value must be destroyed with @'c_duckdb_destroy_copy_function'@ .
+
+    history:
+
+    * unstable: v1.5.0
+
+    * stable: v1.5.6
+
+    __Returns:__ t'DuckDBCopyFunction'
+
+    __C declaration:__ @duckdb_create_copy_function@
+
+    __defined at:__ @duckdb.h 3851:35@
+
+    __exported by:__ @duckdb.h@
+-}
+c_duckdb_create_copy_function :: IO DuckDBCopyFunction
+c_duckdb_create_copy_function =
+  hs_bindgen_9082e3375dc02c6b
+
+-- __unique:__ @Database_DuckDB_FFI_Database.DuckDB.FFI_Safe_duckdb_copy_function_set_name@
+foreign import ccall safe "hs_bindgen_5dcabbbd6ea15759" hs_bindgen_5dcabbbd6ea15759_base ::
+     BG.Ptr BG.Void
+  -> BG.Ptr BG.Void
+  -> IO ()
+
+-- __unique:__ @Database_DuckDB_FFI_Database.DuckDB.FFI_Safe_duckdb_copy_function_set_name@
+hs_bindgen_5dcabbbd6ea15759 ::
+     DuckDBCopyFunction
+  -> PtrConst.PtrConst BG.CChar
+  -> IO ()
+hs_bindgen_5dcabbbd6ea15759 =
+  \x0 ->
+    \x1 ->
+      hs_bindgen_5dcabbbd6ea15759_base (BG.toFFIType x0) (BG.toFFIType x1)
+
+{-| Sets the name of the copy function.
+
+    history:
+
+    * unstable: v1.5.0
+
+    * stable: v1.5.6
+
+    [__@copy_function@__]: The copy function
+
+    [__@name@__]: The name to set
+
+    __Returns:__ void
+
+    __C declaration:__ @duckdb_copy_function_set_name@
+
+    __defined at:__ @duckdb.h 3866:19@
+
+    __exported by:__ @duckdb.h@
+-}
+c_duckdb_copy_function_set_name ::
+     DuckDBCopyFunction
+     {- ^
+
+          [__@copy_function@__]: The copy function
+
+          __C declaration:__ @copy_function@
+     -}
+  -> PtrConst.PtrConst BG.CChar
+     {- ^
+
+          [__@name@__]: The name to set
+
+          __C declaration:__ @name@
+     -}
+  -> IO ()
+c_duckdb_copy_function_set_name =
+  hs_bindgen_5dcabbbd6ea15759
+
+-- __unique:__ @Database_DuckDB_FFI_Database.DuckDB.FFI_Safe_duckdb_copy_function_set_extra_info@
+foreign import ccall safe "hs_bindgen_f11df37a3a7c9589" hs_bindgen_f11df37a3a7c9589_base ::
+     BG.Ptr BG.Void
+  -> BG.Ptr BG.Void
+  -> BG.FunPtr BG.Void
+  -> IO ()
+
+-- __unique:__ @Database_DuckDB_FFI_Database.DuckDB.FFI_Safe_duckdb_copy_function_set_extra_info@
+hs_bindgen_f11df37a3a7c9589 ::
+     DuckDBCopyFunction
+  -> BG.Ptr BG.Void
+  -> DuckDBDeleteCallback
+  -> IO ()
+hs_bindgen_f11df37a3a7c9589 =
+  \x0 ->
+    \x1 ->
+      \x2 ->
+        hs_bindgen_f11df37a3a7c9589_base (BG.toFFIType x0) (BG.toFFIType x1) (BG.toFFIType x2)
+
+{-| Sets the extra info pointer of the copy function, which can be used to store arbitrary data.
+
+    history:
+
+    * unstable: v1.5.0
+
+    * stable: v1.5.6
+
+    [__@copy_function@__]: The copy function
+
+    [__@extra_info@__]: The extra info pointer
+
+    [__@destructor@__]: A destructor function to call to destroy the extra info
+
+    __Returns:__ void
+
+    __C declaration:__ @duckdb_copy_function_set_extra_info@
+
+    __defined at:__ @duckdb.h 3882:19@
+
+    __exported by:__ @duckdb.h@
+-}
+c_duckdb_copy_function_set_extra_info ::
+     DuckDBCopyFunction
+     {- ^
+
+          [__@copy_function@__]: The copy function
+
+          __C declaration:__ @copy_function@
+     -}
+  -> BG.Ptr BG.Void
+     {- ^
+
+          [__@extra_info@__]: The extra info pointer
+
+          __C declaration:__ @extra_info@
+     -}
+  -> DuckDBDeleteCallback
+     {- ^
+
+          [__@destructor@__]: A destructor function to call to destroy the extra info
+
+          __C declaration:__ @destructor@
+     -}
+  -> IO ()
+c_duckdb_copy_function_set_extra_info =
+  hs_bindgen_f11df37a3a7c9589
+
+-- __unique:__ @Database_DuckDB_FFI_Database.DuckDB.FFI_Safe_duckdb_register_copy_function@
+foreign import ccall safe "hs_bindgen_ef2952af4d35b915" hs_bindgen_ef2952af4d35b915_base ::
+     BG.Ptr BG.Void
+  -> BG.Ptr BG.Void
+  -> IO BG.CUInt
+
+-- __unique:__ @Database_DuckDB_FFI_Database.DuckDB.FFI_Safe_duckdb_register_copy_function@
+hs_bindgen_ef2952af4d35b915 ::
+     DuckDBConnection
+  -> DuckDBCopyFunction
+  -> IO DuckDBState
+hs_bindgen_ef2952af4d35b915 =
+  \x0 ->
+    \x1 ->
+      fmap BG.fromFFIType (hs_bindgen_ef2952af4d35b915_base (BG.toFFIType x0) (BG.toFFIType x1))
+
+{-| Registers the given copy function on the database connection under the specified name.
+
+    history:
+
+    * unstable: v1.5.0
+
+    * stable: v1.5.6
+
+    [__@connection@__]: The database connection
+
+    [__@copy_function@__]: The copy function to register
+
+    __Returns:__ t'DuckDBState'
+
+    __C declaration:__ @duckdb_register_copy_function@
+
+    __defined at:__ @duckdb.h 3898:27@
+
+    __exported by:__ @duckdb.h@
+-}
+c_duckdb_register_copy_function ::
+     DuckDBConnection
+     {- ^
+
+          [__@connection@__]: The database connection
+
+          __C declaration:__ @connection@
+     -}
+  -> DuckDBCopyFunction
+     {- ^
+
+          [__@copy_function@__]: The copy function to register
+
+          __C declaration:__ @copy_function@
+     -}
+  -> IO DuckDBState
+c_duckdb_register_copy_function =
+  hs_bindgen_ef2952af4d35b915
+
+-- __unique:__ @Database_DuckDB_FFI_Database.DuckDB.FFI_Safe_duckdb_destroy_copy_function@
+foreign import ccall safe "hs_bindgen_a8e7668d29c4444d" hs_bindgen_a8e7668d29c4444d_base ::
+     BG.Ptr BG.Void
+  -> IO ()
+
+-- __unique:__ @Database_DuckDB_FFI_Database.DuckDB.FFI_Safe_duckdb_destroy_copy_function@
+hs_bindgen_a8e7668d29c4444d ::
+     BG.Ptr DuckDBCopyFunction
+  -> IO ()
+hs_bindgen_a8e7668d29c4444d =
+  \x0 ->
+    hs_bindgen_a8e7668d29c4444d_base (BG.toFFIType x0)
+
+{-| Destroys the given copy function object.
+
+    history:
+
+    * unstable: v1.5.0
+
+    * stable: v1.5.6
+
+    [__@copy_function@__]: The copy function to destroy.
+
+    __Returns:__ void
+
+    __C declaration:__ @duckdb_destroy_copy_function@
+
+    __defined at:__ @duckdb.h 3913:19@
+
+    __exported by:__ @duckdb.h@
+-}
+c_duckdb_destroy_copy_function ::
+     BG.Ptr DuckDBCopyFunction
+     {- ^
+
+          [__@copy_function@__]: The copy function to destroy.
+
+          __C declaration:__ @copy_function@
+     -}
+  -> IO ()
+c_duckdb_destroy_copy_function =
+  hs_bindgen_a8e7668d29c4444d
+
+-- __unique:__ @Database_DuckDB_FFI_Database.DuckDB.FFI_Safe_duckdb_copy_function_set_bind@
+foreign import ccall safe "hs_bindgen_87cf3467d4ff600f" hs_bindgen_87cf3467d4ff600f_base ::
+     BG.Ptr BG.Void
+  -> BG.FunPtr BG.Void
+  -> IO ()
+
+-- __unique:__ @Database_DuckDB_FFI_Database.DuckDB.FFI_Safe_duckdb_copy_function_set_bind@
+hs_bindgen_87cf3467d4ff600f ::
+     DuckDBCopyFunction
+  -> DuckDBCopyFunctionBindFun
+  -> IO ()
+hs_bindgen_87cf3467d4ff600f =
+  \x0 ->
+    \x1 ->
+      hs_bindgen_87cf3467d4ff600f_base (BG.toFFIType x0) (BG.toFFIType x1)
+
+{-| Sets the bind function of the copy function, to use when binding @COPY ... TO@ .
+
+    history:
+
+    * unstable: v1.5.0
+
+    * stable: v1.5.6
+
+    [__@copy_function@__]:
+
+    [__@bind@__]: The bind function
+
+    __Returns:__ void
+
+    __C declaration:__ @duckdb_copy_function_set_bind@
+
+    __defined at:__ @duckdb.h 3928:19@
+
+    __exported by:__ @duckdb.h@
+-}
+c_duckdb_copy_function_set_bind ::
+     DuckDBCopyFunction
+     {- ^
+
+          [__@copy_function@__]:
+
+          __C declaration:__ @copy_function@
+     -}
+  -> DuckDBCopyFunctionBindFun
+     {- ^
+
+          [__@bind@__]: The bind function
+
+          __C declaration:__ @bind@
+     -}
+  -> IO ()
+c_duckdb_copy_function_set_bind =
+  hs_bindgen_87cf3467d4ff600f
+
+-- __unique:__ @Database_DuckDB_FFI_Database.DuckDB.FFI_Safe_duckdb_copy_function_bind_set_error@
+foreign import ccall safe "hs_bindgen_524c0439f2a4c426" hs_bindgen_524c0439f2a4c426_base ::
+     BG.Ptr BG.Void
+  -> BG.Ptr BG.Void
+  -> IO ()
+
+-- __unique:__ @Database_DuckDB_FFI_Database.DuckDB.FFI_Safe_duckdb_copy_function_bind_set_error@
+hs_bindgen_524c0439f2a4c426 ::
+     DuckDBCopyFunctionBindInfo
+  -> PtrConst.PtrConst BG.CChar
+  -> IO ()
+hs_bindgen_524c0439f2a4c426 =
+  \x0 ->
+    \x1 ->
+      hs_bindgen_524c0439f2a4c426_base (BG.toFFIType x0) (BG.toFFIType x1)
+
+{-| Report that an error occurred during the binding-phase of a @COPY ... TO@ function.
+
+    history:
+
+    * unstable: v1.5.0
+
+    * stable: v1.5.6
+
+    [__@info@__]: The bind info provided to the bind function
+
+    [__@error@__]: The error message
+
+    __Returns:__ void
+
+    __C declaration:__ @duckdb_copy_function_bind_set_error@
+
+    __defined at:__ @duckdb.h 3943:19@
+
+    __exported by:__ @duckdb.h@
+-}
+c_duckdb_copy_function_bind_set_error ::
+     DuckDBCopyFunctionBindInfo
+     {- ^
+
+          [__@info@__]: The bind info provided to the bind function
+
+          __C declaration:__ @info@
+     -}
+  -> PtrConst.PtrConst BG.CChar
+     {- ^
+
+          [__@error@__]: The error message
+
+          __C declaration:__ @error@
+     -}
+  -> IO ()
+c_duckdb_copy_function_bind_set_error =
+  hs_bindgen_524c0439f2a4c426
+
+-- __unique:__ @Database_DuckDB_FFI_Database.DuckDB.FFI_Safe_duckdb_copy_function_bind_get_extra_info@
+foreign import ccall safe "hs_bindgen_700aaa096e86aaf2" hs_bindgen_700aaa096e86aaf2_base ::
+     BG.Ptr BG.Void
+  -> IO (BG.Ptr BG.Void)
+
+-- __unique:__ @Database_DuckDB_FFI_Database.DuckDB.FFI_Safe_duckdb_copy_function_bind_get_extra_info@
+hs_bindgen_700aaa096e86aaf2 ::
+     DuckDBCopyFunctionBindInfo
+  -> IO (BG.Ptr BG.Void)
+hs_bindgen_700aaa096e86aaf2 =
+  \x0 ->
+    fmap BG.fromFFIType (hs_bindgen_700aaa096e86aaf2_base (BG.toFFIType x0))
+
+{-| Retrieves the extra info pointer of the copy function.
+
+    history:
+
+    * unstable: v1.5.0
+
+    * stable: v1.5.6
+
+    [__@info@__]: The bind info provided to the bind function
+
+    __Returns:__ void*
+
+    __C declaration:__ @duckdb_copy_function_bind_get_extra_info@
+
+    __defined at:__ @duckdb.h 3957:20@
+
+    __exported by:__ @duckdb.h@
+-}
+c_duckdb_copy_function_bind_get_extra_info ::
+     DuckDBCopyFunctionBindInfo
+     {- ^
+
+          [__@info@__]: The bind info provided to the bind function
+
+          __C declaration:__ @info@
+     -}
+  -> IO (BG.Ptr BG.Void)
+c_duckdb_copy_function_bind_get_extra_info =
+  hs_bindgen_700aaa096e86aaf2
+
+-- __unique:__ @Database_DuckDB_FFI_Database.DuckDB.FFI_Safe_duckdb_copy_function_bind_get_client_context@
+foreign import ccall safe "hs_bindgen_43ecba8b372ade77" hs_bindgen_43ecba8b372ade77_base ::
+     BG.Ptr BG.Void
+  -> IO (BG.Ptr BG.Void)
+
+-- __unique:__ @Database_DuckDB_FFI_Database.DuckDB.FFI_Safe_duckdb_copy_function_bind_get_client_context@
+hs_bindgen_43ecba8b372ade77 ::
+     DuckDBCopyFunctionBindInfo
+  -> IO DuckDBClientContext
+hs_bindgen_43ecba8b372ade77 =
+  \x0 ->
+    fmap BG.fromFFIType (hs_bindgen_43ecba8b372ade77_base (BG.toFFIType x0))
+
+{-| Retrieves the client context of the current connection binding the @COPY ... TO@ function.
+
+    Must be destroyed with @'c_duckdb_destroy_client_context'@
+
+    history:
+
+    * unstable: v1.5.0
+
+    * stable: v1.5.6
+
+    [__@info@__]: The bind info provided to the bind function
+
+    __Returns:__ t'DuckDBClientContext'
+
+    __C declaration:__ @duckdb_copy_function_bind_get_client_context@
+
+    __defined at:__ @duckdb.h 3973:36@
+
+    __exported by:__ @duckdb.h@
+-}
+c_duckdb_copy_function_bind_get_client_context ::
+     DuckDBCopyFunctionBindInfo
+     {- ^
+
+          [__@info@__]: The bind info provided to the bind function
+
+          __C declaration:__ @info@
+     -}
+  -> IO DuckDBClientContext
+c_duckdb_copy_function_bind_get_client_context =
+  hs_bindgen_43ecba8b372ade77
+
+-- __unique:__ @Database_DuckDB_FFI_Database.DuckDB.FFI_Safe_duckdb_copy_function_bind_get_column_count@
+foreign import ccall safe "hs_bindgen_fded725200a8255d" hs_bindgen_fded725200a8255d_base ::
+     BG.Ptr BG.Void
+  -> IO HsBindgen.Runtime.LibC.Word64
+
+-- __unique:__ @Database_DuckDB_FFI_Database.DuckDB.FFI_Safe_duckdb_copy_function_bind_get_column_count@
+hs_bindgen_fded725200a8255d ::
+     DuckDBCopyFunctionBindInfo
+  -> IO DuckDBIdx
+hs_bindgen_fded725200a8255d =
+  \x0 ->
+    fmap BG.fromFFIType (hs_bindgen_fded725200a8255d_base (BG.toFFIType x0))
+
+{-| Retrieves the number of columns that will be provided to the @COPY ... TO@ function.
+
+    history:
+
+    * unstable: v1.5.0
+
+    * stable: v1.5.6
+
+    [__@info@__]: The bind info provided to the bind function
+
+    __Returns:__ t'DuckDBIdx'
+
+    __C declaration:__ @duckdb_copy_function_bind_get_column_count@
+
+    __defined at:__ @duckdb.h 3987:20@
+
+    __exported by:__ @duckdb.h@
+-}
+c_duckdb_copy_function_bind_get_column_count ::
+     DuckDBCopyFunctionBindInfo
+     {- ^
+
+          [__@info@__]: The bind info provided to the bind function
+
+          __C declaration:__ @info@
+     -}
+  -> IO DuckDBIdx
+c_duckdb_copy_function_bind_get_column_count =
+  hs_bindgen_fded725200a8255d
+
+-- __unique:__ @Database_DuckDB_FFI_Database.DuckDB.FFI_Safe_duckdb_copy_function_bind_get_column_type@
+foreign import ccall safe "hs_bindgen_66ea23271c8a6bd0" hs_bindgen_66ea23271c8a6bd0_base ::
+     BG.Ptr BG.Void
+  -> HsBindgen.Runtime.LibC.Word64
+  -> IO (BG.Ptr BG.Void)
+
+-- __unique:__ @Database_DuckDB_FFI_Database.DuckDB.FFI_Safe_duckdb_copy_function_bind_get_column_type@
+hs_bindgen_66ea23271c8a6bd0 ::
+     DuckDBCopyFunctionBindInfo
+  -> DuckDBIdx
+  -> IO DuckDBLogicalType
+hs_bindgen_66ea23271c8a6bd0 =
+  \x0 ->
+    \x1 ->
+      fmap BG.fromFFIType (hs_bindgen_66ea23271c8a6bd0_base (BG.toFFIType x0) (BG.toFFIType x1))
+
+{-| Retrieves the type of a column that will be provided to the @COPY ... TO@ function.
+
+    history:
+
+    * unstable: v1.5.0
+
+    * stable: v1.5.6
+
+    [__@info@__]: The bind info provided to the bind function
+
+    [__@col_idx@__]: The index of the column to retrieve the type for
+
+    __Returns:__ t'DuckDBLogicalType'
+
+    __C declaration:__ @duckdb_copy_function_bind_get_column_type@
+
+    __defined at:__ @duckdb.h 4002:34@
+
+    __exported by:__ @duckdb.h@
+-}
+c_duckdb_copy_function_bind_get_column_type ::
+     DuckDBCopyFunctionBindInfo
+     {- ^
+
+          [__@info@__]: The bind info provided to the bind function
+
+          __C declaration:__ @info@
+     -}
+  -> DuckDBIdx
+     {- ^
+
+          [__@col_idx@__]: The index of the column to retrieve the type for
+
+          __C declaration:__ @col_idx@
+     -}
+  -> IO DuckDBLogicalType
+c_duckdb_copy_function_bind_get_column_type =
+  hs_bindgen_66ea23271c8a6bd0
+
+-- __unique:__ @Database_DuckDB_FFI_Database.DuckDB.FFI_Safe_duckdb_copy_function_bind_get_options@
+foreign import ccall safe "hs_bindgen_7b77d6cb5cf0d60a" hs_bindgen_7b77d6cb5cf0d60a_base ::
+     BG.Ptr BG.Void
+  -> IO (BG.Ptr BG.Void)
+
+-- __unique:__ @Database_DuckDB_FFI_Database.DuckDB.FFI_Safe_duckdb_copy_function_bind_get_options@
+hs_bindgen_7b77d6cb5cf0d60a ::
+     DuckDBCopyFunctionBindInfo
+  -> IO DuckDBValue
+hs_bindgen_7b77d6cb5cf0d60a =
+  \x0 ->
+    fmap BG.fromFFIType (hs_bindgen_7b77d6cb5cf0d60a_base (BG.toFFIType x0))
+
+{-| Retrieves all values for the given options provided to the @COPY ... TO@ function.
+
+    history:
+
+    * unstable: v1.5.0
+
+    * stable: v1.5.6
+
+    [__@info@__]: The bind info provided to the bind function
+
+    __Returns:__ t'DuckDBValue'
+
+    __C declaration:__ @duckdb_copy_function_bind_get_options@
+
+    __defined at:__ @duckdb.h 4017:27@
+
+    __exported by:__ @duckdb.h@
+-}
+c_duckdb_copy_function_bind_get_options ::
+     DuckDBCopyFunctionBindInfo
+     {- ^
+
+          [__@info@__]: The bind info provided to the bind function
+
+          __C declaration:__ @info@
+     -}
+  -> IO DuckDBValue
+c_duckdb_copy_function_bind_get_options =
+  hs_bindgen_7b77d6cb5cf0d60a
+
+-- __unique:__ @Database_DuckDB_FFI_Database.DuckDB.FFI_Safe_duckdb_copy_function_bind_set_bind_data@
+foreign import ccall safe "hs_bindgen_fe305bbf1974a262" hs_bindgen_fe305bbf1974a262_base ::
+     BG.Ptr BG.Void
+  -> BG.Ptr BG.Void
+  -> BG.FunPtr BG.Void
+  -> IO ()
+
+-- __unique:__ @Database_DuckDB_FFI_Database.DuckDB.FFI_Safe_duckdb_copy_function_bind_set_bind_data@
+hs_bindgen_fe305bbf1974a262 ::
+     DuckDBCopyFunctionBindInfo
+  -> BG.Ptr BG.Void
+  -> DuckDBDeleteCallback
+  -> IO ()
+hs_bindgen_fe305bbf1974a262 =
+  \x0 ->
+    \x1 ->
+      \x2 ->
+        hs_bindgen_fe305bbf1974a262_base (BG.toFFIType x0) (BG.toFFIType x1) (BG.toFFIType x2)
+
+{-| Sets the bind data of the copy function, to be provided to the init, sink and finalize functions.
+
+    history:
+
+    * unstable: v1.5.0
+
+    * stable: v1.5.6
+
+    [__@info@__]: The bind info provided to the bind function
+
+    [__@bind_data@__]: The bind data pointer
+
+    [__@destructor@__]: A destructor function to call to destroy the bind data
+
+    __Returns:__ void
+
+    __C declaration:__ @duckdb_copy_function_bind_set_bind_data@
+
+    __defined at:__ @duckdb.h 4033:19@
+
+    __exported by:__ @duckdb.h@
+-}
+c_duckdb_copy_function_bind_set_bind_data ::
+     DuckDBCopyFunctionBindInfo
+     {- ^
+
+          [__@info@__]: The bind info provided to the bind function
+
+          __C declaration:__ @info@
+     -}
+  -> BG.Ptr BG.Void
+     {- ^
+
+          [__@bind_data@__]: The bind data pointer
+
+          __C declaration:__ @bind_data@
+     -}
+  -> DuckDBDeleteCallback
+     {- ^
+
+          [__@destructor@__]: A destructor function to call to destroy the bind data
+
+          __C declaration:__ @destructor@
+     -}
+  -> IO ()
+c_duckdb_copy_function_bind_set_bind_data =
+  hs_bindgen_fe305bbf1974a262
+
+-- __unique:__ @Database_DuckDB_FFI_Database.DuckDB.FFI_Safe_duckdb_copy_function_set_global_init@
+foreign import ccall safe "hs_bindgen_bdf653203b811426" hs_bindgen_bdf653203b811426_base ::
+     BG.Ptr BG.Void
+  -> BG.FunPtr BG.Void
+  -> IO ()
+
+-- __unique:__ @Database_DuckDB_FFI_Database.DuckDB.FFI_Safe_duckdb_copy_function_set_global_init@
+hs_bindgen_bdf653203b811426 ::
+     DuckDBCopyFunction
+  -> DuckDBCopyFunctionGlobalInitFun
+  -> IO ()
+hs_bindgen_bdf653203b811426 =
+  \x0 ->
+    \x1 ->
+      hs_bindgen_bdf653203b811426_base (BG.toFFIType x0) (BG.toFFIType x1)
+
+{-| Sets the initialization function of the copy function, called right before executing @COPY ... TO@ .
+
+    history:
+
+    * unstable: v1.5.0
+
+    * stable: v1.5.6
+
+    [__@copy_function@__]:
+
+    [__@init@__]: The init function
+
+    __Returns:__ void
+
+    __C declaration:__ @duckdb_copy_function_set_global_init@
+
+    __defined at:__ @duckdb.h 4049:19@
+
+    __exported by:__ @duckdb.h@
+-}
+c_duckdb_copy_function_set_global_init ::
+     DuckDBCopyFunction
+     {- ^
+
+          [__@copy_function@__]:
+
+          __C declaration:__ @copy_function@
+     -}
+  -> DuckDBCopyFunctionGlobalInitFun
+     {- ^
+
+          [__@init@__]: The init function
+
+          __C declaration:__ @init@
+     -}
+  -> IO ()
+c_duckdb_copy_function_set_global_init =
+  hs_bindgen_bdf653203b811426
+
+-- __unique:__ @Database_DuckDB_FFI_Database.DuckDB.FFI_Safe_duckdb_copy_function_global_init_set_error@
+foreign import ccall safe "hs_bindgen_279e87fe6d40d247" hs_bindgen_279e87fe6d40d247_base ::
+     BG.Ptr BG.Void
+  -> BG.Ptr BG.Void
+  -> IO ()
+
+-- __unique:__ @Database_DuckDB_FFI_Database.DuckDB.FFI_Safe_duckdb_copy_function_global_init_set_error@
+hs_bindgen_279e87fe6d40d247 ::
+     DuckDBCopyFunctionGlobalInitInfo
+  -> PtrConst.PtrConst BG.CChar
+  -> IO ()
+hs_bindgen_279e87fe6d40d247 =
+  \x0 ->
+    \x1 ->
+      hs_bindgen_279e87fe6d40d247_base (BG.toFFIType x0) (BG.toFFIType x1)
+
+{-| Report that an error occurred during the initialization-phase of a @COPY ... TO@ function.
+
+    history:
+
+    * unstable: v1.5.0
+
+    * stable: v1.5.6
+
+    [__@info@__]: The init info provided to the init function
+
+    [__@error@__]: The error message
+
+    __Returns:__ void
+
+    __C declaration:__ @duckdb_copy_function_global_init_set_error@
+
+    __defined at:__ @duckdb.h 4065:19@
+
+    __exported by:__ @duckdb.h@
+-}
+c_duckdb_copy_function_global_init_set_error ::
+     DuckDBCopyFunctionGlobalInitInfo
+     {- ^
+
+          [__@info@__]: The init info provided to the init function
+
+          __C declaration:__ @info@
+     -}
+  -> PtrConst.PtrConst BG.CChar
+     {- ^
+
+          [__@error@__]: The error message
+
+          __C declaration:__ @error@
+     -}
+  -> IO ()
+c_duckdb_copy_function_global_init_set_error =
+  hs_bindgen_279e87fe6d40d247
+
+-- __unique:__ @Database_DuckDB_FFI_Database.DuckDB.FFI_Safe_duckdb_copy_function_global_init_get_extra_info@
+foreign import ccall safe "hs_bindgen_7609546a5c22ffe0" hs_bindgen_7609546a5c22ffe0_base ::
+     BG.Ptr BG.Void
+  -> IO (BG.Ptr BG.Void)
+
+-- __unique:__ @Database_DuckDB_FFI_Database.DuckDB.FFI_Safe_duckdb_copy_function_global_init_get_extra_info@
+hs_bindgen_7609546a5c22ffe0 ::
+     DuckDBCopyFunctionGlobalInitInfo
+  -> IO (BG.Ptr BG.Void)
+hs_bindgen_7609546a5c22ffe0 =
+  \x0 ->
+    fmap BG.fromFFIType (hs_bindgen_7609546a5c22ffe0_base (BG.toFFIType x0))
+
+{-| Retrieves the extra info pointer of the copy function.
+
+    history:
+
+    * unstable: v1.5.0
+
+    * stable: v1.5.6
+
+    [__@info@__]: The init info provided to the init function
+
+    __Returns:__ void*
+
+    __C declaration:__ @duckdb_copy_function_global_init_get_extra_info@
+
+    __defined at:__ @duckdb.h 4080:20@
+
+    __exported by:__ @duckdb.h@
+-}
+c_duckdb_copy_function_global_init_get_extra_info ::
+     DuckDBCopyFunctionGlobalInitInfo
+     {- ^
+
+          [__@info@__]: The init info provided to the init function
+
+          __C declaration:__ @info@
+     -}
+  -> IO (BG.Ptr BG.Void)
+c_duckdb_copy_function_global_init_get_extra_info =
+  hs_bindgen_7609546a5c22ffe0
+
+-- __unique:__ @Database_DuckDB_FFI_Database.DuckDB.FFI_Safe_duckdb_copy_function_global_init_get_client_context@
+foreign import ccall safe "hs_bindgen_43808cb7db79e801" hs_bindgen_43808cb7db79e801_base ::
+     BG.Ptr BG.Void
+  -> IO (BG.Ptr BG.Void)
+
+-- __unique:__ @Database_DuckDB_FFI_Database.DuckDB.FFI_Safe_duckdb_copy_function_global_init_get_client_context@
+hs_bindgen_43808cb7db79e801 ::
+     DuckDBCopyFunctionGlobalInitInfo
+  -> IO DuckDBClientContext
+hs_bindgen_43808cb7db79e801 =
+  \x0 ->
+    fmap BG.fromFFIType (hs_bindgen_43808cb7db79e801_base (BG.toFFIType x0))
+
+{-| Retrieves the client context of the current connection initializing the @COPY ... TO@ function.
+
+    Must be destroyed with @'c_duckdb_destroy_client_context'@
+
+    history:
+
+    * unstable: v1.5.0
+
+    * stable: v1.5.6
+
+    [__@info@__]: The init info provided to the init function
+
+    __Returns:__ t'DuckDBClientContext'
+
+    __C declaration:__ @duckdb_copy_function_global_init_get_client_context@
+
+    __defined at:__ @duckdb.h 4097:1@
+
+    __exported by:__ @duckdb.h@
+-}
+c_duckdb_copy_function_global_init_get_client_context ::
+     DuckDBCopyFunctionGlobalInitInfo
+     {- ^
+
+          [__@info@__]: The init info provided to the init function
+
+          __C declaration:__ @info@
+     -}
+  -> IO DuckDBClientContext
+c_duckdb_copy_function_global_init_get_client_context =
+  hs_bindgen_43808cb7db79e801
+
+-- __unique:__ @Database_DuckDB_FFI_Database.DuckDB.FFI_Safe_duckdb_copy_function_global_init_get_bind_data@
+foreign import ccall safe "hs_bindgen_687b5ba8e888e959" hs_bindgen_687b5ba8e888e959_base ::
+     BG.Ptr BG.Void
+  -> IO (BG.Ptr BG.Void)
+
+-- __unique:__ @Database_DuckDB_FFI_Database.DuckDB.FFI_Safe_duckdb_copy_function_global_init_get_bind_data@
+hs_bindgen_687b5ba8e888e959 ::
+     DuckDBCopyFunctionGlobalInitInfo
+  -> IO (BG.Ptr BG.Void)
+hs_bindgen_687b5ba8e888e959 =
+  \x0 ->
+    fmap BG.fromFFIType (hs_bindgen_687b5ba8e888e959_base (BG.toFFIType x0))
+
+{-| Retrieves the bind data provided during the binding-phase of a @COPY ... TO@ function.
+
+    history:
+
+    * unstable: v1.5.0
+
+    * stable: v1.5.6
+
+    [__@info@__]: The init info provided to the init function
+
+    __Returns:__ void*
+
+    __C declaration:__ @duckdb_copy_function_global_init_get_bind_data@
+
+    __defined at:__ @duckdb.h 4111:20@
+
+    __exported by:__ @duckdb.h@
+-}
+c_duckdb_copy_function_global_init_get_bind_data ::
+     DuckDBCopyFunctionGlobalInitInfo
+     {- ^
+
+          [__@info@__]: The init info provided to the init function
+
+          __C declaration:__ @info@
+     -}
+  -> IO (BG.Ptr BG.Void)
+c_duckdb_copy_function_global_init_get_bind_data =
+  hs_bindgen_687b5ba8e888e959
+
+-- __unique:__ @Database_DuckDB_FFI_Database.DuckDB.FFI_Safe_duckdb_copy_function_global_init_get_file_path@
+foreign import ccall safe "hs_bindgen_2114989eb445f973" hs_bindgen_2114989eb445f973_base ::
+     BG.Ptr BG.Void
+  -> IO (BG.Ptr BG.Void)
+
+-- __unique:__ @Database_DuckDB_FFI_Database.DuckDB.FFI_Safe_duckdb_copy_function_global_init_get_file_path@
+hs_bindgen_2114989eb445f973 ::
+     DuckDBCopyFunctionGlobalInitInfo
+  -> IO (PtrConst.PtrConst BG.CChar)
+hs_bindgen_2114989eb445f973 =
+  \x0 ->
+    fmap BG.fromFFIType (hs_bindgen_2114989eb445f973_base (BG.toFFIType x0))
+
+{-| Retrieves the file path provided to the @COPY ... TO@ function.
+
+    Lives for the duration of the initialization callback, must not be destroyed.
+
+    history:
+
+    * unstable: v1.5.0
+
+    * stable: v1.5.6
+
+    [__@info@__]: The init info provided to the init function
+
+    __Returns:__ const char*
+
+    __C declaration:__ @duckdb_copy_function_global_init_get_file_path@
+
+    __defined at:__ @duckdb.h 4127:26@
+
+    __exported by:__ @duckdb.h@
+-}
+c_duckdb_copy_function_global_init_get_file_path ::
+     DuckDBCopyFunctionGlobalInitInfo
+     {- ^
+
+          [__@info@__]: The init info provided to the init function
+
+          __C declaration:__ @info@
+     -}
+  -> IO (PtrConst.PtrConst BG.CChar)
+c_duckdb_copy_function_global_init_get_file_path =
+  hs_bindgen_2114989eb445f973
+
+-- __unique:__ @Database_DuckDB_FFI_Database.DuckDB.FFI_Safe_duckdb_copy_function_global_init_set_global_state@
+foreign import ccall safe "hs_bindgen_ff12ab62e7e2b86d" hs_bindgen_ff12ab62e7e2b86d_base ::
+     BG.Ptr BG.Void
+  -> BG.Ptr BG.Void
+  -> BG.FunPtr BG.Void
+  -> IO ()
+
+-- __unique:__ @Database_DuckDB_FFI_Database.DuckDB.FFI_Safe_duckdb_copy_function_global_init_set_global_state@
+hs_bindgen_ff12ab62e7e2b86d ::
+     DuckDBCopyFunctionGlobalInitInfo
+  -> BG.Ptr BG.Void
+  -> DuckDBDeleteCallback
+  -> IO ()
+hs_bindgen_ff12ab62e7e2b86d =
+  \x0 ->
+    \x1 ->
+      \x2 ->
+        hs_bindgen_ff12ab62e7e2b86d_base (BG.toFFIType x0) (BG.toFFIType x1) (BG.toFFIType x2)
+
+{-| Sets the global state of the copy function, to be provided to all subsequent local init, sink and finalize functions.
+
+    history:
+
+    * unstable: v1.5.0
+
+    * stable: v1.5.6
+
+    [__@info@__]: The init info provided to the init function
+
+    [__@global_state@__]: The global state pointer
+
+    [__@destructor@__]: A destructor function to call to destroy the global state
+
+    __Returns:__ void
+
+    __C declaration:__ @duckdb_copy_function_global_init_set_global_state@
+
+    __defined at:__ @duckdb.h 4143:19@
+
+    __exported by:__ @duckdb.h@
+-}
+c_duckdb_copy_function_global_init_set_global_state ::
+     DuckDBCopyFunctionGlobalInitInfo
+     {- ^
+
+          [__@info@__]: The init info provided to the init function
+
+          __C declaration:__ @info@
+     -}
+  -> BG.Ptr BG.Void
+     {- ^
+
+          [__@global_state@__]: The global state pointer
+
+          __C declaration:__ @global_state@
+     -}
+  -> DuckDBDeleteCallback
+     {- ^
+
+          [__@destructor@__]: A destructor function to call to destroy the global state
+
+          __C declaration:__ @destructor@
+     -}
+  -> IO ()
+c_duckdb_copy_function_global_init_set_global_state =
+  hs_bindgen_ff12ab62e7e2b86d
+
+-- __unique:__ @Database_DuckDB_FFI_Database.DuckDB.FFI_Safe_duckdb_copy_function_set_sink@
+foreign import ccall safe "hs_bindgen_5ba7790b6977f6f9" hs_bindgen_5ba7790b6977f6f9_base ::
+     BG.Ptr BG.Void
+  -> BG.FunPtr BG.Void
+  -> IO ()
+
+-- __unique:__ @Database_DuckDB_FFI_Database.DuckDB.FFI_Safe_duckdb_copy_function_set_sink@
+hs_bindgen_5ba7790b6977f6f9 ::
+     DuckDBCopyFunction
+  -> DuckDBCopyFunctionSinkFun
+  -> IO ()
+hs_bindgen_5ba7790b6977f6f9 =
+  \x0 ->
+    \x1 ->
+      hs_bindgen_5ba7790b6977f6f9_base (BG.toFFIType x0) (BG.toFFIType x1)
+
+{-| Sets the sink function of the copy function, called during @COPY ... TO@ .
+
+    history:
+
+    * unstable: v1.5.0
+
+    * stable: v1.5.6
+
+    [__@copy_function@__]:
+
+    [__@function@__]: The sink function
+
+    __Returns:__ void
+
+    __C declaration:__ @duckdb_copy_function_set_sink@
+
+    __defined at:__ @duckdb.h 4160:19@
+
+    __exported by:__ @duckdb.h@
+-}
+c_duckdb_copy_function_set_sink ::
+     DuckDBCopyFunction
+     {- ^
+
+          [__@copy_function@__]:
+
+          __C declaration:__ @copy_function@
+     -}
+  -> DuckDBCopyFunctionSinkFun
+     {- ^
+
+          [__@function@__]: The sink function
+
+          __C declaration:__ @function@
+     -}
+  -> IO ()
+c_duckdb_copy_function_set_sink =
+  hs_bindgen_5ba7790b6977f6f9
+
+-- __unique:__ @Database_DuckDB_FFI_Database.DuckDB.FFI_Safe_duckdb_copy_function_sink_set_error@
+foreign import ccall safe "hs_bindgen_6dcea9bdb2c64239" hs_bindgen_6dcea9bdb2c64239_base ::
+     BG.Ptr BG.Void
+  -> BG.Ptr BG.Void
+  -> IO ()
+
+-- __unique:__ @Database_DuckDB_FFI_Database.DuckDB.FFI_Safe_duckdb_copy_function_sink_set_error@
+hs_bindgen_6dcea9bdb2c64239 ::
+     DuckDBCopyFunctionSinkInfo
+  -> PtrConst.PtrConst BG.CChar
+  -> IO ()
+hs_bindgen_6dcea9bdb2c64239 =
+  \x0 ->
+    \x1 ->
+      hs_bindgen_6dcea9bdb2c64239_base (BG.toFFIType x0) (BG.toFFIType x1)
+
+{-| Report that an error occurred during the sink-phase of a @COPY ... TO@ function.
+
+    history:
+
+    * unstable: v1.5.0
+
+    * stable: v1.5.6
+
+    [__@info@__]: The sink info provided to the sink function
+
+    [__@error@__]: The error message
+
+    __Returns:__ void
+
+    __C declaration:__ @duckdb_copy_function_sink_set_error@
+
+    __defined at:__ @duckdb.h 4176:19@
+
+    __exported by:__ @duckdb.h@
+-}
+c_duckdb_copy_function_sink_set_error ::
+     DuckDBCopyFunctionSinkInfo
+     {- ^
+
+          [__@info@__]: The sink info provided to the sink function
+
+          __C declaration:__ @info@
+     -}
+  -> PtrConst.PtrConst BG.CChar
+     {- ^
+
+          [__@error@__]: The error message
+
+          __C declaration:__ @error@
+     -}
+  -> IO ()
+c_duckdb_copy_function_sink_set_error =
+  hs_bindgen_6dcea9bdb2c64239
+
+-- __unique:__ @Database_DuckDB_FFI_Database.DuckDB.FFI_Safe_duckdb_copy_function_sink_get_extra_info@
+foreign import ccall safe "hs_bindgen_05b0c7709595cb8c" hs_bindgen_05b0c7709595cb8c_base ::
+     BG.Ptr BG.Void
+  -> IO (BG.Ptr BG.Void)
+
+-- __unique:__ @Database_DuckDB_FFI_Database.DuckDB.FFI_Safe_duckdb_copy_function_sink_get_extra_info@
+hs_bindgen_05b0c7709595cb8c ::
+     DuckDBCopyFunctionSinkInfo
+  -> IO (BG.Ptr BG.Void)
+hs_bindgen_05b0c7709595cb8c =
+  \x0 ->
+    fmap BG.fromFFIType (hs_bindgen_05b0c7709595cb8c_base (BG.toFFIType x0))
+
+{-| Retrieves the extra info pointer of the copy function.
+
+    history:
+
+    * unstable: v1.5.0
+
+    * stable: v1.5.6
+
+    [__@info@__]: The sink info provided to the sink function
+
+    __Returns:__ void*
+
+    __C declaration:__ @duckdb_copy_function_sink_get_extra_info@
+
+    __defined at:__ @duckdb.h 4190:20@
+
+    __exported by:__ @duckdb.h@
+-}
+c_duckdb_copy_function_sink_get_extra_info ::
+     DuckDBCopyFunctionSinkInfo
+     {- ^
+
+          [__@info@__]: The sink info provided to the sink function
+
+          __C declaration:__ @info@
+     -}
+  -> IO (BG.Ptr BG.Void)
+c_duckdb_copy_function_sink_get_extra_info =
+  hs_bindgen_05b0c7709595cb8c
+
+-- __unique:__ @Database_DuckDB_FFI_Database.DuckDB.FFI_Safe_duckdb_copy_function_sink_get_client_context@
+foreign import ccall safe "hs_bindgen_c8d3a89903c0ed25" hs_bindgen_c8d3a89903c0ed25_base ::
+     BG.Ptr BG.Void
+  -> IO (BG.Ptr BG.Void)
+
+-- __unique:__ @Database_DuckDB_FFI_Database.DuckDB.FFI_Safe_duckdb_copy_function_sink_get_client_context@
+hs_bindgen_c8d3a89903c0ed25 ::
+     DuckDBCopyFunctionSinkInfo
+  -> IO DuckDBClientContext
+hs_bindgen_c8d3a89903c0ed25 =
+  \x0 ->
+    fmap BG.fromFFIType (hs_bindgen_c8d3a89903c0ed25_base (BG.toFFIType x0))
+
+{-| Retrieves the client context of the current connection during the sink-phase of the @COPY ... TO@ function.
+
+    Must be destroyed with @'c_duckdb_destroy_client_context'@
+
+    history:
+
+    * unstable: v1.5.0
+
+    * stable: v1.5.6
+
+    [__@info@__]: The sink info provided to the sink function
+
+    __Returns:__ t'DuckDBClientContext'
+
+    __C declaration:__ @duckdb_copy_function_sink_get_client_context@
+
+    __defined at:__ @duckdb.h 4206:36@
+
+    __exported by:__ @duckdb.h@
+-}
+c_duckdb_copy_function_sink_get_client_context ::
+     DuckDBCopyFunctionSinkInfo
+     {- ^
+
+          [__@info@__]: The sink info provided to the sink function
+
+          __C declaration:__ @info@
+     -}
+  -> IO DuckDBClientContext
+c_duckdb_copy_function_sink_get_client_context =
+  hs_bindgen_c8d3a89903c0ed25
+
+-- __unique:__ @Database_DuckDB_FFI_Database.DuckDB.FFI_Safe_duckdb_copy_function_sink_get_bind_data@
+foreign import ccall safe "hs_bindgen_0625cce1f60f4400" hs_bindgen_0625cce1f60f4400_base ::
+     BG.Ptr BG.Void
+  -> IO (BG.Ptr BG.Void)
+
+-- __unique:__ @Database_DuckDB_FFI_Database.DuckDB.FFI_Safe_duckdb_copy_function_sink_get_bind_data@
+hs_bindgen_0625cce1f60f4400 ::
+     DuckDBCopyFunctionSinkInfo
+  -> IO (BG.Ptr BG.Void)
+hs_bindgen_0625cce1f60f4400 =
+  \x0 ->
+    fmap BG.fromFFIType (hs_bindgen_0625cce1f60f4400_base (BG.toFFIType x0))
+
+{-| Retrieves the bind data provided during the binding-phase of a @COPY ... TO@ function.
+
+    history:
+
+    * unstable: v1.5.0
+
+    * stable: v1.5.6
+
+    [__@info@__]: The sink info provided to the sink function
+
+    __Returns:__ void*
+
+    __C declaration:__ @duckdb_copy_function_sink_get_bind_data@
+
+    __defined at:__ @duckdb.h 4220:20@
+
+    __exported by:__ @duckdb.h@
+-}
+c_duckdb_copy_function_sink_get_bind_data ::
+     DuckDBCopyFunctionSinkInfo
+     {- ^
+
+          [__@info@__]: The sink info provided to the sink function
+
+          __C declaration:__ @info@
+     -}
+  -> IO (BG.Ptr BG.Void)
+c_duckdb_copy_function_sink_get_bind_data =
+  hs_bindgen_0625cce1f60f4400
+
+-- __unique:__ @Database_DuckDB_FFI_Database.DuckDB.FFI_Safe_duckdb_copy_function_sink_get_global_state@
+foreign import ccall safe "hs_bindgen_32ac91dc1a40c2e1" hs_bindgen_32ac91dc1a40c2e1_base ::
+     BG.Ptr BG.Void
+  -> IO (BG.Ptr BG.Void)
+
+-- __unique:__ @Database_DuckDB_FFI_Database.DuckDB.FFI_Safe_duckdb_copy_function_sink_get_global_state@
+hs_bindgen_32ac91dc1a40c2e1 ::
+     DuckDBCopyFunctionSinkInfo
+  -> IO (BG.Ptr BG.Void)
+hs_bindgen_32ac91dc1a40c2e1 =
+  \x0 ->
+    fmap BG.fromFFIType (hs_bindgen_32ac91dc1a40c2e1_base (BG.toFFIType x0))
+
+{-| Retrieves the global state provided during the init-phase of a @COPY ... TO@ function.
+
+    history:
+
+    * unstable: v1.5.0
+
+    * stable: v1.5.6
+
+    [__@info@__]: The sink info provided to the sink function
+
+    __Returns:__ void*
+
+    __C declaration:__ @duckdb_copy_function_sink_get_global_state@
+
+    __defined at:__ @duckdb.h 4234:20@
+
+    __exported by:__ @duckdb.h@
+-}
+c_duckdb_copy_function_sink_get_global_state ::
+     DuckDBCopyFunctionSinkInfo
+     {- ^
+
+          [__@info@__]: The sink info provided to the sink function
+
+          __C declaration:__ @info@
+     -}
+  -> IO (BG.Ptr BG.Void)
+c_duckdb_copy_function_sink_get_global_state =
+  hs_bindgen_32ac91dc1a40c2e1
+
+-- __unique:__ @Database_DuckDB_FFI_Database.DuckDB.FFI_Safe_duckdb_copy_function_set_finalize@
+foreign import ccall safe "hs_bindgen_1aeb2ff33a42eb52" hs_bindgen_1aeb2ff33a42eb52_base ::
+     BG.Ptr BG.Void
+  -> BG.FunPtr BG.Void
+  -> IO ()
+
+-- __unique:__ @Database_DuckDB_FFI_Database.DuckDB.FFI_Safe_duckdb_copy_function_set_finalize@
+hs_bindgen_1aeb2ff33a42eb52 ::
+     DuckDBCopyFunction
+  -> DuckDBCopyFunctionFinalizeFun
+  -> IO ()
+hs_bindgen_1aeb2ff33a42eb52 =
+  \x0 ->
+    \x1 ->
+      hs_bindgen_1aeb2ff33a42eb52_base (BG.toFFIType x0) (BG.toFFIType x1)
+
+{-| Sets the finalize function of the copy function, called at the end of @COPY ... TO@ .
+
+    history:
+
+    * unstable: v1.5.0
+
+    * stable: v1.5.6
+
+    [__@copy_function@__]:
+
+    [__@finalize@__]: The finalize function
+
+    __Returns:__ void
+
+    __C declaration:__ @duckdb_copy_function_set_finalize@
+
+    __defined at:__ @duckdb.h 4249:19@
+
+    __exported by:__ @duckdb.h@
+-}
+c_duckdb_copy_function_set_finalize ::
+     DuckDBCopyFunction
+     {- ^
+
+          [__@copy_function@__]:
+
+          __C declaration:__ @copy_function@
+     -}
+  -> DuckDBCopyFunctionFinalizeFun
+     {- ^
+
+          [__@finalize@__]: The finalize function
+
+          __C declaration:__ @finalize@
+     -}
+  -> IO ()
+c_duckdb_copy_function_set_finalize =
+  hs_bindgen_1aeb2ff33a42eb52
+
+-- __unique:__ @Database_DuckDB_FFI_Database.DuckDB.FFI_Safe_duckdb_copy_function_finalize_set_error@
+foreign import ccall safe "hs_bindgen_1aff575b0b5aa442" hs_bindgen_1aff575b0b5aa442_base ::
+     BG.Ptr BG.Void
+  -> BG.Ptr BG.Void
+  -> IO ()
+
+-- __unique:__ @Database_DuckDB_FFI_Database.DuckDB.FFI_Safe_duckdb_copy_function_finalize_set_error@
+hs_bindgen_1aff575b0b5aa442 ::
+     DuckDBCopyFunctionFinalizeInfo
+  -> PtrConst.PtrConst BG.CChar
+  -> IO ()
+hs_bindgen_1aff575b0b5aa442 =
+  \x0 ->
+    \x1 ->
+      hs_bindgen_1aff575b0b5aa442_base (BG.toFFIType x0) (BG.toFFIType x1)
+
+{-| Report that an error occurred during the finalize-phase of a @COPY ... TO@ function
+
+    history:
+
+    * unstable: v1.5.0
+
+    * stable: v1.5.6
+
+    [__@info@__]: The finalize info provided to the finalize function
+
+    [__@error@__]: The error message
+
+    __Returns:__ void
+
+    __C declaration:__ @duckdb_copy_function_finalize_set_error@
+
+    __defined at:__ @duckdb.h 4265:19@
+
+    __exported by:__ @duckdb.h@
+-}
+c_duckdb_copy_function_finalize_set_error ::
+     DuckDBCopyFunctionFinalizeInfo
+     {- ^
+
+          [__@info@__]: The finalize info provided to the finalize function
+
+          __C declaration:__ @info@
+     -}
+  -> PtrConst.PtrConst BG.CChar
+     {- ^
+
+          [__@error@__]: The error message
+
+          __C declaration:__ @error@
+     -}
+  -> IO ()
+c_duckdb_copy_function_finalize_set_error =
+  hs_bindgen_1aff575b0b5aa442
+
+-- __unique:__ @Database_DuckDB_FFI_Database.DuckDB.FFI_Safe_duckdb_copy_function_finalize_get_extra_info@
+foreign import ccall safe "hs_bindgen_eac875bdda3d01f5" hs_bindgen_eac875bdda3d01f5_base ::
+     BG.Ptr BG.Void
+  -> IO (BG.Ptr BG.Void)
+
+-- __unique:__ @Database_DuckDB_FFI_Database.DuckDB.FFI_Safe_duckdb_copy_function_finalize_get_extra_info@
+hs_bindgen_eac875bdda3d01f5 ::
+     DuckDBCopyFunctionFinalizeInfo
+  -> IO (BG.Ptr BG.Void)
+hs_bindgen_eac875bdda3d01f5 =
+  \x0 ->
+    fmap BG.fromFFIType (hs_bindgen_eac875bdda3d01f5_base (BG.toFFIType x0))
+
+{-| Retrieves the extra info pointer of the copy function.
+
+    history:
+
+    * unstable: v1.5.0
+
+    * stable: v1.5.6
+
+    [__@info@__]: The finalize info provided to the finalize function
+
+    __Returns:__ void*
+
+    __C declaration:__ @duckdb_copy_function_finalize_get_extra_info@
+
+    __defined at:__ @duckdb.h 4279:20@
+
+    __exported by:__ @duckdb.h@
+-}
+c_duckdb_copy_function_finalize_get_extra_info ::
+     DuckDBCopyFunctionFinalizeInfo
+     {- ^
+
+          [__@info@__]: The finalize info provided to the finalize function
+
+          __C declaration:__ @info@
+     -}
+  -> IO (BG.Ptr BG.Void)
+c_duckdb_copy_function_finalize_get_extra_info =
+  hs_bindgen_eac875bdda3d01f5
+
+-- __unique:__ @Database_DuckDB_FFI_Database.DuckDB.FFI_Safe_duckdb_copy_function_finalize_get_client_context@
+foreign import ccall safe "hs_bindgen_624069d2f8a39d84" hs_bindgen_624069d2f8a39d84_base ::
+     BG.Ptr BG.Void
+  -> IO (BG.Ptr BG.Void)
+
+-- __unique:__ @Database_DuckDB_FFI_Database.DuckDB.FFI_Safe_duckdb_copy_function_finalize_get_client_context@
+hs_bindgen_624069d2f8a39d84 ::
+     DuckDBCopyFunctionFinalizeInfo
+  -> IO DuckDBClientContext
+hs_bindgen_624069d2f8a39d84 =
+  \x0 ->
+    fmap BG.fromFFIType (hs_bindgen_624069d2f8a39d84_base (BG.toFFIType x0))
+
+{-| Retrieves the client context of the current connection during the finalize-phase of the @COPY ... TO@ function.
+
+    Must be destroyed with @'c_duckdb_destroy_client_context'@
+
+    history:
+
+    * unstable: v1.5.0
+
+    * stable: v1.5.6
+
+    [__@info@__]: The finalize info provided to the finalize function
+
+    __Returns:__ t'DuckDBClientContext'
+
+    __C declaration:__ @duckdb_copy_function_finalize_get_client_context@
+
+    __defined at:__ @duckdb.h 4296:1@
+
+    __exported by:__ @duckdb.h@
+-}
+c_duckdb_copy_function_finalize_get_client_context ::
+     DuckDBCopyFunctionFinalizeInfo
+     {- ^
+
+          [__@info@__]: The finalize info provided to the finalize function
+
+          __C declaration:__ @info@
+     -}
+  -> IO DuckDBClientContext
+c_duckdb_copy_function_finalize_get_client_context =
+  hs_bindgen_624069d2f8a39d84
+
+-- __unique:__ @Database_DuckDB_FFI_Database.DuckDB.FFI_Safe_duckdb_copy_function_finalize_get_bind_data@
+foreign import ccall safe "hs_bindgen_3557b4da41c1a1b9" hs_bindgen_3557b4da41c1a1b9_base ::
+     BG.Ptr BG.Void
+  -> IO (BG.Ptr BG.Void)
+
+-- __unique:__ @Database_DuckDB_FFI_Database.DuckDB.FFI_Safe_duckdb_copy_function_finalize_get_bind_data@
+hs_bindgen_3557b4da41c1a1b9 ::
+     DuckDBCopyFunctionFinalizeInfo
+  -> IO (BG.Ptr BG.Void)
+hs_bindgen_3557b4da41c1a1b9 =
+  \x0 ->
+    fmap BG.fromFFIType (hs_bindgen_3557b4da41c1a1b9_base (BG.toFFIType x0))
+
+{-| Retrieves the bind data provided during the binding-phase of a @COPY ... TO@ function.
+
+    history:
+
+    * unstable: v1.5.0
+
+    * stable: v1.5.6
+
+    [__@info@__]: The finalize info provided to the finalize function
+
+    __Returns:__ void*
+
+    __C declaration:__ @duckdb_copy_function_finalize_get_bind_data@
+
+    __defined at:__ @duckdb.h 4310:20@
+
+    __exported by:__ @duckdb.h@
+-}
+c_duckdb_copy_function_finalize_get_bind_data ::
+     DuckDBCopyFunctionFinalizeInfo
+     {- ^
+
+          [__@info@__]: The finalize info provided to the finalize function
+
+          __C declaration:__ @info@
+     -}
+  -> IO (BG.Ptr BG.Void)
+c_duckdb_copy_function_finalize_get_bind_data =
+  hs_bindgen_3557b4da41c1a1b9
+
+-- __unique:__ @Database_DuckDB_FFI_Database.DuckDB.FFI_Safe_duckdb_copy_function_finalize_get_global_state@
+foreign import ccall safe "hs_bindgen_33a78a386647fcda" hs_bindgen_33a78a386647fcda_base ::
+     BG.Ptr BG.Void
+  -> IO (BG.Ptr BG.Void)
+
+-- __unique:__ @Database_DuckDB_FFI_Database.DuckDB.FFI_Safe_duckdb_copy_function_finalize_get_global_state@
+hs_bindgen_33a78a386647fcda ::
+     DuckDBCopyFunctionFinalizeInfo
+  -> IO (BG.Ptr BG.Void)
+hs_bindgen_33a78a386647fcda =
+  \x0 ->
+    fmap BG.fromFFIType (hs_bindgen_33a78a386647fcda_base (BG.toFFIType x0))
+
+{-| Retrieves the global state provided during the init-phase of a @COPY ... TO@ function.
+
+    history:
+
+    * unstable: v1.5.0
+
+    * stable: v1.5.6
+
+    [__@info@__]: The finalize info provided to the finalize function
+
+    __Returns:__ void*
+
+    __C declaration:__ @duckdb_copy_function_finalize_get_global_state@
+
+    __defined at:__ @duckdb.h 4324:20@
+
+    __exported by:__ @duckdb.h@
+-}
+c_duckdb_copy_function_finalize_get_global_state ::
+     DuckDBCopyFunctionFinalizeInfo
+     {- ^
+
+          [__@info@__]: The finalize info provided to the finalize function
+
+          __C declaration:__ @info@
+     -}
+  -> IO (BG.Ptr BG.Void)
+c_duckdb_copy_function_finalize_get_global_state =
+  hs_bindgen_33a78a386647fcda
+
+-- __unique:__ @Database_DuckDB_FFI_Database.DuckDB.FFI_Safe_duckdb_copy_function_set_copy_from_function@
+foreign import ccall safe "hs_bindgen_168dd94dc4472ecc" hs_bindgen_168dd94dc4472ecc_base ::
+     BG.Ptr BG.Void
+  -> BG.Ptr BG.Void
+  -> IO ()
+
+-- __unique:__ @Database_DuckDB_FFI_Database.DuckDB.FFI_Safe_duckdb_copy_function_set_copy_from_function@
+hs_bindgen_168dd94dc4472ecc ::
+     DuckDBCopyFunction
+  -> DuckDBTableFunction
+  -> IO ()
+hs_bindgen_168dd94dc4472ecc =
+  \x0 ->
+    \x1 ->
+      hs_bindgen_168dd94dc4472ecc_base (BG.toFFIType x0) (BG.toFFIType x1)
+
+{-| Sets the table function to use when executing a @COPY ... FROM (...)@ statement with this copy function.
+
+    The table function must have a @t'DuckDBTableFunctionBindFun'@ , @t'DuckDBTableFunctionInitFun'@ and @t'DuckDBTableFunctionFun'@ set.
+
+    The table function must take a single VARCHAR parameter (the file path).
+
+    Options passed to the @COPY ... FROM (...)@ statement are forwarded as named parameters to the table function.
+
+    Since @COPY ... FROM@ copies into an already existing table, the table function should not define its own result columns using @'c_duckdb_bind_add_result_column'@ when binding . Instead use @'c_duckdb_table_function_bind_get_result_column_count'@ and related functions in the bind callback of the table function to retrieve the schema of the target table of the @COPY ... FROM@ statement.
+
+    history:
+
+    * unstable: v1.5.0
+
+    * stable: v1.5.6
+
+    [__@copy_function@__]: The copy function
+
+    [__@table_function@__]: The table function to use for @COPY ... FROM@
+
+    __Returns:__ void
+
+    __C declaration:__ @duckdb_copy_function_set_copy_from_function@
+
+    __defined at:__ @duckdb.h 4351:19@
+
+    __exported by:__ @duckdb.h@
+-}
+c_duckdb_copy_function_set_copy_from_function ::
+     DuckDBCopyFunction
+     {- ^
+
+          [__@copy_function@__]: The copy function
+
+          __C declaration:__ @copy_function@
+     -}
+  -> DuckDBTableFunction
+     {- ^
+
+          [__@table_function@__]: The table function to use for @COPY ... FROM@
+
+          __C declaration:__ @table_function@
+     -}
+  -> IO ()
+c_duckdb_copy_function_set_copy_from_function =
+  hs_bindgen_168dd94dc4472ecc
+
+-- __unique:__ @Database_DuckDB_FFI_Database.DuckDB.FFI_Safe_duckdb_create_data_chunk@
+foreign import ccall safe "hs_bindgen_efb394485fc6a2bf" hs_bindgen_efb394485fc6a2bf_base ::
+     BG.Ptr BG.Void
+  -> HsBindgen.Runtime.LibC.Word64
+  -> IO (BG.Ptr BG.Void)
+
+-- __unique:__ @Database_DuckDB_FFI_Database.DuckDB.FFI_Safe_duckdb_create_data_chunk@
+hs_bindgen_efb394485fc6a2bf ::
+     BG.Ptr DuckDBLogicalType
+  -> DuckDBIdx
+  -> IO DuckDBDataChunk
+hs_bindgen_efb394485fc6a2bf =
+  \x0 ->
+    \x1 ->
+      fmap BG.fromFFIType (hs_bindgen_efb394485fc6a2bf_base (BG.toFFIType x0) (BG.toFFIType x1))
+
+{-| Creates an empty data chunk with the specified column types. The result must be destroyed with @'c_duckdb_destroy_data_chunk'@ .
+
+    history:
+
+    * stable: v0.3.3
+
+    [__@types@__]: An array of column types. Column types can not contain ANY and INVALID types.
+
+    [__@column_count@__]: The number of columns.
+
+    __Returns:__ t'DuckDBDataChunk'
+
+    __C declaration:__ @duckdb_create_data_chunk@
+
+    __defined at:__ @duckdb.h 4385:32@
+
+    __exported by:__ @duckdb.h@
+-}
+c_duckdb_create_data_chunk ::
+     BG.Ptr DuckDBLogicalType
+     {- ^
+
+          [__@types@__]: An array of column types. Column types can not contain ANY and INVALID types.
+
+          __C declaration:__ @types@
+     -}
+  -> DuckDBIdx
+     {- ^
+
+          [__@column_count@__]: The number of columns.
+
+          __C declaration:__ @column_count@
+     -}
+  -> IO DuckDBDataChunk
+c_duckdb_create_data_chunk =
+  hs_bindgen_efb394485fc6a2bf
+
+-- __unique:__ @Database_DuckDB_FFI_Database.DuckDB.FFI_Safe_duckdb_destroy_data_chunk@
+foreign import ccall safe "hs_bindgen_008e9a01c51088d0" hs_bindgen_008e9a01c51088d0_base ::
+     BG.Ptr BG.Void
+  -> IO ()
+
+-- __unique:__ @Database_DuckDB_FFI_Database.DuckDB.FFI_Safe_duckdb_destroy_data_chunk@
+hs_bindgen_008e9a01c51088d0 ::
+     BG.Ptr DuckDBDataChunk
+  -> IO ()
+hs_bindgen_008e9a01c51088d0 =
+  \x0 ->
+    hs_bindgen_008e9a01c51088d0_base (BG.toFFIType x0)
+
+{-| Destroys the data chunk and de-allocates all memory allocated for that chunk.
+
+    history:
+
+    * stable: v0.3.3
+
+    [__@chunk@__]: The data chunk to destroy.
+
+    __Returns:__ void
+
+    __C declaration:__ @duckdb_destroy_data_chunk@
+
+    __defined at:__ @duckdb.h 4398:19@
+
+    __exported by:__ @duckdb.h@
+-}
+c_duckdb_destroy_data_chunk ::
+     BG.Ptr DuckDBDataChunk
+     {- ^
+
+          [__@chunk@__]: The data chunk to destroy.
+
+          __C declaration:__ @chunk@
+     -}
+  -> IO ()
+c_duckdb_destroy_data_chunk =
+  hs_bindgen_008e9a01c51088d0
+
+-- __unique:__ @Database_DuckDB_FFI_Database.DuckDB.FFI_Safe_duckdb_data_chunk_reset@
+foreign import ccall safe "hs_bindgen_f0ed12c45e7de137" hs_bindgen_f0ed12c45e7de137_base ::
+     BG.Ptr BG.Void
+  -> IO ()
+
+-- __unique:__ @Database_DuckDB_FFI_Database.DuckDB.FFI_Safe_duckdb_data_chunk_reset@
+hs_bindgen_f0ed12c45e7de137 ::
+     DuckDBDataChunk
+  -> IO ()
+hs_bindgen_f0ed12c45e7de137 =
+  \x0 ->
+    hs_bindgen_f0ed12c45e7de137_base (BG.toFFIType x0)
+
+{-| Resets a data chunk, clearing the validity masks and setting the cardinality of the data chunk to 0. After calling this method, you must call @'c_duckdb_vector_get_validity'@ and @'c_duckdb_vector_get_data'@ to obtain current data and validity pointers
+
+    history:
+
+    * stable: v0.3.3
+
+    [__@chunk@__]: The data chunk to reset.
+
+    __Returns:__ void
+
+    __C declaration:__ @duckdb_data_chunk_reset@
+
+    __defined at:__ @duckdb.h 4413:19@
+
+    __exported by:__ @duckdb.h@
+-}
+c_duckdb_data_chunk_reset ::
+     DuckDBDataChunk
+     {- ^
+
+          [__@chunk@__]: The data chunk to reset.
+
+          __C declaration:__ @chunk@
+     -}
+  -> IO ()
+c_duckdb_data_chunk_reset =
+  hs_bindgen_f0ed12c45e7de137
+
+-- __unique:__ @Database_DuckDB_FFI_Database.DuckDB.FFI_Safe_duckdb_data_chunk_get_column_count@
+foreign import ccall safe "hs_bindgen_46e003c5051990e9" hs_bindgen_46e003c5051990e9_base ::
+     BG.Ptr BG.Void
+  -> IO HsBindgen.Runtime.LibC.Word64
+
+-- __unique:__ @Database_DuckDB_FFI_Database.DuckDB.FFI_Safe_duckdb_data_chunk_get_column_count@
+hs_bindgen_46e003c5051990e9 ::
+     DuckDBDataChunk
+  -> IO DuckDBIdx
+hs_bindgen_46e003c5051990e9 =
+  \x0 ->
+    fmap BG.fromFFIType (hs_bindgen_46e003c5051990e9_base (BG.toFFIType x0))
+
+{-| Retrieves the number of columns in a data chunk.
+
+    history:
+
+    * stable: v0.3.3
+
+    [__@chunk@__]: The data chunk to get the data from
+
+    __Returns:__ t'DuckDBIdx'
+
+    __C declaration:__ @duckdb_data_chunk_get_column_count@
+
+    __defined at:__ @duckdb.h 4426:20@
+
+    __exported by:__ @duckdb.h@
+-}
+c_duckdb_data_chunk_get_column_count ::
+     DuckDBDataChunk
+     {- ^
+
+          [__@chunk@__]: The data chunk to get the data from
+
+          __C declaration:__ @chunk@
+     -}
+  -> IO DuckDBIdx
+c_duckdb_data_chunk_get_column_count =
+  hs_bindgen_46e003c5051990e9
+
+-- __unique:__ @Database_DuckDB_FFI_Database.DuckDB.FFI_Safe_duckdb_data_chunk_get_vector@
+foreign import ccall safe "hs_bindgen_e612eec3607eea8a" hs_bindgen_e612eec3607eea8a_base ::
+     BG.Ptr BG.Void
+  -> HsBindgen.Runtime.LibC.Word64
+  -> IO (BG.Ptr BG.Void)
+
+-- __unique:__ @Database_DuckDB_FFI_Database.DuckDB.FFI_Safe_duckdb_data_chunk_get_vector@
+hs_bindgen_e612eec3607eea8a ::
+     DuckDBDataChunk
+  -> DuckDBIdx
+  -> IO DuckDBVector
+hs_bindgen_e612eec3607eea8a =
+  \x0 ->
+    \x1 ->
+      fmap BG.fromFFIType (hs_bindgen_e612eec3607eea8a_base (BG.toFFIType x0) (BG.toFFIType x1))
+
+{-| Retrieves the vector at the specified column index in the data chunk.
+
+    The pointer to the vector is valid for as long as the chunk is alive. It does NOT need to be destroyed.
+
+    history:
+
+    * stable: v0.3.3
+
+    [__@chunk@__]: The data chunk to get the data from
+
+    [__@col_idx@__]:
+
+    __Returns:__ t'DuckDBVector'
+
+    __C declaration:__ @duckdb_data_chunk_get_vector@
+
+    __defined at:__ @duckdb.h 4442:28@
+
+    __exported by:__ @duckdb.h@
+-}
+c_duckdb_data_chunk_get_vector ::
+     DuckDBDataChunk
+     {- ^
+
+          [__@chunk@__]: The data chunk to get the data from
+
+          __C declaration:__ @chunk@
+     -}
+  -> DuckDBIdx
+     {- ^
+
+          [__@col_idx@__]:
+
+          __C declaration:__ @col_idx@
+     -}
+  -> IO DuckDBVector
+c_duckdb_data_chunk_get_vector =
+  hs_bindgen_e612eec3607eea8a
+
+-- __unique:__ @Database_DuckDB_FFI_Database.DuckDB.FFI_Safe_duckdb_data_chunk_get_size@
+foreign import ccall safe "hs_bindgen_ff8f64d484345bc6" hs_bindgen_ff8f64d484345bc6_base ::
+     BG.Ptr BG.Void
+  -> IO HsBindgen.Runtime.LibC.Word64
+
+-- __unique:__ @Database_DuckDB_FFI_Database.DuckDB.FFI_Safe_duckdb_data_chunk_get_size@
+hs_bindgen_ff8f64d484345bc6 ::
+     DuckDBDataChunk
+  -> IO DuckDBIdx
+hs_bindgen_ff8f64d484345bc6 =
+  \x0 ->
+    fmap BG.fromFFIType (hs_bindgen_ff8f64d484345bc6_base (BG.toFFIType x0))
+
+{-| Retrieves the current number of tuples in a data chunk.
+
+    history:
+
+    * stable: v0.3.3
+
+    [__@chunk@__]: The data chunk to get the data from
+
+    __Returns:__ t'DuckDBIdx'
+
+    __C declaration:__ @duckdb_data_chunk_get_size@
+
+    __defined at:__ @duckdb.h 4455:20@
+
+    __exported by:__ @duckdb.h@
+-}
+c_duckdb_data_chunk_get_size ::
+     DuckDBDataChunk
+     {- ^
+
+          [__@chunk@__]: The data chunk to get the data from
+
+          __C declaration:__ @chunk@
+     -}
+  -> IO DuckDBIdx
+c_duckdb_data_chunk_get_size =
+  hs_bindgen_ff8f64d484345bc6
+
+-- __unique:__ @Database_DuckDB_FFI_Database.DuckDB.FFI_Safe_duckdb_data_chunk_set_size@
+foreign import ccall safe "hs_bindgen_2dd65b55bf219b31" hs_bindgen_2dd65b55bf219b31_base ::
+     BG.Ptr BG.Void
+  -> HsBindgen.Runtime.LibC.Word64
+  -> IO ()
+
+-- __unique:__ @Database_DuckDB_FFI_Database.DuckDB.FFI_Safe_duckdb_data_chunk_set_size@
+hs_bindgen_2dd65b55bf219b31 ::
+     DuckDBDataChunk
+  -> DuckDBIdx
+  -> IO ()
+hs_bindgen_2dd65b55bf219b31 =
+  \x0 ->
+    \x1 ->
+      hs_bindgen_2dd65b55bf219b31_base (BG.toFFIType x0) (BG.toFFIType x1)
+
+{-| Sets the current number of tuples in a data chunk.
+
+    history:
+
+    * stable: v0.3.3
+
+    [__@chunk@__]: The data chunk to set the size in
+
+    [__@size@__]: The number of tuples in the data chunk
+
+    __Returns:__ void
+
+    __C declaration:__ @duckdb_data_chunk_set_size@
+
+    __defined at:__ @duckdb.h 4469:19@
+
+    __exported by:__ @duckdb.h@
+-}
+c_duckdb_data_chunk_set_size ::
+     DuckDBDataChunk
+     {- ^
+
+          [__@chunk@__]: The data chunk to set the size in
+
+          __C declaration:__ @chunk@
+     -}
+  -> DuckDBIdx
+     {- ^
+
+          [__@size@__]: The number of tuples in the data chunk
+
+          __C declaration:__ @size@
+     -}
+  -> IO ()
+c_duckdb_data_chunk_set_size =
+  hs_bindgen_2dd65b55bf219b31
+
+-- __unique:__ @Database_DuckDB_FFI_Database.DuckDB.FFI_Safe_duckdb_create_instance_cache@
+foreign import ccall safe "hs_bindgen_af9dc862cc92484d" hs_bindgen_af9dc862cc92484d_base ::
+     IO (BG.Ptr BG.Void)
+
+-- __unique:__ @Database_DuckDB_FFI_Database.DuckDB.FFI_Safe_duckdb_create_instance_cache@
+hs_bindgen_af9dc862cc92484d :: IO DuckDBInstanceCache
+hs_bindgen_af9dc862cc92484d =
+  fmap BG.fromFFIType hs_bindgen_af9dc862cc92484d_base
+
+{-| Creates a new database instance cache. The instance cache is necessary if a client/program (re)opens multiple databases to the same file within the same process. Must be destroyed with \'duckdb_destroy_instance_cache\'.
+
+    history:
+
+    * unstable: v1.2.0
+
+    * stable: v1.5.6
+
+    __Returns:__ t'DuckDBInstanceCache'
+
+    __C declaration:__ @duckdb_create_instance_cache@
+
+    __defined at:__ @duckdb.h 4501:36@
+
+    __exported by:__ @duckdb.h@
+-}
+c_duckdb_create_instance_cache :: IO DuckDBInstanceCache
+c_duckdb_create_instance_cache =
+  hs_bindgen_af9dc862cc92484d
+
+-- __unique:__ @Database_DuckDB_FFI_Database.DuckDB.FFI_Safe_duckdb_get_or_create_from_cache@
+foreign import ccall safe "hs_bindgen_498dcd484fdb2257" hs_bindgen_498dcd484fdb2257_base ::
+     BG.Ptr BG.Void
+  -> BG.Ptr BG.Void
+  -> BG.Ptr BG.Void
+  -> BG.Ptr BG.Void
+  -> BG.Ptr BG.Void
+  -> IO BG.CUInt
+
+-- __unique:__ @Database_DuckDB_FFI_Database.DuckDB.FFI_Safe_duckdb_get_or_create_from_cache@
+hs_bindgen_498dcd484fdb2257 ::
+     DuckDBInstanceCache
+  -> PtrConst.PtrConst BG.CChar
+  -> BG.Ptr DuckDBDatabase
+  -> DuckDBConfig
+  -> BG.Ptr (BG.Ptr BG.CChar)
+  -> IO DuckDBState
+hs_bindgen_498dcd484fdb2257 =
+  \x0 ->
+    \x1 ->
+      \x2 ->
+        \x3 ->
+          \x4 ->
+            fmap BG.fromFFIType (hs_bindgen_498dcd484fdb2257_base (BG.toFFIType x0) (BG.toFFIType x1) (BG.toFFIType x2) (BG.toFFIType x3) (BG.toFFIType x4))
+
+{-| Creates a new database instance in the instance cache, or retrieves an existing database instance. Must be closed with \'duckdb_close\'.
+
+    history:
+
+    * unstable: v1.2.0
+
+    * stable: v1.5.6
+
+    [__@instance_cache@__]: The instance cache in which to create the database, or from which to take the database.
+
+    [__@path@__]: Path to the database file on disk. Both @nullptr@ and @:memory:@ open or retrieve an in-memory database.
+
+    [__@out_database@__]: The resulting cached database.
+
+    [__@config@__]: (Optional) configuration used to create the database.
+
+    [__@out_error@__]: If set and the function returns @@DuckDBError@@ , this contains the error message. Note that the error message must be freed using @'c_duckdb_free'@ .
+
+    __Returns:__ t'DuckDBState'
+
+    __C declaration:__ @duckdb_get_or_create_from_cache@
+
+    __defined at:__ @duckdb.h 4521:27@
+
+    __exported by:__ @duckdb.h@
+-}
+c_duckdb_get_or_create_from_cache ::
+     DuckDBInstanceCache
+     {- ^
+
+          [__@instance_cache@__]: The instance cache in which to create the database, or from which to take the database.
+
+          __C declaration:__ @instance_cache@
+     -}
+  -> PtrConst.PtrConst BG.CChar
+     {- ^
+
+          [__@path@__]: Path to the database file on disk. Both @nullptr@ and @:memory:@ open or retrieve an in-memory database.
+
+          __C declaration:__ @path@
+     -}
+  -> BG.Ptr DuckDBDatabase
+     {- ^
+
+          [__@out_database@__]: The resulting cached database.
+
+          __C declaration:__ @out_database@
+     -}
+  -> DuckDBConfig
+     {- ^
+
+          [__@config@__]: (Optional) configuration used to create the database.
+
+          __C declaration:__ @config@
+     -}
+  -> BG.Ptr (BG.Ptr BG.CChar)
+     {- ^
+
+          [__@out_error@__]: If set and the function returns @@DuckDBError@@ , this contains the error message. Note that the error message must be freed using @'c_duckdb_free'@ .
+
+          __C declaration:__ @out_error@
+     -}
+  -> IO DuckDBState
+c_duckdb_get_or_create_from_cache =
+  hs_bindgen_498dcd484fdb2257
+
+-- __unique:__ @Database_DuckDB_FFI_Database.DuckDB.FFI_Safe_duckdb_destroy_instance_cache@
+foreign import ccall safe "hs_bindgen_4880238d117a9624" hs_bindgen_4880238d117a9624_base ::
+     BG.Ptr BG.Void
+  -> IO ()
+
+-- __unique:__ @Database_DuckDB_FFI_Database.DuckDB.FFI_Safe_duckdb_destroy_instance_cache@
+hs_bindgen_4880238d117a9624 ::
+     BG.Ptr DuckDBInstanceCache
+  -> IO ()
+hs_bindgen_4880238d117a9624 =
+  \x0 ->
+    hs_bindgen_4880238d117a9624_base (BG.toFFIType x0)
+
+{-| Destroys an existing database instance cache and de-allocates its memory.
+
+    history:
+
+    * unstable: v1.2.0
+
+    * stable: v1.5.6
+
+    [__@instance_cache@__]: The instance cache to destroy.
+
+    __Returns:__ void
+
+    __C declaration:__ @duckdb_destroy_instance_cache@
+
+    __defined at:__ @duckdb.h 4537:19@
+
+    __exported by:__ @duckdb.h@
+-}
+c_duckdb_destroy_instance_cache ::
+     BG.Ptr DuckDBInstanceCache
+     {- ^
+
+          [__@instance_cache@__]: The instance cache to destroy.
+
+          __C declaration:__ @instance_cache@
+     -}
+  -> IO ()
+c_duckdb_destroy_instance_cache =
+  hs_bindgen_4880238d117a9624
+
+-- __unique:__ @Database_DuckDB_FFI_Database.DuckDB.FFI_Safe_duckdb_open@
+foreign import ccall safe "hs_bindgen_20ccd2dffd9e2deb" hs_bindgen_20ccd2dffd9e2deb_base ::
+     BG.Ptr BG.Void
+  -> BG.Ptr BG.Void
+  -> IO BG.CUInt
+
+-- __unique:__ @Database_DuckDB_FFI_Database.DuckDB.FFI_Safe_duckdb_open@
+hs_bindgen_20ccd2dffd9e2deb ::
+     PtrConst.PtrConst BG.CChar
+  -> BG.Ptr DuckDBDatabase
+  -> IO DuckDBState
+hs_bindgen_20ccd2dffd9e2deb =
+  \x0 ->
+    \x1 ->
+      fmap BG.fromFFIType (hs_bindgen_20ccd2dffd9e2deb_base (BG.toFFIType x0) (BG.toFFIType x1))
+
+{-| Creates a new database or opens an existing database file stored at the given path. If no path is given a new in-memory database is created instead. The database must be closed with \'duckdb_close\'.
+
+    history:
+
+    * stable: v0.1.0
+
+    [__@path@__]: Path to the database file on disk. Both @nullptr@ and @:memory:@ open an in-memory database.
+
+    [__@out_database@__]: The result database object.
+
+    __Returns:__ t'DuckDBState'
+
+    __C declaration:__ @duckdb_open@
+
+    __defined at:__ @duckdb.h 4551:27@
+
+    __exported by:__ @duckdb.h@
+-}
+c_duckdb_open ::
+     PtrConst.PtrConst BG.CChar
+     {- ^
+
+          [__@path@__]: Path to the database file on disk. Both @nullptr@ and @:memory:@ open an in-memory database.
+
+          __C declaration:__ @path@
+     -}
+  -> BG.Ptr DuckDBDatabase
+     {- ^
+
+          [__@out_database@__]: The result database object.
+
+          __C declaration:__ @out_database@
+     -}
+  -> IO DuckDBState
+c_duckdb_open = hs_bindgen_20ccd2dffd9e2deb
+
+-- __unique:__ @Database_DuckDB_FFI_Database.DuckDB.FFI_Safe_duckdb_open_ext@
+foreign import ccall safe "hs_bindgen_29742fa56b59b577" hs_bindgen_29742fa56b59b577_base ::
+     BG.Ptr BG.Void
+  -> BG.Ptr BG.Void
+  -> BG.Ptr BG.Void
+  -> BG.Ptr BG.Void
+  -> IO BG.CUInt
+
+-- __unique:__ @Database_DuckDB_FFI_Database.DuckDB.FFI_Safe_duckdb_open_ext@
+hs_bindgen_29742fa56b59b577 ::
+     PtrConst.PtrConst BG.CChar
+  -> BG.Ptr DuckDBDatabase
+  -> DuckDBConfig
+  -> BG.Ptr (BG.Ptr BG.CChar)
+  -> IO DuckDBState
+hs_bindgen_29742fa56b59b577 =
+  \x0 ->
+    \x1 ->
+      \x2 ->
+        \x3 ->
+          fmap BG.fromFFIType (hs_bindgen_29742fa56b59b577_base (BG.toFFIType x0) (BG.toFFIType x1) (BG.toFFIType x2) (BG.toFFIType x3))
+
+{-| Extended version of duckdb_open. Creates a new database or opens an existing database file stored at the given path. The database must be closed with \'duckdb_close\'.
+
+    history:
+
+    * stable: v0.2.8
+
+    [__@path@__]: Path to the database file on disk. Both @nullptr@ and @:memory:@ open an in-memory database.
+
+    [__@out_database@__]: The result database object.
+
+    [__@config@__]: (Optional) configuration used to start up the database.
+
+    [__@out_error@__]: If set and the function returns @@DuckDBError@@ , this contains the error message. Note that the error message must be freed using @'c_duckdb_free'@ .
+
+    __Returns:__ t'DuckDBState'
+
+    __C declaration:__ @duckdb_open_ext@
+
+    __defined at:__ @duckdb.h 4568:27@
+
+    __exported by:__ @duckdb.h@
+-}
+c_duckdb_open_ext ::
+     PtrConst.PtrConst BG.CChar
+     {- ^
+
+          [__@path@__]: Path to the database file on disk. Both @nullptr@ and @:memory:@ open an in-memory database.
+
+          __C declaration:__ @path@
+     -}
+  -> BG.Ptr DuckDBDatabase
+     {- ^
+
+          [__@out_database@__]: The result database object.
+
+          __C declaration:__ @out_database@
+     -}
+  -> DuckDBConfig
+     {- ^
+
+          [__@config@__]: (Optional) configuration used to start up the database.
+
+          __C declaration:__ @config@
+     -}
+  -> BG.Ptr (BG.Ptr BG.CChar)
+     {- ^
+
+          [__@out_error@__]: If set and the function returns @@DuckDBError@@ , this contains the error message. Note that the error message must be freed using @'c_duckdb_free'@ .
+
+          __C declaration:__ @out_error@
+     -}
+  -> IO DuckDBState
+c_duckdb_open_ext = hs_bindgen_29742fa56b59b577
+
+-- __unique:__ @Database_DuckDB_FFI_Database.DuckDB.FFI_Safe_duckdb_close@
+foreign import ccall safe "hs_bindgen_9612218d8dfe8da0" hs_bindgen_9612218d8dfe8da0_base ::
+     BG.Ptr BG.Void
+  -> IO ()
+
+-- __unique:__ @Database_DuckDB_FFI_Database.DuckDB.FFI_Safe_duckdb_close@
+hs_bindgen_9612218d8dfe8da0 ::
+     BG.Ptr DuckDBDatabase
+  -> IO ()
+hs_bindgen_9612218d8dfe8da0 =
+  \x0 ->
+    hs_bindgen_9612218d8dfe8da0_base (BG.toFFIType x0)
+
+{-| Closes the specified database and de-allocates all memory allocated for that database. This should be called after you are done with any database allocated through @'c_duckdb_open'@ or @'c_duckdb_open_ext'@ . Note that failing to call @'c_duckdb_close'@ (in case of e.g. a program crash) will not cause data corruption. Still, it is recommended to always correctly close a database object after you are done with it.
+
+    history:
+
+    * stable: v0.1.0
+
+    [__@database@__]: The database object to shut down.
+
+    __Returns:__ void
+
+    __C declaration:__ @duckdb_close@
+
+    __defined at:__ @duckdb.h 4584:19@
+
+    __exported by:__ @duckdb.h@
+-}
+c_duckdb_close ::
+     BG.Ptr DuckDBDatabase
+     {- ^
+
+          [__@database@__]: The database object to shut down.
+
+          __C declaration:__ @database@
+     -}
+  -> IO ()
+c_duckdb_close = hs_bindgen_9612218d8dfe8da0
+
+-- __unique:__ @Database_DuckDB_FFI_Database.DuckDB.FFI_Safe_duckdb_library_version@
+foreign import ccall safe "hs_bindgen_6054bd05f5439f26" hs_bindgen_6054bd05f5439f26_base ::
+     IO (BG.Ptr BG.Void)
+
+-- __unique:__ @Database_DuckDB_FFI_Database.DuckDB.FFI_Safe_duckdb_library_version@
+hs_bindgen_6054bd05f5439f26 :: IO (PtrConst.PtrConst BG.CChar)
+hs_bindgen_6054bd05f5439f26 =
+  fmap BG.fromFFIType hs_bindgen_6054bd05f5439f26_base
+
+{-| Returns the version of the linked DuckDB, with a version postfix for dev versions
+
+    Usually used for developing C extensions that must return this for a compatibility check.
+
+    history:
+
+    * stable: v0.6.0
+
+    __Returns:__ const char*
+
+    __C declaration:__ @duckdb_library_version@
+
+    __defined at:__ @duckdb.h 4597:26@
+
+    __exported by:__ @duckdb.h@
+-}
+c_duckdb_library_version :: IO (PtrConst.PtrConst BG.CChar)
+c_duckdb_library_version =
+  hs_bindgen_6054bd05f5439f26
+
+-- __unique:__ @Database_DuckDB_FFI_Database.DuckDB.FFI_Safe_duckdb_create_config@
+foreign import ccall safe "hs_bindgen_9952cdd696ea9b64" hs_bindgen_9952cdd696ea9b64_base ::
+     BG.Ptr BG.Void
+  -> IO BG.CUInt
+
+-- __unique:__ @Database_DuckDB_FFI_Database.DuckDB.FFI_Safe_duckdb_create_config@
+hs_bindgen_9952cdd696ea9b64 ::
+     BG.Ptr DuckDBConfig
+  -> IO DuckDBState
+hs_bindgen_9952cdd696ea9b64 =
+  \x0 ->
+    fmap BG.fromFFIType (hs_bindgen_9952cdd696ea9b64_base (BG.toFFIType x0))
+
+{-|
+
+    Initializes an empty configuration object that can be used to provide start-up options for the DuckDB instance through @'c_duckdb_open_ext'@ . The t'DuckDBConfig' must be destroyed using \'duckdb_destroy_config\'
+
+    This will always succeed unless there is a malloc failure.
+
+    Note that @'c_duckdb_destroy_config'@ should always be called on the resulting config, even if the function returns @@DuckDBError@@ .
+
+    history:
+
+    * stable: v0.2.8
+
+    [__@out_config@__]: The result configuration object.
+
+    __Returns:__ t'DuckDBState'
+
+    __C declaration:__ @duckdb_create_config@
+
+    __defined at:__ @duckdb.h 4616:27@
+
+    __exported by:__ @duckdb.h@
+-}
+c_duckdb_create_config ::
+     BG.Ptr DuckDBConfig
+     {- ^
+
+          [__@out_config@__]: The result configuration object.
+
+          __C declaration:__ @out_config@
+     -}
+  -> IO DuckDBState
+c_duckdb_create_config = hs_bindgen_9952cdd696ea9b64
+
+-- __unique:__ @Database_DuckDB_FFI_Database.DuckDB.FFI_Safe_duckdb_config_count@
+foreign import ccall safe "hs_bindgen_716854cee27243ac" hs_bindgen_716854cee27243ac_base ::
+     IO HsBindgen.Runtime.LibC.CSize
+
+-- __unique:__ @Database_DuckDB_FFI_Database.DuckDB.FFI_Safe_duckdb_config_count@
+hs_bindgen_716854cee27243ac :: IO HsBindgen.Runtime.LibC.CSize
+hs_bindgen_716854cee27243ac =
+  fmap BG.fromFFIType hs_bindgen_716854cee27243ac_base
+
+{-| This returns the total amount of configuration options available for usage with @'c_duckdb_get_config_flag'@ .
+
+    This should not be called in a loop as it internally loops over all the options.
+
+    history:
+
+    * stable: v0.2.8
+
+    __Returns:__ size_t
+
+    __C declaration:__ @duckdb_config_count@
+
+    __defined at:__ @duckdb.h 4630:21@
+
+    __exported by:__ @duckdb.h@
+-}
+c_duckdb_config_count :: IO HsBindgen.Runtime.LibC.CSize
+c_duckdb_config_count = hs_bindgen_716854cee27243ac
+
+-- __unique:__ @Database_DuckDB_FFI_Database.DuckDB.FFI_Safe_duckdb_get_config_flag@
+foreign import ccall safe "hs_bindgen_9c4946fb7bbd79d4" hs_bindgen_9c4946fb7bbd79d4_base ::
+     HsBindgen.Runtime.LibC.CSize
+  -> BG.Ptr BG.Void
+  -> BG.Ptr BG.Void
+  -> IO BG.CUInt
+
+-- __unique:__ @Database_DuckDB_FFI_Database.DuckDB.FFI_Safe_duckdb_get_config_flag@
+hs_bindgen_9c4946fb7bbd79d4 ::
+     HsBindgen.Runtime.LibC.CSize
+  -> BG.Ptr (PtrConst.PtrConst BG.CChar)
+  -> BG.Ptr (PtrConst.PtrConst BG.CChar)
+  -> IO DuckDBState
+hs_bindgen_9c4946fb7bbd79d4 =
+  \x0 ->
+    \x1 ->
+      \x2 ->
+        fmap BG.fromFFIType (hs_bindgen_9c4946fb7bbd79d4_base (BG.toFFIType x0) (BG.toFFIType x1) (BG.toFFIType x2))
+
+{-| Obtains a human-readable name and description of a specific configuration option. This can be used to e.g. display configuration options. This will succeed unless @index@ is out of range (i.e. @>= 'c_duckdb_config_count'@ ).
+
+    The result name or description MUST NOT be freed.
+
+    history:
+
+    * stable: v0.2.8
+
+    [__@index@__]: The index of the configuration option (between 0 and @'c_duckdb_config_count'@ )
+
+    [__@out_name@__]: A name of the configuration flag.
+
+    [__@out_description@__]: A description of the configuration flag.
+
+    __Returns:__ t'DuckDBState'
+
+    __C declaration:__ @duckdb_get_config_flag@
+
+    __defined at:__ @duckdb.h 4648:27@
+
+    __exported by:__ @duckdb.h@
+-}
+c_duckdb_get_config_flag ::
+     HsBindgen.Runtime.LibC.CSize
+     {- ^
+
+          [__@index@__]: The index of the configuration option (between 0 and @'c_duckdb_config_count'@ )
+
+          __C declaration:__ @index@
+     -}
+  -> BG.Ptr (PtrConst.PtrConst BG.CChar)
+     {- ^
+
+          [__@out_name@__]: A name of the configuration flag.
+
+          __C declaration:__ @out_name@
+     -}
+  -> BG.Ptr (PtrConst.PtrConst BG.CChar)
+     {- ^
+
+          [__@out_description@__]: A description of the configuration flag.
+
+          __C declaration:__ @out_description@
+     -}
+  -> IO DuckDBState
+c_duckdb_get_config_flag =
+  hs_bindgen_9c4946fb7bbd79d4
+
+-- __unique:__ @Database_DuckDB_FFI_Database.DuckDB.FFI_Safe_duckdb_set_config@
+foreign import ccall safe "hs_bindgen_1d6e19093e0033ae" hs_bindgen_1d6e19093e0033ae_base ::
+     BG.Ptr BG.Void
+  -> BG.Ptr BG.Void
+  -> BG.Ptr BG.Void
+  -> IO BG.CUInt
+
+-- __unique:__ @Database_DuckDB_FFI_Database.DuckDB.FFI_Safe_duckdb_set_config@
+hs_bindgen_1d6e19093e0033ae ::
+     DuckDBConfig
+  -> PtrConst.PtrConst BG.CChar
+  -> PtrConst.PtrConst BG.CChar
+  -> IO DuckDBState
+hs_bindgen_1d6e19093e0033ae =
+  \x0 ->
+    \x1 ->
+      \x2 ->
+        fmap BG.fromFFIType (hs_bindgen_1d6e19093e0033ae_base (BG.toFFIType x0) (BG.toFFIType x1) (BG.toFFIType x2))
+
+{-| Sets the specified option for the specified configuration. The configuration option is indicated by name. To obtain a list of config options, see @'c_duckdb_get_config_flag'@ .
+
+    In the source code, configuration options are defined in @config.cpp@ .
+
+    This can fail if either the name is invalid, or if the value provided for the option is invalid.
+
+    history:
+
+    * stable: v0.2.8
+
+    [__@config@__]: The configuration object to set the option on.
+
+    [__@name@__]: The name of the configuration flag to set.
+
+    [__@option@__]: The value to set the configuration flag to.
+
+    __Returns:__ t'DuckDBState'
+
+    __C declaration:__ @duckdb_set_config@
+
+    __defined at:__ @duckdb.h 4668:27@
+
+    __exported by:__ @duckdb.h@
+-}
+c_duckdb_set_config ::
+     DuckDBConfig
+     {- ^
+
+          [__@config@__]: The configuration object to set the option on.
+
+          __C declaration:__ @config@
+     -}
+  -> PtrConst.PtrConst BG.CChar
+     {- ^
+
+          [__@name@__]: The name of the configuration flag to set.
+
+          __C declaration:__ @name@
+     -}
+  -> PtrConst.PtrConst BG.CChar
+     {- ^
+
+          [__@option@__]: The value to set the configuration flag to.
+
+          __C declaration:__ @option@
+     -}
+  -> IO DuckDBState
+c_duckdb_set_config = hs_bindgen_1d6e19093e0033ae
+
+-- __unique:__ @Database_DuckDB_FFI_Database.DuckDB.FFI_Safe_duckdb_destroy_config@
+foreign import ccall safe "hs_bindgen_2de3b7a816583458" hs_bindgen_2de3b7a816583458_base ::
+     BG.Ptr BG.Void
+  -> IO ()
+
+-- __unique:__ @Database_DuckDB_FFI_Database.DuckDB.FFI_Safe_duckdb_destroy_config@
+hs_bindgen_2de3b7a816583458 ::
+     BG.Ptr DuckDBConfig
+  -> IO ()
+hs_bindgen_2de3b7a816583458 =
+  \x0 ->
+    hs_bindgen_2de3b7a816583458_base (BG.toFFIType x0)
+
+{-| Destroys the specified configuration object and de-allocates all memory allocated for the object.
+
+    history:
+
+    * stable: v0.2.8
+
+    [__@config@__]: The configuration object to destroy.
+
+    __Returns:__ void
+
+    __C declaration:__ @duckdb_destroy_config@
+
+    __defined at:__ @duckdb.h 4681:19@
+
+    __exported by:__ @duckdb.h@
+-}
+c_duckdb_destroy_config ::
+     BG.Ptr DuckDBConfig
+     {- ^
+
+          [__@config@__]: The configuration object to destroy.
+
+          __C declaration:__ @config@
+     -}
+  -> IO ()
+c_duckdb_destroy_config = hs_bindgen_2de3b7a816583458
+
+-- __unique:__ @Database_DuckDB_FFI_Database.DuckDB.FFI_Safe_duckdb_destroy_expression@
+foreign import ccall safe "hs_bindgen_b2793b95993b27a0" hs_bindgen_b2793b95993b27a0_base ::
+     BG.Ptr BG.Void
+  -> IO ()
+
+-- __unique:__ @Database_DuckDB_FFI_Database.DuckDB.FFI_Safe_duckdb_destroy_expression@
+hs_bindgen_b2793b95993b27a0 ::
+     BG.Ptr DuckDBExpression
+  -> IO ()
+hs_bindgen_b2793b95993b27a0 =
+  \x0 ->
+    hs_bindgen_b2793b95993b27a0_base (BG.toFFIType x0)
+
+{-| Destroys the expression and de-allocates its memory.
+
+    history:
+
+    * unstable: v1.4.0
+
+    * stable: v1.5.6
+
+    [__@expr@__]: A pointer to the expression.
+
+    __Returns:__ void
+
+    __C declaration:__ @duckdb_destroy_expression@
+
+    __defined at:__ @duckdb.h 4713:19@
+
+    __exported by:__ @duckdb.h@
+-}
+c_duckdb_destroy_expression ::
+     BG.Ptr DuckDBExpression
+     {- ^
+
+          [__@expr@__]: A pointer to the expression.
+
+          __C declaration:__ @expr@
+     -}
+  -> IO ()
+c_duckdb_destroy_expression =
+  hs_bindgen_b2793b95993b27a0
+
+-- __unique:__ @Database_DuckDB_FFI_Database.DuckDB.FFI_Safe_duckdb_expression_return_type@
+foreign import ccall safe "hs_bindgen_cdabf4b2938479e7" hs_bindgen_cdabf4b2938479e7_base ::
+     BG.Ptr BG.Void
+  -> IO (BG.Ptr BG.Void)
+
+-- __unique:__ @Database_DuckDB_FFI_Database.DuckDB.FFI_Safe_duckdb_expression_return_type@
+hs_bindgen_cdabf4b2938479e7 ::
+     DuckDBExpression
+  -> IO DuckDBLogicalType
+hs_bindgen_cdabf4b2938479e7 =
+  \x0 ->
+    fmap BG.fromFFIType (hs_bindgen_cdabf4b2938479e7_base (BG.toFFIType x0))
+
+{-| Returns the return type of an expression.
+
+    history:
+
+    * unstable: v1.4.0
+
+    * stable: v1.5.6
+
+    [__@expr@__]: The expression.
+
+    __Returns:__ t'DuckDBLogicalType'
+
+    __C declaration:__ @duckdb_expression_return_type@
+
+    __defined at:__ @duckdb.h 4727:34@
+
+    __exported by:__ @duckdb.h@
+-}
+c_duckdb_expression_return_type ::
+     DuckDBExpression
+     {- ^
+
+          [__@expr@__]: The expression.
+
+          __C declaration:__ @expr@
+     -}
+  -> IO DuckDBLogicalType
+c_duckdb_expression_return_type =
+  hs_bindgen_cdabf4b2938479e7
+
+-- __unique:__ @Database_DuckDB_FFI_Database.DuckDB.FFI_Safe_duckdb_expression_is_foldable@
+foreign import ccall safe "hs_bindgen_5206a378aa1aed90" hs_bindgen_5206a378aa1aed90_base ::
+     BG.Ptr BG.Void
+  -> IO BG.CBool
+
+-- __unique:__ @Database_DuckDB_FFI_Database.DuckDB.FFI_Safe_duckdb_expression_is_foldable@
+hs_bindgen_5206a378aa1aed90 ::
+     DuckDBExpression
+  -> IO BG.CBool
+hs_bindgen_5206a378aa1aed90 =
+  \x0 ->
+    fmap BG.fromFFIType (hs_bindgen_5206a378aa1aed90_base (BG.toFFIType x0))
+
+{-| Returns whether the expression is foldable into a value or not.
+
+    history:
+
+    * unstable: v1.4.0
+
+    * stable: v1.5.6
+
+    [__@expr@__]: The expression.
+
+    __Returns:__ bool
+
+    __C declaration:__ @duckdb_expression_is_foldable@
+
+    __defined at:__ @duckdb.h 4741:19@
+
+    __exported by:__ @duckdb.h@
+-}
+c_duckdb_expression_is_foldable ::
+     DuckDBExpression
+     {- ^
+
+          [__@expr@__]: The expression.
+
+          __C declaration:__ @expr@
+     -}
+  -> IO BG.CBool
+c_duckdb_expression_is_foldable =
+  hs_bindgen_5206a378aa1aed90
+
+-- __unique:__ @Database_DuckDB_FFI_Database.DuckDB.FFI_Safe_duckdb_expression_fold@
+foreign import ccall safe "hs_bindgen_218c780f483b4c25" hs_bindgen_218c780f483b4c25_base ::
+     BG.Ptr BG.Void
+  -> BG.Ptr BG.Void
+  -> BG.Ptr BG.Void
+  -> IO (BG.Ptr BG.Void)
+
+-- __unique:__ @Database_DuckDB_FFI_Database.DuckDB.FFI_Safe_duckdb_expression_fold@
+hs_bindgen_218c780f483b4c25 ::
+     DuckDBClientContext
+  -> DuckDBExpression
+  -> BG.Ptr DuckDBValue
+  -> IO DuckDBErrorData
+hs_bindgen_218c780f483b4c25 =
+  \x0 ->
+    \x1 ->
+      \x2 ->
+        fmap BG.fromFFIType (hs_bindgen_218c780f483b4c25_base (BG.toFFIType x0) (BG.toFFIType x1) (BG.toFFIType x2))
+
+{-| Folds an expression creating a folded value.
+
+    history:
+
+    * unstable: v1.4.0
+
+    * stable: v1.5.6
+
+    [__@context@__]: The client context.
+
+    [__@expr@__]: The expression. Must be foldable.
+
+    [__@out_value@__]: The folded value, if folding was successful. Must be destroyed with @'c_duckdb_destroy_value'@ .
+
+    __Returns:__ t'DuckDBErrorData'
+
+    __C declaration:__ @duckdb_expression_fold@
+
+    __defined at:__ @duckdb.h 4757:32@
+
+    __exported by:__ @duckdb.h@
+-}
+c_duckdb_expression_fold ::
+     DuckDBClientContext
+     {- ^
+
+          [__@context@__]: The client context.
+
+          __C declaration:__ @context@
+     -}
+  -> DuckDBExpression
+     {- ^
+
+          [__@expr@__]: The expression. Must be foldable.
+
+          __C declaration:__ @expr@
+     -}
+  -> BG.Ptr DuckDBValue
+     {- ^
+
+          [__@out_value@__]: The folded value, if folding was successful. Must be destroyed with @'c_duckdb_destroy_value'@ .
+
+          __C declaration:__ @out_value@
+     -}
+  -> IO DuckDBErrorData
+c_duckdb_expression_fold =
+  hs_bindgen_218c780f483b4c25
+
+-- __unique:__ @Database_DuckDB_FFI_Database.DuckDB.FFI_Safe_duckdb_client_context_get_file_system@
+foreign import ccall safe "hs_bindgen_86de50508a218279" hs_bindgen_86de50508a218279_base ::
+     BG.Ptr BG.Void
+  -> IO (BG.Ptr BG.Void)
+
+-- __unique:__ @Database_DuckDB_FFI_Database.DuckDB.FFI_Safe_duckdb_client_context_get_file_system@
+hs_bindgen_86de50508a218279 ::
+     DuckDBClientContext
+  -> IO DuckDBFileSystem
+hs_bindgen_86de50508a218279 =
+  \x0 ->
+    fmap BG.fromFFIType (hs_bindgen_86de50508a218279_base (BG.toFFIType x0))
+
+{-| Get a file system instance associated with the given client context.
+
+    history:
+
+    * unstable: v1.5.0
+
+    * stable: v1.5.6
+
+    [__@context@__]: The client context.
+
+    __Returns:__ t'DuckDBFileSystem'
+
+    __C declaration:__ @duckdb_client_context_get_file_system@
+
+    __defined at:__ @duckdb.h 4790:33@
+
+    __exported by:__ @duckdb.h@
+-}
+c_duckdb_client_context_get_file_system ::
+     DuckDBClientContext
+     {- ^
+
+          [__@context@__]: The client context.
+
+          __C declaration:__ @context@
+     -}
+  -> IO DuckDBFileSystem
+c_duckdb_client_context_get_file_system =
+  hs_bindgen_86de50508a218279
+
+-- __unique:__ @Database_DuckDB_FFI_Database.DuckDB.FFI_Safe_duckdb_destroy_file_system@
+foreign import ccall safe "hs_bindgen_15fa74b0654878cf" hs_bindgen_15fa74b0654878cf_base ::
+     BG.Ptr BG.Void
+  -> IO ()
+
+-- __unique:__ @Database_DuckDB_FFI_Database.DuckDB.FFI_Safe_duckdb_destroy_file_system@
+hs_bindgen_15fa74b0654878cf ::
+     BG.Ptr DuckDBFileSystem
+  -> IO ()
+hs_bindgen_15fa74b0654878cf =
+  \x0 ->
+    hs_bindgen_15fa74b0654878cf_base (BG.toFFIType x0)
+
+{-| Destroys the given file system instance.
+
+    history:
+
+    * unstable: v1.5.0
+
+    * stable: v1.5.6
+
+    [__@file_system@__]: The file system instance to destroy.
+
+    __Returns:__ void
+
+    __C declaration:__ @duckdb_destroy_file_system@
+
+    __defined at:__ @duckdb.h 4804:19@
+
+    __exported by:__ @duckdb.h@
+-}
+c_duckdb_destroy_file_system ::
+     BG.Ptr DuckDBFileSystem
+     {- ^
+
+          [__@file_system@__]: The file system instance to destroy.
+
+          __C declaration:__ @file_system@
+     -}
+  -> IO ()
+c_duckdb_destroy_file_system =
+  hs_bindgen_15fa74b0654878cf
+
+-- __unique:__ @Database_DuckDB_FFI_Database.DuckDB.FFI_Safe_duckdb_file_system_error_data@
+foreign import ccall safe "hs_bindgen_69adcdaa1e007d5a" hs_bindgen_69adcdaa1e007d5a_base ::
+     BG.Ptr BG.Void
+  -> IO (BG.Ptr BG.Void)
+
+-- __unique:__ @Database_DuckDB_FFI_Database.DuckDB.FFI_Safe_duckdb_file_system_error_data@
+hs_bindgen_69adcdaa1e007d5a ::
+     DuckDBFileSystem
+  -> IO DuckDBErrorData
+hs_bindgen_69adcdaa1e007d5a =
+  \x0 ->
+    fmap BG.fromFFIType (hs_bindgen_69adcdaa1e007d5a_base (BG.toFFIType x0))
+
+{-| Retrieves the last error that occurred on the given file system instance.
+
+    history:
+
+    * unstable: v1.5.0
+
+    * stable: v1.5.6
+
+    [__@file_system@__]: The file system instance.
+
+    __Returns:__ t'DuckDBErrorData'
+
+    __C declaration:__ @duckdb_file_system_error_data@
+
+    __defined at:__ @duckdb.h 4818:32@
+
+    __exported by:__ @duckdb.h@
+-}
+c_duckdb_file_system_error_data ::
+     DuckDBFileSystem
+     {- ^
+
+          [__@file_system@__]: The file system instance.
+
+          __C declaration:__ @file_system@
+     -}
+  -> IO DuckDBErrorData
+c_duckdb_file_system_error_data =
+  hs_bindgen_69adcdaa1e007d5a
+
+-- __unique:__ @Database_DuckDB_FFI_Database.DuckDB.FFI_Safe_duckdb_file_system_open@
+foreign import ccall safe "hs_bindgen_5751f4feb4d71533" hs_bindgen_5751f4feb4d71533_base ::
+     BG.Ptr BG.Void
+  -> BG.Ptr BG.Void
+  -> BG.Ptr BG.Void
+  -> BG.Ptr BG.Void
+  -> IO BG.CUInt
+
+-- __unique:__ @Database_DuckDB_FFI_Database.DuckDB.FFI_Safe_duckdb_file_system_open@
+hs_bindgen_5751f4feb4d71533 ::
+     DuckDBFileSystem
+  -> PtrConst.PtrConst BG.CChar
+  -> DuckDBFileOpenOptions
+  -> BG.Ptr DuckDBFileHandle
+  -> IO DuckDBState
+hs_bindgen_5751f4feb4d71533 =
+  \x0 ->
+    \x1 ->
+      \x2 ->
+        \x3 ->
+          fmap BG.fromFFIType (hs_bindgen_5751f4feb4d71533_base (BG.toFFIType x0) (BG.toFFIType x1) (BG.toFFIType x2) (BG.toFFIType x3))
+
+{-| Opens a file at the given path with the specified options.
+
+    history:
+
+    * unstable: v1.5.0
+
+    * stable: v1.5.6
+
+    [__@file_system@__]: The file system instance.
+
+    [__@path@__]: The path to the file.
+
+    [__@options@__]: The file open options specifying how to open the file.
+
+    [__@out_file@__]: The resulting file handle instance, or @nullptr@ if the open failed. Must be destroyed with @'c_duckdb_destroy_file_handle'@ .
+
+    __Returns:__ t'DuckDBState'
+
+    __C declaration:__ @duckdb_file_system_open@
+
+    __defined at:__ @duckdb.h 4836:27@
+
+    __exported by:__ @duckdb.h@
+-}
+c_duckdb_file_system_open ::
+     DuckDBFileSystem
+     {- ^
+
+          [__@file_system@__]: The file system instance.
+
+          __C declaration:__ @file_system@
+     -}
+  -> PtrConst.PtrConst BG.CChar
+     {- ^
+
+          [__@path@__]: The path to the file.
+
+          __C declaration:__ @path@
+     -}
+  -> DuckDBFileOpenOptions
+     {- ^
+
+          [__@options@__]: The file open options specifying how to open the file.
+
+          __C declaration:__ @options@
+     -}
+  -> BG.Ptr DuckDBFileHandle
+     {- ^
+
+          [__@out_file@__]: The resulting file handle instance, or @nullptr@ if the open failed. Must be destroyed with @'c_duckdb_destroy_file_handle'@ .
+
+          __C declaration:__ @out_file@
+     -}
+  -> IO DuckDBState
+c_duckdb_file_system_open =
+  hs_bindgen_5751f4feb4d71533
+
+-- __unique:__ @Database_DuckDB_FFI_Database.DuckDB.FFI_Safe_duckdb_create_file_open_options@
+foreign import ccall safe "hs_bindgen_539de38e0bab26c5" hs_bindgen_539de38e0bab26c5_base ::
+     IO (BG.Ptr BG.Void)
+
+-- __unique:__ @Database_DuckDB_FFI_Database.DuckDB.FFI_Safe_duckdb_create_file_open_options@
+hs_bindgen_539de38e0bab26c5 :: IO DuckDBFileOpenOptions
+hs_bindgen_539de38e0bab26c5 =
+  fmap BG.fromFFIType hs_bindgen_539de38e0bab26c5_base
+
+{-| Creates a new file open options instance with blank settings.
+
+    history:
+
+    * unstable: v1.5.0
+
+    * stable: v1.5.6
+
+    __Returns:__ t'DuckDBFileOpenOptions'
+
+    __C declaration:__ @duckdb_create_file_open_options@
+
+    __defined at:__ @duckdb.h 4850:39@
+
+    __exported by:__ @duckdb.h@
+-}
+c_duckdb_create_file_open_options :: IO DuckDBFileOpenOptions
+c_duckdb_create_file_open_options =
+  hs_bindgen_539de38e0bab26c5
+
+-- __unique:__ @Database_DuckDB_FFI_Database.DuckDB.FFI_Safe_duckdb_file_open_options_set_flag@
+foreign import ccall safe "hs_bindgen_ffd94c80e2976995" hs_bindgen_ffd94c80e2976995_base ::
+     BG.Ptr BG.Void
+  -> BG.CUInt
+  -> BG.CBool
+  -> IO BG.CUInt
+
+-- __unique:__ @Database_DuckDB_FFI_Database.DuckDB.FFI_Safe_duckdb_file_open_options_set_flag@
+hs_bindgen_ffd94c80e2976995 ::
+     DuckDBFileOpenOptions
+  -> DuckDBFileFlag
+  -> BG.CBool
+  -> IO DuckDBState
+hs_bindgen_ffd94c80e2976995 =
+  \x0 ->
+    \x1 ->
+      \x2 ->
+        fmap BG.fromFFIType (hs_bindgen_ffd94c80e2976995_base (BG.toFFIType x0) (BG.toFFIType x1) (BG.toFFIType x2))
+
+{-| Sets a specific flag in the file open options.
+
+    history:
+
+    * unstable: v1.5.0
+
+    * stable: v1.5.6
+
+    [__@options@__]: The file open options instance.
+
+    [__@flag@__]: The flag to set (e.g., read, write).
+
+    [__@value@__]: If the flag is enabled or disabled.
+
+    __Returns:__ t'DuckDBState'
+
+    __C declaration:__ @duckdb_file_open_options_set_flag@
+
+    __defined at:__ @duckdb.h 4866:27@
+
+    __exported by:__ @duckdb.h@
+-}
+c_duckdb_file_open_options_set_flag ::
+     DuckDBFileOpenOptions
+     {- ^
+
+          [__@options@__]: The file open options instance.
+
+          __C declaration:__ @options@
+     -}
+  -> DuckDBFileFlag
+     {- ^
+
+          [__@flag@__]: The flag to set (e.g., read, write).
+
+          __C declaration:__ @flag@
+     -}
+  -> BG.CBool
+     {- ^
+
+          [__@value@__]: If the flag is enabled or disabled.
+
+          __C declaration:__ @value@
+     -}
+  -> IO DuckDBState
+c_duckdb_file_open_options_set_flag =
+  hs_bindgen_ffd94c80e2976995
+
+-- __unique:__ @Database_DuckDB_FFI_Database.DuckDB.FFI_Safe_duckdb_destroy_file_open_options@
+foreign import ccall safe "hs_bindgen_cf37e39c2d419a08" hs_bindgen_cf37e39c2d419a08_base ::
+     BG.Ptr BG.Void
+  -> IO ()
+
+-- __unique:__ @Database_DuckDB_FFI_Database.DuckDB.FFI_Safe_duckdb_destroy_file_open_options@
+hs_bindgen_cf37e39c2d419a08 ::
+     BG.Ptr DuckDBFileOpenOptions
+  -> IO ()
+hs_bindgen_cf37e39c2d419a08 =
+  \x0 ->
+    hs_bindgen_cf37e39c2d419a08_base (BG.toFFIType x0)
+
+{-| Destroys the given file open options instance.
+
+    history:
+
+    * unstable: v1.5.0
+
+    * stable: v1.5.6
+
+    [__@options@__]: The file open options instance to destroy.
+
+    __Returns:__ void
+
+    __C declaration:__ @duckdb_destroy_file_open_options@
+
+    __defined at:__ @duckdb.h 4881:19@
+
+    __exported by:__ @duckdb.h@
+-}
+c_duckdb_destroy_file_open_options ::
+     BG.Ptr DuckDBFileOpenOptions
+     {- ^
+
+          [__@options@__]: The file open options instance to destroy.
+
+          __C declaration:__ @options@
+     -}
+  -> IO ()
+c_duckdb_destroy_file_open_options =
+  hs_bindgen_cf37e39c2d419a08
+
+-- __unique:__ @Database_DuckDB_FFI_Database.DuckDB.FFI_Safe_duckdb_destroy_file_handle@
+foreign import ccall safe "hs_bindgen_aad6fac9a0994e02" hs_bindgen_aad6fac9a0994e02_base ::
+     BG.Ptr BG.Void
+  -> IO ()
+
+-- __unique:__ @Database_DuckDB_FFI_Database.DuckDB.FFI_Safe_duckdb_destroy_file_handle@
+hs_bindgen_aad6fac9a0994e02 ::
+     BG.Ptr DuckDBFileHandle
+  -> IO ()
+hs_bindgen_aad6fac9a0994e02 =
+  \x0 ->
+    hs_bindgen_aad6fac9a0994e02_base (BG.toFFIType x0)
+
+{-| Destroys the given file handle and deallocates all associated resources. This will also close the file if it is still open.
+
+    history:
+
+    * unstable: v1.5.0
+
+    * stable: v1.5.6
+
+    [__@file_handle@__]: The file handle to destroy.
+
+    __Returns:__ void
+
+    __C declaration:__ @duckdb_destroy_file_handle@
+
+    __defined at:__ @duckdb.h 4896:19@
+
+    __exported by:__ @duckdb.h@
+-}
+c_duckdb_destroy_file_handle ::
+     BG.Ptr DuckDBFileHandle
+     {- ^
+
+          [__@file_handle@__]: The file handle to destroy.
+
+          __C declaration:__ @file_handle@
+     -}
+  -> IO ()
+c_duckdb_destroy_file_handle =
+  hs_bindgen_aad6fac9a0994e02
+
+-- __unique:__ @Database_DuckDB_FFI_Database.DuckDB.FFI_Safe_duckdb_file_handle_error_data@
+foreign import ccall safe "hs_bindgen_5e1f67bf3efc2c36" hs_bindgen_5e1f67bf3efc2c36_base ::
+     BG.Ptr BG.Void
+  -> IO (BG.Ptr BG.Void)
+
+-- __unique:__ @Database_DuckDB_FFI_Database.DuckDB.FFI_Safe_duckdb_file_handle_error_data@
+hs_bindgen_5e1f67bf3efc2c36 ::
+     DuckDBFileHandle
+  -> IO DuckDBErrorData
+hs_bindgen_5e1f67bf3efc2c36 =
+  \x0 ->
+    fmap BG.fromFFIType (hs_bindgen_5e1f67bf3efc2c36_base (BG.toFFIType x0))
+
+{-| Retrieves the last error that occurred on the given file handle.
+
+    history:
+
+    * unstable: v1.5.0
+
+    * stable: v1.5.6
+
+    [__@file_handle@__]: The file handle.
+
+    __Returns:__ t'DuckDBErrorData'
+
+    __C declaration:__ @duckdb_file_handle_error_data@
+
+    __defined at:__ @duckdb.h 4910:32@
+
+    __exported by:__ @duckdb.h@
+-}
+c_duckdb_file_handle_error_data ::
+     DuckDBFileHandle
+     {- ^
+
+          [__@file_handle@__]: The file handle.
+
+          __C declaration:__ @file_handle@
+     -}
+  -> IO DuckDBErrorData
+c_duckdb_file_handle_error_data =
+  hs_bindgen_5e1f67bf3efc2c36
+
+-- __unique:__ @Database_DuckDB_FFI_Database.DuckDB.FFI_Safe_duckdb_file_handle_read@
+foreign import ccall safe "hs_bindgen_4b1fa3c92c7ccebd" hs_bindgen_4b1fa3c92c7ccebd_base ::
+     BG.Ptr BG.Void
+  -> BG.Ptr BG.Void
+  -> HsBindgen.Runtime.LibC.Int64
+  -> IO HsBindgen.Runtime.LibC.Int64
+
+-- __unique:__ @Database_DuckDB_FFI_Database.DuckDB.FFI_Safe_duckdb_file_handle_read@
+hs_bindgen_4b1fa3c92c7ccebd ::
+     DuckDBFileHandle
+  -> BG.Ptr BG.Void
+  -> HsBindgen.Runtime.LibC.Int64
+  -> IO HsBindgen.Runtime.LibC.Int64
+hs_bindgen_4b1fa3c92c7ccebd =
+  \x0 ->
+    \x1 ->
+      \x2 ->
+        fmap BG.fromFFIType (hs_bindgen_4b1fa3c92c7ccebd_base (BG.toFFIType x0) (BG.toFFIType x1) (BG.toFFIType x2))
+
+{-| Reads data from the file into the buffer.
+
+    history:
+
+    * unstable: v1.5.0
+
+    * stable: v1.5.6
+
+    [__@file_handle@__]: The file handle to read from.
+
+    [__@buffer@__]: The buffer to read data into.
+
+    [__@size@__]: The number of bytes to read.
+
+    __Returns:__ int64_t
+
+    __C declaration:__ @duckdb_file_handle_read@
+
+    __defined at:__ @duckdb.h 4926:22@
+
+    __exported by:__ @duckdb.h@
+-}
+c_duckdb_file_handle_read ::
+     DuckDBFileHandle
+     {- ^
+
+          [__@file_handle@__]: The file handle to read from.
+
+          __C declaration:__ @file_handle@
+     -}
+  -> BG.Ptr BG.Void
+     {- ^
+
+          [__@buffer@__]: The buffer to read data into.
+
+          __C declaration:__ @buffer@
+     -}
+  -> HsBindgen.Runtime.LibC.Int64
+     {- ^
+
+          [__@size@__]: The number of bytes to read.
+
+          __C declaration:__ @size@
+     -}
+  -> IO HsBindgen.Runtime.LibC.Int64
+c_duckdb_file_handle_read =
+  hs_bindgen_4b1fa3c92c7ccebd
+
+-- __unique:__ @Database_DuckDB_FFI_Database.DuckDB.FFI_Safe_duckdb_file_handle_write@
+foreign import ccall safe "hs_bindgen_b76782389ae4d98e" hs_bindgen_b76782389ae4d98e_base ::
+     BG.Ptr BG.Void
+  -> BG.Ptr BG.Void
+  -> HsBindgen.Runtime.LibC.Int64
+  -> IO HsBindgen.Runtime.LibC.Int64
+
+-- __unique:__ @Database_DuckDB_FFI_Database.DuckDB.FFI_Safe_duckdb_file_handle_write@
+hs_bindgen_b76782389ae4d98e ::
+     DuckDBFileHandle
+  -> PtrConst.PtrConst BG.Void
+  -> HsBindgen.Runtime.LibC.Int64
+  -> IO HsBindgen.Runtime.LibC.Int64
+hs_bindgen_b76782389ae4d98e =
+  \x0 ->
+    \x1 ->
+      \x2 ->
+        fmap BG.fromFFIType (hs_bindgen_b76782389ae4d98e_base (BG.toFFIType x0) (BG.toFFIType x1) (BG.toFFIType x2))
+
+{-| Writes data from the buffer to the file.
+
+    history:
+
+    * unstable: v1.5.0
+
+    * stable: v1.5.6
+
+    [__@file_handle@__]: The file handle to write to.
+
+    [__@buffer@__]: The buffer containing data to write.
+
+    [__@size@__]: The number of bytes to write.
+
+    __Returns:__ int64_t
+
+    __C declaration:__ @duckdb_file_handle_write@
+
+    __defined at:__ @duckdb.h 4942:22@
+
+    __exported by:__ @duckdb.h@
+-}
+c_duckdb_file_handle_write ::
+     DuckDBFileHandle
+     {- ^
+
+          [__@file_handle@__]: The file handle to write to.
+
+          __C declaration:__ @file_handle@
+     -}
+  -> PtrConst.PtrConst BG.Void
+     {- ^
+
+          [__@buffer@__]: The buffer containing data to write.
+
+          __C declaration:__ @buffer@
+     -}
+  -> HsBindgen.Runtime.LibC.Int64
+     {- ^
+
+          [__@size@__]: The number of bytes to write.
+
+          __C declaration:__ @size@
+     -}
+  -> IO HsBindgen.Runtime.LibC.Int64
+c_duckdb_file_handle_write =
+  hs_bindgen_b76782389ae4d98e
+
+-- __unique:__ @Database_DuckDB_FFI_Database.DuckDB.FFI_Safe_duckdb_file_handle_tell@
+foreign import ccall safe "hs_bindgen_aadecefadd076fa0" hs_bindgen_aadecefadd076fa0_base ::
+     BG.Ptr BG.Void
+  -> IO HsBindgen.Runtime.LibC.Int64
+
+-- __unique:__ @Database_DuckDB_FFI_Database.DuckDB.FFI_Safe_duckdb_file_handle_tell@
+hs_bindgen_aadecefadd076fa0 ::
+     DuckDBFileHandle
+  -> IO HsBindgen.Runtime.LibC.Int64
+hs_bindgen_aadecefadd076fa0 =
+  \x0 ->
+    fmap BG.fromFFIType (hs_bindgen_aadecefadd076fa0_base (BG.toFFIType x0))
+
+{-| Tells the current position in the file.
+
+    history:
+
+    * unstable: v1.5.0
+
+    * stable: v1.5.6
+
+    [__@file_handle@__]: The file handle to tell the position of.
+
+    __Returns:__ int64_t
+
+    __C declaration:__ @duckdb_file_handle_tell@
+
+    __defined at:__ @duckdb.h 4956:22@
+
+    __exported by:__ @duckdb.h@
+-}
+c_duckdb_file_handle_tell ::
+     DuckDBFileHandle
+     {- ^
+
+          [__@file_handle@__]: The file handle to tell the position of.
+
+          __C declaration:__ @file_handle@
+     -}
+  -> IO HsBindgen.Runtime.LibC.Int64
+c_duckdb_file_handle_tell =
+  hs_bindgen_aadecefadd076fa0
+
+-- __unique:__ @Database_DuckDB_FFI_Database.DuckDB.FFI_Safe_duckdb_file_handle_size@
+foreign import ccall safe "hs_bindgen_116d5a219fefe068" hs_bindgen_116d5a219fefe068_base ::
+     BG.Ptr BG.Void
+  -> IO HsBindgen.Runtime.LibC.Int64
+
+-- __unique:__ @Database_DuckDB_FFI_Database.DuckDB.FFI_Safe_duckdb_file_handle_size@
+hs_bindgen_116d5a219fefe068 ::
+     DuckDBFileHandle
+  -> IO HsBindgen.Runtime.LibC.Int64
+hs_bindgen_116d5a219fefe068 =
+  \x0 ->
+    fmap BG.fromFFIType (hs_bindgen_116d5a219fefe068_base (BG.toFFIType x0))
+
+{-| Gets the size of the file.
+
+    history:
+
+    * unstable: v1.5.0
+
+    * stable: v1.5.6
+
+    [__@file_handle@__]: The file handle to get the size of.
+
+    __Returns:__ int64_t
+
+    __C declaration:__ @duckdb_file_handle_size@
+
+    __defined at:__ @duckdb.h 4970:22@
+
+    __exported by:__ @duckdb.h@
+-}
+c_duckdb_file_handle_size ::
+     DuckDBFileHandle
+     {- ^
+
+          [__@file_handle@__]: The file handle to get the size of.
+
+          __C declaration:__ @file_handle@
+     -}
+  -> IO HsBindgen.Runtime.LibC.Int64
+c_duckdb_file_handle_size =
+  hs_bindgen_116d5a219fefe068
+
+-- __unique:__ @Database_DuckDB_FFI_Database.DuckDB.FFI_Safe_duckdb_file_handle_seek@
+foreign import ccall safe "hs_bindgen_0bc01ea1e012d827" hs_bindgen_0bc01ea1e012d827_base ::
+     BG.Ptr BG.Void
+  -> HsBindgen.Runtime.LibC.Int64
+  -> IO BG.CUInt
+
+-- __unique:__ @Database_DuckDB_FFI_Database.DuckDB.FFI_Safe_duckdb_file_handle_seek@
+hs_bindgen_0bc01ea1e012d827 ::
+     DuckDBFileHandle
+  -> HsBindgen.Runtime.LibC.Int64
+  -> IO DuckDBState
+hs_bindgen_0bc01ea1e012d827 =
+  \x0 ->
+    \x1 ->
+      fmap BG.fromFFIType (hs_bindgen_0bc01ea1e012d827_base (BG.toFFIType x0) (BG.toFFIType x1))
+
+{-| Seeks to a specific position in the file.
+
+    history:
+
+    * unstable: v1.5.0
+
+    * stable: v1.5.6
+
+    [__@file_handle@__]: The file handle to seek in.
+
+    [__@position@__]:
+
+    __Returns:__ t'DuckDBState'
+
+    __C declaration:__ @duckdb_file_handle_seek@
+
+    __defined at:__ @duckdb.h 4985:27@
+
+    __exported by:__ @duckdb.h@
+-}
+c_duckdb_file_handle_seek ::
+     DuckDBFileHandle
+     {- ^
+
+          [__@file_handle@__]: The file handle to seek in.
+
+          __C declaration:__ @file_handle@
+     -}
+  -> HsBindgen.Runtime.LibC.Int64
+     {- ^
+
+          [__@position@__]:
+
+          __C declaration:__ @position@
+     -}
+  -> IO DuckDBState
+c_duckdb_file_handle_seek =
+  hs_bindgen_0bc01ea1e012d827
+
+-- __unique:__ @Database_DuckDB_FFI_Database.DuckDB.FFI_Safe_duckdb_file_handle_sync@
+foreign import ccall safe "hs_bindgen_54f8658c443ae0c1" hs_bindgen_54f8658c443ae0c1_base ::
+     BG.Ptr BG.Void
+  -> IO BG.CUInt
+
+-- __unique:__ @Database_DuckDB_FFI_Database.DuckDB.FFI_Safe_duckdb_file_handle_sync@
+hs_bindgen_54f8658c443ae0c1 ::
+     DuckDBFileHandle
+  -> IO DuckDBState
+hs_bindgen_54f8658c443ae0c1 =
+  \x0 ->
+    fmap BG.fromFFIType (hs_bindgen_54f8658c443ae0c1_base (BG.toFFIType x0))
+
+{-| Synchronizes the file\'s state with the underlying storage.
+
+    history:
+
+    * unstable: v1.5.0
+
+    * stable: v1.5.6
+
+    [__@file_handle@__]: The file handle to synchronize.
+
+    __Returns:__ t'DuckDBState'
+
+    __C declaration:__ @duckdb_file_handle_sync@
+
+    __defined at:__ @duckdb.h 4999:27@
+
+    __exported by:__ @duckdb.h@
+-}
+c_duckdb_file_handle_sync ::
+     DuckDBFileHandle
+     {- ^
+
+          [__@file_handle@__]: The file handle to synchronize.
+
+          __C declaration:__ @file_handle@
+     -}
+  -> IO DuckDBState
+c_duckdb_file_handle_sync =
+  hs_bindgen_54f8658c443ae0c1
+
+-- __unique:__ @Database_DuckDB_FFI_Database.DuckDB.FFI_Safe_duckdb_file_handle_close@
+foreign import ccall safe "hs_bindgen_b5d3891ef9f994e8" hs_bindgen_b5d3891ef9f994e8_base ::
+     BG.Ptr BG.Void
+  -> IO BG.CUInt
+
+-- __unique:__ @Database_DuckDB_FFI_Database.DuckDB.FFI_Safe_duckdb_file_handle_close@
+hs_bindgen_b5d3891ef9f994e8 ::
+     DuckDBFileHandle
+  -> IO DuckDBState
+hs_bindgen_b5d3891ef9f994e8 =
+  \x0 ->
+    fmap BG.fromFFIType (hs_bindgen_b5d3891ef9f994e8_base (BG.toFFIType x0))
+
+{-| Closes the given file handle.
+
+    history:
+
+    * unstable: v1.5.0
+
+    * stable: v1.5.6
+
+    [__@file_handle@__]: The file handle to close.
+
+    __Returns:__ t'DuckDBState'
+
+    __C declaration:__ @duckdb_file_handle_close@
+
+    __defined at:__ @duckdb.h 5013:27@
+
+    __exported by:__ @duckdb.h@
+-}
+c_duckdb_file_handle_close ::
+     DuckDBFileHandle
+     {- ^
+
+          [__@file_handle@__]: The file handle to close.
+
+          __C declaration:__ @file_handle@
+     -}
+  -> IO DuckDBState
+c_duckdb_file_handle_close =
+  hs_bindgen_b5d3891ef9f994e8
+
+-- __unique:__ @Database_DuckDB_FFI_Database.DuckDB.FFI_Safe_duckdb_create_log_storage@
+foreign import ccall safe "hs_bindgen_f82dcf7bc4f9f778" hs_bindgen_f82dcf7bc4f9f778_base ::
+     IO (BG.Ptr BG.Void)
+
+-- __unique:__ @Database_DuckDB_FFI_Database.DuckDB.FFI_Safe_duckdb_create_log_storage@
+hs_bindgen_f82dcf7bc4f9f778 :: IO DuckDBLogStorage
+hs_bindgen_f82dcf7bc4f9f778 =
+  fmap BG.fromFFIType hs_bindgen_f82dcf7bc4f9f778_base
+
+{-| Creates a new log storage object.
+
+    history:
+
+    * unstable: v1.5.0
+
+    * stable: v1.5.6
+
+    __Returns:__ t'DuckDBLogStorage'
+
+    __C declaration:__ @duckdb_create_log_storage@
+
+    __defined at:__ @duckdb.h 5044:33@
+
+    __exported by:__ @duckdb.h@
+-}
+c_duckdb_create_log_storage :: IO DuckDBLogStorage
+c_duckdb_create_log_storage =
+  hs_bindgen_f82dcf7bc4f9f778
+
+-- __unique:__ @Database_DuckDB_FFI_Database.DuckDB.FFI_Safe_duckdb_destroy_log_storage@
+foreign import ccall safe "hs_bindgen_88b771f8afe3bd0d" hs_bindgen_88b771f8afe3bd0d_base ::
+     BG.Ptr BG.Void
+  -> IO ()
+
+-- __unique:__ @Database_DuckDB_FFI_Database.DuckDB.FFI_Safe_duckdb_destroy_log_storage@
+hs_bindgen_88b771f8afe3bd0d ::
+     BG.Ptr DuckDBLogStorage
+  -> IO ()
+hs_bindgen_88b771f8afe3bd0d =
+  \x0 ->
+    hs_bindgen_88b771f8afe3bd0d_base (BG.toFFIType x0)
+
+{-| Destroys a log storage object.
+
+    history:
+
+    * unstable: v1.5.0
+
+    * stable: v1.5.6
+
+    [__@log_storage@__]: The log storage object to destroy.
+
+    __Returns:__ void
+
+    __C declaration:__ @duckdb_destroy_log_storage@
+
+    __defined at:__ @duckdb.h 5058:19@
+
+    __exported by:__ @duckdb.h@
+-}
+c_duckdb_destroy_log_storage ::
+     BG.Ptr DuckDBLogStorage
+     {- ^
+
+          [__@log_storage@__]: The log storage object to destroy.
+
+          __C declaration:__ @log_storage@
+     -}
+  -> IO ()
+c_duckdb_destroy_log_storage =
+  hs_bindgen_88b771f8afe3bd0d
+
+-- __unique:__ @Database_DuckDB_FFI_Database.DuckDB.FFI_Safe_duckdb_log_storage_set_write_log_entry@
+foreign import ccall safe "hs_bindgen_b3f6a07d7d042e63" hs_bindgen_b3f6a07d7d042e63_base ::
+     BG.Ptr BG.Void
+  -> BG.FunPtr BG.Void
+  -> IO ()
+
+-- __unique:__ @Database_DuckDB_FFI_Database.DuckDB.FFI_Safe_duckdb_log_storage_set_write_log_entry@
+hs_bindgen_b3f6a07d7d042e63 ::
+     DuckDBLogStorage
+  -> DuckDBLoggerWriteLogEntryFun
+  -> IO ()
+hs_bindgen_b3f6a07d7d042e63 =
+  \x0 ->
+    \x1 ->
+      hs_bindgen_b3f6a07d7d042e63_base (BG.toFFIType x0) (BG.toFFIType x1)
+
+{-| Sets the callback function for writing log entries.
+
+    history:
+
+    * unstable: v1.5.0
+
+    * stable: v1.5.6
+
+    [__@log_storage@__]: The log storage object.
+
+    [__@function@__]: The function to call.
+
+    __Returns:__ void
+
+    __C declaration:__ @duckdb_log_storage_set_write_log_entry@
+
+    __defined at:__ @duckdb.h 5073:19@
+
+    __exported by:__ @duckdb.h@
+-}
+c_duckdb_log_storage_set_write_log_entry ::
+     DuckDBLogStorage
+     {- ^
+
+          [__@log_storage@__]: The log storage object.
+
+          __C declaration:__ @log_storage@
+     -}
+  -> DuckDBLoggerWriteLogEntryFun
+     {- ^
+
+          [__@function@__]: The function to call.
+
+          __C declaration:__ @function@
+     -}
+  -> IO ()
+c_duckdb_log_storage_set_write_log_entry =
+  hs_bindgen_b3f6a07d7d042e63
+
+-- __unique:__ @Database_DuckDB_FFI_Database.DuckDB.FFI_Safe_duckdb_log_storage_set_extra_data@
+foreign import ccall safe "hs_bindgen_b1b907492c570cdc" hs_bindgen_b1b907492c570cdc_base ::
+     BG.Ptr BG.Void
+  -> BG.Ptr BG.Void
+  -> BG.FunPtr BG.Void
+  -> IO ()
+
+-- __unique:__ @Database_DuckDB_FFI_Database.DuckDB.FFI_Safe_duckdb_log_storage_set_extra_data@
+hs_bindgen_b1b907492c570cdc ::
+     DuckDBLogStorage
+  -> BG.Ptr BG.Void
+  -> DuckDBDeleteCallback
+  -> IO ()
+hs_bindgen_b1b907492c570cdc =
+  \x0 ->
+    \x1 ->
+      \x2 ->
+        hs_bindgen_b1b907492c570cdc_base (BG.toFFIType x0) (BG.toFFIType x1) (BG.toFFIType x2)
+
+{-| Sets the extra data of the custom log storage.
+
+    history:
+
+    * unstable: v1.5.0
+
+    * stable: v1.5.6
+
+    [__@log_storage@__]: The log storage object.
+
+    [__@extra_data@__]: The extra data that is passed back into the callbacks.
+
+    [__@delete_callback@__]:
+
+    __Returns:__ void
+
+    __C declaration:__ @duckdb_log_storage_set_extra_data@
+
+    __defined at:__ @duckdb.h 5090:19@
+
+    __exported by:__ @duckdb.h@
+-}
+c_duckdb_log_storage_set_extra_data ::
+     DuckDBLogStorage
+     {- ^
+
+          [__@log_storage@__]: The log storage object.
+
+          __C declaration:__ @log_storage@
+     -}
+  -> BG.Ptr BG.Void
+     {- ^
+
+          [__@extra_data@__]: The extra data that is passed back into the callbacks.
+
+          __C declaration:__ @extra_data@
+     -}
+  -> DuckDBDeleteCallback
+     {- ^
+
+          [__@delete_callback@__]:
+
+          __C declaration:__ @delete_callback@
+     -}
+  -> IO ()
+c_duckdb_log_storage_set_extra_data =
+  hs_bindgen_b1b907492c570cdc
+
+-- __unique:__ @Database_DuckDB_FFI_Database.DuckDB.FFI_Safe_duckdb_log_storage_set_name@
+foreign import ccall safe "hs_bindgen_c76226d0eeb4e836" hs_bindgen_c76226d0eeb4e836_base ::
+     BG.Ptr BG.Void
+  -> BG.Ptr BG.Void
+  -> IO ()
+
+-- __unique:__ @Database_DuckDB_FFI_Database.DuckDB.FFI_Safe_duckdb_log_storage_set_name@
+hs_bindgen_c76226d0eeb4e836 ::
+     DuckDBLogStorage
+  -> PtrConst.PtrConst BG.CChar
+  -> IO ()
+hs_bindgen_c76226d0eeb4e836 =
+  \x0 ->
+    \x1 ->
+      hs_bindgen_c76226d0eeb4e836_base (BG.toFFIType x0) (BG.toFFIType x1)
+
+{-| Sets the name of the log storage.
+
+    history:
+
+    * unstable: v1.5.0
+
+    * stable: v1.5.6
+
+    [__@log_storage@__]: The log storage object.
+
+    [__@name@__]: The name of the log storage.
+
+    __Returns:__ void
+
+    __C declaration:__ @duckdb_log_storage_set_name@
+
+    __defined at:__ @duckdb.h 5106:19@
+
+    __exported by:__ @duckdb.h@
+-}
+c_duckdb_log_storage_set_name ::
+     DuckDBLogStorage
+     {- ^
+
+          [__@log_storage@__]: The log storage object.
+
+          __C declaration:__ @log_storage@
+     -}
+  -> PtrConst.PtrConst BG.CChar
+     {- ^
+
+          [__@name@__]: The name of the log storage.
+
+          __C declaration:__ @name@
+     -}
+  -> IO ()
+c_duckdb_log_storage_set_name =
+  hs_bindgen_c76226d0eeb4e836
+
+-- __unique:__ @Database_DuckDB_FFI_Database.DuckDB.FFI_Safe_duckdb_register_log_storage@
+foreign import ccall safe "hs_bindgen_0c9ec8ed934fd689" hs_bindgen_0c9ec8ed934fd689_base ::
+     BG.Ptr BG.Void
+  -> BG.Ptr BG.Void
+  -> IO BG.CUInt
+
+-- __unique:__ @Database_DuckDB_FFI_Database.DuckDB.FFI_Safe_duckdb_register_log_storage@
+hs_bindgen_0c9ec8ed934fd689 ::
+     DuckDBDatabase
+  -> DuckDBLogStorage
+  -> IO DuckDBState
+hs_bindgen_0c9ec8ed934fd689 =
+  \x0 ->
+    \x1 ->
+      fmap BG.fromFFIType (hs_bindgen_0c9ec8ed934fd689_base (BG.toFFIType x0) (BG.toFFIType x1))
+
+{-| Registers a custom log storage for the logger.
+
+    history:
+
+    * unstable: v1.5.0
+
+    * stable: v1.5.6
+
+    [__@database@__]: A database object.
+
+    [__@log_storage@__]: The log storage object.
+
+    __Returns:__ t'DuckDBState'
+
+    __C declaration:__ @duckdb_register_log_storage@
+
+    __defined at:__ @duckdb.h 5121:27@
+
+    __exported by:__ @duckdb.h@
+-}
+c_duckdb_register_log_storage ::
+     DuckDBDatabase
+     {- ^
+
+          [__@database@__]: A database object.
+
+          __C declaration:__ @database@
+     -}
+  -> DuckDBLogStorage
+     {- ^
+
+          [__@log_storage@__]: The log storage object.
+
+          __C declaration:__ @log_storage@
+     -}
+  -> IO DuckDBState
+c_duckdb_register_log_storage =
+  hs_bindgen_0c9ec8ed934fd689
+
+-- __unique:__ @Database_DuckDB_FFI_Database.DuckDB.FFI_Safe_duckdb_create_logical_type@
+foreign import ccall safe "hs_bindgen_6730a3125961d1ce" hs_bindgen_6730a3125961d1ce_base ::
+     BG.CUInt
+  -> IO (BG.Ptr BG.Void)
+
+-- __unique:__ @Database_DuckDB_FFI_Database.DuckDB.FFI_Safe_duckdb_create_logical_type@
+hs_bindgen_6730a3125961d1ce ::
+     DuckDBTypeAlias
+  -> IO DuckDBLogicalType
+hs_bindgen_6730a3125961d1ce =
+  \x0 ->
+    fmap BG.fromFFIType (hs_bindgen_6730a3125961d1ce_base (BG.toFFIType x0))
+
+{-| Creates a @t'DuckDBLogicalType'@ from a primitive type. The resulting logical type must be destroyed with @'c_duckdb_destroy_logical_type'@ .
+
+    Returns an invalid logical type, if type is: @@DUCKDB_TYPE_INVALID@@ , @@DUCKDB_TYPE_DECIMAL@@ , @@DUCKDB_TYPE_ENUM@@ , @@DUCKDB_TYPE_LIST@@ , @@DUCKDB_TYPE_STRUCT@@ , @@DUCKDB_TYPE_MAP@@ , @@DUCKDB_TYPE_ARRAY@@ , or @@DUCKDB_TYPE_UNION@@ .
+
+    history:
+
+    * stable: v0.3.3
+
+    [__@type@__]: The primitive type to create.
+
+    __Returns:__ t'DuckDBLogicalType'
+
+    __C declaration:__ @duckdb_create_logical_type@
+
+    __defined at:__ @duckdb.h 5156:34@
+
+    __exported by:__ @duckdb.h@
+-}
+c_duckdb_create_logical_type ::
+     DuckDBTypeAlias
+     {- ^
+
+          [__@type@__]: The primitive type to create.
+
+          __C declaration:__ @type@
+     -}
+  -> IO DuckDBLogicalType
+c_duckdb_create_logical_type =
+  hs_bindgen_6730a3125961d1ce
+
+-- __unique:__ @Database_DuckDB_FFI_Database.DuckDB.FFI_Safe_duckdb_logical_type_get_alias@
+foreign import ccall safe "hs_bindgen_8bf9efd96355ccc8" hs_bindgen_8bf9efd96355ccc8_base ::
+     BG.Ptr BG.Void
+  -> IO (BG.Ptr BG.Void)
+
+-- __unique:__ @Database_DuckDB_FFI_Database.DuckDB.FFI_Safe_duckdb_logical_type_get_alias@
+hs_bindgen_8bf9efd96355ccc8 ::
+     DuckDBLogicalType
+  -> IO (BG.Ptr BG.CChar)
+hs_bindgen_8bf9efd96355ccc8 =
+  \x0 ->
+    fmap BG.fromFFIType (hs_bindgen_8bf9efd96355ccc8_base (BG.toFFIType x0))
+
+{-|
+
+    Returns the alias of a t'DuckDBLogicalType' , if set, else @nullptr@ . The result must be destroyed with @'c_duckdb_free'@ .
+
+    history:
+
+    * stable: v0.10.0
+
+    [__@type@__]: The logical type
+
+    __Returns:__ char*
+
+    __C declaration:__ @duckdb_logical_type_get_alias@
+
+    __defined at:__ @duckdb.h 5169:20@
+
+    __exported by:__ @duckdb.h@
+-}
+c_duckdb_logical_type_get_alias ::
+     DuckDBLogicalType
+     {- ^
+
+          [__@type@__]: The logical type
+
+          __C declaration:__ @type@
+     -}
+  -> IO (BG.Ptr BG.CChar)
+c_duckdb_logical_type_get_alias =
+  hs_bindgen_8bf9efd96355ccc8
+
+-- __unique:__ @Database_DuckDB_FFI_Database.DuckDB.FFI_Safe_duckdb_logical_type_set_alias@
+foreign import ccall safe "hs_bindgen_4c81dd82a58eab6c" hs_bindgen_4c81dd82a58eab6c_base ::
+     BG.Ptr BG.Void
+  -> BG.Ptr BG.Void
+  -> IO ()
+
+-- __unique:__ @Database_DuckDB_FFI_Database.DuckDB.FFI_Safe_duckdb_logical_type_set_alias@
+hs_bindgen_4c81dd82a58eab6c ::
+     DuckDBLogicalType
+  -> PtrConst.PtrConst BG.CChar
+  -> IO ()
+hs_bindgen_4c81dd82a58eab6c =
+  \x0 ->
+    \x1 ->
+      hs_bindgen_4c81dd82a58eab6c_base (BG.toFFIType x0) (BG.toFFIType x1)
+
+{-|
+
+    Sets the alias of a t'DuckDBLogicalType' .
+
+    history:
+
+    * stable: v1.1.0
+
+    [__@type@__]: The logical type
+
+    [__@alias@__]: The alias to set
+
+    __Returns:__ void
+
+    __C declaration:__ @duckdb_logical_type_set_alias@
+
+    __defined at:__ @duckdb.h 5183:19@
+
+    __exported by:__ @duckdb.h@
+-}
+c_duckdb_logical_type_set_alias ::
+     DuckDBLogicalType
+     {- ^
+
+          [__@type@__]: The logical type
+
+          __C declaration:__ @type@
+     -}
+  -> PtrConst.PtrConst BG.CChar
+     {- ^
+
+          [__@alias@__]: The alias to set
+
+          __C declaration:__ @alias@
+     -}
+  -> IO ()
+c_duckdb_logical_type_set_alias =
+  hs_bindgen_4c81dd82a58eab6c
+
+-- __unique:__ @Database_DuckDB_FFI_Database.DuckDB.FFI_Safe_duckdb_create_list_type@
+foreign import ccall safe "hs_bindgen_be34c8f6b1b36ac2" hs_bindgen_be34c8f6b1b36ac2_base ::
+     BG.Ptr BG.Void
+  -> IO (BG.Ptr BG.Void)
+
+-- __unique:__ @Database_DuckDB_FFI_Database.DuckDB.FFI_Safe_duckdb_create_list_type@
+hs_bindgen_be34c8f6b1b36ac2 ::
+     DuckDBLogicalType
+  -> IO DuckDBLogicalType
+hs_bindgen_be34c8f6b1b36ac2 =
+  \x0 ->
+    fmap BG.fromFFIType (hs_bindgen_be34c8f6b1b36ac2_base (BG.toFFIType x0))
+
+{-| Creates a LIST type from its child type. The return type must be destroyed with @'c_duckdb_destroy_logical_type'@ .
+
+    history:
+
+    * stable: v0.4.0
+
+    [__@type@__]: The child type of the list
+
+    __Returns:__ t'DuckDBLogicalType'
+
+    __C declaration:__ @duckdb_create_list_type@
+
+    __defined at:__ @duckdb.h 5196:34@
+
+    __exported by:__ @duckdb.h@
+-}
+c_duckdb_create_list_type ::
+     DuckDBLogicalType
+     {- ^
+
+          [__@type@__]: The child type of the list
+
+          __C declaration:__ @type@
+     -}
+  -> IO DuckDBLogicalType
+c_duckdb_create_list_type =
+  hs_bindgen_be34c8f6b1b36ac2
+
+-- __unique:__ @Database_DuckDB_FFI_Database.DuckDB.FFI_Safe_duckdb_create_array_type@
+foreign import ccall safe "hs_bindgen_a29e6ca64067833a" hs_bindgen_a29e6ca64067833a_base ::
+     BG.Ptr BG.Void
+  -> HsBindgen.Runtime.LibC.Word64
+  -> IO (BG.Ptr BG.Void)
+
+-- __unique:__ @Database_DuckDB_FFI_Database.DuckDB.FFI_Safe_duckdb_create_array_type@
+hs_bindgen_a29e6ca64067833a ::
+     DuckDBLogicalType
+  -> DuckDBIdx
+  -> IO DuckDBLogicalType
+hs_bindgen_a29e6ca64067833a =
+  \x0 ->
+    \x1 ->
+      fmap BG.fromFFIType (hs_bindgen_a29e6ca64067833a_base (BG.toFFIType x0) (BG.toFFIType x1))
+
+{-| Creates an ARRAY type from its child type. The return type must be destroyed with @'c_duckdb_destroy_logical_type'@ .
+
+    history:
+
+    * stable: v0.10.1
+
+    [__@type@__]: The child type of the array.
+
+    [__@array_size@__]: The number of elements in the array.
+
+    __Returns:__ t'DuckDBLogicalType'
+
+    __C declaration:__ @duckdb_create_array_type@
+
+    __defined at:__ @duckdb.h 5210:34@
+
+    __exported by:__ @duckdb.h@
+-}
+c_duckdb_create_array_type ::
+     DuckDBLogicalType
+     {- ^
+
+          [__@type@__]: The child type of the array.
+
+          __C declaration:__ @type@
+     -}
+  -> DuckDBIdx
+     {- ^
+
+          [__@array_size@__]: The number of elements in the array.
+
+          __C declaration:__ @array_size@
+     -}
+  -> IO DuckDBLogicalType
+c_duckdb_create_array_type =
+  hs_bindgen_a29e6ca64067833a
+
+-- __unique:__ @Database_DuckDB_FFI_Database.DuckDB.FFI_Safe_duckdb_create_map_type@
+foreign import ccall safe "hs_bindgen_d8ad5b24cb72b954" hs_bindgen_d8ad5b24cb72b954_base ::
+     BG.Ptr BG.Void
+  -> BG.Ptr BG.Void
+  -> IO (BG.Ptr BG.Void)
+
+-- __unique:__ @Database_DuckDB_FFI_Database.DuckDB.FFI_Safe_duckdb_create_map_type@
+hs_bindgen_d8ad5b24cb72b954 ::
+     DuckDBLogicalType
+  -> DuckDBLogicalType
+  -> IO DuckDBLogicalType
+hs_bindgen_d8ad5b24cb72b954 =
+  \x0 ->
+    \x1 ->
+      fmap BG.fromFFIType (hs_bindgen_d8ad5b24cb72b954_base (BG.toFFIType x0) (BG.toFFIType x1))
+
+{-| Creates a MAP type from its key type and value type. The return type must be destroyed with @'c_duckdb_destroy_logical_type'@ .
+
+    history:
+
+    * stable: v0.4.0
+
+    [__@key_type@__]: The map\'s key type.
+
+    [__@value_type@__]: The map\'s value type.
+
+    __Returns:__ t'DuckDBLogicalType'
+
+    __C declaration:__ @duckdb_create_map_type@
+
+    __defined at:__ @duckdb.h 5225:34@
+
+    __exported by:__ @duckdb.h@
+-}
+c_duckdb_create_map_type ::
+     DuckDBLogicalType
+     {- ^
+
+          [__@key_type@__]: The map\'s key type.
+
+          __C declaration:__ @key_type@
+     -}
+  -> DuckDBLogicalType
+     {- ^
+
+          [__@value_type@__]: The map\'s value type.
+
+          __C declaration:__ @value_type@
+     -}
+  -> IO DuckDBLogicalType
+c_duckdb_create_map_type =
+  hs_bindgen_d8ad5b24cb72b954
+
+-- __unique:__ @Database_DuckDB_FFI_Database.DuckDB.FFI_Safe_duckdb_create_union_type@
+foreign import ccall safe "hs_bindgen_91bc78375b61b95b" hs_bindgen_91bc78375b61b95b_base ::
+     BG.Ptr BG.Void
+  -> BG.Ptr BG.Void
+  -> HsBindgen.Runtime.LibC.Word64
+  -> IO (BG.Ptr BG.Void)
+
+-- __unique:__ @Database_DuckDB_FFI_Database.DuckDB.FFI_Safe_duckdb_create_union_type@
+hs_bindgen_91bc78375b61b95b ::
+     BG.Ptr DuckDBLogicalType
+  -> BG.Ptr (PtrConst.PtrConst BG.CChar)
+  -> DuckDBIdx
+  -> IO DuckDBLogicalType
+hs_bindgen_91bc78375b61b95b =
+  \x0 ->
+    \x1 ->
+      \x2 ->
+        fmap BG.fromFFIType (hs_bindgen_91bc78375b61b95b_base (BG.toFFIType x0) (BG.toFFIType x1) (BG.toFFIType x2))
+
+{-| Creates a UNION type from the passed arrays. The return type must be destroyed with @'c_duckdb_destroy_logical_type'@ .
+
+    history:
+
+    * stable: v0.7.0
+
+    [__@member_types@__]: The array of union member types.
+
+    [__@member_names@__]: The union member names.
+
+    [__@member_count@__]: The number of union members.
+
+    __Returns:__ t'DuckDBLogicalType'
+
+    __C declaration:__ @duckdb_create_union_type@
+
+    __defined at:__ @duckdb.h 5240:34@
+
+    __exported by:__ @duckdb.h@
+-}
+c_duckdb_create_union_type ::
+     BG.Ptr DuckDBLogicalType
+     {- ^
+
+          [__@member_types@__]: The array of union member types.
+
+          __C declaration:__ @member_types@
+     -}
+  -> BG.Ptr (PtrConst.PtrConst BG.CChar)
+     {- ^
+
+          [__@member_names@__]: The union member names.
+
+          __C declaration:__ @member_names@
+     -}
+  -> DuckDBIdx
+     {- ^
+
+          [__@member_count@__]: The number of union members.
+
+          __C declaration:__ @member_count@
+     -}
+  -> IO DuckDBLogicalType
+c_duckdb_create_union_type =
+  hs_bindgen_91bc78375b61b95b
+
+-- __unique:__ @Database_DuckDB_FFI_Database.DuckDB.FFI_Safe_duckdb_create_struct_type@
+foreign import ccall safe "hs_bindgen_0a08f82ca13a0b71" hs_bindgen_0a08f82ca13a0b71_base ::
+     BG.Ptr BG.Void
+  -> BG.Ptr BG.Void
+  -> HsBindgen.Runtime.LibC.Word64
+  -> IO (BG.Ptr BG.Void)
+
+-- __unique:__ @Database_DuckDB_FFI_Database.DuckDB.FFI_Safe_duckdb_create_struct_type@
+hs_bindgen_0a08f82ca13a0b71 ::
+     BG.Ptr DuckDBLogicalType
+  -> BG.Ptr (PtrConst.PtrConst BG.CChar)
+  -> DuckDBIdx
+  -> IO DuckDBLogicalType
+hs_bindgen_0a08f82ca13a0b71 =
+  \x0 ->
+    \x1 ->
+      \x2 ->
+        fmap BG.fromFFIType (hs_bindgen_0a08f82ca13a0b71_base (BG.toFFIType x0) (BG.toFFIType x1) (BG.toFFIType x2))
+
+{-| Creates a STRUCT type based on the member types and names. The resulting type must be destroyed with @'c_duckdb_destroy_logical_type'@ .
+
+    history:
+
+    * stable: v0.9.0
+
+    [__@member_types@__]: The array of types of the struct members.
+
+    [__@member_names@__]: The array of names of the struct members.
+
+    [__@member_count@__]: The number of members of the struct.
+
+    __Returns:__ t'DuckDBLogicalType'
+
+    __C declaration:__ @duckdb_create_struct_type@
+
+    __defined at:__ @duckdb.h 5257:34@
+
+    __exported by:__ @duckdb.h@
+-}
+c_duckdb_create_struct_type ::
+     BG.Ptr DuckDBLogicalType
+     {- ^
+
+          [__@member_types@__]: The array of types of the struct members.
+
+          __C declaration:__ @member_types@
+     -}
+  -> BG.Ptr (PtrConst.PtrConst BG.CChar)
+     {- ^
+
+          [__@member_names@__]: The array of names of the struct members.
+
+          __C declaration:__ @member_names@
+     -}
+  -> DuckDBIdx
+     {- ^
+
+          [__@member_count@__]: The number of members of the struct.
+
+          __C declaration:__ @member_count@
+     -}
+  -> IO DuckDBLogicalType
+c_duckdb_create_struct_type =
+  hs_bindgen_0a08f82ca13a0b71
+
+-- __unique:__ @Database_DuckDB_FFI_Database.DuckDB.FFI_Safe_duckdb_create_enum_type@
+foreign import ccall safe "hs_bindgen_f7adf54f731b7fa6" hs_bindgen_f7adf54f731b7fa6_base ::
+     BG.Ptr BG.Void
+  -> HsBindgen.Runtime.LibC.Word64
+  -> IO (BG.Ptr BG.Void)
+
+-- __unique:__ @Database_DuckDB_FFI_Database.DuckDB.FFI_Safe_duckdb_create_enum_type@
+hs_bindgen_f7adf54f731b7fa6 ::
+     BG.Ptr (PtrConst.PtrConst BG.CChar)
+  -> DuckDBIdx
+  -> IO DuckDBLogicalType
+hs_bindgen_f7adf54f731b7fa6 =
+  \x0 ->
+    \x1 ->
+      fmap BG.fromFFIType (hs_bindgen_f7adf54f731b7fa6_base (BG.toFFIType x0) (BG.toFFIType x1))
+
+{-| Creates an ENUM type from the passed member name array. The resulting type should be destroyed with @'c_duckdb_destroy_logical_type'@ .
+
+    history:
+
+    * stable: v0.10.0
+
+    [__@member_names@__]: The array of names that the enum should consist of.
+
+    [__@member_count@__]: The number of elements that were specified in the array.
+
+    __Returns:__ t'DuckDBLogicalType'
+
+    __C declaration:__ @duckdb_create_enum_type@
+
+    __defined at:__ @duckdb.h 5273:34@
+
+    __exported by:__ @duckdb.h@
+-}
+c_duckdb_create_enum_type ::
+     BG.Ptr (PtrConst.PtrConst BG.CChar)
+     {- ^
+
+          [__@member_names@__]: The array of names that the enum should consist of.
+
+          __C declaration:__ @member_names@
+     -}
+  -> DuckDBIdx
+     {- ^
+
+          [__@member_count@__]: The number of elements that were specified in the array.
+
+          __C declaration:__ @member_count@
+     -}
+  -> IO DuckDBLogicalType
+c_duckdb_create_enum_type =
+  hs_bindgen_f7adf54f731b7fa6
+
+-- __unique:__ @Database_DuckDB_FFI_Database.DuckDB.FFI_Safe_duckdb_create_decimal_type@
+foreign import ccall safe "hs_bindgen_ab3461fd12251fa5" hs_bindgen_ab3461fd12251fa5_base ::
+     HsBindgen.Runtime.LibC.Word8
+  -> HsBindgen.Runtime.LibC.Word8
+  -> IO (BG.Ptr BG.Void)
+
+-- __unique:__ @Database_DuckDB_FFI_Database.DuckDB.FFI_Safe_duckdb_create_decimal_type@
+hs_bindgen_ab3461fd12251fa5 ::
+     HsBindgen.Runtime.LibC.Word8
+  -> HsBindgen.Runtime.LibC.Word8
+  -> IO DuckDBLogicalType
+hs_bindgen_ab3461fd12251fa5 =
+  \x0 ->
+    \x1 ->
+      fmap BG.fromFFIType (hs_bindgen_ab3461fd12251fa5_base (BG.toFFIType x0) (BG.toFFIType x1))
+
+{-| Creates a DECIMAL type with the specified width and scale. The resulting type should be destroyed with @'c_duckdb_destroy_logical_type'@ .
+
+    history:
+
+    * stable: v0.3.3
+
+    [__@width@__]: The width of the decimal type
+
+    [__@scale@__]: The scale of the decimal type
+
+    __Returns:__ t'DuckDBLogicalType'
+
+    __C declaration:__ @duckdb_create_decimal_type@
+
+    __defined at:__ @duckdb.h 5288:34@
+
+    __exported by:__ @duckdb.h@
+-}
+c_duckdb_create_decimal_type ::
+     HsBindgen.Runtime.LibC.Word8
+     {- ^
+
+          [__@width@__]: The width of the decimal type
+
+          __C declaration:__ @width@
+     -}
+  -> HsBindgen.Runtime.LibC.Word8
+     {- ^
+
+          [__@scale@__]: The scale of the decimal type
+
+          __C declaration:__ @scale@
+     -}
+  -> IO DuckDBLogicalType
+c_duckdb_create_decimal_type =
+  hs_bindgen_ab3461fd12251fa5
+
+-- __unique:__ @Database_DuckDB_FFI_Database.DuckDB.FFI_Safe_duckdb_get_type_id@
+foreign import ccall safe "hs_bindgen_3c065a1280ea9665" hs_bindgen_3c065a1280ea9665_base ::
+     BG.Ptr BG.Void
+  -> IO BG.CUInt
+
+-- __unique:__ @Database_DuckDB_FFI_Database.DuckDB.FFI_Safe_duckdb_get_type_id@
+hs_bindgen_3c065a1280ea9665 ::
+     DuckDBLogicalType
+  -> IO DuckDBTypeAlias
+hs_bindgen_3c065a1280ea9665 =
+  \x0 ->
+    fmap BG.fromFFIType (hs_bindgen_3c065a1280ea9665_base (BG.toFFIType x0))
+
+{-| Retrieves the enum @t'DuckDBTypeAlias'@ of a @t'DuckDBLogicalType'@ .
+
+    history:
+
+    * stable: v0.3.3
+
+    [__@type@__]: The logical type.
+
+    __Returns:__ t'DuckDBTypeAlias'
+
+    __C declaration:__ @duckdb_get_type_id@
+
+    __defined at:__ @duckdb.h 5301:26@
+
+    __exported by:__ @duckdb.h@
+-}
+c_duckdb_get_type_id ::
+     DuckDBLogicalType
+     {- ^
+
+          [__@type@__]: The logical type.
+
+          __C declaration:__ @type@
+     -}
+  -> IO DuckDBTypeAlias
+c_duckdb_get_type_id = hs_bindgen_3c065a1280ea9665
+
+-- __unique:__ @Database_DuckDB_FFI_Database.DuckDB.FFI_Safe_duckdb_decimal_width@
+foreign import ccall safe "hs_bindgen_5cf2d0c9d544dd33" hs_bindgen_5cf2d0c9d544dd33_base ::
+     BG.Ptr BG.Void
+  -> IO HsBindgen.Runtime.LibC.Word8
+
+-- __unique:__ @Database_DuckDB_FFI_Database.DuckDB.FFI_Safe_duckdb_decimal_width@
+hs_bindgen_5cf2d0c9d544dd33 ::
+     DuckDBLogicalType
+  -> IO HsBindgen.Runtime.LibC.Word8
+hs_bindgen_5cf2d0c9d544dd33 =
+  \x0 ->
+    fmap BG.fromFFIType (hs_bindgen_5cf2d0c9d544dd33_base (BG.toFFIType x0))
+
+{-| Retrieves the width of a decimal type.
+
+    history:
+
+    * stable: v0.3.3
+
+    [__@type@__]: The logical type object
+
+    __Returns:__ uint8_t
+
+    __C declaration:__ @duckdb_decimal_width@
+
+    __defined at:__ @duckdb.h 5314:22@
+
+    __exported by:__ @duckdb.h@
+-}
+c_duckdb_decimal_width ::
+     DuckDBLogicalType
+     {- ^
+
+          [__@type@__]: The logical type object
+
+          __C declaration:__ @type@
+     -}
+  -> IO HsBindgen.Runtime.LibC.Word8
+c_duckdb_decimal_width = hs_bindgen_5cf2d0c9d544dd33
+
+-- __unique:__ @Database_DuckDB_FFI_Database.DuckDB.FFI_Safe_duckdb_decimal_scale@
+foreign import ccall safe "hs_bindgen_98a72864c14469ab" hs_bindgen_98a72864c14469ab_base ::
+     BG.Ptr BG.Void
+  -> IO HsBindgen.Runtime.LibC.Word8
+
+-- __unique:__ @Database_DuckDB_FFI_Database.DuckDB.FFI_Safe_duckdb_decimal_scale@
+hs_bindgen_98a72864c14469ab ::
+     DuckDBLogicalType
+  -> IO HsBindgen.Runtime.LibC.Word8
+hs_bindgen_98a72864c14469ab =
+  \x0 ->
+    fmap BG.fromFFIType (hs_bindgen_98a72864c14469ab_base (BG.toFFIType x0))
+
+{-| Retrieves the scale of a decimal type.
+
+    history:
+
+    * stable: v0.3.3
+
+    [__@type@__]: The logical type object
+
+    __Returns:__ uint8_t
+
+    __C declaration:__ @duckdb_decimal_scale@
+
+    __defined at:__ @duckdb.h 5327:22@
+
+    __exported by:__ @duckdb.h@
+-}
+c_duckdb_decimal_scale ::
+     DuckDBLogicalType
+     {- ^
+
+          [__@type@__]: The logical type object
+
+          __C declaration:__ @type@
+     -}
+  -> IO HsBindgen.Runtime.LibC.Word8
+c_duckdb_decimal_scale = hs_bindgen_98a72864c14469ab
+
+-- __unique:__ @Database_DuckDB_FFI_Database.DuckDB.FFI_Safe_duckdb_decimal_internal_type@
+foreign import ccall safe "hs_bindgen_fe2cf67b34d2f6cb" hs_bindgen_fe2cf67b34d2f6cb_base ::
+     BG.Ptr BG.Void
+  -> IO BG.CUInt
+
+-- __unique:__ @Database_DuckDB_FFI_Database.DuckDB.FFI_Safe_duckdb_decimal_internal_type@
+hs_bindgen_fe2cf67b34d2f6cb ::
+     DuckDBLogicalType
+  -> IO DuckDBTypeAlias
+hs_bindgen_fe2cf67b34d2f6cb =
+  \x0 ->
+    fmap BG.fromFFIType (hs_bindgen_fe2cf67b34d2f6cb_base (BG.toFFIType x0))
+
+{-| Retrieves the internal storage type of a decimal type.
+
+    history:
+
+    * stable: v0.3.3
+
+    [__@type@__]: The logical type object
+
+    __Returns:__ t'DuckDBTypeAlias'
+
+    __C declaration:__ @duckdb_decimal_internal_type@
+
+    __defined at:__ @duckdb.h 5340:26@
+
+    __exported by:__ @duckdb.h@
+-}
+c_duckdb_decimal_internal_type ::
+     DuckDBLogicalType
+     {- ^
+
+          [__@type@__]: The logical type object
+
+          __C declaration:__ @type@
+     -}
+  -> IO DuckDBTypeAlias
+c_duckdb_decimal_internal_type =
+  hs_bindgen_fe2cf67b34d2f6cb
+
+-- __unique:__ @Database_DuckDB_FFI_Database.DuckDB.FFI_Safe_duckdb_enum_internal_type@
+foreign import ccall safe "hs_bindgen_5155084716b3c35f" hs_bindgen_5155084716b3c35f_base ::
+     BG.Ptr BG.Void
+  -> IO BG.CUInt
+
+-- __unique:__ @Database_DuckDB_FFI_Database.DuckDB.FFI_Safe_duckdb_enum_internal_type@
+hs_bindgen_5155084716b3c35f ::
+     DuckDBLogicalType
+  -> IO DuckDBTypeAlias
+hs_bindgen_5155084716b3c35f =
+  \x0 ->
+    fmap BG.fromFFIType (hs_bindgen_5155084716b3c35f_base (BG.toFFIType x0))
+
+{-| Retrieves the internal storage type of an enum type.
+
+    history:
+
+    * stable: v0.3.3
+
+    [__@type@__]: The logical type object
+
+    __Returns:__ t'DuckDBTypeAlias'
+
+    __C declaration:__ @duckdb_enum_internal_type@
+
+    __defined at:__ @duckdb.h 5353:26@
+
+    __exported by:__ @duckdb.h@
+-}
+c_duckdb_enum_internal_type ::
+     DuckDBLogicalType
+     {- ^
+
+          [__@type@__]: The logical type object
+
+          __C declaration:__ @type@
+     -}
+  -> IO DuckDBTypeAlias
+c_duckdb_enum_internal_type =
+  hs_bindgen_5155084716b3c35f
+
+-- __unique:__ @Database_DuckDB_FFI_Database.DuckDB.FFI_Safe_duckdb_enum_dictionary_size@
+foreign import ccall safe "hs_bindgen_1e5564406f3fd9db" hs_bindgen_1e5564406f3fd9db_base ::
+     BG.Ptr BG.Void
+  -> IO HsBindgen.Runtime.LibC.Word32
+
+-- __unique:__ @Database_DuckDB_FFI_Database.DuckDB.FFI_Safe_duckdb_enum_dictionary_size@
+hs_bindgen_1e5564406f3fd9db ::
+     DuckDBLogicalType
+  -> IO HsBindgen.Runtime.LibC.Word32
+hs_bindgen_1e5564406f3fd9db =
+  \x0 ->
+    fmap BG.fromFFIType (hs_bindgen_1e5564406f3fd9db_base (BG.toFFIType x0))
+
+{-| Retrieves the dictionary size of the enum type.
+
+    history:
+
+    * stable: v0.3.3
+
+    [__@type@__]: The logical type object
+
+    __Returns:__ uint32_t
+
+    __C declaration:__ @duckdb_enum_dictionary_size@
+
+    __defined at:__ @duckdb.h 5366:23@
+
+    __exported by:__ @duckdb.h@
+-}
+c_duckdb_enum_dictionary_size ::
+     DuckDBLogicalType
+     {- ^
+
+          [__@type@__]: The logical type object
+
+          __C declaration:__ @type@
+     -}
+  -> IO HsBindgen.Runtime.LibC.Word32
+c_duckdb_enum_dictionary_size =
+  hs_bindgen_1e5564406f3fd9db
+
+-- __unique:__ @Database_DuckDB_FFI_Database.DuckDB.FFI_Safe_duckdb_enum_dictionary_value@
+foreign import ccall safe "hs_bindgen_9a20f17db8acbd70" hs_bindgen_9a20f17db8acbd70_base ::
+     BG.Ptr BG.Void
+  -> HsBindgen.Runtime.LibC.Word64
+  -> IO (BG.Ptr BG.Void)
+
+-- __unique:__ @Database_DuckDB_FFI_Database.DuckDB.FFI_Safe_duckdb_enum_dictionary_value@
+hs_bindgen_9a20f17db8acbd70 ::
+     DuckDBLogicalType
+  -> DuckDBIdx
+  -> IO (BG.Ptr BG.CChar)
+hs_bindgen_9a20f17db8acbd70 =
+  \x0 ->
+    \x1 ->
+      fmap BG.fromFFIType (hs_bindgen_9a20f17db8acbd70_base (BG.toFFIType x0) (BG.toFFIType x1))
+
+{-| Retrieves the dictionary value at the specified position from the enum.
+
+    The result must be freed with @'c_duckdb_free'@ .
+
+    history:
+
+    * stable: v0.3.3
+
+    [__@type@__]: The logical type object
+
+    [__@index@__]: The index in the dictionary
+
+    __Returns:__ char*
+
+    __C declaration:__ @duckdb_enum_dictionary_value@
+
+    __defined at:__ @duckdb.h 5382:20@
+
+    __exported by:__ @duckdb.h@
+-}
+c_duckdb_enum_dictionary_value ::
+     DuckDBLogicalType
+     {- ^
+
+          [__@type@__]: The logical type object
+
+          __C declaration:__ @type@
+     -}
+  -> DuckDBIdx
+     {- ^
+
+          [__@index@__]: The index in the dictionary
+
+          __C declaration:__ @index@
+     -}
+  -> IO (BG.Ptr BG.CChar)
+c_duckdb_enum_dictionary_value =
+  hs_bindgen_9a20f17db8acbd70
+
+-- __unique:__ @Database_DuckDB_FFI_Database.DuckDB.FFI_Safe_duckdb_list_type_child_type@
+foreign import ccall safe "hs_bindgen_4157ed3ba592d6c8" hs_bindgen_4157ed3ba592d6c8_base ::
+     BG.Ptr BG.Void
+  -> IO (BG.Ptr BG.Void)
+
+-- __unique:__ @Database_DuckDB_FFI_Database.DuckDB.FFI_Safe_duckdb_list_type_child_type@
+hs_bindgen_4157ed3ba592d6c8 ::
+     DuckDBLogicalType
+  -> IO DuckDBLogicalType
+hs_bindgen_4157ed3ba592d6c8 =
+  \x0 ->
+    fmap BG.fromFFIType (hs_bindgen_4157ed3ba592d6c8_base (BG.toFFIType x0))
+
+{-| Retrieves the child type of the given LIST type. Also accepts MAP types. The result must be freed with @'c_duckdb_destroy_logical_type'@ .
+
+    history:
+
+    * stable: v0.3.3
+
+    [__@type@__]: The logical type, either LIST or MAP.
+
+    __Returns:__ t'DuckDBLogicalType'
+
+    __C declaration:__ @duckdb_list_type_child_type@
+
+    __defined at:__ @duckdb.h 5396:34@
+
+    __exported by:__ @duckdb.h@
+-}
+c_duckdb_list_type_child_type ::
+     DuckDBLogicalType
+     {- ^
+
+          [__@type@__]: The logical type, either LIST or MAP.
+
+          __C declaration:__ @type@
+     -}
+  -> IO DuckDBLogicalType
+c_duckdb_list_type_child_type =
+  hs_bindgen_4157ed3ba592d6c8
+
+-- __unique:__ @Database_DuckDB_FFI_Database.DuckDB.FFI_Safe_duckdb_array_type_child_type@
+foreign import ccall safe "hs_bindgen_2b8ef5e6bdecc75c" hs_bindgen_2b8ef5e6bdecc75c_base ::
+     BG.Ptr BG.Void
+  -> IO (BG.Ptr BG.Void)
+
+-- __unique:__ @Database_DuckDB_FFI_Database.DuckDB.FFI_Safe_duckdb_array_type_child_type@
+hs_bindgen_2b8ef5e6bdecc75c ::
+     DuckDBLogicalType
+  -> IO DuckDBLogicalType
+hs_bindgen_2b8ef5e6bdecc75c =
+  \x0 ->
+    fmap BG.fromFFIType (hs_bindgen_2b8ef5e6bdecc75c_base (BG.toFFIType x0))
+
+{-| Retrieves the child type of the given ARRAY type.
+
+    The result must be freed with @'c_duckdb_destroy_logical_type'@ .
+
+    history:
+
+    * stable: v0.10.1
+
+    [__@type@__]: The logical type. Must be ARRAY.
+
+    __Returns:__ t'DuckDBLogicalType'
+
+    __C declaration:__ @duckdb_array_type_child_type@
+
+    __defined at:__ @duckdb.h 5411:34@
+
+    __exported by:__ @duckdb.h@
+-}
+c_duckdb_array_type_child_type ::
+     DuckDBLogicalType
+     {- ^
+
+          [__@type@__]: The logical type. Must be ARRAY.
+
+          __C declaration:__ @type@
+     -}
+  -> IO DuckDBLogicalType
+c_duckdb_array_type_child_type =
+  hs_bindgen_2b8ef5e6bdecc75c
+
+-- __unique:__ @Database_DuckDB_FFI_Database.DuckDB.FFI_Safe_duckdb_array_type_array_size@
+foreign import ccall safe "hs_bindgen_f95f493b93895a3d" hs_bindgen_f95f493b93895a3d_base ::
+     BG.Ptr BG.Void
+  -> IO HsBindgen.Runtime.LibC.Word64
+
+-- __unique:__ @Database_DuckDB_FFI_Database.DuckDB.FFI_Safe_duckdb_array_type_array_size@
+hs_bindgen_f95f493b93895a3d ::
+     DuckDBLogicalType
+  -> IO DuckDBIdx
+hs_bindgen_f95f493b93895a3d =
+  \x0 ->
+    fmap BG.fromFFIType (hs_bindgen_f95f493b93895a3d_base (BG.toFFIType x0))
+
+{-| Retrieves the array size of the given array type.
+
+    history:
+
+    * stable: v0.10.1
+
+    [__@type@__]: The logical type object
+
+    __Returns:__ t'DuckDBIdx'
+
+    __C declaration:__ @duckdb_array_type_array_size@
+
+    __defined at:__ @duckdb.h 5424:20@
+
+    __exported by:__ @duckdb.h@
+-}
+c_duckdb_array_type_array_size ::
+     DuckDBLogicalType
+     {- ^
+
+          [__@type@__]: The logical type object
+
+          __C declaration:__ @type@
+     -}
+  -> IO DuckDBIdx
+c_duckdb_array_type_array_size =
+  hs_bindgen_f95f493b93895a3d
+
+-- __unique:__ @Database_DuckDB_FFI_Database.DuckDB.FFI_Safe_duckdb_map_type_key_type@
+foreign import ccall safe "hs_bindgen_ba81e4d2dcf269b3" hs_bindgen_ba81e4d2dcf269b3_base ::
+     BG.Ptr BG.Void
+  -> IO (BG.Ptr BG.Void)
+
+-- __unique:__ @Database_DuckDB_FFI_Database.DuckDB.FFI_Safe_duckdb_map_type_key_type@
+hs_bindgen_ba81e4d2dcf269b3 ::
+     DuckDBLogicalType
+  -> IO DuckDBLogicalType
+hs_bindgen_ba81e4d2dcf269b3 =
+  \x0 ->
+    fmap BG.fromFFIType (hs_bindgen_ba81e4d2dcf269b3_base (BG.toFFIType x0))
+
+{-| Retrieves the key type of the given map type.
+
+    The result must be freed with @'c_duckdb_destroy_logical_type'@ .
+
+    history:
+
+    * stable: v0.4.0
+
+    [__@type@__]: The logical type object
+
+    __Returns:__ t'DuckDBLogicalType'
+
+    __C declaration:__ @duckdb_map_type_key_type@
+
+    __defined at:__ @duckdb.h 5439:34@
+
+    __exported by:__ @duckdb.h@
+-}
+c_duckdb_map_type_key_type ::
+     DuckDBLogicalType
+     {- ^
+
+          [__@type@__]: The logical type object
+
+          __C declaration:__ @type@
+     -}
+  -> IO DuckDBLogicalType
+c_duckdb_map_type_key_type =
+  hs_bindgen_ba81e4d2dcf269b3
+
+-- __unique:__ @Database_DuckDB_FFI_Database.DuckDB.FFI_Safe_duckdb_map_type_value_type@
+foreign import ccall safe "hs_bindgen_2c5cd92bbe195c7d" hs_bindgen_2c5cd92bbe195c7d_base ::
+     BG.Ptr BG.Void
+  -> IO (BG.Ptr BG.Void)
+
+-- __unique:__ @Database_DuckDB_FFI_Database.DuckDB.FFI_Safe_duckdb_map_type_value_type@
+hs_bindgen_2c5cd92bbe195c7d ::
+     DuckDBLogicalType
+  -> IO DuckDBLogicalType
+hs_bindgen_2c5cd92bbe195c7d =
+  \x0 ->
+    fmap BG.fromFFIType (hs_bindgen_2c5cd92bbe195c7d_base (BG.toFFIType x0))
+
+{-| Retrieves the value type of the given map type.
+
+    The result must be freed with @'c_duckdb_destroy_logical_type'@ .
+
+    history:
+
+    * stable: v0.4.0
+
+    [__@type@__]: The logical type object
+
+    __Returns:__ t'DuckDBLogicalType'
+
+    __C declaration:__ @duckdb_map_type_value_type@
+
+    __defined at:__ @duckdb.h 5454:34@
+
+    __exported by:__ @duckdb.h@
+-}
+c_duckdb_map_type_value_type ::
+     DuckDBLogicalType
+     {- ^
+
+          [__@type@__]: The logical type object
+
+          __C declaration:__ @type@
+     -}
+  -> IO DuckDBLogicalType
+c_duckdb_map_type_value_type =
+  hs_bindgen_2c5cd92bbe195c7d
+
+-- __unique:__ @Database_DuckDB_FFI_Database.DuckDB.FFI_Safe_duckdb_struct_type_child_count@
+foreign import ccall safe "hs_bindgen_9470b8d41ff2de33" hs_bindgen_9470b8d41ff2de33_base ::
+     BG.Ptr BG.Void
+  -> IO HsBindgen.Runtime.LibC.Word64
+
+-- __unique:__ @Database_DuckDB_FFI_Database.DuckDB.FFI_Safe_duckdb_struct_type_child_count@
+hs_bindgen_9470b8d41ff2de33 ::
+     DuckDBLogicalType
+  -> IO DuckDBIdx
+hs_bindgen_9470b8d41ff2de33 =
+  \x0 ->
+    fmap BG.fromFFIType (hs_bindgen_9470b8d41ff2de33_base (BG.toFFIType x0))
+
+{-| Returns the number of children of a struct type.
+
+    history:
+
+    * stable: v0.3.3
+
+    [__@type@__]: The logical type object
+
+    __Returns:__ t'DuckDBIdx'
+
+    __C declaration:__ @duckdb_struct_type_child_count@
+
+    __defined at:__ @duckdb.h 5467:20@
+
+    __exported by:__ @duckdb.h@
+-}
+c_duckdb_struct_type_child_count ::
+     DuckDBLogicalType
+     {- ^
+
+          [__@type@__]: The logical type object
+
+          __C declaration:__ @type@
+     -}
+  -> IO DuckDBIdx
+c_duckdb_struct_type_child_count =
+  hs_bindgen_9470b8d41ff2de33
+
+-- __unique:__ @Database_DuckDB_FFI_Database.DuckDB.FFI_Safe_duckdb_struct_type_child_name@
+foreign import ccall safe "hs_bindgen_b2175e8f7078654f" hs_bindgen_b2175e8f7078654f_base ::
+     BG.Ptr BG.Void
+  -> HsBindgen.Runtime.LibC.Word64
+  -> IO (BG.Ptr BG.Void)
+
+-- __unique:__ @Database_DuckDB_FFI_Database.DuckDB.FFI_Safe_duckdb_struct_type_child_name@
+hs_bindgen_b2175e8f7078654f ::
+     DuckDBLogicalType
+  -> DuckDBIdx
+  -> IO (BG.Ptr BG.CChar)
+hs_bindgen_b2175e8f7078654f =
+  \x0 ->
+    \x1 ->
+      fmap BG.fromFFIType (hs_bindgen_b2175e8f7078654f_base (BG.toFFIType x0) (BG.toFFIType x1))
+
+{-| Retrieves the name of the struct child.
+
+    The result must be freed with @'c_duckdb_free'@ .
+
+    history:
+
+    * stable: v0.3.3
+
+    [__@type@__]: The logical type object
+
+    [__@index@__]: The child index
+
+    __Returns:__ char*
+
+    __C declaration:__ @duckdb_struct_type_child_name@
+
+    __defined at:__ @duckdb.h 5483:20@
+
+    __exported by:__ @duckdb.h@
+-}
+c_duckdb_struct_type_child_name ::
+     DuckDBLogicalType
+     {- ^
+
+          [__@type@__]: The logical type object
+
+          __C declaration:__ @type@
+     -}
+  -> DuckDBIdx
+     {- ^
+
+          [__@index@__]: The child index
+
+          __C declaration:__ @index@
+     -}
+  -> IO (BG.Ptr BG.CChar)
+c_duckdb_struct_type_child_name =
+  hs_bindgen_b2175e8f7078654f
+
+-- __unique:__ @Database_DuckDB_FFI_Database.DuckDB.FFI_Safe_duckdb_struct_type_child_type@
+foreign import ccall safe "hs_bindgen_601601b3c2e40537" hs_bindgen_601601b3c2e40537_base ::
+     BG.Ptr BG.Void
+  -> HsBindgen.Runtime.LibC.Word64
+  -> IO (BG.Ptr BG.Void)
+
+-- __unique:__ @Database_DuckDB_FFI_Database.DuckDB.FFI_Safe_duckdb_struct_type_child_type@
+hs_bindgen_601601b3c2e40537 ::
+     DuckDBLogicalType
+  -> DuckDBIdx
+  -> IO DuckDBLogicalType
+hs_bindgen_601601b3c2e40537 =
+  \x0 ->
+    \x1 ->
+      fmap BG.fromFFIType (hs_bindgen_601601b3c2e40537_base (BG.toFFIType x0) (BG.toFFIType x1))
+
+{-| Retrieves the child type of the given struct type at the specified index.
+
+    The result must be freed with @'c_duckdb_destroy_logical_type'@ .
+
+    history:
+
+    * stable: v0.3.3
+
+    [__@type@__]: The logical type object
+
+    [__@index@__]: The child index
+
+    __Returns:__ t'DuckDBLogicalType'
+
+    __C declaration:__ @duckdb_struct_type_child_type@
+
+    __defined at:__ @duckdb.h 5499:34@
+
+    __exported by:__ @duckdb.h@
+-}
+c_duckdb_struct_type_child_type ::
+     DuckDBLogicalType
+     {- ^
+
+          [__@type@__]: The logical type object
+
+          __C declaration:__ @type@
+     -}
+  -> DuckDBIdx
+     {- ^
+
+          [__@index@__]: The child index
+
+          __C declaration:__ @index@
+     -}
+  -> IO DuckDBLogicalType
+c_duckdb_struct_type_child_type =
+  hs_bindgen_601601b3c2e40537
+
+-- __unique:__ @Database_DuckDB_FFI_Database.DuckDB.FFI_Safe_duckdb_union_type_member_count@
+foreign import ccall safe "hs_bindgen_1e4a7d3a9bf6afa8" hs_bindgen_1e4a7d3a9bf6afa8_base ::
+     BG.Ptr BG.Void
+  -> IO HsBindgen.Runtime.LibC.Word64
+
+-- __unique:__ @Database_DuckDB_FFI_Database.DuckDB.FFI_Safe_duckdb_union_type_member_count@
+hs_bindgen_1e4a7d3a9bf6afa8 ::
+     DuckDBLogicalType
+  -> IO DuckDBIdx
+hs_bindgen_1e4a7d3a9bf6afa8 =
+  \x0 ->
+    fmap BG.fromFFIType (hs_bindgen_1e4a7d3a9bf6afa8_base (BG.toFFIType x0))
+
+{-| Returns the number of members that the union type has.
+
+    history:
+
+    * stable: v0.7.0
+
+    [__@type@__]: The logical type (union) object
+
+    __Returns:__ t'DuckDBIdx'
+
+    __C declaration:__ @duckdb_union_type_member_count@
+
+    __defined at:__ @duckdb.h 5512:20@
+
+    __exported by:__ @duckdb.h@
+-}
+c_duckdb_union_type_member_count ::
+     DuckDBLogicalType
+     {- ^
+
+          [__@type@__]: The logical type (union) object
+
+          __C declaration:__ @type@
+     -}
+  -> IO DuckDBIdx
+c_duckdb_union_type_member_count =
+  hs_bindgen_1e4a7d3a9bf6afa8
+
+-- __unique:__ @Database_DuckDB_FFI_Database.DuckDB.FFI_Safe_duckdb_union_type_member_name@
+foreign import ccall safe "hs_bindgen_10b7095884bfd6c6" hs_bindgen_10b7095884bfd6c6_base ::
+     BG.Ptr BG.Void
+  -> HsBindgen.Runtime.LibC.Word64
+  -> IO (BG.Ptr BG.Void)
+
+-- __unique:__ @Database_DuckDB_FFI_Database.DuckDB.FFI_Safe_duckdb_union_type_member_name@
+hs_bindgen_10b7095884bfd6c6 ::
+     DuckDBLogicalType
+  -> DuckDBIdx
+  -> IO (BG.Ptr BG.CChar)
+hs_bindgen_10b7095884bfd6c6 =
+  \x0 ->
+    \x1 ->
+      fmap BG.fromFFIType (hs_bindgen_10b7095884bfd6c6_base (BG.toFFIType x0) (BG.toFFIType x1))
+
+{-| Retrieves the name of the union member.
+
+    The result must be freed with @'c_duckdb_free'@ .
+
+    history:
+
+    * stable: v0.7.0
+
+    [__@type@__]: The logical type object
+
+    [__@index@__]: The child index
+
+    __Returns:__ char*
+
+    __C declaration:__ @duckdb_union_type_member_name@
+
+    __defined at:__ @duckdb.h 5528:20@
+
+    __exported by:__ @duckdb.h@
+-}
+c_duckdb_union_type_member_name ::
+     DuckDBLogicalType
+     {- ^
+
+          [__@type@__]: The logical type object
+
+          __C declaration:__ @type@
+     -}
+  -> DuckDBIdx
+     {- ^
+
+          [__@index@__]: The child index
+
+          __C declaration:__ @index@
+     -}
+  -> IO (BG.Ptr BG.CChar)
+c_duckdb_union_type_member_name =
+  hs_bindgen_10b7095884bfd6c6
+
+-- __unique:__ @Database_DuckDB_FFI_Database.DuckDB.FFI_Safe_duckdb_union_type_member_type@
+foreign import ccall safe "hs_bindgen_c51b0baa0c7acc2b" hs_bindgen_c51b0baa0c7acc2b_base ::
+     BG.Ptr BG.Void
+  -> HsBindgen.Runtime.LibC.Word64
+  -> IO (BG.Ptr BG.Void)
+
+-- __unique:__ @Database_DuckDB_FFI_Database.DuckDB.FFI_Safe_duckdb_union_type_member_type@
+hs_bindgen_c51b0baa0c7acc2b ::
+     DuckDBLogicalType
+  -> DuckDBIdx
+  -> IO DuckDBLogicalType
+hs_bindgen_c51b0baa0c7acc2b =
+  \x0 ->
+    \x1 ->
+      fmap BG.fromFFIType (hs_bindgen_c51b0baa0c7acc2b_base (BG.toFFIType x0) (BG.toFFIType x1))
+
+{-| Retrieves the child type of the given union member at the specified index.
+
+    The result must be freed with @'c_duckdb_destroy_logical_type'@ .
+
+    history:
+
+    * stable: v0.7.0
+
+    [__@type@__]: The logical type object
+
+    [__@index@__]: The child index
+
+    __Returns:__ t'DuckDBLogicalType'
+
+    __C declaration:__ @duckdb_union_type_member_type@
+
+    __defined at:__ @duckdb.h 5544:34@
+
+    __exported by:__ @duckdb.h@
+-}
+c_duckdb_union_type_member_type ::
+     DuckDBLogicalType
+     {- ^
+
+          [__@type@__]: The logical type object
+
+          __C declaration:__ @type@
+     -}
+  -> DuckDBIdx
+     {- ^
+
+          [__@index@__]: The child index
+
+          __C declaration:__ @index@
+     -}
+  -> IO DuckDBLogicalType
+c_duckdb_union_type_member_type =
+  hs_bindgen_c51b0baa0c7acc2b
+
+-- __unique:__ @Database_DuckDB_FFI_Database.DuckDB.FFI_Safe_duckdb_destroy_logical_type@
+foreign import ccall safe "hs_bindgen_ba9f691ab447b325" hs_bindgen_ba9f691ab447b325_base ::
+     BG.Ptr BG.Void
+  -> IO ()
+
+-- __unique:__ @Database_DuckDB_FFI_Database.DuckDB.FFI_Safe_duckdb_destroy_logical_type@
+hs_bindgen_ba9f691ab447b325 ::
+     BG.Ptr DuckDBLogicalType
+  -> IO ()
+hs_bindgen_ba9f691ab447b325 =
+  \x0 ->
+    hs_bindgen_ba9f691ab447b325_base (BG.toFFIType x0)
+
+{-| Destroys the logical type and de-allocates all memory allocated for that type.
+
+    history:
+
+    * stable: v0.3.3
+
+    [__@type@__]: The logical type to destroy.
+
+    __Returns:__ void
+
+    __C declaration:__ @duckdb_destroy_logical_type@
+
+    __defined at:__ @duckdb.h 5557:19@
+
+    __exported by:__ @duckdb.h@
+-}
+c_duckdb_destroy_logical_type ::
+     BG.Ptr DuckDBLogicalType
+     {- ^
+
+          [__@type@__]: The logical type to destroy.
+
+          __C declaration:__ @type@
+     -}
+  -> IO ()
+c_duckdb_destroy_logical_type =
+  hs_bindgen_ba9f691ab447b325
+
+-- __unique:__ @Database_DuckDB_FFI_Database.DuckDB.FFI_Safe_duckdb_register_logical_type@
+foreign import ccall safe "hs_bindgen_04ac87cde857ea03" hs_bindgen_04ac87cde857ea03_base ::
+     BG.Ptr BG.Void
+  -> BG.Ptr BG.Void
+  -> BG.Ptr BG.Void
+  -> IO BG.CUInt
+
+-- __unique:__ @Database_DuckDB_FFI_Database.DuckDB.FFI_Safe_duckdb_register_logical_type@
+hs_bindgen_04ac87cde857ea03 ::
+     DuckDBConnection
+  -> DuckDBLogicalType
+  -> DuckDBCreateTypeInfo
+  -> IO DuckDBState
+hs_bindgen_04ac87cde857ea03 =
+  \x0 ->
+    \x1 ->
+      \x2 ->
+        fmap BG.fromFFIType (hs_bindgen_04ac87cde857ea03_base (BG.toFFIType x0) (BG.toFFIType x1) (BG.toFFIType x2))
+
+{-| Registers a custom type within the given connection. The type must have an alias
+
+    history:
+
+    * stable: v1.1.0
+
+    [__@con@__]: The connection to use
+
+    [__@type@__]: The custom type to register
+
+    [__@info@__]:
+
+    __Returns:__ t'DuckDBState'
+
+    __C declaration:__ @duckdb_register_logical_type@
+
+    __defined at:__ @duckdb.h 5572:27@
+
+    __exported by:__ @duckdb.h@
+-}
+c_duckdb_register_logical_type ::
+     DuckDBConnection
+     {- ^
+
+          [__@con@__]: The connection to use
+
+          __C declaration:__ @con@
+     -}
+  -> DuckDBLogicalType
+     {- ^
+
+          [__@type@__]: The custom type to register
+
+          __C declaration:__ @type@
+     -}
+  -> DuckDBCreateTypeInfo
+     {- ^
+
+          [__@info@__]:
+
+          __C declaration:__ @info@
+     -}
+  -> IO DuckDBState
+c_duckdb_register_logical_type =
+  hs_bindgen_04ac87cde857ea03
+
+-- __unique:__ @Database_DuckDB_FFI_Database.DuckDB.FFI_Safe_duckdb_geometry_type_get_crs@
+foreign import ccall safe "hs_bindgen_00c6f6b3b1a432f8" hs_bindgen_00c6f6b3b1a432f8_base ::
+     BG.Ptr BG.Void
+  -> IO (BG.Ptr BG.Void)
+
+-- __unique:__ @Database_DuckDB_FFI_Database.DuckDB.FFI_Safe_duckdb_geometry_type_get_crs@
+hs_bindgen_00c6f6b3b1a432f8 ::
+     DuckDBLogicalType
+  -> IO (BG.Ptr BG.CChar)
+hs_bindgen_00c6f6b3b1a432f8 =
+  \x0 ->
+    fmap BG.fromFFIType (hs_bindgen_00c6f6b3b1a432f8_base (BG.toFFIType x0))
+
+{-| Gets the CRS (Coordinate Reference System) of a GEOMETRY type. Result must be freed with @'c_duckdb_free'@ .
+
+    history:
+
+    * unstable: v1.5.2
+
+    * stable: v1.5.6
+
+    [__@type@__]: The GEOMETRY type.
+
+    __Returns:__ char*
+
+    __C declaration:__ @duckdb_geometry_type_get_crs@
+
+    __defined at:__ @duckdb.h 5587:20@
+
+    __exported by:__ @duckdb.h@
+-}
+c_duckdb_geometry_type_get_crs ::
+     DuckDBLogicalType
+     {- ^
+
+          [__@type@__]: The GEOMETRY type.
+
+          __C declaration:__ @type@
+     -}
+  -> IO (BG.Ptr BG.CChar)
+c_duckdb_geometry_type_get_crs =
+  hs_bindgen_00c6f6b3b1a432f8
+
+-- __unique:__ @Database_DuckDB_FFI_Database.DuckDB.FFI_Safe_duckdb_pending_prepared@
+foreign import ccall safe "hs_bindgen_140ec73cf4fe7786" hs_bindgen_140ec73cf4fe7786_base ::
+     BG.Ptr BG.Void
+  -> BG.Ptr BG.Void
+  -> IO BG.CUInt
+
+-- __unique:__ @Database_DuckDB_FFI_Database.DuckDB.FFI_Safe_duckdb_pending_prepared@
+hs_bindgen_140ec73cf4fe7786 ::
+     DuckDBPreparedStatement
+  -> BG.Ptr DuckDBPendingResult
+  -> IO DuckDBState
+hs_bindgen_140ec73cf4fe7786 =
+  \x0 ->
+    \x1 ->
+      fmap BG.fromFFIType (hs_bindgen_140ec73cf4fe7786_base (BG.toFFIType x0) (BG.toFFIType x1))
+
+{-| Executes the prepared statement with the given bound parameters, and returns a pending result. The pending result represents an intermediate structure for a query that is not yet fully executed. The pending result can be used to incrementally execute a query, returning control to the client between tasks.
+
+    Note that after calling @'c_duckdb_pending_prepared'@ , the pending result should always be destroyed using @'c_duckdb_destroy_pending'@ , even if this function returns DuckDBError.
+
+    history:
+
+    * stable: v0.5.0
+
+    [__@prepared_statement@__]: The prepared statement to execute.
+
+    [__@out_result@__]: The pending query result.
+
+    __Returns:__ t'DuckDBState'
+
+    __C declaration:__ @duckdb_pending_prepared@
+
+    __defined at:__ @duckdb.h 5624:27@
+
+    __exported by:__ @duckdb.h@
+-}
+c_duckdb_pending_prepared ::
+     DuckDBPreparedStatement
+     {- ^
+
+          [__@prepared_statement@__]: The prepared statement to execute.
+
+          __C declaration:__ @prepared_statement@
+     -}
+  -> BG.Ptr DuckDBPendingResult
+     {- ^
+
+          [__@out_result@__]: The pending query result.
+
+          __C declaration:__ @out_result@
+     -}
+  -> IO DuckDBState
+c_duckdb_pending_prepared =
+  hs_bindgen_140ec73cf4fe7786
+
+-- __unique:__ @Database_DuckDB_FFI_Database.DuckDB.FFI_Safe_duckdb_destroy_pending@
+foreign import ccall safe "hs_bindgen_e37a6341372605d4" hs_bindgen_e37a6341372605d4_base ::
+     BG.Ptr BG.Void
+  -> IO ()
+
+-- __unique:__ @Database_DuckDB_FFI_Database.DuckDB.FFI_Safe_duckdb_destroy_pending@
+hs_bindgen_e37a6341372605d4 ::
+     BG.Ptr DuckDBPendingResult
+  -> IO ()
+hs_bindgen_e37a6341372605d4 =
+  \x0 ->
+    hs_bindgen_e37a6341372605d4_base (BG.toFFIType x0)
+
+{-| Closes the pending result and de-allocates all memory allocated for the result.
+
+    Destroying a pending result whose statement has not completed aborts the statement. On autocommit, its writes are rolled back. Inside a transaction, a statement that may write invalidates the transaction, and a read-only statement just stops. Until the statement has completed, preparing or running another statement on the connection fails with @@DUCKDB_ERROR_RESOURCE_IN_USE@@ and leaves it untouched. @'c_duckdb_pending_execution_is_finished'@ reporting true does not mean that the statement completed. To make sure a statement takes effect, complete it before destroying the pending result: call @'c_duckdb_execute_pending'@ , and fetch a streaming result until @'c_duckdb_fetch_chunk'@ returns NULL. A NULL chunk is also returned on an error, so check @'c_duckdb_result_error'@ afterwards.
+
+    history:
+
+    * stable: v0.5.0
+
+    [__@pending_result@__]: The pending result to destroy.
+
+    __Returns:__ void
+
+    __C declaration:__ @duckdb_destroy_pending@
+
+    __defined at:__ @duckdb.h 5646:19@
+
+    __exported by:__ @duckdb.h@
+-}
+c_duckdb_destroy_pending ::
+     BG.Ptr DuckDBPendingResult
+     {- ^
+
+          [__@pending_result@__]: The pending result to destroy.
+
+          __C declaration:__ @pending_result@
+     -}
+  -> IO ()
+c_duckdb_destroy_pending =
+  hs_bindgen_e37a6341372605d4
+
+-- __unique:__ @Database_DuckDB_FFI_Database.DuckDB.FFI_Safe_duckdb_pending_error@
+foreign import ccall safe "hs_bindgen_2de8c0baba09d111" hs_bindgen_2de8c0baba09d111_base ::
+     BG.Ptr BG.Void
+  -> IO (BG.Ptr BG.Void)
+
+-- __unique:__ @Database_DuckDB_FFI_Database.DuckDB.FFI_Safe_duckdb_pending_error@
+hs_bindgen_2de8c0baba09d111 ::
+     DuckDBPendingResult
+  -> IO (PtrConst.PtrConst BG.CChar)
+hs_bindgen_2de8c0baba09d111 =
+  \x0 ->
+    fmap BG.fromFFIType (hs_bindgen_2de8c0baba09d111_base (BG.toFFIType x0))
+
+{-| Returns the error message contained within the pending result.
+
+    The result of this function must not be freed. It will be cleaned up when @'c_duckdb_destroy_pending'@ is called.
+
+    history:
+
+    * stable: v0.5.0
+
+    [__@pending_result@__]: The pending result to fetch the error from.
+
+    __Returns:__ const char*
+
+    __C declaration:__ @duckdb_pending_error@
+
+    __defined at:__ @duckdb.h 5661:26@
+
+    __exported by:__ @duckdb.h@
+-}
+c_duckdb_pending_error ::
+     DuckDBPendingResult
+     {- ^
+
+          [__@pending_result@__]: The pending result to fetch the error from.
+
+          __C declaration:__ @pending_result@
+     -}
+  -> IO (PtrConst.PtrConst BG.CChar)
+c_duckdb_pending_error = hs_bindgen_2de8c0baba09d111
+
+-- __unique:__ @Database_DuckDB_FFI_Database.DuckDB.FFI_Safe_duckdb_pending_execute_task@
+foreign import ccall safe "hs_bindgen_2f6bf9a23cbb0cec" hs_bindgen_2f6bf9a23cbb0cec_base ::
+     BG.Ptr BG.Void
+  -> IO BG.CUInt
+
+-- __unique:__ @Database_DuckDB_FFI_Database.DuckDB.FFI_Safe_duckdb_pending_execute_task@
+hs_bindgen_2f6bf9a23cbb0cec ::
+     DuckDBPendingResult
+  -> IO DuckDBPendingState
+hs_bindgen_2f6bf9a23cbb0cec =
+  \x0 ->
+    fmap BG.fromFFIType (hs_bindgen_2f6bf9a23cbb0cec_base (BG.toFFIType x0))
+
+{-| Executes a single task within the query, returning whether or not the query is ready.
+
+    If this returns DUCKDB_PENDING_RESULT_READY, the duckdb_execute_pending function can be called to obtain the result. If this returns DUCKDB_PENDING_RESULT_NOT_READY, the duckdb_pending_execute_task function should be called again. If this returns DUCKDB_PENDING_ERROR, an error occurred during execution.
+
+    The error message can be obtained by calling duckdb_pending_error on the pending_result.
+
+    history:
+
+    * stable: v0.5.0
+
+    [__@pending_result@__]: The pending result to execute a task within.
+
+    __Returns:__ t'DuckDBPendingState'
+
+    __C declaration:__ @duckdb_pending_execute_task@
+
+    __defined at:__ @duckdb.h 5680:35@
+
+    __exported by:__ @duckdb.h@
+-}
+c_duckdb_pending_execute_task ::
+     DuckDBPendingResult
+     {- ^
+
+          [__@pending_result@__]: The pending result to execute a task within.
+
+          __C declaration:__ @pending_result@
+     -}
+  -> IO DuckDBPendingState
+c_duckdb_pending_execute_task =
+  hs_bindgen_2f6bf9a23cbb0cec
+
+-- __unique:__ @Database_DuckDB_FFI_Database.DuckDB.FFI_Safe_duckdb_pending_execute_check_state@
+foreign import ccall safe "hs_bindgen_8846d60debc2282f" hs_bindgen_8846d60debc2282f_base ::
+     BG.Ptr BG.Void
+  -> IO BG.CUInt
+
+-- __unique:__ @Database_DuckDB_FFI_Database.DuckDB.FFI_Safe_duckdb_pending_execute_check_state@
+hs_bindgen_8846d60debc2282f ::
+     DuckDBPendingResult
+  -> IO DuckDBPendingState
+hs_bindgen_8846d60debc2282f =
+  \x0 ->
+    fmap BG.fromFFIType (hs_bindgen_8846d60debc2282f_base (BG.toFFIType x0))
+
+{-| If this returns DUCKDB_PENDING_RESULT_READY, the duckdb_execute_pending function can be called to obtain the result. If this returns DUCKDB_PENDING_RESULT_NOT_READY, the duckdb_pending_execute_check_state function should be called again. If this returns DUCKDB_PENDING_ERROR, an error occurred during execution.
+
+    The error message can be obtained by calling duckdb_pending_error on the pending_result.
+
+    history:
+
+    * stable: v0.10.0
+
+    [__@pending_result@__]: The pending result.
+
+    __Returns:__ t'DuckDBPendingState'
+
+    __C declaration:__ @duckdb_pending_execute_check_state@
+
+    __defined at:__ @duckdb.h 5697:35@
+
+    __exported by:__ @duckdb.h@
+-}
+c_duckdb_pending_execute_check_state ::
+     DuckDBPendingResult
+     {- ^
+
+          [__@pending_result@__]: The pending result.
+
+          __C declaration:__ @pending_result@
+     -}
+  -> IO DuckDBPendingState
+c_duckdb_pending_execute_check_state =
+  hs_bindgen_8846d60debc2282f
+
+-- __unique:__ @Database_DuckDB_FFI_Database.DuckDB.FFI_Safe_duckdb_execute_pending@
+foreign import ccall safe "hs_bindgen_8d348576f8547d1e" hs_bindgen_8d348576f8547d1e_base ::
+     BG.Ptr BG.Void
+  -> BG.Ptr BG.Void
+  -> IO BG.CUInt
+
+-- __unique:__ @Database_DuckDB_FFI_Database.DuckDB.FFI_Safe_duckdb_execute_pending@
+hs_bindgen_8d348576f8547d1e ::
+     DuckDBPendingResult
+  -> BG.Ptr DuckDBResult
+  -> IO DuckDBState
+hs_bindgen_8d348576f8547d1e =
+  \x0 ->
+    \x1 ->
+      fmap BG.fromFFIType (hs_bindgen_8d348576f8547d1e_base (BG.toFFIType x0) (BG.toFFIType x1))
+
+{-| Fully execute a pending query result, returning the final query result.
+
+    If duckdb_pending_execute_task has been called until DUCKDB_PENDING_RESULT_READY was returned, this will return fast. Otherwise, all remaining tasks must be executed first.
+
+    Note that the result must be freed with @'c_duckdb_destroy_result'@ .
+
+    history:
+
+    * stable: v0.5.0
+
+    [__@pending_result@__]: The pending result to execute.
+
+    [__@out_result@__]: The result object.
+
+    __Returns:__ t'DuckDBState'
+
+    __C declaration:__ @duckdb_execute_pending@
+
+    __defined at:__ @duckdb.h 5716:27@
+
+    __exported by:__ @duckdb.h@
+-}
+c_duckdb_execute_pending ::
+     DuckDBPendingResult
+     {- ^
+
+          [__@pending_result@__]: The pending result to execute.
+
+          __C declaration:__ @pending_result@
+     -}
+  -> BG.Ptr DuckDBResult
+     {- ^
+
+          [__@out_result@__]: The result object.
+
+          __C declaration:__ @out_result@
+     -}
+  -> IO DuckDBState
+c_duckdb_execute_pending =
+  hs_bindgen_8d348576f8547d1e
+
+-- __unique:__ @Database_DuckDB_FFI_Database.DuckDB.FFI_Safe_duckdb_pending_execution_is_finished@
+foreign import ccall safe "hs_bindgen_5dc99c4c5e03476c" hs_bindgen_5dc99c4c5e03476c_base ::
+     BG.CUInt
+  -> IO BG.CBool
+
+-- __unique:__ @Database_DuckDB_FFI_Database.DuckDB.FFI_Safe_duckdb_pending_execution_is_finished@
+hs_bindgen_5dc99c4c5e03476c ::
+     DuckDBPendingState
+  -> IO BG.CBool
+hs_bindgen_5dc99c4c5e03476c =
+  \x0 ->
+    fmap BG.fromFFIType (hs_bindgen_5dc99c4c5e03476c_base (BG.toFFIType x0))
+
+{-|
+
+    Returns whether a t'DuckDBPendingState' is finished executing. For example if @pending_state@ is DUCKDB_PENDING_RESULT_READY, this function will return true.
+
+    history:
+
+    * stable: v0.9.0
+
+    [__@pending_state@__]: The pending state on which to decide whether to finish execution.
+
+    __Returns:__ bool
+
+    __C declaration:__ @duckdb_pending_execution_is_finished@
+
+    __defined at:__ @duckdb.h 5730:19@
+
+    __exported by:__ @duckdb.h@
+-}
+c_duckdb_pending_execution_is_finished ::
+     DuckDBPendingState
+     {- ^
+
+          [__@pending_state@__]: The pending state on which to decide whether to finish execution.
+
+          __C declaration:__ @pending_state@
+     -}
+  -> IO BG.CBool
+c_duckdb_pending_execution_is_finished =
+  hs_bindgen_5dc99c4c5e03476c
+
+-- __unique:__ @Database_DuckDB_FFI_Database.DuckDB.FFI_Safe_duckdb_prepare@
+foreign import ccall safe "hs_bindgen_1bfada4bda17bfab" hs_bindgen_1bfada4bda17bfab_base ::
+     BG.Ptr BG.Void
+  -> BG.Ptr BG.Void
+  -> BG.Ptr BG.Void
+  -> IO BG.CUInt
+
+-- __unique:__ @Database_DuckDB_FFI_Database.DuckDB.FFI_Safe_duckdb_prepare@
+hs_bindgen_1bfada4bda17bfab ::
+     DuckDBConnection
+  -> PtrConst.PtrConst BG.CChar
+  -> BG.Ptr DuckDBPreparedStatement
+  -> IO DuckDBState
+hs_bindgen_1bfada4bda17bfab =
+  \x0 ->
+    \x1 ->
+      \x2 ->
+        fmap BG.fromFFIType (hs_bindgen_1bfada4bda17bfab_base (BG.toFFIType x0) (BG.toFFIType x1) (BG.toFFIType x2))
+
+{-| Create a prepared statement object from a query.
+
+    Note that after calling @'c_duckdb_prepare'@ , the prepared statement should always be destroyed using @'c_duckdb_destroy_prepare'@ , even if the prepare fails.
+
+    If the prepare fails, @'c_duckdb_prepare_error'@ can be called to obtain the reason why the prepare failed.
+
+    history:
+
+    * stable: v0.1.0
+
+    [__@connection@__]: The connection object
+
+    [__@query@__]: The SQL query to prepare
+
+    [__@out_prepared_statement@__]: The resulting prepared statement object
+
+    __Returns:__ t'DuckDBState'
+
+    __C declaration:__ @duckdb_prepare@
+
+    __defined at:__ @duckdb.h 5767:27@
+
+    __exported by:__ @duckdb.h@
+-}
+c_duckdb_prepare ::
+     DuckDBConnection
+     {- ^
+
+          [__@connection@__]: The connection object
+
+          __C declaration:__ @connection@
+     -}
+  -> PtrConst.PtrConst BG.CChar
+     {- ^
+
+          [__@query@__]: The SQL query to prepare
+
+          __C declaration:__ @query@
+     -}
+  -> BG.Ptr DuckDBPreparedStatement
+     {- ^
+
+          [__@out_prepared_statement@__]: The resulting prepared statement object
+
+          __C declaration:__ @out_prepared_statement@
+     -}
+  -> IO DuckDBState
+c_duckdb_prepare = hs_bindgen_1bfada4bda17bfab
+
+-- __unique:__ @Database_DuckDB_FFI_Database.DuckDB.FFI_Safe_duckdb_destroy_prepare@
+foreign import ccall safe "hs_bindgen_26ae03c9c4c5e7c4" hs_bindgen_26ae03c9c4c5e7c4_base ::
+     BG.Ptr BG.Void
+  -> IO ()
+
+-- __unique:__ @Database_DuckDB_FFI_Database.DuckDB.FFI_Safe_duckdb_destroy_prepare@
+hs_bindgen_26ae03c9c4c5e7c4 ::
+     BG.Ptr DuckDBPreparedStatement
+  -> IO ()
+hs_bindgen_26ae03c9c4c5e7c4 =
+  \x0 ->
+    hs_bindgen_26ae03c9c4c5e7c4_base (BG.toFFIType x0)
+
+{-| Closes the prepared statement and de-allocates all memory allocated for the statement.
+
+    history:
+
+    * stable: v0.1.0
+
+    [__@prepared_statement@__]: The prepared statement to destroy.
+
+    __Returns:__ void
+
+    __C declaration:__ @duckdb_destroy_prepare@
+
+    __defined at:__ @duckdb.h 5779:19@
+
+    __exported by:__ @duckdb.h@
+-}
+c_duckdb_destroy_prepare ::
+     BG.Ptr DuckDBPreparedStatement
+     {- ^
+
+          [__@prepared_statement@__]: The prepared statement to destroy.
+
+          __C declaration:__ @prepared_statement@
+     -}
+  -> IO ()
+c_duckdb_destroy_prepare =
+  hs_bindgen_26ae03c9c4c5e7c4
+
+-- __unique:__ @Database_DuckDB_FFI_Database.DuckDB.FFI_Safe_duckdb_prepare_error@
+foreign import ccall safe "hs_bindgen_b25b57b610531432" hs_bindgen_b25b57b610531432_base ::
+     BG.Ptr BG.Void
+  -> IO (BG.Ptr BG.Void)
+
+-- __unique:__ @Database_DuckDB_FFI_Database.DuckDB.FFI_Safe_duckdb_prepare_error@
+hs_bindgen_b25b57b610531432 ::
+     DuckDBPreparedStatement
+  -> IO (PtrConst.PtrConst BG.CChar)
+hs_bindgen_b25b57b610531432 =
+  \x0 ->
+    fmap BG.fromFFIType (hs_bindgen_b25b57b610531432_base (BG.toFFIType x0))
+
+{-| Returns the error message associated with the given prepared statement. If the prepared statement has no error message, this returns @nullptr@ instead.
+
+    The error message should not be freed. It will be de-allocated when @'c_duckdb_destroy_prepare'@ is called.
+
+    history:
+
+    * stable: v0.2.8
+
+    [__@prepared_statement@__]: The prepared statement to obtain the error from.
+
+    __Returns:__ const char*
+
+    __C declaration:__ @duckdb_prepare_error@
+
+    __defined at:__ @duckdb.h 5794:26@
+
+    __exported by:__ @duckdb.h@
+-}
+c_duckdb_prepare_error ::
+     DuckDBPreparedStatement
+     {- ^
+
+          [__@prepared_statement@__]: The prepared statement to obtain the error from.
+
+          __C declaration:__ @prepared_statement@
+     -}
+  -> IO (PtrConst.PtrConst BG.CChar)
+c_duckdb_prepare_error = hs_bindgen_b25b57b610531432
+
+-- __unique:__ @Database_DuckDB_FFI_Database.DuckDB.FFI_Safe_duckdb_nparams@
+foreign import ccall safe "hs_bindgen_5fa1fd0511ab6da4" hs_bindgen_5fa1fd0511ab6da4_base ::
+     BG.Ptr BG.Void
+  -> IO HsBindgen.Runtime.LibC.Word64
+
+-- __unique:__ @Database_DuckDB_FFI_Database.DuckDB.FFI_Safe_duckdb_nparams@
+hs_bindgen_5fa1fd0511ab6da4 ::
+     DuckDBPreparedStatement
+  -> IO DuckDBIdx
+hs_bindgen_5fa1fd0511ab6da4 =
+  \x0 ->
+    fmap BG.fromFFIType (hs_bindgen_5fa1fd0511ab6da4_base (BG.toFFIType x0))
+
+{-| Returns the number of parameters that can be provided to the given prepared statement.
+
+    Returns 0 if the query was not successfully prepared.
+
+    history:
+
+    * stable: v0.1.1
+
+    [__@prepared_statement@__]: The prepared statement to obtain the number of parameters for.
+
+    __Returns:__ t'DuckDBIdx'
+
+    __C declaration:__ @duckdb_nparams@
+
+    __defined at:__ @duckdb.h 5809:20@
+
+    __exported by:__ @duckdb.h@
+-}
+c_duckdb_nparams ::
+     DuckDBPreparedStatement
+     {- ^
+
+          [__@prepared_statement@__]: The prepared statement to obtain the number of parameters for.
+
+          __C declaration:__ @prepared_statement@
+     -}
+  -> IO DuckDBIdx
+c_duckdb_nparams = hs_bindgen_5fa1fd0511ab6da4
+
+-- __unique:__ @Database_DuckDB_FFI_Database.DuckDB.FFI_Safe_duckdb_parameter_name@
+foreign import ccall safe "hs_bindgen_eafa493aee3b4ab5" hs_bindgen_eafa493aee3b4ab5_base ::
+     BG.Ptr BG.Void
+  -> HsBindgen.Runtime.LibC.Word64
+  -> IO (BG.Ptr BG.Void)
+
+-- __unique:__ @Database_DuckDB_FFI_Database.DuckDB.FFI_Safe_duckdb_parameter_name@
+hs_bindgen_eafa493aee3b4ab5 ::
+     DuckDBPreparedStatement
+  -> DuckDBIdx
+  -> IO (PtrConst.PtrConst BG.CChar)
+hs_bindgen_eafa493aee3b4ab5 =
+  \x0 ->
+    \x1 ->
+      fmap BG.fromFFIType (hs_bindgen_eafa493aee3b4ab5_base (BG.toFFIType x0) (BG.toFFIType x1))
+
+{-| Returns the name used to identify the parameter The returned string should be freed using @'c_duckdb_free'@ .
+
+    Returns NULL if the index is out of range for the provided prepared statement.
+
+    history:
+
+    * stable: v0.9.0
+
+    [__@prepared_statement@__]: The prepared statement for which to get the parameter name from.
+
+    [__@index@__]:
+
+    __Returns:__ const char*
+
+    __C declaration:__ @duckdb_parameter_name@
+
+    __defined at:__ @duckdb.h 5825:26@
+
+    __exported by:__ @duckdb.h@
+-}
+c_duckdb_parameter_name ::
+     DuckDBPreparedStatement
+     {- ^
+
+          [__@prepared_statement@__]: The prepared statement for which to get the parameter name from.
+
+          __C declaration:__ @prepared_statement@
+     -}
+  -> DuckDBIdx
+     {- ^
+
+          [__@index@__]:
+
+          __C declaration:__ @index@
+     -}
+  -> IO (PtrConst.PtrConst BG.CChar)
+c_duckdb_parameter_name = hs_bindgen_eafa493aee3b4ab5
+
+-- __unique:__ @Database_DuckDB_FFI_Database.DuckDB.FFI_Safe_duckdb_param_type@
+foreign import ccall safe "hs_bindgen_c8918f417a9d0485" hs_bindgen_c8918f417a9d0485_base ::
+     BG.Ptr BG.Void
+  -> HsBindgen.Runtime.LibC.Word64
+  -> IO BG.CUInt
+
+-- __unique:__ @Database_DuckDB_FFI_Database.DuckDB.FFI_Safe_duckdb_param_type@
+hs_bindgen_c8918f417a9d0485 ::
+     DuckDBPreparedStatement
+  -> DuckDBIdx
+  -> IO DuckDBTypeAlias
+hs_bindgen_c8918f417a9d0485 =
+  \x0 ->
+    \x1 ->
+      fmap BG.fromFFIType (hs_bindgen_c8918f417a9d0485_base (BG.toFFIType x0) (BG.toFFIType x1))
+
+{-| Returns the parameter type for the parameter at the given index.
+
+    Returns @@DUCKDB_TYPE_INVALID@@ if the parameter index is out of range or the statement was not successfully prepared.
+
+    history:
+
+    * stable: v0.2.9
+
+    [__@prepared_statement@__]: The prepared statement.
+
+    [__@param_idx@__]: The parameter index.
+
+    __Returns:__ t'DuckDBTypeAlias'
+
+    __C declaration:__ @duckdb_param_type@
+
+    __defined at:__ @duckdb.h 5841:26@
+
+    __exported by:__ @duckdb.h@
+-}
+c_duckdb_param_type ::
+     DuckDBPreparedStatement
+     {- ^
+
+          [__@prepared_statement@__]: The prepared statement.
+
+          __C declaration:__ @prepared_statement@
+     -}
+  -> DuckDBIdx
+     {- ^
+
+          [__@param_idx@__]: The parameter index.
+
+          __C declaration:__ @param_idx@
+     -}
+  -> IO DuckDBTypeAlias
+c_duckdb_param_type = hs_bindgen_c8918f417a9d0485
+
+-- __unique:__ @Database_DuckDB_FFI_Database.DuckDB.FFI_Safe_duckdb_param_logical_type@
+foreign import ccall safe "hs_bindgen_4bdfeba8a2577d7c" hs_bindgen_4bdfeba8a2577d7c_base ::
+     BG.Ptr BG.Void
+  -> HsBindgen.Runtime.LibC.Word64
+  -> IO (BG.Ptr BG.Void)
+
+-- __unique:__ @Database_DuckDB_FFI_Database.DuckDB.FFI_Safe_duckdb_param_logical_type@
+hs_bindgen_4bdfeba8a2577d7c ::
+     DuckDBPreparedStatement
+  -> DuckDBIdx
+  -> IO DuckDBLogicalType
+hs_bindgen_4bdfeba8a2577d7c =
+  \x0 ->
+    \x1 ->
+      fmap BG.fromFFIType (hs_bindgen_4bdfeba8a2577d7c_base (BG.toFFIType x0) (BG.toFFIType x1))
+
+{-| Returns the logical type for the parameter at the given index.
+
+    Returns @nullptr@ if the parameter index is out of range or the statement was not successfully prepared.
+
+    The return type of this call should be destroyed with @'c_duckdb_destroy_logical_type'@ .
+
+    history:
+
+    * stable: v1.2.0
+
+    [__@prepared_statement@__]: The prepared statement.
+
+    [__@param_idx@__]: The parameter index.
+
+    __Returns:__ t'DuckDBLogicalType'
+
+    __C declaration:__ @duckdb_param_logical_type@
+
+    __defined at:__ @duckdb.h 5859:34@
+
+    __exported by:__ @duckdb.h@
+-}
+c_duckdb_param_logical_type ::
+     DuckDBPreparedStatement
+     {- ^
+
+          [__@prepared_statement@__]: The prepared statement.
+
+          __C declaration:__ @prepared_statement@
+     -}
+  -> DuckDBIdx
+     {- ^
+
+          [__@param_idx@__]: The parameter index.
+
+          __C declaration:__ @param_idx@
+     -}
+  -> IO DuckDBLogicalType
+c_duckdb_param_logical_type =
+  hs_bindgen_4bdfeba8a2577d7c
+
+-- __unique:__ @Database_DuckDB_FFI_Database.DuckDB.FFI_Safe_duckdb_clear_bindings@
+foreign import ccall safe "hs_bindgen_0baec870a17b08f5" hs_bindgen_0baec870a17b08f5_base ::
+     BG.Ptr BG.Void
+  -> IO BG.CUInt
+
+-- __unique:__ @Database_DuckDB_FFI_Database.DuckDB.FFI_Safe_duckdb_clear_bindings@
+hs_bindgen_0baec870a17b08f5 ::
+     DuckDBPreparedStatement
+  -> IO DuckDBState
+hs_bindgen_0baec870a17b08f5 =
+  \x0 ->
+    fmap BG.fromFFIType (hs_bindgen_0baec870a17b08f5_base (BG.toFFIType x0))
+
+{-| Clear the params bind to the prepared statement.
+
+    history:
+
+    * stable: v0.5.0
+
+    [__@prepared_statement@__]:
+
+    __Returns:__ t'DuckDBState'
+
+    __C declaration:__ @duckdb_clear_bindings@
+
+    __defined at:__ @duckdb.h 5873:27@
+
+    __exported by:__ @duckdb.h@
+-}
+c_duckdb_clear_bindings ::
+     DuckDBPreparedStatement
+     {- ^
+
+          [__@prepared_statement@__]:
+
+          __C declaration:__ @prepared_statement@
+     -}
+  -> IO DuckDBState
+c_duckdb_clear_bindings = hs_bindgen_0baec870a17b08f5
+
+-- __unique:__ @Database_DuckDB_FFI_Database.DuckDB.FFI_Safe_duckdb_prepared_statement_type@
+foreign import ccall safe "hs_bindgen_8d1f2852daa4baa8" hs_bindgen_8d1f2852daa4baa8_base ::
+     BG.Ptr BG.Void
+  -> IO BG.CUInt
+
+-- __unique:__ @Database_DuckDB_FFI_Database.DuckDB.FFI_Safe_duckdb_prepared_statement_type@
+hs_bindgen_8d1f2852daa4baa8 ::
+     DuckDBPreparedStatement
+  -> IO DuckDBStatementType
+hs_bindgen_8d1f2852daa4baa8 =
+  \x0 ->
+    fmap BG.fromFFIType (hs_bindgen_8d1f2852daa4baa8_base (BG.toFFIType x0))
+
+{-| Returns the statement type of the statement to be executed
+
+    history:
+
+    * stable: v0.10.0
+
+    [__@statement@__]: The prepared statement.
+
+    __Returns:__ t'DuckDBStatementType'
+
+    __C declaration:__ @duckdb_prepared_statement_type@
+
+    __defined at:__ @duckdb.h 5886:36@
+
+    __exported by:__ @duckdb.h@
+-}
+c_duckdb_prepared_statement_type ::
+     DuckDBPreparedStatement
+     {- ^
+
+          [__@statement@__]: The prepared statement.
+
+          __C declaration:__ @statement@
+     -}
+  -> IO DuckDBStatementType
+c_duckdb_prepared_statement_type =
+  hs_bindgen_8d1f2852daa4baa8
+
+-- __unique:__ @Database_DuckDB_FFI_Database.DuckDB.FFI_Safe_duckdb_prepared_statement_column_count@
+foreign import ccall safe "hs_bindgen_21b83c58e5576ccb" hs_bindgen_21b83c58e5576ccb_base ::
+     BG.Ptr BG.Void
+  -> IO HsBindgen.Runtime.LibC.Word64
+
+-- __unique:__ @Database_DuckDB_FFI_Database.DuckDB.FFI_Safe_duckdb_prepared_statement_column_count@
+hs_bindgen_21b83c58e5576ccb ::
+     DuckDBPreparedStatement
+  -> IO DuckDBIdx
+hs_bindgen_21b83c58e5576ccb =
+  \x0 ->
+    fmap BG.fromFFIType (hs_bindgen_21b83c58e5576ccb_base (BG.toFFIType x0))
+
+{-| Returns the number of columns present in a the result of the prepared statement. If any of the column types are invalid, the result will be 1.
+
+    history:
+
+    * unstable: v1.4.0
+
+    * stable: v1.5.6
+
+    [__@prepared_statement@__]: The prepared statement.
+
+    __Returns:__ t'DuckDBIdx'
+
+    __C declaration:__ @duckdb_prepared_statement_column_count@
+
+    __defined at:__ @duckdb.h 5901:20@
+
+    __exported by:__ @duckdb.h@
+-}
+c_duckdb_prepared_statement_column_count ::
+     DuckDBPreparedStatement
+     {- ^
+
+          [__@prepared_statement@__]: The prepared statement.
+
+          __C declaration:__ @prepared_statement@
+     -}
+  -> IO DuckDBIdx
+c_duckdb_prepared_statement_column_count =
+  hs_bindgen_21b83c58e5576ccb
+
+-- __unique:__ @Database_DuckDB_FFI_Database.DuckDB.FFI_Safe_duckdb_prepared_statement_column_name@
+foreign import ccall safe "hs_bindgen_2446429a160ae499" hs_bindgen_2446429a160ae499_base ::
+     BG.Ptr BG.Void
+  -> HsBindgen.Runtime.LibC.Word64
+  -> IO (BG.Ptr BG.Void)
+
+-- __unique:__ @Database_DuckDB_FFI_Database.DuckDB.FFI_Safe_duckdb_prepared_statement_column_name@
+hs_bindgen_2446429a160ae499 ::
+     DuckDBPreparedStatement
+  -> DuckDBIdx
+  -> IO (PtrConst.PtrConst BG.CChar)
+hs_bindgen_2446429a160ae499 =
+  \x0 ->
+    \x1 ->
+      fmap BG.fromFFIType (hs_bindgen_2446429a160ae499_base (BG.toFFIType x0) (BG.toFFIType x1))
+
+{-| Returns the name of the specified column of the result of the prepared_statement. The returned string should be freed using @'c_duckdb_free'@ .
+
+    Returns @nullptr@ if the column is out of range.
+
+    history:
+
+    * unstable: v1.4.0
+
+    * stable: v1.5.6
+
+    [__@prepared_statement@__]: The prepared statement.
+
+    [__@col_idx@__]: The column index.
+
+    __Returns:__ const char*
+
+    __C declaration:__ @duckdb_prepared_statement_column_name@
+
+    __defined at:__ @duckdb.h 5919:26@
+
+    __exported by:__ @duckdb.h@
+-}
+c_duckdb_prepared_statement_column_name ::
+     DuckDBPreparedStatement
+     {- ^
+
+          [__@prepared_statement@__]: The prepared statement.
+
+          __C declaration:__ @prepared_statement@
+     -}
+  -> DuckDBIdx
+     {- ^
+
+          [__@col_idx@__]: The column index.
+
+          __C declaration:__ @col_idx@
+     -}
+  -> IO (PtrConst.PtrConst BG.CChar)
+c_duckdb_prepared_statement_column_name =
+  hs_bindgen_2446429a160ae499
+
+-- __unique:__ @Database_DuckDB_FFI_Database.DuckDB.FFI_Safe_duckdb_prepared_statement_column_logical_type@
+foreign import ccall safe "hs_bindgen_ec1ee529d3d049b2" hs_bindgen_ec1ee529d3d049b2_base ::
+     BG.Ptr BG.Void
+  -> HsBindgen.Runtime.LibC.Word64
+  -> IO (BG.Ptr BG.Void)
+
+-- __unique:__ @Database_DuckDB_FFI_Database.DuckDB.FFI_Safe_duckdb_prepared_statement_column_logical_type@
+hs_bindgen_ec1ee529d3d049b2 ::
+     DuckDBPreparedStatement
+  -> DuckDBIdx
+  -> IO DuckDBLogicalType
+hs_bindgen_ec1ee529d3d049b2 =
+  \x0 ->
+    \x1 ->
+      fmap BG.fromFFIType (hs_bindgen_ec1ee529d3d049b2_base (BG.toFFIType x0) (BG.toFFIType x1))
+
+{-| Returns the column type of the specified column of the result of the prepared_statement.
+
+    Returns @@DUCKDB_TYPE_INVALID@@ if the column is out of range. The return type of this call should be destroyed with @'c_duckdb_destroy_logical_type'@ .
+
+    history:
+
+    * unstable: v1.4.0
+
+    * stable: v1.5.6
+
+    [__@prepared_statement@__]: The prepared statement to fetch the column type from.
+
+    [__@col_idx@__]: The column index.
+
+    __Returns:__ t'DuckDBLogicalType'
+
+    __C declaration:__ @duckdb_prepared_statement_column_logical_type@
+
+    __defined at:__ @duckdb.h 5939:1@
+
+    __exported by:__ @duckdb.h@
+-}
+c_duckdb_prepared_statement_column_logical_type ::
+     DuckDBPreparedStatement
+     {- ^
+
+          [__@prepared_statement@__]: The prepared statement to fetch the column type from.
+
+          __C declaration:__ @prepared_statement@
+     -}
+  -> DuckDBIdx
+     {- ^
+
+          [__@col_idx@__]: The column index.
+
+          __C declaration:__ @col_idx@
+     -}
+  -> IO DuckDBLogicalType
+c_duckdb_prepared_statement_column_logical_type =
+  hs_bindgen_ec1ee529d3d049b2
+
+-- __unique:__ @Database_DuckDB_FFI_Database.DuckDB.FFI_Safe_duckdb_prepared_statement_column_type@
+foreign import ccall safe "hs_bindgen_735e0700d4547b98" hs_bindgen_735e0700d4547b98_base ::
+     BG.Ptr BG.Void
+  -> HsBindgen.Runtime.LibC.Word64
+  -> IO BG.CUInt
+
+-- __unique:__ @Database_DuckDB_FFI_Database.DuckDB.FFI_Safe_duckdb_prepared_statement_column_type@
+hs_bindgen_735e0700d4547b98 ::
+     DuckDBPreparedStatement
+  -> DuckDBIdx
+  -> IO DuckDBTypeAlias
+hs_bindgen_735e0700d4547b98 =
+  \x0 ->
+    \x1 ->
+      fmap BG.fromFFIType (hs_bindgen_735e0700d4547b98_base (BG.toFFIType x0) (BG.toFFIType x1))
+
+{-| Returns the column type of the specified column of the result of the prepared_statement.
+
+    Returns @@DUCKDB_TYPE_INVALID@@ if the column is out of range.
+
+    history:
+
+    * unstable: v1.4.0
+
+    * stable: v1.5.6
+
+    [__@prepared_statement@__]: The prepared statement to fetch the column type from.
+
+    [__@col_idx@__]: The column index.
+
+    __Returns:__ t'DuckDBTypeAlias'
+
+    __C declaration:__ @duckdb_prepared_statement_column_type@
+
+    __defined at:__ @duckdb.h 5956:26@
+
+    __exported by:__ @duckdb.h@
+-}
+c_duckdb_prepared_statement_column_type ::
+     DuckDBPreparedStatement
+     {- ^
+
+          [__@prepared_statement@__]: The prepared statement to fetch the column type from.
+
+          __C declaration:__ @prepared_statement@
+     -}
+  -> DuckDBIdx
+     {- ^
+
+          [__@col_idx@__]: The column index.
+
+          __C declaration:__ @col_idx@
+     -}
+  -> IO DuckDBTypeAlias
+c_duckdb_prepared_statement_column_type =
+  hs_bindgen_735e0700d4547b98
+
+-- __unique:__ @Database_DuckDB_FFI_Database.DuckDB.FFI_Safe_duckdb_bind_value@
+foreign import ccall safe "hs_bindgen_a6297bae6e7d851e" hs_bindgen_a6297bae6e7d851e_base ::
+     BG.Ptr BG.Void
+  -> HsBindgen.Runtime.LibC.Word64
+  -> BG.Ptr BG.Void
+  -> IO BG.CUInt
+
+-- __unique:__ @Database_DuckDB_FFI_Database.DuckDB.FFI_Safe_duckdb_bind_value@
+hs_bindgen_a6297bae6e7d851e ::
+     DuckDBPreparedStatement
+  -> DuckDBIdx
+  -> DuckDBValue
+  -> IO DuckDBState
+hs_bindgen_a6297bae6e7d851e =
+  \x0 ->
+    \x1 ->
+      \x2 ->
+        fmap BG.fromFFIType (hs_bindgen_a6297bae6e7d851e_base (BG.toFFIType x0) (BG.toFFIType x1) (BG.toFFIType x2))
+
+{-| Binds a value to the prepared statement at the specified index.
+
+    Supersedes all type-specific bind functions (e.g., @'c_duckdb_bind_varchar'@ , @'c_duckdb_bind_int64'@ , etc.).
+
+    history:
+
+    * stable: v0.9.0
+
+    [__@prepared_statement@__]:
+
+    [__@param_idx@__]:
+
+    [__@val@__]:
+
+    __Returns:__ t'DuckDBState'
+
+    __C declaration:__ @duckdb_bind_value@
+
+    __defined at:__ @duckdb.h 5974:27@
+
+    __exported by:__ @duckdb.h@
+-}
+c_duckdb_bind_value ::
+     DuckDBPreparedStatement
+     {- ^
+
+          [__@prepared_statement@__]:
+
+          __C declaration:__ @prepared_statement@
+     -}
+  -> DuckDBIdx
+     {- ^
+
+          [__@param_idx@__]:
+
+          __C declaration:__ @param_idx@
+     -}
+  -> DuckDBValue
+     {- ^
+
+          [__@val@__]:
+
+          __C declaration:__ @val@
+     -}
+  -> IO DuckDBState
+c_duckdb_bind_value = hs_bindgen_a6297bae6e7d851e
+
+-- __unique:__ @Database_DuckDB_FFI_Database.DuckDB.FFI_Safe_duckdb_bind_parameter_index@
+foreign import ccall safe "hs_bindgen_246486cf8a18dc9c" hs_bindgen_246486cf8a18dc9c_base ::
+     BG.Ptr BG.Void
+  -> BG.Ptr BG.Void
+  -> BG.Ptr BG.Void
+  -> IO BG.CUInt
+
+-- __unique:__ @Database_DuckDB_FFI_Database.DuckDB.FFI_Safe_duckdb_bind_parameter_index@
+hs_bindgen_246486cf8a18dc9c ::
+     DuckDBPreparedStatement
+  -> BG.Ptr DuckDBIdx
+  -> PtrConst.PtrConst BG.CChar
+  -> IO DuckDBState
+hs_bindgen_246486cf8a18dc9c =
+  \x0 ->
+    \x1 ->
+      \x2 ->
+        fmap BG.fromFFIType (hs_bindgen_246486cf8a18dc9c_base (BG.toFFIType x0) (BG.toFFIType x1) (BG.toFFIType x2))
+
+{-| Retrieve the index of the parameter for the prepared statement, identified by name
+
+    history:
+
+    * stable: v0.9.0
+
+    [__@prepared_statement@__]:
+
+    [__@param_idx_out@__]:
+
+    [__@name@__]:
+
+    __Returns:__ t'DuckDBState'
+
+    __C declaration:__ @duckdb_bind_parameter_index@
+
+    __defined at:__ @duckdb.h 5990:27@
+
+    __exported by:__ @duckdb.h@
+-}
+c_duckdb_bind_parameter_index ::
+     DuckDBPreparedStatement
+     {- ^
+
+          [__@prepared_statement@__]:
+
+          __C declaration:__ @prepared_statement@
+     -}
+  -> BG.Ptr DuckDBIdx
+     {- ^
+
+          [__@param_idx_out@__]:
+
+          __C declaration:__ @param_idx_out@
+     -}
+  -> PtrConst.PtrConst BG.CChar
+     {- ^
+
+          [__@name@__]:
+
+          __C declaration:__ @name@
+     -}
+  -> IO DuckDBState
+c_duckdb_bind_parameter_index =
+  hs_bindgen_246486cf8a18dc9c
+
+-- __unique:__ @Database_DuckDB_FFI_Database.DuckDB.FFI_Safe_duckdb_bind_boolean@
+foreign import ccall safe "hs_bindgen_de1a77f688a34f93" hs_bindgen_de1a77f688a34f93_base ::
+     BG.Ptr BG.Void
+  -> HsBindgen.Runtime.LibC.Word64
+  -> BG.CBool
+  -> IO BG.CUInt
+
+-- __unique:__ @Database_DuckDB_FFI_Database.DuckDB.FFI_Safe_duckdb_bind_boolean@
+hs_bindgen_de1a77f688a34f93 ::
+     DuckDBPreparedStatement
+  -> DuckDBIdx
+  -> BG.CBool
+  -> IO DuckDBState
+hs_bindgen_de1a77f688a34f93 =
+  \x0 ->
+    \x1 ->
+      \x2 ->
+        fmap BG.fromFFIType (hs_bindgen_de1a77f688a34f93_base (BG.toFFIType x0) (BG.toFFIType x1) (BG.toFFIType x2))
+
+{-| Binds a bool value to the prepared statement at the specified index.
+
+    history:
+
+    * stable: v0.1.0
+
+    [__@prepared_statement@__]:
+
+    [__@param_idx@__]:
+
+    [__@val@__]:
+
+    __Returns:__ t'DuckDBState'
+
+    __C declaration:__ @duckdb_bind_boolean@
+
+    __defined at:__ @duckdb.h 6005:27@
+
+    __exported by:__ @duckdb.h@
+-}
+c_duckdb_bind_boolean ::
+     DuckDBPreparedStatement
+     {- ^
+
+          [__@prepared_statement@__]:
+
+          __C declaration:__ @prepared_statement@
+     -}
+  -> DuckDBIdx
+     {- ^
+
+          [__@param_idx@__]:
+
+          __C declaration:__ @param_idx@
+     -}
+  -> BG.CBool
+     {- ^
+
+          [__@val@__]:
+
+          __C declaration:__ @val@
+     -}
+  -> IO DuckDBState
+c_duckdb_bind_boolean = hs_bindgen_de1a77f688a34f93
+
+-- __unique:__ @Database_DuckDB_FFI_Database.DuckDB.FFI_Safe_duckdb_bind_int8@
+foreign import ccall safe "hs_bindgen_eda830b5f9d73c28" hs_bindgen_eda830b5f9d73c28_base ::
+     BG.Ptr BG.Void
+  -> HsBindgen.Runtime.LibC.Word64
+  -> HsBindgen.Runtime.LibC.Int8
+  -> IO BG.CUInt
+
+-- __unique:__ @Database_DuckDB_FFI_Database.DuckDB.FFI_Safe_duckdb_bind_int8@
+hs_bindgen_eda830b5f9d73c28 ::
+     DuckDBPreparedStatement
+  -> DuckDBIdx
+  -> HsBindgen.Runtime.LibC.Int8
+  -> IO DuckDBState
+hs_bindgen_eda830b5f9d73c28 =
+  \x0 ->
+    \x1 ->
+      \x2 ->
+        fmap BG.fromFFIType (hs_bindgen_eda830b5f9d73c28_base (BG.toFFIType x0) (BG.toFFIType x1) (BG.toFFIType x2))
+
+{-| Binds an int8_t value to the prepared statement at the specified index.
+
+    history:
+
+    * stable: v0.1.0
+
+    [__@prepared_statement@__]:
+
+    [__@param_idx@__]:
+
+    [__@val@__]:
+
+    __Returns:__ t'DuckDBState'
+
+    __C declaration:__ @duckdb_bind_int8@
+
+    __defined at:__ @duckdb.h 6018:27@
+
+    __exported by:__ @duckdb.h@
+-}
+c_duckdb_bind_int8 ::
+     DuckDBPreparedStatement
+     {- ^
+
+          [__@prepared_statement@__]:
+
+          __C declaration:__ @prepared_statement@
+     -}
+  -> DuckDBIdx
+     {- ^
+
+          [__@param_idx@__]:
+
+          __C declaration:__ @param_idx@
+     -}
+  -> HsBindgen.Runtime.LibC.Int8
+     {- ^
+
+          [__@val@__]:
+
+          __C declaration:__ @val@
+     -}
+  -> IO DuckDBState
+c_duckdb_bind_int8 = hs_bindgen_eda830b5f9d73c28
+
+-- __unique:__ @Database_DuckDB_FFI_Database.DuckDB.FFI_Safe_duckdb_bind_int16@
+foreign import ccall safe "hs_bindgen_0355aa2cb5b1fa2e" hs_bindgen_0355aa2cb5b1fa2e_base ::
+     BG.Ptr BG.Void
+  -> HsBindgen.Runtime.LibC.Word64
+  -> HsBindgen.Runtime.LibC.Int16
+  -> IO BG.CUInt
+
+-- __unique:__ @Database_DuckDB_FFI_Database.DuckDB.FFI_Safe_duckdb_bind_int16@
+hs_bindgen_0355aa2cb5b1fa2e ::
+     DuckDBPreparedStatement
+  -> DuckDBIdx
+  -> HsBindgen.Runtime.LibC.Int16
+  -> IO DuckDBState
+hs_bindgen_0355aa2cb5b1fa2e =
+  \x0 ->
+    \x1 ->
+      \x2 ->
+        fmap BG.fromFFIType (hs_bindgen_0355aa2cb5b1fa2e_base (BG.toFFIType x0) (BG.toFFIType x1) (BG.toFFIType x2))
+
+{-| Binds an int16_t value to the prepared statement at the specified index.
+
+    history:
+
+    * stable: v0.1.0
+
+    [__@prepared_statement@__]:
+
+    [__@param_idx@__]:
+
+    [__@val@__]:
+
+    __Returns:__ t'DuckDBState'
+
+    __C declaration:__ @duckdb_bind_int16@
+
+    __defined at:__ @duckdb.h 6031:27@
+
+    __exported by:__ @duckdb.h@
+-}
+c_duckdb_bind_int16 ::
+     DuckDBPreparedStatement
+     {- ^
+
+          [__@prepared_statement@__]:
+
+          __C declaration:__ @prepared_statement@
+     -}
+  -> DuckDBIdx
+     {- ^
+
+          [__@param_idx@__]:
+
+          __C declaration:__ @param_idx@
+     -}
+  -> HsBindgen.Runtime.LibC.Int16
+     {- ^
+
+          [__@val@__]:
+
+          __C declaration:__ @val@
+     -}
+  -> IO DuckDBState
+c_duckdb_bind_int16 = hs_bindgen_0355aa2cb5b1fa2e
+
+-- __unique:__ @Database_DuckDB_FFI_Database.DuckDB.FFI_Safe_duckdb_bind_int32@
+foreign import ccall safe "hs_bindgen_a4f099fbb0a6ba13" hs_bindgen_a4f099fbb0a6ba13_base ::
+     BG.Ptr BG.Void
+  -> HsBindgen.Runtime.LibC.Word64
+  -> HsBindgen.Runtime.LibC.Int32
+  -> IO BG.CUInt
+
+-- __unique:__ @Database_DuckDB_FFI_Database.DuckDB.FFI_Safe_duckdb_bind_int32@
+hs_bindgen_a4f099fbb0a6ba13 ::
+     DuckDBPreparedStatement
+  -> DuckDBIdx
+  -> HsBindgen.Runtime.LibC.Int32
+  -> IO DuckDBState
+hs_bindgen_a4f099fbb0a6ba13 =
+  \x0 ->
+    \x1 ->
+      \x2 ->
+        fmap BG.fromFFIType (hs_bindgen_a4f099fbb0a6ba13_base (BG.toFFIType x0) (BG.toFFIType x1) (BG.toFFIType x2))
+
+{-| Binds an int32_t value to the prepared statement at the specified index.
+
+    history:
+
+    * stable: v0.1.0
+
+    [__@prepared_statement@__]:
+
+    [__@param_idx@__]:
+
+    [__@val@__]:
+
+    __Returns:__ t'DuckDBState'
+
+    __C declaration:__ @duckdb_bind_int32@
+
+    __defined at:__ @duckdb.h 6044:27@
+
+    __exported by:__ @duckdb.h@
+-}
+c_duckdb_bind_int32 ::
+     DuckDBPreparedStatement
+     {- ^
+
+          [__@prepared_statement@__]:
+
+          __C declaration:__ @prepared_statement@
+     -}
+  -> DuckDBIdx
+     {- ^
+
+          [__@param_idx@__]:
+
+          __C declaration:__ @param_idx@
+     -}
+  -> HsBindgen.Runtime.LibC.Int32
+     {- ^
+
+          [__@val@__]:
+
+          __C declaration:__ @val@
+     -}
+  -> IO DuckDBState
+c_duckdb_bind_int32 = hs_bindgen_a4f099fbb0a6ba13
+
+-- __unique:__ @Database_DuckDB_FFI_Database.DuckDB.FFI_Safe_duckdb_bind_int64@
+foreign import ccall safe "hs_bindgen_2ec951c583ce8e04" hs_bindgen_2ec951c583ce8e04_base ::
+     BG.Ptr BG.Void
+  -> HsBindgen.Runtime.LibC.Word64
+  -> HsBindgen.Runtime.LibC.Int64
+  -> IO BG.CUInt
+
+-- __unique:__ @Database_DuckDB_FFI_Database.DuckDB.FFI_Safe_duckdb_bind_int64@
+hs_bindgen_2ec951c583ce8e04 ::
+     DuckDBPreparedStatement
+  -> DuckDBIdx
+  -> HsBindgen.Runtime.LibC.Int64
+  -> IO DuckDBState
+hs_bindgen_2ec951c583ce8e04 =
+  \x0 ->
+    \x1 ->
+      \x2 ->
+        fmap BG.fromFFIType (hs_bindgen_2ec951c583ce8e04_base (BG.toFFIType x0) (BG.toFFIType x1) (BG.toFFIType x2))
+
+{-| Binds an int64_t value to the prepared statement at the specified index.
+
+    history:
+
+    * stable: v0.1.0
+
+    [__@prepared_statement@__]:
+
+    [__@param_idx@__]:
+
+    [__@val@__]:
+
+    __Returns:__ t'DuckDBState'
+
+    __C declaration:__ @duckdb_bind_int64@
+
+    __defined at:__ @duckdb.h 6057:27@
+
+    __exported by:__ @duckdb.h@
+-}
+c_duckdb_bind_int64 ::
+     DuckDBPreparedStatement
+     {- ^
+
+          [__@prepared_statement@__]:
+
+          __C declaration:__ @prepared_statement@
+     -}
+  -> DuckDBIdx
+     {- ^
+
+          [__@param_idx@__]:
+
+          __C declaration:__ @param_idx@
+     -}
+  -> HsBindgen.Runtime.LibC.Int64
+     {- ^
+
+          [__@val@__]:
+
+          __C declaration:__ @val@
+     -}
+  -> IO DuckDBState
+c_duckdb_bind_int64 = hs_bindgen_2ec951c583ce8e04
+
+-- __unique:__ @Database_DuckDB_FFI_Database.DuckDB.FFI_Safe_duckdb_bind_hugeint@
+foreign import ccall safe "hs_bindgen_8780a04bf33744c5" hs_bindgen_8780a04bf33744c5_base ::
+     BG.Ptr BG.Void
+  -> HsBindgen.Runtime.LibC.Word64
+  -> BG.Ptr BG.Void
+  -> IO BG.CUInt
+
+-- __unique:__ @Database_DuckDB_FFI_Database.DuckDB.FFI_Safe_duckdb_bind_hugeint@
+hs_bindgen_8780a04bf33744c5 ::
+     DuckDBPreparedStatement
+  -> DuckDBIdx
+  -> BG.Ptr DuckDBHugeInt
+  -> IO DuckDBState
+hs_bindgen_8780a04bf33744c5 =
+  \x0 ->
+    \x1 ->
+      \x2 ->
+        fmap BG.fromFFIType (hs_bindgen_8780a04bf33744c5_base (BG.toFFIType x0) (BG.toFFIType x1) (BG.toFFIType x2))
+
+{-|
+
+    Binds a t'DuckDBHugeInt' value to the prepared statement at the specified index.
+
+    history:
+
+    * stable: v0.2.9
+
+    [__@prepared_statement@__]:
+
+    [__@param_idx@__]:
+
+    [__@val@__]:
+
+    __Returns:__ t'DuckDBState'
+
+    __C declaration:__ @duckdb_bind_hugeint@
+
+    __defined at:__ @duckdb.h 6071:27@
+
+    __exported by:__ @duckdb.h@
+-}
+c_duckdb_bind_hugeint ::
+     DuckDBPreparedStatement
+     {- ^
+
+          [__@prepared_statement@__]:
+
+          __C declaration:__ @prepared_statement@
+     -}
+  -> DuckDBIdx
+     {- ^
+
+          [__@param_idx@__]:
+
+          __C declaration:__ @param_idx@
+     -}
+  -> DuckDBHugeInt
+     {- ^
+
+          [__@val@__]:
+
+          __C declaration:__ @val@
+     -}
+  -> IO DuckDBState
+c_duckdb_bind_hugeint =
+  \prepared_statement0 ->
+    \param_idx1 ->
+      \val2 ->
+        BG.with val2 (\val3 ->
+                        hs_bindgen_8780a04bf33744c5 prepared_statement0 param_idx1 val3)
+
+-- __unique:__ @Database_DuckDB_FFI_Database.DuckDB.FFI_Safe_duckdb_bind_uhugeint@
+foreign import ccall safe "hs_bindgen_5cb9ed525dffdba8" hs_bindgen_5cb9ed525dffdba8_base ::
+     BG.Ptr BG.Void
+  -> HsBindgen.Runtime.LibC.Word64
+  -> BG.Ptr BG.Void
+  -> IO BG.CUInt
+
+-- __unique:__ @Database_DuckDB_FFI_Database.DuckDB.FFI_Safe_duckdb_bind_uhugeint@
+hs_bindgen_5cb9ed525dffdba8 ::
+     DuckDBPreparedStatement
+  -> DuckDBIdx
+  -> BG.Ptr DuckDBUHugeInt
+  -> IO DuckDBState
+hs_bindgen_5cb9ed525dffdba8 =
+  \x0 ->
+    \x1 ->
+      \x2 ->
+        fmap BG.fromFFIType (hs_bindgen_5cb9ed525dffdba8_base (BG.toFFIType x0) (BG.toFFIType x1) (BG.toFFIType x2))
+
+{-|
+
+    Binds a t'DuckDBUHugeInt' value to the prepared statement at the specified index.
+
+    history:
+
+    * stable: v0.10.0
+
+    [__@prepared_statement@__]:
+
+    [__@param_idx@__]:
+
+    [__@val@__]:
+
+    __Returns:__ t'DuckDBState'
+
+    __C declaration:__ @duckdb_bind_uhugeint@
+
+    __defined at:__ @duckdb.h 6087:27@
+
+    __exported by:__ @duckdb.h@
+-}
+c_duckdb_bind_uhugeint ::
+     DuckDBPreparedStatement
+     {- ^
+
+          [__@prepared_statement@__]:
+
+          __C declaration:__ @prepared_statement@
+     -}
+  -> DuckDBIdx
+     {- ^
+
+          [__@param_idx@__]:
+
+          __C declaration:__ @param_idx@
+     -}
+  -> DuckDBUHugeInt
+     {- ^
+
+          [__@val@__]:
+
+          __C declaration:__ @val@
+     -}
+  -> IO DuckDBState
+c_duckdb_bind_uhugeint =
+  \prepared_statement0 ->
+    \param_idx1 ->
+      \val2 ->
+        BG.with val2 (\val3 ->
+                        hs_bindgen_5cb9ed525dffdba8 prepared_statement0 param_idx1 val3)
+
+-- __unique:__ @Database_DuckDB_FFI_Database.DuckDB.FFI_Safe_duckdb_bind_decimal@
+foreign import ccall safe "hs_bindgen_c9b058b7b2cd21d0" hs_bindgen_c9b058b7b2cd21d0_base ::
+     BG.Ptr BG.Void
+  -> HsBindgen.Runtime.LibC.Word64
+  -> BG.Ptr BG.Void
+  -> IO BG.CUInt
+
+-- __unique:__ @Database_DuckDB_FFI_Database.DuckDB.FFI_Safe_duckdb_bind_decimal@
+hs_bindgen_c9b058b7b2cd21d0 ::
+     DuckDBPreparedStatement
+  -> DuckDBIdx
+  -> BG.Ptr DuckDBDecimal
+  -> IO DuckDBState
+hs_bindgen_c9b058b7b2cd21d0 =
+  \x0 ->
+    \x1 ->
+      \x2 ->
+        fmap BG.fromFFIType (hs_bindgen_c9b058b7b2cd21d0_base (BG.toFFIType x0) (BG.toFFIType x1) (BG.toFFIType x2))
+
+{-|
+
+    Binds a t'DuckDBDecimal' value to the prepared statement at the specified index.
+
+    history:
+
+    * stable: v0.6.0
+
+    [__@prepared_statement@__]:
+
+    [__@param_idx@__]:
+
+    [__@val@__]:
+
+    __Returns:__ t'DuckDBState'
+
+    __C declaration:__ @duckdb_bind_decimal@
+
+    __defined at:__ @duckdb.h 6103:27@
+
+    __exported by:__ @duckdb.h@
+-}
+c_duckdb_bind_decimal ::
+     DuckDBPreparedStatement
+     {- ^
+
+          [__@prepared_statement@__]:
+
+          __C declaration:__ @prepared_statement@
+     -}
+  -> DuckDBIdx
+     {- ^
+
+          [__@param_idx@__]:
+
+          __C declaration:__ @param_idx@
+     -}
+  -> DuckDBDecimal
+     {- ^
+
+          [__@val@__]:
+
+          __C declaration:__ @val@
+     -}
+  -> IO DuckDBState
+c_duckdb_bind_decimal =
+  \prepared_statement0 ->
+    \param_idx1 ->
+      \val2 ->
+        BG.with val2 (\val3 ->
+                        hs_bindgen_c9b058b7b2cd21d0 prepared_statement0 param_idx1 val3)
+
+-- __unique:__ @Database_DuckDB_FFI_Database.DuckDB.FFI_Safe_duckdb_bind_uint8@
+foreign import ccall safe "hs_bindgen_b5a38c6e6ecccd08" hs_bindgen_b5a38c6e6ecccd08_base ::
+     BG.Ptr BG.Void
+  -> HsBindgen.Runtime.LibC.Word64
+  -> HsBindgen.Runtime.LibC.Word8
+  -> IO BG.CUInt
+
+-- __unique:__ @Database_DuckDB_FFI_Database.DuckDB.FFI_Safe_duckdb_bind_uint8@
+hs_bindgen_b5a38c6e6ecccd08 ::
+     DuckDBPreparedStatement
+  -> DuckDBIdx
+  -> HsBindgen.Runtime.LibC.Word8
+  -> IO DuckDBState
+hs_bindgen_b5a38c6e6ecccd08 =
+  \x0 ->
+    \x1 ->
+      \x2 ->
+        fmap BG.fromFFIType (hs_bindgen_b5a38c6e6ecccd08_base (BG.toFFIType x0) (BG.toFFIType x1) (BG.toFFIType x2))
+
+{-| Binds a uint8_t value to the prepared statement at the specified index.
+
+    history:
+
+    * stable: v0.2.5
+
+    [__@prepared_statement@__]:
+
+    [__@param_idx@__]:
+
+    [__@val@__]:
+
+    __Returns:__ t'DuckDBState'
+
+    __C declaration:__ @duckdb_bind_uint8@
+
+    __defined at:__ @duckdb.h 6119:27@
+
+    __exported by:__ @duckdb.h@
+-}
+c_duckdb_bind_uint8 ::
+     DuckDBPreparedStatement
+     {- ^
+
+          [__@prepared_statement@__]:
+
+          __C declaration:__ @prepared_statement@
+     -}
+  -> DuckDBIdx
+     {- ^
+
+          [__@param_idx@__]:
+
+          __C declaration:__ @param_idx@
+     -}
+  -> HsBindgen.Runtime.LibC.Word8
+     {- ^
+
+          [__@val@__]:
+
+          __C declaration:__ @val@
+     -}
+  -> IO DuckDBState
+c_duckdb_bind_uint8 = hs_bindgen_b5a38c6e6ecccd08
+
+-- __unique:__ @Database_DuckDB_FFI_Database.DuckDB.FFI_Safe_duckdb_bind_uint16@
+foreign import ccall safe "hs_bindgen_2e2738c0457ea47d" hs_bindgen_2e2738c0457ea47d_base ::
+     BG.Ptr BG.Void
+  -> HsBindgen.Runtime.LibC.Word64
+  -> HsBindgen.Runtime.LibC.Word16
+  -> IO BG.CUInt
+
+-- __unique:__ @Database_DuckDB_FFI_Database.DuckDB.FFI_Safe_duckdb_bind_uint16@
+hs_bindgen_2e2738c0457ea47d ::
+     DuckDBPreparedStatement
+  -> DuckDBIdx
+  -> HsBindgen.Runtime.LibC.Word16
+  -> IO DuckDBState
+hs_bindgen_2e2738c0457ea47d =
+  \x0 ->
+    \x1 ->
+      \x2 ->
+        fmap BG.fromFFIType (hs_bindgen_2e2738c0457ea47d_base (BG.toFFIType x0) (BG.toFFIType x1) (BG.toFFIType x2))
+
+{-| Binds a uint16_t value to the prepared statement at the specified index.
+
+    history:
+
+    * stable: v0.2.5
+
+    [__@prepared_statement@__]:
+
+    [__@param_idx@__]:
+
+    [__@val@__]:
+
+    __Returns:__ t'DuckDBState'
+
+    __C declaration:__ @duckdb_bind_uint16@
+
+    __defined at:__ @duckdb.h 6134:27@
+
+    __exported by:__ @duckdb.h@
+-}
+c_duckdb_bind_uint16 ::
+     DuckDBPreparedStatement
+     {- ^
+
+          [__@prepared_statement@__]:
+
+          __C declaration:__ @prepared_statement@
+     -}
+  -> DuckDBIdx
+     {- ^
+
+          [__@param_idx@__]:
+
+          __C declaration:__ @param_idx@
+     -}
+  -> HsBindgen.Runtime.LibC.Word16
+     {- ^
+
+          [__@val@__]:
+
+          __C declaration:__ @val@
+     -}
+  -> IO DuckDBState
+c_duckdb_bind_uint16 = hs_bindgen_2e2738c0457ea47d
+
+-- __unique:__ @Database_DuckDB_FFI_Database.DuckDB.FFI_Safe_duckdb_bind_uint32@
+foreign import ccall safe "hs_bindgen_90e699f0e6b9cd29" hs_bindgen_90e699f0e6b9cd29_base ::
+     BG.Ptr BG.Void
+  -> HsBindgen.Runtime.LibC.Word64
+  -> HsBindgen.Runtime.LibC.Word32
+  -> IO BG.CUInt
+
+-- __unique:__ @Database_DuckDB_FFI_Database.DuckDB.FFI_Safe_duckdb_bind_uint32@
+hs_bindgen_90e699f0e6b9cd29 ::
+     DuckDBPreparedStatement
+  -> DuckDBIdx
+  -> HsBindgen.Runtime.LibC.Word32
+  -> IO DuckDBState
+hs_bindgen_90e699f0e6b9cd29 =
+  \x0 ->
+    \x1 ->
+      \x2 ->
+        fmap BG.fromFFIType (hs_bindgen_90e699f0e6b9cd29_base (BG.toFFIType x0) (BG.toFFIType x1) (BG.toFFIType x2))
+
+{-| Binds a uint32_t value to the prepared statement at the specified index.
+
+    history:
+
+    * stable: v0.2.5
+
+    [__@prepared_statement@__]:
+
+    [__@param_idx@__]:
+
+    [__@val@__]:
+
+    __Returns:__ t'DuckDBState'
+
+    __C declaration:__ @duckdb_bind_uint32@
+
+    __defined at:__ @duckdb.h 6150:27@
+
+    __exported by:__ @duckdb.h@
+-}
+c_duckdb_bind_uint32 ::
+     DuckDBPreparedStatement
+     {- ^
+
+          [__@prepared_statement@__]:
+
+          __C declaration:__ @prepared_statement@
+     -}
+  -> DuckDBIdx
+     {- ^
+
+          [__@param_idx@__]:
+
+          __C declaration:__ @param_idx@
+     -}
+  -> HsBindgen.Runtime.LibC.Word32
+     {- ^
+
+          [__@val@__]:
+
+          __C declaration:__ @val@
+     -}
+  -> IO DuckDBState
+c_duckdb_bind_uint32 = hs_bindgen_90e699f0e6b9cd29
+
+-- __unique:__ @Database_DuckDB_FFI_Database.DuckDB.FFI_Safe_duckdb_bind_uint64@
+foreign import ccall safe "hs_bindgen_3ccb9401c1ebda08" hs_bindgen_3ccb9401c1ebda08_base ::
+     BG.Ptr BG.Void
+  -> HsBindgen.Runtime.LibC.Word64
+  -> HsBindgen.Runtime.LibC.Word64
+  -> IO BG.CUInt
+
+-- __unique:__ @Database_DuckDB_FFI_Database.DuckDB.FFI_Safe_duckdb_bind_uint64@
+hs_bindgen_3ccb9401c1ebda08 ::
+     DuckDBPreparedStatement
+  -> DuckDBIdx
+  -> HsBindgen.Runtime.LibC.Word64
+  -> IO DuckDBState
+hs_bindgen_3ccb9401c1ebda08 =
+  \x0 ->
+    \x1 ->
+      \x2 ->
+        fmap BG.fromFFIType (hs_bindgen_3ccb9401c1ebda08_base (BG.toFFIType x0) (BG.toFFIType x1) (BG.toFFIType x2))
+
+{-| Binds a uint64_t value to the prepared statement at the specified index.
+
+    history:
+
+    * stable: v0.2.5
+
+    [__@prepared_statement@__]:
+
+    [__@param_idx@__]:
+
+    [__@val@__]:
+
+    __Returns:__ t'DuckDBState'
+
+    __C declaration:__ @duckdb_bind_uint64@
+
+    __defined at:__ @duckdb.h 6166:27@
+
+    __exported by:__ @duckdb.h@
+-}
+c_duckdb_bind_uint64 ::
+     DuckDBPreparedStatement
+     {- ^
+
+          [__@prepared_statement@__]:
+
+          __C declaration:__ @prepared_statement@
+     -}
+  -> DuckDBIdx
+     {- ^
+
+          [__@param_idx@__]:
+
+          __C declaration:__ @param_idx@
+     -}
+  -> HsBindgen.Runtime.LibC.Word64
+     {- ^
+
+          [__@val@__]:
+
+          __C declaration:__ @val@
+     -}
+  -> IO DuckDBState
+c_duckdb_bind_uint64 = hs_bindgen_3ccb9401c1ebda08
+
+-- __unique:__ @Database_DuckDB_FFI_Database.DuckDB.FFI_Safe_duckdb_bind_float@
+foreign import ccall safe "hs_bindgen_9b6b761b5a1551ef" hs_bindgen_9b6b761b5a1551ef_base ::
+     BG.Ptr BG.Void
+  -> HsBindgen.Runtime.LibC.Word64
+  -> BG.CFloat
+  -> IO BG.CUInt
+
+-- __unique:__ @Database_DuckDB_FFI_Database.DuckDB.FFI_Safe_duckdb_bind_float@
+hs_bindgen_9b6b761b5a1551ef ::
+     DuckDBPreparedStatement
+  -> DuckDBIdx
+  -> BG.CFloat
+  -> IO DuckDBState
+hs_bindgen_9b6b761b5a1551ef =
+  \x0 ->
+    \x1 ->
+      \x2 ->
+        fmap BG.fromFFIType (hs_bindgen_9b6b761b5a1551ef_base (BG.toFFIType x0) (BG.toFFIType x1) (BG.toFFIType x2))
+
+{-| Binds a float value to the prepared statement at the specified index.
+
+    history:
+
+    * stable: v0.1.0
+
+    [__@prepared_statement@__]:
+
+    [__@param_idx@__]:
+
+    [__@val@__]:
+
+    __Returns:__ t'DuckDBState'
+
+    __C declaration:__ @duckdb_bind_float@
+
+    __defined at:__ @duckdb.h 6181:27@
+
+    __exported by:__ @duckdb.h@
+-}
+c_duckdb_bind_float ::
+     DuckDBPreparedStatement
+     {- ^
+
+          [__@prepared_statement@__]:
+
+          __C declaration:__ @prepared_statement@
+     -}
+  -> DuckDBIdx
+     {- ^
+
+          [__@param_idx@__]:
+
+          __C declaration:__ @param_idx@
+     -}
+  -> BG.CFloat
+     {- ^
+
+          [__@val@__]:
+
+          __C declaration:__ @val@
+     -}
+  -> IO DuckDBState
+c_duckdb_bind_float = hs_bindgen_9b6b761b5a1551ef
+
+-- __unique:__ @Database_DuckDB_FFI_Database.DuckDB.FFI_Safe_duckdb_bind_double@
+foreign import ccall safe "hs_bindgen_e37b46704d10e1da" hs_bindgen_e37b46704d10e1da_base ::
+     BG.Ptr BG.Void
+  -> HsBindgen.Runtime.LibC.Word64
+  -> BG.CDouble
+  -> IO BG.CUInt
+
+-- __unique:__ @Database_DuckDB_FFI_Database.DuckDB.FFI_Safe_duckdb_bind_double@
+hs_bindgen_e37b46704d10e1da ::
+     DuckDBPreparedStatement
+  -> DuckDBIdx
+  -> BG.CDouble
+  -> IO DuckDBState
+hs_bindgen_e37b46704d10e1da =
+  \x0 ->
+    \x1 ->
+      \x2 ->
+        fmap BG.fromFFIType (hs_bindgen_e37b46704d10e1da_base (BG.toFFIType x0) (BG.toFFIType x1) (BG.toFFIType x2))
+
+{-| Binds a double value to the prepared statement at the specified index.
+
+    history:
+
+    * stable: v0.1.0
+
+    [__@prepared_statement@__]:
+
+    [__@param_idx@__]:
+
+    [__@val@__]:
+
+    __Returns:__ t'DuckDBState'
+
+    __C declaration:__ @duckdb_bind_double@
+
+    __defined at:__ @duckdb.h 6194:27@
+
+    __exported by:__ @duckdb.h@
+-}
+c_duckdb_bind_double ::
+     DuckDBPreparedStatement
+     {- ^
+
+          [__@prepared_statement@__]:
+
+          __C declaration:__ @prepared_statement@
+     -}
+  -> DuckDBIdx
+     {- ^
+
+          [__@param_idx@__]:
+
+          __C declaration:__ @param_idx@
+     -}
+  -> BG.CDouble
+     {- ^
+
+          [__@val@__]:
+
+          __C declaration:__ @val@
+     -}
+  -> IO DuckDBState
+c_duckdb_bind_double = hs_bindgen_e37b46704d10e1da
+
+-- __unique:__ @Database_DuckDB_FFI_Database.DuckDB.FFI_Safe_duckdb_bind_date@
+foreign import ccall safe "hs_bindgen_f8785689f72e5b5d" hs_bindgen_f8785689f72e5b5d_base ::
+     BG.Ptr BG.Void
+  -> HsBindgen.Runtime.LibC.Word64
+  -> BG.Ptr BG.Void
+  -> IO BG.CUInt
+
+-- __unique:__ @Database_DuckDB_FFI_Database.DuckDB.FFI_Safe_duckdb_bind_date@
+hs_bindgen_f8785689f72e5b5d ::
+     DuckDBPreparedStatement
+  -> DuckDBIdx
+  -> BG.Ptr DuckDBDate
+  -> IO DuckDBState
+hs_bindgen_f8785689f72e5b5d =
+  \x0 ->
+    \x1 ->
+      \x2 ->
+        fmap BG.fromFFIType (hs_bindgen_f8785689f72e5b5d_base (BG.toFFIType x0) (BG.toFFIType x1) (BG.toFFIType x2))
+
+{-|
+
+    Binds a t'DuckDBDate' value to the prepared statement at the specified index.
+
+    history:
+
+    * stable: v0.2.9
+
+    [__@prepared_statement@__]:
+
+    [__@param_idx@__]:
+
+    [__@val@__]:
+
+    __Returns:__ t'DuckDBState'
+
+    __C declaration:__ @duckdb_bind_date@
+
+    __defined at:__ @duckdb.h 6208:27@
+
+    __exported by:__ @duckdb.h@
+-}
+c_duckdb_bind_date ::
+     DuckDBPreparedStatement
+     {- ^
+
+          [__@prepared_statement@__]:
+
+          __C declaration:__ @prepared_statement@
+     -}
+  -> DuckDBIdx
+     {- ^
+
+          [__@param_idx@__]:
+
+          __C declaration:__ @param_idx@
+     -}
+  -> DuckDBDate
+     {- ^
+
+          [__@val@__]:
+
+          __C declaration:__ @val@
+     -}
+  -> IO DuckDBState
+c_duckdb_bind_date =
+  \prepared_statement0 ->
+    \param_idx1 ->
+      \val2 ->
+        BG.with val2 (\val3 ->
+                        hs_bindgen_f8785689f72e5b5d prepared_statement0 param_idx1 val3)
+
+-- __unique:__ @Database_DuckDB_FFI_Database.DuckDB.FFI_Safe_duckdb_bind_time@
+foreign import ccall safe "hs_bindgen_1785c9c57c78cf3d" hs_bindgen_1785c9c57c78cf3d_base ::
+     BG.Ptr BG.Void
+  -> HsBindgen.Runtime.LibC.Word64
+  -> BG.Ptr BG.Void
+  -> IO BG.CUInt
+
+-- __unique:__ @Database_DuckDB_FFI_Database.DuckDB.FFI_Safe_duckdb_bind_time@
+hs_bindgen_1785c9c57c78cf3d ::
+     DuckDBPreparedStatement
+  -> DuckDBIdx
+  -> BG.Ptr DuckDBTime
+  -> IO DuckDBState
+hs_bindgen_1785c9c57c78cf3d =
+  \x0 ->
+    \x1 ->
+      \x2 ->
+        fmap BG.fromFFIType (hs_bindgen_1785c9c57c78cf3d_base (BG.toFFIType x0) (BG.toFFIType x1) (BG.toFFIType x2))
+
+{-|
+
+    Binds a t'DuckDBTime' value to the prepared statement at the specified index.
+
+    history:
+
+    * stable: v0.2.9
+
+    [__@prepared_statement@__]:
+
+    [__@param_idx@__]:
+
+    [__@val@__]:
+
+    __Returns:__ t'DuckDBState'
+
+    __C declaration:__ @duckdb_bind_time@
+
+    __defined at:__ @duckdb.h 6224:27@
+
+    __exported by:__ @duckdb.h@
+-}
+c_duckdb_bind_time ::
+     DuckDBPreparedStatement
+     {- ^
+
+          [__@prepared_statement@__]:
+
+          __C declaration:__ @prepared_statement@
+     -}
+  -> DuckDBIdx
+     {- ^
+
+          [__@param_idx@__]:
+
+          __C declaration:__ @param_idx@
+     -}
+  -> DuckDBTime
+     {- ^
+
+          [__@val@__]:
+
+          __C declaration:__ @val@
+     -}
+  -> IO DuckDBState
+c_duckdb_bind_time =
+  \prepared_statement0 ->
+    \param_idx1 ->
+      \val2 ->
+        BG.with val2 (\val3 ->
+                        hs_bindgen_1785c9c57c78cf3d prepared_statement0 param_idx1 val3)
+
+-- __unique:__ @Database_DuckDB_FFI_Database.DuckDB.FFI_Safe_duckdb_bind_timestamp@
+foreign import ccall safe "hs_bindgen_408ba78d5071e129" hs_bindgen_408ba78d5071e129_base ::
+     BG.Ptr BG.Void
+  -> HsBindgen.Runtime.LibC.Word64
+  -> BG.Ptr BG.Void
+  -> IO BG.CUInt
+
+-- __unique:__ @Database_DuckDB_FFI_Database.DuckDB.FFI_Safe_duckdb_bind_timestamp@
+hs_bindgen_408ba78d5071e129 ::
+     DuckDBPreparedStatement
+  -> DuckDBIdx
+  -> BG.Ptr DuckDBTimestamp
+  -> IO DuckDBState
+hs_bindgen_408ba78d5071e129 =
+  \x0 ->
+    \x1 ->
+      \x2 ->
+        fmap BG.fromFFIType (hs_bindgen_408ba78d5071e129_base (BG.toFFIType x0) (BG.toFFIType x1) (BG.toFFIType x2))
+
+{-|
+
+    Binds a t'DuckDBTimestamp' value to the prepared statement at the specified index.
+
+    history:
+
+    * stable: v0.2.9
+
+    [__@prepared_statement@__]:
+
+    [__@param_idx@__]:
+
+    [__@val@__]:
+
+    __Returns:__ t'DuckDBState'
+
+    __C declaration:__ @duckdb_bind_timestamp@
+
+    __defined at:__ @duckdb.h 6240:27@
+
+    __exported by:__ @duckdb.h@
+-}
+c_duckdb_bind_timestamp ::
+     DuckDBPreparedStatement
+     {- ^
+
+          [__@prepared_statement@__]:
+
+          __C declaration:__ @prepared_statement@
+     -}
+  -> DuckDBIdx
+     {- ^
+
+          [__@param_idx@__]:
+
+          __C declaration:__ @param_idx@
+     -}
+  -> DuckDBTimestamp
+     {- ^
+
+          [__@val@__]:
+
+          __C declaration:__ @val@
+     -}
+  -> IO DuckDBState
+c_duckdb_bind_timestamp =
+  \prepared_statement0 ->
+    \param_idx1 ->
+      \val2 ->
+        BG.with val2 (\val3 ->
+                        hs_bindgen_408ba78d5071e129 prepared_statement0 param_idx1 val3)
+
+-- __unique:__ @Database_DuckDB_FFI_Database.DuckDB.FFI_Safe_duckdb_bind_timestamp_tz@
+foreign import ccall safe "hs_bindgen_e37f0c4d9ec67f72" hs_bindgen_e37f0c4d9ec67f72_base ::
+     BG.Ptr BG.Void
+  -> HsBindgen.Runtime.LibC.Word64
+  -> BG.Ptr BG.Void
+  -> IO BG.CUInt
+
+-- __unique:__ @Database_DuckDB_FFI_Database.DuckDB.FFI_Safe_duckdb_bind_timestamp_tz@
+hs_bindgen_e37f0c4d9ec67f72 ::
+     DuckDBPreparedStatement
+  -> DuckDBIdx
+  -> BG.Ptr DuckDBTimestamp
+  -> IO DuckDBState
+hs_bindgen_e37f0c4d9ec67f72 =
+  \x0 ->
+    \x1 ->
+      \x2 ->
+        fmap BG.fromFFIType (hs_bindgen_e37f0c4d9ec67f72_base (BG.toFFIType x0) (BG.toFFIType x1) (BG.toFFIType x2))
+
+{-|
+
+    Binds a t'DuckDBTimestamp' value to the prepared statement at the specified index.
+
+    history:
+
+    * stable: v1.1.0
+
+    [__@prepared_statement@__]:
+
+    [__@param_idx@__]:
+
+    [__@val@__]:
+
+    __Returns:__ t'DuckDBState'
+
+    __C declaration:__ @duckdb_bind_timestamp_tz@
+
+    __defined at:__ @duckdb.h 6256:27@
+
+    __exported by:__ @duckdb.h@
+-}
+c_duckdb_bind_timestamp_tz ::
+     DuckDBPreparedStatement
+     {- ^
+
+          [__@prepared_statement@__]:
+
+          __C declaration:__ @prepared_statement@
+     -}
+  -> DuckDBIdx
+     {- ^
+
+          [__@param_idx@__]:
+
+          __C declaration:__ @param_idx@
+     -}
+  -> DuckDBTimestamp
+     {- ^
+
+          [__@val@__]:
+
+          __C declaration:__ @val@
+     -}
+  -> IO DuckDBState
+c_duckdb_bind_timestamp_tz =
+  \prepared_statement0 ->
+    \param_idx1 ->
+      \val2 ->
+        BG.with val2 (\val3 ->
+                        hs_bindgen_e37f0c4d9ec67f72 prepared_statement0 param_idx1 val3)
+
+-- __unique:__ @Database_DuckDB_FFI_Database.DuckDB.FFI_Safe_duckdb_bind_interval@
+foreign import ccall safe "hs_bindgen_60eda501a3472aa0" hs_bindgen_60eda501a3472aa0_base ::
+     BG.Ptr BG.Void
+  -> HsBindgen.Runtime.LibC.Word64
+  -> BG.Ptr BG.Void
+  -> IO BG.CUInt
+
+-- __unique:__ @Database_DuckDB_FFI_Database.DuckDB.FFI_Safe_duckdb_bind_interval@
+hs_bindgen_60eda501a3472aa0 ::
+     DuckDBPreparedStatement
+  -> DuckDBIdx
+  -> BG.Ptr DuckDBInterval
+  -> IO DuckDBState
+hs_bindgen_60eda501a3472aa0 =
+  \x0 ->
+    \x1 ->
+      \x2 ->
+        fmap BG.fromFFIType (hs_bindgen_60eda501a3472aa0_base (BG.toFFIType x0) (BG.toFFIType x1) (BG.toFFIType x2))
+
+{-|
+
+    Binds a t'DuckDBInterval' value to the prepared statement at the specified index.
+
+    history:
+
+    * stable: v0.2.9
+
+    [__@prepared_statement@__]:
+
+    [__@param_idx@__]:
+
+    [__@val@__]:
+
+    __Returns:__ t'DuckDBState'
+
+    __C declaration:__ @duckdb_bind_interval@
+
+    __defined at:__ @duckdb.h 6272:27@
+
+    __exported by:__ @duckdb.h@
+-}
+c_duckdb_bind_interval ::
+     DuckDBPreparedStatement
+     {- ^
+
+          [__@prepared_statement@__]:
+
+          __C declaration:__ @prepared_statement@
+     -}
+  -> DuckDBIdx
+     {- ^
+
+          [__@param_idx@__]:
+
+          __C declaration:__ @param_idx@
+     -}
+  -> DuckDBInterval
+     {- ^
+
+          [__@val@__]:
+
+          __C declaration:__ @val@
+     -}
+  -> IO DuckDBState
+c_duckdb_bind_interval =
+  \prepared_statement0 ->
+    \param_idx1 ->
+      \val2 ->
+        BG.with val2 (\val3 ->
+                        hs_bindgen_60eda501a3472aa0 prepared_statement0 param_idx1 val3)
+
+-- __unique:__ @Database_DuckDB_FFI_Database.DuckDB.FFI_Safe_duckdb_bind_varchar@
+foreign import ccall safe "hs_bindgen_6789c4064ae33dfd" hs_bindgen_6789c4064ae33dfd_base ::
+     BG.Ptr BG.Void
+  -> HsBindgen.Runtime.LibC.Word64
+  -> BG.Ptr BG.Void
+  -> IO BG.CUInt
+
+-- __unique:__ @Database_DuckDB_FFI_Database.DuckDB.FFI_Safe_duckdb_bind_varchar@
+hs_bindgen_6789c4064ae33dfd ::
+     DuckDBPreparedStatement
+  -> DuckDBIdx
+  -> PtrConst.PtrConst BG.CChar
+  -> IO DuckDBState
+hs_bindgen_6789c4064ae33dfd =
+  \x0 ->
+    \x1 ->
+      \x2 ->
+        fmap BG.fromFFIType (hs_bindgen_6789c4064ae33dfd_base (BG.toFFIType x0) (BG.toFFIType x1) (BG.toFFIType x2))
+
+{-| Binds a null-terminated varchar value to the prepared statement at the specified index.
+
+    Superseded by @'c_duckdb_bind_value'@ .
+
+    history:
+
+    * stable: v0.1.0
+
+    [__@prepared_statement@__]:
+
+    [__@param_idx@__]:
+
+    [__@val@__]:
+
+    __Returns:__ t'DuckDBState'
+
+    __C declaration:__ @duckdb_bind_varchar@
+
+    __defined at:__ @duckdb.h 6289:27@
+
+    __exported by:__ @duckdb.h@
+-}
+c_duckdb_bind_varchar ::
+     DuckDBPreparedStatement
+     {- ^
+
+          [__@prepared_statement@__]:
+
+          __C declaration:__ @prepared_statement@
+     -}
+  -> DuckDBIdx
+     {- ^
+
+          [__@param_idx@__]:
+
+          __C declaration:__ @param_idx@
+     -}
+  -> PtrConst.PtrConst BG.CChar
+     {- ^
+
+          [__@val@__]:
+
+          __C declaration:__ @val@
+     -}
+  -> IO DuckDBState
+c_duckdb_bind_varchar = hs_bindgen_6789c4064ae33dfd
+
+-- __unique:__ @Database_DuckDB_FFI_Database.DuckDB.FFI_Safe_duckdb_bind_varchar_length@
+foreign import ccall safe "hs_bindgen_8da54da1c75fc6d7" hs_bindgen_8da54da1c75fc6d7_base ::
+     BG.Ptr BG.Void
+  -> HsBindgen.Runtime.LibC.Word64
+  -> BG.Ptr BG.Void
+  -> HsBindgen.Runtime.LibC.Word64
+  -> IO BG.CUInt
+
+-- __unique:__ @Database_DuckDB_FFI_Database.DuckDB.FFI_Safe_duckdb_bind_varchar_length@
+hs_bindgen_8da54da1c75fc6d7 ::
+     DuckDBPreparedStatement
+  -> DuckDBIdx
+  -> PtrConst.PtrConst BG.CChar
+  -> DuckDBIdx
+  -> IO DuckDBState
+hs_bindgen_8da54da1c75fc6d7 =
+  \x0 ->
+    \x1 ->
+      \x2 ->
+        \x3 ->
+          fmap BG.fromFFIType (hs_bindgen_8da54da1c75fc6d7_base (BG.toFFIType x0) (BG.toFFIType x1) (BG.toFFIType x2) (BG.toFFIType x3))
+
+{-| Binds a varchar value to the prepared statement at the specified index.
+
+    Superseded by @'c_duckdb_bind_value'@ .
+
+    history:
+
+    * stable: v0.2.5
+
+    [__@prepared_statement@__]:
+
+    [__@param_idx@__]:
+
+    [__@val@__]:
+
+    [__@length@__]:
+
+    __Returns:__ t'DuckDBState'
+
+    __C declaration:__ @duckdb_bind_varchar_length@
+
+    __defined at:__ @duckdb.h 6307:27@
+
+    __exported by:__ @duckdb.h@
+-}
+c_duckdb_bind_varchar_length ::
+     DuckDBPreparedStatement
+     {- ^
+
+          [__@prepared_statement@__]:
+
+          __C declaration:__ @prepared_statement@
+     -}
+  -> DuckDBIdx
+     {- ^
+
+          [__@param_idx@__]:
+
+          __C declaration:__ @param_idx@
+     -}
+  -> PtrConst.PtrConst BG.CChar
+     {- ^
+
+          [__@val@__]:
+
+          __C declaration:__ @val@
+     -}
+  -> DuckDBIdx
+     {- ^
+
+          [__@length@__]:
+
+          __C declaration:__ @length@
+     -}
+  -> IO DuckDBState
+c_duckdb_bind_varchar_length =
+  hs_bindgen_8da54da1c75fc6d7
+
+-- __unique:__ @Database_DuckDB_FFI_Database.DuckDB.FFI_Safe_duckdb_bind_blob@
+foreign import ccall safe "hs_bindgen_f3dfed4bc402c238" hs_bindgen_f3dfed4bc402c238_base ::
+     BG.Ptr BG.Void
+  -> HsBindgen.Runtime.LibC.Word64
+  -> BG.Ptr BG.Void
+  -> HsBindgen.Runtime.LibC.Word64
+  -> IO BG.CUInt
+
+-- __unique:__ @Database_DuckDB_FFI_Database.DuckDB.FFI_Safe_duckdb_bind_blob@
+hs_bindgen_f3dfed4bc402c238 ::
+     DuckDBPreparedStatement
+  -> DuckDBIdx
+  -> PtrConst.PtrConst BG.Void
+  -> DuckDBIdx
+  -> IO DuckDBState
+hs_bindgen_f3dfed4bc402c238 =
+  \x0 ->
+    \x1 ->
+      \x2 ->
+        \x3 ->
+          fmap BG.fromFFIType (hs_bindgen_f3dfed4bc402c238_base (BG.toFFIType x0) (BG.toFFIType x1) (BG.toFFIType x2) (BG.toFFIType x3))
+
+{-| Binds a blob value to the prepared statement at the specified index.
+
+    history:
+
+    * stable: v0.2.5
+
+    [__@prepared_statement@__]:
+
+    [__@param_idx@__]:
+
+    [__@data@__]:
+
+    [__@length@__]:
+
+    __Returns:__ t'DuckDBState'
+
+    __C declaration:__ @duckdb_bind_blob@
+
+    __defined at:__ @duckdb.h 6324:27@
+
+    __exported by:__ @duckdb.h@
+-}
+c_duckdb_bind_blob ::
+     DuckDBPreparedStatement
+     {- ^
+
+          [__@prepared_statement@__]:
+
+          __C declaration:__ @prepared_statement@
+     -}
+  -> DuckDBIdx
+     {- ^
+
+          [__@param_idx@__]:
+
+          __C declaration:__ @param_idx@
+     -}
+  -> PtrConst.PtrConst BG.Void
+     {- ^
+
+          [__@data@__]:
+
+          __C declaration:__ @data@
+     -}
+  -> DuckDBIdx
+     {- ^
+
+          [__@length@__]:
+
+          __C declaration:__ @length@
+     -}
+  -> IO DuckDBState
+c_duckdb_bind_blob = hs_bindgen_f3dfed4bc402c238
+
+-- __unique:__ @Database_DuckDB_FFI_Database.DuckDB.FFI_Safe_duckdb_bind_null@
+foreign import ccall safe "hs_bindgen_5ef44e468bc16aaa" hs_bindgen_5ef44e468bc16aaa_base ::
+     BG.Ptr BG.Void
+  -> HsBindgen.Runtime.LibC.Word64
+  -> IO BG.CUInt
+
+-- __unique:__ @Database_DuckDB_FFI_Database.DuckDB.FFI_Safe_duckdb_bind_null@
+hs_bindgen_5ef44e468bc16aaa ::
+     DuckDBPreparedStatement
+  -> DuckDBIdx
+  -> IO DuckDBState
+hs_bindgen_5ef44e468bc16aaa =
+  \x0 ->
+    \x1 ->
+      fmap BG.fromFFIType (hs_bindgen_5ef44e468bc16aaa_base (BG.toFFIType x0) (BG.toFFIType x1))
+
+{-| Binds a NULL value to the prepared statement at the specified index.
+
+    history:
+
+    * stable: v0.1.2
+
+    [__@prepared_statement@__]:
+
+    [__@param_idx@__]:
+
+    __Returns:__ t'DuckDBState'
+
+    __C declaration:__ @duckdb_bind_null@
+
+    __defined at:__ @duckdb.h 6339:27@
+
+    __exported by:__ @duckdb.h@
+-}
+c_duckdb_bind_null ::
+     DuckDBPreparedStatement
+     {- ^
+
+          [__@prepared_statement@__]:
+
+          __C declaration:__ @prepared_statement@
+     -}
+  -> DuckDBIdx
+     {- ^
+
+          [__@param_idx@__]:
+
+          __C declaration:__ @param_idx@
+     -}
+  -> IO DuckDBState
+c_duckdb_bind_null = hs_bindgen_5ef44e468bc16aaa
+
+-- __unique:__ @Database_DuckDB_FFI_Database.DuckDB.FFI_Safe_duckdb_execute_prepared@
+foreign import ccall safe "hs_bindgen_629c85be7284c355" hs_bindgen_629c85be7284c355_base ::
+     BG.Ptr BG.Void
+  -> BG.Ptr BG.Void
+  -> IO BG.CUInt
+
+-- __unique:__ @Database_DuckDB_FFI_Database.DuckDB.FFI_Safe_duckdb_execute_prepared@
+hs_bindgen_629c85be7284c355 ::
+     DuckDBPreparedStatement
+  -> BG.Ptr DuckDBResult
+  -> IO DuckDBState
+hs_bindgen_629c85be7284c355 =
+  \x0 ->
+    \x1 ->
+      fmap BG.fromFFIType (hs_bindgen_629c85be7284c355_base (BG.toFFIType x0) (BG.toFFIType x1))
+
+{-| Executes the prepared statement with the given bound parameters, and returns a materialized query result.
+
+    This method can be called multiple times for each prepared statement, and the parameters can be modified between calls to this function.
+
+    Note that the result must be freed with @'c_duckdb_destroy_result'@ .
+
+    history:
+
+    * stable: v0.1.0
+
+    [__@prepared_statement@__]: The prepared statement to execute.
+
+    [__@out_result@__]: The query result.
+
+    __Returns:__ t'DuckDBState'
+
+    __C declaration:__ @duckdb_execute_prepared@
+
+    __defined at:__ @duckdb.h 6357:27@
+
+    __exported by:__ @duckdb.h@
+-}
+c_duckdb_execute_prepared ::
+     DuckDBPreparedStatement
+     {- ^
+
+          [__@prepared_statement@__]: The prepared statement to execute.
+
+          __C declaration:__ @prepared_statement@
+     -}
+  -> BG.Ptr DuckDBResult
+     {- ^
+
+          [__@out_result@__]: The query result.
+
+          __C declaration:__ @out_result@
+     -}
+  -> IO DuckDBState
+c_duckdb_execute_prepared =
+  hs_bindgen_629c85be7284c355
+
+-- __unique:__ @Database_DuckDB_FFI_Database.DuckDB.FFI_Safe_duckdb_extract_statements@
+foreign import ccall safe "hs_bindgen_3a899fb5cfe65940" hs_bindgen_3a899fb5cfe65940_base ::
+     BG.Ptr BG.Void
+  -> BG.Ptr BG.Void
+  -> BG.Ptr BG.Void
+  -> IO HsBindgen.Runtime.LibC.Word64
+
+-- __unique:__ @Database_DuckDB_FFI_Database.DuckDB.FFI_Safe_duckdb_extract_statements@
+hs_bindgen_3a899fb5cfe65940 ::
+     DuckDBConnection
+  -> PtrConst.PtrConst BG.CChar
+  -> BG.Ptr DuckDBExtractedStatements
+  -> IO DuckDBIdx
+hs_bindgen_3a899fb5cfe65940 =
+  \x0 ->
+    \x1 ->
+      \x2 ->
+        fmap BG.fromFFIType (hs_bindgen_3a899fb5cfe65940_base (BG.toFFIType x0) (BG.toFFIType x1) (BG.toFFIType x2))
+
+{-| Extract all statements from a query. Note that after calling @'c_duckdb_extract_statements'@ , the extracted statements should always be destroyed using @'c_duckdb_destroy_extracted'@ , even if no statements were extracted.
+
+    If the extract fails, @'c_duckdb_extract_statements_error'@ can be called to obtain the reason why the extract failed.
+
+    history:
+
+    * stable: v0.7.0
+
+    [__@connection@__]: The connection object
+
+    [__@query@__]: The SQL query to extract
+
+    [__@out_extracted_statements@__]: The resulting extracted statements object
+
+    __Returns:__ t'DuckDBIdx'
+
+    __C declaration:__ @duckdb_extract_statements@
+
+    __defined at:__ @duckdb.h 6375:20@
+
+    __exported by:__ @duckdb.h@
+-}
+c_duckdb_extract_statements ::
+     DuckDBConnection
+     {- ^
+
+          [__@connection@__]: The connection object
+
+          __C declaration:__ @connection@
+     -}
+  -> PtrConst.PtrConst BG.CChar
+     {- ^
+
+          [__@query@__]: The SQL query to extract
+
+          __C declaration:__ @query@
+     -}
+  -> BG.Ptr DuckDBExtractedStatements
+     {- ^
+
+          [__@out_extracted_statements@__]: The resulting extracted statements object
+
+          __C declaration:__ @out_extracted_statements@
+     -}
+  -> IO DuckDBIdx
+c_duckdb_extract_statements =
+  hs_bindgen_3a899fb5cfe65940
+
+-- __unique:__ @Database_DuckDB_FFI_Database.DuckDB.FFI_Safe_duckdb_prepare_extracted_statement@
+foreign import ccall safe "hs_bindgen_c1d2b24650595603" hs_bindgen_c1d2b24650595603_base ::
+     BG.Ptr BG.Void
+  -> BG.Ptr BG.Void
+  -> HsBindgen.Runtime.LibC.Word64
+  -> BG.Ptr BG.Void
+  -> IO BG.CUInt
+
+-- __unique:__ @Database_DuckDB_FFI_Database.DuckDB.FFI_Safe_duckdb_prepare_extracted_statement@
+hs_bindgen_c1d2b24650595603 ::
+     DuckDBConnection
+  -> DuckDBExtractedStatements
+  -> DuckDBIdx
+  -> BG.Ptr DuckDBPreparedStatement
+  -> IO DuckDBState
+hs_bindgen_c1d2b24650595603 =
+  \x0 ->
+    \x1 ->
+      \x2 ->
+        \x3 ->
+          fmap BG.fromFFIType (hs_bindgen_c1d2b24650595603_base (BG.toFFIType x0) (BG.toFFIType x1) (BG.toFFIType x2) (BG.toFFIType x3))
+
+{-| Prepare an extracted statement. Note that after calling @'c_duckdb_prepare_extracted_statement'@ , the prepared statement should always be destroyed using @'c_duckdb_destroy_prepare'@ , even if the prepare fails.
+
+    If the prepare fails, @'c_duckdb_prepare_error'@ can be called to obtain the reason why the prepare failed.
+
+    history:
+
+    * stable: v0.7.0
+
+    [__@connection@__]: The connection object
+
+    [__@extracted_statements@__]: The extracted statements object
+
+    [__@index@__]: The index of the extracted statement to prepare
+
+    [__@out_prepared_statement@__]: The resulting prepared statement object
+
+    __Returns:__ t'DuckDBState'
+
+    __C declaration:__ @duckdb_prepare_extracted_statement@
+
+    __defined at:__ @duckdb.h 6395:27@
+
+    __exported by:__ @duckdb.h@
+-}
+c_duckdb_prepare_extracted_statement ::
+     DuckDBConnection
+     {- ^
+
+          [__@connection@__]: The connection object
+
+          __C declaration:__ @connection@
+     -}
+  -> DuckDBExtractedStatements
+     {- ^
+
+          [__@extracted_statements@__]: The extracted statements object
+
+          __C declaration:__ @extracted_statements@
+     -}
+  -> DuckDBIdx
+     {- ^
+
+          [__@index@__]: The index of the extracted statement to prepare
+
+          __C declaration:__ @index@
+     -}
+  -> BG.Ptr DuckDBPreparedStatement
+     {- ^
+
+          [__@out_prepared_statement@__]: The resulting prepared statement object
+
+          __C declaration:__ @out_prepared_statement@
+     -}
+  -> IO DuckDBState
+c_duckdb_prepare_extracted_statement =
+  hs_bindgen_c1d2b24650595603
+
+-- __unique:__ @Database_DuckDB_FFI_Database.DuckDB.FFI_Safe_duckdb_extract_statements_error@
+foreign import ccall safe "hs_bindgen_d1cda79c464875a1" hs_bindgen_d1cda79c464875a1_base ::
+     BG.Ptr BG.Void
+  -> IO (BG.Ptr BG.Void)
+
+-- __unique:__ @Database_DuckDB_FFI_Database.DuckDB.FFI_Safe_duckdb_extract_statements_error@
+hs_bindgen_d1cda79c464875a1 ::
+     DuckDBExtractedStatements
+  -> IO (PtrConst.PtrConst BG.CChar)
+hs_bindgen_d1cda79c464875a1 =
+  \x0 ->
+    fmap BG.fromFFIType (hs_bindgen_d1cda79c464875a1_base (BG.toFFIType x0))
+
+{-| Returns the error message contained within the extracted statements. The result of this function must not be freed. It will be cleaned up when @'c_duckdb_destroy_extracted'@ is called.
+
+    history:
+
+    * stable: v0.7.0
+
+    [__@extracted_statements@__]: The extracted statements to fetch the error from.
+
+    __Returns:__ const char*
+
+    __C declaration:__ @duckdb_extract_statements_error@
+
+    __defined at:__ @duckdb.h 6412:26@
+
+    __exported by:__ @duckdb.h@
+-}
+c_duckdb_extract_statements_error ::
+     DuckDBExtractedStatements
+     {- ^
+
+          [__@extracted_statements@__]: The extracted statements to fetch the error from.
+
+          __C declaration:__ @extracted_statements@
+     -}
+  -> IO (PtrConst.PtrConst BG.CChar)
+c_duckdb_extract_statements_error =
+  hs_bindgen_d1cda79c464875a1
+
+-- __unique:__ @Database_DuckDB_FFI_Database.DuckDB.FFI_Safe_duckdb_destroy_extracted@
+foreign import ccall safe "hs_bindgen_b2c9b38c3dab239d" hs_bindgen_b2c9b38c3dab239d_base ::
+     BG.Ptr BG.Void
+  -> IO ()
+
+-- __unique:__ @Database_DuckDB_FFI_Database.DuckDB.FFI_Safe_duckdb_destroy_extracted@
+hs_bindgen_b2c9b38c3dab239d ::
+     BG.Ptr DuckDBExtractedStatements
+  -> IO ()
+hs_bindgen_b2c9b38c3dab239d =
+  \x0 ->
+    hs_bindgen_b2c9b38c3dab239d_base (BG.toFFIType x0)
+
+{-| De-allocates all memory allocated for the extracted statements.
+
+    history:
+
+    * stable: v0.7.0
+
+    [__@extracted_statements@__]: The extracted statements to destroy.
+
+    __Returns:__ void
+
+    __C declaration:__ @duckdb_destroy_extracted@
+
+    __defined at:__ @duckdb.h 6425:19@
+
+    __exported by:__ @duckdb.h@
+-}
+c_duckdb_destroy_extracted ::
+     BG.Ptr DuckDBExtractedStatements
+     {- ^
+
+          [__@extracted_statements@__]: The extracted statements to destroy.
+
+          __C declaration:__ @extracted_statements@
+     -}
+  -> IO ()
+c_duckdb_destroy_extracted =
+  hs_bindgen_b2c9b38c3dab239d
+
+-- __unique:__ @Database_DuckDB_FFI_Database.DuckDB.FFI_Safe_duckdb_execute_prepared_streaming@
+foreign import ccall safe "hs_bindgen_d9a9d21987a2fe23" hs_bindgen_d9a9d21987a2fe23_base ::
+     BG.Ptr BG.Void
+  -> BG.Ptr BG.Void
+  -> IO BG.CUInt
+
+-- __unique:__ @Database_DuckDB_FFI_Database.DuckDB.FFI_Safe_duckdb_execute_prepared_streaming@
+hs_bindgen_d9a9d21987a2fe23 ::
+     DuckDBPreparedStatement
+  -> BG.Ptr DuckDBResult
+  -> IO DuckDBState
+hs_bindgen_d9a9d21987a2fe23 =
+  \x0 ->
+    \x1 ->
+      fmap BG.fromFFIType (hs_bindgen_d9a9d21987a2fe23_base (BG.toFFIType x0) (BG.toFFIType x1))
+
+{-| __DEPRECATION NOTICE__ : This method is scheduled for removal in a future release.
+
+    Executes the prepared statement with the given bound parameters, and returns an optionally-streaming query result. To determine if the resulting query was in fact streamed, use @'c_duckdb_result_is_streaming'@
+
+    This method can be called multiple times for each prepared statement, and the parameters can be modified between calls to this function.
+
+    Note that the result must be freed with @'c_duckdb_destroy_result'@ .
+
+    history:
+
+    * stable: v0.10.0
+
+    * deprecated: v1.0.0
+
+    [__@prepared_statement@__]: The prepared statement to execute.
+
+    [__@out_result@__]: The query result.
+
+    __Returns:__ t'DuckDBState'
+
+    __C declaration:__ @duckdb_execute_prepared_streaming@
+
+    __defined at:__ @duckdb.h 6448:27@
+
+    __exported by:__ @duckdb.h@
+-}
+c_duckdb_execute_prepared_streaming ::
+     DuckDBPreparedStatement
+     {- ^
+
+          [__@prepared_statement@__]: The prepared statement to execute.
+
+          __C declaration:__ @prepared_statement@
+     -}
+  -> BG.Ptr DuckDBResult
+     {- ^
+
+          [__@out_result@__]: The query result.
+
+          __C declaration:__ @out_result@
+     -}
+  -> IO DuckDBState
+c_duckdb_execute_prepared_streaming =
+  hs_bindgen_d9a9d21987a2fe23
+
+-- __unique:__ @Database_DuckDB_FFI_Database.DuckDB.FFI_Safe_duckdb_pending_prepared_streaming@
+foreign import ccall safe "hs_bindgen_5b8189ac2ab75aa9" hs_bindgen_5b8189ac2ab75aa9_base ::
+     BG.Ptr BG.Void
+  -> BG.Ptr BG.Void
+  -> IO BG.CUInt
+
+-- __unique:__ @Database_DuckDB_FFI_Database.DuckDB.FFI_Safe_duckdb_pending_prepared_streaming@
+hs_bindgen_5b8189ac2ab75aa9 ::
+     DuckDBPreparedStatement
+  -> BG.Ptr DuckDBPendingResult
+  -> IO DuckDBState
+hs_bindgen_5b8189ac2ab75aa9 =
+  \x0 ->
+    \x1 ->
+      fmap BG.fromFFIType (hs_bindgen_5b8189ac2ab75aa9_base (BG.toFFIType x0) (BG.toFFIType x1))
+
+{-| __DEPRECATION NOTICE__ : This method is scheduled for removal in a future release.
+
+    Executes the prepared statement with the given bound parameters, and returns a pending result. This pending result will create a streaming t'DuckDBResult' when executed. The pending result represents an intermediate structure for a query that is not yet fully executed.
+
+    Note that after calling @'c_duckdb_pending_prepared_streaming'@ , the pending result should always be destroyed using @'c_duckdb_destroy_pending'@ , even if this function returns DuckDBError.
+
+    history:
+
+    * stable: v0.8.0
+
+    * deprecated: v1.0.0
+
+    [__@prepared_statement@__]: The prepared statement to execute.
+
+    [__@out_result@__]: The pending query result.
+
+    __Returns:__ t'DuckDBState'
+
+    __C declaration:__ @duckdb_pending_prepared_streaming@
+
+    __defined at:__ @duckdb.h 6471:27@
+
+    __exported by:__ @duckdb.h@
+-}
+c_duckdb_pending_prepared_streaming ::
+     DuckDBPreparedStatement
+     {- ^
+
+          [__@prepared_statement@__]: The prepared statement to execute.
+
+          __C declaration:__ @prepared_statement@
+     -}
+  -> BG.Ptr DuckDBPendingResult
+     {- ^
+
+          [__@out_result@__]: The pending query result.
+
+          __C declaration:__ @out_result@
+     -}
+  -> IO DuckDBState
+c_duckdb_pending_prepared_streaming =
+  hs_bindgen_5b8189ac2ab75aa9
+
+-- __unique:__ @Database_DuckDB_FFI_Database.DuckDB.FFI_Safe_duckdb_query@
+foreign import ccall safe "hs_bindgen_71265af97d3a41d1" hs_bindgen_71265af97d3a41d1_base ::
+     BG.Ptr BG.Void
+  -> BG.Ptr BG.Void
+  -> BG.Ptr BG.Void
+  -> IO BG.CUInt
+
+-- __unique:__ @Database_DuckDB_FFI_Database.DuckDB.FFI_Safe_duckdb_query@
+hs_bindgen_71265af97d3a41d1 ::
+     DuckDBConnection
+  -> PtrConst.PtrConst BG.CChar
+  -> BG.Ptr DuckDBResult
+  -> IO DuckDBState
+hs_bindgen_71265af97d3a41d1 =
+  \x0 ->
+    \x1 ->
+      \x2 ->
+        fmap BG.fromFFIType (hs_bindgen_71265af97d3a41d1_base (BG.toFFIType x0) (BG.toFFIType x1) (BG.toFFIType x2))
+
+{-| Executes a SQL query within a connection and stores the full (materialized) result in the out_result pointer. If the query fails to execute, DuckDBError is returned and the error message can be retrieved by calling @'c_duckdb_result_error'@ .
+
+    Note that after running @'c_duckdb_query'@ , @'c_duckdb_destroy_result'@ must be called on the result object even if the query fails, otherwise the error stored within the result will not be freed correctly.
+
+    history:
+
+    * stable: v0.1.0
+
+    [__@connection@__]: The connection to perform the query in.
+
+    [__@query@__]: The SQL query to run.
+
+    [__@out_result@__]: The query result.
+
+    __Returns:__ t'DuckDBState'
+
+    __C declaration:__ @duckdb_query@
+
+    __defined at:__ @duckdb.h 6509:27@
+
+    __exported by:__ @duckdb.h@
+-}
+c_duckdb_query ::
+     DuckDBConnection
+     {- ^
+
+          [__@connection@__]: The connection to perform the query in.
+
+          __C declaration:__ @connection@
+     -}
+  -> PtrConst.PtrConst BG.CChar
+     {- ^
+
+          [__@query@__]: The SQL query to run.
+
+          __C declaration:__ @query@
+     -}
+  -> BG.Ptr DuckDBResult
+     {- ^
+
+          [__@out_result@__]: The query result.
+
+          __C declaration:__ @out_result@
+     -}
+  -> IO DuckDBState
+c_duckdb_query = hs_bindgen_71265af97d3a41d1
+
+-- __unique:__ @Database_DuckDB_FFI_Database.DuckDB.FFI_Safe_duckdb_destroy_result@
+foreign import ccall safe "hs_bindgen_b86dbae055869626" hs_bindgen_b86dbae055869626_base ::
+     BG.Ptr BG.Void
+  -> IO ()
+
+-- __unique:__ @Database_DuckDB_FFI_Database.DuckDB.FFI_Safe_duckdb_destroy_result@
+hs_bindgen_b86dbae055869626 ::
+     BG.Ptr DuckDBResult
+  -> IO ()
+hs_bindgen_b86dbae055869626 =
+  \x0 ->
+    hs_bindgen_b86dbae055869626_base (BG.toFFIType x0)
+
+{-| Closes the result and de-allocates all memory allocated for that result.
+
+    Destroying a streaming result whose statement has not completed aborts the statement. On autocommit, its writes are rolled back. Inside a transaction, a statement that may write invalidates the transaction, and a read-only statement just stops. Until the statement has completed, preparing or running another statement on the connection fails with @@DUCKDB_ERROR_RESOURCE_IN_USE@@ and leaves it untouched. To make sure the statement takes effect, complete it by fetching until @'c_duckdb_fetch_chunk'@ returns NULL before destroying the result. A NULL chunk is also returned on an error, so check @'c_duckdb_result_error'@ afterwards.
+
+    history:
+
+    * stable: v0.1.0
+
+    [__@result@__]: The result to destroy.
+
+    __Returns:__ void
+
+    __C declaration:__ @duckdb_destroy_result@
+
+    __defined at:__ @duckdb.h 6527:19@
+
+    __exported by:__ @duckdb.h@
+-}
+c_duckdb_destroy_result ::
+     BG.Ptr DuckDBResult
+     {- ^
+
+          [__@result@__]: The result to destroy.
+
+          __C declaration:__ @result@
+     -}
+  -> IO ()
+c_duckdb_destroy_result = hs_bindgen_b86dbae055869626
+
+-- __unique:__ @Database_DuckDB_FFI_Database.DuckDB.FFI_Safe_duckdb_column_name@
+foreign import ccall safe "hs_bindgen_d23794402f3fe9a9" hs_bindgen_d23794402f3fe9a9_base ::
+     BG.Ptr BG.Void
+  -> HsBindgen.Runtime.LibC.Word64
+  -> IO (BG.Ptr BG.Void)
+
+-- __unique:__ @Database_DuckDB_FFI_Database.DuckDB.FFI_Safe_duckdb_column_name@
+hs_bindgen_d23794402f3fe9a9 ::
+     BG.Ptr DuckDBResult
+  -> DuckDBIdx
+  -> IO (PtrConst.PtrConst BG.CChar)
+hs_bindgen_d23794402f3fe9a9 =
+  \x0 ->
+    \x1 ->
+      fmap BG.fromFFIType (hs_bindgen_d23794402f3fe9a9_base (BG.toFFIType x0) (BG.toFFIType x1))
+
+{-| Returns the column name of the specified column. The result should not need to be freed; the column names will automatically be destroyed when the result is destroyed.
+
+    Returns @NULL@ if the column is out of range.
+
+    history:
+
+    * stable: v0.2.1
+
+    [__@result@__]: The result object to fetch the column name from.
+
+    [__@col@__]: The column index.
+
+    __Returns:__ const char*
+
+    __C declaration:__ @duckdb_column_name@
+
+    __defined at:__ @duckdb.h 6543:26@
+
+    __exported by:__ @duckdb.h@
+-}
+c_duckdb_column_name ::
+     BG.Ptr DuckDBResult
+     {- ^
+
+          [__@result@__]: The result object to fetch the column name from.
+
+          __C declaration:__ @result@
+     -}
+  -> DuckDBIdx
+     {- ^
+
+          [__@col@__]: The column index.
+
+          __C declaration:__ @col@
+     -}
+  -> IO (PtrConst.PtrConst BG.CChar)
+c_duckdb_column_name = hs_bindgen_d23794402f3fe9a9
+
+-- __unique:__ @Database_DuckDB_FFI_Database.DuckDB.FFI_Safe_duckdb_column_type@
+foreign import ccall safe "hs_bindgen_15a95e7d7ac8efc1" hs_bindgen_15a95e7d7ac8efc1_base ::
+     BG.Ptr BG.Void
+  -> HsBindgen.Runtime.LibC.Word64
+  -> IO BG.CUInt
+
+-- __unique:__ @Database_DuckDB_FFI_Database.DuckDB.FFI_Safe_duckdb_column_type@
+hs_bindgen_15a95e7d7ac8efc1 ::
+     BG.Ptr DuckDBResult
+  -> DuckDBIdx
+  -> IO DuckDBTypeAlias
+hs_bindgen_15a95e7d7ac8efc1 =
+  \x0 ->
+    \x1 ->
+      fmap BG.fromFFIType (hs_bindgen_15a95e7d7ac8efc1_base (BG.toFFIType x0) (BG.toFFIType x1))
+
+{-| Returns the column type of the specified column.
+
+    Returns @@DUCKDB_TYPE_INVALID@@ if the column is out of range.
+
+    history:
+
+    * stable: v0.2.9
+
+    [__@result@__]: The result object to fetch the column type from.
+
+    [__@col@__]: The column index.
+
+    __Returns:__ t'DuckDBTypeAlias'
+
+    __C declaration:__ @duckdb_column_type@
+
+    __defined at:__ @duckdb.h 6559:26@
+
+    __exported by:__ @duckdb.h@
+-}
+c_duckdb_column_type ::
+     BG.Ptr DuckDBResult
+     {- ^
+
+          [__@result@__]: The result object to fetch the column type from.
+
+          __C declaration:__ @result@
+     -}
+  -> DuckDBIdx
+     {- ^
+
+          [__@col@__]: The column index.
+
+          __C declaration:__ @col@
+     -}
+  -> IO DuckDBTypeAlias
+c_duckdb_column_type = hs_bindgen_15a95e7d7ac8efc1
+
+-- __unique:__ @Database_DuckDB_FFI_Database.DuckDB.FFI_Safe_duckdb_result_statement_type@
+foreign import ccall safe "hs_bindgen_8a124a1bd6d825dd" hs_bindgen_8a124a1bd6d825dd_base ::
+     BG.Ptr BG.Void
+  -> IO BG.CUInt
+
+-- __unique:__ @Database_DuckDB_FFI_Database.DuckDB.FFI_Safe_duckdb_result_statement_type@
+hs_bindgen_8a124a1bd6d825dd ::
+     BG.Ptr DuckDBResult
+  -> IO DuckDBStatementType
+hs_bindgen_8a124a1bd6d825dd =
+  \x0 ->
+    fmap BG.fromFFIType (hs_bindgen_8a124a1bd6d825dd_base (BG.toFFIType x0))
+
+{-| Returns the statement type of the statement that was executed
+
+    history:
+
+    * stable: v0.10.0
+
+    [__@result@__]: The result object to fetch the statement type from.
+
+    __Returns:__ t'DuckDBStatementType'
+
+    __C declaration:__ @duckdb_result_statement_type@
+
+    __defined at:__ @duckdb.h 6572:36@
+
+    __exported by:__ @duckdb.h@
+-}
+c_duckdb_result_statement_type ::
+     DuckDBResult
+     {- ^
+
+          [__@result@__]: The result object to fetch the statement type from.
+
+          __C declaration:__ @result@
+     -}
+  -> IO DuckDBStatementType
+c_duckdb_result_statement_type =
+  \result0 ->
+    BG.with result0 (\result1 ->
+                       hs_bindgen_8a124a1bd6d825dd result1)
+
+-- __unique:__ @Database_DuckDB_FFI_Database.DuckDB.FFI_Safe_duckdb_column_logical_type@
+foreign import ccall safe "hs_bindgen_7a205ff70db1d914" hs_bindgen_7a205ff70db1d914_base ::
+     BG.Ptr BG.Void
+  -> HsBindgen.Runtime.LibC.Word64
+  -> IO (BG.Ptr BG.Void)
+
+-- __unique:__ @Database_DuckDB_FFI_Database.DuckDB.FFI_Safe_duckdb_column_logical_type@
+hs_bindgen_7a205ff70db1d914 ::
+     BG.Ptr DuckDBResult
+  -> DuckDBIdx
+  -> IO DuckDBLogicalType
+hs_bindgen_7a205ff70db1d914 =
+  \x0 ->
+    \x1 ->
+      fmap BG.fromFFIType (hs_bindgen_7a205ff70db1d914_base (BG.toFFIType x0) (BG.toFFIType x1))
+
+{-| Returns the logical column type of the specified column.
+
+    The return type of this call should be destroyed with @'c_duckdb_destroy_logical_type'@ .
+
+    Returns @NULL@ if the column is out of range.
+
+    history:
+
+    * stable: v0.3.3
+
+    [__@result@__]: The result object to fetch the column type from.
+
+    [__@col@__]: The column index.
+
+    __Returns:__ t'DuckDBLogicalType'
+
+    __C declaration:__ @duckdb_column_logical_type@
+
+    __defined at:__ @duckdb.h 6590:34@
+
+    __exported by:__ @duckdb.h@
+-}
+c_duckdb_column_logical_type ::
+     BG.Ptr DuckDBResult
+     {- ^
+
+          [__@result@__]: The result object to fetch the column type from.
+
+          __C declaration:__ @result@
+     -}
+  -> DuckDBIdx
+     {- ^
+
+          [__@col@__]: The column index.
+
+          __C declaration:__ @col@
+     -}
+  -> IO DuckDBLogicalType
+c_duckdb_column_logical_type =
+  hs_bindgen_7a205ff70db1d914
+
+-- __unique:__ @Database_DuckDB_FFI_Database.DuckDB.FFI_Safe_duckdb_result_get_arrow_options@
+foreign import ccall safe "hs_bindgen_64d7e2281fcc020a" hs_bindgen_64d7e2281fcc020a_base ::
+     BG.Ptr BG.Void
+  -> IO (BG.Ptr BG.Void)
+
+-- __unique:__ @Database_DuckDB_FFI_Database.DuckDB.FFI_Safe_duckdb_result_get_arrow_options@
+hs_bindgen_64d7e2281fcc020a ::
+     BG.Ptr DuckDBResult
+  -> IO DuckDBArrowOptions
+hs_bindgen_64d7e2281fcc020a =
+  \x0 ->
+    fmap BG.fromFFIType (hs_bindgen_64d7e2281fcc020a_base (BG.toFFIType x0))
+
+{-| Returns the arrow options associated with the given result. These options are definitions of how the arrow arrays/schema should be produced.
+
+    history:
+
+    * unstable: v1.4.0
+
+    * stable: v1.5.6
+
+    [__@result@__]: The result object to fetch arrow options from.
+
+    __Returns:__ t'DuckDBArrowOptions'
+
+    __C declaration:__ @duckdb_result_get_arrow_options@
+
+    __defined at:__ @duckdb.h 6605:35@
+
+    __exported by:__ @duckdb.h@
+-}
+c_duckdb_result_get_arrow_options ::
+     BG.Ptr DuckDBResult
+     {- ^
+
+          [__@result@__]: The result object to fetch arrow options from.
+
+          __C declaration:__ @result@
+     -}
+  -> IO DuckDBArrowOptions
+c_duckdb_result_get_arrow_options =
+  hs_bindgen_64d7e2281fcc020a
+
+-- __unique:__ @Database_DuckDB_FFI_Database.DuckDB.FFI_Safe_duckdb_column_count@
+foreign import ccall safe "hs_bindgen_7041e53dc1f8b5e8" hs_bindgen_7041e53dc1f8b5e8_base ::
+     BG.Ptr BG.Void
+  -> IO HsBindgen.Runtime.LibC.Word64
+
+-- __unique:__ @Database_DuckDB_FFI_Database.DuckDB.FFI_Safe_duckdb_column_count@
+hs_bindgen_7041e53dc1f8b5e8 ::
+     BG.Ptr DuckDBResult
+  -> IO DuckDBIdx
+hs_bindgen_7041e53dc1f8b5e8 =
+  \x0 ->
+    fmap BG.fromFFIType (hs_bindgen_7041e53dc1f8b5e8_base (BG.toFFIType x0))
+
+{-| Returns the number of columns present in a the result object.
+
+    history:
+
+    * stable: v0.2.9
+
+    [__@result@__]: The result object.
+
+    __Returns:__ t'DuckDBIdx'
+
+    __C declaration:__ @duckdb_column_count@
+
+    __defined at:__ @duckdb.h 6618:20@
+
+    __exported by:__ @duckdb.h@
+-}
+c_duckdb_column_count ::
+     BG.Ptr DuckDBResult
+     {- ^
+
+          [__@result@__]: The result object.
+
+          __C declaration:__ @result@
+     -}
+  -> IO DuckDBIdx
+c_duckdb_column_count = hs_bindgen_7041e53dc1f8b5e8
+
+-- __unique:__ @Database_DuckDB_FFI_Database.DuckDB.FFI_Safe_duckdb_rows_changed@
+foreign import ccall safe "hs_bindgen_a04d4c381ef339ef" hs_bindgen_a04d4c381ef339ef_base ::
+     BG.Ptr BG.Void
+  -> IO HsBindgen.Runtime.LibC.Word64
+
+-- __unique:__ @Database_DuckDB_FFI_Database.DuckDB.FFI_Safe_duckdb_rows_changed@
+hs_bindgen_a04d4c381ef339ef ::
+     BG.Ptr DuckDBResult
+  -> IO DuckDBIdx
+hs_bindgen_a04d4c381ef339ef =
+  \x0 ->
+    fmap BG.fromFFIType (hs_bindgen_a04d4c381ef339ef_base (BG.toFFIType x0))
+
+{-| Returns the number of rows changed by the query stored in the result. This is relevant only for INSERT/UPDATE/DELETE queries. For other queries the rows_changed will be 0.
+
+    history:
+
+    * stable: v0.2.9
+
+    [__@result@__]: The result object.
+
+    __Returns:__ t'DuckDBIdx'
+
+    __C declaration:__ @duckdb_rows_changed@
+
+    __defined at:__ @duckdb.h 6632:20@
+
+    __exported by:__ @duckdb.h@
+-}
+c_duckdb_rows_changed ::
+     BG.Ptr DuckDBResult
+     {- ^
+
+          [__@result@__]: The result object.
+
+          __C declaration:__ @result@
+     -}
+  -> IO DuckDBIdx
+c_duckdb_rows_changed = hs_bindgen_a04d4c381ef339ef
+
+-- __unique:__ @Database_DuckDB_FFI_Database.DuckDB.FFI_Safe_duckdb_result_error@
+foreign import ccall safe "hs_bindgen_6a44049691a0d5ca" hs_bindgen_6a44049691a0d5ca_base ::
+     BG.Ptr BG.Void
+  -> IO (BG.Ptr BG.Void)
+
+-- __unique:__ @Database_DuckDB_FFI_Database.DuckDB.FFI_Safe_duckdb_result_error@
+hs_bindgen_6a44049691a0d5ca ::
+     BG.Ptr DuckDBResult
+  -> IO (PtrConst.PtrConst BG.CChar)
+hs_bindgen_6a44049691a0d5ca =
+  \x0 ->
+    fmap BG.fromFFIType (hs_bindgen_6a44049691a0d5ca_base (BG.toFFIType x0))
+
+{-| Returns the error message contained within the result. The error is only set if @'c_duckdb_query'@ returns @@DuckDBError@@ .
+
+    The result of this function must not be freed. It will be cleaned up when @'c_duckdb_destroy_result'@ is called.
+
+    history:
+
+    * stable: v0.2.9
+
+    [__@result@__]: The result object to fetch the error from.
+
+    __Returns:__ const char*
+
+    __C declaration:__ @duckdb_result_error@
+
+    __defined at:__ @duckdb.h 6647:26@
+
+    __exported by:__ @duckdb.h@
+-}
+c_duckdb_result_error ::
+     BG.Ptr DuckDBResult
+     {- ^
+
+          [__@result@__]: The result object to fetch the error from.
+
+          __C declaration:__ @result@
+     -}
+  -> IO (PtrConst.PtrConst BG.CChar)
+c_duckdb_result_error = hs_bindgen_6a44049691a0d5ca
+
+-- __unique:__ @Database_DuckDB_FFI_Database.DuckDB.FFI_Safe_duckdb_result_error_type@
+foreign import ccall safe "hs_bindgen_192ec6d6ab754ea4" hs_bindgen_192ec6d6ab754ea4_base ::
+     BG.Ptr BG.Void
+  -> IO BG.CUInt
+
+-- __unique:__ @Database_DuckDB_FFI_Database.DuckDB.FFI_Safe_duckdb_result_error_type@
+hs_bindgen_192ec6d6ab754ea4 ::
+     BG.Ptr DuckDBResult
+  -> IO DuckDBErrorType
+hs_bindgen_192ec6d6ab754ea4 =
+  \x0 ->
+    fmap BG.fromFFIType (hs_bindgen_192ec6d6ab754ea4_base (BG.toFFIType x0))
+
+{-| Returns the result error type contained within the result. The error is only set if @'c_duckdb_query'@ returns @@DuckDBError@@ .
+
+    history:
+
+    * stable: v1.1.0
+
+    [__@result@__]: The result object to fetch the error from.
+
+    __Returns:__ t'DuckDBErrorType'
+
+    __C declaration:__ @duckdb_result_error_type@
+
+    __defined at:__ @duckdb.h 6661:32@
+
+    __exported by:__ @duckdb.h@
+-}
+c_duckdb_result_error_type ::
+     BG.Ptr DuckDBResult
+     {- ^
+
+          [__@result@__]: The result object to fetch the error from.
+
+          __C declaration:__ @result@
+     -}
+  -> IO DuckDBErrorType
+c_duckdb_result_error_type =
+  hs_bindgen_192ec6d6ab754ea4
+
+-- __unique:__ @Database_DuckDB_FFI_Database.DuckDB.FFI_Safe_duckdb_result_return_type@
+foreign import ccall safe "hs_bindgen_28c674c4821c15e7" hs_bindgen_28c674c4821c15e7_base ::
+     BG.Ptr BG.Void
+  -> IO BG.CUInt
+
+-- __unique:__ @Database_DuckDB_FFI_Database.DuckDB.FFI_Safe_duckdb_result_return_type@
+hs_bindgen_28c674c4821c15e7 ::
+     BG.Ptr DuckDBResult
+  -> IO DuckDBResultType
+hs_bindgen_28c674c4821c15e7 =
+  \x0 ->
+    fmap BG.fromFFIType (hs_bindgen_28c674c4821c15e7_base (BG.toFFIType x0))
+
+{-| Returns the return_type of the given result, or DUCKDB_RETURN_TYPE_INVALID on error
+
+    history:
+
+    * stable: v0.10.0
+
+    [__@result@__]: The result object
+
+    __Returns:__ t'DuckDBResultType'
+
+    __C declaration:__ @duckdb_result_return_type@
+
+    __defined at:__ @duckdb.h 6674:33@
+
+    __exported by:__ @duckdb.h@
+-}
+c_duckdb_result_return_type ::
+     DuckDBResult
+     {- ^
+
+          [__@result@__]: The result object
+
+          __C declaration:__ @result@
+     -}
+  -> IO DuckDBResultType
+c_duckdb_result_return_type =
+  \result0 ->
+    BG.with result0 (\result1 ->
+                       hs_bindgen_28c674c4821c15e7 result1)
+
+-- __unique:__ @Database_DuckDB_FFI_Database.DuckDB.FFI_Safe_duckdb_fetch_chunk@
+foreign import ccall safe "hs_bindgen_e0bcac4419c39797" hs_bindgen_e0bcac4419c39797_base ::
+     BG.Ptr BG.Void
+  -> IO (BG.Ptr BG.Void)
+
+-- __unique:__ @Database_DuckDB_FFI_Database.DuckDB.FFI_Safe_duckdb_fetch_chunk@
+hs_bindgen_e0bcac4419c39797 ::
+     BG.Ptr DuckDBResult
+  -> IO DuckDBDataChunk
+hs_bindgen_e0bcac4419c39797 =
+  \x0 ->
+    fmap BG.fromFFIType (hs_bindgen_e0bcac4419c39797_base (BG.toFFIType x0))
+
+{-|
+
+    Fetches a data chunk from a t'DuckDBResult' . This function should be called repeatedly until the result is exhausted.
+
+    The result must be destroyed with @'c_duckdb_destroy_data_chunk'@ .
+
+    It is not known beforehand how many chunks will be returned by this result.
+
+    history:
+
+    * stable: v1.0.0
+
+    [__@result@__]: The result object to fetch the data chunk from.
+
+    __Returns:__ t'DuckDBDataChunk'
+
+    __C declaration:__ @duckdb_fetch_chunk@
+
+    __defined at:__ @duckdb.h 6691:32@
+
+    __exported by:__ @duckdb.h@
+-}
+c_duckdb_fetch_chunk ::
+     DuckDBResult
+     {- ^
+
+          [__@result@__]: The result object to fetch the data chunk from.
+
+          __C declaration:__ @result@
+     -}
+  -> IO DuckDBDataChunk
+c_duckdb_fetch_chunk =
+  \result0 ->
+    BG.with result0 (\result1 ->
+                       hs_bindgen_e0bcac4419c39797 result1)
+
+-- __unique:__ @Database_DuckDB_FFI_Database.DuckDB.FFI_Safe_duckdb_create_error_data@
+foreign import ccall safe "hs_bindgen_83b19aac8561d31d" hs_bindgen_83b19aac8561d31d_base ::
+     BG.CUInt
+  -> BG.Ptr BG.Void
+  -> IO (BG.Ptr BG.Void)
+
+-- __unique:__ @Database_DuckDB_FFI_Database.DuckDB.FFI_Safe_duckdb_create_error_data@
+hs_bindgen_83b19aac8561d31d ::
+     DuckDBErrorType
+  -> PtrConst.PtrConst BG.CChar
+  -> IO DuckDBErrorData
+hs_bindgen_83b19aac8561d31d =
+  \x0 ->
+    \x1 ->
+      fmap BG.fromFFIType (hs_bindgen_83b19aac8561d31d_base (BG.toFFIType x0) (BG.toFFIType x1))
+
+{-|
+
+    Creates t'DuckDBErrorData' . Must be destroyed with @'c_duckdb_destroy_error_data'@ .
+
+    history:
+
+    * unstable: v1.4.0
+
+    * stable: v1.5.6
+
+    [__@type@__]: The error type.
+
+    [__@message@__]: The error message.
+
+    __Returns:__ t'DuckDBErrorData'
+
+    __C declaration:__ @duckdb_create_error_data@
+
+    __defined at:__ @duckdb.h 6706:32@
+
+    __exported by:__ @duckdb.h@
+-}
+c_duckdb_create_error_data ::
+     DuckDBErrorType
+     {- ^
+
+          [__@type@__]: The error type.
+
+          __C declaration:__ @type@
+     -}
+  -> PtrConst.PtrConst BG.CChar
+     {- ^
+
+          [__@message@__]: The error message.
+
+          __C declaration:__ @message@
+     -}
+  -> IO DuckDBErrorData
+c_duckdb_create_error_data =
+  hs_bindgen_83b19aac8561d31d
+
+-- __unique:__ @Database_DuckDB_FFI_Database.DuckDB.FFI_Safe_duckdb_destroy_error_data@
+foreign import ccall safe "hs_bindgen_e557d66e3312baae" hs_bindgen_e557d66e3312baae_base ::
+     BG.Ptr BG.Void
+  -> IO ()
+
+-- __unique:__ @Database_DuckDB_FFI_Database.DuckDB.FFI_Safe_duckdb_destroy_error_data@
+hs_bindgen_e557d66e3312baae ::
+     BG.Ptr DuckDBErrorData
+  -> IO ()
+hs_bindgen_e557d66e3312baae =
+  \x0 ->
+    hs_bindgen_e557d66e3312baae_base (BG.toFFIType x0)
+
+{-| Destroys the error data and deallocates its memory.
+
+    history:
+
+    * unstable: v1.4.0
+
+    * stable: v1.5.6
+
+    [__@error_data@__]: The error data to destroy.
+
+    __Returns:__ void
+
+    __C declaration:__ @duckdb_destroy_error_data@
+
+    __defined at:__ @duckdb.h 6720:19@
+
+    __exported by:__ @duckdb.h@
+-}
+c_duckdb_destroy_error_data ::
+     BG.Ptr DuckDBErrorData
+     {- ^
+
+          [__@error_data@__]: The error data to destroy.
+
+          __C declaration:__ @error_data@
+     -}
+  -> IO ()
+c_duckdb_destroy_error_data =
+  hs_bindgen_e557d66e3312baae
+
+-- __unique:__ @Database_DuckDB_FFI_Database.DuckDB.FFI_Safe_duckdb_error_data_error_type@
+foreign import ccall safe "hs_bindgen_c1966ca80c0b4d76" hs_bindgen_c1966ca80c0b4d76_base ::
+     BG.Ptr BG.Void
+  -> IO BG.CUInt
+
+-- __unique:__ @Database_DuckDB_FFI_Database.DuckDB.FFI_Safe_duckdb_error_data_error_type@
+hs_bindgen_c1966ca80c0b4d76 ::
+     DuckDBErrorData
+  -> IO DuckDBErrorType
+hs_bindgen_c1966ca80c0b4d76 =
+  \x0 ->
+    fmap BG.fromFFIType (hs_bindgen_c1966ca80c0b4d76_base (BG.toFFIType x0))
+
+{-|
+
+    Returns the t'DuckDBErrorType' of the error data.
+
+    history:
+
+    * unstable: v1.4.0
+
+    * stable: v1.5.6
+
+    [__@error_data@__]: The error data.
+
+    __Returns:__ t'DuckDBErrorType'
+
+    __C declaration:__ @duckdb_error_data_error_type@
+
+    __defined at:__ @duckdb.h 6734:32@
+
+    __exported by:__ @duckdb.h@
+-}
+c_duckdb_error_data_error_type ::
+     DuckDBErrorData
+     {- ^
+
+          [__@error_data@__]: The error data.
+
+          __C declaration:__ @error_data@
+     -}
+  -> IO DuckDBErrorType
+c_duckdb_error_data_error_type =
+  hs_bindgen_c1966ca80c0b4d76
+
+-- __unique:__ @Database_DuckDB_FFI_Database.DuckDB.FFI_Safe_duckdb_error_data_message@
+foreign import ccall safe "hs_bindgen_787ec5c9b9236c65" hs_bindgen_787ec5c9b9236c65_base ::
+     BG.Ptr BG.Void
+  -> IO (BG.Ptr BG.Void)
+
+-- __unique:__ @Database_DuckDB_FFI_Database.DuckDB.FFI_Safe_duckdb_error_data_message@
+hs_bindgen_787ec5c9b9236c65 ::
+     DuckDBErrorData
+  -> IO (PtrConst.PtrConst BG.CChar)
+hs_bindgen_787ec5c9b9236c65 =
+  \x0 ->
+    fmap BG.fromFFIType (hs_bindgen_787ec5c9b9236c65_base (BG.toFFIType x0))
+
+{-| Returns the error message of the error data. Must not be freed.
+
+    history:
+
+    * unstable: v1.4.0
+
+    * stable: v1.5.6
+
+    [__@error_data@__]: The error data.
+
+    __Returns:__ const char*
+
+    __C declaration:__ @duckdb_error_data_message@
+
+    __defined at:__ @duckdb.h 6748:26@
+
+    __exported by:__ @duckdb.h@
+-}
+c_duckdb_error_data_message ::
+     DuckDBErrorData
+     {- ^
+
+          [__@error_data@__]: The error data.
+
+          __C declaration:__ @error_data@
+     -}
+  -> IO (PtrConst.PtrConst BG.CChar)
+c_duckdb_error_data_message =
+  hs_bindgen_787ec5c9b9236c65
+
+-- __unique:__ @Database_DuckDB_FFI_Database.DuckDB.FFI_Safe_duckdb_error_data_has_error@
+foreign import ccall safe "hs_bindgen_6ec4f19ab789994d" hs_bindgen_6ec4f19ab789994d_base ::
+     BG.Ptr BG.Void
+  -> IO BG.CBool
+
+-- __unique:__ @Database_DuckDB_FFI_Database.DuckDB.FFI_Safe_duckdb_error_data_has_error@
+hs_bindgen_6ec4f19ab789994d ::
+     DuckDBErrorData
+  -> IO BG.CBool
+hs_bindgen_6ec4f19ab789994d =
+  \x0 ->
+    fmap BG.fromFFIType (hs_bindgen_6ec4f19ab789994d_base (BG.toFFIType x0))
+
+{-| Returns whether the error data contains an error or not.
+
+    history:
+
+    * unstable: v1.4.0
+
+    * stable: v1.5.6
+
+    [__@error_data@__]: The error data.
+
+    __Returns:__ bool
+
+    __C declaration:__ @duckdb_error_data_has_error@
+
+    __defined at:__ @duckdb.h 6762:19@
+
+    __exported by:__ @duckdb.h@
+-}
+c_duckdb_error_data_has_error ::
+     DuckDBErrorData
+     {- ^
+
+          [__@error_data@__]: The error data.
+
+          __C declaration:__ @error_data@
+     -}
+  -> IO BG.CBool
+c_duckdb_error_data_has_error =
+  hs_bindgen_6ec4f19ab789994d
+
+-- __unique:__ @Database_DuckDB_FFI_Database.DuckDB.FFI_Safe_duckdb_malloc@
+foreign import ccall safe "hs_bindgen_f1244214a8151e9a" hs_bindgen_f1244214a8151e9a_base ::
+     HsBindgen.Runtime.LibC.CSize
+  -> IO (BG.Ptr BG.Void)
+
+-- __unique:__ @Database_DuckDB_FFI_Database.DuckDB.FFI_Safe_duckdb_malloc@
+hs_bindgen_f1244214a8151e9a ::
+     HsBindgen.Runtime.LibC.CSize
+  -> IO (BG.Ptr BG.Void)
+hs_bindgen_f1244214a8151e9a =
+  \x0 ->
+    fmap BG.fromFFIType (hs_bindgen_f1244214a8151e9a_base (BG.toFFIType x0))
+
+{-| Allocate @size@ bytes of memory using the duckdb internal malloc function. Any memory allocated in this manner should be freed using @'c_duckdb_free'@ .
+
+    history:
+
+    * stable: v0.2.7
+
+    [__@size@__]: The number of bytes to allocate.
+
+    __Returns:__ void*
+
+    __C declaration:__ @duckdb_malloc@
+
+    __defined at:__ @duckdb.h 6776:20@
+
+    __exported by:__ @duckdb.h@
+-}
+c_duckdb_malloc ::
+     HsBindgen.Runtime.LibC.CSize
+     {- ^
+
+          [__@size@__]: The number of bytes to allocate.
+
+          __C declaration:__ @size@
+     -}
+  -> IO (BG.Ptr BG.Void)
+c_duckdb_malloc = hs_bindgen_f1244214a8151e9a
+
+-- __unique:__ @Database_DuckDB_FFI_Database.DuckDB.FFI_Safe_duckdb_free@
+foreign import ccall safe "hs_bindgen_bcf85a099654942f" hs_bindgen_bcf85a099654942f_base ::
+     BG.Ptr BG.Void
+  -> IO ()
+
+-- __unique:__ @Database_DuckDB_FFI_Database.DuckDB.FFI_Safe_duckdb_free@
+hs_bindgen_bcf85a099654942f ::
+     BG.Ptr BG.Void
+  -> IO ()
+hs_bindgen_bcf85a099654942f =
+  \x0 ->
+    hs_bindgen_bcf85a099654942f_base (BG.toFFIType x0)
+
+{-| Free a value returned from @'c_duckdb_malloc'@ , @'c_duckdb_value_varchar'@ , @'c_duckdb_value_blob'@ , or @'c_duckdb_value_string'@ .
+
+    history:
+
+    * stable: v0.2.7
+
+    [__@ptr@__]: The memory region to de-allocate.
+
+    __Returns:__ void
+
+    __C declaration:__ @duckdb_free@
+
+    __defined at:__ @duckdb.h 6789:19@
+
+    __exported by:__ @duckdb.h@
+-}
+c_duckdb_free ::
+     BG.Ptr BG.Void
+     {- ^
+
+          [__@ptr@__]: The memory region to de-allocate.
+
+          __C declaration:__ @ptr@
+     -}
+  -> IO ()
+c_duckdb_free = hs_bindgen_bcf85a099654942f
+
+-- __unique:__ @Database_DuckDB_FFI_Database.DuckDB.FFI_Safe_duckdb_vector_size@
+foreign import ccall safe "hs_bindgen_3618e0173ef20b47" hs_bindgen_3618e0173ef20b47_base ::
+     IO HsBindgen.Runtime.LibC.Word64
+
+-- __unique:__ @Database_DuckDB_FFI_Database.DuckDB.FFI_Safe_duckdb_vector_size@
+hs_bindgen_3618e0173ef20b47 :: IO DuckDBIdx
+hs_bindgen_3618e0173ef20b47 =
+  fmap BG.fromFFIType hs_bindgen_3618e0173ef20b47_base
+
+{-| The internal vector size used by DuckDB. This is the amount of tuples that will fit into a data chunk created by @'c_duckdb_create_data_chunk'@ .
+
+    history:
+
+    * stable: v0.3.3
+
+    __Returns:__ t'DuckDBIdx'
+
+    __C declaration:__ @duckdb_vector_size@
+
+    __defined at:__ @duckdb.h 6802:20@
+
+    __exported by:__ @duckdb.h@
+-}
+c_duckdb_vector_size :: IO DuckDBIdx
+c_duckdb_vector_size = hs_bindgen_3618e0173ef20b47
+
+-- __unique:__ @Database_DuckDB_FFI_Database.DuckDB.FFI_Safe_duckdb_string_is_inlined@
+foreign import ccall safe "hs_bindgen_7db158389f9bbb5a" hs_bindgen_7db158389f9bbb5a_base ::
+     BG.Ptr BG.Void
+  -> IO BG.CBool
+
+-- __unique:__ @Database_DuckDB_FFI_Database.DuckDB.FFI_Safe_duckdb_string_is_inlined@
+hs_bindgen_7db158389f9bbb5a ::
+     BG.Ptr DuckDBStringT
+  -> IO BG.CBool
+hs_bindgen_7db158389f9bbb5a =
+  \x0 ->
+    fmap BG.fromFFIType (hs_bindgen_7db158389f9bbb5a_base (BG.toFFIType x0))
+
+{-|
+
+    Whether or not the t'DuckDBStringT' value is inlined. This means that the data of the string does not have a separate allocation.
+
+    history:
+
+    * stable: v0.8.0
+
+    [__@string@__]:
+
+    __Returns:__ bool
+
+    __C declaration:__ @duckdb_string_is_inlined@
+
+    __defined at:__ @duckdb.h 6816:19@
+
+    __exported by:__ @duckdb.h@
+-}
+c_duckdb_string_is_inlined ::
+     DuckDBStringT
+     {- ^
+
+          [__@string@__]:
+
+          __C declaration:__ @string@
+     -}
+  -> IO BG.CBool
+c_duckdb_string_is_inlined =
+  \string0 ->
+    BG.with string0 (\string1 ->
+                       hs_bindgen_7db158389f9bbb5a string1)
+
+-- __unique:__ @Database_DuckDB_FFI_Database.DuckDB.FFI_Safe_duckdb_string_t_length@
+foreign import ccall safe "hs_bindgen_370767e53933be13" hs_bindgen_370767e53933be13_base ::
+     BG.Ptr BG.Void
+  -> IO HsBindgen.Runtime.LibC.Word32
+
+-- __unique:__ @Database_DuckDB_FFI_Database.DuckDB.FFI_Safe_duckdb_string_t_length@
+hs_bindgen_370767e53933be13 ::
+     BG.Ptr DuckDBStringT
+  -> IO HsBindgen.Runtime.LibC.Word32
+hs_bindgen_370767e53933be13 =
+  \x0 ->
+    fmap BG.fromFFIType (hs_bindgen_370767e53933be13_base (BG.toFFIType x0))
+
+{-| Get the length of a string
+
+    history:
+
+    * stable: v1.1.0
+
+    [__@string@__]: The string to get the length of.
+
+    __Returns:__ uint32_t
+
+    __C declaration:__ @duckdb_string_t_length@
+
+    __defined at:__ @duckdb.h 6829:23@
+
+    __exported by:__ @duckdb.h@
+-}
+c_duckdb_string_t_length ::
+     DuckDBStringT
+     {- ^
+
+          [__@string@__]: The string to get the length of.
+
+          __C declaration:__ @string@
+     -}
+  -> IO HsBindgen.Runtime.LibC.Word32
+c_duckdb_string_t_length =
+  \string0 ->
+    BG.with string0 (\string1 ->
+                       hs_bindgen_370767e53933be13 string1)
+
+-- __unique:__ @Database_DuckDB_FFI_Database.DuckDB.FFI_Safe_duckdb_string_t_data@
+foreign import ccall safe "hs_bindgen_4dec572fab160e21" hs_bindgen_4dec572fab160e21_base ::
+     BG.Ptr BG.Void
+  -> IO (BG.Ptr BG.Void)
+
+-- __unique:__ @Database_DuckDB_FFI_Database.DuckDB.FFI_Safe_duckdb_string_t_data@
+hs_bindgen_4dec572fab160e21 ::
+     BG.Ptr DuckDBStringT
+  -> IO (PtrConst.PtrConst BG.CChar)
+hs_bindgen_4dec572fab160e21 =
+  \x0 ->
+    fmap BG.fromFFIType (hs_bindgen_4dec572fab160e21_base (BG.toFFIType x0))
+
+{-| Get a pointer to the string data of a string
+
+    history:
+
+    * stable: v1.1.0
+
+    [__@string@__]: The string to get the pointer to.
+
+    __Returns:__ const char*
+
+    __C declaration:__ @duckdb_string_t_data@
+
+    __defined at:__ @duckdb.h 6842:26@
+
+    __exported by:__ @duckdb.h@
+-}
+c_duckdb_string_t_data ::
+     BG.Ptr DuckDBStringT
+     {- ^
+
+          [__@string@__]: The string to get the pointer to.
+
+          __C declaration:__ @string@
+     -}
+  -> IO (PtrConst.PtrConst BG.CChar)
+c_duckdb_string_t_data = hs_bindgen_4dec572fab160e21
+
+-- __unique:__ @Database_DuckDB_FFI_Database.DuckDB.FFI_Safe_duckdb_valid_utf8_check@
+foreign import ccall safe "hs_bindgen_98c8545376939a95" hs_bindgen_98c8545376939a95_base ::
+     BG.Ptr BG.Void
+  -> HsBindgen.Runtime.LibC.Word64
+  -> IO (BG.Ptr BG.Void)
+
+-- __unique:__ @Database_DuckDB_FFI_Database.DuckDB.FFI_Safe_duckdb_valid_utf8_check@
+hs_bindgen_98c8545376939a95 ::
+     PtrConst.PtrConst BG.CChar
+  -> DuckDBIdx
+  -> IO DuckDBErrorData
+hs_bindgen_98c8545376939a95 =
+  \x0 ->
+    \x1 ->
+      fmap BG.fromFFIType (hs_bindgen_98c8545376939a95_base (BG.toFFIType x0) (BG.toFFIType x1))
+
+{-| Checks if a string is valid UTF-8.
+
+    history:
+
+    * unstable: v1.5.0
+
+    * stable: v1.5.6
+
+    [__@str@__]: The string to check
+
+    [__@len@__]: The length of the string (in bytes)
+
+    __Returns:__ t'DuckDBErrorData'
+
+    __C declaration:__ @duckdb_valid_utf8_check@
+
+    __defined at:__ @duckdb.h 6857:32@
+
+    __exported by:__ @duckdb.h@
+-}
+c_duckdb_valid_utf8_check ::
+     PtrConst.PtrConst BG.CChar
+     {- ^
+
+          [__@str@__]: The string to check
+
+          __C declaration:__ @str@
+     -}
+  -> DuckDBIdx
+     {- ^
+
+          [__@len@__]: The length of the string (in bytes)
+
+          __C declaration:__ @len@
+     -}
+  -> IO DuckDBErrorData
+c_duckdb_valid_utf8_check =
+  hs_bindgen_98c8545376939a95
+
+-- __unique:__ @Database_DuckDB_FFI_Database.DuckDB.FFI_Safe_duckdb_row_count@
+foreign import ccall safe "hs_bindgen_9c5e815dd04bdc70" hs_bindgen_9c5e815dd04bdc70_base ::
+     BG.Ptr BG.Void
+  -> IO HsBindgen.Runtime.LibC.Word64
+
+-- __unique:__ @Database_DuckDB_FFI_Database.DuckDB.FFI_Safe_duckdb_row_count@
+hs_bindgen_9c5e815dd04bdc70 ::
+     BG.Ptr DuckDBResult
+  -> IO DuckDBIdx
+hs_bindgen_9c5e815dd04bdc70 =
+  \x0 ->
+    fmap BG.fromFFIType (hs_bindgen_9c5e815dd04bdc70_base (BG.toFFIType x0))
+
+{-| __DEPRECATION NOTICE__ : This method is scheduled for removal in a future release.
+
+    Returns the number of rows present in the result object.
+
+    history:
+
+    * stable: v0.2.9
+
+    * deprecated: v1.0.0
+
+    [__@result@__]: The result object.
+
+    __Returns:__ t'DuckDBIdx'
+
+    __C declaration:__ @duckdb_row_count@
+
+    __defined at:__ @duckdb.h 6873:20@
+
+    __exported by:__ @duckdb.h@
+-}
+c_duckdb_row_count ::
+     BG.Ptr DuckDBResult
+     {- ^
+
+          [__@result@__]: The result object.
+
+          __C declaration:__ @result@
+     -}
+  -> IO DuckDBIdx
+c_duckdb_row_count = hs_bindgen_9c5e815dd04bdc70
+
+-- __unique:__ @Database_DuckDB_FFI_Database.DuckDB.FFI_Safe_duckdb_column_data@
+foreign import ccall safe "hs_bindgen_6d8e96c1f8b5a7c4" hs_bindgen_6d8e96c1f8b5a7c4_base ::
+     BG.Ptr BG.Void
+  -> HsBindgen.Runtime.LibC.Word64
+  -> IO (BG.Ptr BG.Void)
+
+-- __unique:__ @Database_DuckDB_FFI_Database.DuckDB.FFI_Safe_duckdb_column_data@
+hs_bindgen_6d8e96c1f8b5a7c4 ::
+     BG.Ptr DuckDBResult
+  -> DuckDBIdx
+  -> IO (BG.Ptr BG.Void)
+hs_bindgen_6d8e96c1f8b5a7c4 =
+  \x0 ->
+    \x1 ->
+      fmap BG.fromFFIType (hs_bindgen_6d8e96c1f8b5a7c4_base (BG.toFFIType x0) (BG.toFFIType x1))
+
+{-| __DEPRECATED__ : Prefer using @'c_duckdb_result_get_chunk'@ instead.
+
+    Returns the data of a specific column of a result in columnar format.
+
+    The function returns a dense array which contains the result data. The exact type stored in the array depends on the corresponding t'DuckDBTypeAlias' (as provided by @'c_duckdb_column_type'@ ). For the exact type by which the data should be accessed, see the comments in [the types section](types) or the @t'DuckDBType'@ enum.
+
+    For example, for a column of type @@DUCKDB_TYPE_INTEGER@@ , rows can be accessed in the following manner: @c int32_t *data = (int32_t *) 'c_duckdb_column_data' (&result, 0); printf("Data for row d: d\n", row, data[row]);@
+
+    history:
+
+    * stable: v0.2.9
+
+    * deprecated: v1.0.0
+
+    [__@result@__]: The result object to fetch the column data from.
+
+    [__@col@__]: The column index.
+
+    __Returns:__ void*
+
+    __C declaration:__ @duckdb_column_data@
+
+    __defined at:__ @duckdb.h 6897:20@
+
+    __exported by:__ @duckdb.h@
+-}
+c_duckdb_column_data ::
+     BG.Ptr DuckDBResult
+     {- ^
+
+          [__@result@__]: The result object to fetch the column data from.
+
+          __C declaration:__ @result@
+     -}
+  -> DuckDBIdx
+     {- ^
+
+          [__@col@__]: The column index.
+
+          __C declaration:__ @col@
+     -}
+  -> IO (BG.Ptr BG.Void)
+c_duckdb_column_data = hs_bindgen_6d8e96c1f8b5a7c4
+
+-- __unique:__ @Database_DuckDB_FFI_Database.DuckDB.FFI_Safe_duckdb_nullmask_data@
+foreign import ccall safe "hs_bindgen_d038d17542f439e3" hs_bindgen_d038d17542f439e3_base ::
+     BG.Ptr BG.Void
+  -> HsBindgen.Runtime.LibC.Word64
+  -> IO (BG.Ptr BG.Void)
+
+-- __unique:__ @Database_DuckDB_FFI_Database.DuckDB.FFI_Safe_duckdb_nullmask_data@
+hs_bindgen_d038d17542f439e3 ::
+     BG.Ptr DuckDBResult
+  -> DuckDBIdx
+  -> IO (BG.Ptr BG.CBool)
+hs_bindgen_d038d17542f439e3 =
+  \x0 ->
+    \x1 ->
+      fmap BG.fromFFIType (hs_bindgen_d038d17542f439e3_base (BG.toFFIType x0) (BG.toFFIType x1))
+
+{-| __C declaration:__ @duckdb_nullmask_data@
+
+    __defined at:__ @duckdb.h 6920:20@
+
+    __exported by:__ @duckdb.h@
+-}
+c_duckdb_nullmask_data ::
+     BG.Ptr DuckDBResult
+     -- ^ __C declaration:__ @result@
+  -> DuckDBIdx
+     -- ^ __C declaration:__ @col@
+  -> IO (BG.Ptr BG.CBool)
+c_duckdb_nullmask_data = hs_bindgen_d038d17542f439e3
+
+-- __unique:__ @Database_DuckDB_FFI_Database.DuckDB.FFI_Safe_duckdb_result_get_chunk@
+foreign import ccall safe "hs_bindgen_5996d8c396e44345" hs_bindgen_5996d8c396e44345_base ::
+     BG.Ptr BG.Void
+  -> HsBindgen.Runtime.LibC.Word64
+  -> IO (BG.Ptr BG.Void)
+
+-- __unique:__ @Database_DuckDB_FFI_Database.DuckDB.FFI_Safe_duckdb_result_get_chunk@
+hs_bindgen_5996d8c396e44345 ::
+     BG.Ptr DuckDBResult
+  -> DuckDBIdx
+  -> IO DuckDBDataChunk
+hs_bindgen_5996d8c396e44345 =
+  \x0 ->
+    \x1 ->
+      fmap BG.fromFFIType (hs_bindgen_5996d8c396e44345_base (BG.toFFIType x0) (BG.toFFIType x1))
+
+{-| __DEPRECATED__ : Prefer using @'c_duckdb_result_get_chunk'@ instead.
+
+    Returns the nullmask of a specific column of a result in columnar format. The nullmask indicates for every row whether or not the corresponding row is @NULL@ . If a row is @NULL@ , the values present in the array provided by @'c_duckdb_column_data'@ are undefined.
+
+    @
+    int32_t *data = (int32_t *) duckdb_column_data(&result, 0); bool *nullmask = duckdb_nullmask_data(&result, 0);
+      if (nullmask[row]) { printf("Data for row %d: NULL\n", row); } else { printf("Data for row %d: %d\n", row,
+      data[row]); } 
+    @
+
+    history:
+
+    * stable: v0.2.9
+
+    * deprecated: v1.0.0
+
+    #if @DUCKDB_API_VERSION_AT_LEAST(0, 3, 3)@ && ( @DUCKDB_API_VERSION_BELOW(1, 0, 0)@ || DUCKDB_API_ALLOW_DEPRECATED) /*! __DEPRECATION NOTICE__ : This method is scheduled for removal in a future release.
+
+    [__@result@__]: The result object to fetch the nullmask from.
+
+    [__@col@__]: The column index.
+
+    __Returns:__ bool* */ DUCKDB_C_API bool *duckdb_nullmask_data( t'DuckDBResult' *result, t'DuckDBIdx' col); #endif
+
+    Fetches a data chunk from the t'DuckDBResult' . This function should be called repeatedly until the result is exhausted.
+
+    The result must be destroyed with @'c_duckdb_destroy_data_chunk'@ .
+
+    This function supersedes all @t'DuckDBValue'@ functions, as well as the @'c_duckdb_column_data'@ and @duckdb_nullmask_data@ functions. It results in significantly better performance, and should be preferred in newer code-bases.
+
+    If this function is used, none of the other result functions can be used and vice versa (i.e. this function cannot be mixed with the legacy result functions).
+
+    Use @'c_duckdb_result_chunk_count'@ to figure out how many chunks there are in the result.
+
+    history:
+
+    * stable: v0.3.3
+
+    * deprecated: v1.0.0
+
+    [__@result@__]: The result object to fetch the data chunk from.
+
+    [__@chunk_index@__]: The chunk index to fetch from.
+
+    __Returns:__ t'DuckDBDataChunk'
+
+    __C declaration:__ @duckdb_result_get_chunk@
+
+    __defined at:__ @duckdb.h 6947:32@
+
+    __exported by:__ @duckdb.h@
+-}
+c_duckdb_result_get_chunk ::
+     DuckDBResult
+     {- ^
+
+          [__@result@__]: The result object to fetch the data chunk from.
+
+          __C declaration:__ @result@
+     -}
+  -> DuckDBIdx
+     {- ^
+
+          [__@chunk_index@__]: The chunk index to fetch from.
+
+          __C declaration:__ @chunk_index@
+     -}
+  -> IO DuckDBDataChunk
+c_duckdb_result_get_chunk =
+  \result0 ->
+    \chunk_index1 ->
+      BG.with result0 (\result2 ->
+                         hs_bindgen_5996d8c396e44345 result2 chunk_index1)
+
+-- __unique:__ @Database_DuckDB_FFI_Database.DuckDB.FFI_Safe_duckdb_result_is_streaming@
+foreign import ccall safe "hs_bindgen_95717693287571e0" hs_bindgen_95717693287571e0_base ::
+     BG.Ptr BG.Void
+  -> IO BG.CBool
+
+-- __unique:__ @Database_DuckDB_FFI_Database.DuckDB.FFI_Safe_duckdb_result_is_streaming@
+hs_bindgen_95717693287571e0 ::
+     BG.Ptr DuckDBResult
+  -> IO BG.CBool
+hs_bindgen_95717693287571e0 =
+  \x0 ->
+    fmap BG.fromFFIType (hs_bindgen_95717693287571e0_base (BG.toFFIType x0))
+
+{-| __DEPRECATION NOTICE__ : This method is scheduled for removal in a future release.
+
+    Checks if the type of the internal result is StreamQueryResult.
+
+    history:
+
+    * stable: v0.8.0
+
+    * deprecated: v1.0.0
+
+    [__@result@__]: The result object to check.
+
+    __Returns:__ bool
+
+    __C declaration:__ @duckdb_result_is_streaming@
+
+    __defined at:__ @duckdb.h 6963:19@
+
+    __exported by:__ @duckdb.h@
+-}
+c_duckdb_result_is_streaming ::
+     DuckDBResult
+     {- ^
+
+          [__@result@__]: The result object to check.
+
+          __C declaration:__ @result@
+     -}
+  -> IO BG.CBool
+c_duckdb_result_is_streaming =
+  \result0 ->
+    BG.with result0 (\result1 ->
+                       hs_bindgen_95717693287571e0 result1)
+
+-- __unique:__ @Database_DuckDB_FFI_Database.DuckDB.FFI_Safe_duckdb_result_chunk_count@
+foreign import ccall safe "hs_bindgen_026a59d5dd8cd1d0" hs_bindgen_026a59d5dd8cd1d0_base ::
+     BG.Ptr BG.Void
+  -> IO HsBindgen.Runtime.LibC.Word64
+
+-- __unique:__ @Database_DuckDB_FFI_Database.DuckDB.FFI_Safe_duckdb_result_chunk_count@
+hs_bindgen_026a59d5dd8cd1d0 ::
+     BG.Ptr DuckDBResult
+  -> IO DuckDBIdx
+hs_bindgen_026a59d5dd8cd1d0 =
+  \x0 ->
+    fmap BG.fromFFIType (hs_bindgen_026a59d5dd8cd1d0_base (BG.toFFIType x0))
+
+{-| __DEPRECATION NOTICE__ : This method is scheduled for removal in a future release.
+
+    Returns the number of data chunks present in the result.
+
+    history:
+
+    * stable: v0.3.3
+
+    * deprecated: v1.0.0
+
+    [__@result@__]: The result object
+
+    __Returns:__ t'DuckDBIdx'
+
+    __C declaration:__ @duckdb_result_chunk_count@
+
+    __defined at:__ @duckdb.h 6979:20@
+
+    __exported by:__ @duckdb.h@
+-}
+c_duckdb_result_chunk_count ::
+     DuckDBResult
+     {- ^
+
+          [__@result@__]: The result object
+
+          __C declaration:__ @result@
+     -}
+  -> IO DuckDBIdx
+c_duckdb_result_chunk_count =
+  \result0 ->
+    BG.with result0 (\result1 ->
+                       hs_bindgen_026a59d5dd8cd1d0 result1)
+
+-- __unique:__ @Database_DuckDB_FFI_Database.DuckDB.FFI_Safe_duckdb_stream_fetch_chunk@
+foreign import ccall safe "hs_bindgen_1779194488609e3a" hs_bindgen_1779194488609e3a_base ::
+     BG.Ptr BG.Void
+  -> IO (BG.Ptr BG.Void)
+
+-- __unique:__ @Database_DuckDB_FFI_Database.DuckDB.FFI_Safe_duckdb_stream_fetch_chunk@
+hs_bindgen_1779194488609e3a ::
+     BG.Ptr DuckDBResult
+  -> IO DuckDBDataChunk
+hs_bindgen_1779194488609e3a =
+  \x0 ->
+    fmap BG.fromFFIType (hs_bindgen_1779194488609e3a_base (BG.toFFIType x0))
+
+{-| __DEPRECATION NOTICE__ : This method is scheduled for removal in a future release.
+
+    Fetches a data chunk from the (streaming) t'DuckDBResult' . This function should be called repeatedly until the result is exhausted.
+
+    The result must be destroyed with @'c_duckdb_destroy_data_chunk'@ .
+
+    This function can only be used on duckdb_results created with \'duckdb_pending_prepared_streaming\'
+
+    If this function is used, none of the other result functions can be used and vice versa (i.e. this function cannot be mixed with the legacy result functions or the materialized result functions).
+
+    It is not known beforehand how many chunks will be returned by this result.
+
+    history:
+
+    * stable: v0.8.0
+
+    * deprecated: v1.0.0
+
+    [__@result@__]: The result object to fetch the data chunk from.
+
+    __Returns:__ t'DuckDBDataChunk'
+
+    __C declaration:__ @duckdb_stream_fetch_chunk@
+
+    __defined at:__ @duckdb.h 7005:32@
+
+    __exported by:__ @duckdb.h@
+-}
+c_duckdb_stream_fetch_chunk ::
+     DuckDBResult
+     {- ^
+
+          [__@result@__]: The result object to fetch the data chunk from.
+
+          __C declaration:__ @result@
+     -}
+  -> IO DuckDBDataChunk
+c_duckdb_stream_fetch_chunk =
+  \result0 ->
+    BG.with result0 (\result1 ->
+                       hs_bindgen_1779194488609e3a result1)
+
+-- __unique:__ @Database_DuckDB_FFI_Database.DuckDB.FFI_Safe_duckdb_add_replacement_scan@
+foreign import ccall safe "hs_bindgen_97d26f995cbfe9e1" hs_bindgen_97d26f995cbfe9e1_base ::
+     BG.Ptr BG.Void
+  -> BG.FunPtr BG.Void
+  -> BG.Ptr BG.Void
+  -> BG.FunPtr BG.Void
+  -> IO ()
+
+-- __unique:__ @Database_DuckDB_FFI_Database.DuckDB.FFI_Safe_duckdb_add_replacement_scan@
+hs_bindgen_97d26f995cbfe9e1 ::
+     DuckDBDatabase
+  -> DuckDBReplacementCallback
+  -> BG.Ptr BG.Void
+  -> DuckDBDeleteCallback
+  -> IO ()
+hs_bindgen_97d26f995cbfe9e1 =
+  \x0 ->
+    \x1 ->
+      \x2 ->
+        \x3 ->
+          hs_bindgen_97d26f995cbfe9e1_base (BG.toFFIType x0) (BG.toFFIType x1) (BG.toFFIType x2) (BG.toFFIType x3)
+
+{-| Add a replacement scan definition to the specified database.
+
+    history:
+
+    * stable: v0.3.3
+
+    [__@db@__]: The database object to add the replacement scan to
+
+    [__@replacement@__]: The replacement scan callback
+
+    [__@extra_data@__]: Extra data that is passed back into the specified callback
+
+    [__@delete_callback@__]: The delete callback to call on the extra data, if any
+
+    __Returns:__ void
+
+    __C declaration:__ @duckdb_add_replacement_scan@
+
+    __defined at:__ @duckdb.h 7039:19@
+
+    __exported by:__ @duckdb.h@
+-}
+c_duckdb_add_replacement_scan ::
+     DuckDBDatabase
+     {- ^
+
+          [__@db@__]: The database object to add the replacement scan to
+
+          __C declaration:__ @db@
+     -}
+  -> DuckDBReplacementCallback
+     {- ^
+
+          [__@replacement@__]: The replacement scan callback
+
+          __C declaration:__ @replacement@
+     -}
+  -> BG.Ptr BG.Void
+     {- ^
+
+          [__@extra_data@__]: Extra data that is passed back into the specified callback
+
+          __C declaration:__ @extra_data@
+     -}
+  -> DuckDBDeleteCallback
+     {- ^
+
+          [__@delete_callback@__]: The delete callback to call on the extra data, if any
+
+          __C declaration:__ @delete_callback@
+     -}
+  -> IO ()
+c_duckdb_add_replacement_scan =
+  hs_bindgen_97d26f995cbfe9e1
+
+-- __unique:__ @Database_DuckDB_FFI_Database.DuckDB.FFI_Safe_duckdb_replacement_scan_set_function_name@
+foreign import ccall safe "hs_bindgen_9829208ce8f26461" hs_bindgen_9829208ce8f26461_base ::
+     BG.Ptr BG.Void
+  -> BG.Ptr BG.Void
+  -> IO ()
+
+-- __unique:__ @Database_DuckDB_FFI_Database.DuckDB.FFI_Safe_duckdb_replacement_scan_set_function_name@
+hs_bindgen_9829208ce8f26461 ::
+     DuckDBReplacementScanInfo
+  -> PtrConst.PtrConst BG.CChar
+  -> IO ()
+hs_bindgen_9829208ce8f26461 =
+  \x0 ->
+    \x1 ->
+      hs_bindgen_9829208ce8f26461_base (BG.toFFIType x0) (BG.toFFIType x1)
+
+{-| Sets the replacement function name. If this function is called in the replacement callback, the replacement scan is performed. If it is not called, the replacement callback is not performed.
+
+    history:
+
+    * stable: v0.3.3
+
+    [__@info@__]: The info object
+
+    [__@function_name@__]: The function name to substitute.
+
+    __Returns:__ void
+
+    __C declaration:__ @duckdb_replacement_scan_set_function_name@
+
+    __defined at:__ @duckdb.h 7055:19@
+
+    __exported by:__ @duckdb.h@
+-}
+c_duckdb_replacement_scan_set_function_name ::
+     DuckDBReplacementScanInfo
+     {- ^
+
+          [__@info@__]: The info object
+
+          __C declaration:__ @info@
+     -}
+  -> PtrConst.PtrConst BG.CChar
+     {- ^
+
+          [__@function_name@__]: The function name to substitute.
+
+          __C declaration:__ @function_name@
+     -}
+  -> IO ()
+c_duckdb_replacement_scan_set_function_name =
+  hs_bindgen_9829208ce8f26461
+
+-- __unique:__ @Database_DuckDB_FFI_Database.DuckDB.FFI_Safe_duckdb_replacement_scan_add_parameter@
+foreign import ccall safe "hs_bindgen_826fb92442cb041e" hs_bindgen_826fb92442cb041e_base ::
+     BG.Ptr BG.Void
+  -> BG.Ptr BG.Void
+  -> IO ()
+
+-- __unique:__ @Database_DuckDB_FFI_Database.DuckDB.FFI_Safe_duckdb_replacement_scan_add_parameter@
+hs_bindgen_826fb92442cb041e ::
+     DuckDBReplacementScanInfo
+  -> DuckDBValue
+  -> IO ()
+hs_bindgen_826fb92442cb041e =
+  \x0 ->
+    \x1 ->
+      hs_bindgen_826fb92442cb041e_base (BG.toFFIType x0) (BG.toFFIType x1)
+
+{-| Adds a parameter to the replacement scan function.
+
+    history:
+
+    * stable: v0.3.3
+
+    [__@info@__]: The info object
+
+    [__@parameter@__]: The parameter to add.
+
+    __Returns:__ void
+
+    __C declaration:__ @duckdb_replacement_scan_add_parameter@
+
+    __defined at:__ @duckdb.h 7070:19@
+
+    __exported by:__ @duckdb.h@
+-}
+c_duckdb_replacement_scan_add_parameter ::
+     DuckDBReplacementScanInfo
+     {- ^
+
+          [__@info@__]: The info object
+
+          __C declaration:__ @info@
+     -}
+  -> DuckDBValue
+     {- ^
+
+          [__@parameter@__]: The parameter to add.
+
+          __C declaration:__ @parameter@
+     -}
+  -> IO ()
+c_duckdb_replacement_scan_add_parameter =
+  hs_bindgen_826fb92442cb041e
+
+-- __unique:__ @Database_DuckDB_FFI_Database.DuckDB.FFI_Safe_duckdb_replacement_scan_set_error@
+foreign import ccall safe "hs_bindgen_19e43007fd1f8170" hs_bindgen_19e43007fd1f8170_base ::
+     BG.Ptr BG.Void
+  -> BG.Ptr BG.Void
+  -> IO ()
+
+-- __unique:__ @Database_DuckDB_FFI_Database.DuckDB.FFI_Safe_duckdb_replacement_scan_set_error@
+hs_bindgen_19e43007fd1f8170 ::
+     DuckDBReplacementScanInfo
+  -> PtrConst.PtrConst BG.CChar
+  -> IO ()
+hs_bindgen_19e43007fd1f8170 =
+  \x0 ->
+    \x1 ->
+      hs_bindgen_19e43007fd1f8170_base (BG.toFFIType x0) (BG.toFFIType x1)
+
+{-| Report that an error has occurred while executing the replacement scan.
+
+    history:
+
+    * stable: v0.6.0
+
+    [__@info@__]: The info object
+
+    [__@error@__]: The error message
+
+    __Returns:__ void
+
+    __C declaration:__ @duckdb_replacement_scan_set_error@
+
+    __defined at:__ @duckdb.h 7084:19@
+
+    __exported by:__ @duckdb.h@
+-}
+c_duckdb_replacement_scan_set_error ::
+     DuckDBReplacementScanInfo
+     {- ^
+
+          [__@info@__]: The info object
+
+          __C declaration:__ @info@
+     -}
+  -> PtrConst.PtrConst BG.CChar
+     {- ^
+
+          [__@error@__]: The error message
+
+          __C declaration:__ @error@
+     -}
+  -> IO ()
+c_duckdb_replacement_scan_set_error =
+  hs_bindgen_19e43007fd1f8170
+
+-- __unique:__ @Database_DuckDB_FFI_Database.DuckDB.FFI_Safe_duckdb_create_scalar_function@
+foreign import ccall safe "hs_bindgen_29f5e8082607c703" hs_bindgen_29f5e8082607c703_base ::
+     IO (BG.Ptr BG.Void)
+
+-- __unique:__ @Database_DuckDB_FFI_Database.DuckDB.FFI_Safe_duckdb_create_scalar_function@
+hs_bindgen_29f5e8082607c703 :: IO DuckDBScalarFunction
+hs_bindgen_29f5e8082607c703 =
+  fmap BG.fromFFIType hs_bindgen_29f5e8082607c703_base
+
+{-| Creates a new empty scalar function.
+
+    The return value must be destroyed with @'c_duckdb_destroy_scalar_function'@ .
+
+    history:
+
+    * stable: v1.1.0
+
+    __Returns:__ t'DuckDBScalarFunction'
+
+    __C declaration:__ @duckdb_create_scalar_function@
+
+    __defined at:__ @duckdb.h 7116:37@
+
+    __exported by:__ @duckdb.h@
+-}
+c_duckdb_create_scalar_function :: IO DuckDBScalarFunction
+c_duckdb_create_scalar_function =
+  hs_bindgen_29f5e8082607c703
+
+-- __unique:__ @Database_DuckDB_FFI_Database.DuckDB.FFI_Safe_duckdb_destroy_scalar_function@
+foreign import ccall safe "hs_bindgen_057a4b9e9634d576" hs_bindgen_057a4b9e9634d576_base ::
+     BG.Ptr BG.Void
+  -> IO ()
+
+-- __unique:__ @Database_DuckDB_FFI_Database.DuckDB.FFI_Safe_duckdb_destroy_scalar_function@
+hs_bindgen_057a4b9e9634d576 ::
+     BG.Ptr DuckDBScalarFunction
+  -> IO ()
+hs_bindgen_057a4b9e9634d576 =
+  \x0 ->
+    hs_bindgen_057a4b9e9634d576_base (BG.toFFIType x0)
+
+{-| Destroys the given scalar function object.
+
+    history:
+
+    * stable: v1.1.0
+
+    [__@scalar_function@__]: The scalar function to destroy
+
+    __Returns:__ void
+
+    __C declaration:__ @duckdb_destroy_scalar_function@
+
+    __defined at:__ @duckdb.h 7129:19@
+
+    __exported by:__ @duckdb.h@
+-}
+c_duckdb_destroy_scalar_function ::
+     BG.Ptr DuckDBScalarFunction
+     {- ^
+
+          [__@scalar_function@__]: The scalar function to destroy
+
+          __C declaration:__ @scalar_function@
+     -}
+  -> IO ()
+c_duckdb_destroy_scalar_function =
+  hs_bindgen_057a4b9e9634d576
+
+-- __unique:__ @Database_DuckDB_FFI_Database.DuckDB.FFI_Safe_duckdb_scalar_function_set_name@
+foreign import ccall safe "hs_bindgen_d70a7a97e2b89e4d" hs_bindgen_d70a7a97e2b89e4d_base ::
+     BG.Ptr BG.Void
+  -> BG.Ptr BG.Void
+  -> IO ()
+
+-- __unique:__ @Database_DuckDB_FFI_Database.DuckDB.FFI_Safe_duckdb_scalar_function_set_name@
+hs_bindgen_d70a7a97e2b89e4d ::
+     DuckDBScalarFunction
+  -> PtrConst.PtrConst BG.CChar
+  -> IO ()
+hs_bindgen_d70a7a97e2b89e4d =
+  \x0 ->
+    \x1 ->
+      hs_bindgen_d70a7a97e2b89e4d_base (BG.toFFIType x0) (BG.toFFIType x1)
+
+{-| Sets the name of the given scalar function.
+
+    history:
+
+    * stable: v1.1.0
+
+    [__@scalar_function@__]: The scalar function
+
+    [__@name@__]: The name of the scalar function
+
+    __Returns:__ void
+
+    __C declaration:__ @duckdb_scalar_function_set_name@
+
+    __defined at:__ @duckdb.h 7143:19@
+
+    __exported by:__ @duckdb.h@
+-}
+c_duckdb_scalar_function_set_name ::
+     DuckDBScalarFunction
+     {- ^
+
+          [__@scalar_function@__]: The scalar function
+
+          __C declaration:__ @scalar_function@
+     -}
+  -> PtrConst.PtrConst BG.CChar
+     {- ^
+
+          [__@name@__]: The name of the scalar function
+
+          __C declaration:__ @name@
+     -}
+  -> IO ()
+c_duckdb_scalar_function_set_name =
+  hs_bindgen_d70a7a97e2b89e4d
+
+-- __unique:__ @Database_DuckDB_FFI_Database.DuckDB.FFI_Safe_duckdb_scalar_function_set_varargs@
+foreign import ccall safe "hs_bindgen_39e740d82a18ea0b" hs_bindgen_39e740d82a18ea0b_base ::
+     BG.Ptr BG.Void
+  -> BG.Ptr BG.Void
+  -> IO ()
+
+-- __unique:__ @Database_DuckDB_FFI_Database.DuckDB.FFI_Safe_duckdb_scalar_function_set_varargs@
+hs_bindgen_39e740d82a18ea0b ::
+     DuckDBScalarFunction
+  -> DuckDBLogicalType
+  -> IO ()
+hs_bindgen_39e740d82a18ea0b =
+  \x0 ->
+    \x1 ->
+      hs_bindgen_39e740d82a18ea0b_base (BG.toFFIType x0) (BG.toFFIType x1)
+
+{-| Sets the parameters of the given scalar function to varargs. Does not require adding parameters with duckdb_scalar_function_add_parameter.
+
+    history:
+
+    * stable: v1.1.0
+
+    [__@scalar_function@__]: The scalar function.
+
+    [__@type@__]: The type of the arguments.
+
+    __Returns:__ void
+
+    __C declaration:__ @duckdb_scalar_function_set_varargs@
+
+    __defined at:__ @duckdb.h 7158:19@
+
+    __exported by:__ @duckdb.h@
+-}
+c_duckdb_scalar_function_set_varargs ::
+     DuckDBScalarFunction
+     {- ^
+
+          [__@scalar_function@__]: The scalar function.
+
+          __C declaration:__ @scalar_function@
+     -}
+  -> DuckDBLogicalType
+     {- ^
+
+          [__@type@__]: The type of the arguments.
+
+          __C declaration:__ @type@
+     -}
+  -> IO ()
+c_duckdb_scalar_function_set_varargs =
+  hs_bindgen_39e740d82a18ea0b
+
+-- __unique:__ @Database_DuckDB_FFI_Database.DuckDB.FFI_Safe_duckdb_scalar_function_set_special_handling@
+foreign import ccall safe "hs_bindgen_3d2dbabbd47f004c" hs_bindgen_3d2dbabbd47f004c_base ::
+     BG.Ptr BG.Void
+  -> IO ()
+
+-- __unique:__ @Database_DuckDB_FFI_Database.DuckDB.FFI_Safe_duckdb_scalar_function_set_special_handling@
+hs_bindgen_3d2dbabbd47f004c ::
+     DuckDBScalarFunction
+  -> IO ()
+hs_bindgen_3d2dbabbd47f004c =
+  \x0 ->
+    hs_bindgen_3d2dbabbd47f004c_base (BG.toFFIType x0)
+
+{-| Sets the scalar function\'s null-handling behavior to special.
+
+    history:
+
+    * stable: v1.1.0
+
+    [__@scalar_function@__]: The scalar function.
+
+    __Returns:__ void
+
+    __C declaration:__ @duckdb_scalar_function_set_special_handling@
+
+    __defined at:__ @duckdb.h 7171:19@
+
+    __exported by:__ @duckdb.h@
+-}
+c_duckdb_scalar_function_set_special_handling ::
+     DuckDBScalarFunction
+     {- ^
+
+          [__@scalar_function@__]: The scalar function.
+
+          __C declaration:__ @scalar_function@
+     -}
+  -> IO ()
+c_duckdb_scalar_function_set_special_handling =
+  hs_bindgen_3d2dbabbd47f004c
+
+-- __unique:__ @Database_DuckDB_FFI_Database.DuckDB.FFI_Safe_duckdb_scalar_function_set_volatile@
+foreign import ccall safe "hs_bindgen_5bea12af803df42f" hs_bindgen_5bea12af803df42f_base ::
+     BG.Ptr BG.Void
+  -> IO ()
+
+-- __unique:__ @Database_DuckDB_FFI_Database.DuckDB.FFI_Safe_duckdb_scalar_function_set_volatile@
+hs_bindgen_5bea12af803df42f ::
+     DuckDBScalarFunction
+  -> IO ()
+hs_bindgen_5bea12af803df42f =
+  \x0 ->
+    hs_bindgen_5bea12af803df42f_base (BG.toFFIType x0)
+
+{-| Sets the Function Stability of the scalar function to VOLATILE, indicating the function should be re-run for every row. This limits optimization that can be performed for the function.
+
+    history:
+
+    * stable: v1.1.0
+
+    [__@scalar_function@__]: The scalar function.
+
+    __Returns:__ void
+
+    __C declaration:__ @duckdb_scalar_function_set_volatile@
+
+    __defined at:__ @duckdb.h 7185:19@
+
+    __exported by:__ @duckdb.h@
+-}
+c_duckdb_scalar_function_set_volatile ::
+     DuckDBScalarFunction
+     {- ^
+
+          [__@scalar_function@__]: The scalar function.
+
+          __C declaration:__ @scalar_function@
+     -}
+  -> IO ()
+c_duckdb_scalar_function_set_volatile =
+  hs_bindgen_5bea12af803df42f
+
+-- __unique:__ @Database_DuckDB_FFI_Database.DuckDB.FFI_Safe_duckdb_scalar_function_add_parameter@
+foreign import ccall safe "hs_bindgen_51818ec21303d214" hs_bindgen_51818ec21303d214_base ::
+     BG.Ptr BG.Void
+  -> BG.Ptr BG.Void
+  -> IO ()
+
+-- __unique:__ @Database_DuckDB_FFI_Database.DuckDB.FFI_Safe_duckdb_scalar_function_add_parameter@
+hs_bindgen_51818ec21303d214 ::
+     DuckDBScalarFunction
+  -> DuckDBLogicalType
+  -> IO ()
+hs_bindgen_51818ec21303d214 =
+  \x0 ->
+    \x1 ->
+      hs_bindgen_51818ec21303d214_base (BG.toFFIType x0) (BG.toFFIType x1)
+
+{-| Adds a parameter to the scalar function.
+
+    history:
+
+    * stable: v1.1.0
+
+    [__@scalar_function@__]: The scalar function.
+
+    [__@type@__]: The parameter type. Cannot contain INVALID.
+
+    __Returns:__ void
+
+    __C declaration:__ @duckdb_scalar_function_add_parameter@
+
+    __defined at:__ @duckdb.h 7199:19@
+
+    __exported by:__ @duckdb.h@
+-}
+c_duckdb_scalar_function_add_parameter ::
+     DuckDBScalarFunction
+     {- ^
+
+          [__@scalar_function@__]: The scalar function.
+
+          __C declaration:__ @scalar_function@
+     -}
+  -> DuckDBLogicalType
+     {- ^
+
+          [__@type@__]: The parameter type. Cannot contain INVALID.
+
+          __C declaration:__ @type@
+     -}
+  -> IO ()
+c_duckdb_scalar_function_add_parameter =
+  hs_bindgen_51818ec21303d214
+
+-- __unique:__ @Database_DuckDB_FFI_Database.DuckDB.FFI_Safe_duckdb_scalar_function_set_return_type@
+foreign import ccall safe "hs_bindgen_e1d8f6ace443646c" hs_bindgen_e1d8f6ace443646c_base ::
+     BG.Ptr BG.Void
+  -> BG.Ptr BG.Void
+  -> IO ()
+
+-- __unique:__ @Database_DuckDB_FFI_Database.DuckDB.FFI_Safe_duckdb_scalar_function_set_return_type@
+hs_bindgen_e1d8f6ace443646c ::
+     DuckDBScalarFunction
+  -> DuckDBLogicalType
+  -> IO ()
+hs_bindgen_e1d8f6ace443646c =
+  \x0 ->
+    \x1 ->
+      hs_bindgen_e1d8f6ace443646c_base (BG.toFFIType x0) (BG.toFFIType x1)
+
+{-| Sets the return type of the scalar function.
+
+    history:
+
+    * stable: v1.1.0
+
+    [__@scalar_function@__]: The scalar function
+
+    [__@type@__]: Cannot contain INVALID or ANY.
+
+    __Returns:__ void
+
+    __C declaration:__ @duckdb_scalar_function_set_return_type@
+
+    __defined at:__ @duckdb.h 7214:19@
+
+    __exported by:__ @duckdb.h@
+-}
+c_duckdb_scalar_function_set_return_type ::
+     DuckDBScalarFunction
+     {- ^
+
+          [__@scalar_function@__]: The scalar function
+
+          __C declaration:__ @scalar_function@
+     -}
+  -> DuckDBLogicalType
+     {- ^
+
+          [__@type@__]: Cannot contain INVALID or ANY.
+
+          __C declaration:__ @type@
+     -}
+  -> IO ()
+c_duckdb_scalar_function_set_return_type =
+  hs_bindgen_e1d8f6ace443646c
+
+-- __unique:__ @Database_DuckDB_FFI_Database.DuckDB.FFI_Safe_duckdb_scalar_function_set_extra_info@
+foreign import ccall safe "hs_bindgen_c93a9fd37fbf98d6" hs_bindgen_c93a9fd37fbf98d6_base ::
+     BG.Ptr BG.Void
+  -> BG.Ptr BG.Void
+  -> BG.FunPtr BG.Void
+  -> IO ()
+
+-- __unique:__ @Database_DuckDB_FFI_Database.DuckDB.FFI_Safe_duckdb_scalar_function_set_extra_info@
+hs_bindgen_c93a9fd37fbf98d6 ::
+     DuckDBScalarFunction
+  -> BG.Ptr BG.Void
+  -> DuckDBDeleteCallback
+  -> IO ()
+hs_bindgen_c93a9fd37fbf98d6 =
+  \x0 ->
+    \x1 ->
+      \x2 ->
+        hs_bindgen_c93a9fd37fbf98d6_base (BG.toFFIType x0) (BG.toFFIType x1) (BG.toFFIType x2)
+
+{-| Assigns extra information to the scalar function that can be fetched during binding, etc.
+
+    history:
+
+    * stable: v1.1.0
+
+    [__@scalar_function@__]: The scalar function
+
+    [__@extra_info@__]: The extra information
+
+    [__@destroy@__]: The callback that will be called to destroy the extra information (if any)
+
+    __Returns:__ void
+
+    __C declaration:__ @duckdb_scalar_function_set_extra_info@
+
+    __defined at:__ @duckdb.h 7230:19@
+
+    __exported by:__ @duckdb.h@
+-}
+c_duckdb_scalar_function_set_extra_info ::
+     DuckDBScalarFunction
+     {- ^
+
+          [__@scalar_function@__]: The scalar function
+
+          __C declaration:__ @scalar_function@
+     -}
+  -> BG.Ptr BG.Void
+     {- ^
+
+          [__@extra_info@__]: The extra information
+
+          __C declaration:__ @extra_info@
+     -}
+  -> DuckDBDeleteCallback
+     {- ^
+
+          [__@destroy@__]: The callback that will be called to destroy the extra information (if any)
+
+          __C declaration:__ @destroy@
+     -}
+  -> IO ()
+c_duckdb_scalar_function_set_extra_info =
+  hs_bindgen_c93a9fd37fbf98d6
+
+-- __unique:__ @Database_DuckDB_FFI_Database.DuckDB.FFI_Safe_duckdb_scalar_function_set_bind@
+foreign import ccall safe "hs_bindgen_1c92902e5ed97bae" hs_bindgen_1c92902e5ed97bae_base ::
+     BG.Ptr BG.Void
+  -> BG.FunPtr BG.Void
+  -> IO ()
+
+-- __unique:__ @Database_DuckDB_FFI_Database.DuckDB.FFI_Safe_duckdb_scalar_function_set_bind@
+hs_bindgen_1c92902e5ed97bae ::
+     DuckDBScalarFunction
+  -> DuckDBScalarFunctionBindFun
+  -> IO ()
+hs_bindgen_1c92902e5ed97bae =
+  \x0 ->
+    \x1 ->
+      hs_bindgen_1c92902e5ed97bae_base (BG.toFFIType x0) (BG.toFFIType x1)
+
+{-| Sets the (optional) bind function of the scalar function.
+
+    history:
+
+    * unstable: v1.3.0
+
+    * stable: v1.5.6
+
+    [__@scalar_function@__]: The scalar function.
+
+    [__@bind@__]: The bind function.
+
+    __Returns:__ void
+
+    __C declaration:__ @duckdb_scalar_function_set_bind@
+
+    __defined at:__ @duckdb.h 7246:19@
+
+    __exported by:__ @duckdb.h@
+-}
+c_duckdb_scalar_function_set_bind ::
+     DuckDBScalarFunction
+     {- ^
+
+          [__@scalar_function@__]: The scalar function.
+
+          __C declaration:__ @scalar_function@
+     -}
+  -> DuckDBScalarFunctionBindFun
+     {- ^
+
+          [__@bind@__]: The bind function.
+
+          __C declaration:__ @bind@
+     -}
+  -> IO ()
+c_duckdb_scalar_function_set_bind =
+  hs_bindgen_1c92902e5ed97bae
+
+-- __unique:__ @Database_DuckDB_FFI_Database.DuckDB.FFI_Safe_duckdb_scalar_function_set_bind_data@
+foreign import ccall safe "hs_bindgen_161a5fe606050dea" hs_bindgen_161a5fe606050dea_base ::
+     BG.Ptr BG.Void
+  -> BG.Ptr BG.Void
+  -> BG.FunPtr BG.Void
+  -> IO ()
+
+-- __unique:__ @Database_DuckDB_FFI_Database.DuckDB.FFI_Safe_duckdb_scalar_function_set_bind_data@
+hs_bindgen_161a5fe606050dea ::
+     DuckDBBindInfo
+  -> BG.Ptr BG.Void
+  -> DuckDBDeleteCallback
+  -> IO ()
+hs_bindgen_161a5fe606050dea =
+  \x0 ->
+    \x1 ->
+      \x2 ->
+        hs_bindgen_161a5fe606050dea_base (BG.toFFIType x0) (BG.toFFIType x1) (BG.toFFIType x2)
+
+{-| Sets the user-provided bind data in the bind object of the scalar function. The bind data object can be retrieved again during execution. In most case, you also need to set the copy-callback of your bind data via duckdb_scalar_function_set_bind_data_copy.
+
+    history:
+
+    * unstable: v1.3.0
+
+    * stable: v1.5.6
+
+    [__@info@__]: The bind info of the scalar function.
+
+    [__@bind_data@__]: The bind data object.
+
+    [__@destroy@__]: The callback to destroy the bind data (if any).
+
+    __Returns:__ void
+
+    __C declaration:__ @duckdb_scalar_function_set_bind_data@
+
+    __defined at:__ @duckdb.h 7265:19@
+
+    __exported by:__ @duckdb.h@
+-}
+c_duckdb_scalar_function_set_bind_data ::
+     DuckDBBindInfo
+     {- ^
+
+          [__@info@__]: The bind info of the scalar function.
+
+          __C declaration:__ @info@
+     -}
+  -> BG.Ptr BG.Void
+     {- ^
+
+          [__@bind_data@__]: The bind data object.
+
+          __C declaration:__ @bind_data@
+     -}
+  -> DuckDBDeleteCallback
+     {- ^
+
+          [__@destroy@__]: The callback to destroy the bind data (if any).
+
+          __C declaration:__ @destroy@
+     -}
+  -> IO ()
+c_duckdb_scalar_function_set_bind_data =
+  hs_bindgen_161a5fe606050dea
+
+-- __unique:__ @Database_DuckDB_FFI_Database.DuckDB.FFI_Safe_duckdb_scalar_function_set_bind_data_copy@
+foreign import ccall safe "hs_bindgen_83d27908da83f624" hs_bindgen_83d27908da83f624_base ::
+     BG.Ptr BG.Void
+  -> BG.FunPtr BG.Void
+  -> IO ()
+
+-- __unique:__ @Database_DuckDB_FFI_Database.DuckDB.FFI_Safe_duckdb_scalar_function_set_bind_data_copy@
+hs_bindgen_83d27908da83f624 ::
+     DuckDBBindInfo
+  -> DuckDBCopyCallback
+  -> IO ()
+hs_bindgen_83d27908da83f624 =
+  \x0 ->
+    \x1 ->
+      hs_bindgen_83d27908da83f624_base (BG.toFFIType x0) (BG.toFFIType x1)
+
+{-| Sets the copy-callback for the user-provided bind data in the bind object of the scalar function.
+
+    history:
+
+    * unstable: v1.4.0
+
+    * stable: v1.5.6
+
+    [__@info@__]: The bind info of the scalar function.
+
+    [__@copy@__]: The callback to copy the bind data (if any).
+
+    __Returns:__ void
+
+    __C declaration:__ @duckdb_scalar_function_set_bind_data_copy@
+
+    __defined at:__ @duckdb.h 7281:19@
+
+    __exported by:__ @duckdb.h@
+-}
+c_duckdb_scalar_function_set_bind_data_copy ::
+     DuckDBBindInfo
+     {- ^
+
+          [__@info@__]: The bind info of the scalar function.
+
+          __C declaration:__ @info@
+     -}
+  -> DuckDBCopyCallback
+     {- ^
+
+          [__@copy@__]: The callback to copy the bind data (if any).
+
+          __C declaration:__ @copy@
+     -}
+  -> IO ()
+c_duckdb_scalar_function_set_bind_data_copy =
+  hs_bindgen_83d27908da83f624
+
+-- __unique:__ @Database_DuckDB_FFI_Database.DuckDB.FFI_Safe_duckdb_scalar_function_bind_set_error@
+foreign import ccall safe "hs_bindgen_d3eb9e966acdda11" hs_bindgen_d3eb9e966acdda11_base ::
+     BG.Ptr BG.Void
+  -> BG.Ptr BG.Void
+  -> IO ()
+
+-- __unique:__ @Database_DuckDB_FFI_Database.DuckDB.FFI_Safe_duckdb_scalar_function_bind_set_error@
+hs_bindgen_d3eb9e966acdda11 ::
+     DuckDBBindInfo
+  -> PtrConst.PtrConst BG.CChar
+  -> IO ()
+hs_bindgen_d3eb9e966acdda11 =
+  \x0 ->
+    \x1 ->
+      hs_bindgen_d3eb9e966acdda11_base (BG.toFFIType x0) (BG.toFFIType x1)
+
+{-| Report that an error has occurred while calling bind on a scalar function.
+
+    history:
+
+    * unstable: v1.3.0
+
+    * stable: v1.5.6
+
+    [__@info@__]: The bind info object.
+
+    [__@error@__]: The error message.
+
+    __Returns:__ void
+
+    __C declaration:__ @duckdb_scalar_function_bind_set_error@
+
+    __defined at:__ @duckdb.h 7296:19@
+
+    __exported by:__ @duckdb.h@
+-}
+c_duckdb_scalar_function_bind_set_error ::
+     DuckDBBindInfo
+     {- ^
+
+          [__@info@__]: The bind info object.
+
+          __C declaration:__ @info@
+     -}
+  -> PtrConst.PtrConst BG.CChar
+     {- ^
+
+          [__@error@__]: The error message.
+
+          __C declaration:__ @error@
+     -}
+  -> IO ()
+c_duckdb_scalar_function_bind_set_error =
+  hs_bindgen_d3eb9e966acdda11
+
+-- __unique:__ @Database_DuckDB_FFI_Database.DuckDB.FFI_Safe_duckdb_scalar_function_set_function@
+foreign import ccall safe "hs_bindgen_480557d5180f6227" hs_bindgen_480557d5180f6227_base ::
+     BG.Ptr BG.Void
+  -> BG.FunPtr BG.Void
+  -> IO ()
+
+-- __unique:__ @Database_DuckDB_FFI_Database.DuckDB.FFI_Safe_duckdb_scalar_function_set_function@
+hs_bindgen_480557d5180f6227 ::
+     DuckDBScalarFunction
+  -> DuckDBScalarFunctionFun
+  -> IO ()
+hs_bindgen_480557d5180f6227 =
+  \x0 ->
+    \x1 ->
+      hs_bindgen_480557d5180f6227_base (BG.toFFIType x0) (BG.toFFIType x1)
+
+{-| Sets the main function of the scalar function.
+
+    history:
+
+    * stable: v1.1.0
+
+    [__@scalar_function@__]: The scalar function
+
+    [__@function@__]: The function
+
+    __Returns:__ void
+
+    __C declaration:__ @duckdb_scalar_function_set_function@
+
+    __defined at:__ @duckdb.h 7310:19@
+
+    __exported by:__ @duckdb.h@
+-}
+c_duckdb_scalar_function_set_function ::
+     DuckDBScalarFunction
+     {- ^
+
+          [__@scalar_function@__]: The scalar function
+
+          __C declaration:__ @scalar_function@
+     -}
+  -> DuckDBScalarFunctionFun
+     {- ^
+
+          [__@function@__]: The function
+
+          __C declaration:__ @function@
+     -}
+  -> IO ()
+c_duckdb_scalar_function_set_function =
+  hs_bindgen_480557d5180f6227
+
+-- __unique:__ @Database_DuckDB_FFI_Database.DuckDB.FFI_Safe_duckdb_register_scalar_function@
+foreign import ccall safe "hs_bindgen_f58f0538c8a2c929" hs_bindgen_f58f0538c8a2c929_base ::
+     BG.Ptr BG.Void
+  -> BG.Ptr BG.Void
+  -> IO BG.CUInt
+
+-- __unique:__ @Database_DuckDB_FFI_Database.DuckDB.FFI_Safe_duckdb_register_scalar_function@
+hs_bindgen_f58f0538c8a2c929 ::
+     DuckDBConnection
+  -> DuckDBScalarFunction
+  -> IO DuckDBState
+hs_bindgen_f58f0538c8a2c929 =
+  \x0 ->
+    \x1 ->
+      fmap BG.fromFFIType (hs_bindgen_f58f0538c8a2c929_base (BG.toFFIType x0) (BG.toFFIType x1))
+
+{-| Register the scalar function object within the given connection.
+
+    The function requires at least a name, a function and a return type.
+
+    If the function is incomplete or a function with this name already exists DuckDBError is returned.
+
+    history:
+
+    * stable: v1.1.0
+
+    [__@con@__]: The connection to register it in.
+
+    [__@scalar_function@__]: The function pointer
+
+    __Returns:__ t'DuckDBState'
+
+    __C declaration:__ @duckdb_register_scalar_function@
+
+    __defined at:__ @duckdb.h 7329:27@
+
+    __exported by:__ @duckdb.h@
+-}
+c_duckdb_register_scalar_function ::
+     DuckDBConnection
+     {- ^
+
+          [__@con@__]: The connection to register it in.
+
+          __C declaration:__ @con@
+     -}
+  -> DuckDBScalarFunction
+     {- ^
+
+          [__@scalar_function@__]: The function pointer
+
+          __C declaration:__ @scalar_function@
+     -}
+  -> IO DuckDBState
+c_duckdb_register_scalar_function =
+  hs_bindgen_f58f0538c8a2c929
+
+-- __unique:__ @Database_DuckDB_FFI_Database.DuckDB.FFI_Safe_duckdb_scalar_function_get_extra_info@
+foreign import ccall safe "hs_bindgen_8bb846e4c098cebe" hs_bindgen_8bb846e4c098cebe_base ::
+     BG.Ptr BG.Void
+  -> IO (BG.Ptr BG.Void)
+
+-- __unique:__ @Database_DuckDB_FFI_Database.DuckDB.FFI_Safe_duckdb_scalar_function_get_extra_info@
+hs_bindgen_8bb846e4c098cebe ::
+     DuckDBFunctionInfo
+  -> IO (BG.Ptr BG.Void)
+hs_bindgen_8bb846e4c098cebe =
+  \x0 ->
+    fmap BG.fromFFIType (hs_bindgen_8bb846e4c098cebe_base (BG.toFFIType x0))
+
+{-| Retrieves the extra info of the function as set in @'c_duckdb_scalar_function_set_extra_info'@ .
+
+    history:
+
+    * stable: v1.1.0
+
+    [__@info@__]: The info object.
+
+    __Returns:__ void*
+
+    __C declaration:__ @duckdb_scalar_function_get_extra_info@
+
+    __defined at:__ @duckdb.h 7343:20@
+
+    __exported by:__ @duckdb.h@
+-}
+c_duckdb_scalar_function_get_extra_info ::
+     DuckDBFunctionInfo
+     {- ^
+
+          [__@info@__]: The info object.
+
+          __C declaration:__ @info@
+     -}
+  -> IO (BG.Ptr BG.Void)
+c_duckdb_scalar_function_get_extra_info =
+  hs_bindgen_8bb846e4c098cebe
+
+-- __unique:__ @Database_DuckDB_FFI_Database.DuckDB.FFI_Safe_duckdb_scalar_function_bind_get_extra_info@
+foreign import ccall safe "hs_bindgen_353d4b2c6989c18f" hs_bindgen_353d4b2c6989c18f_base ::
+     BG.Ptr BG.Void
+  -> IO (BG.Ptr BG.Void)
+
+-- __unique:__ @Database_DuckDB_FFI_Database.DuckDB.FFI_Safe_duckdb_scalar_function_bind_get_extra_info@
+hs_bindgen_353d4b2c6989c18f ::
+     DuckDBBindInfo
+  -> IO (BG.Ptr BG.Void)
+hs_bindgen_353d4b2c6989c18f =
+  \x0 ->
+    fmap BG.fromFFIType (hs_bindgen_353d4b2c6989c18f_base (BG.toFFIType x0))
+
+{-| Retrieves the extra info of the function as set in the bind info.
+
+    history:
+
+    * unstable: v1.4.0
+
+    * stable: v1.5.6
+
+    [__@info@__]: The info object.
+
+    __Returns:__ void*
+
+    __C declaration:__ @duckdb_scalar_function_bind_get_extra_info@
+
+    __defined at:__ @duckdb.h 7357:20@
+
+    __exported by:__ @duckdb.h@
+-}
+c_duckdb_scalar_function_bind_get_extra_info ::
+     DuckDBBindInfo
+     {- ^
+
+          [__@info@__]: The info object.
+
+          __C declaration:__ @info@
+     -}
+  -> IO (BG.Ptr BG.Void)
+c_duckdb_scalar_function_bind_get_extra_info =
+  hs_bindgen_353d4b2c6989c18f
+
+-- __unique:__ @Database_DuckDB_FFI_Database.DuckDB.FFI_Safe_duckdb_scalar_function_get_bind_data@
+foreign import ccall safe "hs_bindgen_7ee9535ddf4111aa" hs_bindgen_7ee9535ddf4111aa_base ::
+     BG.Ptr BG.Void
+  -> IO (BG.Ptr BG.Void)
+
+-- __unique:__ @Database_DuckDB_FFI_Database.DuckDB.FFI_Safe_duckdb_scalar_function_get_bind_data@
+hs_bindgen_7ee9535ddf4111aa ::
+     DuckDBFunctionInfo
+  -> IO (BG.Ptr BG.Void)
+hs_bindgen_7ee9535ddf4111aa =
+  \x0 ->
+    fmap BG.fromFFIType (hs_bindgen_7ee9535ddf4111aa_base (BG.toFFIType x0))
+
+{-| Gets the scalar function\'s bind data set by @'c_duckdb_scalar_function_set_bind_data'@ . Note that the bind data is read-only.
+
+    history:
+
+    * unstable: v1.3.0
+
+    * stable: v1.5.6
+
+    [__@info@__]: The function info.
+
+    __Returns:__ void*
+
+    __C declaration:__ @duckdb_scalar_function_get_bind_data@
+
+    __defined at:__ @duckdb.h 7372:20@
+
+    __exported by:__ @duckdb.h@
+-}
+c_duckdb_scalar_function_get_bind_data ::
+     DuckDBFunctionInfo
+     {- ^
+
+          [__@info@__]: The function info.
+
+          __C declaration:__ @info@
+     -}
+  -> IO (BG.Ptr BG.Void)
+c_duckdb_scalar_function_get_bind_data =
+  hs_bindgen_7ee9535ddf4111aa
+
+-- __unique:__ @Database_DuckDB_FFI_Database.DuckDB.FFI_Safe_duckdb_scalar_function_get_client_context@
+foreign import ccall safe "hs_bindgen_629abf4e5c702bde" hs_bindgen_629abf4e5c702bde_base ::
+     BG.Ptr BG.Void
+  -> BG.Ptr BG.Void
+  -> IO ()
+
+-- __unique:__ @Database_DuckDB_FFI_Database.DuckDB.FFI_Safe_duckdb_scalar_function_get_client_context@
+hs_bindgen_629abf4e5c702bde ::
+     DuckDBBindInfo
+  -> BG.Ptr DuckDBClientContext
+  -> IO ()
+hs_bindgen_629abf4e5c702bde =
+  \x0 ->
+    \x1 ->
+      hs_bindgen_629abf4e5c702bde_base (BG.toFFIType x0) (BG.toFFIType x1)
+
+{-| Retrieves the client context of the bind info of a scalar function.
+
+    history:
+
+    * unstable: v1.3.0
+
+    * stable: v1.5.6
+
+    [__@info@__]: The bind info object of the scalar function.
+
+    [__@out_context@__]: The client context of the bind info. Must be destroyed with @'c_duckdb_destroy_client_context'@ .
+
+    __Returns:__ void
+
+    __C declaration:__ @duckdb_scalar_function_get_client_context@
+
+    __defined at:__ @duckdb.h 7387:19@
+
+    __exported by:__ @duckdb.h@
+-}
+c_duckdb_scalar_function_get_client_context ::
+     DuckDBBindInfo
+     {- ^
+
+          [__@info@__]: The bind info object of the scalar function.
+
+          __C declaration:__ @info@
+     -}
+  -> BG.Ptr DuckDBClientContext
+     {- ^
+
+          [__@out_context@__]: The client context of the bind info. Must be destroyed with @'c_duckdb_destroy_client_context'@ .
+
+          __C declaration:__ @out_context@
+     -}
+  -> IO ()
+c_duckdb_scalar_function_get_client_context =
+  hs_bindgen_629abf4e5c702bde
+
+-- __unique:__ @Database_DuckDB_FFI_Database.DuckDB.FFI_Safe_duckdb_scalar_function_set_error@
+foreign import ccall safe "hs_bindgen_49dce543be61dc96" hs_bindgen_49dce543be61dc96_base ::
+     BG.Ptr BG.Void
+  -> BG.Ptr BG.Void
+  -> IO ()
+
+-- __unique:__ @Database_DuckDB_FFI_Database.DuckDB.FFI_Safe_duckdb_scalar_function_set_error@
+hs_bindgen_49dce543be61dc96 ::
+     DuckDBFunctionInfo
+  -> PtrConst.PtrConst BG.CChar
+  -> IO ()
+hs_bindgen_49dce543be61dc96 =
+  \x0 ->
+    \x1 ->
+      hs_bindgen_49dce543be61dc96_base (BG.toFFIType x0) (BG.toFFIType x1)
+
+{-| Report that an error has occurred while executing the scalar function.
+
+    history:
+
+    * stable: v1.1.0
+
+    [__@info@__]: The info object.
+
+    [__@error@__]: The error message
+
+    __Returns:__ void
+
+    __C declaration:__ @duckdb_scalar_function_set_error@
+
+    __defined at:__ @duckdb.h 7401:19@
+
+    __exported by:__ @duckdb.h@
+-}
+c_duckdb_scalar_function_set_error ::
+     DuckDBFunctionInfo
+     {- ^
+
+          [__@info@__]: The info object.
+
+          __C declaration:__ @info@
+     -}
+  -> PtrConst.PtrConst BG.CChar
+     {- ^
+
+          [__@error@__]: The error message
+
+          __C declaration:__ @error@
+     -}
+  -> IO ()
+c_duckdb_scalar_function_set_error =
+  hs_bindgen_49dce543be61dc96
+
+-- __unique:__ @Database_DuckDB_FFI_Database.DuckDB.FFI_Safe_duckdb_create_scalar_function_set@
+foreign import ccall safe "hs_bindgen_ac865eab110e40bc" hs_bindgen_ac865eab110e40bc_base ::
+     BG.Ptr BG.Void
+  -> IO (BG.Ptr BG.Void)
+
+-- __unique:__ @Database_DuckDB_FFI_Database.DuckDB.FFI_Safe_duckdb_create_scalar_function_set@
+hs_bindgen_ac865eab110e40bc ::
+     PtrConst.PtrConst BG.CChar
+  -> IO DuckDBScalarFunctionSet
+hs_bindgen_ac865eab110e40bc =
+  \x0 ->
+    fmap BG.fromFFIType (hs_bindgen_ac865eab110e40bc_base (BG.toFFIType x0))
+
+{-| Creates a new empty scalar function set.
+
+    The return value must be destroyed with @'c_duckdb_destroy_scalar_function_set'@ .
+
+    history:
+
+    * stable: v1.1.0
+
+    [__@name@__]:
+
+    __Returns:__ t'DuckDBScalarFunctionSet'
+
+    __C declaration:__ @duckdb_create_scalar_function_set@
+
+    __defined at:__ @duckdb.h 7416:41@
+
+    __exported by:__ @duckdb.h@
+-}
+c_duckdb_create_scalar_function_set ::
+     PtrConst.PtrConst BG.CChar
+     {- ^
+
+          [__@name@__]:
+
+          __C declaration:__ @name@
+     -}
+  -> IO DuckDBScalarFunctionSet
+c_duckdb_create_scalar_function_set =
+  hs_bindgen_ac865eab110e40bc
+
+-- __unique:__ @Database_DuckDB_FFI_Database.DuckDB.FFI_Safe_duckdb_destroy_scalar_function_set@
+foreign import ccall safe "hs_bindgen_967e6425d22f5053" hs_bindgen_967e6425d22f5053_base ::
+     BG.Ptr BG.Void
+  -> IO ()
+
+-- __unique:__ @Database_DuckDB_FFI_Database.DuckDB.FFI_Safe_duckdb_destroy_scalar_function_set@
+hs_bindgen_967e6425d22f5053 ::
+     BG.Ptr DuckDBScalarFunctionSet
+  -> IO ()
+hs_bindgen_967e6425d22f5053 =
+  \x0 ->
+    hs_bindgen_967e6425d22f5053_base (BG.toFFIType x0)
+
+{-| Destroys the given scalar function set object.
+
+    history:
+
+    * stable: v1.1.0
+
+    [__@scalar_function_set@__]:
+
+    __Returns:__ void
+
+    __C declaration:__ @duckdb_destroy_scalar_function_set@
+
+    __defined at:__ @duckdb.h 7429:19@
+
+    __exported by:__ @duckdb.h@
+-}
+c_duckdb_destroy_scalar_function_set ::
+     BG.Ptr DuckDBScalarFunctionSet
+     {- ^
+
+          [__@scalar_function_set@__]:
+
+          __C declaration:__ @scalar_function_set@
+     -}
+  -> IO ()
+c_duckdb_destroy_scalar_function_set =
+  hs_bindgen_967e6425d22f5053
+
+-- __unique:__ @Database_DuckDB_FFI_Database.DuckDB.FFI_Safe_duckdb_add_scalar_function_to_set@
+foreign import ccall safe "hs_bindgen_4de507eae58d6975" hs_bindgen_4de507eae58d6975_base ::
+     BG.Ptr BG.Void
+  -> BG.Ptr BG.Void
+  -> IO BG.CUInt
+
+-- __unique:__ @Database_DuckDB_FFI_Database.DuckDB.FFI_Safe_duckdb_add_scalar_function_to_set@
+hs_bindgen_4de507eae58d6975 ::
+     DuckDBScalarFunctionSet
+  -> DuckDBScalarFunction
+  -> IO DuckDBState
+hs_bindgen_4de507eae58d6975 =
+  \x0 ->
+    \x1 ->
+      fmap BG.fromFFIType (hs_bindgen_4de507eae58d6975_base (BG.toFFIType x0) (BG.toFFIType x1))
+
+{-| Adds the scalar function as a new overload to the scalar function set.
+
+    Returns DuckDBError if the function could not be added, for example if the overload already exists.
+
+    history:
+
+    * stable: v1.1.0
+
+    [__@set@__]: The scalar function set
+
+    [__@function@__]: The function to add
+
+    __Returns:__ t'DuckDBState'
+
+    __C declaration:__ @duckdb_add_scalar_function_to_set@
+
+    __defined at:__ @duckdb.h 7445:27@
+
+    __exported by:__ @duckdb.h@
+-}
+c_duckdb_add_scalar_function_to_set ::
+     DuckDBScalarFunctionSet
+     {- ^
+
+          [__@set@__]: The scalar function set
+
+          __C declaration:__ @set@
+     -}
+  -> DuckDBScalarFunction
+     {- ^
+
+          [__@function@__]: The function to add
+
+          __C declaration:__ @function@
+     -}
+  -> IO DuckDBState
+c_duckdb_add_scalar_function_to_set =
+  hs_bindgen_4de507eae58d6975
+
+-- __unique:__ @Database_DuckDB_FFI_Database.DuckDB.FFI_Safe_duckdb_register_scalar_function_set@
+foreign import ccall safe "hs_bindgen_e4e7795c0415ab7b" hs_bindgen_e4e7795c0415ab7b_base ::
+     BG.Ptr BG.Void
+  -> BG.Ptr BG.Void
+  -> IO BG.CUInt
+
+-- __unique:__ @Database_DuckDB_FFI_Database.DuckDB.FFI_Safe_duckdb_register_scalar_function_set@
+hs_bindgen_e4e7795c0415ab7b ::
+     DuckDBConnection
+  -> DuckDBScalarFunctionSet
+  -> IO DuckDBState
+hs_bindgen_e4e7795c0415ab7b =
+  \x0 ->
+    \x1 ->
+      fmap BG.fromFFIType (hs_bindgen_e4e7795c0415ab7b_base (BG.toFFIType x0) (BG.toFFIType x1))
+
+{-| Register the scalar function set within the given connection.
+
+    The set requires at least a single valid overload.
+
+    If the set is incomplete or a function with this name already exists DuckDBError is returned.
+
+    history:
+
+    * stable: v1.1.0
+
+    [__@con@__]: The connection to register it in.
+
+    [__@set@__]: The function set to register
+
+    __Returns:__ t'DuckDBState'
+
+    __C declaration:__ @duckdb_register_scalar_function_set@
+
+    __defined at:__ @duckdb.h 7464:27@
+
+    __exported by:__ @duckdb.h@
+-}
+c_duckdb_register_scalar_function_set ::
+     DuckDBConnection
+     {- ^
+
+          [__@con@__]: The connection to register it in.
+
+          __C declaration:__ @con@
+     -}
+  -> DuckDBScalarFunctionSet
+     {- ^
+
+          [__@set@__]: The function set to register
+
+          __C declaration:__ @set@
+     -}
+  -> IO DuckDBState
+c_duckdb_register_scalar_function_set =
+  hs_bindgen_e4e7795c0415ab7b
+
+-- __unique:__ @Database_DuckDB_FFI_Database.DuckDB.FFI_Safe_duckdb_scalar_function_bind_get_argument_count@
+foreign import ccall safe "hs_bindgen_63b454129d89f75f" hs_bindgen_63b454129d89f75f_base ::
+     BG.Ptr BG.Void
+  -> IO HsBindgen.Runtime.LibC.Word64
+
+-- __unique:__ @Database_DuckDB_FFI_Database.DuckDB.FFI_Safe_duckdb_scalar_function_bind_get_argument_count@
+hs_bindgen_63b454129d89f75f ::
+     DuckDBBindInfo
+  -> IO DuckDBIdx
+hs_bindgen_63b454129d89f75f =
+  \x0 ->
+    fmap BG.fromFFIType (hs_bindgen_63b454129d89f75f_base (BG.toFFIType x0))
+
+{-| Returns the number of input arguments of the scalar function.
+
+    history:
+
+    * unstable: v1.4.0
+
+    * stable: v1.5.6
+
+    [__@info@__]: The bind info.
+
+    __Returns:__ t'DuckDBIdx'
+
+    __C declaration:__ @duckdb_scalar_function_bind_get_argument_count@
+
+    __defined at:__ @duckdb.h 7478:20@
+
+    __exported by:__ @duckdb.h@
+-}
+c_duckdb_scalar_function_bind_get_argument_count ::
+     DuckDBBindInfo
+     {- ^
+
+          [__@info@__]: The bind info.
+
+          __C declaration:__ @info@
+     -}
+  -> IO DuckDBIdx
+c_duckdb_scalar_function_bind_get_argument_count =
+  hs_bindgen_63b454129d89f75f
+
+-- __unique:__ @Database_DuckDB_FFI_Database.DuckDB.FFI_Safe_duckdb_scalar_function_bind_get_argument@
+foreign import ccall safe "hs_bindgen_5f7dc58f348f5029" hs_bindgen_5f7dc58f348f5029_base ::
+     BG.Ptr BG.Void
+  -> HsBindgen.Runtime.LibC.Word64
+  -> IO (BG.Ptr BG.Void)
+
+-- __unique:__ @Database_DuckDB_FFI_Database.DuckDB.FFI_Safe_duckdb_scalar_function_bind_get_argument@
+hs_bindgen_5f7dc58f348f5029 ::
+     DuckDBBindInfo
+  -> DuckDBIdx
+  -> IO DuckDBExpression
+hs_bindgen_5f7dc58f348f5029 =
+  \x0 ->
+    \x1 ->
+      fmap BG.fromFFIType (hs_bindgen_5f7dc58f348f5029_base (BG.toFFIType x0) (BG.toFFIType x1))
+
+{-| Returns the input argument at index of the scalar function.
+
+    history:
+
+    * unstable: v1.4.0
+
+    * stable: v1.5.6
+
+    [__@info@__]: The bind info.
+
+    [__@index@__]: The argument index.
+
+    __Returns:__ t'DuckDBExpression'
+
+    __C declaration:__ @duckdb_scalar_function_bind_get_argument@
+
+    __defined at:__ @duckdb.h 7493:32@
+
+    __exported by:__ @duckdb.h@
+-}
+c_duckdb_scalar_function_bind_get_argument ::
+     DuckDBBindInfo
+     {- ^
+
+          [__@info@__]: The bind info.
+
+          __C declaration:__ @info@
+     -}
+  -> DuckDBIdx
+     {- ^
+
+          [__@index@__]: The argument index.
+
+          __C declaration:__ @index@
+     -}
+  -> IO DuckDBExpression
+c_duckdb_scalar_function_bind_get_argument =
+  hs_bindgen_5f7dc58f348f5029
+
+-- __unique:__ @Database_DuckDB_FFI_Database.DuckDB.FFI_Safe_duckdb_scalar_function_get_state@
+foreign import ccall safe "hs_bindgen_c9951a19c1a8f16b" hs_bindgen_c9951a19c1a8f16b_base ::
+     BG.Ptr BG.Void
+  -> IO (BG.Ptr BG.Void)
+
+-- __unique:__ @Database_DuckDB_FFI_Database.DuckDB.FFI_Safe_duckdb_scalar_function_get_state@
+hs_bindgen_c9951a19c1a8f16b ::
+     DuckDBFunctionInfo
+  -> IO (BG.Ptr BG.Void)
+hs_bindgen_c9951a19c1a8f16b =
+  \x0 ->
+    fmap BG.fromFFIType (hs_bindgen_c9951a19c1a8f16b_base (BG.toFFIType x0))
+
+{-| Retrieves the state pointer of the function info.
+
+    history:
+
+    * unstable: v1.5.0
+
+    * stable: v1.5.6
+
+    [__@info@__]: The function info object.
+
+    __Returns:__ void*
+
+    __C declaration:__ @duckdb_scalar_function_get_state@
+
+    __defined at:__ @duckdb.h 7507:20@
+
+    __exported by:__ @duckdb.h@
+-}
+c_duckdb_scalar_function_get_state ::
+     DuckDBFunctionInfo
+     {- ^
+
+          [__@info@__]: The function info object.
+
+          __C declaration:__ @info@
+     -}
+  -> IO (BG.Ptr BG.Void)
+c_duckdb_scalar_function_get_state =
+  hs_bindgen_c9951a19c1a8f16b
+
+-- __unique:__ @Database_DuckDB_FFI_Database.DuckDB.FFI_Safe_duckdb_scalar_function_set_init@
+foreign import ccall safe "hs_bindgen_ac222a01dd370217" hs_bindgen_ac222a01dd370217_base ::
+     BG.Ptr BG.Void
+  -> BG.FunPtr BG.Void
+  -> IO ()
+
+-- __unique:__ @Database_DuckDB_FFI_Database.DuckDB.FFI_Safe_duckdb_scalar_function_set_init@
+hs_bindgen_ac222a01dd370217 ::
+     DuckDBScalarFunction
+  -> DuckDBScalarFunctionInitFun
+  -> IO ()
+hs_bindgen_ac222a01dd370217 =
+  \x0 ->
+    \x1 ->
+      hs_bindgen_ac222a01dd370217_base (BG.toFFIType x0) (BG.toFFIType x1)
+
+{-| Sets the (optional) state init function of the scalar function. This is called once for each worker thread that begins executing the function
+
+    history:
+
+    * unstable: v1.5.0
+
+    * stable: v1.5.6
+
+    [__@scalar_function@__]: The scalar function.
+
+    [__@init@__]: The init function.
+
+    __Returns:__ void
+
+    __C declaration:__ @duckdb_scalar_function_set_init@
+
+    __defined at:__ @duckdb.h 7523:19@
+
+    __exported by:__ @duckdb.h@
+-}
+c_duckdb_scalar_function_set_init ::
+     DuckDBScalarFunction
+     {- ^
+
+          [__@scalar_function@__]: The scalar function.
+
+          __C declaration:__ @scalar_function@
+     -}
+  -> DuckDBScalarFunctionInitFun
+     {- ^
+
+          [__@init@__]: The init function.
+
+          __C declaration:__ @init@
+     -}
+  -> IO ()
+c_duckdb_scalar_function_set_init =
+  hs_bindgen_ac222a01dd370217
+
+-- __unique:__ @Database_DuckDB_FFI_Database.DuckDB.FFI_Safe_duckdb_scalar_function_init_set_error@
+foreign import ccall safe "hs_bindgen_53b7cee299a379f8" hs_bindgen_53b7cee299a379f8_base ::
+     BG.Ptr BG.Void
+  -> BG.Ptr BG.Void
+  -> IO ()
+
+-- __unique:__ @Database_DuckDB_FFI_Database.DuckDB.FFI_Safe_duckdb_scalar_function_init_set_error@
+hs_bindgen_53b7cee299a379f8 ::
+     DuckDBInitInfo
+  -> PtrConst.PtrConst BG.CChar
+  -> IO ()
+hs_bindgen_53b7cee299a379f8 =
+  \x0 ->
+    \x1 ->
+      hs_bindgen_53b7cee299a379f8_base (BG.toFFIType x0) (BG.toFFIType x1)
+
+{-| Report that an error has occurred while calling init on a scalar function.
+
+    history:
+
+    * unstable: v1.5.0
+
+    * stable: v1.5.6
+
+    [__@info@__]: The init info object.
+
+    [__@error@__]: The error message.
+
+    __Returns:__ void
+
+    __C declaration:__ @duckdb_scalar_function_init_set_error@
+
+    __defined at:__ @duckdb.h 7539:19@
+
+    __exported by:__ @duckdb.h@
+-}
+c_duckdb_scalar_function_init_set_error ::
+     DuckDBInitInfo
+     {- ^
+
+          [__@info@__]: The init info object.
+
+          __C declaration:__ @info@
+     -}
+  -> PtrConst.PtrConst BG.CChar
+     {- ^
+
+          [__@error@__]: The error message.
+
+          __C declaration:__ @error@
+     -}
+  -> IO ()
+c_duckdb_scalar_function_init_set_error =
+  hs_bindgen_53b7cee299a379f8
+
+-- __unique:__ @Database_DuckDB_FFI_Database.DuckDB.FFI_Safe_duckdb_scalar_function_init_set_state@
+foreign import ccall safe "hs_bindgen_064ca7da09a75b71" hs_bindgen_064ca7da09a75b71_base ::
+     BG.Ptr BG.Void
+  -> BG.Ptr BG.Void
+  -> BG.FunPtr BG.Void
+  -> IO ()
+
+-- __unique:__ @Database_DuckDB_FFI_Database.DuckDB.FFI_Safe_duckdb_scalar_function_init_set_state@
+hs_bindgen_064ca7da09a75b71 ::
+     DuckDBInitInfo
+  -> BG.Ptr BG.Void
+  -> DuckDBDeleteCallback
+  -> IO ()
+hs_bindgen_064ca7da09a75b71 =
+  \x0 ->
+    \x1 ->
+      \x2 ->
+        hs_bindgen_064ca7da09a75b71_base (BG.toFFIType x0) (BG.toFFIType x1) (BG.toFFIType x2)
+
+{-| Sets the state pointer in the init info of the scalar function.
+
+    history:
+
+    * unstable: v1.5.0
+
+    * stable: v1.5.6
+
+    [__@info@__]: The init info object.
+
+    [__@state@__]: The state pointer.
+
+    [__@destroy@__]: The callback to destroy the state (if any).
+
+    __Returns:__ void
+
+    __C declaration:__ @duckdb_scalar_function_init_set_state@
+
+    __defined at:__ @duckdb.h 7555:19@
+
+    __exported by:__ @duckdb.h@
+-}
+c_duckdb_scalar_function_init_set_state ::
+     DuckDBInitInfo
+     {- ^
+
+          [__@info@__]: The init info object.
+
+          __C declaration:__ @info@
+     -}
+  -> BG.Ptr BG.Void
+     {- ^
+
+          [__@state@__]: The state pointer.
+
+          __C declaration:__ @state@
+     -}
+  -> DuckDBDeleteCallback
+     {- ^
+
+          [__@destroy@__]: The callback to destroy the state (if any).
+
+          __C declaration:__ @destroy@
+     -}
+  -> IO ()
+c_duckdb_scalar_function_init_set_state =
+  hs_bindgen_064ca7da09a75b71
+
+-- __unique:__ @Database_DuckDB_FFI_Database.DuckDB.FFI_Safe_duckdb_scalar_function_init_get_client_context@
+foreign import ccall safe "hs_bindgen_cc7cfdf590abe6a3" hs_bindgen_cc7cfdf590abe6a3_base ::
+     BG.Ptr BG.Void
+  -> BG.Ptr BG.Void
+  -> IO ()
+
+-- __unique:__ @Database_DuckDB_FFI_Database.DuckDB.FFI_Safe_duckdb_scalar_function_init_get_client_context@
+hs_bindgen_cc7cfdf590abe6a3 ::
+     DuckDBInitInfo
+  -> BG.Ptr DuckDBClientContext
+  -> IO ()
+hs_bindgen_cc7cfdf590abe6a3 =
+  \x0 ->
+    \x1 ->
+      hs_bindgen_cc7cfdf590abe6a3_base (BG.toFFIType x0) (BG.toFFIType x1)
+
+{-| Retrieves the client context of the init info of a scalar function.
+
+    history:
+
+    * unstable: v1.5.0
+
+    * stable: v1.5.6
+
+    [__@info@__]: The init info object of the scalar function.
+
+    [__@out_context@__]: The client context of the init info. Must be destroyed with @'c_duckdb_destroy_client_context'@ .
+
+    __Returns:__ void
+
+    __C declaration:__ @duckdb_scalar_function_init_get_client_context@
+
+    __defined at:__ @duckdb.h 7571:19@
+
+    __exported by:__ @duckdb.h@
+-}
+c_duckdb_scalar_function_init_get_client_context ::
+     DuckDBInitInfo
+     {- ^
+
+          [__@info@__]: The init info object of the scalar function.
+
+          __C declaration:__ @info@
+     -}
+  -> BG.Ptr DuckDBClientContext
+     {- ^
+
+          [__@out_context@__]: The client context of the init info. Must be destroyed with @'c_duckdb_destroy_client_context'@ .
+
+          __C declaration:__ @out_context@
+     -}
+  -> IO ()
+c_duckdb_scalar_function_init_get_client_context =
+  hs_bindgen_cc7cfdf590abe6a3
+
+-- __unique:__ @Database_DuckDB_FFI_Database.DuckDB.FFI_Safe_duckdb_scalar_function_init_get_bind_data@
+foreign import ccall safe "hs_bindgen_9b7c5e40eb1be92f" hs_bindgen_9b7c5e40eb1be92f_base ::
+     BG.Ptr BG.Void
+  -> IO (BG.Ptr BG.Void)
+
+-- __unique:__ @Database_DuckDB_FFI_Database.DuckDB.FFI_Safe_duckdb_scalar_function_init_get_bind_data@
+hs_bindgen_9b7c5e40eb1be92f ::
+     DuckDBInitInfo
+  -> IO (BG.Ptr BG.Void)
+hs_bindgen_9b7c5e40eb1be92f =
+  \x0 ->
+    fmap BG.fromFFIType (hs_bindgen_9b7c5e40eb1be92f_base (BG.toFFIType x0))
+
+{-| Gets the scalar function\'s bind data set by @'c_duckdb_scalar_function_set_bind_data'@ . Note that the bind data is read-only.
+
+    history:
+
+    * unstable: v1.5.0
+
+    * stable: v1.5.6
+
+    [__@info@__]: The init info object.
+
+    __Returns:__ void*
+
+    __C declaration:__ @duckdb_scalar_function_init_get_bind_data@
+
+    __defined at:__ @duckdb.h 7587:20@
+
+    __exported by:__ @duckdb.h@
+-}
+c_duckdb_scalar_function_init_get_bind_data ::
+     DuckDBInitInfo
+     {- ^
+
+          [__@info@__]: The init info object.
+
+          __C declaration:__ @info@
+     -}
+  -> IO (BG.Ptr BG.Void)
+c_duckdb_scalar_function_init_get_bind_data =
+  hs_bindgen_9b7c5e40eb1be92f
+
+-- __unique:__ @Database_DuckDB_FFI_Database.DuckDB.FFI_Safe_duckdb_scalar_function_init_get_extra_info@
+foreign import ccall safe "hs_bindgen_c88ef758b0fa7ab3" hs_bindgen_c88ef758b0fa7ab3_base ::
+     BG.Ptr BG.Void
+  -> IO (BG.Ptr BG.Void)
+
+-- __unique:__ @Database_DuckDB_FFI_Database.DuckDB.FFI_Safe_duckdb_scalar_function_init_get_extra_info@
+hs_bindgen_c88ef758b0fa7ab3 ::
+     DuckDBInitInfo
+  -> IO (BG.Ptr BG.Void)
+hs_bindgen_c88ef758b0fa7ab3 =
+  \x0 ->
+    fmap BG.fromFFIType (hs_bindgen_c88ef758b0fa7ab3_base (BG.toFFIType x0))
+
+{-| Retrieves the extra info of the function as set in the init info.
+
+    history:
+
+    * unstable: v1.5.0
+
+    * stable: v1.5.6
+
+    [__@info@__]: The init info object.
+
+    __Returns:__ void*
+
+    __C declaration:__ @duckdb_scalar_function_init_get_extra_info@
+
+    __defined at:__ @duckdb.h 7601:20@
+
+    __exported by:__ @duckdb.h@
+-}
+c_duckdb_scalar_function_init_get_extra_info ::
+     DuckDBInitInfo
+     {- ^
+
+          [__@info@__]: The init info object.
+
+          __C declaration:__ @info@
+     -}
+  -> IO (BG.Ptr BG.Void)
+c_duckdb_scalar_function_init_get_extra_info =
+  hs_bindgen_c88ef758b0fa7ab3
+
+-- __unique:__ @Database_DuckDB_FFI_Database.DuckDB.FFI_Safe_duckdb_table_description_create@
+foreign import ccall safe "hs_bindgen_0fc4104d01034d1a" hs_bindgen_0fc4104d01034d1a_base ::
+     BG.Ptr BG.Void
+  -> BG.Ptr BG.Void
+  -> BG.Ptr BG.Void
+  -> BG.Ptr BG.Void
+  -> IO BG.CUInt
+
+-- __unique:__ @Database_DuckDB_FFI_Database.DuckDB.FFI_Safe_duckdb_table_description_create@
+hs_bindgen_0fc4104d01034d1a ::
+     DuckDBConnection
+  -> PtrConst.PtrConst BG.CChar
+  -> PtrConst.PtrConst BG.CChar
+  -> BG.Ptr DuckDBTableDescription
+  -> IO DuckDBState
+hs_bindgen_0fc4104d01034d1a =
+  \x0 ->
+    \x1 ->
+      \x2 ->
+        \x3 ->
+          fmap BG.fromFFIType (hs_bindgen_0fc4104d01034d1a_base (BG.toFFIType x0) (BG.toFFIType x1) (BG.toFFIType x2) (BG.toFFIType x3))
+
+{-| Creates a table description object. Note that @'c_duckdb_table_description_destroy'@ should always be called on the resulting table_description, even if the function returns @@DuckDBError@@ .
+
+    history:
+
+    * stable: v1.1.0
+
+    [__@connection@__]: The connection context.
+
+    [__@schema@__]: The schema of the table, or @nullptr@ for the default schema.
+
+    [__@table@__]: The table name.
+
+    [__@out@__]: The resulting table description object.
+
+    __Returns:__ t'DuckDBState'
+
+    __C declaration:__ @duckdb_table_description_create@
+
+    __defined at:__ @duckdb.h 7636:27@
+
+    __exported by:__ @duckdb.h@
+-}
+c_duckdb_table_description_create ::
+     DuckDBConnection
+     {- ^
+
+          [__@connection@__]: The connection context.
+
+          __C declaration:__ @connection@
+     -}
+  -> PtrConst.PtrConst BG.CChar
+     {- ^
+
+          [__@schema@__]: The schema of the table, or @nullptr@ for the default schema.
+
+          __C declaration:__ @schema@
+     -}
+  -> PtrConst.PtrConst BG.CChar
+     {- ^
+
+          [__@table@__]: The table name.
+
+          __C declaration:__ @table@
+     -}
+  -> BG.Ptr DuckDBTableDescription
+     {- ^
+
+          [__@out@__]: The resulting table description object.
+
+          __C declaration:__ @out@
+     -}
+  -> IO DuckDBState
+c_duckdb_table_description_create =
+  hs_bindgen_0fc4104d01034d1a
+
+-- __unique:__ @Database_DuckDB_FFI_Database.DuckDB.FFI_Safe_duckdb_table_description_create_ext@
+foreign import ccall safe "hs_bindgen_82a0c6b485d97488" hs_bindgen_82a0c6b485d97488_base ::
+     BG.Ptr BG.Void
+  -> BG.Ptr BG.Void
+  -> BG.Ptr BG.Void
+  -> BG.Ptr BG.Void
+  -> BG.Ptr BG.Void
+  -> IO BG.CUInt
+
+-- __unique:__ @Database_DuckDB_FFI_Database.DuckDB.FFI_Safe_duckdb_table_description_create_ext@
+hs_bindgen_82a0c6b485d97488 ::
+     DuckDBConnection
+  -> PtrConst.PtrConst BG.CChar
+  -> PtrConst.PtrConst BG.CChar
+  -> PtrConst.PtrConst BG.CChar
+  -> BG.Ptr DuckDBTableDescription
+  -> IO DuckDBState
+hs_bindgen_82a0c6b485d97488 =
+  \x0 ->
+    \x1 ->
+      \x2 ->
+        \x3 ->
+          \x4 ->
+            fmap BG.fromFFIType (hs_bindgen_82a0c6b485d97488_base (BG.toFFIType x0) (BG.toFFIType x1) (BG.toFFIType x2) (BG.toFFIType x3) (BG.toFFIType x4))
+
+{-| Creates a table description object. Note that @'c_duckdb_table_description_destroy'@ must be called on the resulting table_description, even if the function returns @@DuckDBError@@ .
+
+    history:
+
+    * stable: v1.2.0
+
+    [__@connection@__]: The connection context.
+
+    [__@catalog@__]: The catalog (database) name of the table, or @nullptr@ for the default catalog.
+
+    [__@schema@__]: The schema of the table, or @nullptr@ for the default schema.
+
+    [__@table@__]: The table name.
+
+    [__@out@__]: The resulting table description object.
+
+    __Returns:__ t'DuckDBState'
+
+    __C declaration:__ @duckdb_table_description_create_ext@
+
+    __defined at:__ @duckdb.h 7655:27@
+
+    __exported by:__ @duckdb.h@
+-}
+c_duckdb_table_description_create_ext ::
+     DuckDBConnection
+     {- ^
+
+          [__@connection@__]: The connection context.
+
+          __C declaration:__ @connection@
+     -}
+  -> PtrConst.PtrConst BG.CChar
+     {- ^
+
+          [__@catalog@__]: The catalog (database) name of the table, or @nullptr@ for the default catalog.
+
+          __C declaration:__ @catalog@
+     -}
+  -> PtrConst.PtrConst BG.CChar
+     {- ^
+
+          [__@schema@__]: The schema of the table, or @nullptr@ for the default schema.
+
+          __C declaration:__ @schema@
+     -}
+  -> PtrConst.PtrConst BG.CChar
+     {- ^
+
+          [__@table@__]: The table name.
+
+          __C declaration:__ @table@
+     -}
+  -> BG.Ptr DuckDBTableDescription
+     {- ^
+
+          [__@out@__]: The resulting table description object.
+
+          __C declaration:__ @out@
+     -}
+  -> IO DuckDBState
+c_duckdb_table_description_create_ext =
+  hs_bindgen_82a0c6b485d97488
+
+-- __unique:__ @Database_DuckDB_FFI_Database.DuckDB.FFI_Safe_duckdb_table_description_destroy@
+foreign import ccall safe "hs_bindgen_84b027cfbe2f4401" hs_bindgen_84b027cfbe2f4401_base ::
+     BG.Ptr BG.Void
+  -> IO ()
+
+-- __unique:__ @Database_DuckDB_FFI_Database.DuckDB.FFI_Safe_duckdb_table_description_destroy@
+hs_bindgen_84b027cfbe2f4401 ::
+     BG.Ptr DuckDBTableDescription
+  -> IO ()
+hs_bindgen_84b027cfbe2f4401 =
+  \x0 ->
+    hs_bindgen_84b027cfbe2f4401_base (BG.toFFIType x0)
+
+{-| Destroy the TableDescription object.
+
+    history:
+
+    * stable: v1.1.0
+
+    [__@table_description@__]: The table_description to destroy.
+
+    __Returns:__ void
+
+    __C declaration:__ @duckdb_table_description_destroy@
+
+    __defined at:__ @duckdb.h 7670:19@
+
+    __exported by:__ @duckdb.h@
+-}
+c_duckdb_table_description_destroy ::
+     BG.Ptr DuckDBTableDescription
+     {- ^
+
+          [__@table_description@__]: The table_description to destroy.
+
+          __C declaration:__ @table_description@
+     -}
+  -> IO ()
+c_duckdb_table_description_destroy =
+  hs_bindgen_84b027cfbe2f4401
+
+-- __unique:__ @Database_DuckDB_FFI_Database.DuckDB.FFI_Safe_duckdb_table_description_error@
+foreign import ccall safe "hs_bindgen_6ac61bf6b8c77c47" hs_bindgen_6ac61bf6b8c77c47_base ::
+     BG.Ptr BG.Void
+  -> IO (BG.Ptr BG.Void)
+
+-- __unique:__ @Database_DuckDB_FFI_Database.DuckDB.FFI_Safe_duckdb_table_description_error@
+hs_bindgen_6ac61bf6b8c77c47 ::
+     DuckDBTableDescription
+  -> IO (PtrConst.PtrConst BG.CChar)
+hs_bindgen_6ac61bf6b8c77c47 =
+  \x0 ->
+    fmap BG.fromFFIType (hs_bindgen_6ac61bf6b8c77c47_base (BG.toFFIType x0))
+
+{-| Returns the error message associated with the given table_description. If the table_description has no error message, this returns @nullptr@ instead. The error message should not be freed. It will be de-allocated when @'c_duckdb_table_description_destroy'@ is called.
+
+    history:
+
+    * stable: v1.1.0
+
+    [__@table_description@__]: The table_description to get the error from.
+
+    __Returns:__ const char*
+
+    __C declaration:__ @duckdb_table_description_error@
+
+    __defined at:__ @duckdb.h 7685:26@
+
+    __exported by:__ @duckdb.h@
+-}
+c_duckdb_table_description_error ::
+     DuckDBTableDescription
+     {- ^
+
+          [__@table_description@__]: The table_description to get the error from.
+
+          __C declaration:__ @table_description@
+     -}
+  -> IO (PtrConst.PtrConst BG.CChar)
+c_duckdb_table_description_error =
+  hs_bindgen_6ac61bf6b8c77c47
+
+-- __unique:__ @Database_DuckDB_FFI_Database.DuckDB.FFI_Safe_duckdb_column_has_default@
+foreign import ccall safe "hs_bindgen_4d7369d3b81bfd4c" hs_bindgen_4d7369d3b81bfd4c_base ::
+     BG.Ptr BG.Void
+  -> HsBindgen.Runtime.LibC.Word64
+  -> BG.Ptr BG.Void
+  -> IO BG.CUInt
+
+-- __unique:__ @Database_DuckDB_FFI_Database.DuckDB.FFI_Safe_duckdb_column_has_default@
+hs_bindgen_4d7369d3b81bfd4c ::
+     DuckDBTableDescription
+  -> DuckDBIdx
+  -> BG.Ptr BG.CBool
+  -> IO DuckDBState
+hs_bindgen_4d7369d3b81bfd4c =
+  \x0 ->
+    \x1 ->
+      \x2 ->
+        fmap BG.fromFFIType (hs_bindgen_4d7369d3b81bfd4c_base (BG.toFFIType x0) (BG.toFFIType x1) (BG.toFFIType x2))
+
+{-| Check if the column at \'index\' index of the table has a DEFAULT expression.
+
+    history:
+
+    * stable: v1.1.0
+
+    [__@table_description@__]: The table_description to query.
+
+    [__@index@__]: The index of the column to query.
+
+    [__@out@__]: The out-parameter used to store the result.
+
+    __Returns:__ t'DuckDBState'
+
+    __C declaration:__ @duckdb_column_has_default@
+
+    __defined at:__ @duckdb.h 7700:27@
+
+    __exported by:__ @duckdb.h@
+-}
+c_duckdb_column_has_default ::
+     DuckDBTableDescription
+     {- ^
+
+          [__@table_description@__]: The table_description to query.
+
+          __C declaration:__ @table_description@
+     -}
+  -> DuckDBIdx
+     {- ^
+
+          [__@index@__]: The index of the column to query.
+
+          __C declaration:__ @index@
+     -}
+  -> BG.Ptr BG.CBool
+     {- ^
+
+          [__@out@__]: The out-parameter used to store the result.
+
+          __C declaration:__ @out@
+     -}
+  -> IO DuckDBState
+c_duckdb_column_has_default =
+  hs_bindgen_4d7369d3b81bfd4c
+
+-- __unique:__ @Database_DuckDB_FFI_Database.DuckDB.FFI_Safe_duckdb_table_description_get_column_count@
+foreign import ccall safe "hs_bindgen_8f13db0d61fbb2eb" hs_bindgen_8f13db0d61fbb2eb_base ::
+     BG.Ptr BG.Void
+  -> IO HsBindgen.Runtime.LibC.Word64
+
+-- __unique:__ @Database_DuckDB_FFI_Database.DuckDB.FFI_Safe_duckdb_table_description_get_column_count@
+hs_bindgen_8f13db0d61fbb2eb ::
+     DuckDBTableDescription
+  -> IO DuckDBIdx
+hs_bindgen_8f13db0d61fbb2eb =
+  \x0 ->
+    fmap BG.fromFFIType (hs_bindgen_8f13db0d61fbb2eb_base (BG.toFFIType x0))
+
+{-| Return the number of columns of the described table.
+
+    history:
+
+    * unstable: v1.5.0
+
+    * stable: v1.5.6
+
+    [__@table_description@__]: The table_description to query.
+
+    __Returns:__ t'DuckDBIdx'
+
+    __C declaration:__ @duckdb_table_description_get_column_count@
+
+    __defined at:__ @duckdb.h 7714:20@
+
+    __exported by:__ @duckdb.h@
+-}
+c_duckdb_table_description_get_column_count ::
+     DuckDBTableDescription
+     {- ^
+
+          [__@table_description@__]: The table_description to query.
+
+          __C declaration:__ @table_description@
+     -}
+  -> IO DuckDBIdx
+c_duckdb_table_description_get_column_count =
+  hs_bindgen_8f13db0d61fbb2eb
+
+-- __unique:__ @Database_DuckDB_FFI_Database.DuckDB.FFI_Safe_duckdb_table_description_get_column_name@
+foreign import ccall safe "hs_bindgen_1bd765f144498ef7" hs_bindgen_1bd765f144498ef7_base ::
+     BG.Ptr BG.Void
+  -> HsBindgen.Runtime.LibC.Word64
+  -> IO (BG.Ptr BG.Void)
+
+-- __unique:__ @Database_DuckDB_FFI_Database.DuckDB.FFI_Safe_duckdb_table_description_get_column_name@
+hs_bindgen_1bd765f144498ef7 ::
+     DuckDBTableDescription
+  -> DuckDBIdx
+  -> IO (BG.Ptr BG.CChar)
+hs_bindgen_1bd765f144498ef7 =
+  \x0 ->
+    \x1 ->
+      fmap BG.fromFFIType (hs_bindgen_1bd765f144498ef7_base (BG.toFFIType x0) (BG.toFFIType x1))
+
+{-| Obtain the column name at \'index\'. The out result must be destroyed with @'c_duckdb_free'@ .
+
+    history:
+
+    * stable: v1.2.0
+
+    [__@table_description@__]: The table_description to query.
+
+    [__@index@__]: The index of the column to query.
+
+    __Returns:__ char*
+
+    __C declaration:__ @duckdb_table_description_get_column_name@
+
+    __defined at:__ @duckdb.h 7728:20@
+
+    __exported by:__ @duckdb.h@
+-}
+c_duckdb_table_description_get_column_name ::
+     DuckDBTableDescription
+     {- ^
+
+          [__@table_description@__]: The table_description to query.
+
+          __C declaration:__ @table_description@
+     -}
+  -> DuckDBIdx
+     {- ^
+
+          [__@index@__]: The index of the column to query.
+
+          __C declaration:__ @index@
+     -}
+  -> IO (BG.Ptr BG.CChar)
+c_duckdb_table_description_get_column_name =
+  hs_bindgen_1bd765f144498ef7
+
+-- __unique:__ @Database_DuckDB_FFI_Database.DuckDB.FFI_Safe_duckdb_table_description_get_column_type@
+foreign import ccall safe "hs_bindgen_1c6b54182f653add" hs_bindgen_1c6b54182f653add_base ::
+     BG.Ptr BG.Void
+  -> HsBindgen.Runtime.LibC.Word64
+  -> IO (BG.Ptr BG.Void)
+
+-- __unique:__ @Database_DuckDB_FFI_Database.DuckDB.FFI_Safe_duckdb_table_description_get_column_type@
+hs_bindgen_1c6b54182f653add ::
+     DuckDBTableDescription
+  -> DuckDBIdx
+  -> IO DuckDBLogicalType
+hs_bindgen_1c6b54182f653add =
+  \x0 ->
+    \x1 ->
+      fmap BG.fromFFIType (hs_bindgen_1c6b54182f653add_base (BG.toFFIType x0) (BG.toFFIType x1))
+
+{-| Obtain the column type at \'index\'. The return value must be destroyed with @'c_duckdb_destroy_logical_type'@ .
+
+    history:
+
+    * unstable: v1.5.0
+
+    * stable: v1.5.6
+
+    [__@table_description@__]: The table_description to query.
+
+    [__@index@__]: The index of the column to query.
+
+    __Returns:__ t'DuckDBLogicalType'
+
+    __C declaration:__ @duckdb_table_description_get_column_type@
+
+    __defined at:__ @duckdb.h 7743:34@
+
+    __exported by:__ @duckdb.h@
+-}
+c_duckdb_table_description_get_column_type ::
+     DuckDBTableDescription
+     {- ^
+
+          [__@table_description@__]: The table_description to query.
+
+          __C declaration:__ @table_description@
+     -}
+  -> DuckDBIdx
+     {- ^
+
+          [__@index@__]: The index of the column to query.
+
+          __C declaration:__ @index@
+     -}
+  -> IO DuckDBLogicalType
+c_duckdb_table_description_get_column_type =
+  hs_bindgen_1c6b54182f653add
+
+-- __unique:__ @Database_DuckDB_FFI_Database.DuckDB.FFI_Safe_duckdb_create_table_function@
+foreign import ccall safe "hs_bindgen_fc1c42be14fab1d7" hs_bindgen_fc1c42be14fab1d7_base ::
+     IO (BG.Ptr BG.Void)
+
+-- __unique:__ @Database_DuckDB_FFI_Database.DuckDB.FFI_Safe_duckdb_create_table_function@
+hs_bindgen_fc1c42be14fab1d7 :: IO DuckDBTableFunction
+hs_bindgen_fc1c42be14fab1d7 =
+  fmap BG.fromFFIType hs_bindgen_fc1c42be14fab1d7_base
+
+{-| Creates a new empty table function.
+
+    The return value should be destroyed with @'c_duckdb_destroy_table_function'@ .
+
+    history:
+
+    * stable: v0.3.3
+
+    __Returns:__ t'DuckDBTableFunction'
+
+    __C declaration:__ @duckdb_create_table_function@
+
+    __defined at:__ @duckdb.h 7776:36@
+
+    __exported by:__ @duckdb.h@
+-}
+c_duckdb_create_table_function :: IO DuckDBTableFunction
+c_duckdb_create_table_function =
+  hs_bindgen_fc1c42be14fab1d7
+
+-- __unique:__ @Database_DuckDB_FFI_Database.DuckDB.FFI_Safe_duckdb_destroy_table_function@
+foreign import ccall safe "hs_bindgen_9bbeca3e14750ffd" hs_bindgen_9bbeca3e14750ffd_base ::
+     BG.Ptr BG.Void
+  -> IO ()
+
+-- __unique:__ @Database_DuckDB_FFI_Database.DuckDB.FFI_Safe_duckdb_destroy_table_function@
+hs_bindgen_9bbeca3e14750ffd ::
+     BG.Ptr DuckDBTableFunction
+  -> IO ()
+hs_bindgen_9bbeca3e14750ffd =
+  \x0 ->
+    hs_bindgen_9bbeca3e14750ffd_base (BG.toFFIType x0)
+
+{-| Destroys the given table function object.
+
+    history:
+
+    * stable: v0.3.3
+
+    [__@table_function@__]: The table function to destroy
+
+    __Returns:__ void
+
+    __C declaration:__ @duckdb_destroy_table_function@
+
+    __defined at:__ @duckdb.h 7789:19@
+
+    __exported by:__ @duckdb.h@
+-}
+c_duckdb_destroy_table_function ::
+     BG.Ptr DuckDBTableFunction
+     {- ^
+
+          [__@table_function@__]: The table function to destroy
+
+          __C declaration:__ @table_function@
+     -}
+  -> IO ()
+c_duckdb_destroy_table_function =
+  hs_bindgen_9bbeca3e14750ffd
+
+-- __unique:__ @Database_DuckDB_FFI_Database.DuckDB.FFI_Safe_duckdb_table_function_set_name@
+foreign import ccall safe "hs_bindgen_fa60b5782b676b1b" hs_bindgen_fa60b5782b676b1b_base ::
+     BG.Ptr BG.Void
+  -> BG.Ptr BG.Void
+  -> IO ()
+
+-- __unique:__ @Database_DuckDB_FFI_Database.DuckDB.FFI_Safe_duckdb_table_function_set_name@
+hs_bindgen_fa60b5782b676b1b ::
+     DuckDBTableFunction
+  -> PtrConst.PtrConst BG.CChar
+  -> IO ()
+hs_bindgen_fa60b5782b676b1b =
+  \x0 ->
+    \x1 ->
+      hs_bindgen_fa60b5782b676b1b_base (BG.toFFIType x0) (BG.toFFIType x1)
+
+{-| Sets the name of the given table function.
+
+    history:
+
+    * stable: v0.3.3
+
+    [__@table_function@__]: The table function
+
+    [__@name@__]: The name of the table function
+
+    __Returns:__ void
+
+    __C declaration:__ @duckdb_table_function_set_name@
+
+    __defined at:__ @duckdb.h 7803:19@
+
+    __exported by:__ @duckdb.h@
+-}
+c_duckdb_table_function_set_name ::
+     DuckDBTableFunction
+     {- ^
+
+          [__@table_function@__]: The table function
+
+          __C declaration:__ @table_function@
+     -}
+  -> PtrConst.PtrConst BG.CChar
+     {- ^
+
+          [__@name@__]: The name of the table function
+
+          __C declaration:__ @name@
+     -}
+  -> IO ()
+c_duckdb_table_function_set_name =
+  hs_bindgen_fa60b5782b676b1b
+
+-- __unique:__ @Database_DuckDB_FFI_Database.DuckDB.FFI_Safe_duckdb_table_function_add_parameter@
+foreign import ccall safe "hs_bindgen_c2b43f04cbd5d423" hs_bindgen_c2b43f04cbd5d423_base ::
+     BG.Ptr BG.Void
+  -> BG.Ptr BG.Void
+  -> IO ()
+
+-- __unique:__ @Database_DuckDB_FFI_Database.DuckDB.FFI_Safe_duckdb_table_function_add_parameter@
+hs_bindgen_c2b43f04cbd5d423 ::
+     DuckDBTableFunction
+  -> DuckDBLogicalType
+  -> IO ()
+hs_bindgen_c2b43f04cbd5d423 =
+  \x0 ->
+    \x1 ->
+      hs_bindgen_c2b43f04cbd5d423_base (BG.toFFIType x0) (BG.toFFIType x1)
+
+{-| Adds a parameter to the table function.
+
+    history:
+
+    * stable: v0.3.3
+
+    [__@table_function@__]: The table function.
+
+    [__@type@__]: The parameter type. Cannot contain INVALID.
+
+    __Returns:__ void
+
+    __C declaration:__ @duckdb_table_function_add_parameter@
+
+    __defined at:__ @duckdb.h 7817:19@
+
+    __exported by:__ @duckdb.h@
+-}
+c_duckdb_table_function_add_parameter ::
+     DuckDBTableFunction
+     {- ^
+
+          [__@table_function@__]: The table function.
+
+          __C declaration:__ @table_function@
+     -}
+  -> DuckDBLogicalType
+     {- ^
+
+          [__@type@__]: The parameter type. Cannot contain INVALID.
+
+          __C declaration:__ @type@
+     -}
+  -> IO ()
+c_duckdb_table_function_add_parameter =
+  hs_bindgen_c2b43f04cbd5d423
+
+-- __unique:__ @Database_DuckDB_FFI_Database.DuckDB.FFI_Safe_duckdb_table_function_add_named_parameter@
+foreign import ccall safe "hs_bindgen_169c694648c6ccc1" hs_bindgen_169c694648c6ccc1_base ::
+     BG.Ptr BG.Void
+  -> BG.Ptr BG.Void
+  -> BG.Ptr BG.Void
+  -> IO ()
+
+-- __unique:__ @Database_DuckDB_FFI_Database.DuckDB.FFI_Safe_duckdb_table_function_add_named_parameter@
+hs_bindgen_169c694648c6ccc1 ::
+     DuckDBTableFunction
+  -> PtrConst.PtrConst BG.CChar
+  -> DuckDBLogicalType
+  -> IO ()
+hs_bindgen_169c694648c6ccc1 =
+  \x0 ->
+    \x1 ->
+      \x2 ->
+        hs_bindgen_169c694648c6ccc1_base (BG.toFFIType x0) (BG.toFFIType x1) (BG.toFFIType x2)
+
+{-| Adds a named parameter to the table function.
+
+    history:
+
+    * stable: v0.8.0
+
+    [__@table_function@__]: The table function.
+
+    [__@name@__]: The parameter name.
+
+    [__@type@__]: The parameter type. Cannot contain INVALID.
+
+    __Returns:__ void
+
+    __C declaration:__ @duckdb_table_function_add_named_parameter@
+
+    __defined at:__ @duckdb.h 7832:19@
+
+    __exported by:__ @duckdb.h@
+-}
+c_duckdb_table_function_add_named_parameter ::
+     DuckDBTableFunction
+     {- ^
+
+          [__@table_function@__]: The table function.
+
+          __C declaration:__ @table_function@
+     -}
+  -> PtrConst.PtrConst BG.CChar
+     {- ^
+
+          [__@name@__]: The parameter name.
+
+          __C declaration:__ @name@
+     -}
+  -> DuckDBLogicalType
+     {- ^
+
+          [__@type@__]: The parameter type. Cannot contain INVALID.
+
+          __C declaration:__ @type@
+     -}
+  -> IO ()
+c_duckdb_table_function_add_named_parameter =
+  hs_bindgen_169c694648c6ccc1
+
+-- __unique:__ @Database_DuckDB_FFI_Database.DuckDB.FFI_Safe_duckdb_table_function_set_extra_info@
+foreign import ccall safe "hs_bindgen_c980cb05cbc34a77" hs_bindgen_c980cb05cbc34a77_base ::
+     BG.Ptr BG.Void
+  -> BG.Ptr BG.Void
+  -> BG.FunPtr BG.Void
+  -> IO ()
+
+-- __unique:__ @Database_DuckDB_FFI_Database.DuckDB.FFI_Safe_duckdb_table_function_set_extra_info@
+hs_bindgen_c980cb05cbc34a77 ::
+     DuckDBTableFunction
+  -> BG.Ptr BG.Void
+  -> DuckDBDeleteCallback
+  -> IO ()
+hs_bindgen_c980cb05cbc34a77 =
+  \x0 ->
+    \x1 ->
+      \x2 ->
+        hs_bindgen_c980cb05cbc34a77_base (BG.toFFIType x0) (BG.toFFIType x1) (BG.toFFIType x2)
+
+{-| Assigns extra information to the table function that can be fetched during binding, etc.
+
+    history:
+
+    * stable: v0.3.3
+
+    [__@table_function@__]: The table function
+
+    [__@extra_info@__]: The extra information
+
+    [__@destroy@__]: The callback that will be called to destroy the extra information (if any)
+
+    __Returns:__ void
+
+    __C declaration:__ @duckdb_table_function_set_extra_info@
+
+    __defined at:__ @duckdb.h 7848:19@
+
+    __exported by:__ @duckdb.h@
+-}
+c_duckdb_table_function_set_extra_info ::
+     DuckDBTableFunction
+     {- ^
+
+          [__@table_function@__]: The table function
+
+          __C declaration:__ @table_function@
+     -}
+  -> BG.Ptr BG.Void
+     {- ^
+
+          [__@extra_info@__]: The extra information
+
+          __C declaration:__ @extra_info@
+     -}
+  -> DuckDBDeleteCallback
+     {- ^
+
+          [__@destroy@__]: The callback that will be called to destroy the extra information (if any)
+
+          __C declaration:__ @destroy@
+     -}
+  -> IO ()
+c_duckdb_table_function_set_extra_info =
+  hs_bindgen_c980cb05cbc34a77
+
+-- __unique:__ @Database_DuckDB_FFI_Database.DuckDB.FFI_Safe_duckdb_table_function_set_bind@
+foreign import ccall safe "hs_bindgen_102b9bd82ea79e87" hs_bindgen_102b9bd82ea79e87_base ::
+     BG.Ptr BG.Void
+  -> BG.FunPtr BG.Void
+  -> IO ()
+
+-- __unique:__ @Database_DuckDB_FFI_Database.DuckDB.FFI_Safe_duckdb_table_function_set_bind@
+hs_bindgen_102b9bd82ea79e87 ::
+     DuckDBTableFunction
+  -> DuckDBTableFunctionBindFun
+  -> IO ()
+hs_bindgen_102b9bd82ea79e87 =
+  \x0 ->
+    \x1 ->
+      hs_bindgen_102b9bd82ea79e87_base (BG.toFFIType x0) (BG.toFFIType x1)
+
+{-| Sets the bind function of the table function.
+
+    history:
+
+    * stable: v0.3.3
+
+    [__@table_function@__]: The table function
+
+    [__@bind@__]: The bind function
+
+    __Returns:__ void
+
+    __C declaration:__ @duckdb_table_function_set_bind@
+
+    __defined at:__ @duckdb.h 7863:19@
+
+    __exported by:__ @duckdb.h@
+-}
+c_duckdb_table_function_set_bind ::
+     DuckDBTableFunction
+     {- ^
+
+          [__@table_function@__]: The table function
+
+          __C declaration:__ @table_function@
+     -}
+  -> DuckDBTableFunctionBindFun
+     {- ^
+
+          [__@bind@__]: The bind function
+
+          __C declaration:__ @bind@
+     -}
+  -> IO ()
+c_duckdb_table_function_set_bind =
+  hs_bindgen_102b9bd82ea79e87
+
+-- __unique:__ @Database_DuckDB_FFI_Database.DuckDB.FFI_Safe_duckdb_table_function_set_init@
+foreign import ccall safe "hs_bindgen_b853cf848e1dd32b" hs_bindgen_b853cf848e1dd32b_base ::
+     BG.Ptr BG.Void
+  -> BG.FunPtr BG.Void
+  -> IO ()
+
+-- __unique:__ @Database_DuckDB_FFI_Database.DuckDB.FFI_Safe_duckdb_table_function_set_init@
+hs_bindgen_b853cf848e1dd32b ::
+     DuckDBTableFunction
+  -> DuckDBTableFunctionInitFun
+  -> IO ()
+hs_bindgen_b853cf848e1dd32b =
+  \x0 ->
+    \x1 ->
+      hs_bindgen_b853cf848e1dd32b_base (BG.toFFIType x0) (BG.toFFIType x1)
+
+{-| Sets the init function of the table function.
+
+    history:
+
+    * stable: v0.3.3
+
+    [__@table_function@__]: The table function
+
+    [__@init@__]: The init function
+
+    __Returns:__ void
+
+    __C declaration:__ @duckdb_table_function_set_init@
+
+    __defined at:__ @duckdb.h 7878:19@
+
+    __exported by:__ @duckdb.h@
+-}
+c_duckdb_table_function_set_init ::
+     DuckDBTableFunction
+     {- ^
+
+          [__@table_function@__]: The table function
+
+          __C declaration:__ @table_function@
+     -}
+  -> DuckDBTableFunctionInitFun
+     {- ^
+
+          [__@init@__]: The init function
+
+          __C declaration:__ @init@
+     -}
+  -> IO ()
+c_duckdb_table_function_set_init =
+  hs_bindgen_b853cf848e1dd32b
+
+-- __unique:__ @Database_DuckDB_FFI_Database.DuckDB.FFI_Safe_duckdb_table_function_set_local_init@
+foreign import ccall safe "hs_bindgen_6e9b24dd817b24cb" hs_bindgen_6e9b24dd817b24cb_base ::
+     BG.Ptr BG.Void
+  -> BG.FunPtr BG.Void
+  -> IO ()
+
+-- __unique:__ @Database_DuckDB_FFI_Database.DuckDB.FFI_Safe_duckdb_table_function_set_local_init@
+hs_bindgen_6e9b24dd817b24cb ::
+     DuckDBTableFunction
+  -> DuckDBTableFunctionInitFun
+  -> IO ()
+hs_bindgen_6e9b24dd817b24cb =
+  \x0 ->
+    \x1 ->
+      hs_bindgen_6e9b24dd817b24cb_base (BG.toFFIType x0) (BG.toFFIType x1)
+
+{-| Sets the thread-local init function of the table function.
+
+    history:
+
+    * stable: v0.4.0
+
+    [__@table_function@__]: The table function
+
+    [__@init@__]: The init function
+
+    __Returns:__ void
+
+    __C declaration:__ @duckdb_table_function_set_local_init@
+
+    __defined at:__ @duckdb.h 7893:19@
+
+    __exported by:__ @duckdb.h@
+-}
+c_duckdb_table_function_set_local_init ::
+     DuckDBTableFunction
+     {- ^
+
+          [__@table_function@__]: The table function
+
+          __C declaration:__ @table_function@
+     -}
+  -> DuckDBTableFunctionInitFun
+     {- ^
+
+          [__@init@__]: The init function
+
+          __C declaration:__ @init@
+     -}
+  -> IO ()
+c_duckdb_table_function_set_local_init =
+  hs_bindgen_6e9b24dd817b24cb
+
+-- __unique:__ @Database_DuckDB_FFI_Database.DuckDB.FFI_Safe_duckdb_table_function_set_function@
+foreign import ccall safe "hs_bindgen_02b30c88a74a7b32" hs_bindgen_02b30c88a74a7b32_base ::
+     BG.Ptr BG.Void
+  -> BG.FunPtr BG.Void
+  -> IO ()
+
+-- __unique:__ @Database_DuckDB_FFI_Database.DuckDB.FFI_Safe_duckdb_table_function_set_function@
+hs_bindgen_02b30c88a74a7b32 ::
+     DuckDBTableFunction
+  -> DuckDBTableFunctionFun
+  -> IO ()
+hs_bindgen_02b30c88a74a7b32 =
+  \x0 ->
+    \x1 ->
+      hs_bindgen_02b30c88a74a7b32_base (BG.toFFIType x0) (BG.toFFIType x1)
+
+{-| Sets the main function of the table function.
+
+    history:
+
+    * stable: v0.3.3
+
+    [__@table_function@__]: The table function
+
+    [__@function@__]: The function
+
+    __Returns:__ void
+
+    __C declaration:__ @duckdb_table_function_set_function@
+
+    __defined at:__ @duckdb.h 7908:19@
+
+    __exported by:__ @duckdb.h@
+-}
+c_duckdb_table_function_set_function ::
+     DuckDBTableFunction
+     {- ^
+
+          [__@table_function@__]: The table function
+
+          __C declaration:__ @table_function@
+     -}
+  -> DuckDBTableFunctionFun
+     {- ^
+
+          [__@function@__]: The function
+
+          __C declaration:__ @function@
+     -}
+  -> IO ()
+c_duckdb_table_function_set_function =
+  hs_bindgen_02b30c88a74a7b32
+
+-- __unique:__ @Database_DuckDB_FFI_Database.DuckDB.FFI_Safe_duckdb_table_function_supports_projection_pushdown@
+foreign import ccall safe "hs_bindgen_7b6ddb914e22dc0c" hs_bindgen_7b6ddb914e22dc0c_base ::
+     BG.Ptr BG.Void
+  -> BG.CBool
+  -> IO ()
+
+-- __unique:__ @Database_DuckDB_FFI_Database.DuckDB.FFI_Safe_duckdb_table_function_supports_projection_pushdown@
+hs_bindgen_7b6ddb914e22dc0c ::
+     DuckDBTableFunction
+  -> BG.CBool
+  -> IO ()
+hs_bindgen_7b6ddb914e22dc0c =
+  \x0 ->
+    \x1 ->
+      hs_bindgen_7b6ddb914e22dc0c_base (BG.toFFIType x0) (BG.toFFIType x1)
+
+{-| Sets whether or not the given table function supports projection pushdown.
+
+    If this is set to true, the system will provide a list of all required columns in the @init@ stage through the @'c_duckdb_init_get_column_count'@ and @'c_duckdb_init_get_column_index'@ functions. If this is set to false (the default), the system will expect all columns to be projected.
+
+    history:
+
+    * stable: v0.3.3
+
+    [__@table_function@__]: The table function
+
+    [__@pushdown@__]: True if the table function supports projection pushdown, false otherwise.
+
+    __Returns:__ void
+
+    __C declaration:__ @duckdb_table_function_supports_projection_pushdown@
+
+    __defined at:__ @duckdb.h 7927:19@
+
+    __exported by:__ @duckdb.h@
+-}
+c_duckdb_table_function_supports_projection_pushdown ::
+     DuckDBTableFunction
+     {- ^
+
+          [__@table_function@__]: The table function
+
+          __C declaration:__ @table_function@
+     -}
+  -> BG.CBool
+     {- ^
+
+          [__@pushdown@__]: True if the table function supports projection pushdown, false otherwise.
+
+          __C declaration:__ @pushdown@
+     -}
+  -> IO ()
+c_duckdb_table_function_supports_projection_pushdown =
+  hs_bindgen_7b6ddb914e22dc0c
+
+-- __unique:__ @Database_DuckDB_FFI_Database.DuckDB.FFI_Safe_duckdb_register_table_function@
+foreign import ccall safe "hs_bindgen_aad41a8c83d775f6" hs_bindgen_aad41a8c83d775f6_base ::
+     BG.Ptr BG.Void
+  -> BG.Ptr BG.Void
+  -> IO BG.CUInt
+
+-- __unique:__ @Database_DuckDB_FFI_Database.DuckDB.FFI_Safe_duckdb_register_table_function@
+hs_bindgen_aad41a8c83d775f6 ::
+     DuckDBConnection
+  -> DuckDBTableFunction
+  -> IO DuckDBState
+hs_bindgen_aad41a8c83d775f6 =
+  \x0 ->
+    \x1 ->
+      fmap BG.fromFFIType (hs_bindgen_aad41a8c83d775f6_base (BG.toFFIType x0) (BG.toFFIType x1))
+
+{-| Register the table function object within the given connection.
+
+    The function requires at least a name, a bind function, an init function and a main function.
+
+    If the function is incomplete or a function with this name already exists DuckDBError is returned.
+
+    history:
+
+    * stable: v0.3.3
+
+    [__@con@__]: The connection to register it in.
+
+    [__@function@__]: The function pointer
+
+    __Returns:__ t'DuckDBState'
+
+    __C declaration:__ @duckdb_register_table_function@
+
+    __defined at:__ @duckdb.h 7946:27@
+
+    __exported by:__ @duckdb.h@
+-}
+c_duckdb_register_table_function ::
+     DuckDBConnection
+     {- ^
+
+          [__@con@__]: The connection to register it in.
+
+          __C declaration:__ @con@
+     -}
+  -> DuckDBTableFunction
+     {- ^
+
+          [__@function@__]: The function pointer
+
+          __C declaration:__ @function@
+     -}
+  -> IO DuckDBState
+c_duckdb_register_table_function =
+  hs_bindgen_aad41a8c83d775f6
+
+-- __unique:__ @Database_DuckDB_FFI_Database.DuckDB.FFI_Safe_duckdb_bind_get_extra_info@
+foreign import ccall safe "hs_bindgen_6fab24b482a2ecea" hs_bindgen_6fab24b482a2ecea_base ::
+     BG.Ptr BG.Void
+  -> IO (BG.Ptr BG.Void)
+
+-- __unique:__ @Database_DuckDB_FFI_Database.DuckDB.FFI_Safe_duckdb_bind_get_extra_info@
+hs_bindgen_6fab24b482a2ecea ::
+     DuckDBBindInfo
+  -> IO (BG.Ptr BG.Void)
+hs_bindgen_6fab24b482a2ecea =
+  \x0 ->
+    fmap BG.fromFFIType (hs_bindgen_6fab24b482a2ecea_base (BG.toFFIType x0))
+
+{-| Retrieves the extra info of the function as set in @'c_duckdb_table_function_set_extra_info'@ .
+
+    history:
+
+    * stable: v0.3.3
+
+    [__@info@__]: The info object
+
+    __Returns:__ void*
+
+    __C declaration:__ @duckdb_bind_get_extra_info@
+
+    __defined at:__ @duckdb.h 7959:20@
+
+    __exported by:__ @duckdb.h@
+-}
+c_duckdb_bind_get_extra_info ::
+     DuckDBBindInfo
+     {- ^
+
+          [__@info@__]: The info object
+
+          __C declaration:__ @info@
+     -}
+  -> IO (BG.Ptr BG.Void)
+c_duckdb_bind_get_extra_info =
+  hs_bindgen_6fab24b482a2ecea
+
+-- __unique:__ @Database_DuckDB_FFI_Database.DuckDB.FFI_Safe_duckdb_table_function_get_client_context@
+foreign import ccall safe "hs_bindgen_ccf6e3d06befd12b" hs_bindgen_ccf6e3d06befd12b_base ::
+     BG.Ptr BG.Void
+  -> BG.Ptr BG.Void
+  -> IO ()
+
+-- __unique:__ @Database_DuckDB_FFI_Database.DuckDB.FFI_Safe_duckdb_table_function_get_client_context@
+hs_bindgen_ccf6e3d06befd12b ::
+     DuckDBBindInfo
+  -> BG.Ptr DuckDBClientContext
+  -> IO ()
+hs_bindgen_ccf6e3d06befd12b =
+  \x0 ->
+    \x1 ->
+      hs_bindgen_ccf6e3d06befd12b_base (BG.toFFIType x0) (BG.toFFIType x1)
+
+{-| Retrieves the client context of the bind info of a table function.
+
+    history:
+
+    * unstable: v1.4.0
+
+    * stable: v1.5.6
+
+    [__@info@__]: The bind info object of the table function.
+
+    [__@out_context@__]: The client context of the bind info. Must be destroyed with @'c_duckdb_destroy_client_context'@ .
+
+    __Returns:__ void
+
+    __C declaration:__ @duckdb_table_function_get_client_context@
+
+    __defined at:__ @duckdb.h 7974:19@
+
+    __exported by:__ @duckdb.h@
+-}
+c_duckdb_table_function_get_client_context ::
+     DuckDBBindInfo
+     {- ^
+
+          [__@info@__]: The bind info object of the table function.
+
+          __C declaration:__ @info@
+     -}
+  -> BG.Ptr DuckDBClientContext
+     {- ^
+
+          [__@out_context@__]: The client context of the bind info. Must be destroyed with @'c_duckdb_destroy_client_context'@ .
+
+          __C declaration:__ @out_context@
+     -}
+  -> IO ()
+c_duckdb_table_function_get_client_context =
+  hs_bindgen_ccf6e3d06befd12b
+
+-- __unique:__ @Database_DuckDB_FFI_Database.DuckDB.FFI_Safe_duckdb_bind_add_result_column@
+foreign import ccall safe "hs_bindgen_7f781750bcf9c561" hs_bindgen_7f781750bcf9c561_base ::
+     BG.Ptr BG.Void
+  -> BG.Ptr BG.Void
+  -> BG.Ptr BG.Void
+  -> IO ()
+
+-- __unique:__ @Database_DuckDB_FFI_Database.DuckDB.FFI_Safe_duckdb_bind_add_result_column@
+hs_bindgen_7f781750bcf9c561 ::
+     DuckDBBindInfo
+  -> PtrConst.PtrConst BG.CChar
+  -> DuckDBLogicalType
+  -> IO ()
+hs_bindgen_7f781750bcf9c561 =
+  \x0 ->
+    \x1 ->
+      \x2 ->
+        hs_bindgen_7f781750bcf9c561_base (BG.toFFIType x0) (BG.toFFIType x1) (BG.toFFIType x2)
+
+{-| Adds a result column to the output of the table function.
+
+    history:
+
+    * stable: v0.3.3
+
+    [__@info@__]: The table function\'s bind info.
+
+    [__@name@__]: The column name.
+
+    [__@type@__]: The logical column type.
+
+    __Returns:__ void
+
+    __C declaration:__ @duckdb_bind_add_result_column@
+
+    __defined at:__ @duckdb.h 7989:19@
+
+    __exported by:__ @duckdb.h@
+-}
+c_duckdb_bind_add_result_column ::
+     DuckDBBindInfo
+     {- ^
+
+          [__@info@__]: The table function\'s bind info.
+
+          __C declaration:__ @info@
+     -}
+  -> PtrConst.PtrConst BG.CChar
+     {- ^
+
+          [__@name@__]: The column name.
+
+          __C declaration:__ @name@
+     -}
+  -> DuckDBLogicalType
+     {- ^
+
+          [__@type@__]: The logical column type.
+
+          __C declaration:__ @type@
+     -}
+  -> IO ()
+c_duckdb_bind_add_result_column =
+  hs_bindgen_7f781750bcf9c561
+
+-- __unique:__ @Database_DuckDB_FFI_Database.DuckDB.FFI_Safe_duckdb_bind_get_parameter_count@
+foreign import ccall safe "hs_bindgen_021eeb8fbfbce39a" hs_bindgen_021eeb8fbfbce39a_base ::
+     BG.Ptr BG.Void
+  -> IO HsBindgen.Runtime.LibC.Word64
+
+-- __unique:__ @Database_DuckDB_FFI_Database.DuckDB.FFI_Safe_duckdb_bind_get_parameter_count@
+hs_bindgen_021eeb8fbfbce39a ::
+     DuckDBBindInfo
+  -> IO DuckDBIdx
+hs_bindgen_021eeb8fbfbce39a =
+  \x0 ->
+    fmap BG.fromFFIType (hs_bindgen_021eeb8fbfbce39a_base (BG.toFFIType x0))
+
+{-| Retrieves the number of regular (non-named) parameters to the function.
+
+    history:
+
+    * stable: v0.3.3
+
+    [__@info@__]: The info object
+
+    __Returns:__ t'DuckDBIdx'
+
+    __C declaration:__ @duckdb_bind_get_parameter_count@
+
+    __defined at:__ @duckdb.h 8002:20@
+
+    __exported by:__ @duckdb.h@
+-}
+c_duckdb_bind_get_parameter_count ::
+     DuckDBBindInfo
+     {- ^
+
+          [__@info@__]: The info object
+
+          __C declaration:__ @info@
+     -}
+  -> IO DuckDBIdx
+c_duckdb_bind_get_parameter_count =
+  hs_bindgen_021eeb8fbfbce39a
+
+-- __unique:__ @Database_DuckDB_FFI_Database.DuckDB.FFI_Safe_duckdb_bind_get_parameter@
+foreign import ccall safe "hs_bindgen_ba87799ace861635" hs_bindgen_ba87799ace861635_base ::
+     BG.Ptr BG.Void
+  -> HsBindgen.Runtime.LibC.Word64
+  -> IO (BG.Ptr BG.Void)
+
+-- __unique:__ @Database_DuckDB_FFI_Database.DuckDB.FFI_Safe_duckdb_bind_get_parameter@
+hs_bindgen_ba87799ace861635 ::
+     DuckDBBindInfo
+  -> DuckDBIdx
+  -> IO DuckDBValue
+hs_bindgen_ba87799ace861635 =
+  \x0 ->
+    \x1 ->
+      fmap BG.fromFFIType (hs_bindgen_ba87799ace861635_base (BG.toFFIType x0) (BG.toFFIType x1))
+
+{-| Retrieves the parameter at the given index.
+
+    The result must be destroyed with @'c_duckdb_destroy_value'@ .
+
+    history:
+
+    * stable: v0.3.3
+
+    [__@info@__]: The info object
+
+    [__@index@__]: The index of the parameter to get
+
+    __Returns:__ t'DuckDBValue'
+
+    __C declaration:__ @duckdb_bind_get_parameter@
+
+    __defined at:__ @duckdb.h 8018:27@
+
+    __exported by:__ @duckdb.h@
+-}
+c_duckdb_bind_get_parameter ::
+     DuckDBBindInfo
+     {- ^
+
+          [__@info@__]: The info object
+
+          __C declaration:__ @info@
+     -}
+  -> DuckDBIdx
+     {- ^
+
+          [__@index@__]: The index of the parameter to get
+
+          __C declaration:__ @index@
+     -}
+  -> IO DuckDBValue
+c_duckdb_bind_get_parameter =
+  hs_bindgen_ba87799ace861635
+
+-- __unique:__ @Database_DuckDB_FFI_Database.DuckDB.FFI_Safe_duckdb_bind_get_named_parameter@
+foreign import ccall safe "hs_bindgen_c914bc6228b6bee9" hs_bindgen_c914bc6228b6bee9_base ::
+     BG.Ptr BG.Void
+  -> BG.Ptr BG.Void
+  -> IO (BG.Ptr BG.Void)
+
+-- __unique:__ @Database_DuckDB_FFI_Database.DuckDB.FFI_Safe_duckdb_bind_get_named_parameter@
+hs_bindgen_c914bc6228b6bee9 ::
+     DuckDBBindInfo
+  -> PtrConst.PtrConst BG.CChar
+  -> IO DuckDBValue
+hs_bindgen_c914bc6228b6bee9 =
+  \x0 ->
+    \x1 ->
+      fmap BG.fromFFIType (hs_bindgen_c914bc6228b6bee9_base (BG.toFFIType x0) (BG.toFFIType x1))
+
+{-| Retrieves a named parameter with the given name.
+
+    The result must be destroyed with @'c_duckdb_destroy_value'@ .
+
+    history:
+
+    * stable: v0.8.0
+
+    [__@info@__]: The info object
+
+    [__@name@__]: The name of the parameter
+
+    __Returns:__ t'DuckDBValue'
+
+    __C declaration:__ @duckdb_bind_get_named_parameter@
+
+    __defined at:__ @duckdb.h 8034:27@
+
+    __exported by:__ @duckdb.h@
+-}
+c_duckdb_bind_get_named_parameter ::
+     DuckDBBindInfo
+     {- ^
+
+          [__@info@__]: The info object
+
+          __C declaration:__ @info@
+     -}
+  -> PtrConst.PtrConst BG.CChar
+     {- ^
+
+          [__@name@__]: The name of the parameter
+
+          __C declaration:__ @name@
+     -}
+  -> IO DuckDBValue
+c_duckdb_bind_get_named_parameter =
+  hs_bindgen_c914bc6228b6bee9
+
+-- __unique:__ @Database_DuckDB_FFI_Database.DuckDB.FFI_Safe_duckdb_bind_set_bind_data@
+foreign import ccall safe "hs_bindgen_ae6dbca28237b618" hs_bindgen_ae6dbca28237b618_base ::
+     BG.Ptr BG.Void
+  -> BG.Ptr BG.Void
+  -> BG.FunPtr BG.Void
+  -> IO ()
+
+-- __unique:__ @Database_DuckDB_FFI_Database.DuckDB.FFI_Safe_duckdb_bind_set_bind_data@
+hs_bindgen_ae6dbca28237b618 ::
+     DuckDBBindInfo
+  -> BG.Ptr BG.Void
+  -> DuckDBDeleteCallback
+  -> IO ()
+hs_bindgen_ae6dbca28237b618 =
+  \x0 ->
+    \x1 ->
+      \x2 ->
+        hs_bindgen_ae6dbca28237b618_base (BG.toFFIType x0) (BG.toFFIType x1) (BG.toFFIType x2)
+
+{-| Sets the user-provided bind data in the bind object of the table function. This object can be retrieved again during execution.
+
+    history:
+
+    * stable: v0.3.3
+
+    [__@info@__]: The bind info of the table function.
+
+    [__@bind_data@__]: The bind data object.
+
+    [__@destroy@__]: The callback to destroy the bind data (if any).
+
+    __Returns:__ void
+
+    __C declaration:__ @duckdb_bind_set_bind_data@
+
+    __defined at:__ @duckdb.h 8050:19@
+
+    __exported by:__ @duckdb.h@
+-}
+c_duckdb_bind_set_bind_data ::
+     DuckDBBindInfo
+     {- ^
+
+          [__@info@__]: The bind info of the table function.
+
+          __C declaration:__ @info@
+     -}
+  -> BG.Ptr BG.Void
+     {- ^
+
+          [__@bind_data@__]: The bind data object.
+
+          __C declaration:__ @bind_data@
+     -}
+  -> DuckDBDeleteCallback
+     {- ^
+
+          [__@destroy@__]: The callback to destroy the bind data (if any).
+
+          __C declaration:__ @destroy@
+     -}
+  -> IO ()
+c_duckdb_bind_set_bind_data =
+  hs_bindgen_ae6dbca28237b618
+
+-- __unique:__ @Database_DuckDB_FFI_Database.DuckDB.FFI_Safe_duckdb_bind_set_cardinality@
+foreign import ccall safe "hs_bindgen_78371efd83ac79c2" hs_bindgen_78371efd83ac79c2_base ::
+     BG.Ptr BG.Void
+  -> HsBindgen.Runtime.LibC.Word64
+  -> BG.CBool
+  -> IO ()
+
+-- __unique:__ @Database_DuckDB_FFI_Database.DuckDB.FFI_Safe_duckdb_bind_set_cardinality@
+hs_bindgen_78371efd83ac79c2 ::
+     DuckDBBindInfo
+  -> DuckDBIdx
+  -> BG.CBool
+  -> IO ()
+hs_bindgen_78371efd83ac79c2 =
+  \x0 ->
+    \x1 ->
+      \x2 ->
+        hs_bindgen_78371efd83ac79c2_base (BG.toFFIType x0) (BG.toFFIType x1) (BG.toFFIType x2)
+
+{-| Sets the cardinality estimate for the table function, used for optimization.
+
+    history:
+
+    * stable: v0.5.0
+
+    [__@info@__]: The bind data object.
+
+    [__@cardinality@__]:
+
+    [__@is_exact@__]: Whether or not the cardinality estimate is exact, or an approximation
+
+    __Returns:__ void
+
+    __C declaration:__ @duckdb_bind_set_cardinality@
+
+    __defined at:__ @duckdb.h 8065:19@
+
+    __exported by:__ @duckdb.h@
+-}
+c_duckdb_bind_set_cardinality ::
+     DuckDBBindInfo
+     {- ^
+
+          [__@info@__]: The bind data object.
+
+          __C declaration:__ @info@
+     -}
+  -> DuckDBIdx
+     {- ^
+
+          [__@cardinality@__]:
+
+          __C declaration:__ @cardinality@
+     -}
+  -> BG.CBool
+     {- ^
+
+          [__@is_exact@__]: Whether or not the cardinality estimate is exact, or an approximation
+
+          __C declaration:__ @is_exact@
+     -}
+  -> IO ()
+c_duckdb_bind_set_cardinality =
+  hs_bindgen_78371efd83ac79c2
+
+-- __unique:__ @Database_DuckDB_FFI_Database.DuckDB.FFI_Safe_duckdb_bind_set_error@
+foreign import ccall safe "hs_bindgen_bc90a0043b0ab6d4" hs_bindgen_bc90a0043b0ab6d4_base ::
+     BG.Ptr BG.Void
+  -> BG.Ptr BG.Void
+  -> IO ()
+
+-- __unique:__ @Database_DuckDB_FFI_Database.DuckDB.FFI_Safe_duckdb_bind_set_error@
+hs_bindgen_bc90a0043b0ab6d4 ::
+     DuckDBBindInfo
+  -> PtrConst.PtrConst BG.CChar
+  -> IO ()
+hs_bindgen_bc90a0043b0ab6d4 =
+  \x0 ->
+    \x1 ->
+      hs_bindgen_bc90a0043b0ab6d4_base (BG.toFFIType x0) (BG.toFFIType x1)
+
+{-| Report that an error has occurred while calling bind on a table function.
+
+    history:
+
+    * stable: v0.3.3
+
+    [__@info@__]: The info object
+
+    [__@error@__]: The error message
+
+    __Returns:__ void
+
+    __C declaration:__ @duckdb_bind_set_error@
+
+    __defined at:__ @duckdb.h 8079:19@
+
+    __exported by:__ @duckdb.h@
+-}
+c_duckdb_bind_set_error ::
+     DuckDBBindInfo
+     {- ^
+
+          [__@info@__]: The info object
+
+          __C declaration:__ @info@
+     -}
+  -> PtrConst.PtrConst BG.CChar
+     {- ^
+
+          [__@error@__]: The error message
+
+          __C declaration:__ @error@
+     -}
+  -> IO ()
+c_duckdb_bind_set_error = hs_bindgen_bc90a0043b0ab6d4
+
+-- __unique:__ @Database_DuckDB_FFI_Database.DuckDB.FFI_Safe_duckdb_init_get_extra_info@
+foreign import ccall safe "hs_bindgen_b7875ec01bf04915" hs_bindgen_b7875ec01bf04915_base ::
+     BG.Ptr BG.Void
+  -> IO (BG.Ptr BG.Void)
+
+-- __unique:__ @Database_DuckDB_FFI_Database.DuckDB.FFI_Safe_duckdb_init_get_extra_info@
+hs_bindgen_b7875ec01bf04915 ::
+     DuckDBInitInfo
+  -> IO (BG.Ptr BG.Void)
+hs_bindgen_b7875ec01bf04915 =
+  \x0 ->
+    fmap BG.fromFFIType (hs_bindgen_b7875ec01bf04915_base (BG.toFFIType x0))
+
+{-| Retrieves the extra info of the function as set in @'c_duckdb_table_function_set_extra_info'@ .
+
+    history:
+
+    * stable: v0.3.3
+
+    [__@info@__]: The info object
+
+    __Returns:__ void*
+
+    __C declaration:__ @duckdb_init_get_extra_info@
+
+    __defined at:__ @duckdb.h 8092:20@
+
+    __exported by:__ @duckdb.h@
+-}
+c_duckdb_init_get_extra_info ::
+     DuckDBInitInfo
+     {- ^
+
+          [__@info@__]: The info object
+
+          __C declaration:__ @info@
+     -}
+  -> IO (BG.Ptr BG.Void)
+c_duckdb_init_get_extra_info =
+  hs_bindgen_b7875ec01bf04915
+
+-- __unique:__ @Database_DuckDB_FFI_Database.DuckDB.FFI_Safe_duckdb_init_get_bind_data@
+foreign import ccall safe "hs_bindgen_a0d15cbe241999e8" hs_bindgen_a0d15cbe241999e8_base ::
+     BG.Ptr BG.Void
+  -> IO (BG.Ptr BG.Void)
+
+-- __unique:__ @Database_DuckDB_FFI_Database.DuckDB.FFI_Safe_duckdb_init_get_bind_data@
+hs_bindgen_a0d15cbe241999e8 ::
+     DuckDBInitInfo
+  -> IO (BG.Ptr BG.Void)
+hs_bindgen_a0d15cbe241999e8 =
+  \x0 ->
+    fmap BG.fromFFIType (hs_bindgen_a0d15cbe241999e8_base (BG.toFFIType x0))
+
+{-| Gets the bind data set by @'c_duckdb_bind_set_bind_data'@ during the bind.
+
+    Note that the bind data should be considered as read-only. For tracking state, use the init data instead.
+
+    history:
+
+    * stable: v0.3.3
+
+    [__@info@__]: The info object
+
+    __Returns:__ void*
+
+    __C declaration:__ @duckdb_init_get_bind_data@
+
+    __defined at:__ @duckdb.h 8107:20@
+
+    __exported by:__ @duckdb.h@
+-}
+c_duckdb_init_get_bind_data ::
+     DuckDBInitInfo
+     {- ^
+
+          [__@info@__]: The info object
+
+          __C declaration:__ @info@
+     -}
+  -> IO (BG.Ptr BG.Void)
+c_duckdb_init_get_bind_data =
+  hs_bindgen_a0d15cbe241999e8
+
+-- __unique:__ @Database_DuckDB_FFI_Database.DuckDB.FFI_Safe_duckdb_init_set_init_data@
+foreign import ccall safe "hs_bindgen_97fe52be38df4eb5" hs_bindgen_97fe52be38df4eb5_base ::
+     BG.Ptr BG.Void
+  -> BG.Ptr BG.Void
+  -> BG.FunPtr BG.Void
+  -> IO ()
+
+-- __unique:__ @Database_DuckDB_FFI_Database.DuckDB.FFI_Safe_duckdb_init_set_init_data@
+hs_bindgen_97fe52be38df4eb5 ::
+     DuckDBInitInfo
+  -> BG.Ptr BG.Void
+  -> DuckDBDeleteCallback
+  -> IO ()
+hs_bindgen_97fe52be38df4eb5 =
+  \x0 ->
+    \x1 ->
+      \x2 ->
+        hs_bindgen_97fe52be38df4eb5_base (BG.toFFIType x0) (BG.toFFIType x1) (BG.toFFIType x2)
+
+{-| Sets the user-provided init data in the init object. This object can be retrieved again during execution.
+
+    history:
+
+    * stable: v0.3.3
+
+    [__@info@__]: The info object
+
+    [__@init_data@__]: The init data object.
+
+    [__@destroy@__]: The callback that will be called to destroy the init data (if any)
+
+    __Returns:__ void
+
+    __C declaration:__ @duckdb_init_set_init_data@
+
+    __defined at:__ @duckdb.h 8122:19@
+
+    __exported by:__ @duckdb.h@
+-}
+c_duckdb_init_set_init_data ::
+     DuckDBInitInfo
+     {- ^
+
+          [__@info@__]: The info object
+
+          __C declaration:__ @info@
+     -}
+  -> BG.Ptr BG.Void
+     {- ^
+
+          [__@init_data@__]: The init data object.
+
+          __C declaration:__ @init_data@
+     -}
+  -> DuckDBDeleteCallback
+     {- ^
+
+          [__@destroy@__]: The callback that will be called to destroy the init data (if any)
+
+          __C declaration:__ @destroy@
+     -}
+  -> IO ()
+c_duckdb_init_set_init_data =
+  hs_bindgen_97fe52be38df4eb5
+
+-- __unique:__ @Database_DuckDB_FFI_Database.DuckDB.FFI_Safe_duckdb_init_get_column_count@
+foreign import ccall safe "hs_bindgen_ed33dd34d691cba6" hs_bindgen_ed33dd34d691cba6_base ::
+     BG.Ptr BG.Void
+  -> IO HsBindgen.Runtime.LibC.Word64
+
+-- __unique:__ @Database_DuckDB_FFI_Database.DuckDB.FFI_Safe_duckdb_init_get_column_count@
+hs_bindgen_ed33dd34d691cba6 ::
+     DuckDBInitInfo
+  -> IO DuckDBIdx
+hs_bindgen_ed33dd34d691cba6 =
+  \x0 ->
+    fmap BG.fromFFIType (hs_bindgen_ed33dd34d691cba6_base (BG.toFFIType x0))
+
+{-| Returns the number of projected columns.
+
+    This function must be used if projection pushdown is enabled to figure out which columns to emit.
+
+    history:
+
+    * stable: v0.3.3
+
+    [__@info@__]: The info object
+
+    __Returns:__ t'DuckDBIdx'
+
+    __C declaration:__ @duckdb_init_get_column_count@
+
+    __defined at:__ @duckdb.h 8137:20@
+
+    __exported by:__ @duckdb.h@
+-}
+c_duckdb_init_get_column_count ::
+     DuckDBInitInfo
+     {- ^
+
+          [__@info@__]: The info object
+
+          __C declaration:__ @info@
+     -}
+  -> IO DuckDBIdx
+c_duckdb_init_get_column_count =
+  hs_bindgen_ed33dd34d691cba6
+
+-- __unique:__ @Database_DuckDB_FFI_Database.DuckDB.FFI_Safe_duckdb_init_get_column_index@
+foreign import ccall safe "hs_bindgen_315d90043ca10c52" hs_bindgen_315d90043ca10c52_base ::
+     BG.Ptr BG.Void
+  -> HsBindgen.Runtime.LibC.Word64
+  -> IO HsBindgen.Runtime.LibC.Word64
+
+-- __unique:__ @Database_DuckDB_FFI_Database.DuckDB.FFI_Safe_duckdb_init_get_column_index@
+hs_bindgen_315d90043ca10c52 ::
+     DuckDBInitInfo
+  -> DuckDBIdx
+  -> IO DuckDBIdx
+hs_bindgen_315d90043ca10c52 =
+  \x0 ->
+    \x1 ->
+      fmap BG.fromFFIType (hs_bindgen_315d90043ca10c52_base (BG.toFFIType x0) (BG.toFFIType x1))
+
+{-| Returns the column index of the projected column at the specified position.
+
+    This function must be used if projection pushdown is enabled to figure out which columns to emit.
+
+    history:
+
+    * stable: v0.3.3
+
+    [__@info@__]: The info object
+
+    [__@column_index@__]: The index at which to get the projected column index, from 0..duckdb_init_get_column_count(info)
+
+    __Returns:__ t'DuckDBIdx'
+
+    __C declaration:__ @duckdb_init_get_column_index@
+
+    __defined at:__ @duckdb.h 8153:20@
+
+    __exported by:__ @duckdb.h@
+-}
+c_duckdb_init_get_column_index ::
+     DuckDBInitInfo
+     {- ^
+
+          [__@info@__]: The info object
+
+          __C declaration:__ @info@
+     -}
+  -> DuckDBIdx
+     {- ^
+
+          [__@column_index@__]: The index at which to get the projected column index, from 0..duckdb_init_get_column_count(info)
+
+          __C declaration:__ @column_index@
+     -}
+  -> IO DuckDBIdx
+c_duckdb_init_get_column_index =
+  hs_bindgen_315d90043ca10c52
+
+-- __unique:__ @Database_DuckDB_FFI_Database.DuckDB.FFI_Safe_duckdb_init_set_max_threads@
+foreign import ccall safe "hs_bindgen_5b19cd9c0b08207e" hs_bindgen_5b19cd9c0b08207e_base ::
+     BG.Ptr BG.Void
+  -> HsBindgen.Runtime.LibC.Word64
+  -> IO ()
+
+-- __unique:__ @Database_DuckDB_FFI_Database.DuckDB.FFI_Safe_duckdb_init_set_max_threads@
+hs_bindgen_5b19cd9c0b08207e ::
+     DuckDBInitInfo
+  -> DuckDBIdx
+  -> IO ()
+hs_bindgen_5b19cd9c0b08207e =
+  \x0 ->
+    \x1 ->
+      hs_bindgen_5b19cd9c0b08207e_base (BG.toFFIType x0) (BG.toFFIType x1)
+
+{-| Sets how many threads can process this table function in parallel (default: 1)
+
+    history:
+
+    * stable: v0.4.0
+
+    [__@info@__]: The info object
+
+    [__@max_threads@__]: The maximum amount of threads that can process this table function
+
+    __Returns:__ void
+
+    __C declaration:__ @duckdb_init_set_max_threads@
+
+    __defined at:__ @duckdb.h 8167:19@
+
+    __exported by:__ @duckdb.h@
+-}
+c_duckdb_init_set_max_threads ::
+     DuckDBInitInfo
+     {- ^
+
+          [__@info@__]: The info object
+
+          __C declaration:__ @info@
+     -}
+  -> DuckDBIdx
+     {- ^
+
+          [__@max_threads@__]: The maximum amount of threads that can process this table function
+
+          __C declaration:__ @max_threads@
+     -}
+  -> IO ()
+c_duckdb_init_set_max_threads =
+  hs_bindgen_5b19cd9c0b08207e
+
+-- __unique:__ @Database_DuckDB_FFI_Database.DuckDB.FFI_Safe_duckdb_init_set_error@
+foreign import ccall safe "hs_bindgen_7eed47dafd9844a0" hs_bindgen_7eed47dafd9844a0_base ::
+     BG.Ptr BG.Void
+  -> BG.Ptr BG.Void
+  -> IO ()
+
+-- __unique:__ @Database_DuckDB_FFI_Database.DuckDB.FFI_Safe_duckdb_init_set_error@
+hs_bindgen_7eed47dafd9844a0 ::
+     DuckDBInitInfo
+  -> PtrConst.PtrConst BG.CChar
+  -> IO ()
+hs_bindgen_7eed47dafd9844a0 =
+  \x0 ->
+    \x1 ->
+      hs_bindgen_7eed47dafd9844a0_base (BG.toFFIType x0) (BG.toFFIType x1)
+
+{-| Report that an error has occurred while calling init.
+
+    history:
+
+    * stable: v0.3.3
+
+    [__@info@__]: The info object
+
+    [__@error@__]: The error message
+
+    __Returns:__ void
+
+    __C declaration:__ @duckdb_init_set_error@
+
+    __defined at:__ @duckdb.h 8181:19@
+
+    __exported by:__ @duckdb.h@
+-}
+c_duckdb_init_set_error ::
+     DuckDBInitInfo
+     {- ^
+
+          [__@info@__]: The info object
+
+          __C declaration:__ @info@
+     -}
+  -> PtrConst.PtrConst BG.CChar
+     {- ^
+
+          [__@error@__]: The error message
+
+          __C declaration:__ @error@
+     -}
+  -> IO ()
+c_duckdb_init_set_error = hs_bindgen_7eed47dafd9844a0
+
+-- __unique:__ @Database_DuckDB_FFI_Database.DuckDB.FFI_Safe_duckdb_function_get_extra_info@
+foreign import ccall safe "hs_bindgen_4e748f1d10a395e9" hs_bindgen_4e748f1d10a395e9_base ::
+     BG.Ptr BG.Void
+  -> IO (BG.Ptr BG.Void)
+
+-- __unique:__ @Database_DuckDB_FFI_Database.DuckDB.FFI_Safe_duckdb_function_get_extra_info@
+hs_bindgen_4e748f1d10a395e9 ::
+     DuckDBFunctionInfo
+  -> IO (BG.Ptr BG.Void)
+hs_bindgen_4e748f1d10a395e9 =
+  \x0 ->
+    fmap BG.fromFFIType (hs_bindgen_4e748f1d10a395e9_base (BG.toFFIType x0))
+
+{-| Retrieves the extra info of the function as set in @'c_duckdb_table_function_set_extra_info'@ .
+
+    history:
+
+    * stable: v0.3.3
+
+    [__@info@__]: The info object
+
+    __Returns:__ void*
+
+    __C declaration:__ @duckdb_function_get_extra_info@
+
+    __defined at:__ @duckdb.h 8194:20@
+
+    __exported by:__ @duckdb.h@
+-}
+c_duckdb_function_get_extra_info ::
+     DuckDBFunctionInfo
+     {- ^
+
+          [__@info@__]: The info object
+
+          __C declaration:__ @info@
+     -}
+  -> IO (BG.Ptr BG.Void)
+c_duckdb_function_get_extra_info =
+  hs_bindgen_4e748f1d10a395e9
+
+-- __unique:__ @Database_DuckDB_FFI_Database.DuckDB.FFI_Safe_duckdb_function_get_bind_data@
+foreign import ccall safe "hs_bindgen_cb63e00179906ca2" hs_bindgen_cb63e00179906ca2_base ::
+     BG.Ptr BG.Void
+  -> IO (BG.Ptr BG.Void)
+
+-- __unique:__ @Database_DuckDB_FFI_Database.DuckDB.FFI_Safe_duckdb_function_get_bind_data@
+hs_bindgen_cb63e00179906ca2 ::
+     DuckDBFunctionInfo
+  -> IO (BG.Ptr BG.Void)
+hs_bindgen_cb63e00179906ca2 =
+  \x0 ->
+    fmap BG.fromFFIType (hs_bindgen_cb63e00179906ca2_base (BG.toFFIType x0))
+
+{-| Gets the table function\'s bind data set by @'c_duckdb_bind_set_bind_data'@ .
+
+    Note that the bind data is read-only. For tracking state, use the init data instead.
+
+    history:
+
+    * stable: v0.3.3
+
+    [__@info@__]: The function info object.
+
+    __Returns:__ void*
+
+    __C declaration:__ @duckdb_function_get_bind_data@
+
+    __defined at:__ @duckdb.h 8209:20@
+
+    __exported by:__ @duckdb.h@
+-}
+c_duckdb_function_get_bind_data ::
+     DuckDBFunctionInfo
+     {- ^
+
+          [__@info@__]: The function info object.
+
+          __C declaration:__ @info@
+     -}
+  -> IO (BG.Ptr BG.Void)
+c_duckdb_function_get_bind_data =
+  hs_bindgen_cb63e00179906ca2
+
+-- __unique:__ @Database_DuckDB_FFI_Database.DuckDB.FFI_Safe_duckdb_function_get_init_data@
+foreign import ccall safe "hs_bindgen_7ed5ee7b3e3d9999" hs_bindgen_7ed5ee7b3e3d9999_base ::
+     BG.Ptr BG.Void
+  -> IO (BG.Ptr BG.Void)
+
+-- __unique:__ @Database_DuckDB_FFI_Database.DuckDB.FFI_Safe_duckdb_function_get_init_data@
+hs_bindgen_7ed5ee7b3e3d9999 ::
+     DuckDBFunctionInfo
+  -> IO (BG.Ptr BG.Void)
+hs_bindgen_7ed5ee7b3e3d9999 =
+  \x0 ->
+    fmap BG.fromFFIType (hs_bindgen_7ed5ee7b3e3d9999_base (BG.toFFIType x0))
+
+{-| Gets the init data set by @'c_duckdb_init_set_init_data'@ during the init.
+
+    history:
+
+    * stable: v0.3.3
+
+    [__@info@__]: The info object
+
+    __Returns:__ void*
+
+    __C declaration:__ @duckdb_function_get_init_data@
+
+    __defined at:__ @duckdb.h 8222:20@
+
+    __exported by:__ @duckdb.h@
+-}
+c_duckdb_function_get_init_data ::
+     DuckDBFunctionInfo
+     {- ^
+
+          [__@info@__]: The info object
+
+          __C declaration:__ @info@
+     -}
+  -> IO (BG.Ptr BG.Void)
+c_duckdb_function_get_init_data =
+  hs_bindgen_7ed5ee7b3e3d9999
+
+-- __unique:__ @Database_DuckDB_FFI_Database.DuckDB.FFI_Safe_duckdb_function_get_local_init_data@
+foreign import ccall safe "hs_bindgen_1f692b92cc709645" hs_bindgen_1f692b92cc709645_base ::
+     BG.Ptr BG.Void
+  -> IO (BG.Ptr BG.Void)
+
+-- __unique:__ @Database_DuckDB_FFI_Database.DuckDB.FFI_Safe_duckdb_function_get_local_init_data@
+hs_bindgen_1f692b92cc709645 ::
+     DuckDBFunctionInfo
+  -> IO (BG.Ptr BG.Void)
+hs_bindgen_1f692b92cc709645 =
+  \x0 ->
+    fmap BG.fromFFIType (hs_bindgen_1f692b92cc709645_base (BG.toFFIType x0))
+
+{-| Gets the thread-local init data set by @'c_duckdb_init_set_init_data'@ during the local_init.
+
+    history:
+
+    * stable: v0.4.0
+
+    [__@info@__]: The info object
+
+    __Returns:__ void*
+
+    __C declaration:__ @duckdb_function_get_local_init_data@
+
+    __defined at:__ @duckdb.h 8235:20@
+
+    __exported by:__ @duckdb.h@
+-}
+c_duckdb_function_get_local_init_data ::
+     DuckDBFunctionInfo
+     {- ^
+
+          [__@info@__]: The info object
+
+          __C declaration:__ @info@
+     -}
+  -> IO (BG.Ptr BG.Void)
+c_duckdb_function_get_local_init_data =
+  hs_bindgen_1f692b92cc709645
+
+-- __unique:__ @Database_DuckDB_FFI_Database.DuckDB.FFI_Safe_duckdb_function_set_error@
+foreign import ccall safe "hs_bindgen_00bd4a7b01db4220" hs_bindgen_00bd4a7b01db4220_base ::
+     BG.Ptr BG.Void
+  -> BG.Ptr BG.Void
+  -> IO ()
+
+-- __unique:__ @Database_DuckDB_FFI_Database.DuckDB.FFI_Safe_duckdb_function_set_error@
+hs_bindgen_00bd4a7b01db4220 ::
+     DuckDBFunctionInfo
+  -> PtrConst.PtrConst BG.CChar
+  -> IO ()
+hs_bindgen_00bd4a7b01db4220 =
+  \x0 ->
+    \x1 ->
+      hs_bindgen_00bd4a7b01db4220_base (BG.toFFIType x0) (BG.toFFIType x1)
+
+{-| Report that an error has occurred while executing the function.
+
+    history:
+
+    * stable: v0.3.3
+
+    [__@info@__]: The info object
+
+    [__@error@__]: The error message
+
+    __Returns:__ void
+
+    __C declaration:__ @duckdb_function_set_error@
+
+    __defined at:__ @duckdb.h 8249:19@
+
+    __exported by:__ @duckdb.h@
+-}
+c_duckdb_function_set_error ::
+     DuckDBFunctionInfo
+     {- ^
+
+          [__@info@__]: The info object
+
+          __C declaration:__ @info@
+     -}
+  -> PtrConst.PtrConst BG.CChar
+     {- ^
+
+          [__@error@__]: The error message
+
+          __C declaration:__ @error@
+     -}
+  -> IO ()
+c_duckdb_function_set_error =
+  hs_bindgen_00bd4a7b01db4220
+
+-- __unique:__ @Database_DuckDB_FFI_Database.DuckDB.FFI_Safe_duckdb_table_function_bind_get_result_column_count@
+foreign import ccall safe "hs_bindgen_ddabbca5182a4296" hs_bindgen_ddabbca5182a4296_base ::
+     BG.Ptr BG.Void
+  -> IO HsBindgen.Runtime.LibC.Word64
+
+-- __unique:__ @Database_DuckDB_FFI_Database.DuckDB.FFI_Safe_duckdb_table_function_bind_get_result_column_count@
+hs_bindgen_ddabbca5182a4296 ::
+     DuckDBBindInfo
+  -> IO DuckDBIdx
+hs_bindgen_ddabbca5182a4296 =
+  \x0 ->
+    fmap BG.fromFFIType (hs_bindgen_ddabbca5182a4296_base (BG.toFFIType x0))
+
+{-| Retrieves the number of result columns of a table function.
+
+    If the table function is used in a @COPY ... FROM@ statement, this can be used to retrieve the number of columns in the target table at the start of the bind callback.
+
+    history:
+
+    * unstable: v1.5.0
+
+    * stable: v1.5.6
+
+    [__@info@__]: The bind info provided to the bind function
+
+    __Returns:__ t'DuckDBIdx'
+
+    __C declaration:__ @duckdb_table_function_bind_get_result_column_count@
+
+    __defined at:__ @duckdb.h 8266:20@
+
+    __exported by:__ @duckdb.h@
+-}
+c_duckdb_table_function_bind_get_result_column_count ::
+     DuckDBBindInfo
+     {- ^
+
+          [__@info@__]: The bind info provided to the bind function
+
+          __C declaration:__ @info@
+     -}
+  -> IO DuckDBIdx
+c_duckdb_table_function_bind_get_result_column_count =
+  hs_bindgen_ddabbca5182a4296
+
+-- __unique:__ @Database_DuckDB_FFI_Database.DuckDB.FFI_Safe_duckdb_table_function_bind_get_result_column_name@
+foreign import ccall safe "hs_bindgen_6327aeb7a89bbc07" hs_bindgen_6327aeb7a89bbc07_base ::
+     BG.Ptr BG.Void
+  -> HsBindgen.Runtime.LibC.Word64
+  -> IO (BG.Ptr BG.Void)
+
+-- __unique:__ @Database_DuckDB_FFI_Database.DuckDB.FFI_Safe_duckdb_table_function_bind_get_result_column_name@
+hs_bindgen_6327aeb7a89bbc07 ::
+     DuckDBBindInfo
+  -> DuckDBIdx
+  -> IO (PtrConst.PtrConst BG.CChar)
+hs_bindgen_6327aeb7a89bbc07 =
+  \x0 ->
+    \x1 ->
+      fmap BG.fromFFIType (hs_bindgen_6327aeb7a89bbc07_base (BG.toFFIType x0) (BG.toFFIType x1))
+
+{-| Retrieves the name of a result column of a table function.
+
+    If the table function is used in a @COPY ... FROM@ statement, this can be used to retrieve the names of the columns in the target table at the start of the bind callback.
+
+    The result is valid for the duration of the bind callback or until the next call to @'c_duckdb_bind_add_result_column'@ , so it must not be destroyed.
+
+    history:
+
+    * unstable: v1.5.0
+
+    * stable: v1.5.6
+
+    [__@info@__]: The bind info provided to the bind function
+
+    [__@col_idx@__]: The index of the result column to retrieve the name for
+
+    __Returns:__ const char*
+
+    __C declaration:__ @duckdb_table_function_bind_get_result_column_name@
+
+    __defined at:__ @duckdb.h 8287:26@
+
+    __exported by:__ @duckdb.h@
+-}
+c_duckdb_table_function_bind_get_result_column_name ::
+     DuckDBBindInfo
+     {- ^
+
+          [__@info@__]: The bind info provided to the bind function
+
+          __C declaration:__ @info@
+     -}
+  -> DuckDBIdx
+     {- ^
+
+          [__@col_idx@__]: The index of the result column to retrieve the name for
+
+          __C declaration:__ @col_idx@
+     -}
+  -> IO (PtrConst.PtrConst BG.CChar)
+c_duckdb_table_function_bind_get_result_column_name =
+  hs_bindgen_6327aeb7a89bbc07
+
+-- __unique:__ @Database_DuckDB_FFI_Database.DuckDB.FFI_Safe_duckdb_table_function_bind_get_result_column_type@
+foreign import ccall safe "hs_bindgen_7239677075fd2324" hs_bindgen_7239677075fd2324_base ::
+     BG.Ptr BG.Void
+  -> HsBindgen.Runtime.LibC.Word64
+  -> IO (BG.Ptr BG.Void)
+
+-- __unique:__ @Database_DuckDB_FFI_Database.DuckDB.FFI_Safe_duckdb_table_function_bind_get_result_column_type@
+hs_bindgen_7239677075fd2324 ::
+     DuckDBBindInfo
+  -> DuckDBIdx
+  -> IO DuckDBLogicalType
+hs_bindgen_7239677075fd2324 =
+  \x0 ->
+    \x1 ->
+      fmap BG.fromFFIType (hs_bindgen_7239677075fd2324_base (BG.toFFIType x0) (BG.toFFIType x1))
+
+{-| Retrieves the type of a result column of a table function.
+
+    If the table function is used in a @COPY ... FROM@ statement, this can be used to retrieve the types of the columns in the target table at the start of the bind callback.
+
+    The result must be destroyed with @'c_duckdb_destroy_logical_type'@ .
+
+    history:
+
+    * unstable: v1.5.0
+
+    * stable: v1.5.6
+
+    [__@info@__]: The bind info provided to the bind function
+
+    [__@col_idx@__]: The index of the result column to retrieve the type for
+
+    __Returns:__ t'DuckDBLogicalType'
+
+    __C declaration:__ @duckdb_table_function_bind_get_result_column_type@
+
+    __defined at:__ @duckdb.h 8307:34@
+
+    __exported by:__ @duckdb.h@
+-}
+c_duckdb_table_function_bind_get_result_column_type ::
+     DuckDBBindInfo
+     {- ^
+
+          [__@info@__]: The bind info provided to the bind function
+
+          __C declaration:__ @info@
+     -}
+  -> DuckDBIdx
+     {- ^
+
+          [__@col_idx@__]: The index of the result column to retrieve the type for
+
+          __C declaration:__ @col_idx@
+     -}
+  -> IO DuckDBLogicalType
+c_duckdb_table_function_bind_get_result_column_type =
+  hs_bindgen_7239677075fd2324
+
+-- __unique:__ @Database_DuckDB_FFI_Database.DuckDB.FFI_Safe_duckdb_execute_tasks@
+foreign import ccall safe "hs_bindgen_33fd2a2a6fdd62ff" hs_bindgen_33fd2a2a6fdd62ff_base ::
+     BG.Ptr BG.Void
+  -> HsBindgen.Runtime.LibC.Word64
+  -> IO ()
+
+-- __unique:__ @Database_DuckDB_FFI_Database.DuckDB.FFI_Safe_duckdb_execute_tasks@
+hs_bindgen_33fd2a2a6fdd62ff ::
+     DuckDBDatabase
+  -> DuckDBIdx
+  -> IO ()
+hs_bindgen_33fd2a2a6fdd62ff =
+  \x0 ->
+    \x1 ->
+      hs_bindgen_33fd2a2a6fdd62ff_base (BG.toFFIType x0) (BG.toFFIType x1)
+
+{-| Execute DuckDB tasks on this thread.
+
+    Will return after @max_tasks@ have been executed, or if there are no more tasks present.
+
+    history:
+
+    * stable: v0.4.0
+
+    [__@database@__]: The database object to execute tasks for
+
+    [__@max_tasks@__]: The maximum amount of tasks to execute
+
+    __Returns:__ void
+
+    __C declaration:__ @duckdb_execute_tasks@
+
+    __defined at:__ @duckdb.h 8342:19@
+
+    __exported by:__ @duckdb.h@
+-}
+c_duckdb_execute_tasks ::
+     DuckDBDatabase
+     {- ^
+
+          [__@database@__]: The database object to execute tasks for
+
+          __C declaration:__ @database@
+     -}
+  -> DuckDBIdx
+     {- ^
+
+          [__@max_tasks@__]: The maximum amount of tasks to execute
+
+          __C declaration:__ @max_tasks@
+     -}
+  -> IO ()
+c_duckdb_execute_tasks = hs_bindgen_33fd2a2a6fdd62ff
+
+-- __unique:__ @Database_DuckDB_FFI_Database.DuckDB.FFI_Safe_duckdb_create_task_state@
+foreign import ccall safe "hs_bindgen_75127cab362fdc65" hs_bindgen_75127cab362fdc65_base ::
+     BG.Ptr BG.Void
+  -> IO (BG.Ptr BG.Void)
+
+-- __unique:__ @Database_DuckDB_FFI_Database.DuckDB.FFI_Safe_duckdb_create_task_state@
+hs_bindgen_75127cab362fdc65 ::
+     DuckDBDatabase
+  -> IO DuckDBTaskState
+hs_bindgen_75127cab362fdc65 =
+  \x0 ->
+    fmap BG.fromFFIType (hs_bindgen_75127cab362fdc65_base (BG.toFFIType x0))
+
+{-| Creates a task state that can be used with duckdb_execute_tasks_state to execute tasks until @'c_duckdb_finish_execution'@ is called on the state.
+
+    @duckdb_destroy_state@ must be called on the result.
+
+    history:
+
+    * stable: v0.5.0
+
+    [__@database@__]: The database object to create the task state for
+
+    __Returns:__ t'DuckDBTaskState'
+
+    __C declaration:__ @duckdb_create_task_state@
+
+    __defined at:__ @duckdb.h 8358:32@
+
+    __exported by:__ @duckdb.h@
+-}
+c_duckdb_create_task_state ::
+     DuckDBDatabase
+     {- ^
+
+          [__@database@__]: The database object to create the task state for
+
+          __C declaration:__ @database@
+     -}
+  -> IO DuckDBTaskState
+c_duckdb_create_task_state =
+  hs_bindgen_75127cab362fdc65
+
+-- __unique:__ @Database_DuckDB_FFI_Database.DuckDB.FFI_Safe_duckdb_execute_tasks_state@
+foreign import ccall safe "hs_bindgen_c483eb3fcf9cced4" hs_bindgen_c483eb3fcf9cced4_base ::
+     BG.Ptr BG.Void
+  -> IO ()
+
+-- __unique:__ @Database_DuckDB_FFI_Database.DuckDB.FFI_Safe_duckdb_execute_tasks_state@
+hs_bindgen_c483eb3fcf9cced4 ::
+     DuckDBTaskState
+  -> IO ()
+hs_bindgen_c483eb3fcf9cced4 =
+  \x0 ->
+    hs_bindgen_c483eb3fcf9cced4_base (BG.toFFIType x0)
+
+{-| Execute DuckDB tasks on this thread.
+
+    The thread will keep on executing tasks forever, until duckdb_finish_execution is called on the state. Multiple threads can share the same t'DuckDBTaskState' .
+
+    history:
+
+    * stable: v0.5.0
+
+    [__@state@__]: The task state of the executor
+
+    __Returns:__ void
+
+    __C declaration:__ @duckdb_execute_tasks_state@
+
+    __defined at:__ @duckdb.h 8374:19@
+
+    __exported by:__ @duckdb.h@
+-}
+c_duckdb_execute_tasks_state ::
+     DuckDBTaskState
+     {- ^
+
+          [__@state@__]: The task state of the executor
+
+          __C declaration:__ @state@
+     -}
+  -> IO ()
+c_duckdb_execute_tasks_state =
+  hs_bindgen_c483eb3fcf9cced4
+
+-- __unique:__ @Database_DuckDB_FFI_Database.DuckDB.FFI_Safe_duckdb_execute_n_tasks_state@
+foreign import ccall safe "hs_bindgen_a9f33b6e6c103bca" hs_bindgen_a9f33b6e6c103bca_base ::
+     BG.Ptr BG.Void
+  -> HsBindgen.Runtime.LibC.Word64
+  -> IO HsBindgen.Runtime.LibC.Word64
+
+-- __unique:__ @Database_DuckDB_FFI_Database.DuckDB.FFI_Safe_duckdb_execute_n_tasks_state@
+hs_bindgen_a9f33b6e6c103bca ::
+     DuckDBTaskState
+  -> DuckDBIdx
+  -> IO DuckDBIdx
+hs_bindgen_a9f33b6e6c103bca =
+  \x0 ->
+    \x1 ->
+      fmap BG.fromFFIType (hs_bindgen_a9f33b6e6c103bca_base (BG.toFFIType x0) (BG.toFFIType x1))
+
+{-| Execute DuckDB tasks on this thread.
+
+    The thread will keep on executing tasks until either duckdb_finish_execution is called on the state, max_tasks tasks have been executed or there are no more tasks to be executed.
+
+    Multiple threads can share the same t'DuckDBTaskState' .
+
+    history:
+
+    * stable: v0.5.0
+
+    [__@state@__]: The task state of the executor
+
+    [__@max_tasks@__]: The maximum amount of tasks to execute
+
+    __Returns:__ t'DuckDBIdx'
+
+    __C declaration:__ @duckdb_execute_n_tasks_state@
+
+    __defined at:__ @duckdb.h 8393:20@
+
+    __exported by:__ @duckdb.h@
+-}
+c_duckdb_execute_n_tasks_state ::
+     DuckDBTaskState
+     {- ^
+
+          [__@state@__]: The task state of the executor
+
+          __C declaration:__ @state@
+     -}
+  -> DuckDBIdx
+     {- ^
+
+          [__@max_tasks@__]: The maximum amount of tasks to execute
+
+          __C declaration:__ @max_tasks@
+     -}
+  -> IO DuckDBIdx
+c_duckdb_execute_n_tasks_state =
+  hs_bindgen_a9f33b6e6c103bca
+
+-- __unique:__ @Database_DuckDB_FFI_Database.DuckDB.FFI_Safe_duckdb_finish_execution@
+foreign import ccall safe "hs_bindgen_d7af3b181ccdb7bc" hs_bindgen_d7af3b181ccdb7bc_base ::
+     BG.Ptr BG.Void
+  -> IO ()
+
+-- __unique:__ @Database_DuckDB_FFI_Database.DuckDB.FFI_Safe_duckdb_finish_execution@
+hs_bindgen_d7af3b181ccdb7bc ::
+     DuckDBTaskState
+  -> IO ()
+hs_bindgen_d7af3b181ccdb7bc =
+  \x0 ->
+    hs_bindgen_d7af3b181ccdb7bc_base (BG.toFFIType x0)
+
+{-| Finish execution on a specific task.
+
+    history:
+
+    * stable: v0.5.0
+
+    [__@state@__]: The task state to finish execution
+
+    __Returns:__ void
+
+    __C declaration:__ @duckdb_finish_execution@
+
+    __defined at:__ @duckdb.h 8406:19@
+
+    __exported by:__ @duckdb.h@
+-}
+c_duckdb_finish_execution ::
+     DuckDBTaskState
+     {- ^
+
+          [__@state@__]: The task state to finish execution
+
+          __C declaration:__ @state@
+     -}
+  -> IO ()
+c_duckdb_finish_execution =
+  hs_bindgen_d7af3b181ccdb7bc
+
+-- __unique:__ @Database_DuckDB_FFI_Database.DuckDB.FFI_Safe_duckdb_task_state_is_finished@
+foreign import ccall safe "hs_bindgen_4a7f9cb6b99f4a2c" hs_bindgen_4a7f9cb6b99f4a2c_base ::
+     BG.Ptr BG.Void
+  -> IO BG.CBool
+
+-- __unique:__ @Database_DuckDB_FFI_Database.DuckDB.FFI_Safe_duckdb_task_state_is_finished@
+hs_bindgen_4a7f9cb6b99f4a2c ::
+     DuckDBTaskState
+  -> IO BG.CBool
+hs_bindgen_4a7f9cb6b99f4a2c =
+  \x0 ->
+    fmap BG.fromFFIType (hs_bindgen_4a7f9cb6b99f4a2c_base (BG.toFFIType x0))
+
+{-|
+
+    Check if the provided t'DuckDBTaskState' has finished execution
+
+    history:
+
+    * stable: v0.5.0
+
+    [__@state@__]: The task state to inspect
+
+    __Returns:__ bool
+
+    __C declaration:__ @duckdb_task_state_is_finished@
+
+    __defined at:__ @duckdb.h 8419:19@
+
+    __exported by:__ @duckdb.h@
+-}
+c_duckdb_task_state_is_finished ::
+     DuckDBTaskState
+     {- ^
+
+          [__@state@__]: The task state to inspect
+
+          __C declaration:__ @state@
+     -}
+  -> IO BG.CBool
+c_duckdb_task_state_is_finished =
+  hs_bindgen_4a7f9cb6b99f4a2c
+
+-- __unique:__ @Database_DuckDB_FFI_Database.DuckDB.FFI_Safe_duckdb_destroy_task_state@
+foreign import ccall safe "hs_bindgen_6b20c703713efbc1" hs_bindgen_6b20c703713efbc1_base ::
+     BG.Ptr BG.Void
+  -> IO ()
+
+-- __unique:__ @Database_DuckDB_FFI_Database.DuckDB.FFI_Safe_duckdb_destroy_task_state@
+hs_bindgen_6b20c703713efbc1 ::
+     DuckDBTaskState
+  -> IO ()
+hs_bindgen_6b20c703713efbc1 =
+  \x0 ->
+    hs_bindgen_6b20c703713efbc1_base (BG.toFFIType x0)
+
+{-| Destroys the task state returned from duckdb_create_task_state.
+
+    Note that this should not be called while there is an active duckdb_execute_tasks_state running on the task state.
+
+    history:
+
+    * stable: v0.5.0
+
+    [__@state@__]: The task state to clean up
+
+    __Returns:__ void
+
+    __C declaration:__ @duckdb_destroy_task_state@
+
+    __defined at:__ @duckdb.h 8434:19@
+
+    __exported by:__ @duckdb.h@
+-}
+c_duckdb_destroy_task_state ::
+     DuckDBTaskState
+     {- ^
+
+          [__@state@__]: The task state to clean up
+
+          __C declaration:__ @state@
+     -}
+  -> IO ()
+c_duckdb_destroy_task_state =
+  hs_bindgen_6b20c703713efbc1
+
+-- __unique:__ @Database_DuckDB_FFI_Database.DuckDB.FFI_Safe_duckdb_execution_is_finished@
+foreign import ccall safe "hs_bindgen_b59088062cd376af" hs_bindgen_b59088062cd376af_base ::
+     BG.Ptr BG.Void
+  -> IO BG.CBool
+
+-- __unique:__ @Database_DuckDB_FFI_Database.DuckDB.FFI_Safe_duckdb_execution_is_finished@
+hs_bindgen_b59088062cd376af ::
+     DuckDBConnection
+  -> IO BG.CBool
+hs_bindgen_b59088062cd376af =
+  \x0 ->
+    fmap BG.fromFFIType (hs_bindgen_b59088062cd376af_base (BG.toFFIType x0))
+
+{-| Returns true if the execution of the current query is finished.
+
+    history:
+
+    * stable: v0.7.0
+
+    [__@con@__]: The connection on which to check
+
+    __Returns:__ bool
+
+    __C declaration:__ @duckdb_execution_is_finished@
+
+    __defined at:__ @duckdb.h 8447:19@
+
+    __exported by:__ @duckdb.h@
+-}
+c_duckdb_execution_is_finished ::
+     DuckDBConnection
+     {- ^
+
+          [__@con@__]: The connection on which to check
+
+          __C declaration:__ @con@
+     -}
+  -> IO BG.CBool
+c_duckdb_execution_is_finished =
+  hs_bindgen_b59088062cd376af
+
+-- __unique:__ @Database_DuckDB_FFI_Database.DuckDB.FFI_Safe_duckdb_destroy_value@
+foreign import ccall safe "hs_bindgen_7416564ecbea2162" hs_bindgen_7416564ecbea2162_base ::
+     BG.Ptr BG.Void
+  -> IO ()
+
+-- __unique:__ @Database_DuckDB_FFI_Database.DuckDB.FFI_Safe_duckdb_destroy_value@
+hs_bindgen_7416564ecbea2162 ::
+     BG.Ptr DuckDBValue
+  -> IO ()
+hs_bindgen_7416564ecbea2162 =
+  \x0 ->
+    hs_bindgen_7416564ecbea2162_base (BG.toFFIType x0)
+
+{-| Destroys the value and de-allocates all memory allocated for that type.
+
+    history:
+
+    * stable: v0.3.3
+
+    [__@value@__]: The value to destroy.
+
+    __Returns:__ void
+
+    __C declaration:__ @duckdb_destroy_value@
+
+    __defined at:__ @duckdb.h 8478:19@
+
+    __exported by:__ @duckdb.h@
+-}
+c_duckdb_destroy_value ::
+     BG.Ptr DuckDBValue
+     {- ^
+
+          [__@value@__]: The value to destroy.
+
+          __C declaration:__ @value@
+     -}
+  -> IO ()
+c_duckdb_destroy_value = hs_bindgen_7416564ecbea2162
+
+-- __unique:__ @Database_DuckDB_FFI_Database.DuckDB.FFI_Safe_duckdb_create_varchar@
+foreign import ccall safe "hs_bindgen_b7a98388b23a9165" hs_bindgen_b7a98388b23a9165_base ::
+     BG.Ptr BG.Void
+  -> IO (BG.Ptr BG.Void)
+
+-- __unique:__ @Database_DuckDB_FFI_Database.DuckDB.FFI_Safe_duckdb_create_varchar@
+hs_bindgen_b7a98388b23a9165 ::
+     PtrConst.PtrConst BG.CChar
+  -> IO DuckDBValue
+hs_bindgen_b7a98388b23a9165 =
+  \x0 ->
+    fmap BG.fromFFIType (hs_bindgen_b7a98388b23a9165_base (BG.toFFIType x0))
+
+{-| Creates a value from a null-terminated string. Returns nullptr if the string is not valid UTF-8 or other invalid input.
+
+    Superseded by @'c_duckdb_create_varchar_length'@ .
+
+    history:
+
+    * stable: v0.3.3
+
+    [__@text@__]: The null-terminated string
+
+    __Returns:__ t'DuckDBValue'
+
+    __C declaration:__ @duckdb_create_varchar@
+
+    __defined at:__ @duckdb.h 8494:27@
+
+    __exported by:__ @duckdb.h@
+-}
+c_duckdb_create_varchar ::
+     PtrConst.PtrConst BG.CChar
+     {- ^
+
+          [__@text@__]: The null-terminated string
+
+          __C declaration:__ @text@
+     -}
+  -> IO DuckDBValue
+c_duckdb_create_varchar = hs_bindgen_b7a98388b23a9165
+
+-- __unique:__ @Database_DuckDB_FFI_Database.DuckDB.FFI_Safe_duckdb_create_varchar_length@
+foreign import ccall safe "hs_bindgen_acf0e4b8713d5965" hs_bindgen_acf0e4b8713d5965_base ::
+     BG.Ptr BG.Void
+  -> HsBindgen.Runtime.LibC.Word64
+  -> IO (BG.Ptr BG.Void)
+
+-- __unique:__ @Database_DuckDB_FFI_Database.DuckDB.FFI_Safe_duckdb_create_varchar_length@
+hs_bindgen_acf0e4b8713d5965 ::
+     PtrConst.PtrConst BG.CChar
+  -> DuckDBIdx
+  -> IO DuckDBValue
+hs_bindgen_acf0e4b8713d5965 =
+  \x0 ->
+    \x1 ->
+      fmap BG.fromFFIType (hs_bindgen_acf0e4b8713d5965_base (BG.toFFIType x0) (BG.toFFIType x1))
+
+{-| Creates a value from a string. Returns nullptr if the string is not valid UTF-8 or other invalid input.
+
+    history:
+
+    * stable: v0.3.3
+
+    [__@text@__]: The text
+
+    [__@length@__]: The length of the text
+
+    __Returns:__ t'DuckDBValue'
+
+    __C declaration:__ @duckdb_create_varchar_length@
+
+    __defined at:__ @duckdb.h 8508:27@
+
+    __exported by:__ @duckdb.h@
+-}
+c_duckdb_create_varchar_length ::
+     PtrConst.PtrConst BG.CChar
+     {- ^
+
+          [__@text@__]: The text
+
+          __C declaration:__ @text@
+     -}
+  -> DuckDBIdx
+     {- ^
+
+          [__@length@__]: The length of the text
+
+          __C declaration:__ @length@
+     -}
+  -> IO DuckDBValue
+c_duckdb_create_varchar_length =
+  hs_bindgen_acf0e4b8713d5965
+
+-- __unique:__ @Database_DuckDB_FFI_Database.DuckDB.FFI_Safe_duckdb_create_bool@
+foreign import ccall safe "hs_bindgen_545bb1b78145c2fd" hs_bindgen_545bb1b78145c2fd_base ::
+     BG.CBool
+  -> IO (BG.Ptr BG.Void)
+
+-- __unique:__ @Database_DuckDB_FFI_Database.DuckDB.FFI_Safe_duckdb_create_bool@
+hs_bindgen_545bb1b78145c2fd ::
+     BG.CBool
+  -> IO DuckDBValue
+hs_bindgen_545bb1b78145c2fd =
+  \x0 ->
+    fmap BG.fromFFIType (hs_bindgen_545bb1b78145c2fd_base (BG.toFFIType x0))
+
+{-| Creates a value from a boolean
+
+    history:
+
+    * stable: v1.1.0
+
+    [__@input@__]: The boolean value
+
+    __Returns:__ t'DuckDBValue'
+
+    __C declaration:__ @duckdb_create_bool@
+
+    __defined at:__ @duckdb.h 8521:27@
+
+    __exported by:__ @duckdb.h@
+-}
+c_duckdb_create_bool ::
+     BG.CBool
+     {- ^
+
+          [__@input@__]: The boolean value
+
+          __C declaration:__ @input@
+     -}
+  -> IO DuckDBValue
+c_duckdb_create_bool = hs_bindgen_545bb1b78145c2fd
+
+-- __unique:__ @Database_DuckDB_FFI_Database.DuckDB.FFI_Safe_duckdb_create_int8@
+foreign import ccall safe "hs_bindgen_70b127e29e4eeeee" hs_bindgen_70b127e29e4eeeee_base ::
+     HsBindgen.Runtime.LibC.Int8
+  -> IO (BG.Ptr BG.Void)
+
+-- __unique:__ @Database_DuckDB_FFI_Database.DuckDB.FFI_Safe_duckdb_create_int8@
+hs_bindgen_70b127e29e4eeeee ::
+     HsBindgen.Runtime.LibC.Int8
+  -> IO DuckDBValue
+hs_bindgen_70b127e29e4eeeee =
+  \x0 ->
+    fmap BG.fromFFIType (hs_bindgen_70b127e29e4eeeee_base (BG.toFFIType x0))
+
+{-| Creates a value from an int8_t (a tinyint)
+
+    history:
+
+    * stable: v1.1.0
+
+    [__@input@__]: The tinyint value
+
+    __Returns:__ t'DuckDBValue'
+
+    __C declaration:__ @duckdb_create_int8@
+
+    __defined at:__ @duckdb.h 8534:27@
+
+    __exported by:__ @duckdb.h@
+-}
+c_duckdb_create_int8 ::
+     HsBindgen.Runtime.LibC.Int8
+     {- ^
+
+          [__@input@__]: The tinyint value
+
+          __C declaration:__ @input@
+     -}
+  -> IO DuckDBValue
+c_duckdb_create_int8 = hs_bindgen_70b127e29e4eeeee
+
+-- __unique:__ @Database_DuckDB_FFI_Database.DuckDB.FFI_Safe_duckdb_create_uint8@
+foreign import ccall safe "hs_bindgen_d066824e23ecaa3b" hs_bindgen_d066824e23ecaa3b_base ::
+     HsBindgen.Runtime.LibC.Word8
+  -> IO (BG.Ptr BG.Void)
+
+-- __unique:__ @Database_DuckDB_FFI_Database.DuckDB.FFI_Safe_duckdb_create_uint8@
+hs_bindgen_d066824e23ecaa3b ::
+     HsBindgen.Runtime.LibC.Word8
+  -> IO DuckDBValue
+hs_bindgen_d066824e23ecaa3b =
+  \x0 ->
+    fmap BG.fromFFIType (hs_bindgen_d066824e23ecaa3b_base (BG.toFFIType x0))
+
+{-| Creates a value from a uint8_t (a utinyint)
+
+    history:
+
+    * stable: v1.1.0
+
+    [__@input@__]: The utinyint value
+
+    __Returns:__ t'DuckDBValue'
+
+    __C declaration:__ @duckdb_create_uint8@
+
+    __defined at:__ @duckdb.h 8547:27@
+
+    __exported by:__ @duckdb.h@
+-}
+c_duckdb_create_uint8 ::
+     HsBindgen.Runtime.LibC.Word8
+     {- ^
+
+          [__@input@__]: The utinyint value
+
+          __C declaration:__ @input@
+     -}
+  -> IO DuckDBValue
+c_duckdb_create_uint8 = hs_bindgen_d066824e23ecaa3b
+
+-- __unique:__ @Database_DuckDB_FFI_Database.DuckDB.FFI_Safe_duckdb_create_int16@
+foreign import ccall safe "hs_bindgen_a6cfd909f3065e49" hs_bindgen_a6cfd909f3065e49_base ::
+     HsBindgen.Runtime.LibC.Int16
+  -> IO (BG.Ptr BG.Void)
+
+-- __unique:__ @Database_DuckDB_FFI_Database.DuckDB.FFI_Safe_duckdb_create_int16@
+hs_bindgen_a6cfd909f3065e49 ::
+     HsBindgen.Runtime.LibC.Int16
+  -> IO DuckDBValue
+hs_bindgen_a6cfd909f3065e49 =
+  \x0 ->
+    fmap BG.fromFFIType (hs_bindgen_a6cfd909f3065e49_base (BG.toFFIType x0))
+
+{-| Creates a value from an int16_t (a smallint)
+
+    history:
+
+    * stable: v1.1.0
+
+    [__@input@__]: The smallint value
+
+    __Returns:__ t'DuckDBValue'
+
+    __C declaration:__ @duckdb_create_int16@
+
+    __defined at:__ @duckdb.h 8560:27@
+
+    __exported by:__ @duckdb.h@
+-}
+c_duckdb_create_int16 ::
+     HsBindgen.Runtime.LibC.Int16
+     {- ^
+
+          [__@input@__]: The smallint value
+
+          __C declaration:__ @input@
+     -}
+  -> IO DuckDBValue
+c_duckdb_create_int16 = hs_bindgen_a6cfd909f3065e49
+
+-- __unique:__ @Database_DuckDB_FFI_Database.DuckDB.FFI_Safe_duckdb_create_uint16@
+foreign import ccall safe "hs_bindgen_a9c685bd6504c27a" hs_bindgen_a9c685bd6504c27a_base ::
+     HsBindgen.Runtime.LibC.Word16
+  -> IO (BG.Ptr BG.Void)
+
+-- __unique:__ @Database_DuckDB_FFI_Database.DuckDB.FFI_Safe_duckdb_create_uint16@
+hs_bindgen_a9c685bd6504c27a ::
+     HsBindgen.Runtime.LibC.Word16
+  -> IO DuckDBValue
+hs_bindgen_a9c685bd6504c27a =
+  \x0 ->
+    fmap BG.fromFFIType (hs_bindgen_a9c685bd6504c27a_base (BG.toFFIType x0))
+
+{-| Creates a value from a uint16_t (a usmallint)
+
+    history:
+
+    * stable: v1.1.0
+
+    [__@input@__]: The usmallint value
+
+    __Returns:__ t'DuckDBValue'
+
+    __C declaration:__ @duckdb_create_uint16@
+
+    __defined at:__ @duckdb.h 8573:27@
+
+    __exported by:__ @duckdb.h@
+-}
+c_duckdb_create_uint16 ::
+     HsBindgen.Runtime.LibC.Word16
+     {- ^
+
+          [__@input@__]: The usmallint value
+
+          __C declaration:__ @input@
+     -}
+  -> IO DuckDBValue
+c_duckdb_create_uint16 = hs_bindgen_a9c685bd6504c27a
+
+-- __unique:__ @Database_DuckDB_FFI_Database.DuckDB.FFI_Safe_duckdb_create_int32@
+foreign import ccall safe "hs_bindgen_5bec523c4d95699b" hs_bindgen_5bec523c4d95699b_base ::
+     HsBindgen.Runtime.LibC.Int32
+  -> IO (BG.Ptr BG.Void)
+
+-- __unique:__ @Database_DuckDB_FFI_Database.DuckDB.FFI_Safe_duckdb_create_int32@
+hs_bindgen_5bec523c4d95699b ::
+     HsBindgen.Runtime.LibC.Int32
+  -> IO DuckDBValue
+hs_bindgen_5bec523c4d95699b =
+  \x0 ->
+    fmap BG.fromFFIType (hs_bindgen_5bec523c4d95699b_base (BG.toFFIType x0))
+
+{-| Creates a value from an int32_t (an integer)
+
+    history:
+
+    * stable: v1.1.0
+
+    [__@input@__]: The integer value
+
+    __Returns:__ t'DuckDBValue'
+
+    __C declaration:__ @duckdb_create_int32@
+
+    __defined at:__ @duckdb.h 8586:27@
+
+    __exported by:__ @duckdb.h@
+-}
+c_duckdb_create_int32 ::
+     HsBindgen.Runtime.LibC.Int32
+     {- ^
+
+          [__@input@__]: The integer value
+
+          __C declaration:__ @input@
+     -}
+  -> IO DuckDBValue
+c_duckdb_create_int32 = hs_bindgen_5bec523c4d95699b
+
+-- __unique:__ @Database_DuckDB_FFI_Database.DuckDB.FFI_Safe_duckdb_create_uint32@
+foreign import ccall safe "hs_bindgen_f2c252bc8521c880" hs_bindgen_f2c252bc8521c880_base ::
+     HsBindgen.Runtime.LibC.Word32
+  -> IO (BG.Ptr BG.Void)
+
+-- __unique:__ @Database_DuckDB_FFI_Database.DuckDB.FFI_Safe_duckdb_create_uint32@
+hs_bindgen_f2c252bc8521c880 ::
+     HsBindgen.Runtime.LibC.Word32
+  -> IO DuckDBValue
+hs_bindgen_f2c252bc8521c880 =
+  \x0 ->
+    fmap BG.fromFFIType (hs_bindgen_f2c252bc8521c880_base (BG.toFFIType x0))
+
+{-| Creates a value from a uint32_t (a uinteger)
+
+    history:
+
+    * stable: v1.1.0
+
+    [__@input@__]: The uinteger value
+
+    __Returns:__ t'DuckDBValue'
+
+    __C declaration:__ @duckdb_create_uint32@
+
+    __defined at:__ @duckdb.h 8599:27@
+
+    __exported by:__ @duckdb.h@
+-}
+c_duckdb_create_uint32 ::
+     HsBindgen.Runtime.LibC.Word32
+     {- ^
+
+          [__@input@__]: The uinteger value
+
+          __C declaration:__ @input@
+     -}
+  -> IO DuckDBValue
+c_duckdb_create_uint32 = hs_bindgen_f2c252bc8521c880
+
+-- __unique:__ @Database_DuckDB_FFI_Database.DuckDB.FFI_Safe_duckdb_create_uint64@
+foreign import ccall safe "hs_bindgen_cac3b650cf37ffd2" hs_bindgen_cac3b650cf37ffd2_base ::
+     HsBindgen.Runtime.LibC.Word64
+  -> IO (BG.Ptr BG.Void)
+
+-- __unique:__ @Database_DuckDB_FFI_Database.DuckDB.FFI_Safe_duckdb_create_uint64@
+hs_bindgen_cac3b650cf37ffd2 ::
+     HsBindgen.Runtime.LibC.Word64
+  -> IO DuckDBValue
+hs_bindgen_cac3b650cf37ffd2 =
+  \x0 ->
+    fmap BG.fromFFIType (hs_bindgen_cac3b650cf37ffd2_base (BG.toFFIType x0))
+
+{-| Creates a value from a uint64_t (a ubigint)
+
+    history:
+
+    * stable: v1.1.0
+
+    [__@input@__]: The ubigint value
+
+    __Returns:__ t'DuckDBValue'
+
+    __C declaration:__ @duckdb_create_uint64@
+
+    __defined at:__ @duckdb.h 8612:27@
+
+    __exported by:__ @duckdb.h@
+-}
+c_duckdb_create_uint64 ::
+     HsBindgen.Runtime.LibC.Word64
+     {- ^
+
+          [__@input@__]: The ubigint value
+
+          __C declaration:__ @input@
+     -}
+  -> IO DuckDBValue
+c_duckdb_create_uint64 = hs_bindgen_cac3b650cf37ffd2
+
+-- __unique:__ @Database_DuckDB_FFI_Database.DuckDB.FFI_Safe_duckdb_create_int64@
+foreign import ccall safe "hs_bindgen_5181d8fcad549863" hs_bindgen_5181d8fcad549863_base ::
+     HsBindgen.Runtime.LibC.Int64
+  -> IO (BG.Ptr BG.Void)
+
+-- __unique:__ @Database_DuckDB_FFI_Database.DuckDB.FFI_Safe_duckdb_create_int64@
+hs_bindgen_5181d8fcad549863 ::
+     HsBindgen.Runtime.LibC.Int64
+  -> IO DuckDBValue
+hs_bindgen_5181d8fcad549863 =
+  \x0 ->
+    fmap BG.fromFFIType (hs_bindgen_5181d8fcad549863_base (BG.toFFIType x0))
+
+{-| Creates a value from an int64
+
+    history:
+
+    * stable: v0.3.3
+
+    [__@val@__]:
+
+    __Returns:__ t'DuckDBValue'
+
+    __C declaration:__ @duckdb_create_int64@
+
+    __defined at:__ @duckdb.h 8625:27@
+
+    __exported by:__ @duckdb.h@
+-}
+c_duckdb_create_int64 ::
+     HsBindgen.Runtime.LibC.Int64
+     {- ^
+
+          [__@val@__]:
+
+          __C declaration:__ @val@
+     -}
+  -> IO DuckDBValue
+c_duckdb_create_int64 = hs_bindgen_5181d8fcad549863
+
+-- __unique:__ @Database_DuckDB_FFI_Database.DuckDB.FFI_Safe_duckdb_create_hugeint@
+foreign import ccall safe "hs_bindgen_f6246c4c29021491" hs_bindgen_f6246c4c29021491_base ::
+     BG.Ptr BG.Void
+  -> IO (BG.Ptr BG.Void)
+
+-- __unique:__ @Database_DuckDB_FFI_Database.DuckDB.FFI_Safe_duckdb_create_hugeint@
+hs_bindgen_f6246c4c29021491 ::
+     BG.Ptr DuckDBHugeInt
+  -> IO DuckDBValue
+hs_bindgen_f6246c4c29021491 =
+  \x0 ->
+    fmap BG.fromFFIType (hs_bindgen_f6246c4c29021491_base (BG.toFFIType x0))
+
+{-| Creates a value from a hugeint
+
+    history:
+
+    * stable: v1.1.0
+
+    [__@input@__]: The hugeint value
+
+    __Returns:__ t'DuckDBValue'
+
+    __C declaration:__ @duckdb_create_hugeint@
+
+    __defined at:__ @duckdb.h 8638:27@
+
+    __exported by:__ @duckdb.h@
+-}
+c_duckdb_create_hugeint ::
+     DuckDBHugeInt
+     {- ^
+
+          [__@input@__]: The hugeint value
+
+          __C declaration:__ @input@
+     -}
+  -> IO DuckDBValue
+c_duckdb_create_hugeint =
+  \input0 ->
+    BG.with input0 (\input1 ->
+                      hs_bindgen_f6246c4c29021491 input1)
+
+-- __unique:__ @Database_DuckDB_FFI_Database.DuckDB.FFI_Safe_duckdb_create_uhugeint@
+foreign import ccall safe "hs_bindgen_3e97e4ce6f3c80ac" hs_bindgen_3e97e4ce6f3c80ac_base ::
+     BG.Ptr BG.Void
+  -> IO (BG.Ptr BG.Void)
+
+-- __unique:__ @Database_DuckDB_FFI_Database.DuckDB.FFI_Safe_duckdb_create_uhugeint@
+hs_bindgen_3e97e4ce6f3c80ac ::
+     BG.Ptr DuckDBUHugeInt
+  -> IO DuckDBValue
+hs_bindgen_3e97e4ce6f3c80ac =
+  \x0 ->
+    fmap BG.fromFFIType (hs_bindgen_3e97e4ce6f3c80ac_base (BG.toFFIType x0))
+
+{-| Creates a value from a uhugeint
+
+    history:
+
+    * stable: v1.1.0
+
+    [__@input@__]: The uhugeint value
+
+    __Returns:__ t'DuckDBValue'
+
+    __C declaration:__ @duckdb_create_uhugeint@
+
+    __defined at:__ @duckdb.h 8651:27@
+
+    __exported by:__ @duckdb.h@
+-}
+c_duckdb_create_uhugeint ::
+     DuckDBUHugeInt
+     {- ^
+
+          [__@input@__]: The uhugeint value
+
+          __C declaration:__ @input@
+     -}
+  -> IO DuckDBValue
+c_duckdb_create_uhugeint =
+  \input0 ->
+    BG.with input0 (\input1 ->
+                      hs_bindgen_3e97e4ce6f3c80ac input1)
+
+-- __unique:__ @Database_DuckDB_FFI_Database.DuckDB.FFI_Safe_duckdb_create_bignum@
+foreign import ccall safe "hs_bindgen_d24ce08ffed3f6b6" hs_bindgen_d24ce08ffed3f6b6_base ::
+     BG.Ptr BG.Void
+  -> IO (BG.Ptr BG.Void)
+
+-- __unique:__ @Database_DuckDB_FFI_Database.DuckDB.FFI_Safe_duckdb_create_bignum@
+hs_bindgen_d24ce08ffed3f6b6 ::
+     BG.Ptr DuckDBBignum
+  -> IO DuckDBValue
+hs_bindgen_d24ce08ffed3f6b6 =
+  \x0 ->
+    fmap BG.fromFFIType (hs_bindgen_d24ce08ffed3f6b6_base (BG.toFFIType x0))
+
+{-|
+
+    Creates a BIGNUM value from a t'DuckDBBignum'
+
+    history:
+
+    * stable: v1.2.0
+
+    [__@input@__]: The t'DuckDBBignum' value
+
+    __Returns:__ t'DuckDBValue'
+
+    __C declaration:__ @duckdb_create_bignum@
+
+    __defined at:__ @duckdb.h 8664:27@
+
+    __exported by:__ @duckdb.h@
+-}
+c_duckdb_create_bignum ::
+     DuckDBBignum
+     {- ^
+
+          [__@input@__]: The t'DuckDBBignum' value
+
+          __C declaration:__ @input@
+     -}
+  -> IO DuckDBValue
+c_duckdb_create_bignum =
+  \input0 ->
+    BG.with input0 (\input1 ->
+                      hs_bindgen_d24ce08ffed3f6b6 input1)
+
+-- __unique:__ @Database_DuckDB_FFI_Database.DuckDB.FFI_Safe_duckdb_create_decimal@
+foreign import ccall safe "hs_bindgen_4ca0d4cd4553b621" hs_bindgen_4ca0d4cd4553b621_base ::
+     BG.Ptr BG.Void
+  -> IO (BG.Ptr BG.Void)
+
+-- __unique:__ @Database_DuckDB_FFI_Database.DuckDB.FFI_Safe_duckdb_create_decimal@
+hs_bindgen_4ca0d4cd4553b621 ::
+     BG.Ptr DuckDBDecimal
+  -> IO DuckDBValue
+hs_bindgen_4ca0d4cd4553b621 =
+  \x0 ->
+    fmap BG.fromFFIType (hs_bindgen_4ca0d4cd4553b621_base (BG.toFFIType x0))
+
+{-|
+
+    Creates a DECIMAL value from a t'DuckDBDecimal'
+
+    history:
+
+    * stable: v1.2.0
+
+    [__@input@__]: The t'DuckDBDecimal' value
+
+    __Returns:__ t'DuckDBValue'
+
+    __C declaration:__ @duckdb_create_decimal@
+
+    __defined at:__ @duckdb.h 8677:27@
+
+    __exported by:__ @duckdb.h@
+-}
+c_duckdb_create_decimal ::
+     DuckDBDecimal
+     {- ^
+
+          [__@input@__]: The t'DuckDBDecimal' value
+
+          __C declaration:__ @input@
+     -}
+  -> IO DuckDBValue
+c_duckdb_create_decimal =
+  \input0 ->
+    BG.with input0 (\input1 ->
+                      hs_bindgen_4ca0d4cd4553b621 input1)
+
+-- __unique:__ @Database_DuckDB_FFI_Database.DuckDB.FFI_Safe_duckdb_create_float@
+foreign import ccall safe "hs_bindgen_8e6cf7541c757947" hs_bindgen_8e6cf7541c757947_base ::
+     BG.CFloat
+  -> IO (BG.Ptr BG.Void)
+
+-- __unique:__ @Database_DuckDB_FFI_Database.DuckDB.FFI_Safe_duckdb_create_float@
+hs_bindgen_8e6cf7541c757947 ::
+     BG.CFloat
+  -> IO DuckDBValue
+hs_bindgen_8e6cf7541c757947 =
+  \x0 ->
+    fmap BG.fromFFIType (hs_bindgen_8e6cf7541c757947_base (BG.toFFIType x0))
+
+{-| Creates a value from a float
+
+    history:
+
+    * stable: v1.1.0
+
+    [__@input@__]: The float value
+
+    __Returns:__ t'DuckDBValue'
+
+    __C declaration:__ @duckdb_create_float@
+
+    __defined at:__ @duckdb.h 8690:27@
+
+    __exported by:__ @duckdb.h@
+-}
+c_duckdb_create_float ::
+     BG.CFloat
+     {- ^
+
+          [__@input@__]: The float value
+
+          __C declaration:__ @input@
+     -}
+  -> IO DuckDBValue
+c_duckdb_create_float = hs_bindgen_8e6cf7541c757947
+
+-- __unique:__ @Database_DuckDB_FFI_Database.DuckDB.FFI_Safe_duckdb_create_double@
+foreign import ccall safe "hs_bindgen_6f0cb28a70d81ff7" hs_bindgen_6f0cb28a70d81ff7_base ::
+     BG.CDouble
+  -> IO (BG.Ptr BG.Void)
+
+-- __unique:__ @Database_DuckDB_FFI_Database.DuckDB.FFI_Safe_duckdb_create_double@
+hs_bindgen_6f0cb28a70d81ff7 ::
+     BG.CDouble
+  -> IO DuckDBValue
+hs_bindgen_6f0cb28a70d81ff7 =
+  \x0 ->
+    fmap BG.fromFFIType (hs_bindgen_6f0cb28a70d81ff7_base (BG.toFFIType x0))
+
+{-| Creates a value from a double
+
+    history:
+
+    * stable: v1.1.0
+
+    [__@input@__]: The double value
+
+    __Returns:__ t'DuckDBValue'
+
+    __C declaration:__ @duckdb_create_double@
+
+    __defined at:__ @duckdb.h 8703:27@
+
+    __exported by:__ @duckdb.h@
+-}
+c_duckdb_create_double ::
+     BG.CDouble
+     {- ^
+
+          [__@input@__]: The double value
+
+          __C declaration:__ @input@
+     -}
+  -> IO DuckDBValue
+c_duckdb_create_double = hs_bindgen_6f0cb28a70d81ff7
+
+-- __unique:__ @Database_DuckDB_FFI_Database.DuckDB.FFI_Safe_duckdb_create_date@
+foreign import ccall safe "hs_bindgen_4fc78acbb0d6f7d4" hs_bindgen_4fc78acbb0d6f7d4_base ::
+     BG.Ptr BG.Void
+  -> IO (BG.Ptr BG.Void)
+
+-- __unique:__ @Database_DuckDB_FFI_Database.DuckDB.FFI_Safe_duckdb_create_date@
+hs_bindgen_4fc78acbb0d6f7d4 ::
+     BG.Ptr DuckDBDate
+  -> IO DuckDBValue
+hs_bindgen_4fc78acbb0d6f7d4 =
+  \x0 ->
+    fmap BG.fromFFIType (hs_bindgen_4fc78acbb0d6f7d4_base (BG.toFFIType x0))
+
+{-| Creates a value from a date
+
+    history:
+
+    * stable: v1.1.0
+
+    [__@input@__]: The date value
+
+    __Returns:__ t'DuckDBValue'
+
+    __C declaration:__ @duckdb_create_date@
+
+    __defined at:__ @duckdb.h 8716:27@
+
+    __exported by:__ @duckdb.h@
+-}
+c_duckdb_create_date ::
+     DuckDBDate
+     {- ^
+
+          [__@input@__]: The date value
+
+          __C declaration:__ @input@
+     -}
+  -> IO DuckDBValue
+c_duckdb_create_date =
+  \input0 ->
+    BG.with input0 (\input1 ->
+                      hs_bindgen_4fc78acbb0d6f7d4 input1)
+
+-- __unique:__ @Database_DuckDB_FFI_Database.DuckDB.FFI_Safe_duckdb_create_time@
+foreign import ccall safe "hs_bindgen_b8abb38c489b45f3" hs_bindgen_b8abb38c489b45f3_base ::
+     BG.Ptr BG.Void
+  -> IO (BG.Ptr BG.Void)
+
+-- __unique:__ @Database_DuckDB_FFI_Database.DuckDB.FFI_Safe_duckdb_create_time@
+hs_bindgen_b8abb38c489b45f3 ::
+     BG.Ptr DuckDBTime
+  -> IO DuckDBValue
+hs_bindgen_b8abb38c489b45f3 =
+  \x0 ->
+    fmap BG.fromFFIType (hs_bindgen_b8abb38c489b45f3_base (BG.toFFIType x0))
+
+{-| Creates a value from a time
+
+    history:
+
+    * stable: v1.1.0
+
+    [__@input@__]: The time value
+
+    __Returns:__ t'DuckDBValue'
+
+    __C declaration:__ @duckdb_create_time@
+
+    __defined at:__ @duckdb.h 8729:27@
+
+    __exported by:__ @duckdb.h@
+-}
+c_duckdb_create_time ::
+     DuckDBTime
+     {- ^
+
+          [__@input@__]: The time value
+
+          __C declaration:__ @input@
+     -}
+  -> IO DuckDBValue
+c_duckdb_create_time =
+  \input0 ->
+    BG.with input0 (\input1 ->
+                      hs_bindgen_b8abb38c489b45f3 input1)
+
+-- __unique:__ @Database_DuckDB_FFI_Database.DuckDB.FFI_Safe_duckdb_create_time_ns@
+foreign import ccall safe "hs_bindgen_1e13f4e1b882a94b" hs_bindgen_1e13f4e1b882a94b_base ::
+     BG.Ptr BG.Void
+  -> IO (BG.Ptr BG.Void)
+
+-- __unique:__ @Database_DuckDB_FFI_Database.DuckDB.FFI_Safe_duckdb_create_time_ns@
+hs_bindgen_1e13f4e1b882a94b ::
+     BG.Ptr DuckDBTimeNs
+  -> IO DuckDBValue
+hs_bindgen_1e13f4e1b882a94b =
+  \x0 ->
+    fmap BG.fromFFIType (hs_bindgen_1e13f4e1b882a94b_base (BG.toFFIType x0))
+
+{-| Creates a value from a time_ns
+
+    history:
+
+    * unstable: v1.4.0
+
+    * stable: v1.5.6
+
+    [__@input@__]: The time value
+
+    __Returns:__ t'DuckDBValue'
+
+    __C declaration:__ @duckdb_create_time_ns@
+
+    __defined at:__ @duckdb.h 8743:27@
+
+    __exported by:__ @duckdb.h@
+-}
+c_duckdb_create_time_ns ::
+     DuckDBTimeNs
+     {- ^
+
+          [__@input@__]: The time value
+
+          __C declaration:__ @input@
+     -}
+  -> IO DuckDBValue
+c_duckdb_create_time_ns =
+  \input0 ->
+    BG.with input0 (\input1 ->
+                      hs_bindgen_1e13f4e1b882a94b input1)
+
+-- __unique:__ @Database_DuckDB_FFI_Database.DuckDB.FFI_Safe_duckdb_create_time_tz_value@
+foreign import ccall safe "hs_bindgen_23c57f1e364c528f" hs_bindgen_23c57f1e364c528f_base ::
+     BG.Ptr BG.Void
+  -> IO (BG.Ptr BG.Void)
+
+-- __unique:__ @Database_DuckDB_FFI_Database.DuckDB.FFI_Safe_duckdb_create_time_tz_value@
+hs_bindgen_23c57f1e364c528f ::
+     BG.Ptr DuckDBTimeTz
+  -> IO DuckDBValue
+hs_bindgen_23c57f1e364c528f =
+  \x0 ->
+    fmap BG.fromFFIType (hs_bindgen_23c57f1e364c528f_base (BG.toFFIType x0))
+
+{-| Creates a value from a time_tz. Not to be confused with @'c_duckdb_create_time_tz'@ , which creates a duckdb_time_tz_t.
+
+    history:
+
+    * stable: v1.1.0
+
+    [__@value@__]: The time_tz value
+
+    __Returns:__ t'DuckDBValue'
+
+    __C declaration:__ @duckdb_create_time_tz_value@
+
+    __defined at:__ @duckdb.h 8756:27@
+
+    __exported by:__ @duckdb.h@
+-}
+c_duckdb_create_time_tz_value ::
+     DuckDBTimeTz
+     {- ^
+
+          [__@value@__]: The time_tz value
+
+          __C declaration:__ @value@
+     -}
+  -> IO DuckDBValue
+c_duckdb_create_time_tz_value =
+  \value0 ->
+    BG.with value0 (\value1 ->
+                      hs_bindgen_23c57f1e364c528f value1)
+
+-- __unique:__ @Database_DuckDB_FFI_Database.DuckDB.FFI_Safe_duckdb_create_timestamp@
+foreign import ccall safe "hs_bindgen_931d2c720adf9f32" hs_bindgen_931d2c720adf9f32_base ::
+     BG.Ptr BG.Void
+  -> IO (BG.Ptr BG.Void)
+
+-- __unique:__ @Database_DuckDB_FFI_Database.DuckDB.FFI_Safe_duckdb_create_timestamp@
+hs_bindgen_931d2c720adf9f32 ::
+     BG.Ptr DuckDBTimestamp
+  -> IO DuckDBValue
+hs_bindgen_931d2c720adf9f32 =
+  \x0 ->
+    fmap BG.fromFFIType (hs_bindgen_931d2c720adf9f32_base (BG.toFFIType x0))
+
+{-|
+
+    Creates a TIMESTAMP value from a t'DuckDBTimestamp'
+
+    history:
+
+    * stable: v1.1.0
+
+    [__@input@__]: The t'DuckDBTimestamp' value
+
+    __Returns:__ t'DuckDBValue'
+
+    __C declaration:__ @duckdb_create_timestamp@
+
+    __defined at:__ @duckdb.h 8769:27@
+
+    __exported by:__ @duckdb.h@
+-}
+c_duckdb_create_timestamp ::
+     DuckDBTimestamp
+     {- ^
+
+          [__@input@__]: The t'DuckDBTimestamp' value
+
+          __C declaration:__ @input@
+     -}
+  -> IO DuckDBValue
+c_duckdb_create_timestamp =
+  \input0 ->
+    BG.with input0 (\input1 ->
+                      hs_bindgen_931d2c720adf9f32 input1)
+
+-- __unique:__ @Database_DuckDB_FFI_Database.DuckDB.FFI_Safe_duckdb_create_timestamp_tz@
+foreign import ccall safe "hs_bindgen_4bf48d5c47b0fd30" hs_bindgen_4bf48d5c47b0fd30_base ::
+     BG.Ptr BG.Void
+  -> IO (BG.Ptr BG.Void)
+
+-- __unique:__ @Database_DuckDB_FFI_Database.DuckDB.FFI_Safe_duckdb_create_timestamp_tz@
+hs_bindgen_4bf48d5c47b0fd30 ::
+     BG.Ptr DuckDBTimestamp
+  -> IO DuckDBValue
+hs_bindgen_4bf48d5c47b0fd30 =
+  \x0 ->
+    fmap BG.fromFFIType (hs_bindgen_4bf48d5c47b0fd30_base (BG.toFFIType x0))
+
+{-|
+
+    Creates a TIMESTAMP_TZ value from a t'DuckDBTimestamp'
+
+    history:
+
+    * stable: v1.2.0
+
+    [__@input@__]: The t'DuckDBTimestamp' value
+
+    __Returns:__ t'DuckDBValue'
+
+    __C declaration:__ @duckdb_create_timestamp_tz@
+
+    __defined at:__ @duckdb.h 8782:27@
+
+    __exported by:__ @duckdb.h@
+-}
+c_duckdb_create_timestamp_tz ::
+     DuckDBTimestamp
+     {- ^
+
+          [__@input@__]: The t'DuckDBTimestamp' value
+
+          __C declaration:__ @input@
+     -}
+  -> IO DuckDBValue
+c_duckdb_create_timestamp_tz =
+  \input0 ->
+    BG.with input0 (\input1 ->
+                      hs_bindgen_4bf48d5c47b0fd30 input1)
+
+-- __unique:__ @Database_DuckDB_FFI_Database.DuckDB.FFI_Safe_duckdb_create_timestamp_tz_ns@
+foreign import ccall safe "hs_bindgen_1fd8ec4cc5b7dd6c" hs_bindgen_1fd8ec4cc5b7dd6c_base ::
+     BG.Ptr BG.Void
+  -> IO (BG.Ptr BG.Void)
+
+-- __unique:__ @Database_DuckDB_FFI_Database.DuckDB.FFI_Safe_duckdb_create_timestamp_tz_ns@
+hs_bindgen_1fd8ec4cc5b7dd6c ::
+     BG.Ptr DuckDBTimestampNs
+  -> IO DuckDBValue
+hs_bindgen_1fd8ec4cc5b7dd6c =
+  \x0 ->
+    fmap BG.fromFFIType (hs_bindgen_1fd8ec4cc5b7dd6c_base (BG.toFFIType x0))
+
+{-|
+
+    Creates a TIMESTAMP_TZ_NS value from a t'DuckDBTimestampNs'
+
+    history:
+
+    * unstable: v1.5.4
+
+    * stable: v1.5.6
+
+    [__@input@__]: The t'DuckDBTimestampNs' value
+
+    __Returns:__ t'DuckDBValue'
+
+    __C declaration:__ @duckdb_create_timestamp_tz_ns@
+
+    __defined at:__ @duckdb.h 8796:27@
+
+    __exported by:__ @duckdb.h@
+-}
+c_duckdb_create_timestamp_tz_ns ::
+     DuckDBTimestampNs
+     {- ^
+
+          [__@input@__]: The t'DuckDBTimestampNs' value
+
+          __C declaration:__ @input@
+     -}
+  -> IO DuckDBValue
+c_duckdb_create_timestamp_tz_ns =
+  \input0 ->
+    BG.with input0 (\input1 ->
+                      hs_bindgen_1fd8ec4cc5b7dd6c input1)
+
+-- __unique:__ @Database_DuckDB_FFI_Database.DuckDB.FFI_Safe_duckdb_create_timestamp_s@
+foreign import ccall safe "hs_bindgen_839b89f0c97b4b9c" hs_bindgen_839b89f0c97b4b9c_base ::
+     BG.Ptr BG.Void
+  -> IO (BG.Ptr BG.Void)
+
+-- __unique:__ @Database_DuckDB_FFI_Database.DuckDB.FFI_Safe_duckdb_create_timestamp_s@
+hs_bindgen_839b89f0c97b4b9c ::
+     BG.Ptr DuckDBTimestampS
+  -> IO DuckDBValue
+hs_bindgen_839b89f0c97b4b9c =
+  \x0 ->
+    fmap BG.fromFFIType (hs_bindgen_839b89f0c97b4b9c_base (BG.toFFIType x0))
+
+{-|
+
+    Creates a TIMESTAMP_S value from a t'DuckDBTimestampS'
+
+    history:
+
+    * stable: v1.2.0
+
+    [__@input@__]: The t'DuckDBTimestampS' value
+
+    __Returns:__ t'DuckDBValue'
+
+    __C declaration:__ @duckdb_create_timestamp_s@
+
+    __defined at:__ @duckdb.h 8809:27@
+
+    __exported by:__ @duckdb.h@
+-}
+c_duckdb_create_timestamp_s ::
+     DuckDBTimestampS
+     {- ^
+
+          [__@input@__]: The t'DuckDBTimestampS' value
+
+          __C declaration:__ @input@
+     -}
+  -> IO DuckDBValue
+c_duckdb_create_timestamp_s =
+  \input0 ->
+    BG.with input0 (\input1 ->
+                      hs_bindgen_839b89f0c97b4b9c input1)
+
+-- __unique:__ @Database_DuckDB_FFI_Database.DuckDB.FFI_Safe_duckdb_create_timestamp_ms@
+foreign import ccall safe "hs_bindgen_6976ceed86104904" hs_bindgen_6976ceed86104904_base ::
+     BG.Ptr BG.Void
+  -> IO (BG.Ptr BG.Void)
+
+-- __unique:__ @Database_DuckDB_FFI_Database.DuckDB.FFI_Safe_duckdb_create_timestamp_ms@
+hs_bindgen_6976ceed86104904 ::
+     BG.Ptr DuckDBTimestampMs
+  -> IO DuckDBValue
+hs_bindgen_6976ceed86104904 =
+  \x0 ->
+    fmap BG.fromFFIType (hs_bindgen_6976ceed86104904_base (BG.toFFIType x0))
+
+{-|
+
+    Creates a TIMESTAMP_MS value from a t'DuckDBTimestampMs'
+
+    history:
+
+    * stable: v1.2.0
+
+    [__@input@__]: The t'DuckDBTimestampMs' value
+
+    __Returns:__ t'DuckDBValue'
+
+    __C declaration:__ @duckdb_create_timestamp_ms@
+
+    __defined at:__ @duckdb.h 8822:27@
+
+    __exported by:__ @duckdb.h@
+-}
+c_duckdb_create_timestamp_ms ::
+     DuckDBTimestampMs
+     {- ^
+
+          [__@input@__]: The t'DuckDBTimestampMs' value
+
+          __C declaration:__ @input@
+     -}
+  -> IO DuckDBValue
+c_duckdb_create_timestamp_ms =
+  \input0 ->
+    BG.with input0 (\input1 ->
+                      hs_bindgen_6976ceed86104904 input1)
+
+-- __unique:__ @Database_DuckDB_FFI_Database.DuckDB.FFI_Safe_duckdb_create_timestamp_ns@
+foreign import ccall safe "hs_bindgen_60490049e30ac729" hs_bindgen_60490049e30ac729_base ::
+     BG.Ptr BG.Void
+  -> IO (BG.Ptr BG.Void)
+
+-- __unique:__ @Database_DuckDB_FFI_Database.DuckDB.FFI_Safe_duckdb_create_timestamp_ns@
+hs_bindgen_60490049e30ac729 ::
+     BG.Ptr DuckDBTimestampNs
+  -> IO DuckDBValue
+hs_bindgen_60490049e30ac729 =
+  \x0 ->
+    fmap BG.fromFFIType (hs_bindgen_60490049e30ac729_base (BG.toFFIType x0))
+
+{-|
+
+    Creates a TIMESTAMP_NS value from a t'DuckDBTimestampNs'
+
+    history:
+
+    * stable: v1.2.0
+
+    [__@input@__]: The t'DuckDBTimestampNs' value
+
+    __Returns:__ t'DuckDBValue'
+
+    __C declaration:__ @duckdb_create_timestamp_ns@
+
+    __defined at:__ @duckdb.h 8835:27@
+
+    __exported by:__ @duckdb.h@
+-}
+c_duckdb_create_timestamp_ns ::
+     DuckDBTimestampNs
+     {- ^
+
+          [__@input@__]: The t'DuckDBTimestampNs' value
+
+          __C declaration:__ @input@
+     -}
+  -> IO DuckDBValue
+c_duckdb_create_timestamp_ns =
+  \input0 ->
+    BG.with input0 (\input1 ->
+                      hs_bindgen_60490049e30ac729 input1)
+
+-- __unique:__ @Database_DuckDB_FFI_Database.DuckDB.FFI_Safe_duckdb_create_interval@
+foreign import ccall safe "hs_bindgen_83efabe4062e8681" hs_bindgen_83efabe4062e8681_base ::
+     BG.Ptr BG.Void
+  -> IO (BG.Ptr BG.Void)
+
+-- __unique:__ @Database_DuckDB_FFI_Database.DuckDB.FFI_Safe_duckdb_create_interval@
+hs_bindgen_83efabe4062e8681 ::
+     BG.Ptr DuckDBInterval
+  -> IO DuckDBValue
+hs_bindgen_83efabe4062e8681 =
+  \x0 ->
+    fmap BG.fromFFIType (hs_bindgen_83efabe4062e8681_base (BG.toFFIType x0))
+
+{-| Creates a value from an interval
+
+    history:
+
+    * stable: v1.1.0
+
+    [__@input@__]: The interval value
+
+    __Returns:__ t'DuckDBValue'
+
+    __C declaration:__ @duckdb_create_interval@
+
+    __defined at:__ @duckdb.h 8848:27@
+
+    __exported by:__ @duckdb.h@
+-}
+c_duckdb_create_interval ::
+     DuckDBInterval
+     {- ^
+
+          [__@input@__]: The interval value
+
+          __C declaration:__ @input@
+     -}
+  -> IO DuckDBValue
+c_duckdb_create_interval =
+  \input0 ->
+    BG.with input0 (\input1 ->
+                      hs_bindgen_83efabe4062e8681 input1)
+
+-- __unique:__ @Database_DuckDB_FFI_Database.DuckDB.FFI_Safe_duckdb_create_blob@
+foreign import ccall safe "hs_bindgen_cf735e94c5bac60d" hs_bindgen_cf735e94c5bac60d_base ::
+     BG.Ptr BG.Void
+  -> HsBindgen.Runtime.LibC.Word64
+  -> IO (BG.Ptr BG.Void)
+
+-- __unique:__ @Database_DuckDB_FFI_Database.DuckDB.FFI_Safe_duckdb_create_blob@
+hs_bindgen_cf735e94c5bac60d ::
+     PtrConst.PtrConst HsBindgen.Runtime.LibC.Word8
+  -> DuckDBIdx
+  -> IO DuckDBValue
+hs_bindgen_cf735e94c5bac60d =
+  \x0 ->
+    \x1 ->
+      fmap BG.fromFFIType (hs_bindgen_cf735e94c5bac60d_base (BG.toFFIType x0) (BG.toFFIType x1))
+
+{-| Creates a value from a blob
+
+    history:
+
+    * stable: v1.1.0
+
+    [__@data@__]: The blob data
+
+    [__@length@__]: The length of the blob data
+
+    __Returns:__ t'DuckDBValue'
+
+    __C declaration:__ @duckdb_create_blob@
+
+    __defined at:__ @duckdb.h 8862:27@
+
+    __exported by:__ @duckdb.h@
+-}
+c_duckdb_create_blob ::
+     PtrConst.PtrConst HsBindgen.Runtime.LibC.Word8
+     {- ^
+
+          [__@data@__]: The blob data
+
+          __C declaration:__ @data@
+     -}
+  -> DuckDBIdx
+     {- ^
+
+          [__@length@__]: The length of the blob data
+
+          __C declaration:__ @length@
+     -}
+  -> IO DuckDBValue
+c_duckdb_create_blob = hs_bindgen_cf735e94c5bac60d
+
+-- __unique:__ @Database_DuckDB_FFI_Database.DuckDB.FFI_Safe_duckdb_create_bit@
+foreign import ccall safe "hs_bindgen_c7b4b1a06cda2f10" hs_bindgen_c7b4b1a06cda2f10_base ::
+     BG.Ptr BG.Void
+  -> IO (BG.Ptr BG.Void)
+
+-- __unique:__ @Database_DuckDB_FFI_Database.DuckDB.FFI_Safe_duckdb_create_bit@
+hs_bindgen_c7b4b1a06cda2f10 ::
+     BG.Ptr DuckDBBit
+  -> IO DuckDBValue
+hs_bindgen_c7b4b1a06cda2f10 =
+  \x0 ->
+    fmap BG.fromFFIType (hs_bindgen_c7b4b1a06cda2f10_base (BG.toFFIType x0))
+
+{-|
+
+    Creates a BIT value from a t'DuckDBBit'
+
+    history:
+
+    * stable: v1.2.0
+
+    [__@input@__]: The t'DuckDBBit' value
+
+    __Returns:__ t'DuckDBValue'
+
+    __C declaration:__ @duckdb_create_bit@
+
+    __defined at:__ @duckdb.h 8875:27@
+
+    __exported by:__ @duckdb.h@
+-}
+c_duckdb_create_bit ::
+     DuckDBBit
+     {- ^
+
+          [__@input@__]: The t'DuckDBBit' value
+
+          __C declaration:__ @input@
+     -}
+  -> IO DuckDBValue
+c_duckdb_create_bit =
+  \input0 ->
+    BG.with input0 (\input1 ->
+                      hs_bindgen_c7b4b1a06cda2f10 input1)
+
+-- __unique:__ @Database_DuckDB_FFI_Database.DuckDB.FFI_Safe_duckdb_create_uuid@
+foreign import ccall safe "hs_bindgen_b9b73a0a629f9c40" hs_bindgen_b9b73a0a629f9c40_base ::
+     BG.Ptr BG.Void
+  -> IO (BG.Ptr BG.Void)
+
+-- __unique:__ @Database_DuckDB_FFI_Database.DuckDB.FFI_Safe_duckdb_create_uuid@
+hs_bindgen_b9b73a0a629f9c40 ::
+     BG.Ptr DuckDBUHugeInt
+  -> IO DuckDBValue
+hs_bindgen_b9b73a0a629f9c40 =
+  \x0 ->
+    fmap BG.fromFFIType (hs_bindgen_b9b73a0a629f9c40_base (BG.toFFIType x0))
+
+{-| Creates a UUID value from a uhugeint
+
+    history:
+
+    * stable: v1.2.0
+
+    [__@input@__]: The t'DuckDBUHugeInt' containing the UUID
+
+    __Returns:__ t'DuckDBValue'
+
+    __C declaration:__ @duckdb_create_uuid@
+
+    __defined at:__ @duckdb.h 8888:27@
+
+    __exported by:__ @duckdb.h@
+-}
+c_duckdb_create_uuid ::
+     DuckDBUHugeInt
+     {- ^
+
+          [__@input@__]: The t'DuckDBUHugeInt' containing the UUID
+
+          __C declaration:__ @input@
+     -}
+  -> IO DuckDBValue
+c_duckdb_create_uuid =
+  \input0 ->
+    BG.with input0 (\input1 ->
+                      hs_bindgen_b9b73a0a629f9c40 input1)
+
+-- __unique:__ @Database_DuckDB_FFI_Database.DuckDB.FFI_Safe_duckdb_get_bool@
+foreign import ccall safe "hs_bindgen_8daa08114c4aa357" hs_bindgen_8daa08114c4aa357_base ::
+     BG.Ptr BG.Void
+  -> IO BG.CBool
+
+-- __unique:__ @Database_DuckDB_FFI_Database.DuckDB.FFI_Safe_duckdb_get_bool@
+hs_bindgen_8daa08114c4aa357 ::
+     DuckDBValue
+  -> IO BG.CBool
+hs_bindgen_8daa08114c4aa357 =
+  \x0 ->
+    fmap BG.fromFFIType (hs_bindgen_8daa08114c4aa357_base (BG.toFFIType x0))
+
+{-| Returns the boolean value of the given value.
+
+    history:
+
+    * stable: v1.1.0
+
+    [__@val@__]: A t'DuckDBValue' containing a boolean
+
+    __Returns:__ bool
+
+    __C declaration:__ @duckdb_get_bool@
+
+    __defined at:__ @duckdb.h 8901:19@
+
+    __exported by:__ @duckdb.h@
+-}
+c_duckdb_get_bool ::
+     DuckDBValue
+     {- ^
+
+          [__@val@__]: A t'DuckDBValue' containing a boolean
+
+          __C declaration:__ @val@
+     -}
+  -> IO BG.CBool
+c_duckdb_get_bool = hs_bindgen_8daa08114c4aa357
+
+-- __unique:__ @Database_DuckDB_FFI_Database.DuckDB.FFI_Safe_duckdb_get_int8@
+foreign import ccall safe "hs_bindgen_8635bf99c840171b" hs_bindgen_8635bf99c840171b_base ::
+     BG.Ptr BG.Void
+  -> IO HsBindgen.Runtime.LibC.Int8
+
+-- __unique:__ @Database_DuckDB_FFI_Database.DuckDB.FFI_Safe_duckdb_get_int8@
+hs_bindgen_8635bf99c840171b ::
+     DuckDBValue
+  -> IO HsBindgen.Runtime.LibC.Int8
+hs_bindgen_8635bf99c840171b =
+  \x0 ->
+    fmap BG.fromFFIType (hs_bindgen_8635bf99c840171b_base (BG.toFFIType x0))
+
+{-| Returns the int8_t value of the given value.
+
+    history:
+
+    * stable: v1.1.0
+
+    [__@val@__]: A t'DuckDBValue' containing a tinyint
+
+    __Returns:__ int8_t
+
+    __C declaration:__ @duckdb_get_int8@
+
+    __defined at:__ @duckdb.h 8914:21@
+
+    __exported by:__ @duckdb.h@
+-}
+c_duckdb_get_int8 ::
+     DuckDBValue
+     {- ^
+
+          [__@val@__]: A t'DuckDBValue' containing a tinyint
+
+          __C declaration:__ @val@
+     -}
+  -> IO HsBindgen.Runtime.LibC.Int8
+c_duckdb_get_int8 = hs_bindgen_8635bf99c840171b
+
+-- __unique:__ @Database_DuckDB_FFI_Database.DuckDB.FFI_Safe_duckdb_get_uint8@
+foreign import ccall safe "hs_bindgen_9bcba9c2ddd830e0" hs_bindgen_9bcba9c2ddd830e0_base ::
+     BG.Ptr BG.Void
+  -> IO HsBindgen.Runtime.LibC.Word8
+
+-- __unique:__ @Database_DuckDB_FFI_Database.DuckDB.FFI_Safe_duckdb_get_uint8@
+hs_bindgen_9bcba9c2ddd830e0 ::
+     DuckDBValue
+  -> IO HsBindgen.Runtime.LibC.Word8
+hs_bindgen_9bcba9c2ddd830e0 =
+  \x0 ->
+    fmap BG.fromFFIType (hs_bindgen_9bcba9c2ddd830e0_base (BG.toFFIType x0))
+
+{-| Returns the uint8_t value of the given value.
+
+    history:
+
+    * stable: v1.1.0
+
+    [__@val@__]: A t'DuckDBValue' containing a utinyint
+
+    __Returns:__ uint8_t
+
+    __C declaration:__ @duckdb_get_uint8@
+
+    __defined at:__ @duckdb.h 8927:22@
+
+    __exported by:__ @duckdb.h@
+-}
+c_duckdb_get_uint8 ::
+     DuckDBValue
+     {- ^
+
+          [__@val@__]: A t'DuckDBValue' containing a utinyint
+
+          __C declaration:__ @val@
+     -}
+  -> IO HsBindgen.Runtime.LibC.Word8
+c_duckdb_get_uint8 = hs_bindgen_9bcba9c2ddd830e0
+
+-- __unique:__ @Database_DuckDB_FFI_Database.DuckDB.FFI_Safe_duckdb_get_int16@
+foreign import ccall safe "hs_bindgen_c63af2c95b187ed9" hs_bindgen_c63af2c95b187ed9_base ::
+     BG.Ptr BG.Void
+  -> IO HsBindgen.Runtime.LibC.Int16
+
+-- __unique:__ @Database_DuckDB_FFI_Database.DuckDB.FFI_Safe_duckdb_get_int16@
+hs_bindgen_c63af2c95b187ed9 ::
+     DuckDBValue
+  -> IO HsBindgen.Runtime.LibC.Int16
+hs_bindgen_c63af2c95b187ed9 =
+  \x0 ->
+    fmap BG.fromFFIType (hs_bindgen_c63af2c95b187ed9_base (BG.toFFIType x0))
+
+{-| Returns the int16_t value of the given value.
+
+    history:
+
+    * stable: v1.1.0
+
+    [__@val@__]: A t'DuckDBValue' containing a smallint
+
+    __Returns:__ int16_t
+
+    __C declaration:__ @duckdb_get_int16@
+
+    __defined at:__ @duckdb.h 8940:22@
+
+    __exported by:__ @duckdb.h@
+-}
+c_duckdb_get_int16 ::
+     DuckDBValue
+     {- ^
+
+          [__@val@__]: A t'DuckDBValue' containing a smallint
+
+          __C declaration:__ @val@
+     -}
+  -> IO HsBindgen.Runtime.LibC.Int16
+c_duckdb_get_int16 = hs_bindgen_c63af2c95b187ed9
+
+-- __unique:__ @Database_DuckDB_FFI_Database.DuckDB.FFI_Safe_duckdb_get_uint16@
+foreign import ccall safe "hs_bindgen_b1dacf42f5095365" hs_bindgen_b1dacf42f5095365_base ::
+     BG.Ptr BG.Void
+  -> IO HsBindgen.Runtime.LibC.Word16
+
+-- __unique:__ @Database_DuckDB_FFI_Database.DuckDB.FFI_Safe_duckdb_get_uint16@
+hs_bindgen_b1dacf42f5095365 ::
+     DuckDBValue
+  -> IO HsBindgen.Runtime.LibC.Word16
+hs_bindgen_b1dacf42f5095365 =
+  \x0 ->
+    fmap BG.fromFFIType (hs_bindgen_b1dacf42f5095365_base (BG.toFFIType x0))
+
+{-| Returns the uint16_t value of the given value.
+
+    history:
+
+    * stable: v1.1.0
+
+    [__@val@__]: A t'DuckDBValue' containing a usmallint
+
+    __Returns:__ uint16_t
+
+    __C declaration:__ @duckdb_get_uint16@
+
+    __defined at:__ @duckdb.h 8953:23@
+
+    __exported by:__ @duckdb.h@
+-}
+c_duckdb_get_uint16 ::
+     DuckDBValue
+     {- ^
+
+          [__@val@__]: A t'DuckDBValue' containing a usmallint
+
+          __C declaration:__ @val@
+     -}
+  -> IO HsBindgen.Runtime.LibC.Word16
+c_duckdb_get_uint16 = hs_bindgen_b1dacf42f5095365
+
+-- __unique:__ @Database_DuckDB_FFI_Database.DuckDB.FFI_Safe_duckdb_get_int32@
+foreign import ccall safe "hs_bindgen_6340bd0360a949a3" hs_bindgen_6340bd0360a949a3_base ::
+     BG.Ptr BG.Void
+  -> IO HsBindgen.Runtime.LibC.Int32
+
+-- __unique:__ @Database_DuckDB_FFI_Database.DuckDB.FFI_Safe_duckdb_get_int32@
+hs_bindgen_6340bd0360a949a3 ::
+     DuckDBValue
+  -> IO HsBindgen.Runtime.LibC.Int32
+hs_bindgen_6340bd0360a949a3 =
+  \x0 ->
+    fmap BG.fromFFIType (hs_bindgen_6340bd0360a949a3_base (BG.toFFIType x0))
+
+{-| Returns the int32_t value of the given value.
+
+    history:
+
+    * stable: v1.1.0
+
+    [__@val@__]: A t'DuckDBValue' containing an integer
+
+    __Returns:__ int32_t
+
+    __C declaration:__ @duckdb_get_int32@
+
+    __defined at:__ @duckdb.h 8966:22@
+
+    __exported by:__ @duckdb.h@
+-}
+c_duckdb_get_int32 ::
+     DuckDBValue
+     {- ^
+
+          [__@val@__]: A t'DuckDBValue' containing an integer
+
+          __C declaration:__ @val@
+     -}
+  -> IO HsBindgen.Runtime.LibC.Int32
+c_duckdb_get_int32 = hs_bindgen_6340bd0360a949a3
+
+-- __unique:__ @Database_DuckDB_FFI_Database.DuckDB.FFI_Safe_duckdb_get_uint32@
+foreign import ccall safe "hs_bindgen_2da280f7709cce18" hs_bindgen_2da280f7709cce18_base ::
+     BG.Ptr BG.Void
+  -> IO HsBindgen.Runtime.LibC.Word32
+
+-- __unique:__ @Database_DuckDB_FFI_Database.DuckDB.FFI_Safe_duckdb_get_uint32@
+hs_bindgen_2da280f7709cce18 ::
+     DuckDBValue
+  -> IO HsBindgen.Runtime.LibC.Word32
+hs_bindgen_2da280f7709cce18 =
+  \x0 ->
+    fmap BG.fromFFIType (hs_bindgen_2da280f7709cce18_base (BG.toFFIType x0))
+
+{-| Returns the uint32_t value of the given value.
+
+    history:
+
+    * stable: v1.1.0
+
+    [__@val@__]: A t'DuckDBValue' containing a uinteger
+
+    __Returns:__ uint32_t
+
+    __C declaration:__ @duckdb_get_uint32@
+
+    __defined at:__ @duckdb.h 8979:23@
+
+    __exported by:__ @duckdb.h@
+-}
+c_duckdb_get_uint32 ::
+     DuckDBValue
+     {- ^
+
+          [__@val@__]: A t'DuckDBValue' containing a uinteger
+
+          __C declaration:__ @val@
+     -}
+  -> IO HsBindgen.Runtime.LibC.Word32
+c_duckdb_get_uint32 = hs_bindgen_2da280f7709cce18
+
+-- __unique:__ @Database_DuckDB_FFI_Database.DuckDB.FFI_Safe_duckdb_get_int64@
+foreign import ccall safe "hs_bindgen_c2dd8141b4a3022f" hs_bindgen_c2dd8141b4a3022f_base ::
+     BG.Ptr BG.Void
+  -> IO HsBindgen.Runtime.LibC.Int64
+
+-- __unique:__ @Database_DuckDB_FFI_Database.DuckDB.FFI_Safe_duckdb_get_int64@
+hs_bindgen_c2dd8141b4a3022f ::
+     DuckDBValue
+  -> IO HsBindgen.Runtime.LibC.Int64
+hs_bindgen_c2dd8141b4a3022f =
+  \x0 ->
+    fmap BG.fromFFIType (hs_bindgen_c2dd8141b4a3022f_base (BG.toFFIType x0))
+
+{-| Returns the int64_t value of the given value.
+
+    history:
+
+    * stable: v0.3.3
+
+    [__@val@__]: A t'DuckDBValue' containing a bigint
+
+    __Returns:__ int64_t
+
+    __C declaration:__ @duckdb_get_int64@
+
+    __defined at:__ @duckdb.h 8992:22@
+
+    __exported by:__ @duckdb.h@
+-}
+c_duckdb_get_int64 ::
+     DuckDBValue
+     {- ^
+
+          [__@val@__]: A t'DuckDBValue' containing a bigint
+
+          __C declaration:__ @val@
+     -}
+  -> IO HsBindgen.Runtime.LibC.Int64
+c_duckdb_get_int64 = hs_bindgen_c2dd8141b4a3022f
+
+-- __unique:__ @Database_DuckDB_FFI_Database.DuckDB.FFI_Safe_duckdb_get_uint64@
+foreign import ccall safe "hs_bindgen_6a3f2f6242c76931" hs_bindgen_6a3f2f6242c76931_base ::
+     BG.Ptr BG.Void
+  -> IO HsBindgen.Runtime.LibC.Word64
+
+-- __unique:__ @Database_DuckDB_FFI_Database.DuckDB.FFI_Safe_duckdb_get_uint64@
+hs_bindgen_6a3f2f6242c76931 ::
+     DuckDBValue
+  -> IO HsBindgen.Runtime.LibC.Word64
+hs_bindgen_6a3f2f6242c76931 =
+  \x0 ->
+    fmap BG.fromFFIType (hs_bindgen_6a3f2f6242c76931_base (BG.toFFIType x0))
+
+{-| Returns the uint64_t value of the given value.
+
+    history:
+
+    * stable: v1.1.0
+
+    [__@val@__]: A t'DuckDBValue' containing a ubigint
+
+    __Returns:__ uint64_t
+
+    __C declaration:__ @duckdb_get_uint64@
+
+    __defined at:__ @duckdb.h 9005:23@
+
+    __exported by:__ @duckdb.h@
+-}
+c_duckdb_get_uint64 ::
+     DuckDBValue
+     {- ^
+
+          [__@val@__]: A t'DuckDBValue' containing a ubigint
+
+          __C declaration:__ @val@
+     -}
+  -> IO HsBindgen.Runtime.LibC.Word64
+c_duckdb_get_uint64 = hs_bindgen_6a3f2f6242c76931
+
+-- __unique:__ @Database_DuckDB_FFI_Database.DuckDB.FFI_Safe_duckdb_get_hugeint@
+foreign import ccall safe "hs_bindgen_1c6181d93fbc8796" hs_bindgen_1c6181d93fbc8796_base ::
+     BG.Ptr BG.Void
+  -> BG.Ptr BG.Void
+  -> IO ()
+
+-- __unique:__ @Database_DuckDB_FFI_Database.DuckDB.FFI_Safe_duckdb_get_hugeint@
+hs_bindgen_1c6181d93fbc8796 ::
+     DuckDBValue
+  -> BG.Ptr DuckDBHugeInt
+  -> IO ()
+hs_bindgen_1c6181d93fbc8796 =
+  \x0 ->
+    \x1 ->
+      hs_bindgen_1c6181d93fbc8796_base (BG.toFFIType x0) (BG.toFFIType x1)
+
+{-| Returns the hugeint value of the given value.
+
+    history:
+
+    * stable: v1.1.0
+
+    [__@val@__]: A t'DuckDBValue' containing a hugeint
+
+    __Returns:__ t'DuckDBHugeInt'
+
+    __C declaration:__ @duckdb_get_hugeint@
+
+    __defined at:__ @duckdb.h 9018:29@
+
+    __exported by:__ @duckdb.h@
+-}
+c_duckdb_get_hugeint ::
+     DuckDBValue
+     {- ^
+
+          [__@val@__]: A t'DuckDBValue' containing a hugeint
+
+          __C declaration:__ @val@
+     -}
+  -> IO DuckDBHugeInt
+c_duckdb_get_hugeint =
+  \val0 ->
+    BG.allocaAndPeek (\res1 ->
+                        hs_bindgen_1c6181d93fbc8796 val0 res1)
+
+-- __unique:__ @Database_DuckDB_FFI_Database.DuckDB.FFI_Safe_duckdb_get_uhugeint@
+foreign import ccall safe "hs_bindgen_b5857fae8dc89273" hs_bindgen_b5857fae8dc89273_base ::
+     BG.Ptr BG.Void
+  -> BG.Ptr BG.Void
+  -> IO ()
+
+-- __unique:__ @Database_DuckDB_FFI_Database.DuckDB.FFI_Safe_duckdb_get_uhugeint@
+hs_bindgen_b5857fae8dc89273 ::
+     DuckDBValue
+  -> BG.Ptr DuckDBUHugeInt
+  -> IO ()
+hs_bindgen_b5857fae8dc89273 =
+  \x0 ->
+    \x1 ->
+      hs_bindgen_b5857fae8dc89273_base (BG.toFFIType x0) (BG.toFFIType x1)
+
+{-| Returns the uhugeint value of the given value.
+
+    history:
+
+    * stable: v1.1.0
+
+    [__@val@__]: A t'DuckDBValue' containing a uhugeint
+
+    __Returns:__ t'DuckDBUHugeInt'
+
+    __C declaration:__ @duckdb_get_uhugeint@
+
+    __defined at:__ @duckdb.h 9031:30@
+
+    __exported by:__ @duckdb.h@
+-}
+c_duckdb_get_uhugeint ::
+     DuckDBValue
+     {- ^
+
+          [__@val@__]: A t'DuckDBValue' containing a uhugeint
+
+          __C declaration:__ @val@
+     -}
+  -> IO DuckDBUHugeInt
+c_duckdb_get_uhugeint =
+  \val0 ->
+    BG.allocaAndPeek (\res1 ->
+                        hs_bindgen_b5857fae8dc89273 val0 res1)
+
+-- __unique:__ @Database_DuckDB_FFI_Database.DuckDB.FFI_Safe_duckdb_get_bignum@
+foreign import ccall safe "hs_bindgen_74fbc7e89c0460ed" hs_bindgen_74fbc7e89c0460ed_base ::
+     BG.Ptr BG.Void
+  -> BG.Ptr BG.Void
+  -> IO ()
+
+-- __unique:__ @Database_DuckDB_FFI_Database.DuckDB.FFI_Safe_duckdb_get_bignum@
+hs_bindgen_74fbc7e89c0460ed ::
+     DuckDBValue
+  -> BG.Ptr DuckDBBignum
+  -> IO ()
+hs_bindgen_74fbc7e89c0460ed =
+  \x0 ->
+    \x1 ->
+      hs_bindgen_74fbc7e89c0460ed_base (BG.toFFIType x0) (BG.toFFIType x1)
+
+{-|
+
+    Returns the t'DuckDBBignum' value of the given value. The @data@ field must be destroyed with @'c_duckdb_free'@ .
+
+    history:
+
+    * stable: v1.2.0
+
+    [__@val@__]: A t'DuckDBValue' containing a BIGNUM
+
+    __Returns:__ t'DuckDBBignum'
+
+    __C declaration:__ @duckdb_get_bignum@
+
+    __defined at:__ @duckdb.h 9044:28@
+
+    __exported by:__ @duckdb.h@
+-}
+c_duckdb_get_bignum ::
+     DuckDBValue
+     {- ^
+
+          [__@val@__]: A t'DuckDBValue' containing a BIGNUM
+
+          __C declaration:__ @val@
+     -}
+  -> IO DuckDBBignum
+c_duckdb_get_bignum =
+  \val0 ->
+    BG.allocaAndPeek (\res1 ->
+                        hs_bindgen_74fbc7e89c0460ed val0 res1)
+
+-- __unique:__ @Database_DuckDB_FFI_Database.DuckDB.FFI_Safe_duckdb_get_decimal@
+foreign import ccall safe "hs_bindgen_84e4f424589f16de" hs_bindgen_84e4f424589f16de_base ::
+     BG.Ptr BG.Void
+  -> BG.Ptr BG.Void
+  -> IO ()
+
+-- __unique:__ @Database_DuckDB_FFI_Database.DuckDB.FFI_Safe_duckdb_get_decimal@
+hs_bindgen_84e4f424589f16de ::
+     DuckDBValue
+  -> BG.Ptr DuckDBDecimal
+  -> IO ()
+hs_bindgen_84e4f424589f16de =
+  \x0 ->
+    \x1 ->
+      hs_bindgen_84e4f424589f16de_base (BG.toFFIType x0) (BG.toFFIType x1)
+
+{-|
+
+    Returns the t'DuckDBDecimal' value of the given value.
+
+    history:
+
+    * stable: v1.2.0
+
+    [__@val@__]: A t'DuckDBValue' containing a DECIMAL
+
+    __Returns:__ t'DuckDBDecimal'
+
+    __C declaration:__ @duckdb_get_decimal@
+
+    __defined at:__ @duckdb.h 9057:29@
+
+    __exported by:__ @duckdb.h@
+-}
+c_duckdb_get_decimal ::
+     DuckDBValue
+     {- ^
+
+          [__@val@__]: A t'DuckDBValue' containing a DECIMAL
+
+          __C declaration:__ @val@
+     -}
+  -> IO DuckDBDecimal
+c_duckdb_get_decimal =
+  \val0 ->
+    BG.allocaAndPeek (\res1 ->
+                        hs_bindgen_84e4f424589f16de val0 res1)
+
+-- __unique:__ @Database_DuckDB_FFI_Database.DuckDB.FFI_Safe_duckdb_get_float@
+foreign import ccall safe "hs_bindgen_615a351162dd38b0" hs_bindgen_615a351162dd38b0_base ::
+     BG.Ptr BG.Void
+  -> IO BG.CFloat
+
+-- __unique:__ @Database_DuckDB_FFI_Database.DuckDB.FFI_Safe_duckdb_get_float@
+hs_bindgen_615a351162dd38b0 ::
+     DuckDBValue
+  -> IO BG.CFloat
+hs_bindgen_615a351162dd38b0 =
+  \x0 ->
+    fmap BG.fromFFIType (hs_bindgen_615a351162dd38b0_base (BG.toFFIType x0))
+
+{-| Returns the float value of the given value.
+
+    history:
+
+    * stable: v1.1.0
+
+    [__@val@__]: A t'DuckDBValue' containing a float
+
+    __Returns:__ float
+
+    __C declaration:__ @duckdb_get_float@
+
+    __defined at:__ @duckdb.h 9070:20@
+
+    __exported by:__ @duckdb.h@
+-}
+c_duckdb_get_float ::
+     DuckDBValue
+     {- ^
+
+          [__@val@__]: A t'DuckDBValue' containing a float
+
+          __C declaration:__ @val@
+     -}
+  -> IO BG.CFloat
+c_duckdb_get_float = hs_bindgen_615a351162dd38b0
+
+-- __unique:__ @Database_DuckDB_FFI_Database.DuckDB.FFI_Safe_duckdb_get_double@
+foreign import ccall safe "hs_bindgen_3b54cae80b78d7a6" hs_bindgen_3b54cae80b78d7a6_base ::
+     BG.Ptr BG.Void
+  -> IO BG.CDouble
+
+-- __unique:__ @Database_DuckDB_FFI_Database.DuckDB.FFI_Safe_duckdb_get_double@
+hs_bindgen_3b54cae80b78d7a6 ::
+     DuckDBValue
+  -> IO BG.CDouble
+hs_bindgen_3b54cae80b78d7a6 =
+  \x0 ->
+    fmap BG.fromFFIType (hs_bindgen_3b54cae80b78d7a6_base (BG.toFFIType x0))
+
+{-| Returns the double value of the given value.
+
+    history:
+
+    * stable: v1.1.0
+
+    [__@val@__]: A t'DuckDBValue' containing a double
+
+    __Returns:__ double
+
+    __C declaration:__ @duckdb_get_double@
+
+    __defined at:__ @duckdb.h 9083:21@
+
+    __exported by:__ @duckdb.h@
+-}
+c_duckdb_get_double ::
+     DuckDBValue
+     {- ^
+
+          [__@val@__]: A t'DuckDBValue' containing a double
+
+          __C declaration:__ @val@
+     -}
+  -> IO BG.CDouble
+c_duckdb_get_double = hs_bindgen_3b54cae80b78d7a6
+
+-- __unique:__ @Database_DuckDB_FFI_Database.DuckDB.FFI_Safe_duckdb_get_date@
+foreign import ccall safe "hs_bindgen_022973e5005ce823" hs_bindgen_022973e5005ce823_base ::
+     BG.Ptr BG.Void
+  -> BG.Ptr BG.Void
+  -> IO ()
+
+-- __unique:__ @Database_DuckDB_FFI_Database.DuckDB.FFI_Safe_duckdb_get_date@
+hs_bindgen_022973e5005ce823 ::
+     DuckDBValue
+  -> BG.Ptr DuckDBDate
+  -> IO ()
+hs_bindgen_022973e5005ce823 =
+  \x0 ->
+    \x1 ->
+      hs_bindgen_022973e5005ce823_base (BG.toFFIType x0) (BG.toFFIType x1)
+
+{-| Returns the date value of the given value.
+
+    history:
+
+    * stable: v1.1.0
+
+    [__@val@__]: A t'DuckDBValue' containing a date
+
+    __Returns:__ t'DuckDBDate'
+
+    __C declaration:__ @duckdb_get_date@
+
+    __defined at:__ @duckdb.h 9096:26@
+
+    __exported by:__ @duckdb.h@
+-}
+c_duckdb_get_date ::
+     DuckDBValue
+     {- ^
+
+          [__@val@__]: A t'DuckDBValue' containing a date
+
+          __C declaration:__ @val@
+     -}
+  -> IO DuckDBDate
+c_duckdb_get_date =
+  \val0 ->
+    BG.allocaAndPeek (\res1 ->
+                        hs_bindgen_022973e5005ce823 val0 res1)
+
+-- __unique:__ @Database_DuckDB_FFI_Database.DuckDB.FFI_Safe_duckdb_get_time@
+foreign import ccall safe "hs_bindgen_d90d0681c12eaba7" hs_bindgen_d90d0681c12eaba7_base ::
+     BG.Ptr BG.Void
+  -> BG.Ptr BG.Void
+  -> IO ()
+
+-- __unique:__ @Database_DuckDB_FFI_Database.DuckDB.FFI_Safe_duckdb_get_time@
+hs_bindgen_d90d0681c12eaba7 ::
+     DuckDBValue
+  -> BG.Ptr DuckDBTime
+  -> IO ()
+hs_bindgen_d90d0681c12eaba7 =
+  \x0 ->
+    \x1 ->
+      hs_bindgen_d90d0681c12eaba7_base (BG.toFFIType x0) (BG.toFFIType x1)
+
+{-| Returns the time value of the given value.
+
+    history:
+
+    * stable: v1.1.0
+
+    [__@val@__]: A t'DuckDBValue' containing a time
+
+    __Returns:__ t'DuckDBTime'
+
+    __C declaration:__ @duckdb_get_time@
+
+    __defined at:__ @duckdb.h 9109:26@
+
+    __exported by:__ @duckdb.h@
+-}
+c_duckdb_get_time ::
+     DuckDBValue
+     {- ^
+
+          [__@val@__]: A t'DuckDBValue' containing a time
+
+          __C declaration:__ @val@
+     -}
+  -> IO DuckDBTime
+c_duckdb_get_time =
+  \val0 ->
+    BG.allocaAndPeek (\res1 ->
+                        hs_bindgen_d90d0681c12eaba7 val0 res1)
+
+-- __unique:__ @Database_DuckDB_FFI_Database.DuckDB.FFI_Safe_duckdb_get_time_ns@
+foreign import ccall safe "hs_bindgen_5e6ada8cebf82fef" hs_bindgen_5e6ada8cebf82fef_base ::
+     BG.Ptr BG.Void
+  -> BG.Ptr BG.Void
+  -> IO ()
+
+-- __unique:__ @Database_DuckDB_FFI_Database.DuckDB.FFI_Safe_duckdb_get_time_ns@
+hs_bindgen_5e6ada8cebf82fef ::
+     DuckDBValue
+  -> BG.Ptr DuckDBTimeNs
+  -> IO ()
+hs_bindgen_5e6ada8cebf82fef =
+  \x0 ->
+    \x1 ->
+      hs_bindgen_5e6ada8cebf82fef_base (BG.toFFIType x0) (BG.toFFIType x1)
+
+{-| Returns the time_ns value of the given value.
+
+    history:
+
+    * unstable: v1.4.0
+
+    * stable: v1.5.6
+
+    [__@val@__]: A t'DuckDBValue' containing a time_ns
+
+    __Returns:__ t'DuckDBTimeNs'
+
+    __C declaration:__ @duckdb_get_time_ns@
+
+    __defined at:__ @duckdb.h 9123:29@
+
+    __exported by:__ @duckdb.h@
+-}
+c_duckdb_get_time_ns ::
+     DuckDBValue
+     {- ^
+
+          [__@val@__]: A t'DuckDBValue' containing a time_ns
+
+          __C declaration:__ @val@
+     -}
+  -> IO DuckDBTimeNs
+c_duckdb_get_time_ns =
+  \val0 ->
+    BG.allocaAndPeek (\res1 ->
+                        hs_bindgen_5e6ada8cebf82fef val0 res1)
+
+-- __unique:__ @Database_DuckDB_FFI_Database.DuckDB.FFI_Safe_duckdb_get_time_tz@
+foreign import ccall safe "hs_bindgen_d756e565b6bce9f1" hs_bindgen_d756e565b6bce9f1_base ::
+     BG.Ptr BG.Void
+  -> BG.Ptr BG.Void
+  -> IO ()
+
+-- __unique:__ @Database_DuckDB_FFI_Database.DuckDB.FFI_Safe_duckdb_get_time_tz@
+hs_bindgen_d756e565b6bce9f1 ::
+     DuckDBValue
+  -> BG.Ptr DuckDBTimeTz
+  -> IO ()
+hs_bindgen_d756e565b6bce9f1 =
+  \x0 ->
+    \x1 ->
+      hs_bindgen_d756e565b6bce9f1_base (BG.toFFIType x0) (BG.toFFIType x1)
+
+{-| Returns the time_tz value of the given value.
+
+    history:
+
+    * stable: v1.1.0
+
+    [__@val@__]: A t'DuckDBValue' containing a time_tz
+
+    __Returns:__ t'DuckDBTimeTz'
+
+    __C declaration:__ @duckdb_get_time_tz@
+
+    __defined at:__ @duckdb.h 9136:29@
+
+    __exported by:__ @duckdb.h@
+-}
+c_duckdb_get_time_tz ::
+     DuckDBValue
+     {- ^
+
+          [__@val@__]: A t'DuckDBValue' containing a time_tz
+
+          __C declaration:__ @val@
+     -}
+  -> IO DuckDBTimeTz
+c_duckdb_get_time_tz =
+  \val0 ->
+    BG.allocaAndPeek (\res1 ->
+                        hs_bindgen_d756e565b6bce9f1 val0 res1)
+
+-- __unique:__ @Database_DuckDB_FFI_Database.DuckDB.FFI_Safe_duckdb_get_timestamp@
+foreign import ccall safe "hs_bindgen_d9df571bb20b335a" hs_bindgen_d9df571bb20b335a_base ::
+     BG.Ptr BG.Void
+  -> BG.Ptr BG.Void
+  -> IO ()
+
+-- __unique:__ @Database_DuckDB_FFI_Database.DuckDB.FFI_Safe_duckdb_get_timestamp@
+hs_bindgen_d9df571bb20b335a ::
+     DuckDBValue
+  -> BG.Ptr DuckDBTimestamp
+  -> IO ()
+hs_bindgen_d9df571bb20b335a =
+  \x0 ->
+    \x1 ->
+      hs_bindgen_d9df571bb20b335a_base (BG.toFFIType x0) (BG.toFFIType x1)
+
+{-| Returns the TIMESTAMP value of the given value.
+
+    history:
+
+    * stable: v1.1.0
+
+    [__@val@__]: A t'DuckDBValue' containing a TIMESTAMP
+
+    __Returns:__ t'DuckDBTimestamp'
+
+    __C declaration:__ @duckdb_get_timestamp@
+
+    __defined at:__ @duckdb.h 9149:31@
+
+    __exported by:__ @duckdb.h@
+-}
+c_duckdb_get_timestamp ::
+     DuckDBValue
+     {- ^
+
+          [__@val@__]: A t'DuckDBValue' containing a TIMESTAMP
+
+          __C declaration:__ @val@
+     -}
+  -> IO DuckDBTimestamp
+c_duckdb_get_timestamp =
+  \val0 ->
+    BG.allocaAndPeek (\res1 ->
+                        hs_bindgen_d9df571bb20b335a val0 res1)
+
+-- __unique:__ @Database_DuckDB_FFI_Database.DuckDB.FFI_Safe_duckdb_get_timestamp_tz@
+foreign import ccall safe "hs_bindgen_b755f602a03467f7" hs_bindgen_b755f602a03467f7_base ::
+     BG.Ptr BG.Void
+  -> BG.Ptr BG.Void
+  -> IO ()
+
+-- __unique:__ @Database_DuckDB_FFI_Database.DuckDB.FFI_Safe_duckdb_get_timestamp_tz@
+hs_bindgen_b755f602a03467f7 ::
+     DuckDBValue
+  -> BG.Ptr DuckDBTimestamp
+  -> IO ()
+hs_bindgen_b755f602a03467f7 =
+  \x0 ->
+    \x1 ->
+      hs_bindgen_b755f602a03467f7_base (BG.toFFIType x0) (BG.toFFIType x1)
+
+{-| Returns the TIMESTAMP_TZ value of the given value.
+
+    history:
+
+    * stable: v1.2.0
+
+    [__@val@__]: A t'DuckDBValue' containing a TIMESTAMP_TZ
+
+    __Returns:__ t'DuckDBTimestamp'
+
+    __C declaration:__ @duckdb_get_timestamp_tz@
+
+    __defined at:__ @duckdb.h 9162:31@
+
+    __exported by:__ @duckdb.h@
+-}
+c_duckdb_get_timestamp_tz ::
+     DuckDBValue
+     {- ^
+
+          [__@val@__]: A t'DuckDBValue' containing a TIMESTAMP_TZ
+
+          __C declaration:__ @val@
+     -}
+  -> IO DuckDBTimestamp
+c_duckdb_get_timestamp_tz =
+  \val0 ->
+    BG.allocaAndPeek (\res1 ->
+                        hs_bindgen_b755f602a03467f7 val0 res1)
+
+-- __unique:__ @Database_DuckDB_FFI_Database.DuckDB.FFI_Safe_duckdb_get_timestamp_tz_ns@
+foreign import ccall safe "hs_bindgen_c0cc85ed29a0cab5" hs_bindgen_c0cc85ed29a0cab5_base ::
+     BG.Ptr BG.Void
+  -> BG.Ptr BG.Void
+  -> IO ()
+
+-- __unique:__ @Database_DuckDB_FFI_Database.DuckDB.FFI_Safe_duckdb_get_timestamp_tz_ns@
+hs_bindgen_c0cc85ed29a0cab5 ::
+     DuckDBValue
+  -> BG.Ptr DuckDBTimestampNs
+  -> IO ()
+hs_bindgen_c0cc85ed29a0cab5 =
+  \x0 ->
+    \x1 ->
+      hs_bindgen_c0cc85ed29a0cab5_base (BG.toFFIType x0) (BG.toFFIType x1)
+
+{-| Returns the TIMESTAMP_TZ_NS value of the given value.
+
+    history:
+
+    * unstable: v1.5.4
+
+    * stable: v1.5.6
+
+    [__@val@__]: A t'DuckDBValue' containing a TIMESTAMP_TZ_NS
+
+    __Returns:__ t'DuckDBTimestampNs'
+
+    __C declaration:__ @duckdb_get_timestamp_tz_ns@
+
+    __defined at:__ @duckdb.h 9176:34@
+
+    __exported by:__ @duckdb.h@
+-}
+c_duckdb_get_timestamp_tz_ns ::
+     DuckDBValue
+     {- ^
+
+          [__@val@__]: A t'DuckDBValue' containing a TIMESTAMP_TZ_NS
+
+          __C declaration:__ @val@
+     -}
+  -> IO DuckDBTimestampNs
+c_duckdb_get_timestamp_tz_ns =
+  \val0 ->
+    BG.allocaAndPeek (\res1 ->
+                        hs_bindgen_c0cc85ed29a0cab5 val0 res1)
+
+-- __unique:__ @Database_DuckDB_FFI_Database.DuckDB.FFI_Safe_duckdb_get_timestamp_s@
+foreign import ccall safe "hs_bindgen_94661a923251c477" hs_bindgen_94661a923251c477_base ::
+     BG.Ptr BG.Void
+  -> BG.Ptr BG.Void
+  -> IO ()
+
+-- __unique:__ @Database_DuckDB_FFI_Database.DuckDB.FFI_Safe_duckdb_get_timestamp_s@
+hs_bindgen_94661a923251c477 ::
+     DuckDBValue
+  -> BG.Ptr DuckDBTimestampS
+  -> IO ()
+hs_bindgen_94661a923251c477 =
+  \x0 ->
+    \x1 ->
+      hs_bindgen_94661a923251c477_base (BG.toFFIType x0) (BG.toFFIType x1)
+
+{-|
+
+    Returns the t'DuckDBTimestampS' value of the given value.
+
+    history:
+
+    * stable: v1.2.0
+
+    [__@val@__]: A t'DuckDBValue' containing a TIMESTAMP_S
+
+    __Returns:__ t'DuckDBTimestampS'
+
+    __C declaration:__ @duckdb_get_timestamp_s@
+
+    __defined at:__ @duckdb.h 9189:33@
+
+    __exported by:__ @duckdb.h@
+-}
+c_duckdb_get_timestamp_s ::
+     DuckDBValue
+     {- ^
+
+          [__@val@__]: A t'DuckDBValue' containing a TIMESTAMP_S
+
+          __C declaration:__ @val@
+     -}
+  -> IO DuckDBTimestampS
+c_duckdb_get_timestamp_s =
+  \val0 ->
+    BG.allocaAndPeek (\res1 ->
+                        hs_bindgen_94661a923251c477 val0 res1)
+
+-- __unique:__ @Database_DuckDB_FFI_Database.DuckDB.FFI_Safe_duckdb_get_timestamp_ms@
+foreign import ccall safe "hs_bindgen_ef716f499f99907a" hs_bindgen_ef716f499f99907a_base ::
+     BG.Ptr BG.Void
+  -> BG.Ptr BG.Void
+  -> IO ()
+
+-- __unique:__ @Database_DuckDB_FFI_Database.DuckDB.FFI_Safe_duckdb_get_timestamp_ms@
+hs_bindgen_ef716f499f99907a ::
+     DuckDBValue
+  -> BG.Ptr DuckDBTimestampMs
+  -> IO ()
+hs_bindgen_ef716f499f99907a =
+  \x0 ->
+    \x1 ->
+      hs_bindgen_ef716f499f99907a_base (BG.toFFIType x0) (BG.toFFIType x1)
+
+{-|
+
+    Returns the t'DuckDBTimestampMs' value of the given value.
+
+    history:
+
+    * stable: v1.2.0
+
+    [__@val@__]: A t'DuckDBValue' containing a TIMESTAMP_MS
+
+    __Returns:__ t'DuckDBTimestampMs'
+
+    __C declaration:__ @duckdb_get_timestamp_ms@
+
+    __defined at:__ @duckdb.h 9202:34@
+
+    __exported by:__ @duckdb.h@
+-}
+c_duckdb_get_timestamp_ms ::
+     DuckDBValue
+     {- ^
+
+          [__@val@__]: A t'DuckDBValue' containing a TIMESTAMP_MS
+
+          __C declaration:__ @val@
+     -}
+  -> IO DuckDBTimestampMs
+c_duckdb_get_timestamp_ms =
+  \val0 ->
+    BG.allocaAndPeek (\res1 ->
+                        hs_bindgen_ef716f499f99907a val0 res1)
+
+-- __unique:__ @Database_DuckDB_FFI_Database.DuckDB.FFI_Safe_duckdb_get_timestamp_ns@
+foreign import ccall safe "hs_bindgen_7b25b0eed2d77001" hs_bindgen_7b25b0eed2d77001_base ::
+     BG.Ptr BG.Void
+  -> BG.Ptr BG.Void
+  -> IO ()
+
+-- __unique:__ @Database_DuckDB_FFI_Database.DuckDB.FFI_Safe_duckdb_get_timestamp_ns@
+hs_bindgen_7b25b0eed2d77001 ::
+     DuckDBValue
+  -> BG.Ptr DuckDBTimestampNs
+  -> IO ()
+hs_bindgen_7b25b0eed2d77001 =
+  \x0 ->
+    \x1 ->
+      hs_bindgen_7b25b0eed2d77001_base (BG.toFFIType x0) (BG.toFFIType x1)
+
+{-|
+
+    Returns the t'DuckDBTimestampNs' value of the given value.
+
+    history:
+
+    * stable: v1.2.0
+
+    [__@val@__]: A t'DuckDBValue' containing a TIMESTAMP_NS
+
+    __Returns:__ t'DuckDBTimestampNs'
+
+    __C declaration:__ @duckdb_get_timestamp_ns@
+
+    __defined at:__ @duckdb.h 9215:34@
+
+    __exported by:__ @duckdb.h@
+-}
+c_duckdb_get_timestamp_ns ::
+     DuckDBValue
+     {- ^
+
+          [__@val@__]: A t'DuckDBValue' containing a TIMESTAMP_NS
+
+          __C declaration:__ @val@
+     -}
+  -> IO DuckDBTimestampNs
+c_duckdb_get_timestamp_ns =
+  \val0 ->
+    BG.allocaAndPeek (\res1 ->
+                        hs_bindgen_7b25b0eed2d77001 val0 res1)
+
+-- __unique:__ @Database_DuckDB_FFI_Database.DuckDB.FFI_Safe_duckdb_get_interval@
+foreign import ccall safe "hs_bindgen_988b285b39137a9f" hs_bindgen_988b285b39137a9f_base ::
+     BG.Ptr BG.Void
+  -> BG.Ptr BG.Void
+  -> IO ()
+
+-- __unique:__ @Database_DuckDB_FFI_Database.DuckDB.FFI_Safe_duckdb_get_interval@
+hs_bindgen_988b285b39137a9f ::
+     DuckDBValue
+  -> BG.Ptr DuckDBInterval
+  -> IO ()
+hs_bindgen_988b285b39137a9f =
+  \x0 ->
+    \x1 ->
+      hs_bindgen_988b285b39137a9f_base (BG.toFFIType x0) (BG.toFFIType x1)
+
+{-| Returns the interval value of the given value.
+
+    history:
+
+    * stable: v1.1.0
+
+    [__@val@__]: A t'DuckDBValue' containing a interval
+
+    __Returns:__ t'DuckDBInterval'
+
+    __C declaration:__ @duckdb_get_interval@
+
+    __defined at:__ @duckdb.h 9228:30@
+
+    __exported by:__ @duckdb.h@
+-}
+c_duckdb_get_interval ::
+     DuckDBValue
+     {- ^
+
+          [__@val@__]: A t'DuckDBValue' containing a interval
+
+          __C declaration:__ @val@
+     -}
+  -> IO DuckDBInterval
+c_duckdb_get_interval =
+  \val0 ->
+    BG.allocaAndPeek (\res1 ->
+                        hs_bindgen_988b285b39137a9f val0 res1)
+
+-- __unique:__ @Database_DuckDB_FFI_Database.DuckDB.FFI_Safe_duckdb_get_value_type@
+foreign import ccall safe "hs_bindgen_068c34db6e614c9a" hs_bindgen_068c34db6e614c9a_base ::
+     BG.Ptr BG.Void
+  -> IO (BG.Ptr BG.Void)
+
+-- __unique:__ @Database_DuckDB_FFI_Database.DuckDB.FFI_Safe_duckdb_get_value_type@
+hs_bindgen_068c34db6e614c9a ::
+     DuckDBValue
+  -> IO DuckDBLogicalType
+hs_bindgen_068c34db6e614c9a =
+  \x0 ->
+    fmap BG.fromFFIType (hs_bindgen_068c34db6e614c9a_base (BG.toFFIType x0))
+
+{-| Returns the type of the given value. The type is valid as long as the value is not destroyed. The type itself must not be destroyed.
+
+    history:
+
+    * stable: v1.1.0
+
+    [__@val@__]: A t'DuckDBValue'
+
+    __Returns:__ t'DuckDBLogicalType'
+
+    __C declaration:__ @duckdb_get_value_type@
+
+    __defined at:__ @duckdb.h 9242:34@
+
+    __exported by:__ @duckdb.h@
+-}
+c_duckdb_get_value_type ::
+     DuckDBValue
+     {- ^
+
+          [__@val@__]: A t'DuckDBValue'
+
+          __C declaration:__ @val@
+     -}
+  -> IO DuckDBLogicalType
+c_duckdb_get_value_type = hs_bindgen_068c34db6e614c9a
+
+-- __unique:__ @Database_DuckDB_FFI_Database.DuckDB.FFI_Safe_duckdb_get_blob@
+foreign import ccall safe "hs_bindgen_26638b96308a8043" hs_bindgen_26638b96308a8043_base ::
+     BG.Ptr BG.Void
+  -> BG.Ptr BG.Void
+  -> IO ()
+
+-- __unique:__ @Database_DuckDB_FFI_Database.DuckDB.FFI_Safe_duckdb_get_blob@
+hs_bindgen_26638b96308a8043 ::
+     DuckDBValue
+  -> BG.Ptr DuckDBBlob
+  -> IO ()
+hs_bindgen_26638b96308a8043 =
+  \x0 ->
+    \x1 ->
+      hs_bindgen_26638b96308a8043_base (BG.toFFIType x0) (BG.toFFIType x1)
+
+{-| Returns the blob value of the given value.
+
+    history:
+
+    * stable: v1.1.0
+
+    [__@val@__]: A t'DuckDBValue' containing a blob
+
+    __Returns:__ t'DuckDBBlob'
+
+    __C declaration:__ @duckdb_get_blob@
+
+    __defined at:__ @duckdb.h 9255:26@
+
+    __exported by:__ @duckdb.h@
+-}
+c_duckdb_get_blob ::
+     DuckDBValue
+     {- ^
+
+          [__@val@__]: A t'DuckDBValue' containing a blob
+
+          __C declaration:__ @val@
+     -}
+  -> IO DuckDBBlob
+c_duckdb_get_blob =
+  \val0 ->
+    BG.allocaAndPeek (\res1 ->
+                        hs_bindgen_26638b96308a8043 val0 res1)
+
+-- __unique:__ @Database_DuckDB_FFI_Database.DuckDB.FFI_Safe_duckdb_get_bit@
+foreign import ccall safe "hs_bindgen_450ea2e919fd9d26" hs_bindgen_450ea2e919fd9d26_base ::
+     BG.Ptr BG.Void
+  -> BG.Ptr BG.Void
+  -> IO ()
+
+-- __unique:__ @Database_DuckDB_FFI_Database.DuckDB.FFI_Safe_duckdb_get_bit@
+hs_bindgen_450ea2e919fd9d26 ::
+     DuckDBValue
+  -> BG.Ptr DuckDBBit
+  -> IO ()
+hs_bindgen_450ea2e919fd9d26 =
+  \x0 ->
+    \x1 ->
+      hs_bindgen_450ea2e919fd9d26_base (BG.toFFIType x0) (BG.toFFIType x1)
+
+{-|
+
+    Returns the t'DuckDBBit' value of the given value. The @data@ field must be destroyed with @'c_duckdb_free'@ .
+
+    history:
+
+    * stable: v1.2.0
+
+    [__@val@__]: A t'DuckDBValue' containing a BIT
+
+    __Returns:__ t'DuckDBBit'
+
+    __C declaration:__ @duckdb_get_bit@
+
+    __defined at:__ @duckdb.h 9268:25@
+
+    __exported by:__ @duckdb.h@
+-}
+c_duckdb_get_bit ::
+     DuckDBValue
+     {- ^
+
+          [__@val@__]: A t'DuckDBValue' containing a BIT
+
+          __C declaration:__ @val@
+     -}
+  -> IO DuckDBBit
+c_duckdb_get_bit =
+  \val0 ->
+    BG.allocaAndPeek (\res1 ->
+                        hs_bindgen_450ea2e919fd9d26 val0 res1)
+
+-- __unique:__ @Database_DuckDB_FFI_Database.DuckDB.FFI_Safe_duckdb_get_uuid@
+foreign import ccall safe "hs_bindgen_4799e633564120e9" hs_bindgen_4799e633564120e9_base ::
+     BG.Ptr BG.Void
+  -> BG.Ptr BG.Void
+  -> IO ()
+
+-- __unique:__ @Database_DuckDB_FFI_Database.DuckDB.FFI_Safe_duckdb_get_uuid@
+hs_bindgen_4799e633564120e9 ::
+     DuckDBValue
+  -> BG.Ptr DuckDBUHugeInt
+  -> IO ()
+hs_bindgen_4799e633564120e9 =
+  \x0 ->
+    \x1 ->
+      hs_bindgen_4799e633564120e9_base (BG.toFFIType x0) (BG.toFFIType x1)
+
+{-|
+
+    Returns a t'DuckDBUHugeInt' representing the UUID value of the given value.
+
+    history:
+
+    * stable: v1.2.0
+
+    [__@val@__]: A t'DuckDBValue' containing a UUID
+
+    __Returns:__ t'DuckDBUHugeInt'
+
+    __C declaration:__ @duckdb_get_uuid@
+
+    __defined at:__ @duckdb.h 9281:30@
+
+    __exported by:__ @duckdb.h@
+-}
+c_duckdb_get_uuid ::
+     DuckDBValue
+     {- ^
+
+          [__@val@__]: A t'DuckDBValue' containing a UUID
+
+          __C declaration:__ @val@
+     -}
+  -> IO DuckDBUHugeInt
+c_duckdb_get_uuid =
+  \val0 ->
+    BG.allocaAndPeek (\res1 ->
+                        hs_bindgen_4799e633564120e9 val0 res1)
+
+-- __unique:__ @Database_DuckDB_FFI_Database.DuckDB.FFI_Safe_duckdb_get_varchar@
+foreign import ccall safe "hs_bindgen_06b79afac44ffc3b" hs_bindgen_06b79afac44ffc3b_base ::
+     BG.Ptr BG.Void
+  -> IO (BG.Ptr BG.Void)
+
+-- __unique:__ @Database_DuckDB_FFI_Database.DuckDB.FFI_Safe_duckdb_get_varchar@
+hs_bindgen_06b79afac44ffc3b ::
+     DuckDBValue
+  -> IO (BG.Ptr BG.CChar)
+hs_bindgen_06b79afac44ffc3b =
+  \x0 ->
+    fmap BG.fromFFIType (hs_bindgen_06b79afac44ffc3b_base (BG.toFFIType x0))
+
+{-| Obtains a string representation of the given value. The result must be destroyed with @'c_duckdb_free'@ .
+
+    history:
+
+    * stable: v0.3.3
+
+    [__@value@__]: The value
+
+    __Returns:__ char*
+
+    __C declaration:__ @duckdb_get_varchar@
+
+    __defined at:__ @duckdb.h 9294:20@
+
+    __exported by:__ @duckdb.h@
+-}
+c_duckdb_get_varchar ::
+     DuckDBValue
+     {- ^
+
+          [__@value@__]: The value
+
+          __C declaration:__ @value@
+     -}
+  -> IO (BG.Ptr BG.CChar)
+c_duckdb_get_varchar = hs_bindgen_06b79afac44ffc3b
+
+-- __unique:__ @Database_DuckDB_FFI_Database.DuckDB.FFI_Safe_duckdb_create_struct_value@
+foreign import ccall safe "hs_bindgen_95eb7d0f1c818e7b" hs_bindgen_95eb7d0f1c818e7b_base ::
+     BG.Ptr BG.Void
+  -> BG.Ptr BG.Void
+  -> IO (BG.Ptr BG.Void)
+
+-- __unique:__ @Database_DuckDB_FFI_Database.DuckDB.FFI_Safe_duckdb_create_struct_value@
+hs_bindgen_95eb7d0f1c818e7b ::
+     DuckDBLogicalType
+  -> BG.Ptr DuckDBValue
+  -> IO DuckDBValue
+hs_bindgen_95eb7d0f1c818e7b =
+  \x0 ->
+    \x1 ->
+      fmap BG.fromFFIType (hs_bindgen_95eb7d0f1c818e7b_base (BG.toFFIType x0) (BG.toFFIType x1))
+
+{-| Creates a struct value from a type and an array of values. Must be destroyed with @'c_duckdb_destroy_value'@ .
+
+    history:
+
+    * stable: v0.10.0
+
+    [__@type@__]: The type of the struct
+
+    [__@values@__]: The values for the struct fields
+
+    __Returns:__ t'DuckDBValue'
+
+    __C declaration:__ @duckdb_create_struct_value@
+
+    __defined at:__ @duckdb.h 9308:27@
+
+    __exported by:__ @duckdb.h@
+-}
+c_duckdb_create_struct_value ::
+     DuckDBLogicalType
+     {- ^
+
+          [__@type@__]: The type of the struct
+
+          __C declaration:__ @type@
+     -}
+  -> BG.Ptr DuckDBValue
+     {- ^
+
+          [__@values@__]: The values for the struct fields
+
+          __C declaration:__ @values@
+     -}
+  -> IO DuckDBValue
+c_duckdb_create_struct_value =
+  hs_bindgen_95eb7d0f1c818e7b
+
+-- __unique:__ @Database_DuckDB_FFI_Database.DuckDB.FFI_Safe_duckdb_create_list_value@
+foreign import ccall safe "hs_bindgen_8b254090503c2df0" hs_bindgen_8b254090503c2df0_base ::
+     BG.Ptr BG.Void
+  -> BG.Ptr BG.Void
+  -> HsBindgen.Runtime.LibC.Word64
+  -> IO (BG.Ptr BG.Void)
+
+-- __unique:__ @Database_DuckDB_FFI_Database.DuckDB.FFI_Safe_duckdb_create_list_value@
+hs_bindgen_8b254090503c2df0 ::
+     DuckDBLogicalType
+  -> BG.Ptr DuckDBValue
+  -> DuckDBIdx
+  -> IO DuckDBValue
+hs_bindgen_8b254090503c2df0 =
+  \x0 ->
+    \x1 ->
+      \x2 ->
+        fmap BG.fromFFIType (hs_bindgen_8b254090503c2df0_base (BG.toFFIType x0) (BG.toFFIType x1) (BG.toFFIType x2))
+
+{-| Creates a list value from a child (element) type and an array of values of length @value_count@ . Must be destroyed with @'c_duckdb_destroy_value'@ .
+
+    history:
+
+    * stable: v0.10.0
+
+    [__@type@__]: The type of the list
+
+    [__@values@__]: The values for the list
+
+    [__@value_count@__]: The number of values in the list
+
+    __Returns:__ t'DuckDBValue'
+
+    __C declaration:__ @duckdb_create_list_value@
+
+    __defined at:__ @duckdb.h 9324:27@
+
+    __exported by:__ @duckdb.h@
+-}
+c_duckdb_create_list_value ::
+     DuckDBLogicalType
+     {- ^
+
+          [__@type@__]: The type of the list
+
+          __C declaration:__ @type@
+     -}
+  -> BG.Ptr DuckDBValue
+     {- ^
+
+          [__@values@__]: The values for the list
+
+          __C declaration:__ @values@
+     -}
+  -> DuckDBIdx
+     {- ^
+
+          [__@value_count@__]: The number of values in the list
+
+          __C declaration:__ @value_count@
+     -}
+  -> IO DuckDBValue
+c_duckdb_create_list_value =
+  hs_bindgen_8b254090503c2df0
+
+-- __unique:__ @Database_DuckDB_FFI_Database.DuckDB.FFI_Safe_duckdb_create_array_value@
+foreign import ccall safe "hs_bindgen_d1f6dce6518d2db5" hs_bindgen_d1f6dce6518d2db5_base ::
+     BG.Ptr BG.Void
+  -> BG.Ptr BG.Void
+  -> HsBindgen.Runtime.LibC.Word64
+  -> IO (BG.Ptr BG.Void)
+
+-- __unique:__ @Database_DuckDB_FFI_Database.DuckDB.FFI_Safe_duckdb_create_array_value@
+hs_bindgen_d1f6dce6518d2db5 ::
+     DuckDBLogicalType
+  -> BG.Ptr DuckDBValue
+  -> DuckDBIdx
+  -> IO DuckDBValue
+hs_bindgen_d1f6dce6518d2db5 =
+  \x0 ->
+    \x1 ->
+      \x2 ->
+        fmap BG.fromFFIType (hs_bindgen_d1f6dce6518d2db5_base (BG.toFFIType x0) (BG.toFFIType x1) (BG.toFFIType x2))
+
+{-| Creates an array value from a child (element) type and an array of values of length @value_count@ . Must be destroyed with @'c_duckdb_destroy_value'@ .
+
+    history:
+
+    * stable: v0.10.1
+
+    [__@type@__]: The type of the array
+
+    [__@values@__]: The values for the array
+
+    [__@value_count@__]: The number of values in the array
+
+    __Returns:__ t'DuckDBValue'
+
+    __C declaration:__ @duckdb_create_array_value@
+
+    __defined at:__ @duckdb.h 9340:27@
+
+    __exported by:__ @duckdb.h@
+-}
+c_duckdb_create_array_value ::
+     DuckDBLogicalType
+     {- ^
+
+          [__@type@__]: The type of the array
+
+          __C declaration:__ @type@
+     -}
+  -> BG.Ptr DuckDBValue
+     {- ^
+
+          [__@values@__]: The values for the array
+
+          __C declaration:__ @values@
+     -}
+  -> DuckDBIdx
+     {- ^
+
+          [__@value_count@__]: The number of values in the array
+
+          __C declaration:__ @value_count@
+     -}
+  -> IO DuckDBValue
+c_duckdb_create_array_value =
+  hs_bindgen_d1f6dce6518d2db5
+
+-- __unique:__ @Database_DuckDB_FFI_Database.DuckDB.FFI_Safe_duckdb_create_map_value@
+foreign import ccall safe "hs_bindgen_fa95b21d02a873be" hs_bindgen_fa95b21d02a873be_base ::
+     BG.Ptr BG.Void
+  -> BG.Ptr BG.Void
+  -> BG.Ptr BG.Void
+  -> HsBindgen.Runtime.LibC.Word64
+  -> IO (BG.Ptr BG.Void)
+
+-- __unique:__ @Database_DuckDB_FFI_Database.DuckDB.FFI_Safe_duckdb_create_map_value@
+hs_bindgen_fa95b21d02a873be ::
+     DuckDBLogicalType
+  -> BG.Ptr DuckDBValue
+  -> BG.Ptr DuckDBValue
+  -> DuckDBIdx
+  -> IO DuckDBValue
+hs_bindgen_fa95b21d02a873be =
+  \x0 ->
+    \x1 ->
+      \x2 ->
+        \x3 ->
+          fmap BG.fromFFIType (hs_bindgen_fa95b21d02a873be_base (BG.toFFIType x0) (BG.toFFIType x1) (BG.toFFIType x2) (BG.toFFIType x3))
+
+{-| Creates a map value from a map type and two arrays, one for the keys and one for the values, each of length @entry_count@ . Must be destroyed with @'c_duckdb_destroy_value'@ .
+
+    history:
+
+    * unstable: v1.3.0
+
+    * stable: v1.5.6
+
+    [__@map_type@__]: The map type
+
+    [__@keys@__]: The keys of the map
+
+    [__@values@__]: The values of the map
+
+    [__@entry_count@__]: The number of entries (key-value pairs) in the map
+
+    __Returns:__ t'DuckDBValue'
+
+    __C declaration:__ @duckdb_create_map_value@
+
+    __defined at:__ @duckdb.h 9358:27@
+
+    __exported by:__ @duckdb.h@
+-}
+c_duckdb_create_map_value ::
+     DuckDBLogicalType
+     {- ^
+
+          [__@map_type@__]: The map type
+
+          __C declaration:__ @map_type@
+     -}
+  -> BG.Ptr DuckDBValue
+     {- ^
+
+          [__@keys@__]: The keys of the map
+
+          __C declaration:__ @keys@
+     -}
+  -> BG.Ptr DuckDBValue
+     {- ^
+
+          [__@values@__]: The values of the map
+
+          __C declaration:__ @values@
+     -}
+  -> DuckDBIdx
+     {- ^
+
+          [__@entry_count@__]: The number of entries (key-value pairs) in the map
+
+          __C declaration:__ @entry_count@
+     -}
+  -> IO DuckDBValue
+c_duckdb_create_map_value =
+  hs_bindgen_fa95b21d02a873be
+
+-- __unique:__ @Database_DuckDB_FFI_Database.DuckDB.FFI_Safe_duckdb_create_union_value@
+foreign import ccall safe "hs_bindgen_11c281d6e5e06b0d" hs_bindgen_11c281d6e5e06b0d_base ::
+     BG.Ptr BG.Void
+  -> HsBindgen.Runtime.LibC.Word64
+  -> BG.Ptr BG.Void
+  -> IO (BG.Ptr BG.Void)
+
+-- __unique:__ @Database_DuckDB_FFI_Database.DuckDB.FFI_Safe_duckdb_create_union_value@
+hs_bindgen_11c281d6e5e06b0d ::
+     DuckDBLogicalType
+  -> DuckDBIdx
+  -> DuckDBValue
+  -> IO DuckDBValue
+hs_bindgen_11c281d6e5e06b0d =
+  \x0 ->
+    \x1 ->
+      \x2 ->
+        fmap BG.fromFFIType (hs_bindgen_11c281d6e5e06b0d_base (BG.toFFIType x0) (BG.toFFIType x1) (BG.toFFIType x2))
+
+{-| Creates a union value from a union type, a tag index, and a value. Must be destroyed with @'c_duckdb_destroy_value'@ .
+
+    history:
+
+    * unstable: v1.3.0
+
+    * stable: v1.5.6
+
+    [__@union_type@__]: The union type
+
+    [__@tag_index@__]: The index of the tag of the union
+
+    [__@value@__]: The value of the union for that tag
+
+    __Returns:__ t'DuckDBValue'
+
+    __C declaration:__ @duckdb_create_union_value@
+
+    __defined at:__ @duckdb.h 9375:27@
+
+    __exported by:__ @duckdb.h@
+-}
+c_duckdb_create_union_value ::
+     DuckDBLogicalType
+     {- ^
+
+          [__@union_type@__]: The union type
+
+          __C declaration:__ @union_type@
+     -}
+  -> DuckDBIdx
+     {- ^
+
+          [__@tag_index@__]: The index of the tag of the union
+
+          __C declaration:__ @tag_index@
+     -}
+  -> DuckDBValue
+     {- ^
+
+          [__@value@__]: The value of the union for that tag
+
+          __C declaration:__ @value@
+     -}
+  -> IO DuckDBValue
+c_duckdb_create_union_value =
+  hs_bindgen_11c281d6e5e06b0d
+
+-- __unique:__ @Database_DuckDB_FFI_Database.DuckDB.FFI_Safe_duckdb_get_map_size@
+foreign import ccall safe "hs_bindgen_997728635cf0ac64" hs_bindgen_997728635cf0ac64_base ::
+     BG.Ptr BG.Void
+  -> IO HsBindgen.Runtime.LibC.Word64
+
+-- __unique:__ @Database_DuckDB_FFI_Database.DuckDB.FFI_Safe_duckdb_get_map_size@
+hs_bindgen_997728635cf0ac64 ::
+     DuckDBValue
+  -> IO DuckDBIdx
+hs_bindgen_997728635cf0ac64 =
+  \x0 ->
+    fmap BG.fromFFIType (hs_bindgen_997728635cf0ac64_base (BG.toFFIType x0))
+
+{-| Returns the number of elements in a MAP value.
+
+    history:
+
+    * stable: v1.1.0
+
+    [__@value@__]: The MAP value.
+
+    __Returns:__ t'DuckDBIdx'
+
+    __C declaration:__ @duckdb_get_map_size@
+
+    __defined at:__ @duckdb.h 9389:20@
+
+    __exported by:__ @duckdb.h@
+-}
+c_duckdb_get_map_size ::
+     DuckDBValue
+     {- ^
+
+          [__@value@__]: The MAP value.
+
+          __C declaration:__ @value@
+     -}
+  -> IO DuckDBIdx
+c_duckdb_get_map_size = hs_bindgen_997728635cf0ac64
+
+-- __unique:__ @Database_DuckDB_FFI_Database.DuckDB.FFI_Safe_duckdb_get_map_key@
+foreign import ccall safe "hs_bindgen_4abc412f4cbf3b1c" hs_bindgen_4abc412f4cbf3b1c_base ::
+     BG.Ptr BG.Void
+  -> HsBindgen.Runtime.LibC.Word64
+  -> IO (BG.Ptr BG.Void)
+
+-- __unique:__ @Database_DuckDB_FFI_Database.DuckDB.FFI_Safe_duckdb_get_map_key@
+hs_bindgen_4abc412f4cbf3b1c ::
+     DuckDBValue
+  -> DuckDBIdx
+  -> IO DuckDBValue
+hs_bindgen_4abc412f4cbf3b1c =
+  \x0 ->
+    \x1 ->
+      fmap BG.fromFFIType (hs_bindgen_4abc412f4cbf3b1c_base (BG.toFFIType x0) (BG.toFFIType x1))
+
+{-|
+
+    Returns the MAP key at index as a t'DuckDBValue' .
+
+    history:
+
+    * stable: v1.1.0
+
+    [__@value@__]: The MAP value.
+
+    [__@index@__]: The index of the key.
+
+    __Returns:__ t'DuckDBValue'
+
+    __C declaration:__ @duckdb_get_map_key@
+
+    __defined at:__ @duckdb.h 9403:27@
+
+    __exported by:__ @duckdb.h@
+-}
+c_duckdb_get_map_key ::
+     DuckDBValue
+     {- ^
+
+          [__@value@__]: The MAP value.
+
+          __C declaration:__ @value@
+     -}
+  -> DuckDBIdx
+     {- ^
+
+          [__@index@__]: The index of the key.
+
+          __C declaration:__ @index@
+     -}
+  -> IO DuckDBValue
+c_duckdb_get_map_key = hs_bindgen_4abc412f4cbf3b1c
+
+-- __unique:__ @Database_DuckDB_FFI_Database.DuckDB.FFI_Safe_duckdb_get_map_value@
+foreign import ccall safe "hs_bindgen_95db52b9cb363226" hs_bindgen_95db52b9cb363226_base ::
+     BG.Ptr BG.Void
+  -> HsBindgen.Runtime.LibC.Word64
+  -> IO (BG.Ptr BG.Void)
+
+-- __unique:__ @Database_DuckDB_FFI_Database.DuckDB.FFI_Safe_duckdb_get_map_value@
+hs_bindgen_95db52b9cb363226 ::
+     DuckDBValue
+  -> DuckDBIdx
+  -> IO DuckDBValue
+hs_bindgen_95db52b9cb363226 =
+  \x0 ->
+    \x1 ->
+      fmap BG.fromFFIType (hs_bindgen_95db52b9cb363226_base (BG.toFFIType x0) (BG.toFFIType x1))
+
+{-|
+
+    Returns the MAP value at index as a t'DuckDBValue' .
+
+    history:
+
+    * stable: v1.1.0
+
+    [__@value@__]: The MAP value.
+
+    [__@index@__]: The index of the value.
+
+    __Returns:__ t'DuckDBValue'
+
+    __C declaration:__ @duckdb_get_map_value@
+
+    __defined at:__ @duckdb.h 9417:27@
+
+    __exported by:__ @duckdb.h@
+-}
+c_duckdb_get_map_value ::
+     DuckDBValue
+     {- ^
+
+          [__@value@__]: The MAP value.
+
+          __C declaration:__ @value@
+     -}
+  -> DuckDBIdx
+     {- ^
+
+          [__@index@__]: The index of the value.
+
+          __C declaration:__ @index@
+     -}
+  -> IO DuckDBValue
+c_duckdb_get_map_value = hs_bindgen_95db52b9cb363226
+
+-- __unique:__ @Database_DuckDB_FFI_Database.DuckDB.FFI_Safe_duckdb_is_null_value@
+foreign import ccall safe "hs_bindgen_816a2cdca59a31ab" hs_bindgen_816a2cdca59a31ab_base ::
+     BG.Ptr BG.Void
+  -> IO BG.CBool
+
+-- __unique:__ @Database_DuckDB_FFI_Database.DuckDB.FFI_Safe_duckdb_is_null_value@
+hs_bindgen_816a2cdca59a31ab ::
+     DuckDBValue
+  -> IO BG.CBool
+hs_bindgen_816a2cdca59a31ab =
+  \x0 ->
+    fmap BG.fromFFIType (hs_bindgen_816a2cdca59a31ab_base (BG.toFFIType x0))
+
+{-| Returns whether the value\'s type is SQLNULL or not.
+
+    history:
+
+    * stable: v1.2.0
+
+    [__@value@__]: The value to check.
+
+    __Returns:__ bool
+
+    __C declaration:__ @duckdb_is_null_value@
+
+    __defined at:__ @duckdb.h 9430:19@
+
+    __exported by:__ @duckdb.h@
+-}
+c_duckdb_is_null_value ::
+     DuckDBValue
+     {- ^
+
+          [__@value@__]: The value to check.
+
+          __C declaration:__ @value@
+     -}
+  -> IO BG.CBool
+c_duckdb_is_null_value = hs_bindgen_816a2cdca59a31ab
+
+-- __unique:__ @Database_DuckDB_FFI_Database.DuckDB.FFI_Safe_duckdb_create_null_value@
+foreign import ccall safe "hs_bindgen_3e293eeed247ba3e" hs_bindgen_3e293eeed247ba3e_base ::
+     IO (BG.Ptr BG.Void)
+
+-- __unique:__ @Database_DuckDB_FFI_Database.DuckDB.FFI_Safe_duckdb_create_null_value@
+hs_bindgen_3e293eeed247ba3e :: IO DuckDBValue
+hs_bindgen_3e293eeed247ba3e =
+  fmap BG.fromFFIType hs_bindgen_3e293eeed247ba3e_base
+
+{-| Creates a value of type SQLNULL.
+
+    history:
+
+    * stable: v1.2.0
+
+    __Returns:__ t'DuckDBValue'
+
+    __C declaration:__ @duckdb_create_null_value@
+
+    __defined at:__ @duckdb.h 9442:27@
+
+    __exported by:__ @duckdb.h@
+-}
+c_duckdb_create_null_value :: IO DuckDBValue
+c_duckdb_create_null_value =
+  hs_bindgen_3e293eeed247ba3e
+
+-- __unique:__ @Database_DuckDB_FFI_Database.DuckDB.FFI_Safe_duckdb_get_list_size@
+foreign import ccall safe "hs_bindgen_014e65c8024e4108" hs_bindgen_014e65c8024e4108_base ::
+     BG.Ptr BG.Void
+  -> IO HsBindgen.Runtime.LibC.Word64
+
+-- __unique:__ @Database_DuckDB_FFI_Database.DuckDB.FFI_Safe_duckdb_get_list_size@
+hs_bindgen_014e65c8024e4108 ::
+     DuckDBValue
+  -> IO DuckDBIdx
+hs_bindgen_014e65c8024e4108 =
+  \x0 ->
+    fmap BG.fromFFIType (hs_bindgen_014e65c8024e4108_base (BG.toFFIType x0))
+
+{-| Returns the number of elements in a LIST value.
+
+    history:
+
+    * stable: v1.2.0
+
+    [__@value@__]: The LIST value.
+
+    __Returns:__ t'DuckDBIdx'
+
+    __C declaration:__ @duckdb_get_list_size@
+
+    __defined at:__ @duckdb.h 9455:20@
+
+    __exported by:__ @duckdb.h@
+-}
+c_duckdb_get_list_size ::
+     DuckDBValue
+     {- ^
+
+          [__@value@__]: The LIST value.
+
+          __C declaration:__ @value@
+     -}
+  -> IO DuckDBIdx
+c_duckdb_get_list_size = hs_bindgen_014e65c8024e4108
+
+-- __unique:__ @Database_DuckDB_FFI_Database.DuckDB.FFI_Safe_duckdb_get_list_child@
+foreign import ccall safe "hs_bindgen_e73a36f9bfcfe5a0" hs_bindgen_e73a36f9bfcfe5a0_base ::
+     BG.Ptr BG.Void
+  -> HsBindgen.Runtime.LibC.Word64
+  -> IO (BG.Ptr BG.Void)
+
+-- __unique:__ @Database_DuckDB_FFI_Database.DuckDB.FFI_Safe_duckdb_get_list_child@
+hs_bindgen_e73a36f9bfcfe5a0 ::
+     DuckDBValue
+  -> DuckDBIdx
+  -> IO DuckDBValue
+hs_bindgen_e73a36f9bfcfe5a0 =
+  \x0 ->
+    \x1 ->
+      fmap BG.fromFFIType (hs_bindgen_e73a36f9bfcfe5a0_base (BG.toFFIType x0) (BG.toFFIType x1))
+
+{-|
+
+    Returns the LIST child at index as a t'DuckDBValue' .
+
+    history:
+
+    * stable: v1.2.0
+
+    [__@value@__]: The LIST value.
+
+    [__@index@__]: The index of the child.
+
+    __Returns:__ t'DuckDBValue'
+
+    __C declaration:__ @duckdb_get_list_child@
+
+    __defined at:__ @duckdb.h 9469:27@
+
+    __exported by:__ @duckdb.h@
+-}
+c_duckdb_get_list_child ::
+     DuckDBValue
+     {- ^
+
+          [__@value@__]: The LIST value.
+
+          __C declaration:__ @value@
+     -}
+  -> DuckDBIdx
+     {- ^
+
+          [__@index@__]: The index of the child.
+
+          __C declaration:__ @index@
+     -}
+  -> IO DuckDBValue
+c_duckdb_get_list_child = hs_bindgen_e73a36f9bfcfe5a0
+
+-- __unique:__ @Database_DuckDB_FFI_Database.DuckDB.FFI_Safe_duckdb_create_enum_value@
+foreign import ccall safe "hs_bindgen_76712e93d9d2ee84" hs_bindgen_76712e93d9d2ee84_base ::
+     BG.Ptr BG.Void
+  -> HsBindgen.Runtime.LibC.Word64
+  -> IO (BG.Ptr BG.Void)
+
+-- __unique:__ @Database_DuckDB_FFI_Database.DuckDB.FFI_Safe_duckdb_create_enum_value@
+hs_bindgen_76712e93d9d2ee84 ::
+     DuckDBLogicalType
+  -> HsBindgen.Runtime.LibC.Word64
+  -> IO DuckDBValue
+hs_bindgen_76712e93d9d2ee84 =
+  \x0 ->
+    \x1 ->
+      fmap BG.fromFFIType (hs_bindgen_76712e93d9d2ee84_base (BG.toFFIType x0) (BG.toFFIType x1))
+
+{-| Creates an enum value from a type and a value. Must be destroyed with @'c_duckdb_destroy_value'@ .
+
+    history:
+
+    * stable: v1.2.0
+
+    [__@type@__]: The type of the enum
+
+    [__@value@__]: The value for the enum
+
+    __Returns:__ t'DuckDBValue'
+
+    __C declaration:__ @duckdb_create_enum_value@
+
+    __defined at:__ @duckdb.h 9483:27@
+
+    __exported by:__ @duckdb.h@
+-}
+c_duckdb_create_enum_value ::
+     DuckDBLogicalType
+     {- ^
+
+          [__@type@__]: The type of the enum
+
+          __C declaration:__ @type@
+     -}
+  -> HsBindgen.Runtime.LibC.Word64
+     {- ^
+
+          [__@value@__]: The value for the enum
+
+          __C declaration:__ @value@
+     -}
+  -> IO DuckDBValue
+c_duckdb_create_enum_value =
+  hs_bindgen_76712e93d9d2ee84
+
+-- __unique:__ @Database_DuckDB_FFI_Database.DuckDB.FFI_Safe_duckdb_get_enum_value@
+foreign import ccall safe "hs_bindgen_f88bdd4fc6a804da" hs_bindgen_f88bdd4fc6a804da_base ::
+     BG.Ptr BG.Void
+  -> IO HsBindgen.Runtime.LibC.Word64
+
+-- __unique:__ @Database_DuckDB_FFI_Database.DuckDB.FFI_Safe_duckdb_get_enum_value@
+hs_bindgen_f88bdd4fc6a804da ::
+     DuckDBValue
+  -> IO HsBindgen.Runtime.LibC.Word64
+hs_bindgen_f88bdd4fc6a804da =
+  \x0 ->
+    fmap BG.fromFFIType (hs_bindgen_f88bdd4fc6a804da_base (BG.toFFIType x0))
+
+{-| Returns the enum value of the given value.
+
+    history:
+
+    * stable: v1.2.0
+
+    [__@value@__]: A t'DuckDBValue' containing an enum
+
+    __Returns:__ uint64_t
+
+    __C declaration:__ @duckdb_get_enum_value@
+
+    __defined at:__ @duckdb.h 9496:23@
+
+    __exported by:__ @duckdb.h@
+-}
+c_duckdb_get_enum_value ::
+     DuckDBValue
+     {- ^
+
+          [__@value@__]: A t'DuckDBValue' containing an enum
+
+          __C declaration:__ @value@
+     -}
+  -> IO HsBindgen.Runtime.LibC.Word64
+c_duckdb_get_enum_value = hs_bindgen_f88bdd4fc6a804da
+
+-- __unique:__ @Database_DuckDB_FFI_Database.DuckDB.FFI_Safe_duckdb_get_struct_child@
+foreign import ccall safe "hs_bindgen_bd541a73d7b73adb" hs_bindgen_bd541a73d7b73adb_base ::
+     BG.Ptr BG.Void
+  -> HsBindgen.Runtime.LibC.Word64
+  -> IO (BG.Ptr BG.Void)
+
+-- __unique:__ @Database_DuckDB_FFI_Database.DuckDB.FFI_Safe_duckdb_get_struct_child@
+hs_bindgen_bd541a73d7b73adb ::
+     DuckDBValue
+  -> DuckDBIdx
+  -> IO DuckDBValue
+hs_bindgen_bd541a73d7b73adb =
+  \x0 ->
+    \x1 ->
+      fmap BG.fromFFIType (hs_bindgen_bd541a73d7b73adb_base (BG.toFFIType x0) (BG.toFFIType x1))
+
+{-|
+
+    Returns the STRUCT child at index as a t'DuckDBValue' .
+
+    history:
+
+    * stable: v1.2.0
+
+    [__@value@__]: The STRUCT value.
+
+    [__@index@__]: The index of the child.
+
+    __Returns:__ t'DuckDBValue'
+
+    __C declaration:__ @duckdb_get_struct_child@
+
+    __defined at:__ @duckdb.h 9510:27@
+
+    __exported by:__ @duckdb.h@
+-}
+c_duckdb_get_struct_child ::
+     DuckDBValue
+     {- ^
+
+          [__@value@__]: The STRUCT value.
+
+          __C declaration:__ @value@
+     -}
+  -> DuckDBIdx
+     {- ^
+
+          [__@index@__]: The index of the child.
+
+          __C declaration:__ @index@
+     -}
+  -> IO DuckDBValue
+c_duckdb_get_struct_child =
+  hs_bindgen_bd541a73d7b73adb
+
+-- __unique:__ @Database_DuckDB_FFI_Database.DuckDB.FFI_Safe_duckdb_value_to_string@
+foreign import ccall safe "hs_bindgen_3154db7693be8381" hs_bindgen_3154db7693be8381_base ::
+     BG.Ptr BG.Void
+  -> IO (BG.Ptr BG.Void)
+
+-- __unique:__ @Database_DuckDB_FFI_Database.DuckDB.FFI_Safe_duckdb_value_to_string@
+hs_bindgen_3154db7693be8381 ::
+     DuckDBValue
+  -> IO (BG.Ptr BG.CChar)
+hs_bindgen_3154db7693be8381 =
+  \x0 ->
+    fmap BG.fromFFIType (hs_bindgen_3154db7693be8381_base (BG.toFFIType x0))
+
+{-| Returns the SQL string representation of the given value.
+
+    history:
+
+    * unstable: v1.3.0
+
+    * stable: v1.5.6
+
+    [__@value@__]: A t'DuckDBValue' .
+
+    __Returns:__ char*
+
+    __C declaration:__ @duckdb_value_to_string@
+
+    __defined at:__ @duckdb.h 9524:20@
+
+    __exported by:__ @duckdb.h@
+-}
+c_duckdb_value_to_string ::
+     DuckDBValue
+     {- ^
+
+          [__@value@__]: A t'DuckDBValue' .
+
+          __C declaration:__ @value@
+     -}
+  -> IO (BG.Ptr BG.CChar)
+c_duckdb_value_to_string =
+  hs_bindgen_3154db7693be8381
+
+-- __unique:__ @Database_DuckDB_FFI_Database.DuckDB.FFI_Safe_duckdb_value_boolean@
+foreign import ccall safe "hs_bindgen_6b857667aad1bb1a" hs_bindgen_6b857667aad1bb1a_base ::
+     BG.Ptr BG.Void
+  -> HsBindgen.Runtime.LibC.Word64
+  -> HsBindgen.Runtime.LibC.Word64
+  -> IO BG.CBool
+
+-- __unique:__ @Database_DuckDB_FFI_Database.DuckDB.FFI_Safe_duckdb_value_boolean@
+hs_bindgen_6b857667aad1bb1a ::
+     BG.Ptr DuckDBResult
+  -> DuckDBIdx
+  -> DuckDBIdx
+  -> IO BG.CBool
+hs_bindgen_6b857667aad1bb1a =
+  \x0 ->
+    \x1 ->
+      \x2 ->
+        fmap BG.fromFFIType (hs_bindgen_6b857667aad1bb1a_base (BG.toFFIType x0) (BG.toFFIType x1) (BG.toFFIType x2))
+
+{-| __DEPRECATION NOTICE__ : This method is scheduled for removal in a future release.
+
+    history:
+
+    * stable: v0.1.0
+
+    * deprecated: v1.0.0
+
+    [__@result@__]:
+
+    [__@col@__]:
+
+    [__@row@__]:
+
+    __Returns:__ bool
+
+    __C declaration:__ @duckdb_value_boolean@
+
+    __defined at:__ @duckdb.h 9540:19@
+
+    __exported by:__ @duckdb.h@
+-}
+c_duckdb_value_boolean ::
+     BG.Ptr DuckDBResult
+     {- ^
+
+          [__@result@__]:
+
+          __C declaration:__ @result@
+     -}
+  -> DuckDBIdx
+     {- ^
+
+          [__@col@__]:
+
+          __C declaration:__ @col@
+     -}
+  -> DuckDBIdx
+     {- ^
+
+          [__@row@__]:
+
+          __C declaration:__ @row@
+     -}
+  -> IO BG.CBool
+c_duckdb_value_boolean = hs_bindgen_6b857667aad1bb1a
+
+-- __unique:__ @Database_DuckDB_FFI_Database.DuckDB.FFI_Safe_duckdb_value_int8@
+foreign import ccall safe "hs_bindgen_31a9050aade5103f" hs_bindgen_31a9050aade5103f_base ::
+     BG.Ptr BG.Void
+  -> HsBindgen.Runtime.LibC.Word64
+  -> HsBindgen.Runtime.LibC.Word64
+  -> IO HsBindgen.Runtime.LibC.Int8
+
+-- __unique:__ @Database_DuckDB_FFI_Database.DuckDB.FFI_Safe_duckdb_value_int8@
+hs_bindgen_31a9050aade5103f ::
+     BG.Ptr DuckDBResult
+  -> DuckDBIdx
+  -> DuckDBIdx
+  -> IO HsBindgen.Runtime.LibC.Int8
+hs_bindgen_31a9050aade5103f =
+  \x0 ->
+    \x1 ->
+      \x2 ->
+        fmap BG.fromFFIType (hs_bindgen_31a9050aade5103f_base (BG.toFFIType x0) (BG.toFFIType x1) (BG.toFFIType x2))
+
+{-| __DEPRECATION NOTICE__ : This method is scheduled for removal in a future release.
+
+    history:
+
+    * stable: v0.1.0
+
+    * deprecated: v1.0.0
+
+    [__@result@__]:
+
+    [__@col@__]:
+
+    [__@row@__]:
+
+    __Returns:__ int8_t
+
+    __C declaration:__ @duckdb_value_int8@
+
+    __defined at:__ @duckdb.h 9556:21@
+
+    __exported by:__ @duckdb.h@
+-}
+c_duckdb_value_int8 ::
+     BG.Ptr DuckDBResult
+     {- ^
+
+          [__@result@__]:
+
+          __C declaration:__ @result@
+     -}
+  -> DuckDBIdx
+     {- ^
+
+          [__@col@__]:
+
+          __C declaration:__ @col@
+     -}
+  -> DuckDBIdx
+     {- ^
+
+          [__@row@__]:
+
+          __C declaration:__ @row@
+     -}
+  -> IO HsBindgen.Runtime.LibC.Int8
+c_duckdb_value_int8 = hs_bindgen_31a9050aade5103f
+
+-- __unique:__ @Database_DuckDB_FFI_Database.DuckDB.FFI_Safe_duckdb_value_int16@
+foreign import ccall safe "hs_bindgen_8f6b84207e5703cf" hs_bindgen_8f6b84207e5703cf_base ::
+     BG.Ptr BG.Void
+  -> HsBindgen.Runtime.LibC.Word64
+  -> HsBindgen.Runtime.LibC.Word64
+  -> IO HsBindgen.Runtime.LibC.Int16
+
+-- __unique:__ @Database_DuckDB_FFI_Database.DuckDB.FFI_Safe_duckdb_value_int16@
+hs_bindgen_8f6b84207e5703cf ::
+     BG.Ptr DuckDBResult
+  -> DuckDBIdx
+  -> DuckDBIdx
+  -> IO HsBindgen.Runtime.LibC.Int16
+hs_bindgen_8f6b84207e5703cf =
+  \x0 ->
+    \x1 ->
+      \x2 ->
+        fmap BG.fromFFIType (hs_bindgen_8f6b84207e5703cf_base (BG.toFFIType x0) (BG.toFFIType x1) (BG.toFFIType x2))
+
+{-| __DEPRECATION NOTICE__ : This method is scheduled for removal in a future release.
+
+    history:
+
+    * stable: v0.1.0
+
+    * deprecated: v1.0.0
+
+    [__@result@__]:
+
+    [__@col@__]:
+
+    [__@row@__]:
+
+    __Returns:__ int16_t
+
+    __C declaration:__ @duckdb_value_int16@
+
+    __defined at:__ @duckdb.h 9572:22@
+
+    __exported by:__ @duckdb.h@
+-}
+c_duckdb_value_int16 ::
+     BG.Ptr DuckDBResult
+     {- ^
+
+          [__@result@__]:
+
+          __C declaration:__ @result@
+     -}
+  -> DuckDBIdx
+     {- ^
+
+          [__@col@__]:
+
+          __C declaration:__ @col@
+     -}
+  -> DuckDBIdx
+     {- ^
+
+          [__@row@__]:
+
+          __C declaration:__ @row@
+     -}
+  -> IO HsBindgen.Runtime.LibC.Int16
+c_duckdb_value_int16 = hs_bindgen_8f6b84207e5703cf
+
+-- __unique:__ @Database_DuckDB_FFI_Database.DuckDB.FFI_Safe_duckdb_value_int32@
+foreign import ccall safe "hs_bindgen_2a73adc304a9275f" hs_bindgen_2a73adc304a9275f_base ::
+     BG.Ptr BG.Void
+  -> HsBindgen.Runtime.LibC.Word64
+  -> HsBindgen.Runtime.LibC.Word64
+  -> IO HsBindgen.Runtime.LibC.Int32
+
+-- __unique:__ @Database_DuckDB_FFI_Database.DuckDB.FFI_Safe_duckdb_value_int32@
+hs_bindgen_2a73adc304a9275f ::
+     BG.Ptr DuckDBResult
+  -> DuckDBIdx
+  -> DuckDBIdx
+  -> IO HsBindgen.Runtime.LibC.Int32
+hs_bindgen_2a73adc304a9275f =
+  \x0 ->
+    \x1 ->
+      \x2 ->
+        fmap BG.fromFFIType (hs_bindgen_2a73adc304a9275f_base (BG.toFFIType x0) (BG.toFFIType x1) (BG.toFFIType x2))
+
+{-| __DEPRECATION NOTICE__ : This method is scheduled for removal in a future release.
+
+    history:
+
+    * stable: v0.1.0
+
+    * deprecated: v1.0.0
+
+    [__@result@__]:
+
+    [__@col@__]:
+
+    [__@row@__]:
+
+    __Returns:__ int32_t
+
+    __C declaration:__ @duckdb_value_int32@
+
+    __defined at:__ @duckdb.h 9588:22@
+
+    __exported by:__ @duckdb.h@
+-}
+c_duckdb_value_int32 ::
+     BG.Ptr DuckDBResult
+     {- ^
+
+          [__@result@__]:
+
+          __C declaration:__ @result@
+     -}
+  -> DuckDBIdx
+     {- ^
+
+          [__@col@__]:
+
+          __C declaration:__ @col@
+     -}
+  -> DuckDBIdx
+     {- ^
+
+          [__@row@__]:
+
+          __C declaration:__ @row@
+     -}
+  -> IO HsBindgen.Runtime.LibC.Int32
+c_duckdb_value_int32 = hs_bindgen_2a73adc304a9275f
+
+-- __unique:__ @Database_DuckDB_FFI_Database.DuckDB.FFI_Safe_duckdb_value_int64@
+foreign import ccall safe "hs_bindgen_666edda1d74b4198" hs_bindgen_666edda1d74b4198_base ::
+     BG.Ptr BG.Void
+  -> HsBindgen.Runtime.LibC.Word64
+  -> HsBindgen.Runtime.LibC.Word64
+  -> IO HsBindgen.Runtime.LibC.Int64
+
+-- __unique:__ @Database_DuckDB_FFI_Database.DuckDB.FFI_Safe_duckdb_value_int64@
+hs_bindgen_666edda1d74b4198 ::
+     BG.Ptr DuckDBResult
+  -> DuckDBIdx
+  -> DuckDBIdx
+  -> IO HsBindgen.Runtime.LibC.Int64
+hs_bindgen_666edda1d74b4198 =
+  \x0 ->
+    \x1 ->
+      \x2 ->
+        fmap BG.fromFFIType (hs_bindgen_666edda1d74b4198_base (BG.toFFIType x0) (BG.toFFIType x1) (BG.toFFIType x2))
+
+{-| __DEPRECATION NOTICE__ : This method is scheduled for removal in a future release.
+
+    history:
+
+    * stable: v0.1.0
+
+    * deprecated: v1.0.0
+
+    [__@result@__]:
+
+    [__@col@__]:
+
+    [__@row@__]:
+
+    __Returns:__ int64_t
+
+    __C declaration:__ @duckdb_value_int64@
+
+    __defined at:__ @duckdb.h 9604:22@
+
+    __exported by:__ @duckdb.h@
+-}
+c_duckdb_value_int64 ::
+     BG.Ptr DuckDBResult
+     {- ^
+
+          [__@result@__]:
+
+          __C declaration:__ @result@
+     -}
+  -> DuckDBIdx
+     {- ^
+
+          [__@col@__]:
+
+          __C declaration:__ @col@
+     -}
+  -> DuckDBIdx
+     {- ^
+
+          [__@row@__]:
+
+          __C declaration:__ @row@
+     -}
+  -> IO HsBindgen.Runtime.LibC.Int64
+c_duckdb_value_int64 = hs_bindgen_666edda1d74b4198
+
+-- __unique:__ @Database_DuckDB_FFI_Database.DuckDB.FFI_Safe_duckdb_value_hugeint@
+foreign import ccall safe "hs_bindgen_02dd46eda1283da9" hs_bindgen_02dd46eda1283da9_base ::
+     BG.Ptr BG.Void
+  -> HsBindgen.Runtime.LibC.Word64
+  -> HsBindgen.Runtime.LibC.Word64
+  -> BG.Ptr BG.Void
+  -> IO ()
+
+-- __unique:__ @Database_DuckDB_FFI_Database.DuckDB.FFI_Safe_duckdb_value_hugeint@
+hs_bindgen_02dd46eda1283da9 ::
+     BG.Ptr DuckDBResult
+  -> DuckDBIdx
+  -> DuckDBIdx
+  -> BG.Ptr DuckDBHugeInt
+  -> IO ()
+hs_bindgen_02dd46eda1283da9 =
+  \x0 ->
+    \x1 ->
+      \x2 ->
+        \x3 ->
+          hs_bindgen_02dd46eda1283da9_base (BG.toFFIType x0) (BG.toFFIType x1) (BG.toFFIType x2) (BG.toFFIType x3)
+
+{-| __DEPRECATION NOTICE__ : This method is scheduled for removal in a future release.
+
+    history:
+
+    * stable: v0.2.9
+
+    * deprecated: v1.0.0
+
+    [__@result@__]:
+
+    [__@col@__]:
+
+    [__@row@__]:
+
+    __Returns:__ t'DuckDBHugeInt'
+
+    __C declaration:__ @duckdb_value_hugeint@
+
+    __defined at:__ @duckdb.h 9620:29@
+
+    __exported by:__ @duckdb.h@
+-}
+c_duckdb_value_hugeint ::
+     BG.Ptr DuckDBResult
+     {- ^
+
+          [__@result@__]:
+
+          __C declaration:__ @result@
+     -}
+  -> DuckDBIdx
+     {- ^
+
+          [__@col@__]:
+
+          __C declaration:__ @col@
+     -}
+  -> DuckDBIdx
+     {- ^
+
+          [__@row@__]:
+
+          __C declaration:__ @row@
+     -}
+  -> IO DuckDBHugeInt
+c_duckdb_value_hugeint =
+  \result0 ->
+    \col1 ->
+      \row2 ->
+        BG.allocaAndPeek (\res3 ->
+                            hs_bindgen_02dd46eda1283da9 result0 col1 row2 res3)
+
+-- __unique:__ @Database_DuckDB_FFI_Database.DuckDB.FFI_Safe_duckdb_value_uhugeint@
+foreign import ccall safe "hs_bindgen_3b48fdeb7cde3ab3" hs_bindgen_3b48fdeb7cde3ab3_base ::
+     BG.Ptr BG.Void
+  -> HsBindgen.Runtime.LibC.Word64
+  -> HsBindgen.Runtime.LibC.Word64
+  -> BG.Ptr BG.Void
+  -> IO ()
+
+-- __unique:__ @Database_DuckDB_FFI_Database.DuckDB.FFI_Safe_duckdb_value_uhugeint@
+hs_bindgen_3b48fdeb7cde3ab3 ::
+     BG.Ptr DuckDBResult
+  -> DuckDBIdx
+  -> DuckDBIdx
+  -> BG.Ptr DuckDBUHugeInt
+  -> IO ()
+hs_bindgen_3b48fdeb7cde3ab3 =
+  \x0 ->
+    \x1 ->
+      \x2 ->
+        \x3 ->
+          hs_bindgen_3b48fdeb7cde3ab3_base (BG.toFFIType x0) (BG.toFFIType x1) (BG.toFFIType x2) (BG.toFFIType x3)
+
+{-| __DEPRECATION NOTICE__ : This method is scheduled for removal in a future release.
+
+    history:
+
+    * stable: v0.10.0
+
+    * deprecated: v1.0.0
+
+    [__@result@__]:
+
+    [__@col@__]:
+
+    [__@row@__]:
+
+    __Returns:__ t'DuckDBUHugeInt'
+
+    __C declaration:__ @duckdb_value_uhugeint@
+
+    __defined at:__ @duckdb.h 9636:30@
+
+    __exported by:__ @duckdb.h@
+-}
+c_duckdb_value_uhugeint ::
+     BG.Ptr DuckDBResult
+     {- ^
+
+          [__@result@__]:
+
+          __C declaration:__ @result@
+     -}
+  -> DuckDBIdx
+     {- ^
+
+          [__@col@__]:
+
+          __C declaration:__ @col@
+     -}
+  -> DuckDBIdx
+     {- ^
+
+          [__@row@__]:
+
+          __C declaration:__ @row@
+     -}
+  -> IO DuckDBUHugeInt
+c_duckdb_value_uhugeint =
+  \result0 ->
+    \col1 ->
+      \row2 ->
+        BG.allocaAndPeek (\res3 ->
+                            hs_bindgen_3b48fdeb7cde3ab3 result0 col1 row2 res3)
+
+-- __unique:__ @Database_DuckDB_FFI_Database.DuckDB.FFI_Safe_duckdb_value_decimal@
+foreign import ccall safe "hs_bindgen_bc05565e60bda0c6" hs_bindgen_bc05565e60bda0c6_base ::
+     BG.Ptr BG.Void
+  -> HsBindgen.Runtime.LibC.Word64
+  -> HsBindgen.Runtime.LibC.Word64
+  -> BG.Ptr BG.Void
+  -> IO ()
+
+-- __unique:__ @Database_DuckDB_FFI_Database.DuckDB.FFI_Safe_duckdb_value_decimal@
+hs_bindgen_bc05565e60bda0c6 ::
+     BG.Ptr DuckDBResult
+  -> DuckDBIdx
+  -> DuckDBIdx
+  -> BG.Ptr DuckDBDecimal
+  -> IO ()
+hs_bindgen_bc05565e60bda0c6 =
+  \x0 ->
+    \x1 ->
+      \x2 ->
+        \x3 ->
+          hs_bindgen_bc05565e60bda0c6_base (BG.toFFIType x0) (BG.toFFIType x1) (BG.toFFIType x2) (BG.toFFIType x3)
+
+{-| __DEPRECATION NOTICE__ : This method is scheduled for removal in a future release.
+
+    history:
+
+    * stable: v0.3.3
+
+    * deprecated: v1.0.0
+
+    [__@result@__]:
+
+    [__@col@__]:
+
+    [__@row@__]:
+
+    __Returns:__ t'DuckDBDecimal'
+
+    __C declaration:__ @duckdb_value_decimal@
+
+    __defined at:__ @duckdb.h 9652:29@
+
+    __exported by:__ @duckdb.h@
+-}
+c_duckdb_value_decimal ::
+     BG.Ptr DuckDBResult
+     {- ^
+
+          [__@result@__]:
+
+          __C declaration:__ @result@
+     -}
+  -> DuckDBIdx
+     {- ^
+
+          [__@col@__]:
+
+          __C declaration:__ @col@
+     -}
+  -> DuckDBIdx
+     {- ^
+
+          [__@row@__]:
+
+          __C declaration:__ @row@
+     -}
+  -> IO DuckDBDecimal
+c_duckdb_value_decimal =
+  \result0 ->
+    \col1 ->
+      \row2 ->
+        BG.allocaAndPeek (\res3 ->
+                            hs_bindgen_bc05565e60bda0c6 result0 col1 row2 res3)
+
+-- __unique:__ @Database_DuckDB_FFI_Database.DuckDB.FFI_Safe_duckdb_value_uint8@
+foreign import ccall safe "hs_bindgen_fdfcd21851e7aa44" hs_bindgen_fdfcd21851e7aa44_base ::
+     BG.Ptr BG.Void
+  -> HsBindgen.Runtime.LibC.Word64
+  -> HsBindgen.Runtime.LibC.Word64
+  -> IO HsBindgen.Runtime.LibC.Word8
+
+-- __unique:__ @Database_DuckDB_FFI_Database.DuckDB.FFI_Safe_duckdb_value_uint8@
+hs_bindgen_fdfcd21851e7aa44 ::
+     BG.Ptr DuckDBResult
+  -> DuckDBIdx
+  -> DuckDBIdx
+  -> IO HsBindgen.Runtime.LibC.Word8
+hs_bindgen_fdfcd21851e7aa44 =
+  \x0 ->
+    \x1 ->
+      \x2 ->
+        fmap BG.fromFFIType (hs_bindgen_fdfcd21851e7aa44_base (BG.toFFIType x0) (BG.toFFIType x1) (BG.toFFIType x2))
+
+{-| __DEPRECATION NOTICE__ : This method is scheduled for removal in a future release.
+
+    history:
+
+    * stable: v0.2.5
+
+    * deprecated: v1.0.0
+
+    [__@result@__]:
+
+    [__@col@__]:
+
+    [__@row@__]:
+
+    __Returns:__ uint8_t
+
+    __C declaration:__ @duckdb_value_uint8@
+
+    __defined at:__ @duckdb.h 9668:22@
+
+    __exported by:__ @duckdb.h@
+-}
+c_duckdb_value_uint8 ::
+     BG.Ptr DuckDBResult
+     {- ^
+
+          [__@result@__]:
+
+          __C declaration:__ @result@
+     -}
+  -> DuckDBIdx
+     {- ^
+
+          [__@col@__]:
+
+          __C declaration:__ @col@
+     -}
+  -> DuckDBIdx
+     {- ^
+
+          [__@row@__]:
+
+          __C declaration:__ @row@
+     -}
+  -> IO HsBindgen.Runtime.LibC.Word8
+c_duckdb_value_uint8 = hs_bindgen_fdfcd21851e7aa44
+
+-- __unique:__ @Database_DuckDB_FFI_Database.DuckDB.FFI_Safe_duckdb_value_uint16@
+foreign import ccall safe "hs_bindgen_33587e7ddcd16a45" hs_bindgen_33587e7ddcd16a45_base ::
+     BG.Ptr BG.Void
+  -> HsBindgen.Runtime.LibC.Word64
+  -> HsBindgen.Runtime.LibC.Word64
+  -> IO HsBindgen.Runtime.LibC.Word16
+
+-- __unique:__ @Database_DuckDB_FFI_Database.DuckDB.FFI_Safe_duckdb_value_uint16@
+hs_bindgen_33587e7ddcd16a45 ::
+     BG.Ptr DuckDBResult
+  -> DuckDBIdx
+  -> DuckDBIdx
+  -> IO HsBindgen.Runtime.LibC.Word16
+hs_bindgen_33587e7ddcd16a45 =
+  \x0 ->
+    \x1 ->
+      \x2 ->
+        fmap BG.fromFFIType (hs_bindgen_33587e7ddcd16a45_base (BG.toFFIType x0) (BG.toFFIType x1) (BG.toFFIType x2))
+
+{-| __DEPRECATION NOTICE__ : This method is scheduled for removal in a future release.
+
+    history:
+
+    * stable: v0.2.5
+
+    * deprecated: v1.0.0
+
+    [__@result@__]:
+
+    [__@col@__]:
+
+    [__@row@__]:
+
+    __Returns:__ uint16_t
+
+    __C declaration:__ @duckdb_value_uint16@
+
+    __defined at:__ @duckdb.h 9684:23@
+
+    __exported by:__ @duckdb.h@
+-}
+c_duckdb_value_uint16 ::
+     BG.Ptr DuckDBResult
+     {- ^
+
+          [__@result@__]:
+
+          __C declaration:__ @result@
+     -}
+  -> DuckDBIdx
+     {- ^
+
+          [__@col@__]:
+
+          __C declaration:__ @col@
+     -}
+  -> DuckDBIdx
+     {- ^
+
+          [__@row@__]:
+
+          __C declaration:__ @row@
+     -}
+  -> IO HsBindgen.Runtime.LibC.Word16
+c_duckdb_value_uint16 = hs_bindgen_33587e7ddcd16a45
+
+-- __unique:__ @Database_DuckDB_FFI_Database.DuckDB.FFI_Safe_duckdb_value_uint32@
+foreign import ccall safe "hs_bindgen_7af7c542181749f0" hs_bindgen_7af7c542181749f0_base ::
+     BG.Ptr BG.Void
+  -> HsBindgen.Runtime.LibC.Word64
+  -> HsBindgen.Runtime.LibC.Word64
+  -> IO HsBindgen.Runtime.LibC.Word32
+
+-- __unique:__ @Database_DuckDB_FFI_Database.DuckDB.FFI_Safe_duckdb_value_uint32@
+hs_bindgen_7af7c542181749f0 ::
+     BG.Ptr DuckDBResult
+  -> DuckDBIdx
+  -> DuckDBIdx
+  -> IO HsBindgen.Runtime.LibC.Word32
+hs_bindgen_7af7c542181749f0 =
+  \x0 ->
+    \x1 ->
+      \x2 ->
+        fmap BG.fromFFIType (hs_bindgen_7af7c542181749f0_base (BG.toFFIType x0) (BG.toFFIType x1) (BG.toFFIType x2))
+
+{-| __DEPRECATION NOTICE__ : This method is scheduled for removal in a future release.
+
+    history:
+
+    * stable: v0.2.5
+
+    * deprecated: v1.0.0
+
+    [__@result@__]:
+
+    [__@col@__]:
+
+    [__@row@__]:
+
+    __Returns:__ uint32_t
+
+    __C declaration:__ @duckdb_value_uint32@
+
+    __defined at:__ @duckdb.h 9700:23@
+
+    __exported by:__ @duckdb.h@
+-}
+c_duckdb_value_uint32 ::
+     BG.Ptr DuckDBResult
+     {- ^
+
+          [__@result@__]:
+
+          __C declaration:__ @result@
+     -}
+  -> DuckDBIdx
+     {- ^
+
+          [__@col@__]:
+
+          __C declaration:__ @col@
+     -}
+  -> DuckDBIdx
+     {- ^
+
+          [__@row@__]:
+
+          __C declaration:__ @row@
+     -}
+  -> IO HsBindgen.Runtime.LibC.Word32
+c_duckdb_value_uint32 = hs_bindgen_7af7c542181749f0
+
+-- __unique:__ @Database_DuckDB_FFI_Database.DuckDB.FFI_Safe_duckdb_value_uint64@
+foreign import ccall safe "hs_bindgen_30ad3196e505ee32" hs_bindgen_30ad3196e505ee32_base ::
+     BG.Ptr BG.Void
+  -> HsBindgen.Runtime.LibC.Word64
+  -> HsBindgen.Runtime.LibC.Word64
+  -> IO HsBindgen.Runtime.LibC.Word64
+
+-- __unique:__ @Database_DuckDB_FFI_Database.DuckDB.FFI_Safe_duckdb_value_uint64@
+hs_bindgen_30ad3196e505ee32 ::
+     BG.Ptr DuckDBResult
+  -> DuckDBIdx
+  -> DuckDBIdx
+  -> IO HsBindgen.Runtime.LibC.Word64
+hs_bindgen_30ad3196e505ee32 =
+  \x0 ->
+    \x1 ->
+      \x2 ->
+        fmap BG.fromFFIType (hs_bindgen_30ad3196e505ee32_base (BG.toFFIType x0) (BG.toFFIType x1) (BG.toFFIType x2))
+
+{-| __DEPRECATION NOTICE__ : This method is scheduled for removal in a future release.
+
+    history:
+
+    * stable: v0.2.5
+
+    * deprecated: v1.0.0
+
+    [__@result@__]:
+
+    [__@col@__]:
+
+    [__@row@__]:
+
+    __Returns:__ uint64_t
+
+    __C declaration:__ @duckdb_value_uint64@
+
+    __defined at:__ @duckdb.h 9716:23@
+
+    __exported by:__ @duckdb.h@
+-}
+c_duckdb_value_uint64 ::
+     BG.Ptr DuckDBResult
+     {- ^
+
+          [__@result@__]:
+
+          __C declaration:__ @result@
+     -}
+  -> DuckDBIdx
+     {- ^
+
+          [__@col@__]:
+
+          __C declaration:__ @col@
+     -}
+  -> DuckDBIdx
+     {- ^
+
+          [__@row@__]:
+
+          __C declaration:__ @row@
+     -}
+  -> IO HsBindgen.Runtime.LibC.Word64
+c_duckdb_value_uint64 = hs_bindgen_30ad3196e505ee32
+
+-- __unique:__ @Database_DuckDB_FFI_Database.DuckDB.FFI_Safe_duckdb_value_float@
+foreign import ccall safe "hs_bindgen_848e3a7b82d399ae" hs_bindgen_848e3a7b82d399ae_base ::
+     BG.Ptr BG.Void
+  -> HsBindgen.Runtime.LibC.Word64
+  -> HsBindgen.Runtime.LibC.Word64
+  -> IO BG.CFloat
+
+-- __unique:__ @Database_DuckDB_FFI_Database.DuckDB.FFI_Safe_duckdb_value_float@
+hs_bindgen_848e3a7b82d399ae ::
+     BG.Ptr DuckDBResult
+  -> DuckDBIdx
+  -> DuckDBIdx
+  -> IO BG.CFloat
+hs_bindgen_848e3a7b82d399ae =
+  \x0 ->
+    \x1 ->
+      \x2 ->
+        fmap BG.fromFFIType (hs_bindgen_848e3a7b82d399ae_base (BG.toFFIType x0) (BG.toFFIType x1) (BG.toFFIType x2))
+
+{-| __DEPRECATION NOTICE__ : This method is scheduled for removal in a future release.
+
+    history:
+
+    * stable: v0.1.0
+
+    * deprecated: v1.0.0
+
+    [__@result@__]:
+
+    [__@col@__]:
+
+    [__@row@__]:
+
+    __Returns:__ float
+
+    __C declaration:__ @duckdb_value_float@
+
+    __defined at:__ @duckdb.h 9732:20@
+
+    __exported by:__ @duckdb.h@
+-}
+c_duckdb_value_float ::
+     BG.Ptr DuckDBResult
+     {- ^
+
+          [__@result@__]:
+
+          __C declaration:__ @result@
+     -}
+  -> DuckDBIdx
+     {- ^
+
+          [__@col@__]:
+
+          __C declaration:__ @col@
+     -}
+  -> DuckDBIdx
+     {- ^
+
+          [__@row@__]:
+
+          __C declaration:__ @row@
+     -}
+  -> IO BG.CFloat
+c_duckdb_value_float = hs_bindgen_848e3a7b82d399ae
+
+-- __unique:__ @Database_DuckDB_FFI_Database.DuckDB.FFI_Safe_duckdb_value_double@
+foreign import ccall safe "hs_bindgen_80756391f00963b4" hs_bindgen_80756391f00963b4_base ::
+     BG.Ptr BG.Void
+  -> HsBindgen.Runtime.LibC.Word64
+  -> HsBindgen.Runtime.LibC.Word64
+  -> IO BG.CDouble
+
+-- __unique:__ @Database_DuckDB_FFI_Database.DuckDB.FFI_Safe_duckdb_value_double@
+hs_bindgen_80756391f00963b4 ::
+     BG.Ptr DuckDBResult
+  -> DuckDBIdx
+  -> DuckDBIdx
+  -> IO BG.CDouble
+hs_bindgen_80756391f00963b4 =
+  \x0 ->
+    \x1 ->
+      \x2 ->
+        fmap BG.fromFFIType (hs_bindgen_80756391f00963b4_base (BG.toFFIType x0) (BG.toFFIType x1) (BG.toFFIType x2))
+
+{-| __DEPRECATION NOTICE__ : This method is scheduled for removal in a future release.
+
+    history:
+
+    * stable: v0.1.0
+
+    * deprecated: v1.0.0
+
+    [__@result@__]:
+
+    [__@col@__]:
+
+    [__@row@__]:
+
+    __Returns:__ double
+
+    __C declaration:__ @duckdb_value_double@
+
+    __defined at:__ @duckdb.h 9748:21@
+
+    __exported by:__ @duckdb.h@
+-}
+c_duckdb_value_double ::
+     BG.Ptr DuckDBResult
+     {- ^
+
+          [__@result@__]:
+
+          __C declaration:__ @result@
+     -}
+  -> DuckDBIdx
+     {- ^
+
+          [__@col@__]:
+
+          __C declaration:__ @col@
+     -}
+  -> DuckDBIdx
+     {- ^
+
+          [__@row@__]:
+
+          __C declaration:__ @row@
+     -}
+  -> IO BG.CDouble
+c_duckdb_value_double = hs_bindgen_80756391f00963b4
+
+-- __unique:__ @Database_DuckDB_FFI_Database.DuckDB.FFI_Safe_duckdb_value_date@
+foreign import ccall safe "hs_bindgen_b01230d807dca469" hs_bindgen_b01230d807dca469_base ::
+     BG.Ptr BG.Void
+  -> HsBindgen.Runtime.LibC.Word64
+  -> HsBindgen.Runtime.LibC.Word64
+  -> BG.Ptr BG.Void
+  -> IO ()
+
+-- __unique:__ @Database_DuckDB_FFI_Database.DuckDB.FFI_Safe_duckdb_value_date@
+hs_bindgen_b01230d807dca469 ::
+     BG.Ptr DuckDBResult
+  -> DuckDBIdx
+  -> DuckDBIdx
+  -> BG.Ptr DuckDBDate
+  -> IO ()
+hs_bindgen_b01230d807dca469 =
+  \x0 ->
+    \x1 ->
+      \x2 ->
+        \x3 ->
+          hs_bindgen_b01230d807dca469_base (BG.toFFIType x0) (BG.toFFIType x1) (BG.toFFIType x2) (BG.toFFIType x3)
+
+{-| __DEPRECATION NOTICE__ : This method is scheduled for removal in a future release.
+
+    history:
+
+    * stable: v0.2.9
+
+    * deprecated: v1.0.0
+
+    [__@result@__]:
+
+    [__@col@__]:
+
+    [__@row@__]:
+
+    __Returns:__ t'DuckDBDate'
+
+    __C declaration:__ @duckdb_value_date@
+
+    __defined at:__ @duckdb.h 9764:26@
+
+    __exported by:__ @duckdb.h@
+-}
+c_duckdb_value_date ::
+     BG.Ptr DuckDBResult
+     {- ^
+
+          [__@result@__]:
+
+          __C declaration:__ @result@
+     -}
+  -> DuckDBIdx
+     {- ^
+
+          [__@col@__]:
+
+          __C declaration:__ @col@
+     -}
+  -> DuckDBIdx
+     {- ^
+
+          [__@row@__]:
+
+          __C declaration:__ @row@
+     -}
+  -> IO DuckDBDate
+c_duckdb_value_date =
+  \result0 ->
+    \col1 ->
+      \row2 ->
+        BG.allocaAndPeek (\res3 ->
+                            hs_bindgen_b01230d807dca469 result0 col1 row2 res3)
+
+-- __unique:__ @Database_DuckDB_FFI_Database.DuckDB.FFI_Safe_duckdb_value_time@
+foreign import ccall safe "hs_bindgen_18390c0158b2c517" hs_bindgen_18390c0158b2c517_base ::
+     BG.Ptr BG.Void
+  -> HsBindgen.Runtime.LibC.Word64
+  -> HsBindgen.Runtime.LibC.Word64
+  -> BG.Ptr BG.Void
+  -> IO ()
+
+-- __unique:__ @Database_DuckDB_FFI_Database.DuckDB.FFI_Safe_duckdb_value_time@
+hs_bindgen_18390c0158b2c517 ::
+     BG.Ptr DuckDBResult
+  -> DuckDBIdx
+  -> DuckDBIdx
+  -> BG.Ptr DuckDBTime
+  -> IO ()
+hs_bindgen_18390c0158b2c517 =
+  \x0 ->
+    \x1 ->
+      \x2 ->
+        \x3 ->
+          hs_bindgen_18390c0158b2c517_base (BG.toFFIType x0) (BG.toFFIType x1) (BG.toFFIType x2) (BG.toFFIType x3)
+
+{-| __DEPRECATION NOTICE__ : This method is scheduled for removal in a future release.
+
+    history:
+
+    * stable: v0.2.9
+
+    * deprecated: v1.0.0
+
+    [__@result@__]:
+
+    [__@col@__]:
+
+    [__@row@__]:
+
+    __Returns:__ t'DuckDBTime'
+
+    __C declaration:__ @duckdb_value_time@
+
+    __defined at:__ @duckdb.h 9780:26@
+
+    __exported by:__ @duckdb.h@
+-}
+c_duckdb_value_time ::
+     BG.Ptr DuckDBResult
+     {- ^
+
+          [__@result@__]:
+
+          __C declaration:__ @result@
+     -}
+  -> DuckDBIdx
+     {- ^
+
+          [__@col@__]:
+
+          __C declaration:__ @col@
+     -}
+  -> DuckDBIdx
+     {- ^
+
+          [__@row@__]:
+
+          __C declaration:__ @row@
+     -}
+  -> IO DuckDBTime
+c_duckdb_value_time =
+  \result0 ->
+    \col1 ->
+      \row2 ->
+        BG.allocaAndPeek (\res3 ->
+                            hs_bindgen_18390c0158b2c517 result0 col1 row2 res3)
+
+-- __unique:__ @Database_DuckDB_FFI_Database.DuckDB.FFI_Safe_duckdb_value_timestamp@
+foreign import ccall safe "hs_bindgen_bd4e0af7e013790b" hs_bindgen_bd4e0af7e013790b_base ::
+     BG.Ptr BG.Void
+  -> HsBindgen.Runtime.LibC.Word64
+  -> HsBindgen.Runtime.LibC.Word64
+  -> BG.Ptr BG.Void
+  -> IO ()
+
+-- __unique:__ @Database_DuckDB_FFI_Database.DuckDB.FFI_Safe_duckdb_value_timestamp@
+hs_bindgen_bd4e0af7e013790b ::
+     BG.Ptr DuckDBResult
+  -> DuckDBIdx
+  -> DuckDBIdx
+  -> BG.Ptr DuckDBTimestamp
+  -> IO ()
+hs_bindgen_bd4e0af7e013790b =
+  \x0 ->
+    \x1 ->
+      \x2 ->
+        \x3 ->
+          hs_bindgen_bd4e0af7e013790b_base (BG.toFFIType x0) (BG.toFFIType x1) (BG.toFFIType x2) (BG.toFFIType x3)
+
+{-| __DEPRECATION NOTICE__ : This method is scheduled for removal in a future release.
+
+    history:
+
+    * stable: v0.2.9
+
+    * deprecated: v1.0.0
+
+    [__@result@__]:
+
+    [__@col@__]:
+
+    [__@row@__]:
+
+    __Returns:__ t'DuckDBTimestamp'
+
+    __C declaration:__ @duckdb_value_timestamp@
+
+    __defined at:__ @duckdb.h 9796:31@
+
+    __exported by:__ @duckdb.h@
+-}
+c_duckdb_value_timestamp ::
+     BG.Ptr DuckDBResult
+     {- ^
+
+          [__@result@__]:
+
+          __C declaration:__ @result@
+     -}
+  -> DuckDBIdx
+     {- ^
+
+          [__@col@__]:
+
+          __C declaration:__ @col@
+     -}
+  -> DuckDBIdx
+     {- ^
+
+          [__@row@__]:
+
+          __C declaration:__ @row@
+     -}
+  -> IO DuckDBTimestamp
+c_duckdb_value_timestamp =
+  \result0 ->
+    \col1 ->
+      \row2 ->
+        BG.allocaAndPeek (\res3 ->
+                            hs_bindgen_bd4e0af7e013790b result0 col1 row2 res3)
+
+-- __unique:__ @Database_DuckDB_FFI_Database.DuckDB.FFI_Safe_duckdb_value_interval@
+foreign import ccall safe "hs_bindgen_646a763945377be5" hs_bindgen_646a763945377be5_base ::
+     BG.Ptr BG.Void
+  -> HsBindgen.Runtime.LibC.Word64
+  -> HsBindgen.Runtime.LibC.Word64
+  -> BG.Ptr BG.Void
+  -> IO ()
+
+-- __unique:__ @Database_DuckDB_FFI_Database.DuckDB.FFI_Safe_duckdb_value_interval@
+hs_bindgen_646a763945377be5 ::
+     BG.Ptr DuckDBResult
+  -> DuckDBIdx
+  -> DuckDBIdx
+  -> BG.Ptr DuckDBInterval
+  -> IO ()
+hs_bindgen_646a763945377be5 =
+  \x0 ->
+    \x1 ->
+      \x2 ->
+        \x3 ->
+          hs_bindgen_646a763945377be5_base (BG.toFFIType x0) (BG.toFFIType x1) (BG.toFFIType x2) (BG.toFFIType x3)
+
+{-| __DEPRECATION NOTICE__ : This method is scheduled for removal in a future release.
+
+    history:
+
+    * stable: v0.2.9
+
+    * deprecated: v1.0.0
+
+    [__@result@__]:
+
+    [__@col@__]:
+
+    [__@row@__]:
+
+    __Returns:__ t'DuckDBInterval'
+
+    __C declaration:__ @duckdb_value_interval@
+
+    __defined at:__ @duckdb.h 9812:30@
+
+    __exported by:__ @duckdb.h@
+-}
+c_duckdb_value_interval ::
+     BG.Ptr DuckDBResult
+     {- ^
+
+          [__@result@__]:
+
+          __C declaration:__ @result@
+     -}
+  -> DuckDBIdx
+     {- ^
+
+          [__@col@__]:
+
+          __C declaration:__ @col@
+     -}
+  -> DuckDBIdx
+     {- ^
+
+          [__@row@__]:
+
+          __C declaration:__ @row@
+     -}
+  -> IO DuckDBInterval
+c_duckdb_value_interval =
+  \result0 ->
+    \col1 ->
+      \row2 ->
+        BG.allocaAndPeek (\res3 ->
+                            hs_bindgen_646a763945377be5 result0 col1 row2 res3)
+
+-- __unique:__ @Database_DuckDB_FFI_Database.DuckDB.FFI_Safe_duckdb_value_varchar@
+foreign import ccall safe "hs_bindgen_a9ba2c181c1b3356" hs_bindgen_a9ba2c181c1b3356_base ::
+     BG.Ptr BG.Void
+  -> HsBindgen.Runtime.LibC.Word64
+  -> HsBindgen.Runtime.LibC.Word64
+  -> IO (BG.Ptr BG.Void)
+
+-- __unique:__ @Database_DuckDB_FFI_Database.DuckDB.FFI_Safe_duckdb_value_varchar@
+hs_bindgen_a9ba2c181c1b3356 ::
+     BG.Ptr DuckDBResult
+  -> DuckDBIdx
+  -> DuckDBIdx
+  -> IO (BG.Ptr BG.CChar)
+hs_bindgen_a9ba2c181c1b3356 =
+  \x0 ->
+    \x1 ->
+      \x2 ->
+        fmap BG.fromFFIType (hs_bindgen_a9ba2c181c1b3356_base (BG.toFFIType x0) (BG.toFFIType x1) (BG.toFFIType x2))
+
+{-| __DEPRECATION NOTICE__ : This method is scheduled for removal in a future release.
+
+    history:
+
+    * stable: v0.1.0
+
+    * deprecated: v1.0.0
+
+    [__@result@__]:
+
+    [__@col@__]:
+
+    [__@row@__]:
+
+    __Returns:__ char*
+
+    __C declaration:__ @duckdb_value_varchar@
+
+    __defined at:__ @duckdb.h 9828:20@
+
+    __exported by:__ @duckdb.h@
+-}
+c_duckdb_value_varchar ::
+     BG.Ptr DuckDBResult
+     {- ^
+
+          [__@result@__]:
+
+          __C declaration:__ @result@
+     -}
+  -> DuckDBIdx
+     {- ^
+
+          [__@col@__]:
+
+          __C declaration:__ @col@
+     -}
+  -> DuckDBIdx
+     {- ^
+
+          [__@row@__]:
+
+          __C declaration:__ @row@
+     -}
+  -> IO (BG.Ptr BG.CChar)
+c_duckdb_value_varchar = hs_bindgen_a9ba2c181c1b3356
+
+-- __unique:__ @Database_DuckDB_FFI_Database.DuckDB.FFI_Safe_duckdb_value_string@
+foreign import ccall safe "hs_bindgen_13010e42068fb039" hs_bindgen_13010e42068fb039_base ::
+     BG.Ptr BG.Void
+  -> HsBindgen.Runtime.LibC.Word64
+  -> HsBindgen.Runtime.LibC.Word64
+  -> BG.Ptr BG.Void
+  -> IO ()
+
+-- __unique:__ @Database_DuckDB_FFI_Database.DuckDB.FFI_Safe_duckdb_value_string@
+hs_bindgen_13010e42068fb039 ::
+     BG.Ptr DuckDBResult
+  -> DuckDBIdx
+  -> DuckDBIdx
+  -> BG.Ptr DuckDBString
+  -> IO ()
+hs_bindgen_13010e42068fb039 =
+  \x0 ->
+    \x1 ->
+      \x2 ->
+        \x3 ->
+          hs_bindgen_13010e42068fb039_base (BG.toFFIType x0) (BG.toFFIType x1) (BG.toFFIType x2) (BG.toFFIType x3)
+
+{-| __DEPRECATION NOTICE__ : This method is scheduled for removal in a future release.
+
+    history:
+
+    * stable: v0.6.0
+
+    * deprecated: v1.0.0
+
+    [__@result@__]:
+
+    [__@col@__]:
+
+    [__@row@__]:
+
+    __Returns:__ t'DuckDBString'
+
+    __C declaration:__ @duckdb_value_string@
+
+    __defined at:__ @duckdb.h 9844:28@
+
+    __exported by:__ @duckdb.h@
+-}
+c_duckdb_value_string ::
+     BG.Ptr DuckDBResult
+     {- ^
+
+          [__@result@__]:
+
+          __C declaration:__ @result@
+     -}
+  -> DuckDBIdx
+     {- ^
+
+          [__@col@__]:
+
+          __C declaration:__ @col@
+     -}
+  -> DuckDBIdx
+     {- ^
+
+          [__@row@__]:
+
+          __C declaration:__ @row@
+     -}
+  -> IO DuckDBString
+c_duckdb_value_string =
+  \result0 ->
+    \col1 ->
+      \row2 ->
+        BG.allocaAndPeek (\res3 ->
+                            hs_bindgen_13010e42068fb039 result0 col1 row2 res3)
+
+-- __unique:__ @Database_DuckDB_FFI_Database.DuckDB.FFI_Safe_duckdb_value_varchar_internal@
+foreign import ccall safe "hs_bindgen_71da9a67e7c01761" hs_bindgen_71da9a67e7c01761_base ::
+     BG.Ptr BG.Void
+  -> HsBindgen.Runtime.LibC.Word64
+  -> HsBindgen.Runtime.LibC.Word64
+  -> IO (BG.Ptr BG.Void)
+
+-- __unique:__ @Database_DuckDB_FFI_Database.DuckDB.FFI_Safe_duckdb_value_varchar_internal@
+hs_bindgen_71da9a67e7c01761 ::
+     BG.Ptr DuckDBResult
+  -> DuckDBIdx
+  -> DuckDBIdx
+  -> IO (BG.Ptr BG.CChar)
+hs_bindgen_71da9a67e7c01761 =
+  \x0 ->
+    \x1 ->
+      \x2 ->
+        fmap BG.fromFFIType (hs_bindgen_71da9a67e7c01761_base (BG.toFFIType x0) (BG.toFFIType x1) (BG.toFFIType x2))
+
+{-| __DEPRECATION NOTICE__ : This method is scheduled for removal in a future release.
+
+    history:
+
+    * stable: v0.2.9
+
+    * deprecated: v1.0.0
+
+    [__@result@__]:
+
+    [__@col@__]:
+
+    [__@row@__]:
+
+    __Returns:__ char*
+
+    __C declaration:__ @duckdb_value_varchar_internal@
+
+    __defined at:__ @duckdb.h 9860:20@
+
+    __exported by:__ @duckdb.h@
+-}
+c_duckdb_value_varchar_internal ::
+     BG.Ptr DuckDBResult
+     {- ^
+
+          [__@result@__]:
+
+          __C declaration:__ @result@
+     -}
+  -> DuckDBIdx
+     {- ^
+
+          [__@col@__]:
+
+          __C declaration:__ @col@
+     -}
+  -> DuckDBIdx
+     {- ^
+
+          [__@row@__]:
+
+          __C declaration:__ @row@
+     -}
+  -> IO (BG.Ptr BG.CChar)
+c_duckdb_value_varchar_internal =
+  hs_bindgen_71da9a67e7c01761
+
+-- __unique:__ @Database_DuckDB_FFI_Database.DuckDB.FFI_Safe_duckdb_value_string_internal@
+foreign import ccall safe "hs_bindgen_65b73058a4eafeaa" hs_bindgen_65b73058a4eafeaa_base ::
+     BG.Ptr BG.Void
+  -> HsBindgen.Runtime.LibC.Word64
+  -> HsBindgen.Runtime.LibC.Word64
+  -> BG.Ptr BG.Void
+  -> IO ()
+
+-- __unique:__ @Database_DuckDB_FFI_Database.DuckDB.FFI_Safe_duckdb_value_string_internal@
+hs_bindgen_65b73058a4eafeaa ::
+     BG.Ptr DuckDBResult
+  -> DuckDBIdx
+  -> DuckDBIdx
+  -> BG.Ptr DuckDBString
+  -> IO ()
+hs_bindgen_65b73058a4eafeaa =
+  \x0 ->
+    \x1 ->
+      \x2 ->
+        \x3 ->
+          hs_bindgen_65b73058a4eafeaa_base (BG.toFFIType x0) (BG.toFFIType x1) (BG.toFFIType x2) (BG.toFFIType x3)
+
+{-| __DEPRECATION NOTICE__ : This method is scheduled for removal in a future release.
+
+    history:
+
+    * stable: v0.6.0
+
+    * deprecated: v1.0.0
+
+    [__@result@__]:
+
+    [__@col@__]:
+
+    [__@row@__]:
+
+    __Returns:__ t'DuckDBString'
+
+    __C declaration:__ @duckdb_value_string_internal@
+
+    __defined at:__ @duckdb.h 9876:28@
+
+    __exported by:__ @duckdb.h@
+-}
+c_duckdb_value_string_internal ::
+     BG.Ptr DuckDBResult
+     {- ^
+
+          [__@result@__]:
+
+          __C declaration:__ @result@
+     -}
+  -> DuckDBIdx
+     {- ^
+
+          [__@col@__]:
+
+          __C declaration:__ @col@
+     -}
+  -> DuckDBIdx
+     {- ^
+
+          [__@row@__]:
+
+          __C declaration:__ @row@
+     -}
+  -> IO DuckDBString
+c_duckdb_value_string_internal =
+  \result0 ->
+    \col1 ->
+      \row2 ->
+        BG.allocaAndPeek (\res3 ->
+                            hs_bindgen_65b73058a4eafeaa result0 col1 row2 res3)
+
+-- __unique:__ @Database_DuckDB_FFI_Database.DuckDB.FFI_Safe_duckdb_value_blob@
+foreign import ccall safe "hs_bindgen_d9b2a307bf4c994e" hs_bindgen_d9b2a307bf4c994e_base ::
+     BG.Ptr BG.Void
+  -> HsBindgen.Runtime.LibC.Word64
+  -> HsBindgen.Runtime.LibC.Word64
+  -> BG.Ptr BG.Void
+  -> IO ()
+
+-- __unique:__ @Database_DuckDB_FFI_Database.DuckDB.FFI_Safe_duckdb_value_blob@
+hs_bindgen_d9b2a307bf4c994e ::
+     BG.Ptr DuckDBResult
+  -> DuckDBIdx
+  -> DuckDBIdx
+  -> BG.Ptr DuckDBBlob
+  -> IO ()
+hs_bindgen_d9b2a307bf4c994e =
+  \x0 ->
+    \x1 ->
+      \x2 ->
+        \x3 ->
+          hs_bindgen_d9b2a307bf4c994e_base (BG.toFFIType x0) (BG.toFFIType x1) (BG.toFFIType x2) (BG.toFFIType x3)
+
+{-| __DEPRECATION NOTICE__ : This method is scheduled for removal in a future release.
+
+    history:
+
+    * stable: v0.2.5
+
+    * deprecated: v1.0.0
+
+    [__@result@__]:
+
+    [__@col@__]:
+
+    [__@row@__]:
+
+    __Returns:__ t'DuckDBBlob'
+
+    __C declaration:__ @duckdb_value_blob@
+
+    __defined at:__ @duckdb.h 9892:26@
+
+    __exported by:__ @duckdb.h@
+-}
+c_duckdb_value_blob ::
+     BG.Ptr DuckDBResult
+     {- ^
+
+          [__@result@__]:
+
+          __C declaration:__ @result@
+     -}
+  -> DuckDBIdx
+     {- ^
+
+          [__@col@__]:
+
+          __C declaration:__ @col@
+     -}
+  -> DuckDBIdx
+     {- ^
+
+          [__@row@__]:
+
+          __C declaration:__ @row@
+     -}
+  -> IO DuckDBBlob
+c_duckdb_value_blob =
+  \result0 ->
+    \col1 ->
+      \row2 ->
+        BG.allocaAndPeek (\res3 ->
+                            hs_bindgen_d9b2a307bf4c994e result0 col1 row2 res3)
+
+-- __unique:__ @Database_DuckDB_FFI_Database.DuckDB.FFI_Safe_duckdb_value_is_null@
+foreign import ccall safe "hs_bindgen_4f187070ae13bdb4" hs_bindgen_4f187070ae13bdb4_base ::
+     BG.Ptr BG.Void
+  -> HsBindgen.Runtime.LibC.Word64
+  -> HsBindgen.Runtime.LibC.Word64
+  -> IO BG.CBool
+
+-- __unique:__ @Database_DuckDB_FFI_Database.DuckDB.FFI_Safe_duckdb_value_is_null@
+hs_bindgen_4f187070ae13bdb4 ::
+     BG.Ptr DuckDBResult
+  -> DuckDBIdx
+  -> DuckDBIdx
+  -> IO BG.CBool
+hs_bindgen_4f187070ae13bdb4 =
+  \x0 ->
+    \x1 ->
+      \x2 ->
+        fmap BG.fromFFIType (hs_bindgen_4f187070ae13bdb4_base (BG.toFFIType x0) (BG.toFFIType x1) (BG.toFFIType x2))
+
+{-| __DEPRECATION NOTICE__ : This method is scheduled for removal in a future release.
+
+    history:
+
+    * stable: v0.2.9
+
+    * deprecated: v1.0.0
+
+    [__@result@__]:
+
+    [__@col@__]:
+
+    [__@row@__]:
+
+    __Returns:__ bool
+
+    __C declaration:__ @duckdb_value_is_null@
+
+    __defined at:__ @duckdb.h 9908:19@
+
+    __exported by:__ @duckdb.h@
+-}
+c_duckdb_value_is_null ::
+     BG.Ptr DuckDBResult
+     {- ^
+
+          [__@result@__]:
+
+          __C declaration:__ @result@
+     -}
+  -> DuckDBIdx
+     {- ^
+
+          [__@col@__]:
+
+          __C declaration:__ @col@
+     -}
+  -> DuckDBIdx
+     {- ^
+
+          [__@row@__]:
+
+          __C declaration:__ @row@
+     -}
+  -> IO BG.CBool
+c_duckdb_value_is_null = hs_bindgen_4f187070ae13bdb4
+
+-- __unique:__ @Database_DuckDB_FFI_Database.DuckDB.FFI_Safe_duckdb_create_vector@
+foreign import ccall safe "hs_bindgen_5a72a174d3b35592" hs_bindgen_5a72a174d3b35592_base ::
+     BG.Ptr BG.Void
+  -> HsBindgen.Runtime.LibC.Word64
+  -> IO (BG.Ptr BG.Void)
+
+-- __unique:__ @Database_DuckDB_FFI_Database.DuckDB.FFI_Safe_duckdb_create_vector@
+hs_bindgen_5a72a174d3b35592 ::
+     DuckDBLogicalType
+  -> DuckDBIdx
+  -> IO DuckDBVector
+hs_bindgen_5a72a174d3b35592 =
+  \x0 ->
+    \x1 ->
+      fmap BG.fromFFIType (hs_bindgen_5a72a174d3b35592_base (BG.toFFIType x0) (BG.toFFIType x1))
+
+{-| Creates a flat vector. Must be destroyed with @'c_duckdb_destroy_vector'@ .
+
+    history:
+
+    * unstable: v1.3.0
+
+    * stable: v1.5.6
+
+    [__@type@__]: The logical type of the vector.
+
+    [__@capacity@__]: The capacity of the vector.
+
+    __Returns:__ t'DuckDBVector'
+
+    __C declaration:__ @duckdb_create_vector@
+
+    __defined at:__ @duckdb.h 9941:28@
+
+    __exported by:__ @duckdb.h@
+-}
+c_duckdb_create_vector ::
+     DuckDBLogicalType
+     {- ^
+
+          [__@type@__]: The logical type of the vector.
+
+          __C declaration:__ @type@
+     -}
+  -> DuckDBIdx
+     {- ^
+
+          [__@capacity@__]: The capacity of the vector.
+
+          __C declaration:__ @capacity@
+     -}
+  -> IO DuckDBVector
+c_duckdb_create_vector = hs_bindgen_5a72a174d3b35592
+
+-- __unique:__ @Database_DuckDB_FFI_Database.DuckDB.FFI_Safe_duckdb_destroy_vector@
+foreign import ccall safe "hs_bindgen_b7d6d6c4c6a20da5" hs_bindgen_b7d6d6c4c6a20da5_base ::
+     BG.Ptr BG.Void
+  -> IO ()
+
+-- __unique:__ @Database_DuckDB_FFI_Database.DuckDB.FFI_Safe_duckdb_destroy_vector@
+hs_bindgen_b7d6d6c4c6a20da5 ::
+     BG.Ptr DuckDBVector
+  -> IO ()
+hs_bindgen_b7d6d6c4c6a20da5 =
+  \x0 ->
+    hs_bindgen_b7d6d6c4c6a20da5_base (BG.toFFIType x0)
+
+{-| Destroys the vector and de-allocates its memory.
+
+    history:
+
+    * unstable: v1.3.0
+
+    * stable: v1.5.6
+
+    [__@vector@__]: A pointer to the vector.
+
+    __Returns:__ void
+
+    __C declaration:__ @duckdb_destroy_vector@
+
+    __defined at:__ @duckdb.h 9955:19@
+
+    __exported by:__ @duckdb.h@
+-}
+c_duckdb_destroy_vector ::
+     BG.Ptr DuckDBVector
+     {- ^
+
+          [__@vector@__]: A pointer to the vector.
+
+          __C declaration:__ @vector@
+     -}
+  -> IO ()
+c_duckdb_destroy_vector = hs_bindgen_b7d6d6c4c6a20da5
+
+-- __unique:__ @Database_DuckDB_FFI_Database.DuckDB.FFI_Safe_duckdb_vector_get_column_type@
+foreign import ccall safe "hs_bindgen_cf2be23e58c169ae" hs_bindgen_cf2be23e58c169ae_base ::
+     BG.Ptr BG.Void
+  -> IO (BG.Ptr BG.Void)
+
+-- __unique:__ @Database_DuckDB_FFI_Database.DuckDB.FFI_Safe_duckdb_vector_get_column_type@
+hs_bindgen_cf2be23e58c169ae ::
+     DuckDBVector
+  -> IO DuckDBLogicalType
+hs_bindgen_cf2be23e58c169ae =
+  \x0 ->
+    fmap BG.fromFFIType (hs_bindgen_cf2be23e58c169ae_base (BG.toFFIType x0))
+
+{-| Retrieves the column type of the specified vector.
+
+    The result must be destroyed with @'c_duckdb_destroy_logical_type'@ .
+
+    history:
+
+    * stable: v0.3.3
+
+    [__@vector@__]: The vector get the data from
+
+    __Returns:__ t'DuckDBLogicalType'
+
+    __C declaration:__ @duckdb_vector_get_column_type@
+
+    __defined at:__ @duckdb.h 9970:34@
+
+    __exported by:__ @duckdb.h@
+-}
+c_duckdb_vector_get_column_type ::
+     DuckDBVector
+     {- ^
+
+          [__@vector@__]: The vector get the data from
+
+          __C declaration:__ @vector@
+     -}
+  -> IO DuckDBLogicalType
+c_duckdb_vector_get_column_type =
+  hs_bindgen_cf2be23e58c169ae
+
+-- __unique:__ @Database_DuckDB_FFI_Database.DuckDB.FFI_Safe_duckdb_vector_get_data@
+foreign import ccall safe "hs_bindgen_07e2e0f2f46d24a5" hs_bindgen_07e2e0f2f46d24a5_base ::
+     BG.Ptr BG.Void
+  -> IO (BG.Ptr BG.Void)
+
+-- __unique:__ @Database_DuckDB_FFI_Database.DuckDB.FFI_Safe_duckdb_vector_get_data@
+hs_bindgen_07e2e0f2f46d24a5 ::
+     DuckDBVector
+  -> IO (BG.Ptr BG.Void)
+hs_bindgen_07e2e0f2f46d24a5 =
+  \x0 ->
+    fmap BG.fromFFIType (hs_bindgen_07e2e0f2f46d24a5_base (BG.toFFIType x0))
+
+{-| Retrieves the data pointer of the vector.
+
+    The data pointer can be used to read or write values from the vector. How to read or write values depends on the type of the vector.
+
+    history:
+
+    * stable: v0.3.3
+
+    [__@vector@__]: The vector to get the data from
+
+    __Returns:__ void*
+
+    __C declaration:__ @duckdb_vector_get_data@
+
+    __defined at:__ @duckdb.h 9986:20@
+
+    __exported by:__ @duckdb.h@
+-}
+c_duckdb_vector_get_data ::
+     DuckDBVector
+     {- ^
+
+          [__@vector@__]: The vector to get the data from
+
+          __C declaration:__ @vector@
+     -}
+  -> IO (BG.Ptr BG.Void)
+c_duckdb_vector_get_data =
+  hs_bindgen_07e2e0f2f46d24a5
+
+-- __unique:__ @Database_DuckDB_FFI_Database.DuckDB.FFI_Safe_duckdb_vector_get_validity@
+foreign import ccall safe "hs_bindgen_28185ea7bb3758c3" hs_bindgen_28185ea7bb3758c3_base ::
+     BG.Ptr BG.Void
+  -> IO (BG.Ptr BG.Void)
+
+-- __unique:__ @Database_DuckDB_FFI_Database.DuckDB.FFI_Safe_duckdb_vector_get_validity@
+hs_bindgen_28185ea7bb3758c3 ::
+     DuckDBVector
+  -> IO (BG.Ptr HsBindgen.Runtime.LibC.Word64)
+hs_bindgen_28185ea7bb3758c3 =
+  \x0 ->
+    fmap BG.fromFFIType (hs_bindgen_28185ea7bb3758c3_base (BG.toFFIType x0))
+
+{-| Retrieves the validity mask pointer of the specified vector.
+
+    If all values are valid, this function MIGHT return NULL!
+
+    The validity mask is a bitset that signifies null-ness within the data chunk. It is a series of uint64_t values, where each uint64_t value contains validity for 64 tuples. The bit is set to 1 if the value is valid (i.e. not NULL) or 0 if the value is invalid (i.e. NULL).
+
+    Validity of a specific value can be obtained like this:
+
+    t'DuckDBIdx' entry_idx = row_idx / 64; t'DuckDBIdx' idx_in_entry = row_idx % 64; bool is_valid = validity_mask[entry_idx] & (1 << idx_in_entry);
+
+    Alternatively, the (slower) duckdb_validity_row_is_valid function can be used.
+
+    history:
+
+    * stable: v0.3.3
+
+    [__@vector@__]: The vector to get the data from
+
+    __Returns:__ uint64_t*
+
+    __C declaration:__ @duckdb_vector_get_validity@
+
+    __defined at:__ @duckdb.h 10012:24@
+
+    __exported by:__ @duckdb.h@
+-}
+c_duckdb_vector_get_validity ::
+     DuckDBVector
+     {- ^
+
+          [__@vector@__]: The vector to get the data from
+
+          __C declaration:__ @vector@
+     -}
+  -> IO (BG.Ptr HsBindgen.Runtime.LibC.Word64)
+c_duckdb_vector_get_validity =
+  hs_bindgen_28185ea7bb3758c3
+
+-- __unique:__ @Database_DuckDB_FFI_Database.DuckDB.FFI_Safe_duckdb_vector_ensure_validity_writable@
+foreign import ccall safe "hs_bindgen_77e4922622421a6f" hs_bindgen_77e4922622421a6f_base ::
+     BG.Ptr BG.Void
+  -> IO ()
+
+-- __unique:__ @Database_DuckDB_FFI_Database.DuckDB.FFI_Safe_duckdb_vector_ensure_validity_writable@
+hs_bindgen_77e4922622421a6f ::
+     DuckDBVector
+  -> IO ()
+hs_bindgen_77e4922622421a6f =
+  \x0 ->
+    hs_bindgen_77e4922622421a6f_base (BG.toFFIType x0)
+
+{-| Ensures the validity mask is writable by allocating it.
+
+    After this function is called, @'c_duckdb_vector_get_validity'@ will ALWAYS return non-NULL. This allows NULL values to be written to the vector, regardless of whether a validity mask was present before.
+
+    history:
+
+    * stable: v0.3.3
+
+    [__@vector@__]: The vector to alter
+
+    __Returns:__ void
+
+    __C declaration:__ @duckdb_vector_ensure_validity_writable@
+
+    __defined at:__ @duckdb.h 10028:19@
+
+    __exported by:__ @duckdb.h@
+-}
+c_duckdb_vector_ensure_validity_writable ::
+     DuckDBVector
+     {- ^
+
+          [__@vector@__]: The vector to alter
+
+          __C declaration:__ @vector@
+     -}
+  -> IO ()
+c_duckdb_vector_ensure_validity_writable =
+  hs_bindgen_77e4922622421a6f
+
+-- __unique:__ @Database_DuckDB_FFI_Database.DuckDB.FFI_Safe_duckdb_vector_assign_string_element@
+foreign import ccall safe "hs_bindgen_7236c6c4ac76f787" hs_bindgen_7236c6c4ac76f787_base ::
+     BG.Ptr BG.Void
+  -> HsBindgen.Runtime.LibC.Word64
+  -> BG.Ptr BG.Void
+  -> IO ()
+
+-- __unique:__ @Database_DuckDB_FFI_Database.DuckDB.FFI_Safe_duckdb_vector_assign_string_element@
+hs_bindgen_7236c6c4ac76f787 ::
+     DuckDBVector
+  -> DuckDBIdx
+  -> PtrConst.PtrConst BG.CChar
+  -> IO ()
+hs_bindgen_7236c6c4ac76f787 =
+  \x0 ->
+    \x1 ->
+      \x2 ->
+        hs_bindgen_7236c6c4ac76f787_base (BG.toFFIType x0) (BG.toFFIType x1) (BG.toFFIType x2)
+
+{-| Assigns a string element in the vector at the specified location. For VARCHAR vectors, the input is validated as UTF-8; if invalid, a NULL value is assigned at that index.
+
+    Superseded by @'c_duckdb_unsafe_vector_assign_string_element_len'@ , optionally combined with @'c_duckdb_valid_utf8_check'@ .
+
+    history:
+
+    * stable: v0.3.3
+
+    [__@vector@__]: The vector to alter
+
+    [__@index@__]: The row position in the vector to assign the string to
+
+    [__@str@__]: The null-terminated string
+
+    __Returns:__ void
+
+    __C declaration:__ @duckdb_vector_assign_string_element@
+
+    __defined at:__ @duckdb.h 10046:19@
+
+    __exported by:__ @duckdb.h@
+-}
+c_duckdb_vector_assign_string_element ::
+     DuckDBVector
+     {- ^
+
+          [__@vector@__]: The vector to alter
+
+          __C declaration:__ @vector@
+     -}
+  -> DuckDBIdx
+     {- ^
+
+          [__@index@__]: The row position in the vector to assign the string to
+
+          __C declaration:__ @index@
+     -}
+  -> PtrConst.PtrConst BG.CChar
+     {- ^
+
+          [__@str@__]: The null-terminated string
+
+          __C declaration:__ @str@
+     -}
+  -> IO ()
+c_duckdb_vector_assign_string_element =
+  hs_bindgen_7236c6c4ac76f787
+
+-- __unique:__ @Database_DuckDB_FFI_Database.DuckDB.FFI_Safe_duckdb_vector_assign_string_element_len@
+foreign import ccall safe "hs_bindgen_d73453c618ddc22f" hs_bindgen_d73453c618ddc22f_base ::
+     BG.Ptr BG.Void
+  -> HsBindgen.Runtime.LibC.Word64
+  -> BG.Ptr BG.Void
+  -> HsBindgen.Runtime.LibC.Word64
+  -> IO ()
+
+-- __unique:__ @Database_DuckDB_FFI_Database.DuckDB.FFI_Safe_duckdb_vector_assign_string_element_len@
+hs_bindgen_d73453c618ddc22f ::
+     DuckDBVector
+  -> DuckDBIdx
+  -> PtrConst.PtrConst BG.CChar
+  -> DuckDBIdx
+  -> IO ()
+hs_bindgen_d73453c618ddc22f =
+  \x0 ->
+    \x1 ->
+      \x2 ->
+        \x3 ->
+          hs_bindgen_d73453c618ddc22f_base (BG.toFFIType x0) (BG.toFFIType x1) (BG.toFFIType x2) (BG.toFFIType x3)
+
+{-| Assigns a string element in the vector at the specified location. For VARCHAR vectors, the input is validated as UTF-8; if invalid, a NULL value is assigned at that index. For BLOB vectors, no validation is performed.
+
+    Superseded by @'c_duckdb_unsafe_vector_assign_string_element_len'@ , optionally combined with @'c_duckdb_valid_utf8_check'@ .
+
+    history:
+
+    * stable: v0.3.3
+
+    [__@vector@__]: The vector to alter
+
+    [__@index@__]: The row position in the vector to assign the string to
+
+    [__@str@__]: The string
+
+    [__@str_len@__]: The length of the string (in bytes)
+
+    __Returns:__ void
+
+    __C declaration:__ @duckdb_vector_assign_string_element_len@
+
+    __defined at:__ @duckdb.h 10065:19@
+
+    __exported by:__ @duckdb.h@
+-}
+c_duckdb_vector_assign_string_element_len ::
+     DuckDBVector
+     {- ^
+
+          [__@vector@__]: The vector to alter
+
+          __C declaration:__ @vector@
+     -}
+  -> DuckDBIdx
+     {- ^
+
+          [__@index@__]: The row position in the vector to assign the string to
+
+          __C declaration:__ @index@
+     -}
+  -> PtrConst.PtrConst BG.CChar
+     {- ^
+
+          [__@str@__]: The string
+
+          __C declaration:__ @str@
+     -}
+  -> DuckDBIdx
+     {- ^
+
+          [__@str_len@__]: The length of the string (in bytes)
+
+          __C declaration:__ @str_len@
+     -}
+  -> IO ()
+c_duckdb_vector_assign_string_element_len =
+  hs_bindgen_d73453c618ddc22f
+
+-- __unique:__ @Database_DuckDB_FFI_Database.DuckDB.FFI_Safe_duckdb_unsafe_vector_assign_string_element_len@
+foreign import ccall safe "hs_bindgen_17556343e48a077e" hs_bindgen_17556343e48a077e_base ::
+     BG.Ptr BG.Void
+  -> HsBindgen.Runtime.LibC.Word64
+  -> BG.Ptr BG.Void
+  -> HsBindgen.Runtime.LibC.Word64
+  -> IO ()
+
+-- __unique:__ @Database_DuckDB_FFI_Database.DuckDB.FFI_Safe_duckdb_unsafe_vector_assign_string_element_len@
+hs_bindgen_17556343e48a077e ::
+     DuckDBVector
+  -> DuckDBIdx
+  -> PtrConst.PtrConst BG.CChar
+  -> DuckDBIdx
+  -> IO ()
+hs_bindgen_17556343e48a077e =
+  \x0 ->
+    \x1 ->
+      \x2 ->
+        \x3 ->
+          hs_bindgen_17556343e48a077e_base (BG.toFFIType x0) (BG.toFFIType x1) (BG.toFFIType x2) (BG.toFFIType x3)
+
+{-| Assigns a string element in the vector at the specified location without UTF-8 validation. The caller is responsible for ensuring the input is valid UTF-8. Use @'c_duckdb_valid_utf8_check'@ to validate strings before calling this function if needed. If the input is known to be valid UTF-8, this function can be called directly for better performance, avoiding the overhead of redundant validation.
+
+    history:
+
+    * unstable: v1.5.0
+
+    * stable: v1.5.6
+
+    [__@vector@__]: The vector to alter
+
+    [__@index@__]: The row position in the vector to assign the string to
+
+    [__@str@__]: The string
+
+    [__@str_len@__]: The length of the string (in bytes)
+
+    __Returns:__ void
+
+    __C declaration:__ @duckdb_unsafe_vector_assign_string_element_len@
+
+    __defined at:__ @duckdb.h 10086:19@
+
+    __exported by:__ @duckdb.h@
+-}
+c_duckdb_unsafe_vector_assign_string_element_len ::
+     DuckDBVector
+     {- ^
+
+          [__@vector@__]: The vector to alter
+
+          __C declaration:__ @vector@
+     -}
+  -> DuckDBIdx
+     {- ^
+
+          [__@index@__]: The row position in the vector to assign the string to
+
+          __C declaration:__ @index@
+     -}
+  -> PtrConst.PtrConst BG.CChar
+     {- ^
+
+          [__@str@__]: The string
+
+          __C declaration:__ @str@
+     -}
+  -> DuckDBIdx
+     {- ^
+
+          [__@str_len@__]: The length of the string (in bytes)
+
+          __C declaration:__ @str_len@
+     -}
+  -> IO ()
+c_duckdb_unsafe_vector_assign_string_element_len =
+  hs_bindgen_17556343e48a077e
+
+-- __unique:__ @Database_DuckDB_FFI_Database.DuckDB.FFI_Safe_duckdb_list_vector_get_child@
+foreign import ccall safe "hs_bindgen_b10dc3841ec1d1ad" hs_bindgen_b10dc3841ec1d1ad_base ::
+     BG.Ptr BG.Void
+  -> IO (BG.Ptr BG.Void)
+
+-- __unique:__ @Database_DuckDB_FFI_Database.DuckDB.FFI_Safe_duckdb_list_vector_get_child@
+hs_bindgen_b10dc3841ec1d1ad ::
+     DuckDBVector
+  -> IO DuckDBVector
+hs_bindgen_b10dc3841ec1d1ad =
+  \x0 ->
+    fmap BG.fromFFIType (hs_bindgen_b10dc3841ec1d1ad_base (BG.toFFIType x0))
+
+{-| Retrieves the child vector of a list vector.
+
+    The resulting vector is valid as long as the parent vector is valid.
+
+    history:
+
+    * stable: v0.3.3
+
+    [__@vector@__]: The vector
+
+    __Returns:__ t'DuckDBVector'
+
+    __C declaration:__ @duckdb_list_vector_get_child@
+
+    __defined at:__ @duckdb.h 10102:28@
+
+    __exported by:__ @duckdb.h@
+-}
+c_duckdb_list_vector_get_child ::
+     DuckDBVector
+     {- ^
+
+          [__@vector@__]: The vector
+
+          __C declaration:__ @vector@
+     -}
+  -> IO DuckDBVector
+c_duckdb_list_vector_get_child =
+  hs_bindgen_b10dc3841ec1d1ad
+
+-- __unique:__ @Database_DuckDB_FFI_Database.DuckDB.FFI_Safe_duckdb_list_vector_get_size@
+foreign import ccall safe "hs_bindgen_ec3353c36510d274" hs_bindgen_ec3353c36510d274_base ::
+     BG.Ptr BG.Void
+  -> IO HsBindgen.Runtime.LibC.Word64
+
+-- __unique:__ @Database_DuckDB_FFI_Database.DuckDB.FFI_Safe_duckdb_list_vector_get_size@
+hs_bindgen_ec3353c36510d274 ::
+     DuckDBVector
+  -> IO DuckDBIdx
+hs_bindgen_ec3353c36510d274 =
+  \x0 ->
+    fmap BG.fromFFIType (hs_bindgen_ec3353c36510d274_base (BG.toFFIType x0))
+
+{-| Returns the size of the child vector of the list.
+
+    history:
+
+    * stable: v0.3.3
+
+    [__@vector@__]: The vector
+
+    __Returns:__ t'DuckDBIdx'
+
+    __C declaration:__ @duckdb_list_vector_get_size@
+
+    __defined at:__ @duckdb.h 10115:20@
+
+    __exported by:__ @duckdb.h@
+-}
+c_duckdb_list_vector_get_size ::
+     DuckDBVector
+     {- ^
+
+          [__@vector@__]: The vector
+
+          __C declaration:__ @vector@
+     -}
+  -> IO DuckDBIdx
+c_duckdb_list_vector_get_size =
+  hs_bindgen_ec3353c36510d274
+
+-- __unique:__ @Database_DuckDB_FFI_Database.DuckDB.FFI_Safe_duckdb_list_vector_set_size@
+foreign import ccall safe "hs_bindgen_87686fe663edd51f" hs_bindgen_87686fe663edd51f_base ::
+     BG.Ptr BG.Void
+  -> HsBindgen.Runtime.LibC.Word64
+  -> IO BG.CUInt
+
+-- __unique:__ @Database_DuckDB_FFI_Database.DuckDB.FFI_Safe_duckdb_list_vector_set_size@
+hs_bindgen_87686fe663edd51f ::
+     DuckDBVector
+  -> DuckDBIdx
+  -> IO DuckDBState
+hs_bindgen_87686fe663edd51f =
+  \x0 ->
+    \x1 ->
+      fmap BG.fromFFIType (hs_bindgen_87686fe663edd51f_base (BG.toFFIType x0) (BG.toFFIType x1))
+
+{-| Sets the size of the underlying child-vector of a list vector. Note that this does NOT reserve the memory in the child buffer, and that it is possible to set a size exceeding the capacity. To set the capacity, use @'c_duckdb_list_vector_reserve'@ .
+
+    history:
+
+    * stable: v0.7.0
+
+    [__@vector@__]: The list vector.
+
+    [__@size@__]: The size of the child list.
+
+    __Returns:__ t'DuckDBState'
+
+    __C declaration:__ @duckdb_list_vector_set_size@
+
+    __defined at:__ @duckdb.h 10131:27@
+
+    __exported by:__ @duckdb.h@
+-}
+c_duckdb_list_vector_set_size ::
+     DuckDBVector
+     {- ^
+
+          [__@vector@__]: The list vector.
+
+          __C declaration:__ @vector@
+     -}
+  -> DuckDBIdx
+     {- ^
+
+          [__@size@__]: The size of the child list.
+
+          __C declaration:__ @size@
+     -}
+  -> IO DuckDBState
+c_duckdb_list_vector_set_size =
+  hs_bindgen_87686fe663edd51f
+
+-- __unique:__ @Database_DuckDB_FFI_Database.DuckDB.FFI_Safe_duckdb_list_vector_reserve@
+foreign import ccall safe "hs_bindgen_ccc0fe7414005ff4" hs_bindgen_ccc0fe7414005ff4_base ::
+     BG.Ptr BG.Void
+  -> HsBindgen.Runtime.LibC.Word64
+  -> IO BG.CUInt
+
+-- __unique:__ @Database_DuckDB_FFI_Database.DuckDB.FFI_Safe_duckdb_list_vector_reserve@
+hs_bindgen_ccc0fe7414005ff4 ::
+     DuckDBVector
+  -> DuckDBIdx
+  -> IO DuckDBState
+hs_bindgen_ccc0fe7414005ff4 =
+  \x0 ->
+    \x1 ->
+      fmap BG.fromFFIType (hs_bindgen_ccc0fe7414005ff4_base (BG.toFFIType x0) (BG.toFFIType x1))
+
+{-| Sets the capacity of the underlying child-vector of a list vector. We increment to the next power of two, based on the required capacity. Thus, the capacity might not match the size of the list (capacity >= size), which is set via @'c_duckdb_list_vector_set_size'@ .
+
+    history:
+
+    * stable: v0.7.0
+
+    [__@vector@__]: The list vector.
+
+    [__@required_capacity@__]: The child buffer capacity to reserve.
+
+    __Returns:__ t'DuckDBState'
+
+    __C declaration:__ @duckdb_list_vector_reserve@
+
+    __defined at:__ @duckdb.h 10147:27@
+
+    __exported by:__ @duckdb.h@
+-}
+c_duckdb_list_vector_reserve ::
+     DuckDBVector
+     {- ^
+
+          [__@vector@__]: The list vector.
+
+          __C declaration:__ @vector@
+     -}
+  -> DuckDBIdx
+     {- ^
+
+          [__@required_capacity@__]: The child buffer capacity to reserve.
+
+          __C declaration:__ @required_capacity@
+     -}
+  -> IO DuckDBState
+c_duckdb_list_vector_reserve =
+  hs_bindgen_ccc0fe7414005ff4
+
+-- __unique:__ @Database_DuckDB_FFI_Database.DuckDB.FFI_Safe_duckdb_struct_vector_get_child@
+foreign import ccall safe "hs_bindgen_f99a59b3c10f16bc" hs_bindgen_f99a59b3c10f16bc_base ::
+     BG.Ptr BG.Void
+  -> HsBindgen.Runtime.LibC.Word64
+  -> IO (BG.Ptr BG.Void)
+
+-- __unique:__ @Database_DuckDB_FFI_Database.DuckDB.FFI_Safe_duckdb_struct_vector_get_child@
+hs_bindgen_f99a59b3c10f16bc ::
+     DuckDBVector
+  -> DuckDBIdx
+  -> IO DuckDBVector
+hs_bindgen_f99a59b3c10f16bc =
+  \x0 ->
+    \x1 ->
+      fmap BG.fromFFIType (hs_bindgen_f99a59b3c10f16bc_base (BG.toFFIType x0) (BG.toFFIType x1))
+
+{-| Retrieves the child vector of a struct vector. The resulting vector is valid as long as the parent vector is valid.
+
+    history:
+
+    * stable: v0.3.3
+
+    [__@vector@__]: The vector
+
+    [__@index@__]: The child index
+
+    __Returns:__ t'DuckDBVector'
+
+    __C declaration:__ @duckdb_struct_vector_get_child@
+
+    __defined at:__ @duckdb.h 10161:28@
+
+    __exported by:__ @duckdb.h@
+-}
+c_duckdb_struct_vector_get_child ::
+     DuckDBVector
+     {- ^
+
+          [__@vector@__]: The vector
+
+          __C declaration:__ @vector@
+     -}
+  -> DuckDBIdx
+     {- ^
+
+          [__@index@__]: The child index
+
+          __C declaration:__ @index@
+     -}
+  -> IO DuckDBVector
+c_duckdb_struct_vector_get_child =
+  hs_bindgen_f99a59b3c10f16bc
+
+-- __unique:__ @Database_DuckDB_FFI_Database.DuckDB.FFI_Safe_duckdb_array_vector_get_child@
+foreign import ccall safe "hs_bindgen_2b6cd48bef7c1c5a" hs_bindgen_2b6cd48bef7c1c5a_base ::
+     BG.Ptr BG.Void
+  -> IO (BG.Ptr BG.Void)
+
+-- __unique:__ @Database_DuckDB_FFI_Database.DuckDB.FFI_Safe_duckdb_array_vector_get_child@
+hs_bindgen_2b6cd48bef7c1c5a ::
+     DuckDBVector
+  -> IO DuckDBVector
+hs_bindgen_2b6cd48bef7c1c5a =
+  \x0 ->
+    fmap BG.fromFFIType (hs_bindgen_2b6cd48bef7c1c5a_base (BG.toFFIType x0))
+
+{-| Retrieves the child vector of an array vector. The resulting vector is valid as long as the parent vector is valid. The resulting vector has the size of the parent vector multiplied by the array size.
+
+    history:
+
+    * stable: v0.10.1
+
+    [__@vector@__]: The vector
+
+    __Returns:__ t'DuckDBVector'
+
+    __C declaration:__ @duckdb_array_vector_get_child@
+
+    __defined at:__ @duckdb.h 10175:28@
+
+    __exported by:__ @duckdb.h@
+-}
+c_duckdb_array_vector_get_child ::
+     DuckDBVector
+     {- ^
+
+          [__@vector@__]: The vector
+
+          __C declaration:__ @vector@
+     -}
+  -> IO DuckDBVector
+c_duckdb_array_vector_get_child =
+  hs_bindgen_2b6cd48bef7c1c5a
+
+-- __unique:__ @Database_DuckDB_FFI_Database.DuckDB.FFI_Safe_duckdb_slice_vector@
+foreign import ccall safe "hs_bindgen_53d9e13117c90e3f" hs_bindgen_53d9e13117c90e3f_base ::
+     BG.Ptr BG.Void
+  -> BG.Ptr BG.Void
+  -> HsBindgen.Runtime.LibC.Word64
+  -> IO ()
+
+-- __unique:__ @Database_DuckDB_FFI_Database.DuckDB.FFI_Safe_duckdb_slice_vector@
+hs_bindgen_53d9e13117c90e3f ::
+     DuckDBVector
+  -> DuckDBSelectionVector
+  -> DuckDBIdx
+  -> IO ()
+hs_bindgen_53d9e13117c90e3f =
+  \x0 ->
+    \x1 ->
+      \x2 ->
+        hs_bindgen_53d9e13117c90e3f_base (BG.toFFIType x0) (BG.toFFIType x1) (BG.toFFIType x2)
+
+{-| Slice a vector with a selection vector. The length of the selection vector must be less than or equal to the length of the vector. Turns the vector into a dictionary vector.
+
+    history:
+
+    * unstable: v1.3.0
+
+    * stable: v1.5.6
+
+    [__@vector@__]: The vector to slice.
+
+    [__@sel@__]: The selection vector.
+
+    [__@len@__]: The length of the selection vector.
+
+    __Returns:__ void
+
+    __C declaration:__ @duckdb_slice_vector@
+
+    __defined at:__ @duckdb.h 10192:19@
+
+    __exported by:__ @duckdb.h@
+-}
+c_duckdb_slice_vector ::
+     DuckDBVector
+     {- ^
+
+          [__@vector@__]: The vector to slice.
+
+          __C declaration:__ @vector@
+     -}
+  -> DuckDBSelectionVector
+     {- ^
+
+          [__@sel@__]: The selection vector.
+
+          __C declaration:__ @sel@
+     -}
+  -> DuckDBIdx
+     {- ^
+
+          [__@len@__]: The length of the selection vector.
+
+          __C declaration:__ @len@
+     -}
+  -> IO ()
+c_duckdb_slice_vector = hs_bindgen_53d9e13117c90e3f
+
+-- __unique:__ @Database_DuckDB_FFI_Database.DuckDB.FFI_Safe_duckdb_vector_copy_sel@
+foreign import ccall safe "hs_bindgen_d572a377573f3568" hs_bindgen_d572a377573f3568_base ::
+     BG.Ptr BG.Void
+  -> BG.Ptr BG.Void
+  -> BG.Ptr BG.Void
+  -> HsBindgen.Runtime.LibC.Word64
+  -> HsBindgen.Runtime.LibC.Word64
+  -> HsBindgen.Runtime.LibC.Word64
+  -> IO ()
+
+-- __unique:__ @Database_DuckDB_FFI_Database.DuckDB.FFI_Safe_duckdb_vector_copy_sel@
+hs_bindgen_d572a377573f3568 ::
+     DuckDBVector
+  -> DuckDBVector
+  -> DuckDBSelectionVector
+  -> DuckDBIdx
+  -> DuckDBIdx
+  -> DuckDBIdx
+  -> IO ()
+hs_bindgen_d572a377573f3568 =
+  \x0 ->
+    \x1 ->
+      \x2 ->
+        \x3 ->
+          \x4 ->
+            \x5 ->
+              hs_bindgen_d572a377573f3568_base (BG.toFFIType x0) (BG.toFFIType x1) (BG.toFFIType x2) (BG.toFFIType x3) (BG.toFFIType x4) (BG.toFFIType x5)
+
+{-| Copy the src vector to the dst with a selection vector that identifies which indices to copy.
+
+    history:
+
+    * unstable: v1.4.0
+
+    * stable: v1.5.6
+
+    [__@src@__]: The vector to copy from.
+
+    [__@dst@__]: The vector to copy to.
+
+    [__@sel@__]: The selection vector. The length of the selection vector should not be more than the length of the src vector
+
+    [__@src_count@__]: The number of entries from selection vector to copy. Think of this as the effective length of the selection vector starting from index 0
+
+    [__@src_offset@__]: The offset in the selection vector to copy from (important: actual number of items copied = src_count - src_offset).
+
+    [__@dst_offset@__]: The offset in the dst vector to start copying to.
+
+    __Returns:__ void
+
+    __C declaration:__ @duckdb_vector_copy_sel@
+
+    __defined at:__ @duckdb.h 10214:19@
+
+    __exported by:__ @duckdb.h@
+-}
+c_duckdb_vector_copy_sel ::
+     DuckDBVector
+     {- ^
+
+          [__@src@__]: The vector to copy from.
+
+          __C declaration:__ @src@
+     -}
+  -> DuckDBVector
+     {- ^
+
+          [__@dst@__]: The vector to copy to.
+
+          __C declaration:__ @dst@
+     -}
+  -> DuckDBSelectionVector
+     {- ^
+
+          [__@sel@__]: The selection vector. The length of the selection vector should not be more than the length of the src vector
+
+          __C declaration:__ @sel@
+     -}
+  -> DuckDBIdx
+     {- ^
+
+          [__@src_count@__]: The number of entries from selection vector to copy. Think of this as the effective length of the selection vector starting from index 0
+
+          __C declaration:__ @src_count@
+     -}
+  -> DuckDBIdx
+     {- ^
+
+          [__@src_offset@__]: The offset in the selection vector to copy from (important: actual number of items copied = src_count - src_offset).
+
+          __C declaration:__ @src_offset@
+     -}
+  -> DuckDBIdx
+     {- ^
+
+          [__@dst_offset@__]: The offset in the dst vector to start copying to.
+
+          __C declaration:__ @dst_offset@
+     -}
+  -> IO ()
+c_duckdb_vector_copy_sel =
+  hs_bindgen_d572a377573f3568
+
+-- __unique:__ @Database_DuckDB_FFI_Database.DuckDB.FFI_Safe_duckdb_vector_reference_value@
+foreign import ccall safe "hs_bindgen_eff3eb026da85750" hs_bindgen_eff3eb026da85750_base ::
+     BG.Ptr BG.Void
+  -> BG.Ptr BG.Void
+  -> IO ()
+
+-- __unique:__ @Database_DuckDB_FFI_Database.DuckDB.FFI_Safe_duckdb_vector_reference_value@
+hs_bindgen_eff3eb026da85750 ::
+     DuckDBVector
+  -> DuckDBValue
+  -> IO ()
+hs_bindgen_eff3eb026da85750 =
+  \x0 ->
+    \x1 ->
+      hs_bindgen_eff3eb026da85750_base (BG.toFFIType x0) (BG.toFFIType x1)
+
+{-| Copies the value from @value@ to @vector@ .
+
+    history:
+
+    * unstable: v1.3.0
+
+    * stable: v1.5.6
+
+    [__@vector@__]: The receiving vector.
+
+    [__@value@__]: The value to copy into the vector.
+
+    __Returns:__ void
+
+    __C declaration:__ @duckdb_vector_reference_value@
+
+    __defined at:__ @duckdb.h 10230:19@
+
+    __exported by:__ @duckdb.h@
+-}
+c_duckdb_vector_reference_value ::
+     DuckDBVector
+     {- ^
+
+          [__@vector@__]: The receiving vector.
+
+          __C declaration:__ @vector@
+     -}
+  -> DuckDBValue
+     {- ^
+
+          [__@value@__]: The value to copy into the vector.
+
+          __C declaration:__ @value@
+     -}
+  -> IO ()
+c_duckdb_vector_reference_value =
+  hs_bindgen_eff3eb026da85750
+
+-- __unique:__ @Database_DuckDB_FFI_Database.DuckDB.FFI_Safe_duckdb_vector_reference_vector@
+foreign import ccall safe "hs_bindgen_b59dd1dfed56f6d9" hs_bindgen_b59dd1dfed56f6d9_base ::
+     BG.Ptr BG.Void
+  -> BG.Ptr BG.Void
+  -> IO ()
+
+-- __unique:__ @Database_DuckDB_FFI_Database.DuckDB.FFI_Safe_duckdb_vector_reference_vector@
+hs_bindgen_b59dd1dfed56f6d9 ::
+     DuckDBVector
+  -> DuckDBVector
+  -> IO ()
+hs_bindgen_b59dd1dfed56f6d9 =
+  \x0 ->
+    \x1 ->
+      hs_bindgen_b59dd1dfed56f6d9_base (BG.toFFIType x0) (BG.toFFIType x1)
+
+{-| __C declaration:__ @duckdb_vector_reference_vector@
+
+    __defined at:__ @duckdb.h 10245:19@
+
+    __exported by:__ @duckdb.h@
+-}
+c_duckdb_vector_reference_vector ::
+     DuckDBVector
+     -- ^ __C declaration:__ @to_vector@
+  -> DuckDBVector
+     -- ^ __C declaration:__ @from_vector@
+  -> IO ()
+c_duckdb_vector_reference_vector =
+  hs_bindgen_b59dd1dfed56f6d9
+
+-- __unique:__ @Database_DuckDB_FFI_Database.DuckDB.FFI_Safe_duckdb_validity_row_is_valid@
+foreign import ccall safe "hs_bindgen_951c8fba6822ef9d" hs_bindgen_951c8fba6822ef9d_base ::
+     BG.Ptr BG.Void
+  -> HsBindgen.Runtime.LibC.Word64
+  -> IO BG.CBool
+
+-- __unique:__ @Database_DuckDB_FFI_Database.DuckDB.FFI_Safe_duckdb_validity_row_is_valid@
+hs_bindgen_951c8fba6822ef9d ::
+     BG.Ptr HsBindgen.Runtime.LibC.Word64
+  -> DuckDBIdx
+  -> IO BG.CBool
+hs_bindgen_951c8fba6822ef9d =
+  \x0 ->
+    \x1 ->
+      fmap BG.fromFFIType (hs_bindgen_951c8fba6822ef9d_base (BG.toFFIType x0) (BG.toFFIType x1))
+
+{-| Changes @to_vector@ to reference `from_vector. After, the vectors share ownership of the data.
+
+    history:
+
+    * unstable: v1.3.0
+
+    * stable: v1.5.6
+
+    #if @DUCKDB_API_VERSION_AT_LEAST(0, 3, 3)@ /*! Returns whether or not a row is valid (i.e. not NULL) in the given validity mask.
+
+    [__@to_vector@__]: The receiving vector.
+
+    [__@from_vector@__]: The vector to reference.
+
+    __Returns:__ void */ DUCKDB_C_API void duckdb_vector_reference_vector(duckdb_vector to_vector, duckdb_vector from_vector); #endif
+
+    history:
+
+    * stable: v0.3.3
+
+    [__@validity@__]: The validity mask, as obtained through @'c_duckdb_vector_get_validity'@
+
+    [__@row@__]: The row index
+
+    __Returns:__ bool
+
+    __C declaration:__ @duckdb_validity_row_is_valid@
+
+    __defined at:__ @duckdb.h 10259:19@
+
+    __exported by:__ @duckdb.h@
+-}
+c_duckdb_validity_row_is_valid ::
+     BG.Ptr HsBindgen.Runtime.LibC.Word64
+     {- ^
+
+          [__@validity@__]: The validity mask, as obtained through @'c_duckdb_vector_get_validity'@
+
+          __C declaration:__ @validity@
+     -}
+  -> DuckDBIdx
+     {- ^
+
+          [__@row@__]: The row index
+
+          __C declaration:__ @row@
+     -}
+  -> IO BG.CBool
+c_duckdb_validity_row_is_valid =
+  hs_bindgen_951c8fba6822ef9d
+
+-- __unique:__ @Database_DuckDB_FFI_Database.DuckDB.FFI_Safe_duckdb_validity_set_row_validity@
+foreign import ccall safe "hs_bindgen_552c2923fb858ce4" hs_bindgen_552c2923fb858ce4_base ::
+     BG.Ptr BG.Void
+  -> HsBindgen.Runtime.LibC.Word64
+  -> BG.CBool
+  -> IO ()
+
+-- __unique:__ @Database_DuckDB_FFI_Database.DuckDB.FFI_Safe_duckdb_validity_set_row_validity@
+hs_bindgen_552c2923fb858ce4 ::
+     BG.Ptr HsBindgen.Runtime.LibC.Word64
+  -> DuckDBIdx
+  -> BG.CBool
+  -> IO ()
+hs_bindgen_552c2923fb858ce4 =
+  \x0 ->
+    \x1 ->
+      \x2 ->
+        hs_bindgen_552c2923fb858ce4_base (BG.toFFIType x0) (BG.toFFIType x1) (BG.toFFIType x2)
+
+{-| In a validity mask, sets a specific row to either valid or invalid.
+
+    Note that @'c_duckdb_vector_ensure_validity_writable'@ should be called before calling @'c_duckdb_vector_get_validity'@ , to ensure that there is a validity mask to write to.
+
+    history:
+
+    * stable: v0.3.3
+
+    [__@validity@__]: The validity mask, as obtained through @'c_duckdb_vector_get_validity'@ .
+
+    [__@row@__]: The row index
+
+    [__@valid@__]: Whether or not to set the row to valid, or invalid
+
+    __Returns:__ void
+
+    __C declaration:__ @duckdb_validity_set_row_validity@
+
+    __defined at:__ @duckdb.h 10277:19@
+
+    __exported by:__ @duckdb.h@
+-}
+c_duckdb_validity_set_row_validity ::
+     BG.Ptr HsBindgen.Runtime.LibC.Word64
+     {- ^
+
+          [__@validity@__]: The validity mask, as obtained through @'c_duckdb_vector_get_validity'@ .
+
+          __C declaration:__ @validity@
+     -}
+  -> DuckDBIdx
+     {- ^
+
+          [__@row@__]: The row index
+
+          __C declaration:__ @row@
+     -}
+  -> BG.CBool
+     {- ^
+
+          [__@valid@__]: Whether or not to set the row to valid, or invalid
+
+          __C declaration:__ @valid@
+     -}
+  -> IO ()
+c_duckdb_validity_set_row_validity =
+  hs_bindgen_552c2923fb858ce4
+
+-- __unique:__ @Database_DuckDB_FFI_Database.DuckDB.FFI_Safe_duckdb_validity_set_row_invalid@
+foreign import ccall safe "hs_bindgen_9e881366869db236" hs_bindgen_9e881366869db236_base ::
+     BG.Ptr BG.Void
+  -> HsBindgen.Runtime.LibC.Word64
+  -> IO ()
+
+-- __unique:__ @Database_DuckDB_FFI_Database.DuckDB.FFI_Safe_duckdb_validity_set_row_invalid@
+hs_bindgen_9e881366869db236 ::
+     BG.Ptr HsBindgen.Runtime.LibC.Word64
+  -> DuckDBIdx
+  -> IO ()
+hs_bindgen_9e881366869db236 =
+  \x0 ->
+    \x1 ->
+      hs_bindgen_9e881366869db236_base (BG.toFFIType x0) (BG.toFFIType x1)
+
+{-| In a validity mask, sets a specific row to invalid.
+
+    Equivalent to @'c_duckdb_validity_set_row_validity'@ with valid set to false.
+
+    history:
+
+    * stable: v0.3.3
+
+    [__@validity@__]: The validity mask
+
+    [__@row@__]: The row index
+
+    __Returns:__ void
+
+    __C declaration:__ @duckdb_validity_set_row_invalid@
+
+    __defined at:__ @duckdb.h 10293:19@
+
+    __exported by:__ @duckdb.h@
+-}
+c_duckdb_validity_set_row_invalid ::
+     BG.Ptr HsBindgen.Runtime.LibC.Word64
+     {- ^
+
+          [__@validity@__]: The validity mask
+
+          __C declaration:__ @validity@
+     -}
+  -> DuckDBIdx
+     {- ^
+
+          [__@row@__]: The row index
+
+          __C declaration:__ @row@
+     -}
+  -> IO ()
+c_duckdb_validity_set_row_invalid =
+  hs_bindgen_9e881366869db236
+
+-- __unique:__ @Database_DuckDB_FFI_Database.DuckDB.FFI_Safe_duckdb_validity_set_row_valid@
+foreign import ccall safe "hs_bindgen_1c76442784687a97" hs_bindgen_1c76442784687a97_base ::
+     BG.Ptr BG.Void
+  -> HsBindgen.Runtime.LibC.Word64
+  -> IO ()
+
+-- __unique:__ @Database_DuckDB_FFI_Database.DuckDB.FFI_Safe_duckdb_validity_set_row_valid@
+hs_bindgen_1c76442784687a97 ::
+     BG.Ptr HsBindgen.Runtime.LibC.Word64
+  -> DuckDBIdx
+  -> IO ()
+hs_bindgen_1c76442784687a97 =
+  \x0 ->
+    \x1 ->
+      hs_bindgen_1c76442784687a97_base (BG.toFFIType x0) (BG.toFFIType x1)
+
+{-| In a validity mask, sets a specific row to valid.
+
+    Equivalent to @'c_duckdb_validity_set_row_validity'@ with valid set to true.
+
+    history:
+
+    * stable: v0.3.3
+
+    [__@validity@__]: The validity mask
+
+    [__@row@__]: The row index
+
+    __Returns:__ void
+
+    __C declaration:__ @duckdb_validity_set_row_valid@
+
+    __defined at:__ @duckdb.h 10309:19@
+
+    __exported by:__ @duckdb.h@
+-}
+c_duckdb_validity_set_row_valid ::
+     BG.Ptr HsBindgen.Runtime.LibC.Word64
+     {- ^
+
+          [__@validity@__]: The validity mask
+
+          __C declaration:__ @validity@
+     -}
+  -> DuckDBIdx
+     {- ^
+
+          [__@row@__]: The row index
+
+          __C declaration:__ @row@
+     -}
+  -> IO ()
+c_duckdb_validity_set_row_valid =
+  hs_bindgen_1c76442784687a97
+
+-- __unique:__ @Database_DuckDB_FFI_Database.DuckDB.FFI_Safe_duckdb_create_selection_vector@
+foreign import ccall safe "hs_bindgen_e0f1c7465a41fac7" hs_bindgen_e0f1c7465a41fac7_base ::
+     HsBindgen.Runtime.LibC.Word64
+  -> IO (BG.Ptr BG.Void)
+
+-- __unique:__ @Database_DuckDB_FFI_Database.DuckDB.FFI_Safe_duckdb_create_selection_vector@
+hs_bindgen_e0f1c7465a41fac7 ::
+     DuckDBIdx
+  -> IO DuckDBSelectionVector
+hs_bindgen_e0f1c7465a41fac7 =
+  \x0 ->
+    fmap BG.fromFFIType (hs_bindgen_e0f1c7465a41fac7_base (BG.toFFIType x0))
+
+{-| Creates a new selection vector of size @size@ . Must be destroyed with @'c_duckdb_destroy_selection_vector'@ .
+
+    history:
+
+    * unstable: v1.3.0
+
+    * stable: v1.5.6
+
+    [__@size@__]: The size of the selection vector.
+
+    __Returns:__ t'DuckDBSelectionVector'
+
+    __C declaration:__ @duckdb_create_selection_vector@
+
+    __defined at:__ @duckdb.h 10323:38@
+
+    __exported by:__ @duckdb.h@
+-}
+c_duckdb_create_selection_vector ::
+     DuckDBIdx
+     {- ^
+
+          [__@size@__]: The size of the selection vector.
+
+          __C declaration:__ @size@
+     -}
+  -> IO DuckDBSelectionVector
+c_duckdb_create_selection_vector =
+  hs_bindgen_e0f1c7465a41fac7
+
+-- __unique:__ @Database_DuckDB_FFI_Database.DuckDB.FFI_Safe_duckdb_destroy_selection_vector@
+foreign import ccall safe "hs_bindgen_131b24a6de70ad66" hs_bindgen_131b24a6de70ad66_base ::
+     BG.Ptr BG.Void
+  -> IO ()
+
+-- __unique:__ @Database_DuckDB_FFI_Database.DuckDB.FFI_Safe_duckdb_destroy_selection_vector@
+hs_bindgen_131b24a6de70ad66 ::
+     DuckDBSelectionVector
+  -> IO ()
+hs_bindgen_131b24a6de70ad66 =
+  \x0 ->
+    hs_bindgen_131b24a6de70ad66_base (BG.toFFIType x0)
+
+{-| Destroys the selection vector and de-allocates its memory.
+
+    history:
+
+    * unstable: v1.3.0
+
+    * stable: v1.5.6
+
+    [__@sel@__]: The selection vector.
+
+    __Returns:__ void
+
+    __C declaration:__ @duckdb_destroy_selection_vector@
+
+    __defined at:__ @duckdb.h 10337:19@
+
+    __exported by:__ @duckdb.h@
+-}
+c_duckdb_destroy_selection_vector ::
+     DuckDBSelectionVector
+     {- ^
+
+          [__@sel@__]: The selection vector.
+
+          __C declaration:__ @sel@
+     -}
+  -> IO ()
+c_duckdb_destroy_selection_vector =
+  hs_bindgen_131b24a6de70ad66
+
+-- __unique:__ @Database_DuckDB_FFI_Database.DuckDB.FFI_Safe_duckdb_selection_vector_get_data_ptr@
+foreign import ccall safe "hs_bindgen_efad6679c4838832" hs_bindgen_efad6679c4838832_base ::
+     BG.Ptr BG.Void
+  -> IO (BG.Ptr BG.Void)
+
+-- __unique:__ @Database_DuckDB_FFI_Database.DuckDB.FFI_Safe_duckdb_selection_vector_get_data_ptr@
+hs_bindgen_efad6679c4838832 ::
+     DuckDBSelectionVector
+  -> IO (BG.Ptr DuckDBSel)
+hs_bindgen_efad6679c4838832 =
+  \x0 ->
+    fmap BG.fromFFIType (hs_bindgen_efad6679c4838832_base (BG.toFFIType x0))
+
+{-| Access the data pointer of a selection vector.
+
+    history:
+
+    * unstable: v1.3.0
+
+    * stable: v1.5.6
+
+    [__@sel@__]: The selection vector.
+
+    __Returns:__ sel_t*
+
+    __C declaration:__ @duckdb_selection_vector_get_data_ptr@
+
+    __defined at:__ @duckdb.h 10351:21@
+
+    __exported by:__ @duckdb.h@
+-}
+c_duckdb_selection_vector_get_data_ptr ::
+     DuckDBSelectionVector
+     {- ^
+
+          [__@sel@__]: The selection vector.
+
+          __C declaration:__ @sel@
+     -}
+  -> IO (BG.Ptr DuckDBSel)
+c_duckdb_selection_vector_get_data_ptr =
+  hs_bindgen_efad6679c4838832
diff --git a/generated/Database/DuckDB/FFI/V2.hs b/generated/Database/DuckDB/FFI/V2.hs
new file mode 100644
--- /dev/null
+++ b/generated/Database/DuckDB/FFI/V2.hs
@@ -0,0 +1,47833 @@
+-- | Raw bindings to the DuckDB C API in @duckdb_v2.h@.
+{-# LANGUAGE DataKinds #-}
+{-# LANGUAGE DeriveGeneric #-}
+{-# LANGUAGE DerivingStrategies #-}
+{-# LANGUAGE DerivingVia #-}
+{-# LANGUAGE DuplicateRecordFields #-}
+{-# LANGUAGE EmptyDataDecls #-}
+{-# LANGUAGE ExplicitForAll #-}
+{-# LANGUAGE FlexibleContexts #-}
+{-# LANGUAGE FlexibleInstances #-}
+{-# LANGUAGE ForeignFunctionInterface #-}
+{-# LANGUAGE GeneralizedNewtypeDeriving #-}
+{-# LANGUAGE MagicHash #-}
+{-# LANGUAGE MultiParamTypeClasses #-}
+{-# LANGUAGE NoFieldSelectors #-}
+{-# LANGUAGE NoImplicitPrelude #-}
+{-# LANGUAGE PatternSynonyms #-}
+{-# LANGUAGE StandaloneDeriving #-}
+{-# LANGUAGE TemplateHaskell #-}
+{-# LANGUAGE TypeApplications #-}
+{-# LANGUAGE TypeFamilies #-}
+{-# LANGUAGE TypeOperators #-}
+{-# LANGUAGE UnboxedTuples #-}
+{-# LANGUAGE UndecidableInstances #-}
+{-# OPTIONS_HADDOCK prune #-}
+
+module Database.DuckDB.FFI.V2
+    ( Database.DuckDB.FFI.V2.dUCKDB_V2_API_VERSION_MAJOR
+    , Database.DuckDB.FFI.V2.dUCKDB_V2_API_VERSION_MINOR
+    , Database.DuckDB.FFI.V2.dUCKDB_V2_API_VERSION_PATCH
+    , Database.DuckDB.FFI.V2.dUCKDB_V2_API_ALLOW_DEPRECATED
+    , Database.DuckDB.FFI.V2.aRROW_FLAG_DICTIONARY_ORDERED
+    , Database.DuckDB.FFI.V2.aRROW_FLAG_NULLABLE
+    , Database.DuckDB.FFI.V2.aRROW_FLAG_MAP_KEYS_SORTED
+    , Database.DuckDB.FFI.V2.ArrowSchema(..)
+    , Database.DuckDB.FFI.V2.ArrowArray(..)
+    , Database.DuckDB.FFI.V2.ArrowArrayStream(..)
+    , Database.DuckDB.FFI.V2.DuckDBIdx(..)
+    , Database.DuckDB.FFI.V2.DuckDBExtensionInfoStruct
+    , Database.DuckDB.FFI.V2.DuckDBV2ExtensionHandle(..)
+    , Database.DuckDB.FFI.V2.DuckDBV2OrderPreservation(..)
+    , pattern Database.DuckDB.FFI.V2.DuckDBV2OrderPreservationNoOrder
+    , pattern Database.DuckDB.FFI.V2.DuckDBV2OrderPreservationInsertionOrder
+    , pattern Database.DuckDB.FFI.V2.DuckDBV2OrderPreservationFixedOrder
+    , pattern Database.DuckDB.FFI.V2.DuckDBV2OrderPreservationMaxEnum
+    , Database.DuckDB.FFI.V2.DuckDBV2EnvironmentStruct
+    , Database.DuckDB.FFI.V2.DuckDBV2EnvironmentHandle(..)
+    , Database.DuckDB.FFI.V2.DuckDBV2InstanceStruct
+    , Database.DuckDB.FFI.V2.DuckDBV2InstanceHandle(..)
+    , Database.DuckDB.FFI.V2.DuckDBV2ConnectionStruct
+    , Database.DuckDB.FFI.V2.DuckDBV2ConnectionHandle(..)
+    , Database.DuckDB.FFI.V2.DuckDBV2ConfigStruct
+    , Database.DuckDB.FFI.V2.DuckDBV2ConfigHandle(..)
+    , Database.DuckDB.FFI.V2.DuckDBV2OptionStruct
+    , Database.DuckDB.FFI.V2.DuckDBV2OptionHandle(..)
+    , Database.DuckDB.FFI.V2.DuckDBV2ErrorInfoStruct
+    , Database.DuckDB.FFI.V2.DuckDBV2ErrorInfoHandle(..)
+    , Database.DuckDB.FFI.V2.DuckDBV2LogicalTypeStruct
+    , Database.DuckDB.FFI.V2.DuckDBV2LogicalTypeHandle(..)
+    , Database.DuckDB.FFI.V2.DuckDBV2ValueStruct
+    , Database.DuckDB.FFI.V2.DuckDBV2ValueHandle(..)
+    , Database.DuckDB.FFI.V2.DuckDBV2ResultStruct
+    , Database.DuckDB.FFI.V2.DuckDBV2ResultHandle(..)
+    , Database.DuckDB.FFI.V2.DuckDBV2DataChunkStruct
+    , Database.DuckDB.FFI.V2.DuckDBV2DataChunkHandle(..)
+    , Database.DuckDB.FFI.V2.DuckDBV2VectorStruct
+    , Database.DuckDB.FFI.V2.DuckDBV2VectorHandle(..)
+    , Database.DuckDB.FFI.V2.DuckDBV2ArenaStruct
+    , Database.DuckDB.FFI.V2.DuckDBV2ArenaHandle(..)
+    , Database.DuckDB.FFI.V2.DuckDBV2ContextStruct
+    , Database.DuckDB.FFI.V2.DuckDBV2ContextHandle(..)
+    , Database.DuckDB.FFI.V2.DuckDBV2FactoryStruct
+    , Database.DuckDB.FFI.V2.DuckDBV2FactoryHandle(..)
+    , Database.DuckDB.FFI.V2.DuckDBV2SelT(..)
+    , Database.DuckDB.FFI.V2.dUCKDB_V2_BYTES_INLINE_LENGTH
+    , Database.DuckDB.FFI.V2.DuckDBV2TextSinkFn_Aux(..)
+    , Database.DuckDB.FFI.V2.DuckDBV2TextSinkFn(..)
+    , Database.DuckDB.FFI.V2.DuckDBV2OpaqueEqualsFn_Aux(..)
+    , Database.DuckDB.FFI.V2.DuckDBV2OpaqueEqualsFn(..)
+    , Database.DuckDB.FFI.V2.DuckDBV2OpaqueDestroyFn_Aux(..)
+    , Database.DuckDB.FFI.V2.DuckDBV2OpaqueDestroyFn(..)
+    , Database.DuckDB.FFI.V2.DuckDBV2Str(..)
+    , Database.DuckDB.FFI.V2.DuckDBV2IdentifierT(..)
+    , Database.DuckDB.FFI.V2.Duckdb_v2_bytes_value_pointer(..)
+    , Database.DuckDB.FFI.V2.Duckdb_v2_bytes_value_inlined(..)
+    , Database.DuckDB.FFI.V2.Duckdb_v2_bytes_value(..)
+    , Database.DuckDB.FFI.V2.DuckDBV2Bytes(..)
+    , Database.DuckDB.FFI.V2.DuckDBV2VarcharT(..)
+    , Database.DuckDB.FFI.V2.DuckDBV2BlobT(..)
+    , Database.DuckDB.FFI.V2.DuckDBV2BitT(..)
+    , Database.DuckDB.FFI.V2.DuckDBV2BignumT(..)
+    , Database.DuckDB.FFI.V2.DuckDBV2Opaque(..)
+    , Database.DuckDB.FFI.V2.DuckDBV2Error(..)
+    , pattern Database.DuckDB.FFI.V2.DuckDBV2ErrorNone
+    , pattern Database.DuckDB.FFI.V2.DuckDBV2ErrorApi
+    , pattern Database.DuckDB.FFI.V2.DuckDBV2ErrorIOFileNotFound
+    , pattern Database.DuckDB.FFI.V2.DuckDBV2ErrorIOReadFailure
+    , pattern Database.DuckDB.FFI.V2.DuckDBV2ErrorIOEof
+    , pattern Database.DuckDB.FFI.V2.DuckDBV2ErrorIOGeneral
+    , pattern Database.DuckDB.FFI.V2.DuckDBV2ErrorIONetwork
+    , pattern Database.DuckDB.FFI.V2.DuckDBV2ErrorIOHTTP
+    , pattern Database.DuckDB.FFI.V2.DuckDBV2ErrorInputInvalid
+    , pattern Database.DuckDB.FFI.V2.DuckDBV2ErrorInputParameterInvalid
+    , pattern Database.DuckDB.FFI.V2.DuckDBV2ErrorInputOutOfRange
+    , pattern Database.DuckDB.FFI.V2.DuckDBV2ErrorInputObjectSize
+    , pattern Database.DuckDB.FFI.V2.DuckDBV2ErrorInputMetadataDeferred
+    , pattern Database.DuckDB.FFI.V2.DuckDBV2ErrorResourceInUse
+    , pattern Database.DuckDB.FFI.V2.DuckDBV2ErrorResourceOutOfMemory
+    , pattern Database.DuckDB.FFI.V2.DuckDBV2ErrorResourceConnection
+    , pattern Database.DuckDB.FFI.V2.DuckDBV2ErrorResourceDependency
+    , pattern Database.DuckDB.FFI.V2.DuckDBV2ErrorResourceMissingExtension
+    , pattern Database.DuckDB.FFI.V2.DuckDBV2ErrorResourceAutoload
+    , pattern Database.DuckDB.FFI.V2.DuckDBV2ErrorTypeConversion
+    , pattern Database.DuckDB.FFI.V2.DuckDBV2ErrorTypeUnknown
+    , pattern Database.DuckDB.FFI.V2.DuckDBV2ErrorTypeInvalid
+    , pattern Database.DuckDB.FFI.V2.DuckDBV2ErrorTypeMismatch
+    , pattern Database.DuckDB.FFI.V2.DuckDBV2ErrorTypeDecimal
+    , pattern Database.DuckDB.FFI.V2.DuckDBV2ErrorTypeDivideByZero
+    , pattern Database.DuckDB.FFI.V2.DuckDBV2ErrorQueryParser
+    , pattern Database.DuckDB.FFI.V2.DuckDBV2ErrorQuerySyntax
+    , pattern Database.DuckDB.FFI.V2.DuckDBV2ErrorQueryBinder
+    , pattern Database.DuckDB.FFI.V2.DuckDBV2ErrorQueryPlanner
+    , pattern Database.DuckDB.FFI.V2.DuckDBV2ErrorQueryOptimizer
+    , pattern Database.DuckDB.FFI.V2.DuckDBV2ErrorQueryExpression
+    , pattern Database.DuckDB.FFI.V2.DuckDBV2ErrorQueryExecutor
+    , pattern Database.DuckDB.FFI.V2.DuckDBV2ErrorQueryScheduler
+    , pattern Database.DuckDB.FFI.V2.DuckDBV2ErrorQueryNotImplemented
+    , pattern Database.DuckDB.FFI.V2.DuckDBV2ErrorQueryParameterNotResolved
+    , pattern Database.DuckDB.FFI.V2.DuckDBV2ErrorQueryParameterNotAllowed
+    , pattern Database.DuckDB.FFI.V2.DuckDBV2ErrorDatabaseCatalog
+    , pattern Database.DuckDB.FFI.V2.DuckDBV2ErrorDatabaseTransaction
+    , pattern Database.DuckDB.FFI.V2.DuckDBV2ErrorDatabaseConstraint
+    , pattern Database.DuckDB.FFI.V2.DuckDBV2ErrorDatabaseIndex
+    , pattern Database.DuckDB.FFI.V2.DuckDBV2ErrorDatabaseSequence
+    , pattern Database.DuckDB.FFI.V2.DuckDBV2ErrorDatabaseStatistics
+    , pattern Database.DuckDB.FFI.V2.DuckDBV2ErrorDatabaseSerialization
+    , pattern Database.DuckDB.FFI.V2.DuckDBV2ErrorConfigurationSettings
+    , pattern Database.DuckDB.FFI.V2.DuckDBV2ErrorConfigurationInvalid
+    , pattern Database.DuckDB.FFI.V2.DuckDBV2ErrorConfigurationPermission
+    , pattern Database.DuckDB.FFI.V2.DuckDBV2ErrorRuntimeInternal
+    , pattern Database.DuckDB.FFI.V2.DuckDBV2ErrorRuntimeFatal
+    , pattern Database.DuckDB.FFI.V2.DuckDBV2ErrorRuntimeInterrupt
+    , pattern Database.DuckDB.FFI.V2.DuckDBV2ErrorRuntimeNullPointer
+    , pattern Database.DuckDB.FFI.V2.DuckDBV2ErrorMaxEnum
+    , Database.DuckDB.FFI.V2.DuckDBV2FunctionPropertyKey(..)
+    , pattern Database.DuckDB.FFI.V2.DuckDBV2FunctionPropertyStability
+    , pattern Database.DuckDB.FFI.V2.DuckDBV2FunctionPropertyNullHandling
+    , pattern Database.DuckDB.FFI.V2.DuckDBV2FunctionPropertyFallibility
+    , pattern Database.DuckDB.FFI.V2.DuckDBV2FunctionPropertyCollationHandling
+    , pattern Database.DuckDB.FFI.V2.DuckDBV2FunctionPropertyAggOrderDependent
+    , pattern Database.DuckDB.FFI.V2.DuckDBV2FunctionPropertyAggDistinctDependent
+    , pattern Database.DuckDB.FFI.V2.DuckDBV2FunctionPropertyKeyMaxEnum
+    , Database.DuckDB.FFI.V2.DuckDBV2FunctionPropertyValue(..)
+    , pattern Database.DuckDB.FFI.V2.DuckDBV2FunctionPropertyStabilityConsistent
+    , pattern Database.DuckDB.FFI.V2.DuckDBV2FunctionPropertyStabilityVolatile
+    , pattern Database.DuckDB.FFI.V2.DuckDBV2FunctionPropertyStabilityConsistentWithinQuery
+    , pattern Database.DuckDB.FFI.V2.DuckDBV2FunctionPropertyNullHandlingDefault
+    , pattern Database.DuckDB.FFI.V2.DuckDBV2FunctionPropertyNullHandlingSpecial
+    , pattern Database.DuckDB.FFI.V2.DuckDBV2FunctionPropertyFallibilityInfallible
+    , pattern Database.DuckDB.FFI.V2.DuckDBV2FunctionPropertyFallibilityFallible
+    , pattern Database.DuckDB.FFI.V2.DuckDBV2FunctionPropertyCollationHandlingPropagate
+    , pattern Database.DuckDB.FFI.V2.DuckDBV2FunctionPropertyCollationHandlingPushCombinable
+    , pattern Database.DuckDB.FFI.V2.DuckDBV2FunctionPropertyCollationHandlingIgnore
+    , pattern Database.DuckDB.FFI.V2.DuckDBV2FunctionPropertyAggOrderDependentYes
+    , pattern Database.DuckDB.FFI.V2.DuckDBV2FunctionPropertyAggOrderDependentNo
+    , pattern Database.DuckDB.FFI.V2.DuckDBV2FunctionPropertyAggDistinctDependentYes
+    , pattern Database.DuckDB.FFI.V2.DuckDBV2FunctionPropertyAggDistinctDependentNo
+    , pattern Database.DuckDB.FFI.V2.DuckDBV2FunctionPropertyValueMaxEnum
+    , Database.DuckDB.FFI.V2.DuckDBV2CastMode(..)
+    , pattern Database.DuckDB.FFI.V2.DuckDBV2CastModeNormal
+    , pattern Database.DuckDB.FFI.V2.DuckDBV2CastModeTry
+    , pattern Database.DuckDB.FFI.V2.DuckDBV2CastModeMaxEnum
+    , Database.DuckDB.FFI.V2.DuckDBV2CastFunctionStruct
+    , Database.DuckDB.FFI.V2.DuckDBV2CastFunctionHandle(..)
+    , Database.DuckDB.FFI.V2.DuckDBV2CastFunctionExecInfoStruct
+    , Database.DuckDB.FFI.V2.DuckDBV2CastFunctionExecInfoHandle(..)
+    , Database.DuckDB.FFI.V2.DuckDBV2CastFunctionExecCallbackFn_Aux(..)
+    , Database.DuckDB.FFI.V2.DuckDBV2CastFunctionExecCallbackFn(..)
+    , Database.DuckDB.FFI.V2.DuckDBV2ColumnDataCollectionStruct
+    , Database.DuckDB.FFI.V2.DuckDBV2ColumnDataCollectionHandle(..)
+    , Database.DuckDB.FFI.V2.DuckDBV2ColumnDataCollectionSharedScanStateStruct
+    , Database.DuckDB.FFI.V2.DuckDBV2ColumnDataCollectionSharedScanStateHandle(..)
+    , Database.DuckDB.FFI.V2.DuckDBV2ColumnDataCollectionWorkerScanStateStruct
+    , Database.DuckDB.FFI.V2.DuckDBV2ColumnDataCollectionWorkerScanStateHandle(..)
+    , Database.DuckDB.FFI.V2.DuckDBV2ColumnDataCollectionAppendStateStruct
+    , Database.DuckDB.FFI.V2.DuckDBV2ColumnDataCollectionAppendStateHandle(..)
+    , Database.DuckDB.FFI.V2.DuckDBV2SettingScope(..)
+    , pattern Database.DuckDB.FFI.V2.DuckDBV2SettingScopeDefault
+    , pattern Database.DuckDB.FFI.V2.DuckDBV2SettingScopeGlobal
+    , pattern Database.DuckDB.FFI.V2.DuckDBV2SettingScopeSession
+    , pattern Database.DuckDB.FFI.V2.DuckDBV2SettingScopeMaxEnum
+    , Database.DuckDB.FFI.V2.DuckDBV2CustomTypeStruct
+    , Database.DuckDB.FFI.V2.DuckDBV2CustomTypeHandle(..)
+    , Database.DuckDB.FFI.V2.DuckDBV2ExtensionGetApiFn_Aux(..)
+    , Database.DuckDB.FFI.V2.DuckDBV2ExtensionGetApiFn(..)
+    , Database.DuckDB.FFI.V2.DuckDBV2ExtensionInput(..)
+    , Database.DuckDB.FFI.V2.DuckDBV2FileFlag(..)
+    , pattern Database.DuckDB.FFI.V2.DuckDBV2FileFlagInvalid
+    , pattern Database.DuckDB.FFI.V2.DuckDBV2FileFlagRead
+    , pattern Database.DuckDB.FFI.V2.DuckDBV2FileFlagWrite
+    , pattern Database.DuckDB.FFI.V2.DuckDBV2FileFlagCreate
+    , pattern Database.DuckDB.FFI.V2.DuckDBV2FileFlagCreateNew
+    , pattern Database.DuckDB.FFI.V2.DuckDBV2FileFlagAppend
+    , pattern Database.DuckDB.FFI.V2.DuckDBV2FileFlagExclusiveCreate
+    , pattern Database.DuckDB.FFI.V2.DuckDBV2FileFlagParallelAccess
+    , pattern Database.DuckDB.FFI.V2.DuckDBV2FileFlagExternalFileCache
+    , pattern Database.DuckDB.FFI.V2.DuckDBV2FileFlagMaxEnum
+    , Database.DuckDB.FFI.V2.DuckDBV2FileSystemStruct
+    , Database.DuckDB.FFI.V2.DuckDBV2FileSystemHandle(..)
+    , Database.DuckDB.FFI.V2.DuckDBV2FileOpenOptionsStruct
+    , Database.DuckDB.FFI.V2.DuckDBV2FileOpenOptionsHandle(..)
+    , Database.DuckDB.FFI.V2.DuckDBV2FileStruct
+    , Database.DuckDB.FFI.V2.DuckDBV2FileHandle(..)
+    , Database.DuckDB.FFI.V2.DuckDBV2FileSystemPathGlobCallbackFn_Aux(..)
+    , Database.DuckDB.FFI.V2.DuckDBV2FileSystemPathGlobCallbackFn(..)
+    , Database.DuckDB.FFI.V2.DuckDBV2FunctionBindInfoStruct
+    , Database.DuckDB.FFI.V2.DuckDBV2FunctionBindInfoHandle(..)
+    , Database.DuckDB.FFI.V2.DuckDBV2FunctionDocsStruct
+    , Database.DuckDB.FFI.V2.DuckDBV2FunctionDocsHandle(..)
+    , Database.DuckDB.FFI.V2.DuckDBV2FunctionParameterKind(..)
+    , pattern Database.DuckDB.FFI.V2.DuckDBV2FunctionParameterKindPositionalOnly
+    , pattern Database.DuckDB.FFI.V2.DuckDBV2FunctionParameterKindStandard
+    , pattern Database.DuckDB.FFI.V2.DuckDBV2FunctionParameterKindPositionalVariadic
+    , pattern Database.DuckDB.FFI.V2.DuckDBV2FunctionParameterKindNamedOnly
+    , pattern Database.DuckDB.FFI.V2.DuckDBV2FunctionParameterKindNamedVariadic
+    , pattern Database.DuckDB.FFI.V2.DuckDBV2FunctionParameterKindMaxEnum
+    , Database.DuckDB.FFI.V2.DuckDBV2FunctionSignatureStruct
+    , Database.DuckDB.FFI.V2.DuckDBV2FunctionSignatureHandle(..)
+    , Database.DuckDB.FFI.V2.DuckDBV2AttachOptionsStruct
+    , Database.DuckDB.FFI.V2.DuckDBV2AttachOptionsHandle(..)
+    , Database.DuckDB.FFI.V2.DuckDBV2LogLevel(..)
+    , pattern Database.DuckDB.FFI.V2.DuckDBV2LogLevelTrace
+    , pattern Database.DuckDB.FFI.V2.DuckDBV2LogLevelDebug
+    , pattern Database.DuckDB.FFI.V2.DuckDBV2LogLevelInfo
+    , pattern Database.DuckDB.FFI.V2.DuckDBV2LogLevelWarning
+    , pattern Database.DuckDB.FFI.V2.DuckDBV2LogLevelError
+    , pattern Database.DuckDB.FFI.V2.DuckDBV2LogLevelFatal
+    , pattern Database.DuckDB.FFI.V2.DuckDBV2LogLevelMaxEnum
+    , Database.DuckDB.FFI.V2.DuckDBV2QnameStruct
+    , Database.DuckDB.FFI.V2.DuckDBV2QnameHandle(..)
+    , Database.DuckDB.FFI.V2.DuckDBV2QueryMetricsStruct
+    , Database.DuckDB.FFI.V2.DuckDBV2QueryMetricsHandle(..)
+    , Database.DuckDB.FFI.V2.DuckDBV2QueryMetricsNodeStruct
+    , Database.DuckDB.FFI.V2.DuckDBV2QueryMetricsNodeHandle(..)
+    , Database.DuckDB.FFI.V2.DuckDBV2SchemaStruct
+    , Database.DuckDB.FFI.V2.DuckDBV2SchemaHandle(..)
+    , Database.DuckDB.FFI.V2.DuckDBV2TokenType(..)
+    , pattern Database.DuckDB.FFI.V2.DuckDBV2TokenTypeInvalid
+    , pattern Database.DuckDB.FFI.V2.DuckDBV2TokenTypeKeyword
+    , pattern Database.DuckDB.FFI.V2.DuckDBV2TokenTypeIdentifier
+    , pattern Database.DuckDB.FFI.V2.DuckDBV2TokenTypeStringLiteral
+    , pattern Database.DuckDB.FFI.V2.DuckDBV2TokenTypeNumberLiteral
+    , pattern Database.DuckDB.FFI.V2.DuckDBV2TokenTypeOperator
+    , pattern Database.DuckDB.FFI.V2.DuckDBV2TokenTypeComment
+    , pattern Database.DuckDB.FFI.V2.DuckDBV2TokenTypeTerminator
+    , pattern Database.DuckDB.FFI.V2.DuckDBV2TokenTypeEndOfInput
+    , pattern Database.DuckDB.FFI.V2.DuckDBV2TokenTypeMaxEnum
+    , Database.DuckDB.FFI.V2.DuckDBV2TokenIteratorStruct
+    , Database.DuckDB.FFI.V2.DuckDBV2TokenIteratorHandle(..)
+    , Database.DuckDB.FFI.V2.DuckDBV2AggregateFunctionStruct
+    , Database.DuckDB.FFI.V2.DuckDBV2AggregateFunctionHandle(..)
+    , Database.DuckDB.FFI.V2.DuckDBV2AggregateFunctionBindInfoStruct
+    , Database.DuckDB.FFI.V2.DuckDBV2AggregateFunctionBindInfoHandle(..)
+    , Database.DuckDB.FFI.V2.DuckDBV2AggregateFunctionSizeInfoStruct
+    , Database.DuckDB.FFI.V2.DuckDBV2AggregateFunctionSizeInfoHandle(..)
+    , Database.DuckDB.FFI.V2.DuckDBV2AggregateFunctionInitInfoStruct
+    , Database.DuckDB.FFI.V2.DuckDBV2AggregateFunctionInitInfoHandle(..)
+    , Database.DuckDB.FFI.V2.DuckDBV2AggregateFunctionUpdateInfoStruct
+    , Database.DuckDB.FFI.V2.DuckDBV2AggregateFunctionUpdateInfoHandle(..)
+    , Database.DuckDB.FFI.V2.DuckDBV2AggregateFunctionCombineInfoStruct
+    , Database.DuckDB.FFI.V2.DuckDBV2AggregateFunctionCombineInfoHandle(..)
+    , Database.DuckDB.FFI.V2.DuckDBV2AggregateFunctionFinalizeInfoStruct
+    , Database.DuckDB.FFI.V2.DuckDBV2AggregateFunctionFinalizeInfoHandle(..)
+    , Database.DuckDB.FFI.V2.DuckDBV2AggregateFunctionDestroyInfoStruct
+    , Database.DuckDB.FFI.V2.DuckDBV2AggregateFunctionDestroyInfoHandle(..)
+    , Database.DuckDB.FFI.V2.DuckDBV2AggregateFunctionBindCallbackFn_Aux(..)
+    , Database.DuckDB.FFI.V2.DuckDBV2AggregateFunctionBindCallbackFn(..)
+    , Database.DuckDB.FFI.V2.DuckDBV2AggregateFunctionSizeCallbackFn_Aux(..)
+    , Database.DuckDB.FFI.V2.DuckDBV2AggregateFunctionSizeCallbackFn(..)
+    , Database.DuckDB.FFI.V2.DuckDBV2AggregateFunctionInitCallbackFn_Aux(..)
+    , Database.DuckDB.FFI.V2.DuckDBV2AggregateFunctionInitCallbackFn(..)
+    , Database.DuckDB.FFI.V2.DuckDBV2AggregateFunctionUpdateCallbackFn_Aux(..)
+    , Database.DuckDB.FFI.V2.DuckDBV2AggregateFunctionUpdateCallbackFn(..)
+    , Database.DuckDB.FFI.V2.DuckDBV2AggregateFunctionCombineCallbackFn_Aux(..)
+    , Database.DuckDB.FFI.V2.DuckDBV2AggregateFunctionCombineCallbackFn(..)
+    , Database.DuckDB.FFI.V2.DuckDBV2AggregateFunctionFinalizeCallbackFn_Aux(..)
+    , Database.DuckDB.FFI.V2.DuckDBV2AggregateFunctionFinalizeCallbackFn(..)
+    , Database.DuckDB.FFI.V2.DuckDBV2AggregateFunctionDestroyCallbackFn_Aux(..)
+    , Database.DuckDB.FFI.V2.DuckDBV2AggregateFunctionDestroyCallbackFn(..)
+    , Database.DuckDB.FFI.V2.DuckDBV2TableDescriptionStruct
+    , Database.DuckDB.FFI.V2.DuckDBV2TableDescriptionHandle(..)
+    , Database.DuckDB.FFI.V2.DuckDBV2ColumnDescriptionStruct
+    , Database.DuckDB.FFI.V2.DuckDBV2ColumnDescriptionHandle(..)
+    , Database.DuckDB.FFI.V2.DuckDBV2CopyFunctionStruct
+    , Database.DuckDB.FFI.V2.DuckDBV2CopyFunctionHandle(..)
+    , Database.DuckDB.FFI.V2.DuckDBV2CopyToBindInfoStruct
+    , Database.DuckDB.FFI.V2.DuckDBV2CopyToBindInfoHandle(..)
+    , Database.DuckDB.FFI.V2.DuckDBV2CopyToBatchSizeInfoStruct
+    , Database.DuckDB.FFI.V2.DuckDBV2CopyToBatchSizeInfoHandle(..)
+    , Database.DuckDB.FFI.V2.DuckDBV2CopyToInitInfoStruct
+    , Database.DuckDB.FFI.V2.DuckDBV2CopyToInitInfoHandle(..)
+    , Database.DuckDB.FFI.V2.DuckDBV2CopyToBatchInfoStruct
+    , Database.DuckDB.FFI.V2.DuckDBV2CopyToBatchInfoHandle(..)
+    , Database.DuckDB.FFI.V2.DuckDBV2CopyToFlushInfoStruct
+    , Database.DuckDB.FFI.V2.DuckDBV2CopyToFlushInfoHandle(..)
+    , Database.DuckDB.FFI.V2.DuckDBV2CopyToFinalizeInfoStruct
+    , Database.DuckDB.FFI.V2.DuckDBV2CopyToFinalizeInfoHandle(..)
+    , Database.DuckDB.FFI.V2.DuckDBV2CopyToStatisticsInfoStruct
+    , Database.DuckDB.FFI.V2.DuckDBV2CopyToStatisticsInfoHandle(..)
+    , Database.DuckDB.FFI.V2.DuckDBV2CopyFromBindInfoStruct
+    , Database.DuckDB.FFI.V2.DuckDBV2CopyFromBindInfoHandle(..)
+    , Database.DuckDB.FFI.V2.DuckDBV2CopyFromInitGlobalInfoStruct
+    , Database.DuckDB.FFI.V2.DuckDBV2CopyFromInitGlobalInfoHandle(..)
+    , Database.DuckDB.FFI.V2.DuckDBV2CopyFromInitLocalInfoStruct
+    , Database.DuckDB.FFI.V2.DuckDBV2CopyFromInitLocalInfoHandle(..)
+    , Database.DuckDB.FFI.V2.DuckDBV2CopyFromExecInfoStruct
+    , Database.DuckDB.FFI.V2.DuckDBV2CopyFromExecInfoHandle(..)
+    , Database.DuckDB.FFI.V2.DuckDBV2CopyFromProgressInfoStruct
+    , Database.DuckDB.FFI.V2.DuckDBV2CopyFromProgressInfoHandle(..)
+    , Database.DuckDB.FFI.V2.DuckDBV2CopyToBindCallbackFn_Aux(..)
+    , Database.DuckDB.FFI.V2.DuckDBV2CopyToBindCallbackFn(..)
+    , Database.DuckDB.FFI.V2.DuckDBV2CopyToBatchSizeCallbackFn_Aux(..)
+    , Database.DuckDB.FFI.V2.DuckDBV2CopyToBatchSizeCallbackFn(..)
+    , Database.DuckDB.FFI.V2.DuckDBV2CopyToInitCallbackFn_Aux(..)
+    , Database.DuckDB.FFI.V2.DuckDBV2CopyToInitCallbackFn(..)
+    , Database.DuckDB.FFI.V2.DuckDBV2CopyToBatchCallbackFn_Aux(..)
+    , Database.DuckDB.FFI.V2.DuckDBV2CopyToBatchCallbackFn(..)
+    , Database.DuckDB.FFI.V2.DuckDBV2CopyToFlushCallbackFn_Aux(..)
+    , Database.DuckDB.FFI.V2.DuckDBV2CopyToFlushCallbackFn(..)
+    , Database.DuckDB.FFI.V2.DuckDBV2CopyToFinalizeCallbackFn_Aux(..)
+    , Database.DuckDB.FFI.V2.DuckDBV2CopyToFinalizeCallbackFn(..)
+    , Database.DuckDB.FFI.V2.DuckDBV2CopyToStatisticsCallbackFn_Aux(..)
+    , Database.DuckDB.FFI.V2.DuckDBV2CopyToStatisticsCallbackFn(..)
+    , Database.DuckDB.FFI.V2.DuckDBV2CopyFromBindCallbackFn_Aux(..)
+    , Database.DuckDB.FFI.V2.DuckDBV2CopyFromBindCallbackFn(..)
+    , Database.DuckDB.FFI.V2.DuckDBV2CopyFromInitGlobalCallbackFn_Aux(..)
+    , Database.DuckDB.FFI.V2.DuckDBV2CopyFromInitGlobalCallbackFn(..)
+    , Database.DuckDB.FFI.V2.DuckDBV2CopyFromInitLocalCallbackFn_Aux(..)
+    , Database.DuckDB.FFI.V2.DuckDBV2CopyFromInitLocalCallbackFn(..)
+    , Database.DuckDB.FFI.V2.DuckDBV2CopyFromExecCallbackFn_Aux(..)
+    , Database.DuckDB.FFI.V2.DuckDBV2CopyFromExecCallbackFn(..)
+    , Database.DuckDB.FFI.V2.DuckDBV2CopyFromProgressCallbackFn_Aux(..)
+    , Database.DuckDB.FFI.V2.DuckDBV2CopyFromProgressCallbackFn(..)
+    , Database.DuckDB.FFI.V2.DuckDBV2CustomOptionStruct
+    , Database.DuckDB.FFI.V2.DuckDBV2CustomOptionHandle(..)
+    , Database.DuckDB.FFI.V2.DuckDBV2CustomOptionUpdateInfoStruct
+    , Database.DuckDB.FFI.V2.DuckDBV2CustomOptionUpdateInfoHandle(..)
+    , Database.DuckDB.FFI.V2.DuckDBV2CustomOptionUpdateCallbackFn_Aux(..)
+    , Database.DuckDB.FFI.V2.DuckDBV2CustomOptionUpdateCallbackFn(..)
+    , Database.DuckDB.FFI.V2.DuckDBV2ExpressionType(..)
+    , pattern Database.DuckDB.FFI.V2.DuckDBV2ExpressionTypeInvalid
+    , pattern Database.DuckDB.FFI.V2.DuckDBV2ExpressionTypeOperatorCast
+    , pattern Database.DuckDB.FFI.V2.DuckDBV2ExpressionTypeOperatorNot
+    , pattern Database.DuckDB.FFI.V2.DuckDBV2ExpressionTypeOperatorIsNull
+    , pattern Database.DuckDB.FFI.V2.DuckDBV2ExpressionTypeOperatorIsNotNull
+    , pattern Database.DuckDB.FFI.V2.DuckDBV2ExpressionTypeCompareEqual
+    , pattern Database.DuckDB.FFI.V2.DuckDBV2ExpressionTypeCompareNotequal
+    , pattern Database.DuckDB.FFI.V2.DuckDBV2ExpressionTypeCompareLessthan
+    , pattern Database.DuckDB.FFI.V2.DuckDBV2ExpressionTypeCompareGreaterthan
+    , pattern Database.DuckDB.FFI.V2.DuckDBV2ExpressionTypeCompareLessthanorequalto
+    , pattern Database.DuckDB.FFI.V2.DuckDBV2ExpressionTypeCompareGreaterthanorequalto
+    , pattern Database.DuckDB.FFI.V2.DuckDBV2ExpressionTypeCompareIn
+    , pattern Database.DuckDB.FFI.V2.DuckDBV2ExpressionTypeCompareNotIn
+    , pattern Database.DuckDB.FFI.V2.DuckDBV2ExpressionTypeCompareDistinctFrom
+    , pattern Database.DuckDB.FFI.V2.DuckDBV2ExpressionTypeCompareBetween
+    , pattern Database.DuckDB.FFI.V2.DuckDBV2ExpressionTypeCompareNotDistinctFrom
+    , pattern Database.DuckDB.FFI.V2.DuckDBV2ExpressionTypeConjunctionAnd
+    , pattern Database.DuckDB.FFI.V2.DuckDBV2ExpressionTypeConjunctionOr
+    , pattern Database.DuckDB.FFI.V2.DuckDBV2ExpressionTypeValueConstant
+    , pattern Database.DuckDB.FFI.V2.DuckDBV2ExpressionTypeValueParameter
+    , pattern Database.DuckDB.FFI.V2.DuckDBV2ExpressionTypeBoundFunction
+    , pattern Database.DuckDB.FFI.V2.DuckDBV2ExpressionTypeCaseExpr
+    , pattern Database.DuckDB.FFI.V2.DuckDBV2ExpressionTypeOperatorCoalesce
+    , pattern Database.DuckDB.FFI.V2.DuckDBV2ExpressionTypeBoundColumnRef
+    , pattern Database.DuckDB.FFI.V2.DuckDBV2ExpressionTypeMaxEnum
+    , Database.DuckDB.FFI.V2.DuckDBV2ExpressionStruct
+    , Database.DuckDB.FFI.V2.DuckDBV2ExpressionHandle(..)
+    , Database.DuckDB.FFI.V2.DuckDBV2LogScope(..)
+    , pattern Database.DuckDB.FFI.V2.DuckDBV2LogScopeDatabase
+    , pattern Database.DuckDB.FFI.V2.DuckDBV2LogScopeConnection
+    , pattern Database.DuckDB.FFI.V2.DuckDBV2LogScopeThread
+    , pattern Database.DuckDB.FFI.V2.DuckDBV2LogScopeMaxEnum
+    , Database.DuckDB.FFI.V2.DuckDBV2LogSinkStruct
+    , Database.DuckDB.FFI.V2.DuckDBV2LogSinkHandle(..)
+    , Database.DuckDB.FFI.V2.DuckDBV2LogSinkWriteInfoStruct
+    , Database.DuckDB.FFI.V2.DuckDBV2LogSinkWriteInfoHandle(..)
+    , Database.DuckDB.FFI.V2.DuckDBV2LogSinkFlushInfoStruct
+    , Database.DuckDB.FFI.V2.DuckDBV2LogSinkFlushInfoHandle(..)
+    , Database.DuckDB.FFI.V2.DuckDBV2LogSinkWriteCallbackFn_Aux(..)
+    , Database.DuckDB.FFI.V2.DuckDBV2LogSinkWriteCallbackFn(..)
+    , Database.DuckDB.FFI.V2.DuckDBV2LogSinkFlushCallbackFn_Aux(..)
+    , Database.DuckDB.FFI.V2.DuckDBV2LogSinkFlushCallbackFn(..)
+    , Database.DuckDB.FFI.V2.DuckDBV2LogicalTypeId(..)
+    , pattern Database.DuckDB.FFI.V2.DuckDBV2LogicalTypeIdInvalid
+    , pattern Database.DuckDB.FFI.V2.DuckDBV2LogicalTypeIdSQLNull
+    , pattern Database.DuckDB.FFI.V2.DuckDBV2LogicalTypeIdUnknown
+    , pattern Database.DuckDB.FFI.V2.DuckDBV2LogicalTypeIdAny
+    , pattern Database.DuckDB.FFI.V2.DuckDBV2LogicalTypeIdType
+    , pattern Database.DuckDB.FFI.V2.DuckDBV2LogicalTypeIdBoolean
+    , pattern Database.DuckDB.FFI.V2.DuckDBV2LogicalTypeIdTinyInt
+    , pattern Database.DuckDB.FFI.V2.DuckDBV2LogicalTypeIdSmallInt
+    , pattern Database.DuckDB.FFI.V2.DuckDBV2LogicalTypeIdInteger
+    , pattern Database.DuckDB.FFI.V2.DuckDBV2LogicalTypeIdBigInt
+    , pattern Database.DuckDB.FFI.V2.DuckDBV2LogicalTypeIdDate
+    , pattern Database.DuckDB.FFI.V2.DuckDBV2LogicalTypeIdTime
+    , pattern Database.DuckDB.FFI.V2.DuckDBV2LogicalTypeIdTimestampSec
+    , pattern Database.DuckDB.FFI.V2.DuckDBV2LogicalTypeIdTimestampMs
+    , pattern Database.DuckDB.FFI.V2.DuckDBV2LogicalTypeIdTimestamp
+    , pattern Database.DuckDB.FFI.V2.DuckDBV2LogicalTypeIdTimestampNs
+    , pattern Database.DuckDB.FFI.V2.DuckDBV2LogicalTypeIdDecimal
+    , pattern Database.DuckDB.FFI.V2.DuckDBV2LogicalTypeIdFloat
+    , pattern Database.DuckDB.FFI.V2.DuckDBV2LogicalTypeIdDouble
+    , pattern Database.DuckDB.FFI.V2.DuckDBV2LogicalTypeIdVarchar
+    , pattern Database.DuckDB.FFI.V2.DuckDBV2LogicalTypeIdBlob
+    , pattern Database.DuckDB.FFI.V2.DuckDBV2LogicalTypeIdInterval
+    , pattern Database.DuckDB.FFI.V2.DuckDBV2LogicalTypeIdUTinyInt
+    , pattern Database.DuckDB.FFI.V2.DuckDBV2LogicalTypeIdUSmallInt
+    , pattern Database.DuckDB.FFI.V2.DuckDBV2LogicalTypeIdUInteger
+    , pattern Database.DuckDB.FFI.V2.DuckDBV2LogicalTypeIdUBigInt
+    , pattern Database.DuckDB.FFI.V2.DuckDBV2LogicalTypeIdTimestampTz
+    , pattern Database.DuckDB.FFI.V2.DuckDBV2LogicalTypeIdTimestampTzNs
+    , pattern Database.DuckDB.FFI.V2.DuckDBV2LogicalTypeIdTimeTz
+    , pattern Database.DuckDB.FFI.V2.DuckDBV2LogicalTypeIdTimeNs
+    , pattern Database.DuckDB.FFI.V2.DuckDBV2LogicalTypeIdBit
+    , pattern Database.DuckDB.FFI.V2.DuckDBV2LogicalTypeIdBigNum
+    , pattern Database.DuckDB.FFI.V2.DuckDBV2LogicalTypeIdUHugeInt
+    , pattern Database.DuckDB.FFI.V2.DuckDBV2LogicalTypeIdHugeInt
+    , pattern Database.DuckDB.FFI.V2.DuckDBV2LogicalTypeIdUUID
+    , pattern Database.DuckDB.FFI.V2.DuckDBV2LogicalTypeIdGeometry
+    , pattern Database.DuckDB.FFI.V2.DuckDBV2LogicalTypeIdStruct
+    , pattern Database.DuckDB.FFI.V2.DuckDBV2LogicalTypeIdList
+    , pattern Database.DuckDB.FFI.V2.DuckDBV2LogicalTypeIdMap
+    , pattern Database.DuckDB.FFI.V2.DuckDBV2LogicalTypeIdEnum
+    , pattern Database.DuckDB.FFI.V2.DuckDBV2LogicalTypeIdUnion
+    , pattern Database.DuckDB.FFI.V2.DuckDBV2LogicalTypeIdArray
+    , pattern Database.DuckDB.FFI.V2.DuckDBV2LogicalTypeIdVariant
+    , pattern Database.DuckDB.FFI.V2.DuckDBV2LogicalTypeIdTuple
+    , pattern Database.DuckDB.FFI.V2.DuckDBV2LogicalTypeIdMaxEnum
+    , Database.DuckDB.FFI.V2.DuckDBV2MacroFunctionType(..)
+    , pattern Database.DuckDB.FFI.V2.DuckDBV2MacroFunctionTypeScalar
+    , pattern Database.DuckDB.FFI.V2.DuckDBV2MacroFunctionTypeTable
+    , pattern Database.DuckDB.FFI.V2.DuckDBV2MacroFunctionTypeMaxEnum
+    , Database.DuckDB.FFI.V2.DuckDBV2MacroFunctionStruct
+    , Database.DuckDB.FFI.V2.DuckDBV2MacroFunctionHandle(..)
+    , Database.DuckDB.FFI.V2.DuckDBV2PragmaFunctionStruct
+    , Database.DuckDB.FFI.V2.DuckDBV2PragmaFunctionHandle(..)
+    , Database.DuckDB.FFI.V2.DuckDBV2PragmaFunctionQueryInfoStruct
+    , Database.DuckDB.FFI.V2.DuckDBV2PragmaFunctionQueryInfoHandle(..)
+    , Database.DuckDB.FFI.V2.DuckDBV2PragmaFunctionQueryCallbackFn_Aux(..)
+    , Database.DuckDB.FFI.V2.DuckDBV2PragmaFunctionQueryCallbackFn(..)
+    , Database.DuckDB.FFI.V2.DuckDBV2PragmaFunctionExecCallbackFn_Aux(..)
+    , Database.DuckDB.FFI.V2.DuckDBV2PragmaFunctionExecCallbackFn(..)
+    , Database.DuckDB.FFI.V2.DuckDBV2ReplacementScanStruct
+    , Database.DuckDB.FFI.V2.DuckDBV2ReplacementScanHandle(..)
+    , Database.DuckDB.FFI.V2.DuckDBV2ReplacementScanInfoStruct
+    , Database.DuckDB.FFI.V2.DuckDBV2ReplacementScanInfoHandle(..)
+    , Database.DuckDB.FFI.V2.DuckDBV2ReplacementScanCallbackFn_Aux(..)
+    , Database.DuckDB.FFI.V2.DuckDBV2ReplacementScanCallbackFn(..)
+    , Database.DuckDB.FFI.V2.DuckDBV2ScalarFunctionStruct
+    , Database.DuckDB.FFI.V2.DuckDBV2ScalarFunctionHandle(..)
+    , Database.DuckDB.FFI.V2.DuckDBV2ScalarFunctionResolveTypesInfoStruct
+    , Database.DuckDB.FFI.V2.DuckDBV2ScalarFunctionResolveTypesInfoHandle(..)
+    , Database.DuckDB.FFI.V2.DuckDBV2ScalarFunctionBindInfoStruct
+    , Database.DuckDB.FFI.V2.DuckDBV2ScalarFunctionBindInfoHandle(..)
+    , Database.DuckDB.FFI.V2.DuckDBV2ScalarFunctionInitInfoStruct
+    , Database.DuckDB.FFI.V2.DuckDBV2ScalarFunctionInitInfoHandle(..)
+    , Database.DuckDB.FFI.V2.DuckDBV2ScalarFunctionExecInfoStruct
+    , Database.DuckDB.FFI.V2.DuckDBV2ScalarFunctionExecInfoHandle(..)
+    , Database.DuckDB.FFI.V2.DuckDBV2ScalarFunctionResolveTypesCallbackFn_Aux(..)
+    , Database.DuckDB.FFI.V2.DuckDBV2ScalarFunctionResolveTypesCallbackFn(..)
+    , Database.DuckDB.FFI.V2.DuckDBV2ScalarFunctionBindCallbackFn_Aux(..)
+    , Database.DuckDB.FFI.V2.DuckDBV2ScalarFunctionBindCallbackFn(..)
+    , Database.DuckDB.FFI.V2.DuckDBV2ScalarFunctionInitCallbackFn_Aux(..)
+    , Database.DuckDB.FFI.V2.DuckDBV2ScalarFunctionInitCallbackFn(..)
+    , Database.DuckDB.FFI.V2.DuckDBV2ScalarFunctionExecCallbackFn_Aux(..)
+    , Database.DuckDB.FFI.V2.DuckDBV2ScalarFunctionExecCallbackFn(..)
+    , Database.DuckDB.FFI.V2.DuckDBV2StatementType(..)
+    , pattern Database.DuckDB.FFI.V2.DuckDBV2StatementTypeInvalid
+    , pattern Database.DuckDB.FFI.V2.DuckDBV2StatementTypeSelect
+    , pattern Database.DuckDB.FFI.V2.DuckDBV2StatementTypeInsert
+    , pattern Database.DuckDB.FFI.V2.DuckDBV2StatementTypeUpdate
+    , pattern Database.DuckDB.FFI.V2.DuckDBV2StatementTypeCreate
+    , pattern Database.DuckDB.FFI.V2.DuckDBV2StatementTypeDelete
+    , pattern Database.DuckDB.FFI.V2.DuckDBV2StatementTypePrepare
+    , pattern Database.DuckDB.FFI.V2.DuckDBV2StatementTypeExecute
+    , pattern Database.DuckDB.FFI.V2.DuckDBV2StatementTypeAlter
+    , pattern Database.DuckDB.FFI.V2.DuckDBV2StatementTypeTransaction
+    , pattern Database.DuckDB.FFI.V2.DuckDBV2StatementTypeCopy
+    , pattern Database.DuckDB.FFI.V2.DuckDBV2StatementTypeAnalyze
+    , pattern Database.DuckDB.FFI.V2.DuckDBV2StatementTypeVariableSet
+    , pattern Database.DuckDB.FFI.V2.DuckDBV2StatementTypeCreateFunc
+    , pattern Database.DuckDB.FFI.V2.DuckDBV2StatementTypeExplain
+    , pattern Database.DuckDB.FFI.V2.DuckDBV2StatementTypeDrop
+    , pattern Database.DuckDB.FFI.V2.DuckDBV2StatementTypeExport
+    , pattern Database.DuckDB.FFI.V2.DuckDBV2StatementTypePragma
+    , pattern Database.DuckDB.FFI.V2.DuckDBV2StatementTypeVacuum
+    , pattern Database.DuckDB.FFI.V2.DuckDBV2StatementTypeCall
+    , pattern Database.DuckDB.FFI.V2.DuckDBV2StatementTypeSet
+    , pattern Database.DuckDB.FFI.V2.DuckDBV2StatementTypeLoad
+    , pattern Database.DuckDB.FFI.V2.DuckDBV2StatementTypeRelation
+    , pattern Database.DuckDB.FFI.V2.DuckDBV2StatementTypeExtension
+    , pattern Database.DuckDB.FFI.V2.DuckDBV2StatementTypeLogicalPlan
+    , pattern Database.DuckDB.FFI.V2.DuckDBV2StatementTypeAttach
+    , pattern Database.DuckDB.FFI.V2.DuckDBV2StatementTypeDetach
+    , pattern Database.DuckDB.FFI.V2.DuckDBV2StatementTypeMulti
+    , pattern Database.DuckDB.FFI.V2.DuckDBV2StatementTypeCopyDatabase
+    , pattern Database.DuckDB.FFI.V2.DuckDBV2StatementTypeUpdateExtensions
+    , pattern Database.DuckDB.FFI.V2.DuckDBV2StatementTypeMergeInto
+    , pattern Database.DuckDB.FFI.V2.DuckDBV2StatementTypeConnect
+    , pattern Database.DuckDB.FFI.V2.DuckDBV2StatementTypeDisconnect
+    , pattern Database.DuckDB.FFI.V2.DuckDBV2StatementTypeExternalResource
+    , pattern Database.DuckDB.FFI.V2.DuckDBV2StatementTypePassthrough
+    , pattern Database.DuckDB.FFI.V2.DuckDBV2StatementTypeMaxEnum
+    , Database.DuckDB.FFI.V2.DuckDBV2SqlStatementStruct
+    , Database.DuckDB.FFI.V2.DuckDBV2SqlStatementHandle(..)
+    , Database.DuckDB.FFI.V2.DuckDBV2StatementIteratorStruct
+    , Database.DuckDB.FFI.V2.DuckDBV2StatementIteratorHandle(..)
+    , Database.DuckDB.FFI.V2.DuckDBV2VectorType(..)
+    , pattern Database.DuckDB.FFI.V2.DuckDBV2VectorTypeOther
+    , pattern Database.DuckDB.FFI.V2.DuckDBV2VectorTypeFlat
+    , pattern Database.DuckDB.FFI.V2.DuckDBV2VectorTypeConstant
+    , pattern Database.DuckDB.FFI.V2.DuckDBV2VectorTypeDictionary
+    , pattern Database.DuckDB.FFI.V2.DuckDBV2VectorTypeMaxEnum
+    , Database.DuckDB.FFI.V2.DuckDBV2VectorView(..)
+    , Database.DuckDB.FFI.V2.DuckDBV2ListEntry(..)
+    , Database.DuckDB.FFI.V2.DuckDBV2HugeintT(..)
+    , Database.DuckDB.FFI.V2.DuckDBV2UhugeintT(..)
+    , Database.DuckDB.FFI.V2.DuckDBV2IntervalT(..)
+    , Database.DuckDB.FFI.V2.DuckDBV2PreparedStatementStruct
+    , Database.DuckDB.FFI.V2.DuckDBV2PreparedStatementHandle(..)
+    , Database.DuckDB.FFI.V2.DuckDBV2ResultType(..)
+    , pattern Database.DuckDB.FFI.V2.DuckDBV2ResultTypeQueryResult
+    , pattern Database.DuckDB.FFI.V2.DuckDBV2ResultTypeChangedRows
+    , pattern Database.DuckDB.FFI.V2.DuckDBV2ResultTypeNothing
+    , pattern Database.DuckDB.FFI.V2.DuckDBV2ResultTypeMaxEnum
+    , Database.DuckDB.FFI.V2.DuckDBV2ResultStepStatus(..)
+    , pattern Database.DuckDB.FFI.V2.DuckDBV2ResultStepStatusWaiting
+    , pattern Database.DuckDB.FFI.V2.DuckDBV2ResultStepStatusChunk
+    , pattern Database.DuckDB.FFI.V2.DuckDBV2ResultStepStatusFinished
+    , pattern Database.DuckDB.FFI.V2.DuckDBV2ResultStepStatusCancelled
+    , pattern Database.DuckDB.FFI.V2.DuckDBV2ResultStepStatusMaxEnum
+    , Database.DuckDB.FFI.V2.DuckDBV2TablePartitionInfo(..)
+    , pattern Database.DuckDB.FFI.V2.DuckDBV2TablePartitionInfoNotPartitioned
+    , pattern Database.DuckDB.FFI.V2.DuckDBV2TablePartitionInfoSingleValuePartitions
+    , pattern Database.DuckDB.FFI.V2.DuckDBV2TablePartitionInfoOverlappingPartitions
+    , pattern Database.DuckDB.FFI.V2.DuckDBV2TablePartitionInfoDisjointPartitions
+    , pattern Database.DuckDB.FFI.V2.DuckDBV2TablePartitionInfoMaxEnum
+    , Database.DuckDB.FFI.V2.DuckDBV2TableFunctionStruct
+    , Database.DuckDB.FFI.V2.DuckDBV2TableFunctionHandle(..)
+    , Database.DuckDB.FFI.V2.DuckDBV2TableFunctionBindInfoStruct
+    , Database.DuckDB.FFI.V2.DuckDBV2TableFunctionBindInfoHandle(..)
+    , Database.DuckDB.FFI.V2.DuckDBV2TableFunctionInitGlobalInfoStruct
+    , Database.DuckDB.FFI.V2.DuckDBV2TableFunctionInitGlobalInfoHandle(..)
+    , Database.DuckDB.FFI.V2.DuckDBV2TableFunctionInitLocalInfoStruct
+    , Database.DuckDB.FFI.V2.DuckDBV2TableFunctionInitLocalInfoHandle(..)
+    , Database.DuckDB.FFI.V2.DuckDBV2TableFunctionExecInfoStruct
+    , Database.DuckDB.FFI.V2.DuckDBV2TableFunctionExecInfoHandle(..)
+    , Database.DuckDB.FFI.V2.DuckDBV2TableFunctionProgressInfoStruct
+    , Database.DuckDB.FFI.V2.DuckDBV2TableFunctionProgressInfoHandle(..)
+    , Database.DuckDB.FFI.V2.DuckDBV2TableFunctionFilterPushdownInfoStruct
+    , Database.DuckDB.FFI.V2.DuckDBV2TableFunctionFilterPushdownInfoHandle(..)
+    , Database.DuckDB.FFI.V2.DuckDBV2TableFunctionPartitionDataInfoStruct
+    , Database.DuckDB.FFI.V2.DuckDBV2TableFunctionPartitionDataInfoHandle(..)
+    , Database.DuckDB.FFI.V2.DuckDBV2TableFunctionPartitioningInfoStruct
+    , Database.DuckDB.FFI.V2.DuckDBV2TableFunctionPartitioningInfoHandle(..)
+    , Database.DuckDB.FFI.V2.DuckDBV2TableFunctionClaimBatchInfoStruct
+    , Database.DuckDB.FFI.V2.DuckDBV2TableFunctionClaimBatchInfoHandle(..)
+    , Database.DuckDB.FFI.V2.DuckDBV2TableFunctionGetBindInfoInfoStruct
+    , Database.DuckDB.FFI.V2.DuckDBV2TableFunctionGetBindInfoInfoHandle(..)
+    , Database.DuckDB.FFI.V2.DuckDBV2MultiFileFunctionStruct
+    , Database.DuckDB.FFI.V2.DuckDBV2MultiFileFunctionHandle(..)
+    , Database.DuckDB.FFI.V2.DuckDBV2TableFunctionBindCallbackFn_Aux(..)
+    , Database.DuckDB.FFI.V2.DuckDBV2TableFunctionBindCallbackFn(..)
+    , Database.DuckDB.FFI.V2.DuckDBV2TableFunctionInitGlobalCallbackFn_Aux(..)
+    , Database.DuckDB.FFI.V2.DuckDBV2TableFunctionInitGlobalCallbackFn(..)
+    , Database.DuckDB.FFI.V2.DuckDBV2TableFunctionInitLocalCallbackFn_Aux(..)
+    , Database.DuckDB.FFI.V2.DuckDBV2TableFunctionInitLocalCallbackFn(..)
+    , Database.DuckDB.FFI.V2.DuckDBV2TableFunctionExecCallbackFn_Aux(..)
+    , Database.DuckDB.FFI.V2.DuckDBV2TableFunctionExecCallbackFn(..)
+    , Database.DuckDB.FFI.V2.DuckDBV2TableFunctionProgressCallbackFn_Aux(..)
+    , Database.DuckDB.FFI.V2.DuckDBV2TableFunctionProgressCallbackFn(..)
+    , Database.DuckDB.FFI.V2.DuckDBV2TableFunctionFilterPushdownCallbackFn_Aux(..)
+    , Database.DuckDB.FFI.V2.DuckDBV2TableFunctionFilterPushdownCallbackFn(..)
+    , Database.DuckDB.FFI.V2.DuckDBV2TableFunctionPartitionDataCallbackFn_Aux(..)
+    , Database.DuckDB.FFI.V2.DuckDBV2TableFunctionPartitionDataCallbackFn(..)
+    , Database.DuckDB.FFI.V2.DuckDBV2TableFunctionPartitioningCallbackFn_Aux(..)
+    , Database.DuckDB.FFI.V2.DuckDBV2TableFunctionPartitioningCallbackFn(..)
+    , Database.DuckDB.FFI.V2.DuckDBV2TableFunctionClaimBatchCallbackFn_Aux(..)
+    , Database.DuckDB.FFI.V2.DuckDBV2TableFunctionClaimBatchCallbackFn(..)
+    , Database.DuckDB.FFI.V2.DuckDBV2TableFunctionGetBindInfoCallbackFn_Aux(..)
+    , Database.DuckDB.FFI.V2.DuckDBV2TableFunctionGetBindInfoCallbackFn(..)
+    , Database.DuckDB.FFI.V2.DuckDBV2ArrowImporterStruct
+    , Database.DuckDB.FFI.V2.DuckDBV2ArrowImporterHandle(..)
+    , Database.DuckDB.FFI.V2.DuckDBV2ArrowExporterStruct
+    , Database.DuckDB.FFI.V2.DuckDBV2ArrowExporterHandle(..)
+    , Database.DuckDB.FFI.V2.DuckDBV2ArrowResultStruct
+    , Database.DuckDB.FFI.V2.DuckDBV2ArrowResultHandle(..)
+    , Database.DuckDB.FFI.V2.c_duckdb_v2_arena_allocate
+    , Database.DuckDB.FFI.V2.c_duckdb_v2_cast_function_create
+    , Database.DuckDB.FFI.V2.c_duckdb_v2_cast_function_set_source_type
+    , Database.DuckDB.FFI.V2.c_duckdb_v2_cast_function_set_target_type
+    , Database.DuckDB.FFI.V2.c_duckdb_v2_cast_function_set_implicit_cast_cost
+    , Database.DuckDB.FFI.V2.c_duckdb_v2_cast_function_set_user_data
+    , Database.DuckDB.FFI.V2.c_duckdb_v2_cast_function_set_exec_callback
+    , Database.DuckDB.FFI.V2.c_duckdb_v2_cast_function_exec_get_user_data
+    , Database.DuckDB.FFI.V2.c_duckdb_v2_cast_function_exec_get_row_count
+    , Database.DuckDB.FFI.V2.c_duckdb_v2_cast_function_exec_get_input
+    , Database.DuckDB.FFI.V2.c_duckdb_v2_cast_function_exec_get_output
+    , Database.DuckDB.FFI.V2.c_duckdb_v2_cast_function_exec_get_mode
+    , Database.DuckDB.FFI.V2.c_duckdb_v2_connection_register_cast_function
+    , Database.DuckDB.FFI.V2.c_duckdb_v2_extension_register_cast_function
+    , Database.DuckDB.FFI.V2.c_duckdb_v2_cast_function_destroy
+    , Database.DuckDB.FFI.V2.c_duckdb_v2_column_data_collection_create
+    , Database.DuckDB.FFI.V2.c_duckdb_v2_column_data_collection_reset
+    , Database.DuckDB.FFI.V2.c_duckdb_v2_column_data_collection_clear
+    , Database.DuckDB.FFI.V2.c_duckdb_v2_column_data_collection_destroy
+    , Database.DuckDB.FFI.V2.c_duckdb_v2_column_data_collection_combine
+    , Database.DuckDB.FFI.V2.c_duckdb_v2_column_data_collection_row_count
+    , Database.DuckDB.FFI.V2.c_duckdb_v2_column_data_collection_append_state_create
+    , Database.DuckDB.FFI.V2.c_duckdb_v2_column_data_collection_append_state_destroy
+    , Database.DuckDB.FFI.V2.c_duckdb_v2_column_data_collection_append
+    , Database.DuckDB.FFI.V2.c_duckdb_v2_column_data_collection_shared_scan_state_create
+    , Database.DuckDB.FFI.V2.c_duckdb_v2_column_data_collection_shared_scan_state_destroy
+    , Database.DuckDB.FFI.V2.c_duckdb_v2_column_data_collection_worker_scan_state_create
+    , Database.DuckDB.FFI.V2.c_duckdb_v2_column_data_collection_worker_scan_state_destroy
+    , Database.DuckDB.FFI.V2.c_duckdb_v2_column_data_collection_scan
+    , Database.DuckDB.FFI.V2.c_duckdb_v2_instance_get_config
+    , Database.DuckDB.FFI.V2.c_duckdb_v2_connection_get_config
+    , Database.DuckDB.FFI.V2.c_duckdb_v2_context_get_config
+    , Database.DuckDB.FFI.V2.c_duckdb_v2_config_get_option_value
+    , Database.DuckDB.FFI.V2.c_duckdb_v2_config_set_option_value
+    , Database.DuckDB.FFI.V2.c_duckdb_v2_config_set_option_text
+    , Database.DuckDB.FFI.V2.c_duckdb_v2_config_get_option_by_name
+    , Database.DuckDB.FFI.V2.c_duckdb_v2_config_get_option_count
+    , Database.DuckDB.FFI.V2.c_duckdb_v2_config_get_option_by_index
+    , Database.DuckDB.FFI.V2.c_duckdb_v2_option_destroy
+    , Database.DuckDB.FFI.V2.c_duckdb_v2_option_get_name
+    , Database.DuckDB.FFI.V2.c_duckdb_v2_option_get_default_value
+    , Database.DuckDB.FFI.V2.c_duckdb_v2_option_get_description
+    , Database.DuckDB.FFI.V2.c_duckdb_v2_option_supports_scope
+    , Database.DuckDB.FFI.V2.c_duckdb_v2_option_get_default_scope
+    , Database.DuckDB.FFI.V2.c_duckdb_v2_option_get_alias_count
+    , Database.DuckDB.FFI.V2.c_duckdb_v2_option_get_alias
+    , Database.DuckDB.FFI.V2.c_duckdb_v2_connection_create
+    , Database.DuckDB.FFI.V2.c_duckdb_v2_connection_destroy
+    , Database.DuckDB.FFI.V2.c_duckdb_v2_connection_interrupt
+    , Database.DuckDB.FFI.V2.c_duckdb_v2_connection_progress_get
+    , Database.DuckDB.FFI.V2.c_duckdb_v2_custom_type_create
+    , Database.DuckDB.FFI.V2.c_duckdb_v2_custom_type_set_name
+    , Database.DuckDB.FFI.V2.c_duckdb_v2_custom_type_set_base_type
+    , Database.DuckDB.FFI.V2.c_duckdb_v2_connection_register_custom_type
+    , Database.DuckDB.FFI.V2.c_duckdb_v2_extension_register_custom_type
+    , Database.DuckDB.FFI.V2.c_duckdb_v2_custom_type_destroy
+    , Database.DuckDB.FFI.V2.c_duckdb_v2_data_chunk_create
+    , Database.DuckDB.FFI.V2.c_duckdb_v2_data_chunk_copy
+    , Database.DuckDB.FFI.V2.c_duckdb_v2_data_chunk_destroy
+    , Database.DuckDB.FFI.V2.c_duckdb_v2_data_chunk_clear
+    , Database.DuckDB.FFI.V2.c_duckdb_v2_data_chunk_get_size
+    , Database.DuckDB.FFI.V2.c_duckdb_v2_data_chunk_get_capacity
+    , Database.DuckDB.FFI.V2.c_duckdb_v2_data_chunk_get_vector_count
+    , Database.DuckDB.FFI.V2.c_duckdb_v2_data_chunk_get_vector
+    , Database.DuckDB.FFI.V2.c_duckdb_v2_environment_create
+    , Database.DuckDB.FFI.V2.c_duckdb_v2_environment_destroy
+    , Database.DuckDB.FFI.V2.c_duckdb_v2_environment_get_instance_count
+    , Database.DuckDB.FFI.V2.c_duckdb_v2_error_info_get_code
+    , Database.DuckDB.FFI.V2.c_duckdb_v2_error_info_get_text
+    , Database.DuckDB.FFI.V2.c_duckdb_v2_error_info_get_raw_text
+    , Database.DuckDB.FFI.V2.c_duckdb_v2_error_info_set_code
+    , Database.DuckDB.FFI.V2.c_duckdb_v2_error_info_set_text
+    , Database.DuckDB.FFI.V2.c_duckdb_v2_error_info_destroy
+    , Database.DuckDB.FFI.V2.c_duckdb_v2_instance_get_factory
+    , Database.DuckDB.FFI.V2.c_duckdb_v2_connection_get_factory
+    , Database.DuckDB.FFI.V2.c_duckdb_v2_context_get_factory
+    , Database.DuckDB.FFI.V2.c_duckdb_v2_context_get_file_system
+    , Database.DuckDB.FFI.V2.c_duckdb_v2_instance_get_file_system
+    , Database.DuckDB.FFI.V2.c_duckdb_v2_connection_get_file_system
+    , Database.DuckDB.FFI.V2.c_duckdb_v2_file_open_options_create
+    , Database.DuckDB.FFI.V2.c_duckdb_v2_file_open_options_set_flag
+    , Database.DuckDB.FFI.V2.c_duckdb_v2_file_open_options_set_value
+    , Database.DuckDB.FFI.V2.c_duckdb_v2_file_open_options_destroy
+    , Database.DuckDB.FFI.V2.c_duckdb_v2_file_system_open
+    , Database.DuckDB.FFI.V2.c_duckdb_v2_file_system_path_exists
+    , Database.DuckDB.FFI.V2.c_duckdb_v2_file_system_path_is_remote
+    , Database.DuckDB.FFI.V2.c_duckdb_v2_file_system_path_expand
+    , Database.DuckDB.FFI.V2.c_duckdb_v2_file_system_path_glob
+    , Database.DuckDB.FFI.V2.c_duckdb_v2_file_system_path_move
+    , Database.DuckDB.FFI.V2.c_duckdb_v2_file_system_path_remove
+    , Database.DuckDB.FFI.V2.c_duckdb_v2_file_read
+    , Database.DuckDB.FFI.V2.c_duckdb_v2_file_write
+    , Database.DuckDB.FFI.V2.c_duckdb_v2_file_read_at
+    , Database.DuckDB.FFI.V2.c_duckdb_v2_file_write_at
+    , Database.DuckDB.FFI.V2.c_duckdb_v2_file_tell
+    , Database.DuckDB.FFI.V2.c_duckdb_v2_file_size
+    , Database.DuckDB.FFI.V2.c_duckdb_v2_file_seek
+    , Database.DuckDB.FFI.V2.c_duckdb_v2_file_sync
+    , Database.DuckDB.FFI.V2.c_duckdb_v2_file_close
+    , Database.DuckDB.FFI.V2.c_duckdb_v2_file_destroy
+    , Database.DuckDB.FFI.V2.c_duckdb_v2_function_bind_get_user_data
+    , Database.DuckDB.FFI.V2.c_duckdb_v2_function_bind_set_bind_data
+    , Database.DuckDB.FFI.V2.c_duckdb_v2_function_bind_get_arg_count
+    , Database.DuckDB.FFI.V2.c_duckdb_v2_function_bind_get_arg_type
+    , Database.DuckDB.FFI.V2.c_duckdb_v2_function_bind_get_arg_value
+    , Database.DuckDB.FFI.V2.c_duckdb_v2_function_bind_get_arg_name
+    , Database.DuckDB.FFI.V2.c_duckdb_v2_function_bind_get_arg_index
+    , Database.DuckDB.FFI.V2.c_duckdb_v2_function_docs_set_description
+    , Database.DuckDB.FFI.V2.c_duckdb_v2_function_docs_add_example
+    , Database.DuckDB.FFI.V2.c_duckdb_v2_function_docs_add_category
+    , Database.DuckDB.FFI.V2.c_duckdb_v2_function_signature_add_parameter
+    , Database.DuckDB.FFI.V2.c_duckdb_v2_function_signature_set_return_type
+    , Database.DuckDB.FFI.V2.c_duckdb_v2_identifier_render_quoted
+    , Database.DuckDB.FFI.V2.c_duckdb_v2_instance_create
+    , Database.DuckDB.FFI.V2.c_duckdb_v2_instance_create_with_options
+    , Database.DuckDB.FFI.V2.c_duckdb_v2_instance_destroy
+    , Database.DuckDB.FFI.V2.c_duckdb_v2_instance_attach
+    , Database.DuckDB.FFI.V2.c_duckdb_v2_instance_detach
+    , Database.DuckDB.FFI.V2.c_duckdb_v2_instance_set_default
+    , Database.DuckDB.FFI.V2.c_duckdb_v2_attach_options_create
+    , Database.DuckDB.FFI.V2.c_duckdb_v2_attach_options_set
+    , Database.DuckDB.FFI.V2.c_duckdb_v2_attach_options_destroy
+    , Database.DuckDB.FFI.V2.c_duckdb_v2_library_version
+    , Database.DuckDB.FFI.V2.c_duckdb_v2_context_log
+    , Database.DuckDB.FFI.V2.c_duckdb_v2_instance_log
+    , Database.DuckDB.FFI.V2.c_duckdb_v2_connection_log
+    , Database.DuckDB.FFI.V2.c_duckdb_v2_qname_parse
+    , Database.DuckDB.FFI.V2.c_duckdb_v2_qname_create
+    , Database.DuckDB.FFI.V2.c_duckdb_v2_qname_get_part_count
+    , Database.DuckDB.FFI.V2.c_duckdb_v2_qname_get_part
+    , Database.DuckDB.FFI.V2.c_duckdb_v2_qname_render
+    , Database.DuckDB.FFI.V2.c_duckdb_v2_qname_equals
+    , Database.DuckDB.FFI.V2.c_duckdb_v2_qname_hash
+    , Database.DuckDB.FFI.V2.c_duckdb_v2_qname_destroy
+    , Database.DuckDB.FFI.V2.c_duckdb_v2_connection_get_query_metrics
+    , Database.DuckDB.FFI.V2.c_duckdb_v2_connection_enable_profiling
+    , Database.DuckDB.FFI.V2.c_duckdb_v2_query_metrics_get_root
+    , Database.DuckDB.FFI.V2.c_duckdb_v2_query_metrics_node_get_name
+    , Database.DuckDB.FFI.V2.c_duckdb_v2_query_metrics_node_get_child_count
+    , Database.DuckDB.FFI.V2.c_duckdb_v2_query_metrics_node_get_child
+    , Database.DuckDB.FFI.V2.c_duckdb_v2_query_metrics_node_get_metric_count
+    , Database.DuckDB.FFI.V2.c_duckdb_v2_query_metrics_node_get_metric_name
+    , Database.DuckDB.FFI.V2.c_duckdb_v2_query_metrics_node_get_metric_value
+    , Database.DuckDB.FFI.V2.c_duckdb_v2_query_metrics_node_get_metric
+    , Database.DuckDB.FFI.V2.c_duckdb_v2_query_metrics_destroy
+    , Database.DuckDB.FFI.V2.c_duckdb_v2_schema_get_count
+    , Database.DuckDB.FFI.V2.c_duckdb_v2_schema_get_field
+    , Database.DuckDB.FFI.V2.c_duckdb_v2_schema_destroy
+    , Database.DuckDB.FFI.V2.c_duckdb_v2_tokenize_sql
+    , Database.DuckDB.FFI.V2.c_duckdb_v2_token_iterator_next
+    , Database.DuckDB.FFI.V2.c_duckdb_v2_token_iterator_ends_unterminated
+    , Database.DuckDB.FFI.V2.c_duckdb_v2_token_iterator_destroy
+    , Database.DuckDB.FFI.V2.c_duckdb_v2_aggregate_function_create
+    , Database.DuckDB.FFI.V2.c_duckdb_v2_aggregate_function_set_name
+    , Database.DuckDB.FFI.V2.c_duckdb_v2_aggregate_function_get_docs
+    , Database.DuckDB.FFI.V2.c_duckdb_v2_aggregate_function_get_signature
+    , Database.DuckDB.FFI.V2.c_duckdb_v2_aggregate_function_set_user_data
+    , Database.DuckDB.FFI.V2.c_duckdb_v2_aggregate_function_set_property
+    , Database.DuckDB.FFI.V2.c_duckdb_v2_aggregate_function_set_bind_callback
+    , Database.DuckDB.FFI.V2.c_duckdb_v2_aggregate_function_set_size_callback
+    , Database.DuckDB.FFI.V2.c_duckdb_v2_aggregate_function_set_init_callback
+    , Database.DuckDB.FFI.V2.c_duckdb_v2_aggregate_function_set_update_callback
+    , Database.DuckDB.FFI.V2.c_duckdb_v2_aggregate_function_set_combine_callback
+    , Database.DuckDB.FFI.V2.c_duckdb_v2_aggregate_function_set_finalize_callback
+    , Database.DuckDB.FFI.V2.c_duckdb_v2_aggregate_function_set_destroy_callback
+    , Database.DuckDB.FFI.V2.c_duckdb_v2_aggregate_function_bind_set_return_type
+    , Database.DuckDB.FFI.V2.c_duckdb_v2_aggregate_function_size_get_user_data
+    , Database.DuckDB.FFI.V2.c_duckdb_v2_aggregate_function_size_get_bind_data
+    , Database.DuckDB.FFI.V2.c_duckdb_v2_aggregate_function_size_set_state_size
+    , Database.DuckDB.FFI.V2.c_duckdb_v2_aggregate_function_init_get_user_data
+    , Database.DuckDB.FFI.V2.c_duckdb_v2_aggregate_function_init_get_bind_data
+    , Database.DuckDB.FFI.V2.c_duckdb_v2_aggregate_function_init_get_state_count
+    , Database.DuckDB.FFI.V2.c_duckdb_v2_aggregate_function_init_get_states
+    , Database.DuckDB.FFI.V2.c_duckdb_v2_aggregate_function_update_get_user_data
+    , Database.DuckDB.FFI.V2.c_duckdb_v2_aggregate_function_update_get_bind_data
+    , Database.DuckDB.FFI.V2.c_duckdb_v2_aggregate_function_update_get_row_count
+    , Database.DuckDB.FFI.V2.c_duckdb_v2_aggregate_function_update_get_arg_count
+    , Database.DuckDB.FFI.V2.c_duckdb_v2_aggregate_function_update_get_arg
+    , Database.DuckDB.FFI.V2.c_duckdb_v2_aggregate_function_update_get_states
+    , Database.DuckDB.FFI.V2.c_duckdb_v2_aggregate_function_combine_get_user_data
+    , Database.DuckDB.FFI.V2.c_duckdb_v2_aggregate_function_combine_get_bind_data
+    , Database.DuckDB.FFI.V2.c_duckdb_v2_aggregate_function_combine_get_state_count
+    , Database.DuckDB.FFI.V2.c_duckdb_v2_aggregate_function_combine_get_sources
+    , Database.DuckDB.FFI.V2.c_duckdb_v2_aggregate_function_combine_get_targets
+    , Database.DuckDB.FFI.V2.c_duckdb_v2_aggregate_function_finalize_get_user_data
+    , Database.DuckDB.FFI.V2.c_duckdb_v2_aggregate_function_finalize_get_bind_data
+    , Database.DuckDB.FFI.V2.c_duckdb_v2_aggregate_function_finalize_get_state_count
+    , Database.DuckDB.FFI.V2.c_duckdb_v2_aggregate_function_finalize_get_states
+    , Database.DuckDB.FFI.V2.c_duckdb_v2_aggregate_function_finalize_get_result
+    , Database.DuckDB.FFI.V2.c_duckdb_v2_aggregate_function_finalize_get_result_offset
+    , Database.DuckDB.FFI.V2.c_duckdb_v2_aggregate_function_destroy_get_user_data
+    , Database.DuckDB.FFI.V2.c_duckdb_v2_aggregate_function_destroy_get_bind_data
+    , Database.DuckDB.FFI.V2.c_duckdb_v2_aggregate_function_destroy_get_state_count
+    , Database.DuckDB.FFI.V2.c_duckdb_v2_aggregate_function_destroy_get_states
+    , Database.DuckDB.FFI.V2.c_duckdb_v2_connection_register_aggregate_function
+    , Database.DuckDB.FFI.V2.c_duckdb_v2_extension_register_aggregate_function
+    , Database.DuckDB.FFI.V2.c_duckdb_v2_aggregate_function_destroy
+    , Database.DuckDB.FFI.V2.c_duckdb_v2_connection_describe_table
+    , Database.DuckDB.FFI.V2.c_duckdb_v2_table_description_get_qname
+    , Database.DuckDB.FFI.V2.c_duckdb_v2_table_description_is_readonly
+    , Database.DuckDB.FFI.V2.c_duckdb_v2_table_description_get_column_count
+    , Database.DuckDB.FFI.V2.c_duckdb_v2_table_description_get_column
+    , Database.DuckDB.FFI.V2.c_duckdb_v2_table_description_destroy
+    , Database.DuckDB.FFI.V2.c_duckdb_v2_column_description_get_name
+    , Database.DuckDB.FFI.V2.c_duckdb_v2_column_description_get_type
+    , Database.DuckDB.FFI.V2.c_duckdb_v2_column_description_has_default
+    , Database.DuckDB.FFI.V2.c_duckdb_v2_column_description_has_generated
+    , Database.DuckDB.FFI.V2.c_duckdb_v2_column_description_destroy
+    , Database.DuckDB.FFI.V2.c_duckdb_v2_copy_function_create
+    , Database.DuckDB.FFI.V2.c_duckdb_v2_copy_function_set_name
+    , Database.DuckDB.FFI.V2.c_duckdb_v2_copy_function_set_file_extension
+    , Database.DuckDB.FFI.V2.c_duckdb_v2_copy_function_set_user_data
+    , Database.DuckDB.FFI.V2.c_duckdb_v2_copy_to_set_bind_callback
+    , Database.DuckDB.FFI.V2.c_duckdb_v2_copy_to_set_batch_size_callback
+    , Database.DuckDB.FFI.V2.c_duckdb_v2_copy_to_set_init_callback
+    , Database.DuckDB.FFI.V2.c_duckdb_v2_copy_to_set_batch_callback
+    , Database.DuckDB.FFI.V2.c_duckdb_v2_copy_to_set_flush_callback
+    , Database.DuckDB.FFI.V2.c_duckdb_v2_copy_to_set_finalize_callback
+    , Database.DuckDB.FFI.V2.c_duckdb_v2_copy_to_bind_get_user_data
+    , Database.DuckDB.FFI.V2.c_duckdb_v2_copy_to_bind_set_bind_data
+    , Database.DuckDB.FFI.V2.c_duckdb_v2_copy_to_bind_get_file_path
+    , Database.DuckDB.FFI.V2.c_duckdb_v2_copy_to_bind_get_column_count
+    , Database.DuckDB.FFI.V2.c_duckdb_v2_copy_to_bind_get_column_type
+    , Database.DuckDB.FFI.V2.c_duckdb_v2_copy_to_bind_get_column_name
+    , Database.DuckDB.FFI.V2.c_duckdb_v2_copy_to_bind_get_option_count
+    , Database.DuckDB.FFI.V2.c_duckdb_v2_copy_to_bind_get_option_name
+    , Database.DuckDB.FFI.V2.c_duckdb_v2_copy_to_bind_get_option_value
+    , Database.DuckDB.FFI.V2.c_duckdb_v2_copy_to_batch_size_get_user_data
+    , Database.DuckDB.FFI.V2.c_duckdb_v2_copy_to_batch_size_get_bind_data
+    , Database.DuckDB.FFI.V2.c_duckdb_v2_copy_to_batch_size_set_target
+    , Database.DuckDB.FFI.V2.c_duckdb_v2_copy_to_init_get_user_data
+    , Database.DuckDB.FFI.V2.c_duckdb_v2_copy_to_init_get_bind_data
+    , Database.DuckDB.FFI.V2.c_duckdb_v2_copy_to_init_get_file_path
+    , Database.DuckDB.FFI.V2.c_duckdb_v2_copy_to_init_set_init_data
+    , Database.DuckDB.FFI.V2.c_duckdb_v2_copy_to_batch_get_user_data
+    , Database.DuckDB.FFI.V2.c_duckdb_v2_copy_to_batch_get_bind_data
+    , Database.DuckDB.FFI.V2.c_duckdb_v2_copy_to_batch_get_init_data
+    , Database.DuckDB.FFI.V2.c_duckdb_v2_copy_to_batch_take_input
+    , Database.DuckDB.FFI.V2.c_duckdb_v2_copy_to_batch_set_batch_data
+    , Database.DuckDB.FFI.V2.c_duckdb_v2_copy_to_flush_get_user_data
+    , Database.DuckDB.FFI.V2.c_duckdb_v2_copy_to_flush_get_bind_data
+    , Database.DuckDB.FFI.V2.c_duckdb_v2_copy_to_flush_get_init_data
+    , Database.DuckDB.FFI.V2.c_duckdb_v2_copy_to_flush_get_batch_data
+    , Database.DuckDB.FFI.V2.c_duckdb_v2_copy_to_finalize_get_user_data
+    , Database.DuckDB.FFI.V2.c_duckdb_v2_copy_to_finalize_get_bind_data
+    , Database.DuckDB.FFI.V2.c_duckdb_v2_copy_to_finalize_get_init_data
+    , Database.DuckDB.FFI.V2.c_duckdb_v2_copy_from_set_bind_callback
+    , Database.DuckDB.FFI.V2.c_duckdb_v2_copy_from_set_init_global_callback
+    , Database.DuckDB.FFI.V2.c_duckdb_v2_copy_from_set_init_local_callback
+    , Database.DuckDB.FFI.V2.c_duckdb_v2_copy_from_set_exec_callback
+    , Database.DuckDB.FFI.V2.c_duckdb_v2_copy_from_set_progress_callback
+    , Database.DuckDB.FFI.V2.c_duckdb_v2_copy_from_bind_get_user_data
+    , Database.DuckDB.FFI.V2.c_duckdb_v2_copy_from_bind_set_bind_data
+    , Database.DuckDB.FFI.V2.c_duckdb_v2_copy_from_bind_get_file_path
+    , Database.DuckDB.FFI.V2.c_duckdb_v2_copy_from_bind_get_column_count
+    , Database.DuckDB.FFI.V2.c_duckdb_v2_copy_from_bind_get_column_type
+    , Database.DuckDB.FFI.V2.c_duckdb_v2_copy_from_bind_get_column_name
+    , Database.DuckDB.FFI.V2.c_duckdb_v2_copy_from_bind_get_option_count
+    , Database.DuckDB.FFI.V2.c_duckdb_v2_copy_from_bind_get_option_name
+    , Database.DuckDB.FFI.V2.c_duckdb_v2_copy_from_bind_get_option_value
+    , Database.DuckDB.FFI.V2.c_duckdb_v2_copy_from_bind_set_cardinality
+    , Database.DuckDB.FFI.V2.c_duckdb_v2_copy_from_init_global_get_user_data
+    , Database.DuckDB.FFI.V2.c_duckdb_v2_copy_from_init_global_get_bind_data
+    , Database.DuckDB.FFI.V2.c_duckdb_v2_copy_from_init_global_set_global_state
+    , Database.DuckDB.FFI.V2.c_duckdb_v2_copy_from_init_global_set_max_threads
+    , Database.DuckDB.FFI.V2.c_duckdb_v2_copy_from_init_local_get_user_data
+    , Database.DuckDB.FFI.V2.c_duckdb_v2_copy_from_init_local_get_bind_data
+    , Database.DuckDB.FFI.V2.c_duckdb_v2_copy_from_init_local_get_global_state
+    , Database.DuckDB.FFI.V2.c_duckdb_v2_copy_from_init_local_set_local_state
+    , Database.DuckDB.FFI.V2.c_duckdb_v2_copy_from_exec_get_user_data
+    , Database.DuckDB.FFI.V2.c_duckdb_v2_copy_from_exec_get_bind_data
+    , Database.DuckDB.FFI.V2.c_duckdb_v2_copy_from_exec_get_global_state
+    , Database.DuckDB.FFI.V2.c_duckdb_v2_copy_from_exec_get_local_state
+    , Database.DuckDB.FFI.V2.c_duckdb_v2_copy_from_exec_get_output_chunk
+    , Database.DuckDB.FFI.V2.c_duckdb_v2_copy_from_progress_get_user_data
+    , Database.DuckDB.FFI.V2.c_duckdb_v2_copy_from_progress_get_bind_data
+    , Database.DuckDB.FFI.V2.c_duckdb_v2_copy_from_progress_get_global_state
+    , Database.DuckDB.FFI.V2.c_duckdb_v2_copy_from_progress_set_progress
+    , Database.DuckDB.FFI.V2.c_duckdb_v2_connection_register_copy_function
+    , Database.DuckDB.FFI.V2.c_duckdb_v2_extension_register_copy_function
+    , Database.DuckDB.FFI.V2.c_duckdb_v2_copy_function_destroy
+    , Database.DuckDB.FFI.V2.c_duckdb_v2_copy_to_set_statistics_callback
+    , Database.DuckDB.FFI.V2.c_duckdb_v2_copy_to_statistics_get_user_data
+    , Database.DuckDB.FFI.V2.c_duckdb_v2_copy_to_statistics_get_bind_data
+    , Database.DuckDB.FFI.V2.c_duckdb_v2_copy_to_statistics_get_init_data
+    , Database.DuckDB.FFI.V2.c_duckdb_v2_copy_to_statistics_set_row_count
+    , Database.DuckDB.FFI.V2.c_duckdb_v2_copy_to_statistics_set_file_size
+    , Database.DuckDB.FFI.V2.c_duckdb_v2_custom_option_create
+    , Database.DuckDB.FFI.V2.c_duckdb_v2_custom_option_set_name
+    , Database.DuckDB.FFI.V2.c_duckdb_v2_custom_option_set_type
+    , Database.DuckDB.FFI.V2.c_duckdb_v2_custom_option_set_default_value
+    , Database.DuckDB.FFI.V2.c_duckdb_v2_custom_option_set_description
+    , Database.DuckDB.FFI.V2.c_duckdb_v2_custom_option_set_default_scope
+    , Database.DuckDB.FFI.V2.c_duckdb_v2_custom_option_set_supports_scope
+    , Database.DuckDB.FFI.V2.c_duckdb_v2_custom_option_set_user_data
+    , Database.DuckDB.FFI.V2.c_duckdb_v2_custom_option_set_update_callback
+    , Database.DuckDB.FFI.V2.c_duckdb_v2_custom_option_update_get_user_data
+    , Database.DuckDB.FFI.V2.c_duckdb_v2_custom_option_update_get_value
+    , Database.DuckDB.FFI.V2.c_duckdb_v2_custom_option_update_set_value
+    , Database.DuckDB.FFI.V2.c_duckdb_v2_custom_option_update_get_scope
+    , Database.DuckDB.FFI.V2.c_duckdb_v2_custom_option_update_is_reset
+    , Database.DuckDB.FFI.V2.c_duckdb_v2_connection_register_custom_option
+    , Database.DuckDB.FFI.V2.c_duckdb_v2_extension_register_custom_option
+    , Database.DuckDB.FFI.V2.c_duckdb_v2_custom_option_destroy
+    , Database.DuckDB.FFI.V2.c_duckdb_v2_expression_get_type
+    , Database.DuckDB.FFI.V2.c_duckdb_v2_expression_get_return_type
+    , Database.DuckDB.FFI.V2.c_duckdb_v2_expression_get_child_count
+    , Database.DuckDB.FFI.V2.c_duckdb_v2_expression_get_child
+    , Database.DuckDB.FFI.V2.c_duckdb_v2_expression_constant_get_value
+    , Database.DuckDB.FFI.V2.c_duckdb_v2_expression_column_ref_get_index
+    , Database.DuckDB.FFI.V2.c_duckdb_v2_expression_function_get_name
+    , Database.DuckDB.FFI.V2.c_duckdb_v2_expression_function_get_qname
+    , Database.DuckDB.FFI.V2.c_duckdb_v2_expression_cast_get_mode
+    , Database.DuckDB.FFI.V2.c_duckdb_v2_log_sink_create
+    , Database.DuckDB.FFI.V2.c_duckdb_v2_log_sink_set_name
+    , Database.DuckDB.FFI.V2.c_duckdb_v2_log_sink_set_user_data
+    , Database.DuckDB.FFI.V2.c_duckdb_v2_log_sink_set_write_callback
+    , Database.DuckDB.FFI.V2.c_duckdb_v2_log_sink_set_flush_callback
+    , Database.DuckDB.FFI.V2.c_duckdb_v2_log_sink_write_info_get_connection_id
+    , Database.DuckDB.FFI.V2.c_duckdb_v2_log_sink_write_info_get_transaction_id
+    , Database.DuckDB.FFI.V2.c_duckdb_v2_log_sink_write_info_get_query_id
+    , Database.DuckDB.FFI.V2.c_duckdb_v2_log_sink_write_info_get_thread_id
+    , Database.DuckDB.FFI.V2.c_duckdb_v2_instance_register_log_sink
+    , Database.DuckDB.FFI.V2.c_duckdb_v2_extension_register_log_sink
+    , Database.DuckDB.FFI.V2.c_duckdb_v2_log_sink_destroy
+    , Database.DuckDB.FFI.V2.c_duckdb_v2_factory_create_type_from_id
+    , Database.DuckDB.FFI.V2.c_duckdb_v2_factory_create_type_from_name
+    , Database.DuckDB.FFI.V2.c_duckdb_v2_factory_create_type_from_text
+    , Database.DuckDB.FFI.V2.c_duckdb_v2_logical_type_copy
+    , Database.DuckDB.FFI.V2.c_duckdb_v2_logical_type_destroy
+    , Database.DuckDB.FFI.V2.c_duckdb_v2_logical_type_is_equal
+    , Database.DuckDB.FFI.V2.c_duckdb_v2_logical_type_get_id
+    , Database.DuckDB.FFI.V2.c_duckdb_v2_logical_type_get_name
+    , Database.DuckDB.FFI.V2.c_duckdb_v2_logical_type_to_text
+    , Database.DuckDB.FFI.V2.c_duckdb_v2_logical_type_get_param_count
+    , Database.DuckDB.FFI.V2.c_duckdb_v2_logical_type_get_param
+    , Database.DuckDB.FFI.V2.c_duckdb_v2_factory_create_type_with_alias
+    , Database.DuckDB.FFI.V2.c_duckdb_v2_factory_create_common_type
+    , Database.DuckDB.FFI.V2.c_duckdb_v2_macro_function_create
+    , Database.DuckDB.FFI.V2.c_duckdb_v2_macro_function_set_name
+    , Database.DuckDB.FFI.V2.c_duckdb_v2_macro_function_set_body
+    , Database.DuckDB.FFI.V2.c_duckdb_v2_macro_function_get_signature
+    , Database.DuckDB.FFI.V2.c_duckdb_v2_macro_function_get_docs
+    , Database.DuckDB.FFI.V2.c_duckdb_v2_extension_register_macro_function
+    , Database.DuckDB.FFI.V2.c_duckdb_v2_macro_function_destroy
+    , Database.DuckDB.FFI.V2.c_duckdb_v2_pragma_function_create
+    , Database.DuckDB.FFI.V2.c_duckdb_v2_pragma_function_set_name
+    , Database.DuckDB.FFI.V2.c_duckdb_v2_pragma_function_get_docs
+    , Database.DuckDB.FFI.V2.c_duckdb_v2_pragma_function_get_signature
+    , Database.DuckDB.FFI.V2.c_duckdb_v2_pragma_function_set_user_data
+    , Database.DuckDB.FFI.V2.c_duckdb_v2_pragma_function_set_query_callback
+    , Database.DuckDB.FFI.V2.c_duckdb_v2_pragma_function_set_exec_callback
+    , Database.DuckDB.FFI.V2.c_duckdb_v2_pragma_function_query_set_query
+    , Database.DuckDB.FFI.V2.c_duckdb_v2_connection_register_pragma_function
+    , Database.DuckDB.FFI.V2.c_duckdb_v2_extension_register_pragma_function
+    , Database.DuckDB.FFI.V2.c_duckdb_v2_pragma_function_destroy
+    , Database.DuckDB.FFI.V2.c_duckdb_v2_replacement_scan_create
+    , Database.DuckDB.FFI.V2.c_duckdb_v2_replacement_scan_set_callback
+    , Database.DuckDB.FFI.V2.c_duckdb_v2_replacement_scan_set_user_data
+    , Database.DuckDB.FFI.V2.c_duckdb_v2_replacement_scan_get_user_data
+    , Database.DuckDB.FFI.V2.c_duckdb_v2_replacement_scan_get_name
+    , Database.DuckDB.FFI.V2.c_duckdb_v2_replacement_scan_set_function_name
+    , Database.DuckDB.FFI.V2.c_duckdb_v2_replacement_scan_add_argument
+    , Database.DuckDB.FFI.V2.c_duckdb_v2_replacement_scan_add_named_argument
+    , Database.DuckDB.FFI.V2.c_duckdb_v2_replacement_scan_set_collection
+    , Database.DuckDB.FFI.V2.c_duckdb_v2_replacement_scan_set_subquery
+    , Database.DuckDB.FFI.V2.c_duckdb_v2_replacement_scan_set_alias
+    , Database.DuckDB.FFI.V2.c_duckdb_v2_connection_register_replacement_scan
+    , Database.DuckDB.FFI.V2.c_duckdb_v2_instance_register_replacement_scan
+    , Database.DuckDB.FFI.V2.c_duckdb_v2_extension_register_replacement_scan
+    , Database.DuckDB.FFI.V2.c_duckdb_v2_replacement_scan_destroy
+    , Database.DuckDB.FFI.V2.c_duckdb_v2_scalar_function_create
+    , Database.DuckDB.FFI.V2.c_duckdb_v2_scalar_function_set_name
+    , Database.DuckDB.FFI.V2.c_duckdb_v2_scalar_function_get_docs
+    , Database.DuckDB.FFI.V2.c_duckdb_v2_scalar_function_get_signature
+    , Database.DuckDB.FFI.V2.c_duckdb_v2_scalar_function_set_user_data
+    , Database.DuckDB.FFI.V2.c_duckdb_v2_scalar_function_set_property
+    , Database.DuckDB.FFI.V2.c_duckdb_v2_scalar_function_set_resolve_types_callback
+    , Database.DuckDB.FFI.V2.c_duckdb_v2_scalar_function_set_bind_callback
+    , Database.DuckDB.FFI.V2.c_duckdb_v2_scalar_function_set_init_callback
+    , Database.DuckDB.FFI.V2.c_duckdb_v2_scalar_function_set_exec_callback
+    , Database.DuckDB.FFI.V2.c_duckdb_v2_scalar_function_resolve_types_set_return_type
+    , Database.DuckDB.FFI.V2.c_duckdb_v2_scalar_function_bind_set_bind_data
+    , Database.DuckDB.FFI.V2.c_duckdb_v2_scalar_function_init_get_user_data
+    , Database.DuckDB.FFI.V2.c_duckdb_v2_scalar_function_init_get_bind_data
+    , Database.DuckDB.FFI.V2.c_duckdb_v2_scalar_function_init_set_init_data
+    , Database.DuckDB.FFI.V2.c_duckdb_v2_scalar_function_exec_get_user_data
+    , Database.DuckDB.FFI.V2.c_duckdb_v2_scalar_function_exec_get_bind_data
+    , Database.DuckDB.FFI.V2.c_duckdb_v2_scalar_function_exec_get_init_data
+    , Database.DuckDB.FFI.V2.c_duckdb_v2_scalar_function_exec_get_row_count
+    , Database.DuckDB.FFI.V2.c_duckdb_v2_scalar_function_exec_get_arg_count
+    , Database.DuckDB.FFI.V2.c_duckdb_v2_scalar_function_exec_get_arg
+    , Database.DuckDB.FFI.V2.c_duckdb_v2_scalar_function_exec_get_result
+    , Database.DuckDB.FFI.V2.c_duckdb_v2_connection_register_scalar_function
+    , Database.DuckDB.FFI.V2.c_duckdb_v2_extension_register_scalar_function
+    , Database.DuckDB.FFI.V2.c_duckdb_v2_scalar_function_destroy
+    , Database.DuckDB.FFI.V2.c_duckdb_v2_parse_sql
+    , Database.DuckDB.FFI.V2.c_duckdb_v2_statement_iterator_next
+    , Database.DuckDB.FFI.V2.c_duckdb_v2_statement_bind
+    , Database.DuckDB.FFI.V2.c_duckdb_v2_statement_add_collection
+    , Database.DuckDB.FFI.V2.c_duckdb_v2_sql_statement_get_type
+    , Database.DuckDB.FFI.V2.c_duckdb_v2_sql_statement_get_text
+    , Database.DuckDB.FFI.V2.c_duckdb_v2_sql_statement_get_parameter_count
+    , Database.DuckDB.FFI.V2.c_duckdb_v2_sql_statement_get_parameter_name
+    , Database.DuckDB.FFI.V2.c_duckdb_v2_sql_statement_destroy
+    , Database.DuckDB.FFI.V2.c_duckdb_v2_statement_iterator_destroy
+    , Database.DuckDB.FFI.V2.c_duckdb_v2_vector_get_vector_type
+    , Database.DuckDB.FFI.V2.c_duckdb_v2_vector_get_logical_type
+    , Database.DuckDB.FFI.V2.c_duckdb_v2_vector_get_view
+    , Database.DuckDB.FFI.V2.c_duckdb_v2_vector_get_size
+    , Database.DuckDB.FFI.V2.c_duckdb_v2_vector_set_size
+    , Database.DuckDB.FFI.V2.c_duckdb_v2_vector_get_value
+    , Database.DuckDB.FFI.V2.c_duckdb_v2_vector_set_value
+    , Database.DuckDB.FFI.V2.c_duckdb_v2_vector_get_data_mutable
+    , Database.DuckDB.FFI.V2.c_duckdb_v2_vector_flatten
+    , Database.DuckDB.FFI.V2.c_duckdb_v2_vector_cast
+    , Database.DuckDB.FFI.V2.c_duckdb_v2_vector_reference
+    , Database.DuckDB.FFI.V2.c_duckdb_v2_vector_make_constant
+    , Database.DuckDB.FFI.V2.c_duckdb_v2_vector_make_sequence
+    , Database.DuckDB.FFI.V2.c_duckdb_v2_vector_set_null
+    , Database.DuckDB.FFI.V2.c_duckdb_v2_vector_flat_get_validity_mutable
+    , Database.DuckDB.FFI.V2.c_duckdb_v2_vector_constant_set_valid
+    , Database.DuckDB.FFI.V2.c_duckdb_v2_vector_get_arena
+    , Database.DuckDB.FFI.V2.c_duckdb_v2_vector_get_child_count
+    , Database.DuckDB.FFI.V2.c_duckdb_v2_vector_get_child
+    , Database.DuckDB.FFI.V2.c_duckdb_v2_bignum_decode
+    , Database.DuckDB.FFI.V2.c_duckdb_v2_bignum_encode
+    , Database.DuckDB.FFI.V2.c_duckdb_v2_validate_utf8
+    , Database.DuckDB.FFI.V2.c_duckdb_v2_prepared_statement_create
+    , Database.DuckDB.FFI.V2.c_duckdb_v2_prepared_statement_execute
+    , Database.DuckDB.FFI.V2.c_duckdb_v2_prepared_statement_reuses_plan
+    , Database.DuckDB.FFI.V2.c_duckdb_v2_prepared_statement_destroy
+    , Database.DuckDB.FFI.V2.c_duckdb_v2_statement_execute
+    , Database.DuckDB.FFI.V2.c_duckdb_v2_result_destroy
+    , Database.DuckDB.FFI.V2.c_duckdb_v2_result_step
+    , Database.DuckDB.FFI.V2.c_duckdb_v2_result_fetch_chunk
+    , Database.DuckDB.FFI.V2.c_duckdb_v2_result_wait
+    , Database.DuckDB.FFI.V2.c_duckdb_v2_result_render_box
+    , Database.DuckDB.FFI.V2.c_duckdb_v2_result_drain
+    , Database.DuckDB.FFI.V2.c_duckdb_v2_result_get_result_type
+    , Database.DuckDB.FFI.V2.c_duckdb_v2_result_get_statement_type
+    , Database.DuckDB.FFI.V2.c_duckdb_v2_result_get_schema
+    , Database.DuckDB.FFI.V2.c_duckdb_v2_table_function_create
+    , Database.DuckDB.FFI.V2.c_duckdb_v2_table_function_set_name
+    , Database.DuckDB.FFI.V2.c_duckdb_v2_table_function_get_docs
+    , Database.DuckDB.FFI.V2.c_duckdb_v2_table_function_get_signature
+    , Database.DuckDB.FFI.V2.c_duckdb_v2_table_function_set_user_data
+    , Database.DuckDB.FFI.V2.c_duckdb_v2_table_function_set_bind_callback
+    , Database.DuckDB.FFI.V2.c_duckdb_v2_table_function_set_init_global_callback
+    , Database.DuckDB.FFI.V2.c_duckdb_v2_table_function_set_init_local_callback
+    , Database.DuckDB.FFI.V2.c_duckdb_v2_table_function_set_exec_callback
+    , Database.DuckDB.FFI.V2.c_duckdb_v2_table_function_set_progress_callback
+    , Database.DuckDB.FFI.V2.c_duckdb_v2_table_function_set_projection_pushdown
+    , Database.DuckDB.FFI.V2.c_duckdb_v2_table_function_set_filter_pushdown_callback
+    , Database.DuckDB.FFI.V2.c_duckdb_v2_table_function_set_partition_data_callback
+    , Database.DuckDB.FFI.V2.c_duckdb_v2_table_function_set_partitioning_callback
+    , Database.DuckDB.FFI.V2.c_duckdb_v2_table_function_bind_add_result_column
+    , Database.DuckDB.FFI.V2.c_duckdb_v2_table_function_bind_set_cardinality
+    , Database.DuckDB.FFI.V2.c_duckdb_v2_table_function_bind_set_order_preservation
+    , Database.DuckDB.FFI.V2.c_duckdb_v2_table_function_init_global_get_user_data
+    , Database.DuckDB.FFI.V2.c_duckdb_v2_table_function_init_global_get_bind_data
+    , Database.DuckDB.FFI.V2.c_duckdb_v2_table_function_init_global_set_global_state
+    , Database.DuckDB.FFI.V2.c_duckdb_v2_table_function_init_global_set_max_threads
+    , Database.DuckDB.FFI.V2.c_duckdb_v2_table_function_init_global_get_column_count
+    , Database.DuckDB.FFI.V2.c_duckdb_v2_table_function_init_global_get_column_index
+    , Database.DuckDB.FFI.V2.c_duckdb_v2_table_function_init_local_get_user_data
+    , Database.DuckDB.FFI.V2.c_duckdb_v2_table_function_init_local_get_bind_data
+    , Database.DuckDB.FFI.V2.c_duckdb_v2_table_function_init_local_get_global_state
+    , Database.DuckDB.FFI.V2.c_duckdb_v2_table_function_init_local_set_local_state
+    , Database.DuckDB.FFI.V2.c_duckdb_v2_table_function_init_local_get_column_count
+    , Database.DuckDB.FFI.V2.c_duckdb_v2_table_function_init_local_get_column_index
+    , Database.DuckDB.FFI.V2.c_duckdb_v2_table_function_exec_get_user_data
+    , Database.DuckDB.FFI.V2.c_duckdb_v2_table_function_exec_get_bind_data
+    , Database.DuckDB.FFI.V2.c_duckdb_v2_table_function_exec_get_global_state
+    , Database.DuckDB.FFI.V2.c_duckdb_v2_table_function_exec_get_local_state
+    , Database.DuckDB.FFI.V2.c_duckdb_v2_table_function_exec_get_output_chunk
+    , Database.DuckDB.FFI.V2.c_duckdb_v2_table_function_exec_get_column_count
+    , Database.DuckDB.FFI.V2.c_duckdb_v2_table_function_exec_get_column_index
+    , Database.DuckDB.FFI.V2.c_duckdb_v2_table_function_progress_get_user_data
+    , Database.DuckDB.FFI.V2.c_duckdb_v2_table_function_progress_get_bind_data
+    , Database.DuckDB.FFI.V2.c_duckdb_v2_table_function_progress_get_global_state
+    , Database.DuckDB.FFI.V2.c_duckdb_v2_table_function_progress_set_progress
+    , Database.DuckDB.FFI.V2.c_duckdb_v2_table_function_filter_pushdown_get_user_data
+    , Database.DuckDB.FFI.V2.c_duckdb_v2_table_function_filter_pushdown_get_bind_data
+    , Database.DuckDB.FFI.V2.c_duckdb_v2_table_function_filter_pushdown_get_filter_count
+    , Database.DuckDB.FFI.V2.c_duckdb_v2_table_function_filter_pushdown_get_filter
+    , Database.DuckDB.FFI.V2.c_duckdb_v2_table_function_filter_pushdown_accept
+    , Database.DuckDB.FFI.V2.c_duckdb_v2_table_function_filter_pushdown_get_column_count
+    , Database.DuckDB.FFI.V2.c_duckdb_v2_table_function_filter_pushdown_get_column_index
+    , Database.DuckDB.FFI.V2.c_duckdb_v2_table_function_partition_data_get_user_data
+    , Database.DuckDB.FFI.V2.c_duckdb_v2_table_function_partition_data_get_bind_data
+    , Database.DuckDB.FFI.V2.c_duckdb_v2_table_function_partition_data_get_global_state
+    , Database.DuckDB.FFI.V2.c_duckdb_v2_table_function_partition_data_get_local_state
+    , Database.DuckDB.FFI.V2.c_duckdb_v2_table_function_partition_data_requires_batch_index
+    , Database.DuckDB.FFI.V2.c_duckdb_v2_table_function_partition_data_requires_partition_columns
+    , Database.DuckDB.FFI.V2.c_duckdb_v2_table_function_partition_data_get_partition_column_count
+    , Database.DuckDB.FFI.V2.c_duckdb_v2_table_function_partition_data_get_partition_column_index
+    , Database.DuckDB.FFI.V2.c_duckdb_v2_table_function_partition_data_set_batch_index
+    , Database.DuckDB.FFI.V2.c_duckdb_v2_table_function_partition_data_set_partition_value
+    , Database.DuckDB.FFI.V2.c_duckdb_v2_table_function_partitioning_get_user_data
+    , Database.DuckDB.FFI.V2.c_duckdb_v2_table_function_partitioning_get_bind_data
+    , Database.DuckDB.FFI.V2.c_duckdb_v2_table_function_partitioning_get_partition_column_count
+    , Database.DuckDB.FFI.V2.c_duckdb_v2_table_function_partitioning_get_partition_column_index
+    , Database.DuckDB.FFI.V2.c_duckdb_v2_table_function_partitioning_set_partition_info
+    , Database.DuckDB.FFI.V2.c_duckdb_v2_connection_register_table_function
+    , Database.DuckDB.FFI.V2.c_duckdb_v2_extension_register_table_function
+    , Database.DuckDB.FFI.V2.c_duckdb_v2_table_function_destroy
+    , Database.DuckDB.FFI.V2.c_duckdb_v2_table_function_set_claim_batch_callback
+    , Database.DuckDB.FFI.V2.c_duckdb_v2_table_function_claim_batch_get_user_data
+    , Database.DuckDB.FFI.V2.c_duckdb_v2_table_function_claim_batch_get_bind_data
+    , Database.DuckDB.FFI.V2.c_duckdb_v2_table_function_claim_batch_get_global_state
+    , Database.DuckDB.FFI.V2.c_duckdb_v2_table_function_claim_batch_get_local_state
+    , Database.DuckDB.FFI.V2.c_duckdb_v2_table_function_claim_batch_set_claimed
+    , Database.DuckDB.FFI.V2.c_duckdb_v2_table_function_set_get_bind_info_callback
+    , Database.DuckDB.FFI.V2.c_duckdb_v2_table_function_get_bind_info_get_user_data
+    , Database.DuckDB.FFI.V2.c_duckdb_v2_table_function_get_bind_info_get_bind_data
+    , Database.DuckDB.FFI.V2.c_duckdb_v2_table_function_get_bind_info_set_column_identifier
+    , Database.DuckDB.FFI.V2.c_duckdb_v2_table_function_get_bind_info_set_option
+    , Database.DuckDB.FFI.V2.c_duckdb_v2_multi_file_function_create
+    , Database.DuckDB.FFI.V2.c_duckdb_v2_multi_file_function_set_name
+    , Database.DuckDB.FFI.V2.c_duckdb_v2_multi_file_function_set_single_file_function
+    , Database.DuckDB.FFI.V2.c_duckdb_v2_multi_file_function_set_reader_type
+    , Database.DuckDB.FFI.V2.c_duckdb_v2_multi_file_function_set_file_extension
+    , Database.DuckDB.FFI.V2.c_duckdb_v2_connection_register_multi_file_function
+    , Database.DuckDB.FFI.V2.c_duckdb_v2_extension_register_multi_file_function
+    , Database.DuckDB.FFI.V2.c_duckdb_v2_multi_file_function_destroy
+    , Database.DuckDB.FFI.V2.c_duckdb_v2_value_destroy
+    , Database.DuckDB.FFI.V2.c_duckdb_v2_value_get_bool
+    , Database.DuckDB.FFI.V2.c_duckdb_v2_value_get_utinyint
+    , Database.DuckDB.FFI.V2.c_duckdb_v2_value_get_usmallint
+    , Database.DuckDB.FFI.V2.c_duckdb_v2_value_get_uint
+    , Database.DuckDB.FFI.V2.c_duckdb_v2_value_get_ubigint
+    , Database.DuckDB.FFI.V2.c_duckdb_v2_value_get_uhugeint
+    , Database.DuckDB.FFI.V2.c_duckdb_v2_value_get_tinyint
+    , Database.DuckDB.FFI.V2.c_duckdb_v2_value_get_smallint
+    , Database.DuckDB.FFI.V2.c_duckdb_v2_value_get_int
+    , Database.DuckDB.FFI.V2.c_duckdb_v2_value_get_bigint
+    , Database.DuckDB.FFI.V2.c_duckdb_v2_value_get_hugeint
+    , Database.DuckDB.FFI.V2.c_duckdb_v2_value_get_varchar
+    , Database.DuckDB.FFI.V2.c_duckdb_v2_value_get_blob
+    , Database.DuckDB.FFI.V2.c_duckdb_v2_value_get_float
+    , Database.DuckDB.FFI.V2.c_duckdb_v2_value_get_double
+    , Database.DuckDB.FFI.V2.c_duckdb_v2_value_get_date
+    , Database.DuckDB.FFI.V2.c_duckdb_v2_value_get_time
+    , Database.DuckDB.FFI.V2.c_duckdb_v2_value_get_time_ns
+    , Database.DuckDB.FFI.V2.c_duckdb_v2_value_get_time_tz
+    , Database.DuckDB.FFI.V2.c_duckdb_v2_value_get_timestamp
+    , Database.DuckDB.FFI.V2.c_duckdb_v2_value_get_timestamp_sec
+    , Database.DuckDB.FFI.V2.c_duckdb_v2_value_get_timestamp_ms
+    , Database.DuckDB.FFI.V2.c_duckdb_v2_value_get_timestamp_ns
+    , Database.DuckDB.FFI.V2.c_duckdb_v2_value_get_timestamp_tz
+    , Database.DuckDB.FFI.V2.c_duckdb_v2_value_get_timestamp_tz_ns
+    , Database.DuckDB.FFI.V2.c_duckdb_v2_value_get_interval
+    , Database.DuckDB.FFI.V2.c_duckdb_v2_value_get_uuid
+    , Database.DuckDB.FFI.V2.c_duckdb_v2_value_get_decimal
+    , Database.DuckDB.FFI.V2.c_duckdb_v2_value_get_type
+    , Database.DuckDB.FFI.V2.c_duckdb_v2_value_create_null
+    , Database.DuckDB.FFI.V2.c_duckdb_v2_value_create_bool
+    , Database.DuckDB.FFI.V2.c_duckdb_v2_value_create_utinyint
+    , Database.DuckDB.FFI.V2.c_duckdb_v2_value_create_usmallint
+    , Database.DuckDB.FFI.V2.c_duckdb_v2_value_create_uint
+    , Database.DuckDB.FFI.V2.c_duckdb_v2_value_create_ubigint
+    , Database.DuckDB.FFI.V2.c_duckdb_v2_value_create_uhugeint
+    , Database.DuckDB.FFI.V2.c_duckdb_v2_value_create_tinyint
+    , Database.DuckDB.FFI.V2.c_duckdb_v2_value_create_smallint
+    , Database.DuckDB.FFI.V2.c_duckdb_v2_value_create_int
+    , Database.DuckDB.FFI.V2.c_duckdb_v2_value_create_bigint
+    , Database.DuckDB.FFI.V2.c_duckdb_v2_value_create_hugeint
+    , Database.DuckDB.FFI.V2.c_duckdb_v2_value_create_varchar
+    , Database.DuckDB.FFI.V2.c_duckdb_v2_value_create_blob
+    , Database.DuckDB.FFI.V2.c_duckdb_v2_value_create_float
+    , Database.DuckDB.FFI.V2.c_duckdb_v2_value_create_double
+    , Database.DuckDB.FFI.V2.c_duckdb_v2_value_create_type
+    , Database.DuckDB.FFI.V2.c_duckdb_v2_value_create_date
+    , Database.DuckDB.FFI.V2.c_duckdb_v2_value_create_time
+    , Database.DuckDB.FFI.V2.c_duckdb_v2_value_create_time_ns
+    , Database.DuckDB.FFI.V2.c_duckdb_v2_value_create_time_tz
+    , Database.DuckDB.FFI.V2.c_duckdb_v2_value_create_timestamp
+    , Database.DuckDB.FFI.V2.c_duckdb_v2_value_create_timestamp_sec
+    , Database.DuckDB.FFI.V2.c_duckdb_v2_value_create_timestamp_ms
+    , Database.DuckDB.FFI.V2.c_duckdb_v2_value_create_timestamp_ns
+    , Database.DuckDB.FFI.V2.c_duckdb_v2_value_create_timestamp_tz
+    , Database.DuckDB.FFI.V2.c_duckdb_v2_value_create_timestamp_tz_ns
+    , Database.DuckDB.FFI.V2.c_duckdb_v2_value_create_interval
+    , Database.DuckDB.FFI.V2.c_duckdb_v2_value_create_decimal
+    , Database.DuckDB.FFI.V2.c_duckdb_v2_value_create_uuid
+    , Database.DuckDB.FFI.V2.c_duckdb_v2_value_create_bit
+    , Database.DuckDB.FFI.V2.c_duckdb_v2_value_create_bignum
+    , Database.DuckDB.FFI.V2.c_duckdb_v2_value_create_list
+    , Database.DuckDB.FFI.V2.c_duckdb_v2_value_create_array
+    , Database.DuckDB.FFI.V2.c_duckdb_v2_value_create_struct
+    , Database.DuckDB.FFI.V2.c_duckdb_v2_value_create_tuple
+    , Database.DuckDB.FFI.V2.c_duckdb_v2_value_create_map
+    , Database.DuckDB.FFI.V2.c_duckdb_v2_value_get_child_count
+    , Database.DuckDB.FFI.V2.c_duckdb_v2_value_get_child
+    , Database.DuckDB.FFI.V2.c_duckdb_v2_value_cast
+    , Database.DuckDB.FFI.V2.c_duckdb_v2_value_is_null
+    , Database.DuckDB.FFI.V2.c_duckdb_v2_value_get_logical_type
+    , Database.DuckDB.FFI.V2.c_duckdb_v2_value_to_string
+    , Database.DuckDB.FFI.V2.c_duckdb_v2_arrow_importer_create
+    , Database.DuckDB.FFI.V2.c_duckdb_v2_arrow_importer_get_schema
+    , Database.DuckDB.FFI.V2.c_duckdb_v2_arrow_importer_append
+    , Database.DuckDB.FFI.V2.c_duckdb_v2_arrow_importer_next_chunk
+    , Database.DuckDB.FFI.V2.c_duckdb_v2_arrow_importer_destroy
+    , Database.DuckDB.FFI.V2.c_duckdb_v2_arrow_exporter_create
+    , Database.DuckDB.FFI.V2.c_duckdb_v2_arrow_exporter_get_schema
+    , Database.DuckDB.FFI.V2.c_duckdb_v2_arrow_exporter_append
+    , Database.DuckDB.FFI.V2.c_duckdb_v2_arrow_exporter_next_array
+    , Database.DuckDB.FFI.V2.c_duckdb_v2_arrow_exporter_destroy
+    , Database.DuckDB.FFI.V2.c_duckdb_v2_statement_execute_arrow
+    , Database.DuckDB.FFI.V2.c_duckdb_v2_prepared_statement_execute_arrow
+    , Database.DuckDB.FFI.V2.c_duckdb_v2_arrow_result_destroy
+    , Database.DuckDB.FFI.V2.c_duckdb_v2_arrow_result_step
+    , Database.DuckDB.FFI.V2.c_duckdb_v2_arrow_result_fetch_array
+    , Database.DuckDB.FFI.V2.c_duckdb_v2_arrow_result_wait
+    , Database.DuckDB.FFI.V2.c_duckdb_v2_arrow_result_drain
+    , Database.DuckDB.FFI.V2.c_duckdb_v2_arrow_result_get_result_type
+    , Database.DuckDB.FFI.V2.c_duckdb_v2_arrow_result_get_statement_type
+    , Database.DuckDB.FFI.V2.c_duckdb_v2_arrow_result_get_schema
+    , Database.DuckDB.FFI.V2.c_duckdb_v2_arrow_result_to_arrow_c_stream
+    )
+  where
+
+import qualified HsBindgen.Runtime.CEnum as CEnum
+import qualified HsBindgen.Runtime.ConstantArray as CA
+import qualified HsBindgen.Runtime.HasCField as HasCField
+import qualified HsBindgen.Runtime.LibC
+import qualified HsBindgen.Runtime.Marshal as Marshal
+import qualified HsBindgen.Runtime.PtrConst as PtrConst
+import qualified HsBindgen.Runtime.Struct as Struct
+import qualified HsBindgen.Runtime.Support as BG
+import qualified HsBindgen.Runtime.Support.CAPI
+import qualified HsBindgen.Runtime.Support.CompatHasField as BG.CompatHasField
+import qualified HsBindgen.Runtime.Union as Union
+import Prelude ((<*>), (>>), Bounded, Enum, Eq, IO, Int, Integral, Num, Ord, Read, Real, Show, fmap, pure, type (~))
+
+$(HsBindgen.Runtime.Support.CAPI.addCSource (HsBindgen.Runtime.Support.CAPI.unlines
+  [ "#define DUCKDB_V2_API_ALLOW_UNSTABLE 1"
+  , "#include <duckdb_v2.h>"
+  , "DUCKDB_V2_ERROR hs_bindgen_63694dde75fd6125 ("
+  , "  duckdb_v2_arena_handle arg1,"
+  , "  idx_t arg2,"
+  , "  uint8_t **arg3,"
+  , "  duckdb_v2_error_info_handle *arg4"
+  , ")"
+  , "{"
+  , "  return (duckdb_v2_arena_allocate)(arg1, arg2, arg3, arg4);"
+  , "}"
+  , "DUCKDB_V2_ERROR hs_bindgen_3d4e1db409416097 ("
+  , "  duckdb_v2_factory_handle arg1,"
+  , "  duckdb_v2_cast_function_handle *arg2,"
+  , "  duckdb_v2_error_info_handle *arg3"
+  , ")"
+  , "{"
+  , "  return (duckdb_v2_cast_function_create)(arg1, arg2, arg3);"
+  , "}"
+  , "DUCKDB_V2_ERROR hs_bindgen_ef73622b5f1da9e9 ("
+  , "  duckdb_v2_cast_function_handle arg1,"
+  , "  duckdb_v2_logical_type_handle arg2,"
+  , "  duckdb_v2_error_info_handle *arg3"
+  , ")"
+  , "{"
+  , "  return (duckdb_v2_cast_function_set_source_type)(arg1, arg2, arg3);"
+  , "}"
+  , "DUCKDB_V2_ERROR hs_bindgen_a81debc94fb37b8b ("
+  , "  duckdb_v2_cast_function_handle arg1,"
+  , "  duckdb_v2_logical_type_handle arg2,"
+  , "  duckdb_v2_error_info_handle *arg3"
+  , ")"
+  , "{"
+  , "  return (duckdb_v2_cast_function_set_target_type)(arg1, arg2, arg3);"
+  , "}"
+  , "DUCKDB_V2_ERROR hs_bindgen_a255b48c2a58cca5 ("
+  , "  duckdb_v2_cast_function_handle arg1,"
+  , "  int64_t arg2,"
+  , "  duckdb_v2_error_info_handle *arg3"
+  , ")"
+  , "{"
+  , "  return (duckdb_v2_cast_function_set_implicit_cast_cost)(arg1, arg2, arg3);"
+  , "}"
+  , "DUCKDB_V2_ERROR hs_bindgen_b70e7a978df773c1 ("
+  , "  duckdb_v2_cast_function_handle arg1,"
+  , "  duckdb_v2_opaque *arg2,"
+  , "  duckdb_v2_error_info_handle *arg3"
+  , ")"
+  , "{"
+  , "  return (duckdb_v2_cast_function_set_user_data)(arg1, arg2, arg3);"
+  , "}"
+  , "DUCKDB_V2_ERROR hs_bindgen_44dae14ea099d32d ("
+  , "  duckdb_v2_cast_function_handle arg1,"
+  , "  duckdb_v2_cast_function_exec_callback_fn arg2,"
+  , "  duckdb_v2_error_info_handle *arg3"
+  , ")"
+  , "{"
+  , "  return (duckdb_v2_cast_function_set_exec_callback)(arg1, arg2, arg3);"
+  , "}"
+  , "DUCKDB_V2_ERROR hs_bindgen_9cf9b198c77fb382 ("
+  , "  duckdb_v2_cast_function_exec_info_handle arg1,"
+  , "  void **arg2,"
+  , "  duckdb_v2_error_info_handle *arg3"
+  , ")"
+  , "{"
+  , "  return (duckdb_v2_cast_function_exec_get_user_data)(arg1, arg2, arg3);"
+  , "}"
+  , "DUCKDB_V2_ERROR hs_bindgen_279208830299f25a ("
+  , "  duckdb_v2_cast_function_exec_info_handle arg1,"
+  , "  idx_t *arg2,"
+  , "  duckdb_v2_error_info_handle *arg3"
+  , ")"
+  , "{"
+  , "  return (duckdb_v2_cast_function_exec_get_row_count)(arg1, arg2, arg3);"
+  , "}"
+  , "DUCKDB_V2_ERROR hs_bindgen_6777f89c9eb28fad ("
+  , "  duckdb_v2_cast_function_exec_info_handle arg1,"
+  , "  duckdb_v2_vector_handle *arg2,"
+  , "  duckdb_v2_error_info_handle *arg3"
+  , ")"
+  , "{"
+  , "  return (duckdb_v2_cast_function_exec_get_input)(arg1, arg2, arg3);"
+  , "}"
+  , "DUCKDB_V2_ERROR hs_bindgen_c813b8f41a0b4a94 ("
+  , "  duckdb_v2_cast_function_exec_info_handle arg1,"
+  , "  duckdb_v2_vector_handle *arg2,"
+  , "  duckdb_v2_error_info_handle *arg3"
+  , ")"
+  , "{"
+  , "  return (duckdb_v2_cast_function_exec_get_output)(arg1, arg2, arg3);"
+  , "}"
+  , "DUCKDB_V2_ERROR hs_bindgen_173673f14fe58fb6 ("
+  , "  duckdb_v2_cast_function_exec_info_handle arg1,"
+  , "  DUCKDB_V2_CAST_MODE *arg2,"
+  , "  duckdb_v2_error_info_handle *arg3"
+  , ")"
+  , "{"
+  , "  return (duckdb_v2_cast_function_exec_get_mode)(arg1, arg2, arg3);"
+  , "}"
+  , "DUCKDB_V2_ERROR hs_bindgen_927aa67d3f20cee9 ("
+  , "  duckdb_v2_connection_handle arg1,"
+  , "  duckdb_v2_cast_function_handle arg2,"
+  , "  duckdb_v2_error_info_handle *arg3"
+  , ")"
+  , "{"
+  , "  return (duckdb_v2_connection_register_cast_function)(arg1, arg2, arg3);"
+  , "}"
+  , "DUCKDB_V2_ERROR hs_bindgen_04f61415af74e3e3 ("
+  , "  duckdb_v2_extension_handle arg1,"
+  , "  duckdb_v2_cast_function_handle arg2,"
+  , "  duckdb_v2_error_info_handle *arg3"
+  , ")"
+  , "{"
+  , "  return (duckdb_v2_extension_register_cast_function)(arg1, arg2, arg3);"
+  , "}"
+  , "DUCKDB_V2_ERROR hs_bindgen_69e261c2f46b4edf ("
+  , "  duckdb_v2_cast_function_handle *arg1"
+  , ")"
+  , "{"
+  , "  return (duckdb_v2_cast_function_destroy)(arg1);"
+  , "}"
+  , "DUCKDB_V2_ERROR hs_bindgen_9dff60a24ffcda2e ("
+  , "  duckdb_v2_factory_handle arg1,"
+  , "  duckdb_v2_logical_type_handle const *arg2,"
+  , "  idx_t arg3,"
+  , "  duckdb_v2_column_data_collection_handle *arg4,"
+  , "  duckdb_v2_error_info_handle *arg5"
+  , ")"
+  , "{"
+  , "  return (duckdb_v2_column_data_collection_create)(arg1, arg2, arg3, arg4, arg5);"
+  , "}"
+  , "DUCKDB_V2_ERROR hs_bindgen_b23786ec4d650b95 ("
+  , "  duckdb_v2_column_data_collection_handle arg1,"
+  , "  duckdb_v2_error_info_handle *arg2"
+  , ")"
+  , "{"
+  , "  return (duckdb_v2_column_data_collection_reset)(arg1, arg2);"
+  , "}"
+  , "DUCKDB_V2_ERROR hs_bindgen_94c5d7956298e53b ("
+  , "  duckdb_v2_column_data_collection_handle arg1,"
+  , "  duckdb_v2_error_info_handle *arg2"
+  , ")"
+  , "{"
+  , "  return (duckdb_v2_column_data_collection_clear)(arg1, arg2);"
+  , "}"
+  , "DUCKDB_V2_ERROR hs_bindgen_912fbeaadf6e2a67 ("
+  , "  duckdb_v2_column_data_collection_handle *arg1"
+  , ")"
+  , "{"
+  , "  return (duckdb_v2_column_data_collection_destroy)(arg1);"
+  , "}"
+  , "DUCKDB_V2_ERROR hs_bindgen_5c277886da5b0688 ("
+  , "  duckdb_v2_column_data_collection_handle arg1,"
+  , "  duckdb_v2_column_data_collection_handle *arg2,"
+  , "  duckdb_v2_error_info_handle *arg3"
+  , ")"
+  , "{"
+  , "  return (duckdb_v2_column_data_collection_combine)(arg1, arg2, arg3);"
+  , "}"
+  , "DUCKDB_V2_ERROR hs_bindgen_913dd376ea4c0bd9 ("
+  , "  duckdb_v2_column_data_collection_handle arg1,"
+  , "  idx_t *arg2,"
+  , "  duckdb_v2_error_info_handle *arg3"
+  , ")"
+  , "{"
+  , "  return (duckdb_v2_column_data_collection_row_count)(arg1, arg2, arg3);"
+  , "}"
+  , "DUCKDB_V2_ERROR hs_bindgen_7da52d05e210451c ("
+  , "  duckdb_v2_column_data_collection_handle arg1,"
+  , "  duckdb_v2_column_data_collection_append_state_handle *arg2,"
+  , "  duckdb_v2_error_info_handle *arg3"
+  , ")"
+  , "{"
+  , "  return (duckdb_v2_column_data_collection_append_state_create)(arg1, arg2, arg3);"
+  , "}"
+  , "DUCKDB_V2_ERROR hs_bindgen_92fd22e162f14e28 ("
+  , "  duckdb_v2_column_data_collection_append_state_handle *arg1"
+  , ")"
+  , "{"
+  , "  return (duckdb_v2_column_data_collection_append_state_destroy)(arg1);"
+  , "}"
+  , "DUCKDB_V2_ERROR hs_bindgen_c49da7ea0206b365 ("
+  , "  duckdb_v2_column_data_collection_handle arg1,"
+  , "  duckdb_v2_column_data_collection_append_state_handle arg2,"
+  , "  duckdb_v2_data_chunk_handle arg3,"
+  , "  duckdb_v2_error_info_handle *arg4"
+  , ")"
+  , "{"
+  , "  return (duckdb_v2_column_data_collection_append)(arg1, arg2, arg3, arg4);"
+  , "}"
+  , "DUCKDB_V2_ERROR hs_bindgen_25fe9c136516c087 ("
+  , "  duckdb_v2_column_data_collection_handle arg1,"
+  , "  duckdb_v2_column_data_collection_shared_scan_state_handle *arg2,"
+  , "  duckdb_v2_error_info_handle *arg3"
+  , ")"
+  , "{"
+  , "  return (duckdb_v2_column_data_collection_shared_scan_state_create)(arg1, arg2, arg3);"
+  , "}"
+  , "DUCKDB_V2_ERROR hs_bindgen_afbd72ed03626d52 ("
+  , "  duckdb_v2_column_data_collection_shared_scan_state_handle *arg1"
+  , ")"
+  , "{"
+  , "  return (duckdb_v2_column_data_collection_shared_scan_state_destroy)(arg1);"
+  , "}"
+  , "DUCKDB_V2_ERROR hs_bindgen_376c5d23518529f4 ("
+  , "  duckdb_v2_column_data_collection_handle arg1,"
+  , "  duckdb_v2_column_data_collection_worker_scan_state_handle *arg2,"
+  , "  duckdb_v2_error_info_handle *arg3"
+  , ")"
+  , "{"
+  , "  return (duckdb_v2_column_data_collection_worker_scan_state_create)(arg1, arg2, arg3);"
+  , "}"
+  , "DUCKDB_V2_ERROR hs_bindgen_1a6611ac76d4f30b ("
+  , "  duckdb_v2_column_data_collection_worker_scan_state_handle *arg1"
+  , ")"
+  , "{"
+  , "  return (duckdb_v2_column_data_collection_worker_scan_state_destroy)(arg1);"
+  , "}"
+  , "DUCKDB_V2_ERROR hs_bindgen_17f3458526cb44e4 ("
+  , "  duckdb_v2_column_data_collection_handle arg1,"
+  , "  duckdb_v2_column_data_collection_shared_scan_state_handle arg2,"
+  , "  duckdb_v2_column_data_collection_worker_scan_state_handle arg3,"
+  , "  duckdb_v2_data_chunk_handle arg4,"
+  , "  _Bool *arg5,"
+  , "  duckdb_v2_error_info_handle *arg6"
+  , ")"
+  , "{"
+  , "  return (duckdb_v2_column_data_collection_scan)(arg1, arg2, arg3, arg4, arg5, arg6);"
+  , "}"
+  , "DUCKDB_V2_ERROR hs_bindgen_4beee4f040cabb60 ("
+  , "  duckdb_v2_instance_handle arg1,"
+  , "  duckdb_v2_config_handle *arg2,"
+  , "  duckdb_v2_error_info_handle *arg3"
+  , ")"
+  , "{"
+  , "  return (duckdb_v2_instance_get_config)(arg1, arg2, arg3);"
+  , "}"
+  , "DUCKDB_V2_ERROR hs_bindgen_e72eac585a1c21ee ("
+  , "  duckdb_v2_connection_handle arg1,"
+  , "  duckdb_v2_config_handle *arg2,"
+  , "  duckdb_v2_error_info_handle *arg3"
+  , ")"
+  , "{"
+  , "  return (duckdb_v2_connection_get_config)(arg1, arg2, arg3);"
+  , "}"
+  , "DUCKDB_V2_ERROR hs_bindgen_9ad8ab4a89c46a58 ("
+  , "  duckdb_v2_context_handle arg1,"
+  , "  duckdb_v2_config_handle *arg2,"
+  , "  duckdb_v2_error_info_handle *arg3"
+  , ")"
+  , "{"
+  , "  return (duckdb_v2_context_get_config)(arg1, arg2, arg3);"
+  , "}"
+  , "DUCKDB_V2_ERROR hs_bindgen_27fbc60cf4891fdc ("
+  , "  duckdb_v2_config_handle arg1,"
+  , "  duckdb_v2_identifier_t const *arg2,"
+  , "  duckdb_v2_value_handle *arg3,"
+  , "  DUCKDB_V2_SETTING_SCOPE *arg4,"
+  , "  duckdb_v2_error_info_handle *arg5"
+  , ")"
+  , "{"
+  , "  return (duckdb_v2_config_get_option_value)(arg1, arg2, arg3, arg4, arg5);"
+  , "}"
+  , "DUCKDB_V2_ERROR hs_bindgen_1f2e16826680e38c ("
+  , "  duckdb_v2_config_handle arg1,"
+  , "  duckdb_v2_identifier_t const *arg2,"
+  , "  duckdb_v2_value_handle arg3,"
+  , "  DUCKDB_V2_SETTING_SCOPE arg4,"
+  , "  duckdb_v2_error_info_handle *arg5"
+  , ")"
+  , "{"
+  , "  return (duckdb_v2_config_set_option_value)(arg1, arg2, arg3, arg4, arg5);"
+  , "}"
+  , "DUCKDB_V2_ERROR hs_bindgen_89af9327ea2ff7ac ("
+  , "  duckdb_v2_config_handle arg1,"
+  , "  duckdb_v2_identifier_t const *arg2,"
+  , "  duckdb_v2_str const *arg3,"
+  , "  DUCKDB_V2_SETTING_SCOPE arg4,"
+  , "  duckdb_v2_error_info_handle *arg5"
+  , ")"
+  , "{"
+  , "  return (duckdb_v2_config_set_option_text)(arg1, arg2, arg3, arg4, arg5);"
+  , "}"
+  , "DUCKDB_V2_ERROR hs_bindgen_c7038af6a6f91b7a ("
+  , "  duckdb_v2_config_handle arg1,"
+  , "  duckdb_v2_identifier_t const *arg2,"
+  , "  duckdb_v2_option_handle *arg3,"
+  , "  duckdb_v2_error_info_handle *arg4"
+  , ")"
+  , "{"
+  , "  return (duckdb_v2_config_get_option_by_name)(arg1, arg2, arg3, arg4);"
+  , "}"
+  , "DUCKDB_V2_ERROR hs_bindgen_bd34112ea81d094b ("
+  , "  duckdb_v2_config_handle arg1,"
+  , "  idx_t *arg2,"
+  , "  duckdb_v2_error_info_handle *arg3"
+  , ")"
+  , "{"
+  , "  return (duckdb_v2_config_get_option_count)(arg1, arg2, arg3);"
+  , "}"
+  , "DUCKDB_V2_ERROR hs_bindgen_9a89021a895213c4 ("
+  , "  duckdb_v2_config_handle arg1,"
+  , "  idx_t arg2,"
+  , "  duckdb_v2_option_handle *arg3,"
+  , "  duckdb_v2_error_info_handle *arg4"
+  , ")"
+  , "{"
+  , "  return (duckdb_v2_config_get_option_by_index)(arg1, arg2, arg3, arg4);"
+  , "}"
+  , "DUCKDB_V2_ERROR hs_bindgen_566956b019b9d7ee ("
+  , "  duckdb_v2_option_handle *arg1"
+  , ")"
+  , "{"
+  , "  return (duckdb_v2_option_destroy)(arg1);"
+  , "}"
+  , "DUCKDB_V2_ERROR hs_bindgen_d3be4886e75d39f7 ("
+  , "  duckdb_v2_option_handle arg1,"
+  , "  duckdb_v2_identifier_t *arg2,"
+  , "  duckdb_v2_error_info_handle *arg3"
+  , ")"
+  , "{"
+  , "  return (duckdb_v2_option_get_name)(arg1, arg2, arg3);"
+  , "}"
+  , "DUCKDB_V2_ERROR hs_bindgen_1b3e2d961afd5895 ("
+  , "  duckdb_v2_option_handle arg1,"
+  , "  duckdb_v2_value_handle *arg2,"
+  , "  duckdb_v2_error_info_handle *arg3"
+  , ")"
+  , "{"
+  , "  return (duckdb_v2_option_get_default_value)(arg1, arg2, arg3);"
+  , "}"
+  , "DUCKDB_V2_ERROR hs_bindgen_42ecc9ecd149c818 ("
+  , "  duckdb_v2_option_handle arg1,"
+  , "  duckdb_v2_str *arg2,"
+  , "  duckdb_v2_error_info_handle *arg3"
+  , ")"
+  , "{"
+  , "  return (duckdb_v2_option_get_description)(arg1, arg2, arg3);"
+  , "}"
+  , "DUCKDB_V2_ERROR hs_bindgen_30b1730423201145 ("
+  , "  duckdb_v2_option_handle arg1,"
+  , "  DUCKDB_V2_SETTING_SCOPE arg2,"
+  , "  _Bool *arg3,"
+  , "  duckdb_v2_error_info_handle *arg4"
+  , ")"
+  , "{"
+  , "  return (duckdb_v2_option_supports_scope)(arg1, arg2, arg3, arg4);"
+  , "}"
+  , "DUCKDB_V2_ERROR hs_bindgen_74f6c48afd3dce15 ("
+  , "  duckdb_v2_option_handle arg1,"
+  , "  DUCKDB_V2_SETTING_SCOPE *arg2,"
+  , "  duckdb_v2_error_info_handle *arg3"
+  , ")"
+  , "{"
+  , "  return (duckdb_v2_option_get_default_scope)(arg1, arg2, arg3);"
+  , "}"
+  , "DUCKDB_V2_ERROR hs_bindgen_c9d0217eb4ca39de ("
+  , "  duckdb_v2_option_handle arg1,"
+  , "  idx_t *arg2,"
+  , "  duckdb_v2_error_info_handle *arg3"
+  , ")"
+  , "{"
+  , "  return (duckdb_v2_option_get_alias_count)(arg1, arg2, arg3);"
+  , "}"
+  , "DUCKDB_V2_ERROR hs_bindgen_50f09b8c10860793 ("
+  , "  duckdb_v2_option_handle arg1,"
+  , "  idx_t arg2,"
+  , "  duckdb_v2_identifier_t *arg3,"
+  , "  duckdb_v2_error_info_handle *arg4"
+  , ")"
+  , "{"
+  , "  return (duckdb_v2_option_get_alias)(arg1, arg2, arg3, arg4);"
+  , "}"
+  , "DUCKDB_V2_ERROR hs_bindgen_3271d2900cdc5519 ("
+  , "  duckdb_v2_instance_handle arg1,"
+  , "  duckdb_v2_connection_handle *arg2,"
+  , "  duckdb_v2_error_info_handle *arg3"
+  , ")"
+  , "{"
+  , "  return (duckdb_v2_connection_create)(arg1, arg2, arg3);"
+  , "}"
+  , "DUCKDB_V2_ERROR hs_bindgen_c5bf0ceca89852bf ("
+  , "  duckdb_v2_connection_handle *arg1"
+  , ")"
+  , "{"
+  , "  return (duckdb_v2_connection_destroy)(arg1);"
+  , "}"
+  , "DUCKDB_V2_ERROR hs_bindgen_7867e003657ab2a8 ("
+  , "  duckdb_v2_connection_handle arg1,"
+  , "  duckdb_v2_error_info_handle *arg2"
+  , ")"
+  , "{"
+  , "  return (duckdb_v2_connection_interrupt)(arg1, arg2);"
+  , "}"
+  , "DUCKDB_V2_ERROR hs_bindgen_58c450e34adca788 ("
+  , "  duckdb_v2_connection_handle arg1,"
+  , "  double *arg2,"
+  , "  uint64_t *arg3,"
+  , "  uint64_t *arg4,"
+  , "  duckdb_v2_error_info_handle *arg5"
+  , ")"
+  , "{"
+  , "  return (duckdb_v2_connection_progress_get)(arg1, arg2, arg3, arg4, arg5);"
+  , "}"
+  , "DUCKDB_V2_ERROR hs_bindgen_c8109c39449b5ed8 ("
+  , "  duckdb_v2_factory_handle arg1,"
+  , "  duckdb_v2_custom_type_handle *arg2,"
+  , "  duckdb_v2_error_info_handle *arg3"
+  , ")"
+  , "{"
+  , "  return (duckdb_v2_custom_type_create)(arg1, arg2, arg3);"
+  , "}"
+  , "DUCKDB_V2_ERROR hs_bindgen_953d55bf7eec4908 ("
+  , "  duckdb_v2_custom_type_handle arg1,"
+  , "  duckdb_v2_identifier_t const *arg2,"
+  , "  duckdb_v2_error_info_handle *arg3"
+  , ")"
+  , "{"
+  , "  return (duckdb_v2_custom_type_set_name)(arg1, arg2, arg3);"
+  , "}"
+  , "DUCKDB_V2_ERROR hs_bindgen_1be20a2ba0faa5e1 ("
+  , "  duckdb_v2_custom_type_handle arg1,"
+  , "  duckdb_v2_logical_type_handle arg2,"
+  , "  duckdb_v2_error_info_handle *arg3"
+  , ")"
+  , "{"
+  , "  return (duckdb_v2_custom_type_set_base_type)(arg1, arg2, arg3);"
+  , "}"
+  , "DUCKDB_V2_ERROR hs_bindgen_4169f518e7bb3b23 ("
+  , "  duckdb_v2_connection_handle arg1,"
+  , "  duckdb_v2_custom_type_handle arg2,"
+  , "  duckdb_v2_error_info_handle *arg3"
+  , ")"
+  , "{"
+  , "  return (duckdb_v2_connection_register_custom_type)(arg1, arg2, arg3);"
+  , "}"
+  , "DUCKDB_V2_ERROR hs_bindgen_a833805e0916f364 ("
+  , "  duckdb_v2_extension_handle arg1,"
+  , "  duckdb_v2_custom_type_handle arg2,"
+  , "  duckdb_v2_error_info_handle *arg3"
+  , ")"
+  , "{"
+  , "  return (duckdb_v2_extension_register_custom_type)(arg1, arg2, arg3);"
+  , "}"
+  , "DUCKDB_V2_ERROR hs_bindgen_704b887e14cb4822 ("
+  , "  duckdb_v2_custom_type_handle *arg1"
+  , ")"
+  , "{"
+  , "  return (duckdb_v2_custom_type_destroy)(arg1);"
+  , "}"
+  , "DUCKDB_V2_ERROR hs_bindgen_c8667c82da51f6fa ("
+  , "  duckdb_v2_factory_handle arg1,"
+  , "  duckdb_v2_logical_type_handle const *arg2,"
+  , "  idx_t arg3,"
+  , "  duckdb_v2_data_chunk_handle *arg4,"
+  , "  duckdb_v2_error_info_handle *arg5"
+  , ")"
+  , "{"
+  , "  return (duckdb_v2_data_chunk_create)(arg1, arg2, arg3, arg4, arg5);"
+  , "}"
+  , "DUCKDB_V2_ERROR hs_bindgen_986410f0edd00849 ("
+  , "  duckdb_v2_factory_handle arg1,"
+  , "  duckdb_v2_data_chunk_handle arg2,"
+  , "  duckdb_v2_data_chunk_handle *arg3,"
+  , "  duckdb_v2_error_info_handle *arg4"
+  , ")"
+  , "{"
+  , "  return (duckdb_v2_data_chunk_copy)(arg1, arg2, arg3, arg4);"
+  , "}"
+  , "DUCKDB_V2_ERROR hs_bindgen_3fa1cd2928f089f3 ("
+  , "  duckdb_v2_data_chunk_handle *arg1"
+  , ")"
+  , "{"
+  , "  return (duckdb_v2_data_chunk_destroy)(arg1);"
+  , "}"
+  , "DUCKDB_V2_ERROR hs_bindgen_3b8f7ab391c7469c ("
+  , "  duckdb_v2_data_chunk_handle arg1,"
+  , "  duckdb_v2_error_info_handle *arg2"
+  , ")"
+  , "{"
+  , "  return (duckdb_v2_data_chunk_clear)(arg1, arg2);"
+  , "}"
+  , "DUCKDB_V2_ERROR hs_bindgen_c39520ea51c50c30 ("
+  , "  duckdb_v2_data_chunk_handle arg1,"
+  , "  idx_t *arg2,"
+  , "  duckdb_v2_error_info_handle *arg3"
+  , ")"
+  , "{"
+  , "  return (duckdb_v2_data_chunk_get_size)(arg1, arg2, arg3);"
+  , "}"
+  , "DUCKDB_V2_ERROR hs_bindgen_548fa422e64bf73f ("
+  , "  duckdb_v2_data_chunk_handle arg1,"
+  , "  idx_t *arg2,"
+  , "  duckdb_v2_error_info_handle *arg3"
+  , ")"
+  , "{"
+  , "  return (duckdb_v2_data_chunk_get_capacity)(arg1, arg2, arg3);"
+  , "}"
+  , "DUCKDB_V2_ERROR hs_bindgen_13b9589932c3b637 ("
+  , "  duckdb_v2_data_chunk_handle arg1,"
+  , "  idx_t *arg2,"
+  , "  duckdb_v2_error_info_handle *arg3"
+  , ")"
+  , "{"
+  , "  return (duckdb_v2_data_chunk_get_vector_count)(arg1, arg2, arg3);"
+  , "}"
+  , "DUCKDB_V2_ERROR hs_bindgen_0604ecf0b34bfa42 ("
+  , "  duckdb_v2_data_chunk_handle arg1,"
+  , "  idx_t arg2,"
+  , "  duckdb_v2_vector_handle *arg3,"
+  , "  duckdb_v2_error_info_handle *arg4"
+  , ")"
+  , "{"
+  , "  return (duckdb_v2_data_chunk_get_vector)(arg1, arg2, arg3, arg4);"
+  , "}"
+  , "DUCKDB_V2_ERROR hs_bindgen_0d6e1ef9888bf38b ("
+  , "  duckdb_v2_environment_handle *arg1,"
+  , "  duckdb_v2_error_info_handle *arg2"
+  , ")"
+  , "{"
+  , "  return (duckdb_v2_environment_create)(arg1, arg2);"
+  , "}"
+  , "DUCKDB_V2_ERROR hs_bindgen_6f011a47d1d2a512 ("
+  , "  duckdb_v2_environment_handle *arg1"
+  , ")"
+  , "{"
+  , "  return (duckdb_v2_environment_destroy)(arg1);"
+  , "}"
+  , "DUCKDB_V2_ERROR hs_bindgen_db07f075791341a1 ("
+  , "  duckdb_v2_environment_handle arg1,"
+  , "  idx_t *arg2,"
+  , "  duckdb_v2_error_info_handle *arg3"
+  , ")"
+  , "{"
+  , "  return (duckdb_v2_environment_get_instance_count)(arg1, arg2, arg3);"
+  , "}"
+  , "DUCKDB_V2_ERROR hs_bindgen_552e1c73da925f47 ("
+  , "  duckdb_v2_error_info_handle arg1,"
+  , "  DUCKDB_V2_ERROR *arg2"
+  , ")"
+  , "{"
+  , "  return (duckdb_v2_error_info_get_code)(arg1, arg2);"
+  , "}"
+  , "DUCKDB_V2_ERROR hs_bindgen_03df4b92bc4be03f ("
+  , "  duckdb_v2_error_info_handle arg1,"
+  , "  duckdb_v2_str *arg2"
+  , ")"
+  , "{"
+  , "  return (duckdb_v2_error_info_get_text)(arg1, arg2);"
+  , "}"
+  , "DUCKDB_V2_ERROR hs_bindgen_32a1e95c1b01b1de ("
+  , "  duckdb_v2_error_info_handle arg1,"
+  , "  duckdb_v2_str *arg2"
+  , ")"
+  , "{"
+  , "  return (duckdb_v2_error_info_get_raw_text)(arg1, arg2);"
+  , "}"
+  , "DUCKDB_V2_ERROR hs_bindgen_326085f2ffcfc342 ("
+  , "  duckdb_v2_error_info_handle arg1,"
+  , "  DUCKDB_V2_ERROR arg2"
+  , ")"
+  , "{"
+  , "  return (duckdb_v2_error_info_set_code)(arg1, arg2);"
+  , "}"
+  , "DUCKDB_V2_ERROR hs_bindgen_e6b5e7387b836896 ("
+  , "  duckdb_v2_error_info_handle arg1,"
+  , "  duckdb_v2_str const *arg2"
+  , ")"
+  , "{"
+  , "  return (duckdb_v2_error_info_set_text)(arg1, arg2);"
+  , "}"
+  , "DUCKDB_V2_ERROR hs_bindgen_77cae354c53e33b0 ("
+  , "  duckdb_v2_error_info_handle *arg1"
+  , ")"
+  , "{"
+  , "  return (duckdb_v2_error_info_destroy)(arg1);"
+  , "}"
+  , "DUCKDB_V2_ERROR hs_bindgen_e018ef8a87cb6cfa ("
+  , "  duckdb_v2_instance_handle arg1,"
+  , "  duckdb_v2_factory_handle *arg2,"
+  , "  duckdb_v2_error_info_handle *arg3"
+  , ")"
+  , "{"
+  , "  return (duckdb_v2_instance_get_factory)(arg1, arg2, arg3);"
+  , "}"
+  , "DUCKDB_V2_ERROR hs_bindgen_404bc6fa8a1d8482 ("
+  , "  duckdb_v2_connection_handle arg1,"
+  , "  duckdb_v2_factory_handle *arg2,"
+  , "  duckdb_v2_error_info_handle *arg3"
+  , ")"
+  , "{"
+  , "  return (duckdb_v2_connection_get_factory)(arg1, arg2, arg3);"
+  , "}"
+  , "DUCKDB_V2_ERROR hs_bindgen_171cd09b93febf18 ("
+  , "  duckdb_v2_context_handle arg1,"
+  , "  duckdb_v2_factory_handle *arg2,"
+  , "  duckdb_v2_error_info_handle *arg3"
+  , ")"
+  , "{"
+  , "  return (duckdb_v2_context_get_factory)(arg1, arg2, arg3);"
+  , "}"
+  , "DUCKDB_V2_ERROR hs_bindgen_480977e243515f9b ("
+  , "  duckdb_v2_context_handle arg1,"
+  , "  duckdb_v2_file_system_handle *arg2,"
+  , "  duckdb_v2_error_info_handle *arg3"
+  , ")"
+  , "{"
+  , "  return (duckdb_v2_context_get_file_system)(arg1, arg2, arg3);"
+  , "}"
+  , "DUCKDB_V2_ERROR hs_bindgen_1182a1b34bb4b5d8 ("
+  , "  duckdb_v2_instance_handle arg1,"
+  , "  duckdb_v2_file_system_handle *arg2,"
+  , "  duckdb_v2_error_info_handle *arg3"
+  , ")"
+  , "{"
+  , "  return (duckdb_v2_instance_get_file_system)(arg1, arg2, arg3);"
+  , "}"
+  , "DUCKDB_V2_ERROR hs_bindgen_c3c4dbd17ed425d7 ("
+  , "  duckdb_v2_connection_handle arg1,"
+  , "  duckdb_v2_file_system_handle *arg2,"
+  , "  duckdb_v2_error_info_handle *arg3"
+  , ")"
+  , "{"
+  , "  return (duckdb_v2_connection_get_file_system)(arg1, arg2, arg3);"
+  , "}"
+  , "DUCKDB_V2_ERROR hs_bindgen_3b95d687bcc454dc ("
+  , "  duckdb_v2_file_system_handle arg1,"
+  , "  duckdb_v2_file_open_options_handle *arg2,"
+  , "  duckdb_v2_error_info_handle *arg3"
+  , ")"
+  , "{"
+  , "  return (duckdb_v2_file_open_options_create)(arg1, arg2, arg3);"
+  , "}"
+  , "DUCKDB_V2_ERROR hs_bindgen_13b837fa457c05ab ("
+  , "  duckdb_v2_file_open_options_handle arg1,"
+  , "  DUCKDB_V2_FILE_FLAG arg2,"
+  , "  duckdb_v2_error_info_handle *arg3"
+  , ")"
+  , "{"
+  , "  return (duckdb_v2_file_open_options_set_flag)(arg1, arg2, arg3);"
+  , "}"
+  , "DUCKDB_V2_ERROR hs_bindgen_8057d4fdc98cb7a0 ("
+  , "  duckdb_v2_file_open_options_handle arg1,"
+  , "  duckdb_v2_str const *arg2,"
+  , "  duckdb_v2_value_handle arg3,"
+  , "  duckdb_v2_error_info_handle *arg4"
+  , ")"
+  , "{"
+  , "  return (duckdb_v2_file_open_options_set_value)(arg1, arg2, arg3, arg4);"
+  , "}"
+  , "DUCKDB_V2_ERROR hs_bindgen_eee66d4dc0272778 ("
+  , "  duckdb_v2_file_open_options_handle *arg1"
+  , ")"
+  , "{"
+  , "  return (duckdb_v2_file_open_options_destroy)(arg1);"
+  , "}"
+  , "DUCKDB_V2_ERROR hs_bindgen_d095a79fe561d117 ("
+  , "  duckdb_v2_file_system_handle arg1,"
+  , "  duckdb_v2_str const *arg2,"
+  , "  duckdb_v2_file_open_options_handle arg3,"
+  , "  duckdb_v2_file_handle *arg4,"
+  , "  duckdb_v2_error_info_handle *arg5"
+  , ")"
+  , "{"
+  , "  return (duckdb_v2_file_system_open)(arg1, arg2, arg3, arg4, arg5);"
+  , "}"
+  , "DUCKDB_V2_ERROR hs_bindgen_88b4f0f72cbdbead ("
+  , "  duckdb_v2_file_system_handle arg1,"
+  , "  duckdb_v2_str const *arg2,"
+  , "  _Bool *arg3,"
+  , "  duckdb_v2_error_info_handle *arg4"
+  , ")"
+  , "{"
+  , "  return (duckdb_v2_file_system_path_exists)(arg1, arg2, arg3, arg4);"
+  , "}"
+  , "DUCKDB_V2_ERROR hs_bindgen_a339f857b407ee61 ("
+  , "  duckdb_v2_file_system_handle arg1,"
+  , "  duckdb_v2_str const *arg2,"
+  , "  _Bool *arg3,"
+  , "  duckdb_v2_error_info_handle *arg4"
+  , ")"
+  , "{"
+  , "  return (duckdb_v2_file_system_path_is_remote)(arg1, arg2, arg3, arg4);"
+  , "}"
+  , "DUCKDB_V2_ERROR hs_bindgen_371e0d86cbe6ddc1 ("
+  , "  duckdb_v2_file_system_handle arg1,"
+  , "  duckdb_v2_str const *arg2,"
+  , "  duckdb_v2_text_sink_fn arg3,"
+  , "  void *arg4,"
+  , "  duckdb_v2_error_info_handle *arg5"
+  , ")"
+  , "{"
+  , "  return (duckdb_v2_file_system_path_expand)(arg1, arg2, arg3, arg4, arg5);"
+  , "}"
+  , "DUCKDB_V2_ERROR hs_bindgen_7d20eee7c5ccd236 ("
+  , "  duckdb_v2_file_system_handle arg1,"
+  , "  duckdb_v2_str const *arg2,"
+  , "  duckdb_v2_file_system_path_glob_callback_fn arg3,"
+  , "  void *arg4,"
+  , "  duckdb_v2_error_info_handle *arg5"
+  , ")"
+  , "{"
+  , "  return (duckdb_v2_file_system_path_glob)(arg1, arg2, arg3, arg4, arg5);"
+  , "}"
+  , "DUCKDB_V2_ERROR hs_bindgen_d565d6819ab07083 ("
+  , "  duckdb_v2_file_system_handle arg1,"
+  , "  duckdb_v2_str const *arg2,"
+  , "  duckdb_v2_str const *arg3,"
+  , "  duckdb_v2_error_info_handle *arg4"
+  , ")"
+  , "{"
+  , "  return (duckdb_v2_file_system_path_move)(arg1, arg2, arg3, arg4);"
+  , "}"
+  , "DUCKDB_V2_ERROR hs_bindgen_0c10dec5f12a1394 ("
+  , "  duckdb_v2_file_system_handle arg1,"
+  , "  duckdb_v2_str const *arg2,"
+  , "  _Bool *arg3,"
+  , "  duckdb_v2_error_info_handle *arg4"
+  , ")"
+  , "{"
+  , "  return (duckdb_v2_file_system_path_remove)(arg1, arg2, arg3, arg4);"
+  , "}"
+  , "DUCKDB_V2_ERROR hs_bindgen_52c313658d6f37ba ("
+  , "  duckdb_v2_file_handle arg1,"
+  , "  void *arg2,"
+  , "  idx_t arg3,"
+  , "  idx_t *arg4,"
+  , "  duckdb_v2_error_info_handle *arg5"
+  , ")"
+  , "{"
+  , "  return (duckdb_v2_file_read)(arg1, arg2, arg3, arg4, arg5);"
+  , "}"
+  , "DUCKDB_V2_ERROR hs_bindgen_bed92f205a27136a ("
+  , "  duckdb_v2_file_handle arg1,"
+  , "  void const *arg2,"
+  , "  idx_t arg3,"
+  , "  idx_t *arg4,"
+  , "  duckdb_v2_error_info_handle *arg5"
+  , ")"
+  , "{"
+  , "  return (duckdb_v2_file_write)(arg1, arg2, arg3, arg4, arg5);"
+  , "}"
+  , "DUCKDB_V2_ERROR hs_bindgen_937b677782a1e78a ("
+  , "  duckdb_v2_file_handle arg1,"
+  , "  void *arg2,"
+  , "  idx_t arg3,"
+  , "  idx_t arg4,"
+  , "  duckdb_v2_error_info_handle *arg5"
+  , ")"
+  , "{"
+  , "  return (duckdb_v2_file_read_at)(arg1, arg2, arg3, arg4, arg5);"
+  , "}"
+  , "DUCKDB_V2_ERROR hs_bindgen_15bd243f5702e4f2 ("
+  , "  duckdb_v2_file_handle arg1,"
+  , "  void const *arg2,"
+  , "  idx_t arg3,"
+  , "  idx_t arg4,"
+  , "  duckdb_v2_error_info_handle *arg5"
+  , ")"
+  , "{"
+  , "  return (duckdb_v2_file_write_at)(arg1, arg2, arg3, arg4, arg5);"
+  , "}"
+  , "DUCKDB_V2_ERROR hs_bindgen_f5bb93448c5f8957 ("
+  , "  duckdb_v2_file_handle arg1,"
+  , "  idx_t *arg2,"
+  , "  duckdb_v2_error_info_handle *arg3"
+  , ")"
+  , "{"
+  , "  return (duckdb_v2_file_tell)(arg1, arg2, arg3);"
+  , "}"
+  , "DUCKDB_V2_ERROR hs_bindgen_75b07ce11b78f1d6 ("
+  , "  duckdb_v2_file_handle arg1,"
+  , "  idx_t *arg2,"
+  , "  duckdb_v2_error_info_handle *arg3"
+  , ")"
+  , "{"
+  , "  return (duckdb_v2_file_size)(arg1, arg2, arg3);"
+  , "}"
+  , "DUCKDB_V2_ERROR hs_bindgen_26d8df7e33d02083 ("
+  , "  duckdb_v2_file_handle arg1,"
+  , "  idx_t arg2,"
+  , "  duckdb_v2_error_info_handle *arg3"
+  , ")"
+  , "{"
+  , "  return (duckdb_v2_file_seek)(arg1, arg2, arg3);"
+  , "}"
+  , "DUCKDB_V2_ERROR hs_bindgen_0c19ed1ebed8cac7 ("
+  , "  duckdb_v2_file_handle arg1,"
+  , "  duckdb_v2_error_info_handle *arg2"
+  , ")"
+  , "{"
+  , "  return (duckdb_v2_file_sync)(arg1, arg2);"
+  , "}"
+  , "DUCKDB_V2_ERROR hs_bindgen_b7b4550fbf8627f4 ("
+  , "  duckdb_v2_file_handle arg1,"
+  , "  duckdb_v2_error_info_handle *arg2"
+  , ")"
+  , "{"
+  , "  return (duckdb_v2_file_close)(arg1, arg2);"
+  , "}"
+  , "DUCKDB_V2_ERROR hs_bindgen_5c6f7b7ba5c2bc2c ("
+  , "  duckdb_v2_file_handle *arg1"
+  , ")"
+  , "{"
+  , "  return (duckdb_v2_file_destroy)(arg1);"
+  , "}"
+  , "DUCKDB_V2_ERROR hs_bindgen_4616f88449a9cdf2 ("
+  , "  duckdb_v2_function_bind_info_handle arg1,"
+  , "  void **arg2,"
+  , "  duckdb_v2_error_info_handle *arg3"
+  , ")"
+  , "{"
+  , "  return (duckdb_v2_function_bind_get_user_data)(arg1, arg2, arg3);"
+  , "}"
+  , "DUCKDB_V2_ERROR hs_bindgen_5616d90ac6da1a33 ("
+  , "  duckdb_v2_function_bind_info_handle arg1,"
+  , "  duckdb_v2_opaque *arg2,"
+  , "  duckdb_v2_error_info_handle *arg3"
+  , ")"
+  , "{"
+  , "  return (duckdb_v2_function_bind_set_bind_data)(arg1, arg2, arg3);"
+  , "}"
+  , "DUCKDB_V2_ERROR hs_bindgen_3a58dcb29442c12d ("
+  , "  duckdb_v2_function_bind_info_handle arg1,"
+  , "  idx_t *arg2,"
+  , "  idx_t *arg3,"
+  , "  idx_t *arg4,"
+  , "  idx_t *arg5,"
+  , "  duckdb_v2_error_info_handle *arg6"
+  , ")"
+  , "{"
+  , "  return (duckdb_v2_function_bind_get_arg_count)(arg1, arg2, arg3, arg4, arg5, arg6);"
+  , "}"
+  , "DUCKDB_V2_ERROR hs_bindgen_511e5a20beee3a30 ("
+  , "  duckdb_v2_function_bind_info_handle arg1,"
+  , "  idx_t arg2,"
+  , "  duckdb_v2_logical_type_handle *arg3,"
+  , "  duckdb_v2_error_info_handle *arg4"
+  , ")"
+  , "{"
+  , "  return (duckdb_v2_function_bind_get_arg_type)(arg1, arg2, arg3, arg4);"
+  , "}"
+  , "DUCKDB_V2_ERROR hs_bindgen_80de77fffc115749 ("
+  , "  duckdb_v2_function_bind_info_handle arg1,"
+  , "  idx_t arg2,"
+  , "  duckdb_v2_value_handle *arg3,"
+  , "  duckdb_v2_error_info_handle *arg4"
+  , ")"
+  , "{"
+  , "  return (duckdb_v2_function_bind_get_arg_value)(arg1, arg2, arg3, arg4);"
+  , "}"
+  , "DUCKDB_V2_ERROR hs_bindgen_0511a6b316270315 ("
+  , "  duckdb_v2_function_bind_info_handle arg1,"
+  , "  idx_t arg2,"
+  , "  duckdb_v2_identifier_t *arg3,"
+  , "  duckdb_v2_error_info_handle *arg4"
+  , ")"
+  , "{"
+  , "  return (duckdb_v2_function_bind_get_arg_name)(arg1, arg2, arg3, arg4);"
+  , "}"
+  , "DUCKDB_V2_ERROR hs_bindgen_a877f5bdc11a26db ("
+  , "  duckdb_v2_function_bind_info_handle arg1,"
+  , "  duckdb_v2_identifier_t const *arg2,"
+  , "  idx_t *arg3,"
+  , "  _Bool *arg4,"
+  , "  duckdb_v2_error_info_handle *arg5"
+  , ")"
+  , "{"
+  , "  return (duckdb_v2_function_bind_get_arg_index)(arg1, arg2, arg3, arg4, arg5);"
+  , "}"
+  , "DUCKDB_V2_ERROR hs_bindgen_812ff41ab1d4e439 ("
+  , "  duckdb_v2_function_docs_handle arg1,"
+  , "  duckdb_v2_str const *arg2,"
+  , "  duckdb_v2_error_info_handle *arg3"
+  , ")"
+  , "{"
+  , "  return (duckdb_v2_function_docs_set_description)(arg1, arg2, arg3);"
+  , "}"
+  , "DUCKDB_V2_ERROR hs_bindgen_d63b7ffdb1926c27 ("
+  , "  duckdb_v2_function_docs_handle arg1,"
+  , "  duckdb_v2_str const *arg2,"
+  , "  duckdb_v2_str const *arg3,"
+  , "  duckdb_v2_error_info_handle *arg4"
+  , ")"
+  , "{"
+  , "  return (duckdb_v2_function_docs_add_example)(arg1, arg2, arg3, arg4);"
+  , "}"
+  , "DUCKDB_V2_ERROR hs_bindgen_8c0ae6a612e9d656 ("
+  , "  duckdb_v2_function_docs_handle arg1,"
+  , "  duckdb_v2_str const *arg2,"
+  , "  duckdb_v2_error_info_handle *arg3"
+  , ")"
+  , "{"
+  , "  return (duckdb_v2_function_docs_add_category)(arg1, arg2, arg3);"
+  , "}"
+  , "DUCKDB_V2_ERROR hs_bindgen_7bc5242fb1a27934 ("
+  , "  duckdb_v2_function_signature_handle arg1,"
+  , "  duckdb_v2_identifier_t const *arg2,"
+  , "  duckdb_v2_logical_type_handle arg3,"
+  , "  duckdb_v2_value_handle arg4,"
+  , "  DUCKDB_V2_FUNCTION_PARAMETER_KIND arg5,"
+  , "  duckdb_v2_error_info_handle *arg6"
+  , ")"
+  , "{"
+  , "  return (duckdb_v2_function_signature_add_parameter)(arg1, arg2, arg3, arg4, arg5, arg6);"
+  , "}"
+  , "DUCKDB_V2_ERROR hs_bindgen_d44dad353372974b ("
+  , "  duckdb_v2_function_signature_handle arg1,"
+  , "  duckdb_v2_logical_type_handle arg2,"
+  , "  duckdb_v2_error_info_handle *arg3"
+  , ")"
+  , "{"
+  , "  return (duckdb_v2_function_signature_set_return_type)(arg1, arg2, arg3);"
+  , "}"
+  , "DUCKDB_V2_ERROR hs_bindgen_648d1059972cfe31 ("
+  , "  duckdb_v2_identifier_t const *arg1,"
+  , "  char *arg2,"
+  , "  idx_t arg3,"
+  , "  idx_t *arg4,"
+  , "  duckdb_v2_error_info_handle *arg5"
+  , ")"
+  , "{"
+  , "  return (duckdb_v2_identifier_render_quoted)(arg1, arg2, arg3, arg4, arg5);"
+  , "}"
+  , "DUCKDB_V2_ERROR hs_bindgen_a284cf08a8a65feb ("
+  , "  duckdb_v2_environment_handle arg1,"
+  , "  duckdb_v2_instance_handle *arg2,"
+  , "  duckdb_v2_error_info_handle *arg3"
+  , ")"
+  , "{"
+  , "  return (duckdb_v2_instance_create)(arg1, arg2, arg3);"
+  , "}"
+  , "DUCKDB_V2_ERROR hs_bindgen_73bea1b0baf1b37c ("
+  , "  duckdb_v2_environment_handle arg1,"
+  , "  duckdb_v2_str const *arg2,"
+  , "  duckdb_v2_str const *arg3,"
+  , "  idx_t arg4,"
+  , "  duckdb_v2_instance_handle *arg5,"
+  , "  duckdb_v2_error_info_handle *arg6"
+  , ")"
+  , "{"
+  , "  return (duckdb_v2_instance_create_with_options)(arg1, arg2, arg3, arg4, arg5, arg6);"
+  , "}"
+  , "DUCKDB_V2_ERROR hs_bindgen_56df03d6894ed76a ("
+  , "  duckdb_v2_instance_handle *arg1"
+  , ")"
+  , "{"
+  , "  return (duckdb_v2_instance_destroy)(arg1);"
+  , "}"
+  , "DUCKDB_V2_ERROR hs_bindgen_463a516d6c190a96 ("
+  , "  duckdb_v2_instance_handle arg1,"
+  , "  duckdb_v2_identifier_t const *arg2,"
+  , "  duckdb_v2_str const *arg3,"
+  , "  duckdb_v2_attach_options_handle arg4,"
+  , "  _Bool arg5,"
+  , "  duckdb_v2_error_info_handle *arg6"
+  , ")"
+  , "{"
+  , "  return (duckdb_v2_instance_attach)(arg1, arg2, arg3, arg4, arg5, arg6);"
+  , "}"
+  , "DUCKDB_V2_ERROR hs_bindgen_4378df5ac40df0b9 ("
+  , "  duckdb_v2_instance_handle arg1,"
+  , "  duckdb_v2_identifier_t const *arg2,"
+  , "  duckdb_v2_error_info_handle *arg3"
+  , ")"
+  , "{"
+  , "  return (duckdb_v2_instance_detach)(arg1, arg2, arg3);"
+  , "}"
+  , "DUCKDB_V2_ERROR hs_bindgen_ce4ad4a876e755a4 ("
+  , "  duckdb_v2_instance_handle arg1,"
+  , "  duckdb_v2_identifier_t const *arg2,"
+  , "  duckdb_v2_error_info_handle *arg3"
+  , ")"
+  , "{"
+  , "  return (duckdb_v2_instance_set_default)(arg1, arg2, arg3);"
+  , "}"
+  , "DUCKDB_V2_ERROR hs_bindgen_5b74dc8fe1ab3f0b ("
+  , "  duckdb_v2_instance_handle arg1,"
+  , "  duckdb_v2_attach_options_handle *arg2,"
+  , "  duckdb_v2_error_info_handle *arg3"
+  , ")"
+  , "{"
+  , "  return (duckdb_v2_attach_options_create)(arg1, arg2, arg3);"
+  , "}"
+  , "DUCKDB_V2_ERROR hs_bindgen_dc6215eb5d970dcf ("
+  , "  duckdb_v2_attach_options_handle arg1,"
+  , "  duckdb_v2_identifier_t const *arg2,"
+  , "  duckdb_v2_str const *arg3,"
+  , "  duckdb_v2_error_info_handle *arg4"
+  , ")"
+  , "{"
+  , "  return (duckdb_v2_attach_options_set)(arg1, arg2, arg3, arg4);"
+  , "}"
+  , "DUCKDB_V2_ERROR hs_bindgen_f36c9f1fe2a3a8a3 ("
+  , "  duckdb_v2_attach_options_handle *arg1"
+  , ")"
+  , "{"
+  , "  return (duckdb_v2_attach_options_destroy)(arg1);"
+  , "}"
+  , "DUCKDB_V2_ERROR hs_bindgen_87f034a4e6a0ebd7 ("
+  , "  duckdb_v2_str *arg1,"
+  , "  duckdb_v2_error_info_handle *arg2"
+  , ")"
+  , "{"
+  , "  return (duckdb_v2_library_version)(arg1, arg2);"
+  , "}"
+  , "DUCKDB_V2_ERROR hs_bindgen_c380cb64ce856729 ("
+  , "  duckdb_v2_context_handle arg1,"
+  , "  DUCKDB_V2_LOG_LEVEL arg2,"
+  , "  duckdb_v2_str const *arg3,"
+  , "  duckdb_v2_str const *arg4,"
+  , "  duckdb_v2_error_info_handle *arg5"
+  , ")"
+  , "{"
+  , "  return (duckdb_v2_context_log)(arg1, arg2, arg3, arg4, arg5);"
+  , "}"
+  , "DUCKDB_V2_ERROR hs_bindgen_fc0bdf1b87677558 ("
+  , "  duckdb_v2_instance_handle arg1,"
+  , "  DUCKDB_V2_LOG_LEVEL arg2,"
+  , "  duckdb_v2_str const *arg3,"
+  , "  duckdb_v2_str const *arg4,"
+  , "  duckdb_v2_error_info_handle *arg5"
+  , ")"
+  , "{"
+  , "  return (duckdb_v2_instance_log)(arg1, arg2, arg3, arg4, arg5);"
+  , "}"
+  , "DUCKDB_V2_ERROR hs_bindgen_94c3752a727ebc9d ("
+  , "  duckdb_v2_connection_handle arg1,"
+  , "  DUCKDB_V2_LOG_LEVEL arg2,"
+  , "  duckdb_v2_str const *arg3,"
+  , "  duckdb_v2_str const *arg4,"
+  , "  duckdb_v2_error_info_handle *arg5"
+  , ")"
+  , "{"
+  , "  return (duckdb_v2_connection_log)(arg1, arg2, arg3, arg4, arg5);"
+  , "}"
+  , "DUCKDB_V2_ERROR hs_bindgen_572fa6ba39fa9c2f ("
+  , "  duckdb_v2_str const *arg1,"
+  , "  duckdb_v2_qname_handle *arg2,"
+  , "  duckdb_v2_error_info_handle *arg3"
+  , ")"
+  , "{"
+  , "  return (duckdb_v2_qname_parse)(arg1, arg2, arg3);"
+  , "}"
+  , "DUCKDB_V2_ERROR hs_bindgen_938fba9bffb14be4 ("
+  , "  duckdb_v2_identifier_t const *arg1,"
+  , "  idx_t arg2,"
+  , "  duckdb_v2_qname_handle *arg3,"
+  , "  duckdb_v2_error_info_handle *arg4"
+  , ")"
+  , "{"
+  , "  return (duckdb_v2_qname_create)(arg1, arg2, arg3, arg4);"
+  , "}"
+  , "DUCKDB_V2_ERROR hs_bindgen_cc75a574b2500f25 ("
+  , "  duckdb_v2_qname_handle arg1,"
+  , "  idx_t *arg2,"
+  , "  duckdb_v2_error_info_handle *arg3"
+  , ")"
+  , "{"
+  , "  return (duckdb_v2_qname_get_part_count)(arg1, arg2, arg3);"
+  , "}"
+  , "DUCKDB_V2_ERROR hs_bindgen_39e8720dd2ac4515 ("
+  , "  duckdb_v2_qname_handle arg1,"
+  , "  idx_t arg2,"
+  , "  duckdb_v2_identifier_t *arg3,"
+  , "  duckdb_v2_error_info_handle *arg4"
+  , ")"
+  , "{"
+  , "  return (duckdb_v2_qname_get_part)(arg1, arg2, arg3, arg4);"
+  , "}"
+  , "DUCKDB_V2_ERROR hs_bindgen_faf3d53022aa7b0a ("
+  , "  duckdb_v2_qname_handle arg1,"
+  , "  char *arg2,"
+  , "  idx_t arg3,"
+  , "  idx_t *arg4,"
+  , "  duckdb_v2_error_info_handle *arg5"
+  , ")"
+  , "{"
+  , "  return (duckdb_v2_qname_render)(arg1, arg2, arg3, arg4, arg5);"
+  , "}"
+  , "DUCKDB_V2_ERROR hs_bindgen_854da8ea8294a421 ("
+  , "  duckdb_v2_qname_handle arg1,"
+  , "  duckdb_v2_qname_handle arg2,"
+  , "  _Bool *arg3,"
+  , "  duckdb_v2_error_info_handle *arg4"
+  , ")"
+  , "{"
+  , "  return (duckdb_v2_qname_equals)(arg1, arg2, arg3, arg4);"
+  , "}"
+  , "DUCKDB_V2_ERROR hs_bindgen_9fee0613a71e86f8 ("
+  , "  duckdb_v2_qname_handle arg1,"
+  , "  uint64_t *arg2,"
+  , "  duckdb_v2_error_info_handle *arg3"
+  , ")"
+  , "{"
+  , "  return (duckdb_v2_qname_hash)(arg1, arg2, arg3);"
+  , "}"
+  , "DUCKDB_V2_ERROR hs_bindgen_48c103a2f73deaad ("
+  , "  duckdb_v2_qname_handle *arg1"
+  , ")"
+  , "{"
+  , "  return (duckdb_v2_qname_destroy)(arg1);"
+  , "}"
+  , "DUCKDB_V2_ERROR hs_bindgen_aee239d64332d77b ("
+  , "  duckdb_v2_connection_handle arg1,"
+  , "  duckdb_v2_query_metrics_handle *arg2,"
+  , "  duckdb_v2_error_info_handle *arg3"
+  , ")"
+  , "{"
+  , "  return (duckdb_v2_connection_get_query_metrics)(arg1, arg2, arg3);"
+  , "}"
+  , "DUCKDB_V2_ERROR hs_bindgen_0bdbb410fd4dd19b ("
+  , "  duckdb_v2_connection_handle arg1,"
+  , "  _Bool arg2,"
+  , "  duckdb_v2_error_info_handle *arg3"
+  , ")"
+  , "{"
+  , "  return (duckdb_v2_connection_enable_profiling)(arg1, arg2, arg3);"
+  , "}"
+  , "DUCKDB_V2_ERROR hs_bindgen_6e9c9ddf02db4b6f ("
+  , "  duckdb_v2_query_metrics_handle arg1,"
+  , "  duckdb_v2_query_metrics_node_handle *arg2,"
+  , "  duckdb_v2_error_info_handle *arg3"
+  , ")"
+  , "{"
+  , "  return (duckdb_v2_query_metrics_get_root)(arg1, arg2, arg3);"
+  , "}"
+  , "DUCKDB_V2_ERROR hs_bindgen_dff83b8c50618b55 ("
+  , "  duckdb_v2_query_metrics_node_handle arg1,"
+  , "  duckdb_v2_str *arg2,"
+  , "  duckdb_v2_error_info_handle *arg3"
+  , ")"
+  , "{"
+  , "  return (duckdb_v2_query_metrics_node_get_name)(arg1, arg2, arg3);"
+  , "}"
+  , "DUCKDB_V2_ERROR hs_bindgen_5e364693a7caeb31 ("
+  , "  duckdb_v2_query_metrics_node_handle arg1,"
+  , "  idx_t *arg2,"
+  , "  duckdb_v2_error_info_handle *arg3"
+  , ")"
+  , "{"
+  , "  return (duckdb_v2_query_metrics_node_get_child_count)(arg1, arg2, arg3);"
+  , "}"
+  , "DUCKDB_V2_ERROR hs_bindgen_533edb40a7cdfba6 ("
+  , "  duckdb_v2_query_metrics_node_handle arg1,"
+  , "  idx_t arg2,"
+  , "  duckdb_v2_query_metrics_node_handle *arg3,"
+  , "  duckdb_v2_error_info_handle *arg4"
+  , ")"
+  , "{"
+  , "  return (duckdb_v2_query_metrics_node_get_child)(arg1, arg2, arg3, arg4);"
+  , "}"
+  , "DUCKDB_V2_ERROR hs_bindgen_8390ceea4cb7401a ("
+  , "  duckdb_v2_query_metrics_node_handle arg1,"
+  , "  idx_t *arg2,"
+  , "  duckdb_v2_error_info_handle *arg3"
+  , ")"
+  , "{"
+  , "  return (duckdb_v2_query_metrics_node_get_metric_count)(arg1, arg2, arg3);"
+  , "}"
+  , "DUCKDB_V2_ERROR hs_bindgen_f5b6f537f8e71b7a ("
+  , "  duckdb_v2_query_metrics_node_handle arg1,"
+  , "  idx_t arg2,"
+  , "  duckdb_v2_str *arg3,"
+  , "  duckdb_v2_error_info_handle *arg4"
+  , ")"
+  , "{"
+  , "  return (duckdb_v2_query_metrics_node_get_metric_name)(arg1, arg2, arg3, arg4);"
+  , "}"
+  , "DUCKDB_V2_ERROR hs_bindgen_041ad3ea7d99ea9e ("
+  , "  duckdb_v2_query_metrics_node_handle arg1,"
+  , "  idx_t arg2,"
+  , "  duckdb_v2_value_handle *arg3,"
+  , "  duckdb_v2_error_info_handle *arg4"
+  , ")"
+  , "{"
+  , "  return (duckdb_v2_query_metrics_node_get_metric_value)(arg1, arg2, arg3, arg4);"
+  , "}"
+  , "DUCKDB_V2_ERROR hs_bindgen_1222733778a4b36c ("
+  , "  duckdb_v2_query_metrics_node_handle arg1,"
+  , "  duckdb_v2_str const *arg2,"
+  , "  duckdb_v2_value_handle *arg3,"
+  , "  _Bool *arg4,"
+  , "  duckdb_v2_error_info_handle *arg5"
+  , ")"
+  , "{"
+  , "  return (duckdb_v2_query_metrics_node_get_metric)(arg1, arg2, arg3, arg4, arg5);"
+  , "}"
+  , "DUCKDB_V2_ERROR hs_bindgen_fddb763a22a5c4ad ("
+  , "  duckdb_v2_query_metrics_handle *arg1"
+  , ")"
+  , "{"
+  , "  return (duckdb_v2_query_metrics_destroy)(arg1);"
+  , "}"
+  , "DUCKDB_V2_ERROR hs_bindgen_3153e0ec5d5ca736 ("
+  , "  duckdb_v2_schema_handle arg1,"
+  , "  idx_t *arg2,"
+  , "  duckdb_v2_error_info_handle *arg3"
+  , ")"
+  , "{"
+  , "  return (duckdb_v2_schema_get_count)(arg1, arg2, arg3);"
+  , "}"
+  , "DUCKDB_V2_ERROR hs_bindgen_f6a923bbcc88cfd8 ("
+  , "  duckdb_v2_schema_handle arg1,"
+  , "  idx_t arg2,"
+  , "  duckdb_v2_identifier_t *arg3,"
+  , "  duckdb_v2_logical_type_handle *arg4,"
+  , "  duckdb_v2_error_info_handle *arg5"
+  , ")"
+  , "{"
+  , "  return (duckdb_v2_schema_get_field)(arg1, arg2, arg3, arg4, arg5);"
+  , "}"
+  , "DUCKDB_V2_ERROR hs_bindgen_6fd0ddc1718938a3 ("
+  , "  duckdb_v2_schema_handle *arg1"
+  , ")"
+  , "{"
+  , "  return (duckdb_v2_schema_destroy)(arg1);"
+  , "}"
+  , "DUCKDB_V2_ERROR hs_bindgen_75088b1e73c315b5 ("
+  , "  duckdb_v2_connection_handle arg1,"
+  , "  duckdb_v2_str const *arg2,"
+  , "  duckdb_v2_token_iterator_handle *arg3,"
+  , "  duckdb_v2_error_info_handle *arg4"
+  , ")"
+  , "{"
+  , "  return (duckdb_v2_tokenize_sql)(arg1, arg2, arg3, arg4);"
+  , "}"
+  , "DUCKDB_V2_ERROR hs_bindgen_3cfdd08b2282d0b5 ("
+  , "  duckdb_v2_token_iterator_handle arg1,"
+  , "  DUCKDB_V2_TOKEN_TYPE *arg2,"
+  , "  idx_t *arg3,"
+  , "  idx_t *arg4,"
+  , "  duckdb_v2_error_info_handle *arg5"
+  , ")"
+  , "{"
+  , "  return (duckdb_v2_token_iterator_next)(arg1, arg2, arg3, arg4, arg5);"
+  , "}"
+  , "DUCKDB_V2_ERROR hs_bindgen_4953d5311b118142 ("
+  , "  duckdb_v2_token_iterator_handle arg1,"
+  , "  _Bool *arg2,"
+  , "  duckdb_v2_error_info_handle *arg3"
+  , ")"
+  , "{"
+  , "  return (duckdb_v2_token_iterator_ends_unterminated)(arg1, arg2, arg3);"
+  , "}"
+  , "DUCKDB_V2_ERROR hs_bindgen_26fa817a17ff8ac4 ("
+  , "  duckdb_v2_token_iterator_handle *arg1"
+  , ")"
+  , "{"
+  , "  return (duckdb_v2_token_iterator_destroy)(arg1);"
+  , "}"
+  , "DUCKDB_V2_ERROR hs_bindgen_c8397766adf171de ("
+  , "  duckdb_v2_factory_handle arg1,"
+  , "  duckdb_v2_aggregate_function_handle *arg2,"
+  , "  duckdb_v2_error_info_handle *arg3"
+  , ")"
+  , "{"
+  , "  return (duckdb_v2_aggregate_function_create)(arg1, arg2, arg3);"
+  , "}"
+  , "DUCKDB_V2_ERROR hs_bindgen_f436b75dad10c820 ("
+  , "  duckdb_v2_aggregate_function_handle arg1,"
+  , "  duckdb_v2_identifier_t const *arg2,"
+  , "  duckdb_v2_error_info_handle *arg3"
+  , ")"
+  , "{"
+  , "  return (duckdb_v2_aggregate_function_set_name)(arg1, arg2, arg3);"
+  , "}"
+  , "DUCKDB_V2_ERROR hs_bindgen_1b291982b1956416 ("
+  , "  duckdb_v2_aggregate_function_handle arg1,"
+  , "  duckdb_v2_function_docs_handle *arg2,"
+  , "  duckdb_v2_error_info_handle *arg3"
+  , ")"
+  , "{"
+  , "  return (duckdb_v2_aggregate_function_get_docs)(arg1, arg2, arg3);"
+  , "}"
+  , "DUCKDB_V2_ERROR hs_bindgen_9ba4b7d35bae6d6c ("
+  , "  duckdb_v2_aggregate_function_handle arg1,"
+  , "  duckdb_v2_function_signature_handle *arg2,"
+  , "  duckdb_v2_error_info_handle *arg3"
+  , ")"
+  , "{"
+  , "  return (duckdb_v2_aggregate_function_get_signature)(arg1, arg2, arg3);"
+  , "}"
+  , "DUCKDB_V2_ERROR hs_bindgen_0bc6d5c1ec072ce6 ("
+  , "  duckdb_v2_aggregate_function_handle arg1,"
+  , "  duckdb_v2_opaque *arg2,"
+  , "  duckdb_v2_error_info_handle *arg3"
+  , ")"
+  , "{"
+  , "  return (duckdb_v2_aggregate_function_set_user_data)(arg1, arg2, arg3);"
+  , "}"
+  , "DUCKDB_V2_ERROR hs_bindgen_bdf9d43799abc2b6 ("
+  , "  duckdb_v2_aggregate_function_handle arg1,"
+  , "  DUCKDB_V2_FUNCTION_PROPERTY_KEY arg2,"
+  , "  DUCKDB_V2_FUNCTION_PROPERTY_VALUE arg3,"
+  , "  duckdb_v2_error_info_handle *arg4"
+  , ")"
+  , "{"
+  , "  return (duckdb_v2_aggregate_function_set_property)(arg1, arg2, arg3, arg4);"
+  , "}"
+  , "DUCKDB_V2_ERROR hs_bindgen_9a6452902b78eae7 ("
+  , "  duckdb_v2_aggregate_function_handle arg1,"
+  , "  duckdb_v2_aggregate_function_bind_callback_fn arg2,"
+  , "  duckdb_v2_error_info_handle *arg3"
+  , ")"
+  , "{"
+  , "  return (duckdb_v2_aggregate_function_set_bind_callback)(arg1, arg2, arg3);"
+  , "}"
+  , "DUCKDB_V2_ERROR hs_bindgen_5a532af8d9e4bcf8 ("
+  , "  duckdb_v2_aggregate_function_handle arg1,"
+  , "  duckdb_v2_aggregate_function_size_callback_fn arg2,"
+  , "  duckdb_v2_error_info_handle *arg3"
+  , ")"
+  , "{"
+  , "  return (duckdb_v2_aggregate_function_set_size_callback)(arg1, arg2, arg3);"
+  , "}"
+  , "DUCKDB_V2_ERROR hs_bindgen_20e557f15bb18397 ("
+  , "  duckdb_v2_aggregate_function_handle arg1,"
+  , "  duckdb_v2_aggregate_function_init_callback_fn arg2,"
+  , "  duckdb_v2_error_info_handle *arg3"
+  , ")"
+  , "{"
+  , "  return (duckdb_v2_aggregate_function_set_init_callback)(arg1, arg2, arg3);"
+  , "}"
+  , "DUCKDB_V2_ERROR hs_bindgen_f941c706b3c71e2e ("
+  , "  duckdb_v2_aggregate_function_handle arg1,"
+  , "  duckdb_v2_aggregate_function_update_callback_fn arg2,"
+  , "  duckdb_v2_error_info_handle *arg3"
+  , ")"
+  , "{"
+  , "  return (duckdb_v2_aggregate_function_set_update_callback)(arg1, arg2, arg3);"
+  , "}"
+  , "DUCKDB_V2_ERROR hs_bindgen_30f6675842bc34bf ("
+  , "  duckdb_v2_aggregate_function_handle arg1,"
+  , "  duckdb_v2_aggregate_function_combine_callback_fn arg2,"
+  , "  duckdb_v2_error_info_handle *arg3"
+  , ")"
+  , "{"
+  , "  return (duckdb_v2_aggregate_function_set_combine_callback)(arg1, arg2, arg3);"
+  , "}"
+  , "DUCKDB_V2_ERROR hs_bindgen_1f0a84d781cdf63b ("
+  , "  duckdb_v2_aggregate_function_handle arg1,"
+  , "  duckdb_v2_aggregate_function_finalize_callback_fn arg2,"
+  , "  duckdb_v2_error_info_handle *arg3"
+  , ")"
+  , "{"
+  , "  return (duckdb_v2_aggregate_function_set_finalize_callback)(arg1, arg2, arg3);"
+  , "}"
+  , "DUCKDB_V2_ERROR hs_bindgen_1384b088054cd4f3 ("
+  , "  duckdb_v2_aggregate_function_handle arg1,"
+  , "  duckdb_v2_aggregate_function_destroy_callback_fn arg2,"
+  , "  duckdb_v2_error_info_handle *arg3"
+  , ")"
+  , "{"
+  , "  return (duckdb_v2_aggregate_function_set_destroy_callback)(arg1, arg2, arg3);"
+  , "}"
+  , "DUCKDB_V2_ERROR hs_bindgen_68dbe2a8ba129a0c ("
+  , "  duckdb_v2_aggregate_function_bind_info_handle arg1,"
+  , "  duckdb_v2_logical_type_handle arg2,"
+  , "  duckdb_v2_error_info_handle *arg3"
+  , ")"
+  , "{"
+  , "  return (duckdb_v2_aggregate_function_bind_set_return_type)(arg1, arg2, arg3);"
+  , "}"
+  , "DUCKDB_V2_ERROR hs_bindgen_54889afe4c039009 ("
+  , "  duckdb_v2_aggregate_function_size_info_handle arg1,"
+  , "  void **arg2,"
+  , "  duckdb_v2_error_info_handle *arg3"
+  , ")"
+  , "{"
+  , "  return (duckdb_v2_aggregate_function_size_get_user_data)(arg1, arg2, arg3);"
+  , "}"
+  , "DUCKDB_V2_ERROR hs_bindgen_21da38c7c236eafe ("
+  , "  duckdb_v2_aggregate_function_size_info_handle arg1,"
+  , "  void **arg2,"
+  , "  duckdb_v2_error_info_handle *arg3"
+  , ")"
+  , "{"
+  , "  return (duckdb_v2_aggregate_function_size_get_bind_data)(arg1, arg2, arg3);"
+  , "}"
+  , "DUCKDB_V2_ERROR hs_bindgen_8574517b46d6d782 ("
+  , "  duckdb_v2_aggregate_function_size_info_handle arg1,"
+  , "  idx_t arg2,"
+  , "  duckdb_v2_error_info_handle *arg3"
+  , ")"
+  , "{"
+  , "  return (duckdb_v2_aggregate_function_size_set_state_size)(arg1, arg2, arg3);"
+  , "}"
+  , "DUCKDB_V2_ERROR hs_bindgen_632c73c824a0d9e4 ("
+  , "  duckdb_v2_aggregate_function_init_info_handle arg1,"
+  , "  void **arg2,"
+  , "  duckdb_v2_error_info_handle *arg3"
+  , ")"
+  , "{"
+  , "  return (duckdb_v2_aggregate_function_init_get_user_data)(arg1, arg2, arg3);"
+  , "}"
+  , "DUCKDB_V2_ERROR hs_bindgen_1722d0f33fe0a35d ("
+  , "  duckdb_v2_aggregate_function_init_info_handle arg1,"
+  , "  void **arg2,"
+  , "  duckdb_v2_error_info_handle *arg3"
+  , ")"
+  , "{"
+  , "  return (duckdb_v2_aggregate_function_init_get_bind_data)(arg1, arg2, arg3);"
+  , "}"
+  , "DUCKDB_V2_ERROR hs_bindgen_90692f4406391c34 ("
+  , "  duckdb_v2_aggregate_function_init_info_handle arg1,"
+  , "  idx_t *arg2,"
+  , "  duckdb_v2_error_info_handle *arg3"
+  , ")"
+  , "{"
+  , "  return (duckdb_v2_aggregate_function_init_get_state_count)(arg1, arg2, arg3);"
+  , "}"
+  , "DUCKDB_V2_ERROR hs_bindgen_60b65f5dc431c2ca ("
+  , "  duckdb_v2_aggregate_function_init_info_handle arg1,"
+  , "  void ***arg2,"
+  , "  duckdb_v2_error_info_handle *arg3"
+  , ")"
+  , "{"
+  , "  return (duckdb_v2_aggregate_function_init_get_states)(arg1, arg2, arg3);"
+  , "}"
+  , "DUCKDB_V2_ERROR hs_bindgen_ab277c38ab0400e0 ("
+  , "  duckdb_v2_aggregate_function_update_info_handle arg1,"
+  , "  void **arg2,"
+  , "  duckdb_v2_error_info_handle *arg3"
+  , ")"
+  , "{"
+  , "  return (duckdb_v2_aggregate_function_update_get_user_data)(arg1, arg2, arg3);"
+  , "}"
+  , "DUCKDB_V2_ERROR hs_bindgen_fcf1bef32339fe0f ("
+  , "  duckdb_v2_aggregate_function_update_info_handle arg1,"
+  , "  void **arg2,"
+  , "  duckdb_v2_error_info_handle *arg3"
+  , ")"
+  , "{"
+  , "  return (duckdb_v2_aggregate_function_update_get_bind_data)(arg1, arg2, arg3);"
+  , "}"
+  , "DUCKDB_V2_ERROR hs_bindgen_fae4da92d121adb1 ("
+  , "  duckdb_v2_aggregate_function_update_info_handle arg1,"
+  , "  idx_t *arg2,"
+  , "  duckdb_v2_error_info_handle *arg3"
+  , ")"
+  , "{"
+  , "  return (duckdb_v2_aggregate_function_update_get_row_count)(arg1, arg2, arg3);"
+  , "}"
+  , "DUCKDB_V2_ERROR hs_bindgen_ff26144b83dfadcf ("
+  , "  duckdb_v2_aggregate_function_update_info_handle arg1,"
+  , "  idx_t *arg2,"
+  , "  idx_t *arg3,"
+  , "  idx_t *arg4,"
+  , "  idx_t *arg5,"
+  , "  duckdb_v2_error_info_handle *arg6"
+  , ")"
+  , "{"
+  , "  return (duckdb_v2_aggregate_function_update_get_arg_count)(arg1, arg2, arg3, arg4, arg5, arg6);"
+  , "}"
+  , "DUCKDB_V2_ERROR hs_bindgen_956340ebc344a3d1 ("
+  , "  duckdb_v2_aggregate_function_update_info_handle arg1,"
+  , "  idx_t arg2,"
+  , "  duckdb_v2_vector_handle *arg3,"
+  , "  duckdb_v2_error_info_handle *arg4"
+  , ")"
+  , "{"
+  , "  return (duckdb_v2_aggregate_function_update_get_arg)(arg1, arg2, arg3, arg4);"
+  , "}"
+  , "DUCKDB_V2_ERROR hs_bindgen_23c8a2f6274d7f13 ("
+  , "  duckdb_v2_aggregate_function_update_info_handle arg1,"
+  , "  void ***arg2,"
+  , "  duckdb_v2_error_info_handle *arg3"
+  , ")"
+  , "{"
+  , "  return (duckdb_v2_aggregate_function_update_get_states)(arg1, arg2, arg3);"
+  , "}"
+  , "DUCKDB_V2_ERROR hs_bindgen_0ba10b8aedb08052 ("
+  , "  duckdb_v2_aggregate_function_combine_info_handle arg1,"
+  , "  void **arg2,"
+  , "  duckdb_v2_error_info_handle *arg3"
+  , ")"
+  , "{"
+  , "  return (duckdb_v2_aggregate_function_combine_get_user_data)(arg1, arg2, arg3);"
+  , "}"
+  , "DUCKDB_V2_ERROR hs_bindgen_c8c4df64367a3503 ("
+  , "  duckdb_v2_aggregate_function_combine_info_handle arg1,"
+  , "  void **arg2,"
+  , "  duckdb_v2_error_info_handle *arg3"
+  , ")"
+  , "{"
+  , "  return (duckdb_v2_aggregate_function_combine_get_bind_data)(arg1, arg2, arg3);"
+  , "}"
+  , "DUCKDB_V2_ERROR hs_bindgen_a4a77d26f51774e4 ("
+  , "  duckdb_v2_aggregate_function_combine_info_handle arg1,"
+  , "  idx_t *arg2,"
+  , "  duckdb_v2_error_info_handle *arg3"
+  , ")"
+  , "{"
+  , "  return (duckdb_v2_aggregate_function_combine_get_state_count)(arg1, arg2, arg3);"
+  , "}"
+  , "DUCKDB_V2_ERROR hs_bindgen_2987ded318e1f1db ("
+  , "  duckdb_v2_aggregate_function_combine_info_handle arg1,"
+  , "  void ***arg2,"
+  , "  duckdb_v2_error_info_handle *arg3"
+  , ")"
+  , "{"
+  , "  return (duckdb_v2_aggregate_function_combine_get_sources)(arg1, arg2, arg3);"
+  , "}"
+  , "DUCKDB_V2_ERROR hs_bindgen_6f9c2484ce7951d9 ("
+  , "  duckdb_v2_aggregate_function_combine_info_handle arg1,"
+  , "  void ***arg2,"
+  , "  duckdb_v2_error_info_handle *arg3"
+  , ")"
+  , "{"
+  , "  return (duckdb_v2_aggregate_function_combine_get_targets)(arg1, arg2, arg3);"
+  , "}"
+  , "DUCKDB_V2_ERROR hs_bindgen_4551399ab145cb9f ("
+  , "  duckdb_v2_aggregate_function_finalize_info_handle arg1,"
+  , "  void **arg2,"
+  , "  duckdb_v2_error_info_handle *arg3"
+  , ")"
+  , "{"
+  , "  return (duckdb_v2_aggregate_function_finalize_get_user_data)(arg1, arg2, arg3);"
+  , "}"
+  , "DUCKDB_V2_ERROR hs_bindgen_911b6b58312bcd71 ("
+  , "  duckdb_v2_aggregate_function_finalize_info_handle arg1,"
+  , "  void **arg2,"
+  , "  duckdb_v2_error_info_handle *arg3"
+  , ")"
+  , "{"
+  , "  return (duckdb_v2_aggregate_function_finalize_get_bind_data)(arg1, arg2, arg3);"
+  , "}"
+  , "DUCKDB_V2_ERROR hs_bindgen_ce017d7afc4fee25 ("
+  , "  duckdb_v2_aggregate_function_finalize_info_handle arg1,"
+  , "  idx_t *arg2,"
+  , "  duckdb_v2_error_info_handle *arg3"
+  , ")"
+  , "{"
+  , "  return (duckdb_v2_aggregate_function_finalize_get_state_count)(arg1, arg2, arg3);"
+  , "}"
+  , "DUCKDB_V2_ERROR hs_bindgen_65d33d4acafc8a49 ("
+  , "  duckdb_v2_aggregate_function_finalize_info_handle arg1,"
+  , "  void ***arg2,"
+  , "  duckdb_v2_error_info_handle *arg3"
+  , ")"
+  , "{"
+  , "  return (duckdb_v2_aggregate_function_finalize_get_states)(arg1, arg2, arg3);"
+  , "}"
+  , "DUCKDB_V2_ERROR hs_bindgen_6461ecbe1586fbe2 ("
+  , "  duckdb_v2_aggregate_function_finalize_info_handle arg1,"
+  , "  duckdb_v2_vector_handle *arg2,"
+  , "  duckdb_v2_error_info_handle *arg3"
+  , ")"
+  , "{"
+  , "  return (duckdb_v2_aggregate_function_finalize_get_result)(arg1, arg2, arg3);"
+  , "}"
+  , "DUCKDB_V2_ERROR hs_bindgen_21966eba6ecbf203 ("
+  , "  duckdb_v2_aggregate_function_finalize_info_handle arg1,"
+  , "  idx_t *arg2,"
+  , "  duckdb_v2_error_info_handle *arg3"
+  , ")"
+  , "{"
+  , "  return (duckdb_v2_aggregate_function_finalize_get_result_offset)(arg1, arg2, arg3);"
+  , "}"
+  , "DUCKDB_V2_ERROR hs_bindgen_0a5215fdc2ad0556 ("
+  , "  duckdb_v2_aggregate_function_destroy_info_handle arg1,"
+  , "  void **arg2,"
+  , "  duckdb_v2_error_info_handle *arg3"
+  , ")"
+  , "{"
+  , "  return (duckdb_v2_aggregate_function_destroy_get_user_data)(arg1, arg2, arg3);"
+  , "}"
+  , "DUCKDB_V2_ERROR hs_bindgen_496b2f57d5f5295c ("
+  , "  duckdb_v2_aggregate_function_destroy_info_handle arg1,"
+  , "  void **arg2,"
+  , "  duckdb_v2_error_info_handle *arg3"
+  , ")"
+  , "{"
+  , "  return (duckdb_v2_aggregate_function_destroy_get_bind_data)(arg1, arg2, arg3);"
+  , "}"
+  , "DUCKDB_V2_ERROR hs_bindgen_2de1505847e7b0d1 ("
+  , "  duckdb_v2_aggregate_function_destroy_info_handle arg1,"
+  , "  idx_t *arg2,"
+  , "  duckdb_v2_error_info_handle *arg3"
+  , ")"
+  , "{"
+  , "  return (duckdb_v2_aggregate_function_destroy_get_state_count)(arg1, arg2, arg3);"
+  , "}"
+  , "DUCKDB_V2_ERROR hs_bindgen_50bb744b724818a5 ("
+  , "  duckdb_v2_aggregate_function_destroy_info_handle arg1,"
+  , "  void ***arg2,"
+  , "  duckdb_v2_error_info_handle *arg3"
+  , ")"
+  , "{"
+  , "  return (duckdb_v2_aggregate_function_destroy_get_states)(arg1, arg2, arg3);"
+  , "}"
+  , "DUCKDB_V2_ERROR hs_bindgen_a8317136cc0e9f77 ("
+  , "  duckdb_v2_connection_handle arg1,"
+  , "  duckdb_v2_aggregate_function_handle arg2,"
+  , "  duckdb_v2_error_info_handle *arg3"
+  , ")"
+  , "{"
+  , "  return (duckdb_v2_connection_register_aggregate_function)(arg1, arg2, arg3);"
+  , "}"
+  , "DUCKDB_V2_ERROR hs_bindgen_8fd37fe935e348db ("
+  , "  duckdb_v2_extension_handle arg1,"
+  , "  duckdb_v2_aggregate_function_handle arg2,"
+  , "  duckdb_v2_error_info_handle *arg3"
+  , ")"
+  , "{"
+  , "  return (duckdb_v2_extension_register_aggregate_function)(arg1, arg2, arg3);"
+  , "}"
+  , "DUCKDB_V2_ERROR hs_bindgen_924c3d4d25c5d198 ("
+  , "  duckdb_v2_aggregate_function_handle *arg1"
+  , ")"
+  , "{"
+  , "  return (duckdb_v2_aggregate_function_destroy)(arg1);"
+  , "}"
+  , "DUCKDB_V2_ERROR hs_bindgen_66fecc41919077b0 ("
+  , "  duckdb_v2_connection_handle arg1,"
+  , "  duckdb_v2_qname_handle arg2,"
+  , "  duckdb_v2_table_description_handle *arg3,"
+  , "  duckdb_v2_error_info_handle *arg4"
+  , ")"
+  , "{"
+  , "  return (duckdb_v2_connection_describe_table)(arg1, arg2, arg3, arg4);"
+  , "}"
+  , "DUCKDB_V2_ERROR hs_bindgen_e1e1723713423fb0 ("
+  , "  duckdb_v2_table_description_handle arg1,"
+  , "  duckdb_v2_qname_handle *arg2,"
+  , "  duckdb_v2_error_info_handle *arg3"
+  , ")"
+  , "{"
+  , "  return (duckdb_v2_table_description_get_qname)(arg1, arg2, arg3);"
+  , "}"
+  , "DUCKDB_V2_ERROR hs_bindgen_77eaaf8183d9fdb1 ("
+  , "  duckdb_v2_table_description_handle arg1,"
+  , "  _Bool *arg2,"
+  , "  duckdb_v2_error_info_handle *arg3"
+  , ")"
+  , "{"
+  , "  return (duckdb_v2_table_description_is_readonly)(arg1, arg2, arg3);"
+  , "}"
+  , "DUCKDB_V2_ERROR hs_bindgen_39447e03d9f1d155 ("
+  , "  duckdb_v2_table_description_handle arg1,"
+  , "  idx_t *arg2,"
+  , "  duckdb_v2_error_info_handle *arg3"
+  , ")"
+  , "{"
+  , "  return (duckdb_v2_table_description_get_column_count)(arg1, arg2, arg3);"
+  , "}"
+  , "DUCKDB_V2_ERROR hs_bindgen_3fab6b1834ba9570 ("
+  , "  duckdb_v2_table_description_handle arg1,"
+  , "  idx_t arg2,"
+  , "  duckdb_v2_column_description_handle *arg3,"
+  , "  duckdb_v2_error_info_handle *arg4"
+  , ")"
+  , "{"
+  , "  return (duckdb_v2_table_description_get_column)(arg1, arg2, arg3, arg4);"
+  , "}"
+  , "DUCKDB_V2_ERROR hs_bindgen_503d9b718ec6652d ("
+  , "  duckdb_v2_table_description_handle *arg1"
+  , ")"
+  , "{"
+  , "  return (duckdb_v2_table_description_destroy)(arg1);"
+  , "}"
+  , "DUCKDB_V2_ERROR hs_bindgen_4e5323a1f0159c54 ("
+  , "  duckdb_v2_column_description_handle arg1,"
+  , "  duckdb_v2_identifier_t *arg2,"
+  , "  duckdb_v2_error_info_handle *arg3"
+  , ")"
+  , "{"
+  , "  return (duckdb_v2_column_description_get_name)(arg1, arg2, arg3);"
+  , "}"
+  , "DUCKDB_V2_ERROR hs_bindgen_76c4fc89924dbc4f ("
+  , "  duckdb_v2_column_description_handle arg1,"
+  , "  duckdb_v2_logical_type_handle *arg2,"
+  , "  duckdb_v2_error_info_handle *arg3"
+  , ")"
+  , "{"
+  , "  return (duckdb_v2_column_description_get_type)(arg1, arg2, arg3);"
+  , "}"
+  , "DUCKDB_V2_ERROR hs_bindgen_cb70a2fa3379aed9 ("
+  , "  duckdb_v2_column_description_handle arg1,"
+  , "  _Bool *arg2,"
+  , "  duckdb_v2_error_info_handle *arg3"
+  , ")"
+  , "{"
+  , "  return (duckdb_v2_column_description_has_default)(arg1, arg2, arg3);"
+  , "}"
+  , "DUCKDB_V2_ERROR hs_bindgen_1d6a7a57a7a76147 ("
+  , "  duckdb_v2_column_description_handle arg1,"
+  , "  _Bool *arg2,"
+  , "  duckdb_v2_error_info_handle *arg3"
+  , ")"
+  , "{"
+  , "  return (duckdb_v2_column_description_has_generated)(arg1, arg2, arg3);"
+  , "}"
+  , "DUCKDB_V2_ERROR hs_bindgen_4ec962f4910944a5 ("
+  , "  duckdb_v2_column_description_handle *arg1"
+  , ")"
+  , "{"
+  , "  return (duckdb_v2_column_description_destroy)(arg1);"
+  , "}"
+  , "DUCKDB_V2_ERROR hs_bindgen_5a22fa811ee59c70 ("
+  , "  duckdb_v2_factory_handle arg1,"
+  , "  duckdb_v2_copy_function_handle *arg2,"
+  , "  duckdb_v2_error_info_handle *arg3"
+  , ")"
+  , "{"
+  , "  return (duckdb_v2_copy_function_create)(arg1, arg2, arg3);"
+  , "}"
+  , "DUCKDB_V2_ERROR hs_bindgen_c82d1052e04727af ("
+  , "  duckdb_v2_copy_function_handle arg1,"
+  , "  duckdb_v2_identifier_t const *arg2,"
+  , "  duckdb_v2_error_info_handle *arg3"
+  , ")"
+  , "{"
+  , "  return (duckdb_v2_copy_function_set_name)(arg1, arg2, arg3);"
+  , "}"
+  , "DUCKDB_V2_ERROR hs_bindgen_896e694dbb437dc4 ("
+  , "  duckdb_v2_copy_function_handle arg1,"
+  , "  duckdb_v2_str const *arg2,"
+  , "  duckdb_v2_error_info_handle *arg3"
+  , ")"
+  , "{"
+  , "  return (duckdb_v2_copy_function_set_file_extension)(arg1, arg2, arg3);"
+  , "}"
+  , "DUCKDB_V2_ERROR hs_bindgen_137b1aa7a6c369c3 ("
+  , "  duckdb_v2_copy_function_handle arg1,"
+  , "  duckdb_v2_opaque *arg2,"
+  , "  duckdb_v2_error_info_handle *arg3"
+  , ")"
+  , "{"
+  , "  return (duckdb_v2_copy_function_set_user_data)(arg1, arg2, arg3);"
+  , "}"
+  , "DUCKDB_V2_ERROR hs_bindgen_3f0c177697bfd8ee ("
+  , "  duckdb_v2_copy_function_handle arg1,"
+  , "  duckdb_v2_copy_to_bind_callback_fn arg2,"
+  , "  duckdb_v2_error_info_handle *arg3"
+  , ")"
+  , "{"
+  , "  return (duckdb_v2_copy_to_set_bind_callback)(arg1, arg2, arg3);"
+  , "}"
+  , "DUCKDB_V2_ERROR hs_bindgen_2d899e01b43de8e2 ("
+  , "  duckdb_v2_copy_function_handle arg1,"
+  , "  duckdb_v2_copy_to_batch_size_callback_fn arg2,"
+  , "  duckdb_v2_error_info_handle *arg3"
+  , ")"
+  , "{"
+  , "  return (duckdb_v2_copy_to_set_batch_size_callback)(arg1, arg2, arg3);"
+  , "}"
+  , "DUCKDB_V2_ERROR hs_bindgen_3b90b0509edc4ee0 ("
+  , "  duckdb_v2_copy_function_handle arg1,"
+  , "  duckdb_v2_copy_to_init_callback_fn arg2,"
+  , "  duckdb_v2_error_info_handle *arg3"
+  , ")"
+  , "{"
+  , "  return (duckdb_v2_copy_to_set_init_callback)(arg1, arg2, arg3);"
+  , "}"
+  , "DUCKDB_V2_ERROR hs_bindgen_f5c52f827520706b ("
+  , "  duckdb_v2_copy_function_handle arg1,"
+  , "  duckdb_v2_copy_to_batch_callback_fn arg2,"
+  , "  duckdb_v2_error_info_handle *arg3"
+  , ")"
+  , "{"
+  , "  return (duckdb_v2_copy_to_set_batch_callback)(arg1, arg2, arg3);"
+  , "}"
+  , "DUCKDB_V2_ERROR hs_bindgen_64029a2d5ef70633 ("
+  , "  duckdb_v2_copy_function_handle arg1,"
+  , "  duckdb_v2_copy_to_flush_callback_fn arg2,"
+  , "  duckdb_v2_error_info_handle *arg3"
+  , ")"
+  , "{"
+  , "  return (duckdb_v2_copy_to_set_flush_callback)(arg1, arg2, arg3);"
+  , "}"
+  , "DUCKDB_V2_ERROR hs_bindgen_596a08db4e0079c3 ("
+  , "  duckdb_v2_copy_function_handle arg1,"
+  , "  duckdb_v2_copy_to_finalize_callback_fn arg2,"
+  , "  duckdb_v2_error_info_handle *arg3"
+  , ")"
+  , "{"
+  , "  return (duckdb_v2_copy_to_set_finalize_callback)(arg1, arg2, arg3);"
+  , "}"
+  , "DUCKDB_V2_ERROR hs_bindgen_eb0ea355c070737c ("
+  , "  duckdb_v2_copy_to_bind_info_handle arg1,"
+  , "  void **arg2,"
+  , "  duckdb_v2_error_info_handle *arg3"
+  , ")"
+  , "{"
+  , "  return (duckdb_v2_copy_to_bind_get_user_data)(arg1, arg2, arg3);"
+  , "}"
+  , "DUCKDB_V2_ERROR hs_bindgen_844d7a894ae769fb ("
+  , "  duckdb_v2_copy_to_bind_info_handle arg1,"
+  , "  duckdb_v2_opaque *arg2,"
+  , "  duckdb_v2_error_info_handle *arg3"
+  , ")"
+  , "{"
+  , "  return (duckdb_v2_copy_to_bind_set_bind_data)(arg1, arg2, arg3);"
+  , "}"
+  , "DUCKDB_V2_ERROR hs_bindgen_e18f5ba81ede3548 ("
+  , "  duckdb_v2_copy_to_bind_info_handle arg1,"
+  , "  duckdb_v2_str *arg2,"
+  , "  duckdb_v2_error_info_handle *arg3"
+  , ")"
+  , "{"
+  , "  return (duckdb_v2_copy_to_bind_get_file_path)(arg1, arg2, arg3);"
+  , "}"
+  , "DUCKDB_V2_ERROR hs_bindgen_4a6f50ee26628014 ("
+  , "  duckdb_v2_copy_to_bind_info_handle arg1,"
+  , "  idx_t *arg2,"
+  , "  duckdb_v2_error_info_handle *arg3"
+  , ")"
+  , "{"
+  , "  return (duckdb_v2_copy_to_bind_get_column_count)(arg1, arg2, arg3);"
+  , "}"
+  , "DUCKDB_V2_ERROR hs_bindgen_f25197ced57faa9a ("
+  , "  duckdb_v2_copy_to_bind_info_handle arg1,"
+  , "  idx_t arg2,"
+  , "  duckdb_v2_logical_type_handle *arg3,"
+  , "  duckdb_v2_error_info_handle *arg4"
+  , ")"
+  , "{"
+  , "  return (duckdb_v2_copy_to_bind_get_column_type)(arg1, arg2, arg3, arg4);"
+  , "}"
+  , "DUCKDB_V2_ERROR hs_bindgen_cfeec59f624c4d87 ("
+  , "  duckdb_v2_copy_to_bind_info_handle arg1,"
+  , "  idx_t arg2,"
+  , "  duckdb_v2_identifier_t *arg3,"
+  , "  duckdb_v2_error_info_handle *arg4"
+  , ")"
+  , "{"
+  , "  return (duckdb_v2_copy_to_bind_get_column_name)(arg1, arg2, arg3, arg4);"
+  , "}"
+  , "DUCKDB_V2_ERROR hs_bindgen_714b1ca5c3311fac ("
+  , "  duckdb_v2_copy_to_bind_info_handle arg1,"
+  , "  idx_t *arg2,"
+  , "  duckdb_v2_error_info_handle *arg3"
+  , ")"
+  , "{"
+  , "  return (duckdb_v2_copy_to_bind_get_option_count)(arg1, arg2, arg3);"
+  , "}"
+  , "DUCKDB_V2_ERROR hs_bindgen_fc830fb6ed393ca6 ("
+  , "  duckdb_v2_copy_to_bind_info_handle arg1,"
+  , "  idx_t arg2,"
+  , "  duckdb_v2_identifier_t *arg3,"
+  , "  duckdb_v2_error_info_handle *arg4"
+  , ")"
+  , "{"
+  , "  return (duckdb_v2_copy_to_bind_get_option_name)(arg1, arg2, arg3, arg4);"
+  , "}"
+  , "DUCKDB_V2_ERROR hs_bindgen_80058144eba82b8a ("
+  , "  duckdb_v2_copy_to_bind_info_handle arg1,"
+  , "  idx_t arg2,"
+  , "  duckdb_v2_value_handle *arg3,"
+  , "  duckdb_v2_error_info_handle *arg4"
+  , ")"
+  , "{"
+  , "  return (duckdb_v2_copy_to_bind_get_option_value)(arg1, arg2, arg3, arg4);"
+  , "}"
+  , "DUCKDB_V2_ERROR hs_bindgen_2f5eebf6f95a9505 ("
+  , "  duckdb_v2_copy_to_batch_size_info_handle arg1,"
+  , "  void **arg2,"
+  , "  duckdb_v2_error_info_handle *arg3"
+  , ")"
+  , "{"
+  , "  return (duckdb_v2_copy_to_batch_size_get_user_data)(arg1, arg2, arg3);"
+  , "}"
+  , "DUCKDB_V2_ERROR hs_bindgen_5d8c7f87d651ec5a ("
+  , "  duckdb_v2_copy_to_batch_size_info_handle arg1,"
+  , "  void **arg2,"
+  , "  duckdb_v2_error_info_handle *arg3"
+  , ")"
+  , "{"
+  , "  return (duckdb_v2_copy_to_batch_size_get_bind_data)(arg1, arg2, arg3);"
+  , "}"
+  , "DUCKDB_V2_ERROR hs_bindgen_66061bf318aef235 ("
+  , "  duckdb_v2_copy_to_batch_size_info_handle arg1,"
+  , "  idx_t arg2,"
+  , "  duckdb_v2_error_info_handle *arg3"
+  , ")"
+  , "{"
+  , "  return (duckdb_v2_copy_to_batch_size_set_target)(arg1, arg2, arg3);"
+  , "}"
+  , "DUCKDB_V2_ERROR hs_bindgen_017a284bf00d390f ("
+  , "  duckdb_v2_copy_to_init_info_handle arg1,"
+  , "  void **arg2,"
+  , "  duckdb_v2_error_info_handle *arg3"
+  , ")"
+  , "{"
+  , "  return (duckdb_v2_copy_to_init_get_user_data)(arg1, arg2, arg3);"
+  , "}"
+  , "DUCKDB_V2_ERROR hs_bindgen_33d2e5ca775e0165 ("
+  , "  duckdb_v2_copy_to_init_info_handle arg1,"
+  , "  void **arg2,"
+  , "  duckdb_v2_error_info_handle *arg3"
+  , ")"
+  , "{"
+  , "  return (duckdb_v2_copy_to_init_get_bind_data)(arg1, arg2, arg3);"
+  , "}"
+  , "DUCKDB_V2_ERROR hs_bindgen_2a1da2e88945b462 ("
+  , "  duckdb_v2_copy_to_init_info_handle arg1,"
+  , "  duckdb_v2_str *arg2,"
+  , "  duckdb_v2_error_info_handle *arg3"
+  , ")"
+  , "{"
+  , "  return (duckdb_v2_copy_to_init_get_file_path)(arg1, arg2, arg3);"
+  , "}"
+  , "DUCKDB_V2_ERROR hs_bindgen_2aea517dbce1d596 ("
+  , "  duckdb_v2_copy_to_init_info_handle arg1,"
+  , "  duckdb_v2_opaque *arg2,"
+  , "  duckdb_v2_error_info_handle *arg3"
+  , ")"
+  , "{"
+  , "  return (duckdb_v2_copy_to_init_set_init_data)(arg1, arg2, arg3);"
+  , "}"
+  , "DUCKDB_V2_ERROR hs_bindgen_7aec697d75a762bd ("
+  , "  duckdb_v2_copy_to_batch_info_handle arg1,"
+  , "  void **arg2,"
+  , "  duckdb_v2_error_info_handle *arg3"
+  , ")"
+  , "{"
+  , "  return (duckdb_v2_copy_to_batch_get_user_data)(arg1, arg2, arg3);"
+  , "}"
+  , "DUCKDB_V2_ERROR hs_bindgen_b3998087abd3a493 ("
+  , "  duckdb_v2_copy_to_batch_info_handle arg1,"
+  , "  void **arg2,"
+  , "  duckdb_v2_error_info_handle *arg3"
+  , ")"
+  , "{"
+  , "  return (duckdb_v2_copy_to_batch_get_bind_data)(arg1, arg2, arg3);"
+  , "}"
+  , "DUCKDB_V2_ERROR hs_bindgen_cc14f2e9a70dfd4b ("
+  , "  duckdb_v2_copy_to_batch_info_handle arg1,"
+  , "  void **arg2,"
+  , "  duckdb_v2_error_info_handle *arg3"
+  , ")"
+  , "{"
+  , "  return (duckdb_v2_copy_to_batch_get_init_data)(arg1, arg2, arg3);"
+  , "}"
+  , "DUCKDB_V2_ERROR hs_bindgen_edbfcefd6244b718 ("
+  , "  duckdb_v2_copy_to_batch_info_handle arg1,"
+  , "  duckdb_v2_column_data_collection_handle *arg2,"
+  , "  duckdb_v2_error_info_handle *arg3"
+  , ")"
+  , "{"
+  , "  return (duckdb_v2_copy_to_batch_take_input)(arg1, arg2, arg3);"
+  , "}"
+  , "DUCKDB_V2_ERROR hs_bindgen_11da5d2fd6040855 ("
+  , "  duckdb_v2_copy_to_batch_info_handle arg1,"
+  , "  duckdb_v2_opaque *arg2,"
+  , "  duckdb_v2_error_info_handle *arg3"
+  , ")"
+  , "{"
+  , "  return (duckdb_v2_copy_to_batch_set_batch_data)(arg1, arg2, arg3);"
+  , "}"
+  , "DUCKDB_V2_ERROR hs_bindgen_ab56a26ee665070d ("
+  , "  duckdb_v2_copy_to_flush_info_handle arg1,"
+  , "  void **arg2,"
+  , "  duckdb_v2_error_info_handle *arg3"
+  , ")"
+  , "{"
+  , "  return (duckdb_v2_copy_to_flush_get_user_data)(arg1, arg2, arg3);"
+  , "}"
+  , "DUCKDB_V2_ERROR hs_bindgen_5a6ebe126ac99497 ("
+  , "  duckdb_v2_copy_to_flush_info_handle arg1,"
+  , "  void **arg2,"
+  , "  duckdb_v2_error_info_handle *arg3"
+  , ")"
+  , "{"
+  , "  return (duckdb_v2_copy_to_flush_get_bind_data)(arg1, arg2, arg3);"
+  , "}"
+  , "DUCKDB_V2_ERROR hs_bindgen_1a0fbeb347a0d040 ("
+  , "  duckdb_v2_copy_to_flush_info_handle arg1,"
+  , "  void **arg2,"
+  , "  duckdb_v2_error_info_handle *arg3"
+  , ")"
+  , "{"
+  , "  return (duckdb_v2_copy_to_flush_get_init_data)(arg1, arg2, arg3);"
+  , "}"
+  , "DUCKDB_V2_ERROR hs_bindgen_8cd2b2480c2e9d70 ("
+  , "  duckdb_v2_copy_to_flush_info_handle arg1,"
+  , "  void **arg2,"
+  , "  duckdb_v2_error_info_handle *arg3"
+  , ")"
+  , "{"
+  , "  return (duckdb_v2_copy_to_flush_get_batch_data)(arg1, arg2, arg3);"
+  , "}"
+  , "DUCKDB_V2_ERROR hs_bindgen_81cb7ace0ca893de ("
+  , "  duckdb_v2_copy_to_finalize_info_handle arg1,"
+  , "  void **arg2,"
+  , "  duckdb_v2_error_info_handle *arg3"
+  , ")"
+  , "{"
+  , "  return (duckdb_v2_copy_to_finalize_get_user_data)(arg1, arg2, arg3);"
+  , "}"
+  , "DUCKDB_V2_ERROR hs_bindgen_eab24c449e5e48d9 ("
+  , "  duckdb_v2_copy_to_finalize_info_handle arg1,"
+  , "  void **arg2,"
+  , "  duckdb_v2_error_info_handle *arg3"
+  , ")"
+  , "{"
+  , "  return (duckdb_v2_copy_to_finalize_get_bind_data)(arg1, arg2, arg3);"
+  , "}"
+  , "DUCKDB_V2_ERROR hs_bindgen_1728693bccaabc9f ("
+  , "  duckdb_v2_copy_to_finalize_info_handle arg1,"
+  , "  void **arg2,"
+  , "  duckdb_v2_error_info_handle *arg3"
+  , ")"
+  , "{"
+  , "  return (duckdb_v2_copy_to_finalize_get_init_data)(arg1, arg2, arg3);"
+  , "}"
+  , "DUCKDB_V2_ERROR hs_bindgen_a7fa393848569792 ("
+  , "  duckdb_v2_copy_function_handle arg1,"
+  , "  duckdb_v2_copy_from_bind_callback_fn arg2,"
+  , "  duckdb_v2_error_info_handle *arg3"
+  , ")"
+  , "{"
+  , "  return (duckdb_v2_copy_from_set_bind_callback)(arg1, arg2, arg3);"
+  , "}"
+  , "DUCKDB_V2_ERROR hs_bindgen_96288a021a4369ed ("
+  , "  duckdb_v2_copy_function_handle arg1,"
+  , "  duckdb_v2_copy_from_init_global_callback_fn arg2,"
+  , "  duckdb_v2_error_info_handle *arg3"
+  , ")"
+  , "{"
+  , "  return (duckdb_v2_copy_from_set_init_global_callback)(arg1, arg2, arg3);"
+  , "}"
+  , "DUCKDB_V2_ERROR hs_bindgen_5045d8628a5d27fe ("
+  , "  duckdb_v2_copy_function_handle arg1,"
+  , "  duckdb_v2_copy_from_init_local_callback_fn arg2,"
+  , "  duckdb_v2_error_info_handle *arg3"
+  , ")"
+  , "{"
+  , "  return (duckdb_v2_copy_from_set_init_local_callback)(arg1, arg2, arg3);"
+  , "}"
+  , "DUCKDB_V2_ERROR hs_bindgen_cc2a55de291c0c0a ("
+  , "  duckdb_v2_copy_function_handle arg1,"
+  , "  duckdb_v2_copy_from_exec_callback_fn arg2,"
+  , "  duckdb_v2_error_info_handle *arg3"
+  , ")"
+  , "{"
+  , "  return (duckdb_v2_copy_from_set_exec_callback)(arg1, arg2, arg3);"
+  , "}"
+  , "DUCKDB_V2_ERROR hs_bindgen_bd43c3bdedce42fd ("
+  , "  duckdb_v2_copy_function_handle arg1,"
+  , "  duckdb_v2_copy_from_progress_callback_fn arg2,"
+  , "  duckdb_v2_error_info_handle *arg3"
+  , ")"
+  , "{"
+  , "  return (duckdb_v2_copy_from_set_progress_callback)(arg1, arg2, arg3);"
+  , "}"
+  , "DUCKDB_V2_ERROR hs_bindgen_919a7e52dfb4f754 ("
+  , "  duckdb_v2_copy_from_bind_info_handle arg1,"
+  , "  void **arg2,"
+  , "  duckdb_v2_error_info_handle *arg3"
+  , ")"
+  , "{"
+  , "  return (duckdb_v2_copy_from_bind_get_user_data)(arg1, arg2, arg3);"
+  , "}"
+  , "DUCKDB_V2_ERROR hs_bindgen_077251a9c46e448e ("
+  , "  duckdb_v2_copy_from_bind_info_handle arg1,"
+  , "  duckdb_v2_opaque *arg2,"
+  , "  duckdb_v2_error_info_handle *arg3"
+  , ")"
+  , "{"
+  , "  return (duckdb_v2_copy_from_bind_set_bind_data)(arg1, arg2, arg3);"
+  , "}"
+  , "DUCKDB_V2_ERROR hs_bindgen_0b754a2907b72d27 ("
+  , "  duckdb_v2_copy_from_bind_info_handle arg1,"
+  , "  duckdb_v2_str *arg2,"
+  , "  duckdb_v2_error_info_handle *arg3"
+  , ")"
+  , "{"
+  , "  return (duckdb_v2_copy_from_bind_get_file_path)(arg1, arg2, arg3);"
+  , "}"
+  , "DUCKDB_V2_ERROR hs_bindgen_6183f085d1045b62 ("
+  , "  duckdb_v2_copy_from_bind_info_handle arg1,"
+  , "  idx_t *arg2,"
+  , "  duckdb_v2_error_info_handle *arg3"
+  , ")"
+  , "{"
+  , "  return (duckdb_v2_copy_from_bind_get_column_count)(arg1, arg2, arg3);"
+  , "}"
+  , "DUCKDB_V2_ERROR hs_bindgen_3449290c4f64678d ("
+  , "  duckdb_v2_copy_from_bind_info_handle arg1,"
+  , "  idx_t arg2,"
+  , "  duckdb_v2_logical_type_handle *arg3,"
+  , "  duckdb_v2_error_info_handle *arg4"
+  , ")"
+  , "{"
+  , "  return (duckdb_v2_copy_from_bind_get_column_type)(arg1, arg2, arg3, arg4);"
+  , "}"
+  , "DUCKDB_V2_ERROR hs_bindgen_3684f9eaa4f328c5 ("
+  , "  duckdb_v2_copy_from_bind_info_handle arg1,"
+  , "  idx_t arg2,"
+  , "  duckdb_v2_identifier_t *arg3,"
+  , "  duckdb_v2_error_info_handle *arg4"
+  , ")"
+  , "{"
+  , "  return (duckdb_v2_copy_from_bind_get_column_name)(arg1, arg2, arg3, arg4);"
+  , "}"
+  , "DUCKDB_V2_ERROR hs_bindgen_a2d5f43b93427b87 ("
+  , "  duckdb_v2_copy_from_bind_info_handle arg1,"
+  , "  idx_t *arg2,"
+  , "  duckdb_v2_error_info_handle *arg3"
+  , ")"
+  , "{"
+  , "  return (duckdb_v2_copy_from_bind_get_option_count)(arg1, arg2, arg3);"
+  , "}"
+  , "DUCKDB_V2_ERROR hs_bindgen_9adeda560effcce9 ("
+  , "  duckdb_v2_copy_from_bind_info_handle arg1,"
+  , "  idx_t arg2,"
+  , "  duckdb_v2_identifier_t *arg3,"
+  , "  duckdb_v2_error_info_handle *arg4"
+  , ")"
+  , "{"
+  , "  return (duckdb_v2_copy_from_bind_get_option_name)(arg1, arg2, arg3, arg4);"
+  , "}"
+  , "DUCKDB_V2_ERROR hs_bindgen_36686c2484142b90 ("
+  , "  duckdb_v2_copy_from_bind_info_handle arg1,"
+  , "  idx_t arg2,"
+  , "  duckdb_v2_value_handle *arg3,"
+  , "  duckdb_v2_error_info_handle *arg4"
+  , ")"
+  , "{"
+  , "  return (duckdb_v2_copy_from_bind_get_option_value)(arg1, arg2, arg3, arg4);"
+  , "}"
+  , "DUCKDB_V2_ERROR hs_bindgen_b10c7124294cce11 ("
+  , "  duckdb_v2_copy_from_bind_info_handle arg1,"
+  , "  idx_t arg2,"
+  , "  _Bool arg3,"
+  , "  duckdb_v2_error_info_handle *arg4"
+  , ")"
+  , "{"
+  , "  return (duckdb_v2_copy_from_bind_set_cardinality)(arg1, arg2, arg3, arg4);"
+  , "}"
+  , "DUCKDB_V2_ERROR hs_bindgen_5498acdf9b26c847 ("
+  , "  duckdb_v2_copy_from_init_global_info_handle arg1,"
+  , "  void **arg2,"
+  , "  duckdb_v2_error_info_handle *arg3"
+  , ")"
+  , "{"
+  , "  return (duckdb_v2_copy_from_init_global_get_user_data)(arg1, arg2, arg3);"
+  , "}"
+  , "DUCKDB_V2_ERROR hs_bindgen_9883ac3e9f8b569a ("
+  , "  duckdb_v2_copy_from_init_global_info_handle arg1,"
+  , "  void **arg2,"
+  , "  duckdb_v2_error_info_handle *arg3"
+  , ")"
+  , "{"
+  , "  return (duckdb_v2_copy_from_init_global_get_bind_data)(arg1, arg2, arg3);"
+  , "}"
+  , "DUCKDB_V2_ERROR hs_bindgen_689f04e301c50c88 ("
+  , "  duckdb_v2_copy_from_init_global_info_handle arg1,"
+  , "  duckdb_v2_opaque *arg2,"
+  , "  duckdb_v2_error_info_handle *arg3"
+  , ")"
+  , "{"
+  , "  return (duckdb_v2_copy_from_init_global_set_global_state)(arg1, arg2, arg3);"
+  , "}"
+  , "DUCKDB_V2_ERROR hs_bindgen_9bdb3847d8cbf9b8 ("
+  , "  duckdb_v2_copy_from_init_global_info_handle arg1,"
+  , "  idx_t arg2,"
+  , "  duckdb_v2_error_info_handle *arg3"
+  , ")"
+  , "{"
+  , "  return (duckdb_v2_copy_from_init_global_set_max_threads)(arg1, arg2, arg3);"
+  , "}"
+  , "DUCKDB_V2_ERROR hs_bindgen_9eeb19bc716c6897 ("
+  , "  duckdb_v2_copy_from_init_local_info_handle arg1,"
+  , "  void **arg2,"
+  , "  duckdb_v2_error_info_handle *arg3"
+  , ")"
+  , "{"
+  , "  return (duckdb_v2_copy_from_init_local_get_user_data)(arg1, arg2, arg3);"
+  , "}"
+  , "DUCKDB_V2_ERROR hs_bindgen_76c31c62120fb670 ("
+  , "  duckdb_v2_copy_from_init_local_info_handle arg1,"
+  , "  void **arg2,"
+  , "  duckdb_v2_error_info_handle *arg3"
+  , ")"
+  , "{"
+  , "  return (duckdb_v2_copy_from_init_local_get_bind_data)(arg1, arg2, arg3);"
+  , "}"
+  , "DUCKDB_V2_ERROR hs_bindgen_fd32efaaa0b94469 ("
+  , "  duckdb_v2_copy_from_init_local_info_handle arg1,"
+  , "  void **arg2,"
+  , "  duckdb_v2_error_info_handle *arg3"
+  , ")"
+  , "{"
+  , "  return (duckdb_v2_copy_from_init_local_get_global_state)(arg1, arg2, arg3);"
+  , "}"
+  , "DUCKDB_V2_ERROR hs_bindgen_b3a1bc99145f103c ("
+  , "  duckdb_v2_copy_from_init_local_info_handle arg1,"
+  , "  duckdb_v2_opaque *arg2,"
+  , "  duckdb_v2_error_info_handle *arg3"
+  , ")"
+  , "{"
+  , "  return (duckdb_v2_copy_from_init_local_set_local_state)(arg1, arg2, arg3);"
+  , "}"
+  , "DUCKDB_V2_ERROR hs_bindgen_c3e524ecdd5ded5e ("
+  , "  duckdb_v2_copy_from_exec_info_handle arg1,"
+  , "  void **arg2,"
+  , "  duckdb_v2_error_info_handle *arg3"
+  , ")"
+  , "{"
+  , "  return (duckdb_v2_copy_from_exec_get_user_data)(arg1, arg2, arg3);"
+  , "}"
+  , "DUCKDB_V2_ERROR hs_bindgen_276b7b88ce95f441 ("
+  , "  duckdb_v2_copy_from_exec_info_handle arg1,"
+  , "  void **arg2,"
+  , "  duckdb_v2_error_info_handle *arg3"
+  , ")"
+  , "{"
+  , "  return (duckdb_v2_copy_from_exec_get_bind_data)(arg1, arg2, arg3);"
+  , "}"
+  , "DUCKDB_V2_ERROR hs_bindgen_a0118223d2a6676a ("
+  , "  duckdb_v2_copy_from_exec_info_handle arg1,"
+  , "  void **arg2,"
+  , "  duckdb_v2_error_info_handle *arg3"
+  , ")"
+  , "{"
+  , "  return (duckdb_v2_copy_from_exec_get_global_state)(arg1, arg2, arg3);"
+  , "}"
+  , "DUCKDB_V2_ERROR hs_bindgen_b3a43cb63564909d ("
+  , "  duckdb_v2_copy_from_exec_info_handle arg1,"
+  , "  void **arg2,"
+  , "  duckdb_v2_error_info_handle *arg3"
+  , ")"
+  , "{"
+  , "  return (duckdb_v2_copy_from_exec_get_local_state)(arg1, arg2, arg3);"
+  , "}"
+  , "DUCKDB_V2_ERROR hs_bindgen_e970103092fac840 ("
+  , "  duckdb_v2_copy_from_exec_info_handle arg1,"
+  , "  duckdb_v2_data_chunk_handle *arg2,"
+  , "  duckdb_v2_error_info_handle *arg3"
+  , ")"
+  , "{"
+  , "  return (duckdb_v2_copy_from_exec_get_output_chunk)(arg1, arg2, arg3);"
+  , "}"
+  , "DUCKDB_V2_ERROR hs_bindgen_ea17c550641c5981 ("
+  , "  duckdb_v2_copy_from_progress_info_handle arg1,"
+  , "  void **arg2,"
+  , "  duckdb_v2_error_info_handle *arg3"
+  , ")"
+  , "{"
+  , "  return (duckdb_v2_copy_from_progress_get_user_data)(arg1, arg2, arg3);"
+  , "}"
+  , "DUCKDB_V2_ERROR hs_bindgen_da9a29284de389b6 ("
+  , "  duckdb_v2_copy_from_progress_info_handle arg1,"
+  , "  void **arg2,"
+  , "  duckdb_v2_error_info_handle *arg3"
+  , ")"
+  , "{"
+  , "  return (duckdb_v2_copy_from_progress_get_bind_data)(arg1, arg2, arg3);"
+  , "}"
+  , "DUCKDB_V2_ERROR hs_bindgen_5515b2cbe7220255 ("
+  , "  duckdb_v2_copy_from_progress_info_handle arg1,"
+  , "  void **arg2,"
+  , "  duckdb_v2_error_info_handle *arg3"
+  , ")"
+  , "{"
+  , "  return (duckdb_v2_copy_from_progress_get_global_state)(arg1, arg2, arg3);"
+  , "}"
+  , "DUCKDB_V2_ERROR hs_bindgen_fb3589bcc060b4d5 ("
+  , "  duckdb_v2_copy_from_progress_info_handle arg1,"
+  , "  double arg2,"
+  , "  duckdb_v2_error_info_handle *arg3"
+  , ")"
+  , "{"
+  , "  return (duckdb_v2_copy_from_progress_set_progress)(arg1, arg2, arg3);"
+  , "}"
+  , "DUCKDB_V2_ERROR hs_bindgen_9435150f1c60aa19 ("
+  , "  duckdb_v2_connection_handle arg1,"
+  , "  duckdb_v2_copy_function_handle arg2,"
+  , "  duckdb_v2_error_info_handle *arg3"
+  , ")"
+  , "{"
+  , "  return (duckdb_v2_connection_register_copy_function)(arg1, arg2, arg3);"
+  , "}"
+  , "DUCKDB_V2_ERROR hs_bindgen_331b29a03d5f62fd ("
+  , "  duckdb_v2_extension_handle arg1,"
+  , "  duckdb_v2_copy_function_handle arg2,"
+  , "  duckdb_v2_error_info_handle *arg3"
+  , ")"
+  , "{"
+  , "  return (duckdb_v2_extension_register_copy_function)(arg1, arg2, arg3);"
+  , "}"
+  , "DUCKDB_V2_ERROR hs_bindgen_a36230d6e9c8fab5 ("
+  , "  duckdb_v2_copy_function_handle *arg1"
+  , ")"
+  , "{"
+  , "  return (duckdb_v2_copy_function_destroy)(arg1);"
+  , "}"
+  , "DUCKDB_V2_ERROR hs_bindgen_0356879db98ba3fc ("
+  , "  duckdb_v2_copy_function_handle arg1,"
+  , "  duckdb_v2_copy_to_statistics_callback_fn arg2,"
+  , "  duckdb_v2_error_info_handle *arg3"
+  , ")"
+  , "{"
+  , "  return (duckdb_v2_copy_to_set_statistics_callback)(arg1, arg2, arg3);"
+  , "}"
+  , "DUCKDB_V2_ERROR hs_bindgen_52e52eb853fc599f ("
+  , "  duckdb_v2_copy_to_statistics_info_handle arg1,"
+  , "  void **arg2,"
+  , "  duckdb_v2_error_info_handle *arg3"
+  , ")"
+  , "{"
+  , "  return (duckdb_v2_copy_to_statistics_get_user_data)(arg1, arg2, arg3);"
+  , "}"
+  , "DUCKDB_V2_ERROR hs_bindgen_85172ed21f6cdbcd ("
+  , "  duckdb_v2_copy_to_statistics_info_handle arg1,"
+  , "  void **arg2,"
+  , "  duckdb_v2_error_info_handle *arg3"
+  , ")"
+  , "{"
+  , "  return (duckdb_v2_copy_to_statistics_get_bind_data)(arg1, arg2, arg3);"
+  , "}"
+  , "DUCKDB_V2_ERROR hs_bindgen_a8aaaca8bd785940 ("
+  , "  duckdb_v2_copy_to_statistics_info_handle arg1,"
+  , "  void **arg2,"
+  , "  duckdb_v2_error_info_handle *arg3"
+  , ")"
+  , "{"
+  , "  return (duckdb_v2_copy_to_statistics_get_init_data)(arg1, arg2, arg3);"
+  , "}"
+  , "DUCKDB_V2_ERROR hs_bindgen_b368f75210bde589 ("
+  , "  duckdb_v2_copy_to_statistics_info_handle arg1,"
+  , "  idx_t arg2,"
+  , "  duckdb_v2_error_info_handle *arg3"
+  , ")"
+  , "{"
+  , "  return (duckdb_v2_copy_to_statistics_set_row_count)(arg1, arg2, arg3);"
+  , "}"
+  , "DUCKDB_V2_ERROR hs_bindgen_abea998929c6469b ("
+  , "  duckdb_v2_copy_to_statistics_info_handle arg1,"
+  , "  idx_t arg2,"
+  , "  duckdb_v2_error_info_handle *arg3"
+  , ")"
+  , "{"
+  , "  return (duckdb_v2_copy_to_statistics_set_file_size)(arg1, arg2, arg3);"
+  , "}"
+  , "DUCKDB_V2_ERROR hs_bindgen_75eb1ceeec8f3516 ("
+  , "  duckdb_v2_factory_handle arg1,"
+  , "  duckdb_v2_custom_option_handle *arg2,"
+  , "  duckdb_v2_error_info_handle *arg3"
+  , ")"
+  , "{"
+  , "  return (duckdb_v2_custom_option_create)(arg1, arg2, arg3);"
+  , "}"
+  , "DUCKDB_V2_ERROR hs_bindgen_9ab1bf28e6b1dd85 ("
+  , "  duckdb_v2_custom_option_handle arg1,"
+  , "  duckdb_v2_identifier_t const *arg2,"
+  , "  duckdb_v2_error_info_handle *arg3"
+  , ")"
+  , "{"
+  , "  return (duckdb_v2_custom_option_set_name)(arg1, arg2, arg3);"
+  , "}"
+  , "DUCKDB_V2_ERROR hs_bindgen_f9a091e8b7254362 ("
+  , "  duckdb_v2_custom_option_handle arg1,"
+  , "  duckdb_v2_logical_type_handle arg2,"
+  , "  duckdb_v2_error_info_handle *arg3"
+  , ")"
+  , "{"
+  , "  return (duckdb_v2_custom_option_set_type)(arg1, arg2, arg3);"
+  , "}"
+  , "DUCKDB_V2_ERROR hs_bindgen_8b1bd2012b18e856 ("
+  , "  duckdb_v2_custom_option_handle arg1,"
+  , "  duckdb_v2_value_handle arg2,"
+  , "  duckdb_v2_error_info_handle *arg3"
+  , ")"
+  , "{"
+  , "  return (duckdb_v2_custom_option_set_default_value)(arg1, arg2, arg3);"
+  , "}"
+  , "DUCKDB_V2_ERROR hs_bindgen_3e3600b5ab808934 ("
+  , "  duckdb_v2_custom_option_handle arg1,"
+  , "  duckdb_v2_str const *arg2,"
+  , "  duckdb_v2_error_info_handle *arg3"
+  , ")"
+  , "{"
+  , "  return (duckdb_v2_custom_option_set_description)(arg1, arg2, arg3);"
+  , "}"
+  , "DUCKDB_V2_ERROR hs_bindgen_a9e19e0203102b31 ("
+  , "  duckdb_v2_custom_option_handle arg1,"
+  , "  DUCKDB_V2_SETTING_SCOPE arg2,"
+  , "  duckdb_v2_error_info_handle *arg3"
+  , ")"
+  , "{"
+  , "  return (duckdb_v2_custom_option_set_default_scope)(arg1, arg2, arg3);"
+  , "}"
+  , "DUCKDB_V2_ERROR hs_bindgen_ed63d573db6c901c ("
+  , "  duckdb_v2_custom_option_handle arg1,"
+  , "  DUCKDB_V2_SETTING_SCOPE arg2,"
+  , "  _Bool arg3,"
+  , "  duckdb_v2_error_info_handle *arg4"
+  , ")"
+  , "{"
+  , "  return (duckdb_v2_custom_option_set_supports_scope)(arg1, arg2, arg3, arg4);"
+  , "}"
+  , "DUCKDB_V2_ERROR hs_bindgen_c05c2e5fc7802f0b ("
+  , "  duckdb_v2_custom_option_handle arg1,"
+  , "  duckdb_v2_opaque *arg2,"
+  , "  duckdb_v2_error_info_handle *arg3"
+  , ")"
+  , "{"
+  , "  return (duckdb_v2_custom_option_set_user_data)(arg1, arg2, arg3);"
+  , "}"
+  , "DUCKDB_V2_ERROR hs_bindgen_32ea8d6514b8867b ("
+  , "  duckdb_v2_custom_option_handle arg1,"
+  , "  duckdb_v2_custom_option_update_callback_fn arg2,"
+  , "  duckdb_v2_error_info_handle *arg3"
+  , ")"
+  , "{"
+  , "  return (duckdb_v2_custom_option_set_update_callback)(arg1, arg2, arg3);"
+  , "}"
+  , "DUCKDB_V2_ERROR hs_bindgen_683786e2ba5d7815 ("
+  , "  duckdb_v2_custom_option_update_info_handle arg1,"
+  , "  void **arg2,"
+  , "  duckdb_v2_error_info_handle *arg3"
+  , ")"
+  , "{"
+  , "  return (duckdb_v2_custom_option_update_get_user_data)(arg1, arg2, arg3);"
+  , "}"
+  , "DUCKDB_V2_ERROR hs_bindgen_0f00bbef3aa4bcee ("
+  , "  duckdb_v2_custom_option_update_info_handle arg1,"
+  , "  duckdb_v2_value_handle *arg2,"
+  , "  duckdb_v2_error_info_handle *arg3"
+  , ")"
+  , "{"
+  , "  return (duckdb_v2_custom_option_update_get_value)(arg1, arg2, arg3);"
+  , "}"
+  , "DUCKDB_V2_ERROR hs_bindgen_7327534204ca5be8 ("
+  , "  duckdb_v2_custom_option_update_info_handle arg1,"
+  , "  duckdb_v2_value_handle arg2,"
+  , "  duckdb_v2_error_info_handle *arg3"
+  , ")"
+  , "{"
+  , "  return (duckdb_v2_custom_option_update_set_value)(arg1, arg2, arg3);"
+  , "}"
+  , "DUCKDB_V2_ERROR hs_bindgen_51867bf9028193d3 ("
+  , "  duckdb_v2_custom_option_update_info_handle arg1,"
+  , "  DUCKDB_V2_SETTING_SCOPE *arg2,"
+  , "  duckdb_v2_error_info_handle *arg3"
+  , ")"
+  , "{"
+  , "  return (duckdb_v2_custom_option_update_get_scope)(arg1, arg2, arg3);"
+  , "}"
+  , "DUCKDB_V2_ERROR hs_bindgen_7225307377501320 ("
+  , "  duckdb_v2_custom_option_update_info_handle arg1,"
+  , "  _Bool *arg2,"
+  , "  duckdb_v2_error_info_handle *arg3"
+  , ")"
+  , "{"
+  , "  return (duckdb_v2_custom_option_update_is_reset)(arg1, arg2, arg3);"
+  , "}"
+  , "DUCKDB_V2_ERROR hs_bindgen_f8426cfe22416fb0 ("
+  , "  duckdb_v2_connection_handle arg1,"
+  , "  duckdb_v2_custom_option_handle arg2,"
+  , "  duckdb_v2_error_info_handle *arg3"
+  , ")"
+  , "{"
+  , "  return (duckdb_v2_connection_register_custom_option)(arg1, arg2, arg3);"
+  , "}"
+  , "DUCKDB_V2_ERROR hs_bindgen_aa5cf4de986fc2c8 ("
+  , "  duckdb_v2_extension_handle arg1,"
+  , "  duckdb_v2_custom_option_handle arg2,"
+  , "  duckdb_v2_error_info_handle *arg3"
+  , ")"
+  , "{"
+  , "  return (duckdb_v2_extension_register_custom_option)(arg1, arg2, arg3);"
+  , "}"
+  , "DUCKDB_V2_ERROR hs_bindgen_984c5652201b6bfd ("
+  , "  duckdb_v2_custom_option_handle *arg1"
+  , ")"
+  , "{"
+  , "  return (duckdb_v2_custom_option_destroy)(arg1);"
+  , "}"
+  , "DUCKDB_V2_ERROR hs_bindgen_454025ed7a148077 ("
+  , "  duckdb_v2_expression_handle arg1,"
+  , "  DUCKDB_V2_EXPRESSION_TYPE *arg2,"
+  , "  duckdb_v2_error_info_handle *arg3"
+  , ")"
+  , "{"
+  , "  return (duckdb_v2_expression_get_type)(arg1, arg2, arg3);"
+  , "}"
+  , "DUCKDB_V2_ERROR hs_bindgen_a4b528ffaae2d550 ("
+  , "  duckdb_v2_expression_handle arg1,"
+  , "  duckdb_v2_logical_type_handle *arg2,"
+  , "  duckdb_v2_error_info_handle *arg3"
+  , ")"
+  , "{"
+  , "  return (duckdb_v2_expression_get_return_type)(arg1, arg2, arg3);"
+  , "}"
+  , "DUCKDB_V2_ERROR hs_bindgen_ad153da3449a850a ("
+  , "  duckdb_v2_expression_handle arg1,"
+  , "  idx_t *arg2,"
+  , "  duckdb_v2_error_info_handle *arg3"
+  , ")"
+  , "{"
+  , "  return (duckdb_v2_expression_get_child_count)(arg1, arg2, arg3);"
+  , "}"
+  , "DUCKDB_V2_ERROR hs_bindgen_0773b30cb80a252e ("
+  , "  duckdb_v2_expression_handle arg1,"
+  , "  idx_t arg2,"
+  , "  duckdb_v2_expression_handle *arg3,"
+  , "  duckdb_v2_error_info_handle *arg4"
+  , ")"
+  , "{"
+  , "  return (duckdb_v2_expression_get_child)(arg1, arg2, arg3, arg4);"
+  , "}"
+  , "DUCKDB_V2_ERROR hs_bindgen_cead2d1a1c759d0f ("
+  , "  duckdb_v2_expression_handle arg1,"
+  , "  duckdb_v2_value_handle *arg2,"
+  , "  duckdb_v2_error_info_handle *arg3"
+  , ")"
+  , "{"
+  , "  return (duckdb_v2_expression_constant_get_value)(arg1, arg2, arg3);"
+  , "}"
+  , "DUCKDB_V2_ERROR hs_bindgen_2fb1769d1f358201 ("
+  , "  duckdb_v2_expression_handle arg1,"
+  , "  idx_t *arg2,"
+  , "  duckdb_v2_error_info_handle *arg3"
+  , ")"
+  , "{"
+  , "  return (duckdb_v2_expression_column_ref_get_index)(arg1, arg2, arg3);"
+  , "}"
+  , "DUCKDB_V2_ERROR hs_bindgen_a375c9e45ac1c7f7 ("
+  , "  duckdb_v2_expression_handle arg1,"
+  , "  duckdb_v2_identifier_t *arg2,"
+  , "  duckdb_v2_error_info_handle *arg3"
+  , ")"
+  , "{"
+  , "  return (duckdb_v2_expression_function_get_name)(arg1, arg2, arg3);"
+  , "}"
+  , "DUCKDB_V2_ERROR hs_bindgen_7d5e13a396e3a4ab ("
+  , "  duckdb_v2_expression_handle arg1,"
+  , "  duckdb_v2_qname_handle *arg2,"
+  , "  duckdb_v2_error_info_handle *arg3"
+  , ")"
+  , "{"
+  , "  return (duckdb_v2_expression_function_get_qname)(arg1, arg2, arg3);"
+  , "}"
+  , "DUCKDB_V2_ERROR hs_bindgen_c975ae511aa02980 ("
+  , "  duckdb_v2_expression_handle arg1,"
+  , "  DUCKDB_V2_CAST_MODE *arg2,"
+  , "  duckdb_v2_error_info_handle *arg3"
+  , ")"
+  , "{"
+  , "  return (duckdb_v2_expression_cast_get_mode)(arg1, arg2, arg3);"
+  , "}"
+  , "DUCKDB_V2_ERROR hs_bindgen_6358822ed8d27ef0 ("
+  , "  duckdb_v2_factory_handle arg1,"
+  , "  duckdb_v2_log_sink_handle *arg2,"
+  , "  duckdb_v2_error_info_handle *arg3"
+  , ")"
+  , "{"
+  , "  return (duckdb_v2_log_sink_create)(arg1, arg2, arg3);"
+  , "}"
+  , "DUCKDB_V2_ERROR hs_bindgen_492898c1c449c3fe ("
+  , "  duckdb_v2_log_sink_handle arg1,"
+  , "  duckdb_v2_identifier_t const *arg2,"
+  , "  duckdb_v2_error_info_handle *arg3"
+  , ")"
+  , "{"
+  , "  return (duckdb_v2_log_sink_set_name)(arg1, arg2, arg3);"
+  , "}"
+  , "DUCKDB_V2_ERROR hs_bindgen_7b9de9e8aa64154c ("
+  , "  duckdb_v2_log_sink_handle arg1,"
+  , "  duckdb_v2_opaque *arg2,"
+  , "  duckdb_v2_error_info_handle *arg3"
+  , ")"
+  , "{"
+  , "  return (duckdb_v2_log_sink_set_user_data)(arg1, arg2, arg3);"
+  , "}"
+  , "DUCKDB_V2_ERROR hs_bindgen_dffbee0b81e5642c ("
+  , "  duckdb_v2_log_sink_handle arg1,"
+  , "  duckdb_v2_log_sink_write_callback_fn arg2,"
+  , "  duckdb_v2_error_info_handle *arg3"
+  , ")"
+  , "{"
+  , "  return (duckdb_v2_log_sink_set_write_callback)(arg1, arg2, arg3);"
+  , "}"
+  , "DUCKDB_V2_ERROR hs_bindgen_0a7a3d98c0a85a84 ("
+  , "  duckdb_v2_log_sink_handle arg1,"
+  , "  duckdb_v2_log_sink_flush_callback_fn arg2,"
+  , "  duckdb_v2_error_info_handle *arg3"
+  , ")"
+  , "{"
+  , "  return (duckdb_v2_log_sink_set_flush_callback)(arg1, arg2, arg3);"
+  , "}"
+  , "DUCKDB_V2_ERROR hs_bindgen_727d4c291ab6b5d7 ("
+  , "  duckdb_v2_log_sink_write_info_handle arg1,"
+  , "  idx_t *arg2,"
+  , "  _Bool *arg3,"
+  , "  duckdb_v2_error_info_handle *arg4"
+  , ")"
+  , "{"
+  , "  return (duckdb_v2_log_sink_write_info_get_connection_id)(arg1, arg2, arg3, arg4);"
+  , "}"
+  , "DUCKDB_V2_ERROR hs_bindgen_728828d2ac24012d ("
+  , "  duckdb_v2_log_sink_write_info_handle arg1,"
+  , "  idx_t *arg2,"
+  , "  _Bool *arg3,"
+  , "  duckdb_v2_error_info_handle *arg4"
+  , ")"
+  , "{"
+  , "  return (duckdb_v2_log_sink_write_info_get_transaction_id)(arg1, arg2, arg3, arg4);"
+  , "}"
+  , "DUCKDB_V2_ERROR hs_bindgen_12c9960d2dc79668 ("
+  , "  duckdb_v2_log_sink_write_info_handle arg1,"
+  , "  idx_t *arg2,"
+  , "  _Bool *arg3,"
+  , "  duckdb_v2_error_info_handle *arg4"
+  , ")"
+  , "{"
+  , "  return (duckdb_v2_log_sink_write_info_get_query_id)(arg1, arg2, arg3, arg4);"
+  , "}"
+  , "DUCKDB_V2_ERROR hs_bindgen_8d5cf935dad2ba3f ("
+  , "  duckdb_v2_log_sink_write_info_handle arg1,"
+  , "  idx_t *arg2,"
+  , "  _Bool *arg3,"
+  , "  duckdb_v2_error_info_handle *arg4"
+  , ")"
+  , "{"
+  , "  return (duckdb_v2_log_sink_write_info_get_thread_id)(arg1, arg2, arg3, arg4);"
+  , "}"
+  , "DUCKDB_V2_ERROR hs_bindgen_658c58ec8ec8b03a ("
+  , "  duckdb_v2_instance_handle arg1,"
+  , "  duckdb_v2_log_sink_handle arg2,"
+  , "  duckdb_v2_error_info_handle *arg3"
+  , ")"
+  , "{"
+  , "  return (duckdb_v2_instance_register_log_sink)(arg1, arg2, arg3);"
+  , "}"
+  , "DUCKDB_V2_ERROR hs_bindgen_f22104c93312913d ("
+  , "  duckdb_v2_extension_handle arg1,"
+  , "  duckdb_v2_log_sink_handle arg2,"
+  , "  duckdb_v2_error_info_handle *arg3"
+  , ")"
+  , "{"
+  , "  return (duckdb_v2_extension_register_log_sink)(arg1, arg2, arg3);"
+  , "}"
+  , "DUCKDB_V2_ERROR hs_bindgen_827c72fefc1ae923 ("
+  , "  duckdb_v2_log_sink_handle *arg1"
+  , ")"
+  , "{"
+  , "  return (duckdb_v2_log_sink_destroy)(arg1);"
+  , "}"
+  , "DUCKDB_V2_ERROR hs_bindgen_7c0a920f70a1fbc0 ("
+  , "  duckdb_v2_factory_handle arg1,"
+  , "  DUCKDB_V2_LOGICAL_TYPE_ID arg2,"
+  , "  duckdb_v2_identifier_t const *arg3,"
+  , "  duckdb_v2_value_handle const *arg4,"
+  , "  idx_t arg5,"
+  , "  duckdb_v2_logical_type_handle *arg6,"
+  , "  duckdb_v2_error_info_handle *arg7"
+  , ")"
+  , "{"
+  , "  return (duckdb_v2_factory_create_type_from_id)(arg1, arg2, arg3, arg4, arg5, arg6, arg7);"
+  , "}"
+  , "DUCKDB_V2_ERROR hs_bindgen_51b5d65c0ddb67d9 ("
+  , "  duckdb_v2_factory_handle arg1,"
+  , "  duckdb_v2_qname_handle arg2,"
+  , "  duckdb_v2_identifier_t const *arg3,"
+  , "  duckdb_v2_value_handle const *arg4,"
+  , "  idx_t arg5,"
+  , "  duckdb_v2_logical_type_handle *arg6,"
+  , "  duckdb_v2_error_info_handle *arg7"
+  , ")"
+  , "{"
+  , "  return (duckdb_v2_factory_create_type_from_name)(arg1, arg2, arg3, arg4, arg5, arg6, arg7);"
+  , "}"
+  , "DUCKDB_V2_ERROR hs_bindgen_c04603fdc9cd2c68 ("
+  , "  duckdb_v2_factory_handle arg1,"
+  , "  duckdb_v2_str const *arg2,"
+  , "  duckdb_v2_logical_type_handle *arg3,"
+  , "  duckdb_v2_error_info_handle *arg4"
+  , ")"
+  , "{"
+  , "  return (duckdb_v2_factory_create_type_from_text)(arg1, arg2, arg3, arg4);"
+  , "}"
+  , "DUCKDB_V2_ERROR hs_bindgen_b71b046351f8c916 ("
+  , "  duckdb_v2_logical_type_handle arg1,"
+  , "  duckdb_v2_logical_type_handle *arg2,"
+  , "  duckdb_v2_error_info_handle *arg3"
+  , ")"
+  , "{"
+  , "  return (duckdb_v2_logical_type_copy)(arg1, arg2, arg3);"
+  , "}"
+  , "DUCKDB_V2_ERROR hs_bindgen_3aad55c5964702f7 ("
+  , "  duckdb_v2_logical_type_handle *arg1"
+  , ")"
+  , "{"
+  , "  return (duckdb_v2_logical_type_destroy)(arg1);"
+  , "}"
+  , "DUCKDB_V2_ERROR hs_bindgen_da8cacd6c97feb4c ("
+  , "  duckdb_v2_logical_type_handle arg1,"
+  , "  duckdb_v2_logical_type_handle arg2,"
+  , "  _Bool *arg3,"
+  , "  duckdb_v2_error_info_handle *arg4"
+  , ")"
+  , "{"
+  , "  return (duckdb_v2_logical_type_is_equal)(arg1, arg2, arg3, arg4);"
+  , "}"
+  , "DUCKDB_V2_ERROR hs_bindgen_315b8d3c078ce6f7 ("
+  , "  duckdb_v2_logical_type_handle arg1,"
+  , "  DUCKDB_V2_LOGICAL_TYPE_ID *arg2,"
+  , "  duckdb_v2_error_info_handle *arg3"
+  , ")"
+  , "{"
+  , "  return (duckdb_v2_logical_type_get_id)(arg1, arg2, arg3);"
+  , "}"
+  , "DUCKDB_V2_ERROR hs_bindgen_000999a513f4671d ("
+  , "  duckdb_v2_logical_type_handle arg1,"
+  , "  duckdb_v2_identifier_t *arg2,"
+  , "  duckdb_v2_error_info_handle *arg3"
+  , ")"
+  , "{"
+  , "  return (duckdb_v2_logical_type_get_name)(arg1, arg2, arg3);"
+  , "}"
+  , "DUCKDB_V2_ERROR hs_bindgen_f3c1e302546be432 ("
+  , "  duckdb_v2_logical_type_handle arg1,"
+  , "  char *arg2,"
+  , "  idx_t arg3,"
+  , "  idx_t *arg4,"
+  , "  duckdb_v2_error_info_handle *arg5"
+  , ")"
+  , "{"
+  , "  return (duckdb_v2_logical_type_to_text)(arg1, arg2, arg3, arg4, arg5);"
+  , "}"
+  , "DUCKDB_V2_ERROR hs_bindgen_556856654e08fce7 ("
+  , "  duckdb_v2_logical_type_handle arg1,"
+  , "  idx_t *arg2,"
+  , "  duckdb_v2_error_info_handle *arg3"
+  , ")"
+  , "{"
+  , "  return (duckdb_v2_logical_type_get_param_count)(arg1, arg2, arg3);"
+  , "}"
+  , "DUCKDB_V2_ERROR hs_bindgen_eb8ccfd9c31ac1a9 ("
+  , "  duckdb_v2_logical_type_handle arg1,"
+  , "  idx_t arg2,"
+  , "  duckdb_v2_identifier_t *arg3,"
+  , "  duckdb_v2_value_handle *arg4,"
+  , "  duckdb_v2_error_info_handle *arg5"
+  , ")"
+  , "{"
+  , "  return (duckdb_v2_logical_type_get_param)(arg1, arg2, arg3, arg4, arg5);"
+  , "}"
+  , "DUCKDB_V2_ERROR hs_bindgen_4d26c25b506fdc43 ("
+  , "  duckdb_v2_factory_handle arg1,"
+  , "  duckdb_v2_logical_type_handle arg2,"
+  , "  duckdb_v2_identifier_t const *arg3,"
+  , "  duckdb_v2_logical_type_handle *arg4,"
+  , "  duckdb_v2_error_info_handle *arg5"
+  , ")"
+  , "{"
+  , "  return (duckdb_v2_factory_create_type_with_alias)(arg1, arg2, arg3, arg4, arg5);"
+  , "}"
+  , "DUCKDB_V2_ERROR hs_bindgen_cc99c1f96b585442 ("
+  , "  duckdb_v2_factory_handle arg1,"
+  , "  duckdb_v2_logical_type_handle const *arg2,"
+  , "  idx_t arg3,"
+  , "  duckdb_v2_logical_type_handle *arg4,"
+  , "  duckdb_v2_error_info_handle *arg5"
+  , ")"
+  , "{"
+  , "  return (duckdb_v2_factory_create_common_type)(arg1, arg2, arg3, arg4, arg5);"
+  , "}"
+  , "DUCKDB_V2_ERROR hs_bindgen_0ec6f47de28749e2 ("
+  , "  duckdb_v2_factory_handle arg1,"
+  , "  DUCKDB_V2_MACRO_FUNCTION_TYPE arg2,"
+  , "  duckdb_v2_macro_function_handle *arg3,"
+  , "  duckdb_v2_error_info_handle *arg4"
+  , ")"
+  , "{"
+  , "  return (duckdb_v2_macro_function_create)(arg1, arg2, arg3, arg4);"
+  , "}"
+  , "DUCKDB_V2_ERROR hs_bindgen_fbc9bc7caa2b478e ("
+  , "  duckdb_v2_macro_function_handle arg1,"
+  , "  duckdb_v2_identifier_t const *arg2,"
+  , "  duckdb_v2_error_info_handle *arg3"
+  , ")"
+  , "{"
+  , "  return (duckdb_v2_macro_function_set_name)(arg1, arg2, arg3);"
+  , "}"
+  , "DUCKDB_V2_ERROR hs_bindgen_8974df2b60571bd5 ("
+  , "  duckdb_v2_macro_function_handle arg1,"
+  , "  duckdb_v2_str const *arg2,"
+  , "  duckdb_v2_error_info_handle *arg3"
+  , ")"
+  , "{"
+  , "  return (duckdb_v2_macro_function_set_body)(arg1, arg2, arg3);"
+  , "}"
+  , "DUCKDB_V2_ERROR hs_bindgen_b175b543b7110600 ("
+  , "  duckdb_v2_macro_function_handle arg1,"
+  , "  duckdb_v2_function_signature_handle *arg2,"
+  , "  duckdb_v2_error_info_handle *arg3"
+  , ")"
+  , "{"
+  , "  return (duckdb_v2_macro_function_get_signature)(arg1, arg2, arg3);"
+  , "}"
+  , "DUCKDB_V2_ERROR hs_bindgen_db8a42ade972ac8a ("
+  , "  duckdb_v2_macro_function_handle arg1,"
+  , "  duckdb_v2_function_docs_handle *arg2,"
+  , "  duckdb_v2_error_info_handle *arg3"
+  , ")"
+  , "{"
+  , "  return (duckdb_v2_macro_function_get_docs)(arg1, arg2, arg3);"
+  , "}"
+  , "DUCKDB_V2_ERROR hs_bindgen_5ca6b4239899f807 ("
+  , "  duckdb_v2_extension_handle arg1,"
+  , "  duckdb_v2_macro_function_handle arg2,"
+  , "  duckdb_v2_error_info_handle *arg3"
+  , ")"
+  , "{"
+  , "  return (duckdb_v2_extension_register_macro_function)(arg1, arg2, arg3);"
+  , "}"
+  , "DUCKDB_V2_ERROR hs_bindgen_2fff35927f226418 ("
+  , "  duckdb_v2_macro_function_handle *arg1"
+  , ")"
+  , "{"
+  , "  return (duckdb_v2_macro_function_destroy)(arg1);"
+  , "}"
+  , "DUCKDB_V2_ERROR hs_bindgen_48eaeacc5a484d09 ("
+  , "  duckdb_v2_factory_handle arg1,"
+  , "  duckdb_v2_pragma_function_handle *arg2,"
+  , "  duckdb_v2_error_info_handle *arg3"
+  , ")"
+  , "{"
+  , "  return (duckdb_v2_pragma_function_create)(arg1, arg2, arg3);"
+  , "}"
+  , "DUCKDB_V2_ERROR hs_bindgen_ce9f59e68b8a9710 ("
+  , "  duckdb_v2_pragma_function_handle arg1,"
+  , "  duckdb_v2_identifier_t const *arg2,"
+  , "  duckdb_v2_error_info_handle *arg3"
+  , ")"
+  , "{"
+  , "  return (duckdb_v2_pragma_function_set_name)(arg1, arg2, arg3);"
+  , "}"
+  , "DUCKDB_V2_ERROR hs_bindgen_2dcad178887151dc ("
+  , "  duckdb_v2_pragma_function_handle arg1,"
+  , "  duckdb_v2_function_docs_handle *arg2,"
+  , "  duckdb_v2_error_info_handle *arg3"
+  , ")"
+  , "{"
+  , "  return (duckdb_v2_pragma_function_get_docs)(arg1, arg2, arg3);"
+  , "}"
+  , "DUCKDB_V2_ERROR hs_bindgen_cfc9a98383af3415 ("
+  , "  duckdb_v2_pragma_function_handle arg1,"
+  , "  duckdb_v2_function_signature_handle *arg2,"
+  , "  duckdb_v2_error_info_handle *arg3"
+  , ")"
+  , "{"
+  , "  return (duckdb_v2_pragma_function_get_signature)(arg1, arg2, arg3);"
+  , "}"
+  , "DUCKDB_V2_ERROR hs_bindgen_44b0dd64abaa1c0c ("
+  , "  duckdb_v2_pragma_function_handle arg1,"
+  , "  duckdb_v2_opaque *arg2,"
+  , "  duckdb_v2_error_info_handle *arg3"
+  , ")"
+  , "{"
+  , "  return (duckdb_v2_pragma_function_set_user_data)(arg1, arg2, arg3);"
+  , "}"
+  , "DUCKDB_V2_ERROR hs_bindgen_5d6de7f3388be2c4 ("
+  , "  duckdb_v2_pragma_function_handle arg1,"
+  , "  duckdb_v2_pragma_function_query_callback_fn arg2,"
+  , "  duckdb_v2_error_info_handle *arg3"
+  , ")"
+  , "{"
+  , "  return (duckdb_v2_pragma_function_set_query_callback)(arg1, arg2, arg3);"
+  , "}"
+  , "DUCKDB_V2_ERROR hs_bindgen_4b951b7060351cad ("
+  , "  duckdb_v2_pragma_function_handle arg1,"
+  , "  duckdb_v2_pragma_function_exec_callback_fn arg2,"
+  , "  duckdb_v2_error_info_handle *arg3"
+  , ")"
+  , "{"
+  , "  return (duckdb_v2_pragma_function_set_exec_callback)(arg1, arg2, arg3);"
+  , "}"
+  , "DUCKDB_V2_ERROR hs_bindgen_b801373b24c488d6 ("
+  , "  duckdb_v2_pragma_function_query_info_handle arg1,"
+  , "  duckdb_v2_str const *arg2,"
+  , "  duckdb_v2_error_info_handle *arg3"
+  , ")"
+  , "{"
+  , "  return (duckdb_v2_pragma_function_query_set_query)(arg1, arg2, arg3);"
+  , "}"
+  , "DUCKDB_V2_ERROR hs_bindgen_039a9dadc75b2b29 ("
+  , "  duckdb_v2_connection_handle arg1,"
+  , "  duckdb_v2_pragma_function_handle arg2,"
+  , "  duckdb_v2_error_info_handle *arg3"
+  , ")"
+  , "{"
+  , "  return (duckdb_v2_connection_register_pragma_function)(arg1, arg2, arg3);"
+  , "}"
+  , "DUCKDB_V2_ERROR hs_bindgen_e6919d9feffe14b6 ("
+  , "  duckdb_v2_extension_handle arg1,"
+  , "  duckdb_v2_pragma_function_handle arg2,"
+  , "  duckdb_v2_error_info_handle *arg3"
+  , ")"
+  , "{"
+  , "  return (duckdb_v2_extension_register_pragma_function)(arg1, arg2, arg3);"
+  , "}"
+  , "DUCKDB_V2_ERROR hs_bindgen_8b887df3599166b2 ("
+  , "  duckdb_v2_pragma_function_handle *arg1"
+  , ")"
+  , "{"
+  , "  return (duckdb_v2_pragma_function_destroy)(arg1);"
+  , "}"
+  , "DUCKDB_V2_ERROR hs_bindgen_9a9c477c199679ce ("
+  , "  duckdb_v2_factory_handle arg1,"
+  , "  duckdb_v2_replacement_scan_handle *arg2,"
+  , "  duckdb_v2_error_info_handle *arg3"
+  , ")"
+  , "{"
+  , "  return (duckdb_v2_replacement_scan_create)(arg1, arg2, arg3);"
+  , "}"
+  , "DUCKDB_V2_ERROR hs_bindgen_6d9b9297faec84c9 ("
+  , "  duckdb_v2_replacement_scan_handle arg1,"
+  , "  duckdb_v2_replacement_scan_callback_fn arg2,"
+  , "  duckdb_v2_error_info_handle *arg3"
+  , ")"
+  , "{"
+  , "  return (duckdb_v2_replacement_scan_set_callback)(arg1, arg2, arg3);"
+  , "}"
+  , "DUCKDB_V2_ERROR hs_bindgen_13a4465156ae64d7 ("
+  , "  duckdb_v2_replacement_scan_handle arg1,"
+  , "  duckdb_v2_opaque *arg2,"
+  , "  duckdb_v2_error_info_handle *arg3"
+  , ")"
+  , "{"
+  , "  return (duckdb_v2_replacement_scan_set_user_data)(arg1, arg2, arg3);"
+  , "}"
+  , "DUCKDB_V2_ERROR hs_bindgen_d0be9d4e018884b3 ("
+  , "  duckdb_v2_replacement_scan_info_handle arg1,"
+  , "  void **arg2,"
+  , "  duckdb_v2_error_info_handle *arg3"
+  , ")"
+  , "{"
+  , "  return (duckdb_v2_replacement_scan_get_user_data)(arg1, arg2, arg3);"
+  , "}"
+  , "DUCKDB_V2_ERROR hs_bindgen_60b13e3e17341dc4 ("
+  , "  duckdb_v2_replacement_scan_info_handle arg1,"
+  , "  duckdb_v2_qname_handle *arg2,"
+  , "  duckdb_v2_error_info_handle *arg3"
+  , ")"
+  , "{"
+  , "  return (duckdb_v2_replacement_scan_get_name)(arg1, arg2, arg3);"
+  , "}"
+  , "DUCKDB_V2_ERROR hs_bindgen_275dcb99adeb56bf ("
+  , "  duckdb_v2_replacement_scan_info_handle arg1,"
+  , "  duckdb_v2_qname_handle arg2,"
+  , "  duckdb_v2_error_info_handle *arg3"
+  , ")"
+  , "{"
+  , "  return (duckdb_v2_replacement_scan_set_function_name)(arg1, arg2, arg3);"
+  , "}"
+  , "DUCKDB_V2_ERROR hs_bindgen_b4c78412a057de08 ("
+  , "  duckdb_v2_replacement_scan_info_handle arg1,"
+  , "  duckdb_v2_value_handle arg2,"
+  , "  duckdb_v2_error_info_handle *arg3"
+  , ")"
+  , "{"
+  , "  return (duckdb_v2_replacement_scan_add_argument)(arg1, arg2, arg3);"
+  , "}"
+  , "DUCKDB_V2_ERROR hs_bindgen_5b0e8f4b06bdf6af ("
+  , "  duckdb_v2_replacement_scan_info_handle arg1,"
+  , "  duckdb_v2_identifier_t const *arg2,"
+  , "  duckdb_v2_value_handle arg3,"
+  , "  duckdb_v2_error_info_handle *arg4"
+  , ")"
+  , "{"
+  , "  return (duckdb_v2_replacement_scan_add_named_argument)(arg1, arg2, arg3, arg4);"
+  , "}"
+  , "DUCKDB_V2_ERROR hs_bindgen_b0fa215fb44418e1 ("
+  , "  duckdb_v2_replacement_scan_info_handle arg1,"
+  , "  duckdb_v2_column_data_collection_handle arg2,"
+  , "  duckdb_v2_identifier_t const *arg3,"
+  , "  idx_t arg4,"
+  , "  duckdb_v2_error_info_handle *arg5"
+  , ")"
+  , "{"
+  , "  return (duckdb_v2_replacement_scan_set_collection)(arg1, arg2, arg3, arg4, arg5);"
+  , "}"
+  , "DUCKDB_V2_ERROR hs_bindgen_144e586318b59139 ("
+  , "  duckdb_v2_replacement_scan_info_handle arg1,"
+  , "  duckdb_v2_str const *arg2,"
+  , "  duckdb_v2_error_info_handle *arg3"
+  , ")"
+  , "{"
+  , "  return (duckdb_v2_replacement_scan_set_subquery)(arg1, arg2, arg3);"
+  , "}"
+  , "DUCKDB_V2_ERROR hs_bindgen_0c37cfe083a44d27 ("
+  , "  duckdb_v2_replacement_scan_info_handle arg1,"
+  , "  duckdb_v2_identifier_t const *arg2,"
+  , "  duckdb_v2_error_info_handle *arg3"
+  , ")"
+  , "{"
+  , "  return (duckdb_v2_replacement_scan_set_alias)(arg1, arg2, arg3);"
+  , "}"
+  , "DUCKDB_V2_ERROR hs_bindgen_e57429e0c52c2e37 ("
+  , "  duckdb_v2_connection_handle arg1,"
+  , "  duckdb_v2_replacement_scan_handle arg2,"
+  , "  duckdb_v2_error_info_handle *arg3"
+  , ")"
+  , "{"
+  , "  return (duckdb_v2_connection_register_replacement_scan)(arg1, arg2, arg3);"
+  , "}"
+  , "DUCKDB_V2_ERROR hs_bindgen_b7c7467789b7fc1c ("
+  , "  duckdb_v2_instance_handle arg1,"
+  , "  duckdb_v2_replacement_scan_handle arg2,"
+  , "  duckdb_v2_error_info_handle *arg3"
+  , ")"
+  , "{"
+  , "  return (duckdb_v2_instance_register_replacement_scan)(arg1, arg2, arg3);"
+  , "}"
+  , "DUCKDB_V2_ERROR hs_bindgen_14d15707b0c6050f ("
+  , "  duckdb_v2_extension_handle arg1,"
+  , "  duckdb_v2_replacement_scan_handle arg2,"
+  , "  duckdb_v2_error_info_handle *arg3"
+  , ")"
+  , "{"
+  , "  return (duckdb_v2_extension_register_replacement_scan)(arg1, arg2, arg3);"
+  , "}"
+  , "DUCKDB_V2_ERROR hs_bindgen_315b4557190f4c0a ("
+  , "  duckdb_v2_replacement_scan_handle *arg1"
+  , ")"
+  , "{"
+  , "  return (duckdb_v2_replacement_scan_destroy)(arg1);"
+  , "}"
+  , "DUCKDB_V2_ERROR hs_bindgen_742f0751928cb67d ("
+  , "  duckdb_v2_factory_handle arg1,"
+  , "  duckdb_v2_scalar_function_handle *arg2,"
+  , "  duckdb_v2_error_info_handle *arg3"
+  , ")"
+  , "{"
+  , "  return (duckdb_v2_scalar_function_create)(arg1, arg2, arg3);"
+  , "}"
+  , "DUCKDB_V2_ERROR hs_bindgen_aa81d34a271fa43e ("
+  , "  duckdb_v2_scalar_function_handle arg1,"
+  , "  duckdb_v2_identifier_t const *arg2,"
+  , "  duckdb_v2_error_info_handle *arg3"
+  , ")"
+  , "{"
+  , "  return (duckdb_v2_scalar_function_set_name)(arg1, arg2, arg3);"
+  , "}"
+  , "DUCKDB_V2_ERROR hs_bindgen_40a9e1f8dd5b6e31 ("
+  , "  duckdb_v2_scalar_function_handle arg1,"
+  , "  duckdb_v2_function_docs_handle *arg2,"
+  , "  duckdb_v2_error_info_handle *arg3"
+  , ")"
+  , "{"
+  , "  return (duckdb_v2_scalar_function_get_docs)(arg1, arg2, arg3);"
+  , "}"
+  , "DUCKDB_V2_ERROR hs_bindgen_f119236c665eadd6 ("
+  , "  duckdb_v2_scalar_function_handle arg1,"
+  , "  duckdb_v2_function_signature_handle *arg2,"
+  , "  duckdb_v2_error_info_handle *arg3"
+  , ")"
+  , "{"
+  , "  return (duckdb_v2_scalar_function_get_signature)(arg1, arg2, arg3);"
+  , "}"
+  , "DUCKDB_V2_ERROR hs_bindgen_4da7a6f078093aab ("
+  , "  duckdb_v2_scalar_function_handle arg1,"
+  , "  duckdb_v2_opaque *arg2,"
+  , "  duckdb_v2_error_info_handle *arg3"
+  , ")"
+  , "{"
+  , "  return (duckdb_v2_scalar_function_set_user_data)(arg1, arg2, arg3);"
+  , "}"
+  , "DUCKDB_V2_ERROR hs_bindgen_87c5fb31da0ecdb9 ("
+  , "  duckdb_v2_scalar_function_handle arg1,"
+  , "  DUCKDB_V2_FUNCTION_PROPERTY_KEY arg2,"
+  , "  DUCKDB_V2_FUNCTION_PROPERTY_VALUE arg3,"
+  , "  duckdb_v2_error_info_handle *arg4"
+  , ")"
+  , "{"
+  , "  return (duckdb_v2_scalar_function_set_property)(arg1, arg2, arg3, arg4);"
+  , "}"
+  , "DUCKDB_V2_ERROR hs_bindgen_035bd2a2a872ead7 ("
+  , "  duckdb_v2_scalar_function_handle arg1,"
+  , "  duckdb_v2_scalar_function_resolve_types_callback_fn arg2,"
+  , "  duckdb_v2_error_info_handle *arg3"
+  , ")"
+  , "{"
+  , "  return (duckdb_v2_scalar_function_set_resolve_types_callback)(arg1, arg2, arg3);"
+  , "}"
+  , "DUCKDB_V2_ERROR hs_bindgen_2ecbf5ac124df320 ("
+  , "  duckdb_v2_scalar_function_handle arg1,"
+  , "  duckdb_v2_scalar_function_bind_callback_fn arg2,"
+  , "  duckdb_v2_error_info_handle *arg3"
+  , ")"
+  , "{"
+  , "  return (duckdb_v2_scalar_function_set_bind_callback)(arg1, arg2, arg3);"
+  , "}"
+  , "DUCKDB_V2_ERROR hs_bindgen_6453f4493e0f17a6 ("
+  , "  duckdb_v2_scalar_function_handle arg1,"
+  , "  duckdb_v2_scalar_function_init_callback_fn arg2,"
+  , "  duckdb_v2_error_info_handle *arg3"
+  , ")"
+  , "{"
+  , "  return (duckdb_v2_scalar_function_set_init_callback)(arg1, arg2, arg3);"
+  , "}"
+  , "DUCKDB_V2_ERROR hs_bindgen_c069501cdd5bd694 ("
+  , "  duckdb_v2_scalar_function_handle arg1,"
+  , "  duckdb_v2_scalar_function_exec_callback_fn arg2,"
+  , "  duckdb_v2_error_info_handle *arg3"
+  , ")"
+  , "{"
+  , "  return (duckdb_v2_scalar_function_set_exec_callback)(arg1, arg2, arg3);"
+  , "}"
+  , "DUCKDB_V2_ERROR hs_bindgen_8034f09b5951e789 ("
+  , "  duckdb_v2_scalar_function_resolve_types_info_handle arg1,"
+  , "  duckdb_v2_logical_type_handle arg2,"
+  , "  duckdb_v2_error_info_handle *arg3"
+  , ")"
+  , "{"
+  , "  return (duckdb_v2_scalar_function_resolve_types_set_return_type)(arg1, arg2, arg3);"
+  , "}"
+  , "DUCKDB_V2_ERROR hs_bindgen_a3bf8400ceea5f93 ("
+  , "  duckdb_v2_scalar_function_bind_info_handle arg1,"
+  , "  duckdb_v2_opaque *arg2,"
+  , "  duckdb_v2_error_info_handle *arg3"
+  , ")"
+  , "{"
+  , "  return (duckdb_v2_scalar_function_bind_set_bind_data)(arg1, arg2, arg3);"
+  , "}"
+  , "DUCKDB_V2_ERROR hs_bindgen_2e2070b4fd19c126 ("
+  , "  duckdb_v2_scalar_function_init_info_handle arg1,"
+  , "  void **arg2,"
+  , "  duckdb_v2_error_info_handle *arg3"
+  , ")"
+  , "{"
+  , "  return (duckdb_v2_scalar_function_init_get_user_data)(arg1, arg2, arg3);"
+  , "}"
+  , "DUCKDB_V2_ERROR hs_bindgen_9c5500523d3ef710 ("
+  , "  duckdb_v2_scalar_function_init_info_handle arg1,"
+  , "  void **arg2,"
+  , "  duckdb_v2_error_info_handle *arg3"
+  , ")"
+  , "{"
+  , "  return (duckdb_v2_scalar_function_init_get_bind_data)(arg1, arg2, arg3);"
+  , "}"
+  , "DUCKDB_V2_ERROR hs_bindgen_524f86b44e9294e9 ("
+  , "  duckdb_v2_scalar_function_init_info_handle arg1,"
+  , "  duckdb_v2_opaque *arg2,"
+  , "  duckdb_v2_error_info_handle *arg3"
+  , ")"
+  , "{"
+  , "  return (duckdb_v2_scalar_function_init_set_init_data)(arg1, arg2, arg3);"
+  , "}"
+  , "DUCKDB_V2_ERROR hs_bindgen_39ada4fd8f023c38 ("
+  , "  duckdb_v2_scalar_function_exec_info_handle arg1,"
+  , "  void **arg2,"
+  , "  duckdb_v2_error_info_handle *arg3"
+  , ")"
+  , "{"
+  , "  return (duckdb_v2_scalar_function_exec_get_user_data)(arg1, arg2, arg3);"
+  , "}"
+  , "DUCKDB_V2_ERROR hs_bindgen_41ac6ee4fdc43266 ("
+  , "  duckdb_v2_scalar_function_exec_info_handle arg1,"
+  , "  void **arg2,"
+  , "  duckdb_v2_error_info_handle *arg3"
+  , ")"
+  , "{"
+  , "  return (duckdb_v2_scalar_function_exec_get_bind_data)(arg1, arg2, arg3);"
+  , "}"
+  , "DUCKDB_V2_ERROR hs_bindgen_3e730e841383a6f9 ("
+  , "  duckdb_v2_scalar_function_exec_info_handle arg1,"
+  , "  void **arg2,"
+  , "  duckdb_v2_error_info_handle *arg3"
+  , ")"
+  , "{"
+  , "  return (duckdb_v2_scalar_function_exec_get_init_data)(arg1, arg2, arg3);"
+  , "}"
+  , "DUCKDB_V2_ERROR hs_bindgen_32c2e586fb938a4a ("
+  , "  duckdb_v2_scalar_function_exec_info_handle arg1,"
+  , "  idx_t *arg2,"
+  , "  duckdb_v2_error_info_handle *arg3"
+  , ")"
+  , "{"
+  , "  return (duckdb_v2_scalar_function_exec_get_row_count)(arg1, arg2, arg3);"
+  , "}"
+  , "DUCKDB_V2_ERROR hs_bindgen_68835dd5d850a124 ("
+  , "  duckdb_v2_scalar_function_exec_info_handle arg1,"
+  , "  idx_t *arg2,"
+  , "  idx_t *arg3,"
+  , "  idx_t *arg4,"
+  , "  idx_t *arg5,"
+  , "  duckdb_v2_error_info_handle *arg6"
+  , ")"
+  , "{"
+  , "  return (duckdb_v2_scalar_function_exec_get_arg_count)(arg1, arg2, arg3, arg4, arg5, arg6);"
+  , "}"
+  , "DUCKDB_V2_ERROR hs_bindgen_e0074e12bc64fc47 ("
+  , "  duckdb_v2_scalar_function_exec_info_handle arg1,"
+  , "  idx_t arg2,"
+  , "  duckdb_v2_vector_handle *arg3,"
+  , "  duckdb_v2_error_info_handle *arg4"
+  , ")"
+  , "{"
+  , "  return (duckdb_v2_scalar_function_exec_get_arg)(arg1, arg2, arg3, arg4);"
+  , "}"
+  , "DUCKDB_V2_ERROR hs_bindgen_c99a611fbb136c9c ("
+  , "  duckdb_v2_scalar_function_exec_info_handle arg1,"
+  , "  duckdb_v2_vector_handle *arg2,"
+  , "  duckdb_v2_error_info_handle *arg3"
+  , ")"
+  , "{"
+  , "  return (duckdb_v2_scalar_function_exec_get_result)(arg1, arg2, arg3);"
+  , "}"
+  , "DUCKDB_V2_ERROR hs_bindgen_3228d55aaf4faa5d ("
+  , "  duckdb_v2_connection_handle arg1,"
+  , "  duckdb_v2_scalar_function_handle arg2,"
+  , "  duckdb_v2_error_info_handle *arg3"
+  , ")"
+  , "{"
+  , "  return (duckdb_v2_connection_register_scalar_function)(arg1, arg2, arg3);"
+  , "}"
+  , "DUCKDB_V2_ERROR hs_bindgen_b4c56cb9397e1a66 ("
+  , "  duckdb_v2_extension_handle arg1,"
+  , "  duckdb_v2_scalar_function_handle arg2,"
+  , "  duckdb_v2_error_info_handle *arg3"
+  , ")"
+  , "{"
+  , "  return (duckdb_v2_extension_register_scalar_function)(arg1, arg2, arg3);"
+  , "}"
+  , "DUCKDB_V2_ERROR hs_bindgen_169e77dabc8b9d4e ("
+  , "  duckdb_v2_scalar_function_handle *arg1"
+  , ")"
+  , "{"
+  , "  return (duckdb_v2_scalar_function_destroy)(arg1);"
+  , "}"
+  , "DUCKDB_V2_ERROR hs_bindgen_79641f15c4620dae ("
+  , "  duckdb_v2_connection_handle arg1,"
+  , "  char const *arg2,"
+  , "  duckdb_v2_statement_iterator_handle *arg3,"
+  , "  duckdb_v2_error_info_handle *arg4"
+  , ")"
+  , "{"
+  , "  return (duckdb_v2_parse_sql)(arg1, arg2, arg3, arg4);"
+  , "}"
+  , "DUCKDB_V2_ERROR hs_bindgen_415cf6bf4e5157c3 ("
+  , "  duckdb_v2_statement_iterator_handle arg1,"
+  , "  duckdb_v2_sql_statement_handle *arg2,"
+  , "  duckdb_v2_error_info_handle *arg3"
+  , ")"
+  , "{"
+  , "  return (duckdb_v2_statement_iterator_next)(arg1, arg2, arg3);"
+  , "}"
+  , "DUCKDB_V2_ERROR hs_bindgen_9a54c46c0b4406d4 ("
+  , "  duckdb_v2_connection_handle arg1,"
+  , "  duckdb_v2_sql_statement_handle arg2,"
+  , "  duckdb_v2_schema_handle *arg3,"
+  , "  duckdb_v2_schema_handle *arg4,"
+  , "  duckdb_v2_error_info_handle *arg5"
+  , ")"
+  , "{"
+  , "  return (duckdb_v2_statement_bind)(arg1, arg2, arg3, arg4, arg5);"
+  , "}"
+  , "DUCKDB_V2_ERROR hs_bindgen_ace6940be7595af0 ("
+  , "  duckdb_v2_sql_statement_handle arg1,"
+  , "  duckdb_v2_identifier_t const *arg2,"
+  , "  duckdb_v2_column_data_collection_handle arg3,"
+  , "  duckdb_v2_identifier_t const *arg4,"
+  , "  idx_t arg5,"
+  , "  duckdb_v2_error_info_handle *arg6"
+  , ")"
+  , "{"
+  , "  return (duckdb_v2_statement_add_collection)(arg1, arg2, arg3, arg4, arg5, arg6);"
+  , "}"
+  , "DUCKDB_V2_ERROR hs_bindgen_077080c7f83655d5 ("
+  , "  duckdb_v2_sql_statement_handle arg1,"
+  , "  DUCKDB_V2_STATEMENT_TYPE *arg2,"
+  , "  duckdb_v2_error_info_handle *arg3"
+  , ")"
+  , "{"
+  , "  return (duckdb_v2_sql_statement_get_type)(arg1, arg2, arg3);"
+  , "}"
+  , "DUCKDB_V2_ERROR hs_bindgen_8c1303762f1b18be ("
+  , "  duckdb_v2_sql_statement_handle arg1,"
+  , "  duckdb_v2_str *arg2,"
+  , "  duckdb_v2_error_info_handle *arg3"
+  , ")"
+  , "{"
+  , "  return (duckdb_v2_sql_statement_get_text)(arg1, arg2, arg3);"
+  , "}"
+  , "DUCKDB_V2_ERROR hs_bindgen_06ef57dab7d3ab4c ("
+  , "  duckdb_v2_sql_statement_handle arg1,"
+  , "  idx_t *arg2,"
+  , "  duckdb_v2_error_info_handle *arg3"
+  , ")"
+  , "{"
+  , "  return (duckdb_v2_sql_statement_get_parameter_count)(arg1, arg2, arg3);"
+  , "}"
+  , "DUCKDB_V2_ERROR hs_bindgen_c17b046439fba3da ("
+  , "  duckdb_v2_sql_statement_handle arg1,"
+  , "  idx_t arg2,"
+  , "  duckdb_v2_identifier_t *arg3,"
+  , "  duckdb_v2_error_info_handle *arg4"
+  , ")"
+  , "{"
+  , "  return (duckdb_v2_sql_statement_get_parameter_name)(arg1, arg2, arg3, arg4);"
+  , "}"
+  , "DUCKDB_V2_ERROR hs_bindgen_abc4ad5be777e482 ("
+  , "  duckdb_v2_sql_statement_handle *arg1"
+  , ")"
+  , "{"
+  , "  return (duckdb_v2_sql_statement_destroy)(arg1);"
+  , "}"
+  , "DUCKDB_V2_ERROR hs_bindgen_799899533c3f22fc ("
+  , "  duckdb_v2_statement_iterator_handle *arg1"
+  , ")"
+  , "{"
+  , "  return (duckdb_v2_statement_iterator_destroy)(arg1);"
+  , "}"
+  , "DUCKDB_V2_ERROR hs_bindgen_c3aba412a137899c ("
+  , "  duckdb_v2_vector_handle arg1,"
+  , "  DUCKDB_V2_VECTOR_TYPE *arg2,"
+  , "  duckdb_v2_error_info_handle *arg3"
+  , ")"
+  , "{"
+  , "  return (duckdb_v2_vector_get_vector_type)(arg1, arg2, arg3);"
+  , "}"
+  , "DUCKDB_V2_ERROR hs_bindgen_ad9a536cbf47b7ae ("
+  , "  duckdb_v2_vector_handle arg1,"
+  , "  duckdb_v2_logical_type_handle *arg2,"
+  , "  duckdb_v2_error_info_handle *arg3"
+  , ")"
+  , "{"
+  , "  return (duckdb_v2_vector_get_logical_type)(arg1, arg2, arg3);"
+  , "}"
+  , "DUCKDB_V2_ERROR hs_bindgen_18642405dbd6e0ba ("
+  , "  duckdb_v2_vector_handle arg1,"
+  , "  duckdb_v2_vector_view *arg2,"
+  , "  duckdb_v2_error_info_handle *arg3"
+  , ")"
+  , "{"
+  , "  return (duckdb_v2_vector_get_view)(arg1, arg2, arg3);"
+  , "}"
+  , "DUCKDB_V2_ERROR hs_bindgen_8121bd80fbc2d87d ("
+  , "  duckdb_v2_vector_handle arg1,"
+  , "  idx_t *arg2,"
+  , "  duckdb_v2_error_info_handle *arg3"
+  , ")"
+  , "{"
+  , "  return (duckdb_v2_vector_get_size)(arg1, arg2, arg3);"
+  , "}"
+  , "DUCKDB_V2_ERROR hs_bindgen_3f3cdc8e0a00d71f ("
+  , "  duckdb_v2_vector_handle arg1,"
+  , "  idx_t arg2,"
+  , "  duckdb_v2_error_info_handle *arg3"
+  , ")"
+  , "{"
+  , "  return (duckdb_v2_vector_set_size)(arg1, arg2, arg3);"
+  , "}"
+  , "DUCKDB_V2_ERROR hs_bindgen_fc26d7ca89346169 ("
+  , "  duckdb_v2_vector_handle arg1,"
+  , "  idx_t arg2,"
+  , "  duckdb_v2_value_handle *arg3,"
+  , "  duckdb_v2_error_info_handle *arg4"
+  , ")"
+  , "{"
+  , "  return (duckdb_v2_vector_get_value)(arg1, arg2, arg3, arg4);"
+  , "}"
+  , "DUCKDB_V2_ERROR hs_bindgen_abe26b9e4eedf6a2 ("
+  , "  duckdb_v2_vector_handle arg1,"
+  , "  idx_t arg2,"
+  , "  duckdb_v2_value_handle arg3,"
+  , "  duckdb_v2_error_info_handle *arg4"
+  , ")"
+  , "{"
+  , "  return (duckdb_v2_vector_set_value)(arg1, arg2, arg3, arg4);"
+  , "}"
+  , "DUCKDB_V2_ERROR hs_bindgen_02fd2701725237a4 ("
+  , "  duckdb_v2_vector_handle arg1,"
+  , "  void **arg2,"
+  , "  duckdb_v2_error_info_handle *arg3"
+  , ")"
+  , "{"
+  , "  return (duckdb_v2_vector_get_data_mutable)(arg1, arg2, arg3);"
+  , "}"
+  , "DUCKDB_V2_ERROR hs_bindgen_1a8dba55edf7203d ("
+  , "  duckdb_v2_vector_handle arg1,"
+  , "  duckdb_v2_error_info_handle *arg2"
+  , ")"
+  , "{"
+  , "  return (duckdb_v2_vector_flatten)(arg1, arg2);"
+  , "}"
+  , "DUCKDB_V2_ERROR hs_bindgen_8d58a83ff47c5ea7 ("
+  , "  duckdb_v2_factory_handle arg1,"
+  , "  duckdb_v2_vector_handle arg2,"
+  , "  duckdb_v2_vector_handle arg3,"
+  , "  DUCKDB_V2_CAST_MODE arg4,"
+  , "  _Bool *arg5,"
+  , "  duckdb_v2_error_info_handle *arg6,"
+  , "  duckdb_v2_error_info_handle *arg7"
+  , ")"
+  , "{"
+  , "  return (duckdb_v2_vector_cast)(arg1, arg2, arg3, arg4, arg5, arg6, arg7);"
+  , "}"
+  , "DUCKDB_V2_ERROR hs_bindgen_7576829d7aab2af7 ("
+  , "  duckdb_v2_vector_handle arg1,"
+  , "  duckdb_v2_vector_handle arg2,"
+  , "  duckdb_v2_error_info_handle *arg3"
+  , ")"
+  , "{"
+  , "  return (duckdb_v2_vector_reference)(arg1, arg2, arg3);"
+  , "}"
+  , "DUCKDB_V2_ERROR hs_bindgen_47468c5392ad1c43 ("
+  , "  duckdb_v2_vector_handle arg1,"
+  , "  duckdb_v2_value_handle arg2,"
+  , "  idx_t arg3,"
+  , "  duckdb_v2_error_info_handle *arg4"
+  , ")"
+  , "{"
+  , "  return (duckdb_v2_vector_make_constant)(arg1, arg2, arg3, arg4);"
+  , "}"
+  , "DUCKDB_V2_ERROR hs_bindgen_9077799b85b9faee ("
+  , "  duckdb_v2_vector_handle arg1,"
+  , "  int64_t arg2,"
+  , "  int64_t arg3,"
+  , "  idx_t arg4,"
+  , "  duckdb_v2_error_info_handle *arg5"
+  , ")"
+  , "{"
+  , "  return (duckdb_v2_vector_make_sequence)(arg1, arg2, arg3, arg4, arg5);"
+  , "}"
+  , "DUCKDB_V2_ERROR hs_bindgen_d0800bbe0a6ec46d ("
+  , "  duckdb_v2_vector_handle arg1,"
+  , "  idx_t arg2,"
+  , "  duckdb_v2_error_info_handle *arg3"
+  , ")"
+  , "{"
+  , "  return (duckdb_v2_vector_set_null)(arg1, arg2, arg3);"
+  , "}"
+  , "DUCKDB_V2_ERROR hs_bindgen_cc2a481c5acaa93a ("
+  , "  duckdb_v2_vector_handle arg1,"
+  , "  uint64_t **arg2,"
+  , "  duckdb_v2_error_info_handle *arg3"
+  , ")"
+  , "{"
+  , "  return (duckdb_v2_vector_flat_get_validity_mutable)(arg1, arg2, arg3);"
+  , "}"
+  , "DUCKDB_V2_ERROR hs_bindgen_ed6850bb8e6e6615 ("
+  , "  duckdb_v2_vector_handle arg1,"
+  , "  _Bool arg2,"
+  , "  duckdb_v2_error_info_handle *arg3"
+  , ")"
+  , "{"
+  , "  return (duckdb_v2_vector_constant_set_valid)(arg1, arg2, arg3);"
+  , "}"
+  , "DUCKDB_V2_ERROR hs_bindgen_c3e450b1717e0aec ("
+  , "  duckdb_v2_vector_handle arg1,"
+  , "  duckdb_v2_arena_handle *arg2,"
+  , "  duckdb_v2_error_info_handle *arg3"
+  , ")"
+  , "{"
+  , "  return (duckdb_v2_vector_get_arena)(arg1, arg2, arg3);"
+  , "}"
+  , "DUCKDB_V2_ERROR hs_bindgen_b42cb55351e1fd06 ("
+  , "  duckdb_v2_vector_handle arg1,"
+  , "  idx_t *arg2,"
+  , "  duckdb_v2_error_info_handle *arg3"
+  , ")"
+  , "{"
+  , "  return (duckdb_v2_vector_get_child_count)(arg1, arg2, arg3);"
+  , "}"
+  , "DUCKDB_V2_ERROR hs_bindgen_7b9e0d949dd7f8a5 ("
+  , "  duckdb_v2_vector_handle arg1,"
+  , "  idx_t arg2,"
+  , "  duckdb_v2_vector_handle *arg3,"
+  , "  duckdb_v2_error_info_handle *arg4"
+  , ")"
+  , "{"
+  , "  return (duckdb_v2_vector_get_child)(arg1, arg2, arg3, arg4);"
+  , "}"
+  , "DUCKDB_V2_ERROR hs_bindgen_30a232980daceef5 ("
+  , "  uint8_t const *arg1,"
+  , "  idx_t arg2,"
+  , "  uint8_t *arg3,"
+  , "  idx_t arg4,"
+  , "  idx_t *arg5,"
+  , "  _Bool *arg6,"
+  , "  duckdb_v2_error_info_handle *arg7"
+  , ")"
+  , "{"
+  , "  return (duckdb_v2_bignum_decode)(arg1, arg2, arg3, arg4, arg5, arg6, arg7);"
+  , "}"
+  , "DUCKDB_V2_ERROR hs_bindgen_fe4f11ee6f2d6af1 ("
+  , "  uint8_t const *arg1,"
+  , "  idx_t arg2,"
+  , "  _Bool arg3,"
+  , "  uint8_t *arg4,"
+  , "  idx_t arg5,"
+  , "  idx_t *arg6,"
+  , "  duckdb_v2_error_info_handle *arg7"
+  , ")"
+  , "{"
+  , "  return (duckdb_v2_bignum_encode)(arg1, arg2, arg3, arg4, arg5, arg6, arg7);"
+  , "}"
+  , "DUCKDB_V2_ERROR hs_bindgen_8a1d4d4e86271de2 ("
+  , "  duckdb_v2_str const *arg1,"
+  , "  duckdb_v2_error_info_handle *arg2"
+  , ")"
+  , "{"
+  , "  return (duckdb_v2_validate_utf8)(arg1, arg2);"
+  , "}"
+  , "DUCKDB_V2_ERROR hs_bindgen_b9246b8938bd6700 ("
+  , "  duckdb_v2_connection_handle arg1,"
+  , "  duckdb_v2_sql_statement_handle arg2,"
+  , "  _Bool arg3,"
+  , "  duckdb_v2_prepared_statement_handle *arg4,"
+  , "  duckdb_v2_error_info_handle *arg5"
+  , ")"
+  , "{"
+  , "  return (duckdb_v2_prepared_statement_create)(arg1, arg2, arg3, arg4, arg5);"
+  , "}"
+  , "DUCKDB_V2_ERROR hs_bindgen_1358aa1f8c69ea14 ("
+  , "  duckdb_v2_prepared_statement_handle arg1,"
+  , "  duckdb_v2_identifier_t const *arg2,"
+  , "  duckdb_v2_value_handle const *arg3,"
+  , "  idx_t arg4,"
+  , "  duckdb_v2_result_handle *arg5,"
+  , "  duckdb_v2_error_info_handle *arg6"
+  , ")"
+  , "{"
+  , "  return (duckdb_v2_prepared_statement_execute)(arg1, arg2, arg3, arg4, arg5, arg6);"
+  , "}"
+  , "DUCKDB_V2_ERROR hs_bindgen_605ebc6c17f6f506 ("
+  , "  duckdb_v2_prepared_statement_handle arg1,"
+  , "  _Bool *arg2,"
+  , "  duckdb_v2_error_info_handle *arg3"
+  , ")"
+  , "{"
+  , "  return (duckdb_v2_prepared_statement_reuses_plan)(arg1, arg2, arg3);"
+  , "}"
+  , "DUCKDB_V2_ERROR hs_bindgen_d25880906eff71c0 ("
+  , "  duckdb_v2_prepared_statement_handle *arg1"
+  , ")"
+  , "{"
+  , "  return (duckdb_v2_prepared_statement_destroy)(arg1);"
+  , "}"
+  , "DUCKDB_V2_ERROR hs_bindgen_6f34761779a741e9 ("
+  , "  duckdb_v2_connection_handle arg1,"
+  , "  duckdb_v2_sql_statement_handle arg2,"
+  , "  duckdb_v2_identifier_t const *arg3,"
+  , "  duckdb_v2_value_handle const *arg4,"
+  , "  idx_t arg5,"
+  , "  duckdb_v2_result_handle *arg6,"
+  , "  duckdb_v2_error_info_handle *arg7"
+  , ")"
+  , "{"
+  , "  return (duckdb_v2_statement_execute)(arg1, arg2, arg3, arg4, arg5, arg6, arg7);"
+  , "}"
+  , "DUCKDB_V2_ERROR hs_bindgen_66a764cfa998a75d ("
+  , "  duckdb_v2_result_handle *arg1"
+  , ")"
+  , "{"
+  , "  return (duckdb_v2_result_destroy)(arg1);"
+  , "}"
+  , "DUCKDB_V2_ERROR hs_bindgen_0b00e1f00ca06883 ("
+  , "  duckdb_v2_result_handle arg1,"
+  , "  duckdb_v2_data_chunk_handle *arg2,"
+  , "  DUCKDB_V2_RESULT_STEP_STATUS *arg3,"
+  , "  duckdb_v2_error_info_handle *arg4"
+  , ")"
+  , "{"
+  , "  return (duckdb_v2_result_step)(arg1, arg2, arg3, arg4);"
+  , "}"
+  , "DUCKDB_V2_ERROR hs_bindgen_5a9c2831f75d0684 ("
+  , "  duckdb_v2_result_handle arg1,"
+  , "  duckdb_v2_data_chunk_handle *arg2,"
+  , "  duckdb_v2_error_info_handle *arg3"
+  , ")"
+  , "{"
+  , "  return (duckdb_v2_result_fetch_chunk)(arg1, arg2, arg3);"
+  , "}"
+  , "DUCKDB_V2_ERROR hs_bindgen_0e4429c34e59a1b5 ("
+  , "  duckdb_v2_result_handle arg1,"
+  , "  duckdb_v2_error_info_handle *arg2"
+  , ")"
+  , "{"
+  , "  return (duckdb_v2_result_wait)(arg1, arg2);"
+  , "}"
+  , "DUCKDB_V2_ERROR hs_bindgen_ce024cb402576a11 ("
+  , "  duckdb_v2_result_handle *arg1,"
+  , "  idx_t arg2,"
+  , "  idx_t arg3,"
+  , "  idx_t arg4,"
+  , "  duckdb_v2_str const *arg5,"
+  , "  idx_t arg6,"
+  , "  idx_t arg7,"
+  , "  duckdb_v2_text_sink_fn arg8,"
+  , "  void *arg9,"
+  , "  duckdb_v2_error_info_handle *arg10"
+  , ")"
+  , "{"
+  , "  return (duckdb_v2_result_render_box)(arg1, arg2, arg3, arg4, arg5, arg6, arg7, arg8, arg9, arg10);"
+  , "}"
+  , "DUCKDB_V2_ERROR hs_bindgen_9dcda3b02c8ae4a6 ("
+  , "  duckdb_v2_result_handle arg1,"
+  , "  idx_t *arg2,"
+  , "  duckdb_v2_error_info_handle *arg3"
+  , ")"
+  , "{"
+  , "  return (duckdb_v2_result_drain)(arg1, arg2, arg3);"
+  , "}"
+  , "DUCKDB_V2_ERROR hs_bindgen_51b942a49ae35ec3 ("
+  , "  duckdb_v2_result_handle arg1,"
+  , "  DUCKDB_V2_RESULT_TYPE *arg2,"
+  , "  duckdb_v2_error_info_handle *arg3"
+  , ")"
+  , "{"
+  , "  return (duckdb_v2_result_get_result_type)(arg1, arg2, arg3);"
+  , "}"
+  , "DUCKDB_V2_ERROR hs_bindgen_72821b70c768d2f5 ("
+  , "  duckdb_v2_result_handle arg1,"
+  , "  DUCKDB_V2_STATEMENT_TYPE *arg2,"
+  , "  duckdb_v2_error_info_handle *arg3"
+  , ")"
+  , "{"
+  , "  return (duckdb_v2_result_get_statement_type)(arg1, arg2, arg3);"
+  , "}"
+  , "DUCKDB_V2_ERROR hs_bindgen_d5bff92c871a172c ("
+  , "  duckdb_v2_result_handle arg1,"
+  , "  duckdb_v2_schema_handle *arg2,"
+  , "  duckdb_v2_error_info_handle *arg3"
+  , ")"
+  , "{"
+  , "  return (duckdb_v2_result_get_schema)(arg1, arg2, arg3);"
+  , "}"
+  , "DUCKDB_V2_ERROR hs_bindgen_61d284c9af297e34 ("
+  , "  duckdb_v2_factory_handle arg1,"
+  , "  duckdb_v2_table_function_handle *arg2,"
+  , "  duckdb_v2_error_info_handle *arg3"
+  , ")"
+  , "{"
+  , "  return (duckdb_v2_table_function_create)(arg1, arg2, arg3);"
+  , "}"
+  , "DUCKDB_V2_ERROR hs_bindgen_fee371a3c30f3680 ("
+  , "  duckdb_v2_table_function_handle arg1,"
+  , "  duckdb_v2_identifier_t const *arg2,"
+  , "  duckdb_v2_error_info_handle *arg3"
+  , ")"
+  , "{"
+  , "  return (duckdb_v2_table_function_set_name)(arg1, arg2, arg3);"
+  , "}"
+  , "DUCKDB_V2_ERROR hs_bindgen_574753c003d123f1 ("
+  , "  duckdb_v2_table_function_handle arg1,"
+  , "  duckdb_v2_function_docs_handle *arg2,"
+  , "  duckdb_v2_error_info_handle *arg3"
+  , ")"
+  , "{"
+  , "  return (duckdb_v2_table_function_get_docs)(arg1, arg2, arg3);"
+  , "}"
+  , "DUCKDB_V2_ERROR hs_bindgen_a39f5939f3ff51da ("
+  , "  duckdb_v2_table_function_handle arg1,"
+  , "  duckdb_v2_function_signature_handle *arg2,"
+  , "  duckdb_v2_error_info_handle *arg3"
+  , ")"
+  , "{"
+  , "  return (duckdb_v2_table_function_get_signature)(arg1, arg2, arg3);"
+  , "}"
+  , "DUCKDB_V2_ERROR hs_bindgen_db810193f6248613 ("
+  , "  duckdb_v2_table_function_handle arg1,"
+  , "  duckdb_v2_opaque *arg2,"
+  , "  duckdb_v2_error_info_handle *arg3"
+  , ")"
+  , "{"
+  , "  return (duckdb_v2_table_function_set_user_data)(arg1, arg2, arg3);"
+  , "}"
+  , "DUCKDB_V2_ERROR hs_bindgen_d230471ae19015d9 ("
+  , "  duckdb_v2_table_function_handle arg1,"
+  , "  duckdb_v2_table_function_bind_callback_fn arg2,"
+  , "  duckdb_v2_error_info_handle *arg3"
+  , ")"
+  , "{"
+  , "  return (duckdb_v2_table_function_set_bind_callback)(arg1, arg2, arg3);"
+  , "}"
+  , "DUCKDB_V2_ERROR hs_bindgen_99d851dc0c2a3c67 ("
+  , "  duckdb_v2_table_function_handle arg1,"
+  , "  duckdb_v2_table_function_init_global_callback_fn arg2,"
+  , "  duckdb_v2_error_info_handle *arg3"
+  , ")"
+  , "{"
+  , "  return (duckdb_v2_table_function_set_init_global_callback)(arg1, arg2, arg3);"
+  , "}"
+  , "DUCKDB_V2_ERROR hs_bindgen_18399d2bc5d0a7cc ("
+  , "  duckdb_v2_table_function_handle arg1,"
+  , "  duckdb_v2_table_function_init_local_callback_fn arg2,"
+  , "  duckdb_v2_error_info_handle *arg3"
+  , ")"
+  , "{"
+  , "  return (duckdb_v2_table_function_set_init_local_callback)(arg1, arg2, arg3);"
+  , "}"
+  , "DUCKDB_V2_ERROR hs_bindgen_17879214c12b18e7 ("
+  , "  duckdb_v2_table_function_handle arg1,"
+  , "  duckdb_v2_table_function_exec_callback_fn arg2,"
+  , "  duckdb_v2_error_info_handle *arg3"
+  , ")"
+  , "{"
+  , "  return (duckdb_v2_table_function_set_exec_callback)(arg1, arg2, arg3);"
+  , "}"
+  , "DUCKDB_V2_ERROR hs_bindgen_e3d89062a6f3b691 ("
+  , "  duckdb_v2_table_function_handle arg1,"
+  , "  duckdb_v2_table_function_progress_callback_fn arg2,"
+  , "  duckdb_v2_error_info_handle *arg3"
+  , ")"
+  , "{"
+  , "  return (duckdb_v2_table_function_set_progress_callback)(arg1, arg2, arg3);"
+  , "}"
+  , "DUCKDB_V2_ERROR hs_bindgen_850375d29beab802 ("
+  , "  duckdb_v2_table_function_handle arg1,"
+  , "  _Bool arg2,"
+  , "  duckdb_v2_error_info_handle *arg3"
+  , ")"
+  , "{"
+  , "  return (duckdb_v2_table_function_set_projection_pushdown)(arg1, arg2, arg3);"
+  , "}"
+  , "DUCKDB_V2_ERROR hs_bindgen_dd56f9fb845d8b62 ("
+  , "  duckdb_v2_table_function_handle arg1,"
+  , "  duckdb_v2_table_function_filter_pushdown_callback_fn arg2,"
+  , "  duckdb_v2_error_info_handle *arg3"
+  , ")"
+  , "{"
+  , "  return (duckdb_v2_table_function_set_filter_pushdown_callback)(arg1, arg2, arg3);"
+  , "}"
+  , "DUCKDB_V2_ERROR hs_bindgen_cba5db6a3260b7d8 ("
+  , "  duckdb_v2_table_function_handle arg1,"
+  , "  duckdb_v2_table_function_partition_data_callback_fn arg2,"
+  , "  duckdb_v2_error_info_handle *arg3"
+  , ")"
+  , "{"
+  , "  return (duckdb_v2_table_function_set_partition_data_callback)(arg1, arg2, arg3);"
+  , "}"
+  , "DUCKDB_V2_ERROR hs_bindgen_2f2bcf72e3527454 ("
+  , "  duckdb_v2_table_function_handle arg1,"
+  , "  duckdb_v2_table_function_partitioning_callback_fn arg2,"
+  , "  duckdb_v2_error_info_handle *arg3"
+  , ")"
+  , "{"
+  , "  return (duckdb_v2_table_function_set_partitioning_callback)(arg1, arg2, arg3);"
+  , "}"
+  , "DUCKDB_V2_ERROR hs_bindgen_3a2b9acfaf0f193c ("
+  , "  duckdb_v2_table_function_bind_info_handle arg1,"
+  , "  duckdb_v2_identifier_t const *arg2,"
+  , "  duckdb_v2_logical_type_handle arg3,"
+  , "  duckdb_v2_error_info_handle *arg4"
+  , ")"
+  , "{"
+  , "  return (duckdb_v2_table_function_bind_add_result_column)(arg1, arg2, arg3, arg4);"
+  , "}"
+  , "DUCKDB_V2_ERROR hs_bindgen_1d02e031e9380cf7 ("
+  , "  duckdb_v2_table_function_bind_info_handle arg1,"
+  , "  idx_t arg2,"
+  , "  _Bool arg3,"
+  , "  duckdb_v2_error_info_handle *arg4"
+  , ")"
+  , "{"
+  , "  return (duckdb_v2_table_function_bind_set_cardinality)(arg1, arg2, arg3, arg4);"
+  , "}"
+  , "DUCKDB_V2_ERROR hs_bindgen_99db736f7b370f72 ("
+  , "  duckdb_v2_table_function_bind_info_handle arg1,"
+  , "  DUCKDB_V2_ORDER_PRESERVATION arg2,"
+  , "  duckdb_v2_error_info_handle *arg3"
+  , ")"
+  , "{"
+  , "  return (duckdb_v2_table_function_bind_set_order_preservation)(arg1, arg2, arg3);"
+  , "}"
+  , "DUCKDB_V2_ERROR hs_bindgen_bcb42d983502d204 ("
+  , "  duckdb_v2_table_function_init_global_info_handle arg1,"
+  , "  void **arg2,"
+  , "  duckdb_v2_error_info_handle *arg3"
+  , ")"
+  , "{"
+  , "  return (duckdb_v2_table_function_init_global_get_user_data)(arg1, arg2, arg3);"
+  , "}"
+  , "DUCKDB_V2_ERROR hs_bindgen_594bd43792a96384 ("
+  , "  duckdb_v2_table_function_init_global_info_handle arg1,"
+  , "  void **arg2,"
+  , "  duckdb_v2_error_info_handle *arg3"
+  , ")"
+  , "{"
+  , "  return (duckdb_v2_table_function_init_global_get_bind_data)(arg1, arg2, arg3);"
+  , "}"
+  , "DUCKDB_V2_ERROR hs_bindgen_15387cf426dc90ab ("
+  , "  duckdb_v2_table_function_init_global_info_handle arg1,"
+  , "  duckdb_v2_opaque *arg2,"
+  , "  duckdb_v2_error_info_handle *arg3"
+  , ")"
+  , "{"
+  , "  return (duckdb_v2_table_function_init_global_set_global_state)(arg1, arg2, arg3);"
+  , "}"
+  , "DUCKDB_V2_ERROR hs_bindgen_1de9a55568a3b83c ("
+  , "  duckdb_v2_table_function_init_global_info_handle arg1,"
+  , "  idx_t arg2,"
+  , "  duckdb_v2_error_info_handle *arg3"
+  , ")"
+  , "{"
+  , "  return (duckdb_v2_table_function_init_global_set_max_threads)(arg1, arg2, arg3);"
+  , "}"
+  , "DUCKDB_V2_ERROR hs_bindgen_eef33e332f588b1c ("
+  , "  duckdb_v2_table_function_init_global_info_handle arg1,"
+  , "  idx_t *arg2,"
+  , "  duckdb_v2_error_info_handle *arg3"
+  , ")"
+  , "{"
+  , "  return (duckdb_v2_table_function_init_global_get_column_count)(arg1, arg2, arg3);"
+  , "}"
+  , "DUCKDB_V2_ERROR hs_bindgen_f0194d9095a9ee5e ("
+  , "  duckdb_v2_table_function_init_global_info_handle arg1,"
+  , "  idx_t arg2,"
+  , "  idx_t *arg3,"
+  , "  duckdb_v2_error_info_handle *arg4"
+  , ")"
+  , "{"
+  , "  return (duckdb_v2_table_function_init_global_get_column_index)(arg1, arg2, arg3, arg4);"
+  , "}"
+  , "DUCKDB_V2_ERROR hs_bindgen_4886b8732bf62461 ("
+  , "  duckdb_v2_table_function_init_local_info_handle arg1,"
+  , "  void **arg2,"
+  , "  duckdb_v2_error_info_handle *arg3"
+  , ")"
+  , "{"
+  , "  return (duckdb_v2_table_function_init_local_get_user_data)(arg1, arg2, arg3);"
+  , "}"
+  , "DUCKDB_V2_ERROR hs_bindgen_347565870e1787bc ("
+  , "  duckdb_v2_table_function_init_local_info_handle arg1,"
+  , "  void **arg2,"
+  , "  duckdb_v2_error_info_handle *arg3"
+  , ")"
+  , "{"
+  , "  return (duckdb_v2_table_function_init_local_get_bind_data)(arg1, arg2, arg3);"
+  , "}"
+  , "DUCKDB_V2_ERROR hs_bindgen_0113c71cd8eacb6f ("
+  , "  duckdb_v2_table_function_init_local_info_handle arg1,"
+  , "  void **arg2,"
+  , "  duckdb_v2_error_info_handle *arg3"
+  , ")"
+  , "{"
+  , "  return (duckdb_v2_table_function_init_local_get_global_state)(arg1, arg2, arg3);"
+  , "}"
+  , "DUCKDB_V2_ERROR hs_bindgen_f6ae35e7d61cb905 ("
+  , "  duckdb_v2_table_function_init_local_info_handle arg1,"
+  , "  duckdb_v2_opaque *arg2,"
+  , "  duckdb_v2_error_info_handle *arg3"
+  , ")"
+  , "{"
+  , "  return (duckdb_v2_table_function_init_local_set_local_state)(arg1, arg2, arg3);"
+  , "}"
+  , "DUCKDB_V2_ERROR hs_bindgen_f40572be1a129973 ("
+  , "  duckdb_v2_table_function_init_local_info_handle arg1,"
+  , "  idx_t *arg2,"
+  , "  duckdb_v2_error_info_handle *arg3"
+  , ")"
+  , "{"
+  , "  return (duckdb_v2_table_function_init_local_get_column_count)(arg1, arg2, arg3);"
+  , "}"
+  , "DUCKDB_V2_ERROR hs_bindgen_726441c2f211fcef ("
+  , "  duckdb_v2_table_function_init_local_info_handle arg1,"
+  , "  idx_t arg2,"
+  , "  idx_t *arg3,"
+  , "  duckdb_v2_error_info_handle *arg4"
+  , ")"
+  , "{"
+  , "  return (duckdb_v2_table_function_init_local_get_column_index)(arg1, arg2, arg3, arg4);"
+  , "}"
+  , "DUCKDB_V2_ERROR hs_bindgen_78a0b090ff8d7af3 ("
+  , "  duckdb_v2_table_function_exec_info_handle arg1,"
+  , "  void **arg2,"
+  , "  duckdb_v2_error_info_handle *arg3"
+  , ")"
+  , "{"
+  , "  return (duckdb_v2_table_function_exec_get_user_data)(arg1, arg2, arg3);"
+  , "}"
+  , "DUCKDB_V2_ERROR hs_bindgen_d50ab9edbbc73dbf ("
+  , "  duckdb_v2_table_function_exec_info_handle arg1,"
+  , "  void **arg2,"
+  , "  duckdb_v2_error_info_handle *arg3"
+  , ")"
+  , "{"
+  , "  return (duckdb_v2_table_function_exec_get_bind_data)(arg1, arg2, arg3);"
+  , "}"
+  , "DUCKDB_V2_ERROR hs_bindgen_c833d297d2307e8b ("
+  , "  duckdb_v2_table_function_exec_info_handle arg1,"
+  , "  void **arg2,"
+  , "  duckdb_v2_error_info_handle *arg3"
+  , ")"
+  , "{"
+  , "  return (duckdb_v2_table_function_exec_get_global_state)(arg1, arg2, arg3);"
+  , "}"
+  , "DUCKDB_V2_ERROR hs_bindgen_b6852ffa8009ca44 ("
+  , "  duckdb_v2_table_function_exec_info_handle arg1,"
+  , "  void **arg2,"
+  , "  duckdb_v2_error_info_handle *arg3"
+  , ")"
+  , "{"
+  , "  return (duckdb_v2_table_function_exec_get_local_state)(arg1, arg2, arg3);"
+  , "}"
+  , "DUCKDB_V2_ERROR hs_bindgen_860d56c8d885d624 ("
+  , "  duckdb_v2_table_function_exec_info_handle arg1,"
+  , "  duckdb_v2_data_chunk_handle *arg2,"
+  , "  duckdb_v2_error_info_handle *arg3"
+  , ")"
+  , "{"
+  , "  return (duckdb_v2_table_function_exec_get_output_chunk)(arg1, arg2, arg3);"
+  , "}"
+  , "DUCKDB_V2_ERROR hs_bindgen_cc532ba466dfbcba ("
+  , "  duckdb_v2_table_function_exec_info_handle arg1,"
+  , "  idx_t *arg2,"
+  , "  duckdb_v2_error_info_handle *arg3"
+  , ")"
+  , "{"
+  , "  return (duckdb_v2_table_function_exec_get_column_count)(arg1, arg2, arg3);"
+  , "}"
+  , "DUCKDB_V2_ERROR hs_bindgen_4badc2888a6d5d0b ("
+  , "  duckdb_v2_table_function_exec_info_handle arg1,"
+  , "  idx_t arg2,"
+  , "  idx_t *arg3,"
+  , "  duckdb_v2_error_info_handle *arg4"
+  , ")"
+  , "{"
+  , "  return (duckdb_v2_table_function_exec_get_column_index)(arg1, arg2, arg3, arg4);"
+  , "}"
+  , "DUCKDB_V2_ERROR hs_bindgen_087cb2c6d4e809ea ("
+  , "  duckdb_v2_table_function_progress_info_handle arg1,"
+  , "  void **arg2,"
+  , "  duckdb_v2_error_info_handle *arg3"
+  , ")"
+  , "{"
+  , "  return (duckdb_v2_table_function_progress_get_user_data)(arg1, arg2, arg3);"
+  , "}"
+  , "DUCKDB_V2_ERROR hs_bindgen_0441109e7aba7bf2 ("
+  , "  duckdb_v2_table_function_progress_info_handle arg1,"
+  , "  void **arg2,"
+  , "  duckdb_v2_error_info_handle *arg3"
+  , ")"
+  , "{"
+  , "  return (duckdb_v2_table_function_progress_get_bind_data)(arg1, arg2, arg3);"
+  , "}"
+  , "DUCKDB_V2_ERROR hs_bindgen_68dd8d5fa07f048c ("
+  , "  duckdb_v2_table_function_progress_info_handle arg1,"
+  , "  void **arg2,"
+  , "  duckdb_v2_error_info_handle *arg3"
+  , ")"
+  , "{"
+  , "  return (duckdb_v2_table_function_progress_get_global_state)(arg1, arg2, arg3);"
+  , "}"
+  , "DUCKDB_V2_ERROR hs_bindgen_d16c2e0c7fe027ee ("
+  , "  duckdb_v2_table_function_progress_info_handle arg1,"
+  , "  double arg2,"
+  , "  duckdb_v2_error_info_handle *arg3"
+  , ")"
+  , "{"
+  , "  return (duckdb_v2_table_function_progress_set_progress)(arg1, arg2, arg3);"
+  , "}"
+  , "DUCKDB_V2_ERROR hs_bindgen_d7a5d31099aa0be3 ("
+  , "  duckdb_v2_table_function_filter_pushdown_info_handle arg1,"
+  , "  void **arg2,"
+  , "  duckdb_v2_error_info_handle *arg3"
+  , ")"
+  , "{"
+  , "  return (duckdb_v2_table_function_filter_pushdown_get_user_data)(arg1, arg2, arg3);"
+  , "}"
+  , "DUCKDB_V2_ERROR hs_bindgen_6446a8d127208048 ("
+  , "  duckdb_v2_table_function_filter_pushdown_info_handle arg1,"
+  , "  void **arg2,"
+  , "  duckdb_v2_error_info_handle *arg3"
+  , ")"
+  , "{"
+  , "  return (duckdb_v2_table_function_filter_pushdown_get_bind_data)(arg1, arg2, arg3);"
+  , "}"
+  , "DUCKDB_V2_ERROR hs_bindgen_b0331a679559389f ("
+  , "  duckdb_v2_table_function_filter_pushdown_info_handle arg1,"
+  , "  idx_t *arg2,"
+  , "  duckdb_v2_error_info_handle *arg3"
+  , ")"
+  , "{"
+  , "  return (duckdb_v2_table_function_filter_pushdown_get_filter_count)(arg1, arg2, arg3);"
+  , "}"
+  , "DUCKDB_V2_ERROR hs_bindgen_3fce1781e46440da ("
+  , "  duckdb_v2_table_function_filter_pushdown_info_handle arg1,"
+  , "  idx_t arg2,"
+  , "  duckdb_v2_expression_handle *arg3,"
+  , "  duckdb_v2_error_info_handle *arg4"
+  , ")"
+  , "{"
+  , "  return (duckdb_v2_table_function_filter_pushdown_get_filter)(arg1, arg2, arg3, arg4);"
+  , "}"
+  , "DUCKDB_V2_ERROR hs_bindgen_99099150da26b05e ("
+  , "  duckdb_v2_table_function_filter_pushdown_info_handle arg1,"
+  , "  idx_t arg2,"
+  , "  duckdb_v2_error_info_handle *arg3"
+  , ")"
+  , "{"
+  , "  return (duckdb_v2_table_function_filter_pushdown_accept)(arg1, arg2, arg3);"
+  , "}"
+  , "DUCKDB_V2_ERROR hs_bindgen_65fc674ea4fdc1f3 ("
+  , "  duckdb_v2_table_function_filter_pushdown_info_handle arg1,"
+  , "  idx_t *arg2,"
+  , "  duckdb_v2_error_info_handle *arg3"
+  , ")"
+  , "{"
+  , "  return (duckdb_v2_table_function_filter_pushdown_get_column_count)(arg1, arg2, arg3);"
+  , "}"
+  , "DUCKDB_V2_ERROR hs_bindgen_e113c0615574991d ("
+  , "  duckdb_v2_table_function_filter_pushdown_info_handle arg1,"
+  , "  idx_t arg2,"
+  , "  idx_t *arg3,"
+  , "  duckdb_v2_error_info_handle *arg4"
+  , ")"
+  , "{"
+  , "  return (duckdb_v2_table_function_filter_pushdown_get_column_index)(arg1, arg2, arg3, arg4);"
+  , "}"
+  , "DUCKDB_V2_ERROR hs_bindgen_70a7024399147586 ("
+  , "  duckdb_v2_table_function_partition_data_info_handle arg1,"
+  , "  void **arg2,"
+  , "  duckdb_v2_error_info_handle *arg3"
+  , ")"
+  , "{"
+  , "  return (duckdb_v2_table_function_partition_data_get_user_data)(arg1, arg2, arg3);"
+  , "}"
+  , "DUCKDB_V2_ERROR hs_bindgen_d363a045c5cce5ea ("
+  , "  duckdb_v2_table_function_partition_data_info_handle arg1,"
+  , "  void **arg2,"
+  , "  duckdb_v2_error_info_handle *arg3"
+  , ")"
+  , "{"
+  , "  return (duckdb_v2_table_function_partition_data_get_bind_data)(arg1, arg2, arg3);"
+  , "}"
+  , "DUCKDB_V2_ERROR hs_bindgen_86109e535d0bc157 ("
+  , "  duckdb_v2_table_function_partition_data_info_handle arg1,"
+  , "  void **arg2,"
+  , "  duckdb_v2_error_info_handle *arg3"
+  , ")"
+  , "{"
+  , "  return (duckdb_v2_table_function_partition_data_get_global_state)(arg1, arg2, arg3);"
+  , "}"
+  , "DUCKDB_V2_ERROR hs_bindgen_29605ce2d0a81284 ("
+  , "  duckdb_v2_table_function_partition_data_info_handle arg1,"
+  , "  void **arg2,"
+  , "  duckdb_v2_error_info_handle *arg3"
+  , ")"
+  , "{"
+  , "  return (duckdb_v2_table_function_partition_data_get_local_state)(arg1, arg2, arg3);"
+  , "}"
+  , "DUCKDB_V2_ERROR hs_bindgen_472e8853c25b15e3 ("
+  , "  duckdb_v2_table_function_partition_data_info_handle arg1,"
+  , "  _Bool *arg2,"
+  , "  duckdb_v2_error_info_handle *arg3"
+  , ")"
+  , "{"
+  , "  return (duckdb_v2_table_function_partition_data_requires_batch_index)(arg1, arg2, arg3);"
+  , "}"
+  , "DUCKDB_V2_ERROR hs_bindgen_8f6d32d89bf2c5e1 ("
+  , "  duckdb_v2_table_function_partition_data_info_handle arg1,"
+  , "  _Bool *arg2,"
+  , "  duckdb_v2_error_info_handle *arg3"
+  , ")"
+  , "{"
+  , "  return (duckdb_v2_table_function_partition_data_requires_partition_columns)(arg1, arg2, arg3);"
+  , "}"
+  , "DUCKDB_V2_ERROR hs_bindgen_51c5821229259a9e ("
+  , "  duckdb_v2_table_function_partition_data_info_handle arg1,"
+  , "  idx_t *arg2,"
+  , "  duckdb_v2_error_info_handle *arg3"
+  , ")"
+  , "{"
+  , "  return (duckdb_v2_table_function_partition_data_get_partition_column_count)(arg1, arg2, arg3);"
+  , "}"
+  , "DUCKDB_V2_ERROR hs_bindgen_3e72a638c06af7ec ("
+  , "  duckdb_v2_table_function_partition_data_info_handle arg1,"
+  , "  idx_t arg2,"
+  , "  idx_t *arg3,"
+  , "  duckdb_v2_error_info_handle *arg4"
+  , ")"
+  , "{"
+  , "  return (duckdb_v2_table_function_partition_data_get_partition_column_index)(arg1, arg2, arg3, arg4);"
+  , "}"
+  , "DUCKDB_V2_ERROR hs_bindgen_756227b9867112c7 ("
+  , "  duckdb_v2_table_function_partition_data_info_handle arg1,"
+  , "  idx_t arg2,"
+  , "  duckdb_v2_error_info_handle *arg3"
+  , ")"
+  , "{"
+  , "  return (duckdb_v2_table_function_partition_data_set_batch_index)(arg1, arg2, arg3);"
+  , "}"
+  , "DUCKDB_V2_ERROR hs_bindgen_bdeeb6f63d89c30c ("
+  , "  duckdb_v2_table_function_partition_data_info_handle arg1,"
+  , "  idx_t arg2,"
+  , "  duckdb_v2_value_handle arg3,"
+  , "  duckdb_v2_error_info_handle *arg4"
+  , ")"
+  , "{"
+  , "  return (duckdb_v2_table_function_partition_data_set_partition_value)(arg1, arg2, arg3, arg4);"
+  , "}"
+  , "DUCKDB_V2_ERROR hs_bindgen_ff39060def052198 ("
+  , "  duckdb_v2_table_function_partitioning_info_handle arg1,"
+  , "  void **arg2,"
+  , "  duckdb_v2_error_info_handle *arg3"
+  , ")"
+  , "{"
+  , "  return (duckdb_v2_table_function_partitioning_get_user_data)(arg1, arg2, arg3);"
+  , "}"
+  , "DUCKDB_V2_ERROR hs_bindgen_8dd43b06a11f6b8d ("
+  , "  duckdb_v2_table_function_partitioning_info_handle arg1,"
+  , "  void **arg2,"
+  , "  duckdb_v2_error_info_handle *arg3"
+  , ")"
+  , "{"
+  , "  return (duckdb_v2_table_function_partitioning_get_bind_data)(arg1, arg2, arg3);"
+  , "}"
+  , "DUCKDB_V2_ERROR hs_bindgen_15d230141f8f5c35 ("
+  , "  duckdb_v2_table_function_partitioning_info_handle arg1,"
+  , "  idx_t *arg2,"
+  , "  duckdb_v2_error_info_handle *arg3"
+  , ")"
+  , "{"
+  , "  return (duckdb_v2_table_function_partitioning_get_partition_column_count)(arg1, arg2, arg3);"
+  , "}"
+  , "DUCKDB_V2_ERROR hs_bindgen_e91aef7f35be59d7 ("
+  , "  duckdb_v2_table_function_partitioning_info_handle arg1,"
+  , "  idx_t arg2,"
+  , "  idx_t *arg3,"
+  , "  duckdb_v2_error_info_handle *arg4"
+  , ")"
+  , "{"
+  , "  return (duckdb_v2_table_function_partitioning_get_partition_column_index)(arg1, arg2, arg3, arg4);"
+  , "}"
+  , "DUCKDB_V2_ERROR hs_bindgen_ddea7fbd94a03432 ("
+  , "  duckdb_v2_table_function_partitioning_info_handle arg1,"
+  , "  DUCKDB_V2_TABLE_PARTITION_INFO arg2,"
+  , "  duckdb_v2_error_info_handle *arg3"
+  , ")"
+  , "{"
+  , "  return (duckdb_v2_table_function_partitioning_set_partition_info)(arg1, arg2, arg3);"
+  , "}"
+  , "DUCKDB_V2_ERROR hs_bindgen_45822929a1ed3d54 ("
+  , "  duckdb_v2_connection_handle arg1,"
+  , "  duckdb_v2_table_function_handle arg2,"
+  , "  duckdb_v2_error_info_handle *arg3"
+  , ")"
+  , "{"
+  , "  return (duckdb_v2_connection_register_table_function)(arg1, arg2, arg3);"
+  , "}"
+  , "DUCKDB_V2_ERROR hs_bindgen_b68623d8964d2c4f ("
+  , "  duckdb_v2_extension_handle arg1,"
+  , "  duckdb_v2_table_function_handle arg2,"
+  , "  duckdb_v2_error_info_handle *arg3"
+  , ")"
+  , "{"
+  , "  return (duckdb_v2_extension_register_table_function)(arg1, arg2, arg3);"
+  , "}"
+  , "DUCKDB_V2_ERROR hs_bindgen_0a6c6bcb445fe4dc ("
+  , "  duckdb_v2_table_function_handle *arg1"
+  , ")"
+  , "{"
+  , "  return (duckdb_v2_table_function_destroy)(arg1);"
+  , "}"
+  , "DUCKDB_V2_ERROR hs_bindgen_0b5a4324a94f3e1b ("
+  , "  duckdb_v2_table_function_handle arg1,"
+  , "  duckdb_v2_table_function_claim_batch_callback_fn arg2,"
+  , "  duckdb_v2_error_info_handle *arg3"
+  , ")"
+  , "{"
+  , "  return (duckdb_v2_table_function_set_claim_batch_callback)(arg1, arg2, arg3);"
+  , "}"
+  , "DUCKDB_V2_ERROR hs_bindgen_4ae88de2742a54ca ("
+  , "  duckdb_v2_table_function_claim_batch_info_handle arg1,"
+  , "  void **arg2,"
+  , "  duckdb_v2_error_info_handle *arg3"
+  , ")"
+  , "{"
+  , "  return (duckdb_v2_table_function_claim_batch_get_user_data)(arg1, arg2, arg3);"
+  , "}"
+  , "DUCKDB_V2_ERROR hs_bindgen_bea3238755746cd7 ("
+  , "  duckdb_v2_table_function_claim_batch_info_handle arg1,"
+  , "  void **arg2,"
+  , "  duckdb_v2_error_info_handle *arg3"
+  , ")"
+  , "{"
+  , "  return (duckdb_v2_table_function_claim_batch_get_bind_data)(arg1, arg2, arg3);"
+  , "}"
+  , "DUCKDB_V2_ERROR hs_bindgen_76da5357e6653548 ("
+  , "  duckdb_v2_table_function_claim_batch_info_handle arg1,"
+  , "  void **arg2,"
+  , "  duckdb_v2_error_info_handle *arg3"
+  , ")"
+  , "{"
+  , "  return (duckdb_v2_table_function_claim_batch_get_global_state)(arg1, arg2, arg3);"
+  , "}"
+  , "DUCKDB_V2_ERROR hs_bindgen_2cbd79f8b6dc7864 ("
+  , "  duckdb_v2_table_function_claim_batch_info_handle arg1,"
+  , "  void **arg2,"
+  , "  duckdb_v2_error_info_handle *arg3"
+  , ")"
+  , "{"
+  , "  return (duckdb_v2_table_function_claim_batch_get_local_state)(arg1, arg2, arg3);"
+  , "}"
+  , "DUCKDB_V2_ERROR hs_bindgen_1d6ee8a1f8df1725 ("
+  , "  duckdb_v2_table_function_claim_batch_info_handle arg1,"
+  , "  _Bool arg2,"
+  , "  duckdb_v2_error_info_handle *arg3"
+  , ")"
+  , "{"
+  , "  return (duckdb_v2_table_function_claim_batch_set_claimed)(arg1, arg2, arg3);"
+  , "}"
+  , "DUCKDB_V2_ERROR hs_bindgen_49f8f9ef6c5c2c3d ("
+  , "  duckdb_v2_table_function_handle arg1,"
+  , "  duckdb_v2_table_function_get_bind_info_callback_fn arg2,"
+  , "  duckdb_v2_error_info_handle *arg3"
+  , ")"
+  , "{"
+  , "  return (duckdb_v2_table_function_set_get_bind_info_callback)(arg1, arg2, arg3);"
+  , "}"
+  , "DUCKDB_V2_ERROR hs_bindgen_a6ea2965714f798a ("
+  , "  duckdb_v2_table_function_get_bind_info_info_handle arg1,"
+  , "  void **arg2,"
+  , "  duckdb_v2_error_info_handle *arg3"
+  , ")"
+  , "{"
+  , "  return (duckdb_v2_table_function_get_bind_info_get_user_data)(arg1, arg2, arg3);"
+  , "}"
+  , "DUCKDB_V2_ERROR hs_bindgen_0dfe9d7889b3679f ("
+  , "  duckdb_v2_table_function_get_bind_info_info_handle arg1,"
+  , "  void **arg2,"
+  , "  duckdb_v2_error_info_handle *arg3"
+  , ")"
+  , "{"
+  , "  return (duckdb_v2_table_function_get_bind_info_get_bind_data)(arg1, arg2, arg3);"
+  , "}"
+  , "DUCKDB_V2_ERROR hs_bindgen_74f97126d16d1ace ("
+  , "  duckdb_v2_table_function_get_bind_info_info_handle arg1,"
+  , "  idx_t arg2,"
+  , "  idx_t const *arg3,"
+  , "  idx_t arg4,"
+  , "  duckdb_v2_value_handle arg5,"
+  , "  duckdb_v2_error_info_handle *arg6"
+  , ")"
+  , "{"
+  , "  return (duckdb_v2_table_function_get_bind_info_set_column_identifier)(arg1, arg2, arg3, arg4, arg5, arg6);"
+  , "}"
+  , "DUCKDB_V2_ERROR hs_bindgen_213e2fcdcc617c2b ("
+  , "  duckdb_v2_table_function_get_bind_info_info_handle arg1,"
+  , "  duckdb_v2_str *arg2,"
+  , "  duckdb_v2_value_handle arg3,"
+  , "  duckdb_v2_error_info_handle *arg4"
+  , ")"
+  , "{"
+  , "  return (duckdb_v2_table_function_get_bind_info_set_option)(arg1, arg2, arg3, arg4);"
+  , "}"
+  , "DUCKDB_V2_ERROR hs_bindgen_76350e2af97981c0 ("
+  , "  duckdb_v2_factory_handle arg1,"
+  , "  duckdb_v2_multi_file_function_handle *arg2,"
+  , "  duckdb_v2_error_info_handle *arg3"
+  , ")"
+  , "{"
+  , "  return (duckdb_v2_multi_file_function_create)(arg1, arg2, arg3);"
+  , "}"
+  , "DUCKDB_V2_ERROR hs_bindgen_3114331ea8c67f69 ("
+  , "  duckdb_v2_multi_file_function_handle arg1,"
+  , "  duckdb_v2_str *arg2,"
+  , "  duckdb_v2_error_info_handle *arg3"
+  , ")"
+  , "{"
+  , "  return (duckdb_v2_multi_file_function_set_name)(arg1, arg2, arg3);"
+  , "}"
+  , "DUCKDB_V2_ERROR hs_bindgen_93bfff0d12987d3d ("
+  , "  duckdb_v2_multi_file_function_handle arg1,"
+  , "  duckdb_v2_str *arg2,"
+  , "  duckdb_v2_error_info_handle *arg3"
+  , ")"
+  , "{"
+  , "  return (duckdb_v2_multi_file_function_set_single_file_function)(arg1, arg2, arg3);"
+  , "}"
+  , "DUCKDB_V2_ERROR hs_bindgen_bc3af1f9a2f89979 ("
+  , "  duckdb_v2_multi_file_function_handle arg1,"
+  , "  duckdb_v2_str *arg2,"
+  , "  duckdb_v2_error_info_handle *arg3"
+  , ")"
+  , "{"
+  , "  return (duckdb_v2_multi_file_function_set_reader_type)(arg1, arg2, arg3);"
+  , "}"
+  , "DUCKDB_V2_ERROR hs_bindgen_15e91fdbb9b0ffcc ("
+  , "  duckdb_v2_multi_file_function_handle arg1,"
+  , "  duckdb_v2_str *arg2,"
+  , "  duckdb_v2_error_info_handle *arg3"
+  , ")"
+  , "{"
+  , "  return (duckdb_v2_multi_file_function_set_file_extension)(arg1, arg2, arg3);"
+  , "}"
+  , "DUCKDB_V2_ERROR hs_bindgen_bbc5afea7eae54a3 ("
+  , "  duckdb_v2_connection_handle arg1,"
+  , "  duckdb_v2_multi_file_function_handle arg2,"
+  , "  duckdb_v2_error_info_handle *arg3"
+  , ")"
+  , "{"
+  , "  return (duckdb_v2_connection_register_multi_file_function)(arg1, arg2, arg3);"
+  , "}"
+  , "DUCKDB_V2_ERROR hs_bindgen_9f30b7fefa852dca ("
+  , "  duckdb_v2_extension_handle arg1,"
+  , "  duckdb_v2_multi_file_function_handle arg2,"
+  , "  duckdb_v2_error_info_handle *arg3"
+  , ")"
+  , "{"
+  , "  return (duckdb_v2_extension_register_multi_file_function)(arg1, arg2, arg3);"
+  , "}"
+  , "DUCKDB_V2_ERROR hs_bindgen_3828911399bdcc87 ("
+  , "  duckdb_v2_multi_file_function_handle *arg1"
+  , ")"
+  , "{"
+  , "  return (duckdb_v2_multi_file_function_destroy)(arg1);"
+  , "}"
+  , "DUCKDB_V2_ERROR hs_bindgen_05ac09c9be5a4021 ("
+  , "  duckdb_v2_value_handle *arg1"
+  , ")"
+  , "{"
+  , "  return (duckdb_v2_value_destroy)(arg1);"
+  , "}"
+  , "DUCKDB_V2_ERROR hs_bindgen_39756f700939b775 ("
+  , "  duckdb_v2_value_handle arg1,"
+  , "  _Bool *arg2,"
+  , "  duckdb_v2_error_info_handle *arg3"
+  , ")"
+  , "{"
+  , "  return (duckdb_v2_value_get_bool)(arg1, arg2, arg3);"
+  , "}"
+  , "DUCKDB_V2_ERROR hs_bindgen_c766e44b55c10466 ("
+  , "  duckdb_v2_value_handle arg1,"
+  , "  uint8_t *arg2,"
+  , "  duckdb_v2_error_info_handle *arg3"
+  , ")"
+  , "{"
+  , "  return (duckdb_v2_value_get_utinyint)(arg1, arg2, arg3);"
+  , "}"
+  , "DUCKDB_V2_ERROR hs_bindgen_c2c8be9c47379447 ("
+  , "  duckdb_v2_value_handle arg1,"
+  , "  uint16_t *arg2,"
+  , "  duckdb_v2_error_info_handle *arg3"
+  , ")"
+  , "{"
+  , "  return (duckdb_v2_value_get_usmallint)(arg1, arg2, arg3);"
+  , "}"
+  , "DUCKDB_V2_ERROR hs_bindgen_51e59eb3b1593456 ("
+  , "  duckdb_v2_value_handle arg1,"
+  , "  uint32_t *arg2,"
+  , "  duckdb_v2_error_info_handle *arg3"
+  , ")"
+  , "{"
+  , "  return (duckdb_v2_value_get_uint)(arg1, arg2, arg3);"
+  , "}"
+  , "DUCKDB_V2_ERROR hs_bindgen_a38e8f8bb381782c ("
+  , "  duckdb_v2_value_handle arg1,"
+  , "  uint64_t *arg2,"
+  , "  duckdb_v2_error_info_handle *arg3"
+  , ")"
+  , "{"
+  , "  return (duckdb_v2_value_get_ubigint)(arg1, arg2, arg3);"
+  , "}"
+  , "DUCKDB_V2_ERROR hs_bindgen_51c5a5c17fd68cd0 ("
+  , "  duckdb_v2_value_handle arg1,"
+  , "  duckdb_v2_uhugeint_t *arg2,"
+  , "  duckdb_v2_error_info_handle *arg3"
+  , ")"
+  , "{"
+  , "  return (duckdb_v2_value_get_uhugeint)(arg1, arg2, arg3);"
+  , "}"
+  , "DUCKDB_V2_ERROR hs_bindgen_045486df7d6dcf11 ("
+  , "  duckdb_v2_value_handle arg1,"
+  , "  int8_t *arg2,"
+  , "  duckdb_v2_error_info_handle *arg3"
+  , ")"
+  , "{"
+  , "  return (duckdb_v2_value_get_tinyint)(arg1, arg2, arg3);"
+  , "}"
+  , "DUCKDB_V2_ERROR hs_bindgen_9b7f777a260cde64 ("
+  , "  duckdb_v2_value_handle arg1,"
+  , "  int16_t *arg2,"
+  , "  duckdb_v2_error_info_handle *arg3"
+  , ")"
+  , "{"
+  , "  return (duckdb_v2_value_get_smallint)(arg1, arg2, arg3);"
+  , "}"
+  , "DUCKDB_V2_ERROR hs_bindgen_ad2f4d0358ba054b ("
+  , "  duckdb_v2_value_handle arg1,"
+  , "  int32_t *arg2,"
+  , "  duckdb_v2_error_info_handle *arg3"
+  , ")"
+  , "{"
+  , "  return (duckdb_v2_value_get_int)(arg1, arg2, arg3);"
+  , "}"
+  , "DUCKDB_V2_ERROR hs_bindgen_3785208a3e88cdf7 ("
+  , "  duckdb_v2_value_handle arg1,"
+  , "  int64_t *arg2,"
+  , "  duckdb_v2_error_info_handle *arg3"
+  , ")"
+  , "{"
+  , "  return (duckdb_v2_value_get_bigint)(arg1, arg2, arg3);"
+  , "}"
+  , "DUCKDB_V2_ERROR hs_bindgen_c0b189023ab92265 ("
+  , "  duckdb_v2_value_handle arg1,"
+  , "  duckdb_v2_hugeint_t *arg2,"
+  , "  duckdb_v2_error_info_handle *arg3"
+  , ")"
+  , "{"
+  , "  return (duckdb_v2_value_get_hugeint)(arg1, arg2, arg3);"
+  , "}"
+  , "DUCKDB_V2_ERROR hs_bindgen_2b847cce94fb8e60 ("
+  , "  duckdb_v2_value_handle arg1,"
+  , "  duckdb_v2_str *arg2,"
+  , "  duckdb_v2_error_info_handle *arg3"
+  , ")"
+  , "{"
+  , "  return (duckdb_v2_value_get_varchar)(arg1, arg2, arg3);"
+  , "}"
+  , "DUCKDB_V2_ERROR hs_bindgen_098348ddb2669fc7 ("
+  , "  duckdb_v2_value_handle arg1,"
+  , "  duckdb_v2_str *arg2,"
+  , "  duckdb_v2_error_info_handle *arg3"
+  , ")"
+  , "{"
+  , "  return (duckdb_v2_value_get_blob)(arg1, arg2, arg3);"
+  , "}"
+  , "DUCKDB_V2_ERROR hs_bindgen_b9c2656fbd9907ac ("
+  , "  duckdb_v2_value_handle arg1,"
+  , "  float *arg2,"
+  , "  duckdb_v2_error_info_handle *arg3"
+  , ")"
+  , "{"
+  , "  return (duckdb_v2_value_get_float)(arg1, arg2, arg3);"
+  , "}"
+  , "DUCKDB_V2_ERROR hs_bindgen_0dc27faab0b6c53f ("
+  , "  duckdb_v2_value_handle arg1,"
+  , "  double *arg2,"
+  , "  duckdb_v2_error_info_handle *arg3"
+  , ")"
+  , "{"
+  , "  return (duckdb_v2_value_get_double)(arg1, arg2, arg3);"
+  , "}"
+  , "DUCKDB_V2_ERROR hs_bindgen_e5424260d1544531 ("
+  , "  duckdb_v2_value_handle arg1,"
+  , "  int32_t *arg2,"
+  , "  duckdb_v2_error_info_handle *arg3"
+  , ")"
+  , "{"
+  , "  return (duckdb_v2_value_get_date)(arg1, arg2, arg3);"
+  , "}"
+  , "DUCKDB_V2_ERROR hs_bindgen_f49d3291d05e527c ("
+  , "  duckdb_v2_value_handle arg1,"
+  , "  int64_t *arg2,"
+  , "  duckdb_v2_error_info_handle *arg3"
+  , ")"
+  , "{"
+  , "  return (duckdb_v2_value_get_time)(arg1, arg2, arg3);"
+  , "}"
+  , "DUCKDB_V2_ERROR hs_bindgen_84f6244055551531 ("
+  , "  duckdb_v2_value_handle arg1,"
+  , "  int64_t *arg2,"
+  , "  duckdb_v2_error_info_handle *arg3"
+  , ")"
+  , "{"
+  , "  return (duckdb_v2_value_get_time_ns)(arg1, arg2, arg3);"
+  , "}"
+  , "DUCKDB_V2_ERROR hs_bindgen_80a6c91db01dc8ec ("
+  , "  duckdb_v2_value_handle arg1,"
+  , "  uint64_t *arg2,"
+  , "  duckdb_v2_error_info_handle *arg3"
+  , ")"
+  , "{"
+  , "  return (duckdb_v2_value_get_time_tz)(arg1, arg2, arg3);"
+  , "}"
+  , "DUCKDB_V2_ERROR hs_bindgen_a799d177e44f5c97 ("
+  , "  duckdb_v2_value_handle arg1,"
+  , "  int64_t *arg2,"
+  , "  duckdb_v2_error_info_handle *arg3"
+  , ")"
+  , "{"
+  , "  return (duckdb_v2_value_get_timestamp)(arg1, arg2, arg3);"
+  , "}"
+  , "DUCKDB_V2_ERROR hs_bindgen_62ae61f1eb4769f6 ("
+  , "  duckdb_v2_value_handle arg1,"
+  , "  int64_t *arg2,"
+  , "  duckdb_v2_error_info_handle *arg3"
+  , ")"
+  , "{"
+  , "  return (duckdb_v2_value_get_timestamp_sec)(arg1, arg2, arg3);"
+  , "}"
+  , "DUCKDB_V2_ERROR hs_bindgen_3e2cf5344d055396 ("
+  , "  duckdb_v2_value_handle arg1,"
+  , "  int64_t *arg2,"
+  , "  duckdb_v2_error_info_handle *arg3"
+  , ")"
+  , "{"
+  , "  return (duckdb_v2_value_get_timestamp_ms)(arg1, arg2, arg3);"
+  , "}"
+  , "DUCKDB_V2_ERROR hs_bindgen_d9ca87646112e942 ("
+  , "  duckdb_v2_value_handle arg1,"
+  , "  int64_t *arg2,"
+  , "  duckdb_v2_error_info_handle *arg3"
+  , ")"
+  , "{"
+  , "  return (duckdb_v2_value_get_timestamp_ns)(arg1, arg2, arg3);"
+  , "}"
+  , "DUCKDB_V2_ERROR hs_bindgen_9de5d0f2fa22a17f ("
+  , "  duckdb_v2_value_handle arg1,"
+  , "  int64_t *arg2,"
+  , "  duckdb_v2_error_info_handle *arg3"
+  , ")"
+  , "{"
+  , "  return (duckdb_v2_value_get_timestamp_tz)(arg1, arg2, arg3);"
+  , "}"
+  , "DUCKDB_V2_ERROR hs_bindgen_b523af67ff886981 ("
+  , "  duckdb_v2_value_handle arg1,"
+  , "  int64_t *arg2,"
+  , "  duckdb_v2_error_info_handle *arg3"
+  , ")"
+  , "{"
+  , "  return (duckdb_v2_value_get_timestamp_tz_ns)(arg1, arg2, arg3);"
+  , "}"
+  , "DUCKDB_V2_ERROR hs_bindgen_f839a8299f551e8a ("
+  , "  duckdb_v2_value_handle arg1,"
+  , "  duckdb_v2_interval_t *arg2,"
+  , "  duckdb_v2_error_info_handle *arg3"
+  , ")"
+  , "{"
+  , "  return (duckdb_v2_value_get_interval)(arg1, arg2, arg3);"
+  , "}"
+  , "DUCKDB_V2_ERROR hs_bindgen_9139e719ca4b9cf9 ("
+  , "  duckdb_v2_value_handle arg1,"
+  , "  duckdb_v2_hugeint_t *arg2,"
+  , "  duckdb_v2_error_info_handle *arg3"
+  , ")"
+  , "{"
+  , "  return (duckdb_v2_value_get_uuid)(arg1, arg2, arg3);"
+  , "}"
+  , "DUCKDB_V2_ERROR hs_bindgen_1df25feef13beab2 ("
+  , "  duckdb_v2_value_handle arg1,"
+  , "  duckdb_v2_hugeint_t *arg2,"
+  , "  uint8_t *arg3,"
+  , "  uint8_t *arg4,"
+  , "  duckdb_v2_error_info_handle *arg5"
+  , ")"
+  , "{"
+  , "  return (duckdb_v2_value_get_decimal)(arg1, arg2, arg3, arg4, arg5);"
+  , "}"
+  , "DUCKDB_V2_ERROR hs_bindgen_e7456d094bb3f3d8 ("
+  , "  duckdb_v2_value_handle arg1,"
+  , "  duckdb_v2_logical_type_handle *arg2,"
+  , "  duckdb_v2_error_info_handle *arg3"
+  , ")"
+  , "{"
+  , "  return (duckdb_v2_value_get_type)(arg1, arg2, arg3);"
+  , "}"
+  , "DUCKDB_V2_ERROR hs_bindgen_5114d8d2019785ee ("
+  , "  duckdb_v2_factory_handle arg1,"
+  , "  duckdb_v2_logical_type_handle arg2,"
+  , "  duckdb_v2_value_handle *arg3,"
+  , "  duckdb_v2_error_info_handle *arg4"
+  , ")"
+  , "{"
+  , "  return (duckdb_v2_value_create_null)(arg1, arg2, arg3, arg4);"
+  , "}"
+  , "DUCKDB_V2_ERROR hs_bindgen_3c9f7040612f4efd ("
+  , "  duckdb_v2_factory_handle arg1,"
+  , "  _Bool arg2,"
+  , "  duckdb_v2_value_handle *arg3,"
+  , "  duckdb_v2_error_info_handle *arg4"
+  , ")"
+  , "{"
+  , "  return (duckdb_v2_value_create_bool)(arg1, arg2, arg3, arg4);"
+  , "}"
+  , "DUCKDB_V2_ERROR hs_bindgen_a0bc37a78132eec0 ("
+  , "  duckdb_v2_factory_handle arg1,"
+  , "  uint8_t arg2,"
+  , "  duckdb_v2_value_handle *arg3,"
+  , "  duckdb_v2_error_info_handle *arg4"
+  , ")"
+  , "{"
+  , "  return (duckdb_v2_value_create_utinyint)(arg1, arg2, arg3, arg4);"
+  , "}"
+  , "DUCKDB_V2_ERROR hs_bindgen_39545e9bb2a6c8c9 ("
+  , "  duckdb_v2_factory_handle arg1,"
+  , "  uint16_t arg2,"
+  , "  duckdb_v2_value_handle *arg3,"
+  , "  duckdb_v2_error_info_handle *arg4"
+  , ")"
+  , "{"
+  , "  return (duckdb_v2_value_create_usmallint)(arg1, arg2, arg3, arg4);"
+  , "}"
+  , "DUCKDB_V2_ERROR hs_bindgen_61e712c751a587b3 ("
+  , "  duckdb_v2_factory_handle arg1,"
+  , "  uint32_t arg2,"
+  , "  duckdb_v2_value_handle *arg3,"
+  , "  duckdb_v2_error_info_handle *arg4"
+  , ")"
+  , "{"
+  , "  return (duckdb_v2_value_create_uint)(arg1, arg2, arg3, arg4);"
+  , "}"
+  , "DUCKDB_V2_ERROR hs_bindgen_d66b8e1f5f9e5557 ("
+  , "  duckdb_v2_factory_handle arg1,"
+  , "  uint64_t arg2,"
+  , "  duckdb_v2_value_handle *arg3,"
+  , "  duckdb_v2_error_info_handle *arg4"
+  , ")"
+  , "{"
+  , "  return (duckdb_v2_value_create_ubigint)(arg1, arg2, arg3, arg4);"
+  , "}"
+  , "DUCKDB_V2_ERROR hs_bindgen_6b747e16d2b9cdae ("
+  , "  duckdb_v2_factory_handle arg1,"
+  , "  duckdb_v2_uhugeint_t const *arg2,"
+  , "  duckdb_v2_value_handle *arg3,"
+  , "  duckdb_v2_error_info_handle *arg4"
+  , ")"
+  , "{"
+  , "  return (duckdb_v2_value_create_uhugeint)(arg1, arg2, arg3, arg4);"
+  , "}"
+  , "DUCKDB_V2_ERROR hs_bindgen_1c7c990e0e85db52 ("
+  , "  duckdb_v2_factory_handle arg1,"
+  , "  int8_t arg2,"
+  , "  duckdb_v2_value_handle *arg3,"
+  , "  duckdb_v2_error_info_handle *arg4"
+  , ")"
+  , "{"
+  , "  return (duckdb_v2_value_create_tinyint)(arg1, arg2, arg3, arg4);"
+  , "}"
+  , "DUCKDB_V2_ERROR hs_bindgen_04db4c5281a5f0d0 ("
+  , "  duckdb_v2_factory_handle arg1,"
+  , "  int16_t arg2,"
+  , "  duckdb_v2_value_handle *arg3,"
+  , "  duckdb_v2_error_info_handle *arg4"
+  , ")"
+  , "{"
+  , "  return (duckdb_v2_value_create_smallint)(arg1, arg2, arg3, arg4);"
+  , "}"
+  , "DUCKDB_V2_ERROR hs_bindgen_f1484a1a203e28b4 ("
+  , "  duckdb_v2_factory_handle arg1,"
+  , "  int32_t arg2,"
+  , "  duckdb_v2_value_handle *arg3,"
+  , "  duckdb_v2_error_info_handle *arg4"
+  , ")"
+  , "{"
+  , "  return (duckdb_v2_value_create_int)(arg1, arg2, arg3, arg4);"
+  , "}"
+  , "DUCKDB_V2_ERROR hs_bindgen_44115a52f6f7aff2 ("
+  , "  duckdb_v2_factory_handle arg1,"
+  , "  int64_t arg2,"
+  , "  duckdb_v2_value_handle *arg3,"
+  , "  duckdb_v2_error_info_handle *arg4"
+  , ")"
+  , "{"
+  , "  return (duckdb_v2_value_create_bigint)(arg1, arg2, arg3, arg4);"
+  , "}"
+  , "DUCKDB_V2_ERROR hs_bindgen_d389268204e49951 ("
+  , "  duckdb_v2_factory_handle arg1,"
+  , "  duckdb_v2_hugeint_t const *arg2,"
+  , "  duckdb_v2_value_handle *arg3,"
+  , "  duckdb_v2_error_info_handle *arg4"
+  , ")"
+  , "{"
+  , "  return (duckdb_v2_value_create_hugeint)(arg1, arg2, arg3, arg4);"
+  , "}"
+  , "DUCKDB_V2_ERROR hs_bindgen_4933318e07a2e1bc ("
+  , "  duckdb_v2_factory_handle arg1,"
+  , "  duckdb_v2_str const *arg2,"
+  , "  duckdb_v2_value_handle *arg3,"
+  , "  duckdb_v2_error_info_handle *arg4"
+  , ")"
+  , "{"
+  , "  return (duckdb_v2_value_create_varchar)(arg1, arg2, arg3, arg4);"
+  , "}"
+  , "DUCKDB_V2_ERROR hs_bindgen_ef44c44ca9d42997 ("
+  , "  duckdb_v2_factory_handle arg1,"
+  , "  duckdb_v2_str const *arg2,"
+  , "  duckdb_v2_value_handle *arg3,"
+  , "  duckdb_v2_error_info_handle *arg4"
+  , ")"
+  , "{"
+  , "  return (duckdb_v2_value_create_blob)(arg1, arg2, arg3, arg4);"
+  , "}"
+  , "DUCKDB_V2_ERROR hs_bindgen_57589ffc7a8b4b02 ("
+  , "  duckdb_v2_factory_handle arg1,"
+  , "  float arg2,"
+  , "  duckdb_v2_value_handle *arg3,"
+  , "  duckdb_v2_error_info_handle *arg4"
+  , ")"
+  , "{"
+  , "  return (duckdb_v2_value_create_float)(arg1, arg2, arg3, arg4);"
+  , "}"
+  , "DUCKDB_V2_ERROR hs_bindgen_5d9a1739948ffc4a ("
+  , "  duckdb_v2_factory_handle arg1,"
+  , "  double arg2,"
+  , "  duckdb_v2_value_handle *arg3,"
+  , "  duckdb_v2_error_info_handle *arg4"
+  , ")"
+  , "{"
+  , "  return (duckdb_v2_value_create_double)(arg1, arg2, arg3, arg4);"
+  , "}"
+  , "DUCKDB_V2_ERROR hs_bindgen_191e7b4c2f91f970 ("
+  , "  duckdb_v2_factory_handle arg1,"
+  , "  duckdb_v2_logical_type_handle arg2,"
+  , "  duckdb_v2_value_handle *arg3,"
+  , "  duckdb_v2_error_info_handle *arg4"
+  , ")"
+  , "{"
+  , "  return (duckdb_v2_value_create_type)(arg1, arg2, arg3, arg4);"
+  , "}"
+  , "DUCKDB_V2_ERROR hs_bindgen_fe5730eae385199f ("
+  , "  duckdb_v2_factory_handle arg1,"
+  , "  int32_t arg2,"
+  , "  duckdb_v2_value_handle *arg3,"
+  , "  duckdb_v2_error_info_handle *arg4"
+  , ")"
+  , "{"
+  , "  return (duckdb_v2_value_create_date)(arg1, arg2, arg3, arg4);"
+  , "}"
+  , "DUCKDB_V2_ERROR hs_bindgen_fc290182b17c1a99 ("
+  , "  duckdb_v2_factory_handle arg1,"
+  , "  int64_t arg2,"
+  , "  duckdb_v2_value_handle *arg3,"
+  , "  duckdb_v2_error_info_handle *arg4"
+  , ")"
+  , "{"
+  , "  return (duckdb_v2_value_create_time)(arg1, arg2, arg3, arg4);"
+  , "}"
+  , "DUCKDB_V2_ERROR hs_bindgen_31a1602e50a9be80 ("
+  , "  duckdb_v2_factory_handle arg1,"
+  , "  int64_t arg2,"
+  , "  duckdb_v2_value_handle *arg3,"
+  , "  duckdb_v2_error_info_handle *arg4"
+  , ")"
+  , "{"
+  , "  return (duckdb_v2_value_create_time_ns)(arg1, arg2, arg3, arg4);"
+  , "}"
+  , "DUCKDB_V2_ERROR hs_bindgen_58bff52464b9c7dd ("
+  , "  duckdb_v2_factory_handle arg1,"
+  , "  uint64_t arg2,"
+  , "  duckdb_v2_value_handle *arg3,"
+  , "  duckdb_v2_error_info_handle *arg4"
+  , ")"
+  , "{"
+  , "  return (duckdb_v2_value_create_time_tz)(arg1, arg2, arg3, arg4);"
+  , "}"
+  , "DUCKDB_V2_ERROR hs_bindgen_af8bd23e86ca7f16 ("
+  , "  duckdb_v2_factory_handle arg1,"
+  , "  int64_t arg2,"
+  , "  duckdb_v2_value_handle *arg3,"
+  , "  duckdb_v2_error_info_handle *arg4"
+  , ")"
+  , "{"
+  , "  return (duckdb_v2_value_create_timestamp)(arg1, arg2, arg3, arg4);"
+  , "}"
+  , "DUCKDB_V2_ERROR hs_bindgen_5b8f622401e88242 ("
+  , "  duckdb_v2_factory_handle arg1,"
+  , "  int64_t arg2,"
+  , "  duckdb_v2_value_handle *arg3,"
+  , "  duckdb_v2_error_info_handle *arg4"
+  , ")"
+  , "{"
+  , "  return (duckdb_v2_value_create_timestamp_sec)(arg1, arg2, arg3, arg4);"
+  , "}"
+  , "DUCKDB_V2_ERROR hs_bindgen_77d04257358a65b6 ("
+  , "  duckdb_v2_factory_handle arg1,"
+  , "  int64_t arg2,"
+  , "  duckdb_v2_value_handle *arg3,"
+  , "  duckdb_v2_error_info_handle *arg4"
+  , ")"
+  , "{"
+  , "  return (duckdb_v2_value_create_timestamp_ms)(arg1, arg2, arg3, arg4);"
+  , "}"
+  , "DUCKDB_V2_ERROR hs_bindgen_f230ce063552d6d7 ("
+  , "  duckdb_v2_factory_handle arg1,"
+  , "  int64_t arg2,"
+  , "  duckdb_v2_value_handle *arg3,"
+  , "  duckdb_v2_error_info_handle *arg4"
+  , ")"
+  , "{"
+  , "  return (duckdb_v2_value_create_timestamp_ns)(arg1, arg2, arg3, arg4);"
+  , "}"
+  , "DUCKDB_V2_ERROR hs_bindgen_d56bfc9d6aef842f ("
+  , "  duckdb_v2_factory_handle arg1,"
+  , "  int64_t arg2,"
+  , "  duckdb_v2_value_handle *arg3,"
+  , "  duckdb_v2_error_info_handle *arg4"
+  , ")"
+  , "{"
+  , "  return (duckdb_v2_value_create_timestamp_tz)(arg1, arg2, arg3, arg4);"
+  , "}"
+  , "DUCKDB_V2_ERROR hs_bindgen_79fbde4c7b7b05e4 ("
+  , "  duckdb_v2_factory_handle arg1,"
+  , "  int64_t arg2,"
+  , "  duckdb_v2_value_handle *arg3,"
+  , "  duckdb_v2_error_info_handle *arg4"
+  , ")"
+  , "{"
+  , "  return (duckdb_v2_value_create_timestamp_tz_ns)(arg1, arg2, arg3, arg4);"
+  , "}"
+  , "DUCKDB_V2_ERROR hs_bindgen_3a9af524a6c247e8 ("
+  , "  duckdb_v2_factory_handle arg1,"
+  , "  duckdb_v2_interval_t const *arg2,"
+  , "  duckdb_v2_value_handle *arg3,"
+  , "  duckdb_v2_error_info_handle *arg4"
+  , ")"
+  , "{"
+  , "  return (duckdb_v2_value_create_interval)(arg1, arg2, arg3, arg4);"
+  , "}"
+  , "DUCKDB_V2_ERROR hs_bindgen_6da441e700a19c77 ("
+  , "  duckdb_v2_factory_handle arg1,"
+  , "  duckdb_v2_hugeint_t const *arg2,"
+  , "  uint8_t arg3,"
+  , "  uint8_t arg4,"
+  , "  duckdb_v2_value_handle *arg5,"
+  , "  duckdb_v2_error_info_handle *arg6"
+  , ")"
+  , "{"
+  , "  return (duckdb_v2_value_create_decimal)(arg1, arg2, arg3, arg4, arg5, arg6);"
+  , "}"
+  , "DUCKDB_V2_ERROR hs_bindgen_c3a7f9c056dfa47b ("
+  , "  duckdb_v2_factory_handle arg1,"
+  , "  duckdb_v2_hugeint_t const *arg2,"
+  , "  duckdb_v2_value_handle *arg3,"
+  , "  duckdb_v2_error_info_handle *arg4"
+  , ")"
+  , "{"
+  , "  return (duckdb_v2_value_create_uuid)(arg1, arg2, arg3, arg4);"
+  , "}"
+  , "DUCKDB_V2_ERROR hs_bindgen_24a1843a0540520b ("
+  , "  duckdb_v2_factory_handle arg1,"
+  , "  duckdb_v2_str const *arg2,"
+  , "  duckdb_v2_value_handle *arg3,"
+  , "  duckdb_v2_error_info_handle *arg4"
+  , ")"
+  , "{"
+  , "  return (duckdb_v2_value_create_bit)(arg1, arg2, arg3, arg4);"
+  , "}"
+  , "DUCKDB_V2_ERROR hs_bindgen_4d2585deb143ab9e ("
+  , "  duckdb_v2_factory_handle arg1,"
+  , "  duckdb_v2_str const *arg2,"
+  , "  duckdb_v2_value_handle *arg3,"
+  , "  duckdb_v2_error_info_handle *arg4"
+  , ")"
+  , "{"
+  , "  return (duckdb_v2_value_create_bignum)(arg1, arg2, arg3, arg4);"
+  , "}"
+  , "DUCKDB_V2_ERROR hs_bindgen_f93c65da91c2dd98 ("
+  , "  duckdb_v2_factory_handle arg1,"
+  , "  duckdb_v2_logical_type_handle arg2,"
+  , "  duckdb_v2_value_handle const *arg3,"
+  , "  idx_t arg4,"
+  , "  duckdb_v2_value_handle *arg5,"
+  , "  duckdb_v2_error_info_handle *arg6"
+  , ")"
+  , "{"
+  , "  return (duckdb_v2_value_create_list)(arg1, arg2, arg3, arg4, arg5, arg6);"
+  , "}"
+  , "DUCKDB_V2_ERROR hs_bindgen_52a1442bbab17e81 ("
+  , "  duckdb_v2_factory_handle arg1,"
+  , "  duckdb_v2_logical_type_handle arg2,"
+  , "  duckdb_v2_value_handle const *arg3,"
+  , "  idx_t arg4,"
+  , "  duckdb_v2_value_handle *arg5,"
+  , "  duckdb_v2_error_info_handle *arg6"
+  , ")"
+  , "{"
+  , "  return (duckdb_v2_value_create_array)(arg1, arg2, arg3, arg4, arg5, arg6);"
+  , "}"
+  , "DUCKDB_V2_ERROR hs_bindgen_546c97141d36482d ("
+  , "  duckdb_v2_factory_handle arg1,"
+  , "  duckdb_v2_identifier_t const *arg2,"
+  , "  duckdb_v2_value_handle const *arg3,"
+  , "  idx_t arg4,"
+  , "  duckdb_v2_value_handle *arg5,"
+  , "  duckdb_v2_error_info_handle *arg6"
+  , ")"
+  , "{"
+  , "  return (duckdb_v2_value_create_struct)(arg1, arg2, arg3, arg4, arg5, arg6);"
+  , "}"
+  , "DUCKDB_V2_ERROR hs_bindgen_de51802db315078e ("
+  , "  duckdb_v2_factory_handle arg1,"
+  , "  duckdb_v2_value_handle const *arg2,"
+  , "  idx_t arg3,"
+  , "  duckdb_v2_value_handle *arg4,"
+  , "  duckdb_v2_error_info_handle *arg5"
+  , ")"
+  , "{"
+  , "  return (duckdb_v2_value_create_tuple)(arg1, arg2, arg3, arg4, arg5);"
+  , "}"
+  , "DUCKDB_V2_ERROR hs_bindgen_6865210e4b316857 ("
+  , "  duckdb_v2_factory_handle arg1,"
+  , "  duckdb_v2_logical_type_handle arg2,"
+  , "  duckdb_v2_logical_type_handle arg3,"
+  , "  duckdb_v2_value_handle const *arg4,"
+  , "  duckdb_v2_value_handle const *arg5,"
+  , "  idx_t arg6,"
+  , "  duckdb_v2_value_handle *arg7,"
+  , "  duckdb_v2_error_info_handle *arg8"
+  , ")"
+  , "{"
+  , "  return (duckdb_v2_value_create_map)(arg1, arg2, arg3, arg4, arg5, arg6, arg7, arg8);"
+  , "}"
+  , "DUCKDB_V2_ERROR hs_bindgen_a79797fd7fb51089 ("
+  , "  duckdb_v2_value_handle arg1,"
+  , "  idx_t *arg2,"
+  , "  duckdb_v2_error_info_handle *arg3"
+  , ")"
+  , "{"
+  , "  return (duckdb_v2_value_get_child_count)(arg1, arg2, arg3);"
+  , "}"
+  , "DUCKDB_V2_ERROR hs_bindgen_bb5c40aa9d930f6b ("
+  , "  duckdb_v2_value_handle arg1,"
+  , "  idx_t arg2,"
+  , "  duckdb_v2_value_handle *arg3,"
+  , "  duckdb_v2_error_info_handle *arg4"
+  , ")"
+  , "{"
+  , "  return (duckdb_v2_value_get_child)(arg1, arg2, arg3, arg4);"
+  , "}"
+  , "DUCKDB_V2_ERROR hs_bindgen_939b6f0e54e06ba1 ("
+  , "  duckdb_v2_factory_handle arg1,"
+  , "  duckdb_v2_value_handle arg2,"
+  , "  duckdb_v2_logical_type_handle arg3,"
+  , "  duckdb_v2_value_handle *arg4,"
+  , "  duckdb_v2_error_info_handle *arg5"
+  , ")"
+  , "{"
+  , "  return (duckdb_v2_value_cast)(arg1, arg2, arg3, arg4, arg5);"
+  , "}"
+  , "DUCKDB_V2_ERROR hs_bindgen_b08cf15e7dda52fc ("
+  , "  duckdb_v2_value_handle arg1,"
+  , "  _Bool *arg2,"
+  , "  duckdb_v2_error_info_handle *arg3"
+  , ")"
+  , "{"
+  , "  return (duckdb_v2_value_is_null)(arg1, arg2, arg3);"
+  , "}"
+  , "DUCKDB_V2_ERROR hs_bindgen_6b2ca9f5f8833d99 ("
+  , "  duckdb_v2_value_handle arg1,"
+  , "  duckdb_v2_logical_type_handle *arg2,"
+  , "  duckdb_v2_error_info_handle *arg3"
+  , ")"
+  , "{"
+  , "  return (duckdb_v2_value_get_logical_type)(arg1, arg2, arg3);"
+  , "}"
+  , "DUCKDB_V2_ERROR hs_bindgen_5b9532c46ecdba0d ("
+  , "  duckdb_v2_value_handle arg1,"
+  , "  char *arg2,"
+  , "  idx_t arg3,"
+  , "  idx_t *arg4,"
+  , "  duckdb_v2_error_info_handle *arg5"
+  , ")"
+  , "{"
+  , "  return (duckdb_v2_value_to_string)(arg1, arg2, arg3, arg4, arg5);"
+  , "}"
+  , "DUCKDB_V2_ERROR hs_bindgen_43d61d6b8e5afcbe ("
+  , "  duckdb_v2_context_handle arg1,"
+  , "  struct ArrowSchema *arg2,"
+  , "  idx_t arg3,"
+  , "  duckdb_v2_arrow_importer_handle *arg4,"
+  , "  duckdb_v2_error_info_handle *arg5"
+  , ")"
+  , "{"
+  , "  return (duckdb_v2_arrow_importer_create)(arg1, arg2, arg3, arg4, arg5);"
+  , "}"
+  , "DUCKDB_V2_ERROR hs_bindgen_f1a3bd652ee0abea ("
+  , "  duckdb_v2_arrow_importer_handle arg1,"
+  , "  duckdb_v2_schema_handle *arg2,"
+  , "  duckdb_v2_error_info_handle *arg3"
+  , ")"
+  , "{"
+  , "  return (duckdb_v2_arrow_importer_get_schema)(arg1, arg2, arg3);"
+  , "}"
+  , "DUCKDB_V2_ERROR hs_bindgen_7918df8ebdbfd554 ("
+  , "  duckdb_v2_arrow_importer_handle arg1,"
+  , "  struct ArrowArray *arg2,"
+  , "  _Bool arg3,"
+  , "  _Bool arg4,"
+  , "  duckdb_v2_error_info_handle *arg5"
+  , ")"
+  , "{"
+  , "  return (duckdb_v2_arrow_importer_append)(arg1, arg2, arg3, arg4, arg5);"
+  , "}"
+  , "DUCKDB_V2_ERROR hs_bindgen_23fe015cd74f900f ("
+  , "  duckdb_v2_arrow_importer_handle arg1,"
+  , "  duckdb_v2_data_chunk_handle *arg2,"
+  , "  duckdb_v2_error_info_handle *arg3"
+  , ")"
+  , "{"
+  , "  return (duckdb_v2_arrow_importer_next_chunk)(arg1, arg2, arg3);"
+  , "}"
+  , "DUCKDB_V2_ERROR hs_bindgen_e6bbce16dd274675 ("
+  , "  duckdb_v2_arrow_importer_handle *arg1"
+  , ")"
+  , "{"
+  , "  return (duckdb_v2_arrow_importer_destroy)(arg1);"
+  , "}"
+  , "DUCKDB_V2_ERROR hs_bindgen_0cfd334413b24ade ("
+  , "  duckdb_v2_context_handle arg1,"
+  , "  duckdb_v2_logical_type_handle const *arg2,"
+  , "  duckdb_v2_str const *arg3,"
+  , "  idx_t arg4,"
+  , "  idx_t arg5,"
+  , "  duckdb_v2_arrow_exporter_handle *arg6,"
+  , "  duckdb_v2_error_info_handle *arg7"
+  , ")"
+  , "{"
+  , "  return (duckdb_v2_arrow_exporter_create)(arg1, arg2, arg3, arg4, arg5, arg6, arg7);"
+  , "}"
+  , "DUCKDB_V2_ERROR hs_bindgen_9accaf0a15dfb5de ("
+  , "  duckdb_v2_arrow_exporter_handle arg1,"
+  , "  struct ArrowSchema *arg2,"
+  , "  duckdb_v2_error_info_handle *arg3"
+  , ")"
+  , "{"
+  , "  return (duckdb_v2_arrow_exporter_get_schema)(arg1, arg2, arg3);"
+  , "}"
+  , "DUCKDB_V2_ERROR hs_bindgen_9ff477a8e97d4ef0 ("
+  , "  duckdb_v2_arrow_exporter_handle arg1,"
+  , "  duckdb_v2_data_chunk_handle *arg2,"
+  , "  _Bool arg3,"
+  , "  _Bool arg4,"
+  , "  duckdb_v2_error_info_handle *arg5"
+  , ")"
+  , "{"
+  , "  return (duckdb_v2_arrow_exporter_append)(arg1, arg2, arg3, arg4, arg5);"
+  , "}"
+  , "DUCKDB_V2_ERROR hs_bindgen_1859609c03ba66a2 ("
+  , "  duckdb_v2_arrow_exporter_handle arg1,"
+  , "  struct ArrowArray *arg2,"
+  , "  duckdb_v2_error_info_handle *arg3"
+  , ")"
+  , "{"
+  , "  return (duckdb_v2_arrow_exporter_next_array)(arg1, arg2, arg3);"
+  , "}"
+  , "DUCKDB_V2_ERROR hs_bindgen_cfdf5ff57066ef3b ("
+  , "  duckdb_v2_arrow_exporter_handle *arg1"
+  , ")"
+  , "{"
+  , "  return (duckdb_v2_arrow_exporter_destroy)(arg1);"
+  , "}"
+  , "DUCKDB_V2_ERROR hs_bindgen_a7feaf45468b159f ("
+  , "  duckdb_v2_connection_handle arg1,"
+  , "  duckdb_v2_sql_statement_handle arg2,"
+  , "  duckdb_v2_identifier_t const *arg3,"
+  , "  duckdb_v2_value_handle const *arg4,"
+  , "  idx_t arg5,"
+  , "  idx_t arg6,"
+  , "  duckdb_v2_arrow_result_handle *arg7,"
+  , "  duckdb_v2_error_info_handle *arg8"
+  , ")"
+  , "{"
+  , "  return (duckdb_v2_statement_execute_arrow)(arg1, arg2, arg3, arg4, arg5, arg6, arg7, arg8);"
+  , "}"
+  , "DUCKDB_V2_ERROR hs_bindgen_9725dce980f6a212 ("
+  , "  duckdb_v2_prepared_statement_handle arg1,"
+  , "  duckdb_v2_identifier_t const *arg2,"
+  , "  duckdb_v2_value_handle const *arg3,"
+  , "  idx_t arg4,"
+  , "  idx_t arg5,"
+  , "  duckdb_v2_arrow_result_handle *arg6,"
+  , "  duckdb_v2_error_info_handle *arg7"
+  , ")"
+  , "{"
+  , "  return (duckdb_v2_prepared_statement_execute_arrow)(arg1, arg2, arg3, arg4, arg5, arg6, arg7);"
+  , "}"
+  , "DUCKDB_V2_ERROR hs_bindgen_4ba98edb6f024aaa ("
+  , "  duckdb_v2_arrow_result_handle *arg1"
+  , ")"
+  , "{"
+  , "  return (duckdb_v2_arrow_result_destroy)(arg1);"
+  , "}"
+  , "DUCKDB_V2_ERROR hs_bindgen_f6d3a63b2a6681af ("
+  , "  duckdb_v2_arrow_result_handle arg1,"
+  , "  struct ArrowArray *arg2,"
+  , "  DUCKDB_V2_RESULT_STEP_STATUS *arg3,"
+  , "  duckdb_v2_error_info_handle *arg4"
+  , ")"
+  , "{"
+  , "  return (duckdb_v2_arrow_result_step)(arg1, arg2, arg3, arg4);"
+  , "}"
+  , "DUCKDB_V2_ERROR hs_bindgen_9a4983392d6204a2 ("
+  , "  duckdb_v2_arrow_result_handle arg1,"
+  , "  struct ArrowArray *arg2,"
+  , "  duckdb_v2_error_info_handle *arg3"
+  , ")"
+  , "{"
+  , "  return (duckdb_v2_arrow_result_fetch_array)(arg1, arg2, arg3);"
+  , "}"
+  , "DUCKDB_V2_ERROR hs_bindgen_08b4ee05f9fc6df0 ("
+  , "  duckdb_v2_arrow_result_handle arg1,"
+  , "  duckdb_v2_error_info_handle *arg2"
+  , ")"
+  , "{"
+  , "  return (duckdb_v2_arrow_result_wait)(arg1, arg2);"
+  , "}"
+  , "DUCKDB_V2_ERROR hs_bindgen_9d115d7a4eefcf7d ("
+  , "  duckdb_v2_arrow_result_handle arg1,"
+  , "  idx_t *arg2,"
+  , "  duckdb_v2_error_info_handle *arg3"
+  , ")"
+  , "{"
+  , "  return (duckdb_v2_arrow_result_drain)(arg1, arg2, arg3);"
+  , "}"
+  , "DUCKDB_V2_ERROR hs_bindgen_df90d5b9cdd7d7f4 ("
+  , "  duckdb_v2_arrow_result_handle arg1,"
+  , "  DUCKDB_V2_RESULT_TYPE *arg2,"
+  , "  duckdb_v2_error_info_handle *arg3"
+  , ")"
+  , "{"
+  , "  return (duckdb_v2_arrow_result_get_result_type)(arg1, arg2, arg3);"
+  , "}"
+  , "DUCKDB_V2_ERROR hs_bindgen_9c4be0a3dcd18ff4 ("
+  , "  duckdb_v2_arrow_result_handle arg1,"
+  , "  DUCKDB_V2_STATEMENT_TYPE *arg2,"
+  , "  duckdb_v2_error_info_handle *arg3"
+  , ")"
+  , "{"
+  , "  return (duckdb_v2_arrow_result_get_statement_type)(arg1, arg2, arg3);"
+  , "}"
+  , "DUCKDB_V2_ERROR hs_bindgen_0266106004c2a3ba ("
+  , "  duckdb_v2_arrow_result_handle arg1,"
+  , "  struct ArrowSchema *arg2,"
+  , "  duckdb_v2_error_info_handle *arg3"
+  , ")"
+  , "{"
+  , "  return (duckdb_v2_arrow_result_get_schema)(arg1, arg2, arg3);"
+  , "}"
+  , "DUCKDB_V2_ERROR hs_bindgen_7394c4e3bce82c94 ("
+  , "  duckdb_v2_arrow_result_handle *arg1,"
+  , "  struct ArrowArrayStream *arg2,"
+  , "  duckdb_v2_error_info_handle *arg3"
+  , ")"
+  , "{"
+  , "  return (duckdb_v2_arrow_result_to_arrow_c_stream)(arg1, arg2, arg3);"
+  , "}"
+  ]))
+
+{-| The API version this translation unit targets. Define all three to compile against an older surface than the one this header describes.
+
+    __C declaration:__ @macro DUCKDB_V2_API_VERSION_MAJOR@
+
+    __defined at:__ @duckdb_v2.h 72:9@
+
+    __exported by:__ @duckdb_v2.h@
+-}
+dUCKDB_V2_API_VERSION_MAJOR :: BG.CInt
+dUCKDB_V2_API_VERSION_MAJOR = (2 :: BG.CInt)
+
+{-| __C declaration:__ @macro DUCKDB_V2_API_VERSION_MINOR@
+
+    __defined at:__ @duckdb_v2.h 73:9@
+
+    __exported by:__ @duckdb_v2.h@
+-}
+dUCKDB_V2_API_VERSION_MINOR :: BG.CInt
+dUCKDB_V2_API_VERSION_MINOR = (0 :: BG.CInt)
+
+{-| __C declaration:__ @macro DUCKDB_V2_API_VERSION_PATCH@
+
+    __defined at:__ @duckdb_v2.h 74:9@
+
+    __exported by:__ @duckdb_v2.h@
+-}
+dUCKDB_V2_API_VERSION_PATCH :: BG.CInt
+dUCKDB_V2_API_VERSION_PATCH = (0 :: BG.CInt)
+
+{-| Set to 1 to compile the deprecated surface, 0 to omit it. Defaults from the older DUCKDB_API_NO_DEPRECATED macro when that is what the consumer defines.
+
+    __C declaration:__ @macro DUCKDB_V2_API_ALLOW_DEPRECATED@
+
+    __defined at:__ @duckdb_v2.h 99:9@
+
+    __exported by:__ @duckdb_v2.h@
+-}
+dUCKDB_V2_API_ALLOW_DEPRECATED :: BG.CInt
+dUCKDB_V2_API_ALLOW_DEPRECATED = (1 :: BG.CInt)
+
+{-| __C declaration:__ @macro ARROW_FLAG_DICTIONARY_ORDERED@
+
+    __defined at:__ @duckdb_v2.h 135:9@
+
+    __exported by:__ @duckdb_v2.h@
+-}
+aRROW_FLAG_DICTIONARY_ORDERED :: BG.CInt
+aRROW_FLAG_DICTIONARY_ORDERED = (1 :: BG.CInt)
+
+{-| __C declaration:__ @macro ARROW_FLAG_NULLABLE@
+
+    __defined at:__ @duckdb_v2.h 136:9@
+
+    __exported by:__ @duckdb_v2.h@
+-}
+aRROW_FLAG_NULLABLE :: BG.CInt
+aRROW_FLAG_NULLABLE = (2 :: BG.CInt)
+
+{-| __C declaration:__ @macro ARROW_FLAG_MAP_KEYS_SORTED@
+
+    __defined at:__ @duckdb_v2.h 137:9@
+
+    __exported by:__ @duckdb_v2.h@
+-}
+aRROW_FLAG_MAP_KEYS_SORTED :: BG.CInt
+aRROW_FLAG_MAP_KEYS_SORTED = (4 :: BG.CInt)
+
+{-| __C declaration:__ @struct ArrowSchema@
+
+    __defined at:__ @duckdb_v2.h 139:8@
+
+    __exported by:__ @duckdb_v2.h@
+-}
+data ArrowSchema = ArrowSchema
+  { format :: PtrConst.PtrConst BG.CChar
+    {- ^ __C declaration:__ @format@
+
+         __defined at:__ @duckdb_v2.h 140:14@
+
+         __exported by:__ @duckdb_v2.h@
+    -}
+  , name :: PtrConst.PtrConst BG.CChar
+    {- ^ __C declaration:__ @name@
+
+         __defined at:__ @duckdb_v2.h 141:14@
+
+         __exported by:__ @duckdb_v2.h@
+    -}
+  , metadata :: PtrConst.PtrConst BG.CChar
+    {- ^ __C declaration:__ @metadata@
+
+         __defined at:__ @duckdb_v2.h 142:14@
+
+         __exported by:__ @duckdb_v2.h@
+    -}
+  , flags :: HsBindgen.Runtime.LibC.Int64
+    {- ^ __C declaration:__ @flags@
+
+         __defined at:__ @duckdb_v2.h 143:10@
+
+         __exported by:__ @duckdb_v2.h@
+    -}
+  , n_children :: HsBindgen.Runtime.LibC.Int64
+    {- ^ __C declaration:__ @n_children@
+
+         __defined at:__ @duckdb_v2.h 144:10@
+
+         __exported by:__ @duckdb_v2.h@
+    -}
+  , children :: BG.Ptr (BG.Ptr ArrowSchema)
+    {- ^ __C declaration:__ @children@
+
+         __defined at:__ @duckdb_v2.h 145:23@
+
+         __exported by:__ @duckdb_v2.h@
+    -}
+  , dictionary :: BG.Ptr ArrowSchema
+    {- ^ __C declaration:__ @dictionary@
+
+         __defined at:__ @duckdb_v2.h 146:22@
+
+         __exported by:__ @duckdb_v2.h@
+    -}
+  , release :: BG.FunPtr (BG.Ptr ArrowSchema -> IO ())
+    {- ^ __C declaration:__ @release@
+
+         __defined at:__ @duckdb_v2.h 147:9@
+
+         __exported by:__ @duckdb_v2.h@
+    -}
+  , private_data :: BG.Ptr BG.Void
+    {- ^ __C declaration:__ @private_data@
+
+         __defined at:__ @duckdb_v2.h 148:8@
+
+         __exported by:__ @duckdb_v2.h@
+    -}
+  }
+  deriving stock (Eq, BG.Generic, Show)
+
+instance Marshal.StaticSize ArrowSchema where
+
+  staticSizeOf = \_ -> (72 :: Int)
+
+  staticAlignment = \_ -> (8 :: Int)
+
+instance Marshal.ReadRaw ArrowSchema where
+
+  readRaw =
+    \ptr0 ->
+          pure ArrowSchema
+      <*> HasCField.readRaw (BG.Proxy @"format") ptr0
+      <*> HasCField.readRaw (BG.Proxy @"name") ptr0
+      <*> HasCField.readRaw (BG.Proxy @"metadata") ptr0
+      <*> HasCField.readRaw (BG.Proxy @"flags") ptr0
+      <*> HasCField.readRaw (BG.Proxy @"n_children") ptr0
+      <*> HasCField.readRaw (BG.Proxy @"children") ptr0
+      <*> HasCField.readRaw (BG.Proxy @"dictionary") ptr0
+      <*> HasCField.readRaw (BG.Proxy @"release") ptr0
+      <*> HasCField.readRaw (BG.Proxy @"private_data") ptr0
+
+instance Marshal.WriteRaw ArrowSchema where
+
+  writeRaw =
+    \ptr0 ->
+      \s1 ->
+        case s1 of
+          ArrowSchema
+            format2
+            name3
+            metadata4
+            flags5
+            n_children6
+            children7
+            dictionary8
+            release9
+            private_data10 ->
+                 HasCField.writeRaw (BG.Proxy @"format") ptr0 format2
+              >> HasCField.writeRaw (BG.Proxy @"name") ptr0 name3
+              >> HasCField.writeRaw (BG.Proxy @"metadata") ptr0 metadata4
+              >> HasCField.writeRaw (BG.Proxy @"flags") ptr0 flags5
+              >> HasCField.writeRaw (BG.Proxy @"n_children") ptr0 n_children6
+              >> HasCField.writeRaw (BG.Proxy @"children") ptr0 children7
+              >> HasCField.writeRaw (BG.Proxy @"dictionary") ptr0 dictionary8
+              >> HasCField.writeRaw (BG.Proxy @"release") ptr0 release9
+              >> HasCField.writeRaw (BG.Proxy @"private_data") ptr0 private_data10
+
+deriving via Marshal.EquivStorable ArrowSchema instance BG.Storable ArrowSchema
+
+deriving via Struct.IsStructViaReadRaw ArrowSchema instance Struct.IsStruct ArrowSchema
+
+{-| __C declaration:__ @format@
+
+    __defined at:__ @duckdb_v2.h 140:14@
+
+    __exported by:__ @duckdb_v2.h@
+-}
+instance ( ty ~ PtrConst.PtrConst BG.CChar
+         ) => BG.CompatHasField.HasField "format" ArrowSchema ty where
+
+  hasField =
+    \x0 ->
+      ( \y1 ->
+          ArrowSchema { format = y1
+                      , name = BG.getField @"name" x0
+                      , metadata = BG.getField @"metadata" x0
+                      , flags = BG.getField @"flags" x0
+                      , n_children = BG.getField @"n_children" x0
+                      , children = BG.getField @"children" x0
+                      , dictionary = BG.getField @"dictionary" x0
+                      , release = BG.getField @"release" x0
+                      , private_data = BG.getField @"private_data" x0
+                      }
+      , BG.getField @"format" x0
+      )
+
+instance ( ty ~ PtrConst.PtrConst BG.CChar
+         ) => BG.HasField "format" (BG.Ptr ArrowSchema) (BG.Ptr ty) where
+
+  getField = HasCField.fromPtr (BG.Proxy @"format")
+
+instance HasCField.HasCField ArrowSchema "format" where
+
+  type CFieldType ArrowSchema "format" =
+    PtrConst.PtrConst BG.CChar
+
+  offset# = \_ -> \_ -> 0
+
+{-| __C declaration:__ @name@
+
+    __defined at:__ @duckdb_v2.h 141:14@
+
+    __exported by:__ @duckdb_v2.h@
+-}
+instance ( ty ~ PtrConst.PtrConst BG.CChar
+         ) => BG.CompatHasField.HasField "name" ArrowSchema ty where
+
+  hasField =
+    \x0 ->
+      ( \y1 ->
+          ArrowSchema { name = y1
+                      , format = BG.getField @"format" x0
+                      , metadata = BG.getField @"metadata" x0
+                      , flags = BG.getField @"flags" x0
+                      , n_children = BG.getField @"n_children" x0
+                      , children = BG.getField @"children" x0
+                      , dictionary = BG.getField @"dictionary" x0
+                      , release = BG.getField @"release" x0
+                      , private_data = BG.getField @"private_data" x0
+                      }
+      , BG.getField @"name" x0
+      )
+
+instance ( ty ~ PtrConst.PtrConst BG.CChar
+         ) => BG.HasField "name" (BG.Ptr ArrowSchema) (BG.Ptr ty) where
+
+  getField = HasCField.fromPtr (BG.Proxy @"name")
+
+instance HasCField.HasCField ArrowSchema "name" where
+
+  type CFieldType ArrowSchema "name" =
+    PtrConst.PtrConst BG.CChar
+
+  offset# = \_ -> \_ -> 8
+
+{-| __C declaration:__ @metadata@
+
+    __defined at:__ @duckdb_v2.h 142:14@
+
+    __exported by:__ @duckdb_v2.h@
+-}
+instance ( ty ~ PtrConst.PtrConst BG.CChar
+         ) => BG.CompatHasField.HasField "metadata" ArrowSchema ty where
+
+  hasField =
+    \x0 ->
+      ( \y1 ->
+          ArrowSchema { metadata = y1
+                      , format = BG.getField @"format" x0
+                      , name = BG.getField @"name" x0
+                      , flags = BG.getField @"flags" x0
+                      , n_children = BG.getField @"n_children" x0
+                      , children = BG.getField @"children" x0
+                      , dictionary = BG.getField @"dictionary" x0
+                      , release = BG.getField @"release" x0
+                      , private_data = BG.getField @"private_data" x0
+                      }
+      , BG.getField @"metadata" x0
+      )
+
+instance ( ty ~ PtrConst.PtrConst BG.CChar
+         ) => BG.HasField "metadata" (BG.Ptr ArrowSchema) (BG.Ptr ty) where
+
+  getField = HasCField.fromPtr (BG.Proxy @"metadata")
+
+instance HasCField.HasCField ArrowSchema "metadata" where
+
+  type CFieldType ArrowSchema "metadata" =
+    PtrConst.PtrConst BG.CChar
+
+  offset# = \_ -> \_ -> 16
+
+{-| __C declaration:__ @flags@
+
+    __defined at:__ @duckdb_v2.h 143:10@
+
+    __exported by:__ @duckdb_v2.h@
+-}
+instance ( ty ~ HsBindgen.Runtime.LibC.Int64
+         ) => BG.CompatHasField.HasField "flags" ArrowSchema ty where
+
+  hasField =
+    \x0 ->
+      ( \y1 ->
+          ArrowSchema { flags = y1
+                      , format = BG.getField @"format" x0
+                      , name = BG.getField @"name" x0
+                      , metadata = BG.getField @"metadata" x0
+                      , n_children = BG.getField @"n_children" x0
+                      , children = BG.getField @"children" x0
+                      , dictionary = BG.getField @"dictionary" x0
+                      , release = BG.getField @"release" x0
+                      , private_data = BG.getField @"private_data" x0
+                      }
+      , BG.getField @"flags" x0
+      )
+
+instance ( ty ~ HsBindgen.Runtime.LibC.Int64
+         ) => BG.HasField "flags" (BG.Ptr ArrowSchema) (BG.Ptr ty) where
+
+  getField = HasCField.fromPtr (BG.Proxy @"flags")
+
+instance HasCField.HasCField ArrowSchema "flags" where
+
+  type CFieldType ArrowSchema "flags" =
+    HsBindgen.Runtime.LibC.Int64
+
+  offset# = \_ -> \_ -> 24
+
+{-| __C declaration:__ @n_children@
+
+    __defined at:__ @duckdb_v2.h 144:10@
+
+    __exported by:__ @duckdb_v2.h@
+-}
+instance ( ty ~ HsBindgen.Runtime.LibC.Int64
+         ) => BG.CompatHasField.HasField "n_children" ArrowSchema ty where
+
+  hasField =
+    \x0 ->
+      ( \y1 ->
+          ArrowSchema { n_children = y1
+                      , format = BG.getField @"format" x0
+                      , name = BG.getField @"name" x0
+                      , metadata = BG.getField @"metadata" x0
+                      , flags = BG.getField @"flags" x0
+                      , children = BG.getField @"children" x0
+                      , dictionary = BG.getField @"dictionary" x0
+                      , release = BG.getField @"release" x0
+                      , private_data = BG.getField @"private_data" x0
+                      }
+      , BG.getField @"n_children" x0
+      )
+
+instance ( ty ~ HsBindgen.Runtime.LibC.Int64
+         ) => BG.HasField "n_children" (BG.Ptr ArrowSchema) (BG.Ptr ty) where
+
+  getField = HasCField.fromPtr (BG.Proxy @"n_children")
+
+instance HasCField.HasCField ArrowSchema "n_children" where
+
+  type CFieldType ArrowSchema "n_children" =
+    HsBindgen.Runtime.LibC.Int64
+
+  offset# = \_ -> \_ -> 32
+
+{-| __C declaration:__ @children@
+
+    __defined at:__ @duckdb_v2.h 145:23@
+
+    __exported by:__ @duckdb_v2.h@
+-}
+instance ( ty ~ BG.Ptr (BG.Ptr ArrowSchema)
+         ) => BG.CompatHasField.HasField "children" ArrowSchema ty where
+
+  hasField =
+    \x0 ->
+      ( \y1 ->
+          ArrowSchema { children = y1
+                      , format = BG.getField @"format" x0
+                      , name = BG.getField @"name" x0
+                      , metadata = BG.getField @"metadata" x0
+                      , flags = BG.getField @"flags" x0
+                      , n_children = BG.getField @"n_children" x0
+                      , dictionary = BG.getField @"dictionary" x0
+                      , release = BG.getField @"release" x0
+                      , private_data = BG.getField @"private_data" x0
+                      }
+      , BG.getField @"children" x0
+      )
+
+instance ( ty ~ BG.Ptr (BG.Ptr ArrowSchema)
+         ) => BG.HasField "children" (BG.Ptr ArrowSchema) (BG.Ptr ty) where
+
+  getField = HasCField.fromPtr (BG.Proxy @"children")
+
+instance HasCField.HasCField ArrowSchema "children" where
+
+  type CFieldType ArrowSchema "children" =
+    BG.Ptr (BG.Ptr ArrowSchema)
+
+  offset# = \_ -> \_ -> 40
+
+{-| __C declaration:__ @dictionary@
+
+    __defined at:__ @duckdb_v2.h 146:22@
+
+    __exported by:__ @duckdb_v2.h@
+-}
+instance ( ty ~ BG.Ptr ArrowSchema
+         ) => BG.CompatHasField.HasField "dictionary" ArrowSchema ty where
+
+  hasField =
+    \x0 ->
+      ( \y1 ->
+          ArrowSchema { dictionary = y1
+                      , format = BG.getField @"format" x0
+                      , name = BG.getField @"name" x0
+                      , metadata = BG.getField @"metadata" x0
+                      , flags = BG.getField @"flags" x0
+                      , n_children = BG.getField @"n_children" x0
+                      , children = BG.getField @"children" x0
+                      , release = BG.getField @"release" x0
+                      , private_data = BG.getField @"private_data" x0
+                      }
+      , BG.getField @"dictionary" x0
+      )
+
+instance ( ty ~ BG.Ptr ArrowSchema
+         ) => BG.HasField "dictionary" (BG.Ptr ArrowSchema) (BG.Ptr ty) where
+
+  getField = HasCField.fromPtr (BG.Proxy @"dictionary")
+
+instance HasCField.HasCField ArrowSchema "dictionary" where
+
+  type CFieldType ArrowSchema "dictionary" =
+    BG.Ptr ArrowSchema
+
+  offset# = \_ -> \_ -> 48
+
+{-| __C declaration:__ @release@
+
+    __defined at:__ @duckdb_v2.h 147:9@
+
+    __exported by:__ @duckdb_v2.h@
+-}
+instance ( ty ~ BG.FunPtr (BG.Ptr ArrowSchema -> IO ())
+         ) => BG.CompatHasField.HasField "release" ArrowSchema ty where
+
+  hasField =
+    \x0 ->
+      ( \y1 ->
+          ArrowSchema { release = y1
+                      , format = BG.getField @"format" x0
+                      , name = BG.getField @"name" x0
+                      , metadata = BG.getField @"metadata" x0
+                      , flags = BG.getField @"flags" x0
+                      , n_children = BG.getField @"n_children" x0
+                      , children = BG.getField @"children" x0
+                      , dictionary = BG.getField @"dictionary" x0
+                      , private_data = BG.getField @"private_data" x0
+                      }
+      , BG.getField @"release" x0
+      )
+
+instance ( ty ~ BG.FunPtr (BG.Ptr ArrowSchema -> IO ())
+         ) => BG.HasField "release" (BG.Ptr ArrowSchema) (BG.Ptr ty) where
+
+  getField = HasCField.fromPtr (BG.Proxy @"release")
+
+instance HasCField.HasCField ArrowSchema "release" where
+
+  type CFieldType ArrowSchema "release" =
+    BG.FunPtr (BG.Ptr ArrowSchema -> IO ())
+
+  offset# = \_ -> \_ -> 56
+
+{-| __C declaration:__ @private_data@
+
+    __defined at:__ @duckdb_v2.h 148:8@
+
+    __exported by:__ @duckdb_v2.h@
+-}
+instance ( ty ~ BG.Ptr BG.Void
+         ) => BG.CompatHasField.HasField "private_data" ArrowSchema ty where
+
+  hasField =
+    \x0 ->
+      ( \y1 ->
+          ArrowSchema { private_data = y1
+                      , format = BG.getField @"format" x0
+                      , name = BG.getField @"name" x0
+                      , metadata = BG.getField @"metadata" x0
+                      , flags = BG.getField @"flags" x0
+                      , n_children = BG.getField @"n_children" x0
+                      , children = BG.getField @"children" x0
+                      , dictionary = BG.getField @"dictionary" x0
+                      , release = BG.getField @"release" x0
+                      }
+      , BG.getField @"private_data" x0
+      )
+
+instance ( ty ~ BG.Ptr BG.Void
+         ) => BG.HasField "private_data" (BG.Ptr ArrowSchema) (BG.Ptr ty) where
+
+  getField =
+    HasCField.fromPtr (BG.Proxy @"private_data")
+
+instance HasCField.HasCField ArrowSchema "private_data" where
+
+  type CFieldType ArrowSchema "private_data" =
+    BG.Ptr BG.Void
+
+  offset# = \_ -> \_ -> 64
+
+{-| __C declaration:__ @struct ArrowArray@
+
+    __defined at:__ @duckdb_v2.h 151:8@
+
+    __exported by:__ @duckdb_v2.h@
+-}
+data ArrowArray = ArrowArray
+  { length :: HsBindgen.Runtime.LibC.Int64
+    {- ^ __C declaration:__ @length@
+
+         __defined at:__ @duckdb_v2.h 152:10@
+
+         __exported by:__ @duckdb_v2.h@
+    -}
+  , null_count :: HsBindgen.Runtime.LibC.Int64
+    {- ^ __C declaration:__ @null_count@
+
+         __defined at:__ @duckdb_v2.h 153:10@
+
+         __exported by:__ @duckdb_v2.h@
+    -}
+  , offset :: HsBindgen.Runtime.LibC.Int64
+    {- ^ __C declaration:__ @offset@
+
+         __defined at:__ @duckdb_v2.h 154:10@
+
+         __exported by:__ @duckdb_v2.h@
+    -}
+  , n_buffers :: HsBindgen.Runtime.LibC.Int64
+    {- ^ __C declaration:__ @n_buffers@
+
+         __defined at:__ @duckdb_v2.h 155:10@
+
+         __exported by:__ @duckdb_v2.h@
+    -}
+  , n_children :: HsBindgen.Runtime.LibC.Int64
+    {- ^ __C declaration:__ @n_children@
+
+         __defined at:__ @duckdb_v2.h 156:10@
+
+         __exported by:__ @duckdb_v2.h@
+    -}
+  , buffers :: BG.Ptr (PtrConst.PtrConst BG.Void)
+    {- ^ __C declaration:__ @buffers@
+
+         __defined at:__ @duckdb_v2.h 157:15@
+
+         __exported by:__ @duckdb_v2.h@
+    -}
+  , children :: BG.Ptr (BG.Ptr ArrowArray)
+    {- ^ __C declaration:__ @children@
+
+         __defined at:__ @duckdb_v2.h 158:22@
+
+         __exported by:__ @duckdb_v2.h@
+    -}
+  , dictionary :: BG.Ptr ArrowArray
+    {- ^ __C declaration:__ @dictionary@
+
+         __defined at:__ @duckdb_v2.h 159:21@
+
+         __exported by:__ @duckdb_v2.h@
+    -}
+  , release :: BG.FunPtr (BG.Ptr ArrowArray -> IO ())
+    {- ^ __C declaration:__ @release@
+
+         __defined at:__ @duckdb_v2.h 160:9@
+
+         __exported by:__ @duckdb_v2.h@
+    -}
+  , private_data :: BG.Ptr BG.Void
+    {- ^ __C declaration:__ @private_data@
+
+         __defined at:__ @duckdb_v2.h 161:8@
+
+         __exported by:__ @duckdb_v2.h@
+    -}
+  }
+  deriving stock (Eq, BG.Generic, Show)
+
+instance Marshal.StaticSize ArrowArray where
+
+  staticSizeOf = \_ -> (80 :: Int)
+
+  staticAlignment = \_ -> (8 :: Int)
+
+instance Marshal.ReadRaw ArrowArray where
+
+  readRaw =
+    \ptr0 ->
+          pure ArrowArray
+      <*> HasCField.readRaw (BG.Proxy @"length") ptr0
+      <*> HasCField.readRaw (BG.Proxy @"null_count") ptr0
+      <*> HasCField.readRaw (BG.Proxy @"offset") ptr0
+      <*> HasCField.readRaw (BG.Proxy @"n_buffers") ptr0
+      <*> HasCField.readRaw (BG.Proxy @"n_children") ptr0
+      <*> HasCField.readRaw (BG.Proxy @"buffers") ptr0
+      <*> HasCField.readRaw (BG.Proxy @"children") ptr0
+      <*> HasCField.readRaw (BG.Proxy @"dictionary") ptr0
+      <*> HasCField.readRaw (BG.Proxy @"release") ptr0
+      <*> HasCField.readRaw (BG.Proxy @"private_data") ptr0
+
+instance Marshal.WriteRaw ArrowArray where
+
+  writeRaw =
+    \ptr0 ->
+      \s1 ->
+        case s1 of
+          ArrowArray
+            length2
+            null_count3
+            offset4
+            n_buffers5
+            n_children6
+            buffers7
+            children8
+            dictionary9
+            release10
+            private_data11 ->
+                 HasCField.writeRaw (BG.Proxy @"length") ptr0 length2
+              >> HasCField.writeRaw (BG.Proxy @"null_count") ptr0 null_count3
+              >> HasCField.writeRaw (BG.Proxy @"offset") ptr0 offset4
+              >> HasCField.writeRaw (BG.Proxy @"n_buffers") ptr0 n_buffers5
+              >> HasCField.writeRaw (BG.Proxy @"n_children") ptr0 n_children6
+              >> HasCField.writeRaw (BG.Proxy @"buffers") ptr0 buffers7
+              >> HasCField.writeRaw (BG.Proxy @"children") ptr0 children8
+              >> HasCField.writeRaw (BG.Proxy @"dictionary") ptr0 dictionary9
+              >> HasCField.writeRaw (BG.Proxy @"release") ptr0 release10
+              >> HasCField.writeRaw (BG.Proxy @"private_data") ptr0 private_data11
+
+deriving via Marshal.EquivStorable ArrowArray instance BG.Storable ArrowArray
+
+deriving via Struct.IsStructViaReadRaw ArrowArray instance Struct.IsStruct ArrowArray
+
+{-| __C declaration:__ @length@
+
+    __defined at:__ @duckdb_v2.h 152:10@
+
+    __exported by:__ @duckdb_v2.h@
+-}
+instance ( ty ~ HsBindgen.Runtime.LibC.Int64
+         ) => BG.CompatHasField.HasField "length" ArrowArray ty where
+
+  hasField =
+    \x0 ->
+      ( \y1 ->
+          ArrowArray { length = y1
+                     , null_count = BG.getField @"null_count" x0
+                     , offset = BG.getField @"offset" x0
+                     , n_buffers = BG.getField @"n_buffers" x0
+                     , n_children = BG.getField @"n_children" x0
+                     , buffers = BG.getField @"buffers" x0
+                     , children = BG.getField @"children" x0
+                     , dictionary = BG.getField @"dictionary" x0
+                     , release = BG.getField @"release" x0
+                     , private_data = BG.getField @"private_data" x0
+                     }
+      , BG.getField @"length" x0
+      )
+
+instance ( ty ~ HsBindgen.Runtime.LibC.Int64
+         ) => BG.HasField "length" (BG.Ptr ArrowArray) (BG.Ptr ty) where
+
+  getField = HasCField.fromPtr (BG.Proxy @"length")
+
+instance HasCField.HasCField ArrowArray "length" where
+
+  type CFieldType ArrowArray "length" =
+    HsBindgen.Runtime.LibC.Int64
+
+  offset# = \_ -> \_ -> 0
+
+{-| __C declaration:__ @null_count@
+
+    __defined at:__ @duckdb_v2.h 153:10@
+
+    __exported by:__ @duckdb_v2.h@
+-}
+instance ( ty ~ HsBindgen.Runtime.LibC.Int64
+         ) => BG.CompatHasField.HasField "null_count" ArrowArray ty where
+
+  hasField =
+    \x0 ->
+      ( \y1 ->
+          ArrowArray { null_count = y1
+                     , length = BG.getField @"length" x0
+                     , offset = BG.getField @"offset" x0
+                     , n_buffers = BG.getField @"n_buffers" x0
+                     , n_children = BG.getField @"n_children" x0
+                     , buffers = BG.getField @"buffers" x0
+                     , children = BG.getField @"children" x0
+                     , dictionary = BG.getField @"dictionary" x0
+                     , release = BG.getField @"release" x0
+                     , private_data = BG.getField @"private_data" x0
+                     }
+      , BG.getField @"null_count" x0
+      )
+
+instance ( ty ~ HsBindgen.Runtime.LibC.Int64
+         ) => BG.HasField "null_count" (BG.Ptr ArrowArray) (BG.Ptr ty) where
+
+  getField = HasCField.fromPtr (BG.Proxy @"null_count")
+
+instance HasCField.HasCField ArrowArray "null_count" where
+
+  type CFieldType ArrowArray "null_count" =
+    HsBindgen.Runtime.LibC.Int64
+
+  offset# = \_ -> \_ -> 8
+
+{-| __C declaration:__ @offset@
+
+    __defined at:__ @duckdb_v2.h 154:10@
+
+    __exported by:__ @duckdb_v2.h@
+-}
+instance ( ty ~ HsBindgen.Runtime.LibC.Int64
+         ) => BG.CompatHasField.HasField "offset" ArrowArray ty where
+
+  hasField =
+    \x0 ->
+      ( \y1 ->
+          ArrowArray { offset = y1
+                     , length = BG.getField @"length" x0
+                     , null_count = BG.getField @"null_count" x0
+                     , n_buffers = BG.getField @"n_buffers" x0
+                     , n_children = BG.getField @"n_children" x0
+                     , buffers = BG.getField @"buffers" x0
+                     , children = BG.getField @"children" x0
+                     , dictionary = BG.getField @"dictionary" x0
+                     , release = BG.getField @"release" x0
+                     , private_data = BG.getField @"private_data" x0
+                     }
+      , BG.getField @"offset" x0
+      )
+
+instance ( ty ~ HsBindgen.Runtime.LibC.Int64
+         ) => BG.HasField "offset" (BG.Ptr ArrowArray) (BG.Ptr ty) where
+
+  getField = HasCField.fromPtr (BG.Proxy @"offset")
+
+instance HasCField.HasCField ArrowArray "offset" where
+
+  type CFieldType ArrowArray "offset" =
+    HsBindgen.Runtime.LibC.Int64
+
+  offset# = \_ -> \_ -> 16
+
+{-| __C declaration:__ @n_buffers@
+
+    __defined at:__ @duckdb_v2.h 155:10@
+
+    __exported by:__ @duckdb_v2.h@
+-}
+instance ( ty ~ HsBindgen.Runtime.LibC.Int64
+         ) => BG.CompatHasField.HasField "n_buffers" ArrowArray ty where
+
+  hasField =
+    \x0 ->
+      ( \y1 ->
+          ArrowArray { n_buffers = y1
+                     , length = BG.getField @"length" x0
+                     , null_count = BG.getField @"null_count" x0
+                     , offset = BG.getField @"offset" x0
+                     , n_children = BG.getField @"n_children" x0
+                     , buffers = BG.getField @"buffers" x0
+                     , children = BG.getField @"children" x0
+                     , dictionary = BG.getField @"dictionary" x0
+                     , release = BG.getField @"release" x0
+                     , private_data = BG.getField @"private_data" x0
+                     }
+      , BG.getField @"n_buffers" x0
+      )
+
+instance ( ty ~ HsBindgen.Runtime.LibC.Int64
+         ) => BG.HasField "n_buffers" (BG.Ptr ArrowArray) (BG.Ptr ty) where
+
+  getField = HasCField.fromPtr (BG.Proxy @"n_buffers")
+
+instance HasCField.HasCField ArrowArray "n_buffers" where
+
+  type CFieldType ArrowArray "n_buffers" =
+    HsBindgen.Runtime.LibC.Int64
+
+  offset# = \_ -> \_ -> 24
+
+{-| __C declaration:__ @n_children@
+
+    __defined at:__ @duckdb_v2.h 156:10@
+
+    __exported by:__ @duckdb_v2.h@
+-}
+instance ( ty ~ HsBindgen.Runtime.LibC.Int64
+         ) => BG.CompatHasField.HasField "n_children" ArrowArray ty where
+
+  hasField =
+    \x0 ->
+      ( \y1 ->
+          ArrowArray { n_children = y1
+                     , length = BG.getField @"length" x0
+                     , null_count = BG.getField @"null_count" x0
+                     , offset = BG.getField @"offset" x0
+                     , n_buffers = BG.getField @"n_buffers" x0
+                     , buffers = BG.getField @"buffers" x0
+                     , children = BG.getField @"children" x0
+                     , dictionary = BG.getField @"dictionary" x0
+                     , release = BG.getField @"release" x0
+                     , private_data = BG.getField @"private_data" x0
+                     }
+      , BG.getField @"n_children" x0
+      )
+
+instance ( ty ~ HsBindgen.Runtime.LibC.Int64
+         ) => BG.HasField "n_children" (BG.Ptr ArrowArray) (BG.Ptr ty) where
+
+  getField = HasCField.fromPtr (BG.Proxy @"n_children")
+
+instance HasCField.HasCField ArrowArray "n_children" where
+
+  type CFieldType ArrowArray "n_children" =
+    HsBindgen.Runtime.LibC.Int64
+
+  offset# = \_ -> \_ -> 32
+
+{-| __C declaration:__ @buffers@
+
+    __defined at:__ @duckdb_v2.h 157:15@
+
+    __exported by:__ @duckdb_v2.h@
+-}
+instance ( ty ~ BG.Ptr (PtrConst.PtrConst BG.Void)
+         ) => BG.CompatHasField.HasField "buffers" ArrowArray ty where
+
+  hasField =
+    \x0 ->
+      ( \y1 ->
+          ArrowArray { buffers = y1
+                     , length = BG.getField @"length" x0
+                     , null_count = BG.getField @"null_count" x0
+                     , offset = BG.getField @"offset" x0
+                     , n_buffers = BG.getField @"n_buffers" x0
+                     , n_children = BG.getField @"n_children" x0
+                     , children = BG.getField @"children" x0
+                     , dictionary = BG.getField @"dictionary" x0
+                     , release = BG.getField @"release" x0
+                     , private_data = BG.getField @"private_data" x0
+                     }
+      , BG.getField @"buffers" x0
+      )
+
+instance ( ty ~ BG.Ptr (PtrConst.PtrConst BG.Void)
+         ) => BG.HasField "buffers" (BG.Ptr ArrowArray) (BG.Ptr ty) where
+
+  getField = HasCField.fromPtr (BG.Proxy @"buffers")
+
+instance HasCField.HasCField ArrowArray "buffers" where
+
+  type CFieldType ArrowArray "buffers" =
+    BG.Ptr (PtrConst.PtrConst BG.Void)
+
+  offset# = \_ -> \_ -> 40
+
+{-| __C declaration:__ @children@
+
+    __defined at:__ @duckdb_v2.h 158:22@
+
+    __exported by:__ @duckdb_v2.h@
+-}
+instance ( ty ~ BG.Ptr (BG.Ptr ArrowArray)
+         ) => BG.CompatHasField.HasField "children" ArrowArray ty where
+
+  hasField =
+    \x0 ->
+      ( \y1 ->
+          ArrowArray { children = y1
+                     , length = BG.getField @"length" x0
+                     , null_count = BG.getField @"null_count" x0
+                     , offset = BG.getField @"offset" x0
+                     , n_buffers = BG.getField @"n_buffers" x0
+                     , n_children = BG.getField @"n_children" x0
+                     , buffers = BG.getField @"buffers" x0
+                     , dictionary = BG.getField @"dictionary" x0
+                     , release = BG.getField @"release" x0
+                     , private_data = BG.getField @"private_data" x0
+                     }
+      , BG.getField @"children" x0
+      )
+
+instance ( ty ~ BG.Ptr (BG.Ptr ArrowArray)
+         ) => BG.HasField "children" (BG.Ptr ArrowArray) (BG.Ptr ty) where
+
+  getField = HasCField.fromPtr (BG.Proxy @"children")
+
+instance HasCField.HasCField ArrowArray "children" where
+
+  type CFieldType ArrowArray "children" =
+    BG.Ptr (BG.Ptr ArrowArray)
+
+  offset# = \_ -> \_ -> 48
+
+{-| __C declaration:__ @dictionary@
+
+    __defined at:__ @duckdb_v2.h 159:21@
+
+    __exported by:__ @duckdb_v2.h@
+-}
+instance ( ty ~ BG.Ptr ArrowArray
+         ) => BG.CompatHasField.HasField "dictionary" ArrowArray ty where
+
+  hasField =
+    \x0 ->
+      ( \y1 ->
+          ArrowArray { dictionary = y1
+                     , length = BG.getField @"length" x0
+                     , null_count = BG.getField @"null_count" x0
+                     , offset = BG.getField @"offset" x0
+                     , n_buffers = BG.getField @"n_buffers" x0
+                     , n_children = BG.getField @"n_children" x0
+                     , buffers = BG.getField @"buffers" x0
+                     , children = BG.getField @"children" x0
+                     , release = BG.getField @"release" x0
+                     , private_data = BG.getField @"private_data" x0
+                     }
+      , BG.getField @"dictionary" x0
+      )
+
+instance ( ty ~ BG.Ptr ArrowArray
+         ) => BG.HasField "dictionary" (BG.Ptr ArrowArray) (BG.Ptr ty) where
+
+  getField = HasCField.fromPtr (BG.Proxy @"dictionary")
+
+instance HasCField.HasCField ArrowArray "dictionary" where
+
+  type CFieldType ArrowArray "dictionary" =
+    BG.Ptr ArrowArray
+
+  offset# = \_ -> \_ -> 56
+
+{-| __C declaration:__ @release@
+
+    __defined at:__ @duckdb_v2.h 160:9@
+
+    __exported by:__ @duckdb_v2.h@
+-}
+instance ( ty ~ BG.FunPtr (BG.Ptr ArrowArray -> IO ())
+         ) => BG.CompatHasField.HasField "release" ArrowArray ty where
+
+  hasField =
+    \x0 ->
+      ( \y1 ->
+          ArrowArray { release = y1
+                     , length = BG.getField @"length" x0
+                     , null_count = BG.getField @"null_count" x0
+                     , offset = BG.getField @"offset" x0
+                     , n_buffers = BG.getField @"n_buffers" x0
+                     , n_children = BG.getField @"n_children" x0
+                     , buffers = BG.getField @"buffers" x0
+                     , children = BG.getField @"children" x0
+                     , dictionary = BG.getField @"dictionary" x0
+                     , private_data = BG.getField @"private_data" x0
+                     }
+      , BG.getField @"release" x0
+      )
+
+instance ( ty ~ BG.FunPtr (BG.Ptr ArrowArray -> IO ())
+         ) => BG.HasField "release" (BG.Ptr ArrowArray) (BG.Ptr ty) where
+
+  getField = HasCField.fromPtr (BG.Proxy @"release")
+
+instance HasCField.HasCField ArrowArray "release" where
+
+  type CFieldType ArrowArray "release" =
+    BG.FunPtr (BG.Ptr ArrowArray -> IO ())
+
+  offset# = \_ -> \_ -> 64
+
+{-| __C declaration:__ @private_data@
+
+    __defined at:__ @duckdb_v2.h 161:8@
+
+    __exported by:__ @duckdb_v2.h@
+-}
+instance ( ty ~ BG.Ptr BG.Void
+         ) => BG.CompatHasField.HasField "private_data" ArrowArray ty where
+
+  hasField =
+    \x0 ->
+      ( \y1 ->
+          ArrowArray { private_data = y1
+                     , length = BG.getField @"length" x0
+                     , null_count = BG.getField @"null_count" x0
+                     , offset = BG.getField @"offset" x0
+                     , n_buffers = BG.getField @"n_buffers" x0
+                     , n_children = BG.getField @"n_children" x0
+                     , buffers = BG.getField @"buffers" x0
+                     , children = BG.getField @"children" x0
+                     , dictionary = BG.getField @"dictionary" x0
+                     , release = BG.getField @"release" x0
+                     }
+      , BG.getField @"private_data" x0
+      )
+
+instance ( ty ~ BG.Ptr BG.Void
+         ) => BG.HasField "private_data" (BG.Ptr ArrowArray) (BG.Ptr ty) where
+
+  getField =
+    HasCField.fromPtr (BG.Proxy @"private_data")
+
+instance HasCField.HasCField ArrowArray "private_data" where
+
+  type CFieldType ArrowArray "private_data" =
+    BG.Ptr BG.Void
+
+  offset# = \_ -> \_ -> 72
+
+{-| __C declaration:__ @struct ArrowArrayStream@
+
+    __defined at:__ @duckdb_v2.h 169:8@
+
+    __exported by:__ @duckdb_v2.h@
+-}
+data ArrowArrayStream = ArrowArrayStream
+  { get_schema :: BG.FunPtr (BG.Ptr ArrowArrayStream -> BG.Ptr ArrowSchema -> IO BG.CInt)
+    {- ^ __C declaration:__ @get_schema@
+
+         __defined at:__ @duckdb_v2.h 170:8@
+
+         __exported by:__ @duckdb_v2.h@
+    -}
+  , get_next :: BG.FunPtr (BG.Ptr ArrowArrayStream -> BG.Ptr ArrowArray -> IO BG.CInt)
+    {- ^ __C declaration:__ @get_next@
+
+         __defined at:__ @duckdb_v2.h 171:8@
+
+         __exported by:__ @duckdb_v2.h@
+    -}
+  , get_last_error :: BG.FunPtr (BG.Ptr ArrowArrayStream -> IO (PtrConst.PtrConst BG.CChar))
+    {- ^ __C declaration:__ @get_last_error@
+
+         __defined at:__ @duckdb_v2.h 172:16@
+
+         __exported by:__ @duckdb_v2.h@
+    -}
+  , release :: BG.FunPtr (BG.Ptr ArrowArrayStream -> IO ())
+    {- ^ __C declaration:__ @release@
+
+         __defined at:__ @duckdb_v2.h 173:9@
+
+         __exported by:__ @duckdb_v2.h@
+    -}
+  , private_data :: BG.Ptr BG.Void
+    {- ^ __C declaration:__ @private_data@
+
+         __defined at:__ @duckdb_v2.h 174:8@
+
+         __exported by:__ @duckdb_v2.h@
+    -}
+  }
+  deriving stock (Eq, BG.Generic, Show)
+
+instance Marshal.StaticSize ArrowArrayStream where
+
+  staticSizeOf = \_ -> (40 :: Int)
+
+  staticAlignment = \_ -> (8 :: Int)
+
+instance Marshal.ReadRaw ArrowArrayStream where
+
+  readRaw =
+    \ptr0 ->
+          pure ArrowArrayStream
+      <*> HasCField.readRaw (BG.Proxy @"get_schema") ptr0
+      <*> HasCField.readRaw (BG.Proxy @"get_next") ptr0
+      <*> HasCField.readRaw (BG.Proxy @"get_last_error") ptr0
+      <*> HasCField.readRaw (BG.Proxy @"release") ptr0
+      <*> HasCField.readRaw (BG.Proxy @"private_data") ptr0
+
+instance Marshal.WriteRaw ArrowArrayStream where
+
+  writeRaw =
+    \ptr0 ->
+      \s1 ->
+        case s1 of
+          ArrowArrayStream get_schema2 get_next3 get_last_error4 release5 private_data6 ->
+               HasCField.writeRaw (BG.Proxy @"get_schema") ptr0 get_schema2
+            >> HasCField.writeRaw (BG.Proxy @"get_next") ptr0 get_next3
+            >> HasCField.writeRaw (BG.Proxy @"get_last_error") ptr0 get_last_error4
+            >> HasCField.writeRaw (BG.Proxy @"release") ptr0 release5
+            >> HasCField.writeRaw (BG.Proxy @"private_data") ptr0 private_data6
+
+deriving via Marshal.EquivStorable ArrowArrayStream instance BG.Storable ArrowArrayStream
+
+deriving via Struct.IsStructViaReadRaw ArrowArrayStream instance Struct.IsStruct ArrowArrayStream
+
+{-| __C declaration:__ @get_schema@
+
+    __defined at:__ @duckdb_v2.h 170:8@
+
+    __exported by:__ @duckdb_v2.h@
+-}
+instance ( ty ~ BG.FunPtr (BG.Ptr ArrowArrayStream -> BG.Ptr ArrowSchema -> IO BG.CInt)
+         ) => BG.CompatHasField.HasField "get_schema" ArrowArrayStream ty where
+
+  hasField =
+    \x0 ->
+      ( \y1 ->
+          ArrowArrayStream { get_schema = y1
+                           , get_next = BG.getField @"get_next" x0
+                           , get_last_error = BG.getField @"get_last_error" x0
+                           , release = BG.getField @"release" x0
+                           , private_data = BG.getField @"private_data" x0
+                           }
+      , BG.getField @"get_schema" x0
+      )
+
+instance ( ty ~ BG.FunPtr (BG.Ptr ArrowArrayStream -> BG.Ptr ArrowSchema -> IO BG.CInt)
+         ) => BG.HasField "get_schema" (BG.Ptr ArrowArrayStream) (BG.Ptr ty) where
+
+  getField = HasCField.fromPtr (BG.Proxy @"get_schema")
+
+instance HasCField.HasCField ArrowArrayStream "get_schema" where
+
+  type CFieldType ArrowArrayStream "get_schema" =
+    BG.FunPtr (BG.Ptr ArrowArrayStream -> BG.Ptr ArrowSchema -> IO BG.CInt)
+
+  offset# = \_ -> \_ -> 0
+
+{-| __C declaration:__ @get_next@
+
+    __defined at:__ @duckdb_v2.h 171:8@
+
+    __exported by:__ @duckdb_v2.h@
+-}
+instance ( ty ~ BG.FunPtr (BG.Ptr ArrowArrayStream -> BG.Ptr ArrowArray -> IO BG.CInt)
+         ) => BG.CompatHasField.HasField "get_next" ArrowArrayStream ty where
+
+  hasField =
+    \x0 ->
+      ( \y1 ->
+          ArrowArrayStream { get_next = y1
+                           , get_schema = BG.getField @"get_schema" x0
+                           , get_last_error = BG.getField @"get_last_error" x0
+                           , release = BG.getField @"release" x0
+                           , private_data = BG.getField @"private_data" x0
+                           }
+      , BG.getField @"get_next" x0
+      )
+
+instance ( ty ~ BG.FunPtr (BG.Ptr ArrowArrayStream -> BG.Ptr ArrowArray -> IO BG.CInt)
+         ) => BG.HasField "get_next" (BG.Ptr ArrowArrayStream) (BG.Ptr ty) where
+
+  getField = HasCField.fromPtr (BG.Proxy @"get_next")
+
+instance HasCField.HasCField ArrowArrayStream "get_next" where
+
+  type CFieldType ArrowArrayStream "get_next" =
+    BG.FunPtr (BG.Ptr ArrowArrayStream -> BG.Ptr ArrowArray -> IO BG.CInt)
+
+  offset# = \_ -> \_ -> 8
+
+{-| __C declaration:__ @get_last_error@
+
+    __defined at:__ @duckdb_v2.h 172:16@
+
+    __exported by:__ @duckdb_v2.h@
+-}
+instance ( ty ~ BG.FunPtr (BG.Ptr ArrowArrayStream -> IO (PtrConst.PtrConst BG.CChar))
+         ) => BG.CompatHasField.HasField "get_last_error" ArrowArrayStream ty where
+
+  hasField =
+    \x0 ->
+      ( \y1 ->
+          ArrowArrayStream { get_last_error = y1
+                           , get_schema = BG.getField @"get_schema" x0
+                           , get_next = BG.getField @"get_next" x0
+                           , release = BG.getField @"release" x0
+                           , private_data = BG.getField @"private_data" x0
+                           }
+      , BG.getField @"get_last_error" x0
+      )
+
+instance ( ty ~ BG.FunPtr (BG.Ptr ArrowArrayStream -> IO (PtrConst.PtrConst BG.CChar))
+         ) => BG.HasField "get_last_error" (BG.Ptr ArrowArrayStream) (BG.Ptr ty) where
+
+  getField =
+    HasCField.fromPtr (BG.Proxy @"get_last_error")
+
+instance HasCField.HasCField ArrowArrayStream "get_last_error" where
+
+  type CFieldType ArrowArrayStream "get_last_error" =
+    BG.FunPtr (BG.Ptr ArrowArrayStream -> IO (PtrConst.PtrConst BG.CChar))
+
+  offset# = \_ -> \_ -> 16
+
+{-| __C declaration:__ @release@
+
+    __defined at:__ @duckdb_v2.h 173:9@
+
+    __exported by:__ @duckdb_v2.h@
+-}
+instance ( ty ~ BG.FunPtr (BG.Ptr ArrowArrayStream -> IO ())
+         ) => BG.CompatHasField.HasField "release" ArrowArrayStream ty where
+
+  hasField =
+    \x0 ->
+      ( \y1 ->
+          ArrowArrayStream { release = y1
+                           , get_schema = BG.getField @"get_schema" x0
+                           , get_next = BG.getField @"get_next" x0
+                           , get_last_error = BG.getField @"get_last_error" x0
+                           , private_data = BG.getField @"private_data" x0
+                           }
+      , BG.getField @"release" x0
+      )
+
+instance ( ty ~ BG.FunPtr (BG.Ptr ArrowArrayStream -> IO ())
+         ) => BG.HasField "release" (BG.Ptr ArrowArrayStream) (BG.Ptr ty) where
+
+  getField = HasCField.fromPtr (BG.Proxy @"release")
+
+instance HasCField.HasCField ArrowArrayStream "release" where
+
+  type CFieldType ArrowArrayStream "release" =
+    BG.FunPtr (BG.Ptr ArrowArrayStream -> IO ())
+
+  offset# = \_ -> \_ -> 24
+
+{-| __C declaration:__ @private_data@
+
+    __defined at:__ @duckdb_v2.h 174:8@
+
+    __exported by:__ @duckdb_v2.h@
+-}
+instance ( ty ~ BG.Ptr BG.Void
+         ) => BG.CompatHasField.HasField "private_data" ArrowArrayStream ty where
+
+  hasField =
+    \x0 ->
+      ( \y1 ->
+          ArrowArrayStream { private_data = y1
+                           , get_schema = BG.getField @"get_schema" x0
+                           , get_next = BG.getField @"get_next" x0
+                           , get_last_error = BG.getField @"get_last_error" x0
+                           , release = BG.getField @"release" x0
+                           }
+      , BG.getField @"private_data" x0
+      )
+
+instance ( ty ~ BG.Ptr BG.Void
+         ) => BG.HasField "private_data" (BG.Ptr ArrowArrayStream) (BG.Ptr ty) where
+
+  getField =
+    HasCField.fromPtr (BG.Proxy @"private_data")
+
+instance HasCField.HasCField ArrowArrayStream "private_data" where
+
+  type CFieldType ArrowArrayStream "private_data" =
+    BG.Ptr BG.Void
+
+  offset# = \_ -> \_ -> 32
+
+{-| __C declaration:__ @idx_t@
+
+    __defined at:__ @duckdb_v2.h 179:18@
+
+    __exported by:__ @duckdb_v2.h@
+-}
+newtype DuckDBIdx = DuckDBIdx
+  { unwrap :: HsBindgen.Runtime.LibC.Word64
+  }
+  deriving stock (Eq, BG.Generic, Ord, Read, Show)
+  deriving newtype
+    ( BG.Bitfield
+    , BG.Bits
+    , Bounded
+    , Enum
+    , BG.FiniteBits
+    , BG.HasFFIType
+    , Integral
+    , BG.Ix
+    , Num
+    , BG.Prim
+    , Marshal.ReadRaw
+    , Real
+    , Marshal.StaticSize
+    , BG.Storable
+    , Marshal.WriteRaw
+    )
+
+instance ( ty ~ HsBindgen.Runtime.LibC.Word64
+         ) => BG.CompatHasField.HasField "unwrap" DuckDBIdx ty where
+
+  hasField =
+    \x0 ->
+      (\y1 ->
+         DuckDBIdx {unwrap = y1}, BG.getField @"unwrap" x0)
+
+instance ( ty ~ HsBindgen.Runtime.LibC.Word64
+         ) => BG.HasField "unwrap" (BG.Ptr DuckDBIdx) (BG.Ptr ty) where
+
+  getField = HasCField.fromPtr (BG.Proxy @"unwrap")
+
+instance HasCField.HasCField DuckDBIdx "unwrap" where
+
+  type CFieldType DuckDBIdx "unwrap" =
+    HsBindgen.Runtime.LibC.Word64
+
+  offset# = \_ -> \_ -> 0
+
+{-| __C declaration:__ @struct _duckdb_extension_info@
+
+    __defined at:__ @duckdb_v2.h 180:16@
+
+    __exported by:__ @duckdb_v2.h@
+-}
+data DuckDBExtensionInfoStruct
+
+{-| __C declaration:__ @duckdb_v2_extension_handle@
+
+    __defined at:__ @duckdb_v2.h 180:40@
+
+    __exported by:__ @duckdb_v2.h@
+-}
+newtype DuckDBV2ExtensionHandle = DuckDBV2ExtensionHandle
+  { unwrap :: BG.Ptr DuckDBExtensionInfoStruct
+  }
+  deriving stock (Eq, BG.Generic, Ord, Show)
+  deriving newtype
+    ( BG.HasFFIType
+    , Marshal.ReadRaw
+    , Marshal.StaticSize
+    , BG.Storable
+    , Marshal.WriteRaw
+    )
+
+instance ( ty ~ BG.Ptr DuckDBExtensionInfoStruct
+         ) => BG.CompatHasField.HasField "unwrap" DuckDBV2ExtensionHandle ty where
+
+  hasField =
+    \x0 ->
+      (\y1 ->
+         DuckDBV2ExtensionHandle {unwrap = y1}, BG.getField @"unwrap" x0)
+
+instance ( ty ~ BG.Ptr DuckDBExtensionInfoStruct
+         ) => BG.HasField "unwrap" (BG.Ptr DuckDBV2ExtensionHandle) (BG.Ptr ty) where
+
+  getField = HasCField.fromPtr (BG.Proxy @"unwrap")
+
+instance HasCField.HasCField DuckDBV2ExtensionHandle "unwrap" where
+
+  type CFieldType DuckDBV2ExtensionHandle "unwrap" =
+    BG.Ptr DuckDBExtensionInfoStruct
+
+  offset# = \_ -> \_ -> 0
+
+{-| The order guarantee a producer of rows makes about its output, which decides whether the rows it produces must be kept in order downstream.
+
+    __C declaration:__ @enum DUCKDB_V2_ORDER_PRESERVATION@
+
+    __defined at:__ @duckdb_v2.h 192:14@
+
+    __exported by:__ @duckdb_v2.h@
+-}
+newtype DuckDBV2OrderPreservation = DuckDBV2OrderPreservation
+  { unwrap :: BG.CUInt
+  }
+  deriving stock (Eq, BG.Generic, Ord)
+  deriving newtype (BG.HasFFIType)
+
+instance Marshal.StaticSize DuckDBV2OrderPreservation where
+
+  staticSizeOf = \_ -> (4 :: Int)
+
+  staticAlignment = \_ -> (4 :: Int)
+
+instance Marshal.ReadRaw DuckDBV2OrderPreservation where
+
+  readRaw =
+    \ptr0 ->
+          pure DuckDBV2OrderPreservation
+      <*> Marshal.readRawByteOff ptr0 (0 :: Int)
+
+instance Marshal.WriteRaw DuckDBV2OrderPreservation where
+
+  writeRaw =
+    \ptr0 ->
+      \s1 ->
+        case s1 of
+          DuckDBV2OrderPreservation unwrap2 ->
+            Marshal.writeRawByteOff ptr0 (0 :: Int) unwrap2
+
+deriving via Marshal.EquivStorable DuckDBV2OrderPreservation instance BG.Storable DuckDBV2OrderPreservation
+
+deriving via BG.CUInt instance BG.Prim DuckDBV2OrderPreservation
+
+instance CEnum.CEnum DuckDBV2OrderPreservation where
+
+  type CEnumZ DuckDBV2OrderPreservation = BG.CUInt
+
+  toCEnum = DuckDBV2OrderPreservation
+
+  fromCEnum = BG.getField @"unwrap"
+
+  declaredValues =
+    \_ ->
+      CEnum.declaredValuesFromList [ (0, BG.singleton "DuckDBV2OrderPreservationNoOrder")
+                                   , (1, BG.singleton "DuckDBV2OrderPreservationInsertionOrder")
+                                   , (2, BG.singleton "DuckDBV2OrderPreservationFixedOrder")
+                                   , (2147483647, BG.singleton "DuckDBV2OrderPreservationMaxEnum")
+                                   ]
+
+  showsUndeclared =
+    CEnum.showsWrappedUndeclared "DuckDBV2OrderPreservation"
+
+  readPrecUndeclared =
+    CEnum.readPrecWrappedUndeclared "DuckDBV2OrderPreservation"
+
+instance Show DuckDBV2OrderPreservation where
+
+  showsPrec = CEnum.shows
+
+instance Read DuckDBV2OrderPreservation where
+
+  readPrec = CEnum.readPrec
+
+  readList = BG.readListDefault
+
+  readListPrec = BG.readListPrecDefault
+
+instance ( ty ~ BG.CUInt
+         ) => BG.CompatHasField.HasField "unwrap" DuckDBV2OrderPreservation ty where
+
+  hasField =
+    \x0 ->
+      (\y1 ->
+         DuckDBV2OrderPreservation {unwrap = y1}, BG.getField @"unwrap" x0)
+
+instance ( ty ~ BG.CUInt
+         ) => BG.HasField "unwrap" (BG.Ptr DuckDBV2OrderPreservation) (BG.Ptr ty) where
+
+  getField = HasCField.fromPtr (BG.Proxy @"unwrap")
+
+instance HasCField.HasCField DuckDBV2OrderPreservation "unwrap" where
+
+  type CFieldType DuckDBV2OrderPreservation "unwrap" =
+    BG.CUInt
+
+  offset# = \_ -> \_ -> 0
+
+{-| The rows have no meaningful order. The engine may reorder them freely, and consumers that otherwise keep insertion order, such as query results, INSERT and COPY, run in parallel without ordering them.
+
+    __C declaration:__ @DUCKDB_V2_ORDER_PRESERVATION_NO_ORDER@
+
+    __defined at:__ @duckdb_v2.h 197:2@
+
+    __exported by:__ @duckdb_v2.h@
+-}
+pattern DuckDBV2OrderPreservationNoOrder :: DuckDBV2OrderPreservation
+pattern DuckDBV2OrderPreservationNoOrder = DuckDBV2OrderPreservation 0
+
+{-| The rows are produced in insertion order, which the engine keeps unless the @preserve_insertion_order@ setting is disabled.
+
+    __C declaration:__ @DUCKDB_V2_ORDER_PRESERVATION_INSERTION_ORDER@
+
+    __defined at:__ @duckdb_v2.h 203:2@
+
+    __exported by:__ @duckdb_v2.h@
+-}
+pattern DuckDBV2OrderPreservationInsertionOrder :: DuckDBV2OrderPreservation
+pattern DuckDBV2OrderPreservationInsertionOrder = DuckDBV2OrderPreservation 1
+
+{-| The rows are produced in an order that must be kept, as if sorted by an @ORDER BY@ , even when the @preserve_insertion_order@ setting is disabled.
+
+    __C declaration:__ @DUCKDB_V2_ORDER_PRESERVATION_FIXED_ORDER@
+
+    __defined at:__ @duckdb_v2.h 209:2@
+
+    __exported by:__ @duckdb_v2.h@
+-}
+pattern DuckDBV2OrderPreservationFixedOrder :: DuckDBV2OrderPreservation
+pattern DuckDBV2OrderPreservationFixedOrder = DuckDBV2OrderPreservation 2
+
+{-| __C declaration:__ @DUCKDB_V2_ORDER_PRESERVATION_MAX_ENUM@
+
+    __defined at:__ @duckdb_v2.h 210:2@
+
+    __exported by:__ @duckdb_v2.h@
+-}
+pattern DuckDBV2OrderPreservationMaxEnum :: DuckDBV2OrderPreservation
+pattern DuckDBV2OrderPreservationMaxEnum = DuckDBV2OrderPreservation 2147483647
+
+{-| An opaque, owned handle to the V2 environment: the required root through which instance handles are created. All instances under one environment share an instance cache, so file-level conflicts — the same database file opened twice — are detected across them. Destroying the environment refuses with ERROR_RESOURCE_IN_USE while any instance created through it is still alive; destroy those first.
+
+    __C declaration:__ @struct _duckdb_v2_environment@
+
+    __defined at:__ @duckdb_v2.h 229:16@
+
+    __exported by:__ @duckdb_v2.h@
+-}
+data DuckDBV2EnvironmentStruct
+
+instance Marshal.StaticSize DuckDBV2EnvironmentStruct where
+
+  staticSizeOf = \_ -> (8 :: Int)
+
+  staticAlignment = \_ -> (8 :: Int)
+
+{-| An opaque, owned handle to the V2 environment: the required root through which instance handles are created. All instances under one environment share an instance cache, so file-level conflicts — the same database file opened twice — are detected across them. Destroying the environment refuses with ERROR_RESOURCE_IN_USE while any instance created through it is still alive; destroy those first.
+
+    __C declaration:__ @duckdb_v2_environment_handle@
+
+    __defined at:__ @duckdb_v2.h 231:5@
+
+    __exported by:__ @duckdb_v2.h@
+-}
+newtype DuckDBV2EnvironmentHandle = DuckDBV2EnvironmentHandle
+  { unwrap :: BG.Ptr DuckDBV2EnvironmentStruct
+  }
+  deriving stock (Eq, BG.Generic, Ord, Show)
+  deriving newtype
+    ( BG.HasFFIType
+    , Marshal.ReadRaw
+    , Marshal.StaticSize
+    , BG.Storable
+    , Marshal.WriteRaw
+    )
+
+instance ( ty ~ BG.Ptr DuckDBV2EnvironmentStruct
+         ) => BG.CompatHasField.HasField "unwrap" DuckDBV2EnvironmentHandle ty where
+
+  hasField =
+    \x0 ->
+      (\y1 ->
+         DuckDBV2EnvironmentHandle {unwrap = y1}, BG.getField @"unwrap" x0)
+
+instance ( ty ~ BG.Ptr DuckDBV2EnvironmentStruct
+         ) => BG.HasField "unwrap" (BG.Ptr DuckDBV2EnvironmentHandle) (BG.Ptr ty) where
+
+  getField = HasCField.fromPtr (BG.Proxy @"unwrap")
+
+instance HasCField.HasCField DuckDBV2EnvironmentHandle "unwrap" where
+
+  type CFieldType DuckDBV2EnvironmentHandle "unwrap" =
+    BG.Ptr DuckDBV2EnvironmentStruct
+
+  offset# = \_ -> \_ -> 0
+
+{-| An opaque, owned handle to a DuckDB database instance: a buffer pool, a scheduler, a set of GLOBAL settings, and the databases attached to it. Created empty by @duckdb_v2_instance_create()@ ; databases are attached with @duckdb_v2_instance_attach()@ , made the default with @duckdb_v2_instance_set_default()@ , and detached with @duckdb_v2_instance_detach()@ . Always destroy via @duckdb_v2_instance_destroy()@ .
+
+    __C declaration:__ @struct _duckdb_v2_instance@
+
+    __defined at:__ @duckdb_v2.h 239:16@
+
+    __exported by:__ @duckdb_v2.h@
+-}
+data DuckDBV2InstanceStruct
+
+instance Marshal.StaticSize DuckDBV2InstanceStruct where
+
+  staticSizeOf = \_ -> (8 :: Int)
+
+  staticAlignment = \_ -> (8 :: Int)
+
+{-| An opaque, owned handle to a DuckDB database instance: a buffer pool, a scheduler, a set of GLOBAL settings, and the databases attached to it. Created empty by @duckdb_v2_instance_create()@ ; databases are attached with @duckdb_v2_instance_attach()@ , made the default with @duckdb_v2_instance_set_default()@ , and detached with @duckdb_v2_instance_detach()@ . Always destroy via @duckdb_v2_instance_destroy()@ .
+
+    __C declaration:__ @duckdb_v2_instance_handle@
+
+    __defined at:__ @duckdb_v2.h 241:5@
+
+    __exported by:__ @duckdb_v2.h@
+-}
+newtype DuckDBV2InstanceHandle = DuckDBV2InstanceHandle
+  { unwrap :: BG.Ptr DuckDBV2InstanceStruct
+  }
+  deriving stock (Eq, BG.Generic, Ord, Show)
+  deriving newtype
+    ( BG.HasFFIType
+    , Marshal.ReadRaw
+    , Marshal.StaticSize
+    , BG.Storable
+    , Marshal.WriteRaw
+    )
+
+instance ( ty ~ BG.Ptr DuckDBV2InstanceStruct
+         ) => BG.CompatHasField.HasField "unwrap" DuckDBV2InstanceHandle ty where
+
+  hasField =
+    \x0 ->
+      (\y1 ->
+         DuckDBV2InstanceHandle {unwrap = y1}, BG.getField @"unwrap" x0)
+
+instance ( ty ~ BG.Ptr DuckDBV2InstanceStruct
+         ) => BG.HasField "unwrap" (BG.Ptr DuckDBV2InstanceHandle) (BG.Ptr ty) where
+
+  getField = HasCField.fromPtr (BG.Proxy @"unwrap")
+
+instance HasCField.HasCField DuckDBV2InstanceHandle "unwrap" where
+
+  type CFieldType DuckDBV2InstanceHandle "unwrap" =
+    BG.Ptr DuckDBV2InstanceStruct
+
+  offset# = \_ -> \_ -> 0
+
+{-| An opaque, owned handle to a DuckDB connection: a session on a database instance with its own LOCAL settings and transaction state. Always destroy via @duckdb_v2_connection_destroy()@ .
+
+    __C declaration:__ @struct _duckdb_v2_connection@
+
+    __defined at:__ @duckdb_v2.h 247:16@
+
+    __exported by:__ @duckdb_v2.h@
+-}
+data DuckDBV2ConnectionStruct
+
+instance Marshal.StaticSize DuckDBV2ConnectionStruct where
+
+  staticSizeOf = \_ -> (8 :: Int)
+
+  staticAlignment = \_ -> (8 :: Int)
+
+{-| An opaque, owned handle to a DuckDB connection: a session on a database instance with its own LOCAL settings and transaction state. Always destroy via @duckdb_v2_connection_destroy()@ .
+
+    __C declaration:__ @duckdb_v2_connection_handle@
+
+    __defined at:__ @duckdb_v2.h 249:5@
+
+    __exported by:__ @duckdb_v2.h@
+-}
+newtype DuckDBV2ConnectionHandle = DuckDBV2ConnectionHandle
+  { unwrap :: BG.Ptr DuckDBV2ConnectionStruct
+  }
+  deriving stock (Eq, BG.Generic, Ord, Show)
+  deriving newtype
+    ( BG.HasFFIType
+    , Marshal.ReadRaw
+    , Marshal.StaticSize
+    , BG.Storable
+    , Marshal.WriteRaw
+    )
+
+instance ( ty ~ BG.Ptr DuckDBV2ConnectionStruct
+         ) => BG.CompatHasField.HasField "unwrap" DuckDBV2ConnectionHandle ty where
+
+  hasField =
+    \x0 ->
+      (\y1 ->
+         DuckDBV2ConnectionHandle {unwrap = y1}, BG.getField @"unwrap" x0)
+
+instance ( ty ~ BG.Ptr DuckDBV2ConnectionStruct
+         ) => BG.HasField "unwrap" (BG.Ptr DuckDBV2ConnectionHandle) (BG.Ptr ty) where
+
+  getField = HasCField.fromPtr (BG.Proxy @"unwrap")
+
+instance HasCField.HasCField DuckDBV2ConnectionHandle "unwrap" where
+
+  type CFieldType DuckDBV2ConnectionHandle "unwrap" =
+    BG.Ptr DuckDBV2ConnectionStruct
+
+  offset# = \_ -> \_ -> 0
+
+{-| A borrowed handle to the scope config options are read from and written at. Taken from an instance ( @duckdb_v2_instance_get_config()@ ), a connection ( @duckdb_v2_connection_get_config()@ ) or a context ( @duckdb_v2_context_get_config()@ ), and valid for as long as its source is; the caller never destroys it. An instance\'s config is the GLOBAL scope alone; a connection\'s or a context\'s config reads that client\'s cascade (its SESSION value, else the GLOBAL one, else the default) and writes at any scope the option supports.
+
+    __C declaration:__ @struct _duckdb_v2_config@
+
+    __defined at:__ @duckdb_v2.h 258:16@
+
+    __exported by:__ @duckdb_v2.h@
+-}
+data DuckDBV2ConfigStruct
+
+instance Marshal.StaticSize DuckDBV2ConfigStruct where
+
+  staticSizeOf = \_ -> (8 :: Int)
+
+  staticAlignment = \_ -> (8 :: Int)
+
+{-| A borrowed handle to the scope config options are read from and written at. Taken from an instance ( @duckdb_v2_instance_get_config()@ ), a connection ( @duckdb_v2_connection_get_config()@ ) or a context ( @duckdb_v2_context_get_config()@ ), and valid for as long as its source is; the caller never destroys it. An instance\'s config is the GLOBAL scope alone; a connection\'s or a context\'s config reads that client\'s cascade (its SESSION value, else the GLOBAL one, else the default) and writes at any scope the option supports.
+
+    __C declaration:__ @duckdb_v2_config_handle@
+
+    __defined at:__ @duckdb_v2.h 260:5@
+
+    __exported by:__ @duckdb_v2.h@
+-}
+newtype DuckDBV2ConfigHandle = DuckDBV2ConfigHandle
+  { unwrap :: BG.Ptr DuckDBV2ConfigStruct
+  }
+  deriving stock (Eq, BG.Generic, Ord, Show)
+  deriving newtype
+    ( BG.HasFFIType
+    , Marshal.ReadRaw
+    , Marshal.StaticSize
+    , BG.Storable
+    , Marshal.WriteRaw
+    )
+
+instance ( ty ~ BG.Ptr DuckDBV2ConfigStruct
+         ) => BG.CompatHasField.HasField "unwrap" DuckDBV2ConfigHandle ty where
+
+  hasField =
+    \x0 ->
+      (\y1 ->
+         DuckDBV2ConfigHandle {unwrap = y1}, BG.getField @"unwrap" x0)
+
+instance ( ty ~ BG.Ptr DuckDBV2ConfigStruct
+         ) => BG.HasField "unwrap" (BG.Ptr DuckDBV2ConfigHandle) (BG.Ptr ty) where
+
+  getField = HasCField.fromPtr (BG.Proxy @"unwrap")
+
+instance HasCField.HasCField DuckDBV2ConfigHandle "unwrap" where
+
+  type CFieldType DuckDBV2ConfigHandle "unwrap" =
+    BG.Ptr DuckDBV2ConfigStruct
+
+  offset# = \_ -> \_ -> 0
+
+{-| An opaque, owned, read-only descriptor of a single config option as registered on an instance: its canonical name, default value, description, the scopes it may be written at, and aliases. It carries no current value: read that with the *_get_option_value functions, and write it with the *_set_option functions. Returned by the *_get_option_by_name and *_get_option_by_index functions; the caller always destroys it via @duckdb_v2_option_destroy()@ .
+
+    __C declaration:__ @struct _duckdb_v2_option@
+
+    __defined at:__ @duckdb_v2.h 268:16@
+
+    __exported by:__ @duckdb_v2.h@
+-}
+data DuckDBV2OptionStruct
+
+instance Marshal.StaticSize DuckDBV2OptionStruct where
+
+  staticSizeOf = \_ -> (8 :: Int)
+
+  staticAlignment = \_ -> (8 :: Int)
+
+{-| An opaque, owned, read-only descriptor of a single config option as registered on an instance: its canonical name, default value, description, the scopes it may be written at, and aliases. It carries no current value: read that with the *_get_option_value functions, and write it with the *_set_option functions. Returned by the *_get_option_by_name and *_get_option_by_index functions; the caller always destroys it via @duckdb_v2_option_destroy()@ .
+
+    __C declaration:__ @duckdb_v2_option_handle@
+
+    __defined at:__ @duckdb_v2.h 270:5@
+
+    __exported by:__ @duckdb_v2.h@
+-}
+newtype DuckDBV2OptionHandle = DuckDBV2OptionHandle
+  { unwrap :: BG.Ptr DuckDBV2OptionStruct
+  }
+  deriving stock (Eq, BG.Generic, Ord, Show)
+  deriving newtype
+    ( BG.HasFFIType
+    , Marshal.ReadRaw
+    , Marshal.StaticSize
+    , BG.Storable
+    , Marshal.WriteRaw
+    )
+
+instance ( ty ~ BG.Ptr DuckDBV2OptionStruct
+         ) => BG.CompatHasField.HasField "unwrap" DuckDBV2OptionHandle ty where
+
+  hasField =
+    \x0 ->
+      (\y1 ->
+         DuckDBV2OptionHandle {unwrap = y1}, BG.getField @"unwrap" x0)
+
+instance ( ty ~ BG.Ptr DuckDBV2OptionStruct
+         ) => BG.HasField "unwrap" (BG.Ptr DuckDBV2OptionHandle) (BG.Ptr ty) where
+
+  getField = HasCField.fromPtr (BG.Proxy @"unwrap")
+
+instance HasCField.HasCField DuckDBV2OptionHandle "unwrap" where
+
+  type CFieldType DuckDBV2OptionHandle "unwrap" =
+    BG.Ptr DuckDBV2OptionStruct
+
+  offset# = \_ -> \_ -> 0
+
+{-| Opaque detail for a failed call; destroy with @duckdb_v2_error_info_destroy()@ .
+
+    __C declaration:__ @struct _duckdb_v2_error_info@
+
+    __defined at:__ @duckdb_v2.h 273:16@
+
+    __exported by:__ @duckdb_v2.h@
+-}
+data DuckDBV2ErrorInfoStruct
+
+instance Marshal.StaticSize DuckDBV2ErrorInfoStruct where
+
+  staticSizeOf = \_ -> (8 :: Int)
+
+  staticAlignment = \_ -> (8 :: Int)
+
+{-| Opaque detail for a failed call; destroy with @duckdb_v2_error_info_destroy()@ .
+
+    __C declaration:__ @duckdb_v2_error_info_handle@
+
+    __defined at:__ @duckdb_v2.h 275:5@
+
+    __exported by:__ @duckdb_v2.h@
+-}
+newtype DuckDBV2ErrorInfoHandle = DuckDBV2ErrorInfoHandle
+  { unwrap :: BG.Ptr DuckDBV2ErrorInfoStruct
+  }
+  deriving stock (Eq, BG.Generic, Ord, Show)
+  deriving newtype
+    ( BG.HasFFIType
+    , Marshal.ReadRaw
+    , Marshal.StaticSize
+    , BG.Storable
+    , Marshal.WriteRaw
+    )
+
+instance ( ty ~ BG.Ptr DuckDBV2ErrorInfoStruct
+         ) => BG.CompatHasField.HasField "unwrap" DuckDBV2ErrorInfoHandle ty where
+
+  hasField =
+    \x0 ->
+      (\y1 ->
+         DuckDBV2ErrorInfoHandle {unwrap = y1}, BG.getField @"unwrap" x0)
+
+instance ( ty ~ BG.Ptr DuckDBV2ErrorInfoStruct
+         ) => BG.HasField "unwrap" (BG.Ptr DuckDBV2ErrorInfoHandle) (BG.Ptr ty) where
+
+  getField = HasCField.fromPtr (BG.Proxy @"unwrap")
+
+instance HasCField.HasCField DuckDBV2ErrorInfoHandle "unwrap" where
+
+  type CFieldType DuckDBV2ErrorInfoHandle "unwrap" =
+    BG.Ptr DuckDBV2ErrorInfoStruct
+
+  offset# = \_ -> \_ -> 0
+
+{-| An opaque, owned handle to a logical type. Carries a type id plus any kind-specific metadata: decimal width and scale, enum dictionary, list / array / struct / map / union child types, alias. A type is read-only once constructed; instances arrive from a query result schema, or from one of the create_type_* constructors. Always destroy via @duckdb_v2_logical_type_destroy()@ . Borrowed strings returned by the getters are valid only until then.
+
+    __C declaration:__ @struct _duckdb_v2_logical_type@
+
+    __defined at:__ @duckdb_v2.h 283:16@
+
+    __exported by:__ @duckdb_v2.h@
+-}
+data DuckDBV2LogicalTypeStruct
+
+instance Marshal.StaticSize DuckDBV2LogicalTypeStruct where
+
+  staticSizeOf = \_ -> (8 :: Int)
+
+  staticAlignment = \_ -> (8 :: Int)
+
+{-| An opaque, owned handle to a logical type. Carries a type id plus any kind-specific metadata: decimal width and scale, enum dictionary, list / array / struct / map / union child types, alias. A type is read-only once constructed; instances arrive from a query result schema, or from one of the create_type_* constructors. Always destroy via @duckdb_v2_logical_type_destroy()@ . Borrowed strings returned by the getters are valid only until then.
+
+    __C declaration:__ @duckdb_v2_logical_type_handle@
+
+    __defined at:__ @duckdb_v2.h 285:5@
+
+    __exported by:__ @duckdb_v2.h@
+-}
+newtype DuckDBV2LogicalTypeHandle = DuckDBV2LogicalTypeHandle
+  { unwrap :: BG.Ptr DuckDBV2LogicalTypeStruct
+  }
+  deriving stock (Eq, BG.Generic, Ord, Show)
+  deriving newtype
+    ( BG.HasFFIType
+    , Marshal.ReadRaw
+    , Marshal.StaticSize
+    , BG.Storable
+    , Marshal.WriteRaw
+    )
+
+instance ( ty ~ BG.Ptr DuckDBV2LogicalTypeStruct
+         ) => BG.CompatHasField.HasField "unwrap" DuckDBV2LogicalTypeHandle ty where
+
+  hasField =
+    \x0 ->
+      (\y1 ->
+         DuckDBV2LogicalTypeHandle {unwrap = y1}, BG.getField @"unwrap" x0)
+
+instance ( ty ~ BG.Ptr DuckDBV2LogicalTypeStruct
+         ) => BG.HasField "unwrap" (BG.Ptr DuckDBV2LogicalTypeHandle) (BG.Ptr ty) where
+
+  getField = HasCField.fromPtr (BG.Proxy @"unwrap")
+
+instance HasCField.HasCField DuckDBV2LogicalTypeHandle "unwrap" where
+
+  type CFieldType DuckDBV2LogicalTypeHandle "unwrap" =
+    BG.Ptr DuckDBV2LogicalTypeStruct
+
+  offset# = \_ -> \_ -> 0
+
+{-| An opaque, owned handle to a single SQL value: a logical type plus a typed payload. Always destroy via @duckdb_v2_value_destroy()@ . The string returned by @duckdb_v2_value_get_varchar()@ / @duckdb_v2_value_get_blob()@ is borrowed and valid only until then. That holds for BIGNUM too, where what is borrowed is the opaque storage form; @duckdb_v2_bignum_decode()@ translates it into a magnitude and a sign flag, writing into a buffer the caller supplies.
+
+    __C declaration:__ @struct _duckdb_v2_value@
+
+    __defined at:__ @duckdb_v2.h 294:16@
+
+    __exported by:__ @duckdb_v2.h@
+-}
+data DuckDBV2ValueStruct
+
+instance Marshal.StaticSize DuckDBV2ValueStruct where
+
+  staticSizeOf = \_ -> (8 :: Int)
+
+  staticAlignment = \_ -> (8 :: Int)
+
+{-| An opaque, owned handle to a single SQL value: a logical type plus a typed payload. Always destroy via @duckdb_v2_value_destroy()@ . The string returned by @duckdb_v2_value_get_varchar()@ / @duckdb_v2_value_get_blob()@ is borrowed and valid only until then. That holds for BIGNUM too, where what is borrowed is the opaque storage form; @duckdb_v2_bignum_decode()@ translates it into a magnitude and a sign flag, writing into a buffer the caller supplies.
+
+    __C declaration:__ @duckdb_v2_value_handle@
+
+    __defined at:__ @duckdb_v2.h 296:5@
+
+    __exported by:__ @duckdb_v2.h@
+-}
+newtype DuckDBV2ValueHandle = DuckDBV2ValueHandle
+  { unwrap :: BG.Ptr DuckDBV2ValueStruct
+  }
+  deriving stock (Eq, BG.Generic, Ord, Show)
+  deriving newtype
+    ( BG.HasFFIType
+    , Marshal.ReadRaw
+    , Marshal.StaticSize
+    , BG.Storable
+    , Marshal.WriteRaw
+    )
+
+instance ( ty ~ BG.Ptr DuckDBV2ValueStruct
+         ) => BG.CompatHasField.HasField "unwrap" DuckDBV2ValueHandle ty where
+
+  hasField =
+    \x0 ->
+      (\y1 ->
+         DuckDBV2ValueHandle {unwrap = y1}, BG.getField @"unwrap" x0)
+
+instance ( ty ~ BG.Ptr DuckDBV2ValueStruct
+         ) => BG.HasField "unwrap" (BG.Ptr DuckDBV2ValueHandle) (BG.Ptr ty) where
+
+  getField = HasCField.fromPtr (BG.Proxy @"unwrap")
+
+instance HasCField.HasCField DuckDBV2ValueHandle "unwrap" where
+
+  type CFieldType DuckDBV2ValueHandle "unwrap" =
+    BG.Ptr DuckDBV2ValueStruct
+
+  offset# = \_ -> \_ -> 0
+
+{-| An opaque, owned handle to the streaming result of a query. Carries the schema (column names and logical types), the statement type, and the result type from prepare time; row data is produced incrementally by stepping ( @duckdb_v2_result_step()@ ) or draining ( @duckdb_v2_result_fetch_chunk()@ ). Single consumer: step from one thread at a time.
+
+    A result is a cursor on the connection\'s execution, not a box of data. While its statement runs — at most until it is finished, cancelled, errored, or destroyed — the connection refuses new queries with ERROR_RESOURCE_IN_USE, and the query\'s transaction stays open, deferring version cleanup and checkpointing, so drain or destroy it promptly. Side-effecting statements (PRAGMA, ALTER, ...) take effect only once the result is drained. Always destroy via @duckdb_v2_result_destroy()@ , which is safe even on a partially consumed stream.
+
+    __C declaration:__ @struct _duckdb_v2_result@
+
+    __defined at:__ @duckdb_v2.h 310:16@
+
+    __exported by:__ @duckdb_v2.h@
+-}
+data DuckDBV2ResultStruct
+
+instance Marshal.StaticSize DuckDBV2ResultStruct where
+
+  staticSizeOf = \_ -> (8 :: Int)
+
+  staticAlignment = \_ -> (8 :: Int)
+
+{-| An opaque, owned handle to the streaming result of a query. Carries the schema (column names and logical types), the statement type, and the result type from prepare time; row data is produced incrementally by stepping ( @duckdb_v2_result_step()@ ) or draining ( @duckdb_v2_result_fetch_chunk()@ ). Single consumer: step from one thread at a time.
+
+    A result is a cursor on the connection\'s execution, not a box of data. While its statement runs — at most until it is finished, cancelled, errored, or destroyed — the connection refuses new queries with ERROR_RESOURCE_IN_USE, and the query\'s transaction stays open, deferring version cleanup and checkpointing, so drain or destroy it promptly. Side-effecting statements (PRAGMA, ALTER, ...) take effect only once the result is drained. Always destroy via @duckdb_v2_result_destroy()@ , which is safe even on a partially consumed stream.
+
+    __C declaration:__ @duckdb_v2_result_handle@
+
+    __defined at:__ @duckdb_v2.h 312:5@
+
+    __exported by:__ @duckdb_v2.h@
+-}
+newtype DuckDBV2ResultHandle = DuckDBV2ResultHandle
+  { unwrap :: BG.Ptr DuckDBV2ResultStruct
+  }
+  deriving stock (Eq, BG.Generic, Ord, Show)
+  deriving newtype
+    ( BG.HasFFIType
+    , Marshal.ReadRaw
+    , Marshal.StaticSize
+    , BG.Storable
+    , Marshal.WriteRaw
+    )
+
+instance ( ty ~ BG.Ptr DuckDBV2ResultStruct
+         ) => BG.CompatHasField.HasField "unwrap" DuckDBV2ResultHandle ty where
+
+  hasField =
+    \x0 ->
+      (\y1 ->
+         DuckDBV2ResultHandle {unwrap = y1}, BG.getField @"unwrap" x0)
+
+instance ( ty ~ BG.Ptr DuckDBV2ResultStruct
+         ) => BG.HasField "unwrap" (BG.Ptr DuckDBV2ResultHandle) (BG.Ptr ty) where
+
+  getField = HasCField.fromPtr (BG.Proxy @"unwrap")
+
+instance HasCField.HasCField DuckDBV2ResultHandle "unwrap" where
+
+  type CFieldType DuckDBV2ResultHandle "unwrap" =
+    BG.Ptr DuckDBV2ResultStruct
+
+  offset# = \_ -> \_ -> 0
+
+{-| An opaque, owned handle to a data chunk: a set of vectors of equal logical length plus a cardinality (row count).
+
+    A data chunk is the main "unit of execution" in DuckDB, and the main unit of data transfer in the API. It may be owned or borrowed, depending on the context.
+
+    __C declaration:__ @struct _duckdb_v2_data_chunk@
+
+    __defined at:__ @duckdb_v2.h 320:16@
+
+    __exported by:__ @duckdb_v2.h@
+-}
+data DuckDBV2DataChunkStruct
+
+instance Marshal.StaticSize DuckDBV2DataChunkStruct where
+
+  staticSizeOf = \_ -> (8 :: Int)
+
+  staticAlignment = \_ -> (8 :: Int)
+
+{-| An opaque, owned handle to a data chunk: a set of vectors of equal logical length plus a cardinality (row count).
+
+    A data chunk is the main "unit of execution" in DuckDB, and the main unit of data transfer in the API. It may be owned or borrowed, depending on the context.
+
+    __C declaration:__ @duckdb_v2_data_chunk_handle@
+
+    __defined at:__ @duckdb_v2.h 322:5@
+
+    __exported by:__ @duckdb_v2.h@
+-}
+newtype DuckDBV2DataChunkHandle = DuckDBV2DataChunkHandle
+  { unwrap :: BG.Ptr DuckDBV2DataChunkStruct
+  }
+  deriving stock (Eq, BG.Generic, Ord, Show)
+  deriving newtype
+    ( BG.HasFFIType
+    , Marshal.ReadRaw
+    , Marshal.StaticSize
+    , BG.Storable
+    , Marshal.WriteRaw
+    )
+
+instance ( ty ~ BG.Ptr DuckDBV2DataChunkStruct
+         ) => BG.CompatHasField.HasField "unwrap" DuckDBV2DataChunkHandle ty where
+
+  hasField =
+    \x0 ->
+      (\y1 ->
+         DuckDBV2DataChunkHandle {unwrap = y1}, BG.getField @"unwrap" x0)
+
+instance ( ty ~ BG.Ptr DuckDBV2DataChunkStruct
+         ) => BG.HasField "unwrap" (BG.Ptr DuckDBV2DataChunkHandle) (BG.Ptr ty) where
+
+  getField = HasCField.fromPtr (BG.Proxy @"unwrap")
+
+instance HasCField.HasCField DuckDBV2DataChunkHandle "unwrap" where
+
+  type CFieldType DuckDBV2DataChunkHandle "unwrap" =
+    BG.Ptr DuckDBV2DataChunkStruct
+
+  offset# = \_ -> \_ -> 0
+
+{-| A borrowed handle to a vector within a data chunk, carrying a part of a column\'s values. Vectors are always borrowed from a data chunk, and are valid only as long as their parent data chunk is alive.
+
+    __C declaration:__ @struct _duckdb_v2_vector@
+
+    __defined at:__ @duckdb_v2.h 328:16@
+
+    __exported by:__ @duckdb_v2.h@
+-}
+data DuckDBV2VectorStruct
+
+instance Marshal.StaticSize DuckDBV2VectorStruct where
+
+  staticSizeOf = \_ -> (8 :: Int)
+
+  staticAlignment = \_ -> (8 :: Int)
+
+{-| A borrowed handle to a vector within a data chunk, carrying a part of a column\'s values. Vectors are always borrowed from a data chunk, and are valid only as long as their parent data chunk is alive.
+
+    __C declaration:__ @duckdb_v2_vector_handle@
+
+    __defined at:__ @duckdb_v2.h 330:5@
+
+    __exported by:__ @duckdb_v2.h@
+-}
+newtype DuckDBV2VectorHandle = DuckDBV2VectorHandle
+  { unwrap :: BG.Ptr DuckDBV2VectorStruct
+  }
+  deriving stock (Eq, BG.Generic, Ord, Show)
+  deriving newtype
+    ( BG.HasFFIType
+    , Marshal.ReadRaw
+    , Marshal.StaticSize
+    , BG.Storable
+    , Marshal.WriteRaw
+    )
+
+instance ( ty ~ BG.Ptr DuckDBV2VectorStruct
+         ) => BG.CompatHasField.HasField "unwrap" DuckDBV2VectorHandle ty where
+
+  hasField =
+    \x0 ->
+      (\y1 ->
+         DuckDBV2VectorHandle {unwrap = y1}, BG.getField @"unwrap" x0)
+
+instance ( ty ~ BG.Ptr DuckDBV2VectorStruct
+         ) => BG.HasField "unwrap" (BG.Ptr DuckDBV2VectorHandle) (BG.Ptr ty) where
+
+  getField = HasCField.fromPtr (BG.Proxy @"unwrap")
+
+instance HasCField.HasCField DuckDBV2VectorHandle "unwrap" where
+
+  type CFieldType DuckDBV2VectorHandle "unwrap" =
+    BG.Ptr DuckDBV2VectorStruct
+
+  offset# = \_ -> \_ -> 0
+
+{-| A borrowed handle to a "arena allocator".
+
+    Bytes handed out by @duckdb_v2_arena_allocate()@ share the same lifetime as the arena itself. @duckdb_v2_vector_get_arena()@ yields the arena backing the out-of-line bytes of non-inlined VARCHAR / BLOB / BIT / BIGNUM values, valid until the owning vector is flattened, reallocated, or destroyed.
+
+    __C declaration:__ @struct _duckdb_v2_arena@
+
+    __defined at:__ @duckdb_v2.h 339:16@
+
+    __exported by:__ @duckdb_v2.h@
+-}
+data DuckDBV2ArenaStruct
+
+instance Marshal.StaticSize DuckDBV2ArenaStruct where
+
+  staticSizeOf = \_ -> (8 :: Int)
+
+  staticAlignment = \_ -> (8 :: Int)
+
+{-| A borrowed handle to a "arena allocator".
+
+    Bytes handed out by @duckdb_v2_arena_allocate()@ share the same lifetime as the arena itself. @duckdb_v2_vector_get_arena()@ yields the arena backing the out-of-line bytes of non-inlined VARCHAR / BLOB / BIT / BIGNUM values, valid until the owning vector is flattened, reallocated, or destroyed.
+
+    __C declaration:__ @duckdb_v2_arena_handle@
+
+    __defined at:__ @duckdb_v2.h 341:5@
+
+    __exported by:__ @duckdb_v2.h@
+-}
+newtype DuckDBV2ArenaHandle = DuckDBV2ArenaHandle
+  { unwrap :: BG.Ptr DuckDBV2ArenaStruct
+  }
+  deriving stock (Eq, BG.Generic, Ord, Show)
+  deriving newtype
+    ( BG.HasFFIType
+    , Marshal.ReadRaw
+    , Marshal.StaticSize
+    , BG.Storable
+    , Marshal.WriteRaw
+    )
+
+instance ( ty ~ BG.Ptr DuckDBV2ArenaStruct
+         ) => BG.CompatHasField.HasField "unwrap" DuckDBV2ArenaHandle ty where
+
+  hasField =
+    \x0 ->
+      (\y1 ->
+         DuckDBV2ArenaHandle {unwrap = y1}, BG.getField @"unwrap" x0)
+
+instance ( ty ~ BG.Ptr DuckDBV2ArenaStruct
+         ) => BG.HasField "unwrap" (BG.Ptr DuckDBV2ArenaHandle) (BG.Ptr ty) where
+
+  getField = HasCField.fromPtr (BG.Proxy @"unwrap")
+
+instance HasCField.HasCField DuckDBV2ArenaHandle "unwrap" where
+
+  type CFieldType DuckDBV2ArenaHandle "unwrap" =
+    BG.Ptr DuckDBV2ArenaStruct
+
+  offset# = \_ -> \_ -> 0
+
+{-| A borrowed handle to a client context: a connection seen from inside DuckDB. Handed out within DuckDB-managed scopes — function bind / init / exec callbacks, replacement scans, and the extension entrypoint — and valid only for the duration of that scope; the caller never destroys it. Within that scope a transaction is already active. A context reaches the same capabilities a connection does, through @duckdb_v2_context_get_factory()@ , @duckdb_v2_context_get_config()@ , @duckdb_v2_context_get_file_system()@ and @duckdb_v2_context_log()@ .
+
+    __C declaration:__ @struct _duckdb_v2_context@
+
+    __defined at:__ @duckdb_v2.h 350:16@
+
+    __exported by:__ @duckdb_v2.h@
+-}
+data DuckDBV2ContextStruct
+
+instance Marshal.StaticSize DuckDBV2ContextStruct where
+
+  staticSizeOf = \_ -> (8 :: Int)
+
+  staticAlignment = \_ -> (8 :: Int)
+
+{-| A borrowed handle to a client context: a connection seen from inside DuckDB. Handed out within DuckDB-managed scopes — function bind / init / exec callbacks, replacement scans, and the extension entrypoint — and valid only for the duration of that scope; the caller never destroys it. Within that scope a transaction is already active. A context reaches the same capabilities a connection does, through @duckdb_v2_context_get_factory()@ , @duckdb_v2_context_get_config()@ , @duckdb_v2_context_get_file_system()@ and @duckdb_v2_context_log()@ .
+
+    __C declaration:__ @duckdb_v2_context_handle@
+
+    __defined at:__ @duckdb_v2.h 352:5@
+
+    __exported by:__ @duckdb_v2.h@
+-}
+newtype DuckDBV2ContextHandle = DuckDBV2ContextHandle
+  { unwrap :: BG.Ptr DuckDBV2ContextStruct
+  }
+  deriving stock (Eq, BG.Generic, Ord, Show)
+  deriving newtype
+    ( BG.HasFFIType
+    , Marshal.ReadRaw
+    , Marshal.StaticSize
+    , BG.Storable
+    , Marshal.WriteRaw
+    )
+
+instance ( ty ~ BG.Ptr DuckDBV2ContextStruct
+         ) => BG.CompatHasField.HasField "unwrap" DuckDBV2ContextHandle ty where
+
+  hasField =
+    \x0 ->
+      (\y1 ->
+         DuckDBV2ContextHandle {unwrap = y1}, BG.getField @"unwrap" x0)
+
+instance ( ty ~ BG.Ptr DuckDBV2ContextStruct
+         ) => BG.HasField "unwrap" (BG.Ptr DuckDBV2ContextHandle) (BG.Ptr ty) where
+
+  getField = HasCField.fromPtr (BG.Proxy @"unwrap")
+
+instance HasCField.HasCField DuckDBV2ContextHandle "unwrap" where
+
+  type CFieldType DuckDBV2ContextHandle "unwrap" =
+    BG.Ptr DuckDBV2ContextStruct
+
+  offset# = \_ -> \_ -> 0
+
+{-| A borrowed handle to the scope values, types, data chunks and column data collections are created in. Taken from an instance ( @duckdb_v2_instance_get_factory()@ ), a connection ( @duckdb_v2_connection_get_factory()@ ) or a context ( @duckdb_v2_context_get_factory()@ ), and valid for as long as its source is; the caller never destroys it. A factory resolves in the scope of its source: a connection\'s or a context\'s factory reaches the catalog and the client\'s settings, while an instance\'s factory knows only the built-in types and casts, with default settings, and refuses anything that needs a catalog.
+
+    __C declaration:__ @struct _duckdb_v2_factory@
+
+    __defined at:__ @duckdb_v2.h 362:16@
+
+    __exported by:__ @duckdb_v2.h@
+-}
+data DuckDBV2FactoryStruct
+
+instance Marshal.StaticSize DuckDBV2FactoryStruct where
+
+  staticSizeOf = \_ -> (8 :: Int)
+
+  staticAlignment = \_ -> (8 :: Int)
+
+{-| A borrowed handle to the scope values, types, data chunks and column data collections are created in. Taken from an instance ( @duckdb_v2_instance_get_factory()@ ), a connection ( @duckdb_v2_connection_get_factory()@ ) or a context ( @duckdb_v2_context_get_factory()@ ), and valid for as long as its source is; the caller never destroys it. A factory resolves in the scope of its source: a connection\'s or a context\'s factory reaches the catalog and the client\'s settings, while an instance\'s factory knows only the built-in types and casts, with default settings, and refuses anything that needs a catalog.
+
+    __C declaration:__ @duckdb_v2_factory_handle@
+
+    __defined at:__ @duckdb_v2.h 364:5@
+
+    __exported by:__ @duckdb_v2.h@
+-}
+newtype DuckDBV2FactoryHandle = DuckDBV2FactoryHandle
+  { unwrap :: BG.Ptr DuckDBV2FactoryStruct
+  }
+  deriving stock (Eq, BG.Generic, Ord, Show)
+  deriving newtype
+    ( BG.HasFFIType
+    , Marshal.ReadRaw
+    , Marshal.StaticSize
+    , BG.Storable
+    , Marshal.WriteRaw
+    )
+
+instance ( ty ~ BG.Ptr DuckDBV2FactoryStruct
+         ) => BG.CompatHasField.HasField "unwrap" DuckDBV2FactoryHandle ty where
+
+  hasField =
+    \x0 ->
+      (\y1 ->
+         DuckDBV2FactoryHandle {unwrap = y1}, BG.getField @"unwrap" x0)
+
+instance ( ty ~ BG.Ptr DuckDBV2FactoryStruct
+         ) => BG.HasField "unwrap" (BG.Ptr DuckDBV2FactoryHandle) (BG.Ptr ty) where
+
+  getField = HasCField.fromPtr (BG.Proxy @"unwrap")
+
+instance HasCField.HasCField DuckDBV2FactoryHandle "unwrap" where
+
+  type CFieldType DuckDBV2FactoryHandle "unwrap" =
+    BG.Ptr DuckDBV2FactoryStruct
+
+  offset# = \_ -> \_ -> 0
+
+{-| An entry in a selection-vector.
+
+    A selection-vector is a "dictionary" represented as an array of indices (sel_t\'s) mapping "logical" row indices to the "physical" offsets in a vectors primary data buffer. Used by "dictionary vectors" to represent a filtered or "sparse" view of the vector\'s data.
+
+    __C declaration:__ @duckdb_v2_sel_t@
+
+    __defined at:__ @duckdb_v2.h 373:18@
+
+    __exported by:__ @duckdb_v2.h@
+-}
+newtype DuckDBV2SelT = DuckDBV2SelT
+  { unwrap :: HsBindgen.Runtime.LibC.Word32
+  }
+  deriving stock (Eq, BG.Generic, Ord, Read, Show)
+  deriving newtype
+    ( BG.Bitfield
+    , BG.Bits
+    , Bounded
+    , Enum
+    , BG.FiniteBits
+    , BG.HasFFIType
+    , Integral
+    , BG.Ix
+    , Num
+    , BG.Prim
+    , Marshal.ReadRaw
+    , Real
+    , Marshal.StaticSize
+    , BG.Storable
+    , Marshal.WriteRaw
+    )
+
+instance ( ty ~ HsBindgen.Runtime.LibC.Word32
+         ) => BG.CompatHasField.HasField "unwrap" DuckDBV2SelT ty where
+
+  hasField =
+    \x0 ->
+      (\y1 ->
+         DuckDBV2SelT {unwrap = y1}, BG.getField @"unwrap" x0)
+
+instance ( ty ~ HsBindgen.Runtime.LibC.Word32
+         ) => BG.HasField "unwrap" (BG.Ptr DuckDBV2SelT) (BG.Ptr ty) where
+
+  getField = HasCField.fromPtr (BG.Proxy @"unwrap")
+
+instance HasCField.HasCField DuckDBV2SelT "unwrap" where
+
+  type CFieldType DuckDBV2SelT "unwrap" =
+    HsBindgen.Runtime.LibC.Word32
+
+  offset# = \_ -> \_ -> 0
+
+{-| Inline cutoff for @bytes@ storage: a value of at most this many bytes is stored inline.
+
+    __C declaration:__ @macro DUCKDB_V2_BYTES_INLINE_LENGTH@
+
+    __defined at:__ @duckdb_v2.h 400:9@
+
+    __exported by:__ @duckdb_v2.h@
+-}
+dUCKDB_V2_BYTES_INLINE_LENGTH :: BG.CInt
+dUCKDB_V2_BYTES_INLINE_LENGTH = (12 :: BG.CInt)
+
+{-| Auxiliary type used by t'DuckDBV2TextSinkFn'
+
+    __C declaration:__ @duckdb_v2_text_sink_fn@
+
+    __defined at:__ @duckdb_v2.h 418:16@
+
+    __exported by:__ @duckdb_v2.h@
+-}
+newtype DuckDBV2TextSinkFn_Aux = DuckDBV2TextSinkFn_Aux
+  { unwrap :: PtrConst.PtrConst DuckDBV2Str -> BG.Ptr BG.Void -> BG.Ptr DuckDBV2ErrorInfoHandle -> IO ()
+  }
+  deriving stock (BG.Generic)
+
+-- __unique:__ @toDuckDBV2TextSinkFn_Aux@
+foreign import ccall safe "wrapper" hs_bindgen_07daac22d0d50f86_base ::
+     (BG.Ptr BG.Void -> BG.Ptr BG.Void -> BG.Ptr BG.Void -> IO ())
+  -> IO (BG.FunPtr (BG.Ptr BG.Void -> BG.Ptr BG.Void -> BG.Ptr BG.Void -> IO ()))
+
+-- __unique:__ @toDuckDBV2TextSinkFn_Aux@
+hs_bindgen_07daac22d0d50f86 ::
+     DuckDBV2TextSinkFn_Aux
+  -> IO (BG.FunPtr DuckDBV2TextSinkFn_Aux)
+hs_bindgen_07daac22d0d50f86 =
+  \fun0 ->
+    fmap BG.castFunPtr (hs_bindgen_07daac22d0d50f86_base (\x1 ->
+                                                            \x2 ->
+                                                              \x3 ->
+                                                                BG.getField @"unwrap" fun0 (BG.fromFFIType x1) (BG.fromFFIType x2) (BG.fromFFIType x3)))
+
+-- __unique:__ @fromDuckDBV2TextSinkFn_Aux@
+foreign import ccall safe "dynamic" hs_bindgen_c6b0090bb0507343_base ::
+     BG.FunPtr (BG.Ptr BG.Void -> BG.Ptr BG.Void -> BG.Ptr BG.Void -> IO ())
+  -> BG.Ptr BG.Void -> BG.Ptr BG.Void -> BG.Ptr BG.Void -> IO ()
+
+-- __unique:__ @fromDuckDBV2TextSinkFn_Aux@
+hs_bindgen_c6b0090bb0507343 ::
+     BG.FunPtr DuckDBV2TextSinkFn_Aux
+  -> DuckDBV2TextSinkFn_Aux
+hs_bindgen_c6b0090bb0507343 =
+  \funPtr0 ->
+    DuckDBV2TextSinkFn_Aux (\x1 ->
+                              \x2 ->
+                                \x3 ->
+                                  hs_bindgen_c6b0090bb0507343_base (BG.castFunPtr funPtr0) (BG.toFFIType x1) (BG.toFFIType x2) (BG.toFFIType x3))
+
+instance BG.ToFunPtr DuckDBV2TextSinkFn_Aux where
+
+  toFunPtr = hs_bindgen_07daac22d0d50f86
+
+instance BG.FromFunPtr DuckDBV2TextSinkFn_Aux where
+
+  fromFunPtr = hs_bindgen_c6b0090bb0507343
+
+instance ( ty ~ (PtrConst.PtrConst DuckDBV2Str -> BG.Ptr BG.Void -> BG.Ptr DuckDBV2ErrorInfoHandle -> IO ())
+         ) => BG.CompatHasField.HasField "unwrap" DuckDBV2TextSinkFn_Aux ty where
+
+  hasField =
+    \x0 ->
+      (\y1 ->
+         DuckDBV2TextSinkFn_Aux {unwrap = y1}, BG.getField @"unwrap" x0)
+
+instance ( ty ~ (PtrConst.PtrConst DuckDBV2Str -> BG.Ptr BG.Void -> BG.Ptr DuckDBV2ErrorInfoHandle -> IO ())
+         ) => BG.HasField "unwrap" (BG.Ptr DuckDBV2TextSinkFn_Aux) (BG.Ptr ty) where
+
+  getField = HasCField.fromPtr (BG.Proxy @"unwrap")
+
+instance HasCField.HasCField DuckDBV2TextSinkFn_Aux "unwrap" where
+
+  type CFieldType DuckDBV2TextSinkFn_Aux "unwrap" =
+    PtrConst.PtrConst DuckDBV2Str -> BG.Ptr BG.Void -> BG.Ptr DuckDBV2ErrorInfoHandle -> IO ()
+
+  offset# = \_ -> \_ -> 0
+
+{-| Receives text produced by DuckDB
+
+    Invoked exactly once per producing call, with the complete text in a single view.
+
+    The view is borrowed for the duration of the call only. Copy what you need before returning, and do not retain @text@ or @text->ptr@ . The bytes are NOT guaranteed to be null-terminated.
+
+    @err@ is a live error slot, never NULL. Populate it with @duckdb_v2_error_info_set_code()@ / @duckdb_v2_error_info_set_text()@ to signal failure to DuckDB. Do not destroy it yourself.
+
+    The sink runs inside DuckDB\'s call frame: it must not throw or unwind across the boundary, and it must not re-enter the API on the handle being operated on.
+
+    __C declaration:__ @duckdb_v2_text_sink_fn@
+
+    __defined at:__ @duckdb_v2.h 418:16@
+
+    __exported by:__ @duckdb_v2.h@
+-}
+newtype DuckDBV2TextSinkFn = DuckDBV2TextSinkFn
+  { unwrap :: BG.FunPtr DuckDBV2TextSinkFn_Aux
+  }
+  deriving stock (Eq, BG.Generic, Ord, Show)
+  deriving newtype
+    ( BG.HasFFIType
+    , Marshal.ReadRaw
+    , Marshal.StaticSize
+    , BG.Storable
+    , Marshal.WriteRaw
+    )
+
+instance ( ty ~ BG.FunPtr DuckDBV2TextSinkFn_Aux
+         ) => BG.CompatHasField.HasField "unwrap" DuckDBV2TextSinkFn ty where
+
+  hasField =
+    \x0 ->
+      (\y1 ->
+         DuckDBV2TextSinkFn {unwrap = y1}, BG.getField @"unwrap" x0)
+
+instance ( ty ~ BG.FunPtr DuckDBV2TextSinkFn_Aux
+         ) => BG.HasField "unwrap" (BG.Ptr DuckDBV2TextSinkFn) (BG.Ptr ty) where
+
+  getField = HasCField.fromPtr (BG.Proxy @"unwrap")
+
+instance HasCField.HasCField DuckDBV2TextSinkFn "unwrap" where
+
+  type CFieldType DuckDBV2TextSinkFn "unwrap" =
+    BG.FunPtr DuckDBV2TextSinkFn_Aux
+
+  offset# = \_ -> \_ -> 0
+
+{-| Auxiliary type used by t'DuckDBV2OpaqueEqualsFn'
+
+    __C declaration:__ @duckdb_v2_opaque_equals_fn@
+
+    __defined at:__ @duckdb_v2.h 429:16@
+
+    __exported by:__ @duckdb_v2.h@
+-}
+newtype DuckDBV2OpaqueEqualsFn_Aux = DuckDBV2OpaqueEqualsFn_Aux
+  { unwrap :: BG.Ptr BG.Void -> BG.Ptr BG.Void -> IO BG.CBool
+  }
+  deriving stock (BG.Generic)
+
+-- __unique:__ @toDuckDBV2OpaqueEqualsFn_Aux@
+foreign import ccall safe "wrapper" hs_bindgen_9504cff9a511c8ed_base ::
+     (BG.Ptr BG.Void -> BG.Ptr BG.Void -> IO BG.CBool)
+  -> IO (BG.FunPtr (BG.Ptr BG.Void -> BG.Ptr BG.Void -> IO BG.CBool))
+
+-- __unique:__ @toDuckDBV2OpaqueEqualsFn_Aux@
+hs_bindgen_9504cff9a511c8ed ::
+     DuckDBV2OpaqueEqualsFn_Aux
+  -> IO (BG.FunPtr DuckDBV2OpaqueEqualsFn_Aux)
+hs_bindgen_9504cff9a511c8ed =
+  \fun0 ->
+    fmap BG.castFunPtr (hs_bindgen_9504cff9a511c8ed_base (\x1 ->
+                                                            \x2 ->
+                                                              fmap BG.toFFIType (BG.getField @"unwrap" fun0 (BG.fromFFIType x1) (BG.fromFFIType x2))))
+
+-- __unique:__ @fromDuckDBV2OpaqueEqualsFn_Aux@
+foreign import ccall safe "dynamic" hs_bindgen_30353559b954568e_base ::
+     BG.FunPtr (BG.Ptr BG.Void -> BG.Ptr BG.Void -> IO BG.CBool)
+  -> BG.Ptr BG.Void -> BG.Ptr BG.Void -> IO BG.CBool
+
+-- __unique:__ @fromDuckDBV2OpaqueEqualsFn_Aux@
+hs_bindgen_30353559b954568e ::
+     BG.FunPtr DuckDBV2OpaqueEqualsFn_Aux
+  -> DuckDBV2OpaqueEqualsFn_Aux
+hs_bindgen_30353559b954568e =
+  \funPtr0 ->
+    DuckDBV2OpaqueEqualsFn_Aux (\x1 ->
+                                  \x2 ->
+                                    fmap BG.fromFFIType (hs_bindgen_30353559b954568e_base (BG.castFunPtr funPtr0) (BG.toFFIType x1) (BG.toFFIType x2)))
+
+instance BG.ToFunPtr DuckDBV2OpaqueEqualsFn_Aux where
+
+  toFunPtr = hs_bindgen_9504cff9a511c8ed
+
+instance BG.FromFunPtr DuckDBV2OpaqueEqualsFn_Aux where
+
+  fromFunPtr = hs_bindgen_30353559b954568e
+
+instance ( ty ~ (BG.Ptr BG.Void -> BG.Ptr BG.Void -> IO BG.CBool)
+         ) => BG.CompatHasField.HasField "unwrap" DuckDBV2OpaqueEqualsFn_Aux ty where
+
+  hasField =
+    \x0 ->
+      (\y1 ->
+         DuckDBV2OpaqueEqualsFn_Aux {unwrap = y1}, BG.getField @"unwrap" x0)
+
+instance ( ty ~ (BG.Ptr BG.Void -> BG.Ptr BG.Void -> IO BG.CBool)
+         ) => BG.HasField "unwrap" (BG.Ptr DuckDBV2OpaqueEqualsFn_Aux) (BG.Ptr ty) where
+
+  getField = HasCField.fromPtr (BG.Proxy @"unwrap")
+
+instance HasCField.HasCField DuckDBV2OpaqueEqualsFn_Aux "unwrap" where
+
+  type CFieldType DuckDBV2OpaqueEqualsFn_Aux "unwrap" =
+    BG.Ptr BG.Void -> BG.Ptr BG.Void -> IO BG.CBool
+
+  offset# = \_ -> \_ -> 0
+
+{-| Compares two caller-defined resources for equality.
+
+    Invoked when DuckDB needs to compare two opaque handles. The callback is responsible for interpreting the pointers and comparing the underlying resources. Return true if they are equal, false otherwise.
+
+    The callback runs inside DuckDB\'s call frame: it must not throw or unwind across the boundary, and it must not re-enter the API on the handle being operated on.
+
+    __C declaration:__ @duckdb_v2_opaque_equals_fn@
+
+    __defined at:__ @duckdb_v2.h 429:16@
+
+    __exported by:__ @duckdb_v2.h@
+-}
+newtype DuckDBV2OpaqueEqualsFn = DuckDBV2OpaqueEqualsFn
+  { unwrap :: BG.FunPtr DuckDBV2OpaqueEqualsFn_Aux
+  }
+  deriving stock (Eq, BG.Generic, Ord, Show)
+  deriving newtype
+    ( BG.HasFFIType
+    , Marshal.ReadRaw
+    , Marshal.StaticSize
+    , BG.Storable
+    , Marshal.WriteRaw
+    )
+
+instance ( ty ~ BG.FunPtr DuckDBV2OpaqueEqualsFn_Aux
+         ) => BG.CompatHasField.HasField "unwrap" DuckDBV2OpaqueEqualsFn ty where
+
+  hasField =
+    \x0 ->
+      (\y1 ->
+         DuckDBV2OpaqueEqualsFn {unwrap = y1}, BG.getField @"unwrap" x0)
+
+instance ( ty ~ BG.FunPtr DuckDBV2OpaqueEqualsFn_Aux
+         ) => BG.HasField "unwrap" (BG.Ptr DuckDBV2OpaqueEqualsFn) (BG.Ptr ty) where
+
+  getField = HasCField.fromPtr (BG.Proxy @"unwrap")
+
+instance HasCField.HasCField DuckDBV2OpaqueEqualsFn "unwrap" where
+
+  type CFieldType DuckDBV2OpaqueEqualsFn "unwrap" =
+    BG.FunPtr DuckDBV2OpaqueEqualsFn_Aux
+
+  offset# = \_ -> \_ -> 0
+
+{-| Auxiliary type used by t'DuckDBV2OpaqueDestroyFn'
+
+    __C declaration:__ @duckdb_v2_opaque_destroy_fn@
+
+    __defined at:__ @duckdb_v2.h 440:16@
+
+    __exported by:__ @duckdb_v2.h@
+-}
+newtype DuckDBV2OpaqueDestroyFn_Aux = DuckDBV2OpaqueDestroyFn_Aux
+  { unwrap :: BG.Ptr BG.Void -> IO ()
+  }
+  deriving stock (BG.Generic)
+
+-- __unique:__ @toDuckDBV2OpaqueDestroyFn_Aux@
+foreign import ccall safe "wrapper" hs_bindgen_a2c5f89c823eeb44_base ::
+     (BG.Ptr BG.Void -> IO ())
+  -> IO (BG.FunPtr (BG.Ptr BG.Void -> IO ()))
+
+-- __unique:__ @toDuckDBV2OpaqueDestroyFn_Aux@
+hs_bindgen_a2c5f89c823eeb44 ::
+     DuckDBV2OpaqueDestroyFn_Aux
+  -> IO (BG.FunPtr DuckDBV2OpaqueDestroyFn_Aux)
+hs_bindgen_a2c5f89c823eeb44 =
+  \fun0 ->
+    fmap BG.castFunPtr (hs_bindgen_a2c5f89c823eeb44_base (\x1 ->
+                                                            BG.getField @"unwrap" fun0 (BG.fromFFIType x1)))
+
+-- __unique:__ @fromDuckDBV2OpaqueDestroyFn_Aux@
+foreign import ccall safe "dynamic" hs_bindgen_d9510205c26ab760_base ::
+     BG.FunPtr (BG.Ptr BG.Void -> IO ())
+  -> BG.Ptr BG.Void -> IO ()
+
+-- __unique:__ @fromDuckDBV2OpaqueDestroyFn_Aux@
+hs_bindgen_d9510205c26ab760 ::
+     BG.FunPtr DuckDBV2OpaqueDestroyFn_Aux
+  -> DuckDBV2OpaqueDestroyFn_Aux
+hs_bindgen_d9510205c26ab760 =
+  \funPtr0 ->
+    DuckDBV2OpaqueDestroyFn_Aux (\x1 ->
+                                   hs_bindgen_d9510205c26ab760_base (BG.castFunPtr funPtr0) (BG.toFFIType x1))
+
+instance BG.ToFunPtr DuckDBV2OpaqueDestroyFn_Aux where
+
+  toFunPtr = hs_bindgen_a2c5f89c823eeb44
+
+instance BG.FromFunPtr DuckDBV2OpaqueDestroyFn_Aux where
+
+  fromFunPtr = hs_bindgen_d9510205c26ab760
+
+instance ( ty ~ (BG.Ptr BG.Void -> IO ())
+         ) => BG.CompatHasField.HasField "unwrap" DuckDBV2OpaqueDestroyFn_Aux ty where
+
+  hasField =
+    \x0 ->
+      (\y1 ->
+         DuckDBV2OpaqueDestroyFn_Aux {unwrap = y1}, BG.getField @"unwrap" x0)
+
+instance ( ty ~ (BG.Ptr BG.Void -> IO ())
+         ) => BG.HasField "unwrap" (BG.Ptr DuckDBV2OpaqueDestroyFn_Aux) (BG.Ptr ty) where
+
+  getField = HasCField.fromPtr (BG.Proxy @"unwrap")
+
+instance HasCField.HasCField DuckDBV2OpaqueDestroyFn_Aux "unwrap" where
+
+  type CFieldType DuckDBV2OpaqueDestroyFn_Aux "unwrap" =
+    BG.Ptr BG.Void -> IO ()
+
+  offset# = \_ -> \_ -> 0
+
+{-| Destroys a caller-defined resource.
+
+    Invoked when DuckDB needs to destroy an opaque handle. The callback is responsible for interpreting the pointer and freeing the underlying resource.
+
+    The callback runs inside DuckDB\'s call frame: it must not throw or unwind across the boundary, and it must not re-enter the API on the handle being operated on.
+
+    __C declaration:__ @duckdb_v2_opaque_destroy_fn@
+
+    __defined at:__ @duckdb_v2.h 440:16@
+
+    __exported by:__ @duckdb_v2.h@
+-}
+newtype DuckDBV2OpaqueDestroyFn = DuckDBV2OpaqueDestroyFn
+  { unwrap :: BG.FunPtr DuckDBV2OpaqueDestroyFn_Aux
+  }
+  deriving stock (Eq, BG.Generic, Ord, Show)
+  deriving newtype
+    ( BG.HasFFIType
+    , Marshal.ReadRaw
+    , Marshal.StaticSize
+    , BG.Storable
+    , Marshal.WriteRaw
+    )
+
+instance ( ty ~ BG.FunPtr DuckDBV2OpaqueDestroyFn_Aux
+         ) => BG.CompatHasField.HasField "unwrap" DuckDBV2OpaqueDestroyFn ty where
+
+  hasField =
+    \x0 ->
+      (\y1 ->
+         DuckDBV2OpaqueDestroyFn {unwrap = y1}, BG.getField @"unwrap" x0)
+
+instance ( ty ~ BG.FunPtr DuckDBV2OpaqueDestroyFn_Aux
+         ) => BG.HasField "unwrap" (BG.Ptr DuckDBV2OpaqueDestroyFn) (BG.Ptr ty) where
+
+  getField = HasCField.fromPtr (BG.Proxy @"unwrap")
+
+instance HasCField.HasCField DuckDBV2OpaqueDestroyFn "unwrap" where
+
+  type CFieldType DuckDBV2OpaqueDestroyFn "unwrap" =
+    BG.FunPtr DuckDBV2OpaqueDestroyFn_Aux
+
+  offset# = \_ -> \_ -> 0
+
+{-| A borrowed, length-delimited string view: @@ptr@@ points at @@len@@ bytes of character data. The bytes are NOT guaranteed to be null-terminated and may contain interior null bytes, so always honor @@len@@ rather than scanning for a terminator. The view never owns its bytes; the function that produced it documents how long they live (typically "valid until the owning handle is destroyed"). @{NULL, 0}@ is the canonical empty view, and @@ptr@@ must not be dereferenced when @@len@@ is 0. Not to be confused with @bytes@ , the transparent 16-byte /storage/ format for a variable-size value in a vector.
+
+    Functions take an input view as a @const str *@ , which must not be NULL; a NULL pointer, or a view whose @@ptr@@ is NULL while @@len@@ is nonzero, fails with ERROR_INPUT_INVALID. Point at a @{NULL, 0}@ view to pass an empty string.
+
+    Text inputs, such as VARCHAR values and names, must contain valid UTF-8. The caller is responsible for ensuring this; API functions do not necessarily validate the input. Binary inputs, such as BLOB values, do not require valid UTF-8.
+
+    __C declaration:__ @struct duckdb_v2_str@
+
+    __defined at:__ @duckdb_v2.h 460:8@
+
+    __exported by:__ @duckdb_v2.h@
+-}
+data DuckDBV2Str = DuckDBV2Str
+  { ptr :: PtrConst.PtrConst BG.CChar
+    {- ^ __C declaration:__ @ptr@
+
+         __defined at:__ @duckdb_v2.h 461:14@
+
+         __exported by:__ @duckdb_v2.h@
+    -}
+  , len :: DuckDBIdx
+    {- ^ __C declaration:__ @len@
+
+         __defined at:__ @duckdb_v2.h 462:8@
+
+         __exported by:__ @duckdb_v2.h@
+    -}
+  }
+  deriving stock (Eq, BG.Generic, Show)
+
+instance Marshal.StaticSize DuckDBV2Str where
+
+  staticSizeOf = \_ -> (16 :: Int)
+
+  staticAlignment = \_ -> (8 :: Int)
+
+instance Marshal.ReadRaw DuckDBV2Str where
+
+  readRaw =
+    \ptr0 ->
+          pure DuckDBV2Str
+      <*> HasCField.readRaw (BG.Proxy @"ptr") ptr0
+      <*> HasCField.readRaw (BG.Proxy @"len") ptr0
+
+instance Marshal.WriteRaw DuckDBV2Str where
+
+  writeRaw =
+    \ptr0 ->
+      \s1 ->
+        case s1 of
+          DuckDBV2Str ptr2 len3 ->
+               HasCField.writeRaw (BG.Proxy @"ptr") ptr0 ptr2
+            >> HasCField.writeRaw (BG.Proxy @"len") ptr0 len3
+
+deriving via Marshal.EquivStorable DuckDBV2Str instance BG.Storable DuckDBV2Str
+
+deriving via Struct.IsStructViaReadRaw DuckDBV2Str instance Struct.IsStruct DuckDBV2Str
+
+{-| __C declaration:__ @ptr@
+
+    __defined at:__ @duckdb_v2.h 461:14@
+
+    __exported by:__ @duckdb_v2.h@
+-}
+instance ( ty ~ PtrConst.PtrConst BG.CChar
+         ) => BG.CompatHasField.HasField "ptr" DuckDBV2Str ty where
+
+  hasField =
+    \x0 ->
+      ( \y1 ->
+          DuckDBV2Str {ptr = y1, len = BG.getField @"len" x0}
+      , BG.getField @"ptr" x0
+      )
+
+instance ( ty ~ PtrConst.PtrConst BG.CChar
+         ) => BG.HasField "ptr" (BG.Ptr DuckDBV2Str) (BG.Ptr ty) where
+
+  getField = HasCField.fromPtr (BG.Proxy @"ptr")
+
+instance HasCField.HasCField DuckDBV2Str "ptr" where
+
+  type CFieldType DuckDBV2Str "ptr" =
+    PtrConst.PtrConst BG.CChar
+
+  offset# = \_ -> \_ -> 0
+
+{-| __C declaration:__ @len@
+
+    __defined at:__ @duckdb_v2.h 462:8@
+
+    __exported by:__ @duckdb_v2.h@
+-}
+instance ( ty ~ DuckDBIdx
+         ) => BG.CompatHasField.HasField "len" DuckDBV2Str ty where
+
+  hasField =
+    \x0 ->
+      ( \y1 ->
+          DuckDBV2Str {len = y1, ptr = BG.getField @"ptr" x0}
+      , BG.getField @"len" x0
+      )
+
+instance ( ty ~ DuckDBIdx
+         ) => BG.HasField "len" (BG.Ptr DuckDBV2Str) (BG.Ptr ty) where
+
+  getField = HasCField.fromPtr (BG.Proxy @"len")
+
+instance HasCField.HasCField DuckDBV2Str "len" where
+
+  type CFieldType DuckDBV2Str "len" = DuckDBIdx
+
+  offset# = \_ -> \_ -> 8
+
+{-| A borrowed name view with the same layout as str, marking a string DuckDB treats as a SQL identifier: one matched case-insensitively. Compare two identifiers case-insensitively rather than byte for byte, and render one into SQL through the identifier-quoting entry point rather than embedding it raw. The catalog preserves casing; some registries (config settings) canonicalize to lowercase.
+
+    An identifier passed into the API must be valid UTF-8; otherwise the call fails with @ERROR_INPUT_INVALID@ .
+
+    __C declaration:__ @duckdb_v2_identifier_t@
+
+    __defined at:__ @duckdb_v2.h 395:23@
+
+    __exported by:__ @duckdb_v2.h@
+-}
+newtype DuckDBV2IdentifierT = DuckDBV2IdentifierT
+  { unwrap :: DuckDBV2Str
+  }
+  deriving stock (Eq, BG.Generic, Show)
+  deriving newtype
+    ( Marshal.ReadRaw
+    , Marshal.StaticSize
+    , BG.Storable
+    , Marshal.WriteRaw
+    )
+
+instance ( ty ~ DuckDBV2Str
+         ) => BG.CompatHasField.HasField "unwrap" DuckDBV2IdentifierT ty where
+
+  hasField =
+    \x0 ->
+      (\y1 ->
+         DuckDBV2IdentifierT {unwrap = y1}, BG.getField @"unwrap" x0)
+
+instance ( ty ~ DuckDBV2Str
+         ) => BG.HasField "unwrap" (BG.Ptr DuckDBV2IdentifierT) (BG.Ptr ty) where
+
+  getField = HasCField.fromPtr (BG.Proxy @"unwrap")
+
+instance HasCField.HasCField DuckDBV2IdentifierT "unwrap" where
+
+  type CFieldType DuckDBV2IdentifierT "unwrap" =
+    DuckDBV2Str
+
+  offset# = \_ -> \_ -> 0
+
+{-| __C declaration:__ @struct \@duckdb_v2_bytes_value_pointer@
+
+    __defined at:__ @duckdb_v2.h 475:3@
+
+    __exported by:__ @duckdb_v2.h@
+-}
+data Duckdb_v2_bytes_value_pointer = Duckdb_v2_bytes_value_pointer
+  { length :: HsBindgen.Runtime.LibC.Word32
+    {- ^ __C declaration:__ @length@
+
+         __defined at:__ @duckdb_v2.h 476:13@
+
+         __exported by:__ @duckdb_v2.h@
+    -}
+  , prefix :: CA.ConstantArray 4 BG.CChar
+    {- ^ __C declaration:__ @prefix@
+
+         __defined at:__ @duckdb_v2.h 477:9@
+
+         __exported by:__ @duckdb_v2.h@
+    -}
+  , ptr :: BG.Ptr BG.CChar
+    {- ^ __C declaration:__ @ptr@
+
+         __defined at:__ @duckdb_v2.h 478:10@
+
+         __exported by:__ @duckdb_v2.h@
+    -}
+  }
+  deriving stock (Eq, BG.Generic, Show)
+
+instance Marshal.StaticSize Duckdb_v2_bytes_value_pointer where
+
+  staticSizeOf = \_ -> (16 :: Int)
+
+  staticAlignment = \_ -> (8 :: Int)
+
+instance Marshal.ReadRaw Duckdb_v2_bytes_value_pointer where
+
+  readRaw =
+    \ptr0 ->
+          pure Duckdb_v2_bytes_value_pointer
+      <*> HasCField.readRaw (BG.Proxy @"length") ptr0
+      <*> HasCField.readRaw (BG.Proxy @"prefix") ptr0
+      <*> HasCField.readRaw (BG.Proxy @"ptr") ptr0
+
+instance Marshal.WriteRaw Duckdb_v2_bytes_value_pointer where
+
+  writeRaw =
+    \ptr0 ->
+      \s1 ->
+        case s1 of
+          Duckdb_v2_bytes_value_pointer length2 prefix3 ptr4 ->
+               HasCField.writeRaw (BG.Proxy @"length") ptr0 length2
+            >> HasCField.writeRaw (BG.Proxy @"prefix") ptr0 prefix3
+            >> HasCField.writeRaw (BG.Proxy @"ptr") ptr0 ptr4
+
+deriving via Marshal.EquivStorable Duckdb_v2_bytes_value_pointer instance BG.Storable Duckdb_v2_bytes_value_pointer
+
+deriving via Struct.IsStructViaReadRaw Duckdb_v2_bytes_value_pointer instance Struct.IsStruct Duckdb_v2_bytes_value_pointer
+
+{-| __C declaration:__ @length@
+
+    __defined at:__ @duckdb_v2.h 476:13@
+
+    __exported by:__ @duckdb_v2.h@
+-}
+instance ( ty ~ HsBindgen.Runtime.LibC.Word32
+         ) => BG.CompatHasField.HasField "length" Duckdb_v2_bytes_value_pointer ty where
+
+  hasField =
+    \x0 ->
+      ( \y1 ->
+          Duckdb_v2_bytes_value_pointer {length = y1, prefix = BG.getField @"prefix" x0, ptr = BG.getField @"ptr" x0}
+      , BG.getField @"length" x0
+      )
+
+instance ( ty ~ HsBindgen.Runtime.LibC.Word32
+         ) => BG.HasField "length" (BG.Ptr Duckdb_v2_bytes_value_pointer) (BG.Ptr ty) where
+
+  getField = HasCField.fromPtr (BG.Proxy @"length")
+
+instance HasCField.HasCField Duckdb_v2_bytes_value_pointer "length" where
+
+  type CFieldType Duckdb_v2_bytes_value_pointer "length" =
+    HsBindgen.Runtime.LibC.Word32
+
+  offset# = \_ -> \_ -> 0
+
+{-| __C declaration:__ @prefix@
+
+    __defined at:__ @duckdb_v2.h 477:9@
+
+    __exported by:__ @duckdb_v2.h@
+-}
+instance ( ty ~ CA.ConstantArray 4 BG.CChar
+         ) => BG.CompatHasField.HasField "prefix" Duckdb_v2_bytes_value_pointer ty where
+
+  hasField =
+    \x0 ->
+      ( \y1 ->
+          Duckdb_v2_bytes_value_pointer {prefix = y1, length = BG.getField @"length" x0, ptr = BG.getField @"ptr" x0}
+      , BG.getField @"prefix" x0
+      )
+
+instance ( ty ~ CA.ConstantArray 4 BG.CChar
+         ) => BG.HasField "prefix" (BG.Ptr Duckdb_v2_bytes_value_pointer) (BG.Ptr ty) where
+
+  getField = HasCField.fromPtr (BG.Proxy @"prefix")
+
+instance HasCField.HasCField Duckdb_v2_bytes_value_pointer "prefix" where
+
+  type CFieldType Duckdb_v2_bytes_value_pointer "prefix" =
+    CA.ConstantArray 4 BG.CChar
+
+  offset# = \_ -> \_ -> 4
+
+{-| __C declaration:__ @ptr@
+
+    __defined at:__ @duckdb_v2.h 478:10@
+
+    __exported by:__ @duckdb_v2.h@
+-}
+instance ( ty ~ BG.Ptr BG.CChar
+         ) => BG.CompatHasField.HasField "ptr" Duckdb_v2_bytes_value_pointer ty where
+
+  hasField =
+    \x0 ->
+      ( \y1 ->
+          Duckdb_v2_bytes_value_pointer {ptr = y1, length = BG.getField @"length" x0, prefix = BG.getField @"prefix" x0}
+      , BG.getField @"ptr" x0
+      )
+
+instance ( ty ~ BG.Ptr BG.CChar
+         ) => BG.HasField "ptr" (BG.Ptr Duckdb_v2_bytes_value_pointer) (BG.Ptr ty) where
+
+  getField = HasCField.fromPtr (BG.Proxy @"ptr")
+
+instance HasCField.HasCField Duckdb_v2_bytes_value_pointer "ptr" where
+
+  type CFieldType Duckdb_v2_bytes_value_pointer "ptr" =
+    BG.Ptr BG.CChar
+
+  offset# = \_ -> \_ -> 8
+
+{-| __C declaration:__ @struct \@duckdb_v2_bytes_value_inlined@
+
+    __defined at:__ @duckdb_v2.h 480:3@
+
+    __exported by:__ @duckdb_v2.h@
+-}
+data Duckdb_v2_bytes_value_inlined = Duckdb_v2_bytes_value_inlined
+  { length :: HsBindgen.Runtime.LibC.Word32
+    {- ^ __C declaration:__ @length@
+
+         __defined at:__ @duckdb_v2.h 481:13@
+
+         __exported by:__ @duckdb_v2.h@
+    -}
+  , inlined :: CA.ConstantArray 12 BG.CChar
+    {- ^ __C declaration:__ @inlined@
+
+         __defined at:__ @duckdb_v2.h 482:9@
+
+         __exported by:__ @duckdb_v2.h@
+    -}
+  }
+  deriving stock (Eq, BG.Generic, Show)
+
+instance Marshal.StaticSize Duckdb_v2_bytes_value_inlined where
+
+  staticSizeOf = \_ -> (16 :: Int)
+
+  staticAlignment = \_ -> (4 :: Int)
+
+instance Marshal.ReadRaw Duckdb_v2_bytes_value_inlined where
+
+  readRaw =
+    \ptr0 ->
+          pure Duckdb_v2_bytes_value_inlined
+      <*> HasCField.readRaw (BG.Proxy @"length") ptr0
+      <*> HasCField.readRaw (BG.Proxy @"inlined") ptr0
+
+instance Marshal.WriteRaw Duckdb_v2_bytes_value_inlined where
+
+  writeRaw =
+    \ptr0 ->
+      \s1 ->
+        case s1 of
+          Duckdb_v2_bytes_value_inlined length2 inlined3 ->
+               HasCField.writeRaw (BG.Proxy @"length") ptr0 length2
+            >> HasCField.writeRaw (BG.Proxy @"inlined") ptr0 inlined3
+
+deriving via Marshal.EquivStorable Duckdb_v2_bytes_value_inlined instance BG.Storable Duckdb_v2_bytes_value_inlined
+
+deriving via Struct.IsStructViaReadRaw Duckdb_v2_bytes_value_inlined instance Struct.IsStruct Duckdb_v2_bytes_value_inlined
+
+{-| __C declaration:__ @length@
+
+    __defined at:__ @duckdb_v2.h 481:13@
+
+    __exported by:__ @duckdb_v2.h@
+-}
+instance ( ty ~ HsBindgen.Runtime.LibC.Word32
+         ) => BG.CompatHasField.HasField "length" Duckdb_v2_bytes_value_inlined ty where
+
+  hasField =
+    \x0 ->
+      ( \y1 ->
+          Duckdb_v2_bytes_value_inlined {length = y1, inlined = BG.getField @"inlined" x0}
+      , BG.getField @"length" x0
+      )
+
+instance ( ty ~ HsBindgen.Runtime.LibC.Word32
+         ) => BG.HasField "length" (BG.Ptr Duckdb_v2_bytes_value_inlined) (BG.Ptr ty) where
+
+  getField = HasCField.fromPtr (BG.Proxy @"length")
+
+instance HasCField.HasCField Duckdb_v2_bytes_value_inlined "length" where
+
+  type CFieldType Duckdb_v2_bytes_value_inlined "length" =
+    HsBindgen.Runtime.LibC.Word32
+
+  offset# = \_ -> \_ -> 0
+
+{-| __C declaration:__ @inlined@
+
+    __defined at:__ @duckdb_v2.h 482:9@
+
+    __exported by:__ @duckdb_v2.h@
+-}
+instance ( ty ~ CA.ConstantArray 12 BG.CChar
+         ) => BG.CompatHasField.HasField "inlined" Duckdb_v2_bytes_value_inlined ty where
+
+  hasField =
+    \x0 ->
+      ( \y1 ->
+          Duckdb_v2_bytes_value_inlined {inlined = y1, length = BG.getField @"length" x0}
+      , BG.getField @"inlined" x0
+      )
+
+instance ( ty ~ CA.ConstantArray 12 BG.CChar
+         ) => BG.HasField "inlined" (BG.Ptr Duckdb_v2_bytes_value_inlined) (BG.Ptr ty) where
+
+  getField = HasCField.fromPtr (BG.Proxy @"inlined")
+
+instance HasCField.HasCField Duckdb_v2_bytes_value_inlined "inlined" where
+
+  type CFieldType Duckdb_v2_bytes_value_inlined "inlined" =
+    CA.ConstantArray 12 BG.CChar
+
+  offset# = \_ -> \_ -> 4
+
+{-| __C declaration:__ @union \@duckdb_v2_bytes_value@
+
+    __defined at:__ @duckdb_v2.h 474:2@
+
+    __exported by:__ @duckdb_v2.h@
+-}
+newtype Duckdb_v2_bytes_value = Duckdb_v2_bytes_value
+  { unwrap :: BG.ByteArray
+  }
+  deriving stock (BG.Generic)
+
+deriving via BG.SizedByteArray 16 8 instance Marshal.StaticSize Duckdb_v2_bytes_value
+
+deriving via BG.SizedByteArray 16 8 instance Marshal.ReadRaw Duckdb_v2_bytes_value
+
+deriving via BG.SizedByteArray 16 8 instance Marshal.WriteRaw Duckdb_v2_bytes_value
+
+deriving via Marshal.EquivStorable Duckdb_v2_bytes_value instance BG.Storable Duckdb_v2_bytes_value
+
+deriving via BG.SizedByteArray 16 8 instance Union.IsUnion Duckdb_v2_bytes_value
+
+{-| __C declaration:__ @pointer@
+
+    __defined at:__ @duckdb_v2.h 479:5@
+
+    __exported by:__ @duckdb_v2.h@
+-}
+instance ( ty ~ Duckdb_v2_bytes_value_pointer
+         ) => BG.HasField "pointer" Duckdb_v2_bytes_value ty where
+
+  getField = BG.getUnionPayload
+
+{-| __C declaration:__ @pointer@
+
+    __defined at:__ @duckdb_v2.h 479:5@
+
+    __exported by:__ @duckdb_v2.h@
+-}
+instance ( ty ~ Duckdb_v2_bytes_value_pointer
+         ) => BG.CompatHasField.HasField "pointer" Duckdb_v2_bytes_value ty where
+
+  hasField =
+    \x0 ->
+      (\y1 ->
+         BG.setUnionPayload y1 x0, BG.getField @"pointer" x0)
+
+instance ( ty ~ Duckdb_v2_bytes_value_pointer
+         ) => BG.HasField "pointer" (BG.Ptr Duckdb_v2_bytes_value) (BG.Ptr ty) where
+
+  getField = HasCField.fromPtr (BG.Proxy @"pointer")
+
+instance HasCField.HasCField Duckdb_v2_bytes_value "pointer" where
+
+  type CFieldType Duckdb_v2_bytes_value "pointer" =
+    Duckdb_v2_bytes_value_pointer
+
+  offset# = \_ -> \_ -> 0
+
+{-| __C declaration:__ @inlined@
+
+    __defined at:__ @duckdb_v2.h 483:5@
+
+    __exported by:__ @duckdb_v2.h@
+-}
+instance ( ty ~ Duckdb_v2_bytes_value_inlined
+         ) => BG.HasField "inlined" Duckdb_v2_bytes_value ty where
+
+  getField = BG.getUnionPayload
+
+{-| __C declaration:__ @inlined@
+
+    __defined at:__ @duckdb_v2.h 483:5@
+
+    __exported by:__ @duckdb_v2.h@
+-}
+instance ( ty ~ Duckdb_v2_bytes_value_inlined
+         ) => BG.CompatHasField.HasField "inlined" Duckdb_v2_bytes_value ty where
+
+  hasField =
+    \x0 ->
+      (\y1 ->
+         BG.setUnionPayload y1 x0, BG.getField @"inlined" x0)
+
+instance ( ty ~ Duckdb_v2_bytes_value_inlined
+         ) => BG.HasField "inlined" (BG.Ptr Duckdb_v2_bytes_value) (BG.Ptr ty) where
+
+  getField = HasCField.fromPtr (BG.Proxy @"inlined")
+
+instance HasCField.HasCField Duckdb_v2_bytes_value "inlined" where
+
+  type CFieldType Duckdb_v2_bytes_value "inlined" =
+    Duckdb_v2_bytes_value_inlined
+
+  offset# = \_ -> \_ -> 0
+
+{-| 16-byte storage for a variable-size, byte-backed value: VARCHAR, BLOB, BIT, or BIGNUM. The bytes are inlined when the length is at most BYTES_INLINE_LENGTH, in value.inlined.inlined; otherwise value.pointer.ptr holds them and value.pointer.prefix repeats the first
+
+    1. The union is transparent, so read the fields directly. VARCHAR and BLOB carry no further encoding; BIT and BIGNUM do. For BIT, byte 0 is the padding-bit count and bytes 1.. are the data; BIGNUM is decoded via @duckdb_v2_bignum_decode()@ .
+
+    __C declaration:__ @struct duckdb_v2_bytes@
+
+    __defined at:__ @duckdb_v2.h 473:8@
+
+    __exported by:__ @duckdb_v2.h@
+-}
+data DuckDBV2Bytes = DuckDBV2Bytes
+  { value :: Duckdb_v2_bytes_value
+    {- ^ __C declaration:__ @value@
+
+         __defined at:__ @duckdb_v2.h 484:4@
+
+         __exported by:__ @duckdb_v2.h@
+    -}
+  }
+  deriving stock (BG.Generic)
+
+instance Marshal.StaticSize DuckDBV2Bytes where
+
+  staticSizeOf = \_ -> (16 :: Int)
+
+  staticAlignment = \_ -> (8 :: Int)
+
+instance Marshal.ReadRaw DuckDBV2Bytes where
+
+  readRaw =
+    \ptr0 ->
+          pure DuckDBV2Bytes
+      <*> HasCField.readRaw (BG.Proxy @"value") ptr0
+
+instance Marshal.WriteRaw DuckDBV2Bytes where
+
+  writeRaw =
+    \ptr0 ->
+      \s1 ->
+        case s1 of
+          DuckDBV2Bytes value2 ->
+            HasCField.writeRaw (BG.Proxy @"value") ptr0 value2
+
+deriving via Marshal.EquivStorable DuckDBV2Bytes instance BG.Storable DuckDBV2Bytes
+
+deriving via Struct.IsStructViaReadRaw DuckDBV2Bytes instance Struct.IsStruct DuckDBV2Bytes
+
+{-| __C declaration:__ @value@
+
+    __defined at:__ @duckdb_v2.h 484:4@
+
+    __exported by:__ @duckdb_v2.h@
+-}
+instance ( ty ~ Duckdb_v2_bytes_value
+         ) => BG.CompatHasField.HasField "value" DuckDBV2Bytes ty where
+
+  hasField =
+    \x0 ->
+      (\y1 ->
+         DuckDBV2Bytes {value = y1}, BG.getField @"value" x0)
+
+instance ( ty ~ Duckdb_v2_bytes_value
+         ) => BG.HasField "value" (BG.Ptr DuckDBV2Bytes) (BG.Ptr ty) where
+
+  getField = HasCField.fromPtr (BG.Proxy @"value")
+
+instance HasCField.HasCField DuckDBV2Bytes "value" where
+
+  type CFieldType DuckDBV2Bytes "value" =
+    Duckdb_v2_bytes_value
+
+  offset# = \_ -> \_ -> 0
+
+{-| VARCHAR storage. The bytes must contain valid UTF-8. Read the transparent bytes fields directly.
+
+    __C declaration:__ @duckdb_v2_varchar_t@
+
+    __defined at:__ @duckdb_v2.h 376:25@
+
+    __exported by:__ @duckdb_v2.h@
+-}
+newtype DuckDBV2VarcharT = DuckDBV2VarcharT
+  { unwrap :: DuckDBV2Bytes
+  }
+  deriving stock (BG.Generic)
+  deriving newtype
+    ( Marshal.ReadRaw
+    , Marshal.StaticSize
+    , BG.Storable
+    , Marshal.WriteRaw
+    )
+
+instance ( ty ~ DuckDBV2Bytes
+         ) => BG.CompatHasField.HasField "unwrap" DuckDBV2VarcharT ty where
+
+  hasField =
+    \x0 ->
+      (\y1 ->
+         DuckDBV2VarcharT {unwrap = y1}, BG.getField @"unwrap" x0)
+
+instance ( ty ~ DuckDBV2Bytes
+         ) => BG.HasField "unwrap" (BG.Ptr DuckDBV2VarcharT) (BG.Ptr ty) where
+
+  getField = HasCField.fromPtr (BG.Proxy @"unwrap")
+
+instance HasCField.HasCField DuckDBV2VarcharT "unwrap" where
+
+  type CFieldType DuckDBV2VarcharT "unwrap" =
+    DuckDBV2Bytes
+
+  offset# = \_ -> \_ -> 0
+
+{-| BLOB storage. Read the transparent bytes fields directly.
+
+    __C declaration:__ @duckdb_v2_blob_t@
+
+    __defined at:__ @duckdb_v2.h 379:25@
+
+    __exported by:__ @duckdb_v2.h@
+-}
+newtype DuckDBV2BlobT = DuckDBV2BlobT
+  { unwrap :: DuckDBV2Bytes
+  }
+  deriving stock (BG.Generic)
+  deriving newtype
+    ( Marshal.ReadRaw
+    , Marshal.StaticSize
+    , BG.Storable
+    , Marshal.WriteRaw
+    )
+
+instance ( ty ~ DuckDBV2Bytes
+         ) => BG.CompatHasField.HasField "unwrap" DuckDBV2BlobT ty where
+
+  hasField =
+    \x0 ->
+      (\y1 ->
+         DuckDBV2BlobT {unwrap = y1}, BG.getField @"unwrap" x0)
+
+instance ( ty ~ DuckDBV2Bytes
+         ) => BG.HasField "unwrap" (BG.Ptr DuckDBV2BlobT) (BG.Ptr ty) where
+
+  getField = HasCField.fromPtr (BG.Proxy @"unwrap")
+
+instance HasCField.HasCField DuckDBV2BlobT "unwrap" where
+
+  type CFieldType DuckDBV2BlobT "unwrap" =
+    DuckDBV2Bytes
+
+  offset# = \_ -> \_ -> 0
+
+{-| BIT storage. Byte 0 is the padding-bit count, bytes 1.. the data.
+
+    __C declaration:__ @duckdb_v2_bit_t@
+
+    __defined at:__ @duckdb_v2.h 382:25@
+
+    __exported by:__ @duckdb_v2.h@
+-}
+newtype DuckDBV2BitT = DuckDBV2BitT
+  { unwrap :: DuckDBV2Bytes
+  }
+  deriving stock (BG.Generic)
+  deriving newtype
+    ( Marshal.ReadRaw
+    , Marshal.StaticSize
+    , BG.Storable
+    , Marshal.WriteRaw
+    )
+
+instance ( ty ~ DuckDBV2Bytes
+         ) => BG.CompatHasField.HasField "unwrap" DuckDBV2BitT ty where
+
+  hasField =
+    \x0 ->
+      (\y1 ->
+         DuckDBV2BitT {unwrap = y1}, BG.getField @"unwrap" x0)
+
+instance ( ty ~ DuckDBV2Bytes
+         ) => BG.HasField "unwrap" (BG.Ptr DuckDBV2BitT) (BG.Ptr ty) where
+
+  getField = HasCField.fromPtr (BG.Proxy @"unwrap")
+
+instance HasCField.HasCField DuckDBV2BitT "unwrap" where
+
+  type CFieldType DuckDBV2BitT "unwrap" = DuckDBV2Bytes
+
+  offset# = \_ -> \_ -> 0
+
+{-| BIGNUM storage. Decode via @duckdb_v2_bignum_decode()@ .
+
+    __C declaration:__ @duckdb_v2_bignum_t@
+
+    __defined at:__ @duckdb_v2.h 385:25@
+
+    __exported by:__ @duckdb_v2.h@
+-}
+newtype DuckDBV2BignumT = DuckDBV2BignumT
+  { unwrap :: DuckDBV2Bytes
+  }
+  deriving stock (BG.Generic)
+  deriving newtype
+    ( Marshal.ReadRaw
+    , Marshal.StaticSize
+    , BG.Storable
+    , Marshal.WriteRaw
+    )
+
+instance ( ty ~ DuckDBV2Bytes
+         ) => BG.CompatHasField.HasField "unwrap" DuckDBV2BignumT ty where
+
+  hasField =
+    \x0 ->
+      (\y1 ->
+         DuckDBV2BignumT {unwrap = y1}, BG.getField @"unwrap" x0)
+
+instance ( ty ~ DuckDBV2Bytes
+         ) => BG.HasField "unwrap" (BG.Ptr DuckDBV2BignumT) (BG.Ptr ty) where
+
+  getField = HasCField.fromPtr (BG.Proxy @"unwrap")
+
+instance HasCField.HasCField DuckDBV2BignumT "unwrap" where
+
+  type CFieldType DuckDBV2BignumT "unwrap" =
+    DuckDBV2Bytes
+
+  offset# = \_ -> \_ -> 0
+
+{-| An opaque, owned handle to a caller-defined resource. Bundles the pointer with optional callbacks that destroy and compare the resource.
+
+    __C declaration:__ @struct duckdb_v2_opaque@
+
+    __defined at:__ @duckdb_v2.h 491:8@
+
+    __exported by:__ @duckdb_v2.h@
+-}
+data DuckDBV2Opaque = DuckDBV2Opaque
+  { ptr :: BG.Ptr BG.Void
+    {- ^ __C declaration:__ @ptr@
+
+         __defined at:__ @duckdb_v2.h 492:8@
+
+         __exported by:__ @duckdb_v2.h@
+    -}
+  , destroy :: DuckDBV2OpaqueDestroyFn
+    {- ^ __C declaration:__ @destroy@
+
+         __defined at:__ @duckdb_v2.h 493:30@
+
+         __exported by:__ @duckdb_v2.h@
+    -}
+  , equals :: DuckDBV2OpaqueEqualsFn
+    {- ^ __C declaration:__ @equals@
+
+         __defined at:__ @duckdb_v2.h 494:29@
+
+         __exported by:__ @duckdb_v2.h@
+    -}
+  }
+  deriving stock (Eq, BG.Generic, Show)
+
+instance Marshal.StaticSize DuckDBV2Opaque where
+
+  staticSizeOf = \_ -> (24 :: Int)
+
+  staticAlignment = \_ -> (8 :: Int)
+
+instance Marshal.ReadRaw DuckDBV2Opaque where
+
+  readRaw =
+    \ptr0 ->
+          pure DuckDBV2Opaque
+      <*> HasCField.readRaw (BG.Proxy @"ptr") ptr0
+      <*> HasCField.readRaw (BG.Proxy @"destroy") ptr0
+      <*> HasCField.readRaw (BG.Proxy @"equals") ptr0
+
+instance Marshal.WriteRaw DuckDBV2Opaque where
+
+  writeRaw =
+    \ptr0 ->
+      \s1 ->
+        case s1 of
+          DuckDBV2Opaque ptr2 destroy3 equals4 ->
+               HasCField.writeRaw (BG.Proxy @"ptr") ptr0 ptr2
+            >> HasCField.writeRaw (BG.Proxy @"destroy") ptr0 destroy3
+            >> HasCField.writeRaw (BG.Proxy @"equals") ptr0 equals4
+
+deriving via Marshal.EquivStorable DuckDBV2Opaque instance BG.Storable DuckDBV2Opaque
+
+deriving via Struct.IsStructViaReadRaw DuckDBV2Opaque instance Struct.IsStruct DuckDBV2Opaque
+
+{-| __C declaration:__ @ptr@
+
+    __defined at:__ @duckdb_v2.h 492:8@
+
+    __exported by:__ @duckdb_v2.h@
+-}
+instance ( ty ~ BG.Ptr BG.Void
+         ) => BG.CompatHasField.HasField "ptr" DuckDBV2Opaque ty where
+
+  hasField =
+    \x0 ->
+      ( \y1 ->
+          DuckDBV2Opaque { ptr = y1
+                         , destroy = BG.getField @"destroy" x0
+                         , equals = BG.getField @"equals" x0
+                         }
+      , BG.getField @"ptr" x0
+      )
+
+instance ( ty ~ BG.Ptr BG.Void
+         ) => BG.HasField "ptr" (BG.Ptr DuckDBV2Opaque) (BG.Ptr ty) where
+
+  getField = HasCField.fromPtr (BG.Proxy @"ptr")
+
+instance HasCField.HasCField DuckDBV2Opaque "ptr" where
+
+  type CFieldType DuckDBV2Opaque "ptr" = BG.Ptr BG.Void
+
+  offset# = \_ -> \_ -> 0
+
+{-| __C declaration:__ @destroy@
+
+    __defined at:__ @duckdb_v2.h 493:30@
+
+    __exported by:__ @duckdb_v2.h@
+-}
+instance ( ty ~ DuckDBV2OpaqueDestroyFn
+         ) => BG.CompatHasField.HasField "destroy" DuckDBV2Opaque ty where
+
+  hasField =
+    \x0 ->
+      ( \y1 ->
+          DuckDBV2Opaque {destroy = y1, ptr = BG.getField @"ptr" x0, equals = BG.getField @"equals" x0}
+      , BG.getField @"destroy" x0
+      )
+
+instance ( ty ~ DuckDBV2OpaqueDestroyFn
+         ) => BG.HasField "destroy" (BG.Ptr DuckDBV2Opaque) (BG.Ptr ty) where
+
+  getField = HasCField.fromPtr (BG.Proxy @"destroy")
+
+instance HasCField.HasCField DuckDBV2Opaque "destroy" where
+
+  type CFieldType DuckDBV2Opaque "destroy" =
+    DuckDBV2OpaqueDestroyFn
+
+  offset# = \_ -> \_ -> 8
+
+{-| __C declaration:__ @equals@
+
+    __defined at:__ @duckdb_v2.h 494:29@
+
+    __exported by:__ @duckdb_v2.h@
+-}
+instance ( ty ~ DuckDBV2OpaqueEqualsFn
+         ) => BG.CompatHasField.HasField "equals" DuckDBV2Opaque ty where
+
+  hasField =
+    \x0 ->
+      ( \y1 ->
+          DuckDBV2Opaque {equals = y1, ptr = BG.getField @"ptr" x0, destroy = BG.getField @"destroy" x0}
+      , BG.getField @"equals" x0
+      )
+
+instance ( ty ~ DuckDBV2OpaqueEqualsFn
+         ) => BG.HasField "equals" (BG.Ptr DuckDBV2Opaque) (BG.Ptr ty) where
+
+  getField = HasCField.fromPtr (BG.Proxy @"equals")
+
+instance HasCField.HasCField DuckDBV2Opaque "equals" where
+
+  type CFieldType DuckDBV2Opaque "equals" =
+    DuckDBV2OpaqueEqualsFn
+
+  offset# = \_ -> \_ -> 16
+
+{-| Error codes for API calls.
+
+    __C declaration:__ @enum DUCKDB_V2_ERROR@
+
+    __defined at:__ @duckdb_v2.h 504:14@
+
+    __exported by:__ @duckdb_v2.h@
+-}
+newtype DuckDBV2Error = DuckDBV2Error
+  { unwrap :: BG.CUInt
+  }
+  deriving stock (Eq, BG.Generic, Ord)
+  deriving newtype (BG.HasFFIType)
+
+instance Marshal.StaticSize DuckDBV2Error where
+
+  staticSizeOf = \_ -> (4 :: Int)
+
+  staticAlignment = \_ -> (4 :: Int)
+
+instance Marshal.ReadRaw DuckDBV2Error where
+
+  readRaw =
+    \ptr0 ->
+          pure DuckDBV2Error
+      <*> Marshal.readRawByteOff ptr0 (0 :: Int)
+
+instance Marshal.WriteRaw DuckDBV2Error where
+
+  writeRaw =
+    \ptr0 ->
+      \s1 ->
+        case s1 of
+          DuckDBV2Error unwrap2 ->
+            Marshal.writeRawByteOff ptr0 (0 :: Int) unwrap2
+
+deriving via Marshal.EquivStorable DuckDBV2Error instance BG.Storable DuckDBV2Error
+
+deriving via BG.CUInt instance BG.Prim DuckDBV2Error
+
+instance CEnum.CEnum DuckDBV2Error where
+
+  type CEnumZ DuckDBV2Error = BG.CUInt
+
+  toCEnum = DuckDBV2Error
+
+  fromCEnum = BG.getField @"unwrap"
+
+  declaredValues =
+    \_ ->
+      CEnum.declaredValuesFromList [ (0, BG.singleton "DuckDBV2ErrorNone")
+                                   , (1, BG.singleton "DuckDBV2ErrorApi")
+                                   , (1001, BG.singleton "DuckDBV2ErrorIOFileNotFound")
+                                   , (1002, BG.singleton "DuckDBV2ErrorIOReadFailure")
+                                   , (1003, BG.singleton "DuckDBV2ErrorIOEof")
+                                   , (1004, BG.singleton "DuckDBV2ErrorIOGeneral")
+                                   , (1005, BG.singleton "DuckDBV2ErrorIONetwork")
+                                   , (1006, BG.singleton "DuckDBV2ErrorIOHTTP")
+                                   , (2001, BG.singleton "DuckDBV2ErrorInputInvalid")
+                                   , (2002, BG.singleton "DuckDBV2ErrorInputParameterInvalid")
+                                   , (2003, BG.singleton "DuckDBV2ErrorInputOutOfRange")
+                                   , (2004, BG.singleton "DuckDBV2ErrorInputObjectSize")
+                                   , (2005, BG.singleton "DuckDBV2ErrorInputMetadataDeferred")
+                                   , (3001, BG.singleton "DuckDBV2ErrorResourceInUse")
+                                   , (3002, BG.singleton "DuckDBV2ErrorResourceOutOfMemory")
+                                   , (3003, BG.singleton "DuckDBV2ErrorResourceConnection")
+                                   , (3004, BG.singleton "DuckDBV2ErrorResourceDependency")
+                                   , (3005, BG.singleton "DuckDBV2ErrorResourceMissingExtension")
+                                   , (3006, BG.singleton "DuckDBV2ErrorResourceAutoload")
+                                   , (4001, BG.singleton "DuckDBV2ErrorTypeConversion")
+                                   , (4002, BG.singleton "DuckDBV2ErrorTypeUnknown")
+                                   , (4003, BG.singleton "DuckDBV2ErrorTypeInvalid")
+                                   , (4004, BG.singleton "DuckDBV2ErrorTypeMismatch")
+                                   , (4005, BG.singleton "DuckDBV2ErrorTypeDecimal")
+                                   , (4006, BG.singleton "DuckDBV2ErrorTypeDivideByZero")
+                                   , (5001, BG.singleton "DuckDBV2ErrorQueryParser")
+                                   , (5002, BG.singleton "DuckDBV2ErrorQuerySyntax")
+                                   , (5003, BG.singleton "DuckDBV2ErrorQueryBinder")
+                                   , (5004, BG.singleton "DuckDBV2ErrorQueryPlanner")
+                                   , (5005, BG.singleton "DuckDBV2ErrorQueryOptimizer")
+                                   , (5006, BG.singleton "DuckDBV2ErrorQueryExpression")
+                                   , (5007, BG.singleton "DuckDBV2ErrorQueryExecutor")
+                                   , (5008, BG.singleton "DuckDBV2ErrorQueryScheduler")
+                                   , (5009, BG.singleton "DuckDBV2ErrorQueryNotImplemented")
+                                   , (5010, BG.singleton "DuckDBV2ErrorQueryParameterNotResolved")
+                                   , (5011, BG.singleton "DuckDBV2ErrorQueryParameterNotAllowed")
+                                   , (6001, BG.singleton "DuckDBV2ErrorDatabaseCatalog")
+                                   , (6002, BG.singleton "DuckDBV2ErrorDatabaseTransaction")
+                                   , (6003, BG.singleton "DuckDBV2ErrorDatabaseConstraint")
+                                   , (6004, BG.singleton "DuckDBV2ErrorDatabaseIndex")
+                                   , (6005, BG.singleton "DuckDBV2ErrorDatabaseSequence")
+                                   , (6006, BG.singleton "DuckDBV2ErrorDatabaseStatistics")
+                                   , (6007, BG.singleton "DuckDBV2ErrorDatabaseSerialization")
+                                   , (7001, BG.singleton "DuckDBV2ErrorConfigurationSettings")
+                                   , (7002, BG.singleton "DuckDBV2ErrorConfigurationInvalid")
+                                   , (7003, BG.singleton "DuckDBV2ErrorConfigurationPermission")
+                                   , (8001, BG.singleton "DuckDBV2ErrorRuntimeInternal")
+                                   , (8002, BG.singleton "DuckDBV2ErrorRuntimeFatal")
+                                   , (8003, BG.singleton "DuckDBV2ErrorRuntimeInterrupt")
+                                   , (8004, BG.singleton "DuckDBV2ErrorRuntimeNullPointer")
+                                   , (2147483647, BG.singleton "DuckDBV2ErrorMaxEnum")
+                                   ]
+
+  showsUndeclared =
+    CEnum.showsWrappedUndeclared "DuckDBV2Error"
+
+  readPrecUndeclared =
+    CEnum.readPrecWrappedUndeclared "DuckDBV2Error"
+
+instance Show DuckDBV2Error where
+
+  showsPrec = CEnum.shows
+
+instance Read DuckDBV2Error where
+
+  readPrec = CEnum.readPrec
+
+  readList = BG.readListDefault
+
+  readListPrec = BG.readListPrecDefault
+
+instance ( ty ~ BG.CUInt
+         ) => BG.CompatHasField.HasField "unwrap" DuckDBV2Error ty where
+
+  hasField =
+    \x0 ->
+      (\y1 ->
+         DuckDBV2Error {unwrap = y1}, BG.getField @"unwrap" x0)
+
+instance ( ty ~ BG.CUInt
+         ) => BG.HasField "unwrap" (BG.Ptr DuckDBV2Error) (BG.Ptr ty) where
+
+  getField = HasCField.fromPtr (BG.Proxy @"unwrap")
+
+instance HasCField.HasCField DuckDBV2Error "unwrap" where
+
+  type CFieldType DuckDBV2Error "unwrap" = BG.CUInt
+
+  offset# = \_ -> \_ -> 0
+
+{-| Success.
+
+    __C declaration:__ @DUCKDB_V2_ERROR_NONE@
+
+    __defined at:__ @duckdb_v2.h 506:2@
+
+    __exported by:__ @duckdb_v2.h@
+-}
+pattern DuckDBV2ErrorNone :: DuckDBV2Error
+pattern DuckDBV2ErrorNone = DuckDBV2Error 0
+
+{-| Generic API error.
+
+    __C declaration:__ @DUCKDB_V2_ERROR_API@
+
+    __defined at:__ @duckdb_v2.h 509:2@
+
+    __exported by:__ @duckdb_v2.h@
+-}
+pattern DuckDBV2ErrorApi :: DuckDBV2Error
+pattern DuckDBV2ErrorApi = DuckDBV2Error 1
+
+{-| The specified file could not be found.
+
+    __C declaration:__ @DUCKDB_V2_ERROR_IO_FILE_NOT_FOUND@
+
+    __defined at:__ @duckdb_v2.h 512:2@
+
+    __exported by:__ @duckdb_v2.h@
+-}
+pattern DuckDBV2ErrorIOFileNotFound :: DuckDBV2Error
+pattern DuckDBV2ErrorIOFileNotFound = DuckDBV2Error 1001
+
+{-| Failed to read from the storage device.
+
+    __C declaration:__ @DUCKDB_V2_ERROR_IO_READ_FAILURE@
+
+    __defined at:__ @duckdb_v2.h 515:2@
+
+    __exported by:__ @duckdb_v2.h@
+-}
+pattern DuckDBV2ErrorIOReadFailure :: DuckDBV2Error
+pattern DuckDBV2ErrorIOReadFailure = DuckDBV2Error 1002
+
+{-| Unexpected end of file reached.
+
+    __C declaration:__ @DUCKDB_V2_ERROR_IO_EOF@
+
+    __defined at:__ @duckdb_v2.h 518:2@
+
+    __exported by:__ @duckdb_v2.h@
+-}
+pattern DuckDBV2ErrorIOEof :: DuckDBV2Error
+pattern DuckDBV2ErrorIOEof = DuckDBV2Error 1003
+
+{-| A generic I/O error occurred while reading or writing data.
+
+    __C declaration:__ @DUCKDB_V2_ERROR_IO_GENERAL@
+
+    __defined at:__ @duckdb_v2.h 521:2@
+
+    __exported by:__ @duckdb_v2.h@
+-}
+pattern DuckDBV2ErrorIOGeneral :: DuckDBV2Error
+pattern DuckDBV2ErrorIOGeneral = DuckDBV2Error 1004
+
+{-| A network-level failure occurred during an I/O operation.
+
+    __C declaration:__ @DUCKDB_V2_ERROR_IO_NETWORK@
+
+    __defined at:__ @duckdb_v2.h 524:2@
+
+    __exported by:__ @duckdb_v2.h@
+-}
+pattern DuckDBV2ErrorIONetwork :: DuckDBV2Error
+pattern DuckDBV2ErrorIONetwork = DuckDBV2Error 1005
+
+{-| An HTTP request issued by the database failed.
+
+    __C declaration:__ @DUCKDB_V2_ERROR_IO_HTTP@
+
+    __defined at:__ @duckdb_v2.h 527:2@
+
+    __exported by:__ @duckdb_v2.h@
+-}
+pattern DuckDBV2ErrorIOHTTP :: DuckDBV2Error
+pattern DuckDBV2ErrorIOHTTP = DuckDBV2Error 1006
+
+{-| General invalid input error.
+
+    __C declaration:__ @DUCKDB_V2_ERROR_INPUT_INVALID@
+
+    __defined at:__ @duckdb_v2.h 530:2@
+
+    __exported by:__ @duckdb_v2.h@
+-}
+pattern DuckDBV2ErrorInputInvalid :: DuckDBV2Error
+pattern DuckDBV2ErrorInputInvalid = DuckDBV2Error 2001
+
+{-| A specific function parameter is malformed.
+
+    __C declaration:__ @DUCKDB_V2_ERROR_INPUT_PARAMETER_INVALID@
+
+    __defined at:__ @duckdb_v2.h 533:2@
+
+    __exported by:__ @duckdb_v2.h@
+-}
+pattern DuckDBV2ErrorInputParameterInvalid :: DuckDBV2Error
+pattern DuckDBV2ErrorInputParameterInvalid = DuckDBV2Error 2002
+
+{-| A provided value is outside the acceptable range.
+
+    __C declaration:__ @DUCKDB_V2_ERROR_INPUT_OUT_OF_RANGE@
+
+    __defined at:__ @duckdb_v2.h 536:2@
+
+    __exported by:__ @duckdb_v2.h@
+-}
+pattern DuckDBV2ErrorInputOutOfRange :: DuckDBV2Error
+pattern DuckDBV2ErrorInputOutOfRange = DuckDBV2Error 2003
+
+{-| An object exceeded its maximum permitted size.
+
+    __C declaration:__ @DUCKDB_V2_ERROR_INPUT_OBJECT_SIZE@
+
+    __defined at:__ @duckdb_v2.h 539:2@
+
+    __exported by:__ @duckdb_v2.h@
+-}
+pattern DuckDBV2ErrorInputObjectSize :: DuckDBV2Error
+pattern DuckDBV2ErrorInputObjectSize = DuckDBV2Error 2004
+
+{-| The metadata asked for is known only once execution binds the statement that produces it, because the statement expands into several. Step the result and ask again.
+
+    __C declaration:__ @DUCKDB_V2_ERROR_INPUT_METADATA_DEFERRED@
+
+    __defined at:__ @duckdb_v2.h 545:2@
+
+    __exported by:__ @duckdb_v2.h@
+-}
+pattern DuckDBV2ErrorInputMetadataDeferred :: DuckDBV2Error
+pattern DuckDBV2ErrorInputMetadataDeferred = DuckDBV2Error 2005
+
+{-| The requested resource is already in use.
+
+    __C declaration:__ @DUCKDB_V2_ERROR_RESOURCE_IN_USE@
+
+    __defined at:__ @duckdb_v2.h 548:2@
+
+    __exported by:__ @duckdb_v2.h@
+-}
+pattern DuckDBV2ErrorResourceInUse :: DuckDBV2Error
+pattern DuckDBV2ErrorResourceInUse = DuckDBV2Error 3001
+
+{-| An allocation failed because the system ran out of memory.
+
+    __C declaration:__ @DUCKDB_V2_ERROR_RESOURCE_OUT_OF_MEMORY@
+
+    __defined at:__ @duckdb_v2.h 551:2@
+
+    __exported by:__ @duckdb_v2.h@
+-}
+pattern DuckDBV2ErrorResourceOutOfMemory :: DuckDBV2Error
+pattern DuckDBV2ErrorResourceOutOfMemory = DuckDBV2Error 3002
+
+{-| A connection-level failure occurred (e.g. the connection has been closed or invalidated).
+
+    __C declaration:__ @DUCKDB_V2_ERROR_RESOURCE_CONNECTION@
+
+    __defined at:__ @duckdb_v2.h 554:2@
+
+    __exported by:__ @duckdb_v2.h@
+-}
+pattern DuckDBV2ErrorResourceConnection :: DuckDBV2Error
+pattern DuckDBV2ErrorResourceConnection = DuckDBV2Error 3003
+
+{-| An operation failed because of an unresolved dependency between catalog objects.
+
+    __C declaration:__ @DUCKDB_V2_ERROR_RESOURCE_DEPENDENCY@
+
+    __defined at:__ @duckdb_v2.h 557:2@
+
+    __exported by:__ @duckdb_v2.h@
+-}
+pattern DuckDBV2ErrorResourceDependency :: DuckDBV2Error
+pattern DuckDBV2ErrorResourceDependency = DuckDBV2Error 3004
+
+{-| An extension required by the operation is not loaded.
+
+    __C declaration:__ @DUCKDB_V2_ERROR_RESOURCE_MISSING_EXTENSION@
+
+    __defined at:__ @duckdb_v2.h 560:2@
+
+    __exported by:__ @duckdb_v2.h@
+-}
+pattern DuckDBV2ErrorResourceMissingExtension :: DuckDBV2Error
+pattern DuckDBV2ErrorResourceMissingExtension = DuckDBV2Error 3005
+
+{-| Autoloading an extension failed.
+
+    __C declaration:__ @DUCKDB_V2_ERROR_RESOURCE_AUTOLOAD@
+
+    __defined at:__ @duckdb_v2.h 563:2@
+
+    __exported by:__ @duckdb_v2.h@
+-}
+pattern DuckDBV2ErrorResourceAutoload :: DuckDBV2Error
+pattern DuckDBV2ErrorResourceAutoload = DuckDBV2Error 3006
+
+{-| A value could not be converted to the requested type.
+
+    __C declaration:__ @DUCKDB_V2_ERROR_TYPE_CONVERSION@
+
+    __defined at:__ @duckdb_v2.h 566:2@
+
+    __exported by:__ @duckdb_v2.h@
+-}
+pattern DuckDBV2ErrorTypeConversion :: DuckDBV2Error
+pattern DuckDBV2ErrorTypeConversion = DuckDBV2Error 4001
+
+{-| An unknown or unsupported type was encountered.
+
+    __C declaration:__ @DUCKDB_V2_ERROR_TYPE_UNKNOWN@
+
+    __defined at:__ @duckdb_v2.h 569:2@
+
+    __exported by:__ @duckdb_v2.h@
+-}
+pattern DuckDBV2ErrorTypeUnknown :: DuckDBV2Error
+pattern DuckDBV2ErrorTypeUnknown = DuckDBV2Error 4002
+
+{-| A type was used in a context where it is not valid.
+
+    __C declaration:__ @DUCKDB_V2_ERROR_TYPE_INVALID@
+
+    __defined at:__ @duckdb_v2.h 572:2@
+
+    __exported by:__ @duckdb_v2.h@
+-}
+pattern DuckDBV2ErrorTypeInvalid :: DuckDBV2Error
+pattern DuckDBV2ErrorTypeInvalid = DuckDBV2Error 4003
+
+{-| Two values or expressions have incompatible types.
+
+    __C declaration:__ @DUCKDB_V2_ERROR_TYPE_MISMATCH@
+
+    __defined at:__ @duckdb_v2.h 575:2@
+
+    __exported by:__ @duckdb_v2.h@
+-}
+pattern DuckDBV2ErrorTypeMismatch :: DuckDBV2Error
+pattern DuckDBV2ErrorTypeMismatch = DuckDBV2Error 4004
+
+{-| A decimal value is out of range or otherwise invalid.
+
+    __C declaration:__ @DUCKDB_V2_ERROR_TYPE_DECIMAL@
+
+    __defined at:__ @duckdb_v2.h 578:2@
+
+    __exported by:__ @duckdb_v2.h@
+-}
+pattern DuckDBV2ErrorTypeDecimal :: DuckDBV2Error
+pattern DuckDBV2ErrorTypeDecimal = DuckDBV2Error 4005
+
+{-| Division by zero was attempted.
+
+    __C declaration:__ @DUCKDB_V2_ERROR_TYPE_DIVIDE_BY_ZERO@
+
+    __defined at:__ @duckdb_v2.h 581:2@
+
+    __exported by:__ @duckdb_v2.h@
+-}
+pattern DuckDBV2ErrorTypeDivideByZero :: DuckDBV2Error
+pattern DuckDBV2ErrorTypeDivideByZero = DuckDBV2Error 4006
+
+{-| The query could not be parsed.
+
+    __C declaration:__ @DUCKDB_V2_ERROR_QUERY_PARSER@
+
+    __defined at:__ @duckdb_v2.h 584:2@
+
+    __exported by:__ @duckdb_v2.h@
+-}
+pattern DuckDBV2ErrorQueryParser :: DuckDBV2Error
+pattern DuckDBV2ErrorQueryParser = DuckDBV2Error 5001
+
+{-| The query contains a syntax error.
+
+    __C declaration:__ @DUCKDB_V2_ERROR_QUERY_SYNTAX@
+
+    __defined at:__ @duckdb_v2.h 587:2@
+
+    __exported by:__ @duckdb_v2.h@
+-}
+pattern DuckDBV2ErrorQuerySyntax :: DuckDBV2Error
+pattern DuckDBV2ErrorQuerySyntax = DuckDBV2Error 5002
+
+{-| Binding the query against the catalog failed (e.g. unknown column or table).
+
+    __C declaration:__ @DUCKDB_V2_ERROR_QUERY_BINDER@
+
+    __defined at:__ @duckdb_v2.h 590:2@
+
+    __exported by:__ @duckdb_v2.h@
+-}
+pattern DuckDBV2ErrorQueryBinder :: DuckDBV2Error
+pattern DuckDBV2ErrorQueryBinder = DuckDBV2Error 5003
+
+{-| The query could not be translated into a logical plan.
+
+    __C declaration:__ @DUCKDB_V2_ERROR_QUERY_PLANNER@
+
+    __defined at:__ @duckdb_v2.h 593:2@
+
+    __exported by:__ @duckdb_v2.h@
+-}
+pattern DuckDBV2ErrorQueryPlanner :: DuckDBV2Error
+pattern DuckDBV2ErrorQueryPlanner = DuckDBV2Error 5004
+
+{-| An error occurred during query optimization.
+
+    __C declaration:__ @DUCKDB_V2_ERROR_QUERY_OPTIMIZER@
+
+    __defined at:__ @duckdb_v2.h 596:2@
+
+    __exported by:__ @duckdb_v2.h@
+-}
+pattern DuckDBV2ErrorQueryOptimizer :: DuckDBV2Error
+pattern DuckDBV2ErrorQueryOptimizer = DuckDBV2Error 5005
+
+{-| An expression in the query is invalid or could not be evaluated.
+
+    __C declaration:__ @DUCKDB_V2_ERROR_QUERY_EXPRESSION@
+
+    __defined at:__ @duckdb_v2.h 599:2@
+
+    __exported by:__ @duckdb_v2.h@
+-}
+pattern DuckDBV2ErrorQueryExpression :: DuckDBV2Error
+pattern DuckDBV2ErrorQueryExpression = DuckDBV2Error 5006
+
+{-| An error occurred while executing the physical plan.
+
+    __C declaration:__ @DUCKDB_V2_ERROR_QUERY_EXECUTOR@
+
+    __defined at:__ @duckdb_v2.h 602:2@
+
+    __exported by:__ @duckdb_v2.h@
+-}
+pattern DuckDBV2ErrorQueryExecutor :: DuckDBV2Error
+pattern DuckDBV2ErrorQueryExecutor = DuckDBV2Error 5007
+
+{-| The task scheduler reported an error while running the query.
+
+    __C declaration:__ @DUCKDB_V2_ERROR_QUERY_SCHEDULER@
+
+    __defined at:__ @duckdb_v2.h 605:2@
+
+    __exported by:__ @duckdb_v2.h@
+-}
+pattern DuckDBV2ErrorQueryScheduler :: DuckDBV2Error
+pattern DuckDBV2ErrorQueryScheduler = DuckDBV2Error 5008
+
+{-| The requested feature or operation is not implemented.
+
+    __C declaration:__ @DUCKDB_V2_ERROR_QUERY_NOT_IMPLEMENTED@
+
+    __defined at:__ @duckdb_v2.h 608:2@
+
+    __exported by:__ @duckdb_v2.h@
+-}
+pattern DuckDBV2ErrorQueryNotImplemented :: DuckDBV2Error
+pattern DuckDBV2ErrorQueryNotImplemented = DuckDBV2Error 5009
+
+{-| A prepared-statement parameter has not been bound to a value.
+
+    __C declaration:__ @DUCKDB_V2_ERROR_QUERY_PARAMETER_NOT_RESOLVED@
+
+    __defined at:__ @duckdb_v2.h 611:2@
+
+    __exported by:__ @duckdb_v2.h@
+-}
+pattern DuckDBV2ErrorQueryParameterNotResolved :: DuckDBV2Error
+pattern DuckDBV2ErrorQueryParameterNotResolved = DuckDBV2Error 5010
+
+{-| A prepared-statement parameter was used in a position where it is not allowed.
+
+    __C declaration:__ @DUCKDB_V2_ERROR_QUERY_PARAMETER_NOT_ALLOWED@
+
+    __defined at:__ @duckdb_v2.h 614:2@
+
+    __exported by:__ @duckdb_v2.h@
+-}
+pattern DuckDBV2ErrorQueryParameterNotAllowed :: DuckDBV2Error
+pattern DuckDBV2ErrorQueryParameterNotAllowed = DuckDBV2Error 5011
+
+{-| A catalog operation failed (e.g. object not found or already exists).
+
+    __C declaration:__ @DUCKDB_V2_ERROR_DATABASE_CATALOG@
+
+    __defined at:__ @duckdb_v2.h 617:2@
+
+    __exported by:__ @duckdb_v2.h@
+-}
+pattern DuckDBV2ErrorDatabaseCatalog :: DuckDBV2Error
+pattern DuckDBV2ErrorDatabaseCatalog = DuckDBV2Error 6001
+
+{-| A transaction-level error occurred (e.g. conflict or aborted transaction).
+
+    __C declaration:__ @DUCKDB_V2_ERROR_DATABASE_TRANSACTION@
+
+    __defined at:__ @duckdb_v2.h 620:2@
+
+    __exported by:__ @duckdb_v2.h@
+-}
+pattern DuckDBV2ErrorDatabaseTransaction :: DuckDBV2Error
+pattern DuckDBV2ErrorDatabaseTransaction = DuckDBV2Error 6002
+
+{-| A constraint (primary key, unique, foreign key, NOT NULL, check) was violated.
+
+    __C declaration:__ @DUCKDB_V2_ERROR_DATABASE_CONSTRAINT@
+
+    __defined at:__ @duckdb_v2.h 623:2@
+
+    __exported by:__ @duckdb_v2.h@
+-}
+pattern DuckDBV2ErrorDatabaseConstraint :: DuckDBV2Error
+pattern DuckDBV2ErrorDatabaseConstraint = DuckDBV2Error 6003
+
+{-| An index operation failed.
+
+    __C declaration:__ @DUCKDB_V2_ERROR_DATABASE_INDEX@
+
+    __defined at:__ @duckdb_v2.h 626:2@
+
+    __exported by:__ @duckdb_v2.h@
+-}
+pattern DuckDBV2ErrorDatabaseIndex :: DuckDBV2Error
+pattern DuckDBV2ErrorDatabaseIndex = DuckDBV2Error 6004
+
+{-| A sequence operation failed (e.g. overflow or invalid usage).
+
+    __C declaration:__ @DUCKDB_V2_ERROR_DATABASE_SEQUENCE@
+
+    __defined at:__ @duckdb_v2.h 629:2@
+
+    __exported by:__ @duckdb_v2.h@
+-}
+pattern DuckDBV2ErrorDatabaseSequence :: DuckDBV2Error
+pattern DuckDBV2ErrorDatabaseSequence = DuckDBV2Error 6005
+
+{-| An error related to catalog statistics occurred.
+
+    __C declaration:__ @DUCKDB_V2_ERROR_DATABASE_STATISTICS@
+
+    __defined at:__ @duckdb_v2.h 632:2@
+
+    __exported by:__ @duckdb_v2.h@
+-}
+pattern DuckDBV2ErrorDatabaseStatistics :: DuckDBV2Error
+pattern DuckDBV2ErrorDatabaseStatistics = DuckDBV2Error 6006
+
+{-| Serializing or deserializing a database object failed.
+
+    __C declaration:__ @DUCKDB_V2_ERROR_DATABASE_SERIALIZATION@
+
+    __defined at:__ @duckdb_v2.h 635:2@
+
+    __exported by:__ @duckdb_v2.h@
+-}
+pattern DuckDBV2ErrorDatabaseSerialization :: DuckDBV2Error
+pattern DuckDBV2ErrorDatabaseSerialization = DuckDBV2Error 6007
+
+{-| A settings-related error occurred (e.g. setting an unknown option).
+
+    __C declaration:__ @DUCKDB_V2_ERROR_CONFIGURATION_SETTINGS@
+
+    __defined at:__ @duckdb_v2.h 638:2@
+
+    __exported by:__ @duckdb_v2.h@
+-}
+pattern DuckDBV2ErrorConfigurationSettings :: DuckDBV2Error
+pattern DuckDBV2ErrorConfigurationSettings = DuckDBV2Error 7001
+
+{-| The database configuration is invalid.
+
+    __C declaration:__ @DUCKDB_V2_ERROR_CONFIGURATION_INVALID@
+
+    __defined at:__ @duckdb_v2.h 641:2@
+
+    __exported by:__ @duckdb_v2.h@
+-}
+pattern DuckDBV2ErrorConfigurationInvalid :: DuckDBV2Error
+pattern DuckDBV2ErrorConfigurationInvalid = DuckDBV2Error 7002
+
+{-| The operation is not permitted under the current configuration.
+
+    __C declaration:__ @DUCKDB_V2_ERROR_CONFIGURATION_PERMISSION@
+
+    __defined at:__ @duckdb_v2.h 644:2@
+
+    __exported by:__ @duckdb_v2.h@
+-}
+pattern DuckDBV2ErrorConfigurationPermission :: DuckDBV2Error
+pattern DuckDBV2ErrorConfigurationPermission = DuckDBV2Error 7003
+
+{-| An internal invariant was violated; this indicates a bug in DuckDB.
+
+    __C declaration:__ @DUCKDB_V2_ERROR_RUNTIME_INTERNAL@
+
+    __defined at:__ @duckdb_v2.h 647:2@
+
+    __exported by:__ @duckdb_v2.h@
+-}
+pattern DuckDBV2ErrorRuntimeInternal :: DuckDBV2Error
+pattern DuckDBV2ErrorRuntimeInternal = DuckDBV2Error 8001
+
+{-| A fatal error occurred; the database is no longer usable.
+
+    __C declaration:__ @DUCKDB_V2_ERROR_RUNTIME_FATAL@
+
+    __defined at:__ @duckdb_v2.h 650:2@
+
+    __exported by:__ @duckdb_v2.h@
+-}
+pattern DuckDBV2ErrorRuntimeFatal :: DuckDBV2Error
+pattern DuckDBV2ErrorRuntimeFatal = DuckDBV2Error 8002
+
+{-| The operation was interrupted (e.g. by a cancel request).
+
+    __C declaration:__ @DUCKDB_V2_ERROR_RUNTIME_INTERRUPT@
+
+    __defined at:__ @duckdb_v2.h 653:2@
+
+    __exported by:__ @duckdb_v2.h@
+-}
+pattern DuckDBV2ErrorRuntimeInterrupt :: DuckDBV2Error
+pattern DuckDBV2ErrorRuntimeInterrupt = DuckDBV2Error 8003
+
+{-| A required pointer was unexpectedly null.
+
+    __C declaration:__ @DUCKDB_V2_ERROR_RUNTIME_NULL_POINTER@
+
+    __defined at:__ @duckdb_v2.h 656:2@
+
+    __exported by:__ @duckdb_v2.h@
+-}
+pattern DuckDBV2ErrorRuntimeNullPointer :: DuckDBV2Error
+pattern DuckDBV2ErrorRuntimeNullPointer = DuckDBV2Error 8004
+
+{-| __C declaration:__ @DUCKDB_V2_ERROR_MAX_ENUM@
+
+    __defined at:__ @duckdb_v2.h 657:2@
+
+    __exported by:__ @duckdb_v2.h@
+-}
+pattern DuckDBV2ErrorMaxEnum :: DuckDBV2Error
+pattern DuckDBV2ErrorMaxEnum = DuckDBV2Error 2147483647
+
+{-| Identifies a configurable function property. Pass one of these to @duckdb_v2_scalar_function_set_property()@ or @duckdb_v2_aggregate_function_set_property()@ together with a matching @t'DuckDBV2FunctionPropertyValue'@ . The high byte is the function-type group: COMMON ( @0x01xxxx@ ) keys apply to all function types, while group-specific keys (e.g. aggregate @0x03xxxx@ ) are only valid for that function type and are rejected with an error otherwise.
+
+    __C declaration:__ @enum DUCKDB_V2_FUNCTION_PROPERTY_KEY@
+
+    __defined at:__ @duckdb_v2.h 684:14@
+
+    __exported by:__ @duckdb_v2.h@
+-}
+newtype DuckDBV2FunctionPropertyKey = DuckDBV2FunctionPropertyKey
+  { unwrap :: BG.CUInt
+  }
+  deriving stock (Eq, BG.Generic, Ord)
+  deriving newtype (BG.HasFFIType)
+
+instance Marshal.StaticSize DuckDBV2FunctionPropertyKey where
+
+  staticSizeOf = \_ -> (4 :: Int)
+
+  staticAlignment = \_ -> (4 :: Int)
+
+instance Marshal.ReadRaw DuckDBV2FunctionPropertyKey where
+
+  readRaw =
+    \ptr0 ->
+          pure DuckDBV2FunctionPropertyKey
+      <*> Marshal.readRawByteOff ptr0 (0 :: Int)
+
+instance Marshal.WriteRaw DuckDBV2FunctionPropertyKey where
+
+  writeRaw =
+    \ptr0 ->
+      \s1 ->
+        case s1 of
+          DuckDBV2FunctionPropertyKey unwrap2 ->
+            Marshal.writeRawByteOff ptr0 (0 :: Int) unwrap2
+
+deriving via Marshal.EquivStorable DuckDBV2FunctionPropertyKey instance BG.Storable DuckDBV2FunctionPropertyKey
+
+deriving via BG.CUInt instance BG.Prim DuckDBV2FunctionPropertyKey
+
+instance CEnum.CEnum DuckDBV2FunctionPropertyKey where
+
+  type CEnumZ DuckDBV2FunctionPropertyKey = BG.CUInt
+
+  toCEnum = DuckDBV2FunctionPropertyKey
+
+  fromCEnum = BG.getField @"unwrap"
+
+  declaredValues =
+    \_ ->
+      CEnum.declaredValuesFromList [ (65536, BG.singleton "DuckDBV2FunctionPropertyStability")
+                                   , (65792, BG.singleton "DuckDBV2FunctionPropertyNullHandling")
+                                   , (66048, BG.singleton "DuckDBV2FunctionPropertyFallibility")
+                                   , (66304, BG.singleton "DuckDBV2FunctionPropertyCollationHandling")
+                                   , (196608, BG.singleton "DuckDBV2FunctionPropertyAggOrderDependent")
+                                   , (196864, BG.singleton "DuckDBV2FunctionPropertyAggDistinctDependent")
+                                   , (2147483647, BG.singleton "DuckDBV2FunctionPropertyKeyMaxEnum")
+                                   ]
+
+  showsUndeclared =
+    CEnum.showsWrappedUndeclared "DuckDBV2FunctionPropertyKey"
+
+  readPrecUndeclared =
+    CEnum.readPrecWrappedUndeclared "DuckDBV2FunctionPropertyKey"
+
+instance Show DuckDBV2FunctionPropertyKey where
+
+  showsPrec = CEnum.shows
+
+instance Read DuckDBV2FunctionPropertyKey where
+
+  readPrec = CEnum.readPrec
+
+  readList = BG.readListDefault
+
+  readListPrec = BG.readListPrecDefault
+
+instance ( ty ~ BG.CUInt
+         ) => BG.CompatHasField.HasField "unwrap" DuckDBV2FunctionPropertyKey ty where
+
+  hasField =
+    \x0 ->
+      (\y1 ->
+         DuckDBV2FunctionPropertyKey {unwrap = y1}, BG.getField @"unwrap" x0)
+
+instance ( ty ~ BG.CUInt
+         ) => BG.HasField "unwrap" (BG.Ptr DuckDBV2FunctionPropertyKey) (BG.Ptr ty) where
+
+  getField = HasCField.fromPtr (BG.Proxy @"unwrap")
+
+instance HasCField.HasCField DuckDBV2FunctionPropertyKey "unwrap" where
+
+  type CFieldType DuckDBV2FunctionPropertyKey "unwrap" =
+    BG.CUInt
+
+  offset# = \_ -> \_ -> 0
+
+{-| How stable/deterministic the function\'s result is across rows and queries. Accepts the @FUNCTION_PROPERTY_STABILITY_*@ values. Defaults to @CONSISTENT@ .
+
+    __C declaration:__ @DUCKDB_V2_FUNCTION_PROPERTY_STABILITY@
+
+    __defined at:__ @duckdb_v2.h 689:2@
+
+    __exported by:__ @duckdb_v2.h@
+-}
+pattern DuckDBV2FunctionPropertyStability :: DuckDBV2FunctionPropertyKey
+pattern DuckDBV2FunctionPropertyStability = DuckDBV2FunctionPropertyKey 65536
+
+{-| Whether the function handles NULL inputs itself. Accepts the @FUNCTION_PROPERTY_NULL_HANDLING_*@ values. Defaults to @DEFAULT@ (NULL in, NULL out).
+
+    __C declaration:__ @DUCKDB_V2_FUNCTION_PROPERTY_NULL_HANDLING@
+
+    __defined at:__ @duckdb_v2.h 695:2@
+
+    __exported by:__ @duckdb_v2.h@
+-}
+pattern DuckDBV2FunctionPropertyNullHandling :: DuckDBV2FunctionPropertyKey
+pattern DuckDBV2FunctionPropertyNullHandling = DuckDBV2FunctionPropertyKey 65792
+
+{-| Whether the function can raise a runtime error. Accepts the @FUNCTION_PROPERTY_FALLIBILITY_*@ values. Functions created through this API default to @FALLIBLE@ , since their callbacks can report errors.
+
+    __C declaration:__ @DUCKDB_V2_FUNCTION_PROPERTY_FALLIBILITY@
+
+    __defined at:__ @duckdb_v2.h 701:2@
+
+    __exported by:__ @duckdb_v2.h@
+-}
+pattern DuckDBV2FunctionPropertyFallibility :: DuckDBV2FunctionPropertyKey
+pattern DuckDBV2FunctionPropertyFallibility = DuckDBV2FunctionPropertyKey 66048
+
+{-| How the function interacts with collations on its arguments. Accepts the @FUNCTION_PROPERTY_COLLATION_HANDLING_*@ values. Defaults to @PROPAGATE@ .
+
+    __C declaration:__ @DUCKDB_V2_FUNCTION_PROPERTY_COLLATION_HANDLING@
+
+    __defined at:__ @duckdb_v2.h 707:2@
+
+    __exported by:__ @duckdb_v2.h@
+-}
+pattern DuckDBV2FunctionPropertyCollationHandling :: DuckDBV2FunctionPropertyKey
+pattern DuckDBV2FunctionPropertyCollationHandling = DuckDBV2FunctionPropertyKey 66304
+
+{-| Aggregate only. Whether the aggregate\'s result depends on the order in which rows are aggregated. Accepts the @FUNCTION_PROPERTY_AGG_ORDER_DEPENDENT_*@ values. Defaults to @YES@ .
+
+    __C declaration:__ @DUCKDB_V2_FUNCTION_PROPERTY_AGG_ORDER_DEPENDENT@
+
+    __defined at:__ @duckdb_v2.h 713:2@
+
+    __exported by:__ @duckdb_v2.h@
+-}
+pattern DuckDBV2FunctionPropertyAggOrderDependent :: DuckDBV2FunctionPropertyKey
+pattern DuckDBV2FunctionPropertyAggOrderDependent = DuckDBV2FunctionPropertyKey 196608
+
+{-| Aggregate only. Whether the aggregate\'s result is affected by a DISTINCT modifier. Accepts the @FUNCTION_PROPERTY_AGG_DISTINCT_DEPENDENT_*@ values. Defaults to @YES@ .
+
+    __C declaration:__ @DUCKDB_V2_FUNCTION_PROPERTY_AGG_DISTINCT_DEPENDENT@
+
+    __defined at:__ @duckdb_v2.h 719:2@
+
+    __exported by:__ @duckdb_v2.h@
+-}
+pattern DuckDBV2FunctionPropertyAggDistinctDependent :: DuckDBV2FunctionPropertyKey
+pattern DuckDBV2FunctionPropertyAggDistinctDependent = DuckDBV2FunctionPropertyKey 196864
+
+{-| __C declaration:__ @DUCKDB_V2_FUNCTION_PROPERTY_KEY_MAX_ENUM@
+
+    __defined at:__ @duckdb_v2.h 720:2@
+
+    __exported by:__ @duckdb_v2.h@
+-}
+pattern DuckDBV2FunctionPropertyKeyMaxEnum :: DuckDBV2FunctionPropertyKey
+pattern DuckDBV2FunctionPropertyKeyMaxEnum = DuckDBV2FunctionPropertyKey 2147483647
+
+{-| A value for a @t'DuckDBV2FunctionPropertyKey'@ . Each key owns a 256-value block: a value @V@ is valid for key @K@ iff @(V & 0xFFFF00) == K@ , and shares the key\'s function-type group ( @V & 0xFF0000@ ) in its high byte. Passing a value that does not match the key is rejected with an error. Boolean-like properties are expressed as named values so that additional values can be added later without breaking the ABI.
+
+    __C declaration:__ @enum DUCKDB_V2_FUNCTION_PROPERTY_VALUE@
+
+    __defined at:__ @duckdb_v2.h 729:14@
+
+    __exported by:__ @duckdb_v2.h@
+-}
+newtype DuckDBV2FunctionPropertyValue = DuckDBV2FunctionPropertyValue
+  { unwrap :: BG.CUInt
+  }
+  deriving stock (Eq, BG.Generic, Ord)
+  deriving newtype (BG.HasFFIType)
+
+instance Marshal.StaticSize DuckDBV2FunctionPropertyValue where
+
+  staticSizeOf = \_ -> (4 :: Int)
+
+  staticAlignment = \_ -> (4 :: Int)
+
+instance Marshal.ReadRaw DuckDBV2FunctionPropertyValue where
+
+  readRaw =
+    \ptr0 ->
+          pure DuckDBV2FunctionPropertyValue
+      <*> Marshal.readRawByteOff ptr0 (0 :: Int)
+
+instance Marshal.WriteRaw DuckDBV2FunctionPropertyValue where
+
+  writeRaw =
+    \ptr0 ->
+      \s1 ->
+        case s1 of
+          DuckDBV2FunctionPropertyValue unwrap2 ->
+            Marshal.writeRawByteOff ptr0 (0 :: Int) unwrap2
+
+deriving via Marshal.EquivStorable DuckDBV2FunctionPropertyValue instance BG.Storable DuckDBV2FunctionPropertyValue
+
+deriving via BG.CUInt instance BG.Prim DuckDBV2FunctionPropertyValue
+
+instance CEnum.CEnum DuckDBV2FunctionPropertyValue where
+
+  type CEnumZ DuckDBV2FunctionPropertyValue = BG.CUInt
+
+  toCEnum = DuckDBV2FunctionPropertyValue
+
+  fromCEnum = BG.getField @"unwrap"
+
+  declaredValues =
+    \_ ->
+      CEnum.declaredValuesFromList [ (65536, BG.singleton "DuckDBV2FunctionPropertyStabilityConsistent")
+                                   , (65537, BG.singleton "DuckDBV2FunctionPropertyStabilityVolatile")
+                                   , (65538, BG.singleton "DuckDBV2FunctionPropertyStabilityConsistentWithinQuery")
+                                   , (65792, BG.singleton "DuckDBV2FunctionPropertyNullHandlingDefault")
+                                   , (65793, BG.singleton "DuckDBV2FunctionPropertyNullHandlingSpecial")
+                                   , (66048, BG.singleton "DuckDBV2FunctionPropertyFallibilityInfallible")
+                                   , (66049, BG.singleton "DuckDBV2FunctionPropertyFallibilityFallible")
+                                   , (66304, BG.singleton "DuckDBV2FunctionPropertyCollationHandlingPropagate")
+                                   , (66305, BG.singleton "DuckDBV2FunctionPropertyCollationHandlingPushCombinable")
+                                   , (66306, BG.singleton "DuckDBV2FunctionPropertyCollationHandlingIgnore")
+                                   , (196608, BG.singleton "DuckDBV2FunctionPropertyAggOrderDependentYes")
+                                   , (196609, BG.singleton "DuckDBV2FunctionPropertyAggOrderDependentNo")
+                                   , (196864, BG.singleton "DuckDBV2FunctionPropertyAggDistinctDependentYes")
+                                   , (196865, BG.singleton "DuckDBV2FunctionPropertyAggDistinctDependentNo")
+                                   , (2147483647, BG.singleton "DuckDBV2FunctionPropertyValueMaxEnum")
+                                   ]
+
+  showsUndeclared =
+    CEnum.showsWrappedUndeclared "DuckDBV2FunctionPropertyValue"
+
+  readPrecUndeclared =
+    CEnum.readPrecWrappedUndeclared "DuckDBV2FunctionPropertyValue"
+
+instance Show DuckDBV2FunctionPropertyValue where
+
+  showsPrec = CEnum.shows
+
+instance Read DuckDBV2FunctionPropertyValue where
+
+  readPrec = CEnum.readPrec
+
+  readList = BG.readListDefault
+
+  readListPrec = BG.readListPrecDefault
+
+instance ( ty ~ BG.CUInt
+         ) => BG.CompatHasField.HasField "unwrap" DuckDBV2FunctionPropertyValue ty where
+
+  hasField =
+    \x0 ->
+      ( \y1 -> DuckDBV2FunctionPropertyValue {unwrap = y1}
+      , BG.getField @"unwrap" x0
+      )
+
+instance ( ty ~ BG.CUInt
+         ) => BG.HasField "unwrap" (BG.Ptr DuckDBV2FunctionPropertyValue) (BG.Ptr ty) where
+
+  getField = HasCField.fromPtr (BG.Proxy @"unwrap")
+
+instance HasCField.HasCField DuckDBV2FunctionPropertyValue "unwrap" where
+
+  type CFieldType DuckDBV2FunctionPropertyValue "unwrap" =
+    BG.CUInt
+
+  offset# = \_ -> \_ -> 0
+
+{-| The function always returns the same result given the same input.
+
+    __C declaration:__ @DUCKDB_V2_FUNCTION_PROPERTY_STABILITY_CONSISTENT@
+
+    __defined at:__ @duckdb_v2.h 731:2@
+
+    __exported by:__ @duckdb_v2.h@
+-}
+pattern DuckDBV2FunctionPropertyStabilityConsistent :: DuckDBV2FunctionPropertyValue
+pattern DuckDBV2FunctionPropertyStabilityConsistent = DuckDBV2FunctionPropertyValue 65536
+
+{-| The result may differ per row (e.g. random()).
+
+    __C declaration:__ @DUCKDB_V2_FUNCTION_PROPERTY_STABILITY_VOLATILE@
+
+    __defined at:__ @duckdb_v2.h 734:2@
+
+    __exported by:__ @duckdb_v2.h@
+-}
+pattern DuckDBV2FunctionPropertyStabilityVolatile :: DuckDBV2FunctionPropertyValue
+pattern DuckDBV2FunctionPropertyStabilityVolatile = DuckDBV2FunctionPropertyValue 65537
+
+{-| The result is stable within a single query/transaction but may change across queries (e.g. now()).
+
+    __C declaration:__ @DUCKDB_V2_FUNCTION_PROPERTY_STABILITY_CONSISTENT_WITHIN_QUERY@
+
+    __defined at:__ @duckdb_v2.h 737:2@
+
+    __exported by:__ @duckdb_v2.h@
+-}
+pattern DuckDBV2FunctionPropertyStabilityConsistentWithinQuery :: DuckDBV2FunctionPropertyValue
+pattern DuckDBV2FunctionPropertyStabilityConsistentWithinQuery = DuckDBV2FunctionPropertyValue 65538
+
+{-| Default NULL handling: if any argument is NULL the result is NULL and the function is not invoked for that row.
+
+    __C declaration:__ @DUCKDB_V2_FUNCTION_PROPERTY_NULL_HANDLING_DEFAULT@
+
+    __defined at:__ @duckdb_v2.h 740:2@
+
+    __exported by:__ @duckdb_v2.h@
+-}
+pattern DuckDBV2FunctionPropertyNullHandlingDefault :: DuckDBV2FunctionPropertyValue
+pattern DuckDBV2FunctionPropertyNullHandlingDefault = DuckDBV2FunctionPropertyValue 65792
+
+{-| The function handles NULL inputs itself and is invoked even when arguments are NULL.
+
+    __C declaration:__ @DUCKDB_V2_FUNCTION_PROPERTY_NULL_HANDLING_SPECIAL@
+
+    __defined at:__ @duckdb_v2.h 743:2@
+
+    __exported by:__ @duckdb_v2.h@
+-}
+pattern DuckDBV2FunctionPropertyNullHandlingSpecial :: DuckDBV2FunctionPropertyValue
+pattern DuckDBV2FunctionPropertyNullHandlingSpecial = DuckDBV2FunctionPropertyValue 65793
+
+{-| The function never raises a runtime error. Declaring this promises that the callbacks never report an error; an error reported anyway becomes an internal error.
+
+    __C declaration:__ @DUCKDB_V2_FUNCTION_PROPERTY_FALLIBILITY_INFALLIBLE@
+
+    __defined at:__ @duckdb_v2.h 749:2@
+
+    __exported by:__ @duckdb_v2.h@
+-}
+pattern DuckDBV2FunctionPropertyFallibilityInfallible :: DuckDBV2FunctionPropertyValue
+pattern DuckDBV2FunctionPropertyFallibilityInfallible = DuckDBV2FunctionPropertyValue 66048
+
+{-| The function may raise a runtime error for some inputs.
+
+    __C declaration:__ @DUCKDB_V2_FUNCTION_PROPERTY_FALLIBILITY_FALLIBLE@
+
+    __defined at:__ @duckdb_v2.h 752:2@
+
+    __exported by:__ @duckdb_v2.h@
+-}
+pattern DuckDBV2FunctionPropertyFallibilityFallible :: DuckDBV2FunctionPropertyValue
+pattern DuckDBV2FunctionPropertyFallibilityFallible = DuckDBV2FunctionPropertyValue 66049
+
+{-| The function combines collations from its inputs and propagates them to its result (default).
+
+    __C declaration:__ @DUCKDB_V2_FUNCTION_PROPERTY_COLLATION_HANDLING_PROPAGATE@
+
+    __defined at:__ @duckdb_v2.h 755:2@
+
+    __exported by:__ @duckdb_v2.h@
+-}
+pattern DuckDBV2FunctionPropertyCollationHandlingPropagate :: DuckDBV2FunctionPropertyValue
+pattern DuckDBV2FunctionPropertyCollationHandlingPropagate = DuckDBV2FunctionPropertyValue 66304
+
+{-| Combinable collations are executed on the input arguments before the function runs.
+
+    __C declaration:__ @DUCKDB_V2_FUNCTION_PROPERTY_COLLATION_HANDLING_PUSH_COMBINABLE@
+
+    __defined at:__ @duckdb_v2.h 758:2@
+
+    __exported by:__ @duckdb_v2.h@
+-}
+pattern DuckDBV2FunctionPropertyCollationHandlingPushCombinable :: DuckDBV2FunctionPropertyValue
+pattern DuckDBV2FunctionPropertyCollationHandlingPushCombinable = DuckDBV2FunctionPropertyValue 66305
+
+{-| Collations are ignored by the function.
+
+    __C declaration:__ @DUCKDB_V2_FUNCTION_PROPERTY_COLLATION_HANDLING_IGNORE@
+
+    __defined at:__ @duckdb_v2.h 761:2@
+
+    __exported by:__ @duckdb_v2.h@
+-}
+pattern DuckDBV2FunctionPropertyCollationHandlingIgnore :: DuckDBV2FunctionPropertyValue
+pattern DuckDBV2FunctionPropertyCollationHandlingIgnore = DuckDBV2FunctionPropertyValue 66306
+
+{-| The aggregate\'s result depends on the order in which rows are aggregated (default).
+
+    __C declaration:__ @DUCKDB_V2_FUNCTION_PROPERTY_AGG_ORDER_DEPENDENT_YES@
+
+    __defined at:__ @duckdb_v2.h 764:2@
+
+    __exported by:__ @duckdb_v2.h@
+-}
+pattern DuckDBV2FunctionPropertyAggOrderDependentYes :: DuckDBV2FunctionPropertyValue
+pattern DuckDBV2FunctionPropertyAggOrderDependentYes = DuckDBV2FunctionPropertyValue 196608
+
+{-| The aggregate\'s result does not depend on input order.
+
+    __C declaration:__ @DUCKDB_V2_FUNCTION_PROPERTY_AGG_ORDER_DEPENDENT_NO@
+
+    __defined at:__ @duckdb_v2.h 767:2@
+
+    __exported by:__ @duckdb_v2.h@
+-}
+pattern DuckDBV2FunctionPropertyAggOrderDependentNo :: DuckDBV2FunctionPropertyValue
+pattern DuckDBV2FunctionPropertyAggOrderDependentNo = DuckDBV2FunctionPropertyValue 196609
+
+{-| The aggregate\'s result is affected by a DISTINCT modifier (default).
+
+    __C declaration:__ @DUCKDB_V2_FUNCTION_PROPERTY_AGG_DISTINCT_DEPENDENT_YES@
+
+    __defined at:__ @duckdb_v2.h 770:2@
+
+    __exported by:__ @duckdb_v2.h@
+-}
+pattern DuckDBV2FunctionPropertyAggDistinctDependentYes :: DuckDBV2FunctionPropertyValue
+pattern DuckDBV2FunctionPropertyAggDistinctDependentYes = DuckDBV2FunctionPropertyValue 196864
+
+{-| The aggregate\'s result is not affected by a DISTINCT modifier.
+
+    __C declaration:__ @DUCKDB_V2_FUNCTION_PROPERTY_AGG_DISTINCT_DEPENDENT_NO@
+
+    __defined at:__ @duckdb_v2.h 773:2@
+
+    __exported by:__ @duckdb_v2.h@
+-}
+pattern DuckDBV2FunctionPropertyAggDistinctDependentNo :: DuckDBV2FunctionPropertyValue
+pattern DuckDBV2FunctionPropertyAggDistinctDependentNo = DuckDBV2FunctionPropertyValue 196865
+
+{-| __C declaration:__ @DUCKDB_V2_FUNCTION_PROPERTY_VALUE_MAX_ENUM@
+
+    __defined at:__ @duckdb_v2.h 774:2@
+
+    __exported by:__ @duckdb_v2.h@
+-}
+pattern DuckDBV2FunctionPropertyValueMaxEnum :: DuckDBV2FunctionPropertyValue
+pattern DuckDBV2FunctionPropertyValueMaxEnum = DuckDBV2FunctionPropertyValue 2147483647
+
+{-| The mode a cast is being executed in. A normal cast must either succeed for every row or report an error, which aborts the query. A "try" cast (SQL TRY_CAST, and implicit casts the engine probes speculatively) tolerates per-row failures: the callback writes NULL for the rows it could not convert instead of aborting. Read with @duckdb_v2_cast_function_exec_get_mode()@ , and passed to @duckdb_v2_vector_cast()@ .
+
+    __C declaration:__ @enum DUCKDB_V2_CAST_MODE@
+
+    __defined at:__ @duckdb_v2.h 841:14@
+
+    __exported by:__ @duckdb_v2.h@
+-}
+newtype DuckDBV2CastMode = DuckDBV2CastMode
+  { unwrap :: BG.CUInt
+  }
+  deriving stock (Eq, BG.Generic, Ord)
+  deriving newtype (BG.HasFFIType)
+
+instance Marshal.StaticSize DuckDBV2CastMode where
+
+  staticSizeOf = \_ -> (4 :: Int)
+
+  staticAlignment = \_ -> (4 :: Int)
+
+instance Marshal.ReadRaw DuckDBV2CastMode where
+
+  readRaw =
+    \ptr0 ->
+          pure DuckDBV2CastMode
+      <*> Marshal.readRawByteOff ptr0 (0 :: Int)
+
+instance Marshal.WriteRaw DuckDBV2CastMode where
+
+  writeRaw =
+    \ptr0 ->
+      \s1 ->
+        case s1 of
+          DuckDBV2CastMode unwrap2 ->
+            Marshal.writeRawByteOff ptr0 (0 :: Int) unwrap2
+
+deriving via Marshal.EquivStorable DuckDBV2CastMode instance BG.Storable DuckDBV2CastMode
+
+deriving via BG.CUInt instance BG.Prim DuckDBV2CastMode
+
+instance CEnum.CEnum DuckDBV2CastMode where
+
+  type CEnumZ DuckDBV2CastMode = BG.CUInt
+
+  toCEnum = DuckDBV2CastMode
+
+  fromCEnum = BG.getField @"unwrap"
+
+  declaredValues =
+    \_ ->
+      CEnum.declaredValuesFromList [ (0, BG.singleton "DuckDBV2CastModeNormal")
+                                   , (1, BG.singleton "DuckDBV2CastModeTry")
+                                   , (2147483647, BG.singleton "DuckDBV2CastModeMaxEnum")
+                                   ]
+
+  showsUndeclared =
+    CEnum.showsWrappedUndeclared "DuckDBV2CastMode"
+
+  readPrecUndeclared =
+    CEnum.readPrecWrappedUndeclared "DuckDBV2CastMode"
+
+instance Show DuckDBV2CastMode where
+
+  showsPrec = CEnum.shows
+
+instance Read DuckDBV2CastMode where
+
+  readPrec = CEnum.readPrec
+
+  readList = BG.readListDefault
+
+  readListPrec = BG.readListPrecDefault
+
+instance ( ty ~ BG.CUInt
+         ) => BG.CompatHasField.HasField "unwrap" DuckDBV2CastMode ty where
+
+  hasField =
+    \x0 ->
+      (\y1 ->
+         DuckDBV2CastMode {unwrap = y1}, BG.getField @"unwrap" x0)
+
+instance ( ty ~ BG.CUInt
+         ) => BG.HasField "unwrap" (BG.Ptr DuckDBV2CastMode) (BG.Ptr ty) where
+
+  getField = HasCField.fromPtr (BG.Proxy @"unwrap")
+
+instance HasCField.HasCField DuckDBV2CastMode "unwrap" where
+
+  type CFieldType DuckDBV2CastMode "unwrap" = BG.CUInt
+
+  offset# = \_ -> \_ -> 0
+
+{-| A regular cast. A conversion failure reported through the error slot aborts the query.
+
+    __C declaration:__ @DUCKDB_V2_CAST_MODE_NORMAL@
+
+    __defined at:__ @duckdb_v2.h 843:2@
+
+    __exported by:__ @duckdb_v2.h@
+-}
+pattern DuckDBV2CastModeNormal :: DuckDBV2CastMode
+pattern DuckDBV2CastModeNormal = DuckDBV2CastMode 0
+
+{-| A "try" cast. Conversion failures should be written as NULLs into the output vector; an error reported through the slot is swallowed and the affected rows are left NULL.
+
+    __C declaration:__ @DUCKDB_V2_CAST_MODE_TRY@
+
+    __defined at:__ @duckdb_v2.h 849:2@
+
+    __exported by:__ @duckdb_v2.h@
+-}
+pattern DuckDBV2CastModeTry :: DuckDBV2CastMode
+pattern DuckDBV2CastModeTry = DuckDBV2CastMode 1
+
+{-| __C declaration:__ @DUCKDB_V2_CAST_MODE_MAX_ENUM@
+
+    __defined at:__ @duckdb_v2.h 850:2@
+
+    __exported by:__ @duckdb_v2.h@
+-}
+pattern DuckDBV2CastModeMaxEnum :: DuckDBV2CastMode
+pattern DuckDBV2CastModeMaxEnum = DuckDBV2CastMode 2147483647
+
+{-| An owned opaque handle to a cast function being built. Created with @duckdb_v2_cast_function_create()@ , configured with the setter functions (e.g. @duckdb_v2_cast_function_set_source_type()@ , @duckdb_v2_cast_function_set_exec_callback()@ , etc.), made available with @duckdb_v2_connection_register_cast_function()@ or @duckdb_v2_extension_register_cast_function()@ , and destroyed with @duckdb_v2_cast_function_destroy()@ .
+
+    __C declaration:__ @struct _duckdb_v2_cast_function@
+
+    __defined at:__ @duckdb_v2.h 864:16@
+
+    __exported by:__ @duckdb_v2.h@
+-}
+data DuckDBV2CastFunctionStruct
+
+instance Marshal.StaticSize DuckDBV2CastFunctionStruct where
+
+  staticSizeOf = \_ -> (8 :: Int)
+
+  staticAlignment = \_ -> (8 :: Int)
+
+{-| An owned opaque handle to a cast function being built. Created with @duckdb_v2_cast_function_create()@ , configured with the setter functions (e.g. @duckdb_v2_cast_function_set_source_type()@ , @duckdb_v2_cast_function_set_exec_callback()@ , etc.), made available with @duckdb_v2_connection_register_cast_function()@ or @duckdb_v2_extension_register_cast_function()@ , and destroyed with @duckdb_v2_cast_function_destroy()@ .
+
+    __C declaration:__ @duckdb_v2_cast_function_handle@
+
+    __defined at:__ @duckdb_v2.h 866:5@
+
+    __exported by:__ @duckdb_v2.h@
+-}
+newtype DuckDBV2CastFunctionHandle = DuckDBV2CastFunctionHandle
+  { unwrap :: BG.Ptr DuckDBV2CastFunctionStruct
+  }
+  deriving stock (Eq, BG.Generic, Ord, Show)
+  deriving newtype
+    ( BG.HasFFIType
+    , Marshal.ReadRaw
+    , Marshal.StaticSize
+    , BG.Storable
+    , Marshal.WriteRaw
+    )
+
+instance ( ty ~ BG.Ptr DuckDBV2CastFunctionStruct
+         ) => BG.CompatHasField.HasField "unwrap" DuckDBV2CastFunctionHandle ty where
+
+  hasField =
+    \x0 ->
+      (\y1 ->
+         DuckDBV2CastFunctionHandle {unwrap = y1}, BG.getField @"unwrap" x0)
+
+instance ( ty ~ BG.Ptr DuckDBV2CastFunctionStruct
+         ) => BG.HasField "unwrap" (BG.Ptr DuckDBV2CastFunctionHandle) (BG.Ptr ty) where
+
+  getField = HasCField.fromPtr (BG.Proxy @"unwrap")
+
+instance HasCField.HasCField DuckDBV2CastFunctionHandle "unwrap" where
+
+  type CFieldType DuckDBV2CastFunctionHandle "unwrap" =
+    BG.Ptr DuckDBV2CastFunctionStruct
+
+  offset# = \_ -> \_ -> 0
+
+{-| A borrowed opaque handle to the arguments supplied to a cast function during the execution "exec" phase. The "exec" callback receives this handle and can use it to access the input vector, the output vector to write into, the number of rows to convert, and the mode the cast is running in.
+
+    __C declaration:__ @struct _duckdb_v2_cast_function_exec_info@
+
+    __defined at:__ @duckdb_v2.h 873:16@
+
+    __exported by:__ @duckdb_v2.h@
+-}
+data DuckDBV2CastFunctionExecInfoStruct
+
+instance Marshal.StaticSize DuckDBV2CastFunctionExecInfoStruct where
+
+  staticSizeOf = \_ -> (8 :: Int)
+
+  staticAlignment = \_ -> (8 :: Int)
+
+{-| A borrowed opaque handle to the arguments supplied to a cast function during the execution "exec" phase. The "exec" callback receives this handle and can use it to access the input vector, the output vector to write into, the number of rows to convert, and the mode the cast is running in.
+
+    __C declaration:__ @duckdb_v2_cast_function_exec_info_handle@
+
+    __defined at:__ @duckdb_v2.h 875:5@
+
+    __exported by:__ @duckdb_v2.h@
+-}
+newtype DuckDBV2CastFunctionExecInfoHandle = DuckDBV2CastFunctionExecInfoHandle
+  { unwrap :: BG.Ptr DuckDBV2CastFunctionExecInfoStruct
+  }
+  deriving stock (Eq, BG.Generic, Ord, Show)
+  deriving newtype
+    ( BG.HasFFIType
+    , Marshal.ReadRaw
+    , Marshal.StaticSize
+    , BG.Storable
+    , Marshal.WriteRaw
+    )
+
+instance ( ty ~ BG.Ptr DuckDBV2CastFunctionExecInfoStruct
+         ) => BG.CompatHasField.HasField "unwrap" DuckDBV2CastFunctionExecInfoHandle ty where
+
+  hasField =
+    \x0 ->
+      ( \y1 ->
+          DuckDBV2CastFunctionExecInfoHandle {unwrap = y1}
+      , BG.getField @"unwrap" x0
+      )
+
+instance ( ty ~ BG.Ptr DuckDBV2CastFunctionExecInfoStruct
+         ) => BG.HasField "unwrap" (BG.Ptr DuckDBV2CastFunctionExecInfoHandle) (BG.Ptr ty) where
+
+  getField = HasCField.fromPtr (BG.Proxy @"unwrap")
+
+instance HasCField.HasCField DuckDBV2CastFunctionExecInfoHandle "unwrap" where
+
+  type CFieldType DuckDBV2CastFunctionExecInfoHandle "unwrap" =
+    BG.Ptr DuckDBV2CastFunctionExecInfoStruct
+
+  offset# = \_ -> \_ -> 0
+
+{-| Auxiliary type used by t'DuckDBV2CastFunctionExecCallbackFn'
+
+    __C declaration:__ @duckdb_v2_cast_function_exec_callback_fn@
+
+    __defined at:__ @duckdb_v2.h 881:16@
+
+    __exported by:__ @duckdb_v2.h@
+-}
+newtype DuckDBV2CastFunctionExecCallbackFn_Aux = DuckDBV2CastFunctionExecCallbackFn_Aux
+  { unwrap :: DuckDBV2CastFunctionExecInfoHandle -> DuckDBV2ContextHandle -> BG.Ptr DuckDBV2ErrorInfoHandle -> IO ()
+  }
+  deriving stock (BG.Generic)
+
+-- __unique:__ @toDuckDBV2CastFunctionExecCallbackFn_Aux@
+foreign import ccall safe "wrapper" hs_bindgen_8be35a2c127ee114_base ::
+     (BG.Ptr BG.Void -> BG.Ptr BG.Void -> BG.Ptr BG.Void -> IO ())
+  -> IO (BG.FunPtr (BG.Ptr BG.Void -> BG.Ptr BG.Void -> BG.Ptr BG.Void -> IO ()))
+
+-- __unique:__ @toDuckDBV2CastFunctionExecCallbackFn_Aux@
+hs_bindgen_8be35a2c127ee114 ::
+     DuckDBV2CastFunctionExecCallbackFn_Aux
+  -> IO (BG.FunPtr DuckDBV2CastFunctionExecCallbackFn_Aux)
+hs_bindgen_8be35a2c127ee114 =
+  \fun0 ->
+    fmap BG.castFunPtr (hs_bindgen_8be35a2c127ee114_base (\x1 ->
+                                                            \x2 ->
+                                                              \x3 ->
+                                                                BG.getField @"unwrap" fun0 (BG.fromFFIType x1) (BG.fromFFIType x2) (BG.fromFFIType x3)))
+
+-- __unique:__ @fromDuckDBV2CastFunctionExecCallbackFn_Aux@
+foreign import ccall safe "dynamic" hs_bindgen_d71b5e8d408a5e58_base ::
+     BG.FunPtr (BG.Ptr BG.Void -> BG.Ptr BG.Void -> BG.Ptr BG.Void -> IO ())
+  -> BG.Ptr BG.Void -> BG.Ptr BG.Void -> BG.Ptr BG.Void -> IO ()
+
+-- __unique:__ @fromDuckDBV2CastFunctionExecCallbackFn_Aux@
+hs_bindgen_d71b5e8d408a5e58 ::
+     BG.FunPtr DuckDBV2CastFunctionExecCallbackFn_Aux
+  -> DuckDBV2CastFunctionExecCallbackFn_Aux
+hs_bindgen_d71b5e8d408a5e58 =
+  \funPtr0 ->
+    DuckDBV2CastFunctionExecCallbackFn_Aux (\x1 ->
+                                              \x2 ->
+                                                \x3 ->
+                                                  hs_bindgen_d71b5e8d408a5e58_base (BG.castFunPtr funPtr0) (BG.toFFIType x1) (BG.toFFIType x2) (BG.toFFIType x3))
+
+instance BG.ToFunPtr DuckDBV2CastFunctionExecCallbackFn_Aux where
+
+  toFunPtr = hs_bindgen_8be35a2c127ee114
+
+instance BG.FromFunPtr DuckDBV2CastFunctionExecCallbackFn_Aux where
+
+  fromFunPtr = hs_bindgen_d71b5e8d408a5e58
+
+instance ( ty ~ (DuckDBV2CastFunctionExecInfoHandle -> DuckDBV2ContextHandle -> BG.Ptr DuckDBV2ErrorInfoHandle -> IO ())
+         ) => BG.CompatHasField.HasField "unwrap" DuckDBV2CastFunctionExecCallbackFn_Aux ty where
+
+  hasField =
+    \x0 ->
+      ( \y1 ->
+          DuckDBV2CastFunctionExecCallbackFn_Aux {unwrap = y1}
+      , BG.getField @"unwrap" x0
+      )
+
+instance ( ty ~ (DuckDBV2CastFunctionExecInfoHandle -> DuckDBV2ContextHandle -> BG.Ptr DuckDBV2ErrorInfoHandle -> IO ())
+         ) => BG.HasField "unwrap" (BG.Ptr DuckDBV2CastFunctionExecCallbackFn_Aux) (BG.Ptr ty) where
+
+  getField = HasCField.fromPtr (BG.Proxy @"unwrap")
+
+instance HasCField.HasCField DuckDBV2CastFunctionExecCallbackFn_Aux "unwrap" where
+
+  type CFieldType DuckDBV2CastFunctionExecCallbackFn_Aux "unwrap" =
+    DuckDBV2CastFunctionExecInfoHandle -> DuckDBV2ContextHandle -> BG.Ptr DuckDBV2ErrorInfoHandle -> IO ()
+
+  offset# = \_ -> \_ -> 0
+
+{-| __C declaration:__ @duckdb_v2_cast_function_exec_callback_fn@
+
+    __defined at:__ @duckdb_v2.h 881:16@
+
+    __exported by:__ @duckdb_v2.h@
+-}
+newtype DuckDBV2CastFunctionExecCallbackFn = DuckDBV2CastFunctionExecCallbackFn
+  { unwrap :: BG.FunPtr DuckDBV2CastFunctionExecCallbackFn_Aux
+  }
+  deriving stock (Eq, BG.Generic, Ord, Show)
+  deriving newtype
+    ( BG.HasFFIType
+    , Marshal.ReadRaw
+    , Marshal.StaticSize
+    , BG.Storable
+    , Marshal.WriteRaw
+    )
+
+instance ( ty ~ BG.FunPtr DuckDBV2CastFunctionExecCallbackFn_Aux
+         ) => BG.CompatHasField.HasField "unwrap" DuckDBV2CastFunctionExecCallbackFn ty where
+
+  hasField =
+    \x0 ->
+      ( \y1 ->
+          DuckDBV2CastFunctionExecCallbackFn {unwrap = y1}
+      , BG.getField @"unwrap" x0
+      )
+
+instance ( ty ~ BG.FunPtr DuckDBV2CastFunctionExecCallbackFn_Aux
+         ) => BG.HasField "unwrap" (BG.Ptr DuckDBV2CastFunctionExecCallbackFn) (BG.Ptr ty) where
+
+  getField = HasCField.fromPtr (BG.Proxy @"unwrap")
+
+instance HasCField.HasCField DuckDBV2CastFunctionExecCallbackFn "unwrap" where
+
+  type CFieldType DuckDBV2CastFunctionExecCallbackFn "unwrap" =
+    BG.FunPtr DuckDBV2CastFunctionExecCallbackFn_Aux
+
+  offset# = \_ -> \_ -> 0
+
+{-| A column data collection represents a set of (buffer-managed) data chunks.
+
+    You can append chunks to the collection iteratively, and then scan the collection back to retrieve the chunks in order. DuckDB will manage the memory for the chunks, and transparently offload chunks to disk if necessary. A collection shall not be scanned while it is being appended to, and vice versa. A collection shall not be appended to concurrently, but it can be scanned concurrently by multiple threads using a shared scan state and per-thread worker scan states. For concurrent appends, consider creating multiple collections and "combining" them into one collection at the end.
+
+    __C declaration:__ @struct _duckdb_v2_column_data_collection@
+
+    __defined at:__ @duckdb_v2.h 1210:16@
+
+    __exported by:__ @duckdb_v2.h@
+-}
+data DuckDBV2ColumnDataCollectionStruct
+
+instance Marshal.StaticSize DuckDBV2ColumnDataCollectionStruct where
+
+  staticSizeOf = \_ -> (8 :: Int)
+
+  staticAlignment = \_ -> (8 :: Int)
+
+{-| A column data collection represents a set of (buffer-managed) data chunks.
+
+    You can append chunks to the collection iteratively, and then scan the collection back to retrieve the chunks in order. DuckDB will manage the memory for the chunks, and transparently offload chunks to disk if necessary. A collection shall not be scanned while it is being appended to, and vice versa. A collection shall not be appended to concurrently, but it can be scanned concurrently by multiple threads using a shared scan state and per-thread worker scan states. For concurrent appends, consider creating multiple collections and "combining" them into one collection at the end.
+
+    __C declaration:__ @duckdb_v2_column_data_collection_handle@
+
+    __defined at:__ @duckdb_v2.h 1212:5@
+
+    __exported by:__ @duckdb_v2.h@
+-}
+newtype DuckDBV2ColumnDataCollectionHandle = DuckDBV2ColumnDataCollectionHandle
+  { unwrap :: BG.Ptr DuckDBV2ColumnDataCollectionStruct
+  }
+  deriving stock (Eq, BG.Generic, Ord, Show)
+  deriving newtype
+    ( BG.HasFFIType
+    , Marshal.ReadRaw
+    , Marshal.StaticSize
+    , BG.Storable
+    , Marshal.WriteRaw
+    )
+
+instance ( ty ~ BG.Ptr DuckDBV2ColumnDataCollectionStruct
+         ) => BG.CompatHasField.HasField "unwrap" DuckDBV2ColumnDataCollectionHandle ty where
+
+  hasField =
+    \x0 ->
+      ( \y1 ->
+          DuckDBV2ColumnDataCollectionHandle {unwrap = y1}
+      , BG.getField @"unwrap" x0
+      )
+
+instance ( ty ~ BG.Ptr DuckDBV2ColumnDataCollectionStruct
+         ) => BG.HasField "unwrap" (BG.Ptr DuckDBV2ColumnDataCollectionHandle) (BG.Ptr ty) where
+
+  getField = HasCField.fromPtr (BG.Proxy @"unwrap")
+
+instance HasCField.HasCField DuckDBV2ColumnDataCollectionHandle "unwrap" where
+
+  type CFieldType DuckDBV2ColumnDataCollectionHandle "unwrap" =
+    BG.Ptr DuckDBV2ColumnDataCollectionStruct
+
+  offset# = \_ -> \_ -> 0
+
+{-| Opaque state handle for shared state across multiple threads scanning a column data collection. This is used to coordinate work distribution, track global progress, or store any other state that needs to be shared across threads during the scan of the collection.
+
+    __C declaration:__ @struct _duckdb_v2_column_data_collection_shared_scan_state@
+
+    __defined at:__ @duckdb_v2.h 1219:16@
+
+    __exported by:__ @duckdb_v2.h@
+-}
+data DuckDBV2ColumnDataCollectionSharedScanStateStruct
+
+instance Marshal.StaticSize DuckDBV2ColumnDataCollectionSharedScanStateStruct where
+
+  staticSizeOf = \_ -> (8 :: Int)
+
+  staticAlignment = \_ -> (8 :: Int)
+
+{-| Opaque state handle for shared state across multiple threads scanning a column data collection. This is used to coordinate work distribution, track global progress, or store any other state that needs to be shared across threads during the scan of the collection.
+
+    __C declaration:__ @duckdb_v2_column_data_collection_shared_scan_state_handle@
+
+    __defined at:__ @duckdb_v2.h 1221:5@
+
+    __exported by:__ @duckdb_v2.h@
+-}
+newtype DuckDBV2ColumnDataCollectionSharedScanStateHandle = DuckDBV2ColumnDataCollectionSharedScanStateHandle
+  { unwrap :: BG.Ptr DuckDBV2ColumnDataCollectionSharedScanStateStruct
+  }
+  deriving stock (Eq, BG.Generic, Ord, Show)
+  deriving newtype
+    ( BG.HasFFIType
+    , Marshal.ReadRaw
+    , Marshal.StaticSize
+    , BG.Storable
+    , Marshal.WriteRaw
+    )
+
+instance ( ty ~ BG.Ptr DuckDBV2ColumnDataCollectionSharedScanStateStruct
+         ) => BG.CompatHasField.HasField "unwrap" DuckDBV2ColumnDataCollectionSharedScanStateHandle ty where
+
+  hasField =
+    \x0 ->
+      ( \y1 ->
+          DuckDBV2ColumnDataCollectionSharedScanStateHandle {unwrap = y1}
+      , BG.getField @"unwrap" x0
+      )
+
+instance ( ty ~ BG.Ptr DuckDBV2ColumnDataCollectionSharedScanStateStruct
+         ) => BG.HasField "unwrap" (BG.Ptr DuckDBV2ColumnDataCollectionSharedScanStateHandle) (BG.Ptr ty) where
+
+  getField = HasCField.fromPtr (BG.Proxy @"unwrap")
+
+instance HasCField.HasCField DuckDBV2ColumnDataCollectionSharedScanStateHandle "unwrap" where
+
+  type CFieldType DuckDBV2ColumnDataCollectionSharedScanStateHandle "unwrap" =
+    BG.Ptr DuckDBV2ColumnDataCollectionSharedScanStateStruct
+
+  offset# = \_ -> \_ -> 0
+
+{-| Opaque state handle for local state while scanning a column data collection. This is used to track progress and any other state that needs to be maintained on a per-thread basis across calls while scanning the collection. It also keeps the buffers backing the most recently scanned chunk alive: chunks are scanned zero-copy, so a scanned chunk\'s data is only valid until the worker state\'s next scan call or its destruction.
+
+    __C declaration:__ @struct _duckdb_v2_column_data_collection_worker_scan_state@
+
+    __defined at:__ @duckdb_v2.h 1229:16@
+
+    __exported by:__ @duckdb_v2.h@
+-}
+data DuckDBV2ColumnDataCollectionWorkerScanStateStruct
+
+instance Marshal.StaticSize DuckDBV2ColumnDataCollectionWorkerScanStateStruct where
+
+  staticSizeOf = \_ -> (8 :: Int)
+
+  staticAlignment = \_ -> (8 :: Int)
+
+{-| Opaque state handle for local state while scanning a column data collection. This is used to track progress and any other state that needs to be maintained on a per-thread basis across calls while scanning the collection. It also keeps the buffers backing the most recently scanned chunk alive: chunks are scanned zero-copy, so a scanned chunk\'s data is only valid until the worker state\'s next scan call or its destruction.
+
+    __C declaration:__ @duckdb_v2_column_data_collection_worker_scan_state_handle@
+
+    __defined at:__ @duckdb_v2.h 1231:5@
+
+    __exported by:__ @duckdb_v2.h@
+-}
+newtype DuckDBV2ColumnDataCollectionWorkerScanStateHandle = DuckDBV2ColumnDataCollectionWorkerScanStateHandle
+  { unwrap :: BG.Ptr DuckDBV2ColumnDataCollectionWorkerScanStateStruct
+  }
+  deriving stock (Eq, BG.Generic, Ord, Show)
+  deriving newtype
+    ( BG.HasFFIType
+    , Marshal.ReadRaw
+    , Marshal.StaticSize
+    , BG.Storable
+    , Marshal.WriteRaw
+    )
+
+instance ( ty ~ BG.Ptr DuckDBV2ColumnDataCollectionWorkerScanStateStruct
+         ) => BG.CompatHasField.HasField "unwrap" DuckDBV2ColumnDataCollectionWorkerScanStateHandle ty where
+
+  hasField =
+    \x0 ->
+      ( \y1 ->
+          DuckDBV2ColumnDataCollectionWorkerScanStateHandle {unwrap = y1}
+      , BG.getField @"unwrap" x0
+      )
+
+instance ( ty ~ BG.Ptr DuckDBV2ColumnDataCollectionWorkerScanStateStruct
+         ) => BG.HasField "unwrap" (BG.Ptr DuckDBV2ColumnDataCollectionWorkerScanStateHandle) (BG.Ptr ty) where
+
+  getField = HasCField.fromPtr (BG.Proxy @"unwrap")
+
+instance HasCField.HasCField DuckDBV2ColumnDataCollectionWorkerScanStateHandle "unwrap" where
+
+  type CFieldType DuckDBV2ColumnDataCollectionWorkerScanStateHandle "unwrap" =
+    BG.Ptr DuckDBV2ColumnDataCollectionWorkerScanStateStruct
+
+  offset# = \_ -> \_ -> 0
+
+{-| Opaque state handle for appending to a column data collection. This is used to track progress and any other state that needs to be maintained across calls while appending to the collection.
+
+    __C declaration:__ @struct _duckdb_v2_column_data_collection_append_state@
+
+    __defined at:__ @duckdb_v2.h 1237:16@
+
+    __exported by:__ @duckdb_v2.h@
+-}
+data DuckDBV2ColumnDataCollectionAppendStateStruct
+
+instance Marshal.StaticSize DuckDBV2ColumnDataCollectionAppendStateStruct where
+
+  staticSizeOf = \_ -> (8 :: Int)
+
+  staticAlignment = \_ -> (8 :: Int)
+
+{-| Opaque state handle for appending to a column data collection. This is used to track progress and any other state that needs to be maintained across calls while appending to the collection.
+
+    __C declaration:__ @duckdb_v2_column_data_collection_append_state_handle@
+
+    __defined at:__ @duckdb_v2.h 1239:5@
+
+    __exported by:__ @duckdb_v2.h@
+-}
+newtype DuckDBV2ColumnDataCollectionAppendStateHandle = DuckDBV2ColumnDataCollectionAppendStateHandle
+  { unwrap :: BG.Ptr DuckDBV2ColumnDataCollectionAppendStateStruct
+  }
+  deriving stock (Eq, BG.Generic, Ord, Show)
+  deriving newtype
+    ( BG.HasFFIType
+    , Marshal.ReadRaw
+    , Marshal.StaticSize
+    , BG.Storable
+    , Marshal.WriteRaw
+    )
+
+instance ( ty ~ BG.Ptr DuckDBV2ColumnDataCollectionAppendStateStruct
+         ) => BG.CompatHasField.HasField "unwrap" DuckDBV2ColumnDataCollectionAppendStateHandle ty where
+
+  hasField =
+    \x0 ->
+      ( \y1 ->
+          DuckDBV2ColumnDataCollectionAppendStateHandle {unwrap = y1}
+      , BG.getField @"unwrap" x0
+      )
+
+instance ( ty ~ BG.Ptr DuckDBV2ColumnDataCollectionAppendStateStruct
+         ) => BG.HasField "unwrap" (BG.Ptr DuckDBV2ColumnDataCollectionAppendStateHandle) (BG.Ptr ty) where
+
+  getField = HasCField.fromPtr (BG.Proxy @"unwrap")
+
+instance HasCField.HasCField DuckDBV2ColumnDataCollectionAppendStateHandle "unwrap" where
+
+  type CFieldType DuckDBV2ColumnDataCollectionAppendStateHandle "unwrap" =
+    BG.Ptr DuckDBV2ColumnDataCollectionAppendStateStruct
+
+  offset# = \_ -> \_ -> 0
+
+{-| The scope of an option\'s value. Writes take DEFAULT, GLOBAL or SESSION: DEFAULT writes to the option\'s default scope ( @duckdb_v2_option_get_default_scope()@ ), like SQL @SET name = value@ ; GLOBAL writes through to the instance, visible to all connections, like @SET GLOBAL@ ; SESSION writes to one connection\'s session only, like @SET SESSION@ . Reads report GLOBAL or SESSION, as DuckDB attributes the value: an option no scope sets reads as GLOBAL, its default, and a legacy option read through a connection or context reads as SESSION.
+
+    __C declaration:__ @enum DUCKDB_V2_SETTING_SCOPE@
+
+    __defined at:__ @duckdb_v2.h 1553:14@
+
+    __exported by:__ @duckdb_v2.h@
+-}
+newtype DuckDBV2SettingScope = DuckDBV2SettingScope
+  { unwrap :: BG.CUInt
+  }
+  deriving stock (Eq, BG.Generic, Ord)
+  deriving newtype (BG.HasFFIType)
+
+instance Marshal.StaticSize DuckDBV2SettingScope where
+
+  staticSizeOf = \_ -> (4 :: Int)
+
+  staticAlignment = \_ -> (4 :: Int)
+
+instance Marshal.ReadRaw DuckDBV2SettingScope where
+
+  readRaw =
+    \ptr0 ->
+          pure DuckDBV2SettingScope
+      <*> Marshal.readRawByteOff ptr0 (0 :: Int)
+
+instance Marshal.WriteRaw DuckDBV2SettingScope where
+
+  writeRaw =
+    \ptr0 ->
+      \s1 ->
+        case s1 of
+          DuckDBV2SettingScope unwrap2 ->
+            Marshal.writeRawByteOff ptr0 (0 :: Int) unwrap2
+
+deriving via Marshal.EquivStorable DuckDBV2SettingScope instance BG.Storable DuckDBV2SettingScope
+
+deriving via BG.CUInt instance BG.Prim DuckDBV2SettingScope
+
+instance CEnum.CEnum DuckDBV2SettingScope where
+
+  type CEnumZ DuckDBV2SettingScope = BG.CUInt
+
+  toCEnum = DuckDBV2SettingScope
+
+  fromCEnum = BG.getField @"unwrap"
+
+  declaredValues =
+    \_ ->
+      CEnum.declaredValuesFromList [ (0, BG.singleton "DuckDBV2SettingScopeDefault")
+                                   , (1, BG.singleton "DuckDBV2SettingScopeGlobal")
+                                   , (2, BG.singleton "DuckDBV2SettingScopeSession")
+                                   , (2147483647, BG.singleton "DuckDBV2SettingScopeMaxEnum")
+                                   ]
+
+  showsUndeclared =
+    CEnum.showsWrappedUndeclared "DuckDBV2SettingScope"
+
+  readPrecUndeclared =
+    CEnum.readPrecWrappedUndeclared "DuckDBV2SettingScope"
+
+instance Show DuckDBV2SettingScope where
+
+  showsPrec = CEnum.shows
+
+instance Read DuckDBV2SettingScope where
+
+  readPrec = CEnum.readPrec
+
+  readList = BG.readListDefault
+
+  readListPrec = BG.readListPrecDefault
+
+instance ( ty ~ BG.CUInt
+         ) => BG.CompatHasField.HasField "unwrap" DuckDBV2SettingScope ty where
+
+  hasField =
+    \x0 ->
+      (\y1 ->
+         DuckDBV2SettingScope {unwrap = y1}, BG.getField @"unwrap" x0)
+
+instance ( ty ~ BG.CUInt
+         ) => BG.HasField "unwrap" (BG.Ptr DuckDBV2SettingScope) (BG.Ptr ty) where
+
+  getField = HasCField.fromPtr (BG.Proxy @"unwrap")
+
+instance HasCField.HasCField DuckDBV2SettingScope "unwrap" where
+
+  type CFieldType DuckDBV2SettingScope "unwrap" =
+    BG.CUInt
+
+  offset# = \_ -> \_ -> 0
+
+{-| Write only: the option\'s default scope ( @duckdb_v2_option_get_default_scope()@ ), not its default value.
+
+    __C declaration:__ @DUCKDB_V2_SETTING_SCOPE_DEFAULT@
+
+    __defined at:__ @duckdb_v2.h 1555:2@
+
+    __exported by:__ @duckdb_v2.h@
+-}
+pattern DuckDBV2SettingScopeDefault :: DuckDBV2SettingScope
+pattern DuckDBV2SettingScopeDefault = DuckDBV2SettingScope 0
+
+{-| The instance\'s value, visible to all connections.
+
+    __C declaration:__ @DUCKDB_V2_SETTING_SCOPE_GLOBAL@
+
+    __defined at:__ @duckdb_v2.h 1558:2@
+
+    __exported by:__ @duckdb_v2.h@
+-}
+pattern DuckDBV2SettingScopeGlobal :: DuckDBV2SettingScope
+pattern DuckDBV2SettingScopeGlobal = DuckDBV2SettingScope 1
+
+{-| A connection\'s session value.
+
+    __C declaration:__ @DUCKDB_V2_SETTING_SCOPE_SESSION@
+
+    __defined at:__ @duckdb_v2.h 1561:2@
+
+    __exported by:__ @duckdb_v2.h@
+-}
+pattern DuckDBV2SettingScopeSession :: DuckDBV2SettingScope
+pattern DuckDBV2SettingScopeSession = DuckDBV2SettingScope 2
+
+{-| __C declaration:__ @DUCKDB_V2_SETTING_SCOPE_MAX_ENUM@
+
+    __defined at:__ @duckdb_v2.h 1562:2@
+
+    __exported by:__ @duckdb_v2.h@
+-}
+pattern DuckDBV2SettingScopeMaxEnum :: DuckDBV2SettingScope
+pattern DuckDBV2SettingScopeMaxEnum = DuckDBV2SettingScope 2147483647
+
+{-| An owned opaque handle to a custom type being built. Created with @duckdb_v2_custom_type_create()@ , configured with @duckdb_v2_custom_type_set_name()@ and @duckdb_v2_custom_type_set_base_type()@ , made available with @duckdb_v2_connection_register_custom_type()@ or @duckdb_v2_extension_register_custom_type()@ , and destroyed with @duckdb_v2_custom_type_destroy()@ .
+
+    __C declaration:__ @struct _duckdb_v2_custom_type@
+
+    __defined at:__ @duckdb_v2.h 2069:16@
+
+    __exported by:__ @duckdb_v2.h@
+-}
+data DuckDBV2CustomTypeStruct
+
+instance Marshal.StaticSize DuckDBV2CustomTypeStruct where
+
+  staticSizeOf = \_ -> (8 :: Int)
+
+  staticAlignment = \_ -> (8 :: Int)
+
+{-| An owned opaque handle to a custom type being built. Created with @duckdb_v2_custom_type_create()@ , configured with @duckdb_v2_custom_type_set_name()@ and @duckdb_v2_custom_type_set_base_type()@ , made available with @duckdb_v2_connection_register_custom_type()@ or @duckdb_v2_extension_register_custom_type()@ , and destroyed with @duckdb_v2_custom_type_destroy()@ .
+
+    __C declaration:__ @duckdb_v2_custom_type_handle@
+
+    __defined at:__ @duckdb_v2.h 2071:5@
+
+    __exported by:__ @duckdb_v2.h@
+-}
+newtype DuckDBV2CustomTypeHandle = DuckDBV2CustomTypeHandle
+  { unwrap :: BG.Ptr DuckDBV2CustomTypeStruct
+  }
+  deriving stock (Eq, BG.Generic, Ord, Show)
+  deriving newtype
+    ( BG.HasFFIType
+    , Marshal.ReadRaw
+    , Marshal.StaticSize
+    , BG.Storable
+    , Marshal.WriteRaw
+    )
+
+instance ( ty ~ BG.Ptr DuckDBV2CustomTypeStruct
+         ) => BG.CompatHasField.HasField "unwrap" DuckDBV2CustomTypeHandle ty where
+
+  hasField =
+    \x0 ->
+      (\y1 ->
+         DuckDBV2CustomTypeHandle {unwrap = y1}, BG.getField @"unwrap" x0)
+
+instance ( ty ~ BG.Ptr DuckDBV2CustomTypeStruct
+         ) => BG.HasField "unwrap" (BG.Ptr DuckDBV2CustomTypeHandle) (BG.Ptr ty) where
+
+  getField = HasCField.fromPtr (BG.Proxy @"unwrap")
+
+instance HasCField.HasCField DuckDBV2CustomTypeHandle "unwrap" where
+
+  type CFieldType DuckDBV2CustomTypeHandle "unwrap" =
+    BG.Ptr DuckDBV2CustomTypeStruct
+
+  offset# = \_ -> \_ -> 0
+
+{-| Auxiliary type used by t'DuckDBV2ExtensionGetApiFn'
+
+    __C declaration:__ @duckdb_v2_extension_get_api_fn@
+
+    __defined at:__ @duckdb_v2.h 2609:23@
+
+    __exported by:__ @duckdb_v2.h@
+-}
+newtype DuckDBV2ExtensionGetApiFn_Aux = DuckDBV2ExtensionGetApiFn_Aux
+  { unwrap :: DuckDBV2ExtensionHandle -> PtrConst.PtrConst BG.CChar -> IO (PtrConst.PtrConst BG.Void)
+  }
+  deriving stock (BG.Generic)
+
+-- __unique:__ @toDuckDBV2ExtensionGetApiFn_Aux@
+foreign import ccall safe "wrapper" hs_bindgen_182375870cb695de_base ::
+     (BG.Ptr BG.Void -> BG.Ptr BG.Void -> IO (BG.Ptr BG.Void))
+  -> IO (BG.FunPtr (BG.Ptr BG.Void -> BG.Ptr BG.Void -> IO (BG.Ptr BG.Void)))
+
+-- __unique:__ @toDuckDBV2ExtensionGetApiFn_Aux@
+hs_bindgen_182375870cb695de ::
+     DuckDBV2ExtensionGetApiFn_Aux
+  -> IO (BG.FunPtr DuckDBV2ExtensionGetApiFn_Aux)
+hs_bindgen_182375870cb695de =
+  \fun0 ->
+    fmap BG.castFunPtr (hs_bindgen_182375870cb695de_base (\x1 ->
+                                                            \x2 ->
+                                                              fmap BG.toFFIType (BG.getField @"unwrap" fun0 (BG.fromFFIType x1) (BG.fromFFIType x2))))
+
+-- __unique:__ @fromDuckDBV2ExtensionGetApiFn_Aux@
+foreign import ccall safe "dynamic" hs_bindgen_cc11c261f11e00d7_base ::
+     BG.FunPtr (BG.Ptr BG.Void -> BG.Ptr BG.Void -> IO (BG.Ptr BG.Void))
+  -> BG.Ptr BG.Void -> BG.Ptr BG.Void -> IO (BG.Ptr BG.Void)
+
+-- __unique:__ @fromDuckDBV2ExtensionGetApiFn_Aux@
+hs_bindgen_cc11c261f11e00d7 ::
+     BG.FunPtr DuckDBV2ExtensionGetApiFn_Aux
+  -> DuckDBV2ExtensionGetApiFn_Aux
+hs_bindgen_cc11c261f11e00d7 =
+  \funPtr0 ->
+    DuckDBV2ExtensionGetApiFn_Aux (\x1 ->
+                                     \x2 ->
+                                       fmap BG.fromFFIType (hs_bindgen_cc11c261f11e00d7_base (BG.castFunPtr funPtr0) (BG.toFFIType x1) (BG.toFFIType x2)))
+
+instance BG.ToFunPtr DuckDBV2ExtensionGetApiFn_Aux where
+
+  toFunPtr = hs_bindgen_182375870cb695de
+
+instance BG.FromFunPtr DuckDBV2ExtensionGetApiFn_Aux where
+
+  fromFunPtr = hs_bindgen_cc11c261f11e00d7
+
+instance ( ty ~ (DuckDBV2ExtensionHandle -> PtrConst.PtrConst BG.CChar -> IO (PtrConst.PtrConst BG.Void))
+         ) => BG.CompatHasField.HasField "unwrap" DuckDBV2ExtensionGetApiFn_Aux ty where
+
+  hasField =
+    \x0 ->
+      ( \y1 -> DuckDBV2ExtensionGetApiFn_Aux {unwrap = y1}
+      , BG.getField @"unwrap" x0
+      )
+
+instance ( ty ~ (DuckDBV2ExtensionHandle -> PtrConst.PtrConst BG.CChar -> IO (PtrConst.PtrConst BG.Void))
+         ) => BG.HasField "unwrap" (BG.Ptr DuckDBV2ExtensionGetApiFn_Aux) (BG.Ptr ty) where
+
+  getField = HasCField.fromPtr (BG.Proxy @"unwrap")
+
+instance HasCField.HasCField DuckDBV2ExtensionGetApiFn_Aux "unwrap" where
+
+  type CFieldType DuckDBV2ExtensionGetApiFn_Aux "unwrap" =
+    DuckDBV2ExtensionHandle -> PtrConst.PtrConst BG.CChar -> IO (PtrConst.PtrConst BG.Void)
+
+  offset# = \_ -> \_ -> 0
+
+{-| Hands back the function-pointer table for the API version the extension was built against, or NULL if this DuckDB cannot serve it.
+
+    The extension calls it exactly once, first, through DUCKDB_EXTENSION_API_INIT; nothing else in the API may be called before it succeeds. A NULL return means the load has already failed and DuckDB has recorded why, so the entrypoint must return without touching the error slot. Statically linked extensions resolve DuckDB\'s symbols at link time and never call it, so for those the field is NULL.
+
+    __C declaration:__ @duckdb_v2_extension_get_api_fn@
+
+    __defined at:__ @duckdb_v2.h 2609:23@
+
+    __exported by:__ @duckdb_v2.h@
+-}
+newtype DuckDBV2ExtensionGetApiFn = DuckDBV2ExtensionGetApiFn
+  { unwrap :: BG.FunPtr DuckDBV2ExtensionGetApiFn_Aux
+  }
+  deriving stock (Eq, BG.Generic, Ord, Show)
+  deriving newtype
+    ( BG.HasFFIType
+    , Marshal.ReadRaw
+    , Marshal.StaticSize
+    , BG.Storable
+    , Marshal.WriteRaw
+    )
+
+instance ( ty ~ BG.FunPtr DuckDBV2ExtensionGetApiFn_Aux
+         ) => BG.CompatHasField.HasField "unwrap" DuckDBV2ExtensionGetApiFn ty where
+
+  hasField =
+    \x0 ->
+      (\y1 ->
+         DuckDBV2ExtensionGetApiFn {unwrap = y1}, BG.getField @"unwrap" x0)
+
+instance ( ty ~ BG.FunPtr DuckDBV2ExtensionGetApiFn_Aux
+         ) => BG.HasField "unwrap" (BG.Ptr DuckDBV2ExtensionGetApiFn) (BG.Ptr ty) where
+
+  getField = HasCField.fromPtr (BG.Proxy @"unwrap")
+
+instance HasCField.HasCField DuckDBV2ExtensionGetApiFn "unwrap" where
+
+  type CFieldType DuckDBV2ExtensionGetApiFn "unwrap" =
+    BG.FunPtr DuckDBV2ExtensionGetApiFn_Aux
+
+  offset# = \_ -> \_ -> 0
+
+{-| The single argument to a V2 C extension entrypoint. Borrowed for the duration of the call: none of its fields outlive the entrypoint, and the extension destroys none of them.
+
+    __C declaration:__ @struct duckdb_v2_extension_input@
+
+    __defined at:__ @duckdb_v2.h 2619:8@
+
+    __exported by:__ @duckdb_v2.h@
+-}
+data DuckDBV2ExtensionInput = DuckDBV2ExtensionInput
+  { get_api :: DuckDBV2ExtensionGetApiFn
+    {- ^ Fetches the versioned function-pointer table. NULL for a statically linked extension.
+
+         __C declaration:__ @get_api@
+
+         __defined at:__ @duckdb_v2.h 2621:33@
+
+         __exported by:__ @duckdb_v2.h@
+    -}
+  , extension :: DuckDBV2ExtensionHandle
+    {- ^ The extension being loaded, and the token get_api takes.
+
+         __C declaration:__ @extension@
+
+         __defined at:__ @duckdb_v2.h 2624:29@
+
+         __exported by:__ @duckdb_v2.h@
+    -}
+  , context :: DuckDBV2ContextHandle
+    {- ^ A borrowed context to read and run queries through, with a transaction already active. Valid only until the extension entrypoint returns; do not retain or destroy it.
+
+         __C declaration:__ @context@
+
+         __defined at:__ @duckdb_v2.h 2630:27@
+
+         __exported by:__ @duckdb_v2.h@
+    -}
+  , err :: BG.Ptr DuckDBV2ErrorInfoHandle
+    {- ^ A live error slot: never NULL, and never pointing at NULL. Populate it with error_info_set_code, and optionally error_info_set_text, to fail the load. Do not destroy it DuckDB owns it. Pass a slot of your own to calls whose failure you intend to handle, so only a failure you mean to abort the load with lands here.
+
+         __C declaration:__ @err@
+
+         __defined at:__ @duckdb_v2.h 2637:31@
+
+         __exported by:__ @duckdb_v2.h@
+    -}
+  }
+  deriving stock (Eq, BG.Generic, Show)
+
+instance Marshal.StaticSize DuckDBV2ExtensionInput where
+
+  staticSizeOf = \_ -> (32 :: Int)
+
+  staticAlignment = \_ -> (8 :: Int)
+
+instance Marshal.ReadRaw DuckDBV2ExtensionInput where
+
+  readRaw =
+    \ptr0 ->
+          pure DuckDBV2ExtensionInput
+      <*> HasCField.readRaw (BG.Proxy @"get_api") ptr0
+      <*> HasCField.readRaw (BG.Proxy @"extension") ptr0
+      <*> HasCField.readRaw (BG.Proxy @"context") ptr0
+      <*> HasCField.readRaw (BG.Proxy @"err") ptr0
+
+instance Marshal.WriteRaw DuckDBV2ExtensionInput where
+
+  writeRaw =
+    \ptr0 ->
+      \s1 ->
+        case s1 of
+          DuckDBV2ExtensionInput get_api2 extension3 context4 err5 ->
+               HasCField.writeRaw (BG.Proxy @"get_api") ptr0 get_api2
+            >> HasCField.writeRaw (BG.Proxy @"extension") ptr0 extension3
+            >> HasCField.writeRaw (BG.Proxy @"context") ptr0 context4
+            >> HasCField.writeRaw (BG.Proxy @"err") ptr0 err5
+
+deriving via Marshal.EquivStorable DuckDBV2ExtensionInput instance BG.Storable DuckDBV2ExtensionInput
+
+deriving via Struct.IsStructViaReadRaw DuckDBV2ExtensionInput instance Struct.IsStruct DuckDBV2ExtensionInput
+
+{-| Fetches the versioned function-pointer table. NULL for a statically linked extension.
+
+    __C declaration:__ @get_api@
+
+    __defined at:__ @duckdb_v2.h 2621:33@
+
+    __exported by:__ @duckdb_v2.h@
+-}
+instance ( ty ~ DuckDBV2ExtensionGetApiFn
+         ) => BG.CompatHasField.HasField "get_api" DuckDBV2ExtensionInput ty where
+
+  hasField =
+    \x0 ->
+      ( \y1 ->
+          DuckDBV2ExtensionInput { get_api = y1
+                                 , extension = BG.getField @"extension" x0
+                                 , context = BG.getField @"context" x0
+                                 , err = BG.getField @"err" x0
+                                 }
+      , BG.getField @"get_api" x0
+      )
+
+instance ( ty ~ DuckDBV2ExtensionGetApiFn
+         ) => BG.HasField "get_api" (BG.Ptr DuckDBV2ExtensionInput) (BG.Ptr ty) where
+
+  getField = HasCField.fromPtr (BG.Proxy @"get_api")
+
+instance HasCField.HasCField DuckDBV2ExtensionInput "get_api" where
+
+  type CFieldType DuckDBV2ExtensionInput "get_api" =
+    DuckDBV2ExtensionGetApiFn
+
+  offset# = \_ -> \_ -> 0
+
+{-| The extension being loaded, and the token get_api takes.
+
+    __C declaration:__ @extension@
+
+    __defined at:__ @duckdb_v2.h 2624:29@
+
+    __exported by:__ @duckdb_v2.h@
+-}
+instance ( ty ~ DuckDBV2ExtensionHandle
+         ) => BG.CompatHasField.HasField "extension" DuckDBV2ExtensionInput ty where
+
+  hasField =
+    \x0 ->
+      ( \y1 ->
+          DuckDBV2ExtensionInput { extension = y1
+                                 , get_api = BG.getField @"get_api" x0
+                                 , context = BG.getField @"context" x0
+                                 , err = BG.getField @"err" x0
+                                 }
+      , BG.getField @"extension" x0
+      )
+
+instance ( ty ~ DuckDBV2ExtensionHandle
+         ) => BG.HasField "extension" (BG.Ptr DuckDBV2ExtensionInput) (BG.Ptr ty) where
+
+  getField = HasCField.fromPtr (BG.Proxy @"extension")
+
+instance HasCField.HasCField DuckDBV2ExtensionInput "extension" where
+
+  type CFieldType DuckDBV2ExtensionInput "extension" =
+    DuckDBV2ExtensionHandle
+
+  offset# = \_ -> \_ -> 8
+
+{-| A borrowed context to read and run queries through, with a transaction already active. Valid only until the extension entrypoint returns; do not retain or destroy it.
+
+    __C declaration:__ @context@
+
+    __defined at:__ @duckdb_v2.h 2630:27@
+
+    __exported by:__ @duckdb_v2.h@
+-}
+instance ( ty ~ DuckDBV2ContextHandle
+         ) => BG.CompatHasField.HasField "context" DuckDBV2ExtensionInput ty where
+
+  hasField =
+    \x0 ->
+      ( \y1 ->
+          DuckDBV2ExtensionInput { context = y1
+                                 , get_api = BG.getField @"get_api" x0
+                                 , extension = BG.getField @"extension" x0
+                                 , err = BG.getField @"err" x0
+                                 }
+      , BG.getField @"context" x0
+      )
+
+instance ( ty ~ DuckDBV2ContextHandle
+         ) => BG.HasField "context" (BG.Ptr DuckDBV2ExtensionInput) (BG.Ptr ty) where
+
+  getField = HasCField.fromPtr (BG.Proxy @"context")
+
+instance HasCField.HasCField DuckDBV2ExtensionInput "context" where
+
+  type CFieldType DuckDBV2ExtensionInput "context" =
+    DuckDBV2ContextHandle
+
+  offset# = \_ -> \_ -> 16
+
+{-| A live error slot: never NULL, and never pointing at NULL. Populate it with error_info_set_code, and optionally error_info_set_text, to fail the load. Do not destroy it DuckDB owns it. Pass a slot of your own to calls whose failure you intend to handle, so only a failure you mean to abort the load with lands here.
+
+    __C declaration:__ @err@
+
+    __defined at:__ @duckdb_v2.h 2637:31@
+
+    __exported by:__ @duckdb_v2.h@
+-}
+instance ( ty ~ BG.Ptr DuckDBV2ErrorInfoHandle
+         ) => BG.CompatHasField.HasField "err" DuckDBV2ExtensionInput ty where
+
+  hasField =
+    \x0 ->
+      ( \y1 ->
+          DuckDBV2ExtensionInput { err = y1
+                                 , get_api = BG.getField @"get_api" x0
+                                 , extension = BG.getField @"extension" x0
+                                 , context = BG.getField @"context" x0
+                                 }
+      , BG.getField @"err" x0
+      )
+
+instance ( ty ~ BG.Ptr DuckDBV2ErrorInfoHandle
+         ) => BG.HasField "err" (BG.Ptr DuckDBV2ExtensionInput) (BG.Ptr ty) where
+
+  getField = HasCField.fromPtr (BG.Proxy @"err")
+
+instance HasCField.HasCField DuckDBV2ExtensionInput "err" where
+
+  type CFieldType DuckDBV2ExtensionInput "err" =
+    BG.Ptr DuckDBV2ErrorInfoHandle
+
+  offset# = \_ -> \_ -> 24
+
+{-| How @duckdb_v2_file_system_open()@ opens a file. These are not a bitmask apply them one at a time with @duckdb_v2_file_open_options_set_flag()@ , calling it once per behaviour you want, e.g. @FILE_FLAG_WRITE@ then @FILE_FLAG_CREATE@ to write to a file and create it when it does not exist.
+
+    __C declaration:__ @enum DUCKDB_V2_FILE_FLAG@
+
+    __defined at:__ @duckdb_v2.h 2735:14@
+
+    __exported by:__ @duckdb_v2.h@
+-}
+newtype DuckDBV2FileFlag = DuckDBV2FileFlag
+  { unwrap :: BG.CUInt
+  }
+  deriving stock (Eq, BG.Generic, Ord)
+  deriving newtype (BG.HasFFIType)
+
+instance Marshal.StaticSize DuckDBV2FileFlag where
+
+  staticSizeOf = \_ -> (4 :: Int)
+
+  staticAlignment = \_ -> (4 :: Int)
+
+instance Marshal.ReadRaw DuckDBV2FileFlag where
+
+  readRaw =
+    \ptr0 ->
+          pure DuckDBV2FileFlag
+      <*> Marshal.readRawByteOff ptr0 (0 :: Int)
+
+instance Marshal.WriteRaw DuckDBV2FileFlag where
+
+  writeRaw =
+    \ptr0 ->
+      \s1 ->
+        case s1 of
+          DuckDBV2FileFlag unwrap2 ->
+            Marshal.writeRawByteOff ptr0 (0 :: Int) unwrap2
+
+deriving via Marshal.EquivStorable DuckDBV2FileFlag instance BG.Storable DuckDBV2FileFlag
+
+deriving via BG.CUInt instance BG.Prim DuckDBV2FileFlag
+
+instance CEnum.CEnum DuckDBV2FileFlag where
+
+  type CEnumZ DuckDBV2FileFlag = BG.CUInt
+
+  toCEnum = DuckDBV2FileFlag
+
+  fromCEnum = BG.getField @"unwrap"
+
+  declaredValues =
+    \_ ->
+      CEnum.declaredValuesFromList [ (0, BG.singleton "DuckDBV2FileFlagInvalid")
+                                   , (1, BG.singleton "DuckDBV2FileFlagRead")
+                                   , (2, BG.singleton "DuckDBV2FileFlagWrite")
+                                   , (3, BG.singleton "DuckDBV2FileFlagCreate")
+                                   , (4, BG.singleton "DuckDBV2FileFlagCreateNew")
+                                   , (5, BG.singleton "DuckDBV2FileFlagAppend")
+                                   , (6, BG.singleton "DuckDBV2FileFlagExclusiveCreate")
+                                   , (7, BG.singleton "DuckDBV2FileFlagParallelAccess")
+                                   , (8, BG.singleton "DuckDBV2FileFlagExternalFileCache")
+                                   , (2147483647, BG.singleton "DuckDBV2FileFlagMaxEnum")
+                                   ]
+
+  showsUndeclared =
+    CEnum.showsWrappedUndeclared "DuckDBV2FileFlag"
+
+  readPrecUndeclared =
+    CEnum.readPrecWrappedUndeclared "DuckDBV2FileFlag"
+
+instance Show DuckDBV2FileFlag where
+
+  showsPrec = CEnum.shows
+
+instance Read DuckDBV2FileFlag where
+
+  readPrec = CEnum.readPrec
+
+  readList = BG.readListDefault
+
+  readListPrec = BG.readListPrecDefault
+
+instance ( ty ~ BG.CUInt
+         ) => BG.CompatHasField.HasField "unwrap" DuckDBV2FileFlag ty where
+
+  hasField =
+    \x0 ->
+      (\y1 ->
+         DuckDBV2FileFlag {unwrap = y1}, BG.getField @"unwrap" x0)
+
+instance ( ty ~ BG.CUInt
+         ) => BG.HasField "unwrap" (BG.Ptr DuckDBV2FileFlag) (BG.Ptr ty) where
+
+  getField = HasCField.fromPtr (BG.Proxy @"unwrap")
+
+instance HasCField.HasCField DuckDBV2FileFlag "unwrap" where
+
+  type CFieldType DuckDBV2FileFlag "unwrap" = BG.CUInt
+
+  offset# = \_ -> \_ -> 0
+
+{-| Not a flag. The zero value, so that an uninitialized variable does not name a behaviour; applying it is an error.
+
+    __C declaration:__ @DUCKDB_V2_FILE_FLAG_INVALID@
+
+    __defined at:__ @duckdb_v2.h 2738:2@
+
+    __exported by:__ @duckdb_v2.h@
+-}
+pattern DuckDBV2FileFlagInvalid :: DuckDBV2FileFlag
+pattern DuckDBV2FileFlagInvalid = DuckDBV2FileFlag 0
+
+{-| Open the file with "read" capabilities.
+
+    __C declaration:__ @DUCKDB_V2_FILE_FLAG_READ@
+
+    __defined at:__ @duckdb_v2.h 2741:2@
+
+    __exported by:__ @duckdb_v2.h@
+-}
+pattern DuckDBV2FileFlagRead :: DuckDBV2FileFlag
+pattern DuckDBV2FileFlagRead = DuckDBV2FileFlag 1
+
+{-| Open the file with "write" capabilities.
+
+    __C declaration:__ @DUCKDB_V2_FILE_FLAG_WRITE@
+
+    __defined at:__ @duckdb_v2.h 2744:2@
+
+    __exported by:__ @duckdb_v2.h@
+-}
+pattern DuckDBV2FileFlagWrite :: DuckDBV2FileFlag
+pattern DuckDBV2FileFlagWrite = DuckDBV2FileFlag 2
+
+{-| Create the file if it does not exist, and open it as it is if it does.
+
+    __C declaration:__ @DUCKDB_V2_FILE_FLAG_CREATE@
+
+    __defined at:__ @duckdb_v2.h 2747:2@
+
+    __exported by:__ @duckdb_v2.h@
+-}
+pattern DuckDBV2FileFlagCreate :: DuckDBV2FileFlag
+pattern DuckDBV2FileFlagCreate = DuckDBV2FileFlag 3
+
+{-| Create the file if it does not exist, and truncate it to empty if it does. To fail instead of truncating, combine @FILE_FLAG_CREATE@ with @FILE_FLAG_EXCLUSIVE_CREATE@ .
+
+    __C declaration:__ @DUCKDB_V2_FILE_FLAG_CREATE_NEW@
+
+    __defined at:__ @duckdb_v2.h 2753:2@
+
+    __exported by:__ @duckdb_v2.h@
+-}
+pattern DuckDBV2FileFlagCreateNew :: DuckDBV2FileFlag
+pattern DuckDBV2FileFlagCreateNew = DuckDBV2FileFlag 4
+
+{-| Open the file in "append" mode.
+
+    __C declaration:__ @DUCKDB_V2_FILE_FLAG_APPEND@
+
+    __defined at:__ @duckdb_v2.h 2756:2@
+
+    __exported by:__ @duckdb_v2.h@
+-}
+pattern DuckDBV2FileFlagAppend :: DuckDBV2FileFlag
+pattern DuckDBV2FileFlagAppend = DuckDBV2FileFlag 5
+
+{-| Fail if the file already exists. A modifier on @FILE_FLAG_CREATE@ , and meaningless without it.
+
+    __C declaration:__ @DUCKDB_V2_FILE_FLAG_EXCLUSIVE_CREATE@
+
+    __defined at:__ @duckdb_v2.h 2759:2@
+
+    __exported by:__ @duckdb_v2.h@
+-}
+pattern DuckDBV2FileFlagExclusiveCreate :: DuckDBV2FileFlag
+pattern DuckDBV2FileFlagExclusiveCreate = DuckDBV2FileFlag 6
+
+{-| The file will be read and written at explicit offsets from several threads at once. Pass it whenever @duckdb_v2_file_read_at()@ or @duckdb_v2_file_write_at()@ are used concurrently a file system that would otherwise assume sequential access, by caching, buffering, or keeping a single cursor, needs to know not to.
+
+    __C declaration:__ @DUCKDB_V2_FILE_FLAG_PARALLEL_ACCESS@
+
+    __defined at:__ @duckdb_v2.h 2766:2@
+
+    __exported by:__ @duckdb_v2.h@
+-}
+pattern DuckDBV2FileFlagParallelAccess :: DuckDBV2FileFlag
+pattern DuckDBV2FileFlagParallelAccess = DuckDBV2FileFlag 7
+
+{-| Read the file through DuckDB\'s external file cache, which keeps the bytes that were read in memory, so that later reads of the same file - also by later queries - do not have to read them again. Whether a local file is cached is decided by the @cache_local_files@ setting. Only meaningful for reading.
+
+    __C declaration:__ @DUCKDB_V2_FILE_FLAG_EXTERNAL_FILE_CACHE@
+
+    __defined at:__ @duckdb_v2.h 2773:2@
+
+    __exported by:__ @duckdb_v2.h@
+-}
+pattern DuckDBV2FileFlagExternalFileCache :: DuckDBV2FileFlag
+pattern DuckDBV2FileFlagExternalFileCache = DuckDBV2FileFlag 8
+
+{-| __C declaration:__ @DUCKDB_V2_FILE_FLAG_MAX_ENUM@
+
+    __defined at:__ @duckdb_v2.h 2774:2@
+
+    __exported by:__ @duckdb_v2.h@
+-}
+pattern DuckDBV2FileFlagMaxEnum :: DuckDBV2FileFlag
+pattern DuckDBV2FileFlagMaxEnum = DuckDBV2FileFlag 2147483647
+
+{-| A borrowed opaque handle to a file system. Obtained from @duckdb_v2_instance_get_file_system()@ , @duckdb_v2_connection_get_file_system()@ or @duckdb_v2_context_get_file_system()@ , and used to open files with @duckdb_v2_file_system_open()@ . Borrowed: the handle belongs to the instance, connection or context it came from, is valid only for as long as that is, and must not be destroyed.
+
+    __C declaration:__ @struct _duckdb_v2_file_system@
+
+    __defined at:__ @duckdb_v2.h 2787:16@
+
+    __exported by:__ @duckdb_v2.h@
+-}
+data DuckDBV2FileSystemStruct
+
+instance Marshal.StaticSize DuckDBV2FileSystemStruct where
+
+  staticSizeOf = \_ -> (8 :: Int)
+
+  staticAlignment = \_ -> (8 :: Int)
+
+{-| A borrowed opaque handle to a file system. Obtained from @duckdb_v2_instance_get_file_system()@ , @duckdb_v2_connection_get_file_system()@ or @duckdb_v2_context_get_file_system()@ , and used to open files with @duckdb_v2_file_system_open()@ . Borrowed: the handle belongs to the instance, connection or context it came from, is valid only for as long as that is, and must not be destroyed.
+
+    __C declaration:__ @duckdb_v2_file_system_handle@
+
+    __defined at:__ @duckdb_v2.h 2789:5@
+
+    __exported by:__ @duckdb_v2.h@
+-}
+newtype DuckDBV2FileSystemHandle = DuckDBV2FileSystemHandle
+  { unwrap :: BG.Ptr DuckDBV2FileSystemStruct
+  }
+  deriving stock (Eq, BG.Generic, Ord, Show)
+  deriving newtype
+    ( BG.HasFFIType
+    , Marshal.ReadRaw
+    , Marshal.StaticSize
+    , BG.Storable
+    , Marshal.WriteRaw
+    )
+
+instance ( ty ~ BG.Ptr DuckDBV2FileSystemStruct
+         ) => BG.CompatHasField.HasField "unwrap" DuckDBV2FileSystemHandle ty where
+
+  hasField =
+    \x0 ->
+      (\y1 ->
+         DuckDBV2FileSystemHandle {unwrap = y1}, BG.getField @"unwrap" x0)
+
+instance ( ty ~ BG.Ptr DuckDBV2FileSystemStruct
+         ) => BG.HasField "unwrap" (BG.Ptr DuckDBV2FileSystemHandle) (BG.Ptr ty) where
+
+  getField = HasCField.fromPtr (BG.Proxy @"unwrap")
+
+instance HasCField.HasCField DuckDBV2FileSystemHandle "unwrap" where
+
+  type CFieldType DuckDBV2FileSystemHandle "unwrap" =
+    BG.Ptr DuckDBV2FileSystemStruct
+
+  offset# = \_ -> \_ -> 0
+
+{-| An owned opaque handle to the options a file is opened with. Created with @duckdb_v2_file_open_options_create()@ , configured with @duckdb_v2_file_open_options_set_flag()@ and @duckdb_v2_file_open_options_set_value()@ , passed to @duckdb_v2_file_system_open()@ , and destroyed with @duckdb_v2_file_open_options_destroy()@ . One options object can open any number of files, and destroying it does not affect files already opened with it.
+
+    __C declaration:__ @struct _duckdb_v2_file_open_options@
+
+    __defined at:__ @duckdb_v2.h 2797:16@
+
+    __exported by:__ @duckdb_v2.h@
+-}
+data DuckDBV2FileOpenOptionsStruct
+
+instance Marshal.StaticSize DuckDBV2FileOpenOptionsStruct where
+
+  staticSizeOf = \_ -> (8 :: Int)
+
+  staticAlignment = \_ -> (8 :: Int)
+
+{-| An owned opaque handle to the options a file is opened with. Created with @duckdb_v2_file_open_options_create()@ , configured with @duckdb_v2_file_open_options_set_flag()@ and @duckdb_v2_file_open_options_set_value()@ , passed to @duckdb_v2_file_system_open()@ , and destroyed with @duckdb_v2_file_open_options_destroy()@ . One options object can open any number of files, and destroying it does not affect files already opened with it.
+
+    __C declaration:__ @duckdb_v2_file_open_options_handle@
+
+    __defined at:__ @duckdb_v2.h 2799:5@
+
+    __exported by:__ @duckdb_v2.h@
+-}
+newtype DuckDBV2FileOpenOptionsHandle = DuckDBV2FileOpenOptionsHandle
+  { unwrap :: BG.Ptr DuckDBV2FileOpenOptionsStruct
+  }
+  deriving stock (Eq, BG.Generic, Ord, Show)
+  deriving newtype
+    ( BG.HasFFIType
+    , Marshal.ReadRaw
+    , Marshal.StaticSize
+    , BG.Storable
+    , Marshal.WriteRaw
+    )
+
+instance ( ty ~ BG.Ptr DuckDBV2FileOpenOptionsStruct
+         ) => BG.CompatHasField.HasField "unwrap" DuckDBV2FileOpenOptionsHandle ty where
+
+  hasField =
+    \x0 ->
+      ( \y1 -> DuckDBV2FileOpenOptionsHandle {unwrap = y1}
+      , BG.getField @"unwrap" x0
+      )
+
+instance ( ty ~ BG.Ptr DuckDBV2FileOpenOptionsStruct
+         ) => BG.HasField "unwrap" (BG.Ptr DuckDBV2FileOpenOptionsHandle) (BG.Ptr ty) where
+
+  getField = HasCField.fromPtr (BG.Proxy @"unwrap")
+
+instance HasCField.HasCField DuckDBV2FileOpenOptionsHandle "unwrap" where
+
+  type CFieldType DuckDBV2FileOpenOptionsHandle "unwrap" =
+    BG.Ptr DuckDBV2FileOpenOptionsStruct
+
+  offset# = \_ -> \_ -> 0
+
+{-| An owned opaque handle to an open file, produced by @duckdb_v2_file_system_open()@ and destroyed with @duckdb_v2_file_destroy()@ . Read, write, seek and sync through the @file_*@ functions. Only usable while the file system it was opened through is still valid.
+
+    __C declaration:__ @struct _duckdb_v2_file@
+
+    __defined at:__ @duckdb_v2.h 2806:16@
+
+    __exported by:__ @duckdb_v2.h@
+-}
+data DuckDBV2FileStruct
+
+instance Marshal.StaticSize DuckDBV2FileStruct where
+
+  staticSizeOf = \_ -> (8 :: Int)
+
+  staticAlignment = \_ -> (8 :: Int)
+
+{-| An owned opaque handle to an open file, produced by @duckdb_v2_file_system_open()@ and destroyed with @duckdb_v2_file_destroy()@ . Read, write, seek and sync through the @file_*@ functions. Only usable while the file system it was opened through is still valid.
+
+    __C declaration:__ @duckdb_v2_file_handle@
+
+    __defined at:__ @duckdb_v2.h 2808:5@
+
+    __exported by:__ @duckdb_v2.h@
+-}
+newtype DuckDBV2FileHandle = DuckDBV2FileHandle
+  { unwrap :: BG.Ptr DuckDBV2FileStruct
+  }
+  deriving stock (Eq, BG.Generic, Ord, Show)
+  deriving newtype
+    ( BG.HasFFIType
+    , Marshal.ReadRaw
+    , Marshal.StaticSize
+    , BG.Storable
+    , Marshal.WriteRaw
+    )
+
+instance ( ty ~ BG.Ptr DuckDBV2FileStruct
+         ) => BG.CompatHasField.HasField "unwrap" DuckDBV2FileHandle ty where
+
+  hasField =
+    \x0 ->
+      (\y1 ->
+         DuckDBV2FileHandle {unwrap = y1}, BG.getField @"unwrap" x0)
+
+instance ( ty ~ BG.Ptr DuckDBV2FileStruct
+         ) => BG.HasField "unwrap" (BG.Ptr DuckDBV2FileHandle) (BG.Ptr ty) where
+
+  getField = HasCField.fromPtr (BG.Proxy @"unwrap")
+
+instance HasCField.HasCField DuckDBV2FileHandle "unwrap" where
+
+  type CFieldType DuckDBV2FileHandle "unwrap" =
+    BG.Ptr DuckDBV2FileStruct
+
+  offset# = \_ -> \_ -> 0
+
+{-| Auxiliary type used by t'DuckDBV2FileSystemPathGlobCallbackFn'
+
+    __C declaration:__ @duckdb_v2_file_system_path_glob_callback_fn@
+
+    __defined at:__ @duckdb_v2.h 2821:16@
+
+    __exported by:__ @duckdb_v2.h@
+-}
+newtype DuckDBV2FileSystemPathGlobCallbackFn_Aux = DuckDBV2FileSystemPathGlobCallbackFn_Aux
+  { unwrap :: PtrConst.PtrConst DuckDBV2Str -> BG.Ptr BG.Void -> BG.Ptr DuckDBV2ErrorInfoHandle -> IO ()
+  }
+  deriving stock (BG.Generic)
+
+-- __unique:__ @toDuckDBV2FileSystemPathGlobCallbackFn_Aux@
+foreign import ccall safe "wrapper" hs_bindgen_b4aca78582269bd2_base ::
+     (BG.Ptr BG.Void -> BG.Ptr BG.Void -> BG.Ptr BG.Void -> IO ())
+  -> IO (BG.FunPtr (BG.Ptr BG.Void -> BG.Ptr BG.Void -> BG.Ptr BG.Void -> IO ()))
+
+-- __unique:__ @toDuckDBV2FileSystemPathGlobCallbackFn_Aux@
+hs_bindgen_b4aca78582269bd2 ::
+     DuckDBV2FileSystemPathGlobCallbackFn_Aux
+  -> IO (BG.FunPtr DuckDBV2FileSystemPathGlobCallbackFn_Aux)
+hs_bindgen_b4aca78582269bd2 =
+  \fun0 ->
+    fmap BG.castFunPtr (hs_bindgen_b4aca78582269bd2_base (\x1 ->
+                                                            \x2 ->
+                                                              \x3 ->
+                                                                BG.getField @"unwrap" fun0 (BG.fromFFIType x1) (BG.fromFFIType x2) (BG.fromFFIType x3)))
+
+-- __unique:__ @fromDuckDBV2FileSystemPathGlobCallbackFn_Aux@
+foreign import ccall safe "dynamic" hs_bindgen_e37b5b82cf12d843_base ::
+     BG.FunPtr (BG.Ptr BG.Void -> BG.Ptr BG.Void -> BG.Ptr BG.Void -> IO ())
+  -> BG.Ptr BG.Void -> BG.Ptr BG.Void -> BG.Ptr BG.Void -> IO ()
+
+-- __unique:__ @fromDuckDBV2FileSystemPathGlobCallbackFn_Aux@
+hs_bindgen_e37b5b82cf12d843 ::
+     BG.FunPtr DuckDBV2FileSystemPathGlobCallbackFn_Aux
+  -> DuckDBV2FileSystemPathGlobCallbackFn_Aux
+hs_bindgen_e37b5b82cf12d843 =
+  \funPtr0 ->
+    DuckDBV2FileSystemPathGlobCallbackFn_Aux (\x1 ->
+                                                \x2 ->
+                                                  \x3 ->
+                                                    hs_bindgen_e37b5b82cf12d843_base (BG.castFunPtr funPtr0) (BG.toFFIType x1) (BG.toFFIType x2) (BG.toFFIType x3))
+
+instance BG.ToFunPtr DuckDBV2FileSystemPathGlobCallbackFn_Aux where
+
+  toFunPtr = hs_bindgen_b4aca78582269bd2
+
+instance BG.FromFunPtr DuckDBV2FileSystemPathGlobCallbackFn_Aux where
+
+  fromFunPtr = hs_bindgen_e37b5b82cf12d843
+
+instance ( ty ~ (PtrConst.PtrConst DuckDBV2Str -> BG.Ptr BG.Void -> BG.Ptr DuckDBV2ErrorInfoHandle -> IO ())
+         ) => BG.CompatHasField.HasField "unwrap" DuckDBV2FileSystemPathGlobCallbackFn_Aux ty where
+
+  hasField =
+    \x0 ->
+      ( \y1 ->
+          DuckDBV2FileSystemPathGlobCallbackFn_Aux {unwrap = y1}
+      , BG.getField @"unwrap" x0
+      )
+
+instance ( ty ~ (PtrConst.PtrConst DuckDBV2Str -> BG.Ptr BG.Void -> BG.Ptr DuckDBV2ErrorInfoHandle -> IO ())
+         ) => BG.HasField "unwrap" (BG.Ptr DuckDBV2FileSystemPathGlobCallbackFn_Aux) (BG.Ptr ty) where
+
+  getField = HasCField.fromPtr (BG.Proxy @"unwrap")
+
+instance HasCField.HasCField DuckDBV2FileSystemPathGlobCallbackFn_Aux "unwrap" where
+
+  type CFieldType DuckDBV2FileSystemPathGlobCallbackFn_Aux "unwrap" =
+    PtrConst.PtrConst DuckDBV2Str -> BG.Ptr BG.Void -> BG.Ptr DuckDBV2ErrorInfoHandle -> IO ()
+
+  offset# = \_ -> \_ -> 0
+
+{-| Receives one path matched by @duckdb_v2_file_system_path_glob()@ .
+
+    The view is borrowed for the duration of the call only, and is not guaranteed to be null-terminated. Report an error through @err@ , a live slot that must not be destroyed, to stop the glob: @duckdb_v2_file_system_path_glob()@ then fails with that error. The callback must not throw or unwind across the boundary.
+
+    __C declaration:__ @duckdb_v2_file_system_path_glob_callback_fn@
+
+    __defined at:__ @duckdb_v2.h 2821:16@
+
+    __exported by:__ @duckdb_v2.h@
+-}
+newtype DuckDBV2FileSystemPathGlobCallbackFn = DuckDBV2FileSystemPathGlobCallbackFn
+  { unwrap :: BG.FunPtr DuckDBV2FileSystemPathGlobCallbackFn_Aux
+  }
+  deriving stock (Eq, BG.Generic, Ord, Show)
+  deriving newtype
+    ( BG.HasFFIType
+    , Marshal.ReadRaw
+    , Marshal.StaticSize
+    , BG.Storable
+    , Marshal.WriteRaw
+    )
+
+instance ( ty ~ BG.FunPtr DuckDBV2FileSystemPathGlobCallbackFn_Aux
+         ) => BG.CompatHasField.HasField "unwrap" DuckDBV2FileSystemPathGlobCallbackFn ty where
+
+  hasField =
+    \x0 ->
+      ( \y1 ->
+          DuckDBV2FileSystemPathGlobCallbackFn {unwrap = y1}
+      , BG.getField @"unwrap" x0
+      )
+
+instance ( ty ~ BG.FunPtr DuckDBV2FileSystemPathGlobCallbackFn_Aux
+         ) => BG.HasField "unwrap" (BG.Ptr DuckDBV2FileSystemPathGlobCallbackFn) (BG.Ptr ty) where
+
+  getField = HasCField.fromPtr (BG.Proxy @"unwrap")
+
+instance HasCField.HasCField DuckDBV2FileSystemPathGlobCallbackFn "unwrap" where
+
+  type CFieldType DuckDBV2FileSystemPathGlobCallbackFn "unwrap" =
+    BG.FunPtr DuckDBV2FileSystemPathGlobCallbackFn_Aux
+
+  offset# = \_ -> \_ -> 0
+
+{-| A borrowed opaque handle to the call site a bind callback is binding. Every function family\'s bind callback receives this handle next to its own bind info. It gives access to the arguments of the call, the function\'s user data, and the bind data.
+
+    The arguments form one list in four parts, in this order: one argument per positional-only and standard parameter, in declaration order; the arguments @*args@ received, in call order; one argument per named-only parameter, in declaration order; and the arguments @**kwargs@ received, in call order. How the caller passed an argument does not matter: a standard parameter passed by name is at its declared position. A parameter the call omitted is present with its default value. See @duckdb_v2_function_bind_get_arg_count()@ for the size of each part.
+
+    __C declaration:__ @struct _duckdb_v2_function_bind_info@
+
+    __defined at:__ @duckdb_v2.h 3396:16@
+
+    __exported by:__ @duckdb_v2.h@
+-}
+data DuckDBV2FunctionBindInfoStruct
+
+instance Marshal.StaticSize DuckDBV2FunctionBindInfoStruct where
+
+  staticSizeOf = \_ -> (8 :: Int)
+
+  staticAlignment = \_ -> (8 :: Int)
+
+{-| A borrowed opaque handle to the call site a bind callback is binding. Every function family\'s bind callback receives this handle next to its own bind info. It gives access to the arguments of the call, the function\'s user data, and the bind data.
+
+    The arguments form one list in four parts, in this order: one argument per positional-only and standard parameter, in declaration order; the arguments @*args@ received, in call order; one argument per named-only parameter, in declaration order; and the arguments @**kwargs@ received, in call order. How the caller passed an argument does not matter: a standard parameter passed by name is at its declared position. A parameter the call omitted is present with its default value. See @duckdb_v2_function_bind_get_arg_count()@ for the size of each part.
+
+    __C declaration:__ @duckdb_v2_function_bind_info_handle@
+
+    __defined at:__ @duckdb_v2.h 3398:5@
+
+    __exported by:__ @duckdb_v2.h@
+-}
+newtype DuckDBV2FunctionBindInfoHandle = DuckDBV2FunctionBindInfoHandle
+  { unwrap :: BG.Ptr DuckDBV2FunctionBindInfoStruct
+  }
+  deriving stock (Eq, BG.Generic, Ord, Show)
+  deriving newtype
+    ( BG.HasFFIType
+    , Marshal.ReadRaw
+    , Marshal.StaticSize
+    , BG.Storable
+    , Marshal.WriteRaw
+    )
+
+instance ( ty ~ BG.Ptr DuckDBV2FunctionBindInfoStruct
+         ) => BG.CompatHasField.HasField "unwrap" DuckDBV2FunctionBindInfoHandle ty where
+
+  hasField =
+    \x0 ->
+      ( \y1 -> DuckDBV2FunctionBindInfoHandle {unwrap = y1}
+      , BG.getField @"unwrap" x0
+      )
+
+instance ( ty ~ BG.Ptr DuckDBV2FunctionBindInfoStruct
+         ) => BG.HasField "unwrap" (BG.Ptr DuckDBV2FunctionBindInfoHandle) (BG.Ptr ty) where
+
+  getField = HasCField.fromPtr (BG.Proxy @"unwrap")
+
+instance HasCField.HasCField DuckDBV2FunctionBindInfoHandle "unwrap" where
+
+  type CFieldType DuckDBV2FunctionBindInfoHandle "unwrap" =
+    BG.Ptr DuckDBV2FunctionBindInfoStruct
+
+  offset# = \_ -> \_ -> 0
+
+{-| A borrowed opaque handle to the documentation of a function overload. Taken from the function it documents with @duckdb_v2_scalar_function_get_docs()@ , @duckdb_v2_aggregate_function_get_docs()@ , @duckdb_v2_table_function_get_docs()@ , @duckdb_v2_pragma_function_get_docs()@ or @duckdb_v2_macro_function_get_docs()@ , and valid for as long as that function handle is; the caller never destroys it.
+
+    __C declaration:__ @struct _duckdb_v2_function_docs@
+
+    __defined at:__ @duckdb_v2.h 3589:16@
+
+    __exported by:__ @duckdb_v2.h@
+-}
+data DuckDBV2FunctionDocsStruct
+
+instance Marshal.StaticSize DuckDBV2FunctionDocsStruct where
+
+  staticSizeOf = \_ -> (8 :: Int)
+
+  staticAlignment = \_ -> (8 :: Int)
+
+{-| A borrowed opaque handle to the documentation of a function overload. Taken from the function it documents with @duckdb_v2_scalar_function_get_docs()@ , @duckdb_v2_aggregate_function_get_docs()@ , @duckdb_v2_table_function_get_docs()@ , @duckdb_v2_pragma_function_get_docs()@ or @duckdb_v2_macro_function_get_docs()@ , and valid for as long as that function handle is; the caller never destroys it.
+
+    __C declaration:__ @duckdb_v2_function_docs_handle@
+
+    __defined at:__ @duckdb_v2.h 3591:5@
+
+    __exported by:__ @duckdb_v2.h@
+-}
+newtype DuckDBV2FunctionDocsHandle = DuckDBV2FunctionDocsHandle
+  { unwrap :: BG.Ptr DuckDBV2FunctionDocsStruct
+  }
+  deriving stock (Eq, BG.Generic, Ord, Show)
+  deriving newtype
+    ( BG.HasFFIType
+    , Marshal.ReadRaw
+    , Marshal.StaticSize
+    , BG.Storable
+    , Marshal.WriteRaw
+    )
+
+instance ( ty ~ BG.Ptr DuckDBV2FunctionDocsStruct
+         ) => BG.CompatHasField.HasField "unwrap" DuckDBV2FunctionDocsHandle ty where
+
+  hasField =
+    \x0 ->
+      (\y1 ->
+         DuckDBV2FunctionDocsHandle {unwrap = y1}, BG.getField @"unwrap" x0)
+
+instance ( ty ~ BG.Ptr DuckDBV2FunctionDocsStruct
+         ) => BG.HasField "unwrap" (BG.Ptr DuckDBV2FunctionDocsHandle) (BG.Ptr ty) where
+
+  getField = HasCField.fromPtr (BG.Proxy @"unwrap")
+
+instance HasCField.HasCField DuckDBV2FunctionDocsHandle "unwrap" where
+
+  type CFieldType DuckDBV2FunctionDocsHandle "unwrap" =
+    BG.Ptr DuckDBV2FunctionDocsStruct
+
+  offset# = \_ -> \_ -> 0
+
+{-| How a caller passes the argument for a parameter, following Python\'s parameter kinds. A signature orders its parameters by kind, in the order the values are listed here. Pass one of these to @duckdb_v2_function_signature_add_parameter()@ .
+
+    __C declaration:__ @enum DUCKDB_V2_FUNCTION_PARAMETER_KIND@
+
+    __defined at:__ @duckdb_v2.h 3674:14@
+
+    __exported by:__ @duckdb_v2.h@
+-}
+newtype DuckDBV2FunctionParameterKind = DuckDBV2FunctionParameterKind
+  { unwrap :: BG.CUInt
+  }
+  deriving stock (Eq, BG.Generic, Ord)
+  deriving newtype (BG.HasFFIType)
+
+instance Marshal.StaticSize DuckDBV2FunctionParameterKind where
+
+  staticSizeOf = \_ -> (4 :: Int)
+
+  staticAlignment = \_ -> (4 :: Int)
+
+instance Marshal.ReadRaw DuckDBV2FunctionParameterKind where
+
+  readRaw =
+    \ptr0 ->
+          pure DuckDBV2FunctionParameterKind
+      <*> Marshal.readRawByteOff ptr0 (0 :: Int)
+
+instance Marshal.WriteRaw DuckDBV2FunctionParameterKind where
+
+  writeRaw =
+    \ptr0 ->
+      \s1 ->
+        case s1 of
+          DuckDBV2FunctionParameterKind unwrap2 ->
+            Marshal.writeRawByteOff ptr0 (0 :: Int) unwrap2
+
+deriving via Marshal.EquivStorable DuckDBV2FunctionParameterKind instance BG.Storable DuckDBV2FunctionParameterKind
+
+deriving via BG.CUInt instance BG.Prim DuckDBV2FunctionParameterKind
+
+instance CEnum.CEnum DuckDBV2FunctionParameterKind where
+
+  type CEnumZ DuckDBV2FunctionParameterKind = BG.CUInt
+
+  toCEnum = DuckDBV2FunctionParameterKind
+
+  fromCEnum = BG.getField @"unwrap"
+
+  declaredValues =
+    \_ ->
+      CEnum.declaredValuesFromList [ (0, BG.singleton "DuckDBV2FunctionParameterKindPositionalOnly")
+                                   , (1, BG.singleton "DuckDBV2FunctionParameterKindStandard")
+                                   , (2, BG.singleton "DuckDBV2FunctionParameterKindPositionalVariadic")
+                                   , (3, BG.singleton "DuckDBV2FunctionParameterKindNamedOnly")
+                                   , (4, BG.singleton "DuckDBV2FunctionParameterKindNamedVariadic")
+                                   , (2147483647, BG.singleton "DuckDBV2FunctionParameterKindMaxEnum")
+                                   ]
+
+  showsUndeclared =
+    CEnum.showsWrappedUndeclared "DuckDBV2FunctionParameterKind"
+
+  readPrecUndeclared =
+    CEnum.readPrecWrappedUndeclared "DuckDBV2FunctionParameterKind"
+
+instance Show DuckDBV2FunctionParameterKind where
+
+  showsPrec = CEnum.shows
+
+instance Read DuckDBV2FunctionParameterKind where
+
+  readPrec = CEnum.readPrec
+
+  readList = BG.readListDefault
+
+  readListPrec = BG.readListPrecDefault
+
+instance ( ty ~ BG.CUInt
+         ) => BG.CompatHasField.HasField "unwrap" DuckDBV2FunctionParameterKind ty where
+
+  hasField =
+    \x0 ->
+      ( \y1 -> DuckDBV2FunctionParameterKind {unwrap = y1}
+      , BG.getField @"unwrap" x0
+      )
+
+instance ( ty ~ BG.CUInt
+         ) => BG.HasField "unwrap" (BG.Ptr DuckDBV2FunctionParameterKind) (BG.Ptr ty) where
+
+  getField = HasCField.fromPtr (BG.Proxy @"unwrap")
+
+instance HasCField.HasCField DuckDBV2FunctionParameterKind "unwrap" where
+
+  type CFieldType DuckDBV2FunctionParameterKind "unwrap" =
+    BG.CUInt
+
+  offset# = \_ -> \_ -> 0
+
+{-| Passed by position only. The name is invisible to a caller: a named argument with the same name is received by @**kwargs@ , or rejected when the signature has none.
+
+    __C declaration:__ @DUCKDB_V2_FUNCTION_PARAMETER_KIND_POSITIONAL_ONLY@
+
+    __defined at:__ @duckdb_v2.h 3679:2@
+
+    __exported by:__ @duckdb_v2.h@
+-}
+pattern DuckDBV2FunctionParameterKindPositionalOnly :: DuckDBV2FunctionParameterKind
+pattern DuckDBV2FunctionParameterKindPositionalOnly = DuckDBV2FunctionParameterKind 0
+
+{-| Passed by position or by name.
+
+    __C declaration:__ @DUCKDB_V2_FUNCTION_PARAMETER_KIND_STANDARD@
+
+    __defined at:__ @duckdb_v2.h 3682:2@
+
+    __exported by:__ @duckdb_v2.h@
+-}
+pattern DuckDBV2FunctionParameterKindStandard :: DuckDBV2FunctionParameterKind
+pattern DuckDBV2FunctionParameterKindStandard = DuckDBV2FunctionParameterKind 1
+
+{-| @*args@ : receives the positional arguments left over after the positional-only and standard parameters, each cast to the parameter type. ANY leaves them un-cast.
+
+    __C declaration:__ @DUCKDB_V2_FUNCTION_PARAMETER_KIND_POSITIONAL_VARIADIC@
+
+    __defined at:__ @duckdb_v2.h 3688:2@
+
+    __exported by:__ @duckdb_v2.h@
+-}
+pattern DuckDBV2FunctionParameterKindPositionalVariadic :: DuckDBV2FunctionParameterKind
+pattern DuckDBV2FunctionParameterKindPositionalVariadic = DuckDBV2FunctionParameterKind 2
+
+{-| Passed by name only.
+
+    __C declaration:__ @DUCKDB_V2_FUNCTION_PARAMETER_KIND_NAMED_ONLY@
+
+    __defined at:__ @duckdb_v2.h 3691:2@
+
+    __exported by:__ @duckdb_v2.h@
+-}
+pattern DuckDBV2FunctionParameterKindNamedOnly :: DuckDBV2FunctionParameterKind
+pattern DuckDBV2FunctionParameterKindNamedOnly = DuckDBV2FunctionParameterKind 3
+
+{-| @**kwargs@ : receives the named arguments that match no other parameter, each cast to the parameter type. ANY leaves them un-cast.
+
+    __C declaration:__ @DUCKDB_V2_FUNCTION_PARAMETER_KIND_NAMED_VARIADIC@
+
+    __defined at:__ @duckdb_v2.h 3697:2@
+
+    __exported by:__ @duckdb_v2.h@
+-}
+pattern DuckDBV2FunctionParameterKindNamedVariadic :: DuckDBV2FunctionParameterKind
+pattern DuckDBV2FunctionParameterKindNamedVariadic = DuckDBV2FunctionParameterKind 4
+
+{-| __C declaration:__ @DUCKDB_V2_FUNCTION_PARAMETER_KIND_MAX_ENUM@
+
+    __defined at:__ @duckdb_v2.h 3698:2@
+
+    __exported by:__ @duckdb_v2.h@
+-}
+pattern DuckDBV2FunctionParameterKindMaxEnum :: DuckDBV2FunctionParameterKind
+pattern DuckDBV2FunctionParameterKindMaxEnum = DuckDBV2FunctionParameterKind 2147483647
+
+{-| An opaque handle to a function signature. Carries the function\'s parameters and return type.
+
+    __C declaration:__ @struct _duckdb_v2_function_signature@
+
+    __defined at:__ @duckdb_v2.h 3706:16@
+
+    __exported by:__ @duckdb_v2.h@
+-}
+data DuckDBV2FunctionSignatureStruct
+
+instance Marshal.StaticSize DuckDBV2FunctionSignatureStruct where
+
+  staticSizeOf = \_ -> (8 :: Int)
+
+  staticAlignment = \_ -> (8 :: Int)
+
+{-| An opaque handle to a function signature. Carries the function\'s parameters and return type.
+
+    __C declaration:__ @duckdb_v2_function_signature_handle@
+
+    __defined at:__ @duckdb_v2.h 3708:5@
+
+    __exported by:__ @duckdb_v2.h@
+-}
+newtype DuckDBV2FunctionSignatureHandle = DuckDBV2FunctionSignatureHandle
+  { unwrap :: BG.Ptr DuckDBV2FunctionSignatureStruct
+  }
+  deriving stock (Eq, BG.Generic, Ord, Show)
+  deriving newtype
+    ( BG.HasFFIType
+    , Marshal.ReadRaw
+    , Marshal.StaticSize
+    , BG.Storable
+    , Marshal.WriteRaw
+    )
+
+instance ( ty ~ BG.Ptr DuckDBV2FunctionSignatureStruct
+         ) => BG.CompatHasField.HasField "unwrap" DuckDBV2FunctionSignatureHandle ty where
+
+  hasField =
+    \x0 ->
+      ( \y1 ->
+          DuckDBV2FunctionSignatureHandle {unwrap = y1}
+      , BG.getField @"unwrap" x0
+      )
+
+instance ( ty ~ BG.Ptr DuckDBV2FunctionSignatureStruct
+         ) => BG.HasField "unwrap" (BG.Ptr DuckDBV2FunctionSignatureHandle) (BG.Ptr ty) where
+
+  getField = HasCField.fromPtr (BG.Proxy @"unwrap")
+
+instance HasCField.HasCField DuckDBV2FunctionSignatureHandle "unwrap" where
+
+  type CFieldType DuckDBV2FunctionSignatureHandle "unwrap" =
+    BG.Ptr DuckDBV2FunctionSignatureStruct
+
+  offset# = \_ -> \_ -> 0
+
+{-| An opaque, owned handle to the @(KEY value)@ options of one @duckdb_v2_instance_attach()@ call, as SQL @ATTACH@ accepts them. Created from the instance handle it will be used with via @duckdb_v2_attach_options_create()@ ; destroy it via @duckdb_v2_attach_options_destroy()@ .
+
+    __C declaration:__ @struct _duckdb_v2_attach_options@
+
+    __defined at:__ @duckdb_v2.h 3835:16@
+
+    __exported by:__ @duckdb_v2.h@
+-}
+data DuckDBV2AttachOptionsStruct
+
+instance Marshal.StaticSize DuckDBV2AttachOptionsStruct where
+
+  staticSizeOf = \_ -> (8 :: Int)
+
+  staticAlignment = \_ -> (8 :: Int)
+
+{-| An opaque, owned handle to the @(KEY value)@ options of one @duckdb_v2_instance_attach()@ call, as SQL @ATTACH@ accepts them. Created from the instance handle it will be used with via @duckdb_v2_attach_options_create()@ ; destroy it via @duckdb_v2_attach_options_destroy()@ .
+
+    __C declaration:__ @duckdb_v2_attach_options_handle@
+
+    __defined at:__ @duckdb_v2.h 3837:5@
+
+    __exported by:__ @duckdb_v2.h@
+-}
+newtype DuckDBV2AttachOptionsHandle = DuckDBV2AttachOptionsHandle
+  { unwrap :: BG.Ptr DuckDBV2AttachOptionsStruct
+  }
+  deriving stock (Eq, BG.Generic, Ord, Show)
+  deriving newtype
+    ( BG.HasFFIType
+    , Marshal.ReadRaw
+    , Marshal.StaticSize
+    , BG.Storable
+    , Marshal.WriteRaw
+    )
+
+instance ( ty ~ BG.Ptr DuckDBV2AttachOptionsStruct
+         ) => BG.CompatHasField.HasField "unwrap" DuckDBV2AttachOptionsHandle ty where
+
+  hasField =
+    \x0 ->
+      (\y1 ->
+         DuckDBV2AttachOptionsHandle {unwrap = y1}, BG.getField @"unwrap" x0)
+
+instance ( ty ~ BG.Ptr DuckDBV2AttachOptionsStruct
+         ) => BG.HasField "unwrap" (BG.Ptr DuckDBV2AttachOptionsHandle) (BG.Ptr ty) where
+
+  getField = HasCField.fromPtr (BG.Proxy @"unwrap")
+
+instance HasCField.HasCField DuckDBV2AttachOptionsHandle "unwrap" where
+
+  type CFieldType DuckDBV2AttachOptionsHandle "unwrap" =
+    BG.Ptr DuckDBV2AttachOptionsStruct
+
+  offset# = \_ -> \_ -> 0
+
+{-| Severity of a log message. Mirrors DuckDB\'s own log levels, and is compared against the configured threshold: an entry below it is dropped.
+
+    __C declaration:__ @enum DUCKDB_V2_LOG_LEVEL@
+
+    __defined at:__ @duckdb_v2.h 4098:14@
+
+    __exported by:__ @duckdb_v2.h@
+-}
+newtype DuckDBV2LogLevel = DuckDBV2LogLevel
+  { unwrap :: BG.CUInt
+  }
+  deriving stock (Eq, BG.Generic, Ord)
+  deriving newtype (BG.HasFFIType)
+
+instance Marshal.StaticSize DuckDBV2LogLevel where
+
+  staticSizeOf = \_ -> (4 :: Int)
+
+  staticAlignment = \_ -> (4 :: Int)
+
+instance Marshal.ReadRaw DuckDBV2LogLevel where
+
+  readRaw =
+    \ptr0 ->
+          pure DuckDBV2LogLevel
+      <*> Marshal.readRawByteOff ptr0 (0 :: Int)
+
+instance Marshal.WriteRaw DuckDBV2LogLevel where
+
+  writeRaw =
+    \ptr0 ->
+      \s1 ->
+        case s1 of
+          DuckDBV2LogLevel unwrap2 ->
+            Marshal.writeRawByteOff ptr0 (0 :: Int) unwrap2
+
+deriving via Marshal.EquivStorable DuckDBV2LogLevel instance BG.Storable DuckDBV2LogLevel
+
+deriving via BG.CUInt instance BG.Prim DuckDBV2LogLevel
+
+instance CEnum.CEnum DuckDBV2LogLevel where
+
+  type CEnumZ DuckDBV2LogLevel = BG.CUInt
+
+  toCEnum = DuckDBV2LogLevel
+
+  fromCEnum = BG.getField @"unwrap"
+
+  declaredValues =
+    \_ ->
+      CEnum.declaredValuesFromList [ (10, BG.singleton "DuckDBV2LogLevelTrace")
+                                   , (20, BG.singleton "DuckDBV2LogLevelDebug")
+                                   , (30, BG.singleton "DuckDBV2LogLevelInfo")
+                                   , (40, BG.singleton "DuckDBV2LogLevelWarning")
+                                   , (50, BG.singleton "DuckDBV2LogLevelError")
+                                   , (60, BG.singleton "DuckDBV2LogLevelFatal")
+                                   , (2147483647, BG.singleton "DuckDBV2LogLevelMaxEnum")
+                                   ]
+
+  showsUndeclared =
+    CEnum.showsWrappedUndeclared "DuckDBV2LogLevel"
+
+  readPrecUndeclared =
+    CEnum.readPrecWrappedUndeclared "DuckDBV2LogLevel"
+
+instance Show DuckDBV2LogLevel where
+
+  showsPrec = CEnum.shows
+
+instance Read DuckDBV2LogLevel where
+
+  readPrec = CEnum.readPrec
+
+  readList = BG.readListDefault
+
+  readListPrec = BG.readListPrecDefault
+
+instance ( ty ~ BG.CUInt
+         ) => BG.CompatHasField.HasField "unwrap" DuckDBV2LogLevel ty where
+
+  hasField =
+    \x0 ->
+      (\y1 ->
+         DuckDBV2LogLevel {unwrap = y1}, BG.getField @"unwrap" x0)
+
+instance ( ty ~ BG.CUInt
+         ) => BG.HasField "unwrap" (BG.Ptr DuckDBV2LogLevel) (BG.Ptr ty) where
+
+  getField = HasCField.fromPtr (BG.Proxy @"unwrap")
+
+instance HasCField.HasCField DuckDBV2LogLevel "unwrap" where
+
+  type CFieldType DuckDBV2LogLevel "unwrap" = BG.CUInt
+
+  offset# = \_ -> \_ -> 0
+
+{-| Finest detail; off in any default configuration.
+
+    __C declaration:__ @DUCKDB_V2_LOG_LEVEL_TRACE@
+
+    __defined at:__ @duckdb_v2.h 4100:2@
+
+    __exported by:__ @duckdb_v2.h@
+-}
+pattern DuckDBV2LogLevelTrace :: DuckDBV2LogLevel
+pattern DuckDBV2LogLevelTrace = DuckDBV2LogLevel 10
+
+{-| Diagnostic detail.
+
+    __C declaration:__ @DUCKDB_V2_LOG_LEVEL_DEBUG@
+
+    __defined at:__ @duckdb_v2.h 4103:2@
+
+    __exported by:__ @duckdb_v2.h@
+-}
+pattern DuckDBV2LogLevelDebug :: DuckDBV2LogLevel
+pattern DuckDBV2LogLevelDebug = DuckDBV2LogLevel 20
+
+{-| Ordinary progress information.
+
+    __C declaration:__ @DUCKDB_V2_LOG_LEVEL_INFO@
+
+    __defined at:__ @duckdb_v2.h 4106:2@
+
+    __exported by:__ @duckdb_v2.h@
+-}
+pattern DuckDBV2LogLevelInfo :: DuckDBV2LogLevel
+pattern DuckDBV2LogLevelInfo = DuckDBV2LogLevel 30
+
+{-| A recoverable problem.
+
+    __C declaration:__ @DUCKDB_V2_LOG_LEVEL_WARNING@
+
+    __defined at:__ @duckdb_v2.h 4109:2@
+
+    __exported by:__ @duckdb_v2.h@
+-}
+pattern DuckDBV2LogLevelWarning :: DuckDBV2LogLevel
+pattern DuckDBV2LogLevelWarning = DuckDBV2LogLevel 40
+
+{-| An operation failed.
+
+    __C declaration:__ @DUCKDB_V2_LOG_LEVEL_ERROR@
+
+    __defined at:__ @duckdb_v2.h 4112:2@
+
+    __exported by:__ @duckdb_v2.h@
+-}
+pattern DuckDBV2LogLevelError :: DuckDBV2LogLevel
+pattern DuckDBV2LogLevelError = DuckDBV2LogLevel 50
+
+{-| An unrecoverable failure.
+
+    __C declaration:__ @DUCKDB_V2_LOG_LEVEL_FATAL@
+
+    __defined at:__ @duckdb_v2.h 4115:2@
+
+    __exported by:__ @duckdb_v2.h@
+-}
+pattern DuckDBV2LogLevelFatal :: DuckDBV2LogLevel
+pattern DuckDBV2LogLevelFatal = DuckDBV2LogLevel 60
+
+{-| __C declaration:__ @DUCKDB_V2_LOG_LEVEL_MAX_ENUM@
+
+    __defined at:__ @duckdb_v2.h 4116:2@
+
+    __exported by:__ @duckdb_v2.h@
+-}
+pattern DuckDBV2LogLevelMaxEnum :: DuckDBV2LogLevel
+pattern DuckDBV2LogLevelMaxEnum = DuckDBV2LogLevel 2147483647
+
+{-| An owned qualified name: an ordered path of one to three non-empty identifier parts whose last element is the object name. Construct with @duckdb_v2_qname_parse()@ or @duckdb_v2_qname_create()@ , read with @duckdb_v2_qname_get_part_count()@ and @duckdb_v2_qname_get_part()@ , render back to SQL with @duckdb_v2_qname_render()@ , compare with @duckdb_v2_qname_equals()@ , and destroy with @duckdb_v2_qname_destroy()@ . Two handles are compared with @duckdb_v2_qname_equals()@ , never by pointer.
+
+    __C declaration:__ @struct _duckdb_v2_qname@
+
+    __defined at:__ @duckdb_v2.h 4220:16@
+
+    __exported by:__ @duckdb_v2.h@
+-}
+data DuckDBV2QnameStruct
+
+instance Marshal.StaticSize DuckDBV2QnameStruct where
+
+  staticSizeOf = \_ -> (8 :: Int)
+
+  staticAlignment = \_ -> (8 :: Int)
+
+{-| An owned qualified name: an ordered path of one to three non-empty identifier parts whose last element is the object name. Construct with @duckdb_v2_qname_parse()@ or @duckdb_v2_qname_create()@ , read with @duckdb_v2_qname_get_part_count()@ and @duckdb_v2_qname_get_part()@ , render back to SQL with @duckdb_v2_qname_render()@ , compare with @duckdb_v2_qname_equals()@ , and destroy with @duckdb_v2_qname_destroy()@ . Two handles are compared with @duckdb_v2_qname_equals()@ , never by pointer.
+
+    __C declaration:__ @duckdb_v2_qname_handle@
+
+    __defined at:__ @duckdb_v2.h 4222:5@
+
+    __exported by:__ @duckdb_v2.h@
+-}
+newtype DuckDBV2QnameHandle = DuckDBV2QnameHandle
+  { unwrap :: BG.Ptr DuckDBV2QnameStruct
+  }
+  deriving stock (Eq, BG.Generic, Ord, Show)
+  deriving newtype
+    ( BG.HasFFIType
+    , Marshal.ReadRaw
+    , Marshal.StaticSize
+    , BG.Storable
+    , Marshal.WriteRaw
+    )
+
+instance ( ty ~ BG.Ptr DuckDBV2QnameStruct
+         ) => BG.CompatHasField.HasField "unwrap" DuckDBV2QnameHandle ty where
+
+  hasField =
+    \x0 ->
+      (\y1 ->
+         DuckDBV2QnameHandle {unwrap = y1}, BG.getField @"unwrap" x0)
+
+instance ( ty ~ BG.Ptr DuckDBV2QnameStruct
+         ) => BG.HasField "unwrap" (BG.Ptr DuckDBV2QnameHandle) (BG.Ptr ty) where
+
+  getField = HasCField.fromPtr (BG.Proxy @"unwrap")
+
+instance HasCField.HasCField DuckDBV2QnameHandle "unwrap" where
+
+  type CFieldType DuckDBV2QnameHandle "unwrap" =
+    BG.Ptr DuckDBV2QnameStruct
+
+  offset# = \_ -> \_ -> 0
+
+{-| An owned snapshot of the metrics of a query. Taken with @duckdb_v2_connection_get_query_metrics()@ , read from its root node via @duckdb_v2_query_metrics_get_root()@ , and destroyed with @duckdb_v2_query_metrics_destroy()@ . Later queries do not update it.
+
+    __C declaration:__ @struct _duckdb_v2_query_metrics@
+
+    __defined at:__ @duckdb_v2.h 4425:16@
+
+    __exported by:__ @duckdb_v2.h@
+-}
+data DuckDBV2QueryMetricsStruct
+
+instance Marshal.StaticSize DuckDBV2QueryMetricsStruct where
+
+  staticSizeOf = \_ -> (8 :: Int)
+
+  staticAlignment = \_ -> (8 :: Int)
+
+{-| An owned snapshot of the metrics of a query. Taken with @duckdb_v2_connection_get_query_metrics()@ , read from its root node via @duckdb_v2_query_metrics_get_root()@ , and destroyed with @duckdb_v2_query_metrics_destroy()@ . Later queries do not update it.
+
+    __C declaration:__ @duckdb_v2_query_metrics_handle@
+
+    __defined at:__ @duckdb_v2.h 4427:5@
+
+    __exported by:__ @duckdb_v2.h@
+-}
+newtype DuckDBV2QueryMetricsHandle = DuckDBV2QueryMetricsHandle
+  { unwrap :: BG.Ptr DuckDBV2QueryMetricsStruct
+  }
+  deriving stock (Eq, BG.Generic, Ord, Show)
+  deriving newtype
+    ( BG.HasFFIType
+    , Marshal.ReadRaw
+    , Marshal.StaticSize
+    , BG.Storable
+    , Marshal.WriteRaw
+    )
+
+instance ( ty ~ BG.Ptr DuckDBV2QueryMetricsStruct
+         ) => BG.CompatHasField.HasField "unwrap" DuckDBV2QueryMetricsHandle ty where
+
+  hasField =
+    \x0 ->
+      (\y1 ->
+         DuckDBV2QueryMetricsHandle {unwrap = y1}, BG.getField @"unwrap" x0)
+
+instance ( ty ~ BG.Ptr DuckDBV2QueryMetricsStruct
+         ) => BG.HasField "unwrap" (BG.Ptr DuckDBV2QueryMetricsHandle) (BG.Ptr ty) where
+
+  getField = HasCField.fromPtr (BG.Proxy @"unwrap")
+
+instance HasCField.HasCField DuckDBV2QueryMetricsHandle "unwrap" where
+
+  type CFieldType DuckDBV2QueryMetricsHandle "unwrap" =
+    BG.Ptr DuckDBV2QueryMetricsStruct
+
+  offset# = \_ -> \_ -> 0
+
+{-| A borrowed opaque handle to one node of a query metrics snapshot, valid for as long as the snapshot is. Read its name with @duckdb_v2_query_metrics_node_get_name()@ , its metrics with @duckdb_v2_query_metrics_node_get_metric()@ or by index, and its children with @duckdb_v2_query_metrics_node_get_child()@ .
+
+    __C declaration:__ @struct _duckdb_v2_query_metrics_node@
+
+    __defined at:__ @duckdb_v2.h 4434:16@
+
+    __exported by:__ @duckdb_v2.h@
+-}
+data DuckDBV2QueryMetricsNodeStruct
+
+instance Marshal.StaticSize DuckDBV2QueryMetricsNodeStruct where
+
+  staticSizeOf = \_ -> (8 :: Int)
+
+  staticAlignment = \_ -> (8 :: Int)
+
+{-| A borrowed opaque handle to one node of a query metrics snapshot, valid for as long as the snapshot is. Read its name with @duckdb_v2_query_metrics_node_get_name()@ , its metrics with @duckdb_v2_query_metrics_node_get_metric()@ or by index, and its children with @duckdb_v2_query_metrics_node_get_child()@ .
+
+    __C declaration:__ @duckdb_v2_query_metrics_node_handle@
+
+    __defined at:__ @duckdb_v2.h 4436:5@
+
+    __exported by:__ @duckdb_v2.h@
+-}
+newtype DuckDBV2QueryMetricsNodeHandle = DuckDBV2QueryMetricsNodeHandle
+  { unwrap :: BG.Ptr DuckDBV2QueryMetricsNodeStruct
+  }
+  deriving stock (Eq, BG.Generic, Ord, Show)
+  deriving newtype
+    ( BG.HasFFIType
+    , Marshal.ReadRaw
+    , Marshal.StaticSize
+    , BG.Storable
+    , Marshal.WriteRaw
+    )
+
+instance ( ty ~ BG.Ptr DuckDBV2QueryMetricsNodeStruct
+         ) => BG.CompatHasField.HasField "unwrap" DuckDBV2QueryMetricsNodeHandle ty where
+
+  hasField =
+    \x0 ->
+      ( \y1 -> DuckDBV2QueryMetricsNodeHandle {unwrap = y1}
+      , BG.getField @"unwrap" x0
+      )
+
+instance ( ty ~ BG.Ptr DuckDBV2QueryMetricsNodeStruct
+         ) => BG.HasField "unwrap" (BG.Ptr DuckDBV2QueryMetricsNodeHandle) (BG.Ptr ty) where
+
+  getField = HasCField.fromPtr (BG.Proxy @"unwrap")
+
+instance HasCField.HasCField DuckDBV2QueryMetricsNodeHandle "unwrap" where
+
+  type CFieldType DuckDBV2QueryMetricsNodeHandle "unwrap" =
+    BG.Ptr DuckDBV2QueryMetricsNodeStruct
+
+  offset# = \_ -> \_ -> 0
+
+{-| An owned, ordered list of (name, type) fields. Read with schema_get_count and schema_get_field. Destroy via schema_destroy.
+
+    __C declaration:__ @struct _duckdb_v2_schema@
+
+    __defined at:__ @duckdb_v2.h 4681:16@
+
+    __exported by:__ @duckdb_v2.h@
+-}
+data DuckDBV2SchemaStruct
+
+instance Marshal.StaticSize DuckDBV2SchemaStruct where
+
+  staticSizeOf = \_ -> (8 :: Int)
+
+  staticAlignment = \_ -> (8 :: Int)
+
+{-| An owned, ordered list of (name, type) fields. Read with schema_get_count and schema_get_field. Destroy via schema_destroy.
+
+    __C declaration:__ @duckdb_v2_schema_handle@
+
+    __defined at:__ @duckdb_v2.h 4683:5@
+
+    __exported by:__ @duckdb_v2.h@
+-}
+newtype DuckDBV2SchemaHandle = DuckDBV2SchemaHandle
+  { unwrap :: BG.Ptr DuckDBV2SchemaStruct
+  }
+  deriving stock (Eq, BG.Generic, Ord, Show)
+  deriving newtype
+    ( BG.HasFFIType
+    , Marshal.ReadRaw
+    , Marshal.StaticSize
+    , BG.Storable
+    , Marshal.WriteRaw
+    )
+
+instance ( ty ~ BG.Ptr DuckDBV2SchemaStruct
+         ) => BG.CompatHasField.HasField "unwrap" DuckDBV2SchemaHandle ty where
+
+  hasField =
+    \x0 ->
+      (\y1 ->
+         DuckDBV2SchemaHandle {unwrap = y1}, BG.getField @"unwrap" x0)
+
+instance ( ty ~ BG.Ptr DuckDBV2SchemaStruct
+         ) => BG.HasField "unwrap" (BG.Ptr DuckDBV2SchemaHandle) (BG.Ptr ty) where
+
+  getField = HasCField.fromPtr (BG.Proxy @"unwrap")
+
+instance HasCField.HasCField DuckDBV2SchemaHandle "unwrap" where
+
+  type CFieldType DuckDBV2SchemaHandle "unwrap" =
+    BG.Ptr DuckDBV2SchemaStruct
+
+  offset# = \_ -> \_ -> 0
+
+{-| The lexical class of a token.
+
+    __C declaration:__ @enum DUCKDB_V2_TOKEN_TYPE@
+
+    __defined at:__ @duckdb_v2.h 4755:14@
+
+    __exported by:__ @duckdb_v2.h@
+-}
+newtype DuckDBV2TokenType = DuckDBV2TokenType
+  { unwrap :: BG.CUInt
+  }
+  deriving stock (Eq, BG.Generic, Ord)
+  deriving newtype (BG.HasFFIType)
+
+instance Marshal.StaticSize DuckDBV2TokenType where
+
+  staticSizeOf = \_ -> (4 :: Int)
+
+  staticAlignment = \_ -> (4 :: Int)
+
+instance Marshal.ReadRaw DuckDBV2TokenType where
+
+  readRaw =
+    \ptr0 ->
+          pure DuckDBV2TokenType
+      <*> Marshal.readRawByteOff ptr0 (0 :: Int)
+
+instance Marshal.WriteRaw DuckDBV2TokenType where
+
+  writeRaw =
+    \ptr0 ->
+      \s1 ->
+        case s1 of
+          DuckDBV2TokenType unwrap2 ->
+            Marshal.writeRawByteOff ptr0 (0 :: Int) unwrap2
+
+deriving via Marshal.EquivStorable DuckDBV2TokenType instance BG.Storable DuckDBV2TokenType
+
+deriving via BG.CUInt instance BG.Prim DuckDBV2TokenType
+
+instance CEnum.CEnum DuckDBV2TokenType where
+
+  type CEnumZ DuckDBV2TokenType = BG.CUInt
+
+  toCEnum = DuckDBV2TokenType
+
+  fromCEnum = BG.getField @"unwrap"
+
+  declaredValues =
+    \_ ->
+      CEnum.declaredValuesFromList [ (0, BG.singleton "DuckDBV2TokenTypeInvalid")
+                                   , (1, BG.singleton "DuckDBV2TokenTypeKeyword")
+                                   , (2, BG.singleton "DuckDBV2TokenTypeIdentifier")
+                                   , (3, BG.singleton "DuckDBV2TokenTypeStringLiteral")
+                                   , (4, BG.singleton "DuckDBV2TokenTypeNumberLiteral")
+                                   , (5, BG.singleton "DuckDBV2TokenTypeOperator")
+                                   , (6, BG.singleton "DuckDBV2TokenTypeComment")
+                                   , (7, BG.singleton "DuckDBV2TokenTypeTerminator")
+                                   , (8, BG.singleton "DuckDBV2TokenTypeEndOfInput")
+                                   , (2147483647, BG.singleton "DuckDBV2TokenTypeMaxEnum")
+                                   ]
+
+  showsUndeclared =
+    CEnum.showsWrappedUndeclared "DuckDBV2TokenType"
+
+  readPrecUndeclared =
+    CEnum.readPrecWrappedUndeclared "DuckDBV2TokenType"
+
+instance Show DuckDBV2TokenType where
+
+  showsPrec = CEnum.shows
+
+instance Read DuckDBV2TokenType where
+
+  readPrec = CEnum.readPrec
+
+  readList = BG.readListDefault
+
+  readListPrec = BG.readListPrecDefault
+
+instance ( ty ~ BG.CUInt
+         ) => BG.CompatHasField.HasField "unwrap" DuckDBV2TokenType ty where
+
+  hasField =
+    \x0 ->
+      (\y1 ->
+         DuckDBV2TokenType {unwrap = y1}, BG.getField @"unwrap" x0)
+
+instance ( ty ~ BG.CUInt
+         ) => BG.HasField "unwrap" (BG.Ptr DuckDBV2TokenType) (BG.Ptr ty) where
+
+  getField = HasCField.fromPtr (BG.Proxy @"unwrap")
+
+instance HasCField.HasCField DuckDBV2TokenType "unwrap" where
+
+  type CFieldType DuckDBV2TokenType "unwrap" = BG.CUInt
+
+  offset# = \_ -> \_ -> 0
+
+{-| Not an actual token class; out_type is set to this when @duckdb_v2_token_iterator_next()@ fails.
+
+    __C declaration:__ @DUCKDB_V2_TOKEN_TYPE_INVALID@
+
+    __defined at:__ @duckdb_v2.h 4757:2@
+
+    __exported by:__ @duckdb_v2.h@
+-}
+pattern DuckDBV2TokenTypeInvalid :: DuckDBV2TokenType
+pattern DuckDBV2TokenTypeInvalid = DuckDBV2TokenType 0
+
+{-| A keyword of the connection\'s grammar.
+
+    __C declaration:__ @DUCKDB_V2_TOKEN_TYPE_KEYWORD@
+
+    __defined at:__ @duckdb_v2.h 4760:2@
+
+    __exported by:__ @duckdb_v2.h@
+-}
+pattern DuckDBV2TokenTypeKeyword :: DuckDBV2TokenType
+pattern DuckDBV2TokenTypeKeyword = DuckDBV2TokenType 1
+
+{-| A bare or double-quoted identifier, quotes included.
+
+    __C declaration:__ @DUCKDB_V2_TOKEN_TYPE_IDENTIFIER@
+
+    __defined at:__ @duckdb_v2.h 4763:2@
+
+    __exported by:__ @duckdb_v2.h@
+-}
+pattern DuckDBV2TokenTypeIdentifier :: DuckDBV2TokenType
+pattern DuckDBV2TokenTypeIdentifier = DuckDBV2TokenType 2
+
+{-| A quoted or dollar-quoted string, delimiters included.
+
+    __C declaration:__ @DUCKDB_V2_TOKEN_TYPE_STRING_LITERAL@
+
+    __defined at:__ @duckdb_v2.h 4766:2@
+
+    __exported by:__ @duckdb_v2.h@
+-}
+pattern DuckDBV2TokenTypeStringLiteral :: DuckDBV2TokenType
+pattern DuckDBV2TokenTypeStringLiteral = DuckDBV2TokenType 3
+
+{-| A numeric literal.
+
+    __C declaration:__ @DUCKDB_V2_TOKEN_TYPE_NUMBER_LITERAL@
+
+    __defined at:__ @duckdb_v2.h 4769:2@
+
+    __exported by:__ @duckdb_v2.h@
+-}
+pattern DuckDBV2TokenTypeNumberLiteral :: DuckDBV2TokenType
+pattern DuckDBV2TokenTypeNumberLiteral = DuckDBV2TokenType 4
+
+{-| An operator or punctuation run other than the statement terminator.
+
+    __C declaration:__ @DUCKDB_V2_TOKEN_TYPE_OPERATOR@
+
+    __defined at:__ @duckdb_v2.h 4772:2@
+
+    __exported by:__ @duckdb_v2.h@
+-}
+pattern DuckDBV2TokenTypeOperator :: DuckDBV2TokenType
+pattern DuckDBV2TokenTypeOperator = DuckDBV2TokenType 5
+
+{-| A line or block comment, delimiters included.
+
+    __C declaration:__ @DUCKDB_V2_TOKEN_TYPE_COMMENT@
+
+    __defined at:__ @duckdb_v2.h 4775:2@
+
+    __exported by:__ @duckdb_v2.h@
+-}
+pattern DuckDBV2TokenTypeComment :: DuckDBV2TokenType
+pattern DuckDBV2TokenTypeComment = DuckDBV2TokenType 6
+
+{-| A statement-terminating semicolon.
+
+    __C declaration:__ @DUCKDB_V2_TOKEN_TYPE_TERMINATOR@
+
+    __defined at:__ @duckdb_v2.h 4778:2@
+
+    __exported by:__ @duckdb_v2.h@
+-}
+pattern DuckDBV2TokenTypeTerminator :: DuckDBV2TokenType
+pattern DuckDBV2TokenTypeTerminator = DuckDBV2TokenType 7
+
+{-| Not a token; reported by token_iterator_next once the input is exhausted, with start equal to the input length and length 0.
+
+    __C declaration:__ @DUCKDB_V2_TOKEN_TYPE_END_OF_INPUT@
+
+    __defined at:__ @duckdb_v2.h 4784:2@
+
+    __exported by:__ @duckdb_v2.h@
+-}
+pattern DuckDBV2TokenTypeEndOfInput :: DuckDBV2TokenType
+pattern DuckDBV2TokenTypeEndOfInput = DuckDBV2TokenType 8
+
+{-| __C declaration:__ @DUCKDB_V2_TOKEN_TYPE_MAX_ENUM@
+
+    __defined at:__ @duckdb_v2.h 4785:2@
+
+    __exported by:__ @duckdb_v2.h@
+-}
+pattern DuckDBV2TokenTypeMaxEnum :: DuckDBV2TokenType
+pattern DuckDBV2TokenTypeMaxEnum = DuckDBV2TokenType 2147483647
+
+{-| An opaque, owned handle to an iterator over the tokens of a SQL string, produced by tokenize_sql.
+
+    __C declaration:__ @struct _duckdb_v2_token_iterator@
+
+    __defined at:__ @duckdb_v2.h 4793:16@
+
+    __exported by:__ @duckdb_v2.h@
+-}
+data DuckDBV2TokenIteratorStruct
+
+instance Marshal.StaticSize DuckDBV2TokenIteratorStruct where
+
+  staticSizeOf = \_ -> (8 :: Int)
+
+  staticAlignment = \_ -> (8 :: Int)
+
+{-| An opaque, owned handle to an iterator over the tokens of a SQL string, produced by tokenize_sql.
+
+    __C declaration:__ @duckdb_v2_token_iterator_handle@
+
+    __defined at:__ @duckdb_v2.h 4795:5@
+
+    __exported by:__ @duckdb_v2.h@
+-}
+newtype DuckDBV2TokenIteratorHandle = DuckDBV2TokenIteratorHandle
+  { unwrap :: BG.Ptr DuckDBV2TokenIteratorStruct
+  }
+  deriving stock (Eq, BG.Generic, Ord, Show)
+  deriving newtype
+    ( BG.HasFFIType
+    , Marshal.ReadRaw
+    , Marshal.StaticSize
+    , BG.Storable
+    , Marshal.WriteRaw
+    )
+
+instance ( ty ~ BG.Ptr DuckDBV2TokenIteratorStruct
+         ) => BG.CompatHasField.HasField "unwrap" DuckDBV2TokenIteratorHandle ty where
+
+  hasField =
+    \x0 ->
+      (\y1 ->
+         DuckDBV2TokenIteratorHandle {unwrap = y1}, BG.getField @"unwrap" x0)
+
+instance ( ty ~ BG.Ptr DuckDBV2TokenIteratorStruct
+         ) => BG.HasField "unwrap" (BG.Ptr DuckDBV2TokenIteratorHandle) (BG.Ptr ty) where
+
+  getField = HasCField.fromPtr (BG.Proxy @"unwrap")
+
+instance HasCField.HasCField DuckDBV2TokenIteratorHandle "unwrap" where
+
+  type CFieldType DuckDBV2TokenIteratorHandle "unwrap" =
+    BG.Ptr DuckDBV2TokenIteratorStruct
+
+  offset# = \_ -> \_ -> 0
+
+{-| An owned opaque handle to a custom aggregate function being built. Created with @duckdb_v2_aggregate_function_create()@ , configured with the setter functions (e.g. @duckdb_v2_aggregate_function_set_name()@ , @duckdb_v2_aggregate_function_set_update_callback()@ , etc.) and the signature obtained via @duckdb_v2_aggregate_function_get_signature()@ , made available with @duckdb_v2_connection_register_aggregate_function()@ or @duckdb_v2_extension_register_aggregate_function()@ , and destroyed with @duckdb_v2_aggregate_function_destroy()@ .
+
+    __C declaration:__ @struct _duckdb_v2_aggregate_function@
+
+    __defined at:__ @duckdb_v2.h 4907:16@
+
+    __exported by:__ @duckdb_v2.h@
+-}
+data DuckDBV2AggregateFunctionStruct
+
+instance Marshal.StaticSize DuckDBV2AggregateFunctionStruct where
+
+  staticSizeOf = \_ -> (8 :: Int)
+
+  staticAlignment = \_ -> (8 :: Int)
+
+{-| An owned opaque handle to a custom aggregate function being built. Created with @duckdb_v2_aggregate_function_create()@ , configured with the setter functions (e.g. @duckdb_v2_aggregate_function_set_name()@ , @duckdb_v2_aggregate_function_set_update_callback()@ , etc.) and the signature obtained via @duckdb_v2_aggregate_function_get_signature()@ , made available with @duckdb_v2_connection_register_aggregate_function()@ or @duckdb_v2_extension_register_aggregate_function()@ , and destroyed with @duckdb_v2_aggregate_function_destroy()@ .
+
+    __C declaration:__ @duckdb_v2_aggregate_function_handle@
+
+    __defined at:__ @duckdb_v2.h 4909:5@
+
+    __exported by:__ @duckdb_v2.h@
+-}
+newtype DuckDBV2AggregateFunctionHandle = DuckDBV2AggregateFunctionHandle
+  { unwrap :: BG.Ptr DuckDBV2AggregateFunctionStruct
+  }
+  deriving stock (Eq, BG.Generic, Ord, Show)
+  deriving newtype
+    ( BG.HasFFIType
+    , Marshal.ReadRaw
+    , Marshal.StaticSize
+    , BG.Storable
+    , Marshal.WriteRaw
+    )
+
+instance ( ty ~ BG.Ptr DuckDBV2AggregateFunctionStruct
+         ) => BG.CompatHasField.HasField "unwrap" DuckDBV2AggregateFunctionHandle ty where
+
+  hasField =
+    \x0 ->
+      ( \y1 ->
+          DuckDBV2AggregateFunctionHandle {unwrap = y1}
+      , BG.getField @"unwrap" x0
+      )
+
+instance ( ty ~ BG.Ptr DuckDBV2AggregateFunctionStruct
+         ) => BG.HasField "unwrap" (BG.Ptr DuckDBV2AggregateFunctionHandle) (BG.Ptr ty) where
+
+  getField = HasCField.fromPtr (BG.Proxy @"unwrap")
+
+instance HasCField.HasCField DuckDBV2AggregateFunctionHandle "unwrap" where
+
+  type CFieldType DuckDBV2AggregateFunctionHandle "unwrap" =
+    BG.Ptr DuckDBV2AggregateFunctionStruct
+
+  offset# = \_ -> \_ -> 0
+
+{-| A borrowed opaque handle to the result of an aggregate function\'s "bind" phase. The "bind" callback receives this handle next to a @t'DuckDBV2FunctionBindInfoHandle'@ , which gives access to the arguments, the user data and the bind data, and can use it to set the return type of the call site being bound.
+
+    __C declaration:__ @struct _duckdb_v2_aggregate_function_bind_info@
+
+    __defined at:__ @duckdb_v2.h 4916:16@
+
+    __exported by:__ @duckdb_v2.h@
+-}
+data DuckDBV2AggregateFunctionBindInfoStruct
+
+instance Marshal.StaticSize DuckDBV2AggregateFunctionBindInfoStruct where
+
+  staticSizeOf = \_ -> (8 :: Int)
+
+  staticAlignment = \_ -> (8 :: Int)
+
+{-| A borrowed opaque handle to the result of an aggregate function\'s "bind" phase. The "bind" callback receives this handle next to a @t'DuckDBV2FunctionBindInfoHandle'@ , which gives access to the arguments, the user data and the bind data, and can use it to set the return type of the call site being bound.
+
+    __C declaration:__ @duckdb_v2_aggregate_function_bind_info_handle@
+
+    __defined at:__ @duckdb_v2.h 4918:5@
+
+    __exported by:__ @duckdb_v2.h@
+-}
+newtype DuckDBV2AggregateFunctionBindInfoHandle = DuckDBV2AggregateFunctionBindInfoHandle
+  { unwrap :: BG.Ptr DuckDBV2AggregateFunctionBindInfoStruct
+  }
+  deriving stock (Eq, BG.Generic, Ord, Show)
+  deriving newtype
+    ( BG.HasFFIType
+    , Marshal.ReadRaw
+    , Marshal.StaticSize
+    , BG.Storable
+    , Marshal.WriteRaw
+    )
+
+instance ( ty ~ BG.Ptr DuckDBV2AggregateFunctionBindInfoStruct
+         ) => BG.CompatHasField.HasField "unwrap" DuckDBV2AggregateFunctionBindInfoHandle ty where
+
+  hasField =
+    \x0 ->
+      ( \y1 ->
+          DuckDBV2AggregateFunctionBindInfoHandle {unwrap = y1}
+      , BG.getField @"unwrap" x0
+      )
+
+instance ( ty ~ BG.Ptr DuckDBV2AggregateFunctionBindInfoStruct
+         ) => BG.HasField "unwrap" (BG.Ptr DuckDBV2AggregateFunctionBindInfoHandle) (BG.Ptr ty) where
+
+  getField = HasCField.fromPtr (BG.Proxy @"unwrap")
+
+instance HasCField.HasCField DuckDBV2AggregateFunctionBindInfoHandle "unwrap" where
+
+  type CFieldType DuckDBV2AggregateFunctionBindInfoHandle "unwrap" =
+    BG.Ptr DuckDBV2AggregateFunctionBindInfoStruct
+
+  offset# = \_ -> \_ -> 0
+
+{-| A borrowed opaque handle to the arguments supplied to an aggregate function during the state sizing "size" phase. The "size" callback receives this handle and must use it to report the size of a single aggregate state in bytes.
+
+    __C declaration:__ @struct _duckdb_v2_aggregate_function_size_info@
+
+    __defined at:__ @duckdb_v2.h 4924:16@
+
+    __exported by:__ @duckdb_v2.h@
+-}
+data DuckDBV2AggregateFunctionSizeInfoStruct
+
+instance Marshal.StaticSize DuckDBV2AggregateFunctionSizeInfoStruct where
+
+  staticSizeOf = \_ -> (8 :: Int)
+
+  staticAlignment = \_ -> (8 :: Int)
+
+{-| A borrowed opaque handle to the arguments supplied to an aggregate function during the state sizing "size" phase. The "size" callback receives this handle and must use it to report the size of a single aggregate state in bytes.
+
+    __C declaration:__ @duckdb_v2_aggregate_function_size_info_handle@
+
+    __defined at:__ @duckdb_v2.h 4926:5@
+
+    __exported by:__ @duckdb_v2.h@
+-}
+newtype DuckDBV2AggregateFunctionSizeInfoHandle = DuckDBV2AggregateFunctionSizeInfoHandle
+  { unwrap :: BG.Ptr DuckDBV2AggregateFunctionSizeInfoStruct
+  }
+  deriving stock (Eq, BG.Generic, Ord, Show)
+  deriving newtype
+    ( BG.HasFFIType
+    , Marshal.ReadRaw
+    , Marshal.StaticSize
+    , BG.Storable
+    , Marshal.WriteRaw
+    )
+
+instance ( ty ~ BG.Ptr DuckDBV2AggregateFunctionSizeInfoStruct
+         ) => BG.CompatHasField.HasField "unwrap" DuckDBV2AggregateFunctionSizeInfoHandle ty where
+
+  hasField =
+    \x0 ->
+      ( \y1 ->
+          DuckDBV2AggregateFunctionSizeInfoHandle {unwrap = y1}
+      , BG.getField @"unwrap" x0
+      )
+
+instance ( ty ~ BG.Ptr DuckDBV2AggregateFunctionSizeInfoStruct
+         ) => BG.HasField "unwrap" (BG.Ptr DuckDBV2AggregateFunctionSizeInfoHandle) (BG.Ptr ty) where
+
+  getField = HasCField.fromPtr (BG.Proxy @"unwrap")
+
+instance HasCField.HasCField DuckDBV2AggregateFunctionSizeInfoHandle "unwrap" where
+
+  type CFieldType DuckDBV2AggregateFunctionSizeInfoHandle "unwrap" =
+    BG.Ptr DuckDBV2AggregateFunctionSizeInfoStruct
+
+  offset# = \_ -> \_ -> 0
+
+{-| A borrowed opaque handle to the arguments supplied to an aggregate function during the state initialization "init" phase. The "init" callback receives this handle and can use it to access the array of aggregate states it must initialize in place.
+
+    __C declaration:__ @struct _duckdb_v2_aggregate_function_init_info@
+
+    __defined at:__ @duckdb_v2.h 4933:16@
+
+    __exported by:__ @duckdb_v2.h@
+-}
+data DuckDBV2AggregateFunctionInitInfoStruct
+
+instance Marshal.StaticSize DuckDBV2AggregateFunctionInitInfoStruct where
+
+  staticSizeOf = \_ -> (8 :: Int)
+
+  staticAlignment = \_ -> (8 :: Int)
+
+{-| A borrowed opaque handle to the arguments supplied to an aggregate function during the state initialization "init" phase. The "init" callback receives this handle and can use it to access the array of aggregate states it must initialize in place.
+
+    __C declaration:__ @duckdb_v2_aggregate_function_init_info_handle@
+
+    __defined at:__ @duckdb_v2.h 4935:5@
+
+    __exported by:__ @duckdb_v2.h@
+-}
+newtype DuckDBV2AggregateFunctionInitInfoHandle = DuckDBV2AggregateFunctionInitInfoHandle
+  { unwrap :: BG.Ptr DuckDBV2AggregateFunctionInitInfoStruct
+  }
+  deriving stock (Eq, BG.Generic, Ord, Show)
+  deriving newtype
+    ( BG.HasFFIType
+    , Marshal.ReadRaw
+    , Marshal.StaticSize
+    , BG.Storable
+    , Marshal.WriteRaw
+    )
+
+instance ( ty ~ BG.Ptr DuckDBV2AggregateFunctionInitInfoStruct
+         ) => BG.CompatHasField.HasField "unwrap" DuckDBV2AggregateFunctionInitInfoHandle ty where
+
+  hasField =
+    \x0 ->
+      ( \y1 ->
+          DuckDBV2AggregateFunctionInitInfoHandle {unwrap = y1}
+      , BG.getField @"unwrap" x0
+      )
+
+instance ( ty ~ BG.Ptr DuckDBV2AggregateFunctionInitInfoStruct
+         ) => BG.HasField "unwrap" (BG.Ptr DuckDBV2AggregateFunctionInitInfoHandle) (BG.Ptr ty) where
+
+  getField = HasCField.fromPtr (BG.Proxy @"unwrap")
+
+instance HasCField.HasCField DuckDBV2AggregateFunctionInitInfoHandle "unwrap" where
+
+  type CFieldType DuckDBV2AggregateFunctionInitInfoHandle "unwrap" =
+    BG.Ptr DuckDBV2AggregateFunctionInitInfoStruct
+
+  offset# = \_ -> \_ -> 0
+
+{-| A borrowed opaque handle to the arguments supplied to an aggregate function during the "update" phase. The "update" callback receives this handle and can use it to access the input argument vectors, the number of rows to process, and the aggregate state each row must be aggregated into.
+
+    __C declaration:__ @struct _duckdb_v2_aggregate_function_update_info@
+
+    __defined at:__ @duckdb_v2.h 4942:16@
+
+    __exported by:__ @duckdb_v2.h@
+-}
+data DuckDBV2AggregateFunctionUpdateInfoStruct
+
+instance Marshal.StaticSize DuckDBV2AggregateFunctionUpdateInfoStruct where
+
+  staticSizeOf = \_ -> (8 :: Int)
+
+  staticAlignment = \_ -> (8 :: Int)
+
+{-| A borrowed opaque handle to the arguments supplied to an aggregate function during the "update" phase. The "update" callback receives this handle and can use it to access the input argument vectors, the number of rows to process, and the aggregate state each row must be aggregated into.
+
+    __C declaration:__ @duckdb_v2_aggregate_function_update_info_handle@
+
+    __defined at:__ @duckdb_v2.h 4944:5@
+
+    __exported by:__ @duckdb_v2.h@
+-}
+newtype DuckDBV2AggregateFunctionUpdateInfoHandle = DuckDBV2AggregateFunctionUpdateInfoHandle
+  { unwrap :: BG.Ptr DuckDBV2AggregateFunctionUpdateInfoStruct
+  }
+  deriving stock (Eq, BG.Generic, Ord, Show)
+  deriving newtype
+    ( BG.HasFFIType
+    , Marshal.ReadRaw
+    , Marshal.StaticSize
+    , BG.Storable
+    , Marshal.WriteRaw
+    )
+
+instance ( ty ~ BG.Ptr DuckDBV2AggregateFunctionUpdateInfoStruct
+         ) => BG.CompatHasField.HasField "unwrap" DuckDBV2AggregateFunctionUpdateInfoHandle ty where
+
+  hasField =
+    \x0 ->
+      ( \y1 ->
+          DuckDBV2AggregateFunctionUpdateInfoHandle {unwrap = y1}
+      , BG.getField @"unwrap" x0
+      )
+
+instance ( ty ~ BG.Ptr DuckDBV2AggregateFunctionUpdateInfoStruct
+         ) => BG.HasField "unwrap" (BG.Ptr DuckDBV2AggregateFunctionUpdateInfoHandle) (BG.Ptr ty) where
+
+  getField = HasCField.fromPtr (BG.Proxy @"unwrap")
+
+instance HasCField.HasCField DuckDBV2AggregateFunctionUpdateInfoHandle "unwrap" where
+
+  type CFieldType DuckDBV2AggregateFunctionUpdateInfoHandle "unwrap" =
+    BG.Ptr DuckDBV2AggregateFunctionUpdateInfoStruct
+
+  offset# = \_ -> \_ -> 0
+
+{-| A borrowed opaque handle to the arguments supplied to an aggregate function during the "combine" phase. The "combine" callback receives this handle and can use it to access the source and target aggregate state arrays to merge.
+
+    __C declaration:__ @struct _duckdb_v2_aggregate_function_combine_info@
+
+    __defined at:__ @duckdb_v2.h 4950:16@
+
+    __exported by:__ @duckdb_v2.h@
+-}
+data DuckDBV2AggregateFunctionCombineInfoStruct
+
+instance Marshal.StaticSize DuckDBV2AggregateFunctionCombineInfoStruct where
+
+  staticSizeOf = \_ -> (8 :: Int)
+
+  staticAlignment = \_ -> (8 :: Int)
+
+{-| A borrowed opaque handle to the arguments supplied to an aggregate function during the "combine" phase. The "combine" callback receives this handle and can use it to access the source and target aggregate state arrays to merge.
+
+    __C declaration:__ @duckdb_v2_aggregate_function_combine_info_handle@
+
+    __defined at:__ @duckdb_v2.h 4952:5@
+
+    __exported by:__ @duckdb_v2.h@
+-}
+newtype DuckDBV2AggregateFunctionCombineInfoHandle = DuckDBV2AggregateFunctionCombineInfoHandle
+  { unwrap :: BG.Ptr DuckDBV2AggregateFunctionCombineInfoStruct
+  }
+  deriving stock (Eq, BG.Generic, Ord, Show)
+  deriving newtype
+    ( BG.HasFFIType
+    , Marshal.ReadRaw
+    , Marshal.StaticSize
+    , BG.Storable
+    , Marshal.WriteRaw
+    )
+
+instance ( ty ~ BG.Ptr DuckDBV2AggregateFunctionCombineInfoStruct
+         ) => BG.CompatHasField.HasField "unwrap" DuckDBV2AggregateFunctionCombineInfoHandle ty where
+
+  hasField =
+    \x0 ->
+      ( \y1 ->
+          DuckDBV2AggregateFunctionCombineInfoHandle {unwrap = y1}
+      , BG.getField @"unwrap" x0
+      )
+
+instance ( ty ~ BG.Ptr DuckDBV2AggregateFunctionCombineInfoStruct
+         ) => BG.HasField "unwrap" (BG.Ptr DuckDBV2AggregateFunctionCombineInfoHandle) (BG.Ptr ty) where
+
+  getField = HasCField.fromPtr (BG.Proxy @"unwrap")
+
+instance HasCField.HasCField DuckDBV2AggregateFunctionCombineInfoHandle "unwrap" where
+
+  type CFieldType DuckDBV2AggregateFunctionCombineInfoHandle "unwrap" =
+    BG.Ptr DuckDBV2AggregateFunctionCombineInfoStruct
+
+  offset# = \_ -> \_ -> 0
+
+{-| A borrowed opaque handle to the arguments supplied to an aggregate function during the "finalize" phase. The "finalize" callback receives this handle and can use it to access the aggregate states and the result vector and offset to write their final values to.
+
+    __C declaration:__ @struct _duckdb_v2_aggregate_function_finalize_info@
+
+    __defined at:__ @duckdb_v2.h 4959:16@
+
+    __exported by:__ @duckdb_v2.h@
+-}
+data DuckDBV2AggregateFunctionFinalizeInfoStruct
+
+instance Marshal.StaticSize DuckDBV2AggregateFunctionFinalizeInfoStruct where
+
+  staticSizeOf = \_ -> (8 :: Int)
+
+  staticAlignment = \_ -> (8 :: Int)
+
+{-| A borrowed opaque handle to the arguments supplied to an aggregate function during the "finalize" phase. The "finalize" callback receives this handle and can use it to access the aggregate states and the result vector and offset to write their final values to.
+
+    __C declaration:__ @duckdb_v2_aggregate_function_finalize_info_handle@
+
+    __defined at:__ @duckdb_v2.h 4961:5@
+
+    __exported by:__ @duckdb_v2.h@
+-}
+newtype DuckDBV2AggregateFunctionFinalizeInfoHandle = DuckDBV2AggregateFunctionFinalizeInfoHandle
+  { unwrap :: BG.Ptr DuckDBV2AggregateFunctionFinalizeInfoStruct
+  }
+  deriving stock (Eq, BG.Generic, Ord, Show)
+  deriving newtype
+    ( BG.HasFFIType
+    , Marshal.ReadRaw
+    , Marshal.StaticSize
+    , BG.Storable
+    , Marshal.WriteRaw
+    )
+
+instance ( ty ~ BG.Ptr DuckDBV2AggregateFunctionFinalizeInfoStruct
+         ) => BG.CompatHasField.HasField "unwrap" DuckDBV2AggregateFunctionFinalizeInfoHandle ty where
+
+  hasField =
+    \x0 ->
+      ( \y1 ->
+          DuckDBV2AggregateFunctionFinalizeInfoHandle {unwrap = y1}
+      , BG.getField @"unwrap" x0
+      )
+
+instance ( ty ~ BG.Ptr DuckDBV2AggregateFunctionFinalizeInfoStruct
+         ) => BG.HasField "unwrap" (BG.Ptr DuckDBV2AggregateFunctionFinalizeInfoHandle) (BG.Ptr ty) where
+
+  getField = HasCField.fromPtr (BG.Proxy @"unwrap")
+
+instance HasCField.HasCField DuckDBV2AggregateFunctionFinalizeInfoHandle "unwrap" where
+
+  type CFieldType DuckDBV2AggregateFunctionFinalizeInfoHandle "unwrap" =
+    BG.Ptr DuckDBV2AggregateFunctionFinalizeInfoStruct
+
+  offset# = \_ -> \_ -> 0
+
+{-| A borrowed opaque handle to the arguments supplied to an aggregate function during the state destruction "destroy" phase. The "destroy" callback receives this handle and can use it to access the array of aggregate states whose resources must be released.
+
+    __C declaration:__ @struct _duckdb_v2_aggregate_function_destroy_info@
+
+    __defined at:__ @duckdb_v2.h 4968:16@
+
+    __exported by:__ @duckdb_v2.h@
+-}
+data DuckDBV2AggregateFunctionDestroyInfoStruct
+
+instance Marshal.StaticSize DuckDBV2AggregateFunctionDestroyInfoStruct where
+
+  staticSizeOf = \_ -> (8 :: Int)
+
+  staticAlignment = \_ -> (8 :: Int)
+
+{-| A borrowed opaque handle to the arguments supplied to an aggregate function during the state destruction "destroy" phase. The "destroy" callback receives this handle and can use it to access the array of aggregate states whose resources must be released.
+
+    __C declaration:__ @duckdb_v2_aggregate_function_destroy_info_handle@
+
+    __defined at:__ @duckdb_v2.h 4970:5@
+
+    __exported by:__ @duckdb_v2.h@
+-}
+newtype DuckDBV2AggregateFunctionDestroyInfoHandle = DuckDBV2AggregateFunctionDestroyInfoHandle
+  { unwrap :: BG.Ptr DuckDBV2AggregateFunctionDestroyInfoStruct
+  }
+  deriving stock (Eq, BG.Generic, Ord, Show)
+  deriving newtype
+    ( BG.HasFFIType
+    , Marshal.ReadRaw
+    , Marshal.StaticSize
+    , BG.Storable
+    , Marshal.WriteRaw
+    )
+
+instance ( ty ~ BG.Ptr DuckDBV2AggregateFunctionDestroyInfoStruct
+         ) => BG.CompatHasField.HasField "unwrap" DuckDBV2AggregateFunctionDestroyInfoHandle ty where
+
+  hasField =
+    \x0 ->
+      ( \y1 ->
+          DuckDBV2AggregateFunctionDestroyInfoHandle {unwrap = y1}
+      , BG.getField @"unwrap" x0
+      )
+
+instance ( ty ~ BG.Ptr DuckDBV2AggregateFunctionDestroyInfoStruct
+         ) => BG.HasField "unwrap" (BG.Ptr DuckDBV2AggregateFunctionDestroyInfoHandle) (BG.Ptr ty) where
+
+  getField = HasCField.fromPtr (BG.Proxy @"unwrap")
+
+instance HasCField.HasCField DuckDBV2AggregateFunctionDestroyInfoHandle "unwrap" where
+
+  type CFieldType DuckDBV2AggregateFunctionDestroyInfoHandle "unwrap" =
+    BG.Ptr DuckDBV2AggregateFunctionDestroyInfoStruct
+
+  offset# = \_ -> \_ -> 0
+
+{-| Auxiliary type used by t'DuckDBV2AggregateFunctionBindCallbackFn'
+
+    __C declaration:__ @duckdb_v2_aggregate_function_bind_callback_fn@
+
+    __defined at:__ @duckdb_v2.h 4976:16@
+
+    __exported by:__ @duckdb_v2.h@
+-}
+newtype DuckDBV2AggregateFunctionBindCallbackFn_Aux = DuckDBV2AggregateFunctionBindCallbackFn_Aux
+  { unwrap :: DuckDBV2FunctionBindInfoHandle -> DuckDBV2AggregateFunctionBindInfoHandle -> DuckDBV2ContextHandle -> BG.Ptr DuckDBV2ErrorInfoHandle -> IO ()
+  }
+  deriving stock (BG.Generic)
+
+-- __unique:__ @toDuckDBV2AggregateFunctionBindCallbackFn_Aux@
+foreign import ccall safe "wrapper" hs_bindgen_e72836ea71424818_base ::
+     (BG.Ptr BG.Void -> BG.Ptr BG.Void -> BG.Ptr BG.Void -> BG.Ptr BG.Void -> IO ())
+  -> IO (BG.FunPtr (BG.Ptr BG.Void -> BG.Ptr BG.Void -> BG.Ptr BG.Void -> BG.Ptr BG.Void -> IO ()))
+
+-- __unique:__ @toDuckDBV2AggregateFunctionBindCallbackFn_Aux@
+hs_bindgen_e72836ea71424818 ::
+     DuckDBV2AggregateFunctionBindCallbackFn_Aux
+  -> IO (BG.FunPtr DuckDBV2AggregateFunctionBindCallbackFn_Aux)
+hs_bindgen_e72836ea71424818 =
+  \fun0 ->
+    fmap BG.castFunPtr (hs_bindgen_e72836ea71424818_base (\x1 ->
+                                                            \x2 ->
+                                                              \x3 ->
+                                                                \x4 ->
+                                                                  BG.getField @"unwrap" fun0 (BG.fromFFIType x1) (BG.fromFFIType x2) (BG.fromFFIType x3) (BG.fromFFIType x4)))
+
+-- __unique:__ @fromDuckDBV2AggregateFunctionBindCallbackFn_Aux@
+foreign import ccall safe "dynamic" hs_bindgen_bb82cd6533068995_base ::
+     BG.FunPtr (BG.Ptr BG.Void -> BG.Ptr BG.Void -> BG.Ptr BG.Void -> BG.Ptr BG.Void -> IO ())
+  -> BG.Ptr BG.Void -> BG.Ptr BG.Void -> BG.Ptr BG.Void -> BG.Ptr BG.Void -> IO ()
+
+-- __unique:__ @fromDuckDBV2AggregateFunctionBindCallbackFn_Aux@
+hs_bindgen_bb82cd6533068995 ::
+     BG.FunPtr DuckDBV2AggregateFunctionBindCallbackFn_Aux
+  -> DuckDBV2AggregateFunctionBindCallbackFn_Aux
+hs_bindgen_bb82cd6533068995 =
+  \funPtr0 ->
+    DuckDBV2AggregateFunctionBindCallbackFn_Aux (\x1 ->
+                                                   \x2 ->
+                                                     \x3 ->
+                                                       \x4 ->
+                                                         hs_bindgen_bb82cd6533068995_base (BG.castFunPtr funPtr0) (BG.toFFIType x1) (BG.toFFIType x2) (BG.toFFIType x3) (BG.toFFIType x4))
+
+instance BG.ToFunPtr DuckDBV2AggregateFunctionBindCallbackFn_Aux where
+
+  toFunPtr = hs_bindgen_e72836ea71424818
+
+instance BG.FromFunPtr DuckDBV2AggregateFunctionBindCallbackFn_Aux where
+
+  fromFunPtr = hs_bindgen_bb82cd6533068995
+
+instance ( ty ~ (DuckDBV2FunctionBindInfoHandle -> DuckDBV2AggregateFunctionBindInfoHandle -> DuckDBV2ContextHandle -> BG.Ptr DuckDBV2ErrorInfoHandle -> IO ())
+         ) => BG.CompatHasField.HasField "unwrap" DuckDBV2AggregateFunctionBindCallbackFn_Aux ty where
+
+  hasField =
+    \x0 ->
+      ( \y1 ->
+          DuckDBV2AggregateFunctionBindCallbackFn_Aux {unwrap = y1}
+      , BG.getField @"unwrap" x0
+      )
+
+instance ( ty ~ (DuckDBV2FunctionBindInfoHandle -> DuckDBV2AggregateFunctionBindInfoHandle -> DuckDBV2ContextHandle -> BG.Ptr DuckDBV2ErrorInfoHandle -> IO ())
+         ) => BG.HasField "unwrap" (BG.Ptr DuckDBV2AggregateFunctionBindCallbackFn_Aux) (BG.Ptr ty) where
+
+  getField = HasCField.fromPtr (BG.Proxy @"unwrap")
+
+instance HasCField.HasCField DuckDBV2AggregateFunctionBindCallbackFn_Aux "unwrap" where
+
+  type CFieldType DuckDBV2AggregateFunctionBindCallbackFn_Aux "unwrap" =
+    DuckDBV2FunctionBindInfoHandle -> DuckDBV2AggregateFunctionBindInfoHandle -> DuckDBV2ContextHandle -> BG.Ptr DuckDBV2ErrorInfoHandle -> IO ()
+
+  offset# = \_ -> \_ -> 0
+
+{-| __C declaration:__ @duckdb_v2_aggregate_function_bind_callback_fn@
+
+    __defined at:__ @duckdb_v2.h 4976:16@
+
+    __exported by:__ @duckdb_v2.h@
+-}
+newtype DuckDBV2AggregateFunctionBindCallbackFn = DuckDBV2AggregateFunctionBindCallbackFn
+  { unwrap :: BG.FunPtr DuckDBV2AggregateFunctionBindCallbackFn_Aux
+  }
+  deriving stock (Eq, BG.Generic, Ord, Show)
+  deriving newtype
+    ( BG.HasFFIType
+    , Marshal.ReadRaw
+    , Marshal.StaticSize
+    , BG.Storable
+    , Marshal.WriteRaw
+    )
+
+instance ( ty ~ BG.FunPtr DuckDBV2AggregateFunctionBindCallbackFn_Aux
+         ) => BG.CompatHasField.HasField "unwrap" DuckDBV2AggregateFunctionBindCallbackFn ty where
+
+  hasField =
+    \x0 ->
+      ( \y1 ->
+          DuckDBV2AggregateFunctionBindCallbackFn {unwrap = y1}
+      , BG.getField @"unwrap" x0
+      )
+
+instance ( ty ~ BG.FunPtr DuckDBV2AggregateFunctionBindCallbackFn_Aux
+         ) => BG.HasField "unwrap" (BG.Ptr DuckDBV2AggregateFunctionBindCallbackFn) (BG.Ptr ty) where
+
+  getField = HasCField.fromPtr (BG.Proxy @"unwrap")
+
+instance HasCField.HasCField DuckDBV2AggregateFunctionBindCallbackFn "unwrap" where
+
+  type CFieldType DuckDBV2AggregateFunctionBindCallbackFn "unwrap" =
+    BG.FunPtr DuckDBV2AggregateFunctionBindCallbackFn_Aux
+
+  offset# = \_ -> \_ -> 0
+
+{-| Auxiliary type used by t'DuckDBV2AggregateFunctionSizeCallbackFn'
+
+    __C declaration:__ @duckdb_v2_aggregate_function_size_callback_fn@
+
+    __defined at:__ @duckdb_v2.h 4981:16@
+
+    __exported by:__ @duckdb_v2.h@
+-}
+newtype DuckDBV2AggregateFunctionSizeCallbackFn_Aux = DuckDBV2AggregateFunctionSizeCallbackFn_Aux
+  { unwrap :: DuckDBV2AggregateFunctionSizeInfoHandle -> BG.Ptr DuckDBV2ErrorInfoHandle -> IO ()
+  }
+  deriving stock (BG.Generic)
+
+-- __unique:__ @toDuckDBV2AggregateFunctionSizeCallbackFn_Aux@
+foreign import ccall safe "wrapper" hs_bindgen_1d27784caabe73b2_base ::
+     (BG.Ptr BG.Void -> BG.Ptr BG.Void -> IO ())
+  -> IO (BG.FunPtr (BG.Ptr BG.Void -> BG.Ptr BG.Void -> IO ()))
+
+-- __unique:__ @toDuckDBV2AggregateFunctionSizeCallbackFn_Aux@
+hs_bindgen_1d27784caabe73b2 ::
+     DuckDBV2AggregateFunctionSizeCallbackFn_Aux
+  -> IO (BG.FunPtr DuckDBV2AggregateFunctionSizeCallbackFn_Aux)
+hs_bindgen_1d27784caabe73b2 =
+  \fun0 ->
+    fmap BG.castFunPtr (hs_bindgen_1d27784caabe73b2_base (\x1 ->
+                                                            \x2 ->
+                                                              BG.getField @"unwrap" fun0 (BG.fromFFIType x1) (BG.fromFFIType x2)))
+
+-- __unique:__ @fromDuckDBV2AggregateFunctionSizeCallbackFn_Aux@
+foreign import ccall safe "dynamic" hs_bindgen_1c37b8e1b8e9f463_base ::
+     BG.FunPtr (BG.Ptr BG.Void -> BG.Ptr BG.Void -> IO ())
+  -> BG.Ptr BG.Void -> BG.Ptr BG.Void -> IO ()
+
+-- __unique:__ @fromDuckDBV2AggregateFunctionSizeCallbackFn_Aux@
+hs_bindgen_1c37b8e1b8e9f463 ::
+     BG.FunPtr DuckDBV2AggregateFunctionSizeCallbackFn_Aux
+  -> DuckDBV2AggregateFunctionSizeCallbackFn_Aux
+hs_bindgen_1c37b8e1b8e9f463 =
+  \funPtr0 ->
+    DuckDBV2AggregateFunctionSizeCallbackFn_Aux (\x1 ->
+                                                   \x2 ->
+                                                     hs_bindgen_1c37b8e1b8e9f463_base (BG.castFunPtr funPtr0) (BG.toFFIType x1) (BG.toFFIType x2))
+
+instance BG.ToFunPtr DuckDBV2AggregateFunctionSizeCallbackFn_Aux where
+
+  toFunPtr = hs_bindgen_1d27784caabe73b2
+
+instance BG.FromFunPtr DuckDBV2AggregateFunctionSizeCallbackFn_Aux where
+
+  fromFunPtr = hs_bindgen_1c37b8e1b8e9f463
+
+instance ( ty ~ (DuckDBV2AggregateFunctionSizeInfoHandle -> BG.Ptr DuckDBV2ErrorInfoHandle -> IO ())
+         ) => BG.CompatHasField.HasField "unwrap" DuckDBV2AggregateFunctionSizeCallbackFn_Aux ty where
+
+  hasField =
+    \x0 ->
+      ( \y1 ->
+          DuckDBV2AggregateFunctionSizeCallbackFn_Aux {unwrap = y1}
+      , BG.getField @"unwrap" x0
+      )
+
+instance ( ty ~ (DuckDBV2AggregateFunctionSizeInfoHandle -> BG.Ptr DuckDBV2ErrorInfoHandle -> IO ())
+         ) => BG.HasField "unwrap" (BG.Ptr DuckDBV2AggregateFunctionSizeCallbackFn_Aux) (BG.Ptr ty) where
+
+  getField = HasCField.fromPtr (BG.Proxy @"unwrap")
+
+instance HasCField.HasCField DuckDBV2AggregateFunctionSizeCallbackFn_Aux "unwrap" where
+
+  type CFieldType DuckDBV2AggregateFunctionSizeCallbackFn_Aux "unwrap" =
+    DuckDBV2AggregateFunctionSizeInfoHandle -> BG.Ptr DuckDBV2ErrorInfoHandle -> IO ()
+
+  offset# = \_ -> \_ -> 0
+
+{-| __C declaration:__ @duckdb_v2_aggregate_function_size_callback_fn@
+
+    __defined at:__ @duckdb_v2.h 4981:16@
+
+    __exported by:__ @duckdb_v2.h@
+-}
+newtype DuckDBV2AggregateFunctionSizeCallbackFn = DuckDBV2AggregateFunctionSizeCallbackFn
+  { unwrap :: BG.FunPtr DuckDBV2AggregateFunctionSizeCallbackFn_Aux
+  }
+  deriving stock (Eq, BG.Generic, Ord, Show)
+  deriving newtype
+    ( BG.HasFFIType
+    , Marshal.ReadRaw
+    , Marshal.StaticSize
+    , BG.Storable
+    , Marshal.WriteRaw
+    )
+
+instance ( ty ~ BG.FunPtr DuckDBV2AggregateFunctionSizeCallbackFn_Aux
+         ) => BG.CompatHasField.HasField "unwrap" DuckDBV2AggregateFunctionSizeCallbackFn ty where
+
+  hasField =
+    \x0 ->
+      ( \y1 ->
+          DuckDBV2AggregateFunctionSizeCallbackFn {unwrap = y1}
+      , BG.getField @"unwrap" x0
+      )
+
+instance ( ty ~ BG.FunPtr DuckDBV2AggregateFunctionSizeCallbackFn_Aux
+         ) => BG.HasField "unwrap" (BG.Ptr DuckDBV2AggregateFunctionSizeCallbackFn) (BG.Ptr ty) where
+
+  getField = HasCField.fromPtr (BG.Proxy @"unwrap")
+
+instance HasCField.HasCField DuckDBV2AggregateFunctionSizeCallbackFn "unwrap" where
+
+  type CFieldType DuckDBV2AggregateFunctionSizeCallbackFn "unwrap" =
+    BG.FunPtr DuckDBV2AggregateFunctionSizeCallbackFn_Aux
+
+  offset# = \_ -> \_ -> 0
+
+{-| Auxiliary type used by t'DuckDBV2AggregateFunctionInitCallbackFn'
+
+    __C declaration:__ @duckdb_v2_aggregate_function_init_callback_fn@
+
+    __defined at:__ @duckdb_v2.h 4984:16@
+
+    __exported by:__ @duckdb_v2.h@
+-}
+newtype DuckDBV2AggregateFunctionInitCallbackFn_Aux = DuckDBV2AggregateFunctionInitCallbackFn_Aux
+  { unwrap :: DuckDBV2AggregateFunctionInitInfoHandle -> BG.Ptr DuckDBV2ErrorInfoHandle -> IO ()
+  }
+  deriving stock (BG.Generic)
+
+-- __unique:__ @toDuckDBV2AggregateFunctionInitCallbackFn_Aux@
+foreign import ccall safe "wrapper" hs_bindgen_99f9a032cf6b7a9f_base ::
+     (BG.Ptr BG.Void -> BG.Ptr BG.Void -> IO ())
+  -> IO (BG.FunPtr (BG.Ptr BG.Void -> BG.Ptr BG.Void -> IO ()))
+
+-- __unique:__ @toDuckDBV2AggregateFunctionInitCallbackFn_Aux@
+hs_bindgen_99f9a032cf6b7a9f ::
+     DuckDBV2AggregateFunctionInitCallbackFn_Aux
+  -> IO (BG.FunPtr DuckDBV2AggregateFunctionInitCallbackFn_Aux)
+hs_bindgen_99f9a032cf6b7a9f =
+  \fun0 ->
+    fmap BG.castFunPtr (hs_bindgen_99f9a032cf6b7a9f_base (\x1 ->
+                                                            \x2 ->
+                                                              BG.getField @"unwrap" fun0 (BG.fromFFIType x1) (BG.fromFFIType x2)))
+
+-- __unique:__ @fromDuckDBV2AggregateFunctionInitCallbackFn_Aux@
+foreign import ccall safe "dynamic" hs_bindgen_6c5f770684c99c23_base ::
+     BG.FunPtr (BG.Ptr BG.Void -> BG.Ptr BG.Void -> IO ())
+  -> BG.Ptr BG.Void -> BG.Ptr BG.Void -> IO ()
+
+-- __unique:__ @fromDuckDBV2AggregateFunctionInitCallbackFn_Aux@
+hs_bindgen_6c5f770684c99c23 ::
+     BG.FunPtr DuckDBV2AggregateFunctionInitCallbackFn_Aux
+  -> DuckDBV2AggregateFunctionInitCallbackFn_Aux
+hs_bindgen_6c5f770684c99c23 =
+  \funPtr0 ->
+    DuckDBV2AggregateFunctionInitCallbackFn_Aux (\x1 ->
+                                                   \x2 ->
+                                                     hs_bindgen_6c5f770684c99c23_base (BG.castFunPtr funPtr0) (BG.toFFIType x1) (BG.toFFIType x2))
+
+instance BG.ToFunPtr DuckDBV2AggregateFunctionInitCallbackFn_Aux where
+
+  toFunPtr = hs_bindgen_99f9a032cf6b7a9f
+
+instance BG.FromFunPtr DuckDBV2AggregateFunctionInitCallbackFn_Aux where
+
+  fromFunPtr = hs_bindgen_6c5f770684c99c23
+
+instance ( ty ~ (DuckDBV2AggregateFunctionInitInfoHandle -> BG.Ptr DuckDBV2ErrorInfoHandle -> IO ())
+         ) => BG.CompatHasField.HasField "unwrap" DuckDBV2AggregateFunctionInitCallbackFn_Aux ty where
+
+  hasField =
+    \x0 ->
+      ( \y1 ->
+          DuckDBV2AggregateFunctionInitCallbackFn_Aux {unwrap = y1}
+      , BG.getField @"unwrap" x0
+      )
+
+instance ( ty ~ (DuckDBV2AggregateFunctionInitInfoHandle -> BG.Ptr DuckDBV2ErrorInfoHandle -> IO ())
+         ) => BG.HasField "unwrap" (BG.Ptr DuckDBV2AggregateFunctionInitCallbackFn_Aux) (BG.Ptr ty) where
+
+  getField = HasCField.fromPtr (BG.Proxy @"unwrap")
+
+instance HasCField.HasCField DuckDBV2AggregateFunctionInitCallbackFn_Aux "unwrap" where
+
+  type CFieldType DuckDBV2AggregateFunctionInitCallbackFn_Aux "unwrap" =
+    DuckDBV2AggregateFunctionInitInfoHandle -> BG.Ptr DuckDBV2ErrorInfoHandle -> IO ()
+
+  offset# = \_ -> \_ -> 0
+
+{-| __C declaration:__ @duckdb_v2_aggregate_function_init_callback_fn@
+
+    __defined at:__ @duckdb_v2.h 4984:16@
+
+    __exported by:__ @duckdb_v2.h@
+-}
+newtype DuckDBV2AggregateFunctionInitCallbackFn = DuckDBV2AggregateFunctionInitCallbackFn
+  { unwrap :: BG.FunPtr DuckDBV2AggregateFunctionInitCallbackFn_Aux
+  }
+  deriving stock (Eq, BG.Generic, Ord, Show)
+  deriving newtype
+    ( BG.HasFFIType
+    , Marshal.ReadRaw
+    , Marshal.StaticSize
+    , BG.Storable
+    , Marshal.WriteRaw
+    )
+
+instance ( ty ~ BG.FunPtr DuckDBV2AggregateFunctionInitCallbackFn_Aux
+         ) => BG.CompatHasField.HasField "unwrap" DuckDBV2AggregateFunctionInitCallbackFn ty where
+
+  hasField =
+    \x0 ->
+      ( \y1 ->
+          DuckDBV2AggregateFunctionInitCallbackFn {unwrap = y1}
+      , BG.getField @"unwrap" x0
+      )
+
+instance ( ty ~ BG.FunPtr DuckDBV2AggregateFunctionInitCallbackFn_Aux
+         ) => BG.HasField "unwrap" (BG.Ptr DuckDBV2AggregateFunctionInitCallbackFn) (BG.Ptr ty) where
+
+  getField = HasCField.fromPtr (BG.Proxy @"unwrap")
+
+instance HasCField.HasCField DuckDBV2AggregateFunctionInitCallbackFn "unwrap" where
+
+  type CFieldType DuckDBV2AggregateFunctionInitCallbackFn "unwrap" =
+    BG.FunPtr DuckDBV2AggregateFunctionInitCallbackFn_Aux
+
+  offset# = \_ -> \_ -> 0
+
+{-| Auxiliary type used by t'DuckDBV2AggregateFunctionUpdateCallbackFn'
+
+    __C declaration:__ @duckdb_v2_aggregate_function_update_callback_fn@
+
+    __defined at:__ @duckdb_v2.h 4987:16@
+
+    __exported by:__ @duckdb_v2.h@
+-}
+newtype DuckDBV2AggregateFunctionUpdateCallbackFn_Aux = DuckDBV2AggregateFunctionUpdateCallbackFn_Aux
+  { unwrap :: DuckDBV2AggregateFunctionUpdateInfoHandle -> BG.Ptr DuckDBV2ErrorInfoHandle -> IO ()
+  }
+  deriving stock (BG.Generic)
+
+-- __unique:__ @toDuckDBV2AggregateFunctionUpdateCallbackFn_Aux@
+foreign import ccall safe "wrapper" hs_bindgen_3071f0c4f1e1eaef_base ::
+     (BG.Ptr BG.Void -> BG.Ptr BG.Void -> IO ())
+  -> IO (BG.FunPtr (BG.Ptr BG.Void -> BG.Ptr BG.Void -> IO ()))
+
+-- __unique:__ @toDuckDBV2AggregateFunctionUpdateCallbackFn_Aux@
+hs_bindgen_3071f0c4f1e1eaef ::
+     DuckDBV2AggregateFunctionUpdateCallbackFn_Aux
+  -> IO (BG.FunPtr DuckDBV2AggregateFunctionUpdateCallbackFn_Aux)
+hs_bindgen_3071f0c4f1e1eaef =
+  \fun0 ->
+    fmap BG.castFunPtr (hs_bindgen_3071f0c4f1e1eaef_base (\x1 ->
+                                                            \x2 ->
+                                                              BG.getField @"unwrap" fun0 (BG.fromFFIType x1) (BG.fromFFIType x2)))
+
+-- __unique:__ @fromDuckDBV2AggregateFunctionUpdateCallbackFn_Aux@
+foreign import ccall safe "dynamic" hs_bindgen_86248cdefceeddeb_base ::
+     BG.FunPtr (BG.Ptr BG.Void -> BG.Ptr BG.Void -> IO ())
+  -> BG.Ptr BG.Void -> BG.Ptr BG.Void -> IO ()
+
+-- __unique:__ @fromDuckDBV2AggregateFunctionUpdateCallbackFn_Aux@
+hs_bindgen_86248cdefceeddeb ::
+     BG.FunPtr DuckDBV2AggregateFunctionUpdateCallbackFn_Aux
+  -> DuckDBV2AggregateFunctionUpdateCallbackFn_Aux
+hs_bindgen_86248cdefceeddeb =
+  \funPtr0 ->
+    DuckDBV2AggregateFunctionUpdateCallbackFn_Aux (\x1 ->
+                                                     \x2 ->
+                                                       hs_bindgen_86248cdefceeddeb_base (BG.castFunPtr funPtr0) (BG.toFFIType x1) (BG.toFFIType x2))
+
+instance BG.ToFunPtr DuckDBV2AggregateFunctionUpdateCallbackFn_Aux where
+
+  toFunPtr = hs_bindgen_3071f0c4f1e1eaef
+
+instance BG.FromFunPtr DuckDBV2AggregateFunctionUpdateCallbackFn_Aux where
+
+  fromFunPtr = hs_bindgen_86248cdefceeddeb
+
+instance ( ty ~ (DuckDBV2AggregateFunctionUpdateInfoHandle -> BG.Ptr DuckDBV2ErrorInfoHandle -> IO ())
+         ) => BG.CompatHasField.HasField "unwrap" DuckDBV2AggregateFunctionUpdateCallbackFn_Aux ty where
+
+  hasField =
+    \x0 ->
+      ( \y1 ->
+          DuckDBV2AggregateFunctionUpdateCallbackFn_Aux {unwrap = y1}
+      , BG.getField @"unwrap" x0
+      )
+
+instance ( ty ~ (DuckDBV2AggregateFunctionUpdateInfoHandle -> BG.Ptr DuckDBV2ErrorInfoHandle -> IO ())
+         ) => BG.HasField "unwrap" (BG.Ptr DuckDBV2AggregateFunctionUpdateCallbackFn_Aux) (BG.Ptr ty) where
+
+  getField = HasCField.fromPtr (BG.Proxy @"unwrap")
+
+instance HasCField.HasCField DuckDBV2AggregateFunctionUpdateCallbackFn_Aux "unwrap" where
+
+  type CFieldType DuckDBV2AggregateFunctionUpdateCallbackFn_Aux "unwrap" =
+    DuckDBV2AggregateFunctionUpdateInfoHandle -> BG.Ptr DuckDBV2ErrorInfoHandle -> IO ()
+
+  offset# = \_ -> \_ -> 0
+
+{-| __C declaration:__ @duckdb_v2_aggregate_function_update_callback_fn@
+
+    __defined at:__ @duckdb_v2.h 4987:16@
+
+    __exported by:__ @duckdb_v2.h@
+-}
+newtype DuckDBV2AggregateFunctionUpdateCallbackFn = DuckDBV2AggregateFunctionUpdateCallbackFn
+  { unwrap :: BG.FunPtr DuckDBV2AggregateFunctionUpdateCallbackFn_Aux
+  }
+  deriving stock (Eq, BG.Generic, Ord, Show)
+  deriving newtype
+    ( BG.HasFFIType
+    , Marshal.ReadRaw
+    , Marshal.StaticSize
+    , BG.Storable
+    , Marshal.WriteRaw
+    )
+
+instance ( ty ~ BG.FunPtr DuckDBV2AggregateFunctionUpdateCallbackFn_Aux
+         ) => BG.CompatHasField.HasField "unwrap" DuckDBV2AggregateFunctionUpdateCallbackFn ty where
+
+  hasField =
+    \x0 ->
+      ( \y1 ->
+          DuckDBV2AggregateFunctionUpdateCallbackFn {unwrap = y1}
+      , BG.getField @"unwrap" x0
+      )
+
+instance ( ty ~ BG.FunPtr DuckDBV2AggregateFunctionUpdateCallbackFn_Aux
+         ) => BG.HasField "unwrap" (BG.Ptr DuckDBV2AggregateFunctionUpdateCallbackFn) (BG.Ptr ty) where
+
+  getField = HasCField.fromPtr (BG.Proxy @"unwrap")
+
+instance HasCField.HasCField DuckDBV2AggregateFunctionUpdateCallbackFn "unwrap" where
+
+  type CFieldType DuckDBV2AggregateFunctionUpdateCallbackFn "unwrap" =
+    BG.FunPtr DuckDBV2AggregateFunctionUpdateCallbackFn_Aux
+
+  offset# = \_ -> \_ -> 0
+
+{-| Auxiliary type used by t'DuckDBV2AggregateFunctionCombineCallbackFn'
+
+    __C declaration:__ @duckdb_v2_aggregate_function_combine_callback_fn@
+
+    __defined at:__ @duckdb_v2.h 4990:16@
+
+    __exported by:__ @duckdb_v2.h@
+-}
+newtype DuckDBV2AggregateFunctionCombineCallbackFn_Aux = DuckDBV2AggregateFunctionCombineCallbackFn_Aux
+  { unwrap :: DuckDBV2AggregateFunctionCombineInfoHandle -> BG.Ptr DuckDBV2ErrorInfoHandle -> IO ()
+  }
+  deriving stock (BG.Generic)
+
+-- __unique:__ @toDuckDBV2AggregateFunctionCombineCallbackFn_Aux@
+foreign import ccall safe "wrapper" hs_bindgen_f9fb9e162a617937_base ::
+     (BG.Ptr BG.Void -> BG.Ptr BG.Void -> IO ())
+  -> IO (BG.FunPtr (BG.Ptr BG.Void -> BG.Ptr BG.Void -> IO ()))
+
+-- __unique:__ @toDuckDBV2AggregateFunctionCombineCallbackFn_Aux@
+hs_bindgen_f9fb9e162a617937 ::
+     DuckDBV2AggregateFunctionCombineCallbackFn_Aux
+  -> IO (BG.FunPtr DuckDBV2AggregateFunctionCombineCallbackFn_Aux)
+hs_bindgen_f9fb9e162a617937 =
+  \fun0 ->
+    fmap BG.castFunPtr (hs_bindgen_f9fb9e162a617937_base (\x1 ->
+                                                            \x2 ->
+                                                              BG.getField @"unwrap" fun0 (BG.fromFFIType x1) (BG.fromFFIType x2)))
+
+-- __unique:__ @fromDuckDBV2AggregateFunctionCombineCallbackFn_Aux@
+foreign import ccall safe "dynamic" hs_bindgen_6442f537914b96dc_base ::
+     BG.FunPtr (BG.Ptr BG.Void -> BG.Ptr BG.Void -> IO ())
+  -> BG.Ptr BG.Void -> BG.Ptr BG.Void -> IO ()
+
+-- __unique:__ @fromDuckDBV2AggregateFunctionCombineCallbackFn_Aux@
+hs_bindgen_6442f537914b96dc ::
+     BG.FunPtr DuckDBV2AggregateFunctionCombineCallbackFn_Aux
+  -> DuckDBV2AggregateFunctionCombineCallbackFn_Aux
+hs_bindgen_6442f537914b96dc =
+  \funPtr0 ->
+    DuckDBV2AggregateFunctionCombineCallbackFn_Aux (\x1 ->
+                                                      \x2 ->
+                                                        hs_bindgen_6442f537914b96dc_base (BG.castFunPtr funPtr0) (BG.toFFIType x1) (BG.toFFIType x2))
+
+instance BG.ToFunPtr DuckDBV2AggregateFunctionCombineCallbackFn_Aux where
+
+  toFunPtr = hs_bindgen_f9fb9e162a617937
+
+instance BG.FromFunPtr DuckDBV2AggregateFunctionCombineCallbackFn_Aux where
+
+  fromFunPtr = hs_bindgen_6442f537914b96dc
+
+instance ( ty ~ (DuckDBV2AggregateFunctionCombineInfoHandle -> BG.Ptr DuckDBV2ErrorInfoHandle -> IO ())
+         ) => BG.CompatHasField.HasField "unwrap" DuckDBV2AggregateFunctionCombineCallbackFn_Aux ty where
+
+  hasField =
+    \x0 ->
+      ( \y1 ->
+          DuckDBV2AggregateFunctionCombineCallbackFn_Aux {unwrap = y1}
+      , BG.getField @"unwrap" x0
+      )
+
+instance ( ty ~ (DuckDBV2AggregateFunctionCombineInfoHandle -> BG.Ptr DuckDBV2ErrorInfoHandle -> IO ())
+         ) => BG.HasField "unwrap" (BG.Ptr DuckDBV2AggregateFunctionCombineCallbackFn_Aux) (BG.Ptr ty) where
+
+  getField = HasCField.fromPtr (BG.Proxy @"unwrap")
+
+instance HasCField.HasCField DuckDBV2AggregateFunctionCombineCallbackFn_Aux "unwrap" where
+
+  type CFieldType DuckDBV2AggregateFunctionCombineCallbackFn_Aux "unwrap" =
+    DuckDBV2AggregateFunctionCombineInfoHandle -> BG.Ptr DuckDBV2ErrorInfoHandle -> IO ()
+
+  offset# = \_ -> \_ -> 0
+
+{-| __C declaration:__ @duckdb_v2_aggregate_function_combine_callback_fn@
+
+    __defined at:__ @duckdb_v2.h 4990:16@
+
+    __exported by:__ @duckdb_v2.h@
+-}
+newtype DuckDBV2AggregateFunctionCombineCallbackFn = DuckDBV2AggregateFunctionCombineCallbackFn
+  { unwrap :: BG.FunPtr DuckDBV2AggregateFunctionCombineCallbackFn_Aux
+  }
+  deriving stock (Eq, BG.Generic, Ord, Show)
+  deriving newtype
+    ( BG.HasFFIType
+    , Marshal.ReadRaw
+    , Marshal.StaticSize
+    , BG.Storable
+    , Marshal.WriteRaw
+    )
+
+instance ( ty ~ BG.FunPtr DuckDBV2AggregateFunctionCombineCallbackFn_Aux
+         ) => BG.CompatHasField.HasField "unwrap" DuckDBV2AggregateFunctionCombineCallbackFn ty where
+
+  hasField =
+    \x0 ->
+      ( \y1 ->
+          DuckDBV2AggregateFunctionCombineCallbackFn {unwrap = y1}
+      , BG.getField @"unwrap" x0
+      )
+
+instance ( ty ~ BG.FunPtr DuckDBV2AggregateFunctionCombineCallbackFn_Aux
+         ) => BG.HasField "unwrap" (BG.Ptr DuckDBV2AggregateFunctionCombineCallbackFn) (BG.Ptr ty) where
+
+  getField = HasCField.fromPtr (BG.Proxy @"unwrap")
+
+instance HasCField.HasCField DuckDBV2AggregateFunctionCombineCallbackFn "unwrap" where
+
+  type CFieldType DuckDBV2AggregateFunctionCombineCallbackFn "unwrap" =
+    BG.FunPtr DuckDBV2AggregateFunctionCombineCallbackFn_Aux
+
+  offset# = \_ -> \_ -> 0
+
+{-| Auxiliary type used by t'DuckDBV2AggregateFunctionFinalizeCallbackFn'
+
+    __C declaration:__ @duckdb_v2_aggregate_function_finalize_callback_fn@
+
+    __defined at:__ @duckdb_v2.h 4993:16@
+
+    __exported by:__ @duckdb_v2.h@
+-}
+newtype DuckDBV2AggregateFunctionFinalizeCallbackFn_Aux = DuckDBV2AggregateFunctionFinalizeCallbackFn_Aux
+  { unwrap :: DuckDBV2AggregateFunctionFinalizeInfoHandle -> BG.Ptr DuckDBV2ErrorInfoHandle -> IO ()
+  }
+  deriving stock (BG.Generic)
+
+-- __unique:__ @toDuckDBV2AggregateFunctionFinalizeCallbackFn_Aux@
+foreign import ccall safe "wrapper" hs_bindgen_12ce77d960377ec7_base ::
+     (BG.Ptr BG.Void -> BG.Ptr BG.Void -> IO ())
+  -> IO (BG.FunPtr (BG.Ptr BG.Void -> BG.Ptr BG.Void -> IO ()))
+
+-- __unique:__ @toDuckDBV2AggregateFunctionFinalizeCallbackFn_Aux@
+hs_bindgen_12ce77d960377ec7 ::
+     DuckDBV2AggregateFunctionFinalizeCallbackFn_Aux
+  -> IO (BG.FunPtr DuckDBV2AggregateFunctionFinalizeCallbackFn_Aux)
+hs_bindgen_12ce77d960377ec7 =
+  \fun0 ->
+    fmap BG.castFunPtr (hs_bindgen_12ce77d960377ec7_base (\x1 ->
+                                                            \x2 ->
+                                                              BG.getField @"unwrap" fun0 (BG.fromFFIType x1) (BG.fromFFIType x2)))
+
+-- __unique:__ @fromDuckDBV2AggregateFunctionFinalizeCallbackFn_Aux@
+foreign import ccall safe "dynamic" hs_bindgen_345623cf531771ff_base ::
+     BG.FunPtr (BG.Ptr BG.Void -> BG.Ptr BG.Void -> IO ())
+  -> BG.Ptr BG.Void -> BG.Ptr BG.Void -> IO ()
+
+-- __unique:__ @fromDuckDBV2AggregateFunctionFinalizeCallbackFn_Aux@
+hs_bindgen_345623cf531771ff ::
+     BG.FunPtr DuckDBV2AggregateFunctionFinalizeCallbackFn_Aux
+  -> DuckDBV2AggregateFunctionFinalizeCallbackFn_Aux
+hs_bindgen_345623cf531771ff =
+  \funPtr0 ->
+    DuckDBV2AggregateFunctionFinalizeCallbackFn_Aux (\x1 ->
+                                                       \x2 ->
+                                                         hs_bindgen_345623cf531771ff_base (BG.castFunPtr funPtr0) (BG.toFFIType x1) (BG.toFFIType x2))
+
+instance BG.ToFunPtr DuckDBV2AggregateFunctionFinalizeCallbackFn_Aux where
+
+  toFunPtr = hs_bindgen_12ce77d960377ec7
+
+instance BG.FromFunPtr DuckDBV2AggregateFunctionFinalizeCallbackFn_Aux where
+
+  fromFunPtr = hs_bindgen_345623cf531771ff
+
+instance ( ty ~ (DuckDBV2AggregateFunctionFinalizeInfoHandle -> BG.Ptr DuckDBV2ErrorInfoHandle -> IO ())
+         ) => BG.CompatHasField.HasField "unwrap" DuckDBV2AggregateFunctionFinalizeCallbackFn_Aux ty where
+
+  hasField =
+    \x0 ->
+      ( \y1 ->
+          DuckDBV2AggregateFunctionFinalizeCallbackFn_Aux {unwrap = y1}
+      , BG.getField @"unwrap" x0
+      )
+
+instance ( ty ~ (DuckDBV2AggregateFunctionFinalizeInfoHandle -> BG.Ptr DuckDBV2ErrorInfoHandle -> IO ())
+         ) => BG.HasField "unwrap" (BG.Ptr DuckDBV2AggregateFunctionFinalizeCallbackFn_Aux) (BG.Ptr ty) where
+
+  getField = HasCField.fromPtr (BG.Proxy @"unwrap")
+
+instance HasCField.HasCField DuckDBV2AggregateFunctionFinalizeCallbackFn_Aux "unwrap" where
+
+  type CFieldType DuckDBV2AggregateFunctionFinalizeCallbackFn_Aux "unwrap" =
+    DuckDBV2AggregateFunctionFinalizeInfoHandle -> BG.Ptr DuckDBV2ErrorInfoHandle -> IO ()
+
+  offset# = \_ -> \_ -> 0
+
+{-| __C declaration:__ @duckdb_v2_aggregate_function_finalize_callback_fn@
+
+    __defined at:__ @duckdb_v2.h 4993:16@
+
+    __exported by:__ @duckdb_v2.h@
+-}
+newtype DuckDBV2AggregateFunctionFinalizeCallbackFn = DuckDBV2AggregateFunctionFinalizeCallbackFn
+  { unwrap :: BG.FunPtr DuckDBV2AggregateFunctionFinalizeCallbackFn_Aux
+  }
+  deriving stock (Eq, BG.Generic, Ord, Show)
+  deriving newtype
+    ( BG.HasFFIType
+    , Marshal.ReadRaw
+    , Marshal.StaticSize
+    , BG.Storable
+    , Marshal.WriteRaw
+    )
+
+instance ( ty ~ BG.FunPtr DuckDBV2AggregateFunctionFinalizeCallbackFn_Aux
+         ) => BG.CompatHasField.HasField "unwrap" DuckDBV2AggregateFunctionFinalizeCallbackFn ty where
+
+  hasField =
+    \x0 ->
+      ( \y1 ->
+          DuckDBV2AggregateFunctionFinalizeCallbackFn {unwrap = y1}
+      , BG.getField @"unwrap" x0
+      )
+
+instance ( ty ~ BG.FunPtr DuckDBV2AggregateFunctionFinalizeCallbackFn_Aux
+         ) => BG.HasField "unwrap" (BG.Ptr DuckDBV2AggregateFunctionFinalizeCallbackFn) (BG.Ptr ty) where
+
+  getField = HasCField.fromPtr (BG.Proxy @"unwrap")
+
+instance HasCField.HasCField DuckDBV2AggregateFunctionFinalizeCallbackFn "unwrap" where
+
+  type CFieldType DuckDBV2AggregateFunctionFinalizeCallbackFn "unwrap" =
+    BG.FunPtr DuckDBV2AggregateFunctionFinalizeCallbackFn_Aux
+
+  offset# = \_ -> \_ -> 0
+
+{-| Auxiliary type used by t'DuckDBV2AggregateFunctionDestroyCallbackFn'
+
+    __C declaration:__ @duckdb_v2_aggregate_function_destroy_callback_fn@
+
+    __defined at:__ @duckdb_v2.h 4996:16@
+
+    __exported by:__ @duckdb_v2.h@
+-}
+newtype DuckDBV2AggregateFunctionDestroyCallbackFn_Aux = DuckDBV2AggregateFunctionDestroyCallbackFn_Aux
+  { unwrap :: DuckDBV2AggregateFunctionDestroyInfoHandle -> BG.Ptr DuckDBV2ErrorInfoHandle -> IO ()
+  }
+  deriving stock (BG.Generic)
+
+-- __unique:__ @toDuckDBV2AggregateFunctionDestroyCallbackFn_Aux@
+foreign import ccall safe "wrapper" hs_bindgen_8a04f69be2d8f7d7_base ::
+     (BG.Ptr BG.Void -> BG.Ptr BG.Void -> IO ())
+  -> IO (BG.FunPtr (BG.Ptr BG.Void -> BG.Ptr BG.Void -> IO ()))
+
+-- __unique:__ @toDuckDBV2AggregateFunctionDestroyCallbackFn_Aux@
+hs_bindgen_8a04f69be2d8f7d7 ::
+     DuckDBV2AggregateFunctionDestroyCallbackFn_Aux
+  -> IO (BG.FunPtr DuckDBV2AggregateFunctionDestroyCallbackFn_Aux)
+hs_bindgen_8a04f69be2d8f7d7 =
+  \fun0 ->
+    fmap BG.castFunPtr (hs_bindgen_8a04f69be2d8f7d7_base (\x1 ->
+                                                            \x2 ->
+                                                              BG.getField @"unwrap" fun0 (BG.fromFFIType x1) (BG.fromFFIType x2)))
+
+-- __unique:__ @fromDuckDBV2AggregateFunctionDestroyCallbackFn_Aux@
+foreign import ccall safe "dynamic" hs_bindgen_77ba856dafc1a8f7_base ::
+     BG.FunPtr (BG.Ptr BG.Void -> BG.Ptr BG.Void -> IO ())
+  -> BG.Ptr BG.Void -> BG.Ptr BG.Void -> IO ()
+
+-- __unique:__ @fromDuckDBV2AggregateFunctionDestroyCallbackFn_Aux@
+hs_bindgen_77ba856dafc1a8f7 ::
+     BG.FunPtr DuckDBV2AggregateFunctionDestroyCallbackFn_Aux
+  -> DuckDBV2AggregateFunctionDestroyCallbackFn_Aux
+hs_bindgen_77ba856dafc1a8f7 =
+  \funPtr0 ->
+    DuckDBV2AggregateFunctionDestroyCallbackFn_Aux (\x1 ->
+                                                      \x2 ->
+                                                        hs_bindgen_77ba856dafc1a8f7_base (BG.castFunPtr funPtr0) (BG.toFFIType x1) (BG.toFFIType x2))
+
+instance BG.ToFunPtr DuckDBV2AggregateFunctionDestroyCallbackFn_Aux where
+
+  toFunPtr = hs_bindgen_8a04f69be2d8f7d7
+
+instance BG.FromFunPtr DuckDBV2AggregateFunctionDestroyCallbackFn_Aux where
+
+  fromFunPtr = hs_bindgen_77ba856dafc1a8f7
+
+instance ( ty ~ (DuckDBV2AggregateFunctionDestroyInfoHandle -> BG.Ptr DuckDBV2ErrorInfoHandle -> IO ())
+         ) => BG.CompatHasField.HasField "unwrap" DuckDBV2AggregateFunctionDestroyCallbackFn_Aux ty where
+
+  hasField =
+    \x0 ->
+      ( \y1 ->
+          DuckDBV2AggregateFunctionDestroyCallbackFn_Aux {unwrap = y1}
+      , BG.getField @"unwrap" x0
+      )
+
+instance ( ty ~ (DuckDBV2AggregateFunctionDestroyInfoHandle -> BG.Ptr DuckDBV2ErrorInfoHandle -> IO ())
+         ) => BG.HasField "unwrap" (BG.Ptr DuckDBV2AggregateFunctionDestroyCallbackFn_Aux) (BG.Ptr ty) where
+
+  getField = HasCField.fromPtr (BG.Proxy @"unwrap")
+
+instance HasCField.HasCField DuckDBV2AggregateFunctionDestroyCallbackFn_Aux "unwrap" where
+
+  type CFieldType DuckDBV2AggregateFunctionDestroyCallbackFn_Aux "unwrap" =
+    DuckDBV2AggregateFunctionDestroyInfoHandle -> BG.Ptr DuckDBV2ErrorInfoHandle -> IO ()
+
+  offset# = \_ -> \_ -> 0
+
+{-| __C declaration:__ @duckdb_v2_aggregate_function_destroy_callback_fn@
+
+    __defined at:__ @duckdb_v2.h 4996:16@
+
+    __exported by:__ @duckdb_v2.h@
+-}
+newtype DuckDBV2AggregateFunctionDestroyCallbackFn = DuckDBV2AggregateFunctionDestroyCallbackFn
+  { unwrap :: BG.FunPtr DuckDBV2AggregateFunctionDestroyCallbackFn_Aux
+  }
+  deriving stock (Eq, BG.Generic, Ord, Show)
+  deriving newtype
+    ( BG.HasFFIType
+    , Marshal.ReadRaw
+    , Marshal.StaticSize
+    , BG.Storable
+    , Marshal.WriteRaw
+    )
+
+instance ( ty ~ BG.FunPtr DuckDBV2AggregateFunctionDestroyCallbackFn_Aux
+         ) => BG.CompatHasField.HasField "unwrap" DuckDBV2AggregateFunctionDestroyCallbackFn ty where
+
+  hasField =
+    \x0 ->
+      ( \y1 ->
+          DuckDBV2AggregateFunctionDestroyCallbackFn {unwrap = y1}
+      , BG.getField @"unwrap" x0
+      )
+
+instance ( ty ~ BG.FunPtr DuckDBV2AggregateFunctionDestroyCallbackFn_Aux
+         ) => BG.HasField "unwrap" (BG.Ptr DuckDBV2AggregateFunctionDestroyCallbackFn) (BG.Ptr ty) where
+
+  getField = HasCField.fromPtr (BG.Proxy @"unwrap")
+
+instance HasCField.HasCField DuckDBV2AggregateFunctionDestroyCallbackFn "unwrap" where
+
+  type CFieldType DuckDBV2AggregateFunctionDestroyCallbackFn "unwrap" =
+    BG.FunPtr DuckDBV2AggregateFunctionDestroyCallbackFn_Aux
+
+  offset# = \_ -> \_ -> 0
+
+{-| An owned snapshot of one base table taken at creation: where the name resolved, the table\'s columns, and per-column catalog facts. Later DDL does not update it. Create with @duckdb_v2_connection_describe_table()@ , read the resolved location via @duckdb_v2_table_description_get_qname()@ , and the columns via @duckdb_v2_table_description_get_column_count()@ and @duckdb_v2_table_description_get_column()@ . Destroy via @duckdb_v2_table_description_destroy()@ .
+
+    __C declaration:__ @struct _duckdb_v2_table_description@
+
+    __defined at:__ @duckdb_v2.h 5905:16@
+
+    __exported by:__ @duckdb_v2.h@
+-}
+data DuckDBV2TableDescriptionStruct
+
+instance Marshal.StaticSize DuckDBV2TableDescriptionStruct where
+
+  staticSizeOf = \_ -> (8 :: Int)
+
+  staticAlignment = \_ -> (8 :: Int)
+
+{-| An owned snapshot of one base table taken at creation: where the name resolved, the table\'s columns, and per-column catalog facts. Later DDL does not update it. Create with @duckdb_v2_connection_describe_table()@ , read the resolved location via @duckdb_v2_table_description_get_qname()@ , and the columns via @duckdb_v2_table_description_get_column_count()@ and @duckdb_v2_table_description_get_column()@ . Destroy via @duckdb_v2_table_description_destroy()@ .
+
+    __C declaration:__ @duckdb_v2_table_description_handle@
+
+    __defined at:__ @duckdb_v2.h 5907:5@
+
+    __exported by:__ @duckdb_v2.h@
+-}
+newtype DuckDBV2TableDescriptionHandle = DuckDBV2TableDescriptionHandle
+  { unwrap :: BG.Ptr DuckDBV2TableDescriptionStruct
+  }
+  deriving stock (Eq, BG.Generic, Ord, Show)
+  deriving newtype
+    ( BG.HasFFIType
+    , Marshal.ReadRaw
+    , Marshal.StaticSize
+    , BG.Storable
+    , Marshal.WriteRaw
+    )
+
+instance ( ty ~ BG.Ptr DuckDBV2TableDescriptionStruct
+         ) => BG.CompatHasField.HasField "unwrap" DuckDBV2TableDescriptionHandle ty where
+
+  hasField =
+    \x0 ->
+      ( \y1 -> DuckDBV2TableDescriptionHandle {unwrap = y1}
+      , BG.getField @"unwrap" x0
+      )
+
+instance ( ty ~ BG.Ptr DuckDBV2TableDescriptionStruct
+         ) => BG.HasField "unwrap" (BG.Ptr DuckDBV2TableDescriptionHandle) (BG.Ptr ty) where
+
+  getField = HasCField.fromPtr (BG.Proxy @"unwrap")
+
+instance HasCField.HasCField DuckDBV2TableDescriptionHandle "unwrap" where
+
+  type CFieldType DuckDBV2TableDescriptionHandle "unwrap" =
+    BG.Ptr DuckDBV2TableDescriptionStruct
+
+  offset# = \_ -> \_ -> 0
+
+{-| An owned snapshot of one column of a described table: its name, type, and catalog facts. Obtain with @duckdb_v2_table_description_get_column()@ , read with @duckdb_v2_column_description_get_name()@ , @duckdb_v2_column_description_get_type()@ , @duckdb_v2_column_description_has_default()@ and @duckdb_v2_column_description_has_generated()@ , and destroy with @duckdb_v2_column_description_destroy()@ .
+
+    __C declaration:__ @struct _duckdb_v2_column_description@
+
+    __defined at:__ @duckdb_v2.h 5915:16@
+
+    __exported by:__ @duckdb_v2.h@
+-}
+data DuckDBV2ColumnDescriptionStruct
+
+instance Marshal.StaticSize DuckDBV2ColumnDescriptionStruct where
+
+  staticSizeOf = \_ -> (8 :: Int)
+
+  staticAlignment = \_ -> (8 :: Int)
+
+{-| An owned snapshot of one column of a described table: its name, type, and catalog facts. Obtain with @duckdb_v2_table_description_get_column()@ , read with @duckdb_v2_column_description_get_name()@ , @duckdb_v2_column_description_get_type()@ , @duckdb_v2_column_description_has_default()@ and @duckdb_v2_column_description_has_generated()@ , and destroy with @duckdb_v2_column_description_destroy()@ .
+
+    __C declaration:__ @duckdb_v2_column_description_handle@
+
+    __defined at:__ @duckdb_v2.h 5917:5@
+
+    __exported by:__ @duckdb_v2.h@
+-}
+newtype DuckDBV2ColumnDescriptionHandle = DuckDBV2ColumnDescriptionHandle
+  { unwrap :: BG.Ptr DuckDBV2ColumnDescriptionStruct
+  }
+  deriving stock (Eq, BG.Generic, Ord, Show)
+  deriving newtype
+    ( BG.HasFFIType
+    , Marshal.ReadRaw
+    , Marshal.StaticSize
+    , BG.Storable
+    , Marshal.WriteRaw
+    )
+
+instance ( ty ~ BG.Ptr DuckDBV2ColumnDescriptionStruct
+         ) => BG.CompatHasField.HasField "unwrap" DuckDBV2ColumnDescriptionHandle ty where
+
+  hasField =
+    \x0 ->
+      ( \y1 ->
+          DuckDBV2ColumnDescriptionHandle {unwrap = y1}
+      , BG.getField @"unwrap" x0
+      )
+
+instance ( ty ~ BG.Ptr DuckDBV2ColumnDescriptionStruct
+         ) => BG.HasField "unwrap" (BG.Ptr DuckDBV2ColumnDescriptionHandle) (BG.Ptr ty) where
+
+  getField = HasCField.fromPtr (BG.Proxy @"unwrap")
+
+instance HasCField.HasCField DuckDBV2ColumnDescriptionHandle "unwrap" where
+
+  type CFieldType DuckDBV2ColumnDescriptionHandle "unwrap" =
+    BG.Ptr DuckDBV2ColumnDescriptionStruct
+
+  offset# = \_ -> \_ -> 0
+
+{-| An owned opaque handle to a custom copy function being built: an output format for @COPY ... TO@ , an input format for @COPY ... FROM@ , or both. Created with @duckdb_v2_copy_function_create()@ , configured with the setter functions (e.g. @duckdb_v2_copy_function_set_name()@ , @duckdb_v2_copy_to_set_batch_callback()@ , @duckdb_v2_copy_from_set_exec_callback()@ , etc.), made available with @duckdb_v2_connection_register_copy_function()@ or @duckdb_v2_extension_register_copy_function()@ , and destroyed with @duckdb_v2_copy_function_destroy()@ .
+
+    __C declaration:__ @struct _duckdb_v2_copy_function@
+
+    __defined at:__ @duckdb_v2.h 6168:16@
+
+    __exported by:__ @duckdb_v2.h@
+-}
+data DuckDBV2CopyFunctionStruct
+
+instance Marshal.StaticSize DuckDBV2CopyFunctionStruct where
+
+  staticSizeOf = \_ -> (8 :: Int)
+
+  staticAlignment = \_ -> (8 :: Int)
+
+{-| An owned opaque handle to a custom copy function being built: an output format for @COPY ... TO@ , an input format for @COPY ... FROM@ , or both. Created with @duckdb_v2_copy_function_create()@ , configured with the setter functions (e.g. @duckdb_v2_copy_function_set_name()@ , @duckdb_v2_copy_to_set_batch_callback()@ , @duckdb_v2_copy_from_set_exec_callback()@ , etc.), made available with @duckdb_v2_connection_register_copy_function()@ or @duckdb_v2_extension_register_copy_function()@ , and destroyed with @duckdb_v2_copy_function_destroy()@ .
+
+    __C declaration:__ @duckdb_v2_copy_function_handle@
+
+    __defined at:__ @duckdb_v2.h 6170:5@
+
+    __exported by:__ @duckdb_v2.h@
+-}
+newtype DuckDBV2CopyFunctionHandle = DuckDBV2CopyFunctionHandle
+  { unwrap :: BG.Ptr DuckDBV2CopyFunctionStruct
+  }
+  deriving stock (Eq, BG.Generic, Ord, Show)
+  deriving newtype
+    ( BG.HasFFIType
+    , Marshal.ReadRaw
+    , Marshal.StaticSize
+    , BG.Storable
+    , Marshal.WriteRaw
+    )
+
+instance ( ty ~ BG.Ptr DuckDBV2CopyFunctionStruct
+         ) => BG.CompatHasField.HasField "unwrap" DuckDBV2CopyFunctionHandle ty where
+
+  hasField =
+    \x0 ->
+      (\y1 ->
+         DuckDBV2CopyFunctionHandle {unwrap = y1}, BG.getField @"unwrap" x0)
+
+instance ( ty ~ BG.Ptr DuckDBV2CopyFunctionStruct
+         ) => BG.HasField "unwrap" (BG.Ptr DuckDBV2CopyFunctionHandle) (BG.Ptr ty) where
+
+  getField = HasCField.fromPtr (BG.Proxy @"unwrap")
+
+instance HasCField.HasCField DuckDBV2CopyFunctionHandle "unwrap" where
+
+  type CFieldType DuckDBV2CopyFunctionHandle "unwrap" =
+    BG.Ptr DuckDBV2CopyFunctionStruct
+
+  offset# = \_ -> \_ -> 0
+
+{-| A borrowed opaque handle to the arguments supplied to a copy function during the query preparation "bind" phase of a @COPY ... TO@ statement. The "bind" callback receives this handle and can use it to e.g. inspect the names and types of the columns being written, read the statement\'s options and initialize some constant state.
+
+    __C declaration:__ @struct _duckdb_v2_copy_to_bind_info@
+
+    __defined at:__ @duckdb_v2.h 6177:16@
+
+    __exported by:__ @duckdb_v2.h@
+-}
+data DuckDBV2CopyToBindInfoStruct
+
+instance Marshal.StaticSize DuckDBV2CopyToBindInfoStruct where
+
+  staticSizeOf = \_ -> (8 :: Int)
+
+  staticAlignment = \_ -> (8 :: Int)
+
+{-| A borrowed opaque handle to the arguments supplied to a copy function during the query preparation "bind" phase of a @COPY ... TO@ statement. The "bind" callback receives this handle and can use it to e.g. inspect the names and types of the columns being written, read the statement\'s options and initialize some constant state.
+
+    __C declaration:__ @duckdb_v2_copy_to_bind_info_handle@
+
+    __defined at:__ @duckdb_v2.h 6179:5@
+
+    __exported by:__ @duckdb_v2.h@
+-}
+newtype DuckDBV2CopyToBindInfoHandle = DuckDBV2CopyToBindInfoHandle
+  { unwrap :: BG.Ptr DuckDBV2CopyToBindInfoStruct
+  }
+  deriving stock (Eq, BG.Generic, Ord, Show)
+  deriving newtype
+    ( BG.HasFFIType
+    , Marshal.ReadRaw
+    , Marshal.StaticSize
+    , BG.Storable
+    , Marshal.WriteRaw
+    )
+
+instance ( ty ~ BG.Ptr DuckDBV2CopyToBindInfoStruct
+         ) => BG.CompatHasField.HasField "unwrap" DuckDBV2CopyToBindInfoHandle ty where
+
+  hasField =
+    \x0 ->
+      (\y1 ->
+         DuckDBV2CopyToBindInfoHandle {unwrap = y1}, BG.getField @"unwrap" x0)
+
+instance ( ty ~ BG.Ptr DuckDBV2CopyToBindInfoStruct
+         ) => BG.HasField "unwrap" (BG.Ptr DuckDBV2CopyToBindInfoHandle) (BG.Ptr ty) where
+
+  getField = HasCField.fromPtr (BG.Proxy @"unwrap")
+
+instance HasCField.HasCField DuckDBV2CopyToBindInfoHandle "unwrap" where
+
+  type CFieldType DuckDBV2CopyToBindInfoHandle "unwrap" =
+    BG.Ptr DuckDBV2CopyToBindInfoStruct
+
+  offset# = \_ -> \_ -> 0
+
+{-| A borrowed opaque handle to the arguments supplied to a copy function during the "batch size" phase of a @COPY ... TO@ statement. The "batch size" callback receives this handle and must use it to report how many rows a batch should carry.
+
+    __C declaration:__ @struct _duckdb_v2_copy_to_batch_size_info@
+
+    __defined at:__ @duckdb_v2.h 6186:16@
+
+    __exported by:__ @duckdb_v2.h@
+-}
+data DuckDBV2CopyToBatchSizeInfoStruct
+
+instance Marshal.StaticSize DuckDBV2CopyToBatchSizeInfoStruct where
+
+  staticSizeOf = \_ -> (8 :: Int)
+
+  staticAlignment = \_ -> (8 :: Int)
+
+{-| A borrowed opaque handle to the arguments supplied to a copy function during the "batch size" phase of a @COPY ... TO@ statement. The "batch size" callback receives this handle and must use it to report how many rows a batch should carry.
+
+    __C declaration:__ @duckdb_v2_copy_to_batch_size_info_handle@
+
+    __defined at:__ @duckdb_v2.h 6188:5@
+
+    __exported by:__ @duckdb_v2.h@
+-}
+newtype DuckDBV2CopyToBatchSizeInfoHandle = DuckDBV2CopyToBatchSizeInfoHandle
+  { unwrap :: BG.Ptr DuckDBV2CopyToBatchSizeInfoStruct
+  }
+  deriving stock (Eq, BG.Generic, Ord, Show)
+  deriving newtype
+    ( BG.HasFFIType
+    , Marshal.ReadRaw
+    , Marshal.StaticSize
+    , BG.Storable
+    , Marshal.WriteRaw
+    )
+
+instance ( ty ~ BG.Ptr DuckDBV2CopyToBatchSizeInfoStruct
+         ) => BG.CompatHasField.HasField "unwrap" DuckDBV2CopyToBatchSizeInfoHandle ty where
+
+  hasField =
+    \x0 ->
+      ( \y1 ->
+          DuckDBV2CopyToBatchSizeInfoHandle {unwrap = y1}
+      , BG.getField @"unwrap" x0
+      )
+
+instance ( ty ~ BG.Ptr DuckDBV2CopyToBatchSizeInfoStruct
+         ) => BG.HasField "unwrap" (BG.Ptr DuckDBV2CopyToBatchSizeInfoHandle) (BG.Ptr ty) where
+
+  getField = HasCField.fromPtr (BG.Proxy @"unwrap")
+
+instance HasCField.HasCField DuckDBV2CopyToBatchSizeInfoHandle "unwrap" where
+
+  type CFieldType DuckDBV2CopyToBatchSizeInfoHandle "unwrap" =
+    BG.Ptr DuckDBV2CopyToBatchSizeInfoStruct
+
+  offset# = \_ -> \_ -> 0
+
+{-| A borrowed opaque handle to the arguments supplied to a copy function during the per-file "init" phase of a @COPY ... TO@ statement. The "init" callback receives this handle and can use it to e.g. read the path of the file being written and set up the state shared by every batch written to that file.
+
+    __C declaration:__ @struct _duckdb_v2_copy_to_init_info@
+
+    __defined at:__ @duckdb_v2.h 6195:16@
+
+    __exported by:__ @duckdb_v2.h@
+-}
+data DuckDBV2CopyToInitInfoStruct
+
+instance Marshal.StaticSize DuckDBV2CopyToInitInfoStruct where
+
+  staticSizeOf = \_ -> (8 :: Int)
+
+  staticAlignment = \_ -> (8 :: Int)
+
+{-| A borrowed opaque handle to the arguments supplied to a copy function during the per-file "init" phase of a @COPY ... TO@ statement. The "init" callback receives this handle and can use it to e.g. read the path of the file being written and set up the state shared by every batch written to that file.
+
+    __C declaration:__ @duckdb_v2_copy_to_init_info_handle@
+
+    __defined at:__ @duckdb_v2.h 6197:5@
+
+    __exported by:__ @duckdb_v2.h@
+-}
+newtype DuckDBV2CopyToInitInfoHandle = DuckDBV2CopyToInitInfoHandle
+  { unwrap :: BG.Ptr DuckDBV2CopyToInitInfoStruct
+  }
+  deriving stock (Eq, BG.Generic, Ord, Show)
+  deriving newtype
+    ( BG.HasFFIType
+    , Marshal.ReadRaw
+    , Marshal.StaticSize
+    , BG.Storable
+    , Marshal.WriteRaw
+    )
+
+instance ( ty ~ BG.Ptr DuckDBV2CopyToInitInfoStruct
+         ) => BG.CompatHasField.HasField "unwrap" DuckDBV2CopyToInitInfoHandle ty where
+
+  hasField =
+    \x0 ->
+      (\y1 ->
+         DuckDBV2CopyToInitInfoHandle {unwrap = y1}, BG.getField @"unwrap" x0)
+
+instance ( ty ~ BG.Ptr DuckDBV2CopyToInitInfoStruct
+         ) => BG.HasField "unwrap" (BG.Ptr DuckDBV2CopyToInitInfoHandle) (BG.Ptr ty) where
+
+  getField = HasCField.fromPtr (BG.Proxy @"unwrap")
+
+instance HasCField.HasCField DuckDBV2CopyToInitInfoHandle "unwrap" where
+
+  type CFieldType DuckDBV2CopyToInitInfoHandle "unwrap" =
+    BG.Ptr DuckDBV2CopyToInitInfoStruct
+
+  offset# = \_ -> \_ -> 0
+
+{-| A borrowed opaque handle to the arguments supplied to a copy function during the "batch" phase of a @COPY ... TO@ statement. The "batch" callback receives this handle and can use it to take ownership of the rows of the batch and to set the prepared form of the batch handed to the "flush" callback.
+
+    __C declaration:__ @struct _duckdb_v2_copy_to_batch_info@
+
+    __defined at:__ @duckdb_v2.h 6204:16@
+
+    __exported by:__ @duckdb_v2.h@
+-}
+data DuckDBV2CopyToBatchInfoStruct
+
+instance Marshal.StaticSize DuckDBV2CopyToBatchInfoStruct where
+
+  staticSizeOf = \_ -> (8 :: Int)
+
+  staticAlignment = \_ -> (8 :: Int)
+
+{-| A borrowed opaque handle to the arguments supplied to a copy function during the "batch" phase of a @COPY ... TO@ statement. The "batch" callback receives this handle and can use it to take ownership of the rows of the batch and to set the prepared form of the batch handed to the "flush" callback.
+
+    __C declaration:__ @duckdb_v2_copy_to_batch_info_handle@
+
+    __defined at:__ @duckdb_v2.h 6206:5@
+
+    __exported by:__ @duckdb_v2.h@
+-}
+newtype DuckDBV2CopyToBatchInfoHandle = DuckDBV2CopyToBatchInfoHandle
+  { unwrap :: BG.Ptr DuckDBV2CopyToBatchInfoStruct
+  }
+  deriving stock (Eq, BG.Generic, Ord, Show)
+  deriving newtype
+    ( BG.HasFFIType
+    , Marshal.ReadRaw
+    , Marshal.StaticSize
+    , BG.Storable
+    , Marshal.WriteRaw
+    )
+
+instance ( ty ~ BG.Ptr DuckDBV2CopyToBatchInfoStruct
+         ) => BG.CompatHasField.HasField "unwrap" DuckDBV2CopyToBatchInfoHandle ty where
+
+  hasField =
+    \x0 ->
+      ( \y1 -> DuckDBV2CopyToBatchInfoHandle {unwrap = y1}
+      , BG.getField @"unwrap" x0
+      )
+
+instance ( ty ~ BG.Ptr DuckDBV2CopyToBatchInfoStruct
+         ) => BG.HasField "unwrap" (BG.Ptr DuckDBV2CopyToBatchInfoHandle) (BG.Ptr ty) where
+
+  getField = HasCField.fromPtr (BG.Proxy @"unwrap")
+
+instance HasCField.HasCField DuckDBV2CopyToBatchInfoHandle "unwrap" where
+
+  type CFieldType DuckDBV2CopyToBatchInfoHandle "unwrap" =
+    BG.Ptr DuckDBV2CopyToBatchInfoStruct
+
+  offset# = \_ -> \_ -> 0
+
+{-| A borrowed opaque handle to the arguments supplied to a copy function during the "flush" phase of a @COPY ... TO@ statement. The "flush" callback receives this handle and can use it to access the prepared batch and write it to the output.
+
+    __C declaration:__ @struct _duckdb_v2_copy_to_flush_info@
+
+    __defined at:__ @duckdb_v2.h 6213:16@
+
+    __exported by:__ @duckdb_v2.h@
+-}
+data DuckDBV2CopyToFlushInfoStruct
+
+instance Marshal.StaticSize DuckDBV2CopyToFlushInfoStruct where
+
+  staticSizeOf = \_ -> (8 :: Int)
+
+  staticAlignment = \_ -> (8 :: Int)
+
+{-| A borrowed opaque handle to the arguments supplied to a copy function during the "flush" phase of a @COPY ... TO@ statement. The "flush" callback receives this handle and can use it to access the prepared batch and write it to the output.
+
+    __C declaration:__ @duckdb_v2_copy_to_flush_info_handle@
+
+    __defined at:__ @duckdb_v2.h 6215:5@
+
+    __exported by:__ @duckdb_v2.h@
+-}
+newtype DuckDBV2CopyToFlushInfoHandle = DuckDBV2CopyToFlushInfoHandle
+  { unwrap :: BG.Ptr DuckDBV2CopyToFlushInfoStruct
+  }
+  deriving stock (Eq, BG.Generic, Ord, Show)
+  deriving newtype
+    ( BG.HasFFIType
+    , Marshal.ReadRaw
+    , Marshal.StaticSize
+    , BG.Storable
+    , Marshal.WriteRaw
+    )
+
+instance ( ty ~ BG.Ptr DuckDBV2CopyToFlushInfoStruct
+         ) => BG.CompatHasField.HasField "unwrap" DuckDBV2CopyToFlushInfoHandle ty where
+
+  hasField =
+    \x0 ->
+      ( \y1 -> DuckDBV2CopyToFlushInfoHandle {unwrap = y1}
+      , BG.getField @"unwrap" x0
+      )
+
+instance ( ty ~ BG.Ptr DuckDBV2CopyToFlushInfoStruct
+         ) => BG.HasField "unwrap" (BG.Ptr DuckDBV2CopyToFlushInfoHandle) (BG.Ptr ty) where
+
+  getField = HasCField.fromPtr (BG.Proxy @"unwrap")
+
+instance HasCField.HasCField DuckDBV2CopyToFlushInfoHandle "unwrap" where
+
+  type CFieldType DuckDBV2CopyToFlushInfoHandle "unwrap" =
+    BG.Ptr DuckDBV2CopyToFlushInfoStruct
+
+  offset# = \_ -> \_ -> 0
+
+{-| A borrowed opaque handle to the arguments supplied to a copy function during the per-file "finalize" phase of a @COPY ... TO@ statement. The "finalize" callback receives this handle and can use it to e.g. close the file after every batch has been flushed to it.
+
+    __C declaration:__ @struct _duckdb_v2_copy_to_finalize_info@
+
+    __defined at:__ @duckdb_v2.h 6222:16@
+
+    __exported by:__ @duckdb_v2.h@
+-}
+data DuckDBV2CopyToFinalizeInfoStruct
+
+instance Marshal.StaticSize DuckDBV2CopyToFinalizeInfoStruct where
+
+  staticSizeOf = \_ -> (8 :: Int)
+
+  staticAlignment = \_ -> (8 :: Int)
+
+{-| A borrowed opaque handle to the arguments supplied to a copy function during the per-file "finalize" phase of a @COPY ... TO@ statement. The "finalize" callback receives this handle and can use it to e.g. close the file after every batch has been flushed to it.
+
+    __C declaration:__ @duckdb_v2_copy_to_finalize_info_handle@
+
+    __defined at:__ @duckdb_v2.h 6224:5@
+
+    __exported by:__ @duckdb_v2.h@
+-}
+newtype DuckDBV2CopyToFinalizeInfoHandle = DuckDBV2CopyToFinalizeInfoHandle
+  { unwrap :: BG.Ptr DuckDBV2CopyToFinalizeInfoStruct
+  }
+  deriving stock (Eq, BG.Generic, Ord, Show)
+  deriving newtype
+    ( BG.HasFFIType
+    , Marshal.ReadRaw
+    , Marshal.StaticSize
+    , BG.Storable
+    , Marshal.WriteRaw
+    )
+
+instance ( ty ~ BG.Ptr DuckDBV2CopyToFinalizeInfoStruct
+         ) => BG.CompatHasField.HasField "unwrap" DuckDBV2CopyToFinalizeInfoHandle ty where
+
+  hasField =
+    \x0 ->
+      ( \y1 ->
+          DuckDBV2CopyToFinalizeInfoHandle {unwrap = y1}
+      , BG.getField @"unwrap" x0
+      )
+
+instance ( ty ~ BG.Ptr DuckDBV2CopyToFinalizeInfoStruct
+         ) => BG.HasField "unwrap" (BG.Ptr DuckDBV2CopyToFinalizeInfoHandle) (BG.Ptr ty) where
+
+  getField = HasCField.fromPtr (BG.Proxy @"unwrap")
+
+instance HasCField.HasCField DuckDBV2CopyToFinalizeInfoHandle "unwrap" where
+
+  type CFieldType DuckDBV2CopyToFinalizeInfoHandle "unwrap" =
+    BG.Ptr DuckDBV2CopyToFinalizeInfoStruct
+
+  offset# = \_ -> \_ -> 0
+
+{-| A borrowed opaque handle to the arguments supplied to a copy function when a @COPY ... TO@ statement reports statistics about the files it wrote (e.g. with @RETURN_STATS@ ). The "statistics" callback receives this handle and uses it to report the statistics of one written file.
+
+    __C declaration:__ @struct _duckdb_v2_copy_to_statistics_info@
+
+    __defined at:__ @duckdb_v2.h 6231:16@
+
+    __exported by:__ @duckdb_v2.h@
+-}
+data DuckDBV2CopyToStatisticsInfoStruct
+
+instance Marshal.StaticSize DuckDBV2CopyToStatisticsInfoStruct where
+
+  staticSizeOf = \_ -> (8 :: Int)
+
+  staticAlignment = \_ -> (8 :: Int)
+
+{-| A borrowed opaque handle to the arguments supplied to a copy function when a @COPY ... TO@ statement reports statistics about the files it wrote (e.g. with @RETURN_STATS@ ). The "statistics" callback receives this handle and uses it to report the statistics of one written file.
+
+    __C declaration:__ @duckdb_v2_copy_to_statistics_info_handle@
+
+    __defined at:__ @duckdb_v2.h 6233:5@
+
+    __exported by:__ @duckdb_v2.h@
+-}
+newtype DuckDBV2CopyToStatisticsInfoHandle = DuckDBV2CopyToStatisticsInfoHandle
+  { unwrap :: BG.Ptr DuckDBV2CopyToStatisticsInfoStruct
+  }
+  deriving stock (Eq, BG.Generic, Ord, Show)
+  deriving newtype
+    ( BG.HasFFIType
+    , Marshal.ReadRaw
+    , Marshal.StaticSize
+    , BG.Storable
+    , Marshal.WriteRaw
+    )
+
+instance ( ty ~ BG.Ptr DuckDBV2CopyToStatisticsInfoStruct
+         ) => BG.CompatHasField.HasField "unwrap" DuckDBV2CopyToStatisticsInfoHandle ty where
+
+  hasField =
+    \x0 ->
+      ( \y1 ->
+          DuckDBV2CopyToStatisticsInfoHandle {unwrap = y1}
+      , BG.getField @"unwrap" x0
+      )
+
+instance ( ty ~ BG.Ptr DuckDBV2CopyToStatisticsInfoStruct
+         ) => BG.HasField "unwrap" (BG.Ptr DuckDBV2CopyToStatisticsInfoHandle) (BG.Ptr ty) where
+
+  getField = HasCField.fromPtr (BG.Proxy @"unwrap")
+
+instance HasCField.HasCField DuckDBV2CopyToStatisticsInfoHandle "unwrap" where
+
+  type CFieldType DuckDBV2CopyToStatisticsInfoHandle "unwrap" =
+    BG.Ptr DuckDBV2CopyToStatisticsInfoStruct
+
+  offset# = \_ -> \_ -> 0
+
+{-| A borrowed opaque handle to the arguments supplied to a copy function during the query preparation "bind" phase of a @COPY ... FROM@ statement. The "bind" callback receives this handle and can use it to e.g. read the path of the file to read, inspect the names and types of the columns the target table expects, read the statement\'s options, hint at the number of rows the read will produce and initialize some constant state.
+
+    __C declaration:__ @struct _duckdb_v2_copy_from_bind_info@
+
+    __defined at:__ @duckdb_v2.h 6241:16@
+
+    __exported by:__ @duckdb_v2.h@
+-}
+data DuckDBV2CopyFromBindInfoStruct
+
+instance Marshal.StaticSize DuckDBV2CopyFromBindInfoStruct where
+
+  staticSizeOf = \_ -> (8 :: Int)
+
+  staticAlignment = \_ -> (8 :: Int)
+
+{-| A borrowed opaque handle to the arguments supplied to a copy function during the query preparation "bind" phase of a @COPY ... FROM@ statement. The "bind" callback receives this handle and can use it to e.g. read the path of the file to read, inspect the names and types of the columns the target table expects, read the statement\'s options, hint at the number of rows the read will produce and initialize some constant state.
+
+    __C declaration:__ @duckdb_v2_copy_from_bind_info_handle@
+
+    __defined at:__ @duckdb_v2.h 6243:5@
+
+    __exported by:__ @duckdb_v2.h@
+-}
+newtype DuckDBV2CopyFromBindInfoHandle = DuckDBV2CopyFromBindInfoHandle
+  { unwrap :: BG.Ptr DuckDBV2CopyFromBindInfoStruct
+  }
+  deriving stock (Eq, BG.Generic, Ord, Show)
+  deriving newtype
+    ( BG.HasFFIType
+    , Marshal.ReadRaw
+    , Marshal.StaticSize
+    , BG.Storable
+    , Marshal.WriteRaw
+    )
+
+instance ( ty ~ BG.Ptr DuckDBV2CopyFromBindInfoStruct
+         ) => BG.CompatHasField.HasField "unwrap" DuckDBV2CopyFromBindInfoHandle ty where
+
+  hasField =
+    \x0 ->
+      ( \y1 -> DuckDBV2CopyFromBindInfoHandle {unwrap = y1}
+      , BG.getField @"unwrap" x0
+      )
+
+instance ( ty ~ BG.Ptr DuckDBV2CopyFromBindInfoStruct
+         ) => BG.HasField "unwrap" (BG.Ptr DuckDBV2CopyFromBindInfoHandle) (BG.Ptr ty) where
+
+  getField = HasCField.fromPtr (BG.Proxy @"unwrap")
+
+instance HasCField.HasCField DuckDBV2CopyFromBindInfoHandle "unwrap" where
+
+  type CFieldType DuckDBV2CopyFromBindInfoHandle "unwrap" =
+    BG.Ptr DuckDBV2CopyFromBindInfoStruct
+
+  offset# = \_ -> \_ -> 0
+
+{-| A borrowed opaque handle to the arguments supplied to a copy function during the global state initialization "init global" phase of a @COPY ... FROM@ statement. The "init global" callback receives this handle and can use it to e.g. set up the state shared by every thread reading the file, and to declare how many threads may read it.
+
+    __C declaration:__ @struct _duckdb_v2_copy_from_init_global_info@
+
+    __defined at:__ @duckdb_v2.h 6250:16@
+
+    __exported by:__ @duckdb_v2.h@
+-}
+data DuckDBV2CopyFromInitGlobalInfoStruct
+
+instance Marshal.StaticSize DuckDBV2CopyFromInitGlobalInfoStruct where
+
+  staticSizeOf = \_ -> (8 :: Int)
+
+  staticAlignment = \_ -> (8 :: Int)
+
+{-| A borrowed opaque handle to the arguments supplied to a copy function during the global state initialization "init global" phase of a @COPY ... FROM@ statement. The "init global" callback receives this handle and can use it to e.g. set up the state shared by every thread reading the file, and to declare how many threads may read it.
+
+    __C declaration:__ @duckdb_v2_copy_from_init_global_info_handle@
+
+    __defined at:__ @duckdb_v2.h 6252:5@
+
+    __exported by:__ @duckdb_v2.h@
+-}
+newtype DuckDBV2CopyFromInitGlobalInfoHandle = DuckDBV2CopyFromInitGlobalInfoHandle
+  { unwrap :: BG.Ptr DuckDBV2CopyFromInitGlobalInfoStruct
+  }
+  deriving stock (Eq, BG.Generic, Ord, Show)
+  deriving newtype
+    ( BG.HasFFIType
+    , Marshal.ReadRaw
+    , Marshal.StaticSize
+    , BG.Storable
+    , Marshal.WriteRaw
+    )
+
+instance ( ty ~ BG.Ptr DuckDBV2CopyFromInitGlobalInfoStruct
+         ) => BG.CompatHasField.HasField "unwrap" DuckDBV2CopyFromInitGlobalInfoHandle ty where
+
+  hasField =
+    \x0 ->
+      ( \y1 ->
+          DuckDBV2CopyFromInitGlobalInfoHandle {unwrap = y1}
+      , BG.getField @"unwrap" x0
+      )
+
+instance ( ty ~ BG.Ptr DuckDBV2CopyFromInitGlobalInfoStruct
+         ) => BG.HasField "unwrap" (BG.Ptr DuckDBV2CopyFromInitGlobalInfoHandle) (BG.Ptr ty) where
+
+  getField = HasCField.fromPtr (BG.Proxy @"unwrap")
+
+instance HasCField.HasCField DuckDBV2CopyFromInitGlobalInfoHandle "unwrap" where
+
+  type CFieldType DuckDBV2CopyFromInitGlobalInfoHandle "unwrap" =
+    BG.Ptr DuckDBV2CopyFromInitGlobalInfoStruct
+
+  offset# = \_ -> \_ -> 0
+
+{-| A borrowed opaque handle to the arguments supplied to a copy function during the local state initialization "init local" phase of a @COPY ... FROM@ statement. The "init local" callback receives this handle and can use it to e.g. set up worker-local state, typically by claiming work from the shared global state.
+
+    __C declaration:__ @struct _duckdb_v2_copy_from_init_local_info@
+
+    __defined at:__ @duckdb_v2.h 6259:16@
+
+    __exported by:__ @duckdb_v2.h@
+-}
+data DuckDBV2CopyFromInitLocalInfoStruct
+
+instance Marshal.StaticSize DuckDBV2CopyFromInitLocalInfoStruct where
+
+  staticSizeOf = \_ -> (8 :: Int)
+
+  staticAlignment = \_ -> (8 :: Int)
+
+{-| A borrowed opaque handle to the arguments supplied to a copy function during the local state initialization "init local" phase of a @COPY ... FROM@ statement. The "init local" callback receives this handle and can use it to e.g. set up worker-local state, typically by claiming work from the shared global state.
+
+    __C declaration:__ @duckdb_v2_copy_from_init_local_info_handle@
+
+    __defined at:__ @duckdb_v2.h 6261:5@
+
+    __exported by:__ @duckdb_v2.h@
+-}
+newtype DuckDBV2CopyFromInitLocalInfoHandle = DuckDBV2CopyFromInitLocalInfoHandle
+  { unwrap :: BG.Ptr DuckDBV2CopyFromInitLocalInfoStruct
+  }
+  deriving stock (Eq, BG.Generic, Ord, Show)
+  deriving newtype
+    ( BG.HasFFIType
+    , Marshal.ReadRaw
+    , Marshal.StaticSize
+    , BG.Storable
+    , Marshal.WriteRaw
+    )
+
+instance ( ty ~ BG.Ptr DuckDBV2CopyFromInitLocalInfoStruct
+         ) => BG.CompatHasField.HasField "unwrap" DuckDBV2CopyFromInitLocalInfoHandle ty where
+
+  hasField =
+    \x0 ->
+      ( \y1 ->
+          DuckDBV2CopyFromInitLocalInfoHandle {unwrap = y1}
+      , BG.getField @"unwrap" x0
+      )
+
+instance ( ty ~ BG.Ptr DuckDBV2CopyFromInitLocalInfoStruct
+         ) => BG.HasField "unwrap" (BG.Ptr DuckDBV2CopyFromInitLocalInfoHandle) (BG.Ptr ty) where
+
+  getField = HasCField.fromPtr (BG.Proxy @"unwrap")
+
+instance HasCField.HasCField DuckDBV2CopyFromInitLocalInfoHandle "unwrap" where
+
+  type CFieldType DuckDBV2CopyFromInitLocalInfoHandle "unwrap" =
+    BG.Ptr DuckDBV2CopyFromInitLocalInfoStruct
+
+  offset# = \_ -> \_ -> 0
+
+{-| A borrowed opaque handle to the arguments supplied to a copy function during the execution "exec" phase of a @COPY ... FROM@ statement. The "exec" callback receives this handle and can use it to e.g. access the global and local state and write the next batch of rows to the output chunk.
+
+    __C declaration:__ @struct _duckdb_v2_copy_from_exec_info@
+
+    __defined at:__ @duckdb_v2.h 6268:16@
+
+    __exported by:__ @duckdb_v2.h@
+-}
+data DuckDBV2CopyFromExecInfoStruct
+
+instance Marshal.StaticSize DuckDBV2CopyFromExecInfoStruct where
+
+  staticSizeOf = \_ -> (8 :: Int)
+
+  staticAlignment = \_ -> (8 :: Int)
+
+{-| A borrowed opaque handle to the arguments supplied to a copy function during the execution "exec" phase of a @COPY ... FROM@ statement. The "exec" callback receives this handle and can use it to e.g. access the global and local state and write the next batch of rows to the output chunk.
+
+    __C declaration:__ @duckdb_v2_copy_from_exec_info_handle@
+
+    __defined at:__ @duckdb_v2.h 6270:5@
+
+    __exported by:__ @duckdb_v2.h@
+-}
+newtype DuckDBV2CopyFromExecInfoHandle = DuckDBV2CopyFromExecInfoHandle
+  { unwrap :: BG.Ptr DuckDBV2CopyFromExecInfoStruct
+  }
+  deriving stock (Eq, BG.Generic, Ord, Show)
+  deriving newtype
+    ( BG.HasFFIType
+    , Marshal.ReadRaw
+    , Marshal.StaticSize
+    , BG.Storable
+    , Marshal.WriteRaw
+    )
+
+instance ( ty ~ BG.Ptr DuckDBV2CopyFromExecInfoStruct
+         ) => BG.CompatHasField.HasField "unwrap" DuckDBV2CopyFromExecInfoHandle ty where
+
+  hasField =
+    \x0 ->
+      ( \y1 -> DuckDBV2CopyFromExecInfoHandle {unwrap = y1}
+      , BG.getField @"unwrap" x0
+      )
+
+instance ( ty ~ BG.Ptr DuckDBV2CopyFromExecInfoStruct
+         ) => BG.HasField "unwrap" (BG.Ptr DuckDBV2CopyFromExecInfoHandle) (BG.Ptr ty) where
+
+  getField = HasCField.fromPtr (BG.Proxy @"unwrap")
+
+instance HasCField.HasCField DuckDBV2CopyFromExecInfoHandle "unwrap" where
+
+  type CFieldType DuckDBV2CopyFromExecInfoHandle "unwrap" =
+    BG.Ptr DuckDBV2CopyFromExecInfoStruct
+
+  offset# = \_ -> \_ -> 0
+
+{-| A borrowed opaque handle to the arguments supplied to a copy function during the "progress" phase of a @COPY ... FROM@ statement. The "progress" callback receives this handle and can use it to report how far the read has advanced.
+
+    __C declaration:__ @struct _duckdb_v2_copy_from_progress_info@
+
+    __defined at:__ @duckdb_v2.h 6276:16@
+
+    __exported by:__ @duckdb_v2.h@
+-}
+data DuckDBV2CopyFromProgressInfoStruct
+
+instance Marshal.StaticSize DuckDBV2CopyFromProgressInfoStruct where
+
+  staticSizeOf = \_ -> (8 :: Int)
+
+  staticAlignment = \_ -> (8 :: Int)
+
+{-| A borrowed opaque handle to the arguments supplied to a copy function during the "progress" phase of a @COPY ... FROM@ statement. The "progress" callback receives this handle and can use it to report how far the read has advanced.
+
+    __C declaration:__ @duckdb_v2_copy_from_progress_info_handle@
+
+    __defined at:__ @duckdb_v2.h 6278:5@
+
+    __exported by:__ @duckdb_v2.h@
+-}
+newtype DuckDBV2CopyFromProgressInfoHandle = DuckDBV2CopyFromProgressInfoHandle
+  { unwrap :: BG.Ptr DuckDBV2CopyFromProgressInfoStruct
+  }
+  deriving stock (Eq, BG.Generic, Ord, Show)
+  deriving newtype
+    ( BG.HasFFIType
+    , Marshal.ReadRaw
+    , Marshal.StaticSize
+    , BG.Storable
+    , Marshal.WriteRaw
+    )
+
+instance ( ty ~ BG.Ptr DuckDBV2CopyFromProgressInfoStruct
+         ) => BG.CompatHasField.HasField "unwrap" DuckDBV2CopyFromProgressInfoHandle ty where
+
+  hasField =
+    \x0 ->
+      ( \y1 ->
+          DuckDBV2CopyFromProgressInfoHandle {unwrap = y1}
+      , BG.getField @"unwrap" x0
+      )
+
+instance ( ty ~ BG.Ptr DuckDBV2CopyFromProgressInfoStruct
+         ) => BG.HasField "unwrap" (BG.Ptr DuckDBV2CopyFromProgressInfoHandle) (BG.Ptr ty) where
+
+  getField = HasCField.fromPtr (BG.Proxy @"unwrap")
+
+instance HasCField.HasCField DuckDBV2CopyFromProgressInfoHandle "unwrap" where
+
+  type CFieldType DuckDBV2CopyFromProgressInfoHandle "unwrap" =
+    BG.Ptr DuckDBV2CopyFromProgressInfoStruct
+
+  offset# = \_ -> \_ -> 0
+
+{-| Auxiliary type used by t'DuckDBV2CopyToBindCallbackFn'
+
+    __C declaration:__ @duckdb_v2_copy_to_bind_callback_fn@
+
+    __defined at:__ @duckdb_v2.h 6284:16@
+
+    __exported by:__ @duckdb_v2.h@
+-}
+newtype DuckDBV2CopyToBindCallbackFn_Aux = DuckDBV2CopyToBindCallbackFn_Aux
+  { unwrap :: DuckDBV2CopyToBindInfoHandle -> DuckDBV2ContextHandle -> BG.Ptr DuckDBV2ErrorInfoHandle -> IO ()
+  }
+  deriving stock (BG.Generic)
+
+-- __unique:__ @toDuckDBV2CopyToBindCallbackFn_Aux@
+foreign import ccall safe "wrapper" hs_bindgen_c23834d33805f818_base ::
+     (BG.Ptr BG.Void -> BG.Ptr BG.Void -> BG.Ptr BG.Void -> IO ())
+  -> IO (BG.FunPtr (BG.Ptr BG.Void -> BG.Ptr BG.Void -> BG.Ptr BG.Void -> IO ()))
+
+-- __unique:__ @toDuckDBV2CopyToBindCallbackFn_Aux@
+hs_bindgen_c23834d33805f818 ::
+     DuckDBV2CopyToBindCallbackFn_Aux
+  -> IO (BG.FunPtr DuckDBV2CopyToBindCallbackFn_Aux)
+hs_bindgen_c23834d33805f818 =
+  \fun0 ->
+    fmap BG.castFunPtr (hs_bindgen_c23834d33805f818_base (\x1 ->
+                                                            \x2 ->
+                                                              \x3 ->
+                                                                BG.getField @"unwrap" fun0 (BG.fromFFIType x1) (BG.fromFFIType x2) (BG.fromFFIType x3)))
+
+-- __unique:__ @fromDuckDBV2CopyToBindCallbackFn_Aux@
+foreign import ccall safe "dynamic" hs_bindgen_63c8fe01b2154444_base ::
+     BG.FunPtr (BG.Ptr BG.Void -> BG.Ptr BG.Void -> BG.Ptr BG.Void -> IO ())
+  -> BG.Ptr BG.Void -> BG.Ptr BG.Void -> BG.Ptr BG.Void -> IO ()
+
+-- __unique:__ @fromDuckDBV2CopyToBindCallbackFn_Aux@
+hs_bindgen_63c8fe01b2154444 ::
+     BG.FunPtr DuckDBV2CopyToBindCallbackFn_Aux
+  -> DuckDBV2CopyToBindCallbackFn_Aux
+hs_bindgen_63c8fe01b2154444 =
+  \funPtr0 ->
+    DuckDBV2CopyToBindCallbackFn_Aux (\x1 ->
+                                        \x2 ->
+                                          \x3 ->
+                                            hs_bindgen_63c8fe01b2154444_base (BG.castFunPtr funPtr0) (BG.toFFIType x1) (BG.toFFIType x2) (BG.toFFIType x3))
+
+instance BG.ToFunPtr DuckDBV2CopyToBindCallbackFn_Aux where
+
+  toFunPtr = hs_bindgen_c23834d33805f818
+
+instance BG.FromFunPtr DuckDBV2CopyToBindCallbackFn_Aux where
+
+  fromFunPtr = hs_bindgen_63c8fe01b2154444
+
+instance ( ty ~ (DuckDBV2CopyToBindInfoHandle -> DuckDBV2ContextHandle -> BG.Ptr DuckDBV2ErrorInfoHandle -> IO ())
+         ) => BG.CompatHasField.HasField "unwrap" DuckDBV2CopyToBindCallbackFn_Aux ty where
+
+  hasField =
+    \x0 ->
+      ( \y1 ->
+          DuckDBV2CopyToBindCallbackFn_Aux {unwrap = y1}
+      , BG.getField @"unwrap" x0
+      )
+
+instance ( ty ~ (DuckDBV2CopyToBindInfoHandle -> DuckDBV2ContextHandle -> BG.Ptr DuckDBV2ErrorInfoHandle -> IO ())
+         ) => BG.HasField "unwrap" (BG.Ptr DuckDBV2CopyToBindCallbackFn_Aux) (BG.Ptr ty) where
+
+  getField = HasCField.fromPtr (BG.Proxy @"unwrap")
+
+instance HasCField.HasCField DuckDBV2CopyToBindCallbackFn_Aux "unwrap" where
+
+  type CFieldType DuckDBV2CopyToBindCallbackFn_Aux "unwrap" =
+    DuckDBV2CopyToBindInfoHandle -> DuckDBV2ContextHandle -> BG.Ptr DuckDBV2ErrorInfoHandle -> IO ()
+
+  offset# = \_ -> \_ -> 0
+
+{-| __C declaration:__ @duckdb_v2_copy_to_bind_callback_fn@
+
+    __defined at:__ @duckdb_v2.h 6284:16@
+
+    __exported by:__ @duckdb_v2.h@
+-}
+newtype DuckDBV2CopyToBindCallbackFn = DuckDBV2CopyToBindCallbackFn
+  { unwrap :: BG.FunPtr DuckDBV2CopyToBindCallbackFn_Aux
+  }
+  deriving stock (Eq, BG.Generic, Ord, Show)
+  deriving newtype
+    ( BG.HasFFIType
+    , Marshal.ReadRaw
+    , Marshal.StaticSize
+    , BG.Storable
+    , Marshal.WriteRaw
+    )
+
+instance ( ty ~ BG.FunPtr DuckDBV2CopyToBindCallbackFn_Aux
+         ) => BG.CompatHasField.HasField "unwrap" DuckDBV2CopyToBindCallbackFn ty where
+
+  hasField =
+    \x0 ->
+      (\y1 ->
+         DuckDBV2CopyToBindCallbackFn {unwrap = y1}, BG.getField @"unwrap" x0)
+
+instance ( ty ~ BG.FunPtr DuckDBV2CopyToBindCallbackFn_Aux
+         ) => BG.HasField "unwrap" (BG.Ptr DuckDBV2CopyToBindCallbackFn) (BG.Ptr ty) where
+
+  getField = HasCField.fromPtr (BG.Proxy @"unwrap")
+
+instance HasCField.HasCField DuckDBV2CopyToBindCallbackFn "unwrap" where
+
+  type CFieldType DuckDBV2CopyToBindCallbackFn "unwrap" =
+    BG.FunPtr DuckDBV2CopyToBindCallbackFn_Aux
+
+  offset# = \_ -> \_ -> 0
+
+{-| Auxiliary type used by t'DuckDBV2CopyToBatchSizeCallbackFn'
+
+    __C declaration:__ @duckdb_v2_copy_to_batch_size_callback_fn@
+
+    __defined at:__ @duckdb_v2.h 6287:16@
+
+    __exported by:__ @duckdb_v2.h@
+-}
+newtype DuckDBV2CopyToBatchSizeCallbackFn_Aux = DuckDBV2CopyToBatchSizeCallbackFn_Aux
+  { unwrap :: DuckDBV2CopyToBatchSizeInfoHandle -> DuckDBV2ContextHandle -> BG.Ptr DuckDBV2ErrorInfoHandle -> IO ()
+  }
+  deriving stock (BG.Generic)
+
+-- __unique:__ @toDuckDBV2CopyToBatchSizeCallbackFn_Aux@
+foreign import ccall safe "wrapper" hs_bindgen_d492c4aa2ae102e9_base ::
+     (BG.Ptr BG.Void -> BG.Ptr BG.Void -> BG.Ptr BG.Void -> IO ())
+  -> IO (BG.FunPtr (BG.Ptr BG.Void -> BG.Ptr BG.Void -> BG.Ptr BG.Void -> IO ()))
+
+-- __unique:__ @toDuckDBV2CopyToBatchSizeCallbackFn_Aux@
+hs_bindgen_d492c4aa2ae102e9 ::
+     DuckDBV2CopyToBatchSizeCallbackFn_Aux
+  -> IO (BG.FunPtr DuckDBV2CopyToBatchSizeCallbackFn_Aux)
+hs_bindgen_d492c4aa2ae102e9 =
+  \fun0 ->
+    fmap BG.castFunPtr (hs_bindgen_d492c4aa2ae102e9_base (\x1 ->
+                                                            \x2 ->
+                                                              \x3 ->
+                                                                BG.getField @"unwrap" fun0 (BG.fromFFIType x1) (BG.fromFFIType x2) (BG.fromFFIType x3)))
+
+-- __unique:__ @fromDuckDBV2CopyToBatchSizeCallbackFn_Aux@
+foreign import ccall safe "dynamic" hs_bindgen_82088525e0b9c076_base ::
+     BG.FunPtr (BG.Ptr BG.Void -> BG.Ptr BG.Void -> BG.Ptr BG.Void -> IO ())
+  -> BG.Ptr BG.Void -> BG.Ptr BG.Void -> BG.Ptr BG.Void -> IO ()
+
+-- __unique:__ @fromDuckDBV2CopyToBatchSizeCallbackFn_Aux@
+hs_bindgen_82088525e0b9c076 ::
+     BG.FunPtr DuckDBV2CopyToBatchSizeCallbackFn_Aux
+  -> DuckDBV2CopyToBatchSizeCallbackFn_Aux
+hs_bindgen_82088525e0b9c076 =
+  \funPtr0 ->
+    DuckDBV2CopyToBatchSizeCallbackFn_Aux (\x1 ->
+                                             \x2 ->
+                                               \x3 ->
+                                                 hs_bindgen_82088525e0b9c076_base (BG.castFunPtr funPtr0) (BG.toFFIType x1) (BG.toFFIType x2) (BG.toFFIType x3))
+
+instance BG.ToFunPtr DuckDBV2CopyToBatchSizeCallbackFn_Aux where
+
+  toFunPtr = hs_bindgen_d492c4aa2ae102e9
+
+instance BG.FromFunPtr DuckDBV2CopyToBatchSizeCallbackFn_Aux where
+
+  fromFunPtr = hs_bindgen_82088525e0b9c076
+
+instance ( ty ~ (DuckDBV2CopyToBatchSizeInfoHandle -> DuckDBV2ContextHandle -> BG.Ptr DuckDBV2ErrorInfoHandle -> IO ())
+         ) => BG.CompatHasField.HasField "unwrap" DuckDBV2CopyToBatchSizeCallbackFn_Aux ty where
+
+  hasField =
+    \x0 ->
+      ( \y1 ->
+          DuckDBV2CopyToBatchSizeCallbackFn_Aux {unwrap = y1}
+      , BG.getField @"unwrap" x0
+      )
+
+instance ( ty ~ (DuckDBV2CopyToBatchSizeInfoHandle -> DuckDBV2ContextHandle -> BG.Ptr DuckDBV2ErrorInfoHandle -> IO ())
+         ) => BG.HasField "unwrap" (BG.Ptr DuckDBV2CopyToBatchSizeCallbackFn_Aux) (BG.Ptr ty) where
+
+  getField = HasCField.fromPtr (BG.Proxy @"unwrap")
+
+instance HasCField.HasCField DuckDBV2CopyToBatchSizeCallbackFn_Aux "unwrap" where
+
+  type CFieldType DuckDBV2CopyToBatchSizeCallbackFn_Aux "unwrap" =
+    DuckDBV2CopyToBatchSizeInfoHandle -> DuckDBV2ContextHandle -> BG.Ptr DuckDBV2ErrorInfoHandle -> IO ()
+
+  offset# = \_ -> \_ -> 0
+
+{-| __C declaration:__ @duckdb_v2_copy_to_batch_size_callback_fn@
+
+    __defined at:__ @duckdb_v2.h 6287:16@
+
+    __exported by:__ @duckdb_v2.h@
+-}
+newtype DuckDBV2CopyToBatchSizeCallbackFn = DuckDBV2CopyToBatchSizeCallbackFn
+  { unwrap :: BG.FunPtr DuckDBV2CopyToBatchSizeCallbackFn_Aux
+  }
+  deriving stock (Eq, BG.Generic, Ord, Show)
+  deriving newtype
+    ( BG.HasFFIType
+    , Marshal.ReadRaw
+    , Marshal.StaticSize
+    , BG.Storable
+    , Marshal.WriteRaw
+    )
+
+instance ( ty ~ BG.FunPtr DuckDBV2CopyToBatchSizeCallbackFn_Aux
+         ) => BG.CompatHasField.HasField "unwrap" DuckDBV2CopyToBatchSizeCallbackFn ty where
+
+  hasField =
+    \x0 ->
+      ( \y1 ->
+          DuckDBV2CopyToBatchSizeCallbackFn {unwrap = y1}
+      , BG.getField @"unwrap" x0
+      )
+
+instance ( ty ~ BG.FunPtr DuckDBV2CopyToBatchSizeCallbackFn_Aux
+         ) => BG.HasField "unwrap" (BG.Ptr DuckDBV2CopyToBatchSizeCallbackFn) (BG.Ptr ty) where
+
+  getField = HasCField.fromPtr (BG.Proxy @"unwrap")
+
+instance HasCField.HasCField DuckDBV2CopyToBatchSizeCallbackFn "unwrap" where
+
+  type CFieldType DuckDBV2CopyToBatchSizeCallbackFn "unwrap" =
+    BG.FunPtr DuckDBV2CopyToBatchSizeCallbackFn_Aux
+
+  offset# = \_ -> \_ -> 0
+
+{-| Auxiliary type used by t'DuckDBV2CopyToInitCallbackFn'
+
+    __C declaration:__ @duckdb_v2_copy_to_init_callback_fn@
+
+    __defined at:__ @duckdb_v2.h 6291:16@
+
+    __exported by:__ @duckdb_v2.h@
+-}
+newtype DuckDBV2CopyToInitCallbackFn_Aux = DuckDBV2CopyToInitCallbackFn_Aux
+  { unwrap :: DuckDBV2CopyToInitInfoHandle -> DuckDBV2ContextHandle -> BG.Ptr DuckDBV2ErrorInfoHandle -> IO ()
+  }
+  deriving stock (BG.Generic)
+
+-- __unique:__ @toDuckDBV2CopyToInitCallbackFn_Aux@
+foreign import ccall safe "wrapper" hs_bindgen_ea1b303708a16a40_base ::
+     (BG.Ptr BG.Void -> BG.Ptr BG.Void -> BG.Ptr BG.Void -> IO ())
+  -> IO (BG.FunPtr (BG.Ptr BG.Void -> BG.Ptr BG.Void -> BG.Ptr BG.Void -> IO ()))
+
+-- __unique:__ @toDuckDBV2CopyToInitCallbackFn_Aux@
+hs_bindgen_ea1b303708a16a40 ::
+     DuckDBV2CopyToInitCallbackFn_Aux
+  -> IO (BG.FunPtr DuckDBV2CopyToInitCallbackFn_Aux)
+hs_bindgen_ea1b303708a16a40 =
+  \fun0 ->
+    fmap BG.castFunPtr (hs_bindgen_ea1b303708a16a40_base (\x1 ->
+                                                            \x2 ->
+                                                              \x3 ->
+                                                                BG.getField @"unwrap" fun0 (BG.fromFFIType x1) (BG.fromFFIType x2) (BG.fromFFIType x3)))
+
+-- __unique:__ @fromDuckDBV2CopyToInitCallbackFn_Aux@
+foreign import ccall safe "dynamic" hs_bindgen_28629c3e834ae588_base ::
+     BG.FunPtr (BG.Ptr BG.Void -> BG.Ptr BG.Void -> BG.Ptr BG.Void -> IO ())
+  -> BG.Ptr BG.Void -> BG.Ptr BG.Void -> BG.Ptr BG.Void -> IO ()
+
+-- __unique:__ @fromDuckDBV2CopyToInitCallbackFn_Aux@
+hs_bindgen_28629c3e834ae588 ::
+     BG.FunPtr DuckDBV2CopyToInitCallbackFn_Aux
+  -> DuckDBV2CopyToInitCallbackFn_Aux
+hs_bindgen_28629c3e834ae588 =
+  \funPtr0 ->
+    DuckDBV2CopyToInitCallbackFn_Aux (\x1 ->
+                                        \x2 ->
+                                          \x3 ->
+                                            hs_bindgen_28629c3e834ae588_base (BG.castFunPtr funPtr0) (BG.toFFIType x1) (BG.toFFIType x2) (BG.toFFIType x3))
+
+instance BG.ToFunPtr DuckDBV2CopyToInitCallbackFn_Aux where
+
+  toFunPtr = hs_bindgen_ea1b303708a16a40
+
+instance BG.FromFunPtr DuckDBV2CopyToInitCallbackFn_Aux where
+
+  fromFunPtr = hs_bindgen_28629c3e834ae588
+
+instance ( ty ~ (DuckDBV2CopyToInitInfoHandle -> DuckDBV2ContextHandle -> BG.Ptr DuckDBV2ErrorInfoHandle -> IO ())
+         ) => BG.CompatHasField.HasField "unwrap" DuckDBV2CopyToInitCallbackFn_Aux ty where
+
+  hasField =
+    \x0 ->
+      ( \y1 ->
+          DuckDBV2CopyToInitCallbackFn_Aux {unwrap = y1}
+      , BG.getField @"unwrap" x0
+      )
+
+instance ( ty ~ (DuckDBV2CopyToInitInfoHandle -> DuckDBV2ContextHandle -> BG.Ptr DuckDBV2ErrorInfoHandle -> IO ())
+         ) => BG.HasField "unwrap" (BG.Ptr DuckDBV2CopyToInitCallbackFn_Aux) (BG.Ptr ty) where
+
+  getField = HasCField.fromPtr (BG.Proxy @"unwrap")
+
+instance HasCField.HasCField DuckDBV2CopyToInitCallbackFn_Aux "unwrap" where
+
+  type CFieldType DuckDBV2CopyToInitCallbackFn_Aux "unwrap" =
+    DuckDBV2CopyToInitInfoHandle -> DuckDBV2ContextHandle -> BG.Ptr DuckDBV2ErrorInfoHandle -> IO ()
+
+  offset# = \_ -> \_ -> 0
+
+{-| __C declaration:__ @duckdb_v2_copy_to_init_callback_fn@
+
+    __defined at:__ @duckdb_v2.h 6291:16@
+
+    __exported by:__ @duckdb_v2.h@
+-}
+newtype DuckDBV2CopyToInitCallbackFn = DuckDBV2CopyToInitCallbackFn
+  { unwrap :: BG.FunPtr DuckDBV2CopyToInitCallbackFn_Aux
+  }
+  deriving stock (Eq, BG.Generic, Ord, Show)
+  deriving newtype
+    ( BG.HasFFIType
+    , Marshal.ReadRaw
+    , Marshal.StaticSize
+    , BG.Storable
+    , Marshal.WriteRaw
+    )
+
+instance ( ty ~ BG.FunPtr DuckDBV2CopyToInitCallbackFn_Aux
+         ) => BG.CompatHasField.HasField "unwrap" DuckDBV2CopyToInitCallbackFn ty where
+
+  hasField =
+    \x0 ->
+      (\y1 ->
+         DuckDBV2CopyToInitCallbackFn {unwrap = y1}, BG.getField @"unwrap" x0)
+
+instance ( ty ~ BG.FunPtr DuckDBV2CopyToInitCallbackFn_Aux
+         ) => BG.HasField "unwrap" (BG.Ptr DuckDBV2CopyToInitCallbackFn) (BG.Ptr ty) where
+
+  getField = HasCField.fromPtr (BG.Proxy @"unwrap")
+
+instance HasCField.HasCField DuckDBV2CopyToInitCallbackFn "unwrap" where
+
+  type CFieldType DuckDBV2CopyToInitCallbackFn "unwrap" =
+    BG.FunPtr DuckDBV2CopyToInitCallbackFn_Aux
+
+  offset# = \_ -> \_ -> 0
+
+{-| Auxiliary type used by t'DuckDBV2CopyToBatchCallbackFn'
+
+    __C declaration:__ @duckdb_v2_copy_to_batch_callback_fn@
+
+    __defined at:__ @duckdb_v2.h 6294:16@
+
+    __exported by:__ @duckdb_v2.h@
+-}
+newtype DuckDBV2CopyToBatchCallbackFn_Aux = DuckDBV2CopyToBatchCallbackFn_Aux
+  { unwrap :: DuckDBV2CopyToBatchInfoHandle -> DuckDBV2ContextHandle -> BG.Ptr DuckDBV2ErrorInfoHandle -> IO ()
+  }
+  deriving stock (BG.Generic)
+
+-- __unique:__ @toDuckDBV2CopyToBatchCallbackFn_Aux@
+foreign import ccall safe "wrapper" hs_bindgen_fac0e57ce7afb509_base ::
+     (BG.Ptr BG.Void -> BG.Ptr BG.Void -> BG.Ptr BG.Void -> IO ())
+  -> IO (BG.FunPtr (BG.Ptr BG.Void -> BG.Ptr BG.Void -> BG.Ptr BG.Void -> IO ()))
+
+-- __unique:__ @toDuckDBV2CopyToBatchCallbackFn_Aux@
+hs_bindgen_fac0e57ce7afb509 ::
+     DuckDBV2CopyToBatchCallbackFn_Aux
+  -> IO (BG.FunPtr DuckDBV2CopyToBatchCallbackFn_Aux)
+hs_bindgen_fac0e57ce7afb509 =
+  \fun0 ->
+    fmap BG.castFunPtr (hs_bindgen_fac0e57ce7afb509_base (\x1 ->
+                                                            \x2 ->
+                                                              \x3 ->
+                                                                BG.getField @"unwrap" fun0 (BG.fromFFIType x1) (BG.fromFFIType x2) (BG.fromFFIType x3)))
+
+-- __unique:__ @fromDuckDBV2CopyToBatchCallbackFn_Aux@
+foreign import ccall safe "dynamic" hs_bindgen_592f066642e6892f_base ::
+     BG.FunPtr (BG.Ptr BG.Void -> BG.Ptr BG.Void -> BG.Ptr BG.Void -> IO ())
+  -> BG.Ptr BG.Void -> BG.Ptr BG.Void -> BG.Ptr BG.Void -> IO ()
+
+-- __unique:__ @fromDuckDBV2CopyToBatchCallbackFn_Aux@
+hs_bindgen_592f066642e6892f ::
+     BG.FunPtr DuckDBV2CopyToBatchCallbackFn_Aux
+  -> DuckDBV2CopyToBatchCallbackFn_Aux
+hs_bindgen_592f066642e6892f =
+  \funPtr0 ->
+    DuckDBV2CopyToBatchCallbackFn_Aux (\x1 ->
+                                         \x2 ->
+                                           \x3 ->
+                                             hs_bindgen_592f066642e6892f_base (BG.castFunPtr funPtr0) (BG.toFFIType x1) (BG.toFFIType x2) (BG.toFFIType x3))
+
+instance BG.ToFunPtr DuckDBV2CopyToBatchCallbackFn_Aux where
+
+  toFunPtr = hs_bindgen_fac0e57ce7afb509
+
+instance BG.FromFunPtr DuckDBV2CopyToBatchCallbackFn_Aux where
+
+  fromFunPtr = hs_bindgen_592f066642e6892f
+
+instance ( ty ~ (DuckDBV2CopyToBatchInfoHandle -> DuckDBV2ContextHandle -> BG.Ptr DuckDBV2ErrorInfoHandle -> IO ())
+         ) => BG.CompatHasField.HasField "unwrap" DuckDBV2CopyToBatchCallbackFn_Aux ty where
+
+  hasField =
+    \x0 ->
+      ( \y1 ->
+          DuckDBV2CopyToBatchCallbackFn_Aux {unwrap = y1}
+      , BG.getField @"unwrap" x0
+      )
+
+instance ( ty ~ (DuckDBV2CopyToBatchInfoHandle -> DuckDBV2ContextHandle -> BG.Ptr DuckDBV2ErrorInfoHandle -> IO ())
+         ) => BG.HasField "unwrap" (BG.Ptr DuckDBV2CopyToBatchCallbackFn_Aux) (BG.Ptr ty) where
+
+  getField = HasCField.fromPtr (BG.Proxy @"unwrap")
+
+instance HasCField.HasCField DuckDBV2CopyToBatchCallbackFn_Aux "unwrap" where
+
+  type CFieldType DuckDBV2CopyToBatchCallbackFn_Aux "unwrap" =
+    DuckDBV2CopyToBatchInfoHandle -> DuckDBV2ContextHandle -> BG.Ptr DuckDBV2ErrorInfoHandle -> IO ()
+
+  offset# = \_ -> \_ -> 0
+
+{-| __C declaration:__ @duckdb_v2_copy_to_batch_callback_fn@
+
+    __defined at:__ @duckdb_v2.h 6294:16@
+
+    __exported by:__ @duckdb_v2.h@
+-}
+newtype DuckDBV2CopyToBatchCallbackFn = DuckDBV2CopyToBatchCallbackFn
+  { unwrap :: BG.FunPtr DuckDBV2CopyToBatchCallbackFn_Aux
+  }
+  deriving stock (Eq, BG.Generic, Ord, Show)
+  deriving newtype
+    ( BG.HasFFIType
+    , Marshal.ReadRaw
+    , Marshal.StaticSize
+    , BG.Storable
+    , Marshal.WriteRaw
+    )
+
+instance ( ty ~ BG.FunPtr DuckDBV2CopyToBatchCallbackFn_Aux
+         ) => BG.CompatHasField.HasField "unwrap" DuckDBV2CopyToBatchCallbackFn ty where
+
+  hasField =
+    \x0 ->
+      ( \y1 -> DuckDBV2CopyToBatchCallbackFn {unwrap = y1}
+      , BG.getField @"unwrap" x0
+      )
+
+instance ( ty ~ BG.FunPtr DuckDBV2CopyToBatchCallbackFn_Aux
+         ) => BG.HasField "unwrap" (BG.Ptr DuckDBV2CopyToBatchCallbackFn) (BG.Ptr ty) where
+
+  getField = HasCField.fromPtr (BG.Proxy @"unwrap")
+
+instance HasCField.HasCField DuckDBV2CopyToBatchCallbackFn "unwrap" where
+
+  type CFieldType DuckDBV2CopyToBatchCallbackFn "unwrap" =
+    BG.FunPtr DuckDBV2CopyToBatchCallbackFn_Aux
+
+  offset# = \_ -> \_ -> 0
+
+{-| Auxiliary type used by t'DuckDBV2CopyToFlushCallbackFn'
+
+    __C declaration:__ @duckdb_v2_copy_to_flush_callback_fn@
+
+    __defined at:__ @duckdb_v2.h 6297:16@
+
+    __exported by:__ @duckdb_v2.h@
+-}
+newtype DuckDBV2CopyToFlushCallbackFn_Aux = DuckDBV2CopyToFlushCallbackFn_Aux
+  { unwrap :: DuckDBV2CopyToFlushInfoHandle -> DuckDBV2ContextHandle -> BG.Ptr DuckDBV2ErrorInfoHandle -> IO ()
+  }
+  deriving stock (BG.Generic)
+
+-- __unique:__ @toDuckDBV2CopyToFlushCallbackFn_Aux@
+foreign import ccall safe "wrapper" hs_bindgen_9e2b079ae4eaf8cd_base ::
+     (BG.Ptr BG.Void -> BG.Ptr BG.Void -> BG.Ptr BG.Void -> IO ())
+  -> IO (BG.FunPtr (BG.Ptr BG.Void -> BG.Ptr BG.Void -> BG.Ptr BG.Void -> IO ()))
+
+-- __unique:__ @toDuckDBV2CopyToFlushCallbackFn_Aux@
+hs_bindgen_9e2b079ae4eaf8cd ::
+     DuckDBV2CopyToFlushCallbackFn_Aux
+  -> IO (BG.FunPtr DuckDBV2CopyToFlushCallbackFn_Aux)
+hs_bindgen_9e2b079ae4eaf8cd =
+  \fun0 ->
+    fmap BG.castFunPtr (hs_bindgen_9e2b079ae4eaf8cd_base (\x1 ->
+                                                            \x2 ->
+                                                              \x3 ->
+                                                                BG.getField @"unwrap" fun0 (BG.fromFFIType x1) (BG.fromFFIType x2) (BG.fromFFIType x3)))
+
+-- __unique:__ @fromDuckDBV2CopyToFlushCallbackFn_Aux@
+foreign import ccall safe "dynamic" hs_bindgen_61661d7b265a1d07_base ::
+     BG.FunPtr (BG.Ptr BG.Void -> BG.Ptr BG.Void -> BG.Ptr BG.Void -> IO ())
+  -> BG.Ptr BG.Void -> BG.Ptr BG.Void -> BG.Ptr BG.Void -> IO ()
+
+-- __unique:__ @fromDuckDBV2CopyToFlushCallbackFn_Aux@
+hs_bindgen_61661d7b265a1d07 ::
+     BG.FunPtr DuckDBV2CopyToFlushCallbackFn_Aux
+  -> DuckDBV2CopyToFlushCallbackFn_Aux
+hs_bindgen_61661d7b265a1d07 =
+  \funPtr0 ->
+    DuckDBV2CopyToFlushCallbackFn_Aux (\x1 ->
+                                         \x2 ->
+                                           \x3 ->
+                                             hs_bindgen_61661d7b265a1d07_base (BG.castFunPtr funPtr0) (BG.toFFIType x1) (BG.toFFIType x2) (BG.toFFIType x3))
+
+instance BG.ToFunPtr DuckDBV2CopyToFlushCallbackFn_Aux where
+
+  toFunPtr = hs_bindgen_9e2b079ae4eaf8cd
+
+instance BG.FromFunPtr DuckDBV2CopyToFlushCallbackFn_Aux where
+
+  fromFunPtr = hs_bindgen_61661d7b265a1d07
+
+instance ( ty ~ (DuckDBV2CopyToFlushInfoHandle -> DuckDBV2ContextHandle -> BG.Ptr DuckDBV2ErrorInfoHandle -> IO ())
+         ) => BG.CompatHasField.HasField "unwrap" DuckDBV2CopyToFlushCallbackFn_Aux ty where
+
+  hasField =
+    \x0 ->
+      ( \y1 ->
+          DuckDBV2CopyToFlushCallbackFn_Aux {unwrap = y1}
+      , BG.getField @"unwrap" x0
+      )
+
+instance ( ty ~ (DuckDBV2CopyToFlushInfoHandle -> DuckDBV2ContextHandle -> BG.Ptr DuckDBV2ErrorInfoHandle -> IO ())
+         ) => BG.HasField "unwrap" (BG.Ptr DuckDBV2CopyToFlushCallbackFn_Aux) (BG.Ptr ty) where
+
+  getField = HasCField.fromPtr (BG.Proxy @"unwrap")
+
+instance HasCField.HasCField DuckDBV2CopyToFlushCallbackFn_Aux "unwrap" where
+
+  type CFieldType DuckDBV2CopyToFlushCallbackFn_Aux "unwrap" =
+    DuckDBV2CopyToFlushInfoHandle -> DuckDBV2ContextHandle -> BG.Ptr DuckDBV2ErrorInfoHandle -> IO ()
+
+  offset# = \_ -> \_ -> 0
+
+{-| __C declaration:__ @duckdb_v2_copy_to_flush_callback_fn@
+
+    __defined at:__ @duckdb_v2.h 6297:16@
+
+    __exported by:__ @duckdb_v2.h@
+-}
+newtype DuckDBV2CopyToFlushCallbackFn = DuckDBV2CopyToFlushCallbackFn
+  { unwrap :: BG.FunPtr DuckDBV2CopyToFlushCallbackFn_Aux
+  }
+  deriving stock (Eq, BG.Generic, Ord, Show)
+  deriving newtype
+    ( BG.HasFFIType
+    , Marshal.ReadRaw
+    , Marshal.StaticSize
+    , BG.Storable
+    , Marshal.WriteRaw
+    )
+
+instance ( ty ~ BG.FunPtr DuckDBV2CopyToFlushCallbackFn_Aux
+         ) => BG.CompatHasField.HasField "unwrap" DuckDBV2CopyToFlushCallbackFn ty where
+
+  hasField =
+    \x0 ->
+      ( \y1 -> DuckDBV2CopyToFlushCallbackFn {unwrap = y1}
+      , BG.getField @"unwrap" x0
+      )
+
+instance ( ty ~ BG.FunPtr DuckDBV2CopyToFlushCallbackFn_Aux
+         ) => BG.HasField "unwrap" (BG.Ptr DuckDBV2CopyToFlushCallbackFn) (BG.Ptr ty) where
+
+  getField = HasCField.fromPtr (BG.Proxy @"unwrap")
+
+instance HasCField.HasCField DuckDBV2CopyToFlushCallbackFn "unwrap" where
+
+  type CFieldType DuckDBV2CopyToFlushCallbackFn "unwrap" =
+    BG.FunPtr DuckDBV2CopyToFlushCallbackFn_Aux
+
+  offset# = \_ -> \_ -> 0
+
+{-| Auxiliary type used by t'DuckDBV2CopyToFinalizeCallbackFn'
+
+    __C declaration:__ @duckdb_v2_copy_to_finalize_callback_fn@
+
+    __defined at:__ @duckdb_v2.h 6300:16@
+
+    __exported by:__ @duckdb_v2.h@
+-}
+newtype DuckDBV2CopyToFinalizeCallbackFn_Aux = DuckDBV2CopyToFinalizeCallbackFn_Aux
+  { unwrap :: DuckDBV2CopyToFinalizeInfoHandle -> DuckDBV2ContextHandle -> BG.Ptr DuckDBV2ErrorInfoHandle -> IO ()
+  }
+  deriving stock (BG.Generic)
+
+-- __unique:__ @toDuckDBV2CopyToFinalizeCallbackFn_Aux@
+foreign import ccall safe "wrapper" hs_bindgen_95322f0b78246fa9_base ::
+     (BG.Ptr BG.Void -> BG.Ptr BG.Void -> BG.Ptr BG.Void -> IO ())
+  -> IO (BG.FunPtr (BG.Ptr BG.Void -> BG.Ptr BG.Void -> BG.Ptr BG.Void -> IO ()))
+
+-- __unique:__ @toDuckDBV2CopyToFinalizeCallbackFn_Aux@
+hs_bindgen_95322f0b78246fa9 ::
+     DuckDBV2CopyToFinalizeCallbackFn_Aux
+  -> IO (BG.FunPtr DuckDBV2CopyToFinalizeCallbackFn_Aux)
+hs_bindgen_95322f0b78246fa9 =
+  \fun0 ->
+    fmap BG.castFunPtr (hs_bindgen_95322f0b78246fa9_base (\x1 ->
+                                                            \x2 ->
+                                                              \x3 ->
+                                                                BG.getField @"unwrap" fun0 (BG.fromFFIType x1) (BG.fromFFIType x2) (BG.fromFFIType x3)))
+
+-- __unique:__ @fromDuckDBV2CopyToFinalizeCallbackFn_Aux@
+foreign import ccall safe "dynamic" hs_bindgen_8eda1f6110fa2554_base ::
+     BG.FunPtr (BG.Ptr BG.Void -> BG.Ptr BG.Void -> BG.Ptr BG.Void -> IO ())
+  -> BG.Ptr BG.Void -> BG.Ptr BG.Void -> BG.Ptr BG.Void -> IO ()
+
+-- __unique:__ @fromDuckDBV2CopyToFinalizeCallbackFn_Aux@
+hs_bindgen_8eda1f6110fa2554 ::
+     BG.FunPtr DuckDBV2CopyToFinalizeCallbackFn_Aux
+  -> DuckDBV2CopyToFinalizeCallbackFn_Aux
+hs_bindgen_8eda1f6110fa2554 =
+  \funPtr0 ->
+    DuckDBV2CopyToFinalizeCallbackFn_Aux (\x1 ->
+                                            \x2 ->
+                                              \x3 ->
+                                                hs_bindgen_8eda1f6110fa2554_base (BG.castFunPtr funPtr0) (BG.toFFIType x1) (BG.toFFIType x2) (BG.toFFIType x3))
+
+instance BG.ToFunPtr DuckDBV2CopyToFinalizeCallbackFn_Aux where
+
+  toFunPtr = hs_bindgen_95322f0b78246fa9
+
+instance BG.FromFunPtr DuckDBV2CopyToFinalizeCallbackFn_Aux where
+
+  fromFunPtr = hs_bindgen_8eda1f6110fa2554
+
+instance ( ty ~ (DuckDBV2CopyToFinalizeInfoHandle -> DuckDBV2ContextHandle -> BG.Ptr DuckDBV2ErrorInfoHandle -> IO ())
+         ) => BG.CompatHasField.HasField "unwrap" DuckDBV2CopyToFinalizeCallbackFn_Aux ty where
+
+  hasField =
+    \x0 ->
+      ( \y1 ->
+          DuckDBV2CopyToFinalizeCallbackFn_Aux {unwrap = y1}
+      , BG.getField @"unwrap" x0
+      )
+
+instance ( ty ~ (DuckDBV2CopyToFinalizeInfoHandle -> DuckDBV2ContextHandle -> BG.Ptr DuckDBV2ErrorInfoHandle -> IO ())
+         ) => BG.HasField "unwrap" (BG.Ptr DuckDBV2CopyToFinalizeCallbackFn_Aux) (BG.Ptr ty) where
+
+  getField = HasCField.fromPtr (BG.Proxy @"unwrap")
+
+instance HasCField.HasCField DuckDBV2CopyToFinalizeCallbackFn_Aux "unwrap" where
+
+  type CFieldType DuckDBV2CopyToFinalizeCallbackFn_Aux "unwrap" =
+    DuckDBV2CopyToFinalizeInfoHandle -> DuckDBV2ContextHandle -> BG.Ptr DuckDBV2ErrorInfoHandle -> IO ()
+
+  offset# = \_ -> \_ -> 0
+
+{-| __C declaration:__ @duckdb_v2_copy_to_finalize_callback_fn@
+
+    __defined at:__ @duckdb_v2.h 6300:16@
+
+    __exported by:__ @duckdb_v2.h@
+-}
+newtype DuckDBV2CopyToFinalizeCallbackFn = DuckDBV2CopyToFinalizeCallbackFn
+  { unwrap :: BG.FunPtr DuckDBV2CopyToFinalizeCallbackFn_Aux
+  }
+  deriving stock (Eq, BG.Generic, Ord, Show)
+  deriving newtype
+    ( BG.HasFFIType
+    , Marshal.ReadRaw
+    , Marshal.StaticSize
+    , BG.Storable
+    , Marshal.WriteRaw
+    )
+
+instance ( ty ~ BG.FunPtr DuckDBV2CopyToFinalizeCallbackFn_Aux
+         ) => BG.CompatHasField.HasField "unwrap" DuckDBV2CopyToFinalizeCallbackFn ty where
+
+  hasField =
+    \x0 ->
+      ( \y1 ->
+          DuckDBV2CopyToFinalizeCallbackFn {unwrap = y1}
+      , BG.getField @"unwrap" x0
+      )
+
+instance ( ty ~ BG.FunPtr DuckDBV2CopyToFinalizeCallbackFn_Aux
+         ) => BG.HasField "unwrap" (BG.Ptr DuckDBV2CopyToFinalizeCallbackFn) (BG.Ptr ty) where
+
+  getField = HasCField.fromPtr (BG.Proxy @"unwrap")
+
+instance HasCField.HasCField DuckDBV2CopyToFinalizeCallbackFn "unwrap" where
+
+  type CFieldType DuckDBV2CopyToFinalizeCallbackFn "unwrap" =
+    BG.FunPtr DuckDBV2CopyToFinalizeCallbackFn_Aux
+
+  offset# = \_ -> \_ -> 0
+
+{-| Auxiliary type used by t'DuckDBV2CopyToStatisticsCallbackFn'
+
+    __C declaration:__ @duckdb_v2_copy_to_statistics_callback_fn@
+
+    __defined at:__ @duckdb_v2.h 6304:16@
+
+    __exported by:__ @duckdb_v2.h@
+-}
+newtype DuckDBV2CopyToStatisticsCallbackFn_Aux = DuckDBV2CopyToStatisticsCallbackFn_Aux
+  { unwrap :: DuckDBV2CopyToStatisticsInfoHandle -> DuckDBV2ContextHandle -> BG.Ptr DuckDBV2ErrorInfoHandle -> IO ()
+  }
+  deriving stock (BG.Generic)
+
+-- __unique:__ @toDuckDBV2CopyToStatisticsCallbackFn_Aux@
+foreign import ccall safe "wrapper" hs_bindgen_fde201b2dab8358d_base ::
+     (BG.Ptr BG.Void -> BG.Ptr BG.Void -> BG.Ptr BG.Void -> IO ())
+  -> IO (BG.FunPtr (BG.Ptr BG.Void -> BG.Ptr BG.Void -> BG.Ptr BG.Void -> IO ()))
+
+-- __unique:__ @toDuckDBV2CopyToStatisticsCallbackFn_Aux@
+hs_bindgen_fde201b2dab8358d ::
+     DuckDBV2CopyToStatisticsCallbackFn_Aux
+  -> IO (BG.FunPtr DuckDBV2CopyToStatisticsCallbackFn_Aux)
+hs_bindgen_fde201b2dab8358d =
+  \fun0 ->
+    fmap BG.castFunPtr (hs_bindgen_fde201b2dab8358d_base (\x1 ->
+                                                            \x2 ->
+                                                              \x3 ->
+                                                                BG.getField @"unwrap" fun0 (BG.fromFFIType x1) (BG.fromFFIType x2) (BG.fromFFIType x3)))
+
+-- __unique:__ @fromDuckDBV2CopyToStatisticsCallbackFn_Aux@
+foreign import ccall safe "dynamic" hs_bindgen_c073fd317c9c59a3_base ::
+     BG.FunPtr (BG.Ptr BG.Void -> BG.Ptr BG.Void -> BG.Ptr BG.Void -> IO ())
+  -> BG.Ptr BG.Void -> BG.Ptr BG.Void -> BG.Ptr BG.Void -> IO ()
+
+-- __unique:__ @fromDuckDBV2CopyToStatisticsCallbackFn_Aux@
+hs_bindgen_c073fd317c9c59a3 ::
+     BG.FunPtr DuckDBV2CopyToStatisticsCallbackFn_Aux
+  -> DuckDBV2CopyToStatisticsCallbackFn_Aux
+hs_bindgen_c073fd317c9c59a3 =
+  \funPtr0 ->
+    DuckDBV2CopyToStatisticsCallbackFn_Aux (\x1 ->
+                                              \x2 ->
+                                                \x3 ->
+                                                  hs_bindgen_c073fd317c9c59a3_base (BG.castFunPtr funPtr0) (BG.toFFIType x1) (BG.toFFIType x2) (BG.toFFIType x3))
+
+instance BG.ToFunPtr DuckDBV2CopyToStatisticsCallbackFn_Aux where
+
+  toFunPtr = hs_bindgen_fde201b2dab8358d
+
+instance BG.FromFunPtr DuckDBV2CopyToStatisticsCallbackFn_Aux where
+
+  fromFunPtr = hs_bindgen_c073fd317c9c59a3
+
+instance ( ty ~ (DuckDBV2CopyToStatisticsInfoHandle -> DuckDBV2ContextHandle -> BG.Ptr DuckDBV2ErrorInfoHandle -> IO ())
+         ) => BG.CompatHasField.HasField "unwrap" DuckDBV2CopyToStatisticsCallbackFn_Aux ty where
+
+  hasField =
+    \x0 ->
+      ( \y1 ->
+          DuckDBV2CopyToStatisticsCallbackFn_Aux {unwrap = y1}
+      , BG.getField @"unwrap" x0
+      )
+
+instance ( ty ~ (DuckDBV2CopyToStatisticsInfoHandle -> DuckDBV2ContextHandle -> BG.Ptr DuckDBV2ErrorInfoHandle -> IO ())
+         ) => BG.HasField "unwrap" (BG.Ptr DuckDBV2CopyToStatisticsCallbackFn_Aux) (BG.Ptr ty) where
+
+  getField = HasCField.fromPtr (BG.Proxy @"unwrap")
+
+instance HasCField.HasCField DuckDBV2CopyToStatisticsCallbackFn_Aux "unwrap" where
+
+  type CFieldType DuckDBV2CopyToStatisticsCallbackFn_Aux "unwrap" =
+    DuckDBV2CopyToStatisticsInfoHandle -> DuckDBV2ContextHandle -> BG.Ptr DuckDBV2ErrorInfoHandle -> IO ()
+
+  offset# = \_ -> \_ -> 0
+
+{-| __C declaration:__ @duckdb_v2_copy_to_statistics_callback_fn@
+
+    __defined at:__ @duckdb_v2.h 6304:16@
+
+    __exported by:__ @duckdb_v2.h@
+-}
+newtype DuckDBV2CopyToStatisticsCallbackFn = DuckDBV2CopyToStatisticsCallbackFn
+  { unwrap :: BG.FunPtr DuckDBV2CopyToStatisticsCallbackFn_Aux
+  }
+  deriving stock (Eq, BG.Generic, Ord, Show)
+  deriving newtype
+    ( BG.HasFFIType
+    , Marshal.ReadRaw
+    , Marshal.StaticSize
+    , BG.Storable
+    , Marshal.WriteRaw
+    )
+
+instance ( ty ~ BG.FunPtr DuckDBV2CopyToStatisticsCallbackFn_Aux
+         ) => BG.CompatHasField.HasField "unwrap" DuckDBV2CopyToStatisticsCallbackFn ty where
+
+  hasField =
+    \x0 ->
+      ( \y1 ->
+          DuckDBV2CopyToStatisticsCallbackFn {unwrap = y1}
+      , BG.getField @"unwrap" x0
+      )
+
+instance ( ty ~ BG.FunPtr DuckDBV2CopyToStatisticsCallbackFn_Aux
+         ) => BG.HasField "unwrap" (BG.Ptr DuckDBV2CopyToStatisticsCallbackFn) (BG.Ptr ty) where
+
+  getField = HasCField.fromPtr (BG.Proxy @"unwrap")
+
+instance HasCField.HasCField DuckDBV2CopyToStatisticsCallbackFn "unwrap" where
+
+  type CFieldType DuckDBV2CopyToStatisticsCallbackFn "unwrap" =
+    BG.FunPtr DuckDBV2CopyToStatisticsCallbackFn_Aux
+
+  offset# = \_ -> \_ -> 0
+
+{-| Auxiliary type used by t'DuckDBV2CopyFromBindCallbackFn'
+
+    __C declaration:__ @duckdb_v2_copy_from_bind_callback_fn@
+
+    __defined at:__ @duckdb_v2.h 6308:16@
+
+    __exported by:__ @duckdb_v2.h@
+-}
+newtype DuckDBV2CopyFromBindCallbackFn_Aux = DuckDBV2CopyFromBindCallbackFn_Aux
+  { unwrap :: DuckDBV2CopyFromBindInfoHandle -> DuckDBV2ContextHandle -> BG.Ptr DuckDBV2ErrorInfoHandle -> IO ()
+  }
+  deriving stock (BG.Generic)
+
+-- __unique:__ @toDuckDBV2CopyFromBindCallbackFn_Aux@
+foreign import ccall safe "wrapper" hs_bindgen_bc89d19b4151e2eb_base ::
+     (BG.Ptr BG.Void -> BG.Ptr BG.Void -> BG.Ptr BG.Void -> IO ())
+  -> IO (BG.FunPtr (BG.Ptr BG.Void -> BG.Ptr BG.Void -> BG.Ptr BG.Void -> IO ()))
+
+-- __unique:__ @toDuckDBV2CopyFromBindCallbackFn_Aux@
+hs_bindgen_bc89d19b4151e2eb ::
+     DuckDBV2CopyFromBindCallbackFn_Aux
+  -> IO (BG.FunPtr DuckDBV2CopyFromBindCallbackFn_Aux)
+hs_bindgen_bc89d19b4151e2eb =
+  \fun0 ->
+    fmap BG.castFunPtr (hs_bindgen_bc89d19b4151e2eb_base (\x1 ->
+                                                            \x2 ->
+                                                              \x3 ->
+                                                                BG.getField @"unwrap" fun0 (BG.fromFFIType x1) (BG.fromFFIType x2) (BG.fromFFIType x3)))
+
+-- __unique:__ @fromDuckDBV2CopyFromBindCallbackFn_Aux@
+foreign import ccall safe "dynamic" hs_bindgen_217a11bec38d0bb0_base ::
+     BG.FunPtr (BG.Ptr BG.Void -> BG.Ptr BG.Void -> BG.Ptr BG.Void -> IO ())
+  -> BG.Ptr BG.Void -> BG.Ptr BG.Void -> BG.Ptr BG.Void -> IO ()
+
+-- __unique:__ @fromDuckDBV2CopyFromBindCallbackFn_Aux@
+hs_bindgen_217a11bec38d0bb0 ::
+     BG.FunPtr DuckDBV2CopyFromBindCallbackFn_Aux
+  -> DuckDBV2CopyFromBindCallbackFn_Aux
+hs_bindgen_217a11bec38d0bb0 =
+  \funPtr0 ->
+    DuckDBV2CopyFromBindCallbackFn_Aux (\x1 ->
+                                          \x2 ->
+                                            \x3 ->
+                                              hs_bindgen_217a11bec38d0bb0_base (BG.castFunPtr funPtr0) (BG.toFFIType x1) (BG.toFFIType x2) (BG.toFFIType x3))
+
+instance BG.ToFunPtr DuckDBV2CopyFromBindCallbackFn_Aux where
+
+  toFunPtr = hs_bindgen_bc89d19b4151e2eb
+
+instance BG.FromFunPtr DuckDBV2CopyFromBindCallbackFn_Aux where
+
+  fromFunPtr = hs_bindgen_217a11bec38d0bb0
+
+instance ( ty ~ (DuckDBV2CopyFromBindInfoHandle -> DuckDBV2ContextHandle -> BG.Ptr DuckDBV2ErrorInfoHandle -> IO ())
+         ) => BG.CompatHasField.HasField "unwrap" DuckDBV2CopyFromBindCallbackFn_Aux ty where
+
+  hasField =
+    \x0 ->
+      ( \y1 ->
+          DuckDBV2CopyFromBindCallbackFn_Aux {unwrap = y1}
+      , BG.getField @"unwrap" x0
+      )
+
+instance ( ty ~ (DuckDBV2CopyFromBindInfoHandle -> DuckDBV2ContextHandle -> BG.Ptr DuckDBV2ErrorInfoHandle -> IO ())
+         ) => BG.HasField "unwrap" (BG.Ptr DuckDBV2CopyFromBindCallbackFn_Aux) (BG.Ptr ty) where
+
+  getField = HasCField.fromPtr (BG.Proxy @"unwrap")
+
+instance HasCField.HasCField DuckDBV2CopyFromBindCallbackFn_Aux "unwrap" where
+
+  type CFieldType DuckDBV2CopyFromBindCallbackFn_Aux "unwrap" =
+    DuckDBV2CopyFromBindInfoHandle -> DuckDBV2ContextHandle -> BG.Ptr DuckDBV2ErrorInfoHandle -> IO ()
+
+  offset# = \_ -> \_ -> 0
+
+{-| __C declaration:__ @duckdb_v2_copy_from_bind_callback_fn@
+
+    __defined at:__ @duckdb_v2.h 6308:16@
+
+    __exported by:__ @duckdb_v2.h@
+-}
+newtype DuckDBV2CopyFromBindCallbackFn = DuckDBV2CopyFromBindCallbackFn
+  { unwrap :: BG.FunPtr DuckDBV2CopyFromBindCallbackFn_Aux
+  }
+  deriving stock (Eq, BG.Generic, Ord, Show)
+  deriving newtype
+    ( BG.HasFFIType
+    , Marshal.ReadRaw
+    , Marshal.StaticSize
+    , BG.Storable
+    , Marshal.WriteRaw
+    )
+
+instance ( ty ~ BG.FunPtr DuckDBV2CopyFromBindCallbackFn_Aux
+         ) => BG.CompatHasField.HasField "unwrap" DuckDBV2CopyFromBindCallbackFn ty where
+
+  hasField =
+    \x0 ->
+      ( \y1 -> DuckDBV2CopyFromBindCallbackFn {unwrap = y1}
+      , BG.getField @"unwrap" x0
+      )
+
+instance ( ty ~ BG.FunPtr DuckDBV2CopyFromBindCallbackFn_Aux
+         ) => BG.HasField "unwrap" (BG.Ptr DuckDBV2CopyFromBindCallbackFn) (BG.Ptr ty) where
+
+  getField = HasCField.fromPtr (BG.Proxy @"unwrap")
+
+instance HasCField.HasCField DuckDBV2CopyFromBindCallbackFn "unwrap" where
+
+  type CFieldType DuckDBV2CopyFromBindCallbackFn "unwrap" =
+    BG.FunPtr DuckDBV2CopyFromBindCallbackFn_Aux
+
+  offset# = \_ -> \_ -> 0
+
+{-| Auxiliary type used by t'DuckDBV2CopyFromInitGlobalCallbackFn'
+
+    __C declaration:__ @duckdb_v2_copy_from_init_global_callback_fn@
+
+    __defined at:__ @duckdb_v2.h 6312:16@
+
+    __exported by:__ @duckdb_v2.h@
+-}
+newtype DuckDBV2CopyFromInitGlobalCallbackFn_Aux = DuckDBV2CopyFromInitGlobalCallbackFn_Aux
+  { unwrap :: DuckDBV2CopyFromInitGlobalInfoHandle -> DuckDBV2ContextHandle -> BG.Ptr DuckDBV2ErrorInfoHandle -> IO ()
+  }
+  deriving stock (BG.Generic)
+
+-- __unique:__ @toDuckDBV2CopyFromInitGlobalCallbackFn_Aux@
+foreign import ccall safe "wrapper" hs_bindgen_a141bd4cc5a84def_base ::
+     (BG.Ptr BG.Void -> BG.Ptr BG.Void -> BG.Ptr BG.Void -> IO ())
+  -> IO (BG.FunPtr (BG.Ptr BG.Void -> BG.Ptr BG.Void -> BG.Ptr BG.Void -> IO ()))
+
+-- __unique:__ @toDuckDBV2CopyFromInitGlobalCallbackFn_Aux@
+hs_bindgen_a141bd4cc5a84def ::
+     DuckDBV2CopyFromInitGlobalCallbackFn_Aux
+  -> IO (BG.FunPtr DuckDBV2CopyFromInitGlobalCallbackFn_Aux)
+hs_bindgen_a141bd4cc5a84def =
+  \fun0 ->
+    fmap BG.castFunPtr (hs_bindgen_a141bd4cc5a84def_base (\x1 ->
+                                                            \x2 ->
+                                                              \x3 ->
+                                                                BG.getField @"unwrap" fun0 (BG.fromFFIType x1) (BG.fromFFIType x2) (BG.fromFFIType x3)))
+
+-- __unique:__ @fromDuckDBV2CopyFromInitGlobalCallbackFn_Aux@
+foreign import ccall safe "dynamic" hs_bindgen_c218f38631c47665_base ::
+     BG.FunPtr (BG.Ptr BG.Void -> BG.Ptr BG.Void -> BG.Ptr BG.Void -> IO ())
+  -> BG.Ptr BG.Void -> BG.Ptr BG.Void -> BG.Ptr BG.Void -> IO ()
+
+-- __unique:__ @fromDuckDBV2CopyFromInitGlobalCallbackFn_Aux@
+hs_bindgen_c218f38631c47665 ::
+     BG.FunPtr DuckDBV2CopyFromInitGlobalCallbackFn_Aux
+  -> DuckDBV2CopyFromInitGlobalCallbackFn_Aux
+hs_bindgen_c218f38631c47665 =
+  \funPtr0 ->
+    DuckDBV2CopyFromInitGlobalCallbackFn_Aux (\x1 ->
+                                                \x2 ->
+                                                  \x3 ->
+                                                    hs_bindgen_c218f38631c47665_base (BG.castFunPtr funPtr0) (BG.toFFIType x1) (BG.toFFIType x2) (BG.toFFIType x3))
+
+instance BG.ToFunPtr DuckDBV2CopyFromInitGlobalCallbackFn_Aux where
+
+  toFunPtr = hs_bindgen_a141bd4cc5a84def
+
+instance BG.FromFunPtr DuckDBV2CopyFromInitGlobalCallbackFn_Aux where
+
+  fromFunPtr = hs_bindgen_c218f38631c47665
+
+instance ( ty ~ (DuckDBV2CopyFromInitGlobalInfoHandle -> DuckDBV2ContextHandle -> BG.Ptr DuckDBV2ErrorInfoHandle -> IO ())
+         ) => BG.CompatHasField.HasField "unwrap" DuckDBV2CopyFromInitGlobalCallbackFn_Aux ty where
+
+  hasField =
+    \x0 ->
+      ( \y1 ->
+          DuckDBV2CopyFromInitGlobalCallbackFn_Aux {unwrap = y1}
+      , BG.getField @"unwrap" x0
+      )
+
+instance ( ty ~ (DuckDBV2CopyFromInitGlobalInfoHandle -> DuckDBV2ContextHandle -> BG.Ptr DuckDBV2ErrorInfoHandle -> IO ())
+         ) => BG.HasField "unwrap" (BG.Ptr DuckDBV2CopyFromInitGlobalCallbackFn_Aux) (BG.Ptr ty) where
+
+  getField = HasCField.fromPtr (BG.Proxy @"unwrap")
+
+instance HasCField.HasCField DuckDBV2CopyFromInitGlobalCallbackFn_Aux "unwrap" where
+
+  type CFieldType DuckDBV2CopyFromInitGlobalCallbackFn_Aux "unwrap" =
+    DuckDBV2CopyFromInitGlobalInfoHandle -> DuckDBV2ContextHandle -> BG.Ptr DuckDBV2ErrorInfoHandle -> IO ()
+
+  offset# = \_ -> \_ -> 0
+
+{-| __C declaration:__ @duckdb_v2_copy_from_init_global_callback_fn@
+
+    __defined at:__ @duckdb_v2.h 6312:16@
+
+    __exported by:__ @duckdb_v2.h@
+-}
+newtype DuckDBV2CopyFromInitGlobalCallbackFn = DuckDBV2CopyFromInitGlobalCallbackFn
+  { unwrap :: BG.FunPtr DuckDBV2CopyFromInitGlobalCallbackFn_Aux
+  }
+  deriving stock (Eq, BG.Generic, Ord, Show)
+  deriving newtype
+    ( BG.HasFFIType
+    , Marshal.ReadRaw
+    , Marshal.StaticSize
+    , BG.Storable
+    , Marshal.WriteRaw
+    )
+
+instance ( ty ~ BG.FunPtr DuckDBV2CopyFromInitGlobalCallbackFn_Aux
+         ) => BG.CompatHasField.HasField "unwrap" DuckDBV2CopyFromInitGlobalCallbackFn ty where
+
+  hasField =
+    \x0 ->
+      ( \y1 ->
+          DuckDBV2CopyFromInitGlobalCallbackFn {unwrap = y1}
+      , BG.getField @"unwrap" x0
+      )
+
+instance ( ty ~ BG.FunPtr DuckDBV2CopyFromInitGlobalCallbackFn_Aux
+         ) => BG.HasField "unwrap" (BG.Ptr DuckDBV2CopyFromInitGlobalCallbackFn) (BG.Ptr ty) where
+
+  getField = HasCField.fromPtr (BG.Proxy @"unwrap")
+
+instance HasCField.HasCField DuckDBV2CopyFromInitGlobalCallbackFn "unwrap" where
+
+  type CFieldType DuckDBV2CopyFromInitGlobalCallbackFn "unwrap" =
+    BG.FunPtr DuckDBV2CopyFromInitGlobalCallbackFn_Aux
+
+  offset# = \_ -> \_ -> 0
+
+{-| Auxiliary type used by t'DuckDBV2CopyFromInitLocalCallbackFn'
+
+    __C declaration:__ @duckdb_v2_copy_from_init_local_callback_fn@
+
+    __defined at:__ @duckdb_v2.h 6316:16@
+
+    __exported by:__ @duckdb_v2.h@
+-}
+newtype DuckDBV2CopyFromInitLocalCallbackFn_Aux = DuckDBV2CopyFromInitLocalCallbackFn_Aux
+  { unwrap :: DuckDBV2CopyFromInitLocalInfoHandle -> DuckDBV2ContextHandle -> BG.Ptr DuckDBV2ErrorInfoHandle -> IO ()
+  }
+  deriving stock (BG.Generic)
+
+-- __unique:__ @toDuckDBV2CopyFromInitLocalCallbackFn_Aux@
+foreign import ccall safe "wrapper" hs_bindgen_c994ee7641468a3e_base ::
+     (BG.Ptr BG.Void -> BG.Ptr BG.Void -> BG.Ptr BG.Void -> IO ())
+  -> IO (BG.FunPtr (BG.Ptr BG.Void -> BG.Ptr BG.Void -> BG.Ptr BG.Void -> IO ()))
+
+-- __unique:__ @toDuckDBV2CopyFromInitLocalCallbackFn_Aux@
+hs_bindgen_c994ee7641468a3e ::
+     DuckDBV2CopyFromInitLocalCallbackFn_Aux
+  -> IO (BG.FunPtr DuckDBV2CopyFromInitLocalCallbackFn_Aux)
+hs_bindgen_c994ee7641468a3e =
+  \fun0 ->
+    fmap BG.castFunPtr (hs_bindgen_c994ee7641468a3e_base (\x1 ->
+                                                            \x2 ->
+                                                              \x3 ->
+                                                                BG.getField @"unwrap" fun0 (BG.fromFFIType x1) (BG.fromFFIType x2) (BG.fromFFIType x3)))
+
+-- __unique:__ @fromDuckDBV2CopyFromInitLocalCallbackFn_Aux@
+foreign import ccall safe "dynamic" hs_bindgen_b21fef5c1a8591ca_base ::
+     BG.FunPtr (BG.Ptr BG.Void -> BG.Ptr BG.Void -> BG.Ptr BG.Void -> IO ())
+  -> BG.Ptr BG.Void -> BG.Ptr BG.Void -> BG.Ptr BG.Void -> IO ()
+
+-- __unique:__ @fromDuckDBV2CopyFromInitLocalCallbackFn_Aux@
+hs_bindgen_b21fef5c1a8591ca ::
+     BG.FunPtr DuckDBV2CopyFromInitLocalCallbackFn_Aux
+  -> DuckDBV2CopyFromInitLocalCallbackFn_Aux
+hs_bindgen_b21fef5c1a8591ca =
+  \funPtr0 ->
+    DuckDBV2CopyFromInitLocalCallbackFn_Aux (\x1 ->
+                                               \x2 ->
+                                                 \x3 ->
+                                                   hs_bindgen_b21fef5c1a8591ca_base (BG.castFunPtr funPtr0) (BG.toFFIType x1) (BG.toFFIType x2) (BG.toFFIType x3))
+
+instance BG.ToFunPtr DuckDBV2CopyFromInitLocalCallbackFn_Aux where
+
+  toFunPtr = hs_bindgen_c994ee7641468a3e
+
+instance BG.FromFunPtr DuckDBV2CopyFromInitLocalCallbackFn_Aux where
+
+  fromFunPtr = hs_bindgen_b21fef5c1a8591ca
+
+instance ( ty ~ (DuckDBV2CopyFromInitLocalInfoHandle -> DuckDBV2ContextHandle -> BG.Ptr DuckDBV2ErrorInfoHandle -> IO ())
+         ) => BG.CompatHasField.HasField "unwrap" DuckDBV2CopyFromInitLocalCallbackFn_Aux ty where
+
+  hasField =
+    \x0 ->
+      ( \y1 ->
+          DuckDBV2CopyFromInitLocalCallbackFn_Aux {unwrap = y1}
+      , BG.getField @"unwrap" x0
+      )
+
+instance ( ty ~ (DuckDBV2CopyFromInitLocalInfoHandle -> DuckDBV2ContextHandle -> BG.Ptr DuckDBV2ErrorInfoHandle -> IO ())
+         ) => BG.HasField "unwrap" (BG.Ptr DuckDBV2CopyFromInitLocalCallbackFn_Aux) (BG.Ptr ty) where
+
+  getField = HasCField.fromPtr (BG.Proxy @"unwrap")
+
+instance HasCField.HasCField DuckDBV2CopyFromInitLocalCallbackFn_Aux "unwrap" where
+
+  type CFieldType DuckDBV2CopyFromInitLocalCallbackFn_Aux "unwrap" =
+    DuckDBV2CopyFromInitLocalInfoHandle -> DuckDBV2ContextHandle -> BG.Ptr DuckDBV2ErrorInfoHandle -> IO ()
+
+  offset# = \_ -> \_ -> 0
+
+{-| __C declaration:__ @duckdb_v2_copy_from_init_local_callback_fn@
+
+    __defined at:__ @duckdb_v2.h 6316:16@
+
+    __exported by:__ @duckdb_v2.h@
+-}
+newtype DuckDBV2CopyFromInitLocalCallbackFn = DuckDBV2CopyFromInitLocalCallbackFn
+  { unwrap :: BG.FunPtr DuckDBV2CopyFromInitLocalCallbackFn_Aux
+  }
+  deriving stock (Eq, BG.Generic, Ord, Show)
+  deriving newtype
+    ( BG.HasFFIType
+    , Marshal.ReadRaw
+    , Marshal.StaticSize
+    , BG.Storable
+    , Marshal.WriteRaw
+    )
+
+instance ( ty ~ BG.FunPtr DuckDBV2CopyFromInitLocalCallbackFn_Aux
+         ) => BG.CompatHasField.HasField "unwrap" DuckDBV2CopyFromInitLocalCallbackFn ty where
+
+  hasField =
+    \x0 ->
+      ( \y1 ->
+          DuckDBV2CopyFromInitLocalCallbackFn {unwrap = y1}
+      , BG.getField @"unwrap" x0
+      )
+
+instance ( ty ~ BG.FunPtr DuckDBV2CopyFromInitLocalCallbackFn_Aux
+         ) => BG.HasField "unwrap" (BG.Ptr DuckDBV2CopyFromInitLocalCallbackFn) (BG.Ptr ty) where
+
+  getField = HasCField.fromPtr (BG.Proxy @"unwrap")
+
+instance HasCField.HasCField DuckDBV2CopyFromInitLocalCallbackFn "unwrap" where
+
+  type CFieldType DuckDBV2CopyFromInitLocalCallbackFn "unwrap" =
+    BG.FunPtr DuckDBV2CopyFromInitLocalCallbackFn_Aux
+
+  offset# = \_ -> \_ -> 0
+
+{-| Auxiliary type used by t'DuckDBV2CopyFromExecCallbackFn'
+
+    __C declaration:__ @duckdb_v2_copy_from_exec_callback_fn@
+
+    __defined at:__ @duckdb_v2.h 6320:16@
+
+    __exported by:__ @duckdb_v2.h@
+-}
+newtype DuckDBV2CopyFromExecCallbackFn_Aux = DuckDBV2CopyFromExecCallbackFn_Aux
+  { unwrap :: DuckDBV2CopyFromExecInfoHandle -> DuckDBV2ContextHandle -> BG.Ptr DuckDBV2ErrorInfoHandle -> IO ()
+  }
+  deriving stock (BG.Generic)
+
+-- __unique:__ @toDuckDBV2CopyFromExecCallbackFn_Aux@
+foreign import ccall safe "wrapper" hs_bindgen_c1d939101cec6966_base ::
+     (BG.Ptr BG.Void -> BG.Ptr BG.Void -> BG.Ptr BG.Void -> IO ())
+  -> IO (BG.FunPtr (BG.Ptr BG.Void -> BG.Ptr BG.Void -> BG.Ptr BG.Void -> IO ()))
+
+-- __unique:__ @toDuckDBV2CopyFromExecCallbackFn_Aux@
+hs_bindgen_c1d939101cec6966 ::
+     DuckDBV2CopyFromExecCallbackFn_Aux
+  -> IO (BG.FunPtr DuckDBV2CopyFromExecCallbackFn_Aux)
+hs_bindgen_c1d939101cec6966 =
+  \fun0 ->
+    fmap BG.castFunPtr (hs_bindgen_c1d939101cec6966_base (\x1 ->
+                                                            \x2 ->
+                                                              \x3 ->
+                                                                BG.getField @"unwrap" fun0 (BG.fromFFIType x1) (BG.fromFFIType x2) (BG.fromFFIType x3)))
+
+-- __unique:__ @fromDuckDBV2CopyFromExecCallbackFn_Aux@
+foreign import ccall safe "dynamic" hs_bindgen_b336b2f583f27f32_base ::
+     BG.FunPtr (BG.Ptr BG.Void -> BG.Ptr BG.Void -> BG.Ptr BG.Void -> IO ())
+  -> BG.Ptr BG.Void -> BG.Ptr BG.Void -> BG.Ptr BG.Void -> IO ()
+
+-- __unique:__ @fromDuckDBV2CopyFromExecCallbackFn_Aux@
+hs_bindgen_b336b2f583f27f32 ::
+     BG.FunPtr DuckDBV2CopyFromExecCallbackFn_Aux
+  -> DuckDBV2CopyFromExecCallbackFn_Aux
+hs_bindgen_b336b2f583f27f32 =
+  \funPtr0 ->
+    DuckDBV2CopyFromExecCallbackFn_Aux (\x1 ->
+                                          \x2 ->
+                                            \x3 ->
+                                              hs_bindgen_b336b2f583f27f32_base (BG.castFunPtr funPtr0) (BG.toFFIType x1) (BG.toFFIType x2) (BG.toFFIType x3))
+
+instance BG.ToFunPtr DuckDBV2CopyFromExecCallbackFn_Aux where
+
+  toFunPtr = hs_bindgen_c1d939101cec6966
+
+instance BG.FromFunPtr DuckDBV2CopyFromExecCallbackFn_Aux where
+
+  fromFunPtr = hs_bindgen_b336b2f583f27f32
+
+instance ( ty ~ (DuckDBV2CopyFromExecInfoHandle -> DuckDBV2ContextHandle -> BG.Ptr DuckDBV2ErrorInfoHandle -> IO ())
+         ) => BG.CompatHasField.HasField "unwrap" DuckDBV2CopyFromExecCallbackFn_Aux ty where
+
+  hasField =
+    \x0 ->
+      ( \y1 ->
+          DuckDBV2CopyFromExecCallbackFn_Aux {unwrap = y1}
+      , BG.getField @"unwrap" x0
+      )
+
+instance ( ty ~ (DuckDBV2CopyFromExecInfoHandle -> DuckDBV2ContextHandle -> BG.Ptr DuckDBV2ErrorInfoHandle -> IO ())
+         ) => BG.HasField "unwrap" (BG.Ptr DuckDBV2CopyFromExecCallbackFn_Aux) (BG.Ptr ty) where
+
+  getField = HasCField.fromPtr (BG.Proxy @"unwrap")
+
+instance HasCField.HasCField DuckDBV2CopyFromExecCallbackFn_Aux "unwrap" where
+
+  type CFieldType DuckDBV2CopyFromExecCallbackFn_Aux "unwrap" =
+    DuckDBV2CopyFromExecInfoHandle -> DuckDBV2ContextHandle -> BG.Ptr DuckDBV2ErrorInfoHandle -> IO ()
+
+  offset# = \_ -> \_ -> 0
+
+{-| __C declaration:__ @duckdb_v2_copy_from_exec_callback_fn@
+
+    __defined at:__ @duckdb_v2.h 6320:16@
+
+    __exported by:__ @duckdb_v2.h@
+-}
+newtype DuckDBV2CopyFromExecCallbackFn = DuckDBV2CopyFromExecCallbackFn
+  { unwrap :: BG.FunPtr DuckDBV2CopyFromExecCallbackFn_Aux
+  }
+  deriving stock (Eq, BG.Generic, Ord, Show)
+  deriving newtype
+    ( BG.HasFFIType
+    , Marshal.ReadRaw
+    , Marshal.StaticSize
+    , BG.Storable
+    , Marshal.WriteRaw
+    )
+
+instance ( ty ~ BG.FunPtr DuckDBV2CopyFromExecCallbackFn_Aux
+         ) => BG.CompatHasField.HasField "unwrap" DuckDBV2CopyFromExecCallbackFn ty where
+
+  hasField =
+    \x0 ->
+      ( \y1 -> DuckDBV2CopyFromExecCallbackFn {unwrap = y1}
+      , BG.getField @"unwrap" x0
+      )
+
+instance ( ty ~ BG.FunPtr DuckDBV2CopyFromExecCallbackFn_Aux
+         ) => BG.HasField "unwrap" (BG.Ptr DuckDBV2CopyFromExecCallbackFn) (BG.Ptr ty) where
+
+  getField = HasCField.fromPtr (BG.Proxy @"unwrap")
+
+instance HasCField.HasCField DuckDBV2CopyFromExecCallbackFn "unwrap" where
+
+  type CFieldType DuckDBV2CopyFromExecCallbackFn "unwrap" =
+    BG.FunPtr DuckDBV2CopyFromExecCallbackFn_Aux
+
+  offset# = \_ -> \_ -> 0
+
+{-| Auxiliary type used by t'DuckDBV2CopyFromProgressCallbackFn'
+
+    __C declaration:__ @duckdb_v2_copy_from_progress_callback_fn@
+
+    __defined at:__ @duckdb_v2.h 6324:16@
+
+    __exported by:__ @duckdb_v2.h@
+-}
+newtype DuckDBV2CopyFromProgressCallbackFn_Aux = DuckDBV2CopyFromProgressCallbackFn_Aux
+  { unwrap :: DuckDBV2CopyFromProgressInfoHandle -> DuckDBV2ContextHandle -> BG.Ptr DuckDBV2ErrorInfoHandle -> IO ()
+  }
+  deriving stock (BG.Generic)
+
+-- __unique:__ @toDuckDBV2CopyFromProgressCallbackFn_Aux@
+foreign import ccall safe "wrapper" hs_bindgen_af6d2bf56fec3f38_base ::
+     (BG.Ptr BG.Void -> BG.Ptr BG.Void -> BG.Ptr BG.Void -> IO ())
+  -> IO (BG.FunPtr (BG.Ptr BG.Void -> BG.Ptr BG.Void -> BG.Ptr BG.Void -> IO ()))
+
+-- __unique:__ @toDuckDBV2CopyFromProgressCallbackFn_Aux@
+hs_bindgen_af6d2bf56fec3f38 ::
+     DuckDBV2CopyFromProgressCallbackFn_Aux
+  -> IO (BG.FunPtr DuckDBV2CopyFromProgressCallbackFn_Aux)
+hs_bindgen_af6d2bf56fec3f38 =
+  \fun0 ->
+    fmap BG.castFunPtr (hs_bindgen_af6d2bf56fec3f38_base (\x1 ->
+                                                            \x2 ->
+                                                              \x3 ->
+                                                                BG.getField @"unwrap" fun0 (BG.fromFFIType x1) (BG.fromFFIType x2) (BG.fromFFIType x3)))
+
+-- __unique:__ @fromDuckDBV2CopyFromProgressCallbackFn_Aux@
+foreign import ccall safe "dynamic" hs_bindgen_9e50a794aa05746f_base ::
+     BG.FunPtr (BG.Ptr BG.Void -> BG.Ptr BG.Void -> BG.Ptr BG.Void -> IO ())
+  -> BG.Ptr BG.Void -> BG.Ptr BG.Void -> BG.Ptr BG.Void -> IO ()
+
+-- __unique:__ @fromDuckDBV2CopyFromProgressCallbackFn_Aux@
+hs_bindgen_9e50a794aa05746f ::
+     BG.FunPtr DuckDBV2CopyFromProgressCallbackFn_Aux
+  -> DuckDBV2CopyFromProgressCallbackFn_Aux
+hs_bindgen_9e50a794aa05746f =
+  \funPtr0 ->
+    DuckDBV2CopyFromProgressCallbackFn_Aux (\x1 ->
+                                              \x2 ->
+                                                \x3 ->
+                                                  hs_bindgen_9e50a794aa05746f_base (BG.castFunPtr funPtr0) (BG.toFFIType x1) (BG.toFFIType x2) (BG.toFFIType x3))
+
+instance BG.ToFunPtr DuckDBV2CopyFromProgressCallbackFn_Aux where
+
+  toFunPtr = hs_bindgen_af6d2bf56fec3f38
+
+instance BG.FromFunPtr DuckDBV2CopyFromProgressCallbackFn_Aux where
+
+  fromFunPtr = hs_bindgen_9e50a794aa05746f
+
+instance ( ty ~ (DuckDBV2CopyFromProgressInfoHandle -> DuckDBV2ContextHandle -> BG.Ptr DuckDBV2ErrorInfoHandle -> IO ())
+         ) => BG.CompatHasField.HasField "unwrap" DuckDBV2CopyFromProgressCallbackFn_Aux ty where
+
+  hasField =
+    \x0 ->
+      ( \y1 ->
+          DuckDBV2CopyFromProgressCallbackFn_Aux {unwrap = y1}
+      , BG.getField @"unwrap" x0
+      )
+
+instance ( ty ~ (DuckDBV2CopyFromProgressInfoHandle -> DuckDBV2ContextHandle -> BG.Ptr DuckDBV2ErrorInfoHandle -> IO ())
+         ) => BG.HasField "unwrap" (BG.Ptr DuckDBV2CopyFromProgressCallbackFn_Aux) (BG.Ptr ty) where
+
+  getField = HasCField.fromPtr (BG.Proxy @"unwrap")
+
+instance HasCField.HasCField DuckDBV2CopyFromProgressCallbackFn_Aux "unwrap" where
+
+  type CFieldType DuckDBV2CopyFromProgressCallbackFn_Aux "unwrap" =
+    DuckDBV2CopyFromProgressInfoHandle -> DuckDBV2ContextHandle -> BG.Ptr DuckDBV2ErrorInfoHandle -> IO ()
+
+  offset# = \_ -> \_ -> 0
+
+{-| __C declaration:__ @duckdb_v2_copy_from_progress_callback_fn@
+
+    __defined at:__ @duckdb_v2.h 6324:16@
+
+    __exported by:__ @duckdb_v2.h@
+-}
+newtype DuckDBV2CopyFromProgressCallbackFn = DuckDBV2CopyFromProgressCallbackFn
+  { unwrap :: BG.FunPtr DuckDBV2CopyFromProgressCallbackFn_Aux
+  }
+  deriving stock (Eq, BG.Generic, Ord, Show)
+  deriving newtype
+    ( BG.HasFFIType
+    , Marshal.ReadRaw
+    , Marshal.StaticSize
+    , BG.Storable
+    , Marshal.WriteRaw
+    )
+
+instance ( ty ~ BG.FunPtr DuckDBV2CopyFromProgressCallbackFn_Aux
+         ) => BG.CompatHasField.HasField "unwrap" DuckDBV2CopyFromProgressCallbackFn ty where
+
+  hasField =
+    \x0 ->
+      ( \y1 ->
+          DuckDBV2CopyFromProgressCallbackFn {unwrap = y1}
+      , BG.getField @"unwrap" x0
+      )
+
+instance ( ty ~ BG.FunPtr DuckDBV2CopyFromProgressCallbackFn_Aux
+         ) => BG.HasField "unwrap" (BG.Ptr DuckDBV2CopyFromProgressCallbackFn) (BG.Ptr ty) where
+
+  getField = HasCField.fromPtr (BG.Proxy @"unwrap")
+
+instance HasCField.HasCField DuckDBV2CopyFromProgressCallbackFn "unwrap" where
+
+  type CFieldType DuckDBV2CopyFromProgressCallbackFn "unwrap" =
+    BG.FunPtr DuckDBV2CopyFromProgressCallbackFn_Aux
+
+  offset# = \_ -> \_ -> 0
+
+{-| An owned opaque handle to a custom option being built. Created with @duckdb_v2_custom_option_create()@ , configured with the setter functions (e.g. @duckdb_v2_custom_option_set_name()@ , @duckdb_v2_custom_option_set_type()@ , etc.), made available with @duckdb_v2_connection_register_custom_option()@ or @duckdb_v2_extension_register_custom_option()@ , and destroyed with @duckdb_v2_custom_option_destroy()@ .
+
+    __C declaration:__ @struct _duckdb_v2_custom_option@
+
+    __defined at:__ @duckdb_v2.h 7938:16@
+
+    __exported by:__ @duckdb_v2.h@
+-}
+data DuckDBV2CustomOptionStruct
+
+instance Marshal.StaticSize DuckDBV2CustomOptionStruct where
+
+  staticSizeOf = \_ -> (8 :: Int)
+
+  staticAlignment = \_ -> (8 :: Int)
+
+{-| An owned opaque handle to a custom option being built. Created with @duckdb_v2_custom_option_create()@ , configured with the setter functions (e.g. @duckdb_v2_custom_option_set_name()@ , @duckdb_v2_custom_option_set_type()@ , etc.), made available with @duckdb_v2_connection_register_custom_option()@ or @duckdb_v2_extension_register_custom_option()@ , and destroyed with @duckdb_v2_custom_option_destroy()@ .
+
+    __C declaration:__ @duckdb_v2_custom_option_handle@
+
+    __defined at:__ @duckdb_v2.h 7940:5@
+
+    __exported by:__ @duckdb_v2.h@
+-}
+newtype DuckDBV2CustomOptionHandle = DuckDBV2CustomOptionHandle
+  { unwrap :: BG.Ptr DuckDBV2CustomOptionStruct
+  }
+  deriving stock (Eq, BG.Generic, Ord, Show)
+  deriving newtype
+    ( BG.HasFFIType
+    , Marshal.ReadRaw
+    , Marshal.StaticSize
+    , BG.Storable
+    , Marshal.WriteRaw
+    )
+
+instance ( ty ~ BG.Ptr DuckDBV2CustomOptionStruct
+         ) => BG.CompatHasField.HasField "unwrap" DuckDBV2CustomOptionHandle ty where
+
+  hasField =
+    \x0 ->
+      (\y1 ->
+         DuckDBV2CustomOptionHandle {unwrap = y1}, BG.getField @"unwrap" x0)
+
+instance ( ty ~ BG.Ptr DuckDBV2CustomOptionStruct
+         ) => BG.HasField "unwrap" (BG.Ptr DuckDBV2CustomOptionHandle) (BG.Ptr ty) where
+
+  getField = HasCField.fromPtr (BG.Proxy @"unwrap")
+
+instance HasCField.HasCField DuckDBV2CustomOptionHandle "unwrap" where
+
+  type CFieldType DuckDBV2CustomOptionHandle "unwrap" =
+    BG.Ptr DuckDBV2CustomOptionStruct
+
+  offset# = \_ -> \_ -> 0
+
+{-| A borrowed opaque handle to an update of a custom option, received by its update callback. It gives access to the new value, the scope it is written at and the user data, and can replace the value.
+
+    __C declaration:__ @struct _duckdb_v2_custom_option_update_info@
+
+    __defined at:__ @duckdb_v2.h 7946:16@
+
+    __exported by:__ @duckdb_v2.h@
+-}
+data DuckDBV2CustomOptionUpdateInfoStruct
+
+instance Marshal.StaticSize DuckDBV2CustomOptionUpdateInfoStruct where
+
+  staticSizeOf = \_ -> (8 :: Int)
+
+  staticAlignment = \_ -> (8 :: Int)
+
+{-| A borrowed opaque handle to an update of a custom option, received by its update callback. It gives access to the new value, the scope it is written at and the user data, and can replace the value.
+
+    __C declaration:__ @duckdb_v2_custom_option_update_info_handle@
+
+    __defined at:__ @duckdb_v2.h 7948:5@
+
+    __exported by:__ @duckdb_v2.h@
+-}
+newtype DuckDBV2CustomOptionUpdateInfoHandle = DuckDBV2CustomOptionUpdateInfoHandle
+  { unwrap :: BG.Ptr DuckDBV2CustomOptionUpdateInfoStruct
+  }
+  deriving stock (Eq, BG.Generic, Ord, Show)
+  deriving newtype
+    ( BG.HasFFIType
+    , Marshal.ReadRaw
+    , Marshal.StaticSize
+    , BG.Storable
+    , Marshal.WriteRaw
+    )
+
+instance ( ty ~ BG.Ptr DuckDBV2CustomOptionUpdateInfoStruct
+         ) => BG.CompatHasField.HasField "unwrap" DuckDBV2CustomOptionUpdateInfoHandle ty where
+
+  hasField =
+    \x0 ->
+      ( \y1 ->
+          DuckDBV2CustomOptionUpdateInfoHandle {unwrap = y1}
+      , BG.getField @"unwrap" x0
+      )
+
+instance ( ty ~ BG.Ptr DuckDBV2CustomOptionUpdateInfoStruct
+         ) => BG.HasField "unwrap" (BG.Ptr DuckDBV2CustomOptionUpdateInfoHandle) (BG.Ptr ty) where
+
+  getField = HasCField.fromPtr (BG.Proxy @"unwrap")
+
+instance HasCField.HasCField DuckDBV2CustomOptionUpdateInfoHandle "unwrap" where
+
+  type CFieldType DuckDBV2CustomOptionUpdateInfoHandle "unwrap" =
+    BG.Ptr DuckDBV2CustomOptionUpdateInfoStruct
+
+  offset# = \_ -> \_ -> 0
+
+{-| Auxiliary type used by t'DuckDBV2CustomOptionUpdateCallbackFn'
+
+    __C declaration:__ @duckdb_v2_custom_option_update_callback_fn@
+
+    __defined at:__ @duckdb_v2.h 7954:16@
+
+    __exported by:__ @duckdb_v2.h@
+-}
+newtype DuckDBV2CustomOptionUpdateCallbackFn_Aux = DuckDBV2CustomOptionUpdateCallbackFn_Aux
+  { unwrap :: DuckDBV2CustomOptionUpdateInfoHandle -> DuckDBV2ContextHandle -> BG.Ptr DuckDBV2ErrorInfoHandle -> IO ()
+  }
+  deriving stock (BG.Generic)
+
+-- __unique:__ @toDuckDBV2CustomOptionUpdateCallbackFn_Aux@
+foreign import ccall safe "wrapper" hs_bindgen_81ba970f22f27bd8_base ::
+     (BG.Ptr BG.Void -> BG.Ptr BG.Void -> BG.Ptr BG.Void -> IO ())
+  -> IO (BG.FunPtr (BG.Ptr BG.Void -> BG.Ptr BG.Void -> BG.Ptr BG.Void -> IO ()))
+
+-- __unique:__ @toDuckDBV2CustomOptionUpdateCallbackFn_Aux@
+hs_bindgen_81ba970f22f27bd8 ::
+     DuckDBV2CustomOptionUpdateCallbackFn_Aux
+  -> IO (BG.FunPtr DuckDBV2CustomOptionUpdateCallbackFn_Aux)
+hs_bindgen_81ba970f22f27bd8 =
+  \fun0 ->
+    fmap BG.castFunPtr (hs_bindgen_81ba970f22f27bd8_base (\x1 ->
+                                                            \x2 ->
+                                                              \x3 ->
+                                                                BG.getField @"unwrap" fun0 (BG.fromFFIType x1) (BG.fromFFIType x2) (BG.fromFFIType x3)))
+
+-- __unique:__ @fromDuckDBV2CustomOptionUpdateCallbackFn_Aux@
+foreign import ccall safe "dynamic" hs_bindgen_aff5539ba3cab0f4_base ::
+     BG.FunPtr (BG.Ptr BG.Void -> BG.Ptr BG.Void -> BG.Ptr BG.Void -> IO ())
+  -> BG.Ptr BG.Void -> BG.Ptr BG.Void -> BG.Ptr BG.Void -> IO ()
+
+-- __unique:__ @fromDuckDBV2CustomOptionUpdateCallbackFn_Aux@
+hs_bindgen_aff5539ba3cab0f4 ::
+     BG.FunPtr DuckDBV2CustomOptionUpdateCallbackFn_Aux
+  -> DuckDBV2CustomOptionUpdateCallbackFn_Aux
+hs_bindgen_aff5539ba3cab0f4 =
+  \funPtr0 ->
+    DuckDBV2CustomOptionUpdateCallbackFn_Aux (\x1 ->
+                                                \x2 ->
+                                                  \x3 ->
+                                                    hs_bindgen_aff5539ba3cab0f4_base (BG.castFunPtr funPtr0) (BG.toFFIType x1) (BG.toFFIType x2) (BG.toFFIType x3))
+
+instance BG.ToFunPtr DuckDBV2CustomOptionUpdateCallbackFn_Aux where
+
+  toFunPtr = hs_bindgen_81ba970f22f27bd8
+
+instance BG.FromFunPtr DuckDBV2CustomOptionUpdateCallbackFn_Aux where
+
+  fromFunPtr = hs_bindgen_aff5539ba3cab0f4
+
+instance ( ty ~ (DuckDBV2CustomOptionUpdateInfoHandle -> DuckDBV2ContextHandle -> BG.Ptr DuckDBV2ErrorInfoHandle -> IO ())
+         ) => BG.CompatHasField.HasField "unwrap" DuckDBV2CustomOptionUpdateCallbackFn_Aux ty where
+
+  hasField =
+    \x0 ->
+      ( \y1 ->
+          DuckDBV2CustomOptionUpdateCallbackFn_Aux {unwrap = y1}
+      , BG.getField @"unwrap" x0
+      )
+
+instance ( ty ~ (DuckDBV2CustomOptionUpdateInfoHandle -> DuckDBV2ContextHandle -> BG.Ptr DuckDBV2ErrorInfoHandle -> IO ())
+         ) => BG.HasField "unwrap" (BG.Ptr DuckDBV2CustomOptionUpdateCallbackFn_Aux) (BG.Ptr ty) where
+
+  getField = HasCField.fromPtr (BG.Proxy @"unwrap")
+
+instance HasCField.HasCField DuckDBV2CustomOptionUpdateCallbackFn_Aux "unwrap" where
+
+  type CFieldType DuckDBV2CustomOptionUpdateCallbackFn_Aux "unwrap" =
+    DuckDBV2CustomOptionUpdateInfoHandle -> DuckDBV2ContextHandle -> BG.Ptr DuckDBV2ErrorInfoHandle -> IO ()
+
+  offset# = \_ -> \_ -> 0
+
+{-| __C declaration:__ @duckdb_v2_custom_option_update_callback_fn@
+
+    __defined at:__ @duckdb_v2.h 7954:16@
+
+    __exported by:__ @duckdb_v2.h@
+-}
+newtype DuckDBV2CustomOptionUpdateCallbackFn = DuckDBV2CustomOptionUpdateCallbackFn
+  { unwrap :: BG.FunPtr DuckDBV2CustomOptionUpdateCallbackFn_Aux
+  }
+  deriving stock (Eq, BG.Generic, Ord, Show)
+  deriving newtype
+    ( BG.HasFFIType
+    , Marshal.ReadRaw
+    , Marshal.StaticSize
+    , BG.Storable
+    , Marshal.WriteRaw
+    )
+
+instance ( ty ~ BG.FunPtr DuckDBV2CustomOptionUpdateCallbackFn_Aux
+         ) => BG.CompatHasField.HasField "unwrap" DuckDBV2CustomOptionUpdateCallbackFn ty where
+
+  hasField =
+    \x0 ->
+      ( \y1 ->
+          DuckDBV2CustomOptionUpdateCallbackFn {unwrap = y1}
+      , BG.getField @"unwrap" x0
+      )
+
+instance ( ty ~ BG.FunPtr DuckDBV2CustomOptionUpdateCallbackFn_Aux
+         ) => BG.HasField "unwrap" (BG.Ptr DuckDBV2CustomOptionUpdateCallbackFn) (BG.Ptr ty) where
+
+  getField = HasCField.fromPtr (BG.Proxy @"unwrap")
+
+instance HasCField.HasCField DuckDBV2CustomOptionUpdateCallbackFn "unwrap" where
+
+  type CFieldType DuckDBV2CustomOptionUpdateCallbackFn "unwrap" =
+    BG.FunPtr DuckDBV2CustomOptionUpdateCallbackFn_Aux
+
+  offset# = \_ -> \_ -> 0
+
+{-| The type of a bound expression node. The values mirror the engine\'s own expression types, restricted to the node types a filter predicate can contain; every other node type is reported as @EXPRESSION_TYPE_INVALID@ .
+
+    Comparisons, @BETWEEN@ and casts are regular scalar function calls once bound: they have the function\'s children and name, and only their type tells them apart from any other function. A @CAST@ therefore has one child, the value being cast, and its target type is the node\'s return type.
+
+    __C declaration:__ @enum DUCKDB_V2_EXPRESSION_TYPE@
+
+    __defined at:__ @duckdb_v2.h 8327:14@
+
+    __exported by:__ @duckdb_v2.h@
+-}
+newtype DuckDBV2ExpressionType = DuckDBV2ExpressionType
+  { unwrap :: BG.CUInt
+  }
+  deriving stock (Eq, BG.Generic, Ord)
+  deriving newtype (BG.HasFFIType)
+
+instance Marshal.StaticSize DuckDBV2ExpressionType where
+
+  staticSizeOf = \_ -> (4 :: Int)
+
+  staticAlignment = \_ -> (4 :: Int)
+
+instance Marshal.ReadRaw DuckDBV2ExpressionType where
+
+  readRaw =
+    \ptr0 ->
+          pure DuckDBV2ExpressionType
+      <*> Marshal.readRawByteOff ptr0 (0 :: Int)
+
+instance Marshal.WriteRaw DuckDBV2ExpressionType where
+
+  writeRaw =
+    \ptr0 ->
+      \s1 ->
+        case s1 of
+          DuckDBV2ExpressionType unwrap2 ->
+            Marshal.writeRawByteOff ptr0 (0 :: Int) unwrap2
+
+deriving via Marshal.EquivStorable DuckDBV2ExpressionType instance BG.Storable DuckDBV2ExpressionType
+
+deriving via BG.CUInt instance BG.Prim DuckDBV2ExpressionType
+
+instance CEnum.CEnum DuckDBV2ExpressionType where
+
+  type CEnumZ DuckDBV2ExpressionType = BG.CUInt
+
+  toCEnum = DuckDBV2ExpressionType
+
+  fromCEnum = BG.getField @"unwrap"
+
+  declaredValues =
+    \_ ->
+      CEnum.declaredValuesFromList [ (0, BG.singleton "DuckDBV2ExpressionTypeInvalid")
+                                   , (12, BG.singleton "DuckDBV2ExpressionTypeOperatorCast")
+                                   , (13, BG.singleton "DuckDBV2ExpressionTypeOperatorNot")
+                                   , (14, BG.singleton "DuckDBV2ExpressionTypeOperatorIsNull")
+                                   , (15, BG.singleton "DuckDBV2ExpressionTypeOperatorIsNotNull")
+                                   , (25, BG.singleton "DuckDBV2ExpressionTypeCompareEqual")
+                                   , (26, BG.singleton "DuckDBV2ExpressionTypeCompareNotequal")
+                                   , (27, BG.singleton "DuckDBV2ExpressionTypeCompareLessthan")
+                                   , (28, BG.singleton "DuckDBV2ExpressionTypeCompareGreaterthan")
+                                   , (29, BG.singleton "DuckDBV2ExpressionTypeCompareLessthanorequalto")
+                                   , (30, BG.singleton "DuckDBV2ExpressionTypeCompareGreaterthanorequalto")
+                                   , (35, BG.singleton "DuckDBV2ExpressionTypeCompareIn")
+                                   , (36, BG.singleton "DuckDBV2ExpressionTypeCompareNotIn")
+                                   , (37, BG.singleton "DuckDBV2ExpressionTypeCompareDistinctFrom")
+                                   , (38, BG.singleton "DuckDBV2ExpressionTypeCompareBetween")
+                                   , (40, BG.singleton "DuckDBV2ExpressionTypeCompareNotDistinctFrom")
+                                   , (50, BG.singleton "DuckDBV2ExpressionTypeConjunctionAnd")
+                                   , (51, BG.singleton "DuckDBV2ExpressionTypeConjunctionOr")
+                                   , (75, BG.singleton "DuckDBV2ExpressionTypeValueConstant")
+                                   , (76, BG.singleton "DuckDBV2ExpressionTypeValueParameter")
+                                   , (141, BG.singleton "DuckDBV2ExpressionTypeBoundFunction")
+                                   , (150, BG.singleton "DuckDBV2ExpressionTypeCaseExpr")
+                                   , (152, BG.singleton "DuckDBV2ExpressionTypeOperatorCoalesce")
+                                   , (228, BG.singleton "DuckDBV2ExpressionTypeBoundColumnRef")
+                                   , (2147483647, BG.singleton "DuckDBV2ExpressionTypeMaxEnum")
+                                   ]
+
+  showsUndeclared =
+    CEnum.showsWrappedUndeclared "DuckDBV2ExpressionType"
+
+  readPrecUndeclared =
+    CEnum.readPrecWrappedUndeclared "DuckDBV2ExpressionType"
+
+instance Show DuckDBV2ExpressionType where
+
+  showsPrec = CEnum.shows
+
+instance Read DuckDBV2ExpressionType where
+
+  readPrec = CEnum.readPrec
+
+  readList = BG.readListDefault
+
+  readListPrec = BG.readListPrecDefault
+
+instance ( ty ~ BG.CUInt
+         ) => BG.CompatHasField.HasField "unwrap" DuckDBV2ExpressionType ty where
+
+  hasField =
+    \x0 ->
+      (\y1 ->
+         DuckDBV2ExpressionType {unwrap = y1}, BG.getField @"unwrap" x0)
+
+instance ( ty ~ BG.CUInt
+         ) => BG.HasField "unwrap" (BG.Ptr DuckDBV2ExpressionType) (BG.Ptr ty) where
+
+  getField = HasCField.fromPtr (BG.Proxy @"unwrap")
+
+instance HasCField.HasCField DuckDBV2ExpressionType "unwrap" where
+
+  type CFieldType DuckDBV2ExpressionType "unwrap" =
+    BG.CUInt
+
+  offset# = \_ -> \_ -> 0
+
+{-| A node type this API does not model. Its children can still be walked.
+
+    __C declaration:__ @DUCKDB_V2_EXPRESSION_TYPE_INVALID@
+
+    __defined at:__ @duckdb_v2.h 8329:2@
+
+    __exported by:__ @duckdb_v2.h@
+-}
+pattern DuckDBV2ExpressionTypeInvalid :: DuckDBV2ExpressionType
+pattern DuckDBV2ExpressionTypeInvalid = DuckDBV2ExpressionType 0
+
+{-| A cast. One child; the target type is the node\'s return type and @duckdb_v2_expression_cast_get_mode()@ tells a @TRY_CAST@ apart.
+
+    __C declaration:__ @DUCKDB_V2_EXPRESSION_TYPE_OPERATOR_CAST@
+
+    __defined at:__ @duckdb_v2.h 8335:2@
+
+    __exported by:__ @duckdb_v2.h@
+-}
+pattern DuckDBV2ExpressionTypeOperatorCast :: DuckDBV2ExpressionType
+pattern DuckDBV2ExpressionTypeOperatorCast = DuckDBV2ExpressionType 12
+
+{-| Logical @NOT@ . One child.
+
+    __C declaration:__ @DUCKDB_V2_EXPRESSION_TYPE_OPERATOR_NOT@
+
+    __defined at:__ @duckdb_v2.h 8338:2@
+
+    __exported by:__ @duckdb_v2.h@
+-}
+pattern DuckDBV2ExpressionTypeOperatorNot :: DuckDBV2ExpressionType
+pattern DuckDBV2ExpressionTypeOperatorNot = DuckDBV2ExpressionType 13
+
+{-| @IS NULL@ . One child.
+
+    __C declaration:__ @DUCKDB_V2_EXPRESSION_TYPE_OPERATOR_IS_NULL@
+
+    __defined at:__ @duckdb_v2.h 8341:2@
+
+    __exported by:__ @duckdb_v2.h@
+-}
+pattern DuckDBV2ExpressionTypeOperatorIsNull :: DuckDBV2ExpressionType
+pattern DuckDBV2ExpressionTypeOperatorIsNull = DuckDBV2ExpressionType 14
+
+{-| @IS NOT NULL@ . One child.
+
+    __C declaration:__ @DUCKDB_V2_EXPRESSION_TYPE_OPERATOR_IS_NOT_NULL@
+
+    __defined at:__ @duckdb_v2.h 8344:2@
+
+    __exported by:__ @duckdb_v2.h@
+-}
+pattern DuckDBV2ExpressionTypeOperatorIsNotNull :: DuckDBV2ExpressionType
+pattern DuckDBV2ExpressionTypeOperatorIsNotNull = DuckDBV2ExpressionType 15
+
+{-| @=@ . Two children.
+
+    __C declaration:__ @DUCKDB_V2_EXPRESSION_TYPE_COMPARE_EQUAL@
+
+    __defined at:__ @duckdb_v2.h 8347:2@
+
+    __exported by:__ @duckdb_v2.h@
+-}
+pattern DuckDBV2ExpressionTypeCompareEqual :: DuckDBV2ExpressionType
+pattern DuckDBV2ExpressionTypeCompareEqual = DuckDBV2ExpressionType 25
+
+{-| @<>@ . Two children.
+
+    __C declaration:__ @DUCKDB_V2_EXPRESSION_TYPE_COMPARE_NOTEQUAL@
+
+    __defined at:__ @duckdb_v2.h 8350:2@
+
+    __exported by:__ @duckdb_v2.h@
+-}
+pattern DuckDBV2ExpressionTypeCompareNotequal :: DuckDBV2ExpressionType
+pattern DuckDBV2ExpressionTypeCompareNotequal = DuckDBV2ExpressionType 26
+
+{-| @<@ . Two children.
+
+    __C declaration:__ @DUCKDB_V2_EXPRESSION_TYPE_COMPARE_LESSTHAN@
+
+    __defined at:__ @duckdb_v2.h 8353:2@
+
+    __exported by:__ @duckdb_v2.h@
+-}
+pattern DuckDBV2ExpressionTypeCompareLessthan :: DuckDBV2ExpressionType
+pattern DuckDBV2ExpressionTypeCompareLessthan = DuckDBV2ExpressionType 27
+
+{-| @>@ . Two children.
+
+    __C declaration:__ @DUCKDB_V2_EXPRESSION_TYPE_COMPARE_GREATERTHAN@
+
+    __defined at:__ @duckdb_v2.h 8356:2@
+
+    __exported by:__ @duckdb_v2.h@
+-}
+pattern DuckDBV2ExpressionTypeCompareGreaterthan :: DuckDBV2ExpressionType
+pattern DuckDBV2ExpressionTypeCompareGreaterthan = DuckDBV2ExpressionType 28
+
+{-| @<=@ . Two children.
+
+    __C declaration:__ @DUCKDB_V2_EXPRESSION_TYPE_COMPARE_LESSTHANOREQUALTO@
+
+    __defined at:__ @duckdb_v2.h 8359:2@
+
+    __exported by:__ @duckdb_v2.h@
+-}
+pattern DuckDBV2ExpressionTypeCompareLessthanorequalto :: DuckDBV2ExpressionType
+pattern DuckDBV2ExpressionTypeCompareLessthanorequalto = DuckDBV2ExpressionType 29
+
+{-| @>=@ . Two children.
+
+    __C declaration:__ @DUCKDB_V2_EXPRESSION_TYPE_COMPARE_GREATERTHANOREQUALTO@
+
+    __defined at:__ @duckdb_v2.h 8362:2@
+
+    __exported by:__ @duckdb_v2.h@
+-}
+pattern DuckDBV2ExpressionTypeCompareGreaterthanorequalto :: DuckDBV2ExpressionType
+pattern DuckDBV2ExpressionTypeCompareGreaterthanorequalto = DuckDBV2ExpressionType 30
+
+{-| @IN@ . The first child is the value tested, the remaining children are the candidates.
+
+    __C declaration:__ @DUCKDB_V2_EXPRESSION_TYPE_COMPARE_IN@
+
+    __defined at:__ @duckdb_v2.h 8365:2@
+
+    __exported by:__ @duckdb_v2.h@
+-}
+pattern DuckDBV2ExpressionTypeCompareIn :: DuckDBV2ExpressionType
+pattern DuckDBV2ExpressionTypeCompareIn = DuckDBV2ExpressionType 35
+
+{-| @NOT IN@ . The first child is the value tested, the remaining children are the candidates.
+
+    __C declaration:__ @DUCKDB_V2_EXPRESSION_TYPE_COMPARE_NOT_IN@
+
+    __defined at:__ @duckdb_v2.h 8368:2@
+
+    __exported by:__ @duckdb_v2.h@
+-}
+pattern DuckDBV2ExpressionTypeCompareNotIn :: DuckDBV2ExpressionType
+pattern DuckDBV2ExpressionTypeCompareNotIn = DuckDBV2ExpressionType 36
+
+{-| @IS DISTINCT FROM@ . Two children.
+
+    __C declaration:__ @DUCKDB_V2_EXPRESSION_TYPE_COMPARE_DISTINCT_FROM@
+
+    __defined at:__ @duckdb_v2.h 8371:2@
+
+    __exported by:__ @duckdb_v2.h@
+-}
+pattern DuckDBV2ExpressionTypeCompareDistinctFrom :: DuckDBV2ExpressionType
+pattern DuckDBV2ExpressionTypeCompareDistinctFrom = DuckDBV2ExpressionType 37
+
+{-| @BETWEEN@ . Three children: the value tested, the lower bound and the upper bound.
+
+    __C declaration:__ @DUCKDB_V2_EXPRESSION_TYPE_COMPARE_BETWEEN@
+
+    __defined at:__ @duckdb_v2.h 8374:2@
+
+    __exported by:__ @duckdb_v2.h@
+-}
+pattern DuckDBV2ExpressionTypeCompareBetween :: DuckDBV2ExpressionType
+pattern DuckDBV2ExpressionTypeCompareBetween = DuckDBV2ExpressionType 38
+
+{-| @IS NOT DISTINCT FROM@ . Two children.
+
+    __C declaration:__ @DUCKDB_V2_EXPRESSION_TYPE_COMPARE_NOT_DISTINCT_FROM@
+
+    __defined at:__ @duckdb_v2.h 8377:2@
+
+    __exported by:__ @duckdb_v2.h@
+-}
+pattern DuckDBV2ExpressionTypeCompareNotDistinctFrom :: DuckDBV2ExpressionType
+pattern DuckDBV2ExpressionTypeCompareNotDistinctFrom = DuckDBV2ExpressionType 40
+
+{-| Logical @AND@ . Two or more children.
+
+    __C declaration:__ @DUCKDB_V2_EXPRESSION_TYPE_CONJUNCTION_AND@
+
+    __defined at:__ @duckdb_v2.h 8380:2@
+
+    __exported by:__ @duckdb_v2.h@
+-}
+pattern DuckDBV2ExpressionTypeConjunctionAnd :: DuckDBV2ExpressionType
+pattern DuckDBV2ExpressionTypeConjunctionAnd = DuckDBV2ExpressionType 50
+
+{-| Logical @OR@ . Two or more children.
+
+    __C declaration:__ @DUCKDB_V2_EXPRESSION_TYPE_CONJUNCTION_OR@
+
+    __defined at:__ @duckdb_v2.h 8383:2@
+
+    __exported by:__ @duckdb_v2.h@
+-}
+pattern DuckDBV2ExpressionTypeConjunctionOr :: DuckDBV2ExpressionType
+pattern DuckDBV2ExpressionTypeConjunctionOr = DuckDBV2ExpressionType 51
+
+{-| A constant. No children; read it with @duckdb_v2_expression_constant_get_value()@ .
+
+    __C declaration:__ @DUCKDB_V2_EXPRESSION_TYPE_VALUE_CONSTANT@
+
+    __defined at:__ @duckdb_v2.h 8386:2@
+
+    __exported by:__ @duckdb_v2.h@
+-}
+pattern DuckDBV2ExpressionTypeValueConstant :: DuckDBV2ExpressionType
+pattern DuckDBV2ExpressionTypeValueConstant = DuckDBV2ExpressionType 75
+
+{-| A prepared statement parameter whose value is not known yet. No children.
+
+    __C declaration:__ @DUCKDB_V2_EXPRESSION_TYPE_VALUE_PARAMETER@
+
+    __defined at:__ @duckdb_v2.h 8389:2@
+
+    __exported by:__ @duckdb_v2.h@
+-}
+pattern DuckDBV2ExpressionTypeValueParameter :: DuckDBV2ExpressionType
+pattern DuckDBV2ExpressionTypeValueParameter = DuckDBV2ExpressionType 76
+
+{-| A call to a scalar function other than the ones listed above. The children are its arguments; read the name with @duckdb_v2_expression_function_get_name()@ .
+
+    __C declaration:__ @DUCKDB_V2_EXPRESSION_TYPE_BOUND_FUNCTION@
+
+    __defined at:__ @duckdb_v2.h 8395:2@
+
+    __exported by:__ @duckdb_v2.h@
+-}
+pattern DuckDBV2ExpressionTypeBoundFunction :: DuckDBV2ExpressionType
+pattern DuckDBV2ExpressionTypeBoundFunction = DuckDBV2ExpressionType 141
+
+{-| A @CASE@ expression. The children are each @WHEN@ condition followed by its @THEN@ result, then the @ELSE@ result.
+
+    __C declaration:__ @DUCKDB_V2_EXPRESSION_TYPE_CASE_EXPR@
+
+    __defined at:__ @duckdb_v2.h 8399:2@
+
+    __exported by:__ @duckdb_v2.h@
+-}
+pattern DuckDBV2ExpressionTypeCaseExpr :: DuckDBV2ExpressionType
+pattern DuckDBV2ExpressionTypeCaseExpr = DuckDBV2ExpressionType 150
+
+{-| @COALESCE@ . One or more children.
+
+    __C declaration:__ @DUCKDB_V2_EXPRESSION_TYPE_OPERATOR_COALESCE@
+
+    __defined at:__ @duckdb_v2.h 8402:2@
+
+    __exported by:__ @duckdb_v2.h@
+-}
+pattern DuckDBV2ExpressionTypeOperatorCoalesce :: DuckDBV2ExpressionType
+pattern DuckDBV2ExpressionTypeOperatorCoalesce = DuckDBV2ExpressionType 152
+
+{-| A reference to a column. No children; read it with @duckdb_v2_expression_column_ref_get_index()@ .
+
+    __C declaration:__ @DUCKDB_V2_EXPRESSION_TYPE_BOUND_COLUMN_REF@
+
+    __defined at:__ @duckdb_v2.h 8405:2@
+
+    __exported by:__ @duckdb_v2.h@
+-}
+pattern DuckDBV2ExpressionTypeBoundColumnRef :: DuckDBV2ExpressionType
+pattern DuckDBV2ExpressionTypeBoundColumnRef = DuckDBV2ExpressionType 228
+
+{-| __C declaration:__ @DUCKDB_V2_EXPRESSION_TYPE_MAX_ENUM@
+
+    __defined at:__ @duckdb_v2.h 8406:2@
+
+    __exported by:__ @duckdb_v2.h@
+-}
+pattern DuckDBV2ExpressionTypeMaxEnum :: DuckDBV2ExpressionType
+pattern DuckDBV2ExpressionTypeMaxEnum = DuckDBV2ExpressionType 2147483647
+
+{-| A borrowed opaque handle to a node of a bound expression tree. Read-only and owned by the engine: valid only for the duration of the callback that handed it out, and never destroyed by the caller. Child nodes borrowed via @duckdb_v2_expression_get_child()@ share their parent\'s lifetime.
+
+    __C declaration:__ @struct _duckdb_v2_expression@
+
+    __defined at:__ @duckdb_v2.h 8418:16@
+
+    __exported by:__ @duckdb_v2.h@
+-}
+data DuckDBV2ExpressionStruct
+
+instance Marshal.StaticSize DuckDBV2ExpressionStruct where
+
+  staticSizeOf = \_ -> (8 :: Int)
+
+  staticAlignment = \_ -> (8 :: Int)
+
+{-| A borrowed opaque handle to a node of a bound expression tree. Read-only and owned by the engine: valid only for the duration of the callback that handed it out, and never destroyed by the caller. Child nodes borrowed via @duckdb_v2_expression_get_child()@ share their parent\'s lifetime.
+
+    __C declaration:__ @duckdb_v2_expression_handle@
+
+    __defined at:__ @duckdb_v2.h 8420:5@
+
+    __exported by:__ @duckdb_v2.h@
+-}
+newtype DuckDBV2ExpressionHandle = DuckDBV2ExpressionHandle
+  { unwrap :: BG.Ptr DuckDBV2ExpressionStruct
+  }
+  deriving stock (Eq, BG.Generic, Ord, Show)
+  deriving newtype
+    ( BG.HasFFIType
+    , Marshal.ReadRaw
+    , Marshal.StaticSize
+    , BG.Storable
+    , Marshal.WriteRaw
+    )
+
+instance ( ty ~ BG.Ptr DuckDBV2ExpressionStruct
+         ) => BG.CompatHasField.HasField "unwrap" DuckDBV2ExpressionHandle ty where
+
+  hasField =
+    \x0 ->
+      (\y1 ->
+         DuckDBV2ExpressionHandle {unwrap = y1}, BG.getField @"unwrap" x0)
+
+instance ( ty ~ BG.Ptr DuckDBV2ExpressionStruct
+         ) => BG.HasField "unwrap" (BG.Ptr DuckDBV2ExpressionHandle) (BG.Ptr ty) where
+
+  getField = HasCField.fromPtr (BG.Proxy @"unwrap")
+
+instance HasCField.HasCField DuckDBV2ExpressionHandle "unwrap" where
+
+  type CFieldType DuckDBV2ExpressionHandle "unwrap" =
+    BG.Ptr DuckDBV2ExpressionStruct
+
+  offset# = \_ -> \_ -> 0
+
+{-| The scope a log entry was written in, which decides which of its ids are present.
+
+    __C declaration:__ @enum DUCKDB_V2_LOG_SCOPE@
+
+    __defined at:__ @duckdb_v2.h 8630:14@
+
+    __exported by:__ @duckdb_v2.h@
+-}
+newtype DuckDBV2LogScope = DuckDBV2LogScope
+  { unwrap :: BG.CUInt
+  }
+  deriving stock (Eq, BG.Generic, Ord)
+  deriving newtype (BG.HasFFIType)
+
+instance Marshal.StaticSize DuckDBV2LogScope where
+
+  staticSizeOf = \_ -> (4 :: Int)
+
+  staticAlignment = \_ -> (4 :: Int)
+
+instance Marshal.ReadRaw DuckDBV2LogScope where
+
+  readRaw =
+    \ptr0 ->
+          pure DuckDBV2LogScope
+      <*> Marshal.readRawByteOff ptr0 (0 :: Int)
+
+instance Marshal.WriteRaw DuckDBV2LogScope where
+
+  writeRaw =
+    \ptr0 ->
+      \s1 ->
+        case s1 of
+          DuckDBV2LogScope unwrap2 ->
+            Marshal.writeRawByteOff ptr0 (0 :: Int) unwrap2
+
+deriving via Marshal.EquivStorable DuckDBV2LogScope instance BG.Storable DuckDBV2LogScope
+
+deriving via BG.CUInt instance BG.Prim DuckDBV2LogScope
+
+instance CEnum.CEnum DuckDBV2LogScope where
+
+  type CEnumZ DuckDBV2LogScope = BG.CUInt
+
+  toCEnum = DuckDBV2LogScope
+
+  fromCEnum = BG.getField @"unwrap"
+
+  declaredValues =
+    \_ ->
+      CEnum.declaredValuesFromList [ (10, BG.singleton "DuckDBV2LogScopeDatabase")
+                                   , (20, BG.singleton "DuckDBV2LogScopeConnection")
+                                   , (30, BG.singleton "DuckDBV2LogScopeThread")
+                                   , (2147483647, BG.singleton "DuckDBV2LogScopeMaxEnum")
+                                   ]
+
+  showsUndeclared =
+    CEnum.showsWrappedUndeclared "DuckDBV2LogScope"
+
+  readPrecUndeclared =
+    CEnum.readPrecWrappedUndeclared "DuckDBV2LogScope"
+
+instance Show DuckDBV2LogScope where
+
+  showsPrec = CEnum.shows
+
+instance Read DuckDBV2LogScope where
+
+  readPrec = CEnum.readPrec
+
+  readList = BG.readListDefault
+
+  readListPrec = BG.readListPrecDefault
+
+instance ( ty ~ BG.CUInt
+         ) => BG.CompatHasField.HasField "unwrap" DuckDBV2LogScope ty where
+
+  hasField =
+    \x0 ->
+      (\y1 ->
+         DuckDBV2LogScope {unwrap = y1}, BG.getField @"unwrap" x0)
+
+instance ( ty ~ BG.CUInt
+         ) => BG.HasField "unwrap" (BG.Ptr DuckDBV2LogScope) (BG.Ptr ty) where
+
+  getField = HasCField.fromPtr (BG.Proxy @"unwrap")
+
+instance HasCField.HasCField DuckDBV2LogScope "unwrap" where
+
+  type CFieldType DuckDBV2LogScope "unwrap" = BG.CUInt
+
+  offset# = \_ -> \_ -> 0
+
+{-| Written for the database as a whole, carrying no connection, transaction or query id.
+
+    __C declaration:__ @DUCKDB_V2_LOG_SCOPE_DATABASE@
+
+    __defined at:__ @duckdb_v2.h 8632:2@
+
+    __exported by:__ @duckdb_v2.h@
+-}
+pattern DuckDBV2LogScopeDatabase :: DuckDBV2LogScope
+pattern DuckDBV2LogScopeDatabase = DuckDBV2LogScope 10
+
+{-| Written by a connection, carrying its connection id and, inside one, the transaction and query ids.
+
+    __C declaration:__ @DUCKDB_V2_LOG_SCOPE_CONNECTION@
+
+    __defined at:__ @duckdb_v2.h 8635:2@
+
+    __exported by:__ @duckdb_v2.h@
+-}
+pattern DuckDBV2LogScopeConnection :: DuckDBV2LogScope
+pattern DuckDBV2LogScopeConnection = DuckDBV2LogScope 20
+
+{-| Written by a thread executing a query, carrying the thread id next to the connection\'s ids.
+
+    __C declaration:__ @DUCKDB_V2_LOG_SCOPE_THREAD@
+
+    __defined at:__ @duckdb_v2.h 8638:2@
+
+    __exported by:__ @duckdb_v2.h@
+-}
+pattern DuckDBV2LogScopeThread :: DuckDBV2LogScope
+pattern DuckDBV2LogScopeThread = DuckDBV2LogScope 30
+
+{-| __C declaration:__ @DUCKDB_V2_LOG_SCOPE_MAX_ENUM@
+
+    __defined at:__ @duckdb_v2.h 8639:2@
+
+    __exported by:__ @duckdb_v2.h@
+-}
+pattern DuckDBV2LogScopeMaxEnum :: DuckDBV2LogScope
+pattern DuckDBV2LogScopeMaxEnum = DuckDBV2LogScope 2147483647
+
+{-| An owned opaque handle to a log sink being built. Created with @duckdb_v2_log_sink_create()@ , configured with @duckdb_v2_log_sink_set_name()@ , @duckdb_v2_log_sink_set_write_callback()@ and the other setters, made available with @duckdb_v2_instance_register_log_sink()@ or @duckdb_v2_extension_register_log_sink()@ , and destroyed with @duckdb_v2_log_sink_destroy()@ .
+
+    __C declaration:__ @struct _duckdb_v2_log_sink@
+
+    __defined at:__ @duckdb_v2.h 8652:16@
+
+    __exported by:__ @duckdb_v2.h@
+-}
+data DuckDBV2LogSinkStruct
+
+instance Marshal.StaticSize DuckDBV2LogSinkStruct where
+
+  staticSizeOf = \_ -> (8 :: Int)
+
+  staticAlignment = \_ -> (8 :: Int)
+
+{-| An owned opaque handle to a log sink being built. Created with @duckdb_v2_log_sink_create()@ , configured with @duckdb_v2_log_sink_set_name()@ , @duckdb_v2_log_sink_set_write_callback()@ and the other setters, made available with @duckdb_v2_instance_register_log_sink()@ or @duckdb_v2_extension_register_log_sink()@ , and destroyed with @duckdb_v2_log_sink_destroy()@ .
+
+    __C declaration:__ @duckdb_v2_log_sink_handle@
+
+    __defined at:__ @duckdb_v2.h 8654:5@
+
+    __exported by:__ @duckdb_v2.h@
+-}
+newtype DuckDBV2LogSinkHandle = DuckDBV2LogSinkHandle
+  { unwrap :: BG.Ptr DuckDBV2LogSinkStruct
+  }
+  deriving stock (Eq, BG.Generic, Ord, Show)
+  deriving newtype
+    ( BG.HasFFIType
+    , Marshal.ReadRaw
+    , Marshal.StaticSize
+    , BG.Storable
+    , Marshal.WriteRaw
+    )
+
+instance ( ty ~ BG.Ptr DuckDBV2LogSinkStruct
+         ) => BG.CompatHasField.HasField "unwrap" DuckDBV2LogSinkHandle ty where
+
+  hasField =
+    \x0 ->
+      (\y1 ->
+         DuckDBV2LogSinkHandle {unwrap = y1}, BG.getField @"unwrap" x0)
+
+instance ( ty ~ BG.Ptr DuckDBV2LogSinkStruct
+         ) => BG.HasField "unwrap" (BG.Ptr DuckDBV2LogSinkHandle) (BG.Ptr ty) where
+
+  getField = HasCField.fromPtr (BG.Proxy @"unwrap")
+
+instance HasCField.HasCField DuckDBV2LogSinkHandle "unwrap" where
+
+  type CFieldType DuckDBV2LogSinkHandle "unwrap" =
+    BG.Ptr DuckDBV2LogSinkStruct
+
+  offset# = \_ -> \_ -> 0
+
+{-| A borrowed opaque handle to the context of a log entry, received by a log sink\'s write callback next to the entry itself, and valid only for the duration of that call. Read the ids @duckdb_logs@ reports for the entry through its getters, e.g. @duckdb_v2_log_sink_write_info_get_connection_id()@ .
+
+    __C declaration:__ @struct _duckdb_v2_log_sink_write_info@
+
+    __defined at:__ @duckdb_v2.h 8661:16@
+
+    __exported by:__ @duckdb_v2.h@
+-}
+data DuckDBV2LogSinkWriteInfoStruct
+
+instance Marshal.StaticSize DuckDBV2LogSinkWriteInfoStruct where
+
+  staticSizeOf = \_ -> (8 :: Int)
+
+  staticAlignment = \_ -> (8 :: Int)
+
+{-| A borrowed opaque handle to the context of a log entry, received by a log sink\'s write callback next to the entry itself, and valid only for the duration of that call. Read the ids @duckdb_logs@ reports for the entry through its getters, e.g. @duckdb_v2_log_sink_write_info_get_connection_id()@ .
+
+    __C declaration:__ @duckdb_v2_log_sink_write_info_handle@
+
+    __defined at:__ @duckdb_v2.h 8663:5@
+
+    __exported by:__ @duckdb_v2.h@
+-}
+newtype DuckDBV2LogSinkWriteInfoHandle = DuckDBV2LogSinkWriteInfoHandle
+  { unwrap :: BG.Ptr DuckDBV2LogSinkWriteInfoStruct
+  }
+  deriving stock (Eq, BG.Generic, Ord, Show)
+  deriving newtype
+    ( BG.HasFFIType
+    , Marshal.ReadRaw
+    , Marshal.StaticSize
+    , BG.Storable
+    , Marshal.WriteRaw
+    )
+
+instance ( ty ~ BG.Ptr DuckDBV2LogSinkWriteInfoStruct
+         ) => BG.CompatHasField.HasField "unwrap" DuckDBV2LogSinkWriteInfoHandle ty where
+
+  hasField =
+    \x0 ->
+      ( \y1 -> DuckDBV2LogSinkWriteInfoHandle {unwrap = y1}
+      , BG.getField @"unwrap" x0
+      )
+
+instance ( ty ~ BG.Ptr DuckDBV2LogSinkWriteInfoStruct
+         ) => BG.HasField "unwrap" (BG.Ptr DuckDBV2LogSinkWriteInfoHandle) (BG.Ptr ty) where
+
+  getField = HasCField.fromPtr (BG.Proxy @"unwrap")
+
+instance HasCField.HasCField DuckDBV2LogSinkWriteInfoHandle "unwrap" where
+
+  type CFieldType DuckDBV2LogSinkWriteInfoHandle "unwrap" =
+    BG.Ptr DuckDBV2LogSinkWriteInfoStruct
+
+  offset# = \_ -> \_ -> 0
+
+{-| A borrowed opaque handle received by a log sink\'s flush callback, and valid only for the duration of that call. It carries nothing yet.
+
+    __C declaration:__ @struct _duckdb_v2_log_sink_flush_info@
+
+    __defined at:__ @duckdb_v2.h 8669:16@
+
+    __exported by:__ @duckdb_v2.h@
+-}
+data DuckDBV2LogSinkFlushInfoStruct
+
+instance Marshal.StaticSize DuckDBV2LogSinkFlushInfoStruct where
+
+  staticSizeOf = \_ -> (8 :: Int)
+
+  staticAlignment = \_ -> (8 :: Int)
+
+{-| A borrowed opaque handle received by a log sink\'s flush callback, and valid only for the duration of that call. It carries nothing yet.
+
+    __C declaration:__ @duckdb_v2_log_sink_flush_info_handle@
+
+    __defined at:__ @duckdb_v2.h 8671:5@
+
+    __exported by:__ @duckdb_v2.h@
+-}
+newtype DuckDBV2LogSinkFlushInfoHandle = DuckDBV2LogSinkFlushInfoHandle
+  { unwrap :: BG.Ptr DuckDBV2LogSinkFlushInfoStruct
+  }
+  deriving stock (Eq, BG.Generic, Ord, Show)
+  deriving newtype
+    ( BG.HasFFIType
+    , Marshal.ReadRaw
+    , Marshal.StaticSize
+    , BG.Storable
+    , Marshal.WriteRaw
+    )
+
+instance ( ty ~ BG.Ptr DuckDBV2LogSinkFlushInfoStruct
+         ) => BG.CompatHasField.HasField "unwrap" DuckDBV2LogSinkFlushInfoHandle ty where
+
+  hasField =
+    \x0 ->
+      ( \y1 -> DuckDBV2LogSinkFlushInfoHandle {unwrap = y1}
+      , BG.getField @"unwrap" x0
+      )
+
+instance ( ty ~ BG.Ptr DuckDBV2LogSinkFlushInfoStruct
+         ) => BG.HasField "unwrap" (BG.Ptr DuckDBV2LogSinkFlushInfoHandle) (BG.Ptr ty) where
+
+  getField = HasCField.fromPtr (BG.Proxy @"unwrap")
+
+instance HasCField.HasCField DuckDBV2LogSinkFlushInfoHandle "unwrap" where
+
+  type CFieldType DuckDBV2LogSinkFlushInfoHandle "unwrap" =
+    BG.Ptr DuckDBV2LogSinkFlushInfoStruct
+
+  offset# = \_ -> \_ -> 0
+
+{-| Auxiliary type used by t'DuckDBV2LogSinkWriteCallbackFn'
+
+    __C declaration:__ @duckdb_v2_log_sink_write_callback_fn@
+
+    __defined at:__ @duckdb_v2.h 8677:16@
+
+    __exported by:__ @duckdb_v2.h@
+-}
+newtype DuckDBV2LogSinkWriteCallbackFn_Aux = DuckDBV2LogSinkWriteCallbackFn_Aux
+  { unwrap :: DuckDBV2LogSinkWriteInfoHandle -> BG.Ptr BG.Void -> HsBindgen.Runtime.LibC.Int64 -> DuckDBV2LogLevel -> DuckDBV2LogScope -> PtrConst.PtrConst DuckDBV2Str -> PtrConst.PtrConst DuckDBV2Str -> BG.Ptr DuckDBV2ErrorInfoHandle -> IO ()
+  }
+  deriving stock (BG.Generic)
+
+-- __unique:__ @toDuckDBV2LogSinkWriteCallbackFn_Aux@
+foreign import ccall safe "wrapper" hs_bindgen_01ca0594cb089acc_base ::
+     (BG.Ptr BG.Void -> BG.Ptr BG.Void -> HsBindgen.Runtime.LibC.Int64 -> BG.CUInt -> BG.CUInt -> BG.Ptr BG.Void -> BG.Ptr BG.Void -> BG.Ptr BG.Void -> IO ())
+  -> IO (BG.FunPtr (BG.Ptr BG.Void -> BG.Ptr BG.Void -> HsBindgen.Runtime.LibC.Int64 -> BG.CUInt -> BG.CUInt -> BG.Ptr BG.Void -> BG.Ptr BG.Void -> BG.Ptr BG.Void -> IO ()))
+
+-- __unique:__ @toDuckDBV2LogSinkWriteCallbackFn_Aux@
+hs_bindgen_01ca0594cb089acc ::
+     DuckDBV2LogSinkWriteCallbackFn_Aux
+  -> IO (BG.FunPtr DuckDBV2LogSinkWriteCallbackFn_Aux)
+hs_bindgen_01ca0594cb089acc =
+  \fun0 ->
+    fmap BG.castFunPtr (hs_bindgen_01ca0594cb089acc_base (\x1 ->
+                                                            \x2 ->
+                                                              \x3 ->
+                                                                \x4 ->
+                                                                  \x5 ->
+                                                                    \x6 ->
+                                                                      \x7 ->
+                                                                        \x8 ->
+                                                                          BG.getField @"unwrap" fun0 (BG.fromFFIType x1) (BG.fromFFIType x2) (BG.fromFFIType x3) (BG.fromFFIType x4) (BG.fromFFIType x5) (BG.fromFFIType x6) (BG.fromFFIType x7) (BG.fromFFIType x8)))
+
+-- __unique:__ @fromDuckDBV2LogSinkWriteCallbackFn_Aux@
+foreign import ccall safe "dynamic" hs_bindgen_0eb7df353bd2f7ac_base ::
+     BG.FunPtr (BG.Ptr BG.Void -> BG.Ptr BG.Void -> HsBindgen.Runtime.LibC.Int64 -> BG.CUInt -> BG.CUInt -> BG.Ptr BG.Void -> BG.Ptr BG.Void -> BG.Ptr BG.Void -> IO ())
+  -> BG.Ptr BG.Void -> BG.Ptr BG.Void -> HsBindgen.Runtime.LibC.Int64 -> BG.CUInt -> BG.CUInt -> BG.Ptr BG.Void -> BG.Ptr BG.Void -> BG.Ptr BG.Void -> IO ()
+
+-- __unique:__ @fromDuckDBV2LogSinkWriteCallbackFn_Aux@
+hs_bindgen_0eb7df353bd2f7ac ::
+     BG.FunPtr DuckDBV2LogSinkWriteCallbackFn_Aux
+  -> DuckDBV2LogSinkWriteCallbackFn_Aux
+hs_bindgen_0eb7df353bd2f7ac =
+  \funPtr0 ->
+    DuckDBV2LogSinkWriteCallbackFn_Aux (\x1 ->
+                                          \x2 ->
+                                            \x3 ->
+                                              \x4 ->
+                                                \x5 ->
+                                                  \x6 ->
+                                                    \x7 ->
+                                                      \x8 ->
+                                                        hs_bindgen_0eb7df353bd2f7ac_base (BG.castFunPtr funPtr0) (BG.toFFIType x1) (BG.toFFIType x2) (BG.toFFIType x3) (BG.toFFIType x4) (BG.toFFIType x5) (BG.toFFIType x6) (BG.toFFIType x7) (BG.toFFIType x8))
+
+instance BG.ToFunPtr DuckDBV2LogSinkWriteCallbackFn_Aux where
+
+  toFunPtr = hs_bindgen_01ca0594cb089acc
+
+instance BG.FromFunPtr DuckDBV2LogSinkWriteCallbackFn_Aux where
+
+  fromFunPtr = hs_bindgen_0eb7df353bd2f7ac
+
+instance ( ty ~ (DuckDBV2LogSinkWriteInfoHandle -> BG.Ptr BG.Void -> HsBindgen.Runtime.LibC.Int64 -> DuckDBV2LogLevel -> DuckDBV2LogScope -> PtrConst.PtrConst DuckDBV2Str -> PtrConst.PtrConst DuckDBV2Str -> BG.Ptr DuckDBV2ErrorInfoHandle -> IO ())
+         ) => BG.CompatHasField.HasField "unwrap" DuckDBV2LogSinkWriteCallbackFn_Aux ty where
+
+  hasField =
+    \x0 ->
+      ( \y1 ->
+          DuckDBV2LogSinkWriteCallbackFn_Aux {unwrap = y1}
+      , BG.getField @"unwrap" x0
+      )
+
+instance ( ty ~ (DuckDBV2LogSinkWriteInfoHandle -> BG.Ptr BG.Void -> HsBindgen.Runtime.LibC.Int64 -> DuckDBV2LogLevel -> DuckDBV2LogScope -> PtrConst.PtrConst DuckDBV2Str -> PtrConst.PtrConst DuckDBV2Str -> BG.Ptr DuckDBV2ErrorInfoHandle -> IO ())
+         ) => BG.HasField "unwrap" (BG.Ptr DuckDBV2LogSinkWriteCallbackFn_Aux) (BG.Ptr ty) where
+
+  getField = HasCField.fromPtr (BG.Proxy @"unwrap")
+
+instance HasCField.HasCField DuckDBV2LogSinkWriteCallbackFn_Aux "unwrap" where
+
+  type CFieldType DuckDBV2LogSinkWriteCallbackFn_Aux "unwrap" =
+    DuckDBV2LogSinkWriteInfoHandle -> BG.Ptr BG.Void -> HsBindgen.Runtime.LibC.Int64 -> DuckDBV2LogLevel -> DuckDBV2LogScope -> PtrConst.PtrConst DuckDBV2Str -> PtrConst.PtrConst DuckDBV2Str -> BG.Ptr DuckDBV2ErrorInfoHandle -> IO ()
+
+  offset# = \_ -> \_ -> 0
+
+{-| __C declaration:__ @duckdb_v2_log_sink_write_callback_fn@
+
+    __defined at:__ @duckdb_v2.h 8677:16@
+
+    __exported by:__ @duckdb_v2.h@
+-}
+newtype DuckDBV2LogSinkWriteCallbackFn = DuckDBV2LogSinkWriteCallbackFn
+  { unwrap :: BG.FunPtr DuckDBV2LogSinkWriteCallbackFn_Aux
+  }
+  deriving stock (Eq, BG.Generic, Ord, Show)
+  deriving newtype
+    ( BG.HasFFIType
+    , Marshal.ReadRaw
+    , Marshal.StaticSize
+    , BG.Storable
+    , Marshal.WriteRaw
+    )
+
+instance ( ty ~ BG.FunPtr DuckDBV2LogSinkWriteCallbackFn_Aux
+         ) => BG.CompatHasField.HasField "unwrap" DuckDBV2LogSinkWriteCallbackFn ty where
+
+  hasField =
+    \x0 ->
+      ( \y1 -> DuckDBV2LogSinkWriteCallbackFn {unwrap = y1}
+      , BG.getField @"unwrap" x0
+      )
+
+instance ( ty ~ BG.FunPtr DuckDBV2LogSinkWriteCallbackFn_Aux
+         ) => BG.HasField "unwrap" (BG.Ptr DuckDBV2LogSinkWriteCallbackFn) (BG.Ptr ty) where
+
+  getField = HasCField.fromPtr (BG.Proxy @"unwrap")
+
+instance HasCField.HasCField DuckDBV2LogSinkWriteCallbackFn "unwrap" where
+
+  type CFieldType DuckDBV2LogSinkWriteCallbackFn "unwrap" =
+    BG.FunPtr DuckDBV2LogSinkWriteCallbackFn_Aux
+
+  offset# = \_ -> \_ -> 0
+
+{-| Auxiliary type used by t'DuckDBV2LogSinkFlushCallbackFn'
+
+    __C declaration:__ @duckdb_v2_log_sink_flush_callback_fn@
+
+    __defined at:__ @duckdb_v2.h 8682:16@
+
+    __exported by:__ @duckdb_v2.h@
+-}
+newtype DuckDBV2LogSinkFlushCallbackFn_Aux = DuckDBV2LogSinkFlushCallbackFn_Aux
+  { unwrap :: DuckDBV2LogSinkFlushInfoHandle -> BG.Ptr BG.Void -> BG.Ptr DuckDBV2ErrorInfoHandle -> IO ()
+  }
+  deriving stock (BG.Generic)
+
+-- __unique:__ @toDuckDBV2LogSinkFlushCallbackFn_Aux@
+foreign import ccall safe "wrapper" hs_bindgen_9b28639783c8b3a0_base ::
+     (BG.Ptr BG.Void -> BG.Ptr BG.Void -> BG.Ptr BG.Void -> IO ())
+  -> IO (BG.FunPtr (BG.Ptr BG.Void -> BG.Ptr BG.Void -> BG.Ptr BG.Void -> IO ()))
+
+-- __unique:__ @toDuckDBV2LogSinkFlushCallbackFn_Aux@
+hs_bindgen_9b28639783c8b3a0 ::
+     DuckDBV2LogSinkFlushCallbackFn_Aux
+  -> IO (BG.FunPtr DuckDBV2LogSinkFlushCallbackFn_Aux)
+hs_bindgen_9b28639783c8b3a0 =
+  \fun0 ->
+    fmap BG.castFunPtr (hs_bindgen_9b28639783c8b3a0_base (\x1 ->
+                                                            \x2 ->
+                                                              \x3 ->
+                                                                BG.getField @"unwrap" fun0 (BG.fromFFIType x1) (BG.fromFFIType x2) (BG.fromFFIType x3)))
+
+-- __unique:__ @fromDuckDBV2LogSinkFlushCallbackFn_Aux@
+foreign import ccall safe "dynamic" hs_bindgen_44677c981d9b902a_base ::
+     BG.FunPtr (BG.Ptr BG.Void -> BG.Ptr BG.Void -> BG.Ptr BG.Void -> IO ())
+  -> BG.Ptr BG.Void -> BG.Ptr BG.Void -> BG.Ptr BG.Void -> IO ()
+
+-- __unique:__ @fromDuckDBV2LogSinkFlushCallbackFn_Aux@
+hs_bindgen_44677c981d9b902a ::
+     BG.FunPtr DuckDBV2LogSinkFlushCallbackFn_Aux
+  -> DuckDBV2LogSinkFlushCallbackFn_Aux
+hs_bindgen_44677c981d9b902a =
+  \funPtr0 ->
+    DuckDBV2LogSinkFlushCallbackFn_Aux (\x1 ->
+                                          \x2 ->
+                                            \x3 ->
+                                              hs_bindgen_44677c981d9b902a_base (BG.castFunPtr funPtr0) (BG.toFFIType x1) (BG.toFFIType x2) (BG.toFFIType x3))
+
+instance BG.ToFunPtr DuckDBV2LogSinkFlushCallbackFn_Aux where
+
+  toFunPtr = hs_bindgen_9b28639783c8b3a0
+
+instance BG.FromFunPtr DuckDBV2LogSinkFlushCallbackFn_Aux where
+
+  fromFunPtr = hs_bindgen_44677c981d9b902a
+
+instance ( ty ~ (DuckDBV2LogSinkFlushInfoHandle -> BG.Ptr BG.Void -> BG.Ptr DuckDBV2ErrorInfoHandle -> IO ())
+         ) => BG.CompatHasField.HasField "unwrap" DuckDBV2LogSinkFlushCallbackFn_Aux ty where
+
+  hasField =
+    \x0 ->
+      ( \y1 ->
+          DuckDBV2LogSinkFlushCallbackFn_Aux {unwrap = y1}
+      , BG.getField @"unwrap" x0
+      )
+
+instance ( ty ~ (DuckDBV2LogSinkFlushInfoHandle -> BG.Ptr BG.Void -> BG.Ptr DuckDBV2ErrorInfoHandle -> IO ())
+         ) => BG.HasField "unwrap" (BG.Ptr DuckDBV2LogSinkFlushCallbackFn_Aux) (BG.Ptr ty) where
+
+  getField = HasCField.fromPtr (BG.Proxy @"unwrap")
+
+instance HasCField.HasCField DuckDBV2LogSinkFlushCallbackFn_Aux "unwrap" where
+
+  type CFieldType DuckDBV2LogSinkFlushCallbackFn_Aux "unwrap" =
+    DuckDBV2LogSinkFlushInfoHandle -> BG.Ptr BG.Void -> BG.Ptr DuckDBV2ErrorInfoHandle -> IO ()
+
+  offset# = \_ -> \_ -> 0
+
+{-| __C declaration:__ @duckdb_v2_log_sink_flush_callback_fn@
+
+    __defined at:__ @duckdb_v2.h 8682:16@
+
+    __exported by:__ @duckdb_v2.h@
+-}
+newtype DuckDBV2LogSinkFlushCallbackFn = DuckDBV2LogSinkFlushCallbackFn
+  { unwrap :: BG.FunPtr DuckDBV2LogSinkFlushCallbackFn_Aux
+  }
+  deriving stock (Eq, BG.Generic, Ord, Show)
+  deriving newtype
+    ( BG.HasFFIType
+    , Marshal.ReadRaw
+    , Marshal.StaticSize
+    , BG.Storable
+    , Marshal.WriteRaw
+    )
+
+instance ( ty ~ BG.FunPtr DuckDBV2LogSinkFlushCallbackFn_Aux
+         ) => BG.CompatHasField.HasField "unwrap" DuckDBV2LogSinkFlushCallbackFn ty where
+
+  hasField =
+    \x0 ->
+      ( \y1 -> DuckDBV2LogSinkFlushCallbackFn {unwrap = y1}
+      , BG.getField @"unwrap" x0
+      )
+
+instance ( ty ~ BG.FunPtr DuckDBV2LogSinkFlushCallbackFn_Aux
+         ) => BG.HasField "unwrap" (BG.Ptr DuckDBV2LogSinkFlushCallbackFn) (BG.Ptr ty) where
+
+  getField = HasCField.fromPtr (BG.Proxy @"unwrap")
+
+instance HasCField.HasCField DuckDBV2LogSinkFlushCallbackFn "unwrap" where
+
+  type CFieldType DuckDBV2LogSinkFlushCallbackFn "unwrap" =
+    BG.FunPtr DuckDBV2LogSinkFlushCallbackFn_Aux
+
+  offset# = \_ -> \_ -> 0
+
+{-| Logical type identifier. The values are the same integers DuckDB uses internally, so round-tripping is lossless. The bind- and UDF-only ids (UNKNOWN, ANY, TEMPLATE) appear here for completeness; they do not show up in result column types in practice.
+
+    __C declaration:__ @enum DUCKDB_V2_LOGICAL_TYPE_ID@
+
+    __defined at:__ @duckdb_v2.h 8953:14@
+
+    __exported by:__ @duckdb_v2.h@
+-}
+newtype DuckDBV2LogicalTypeId = DuckDBV2LogicalTypeId
+  { unwrap :: BG.CUInt
+  }
+  deriving stock (Eq, BG.Generic, Ord)
+  deriving newtype (BG.HasFFIType)
+
+instance Marshal.StaticSize DuckDBV2LogicalTypeId where
+
+  staticSizeOf = \_ -> (4 :: Int)
+
+  staticAlignment = \_ -> (4 :: Int)
+
+instance Marshal.ReadRaw DuckDBV2LogicalTypeId where
+
+  readRaw =
+    \ptr0 ->
+          pure DuckDBV2LogicalTypeId
+      <*> Marshal.readRawByteOff ptr0 (0 :: Int)
+
+instance Marshal.WriteRaw DuckDBV2LogicalTypeId where
+
+  writeRaw =
+    \ptr0 ->
+      \s1 ->
+        case s1 of
+          DuckDBV2LogicalTypeId unwrap2 ->
+            Marshal.writeRawByteOff ptr0 (0 :: Int) unwrap2
+
+deriving via Marshal.EquivStorable DuckDBV2LogicalTypeId instance BG.Storable DuckDBV2LogicalTypeId
+
+deriving via BG.CUInt instance BG.Prim DuckDBV2LogicalTypeId
+
+instance CEnum.CEnum DuckDBV2LogicalTypeId where
+
+  type CEnumZ DuckDBV2LogicalTypeId = BG.CUInt
+
+  toCEnum = DuckDBV2LogicalTypeId
+
+  fromCEnum = BG.getField @"unwrap"
+
+  declaredValues =
+    \_ ->
+      CEnum.declaredValuesFromList [ (0, BG.singleton "DuckDBV2LogicalTypeIdInvalid")
+                                   , (1, BG.singleton "DuckDBV2LogicalTypeIdSQLNull")
+                                   , (2, BG.singleton "DuckDBV2LogicalTypeIdUnknown")
+                                   , (3, BG.singleton "DuckDBV2LogicalTypeIdAny")
+                                   , (6, BG.singleton "DuckDBV2LogicalTypeIdType")
+                                   , (10, BG.singleton "DuckDBV2LogicalTypeIdBoolean")
+                                   , (11, BG.singleton "DuckDBV2LogicalTypeIdTinyInt")
+                                   , (12, BG.singleton "DuckDBV2LogicalTypeIdSmallInt")
+                                   , (13, BG.singleton "DuckDBV2LogicalTypeIdInteger")
+                                   , (14, BG.singleton "DuckDBV2LogicalTypeIdBigInt")
+                                   , (15, BG.singleton "DuckDBV2LogicalTypeIdDate")
+                                   , (16, BG.singleton "DuckDBV2LogicalTypeIdTime")
+                                   , (17, BG.singleton "DuckDBV2LogicalTypeIdTimestampSec")
+                                   , (18, BG.singleton "DuckDBV2LogicalTypeIdTimestampMs")
+                                   , (19, BG.singleton "DuckDBV2LogicalTypeIdTimestamp")
+                                   , (20, BG.singleton "DuckDBV2LogicalTypeIdTimestampNs")
+                                   , (21, BG.singleton "DuckDBV2LogicalTypeIdDecimal")
+                                   , (22, BG.singleton "DuckDBV2LogicalTypeIdFloat")
+                                   , (23, BG.singleton "DuckDBV2LogicalTypeIdDouble")
+                                   , (25, BG.singleton "DuckDBV2LogicalTypeIdVarchar")
+                                   , (26, BG.singleton "DuckDBV2LogicalTypeIdBlob")
+                                   , (27, BG.singleton "DuckDBV2LogicalTypeIdInterval")
+                                   , (28, BG.singleton "DuckDBV2LogicalTypeIdUTinyInt")
+                                   , (29, BG.singleton "DuckDBV2LogicalTypeIdUSmallInt")
+                                   , (30, BG.singleton "DuckDBV2LogicalTypeIdUInteger")
+                                   , (31, BG.singleton "DuckDBV2LogicalTypeIdUBigInt")
+                                   , (32, BG.singleton "DuckDBV2LogicalTypeIdTimestampTz")
+                                   , (33, BG.singleton "DuckDBV2LogicalTypeIdTimestampTzNs")
+                                   , (34, BG.singleton "DuckDBV2LogicalTypeIdTimeTz")
+                                   , (35, BG.singleton "DuckDBV2LogicalTypeIdTimeNs")
+                                   , (36, BG.singleton "DuckDBV2LogicalTypeIdBit")
+                                   , (39, BG.singleton "DuckDBV2LogicalTypeIdBigNum")
+                                   , (49, BG.singleton "DuckDBV2LogicalTypeIdUHugeInt")
+                                   , (50, BG.singleton "DuckDBV2LogicalTypeIdHugeInt")
+                                   , (54, BG.singleton "DuckDBV2LogicalTypeIdUUID")
+                                   , (60, BG.singleton "DuckDBV2LogicalTypeIdGeometry")
+                                   , (100, BG.singleton "DuckDBV2LogicalTypeIdStruct")
+                                   , (101, BG.singleton "DuckDBV2LogicalTypeIdList")
+                                   , (102, BG.singleton "DuckDBV2LogicalTypeIdMap")
+                                   , (104, BG.singleton "DuckDBV2LogicalTypeIdEnum")
+                                   , (107, BG.singleton "DuckDBV2LogicalTypeIdUnion")
+                                   , (108, BG.singleton "DuckDBV2LogicalTypeIdArray")
+                                   , (109, BG.singleton "DuckDBV2LogicalTypeIdVariant")
+                                   , (110, BG.singleton "DuckDBV2LogicalTypeIdTuple")
+                                   , (2147483647, BG.singleton "DuckDBV2LogicalTypeIdMaxEnum")
+                                   ]
+
+  showsUndeclared =
+    CEnum.showsWrappedUndeclared "DuckDBV2LogicalTypeId"
+
+  readPrecUndeclared =
+    CEnum.readPrecWrappedUndeclared "DuckDBV2LogicalTypeId"
+
+instance Show DuckDBV2LogicalTypeId where
+
+  showsPrec = CEnum.shows
+
+instance Read DuckDBV2LogicalTypeId where
+
+  readPrec = CEnum.readPrec
+
+  readList = BG.readListDefault
+
+  readListPrec = BG.readListPrecDefault
+
+instance ( ty ~ BG.CUInt
+         ) => BG.CompatHasField.HasField "unwrap" DuckDBV2LogicalTypeId ty where
+
+  hasField =
+    \x0 ->
+      (\y1 ->
+         DuckDBV2LogicalTypeId {unwrap = y1}, BG.getField @"unwrap" x0)
+
+instance ( ty ~ BG.CUInt
+         ) => BG.HasField "unwrap" (BG.Ptr DuckDBV2LogicalTypeId) (BG.Ptr ty) where
+
+  getField = HasCField.fromPtr (BG.Proxy @"unwrap")
+
+instance HasCField.HasCField DuckDBV2LogicalTypeId "unwrap" where
+
+  type CFieldType DuckDBV2LogicalTypeId "unwrap" =
+    BG.CUInt
+
+  offset# = \_ -> \_ -> 0
+
+{-| Invalid / unset.
+
+    __C declaration:__ @DUCKDB_V2_LOGICAL_TYPE_ID_INVALID@
+
+    __defined at:__ @duckdb_v2.h 8955:2@
+
+    __exported by:__ @duckdb_v2.h@
+-}
+pattern DuckDBV2LogicalTypeIdInvalid :: DuckDBV2LogicalTypeId
+pattern DuckDBV2LogicalTypeIdInvalid = DuckDBV2LogicalTypeId 0
+
+{-| NULL constant type.
+
+    __C declaration:__ @DUCKDB_V2_LOGICAL_TYPE_ID_SQLNULL@
+
+    __defined at:__ @duckdb_v2.h 8958:2@
+
+    __exported by:__ @duckdb_v2.h@
+-}
+pattern DuckDBV2LogicalTypeIdSQLNull :: DuckDBV2LogicalTypeId
+pattern DuckDBV2LogicalTypeIdSQLNull = DuckDBV2LogicalTypeId 1
+
+{-| Unknown — used for unresolved parameter expressions.
+
+    __C declaration:__ @DUCKDB_V2_LOGICAL_TYPE_ID_UNKNOWN@
+
+    __defined at:__ @duckdb_v2.h 8961:2@
+
+    __exported by:__ @duckdb_v2.h@
+-}
+pattern DuckDBV2LogicalTypeIdUnknown :: DuckDBV2LogicalTypeId
+pattern DuckDBV2LogicalTypeIdUnknown = DuckDBV2LogicalTypeId 2
+
+{-| ANY — used for functions that accept any type.
+
+    __C declaration:__ @DUCKDB_V2_LOGICAL_TYPE_ID_ANY@
+
+    __defined at:__ @duckdb_v2.h 8964:2@
+
+    __exported by:__ @duckdb_v2.h@
+-}
+pattern DuckDBV2LogicalTypeIdAny :: DuckDBV2LogicalTypeId
+pattern DuckDBV2LogicalTypeIdAny = DuckDBV2LogicalTypeId 3
+
+{-| A type carried as a value (type parameters). Values of this type are built via value_create_type.
+
+    __C declaration:__ @DUCKDB_V2_LOGICAL_TYPE_ID_TYPE@
+
+    __defined at:__ @duckdb_v2.h 8967:2@
+
+    __exported by:__ @duckdb_v2.h@
+-}
+pattern DuckDBV2LogicalTypeIdType :: DuckDBV2LogicalTypeId
+pattern DuckDBV2LogicalTypeIdType = DuckDBV2LogicalTypeId 6
+
+{-| __C declaration:__ @DUCKDB_V2_LOGICAL_TYPE_ID_BOOLEAN@
+
+    __defined at:__ @duckdb_v2.h 8968:2@
+
+    __exported by:__ @duckdb_v2.h@
+-}
+pattern DuckDBV2LogicalTypeIdBoolean :: DuckDBV2LogicalTypeId
+pattern DuckDBV2LogicalTypeIdBoolean = DuckDBV2LogicalTypeId 10
+
+{-| __C declaration:__ @DUCKDB_V2_LOGICAL_TYPE_ID_TINYINT@
+
+    __defined at:__ @duckdb_v2.h 8969:2@
+
+    __exported by:__ @duckdb_v2.h@
+-}
+pattern DuckDBV2LogicalTypeIdTinyInt :: DuckDBV2LogicalTypeId
+pattern DuckDBV2LogicalTypeIdTinyInt = DuckDBV2LogicalTypeId 11
+
+{-| __C declaration:__ @DUCKDB_V2_LOGICAL_TYPE_ID_SMALLINT@
+
+    __defined at:__ @duckdb_v2.h 8970:2@
+
+    __exported by:__ @duckdb_v2.h@
+-}
+pattern DuckDBV2LogicalTypeIdSmallInt :: DuckDBV2LogicalTypeId
+pattern DuckDBV2LogicalTypeIdSmallInt = DuckDBV2LogicalTypeId 12
+
+{-| __C declaration:__ @DUCKDB_V2_LOGICAL_TYPE_ID_INTEGER@
+
+    __defined at:__ @duckdb_v2.h 8971:2@
+
+    __exported by:__ @duckdb_v2.h@
+-}
+pattern DuckDBV2LogicalTypeIdInteger :: DuckDBV2LogicalTypeId
+pattern DuckDBV2LogicalTypeIdInteger = DuckDBV2LogicalTypeId 13
+
+{-| __C declaration:__ @DUCKDB_V2_LOGICAL_TYPE_ID_BIGINT@
+
+    __defined at:__ @duckdb_v2.h 8972:2@
+
+    __exported by:__ @duckdb_v2.h@
+-}
+pattern DuckDBV2LogicalTypeIdBigInt :: DuckDBV2LogicalTypeId
+pattern DuckDBV2LogicalTypeIdBigInt = DuckDBV2LogicalTypeId 14
+
+{-| 32-bit days since epoch.
+
+    __C declaration:__ @DUCKDB_V2_LOGICAL_TYPE_ID_DATE@
+
+    __defined at:__ @duckdb_v2.h 8975:2@
+
+    __exported by:__ @duckdb_v2.h@
+-}
+pattern DuckDBV2LogicalTypeIdDate :: DuckDBV2LogicalTypeId
+pattern DuckDBV2LogicalTypeIdDate = DuckDBV2LogicalTypeId 15
+
+{-| 64-bit microseconds since midnight.
+
+    __C declaration:__ @DUCKDB_V2_LOGICAL_TYPE_ID_TIME@
+
+    __defined at:__ @duckdb_v2.h 8978:2@
+
+    __exported by:__ @duckdb_v2.h@
+-}
+pattern DuckDBV2LogicalTypeIdTime :: DuckDBV2LogicalTypeId
+pattern DuckDBV2LogicalTypeIdTime = DuckDBV2LogicalTypeId 16
+
+{-| 64-bit seconds since epoch.
+
+    __C declaration:__ @DUCKDB_V2_LOGICAL_TYPE_ID_TIMESTAMP_SEC@
+
+    __defined at:__ @duckdb_v2.h 8981:2@
+
+    __exported by:__ @duckdb_v2.h@
+-}
+pattern DuckDBV2LogicalTypeIdTimestampSec :: DuckDBV2LogicalTypeId
+pattern DuckDBV2LogicalTypeIdTimestampSec = DuckDBV2LogicalTypeId 17
+
+{-| 64-bit milliseconds since epoch.
+
+    __C declaration:__ @DUCKDB_V2_LOGICAL_TYPE_ID_TIMESTAMP_MS@
+
+    __defined at:__ @duckdb_v2.h 8984:2@
+
+    __exported by:__ @duckdb_v2.h@
+-}
+pattern DuckDBV2LogicalTypeIdTimestampMs :: DuckDBV2LogicalTypeId
+pattern DuckDBV2LogicalTypeIdTimestampMs = DuckDBV2LogicalTypeId 18
+
+{-| 64-bit microseconds since epoch.
+
+    __C declaration:__ @DUCKDB_V2_LOGICAL_TYPE_ID_TIMESTAMP@
+
+    __defined at:__ @duckdb_v2.h 8987:2@
+
+    __exported by:__ @duckdb_v2.h@
+-}
+pattern DuckDBV2LogicalTypeIdTimestamp :: DuckDBV2LogicalTypeId
+pattern DuckDBV2LogicalTypeIdTimestamp = DuckDBV2LogicalTypeId 19
+
+{-| 64-bit nanoseconds since epoch.
+
+    __C declaration:__ @DUCKDB_V2_LOGICAL_TYPE_ID_TIMESTAMP_NS@
+
+    __defined at:__ @duckdb_v2.h 8990:2@
+
+    __exported by:__ @duckdb_v2.h@
+-}
+pattern DuckDBV2LogicalTypeIdTimestampNs :: DuckDBV2LogicalTypeId
+pattern DuckDBV2LogicalTypeIdTimestampNs = DuckDBV2LogicalTypeId 20
+
+{-| Decimal with width and scale parameters.
+
+    __C declaration:__ @DUCKDB_V2_LOGICAL_TYPE_ID_DECIMAL@
+
+    __defined at:__ @duckdb_v2.h 8993:2@
+
+    __exported by:__ @duckdb_v2.h@
+-}
+pattern DuckDBV2LogicalTypeIdDecimal :: DuckDBV2LogicalTypeId
+pattern DuckDBV2LogicalTypeIdDecimal = DuckDBV2LogicalTypeId 21
+
+{-| __C declaration:__ @DUCKDB_V2_LOGICAL_TYPE_ID_FLOAT@
+
+    __defined at:__ @duckdb_v2.h 8994:2@
+
+    __exported by:__ @duckdb_v2.h@
+-}
+pattern DuckDBV2LogicalTypeIdFloat :: DuckDBV2LogicalTypeId
+pattern DuckDBV2LogicalTypeIdFloat = DuckDBV2LogicalTypeId 22
+
+{-| __C declaration:__ @DUCKDB_V2_LOGICAL_TYPE_ID_DOUBLE@
+
+    __defined at:__ @duckdb_v2.h 8995:2@
+
+    __exported by:__ @duckdb_v2.h@
+-}
+pattern DuckDBV2LogicalTypeIdDouble :: DuckDBV2LogicalTypeId
+pattern DuckDBV2LogicalTypeIdDouble = DuckDBV2LogicalTypeId 23
+
+{-| __C declaration:__ @DUCKDB_V2_LOGICAL_TYPE_ID_VARCHAR@
+
+    __defined at:__ @duckdb_v2.h 8996:2@
+
+    __exported by:__ @duckdb_v2.h@
+-}
+pattern DuckDBV2LogicalTypeIdVarchar :: DuckDBV2LogicalTypeId
+pattern DuckDBV2LogicalTypeIdVarchar = DuckDBV2LogicalTypeId 25
+
+{-| __C declaration:__ @DUCKDB_V2_LOGICAL_TYPE_ID_BLOB@
+
+    __defined at:__ @duckdb_v2.h 8997:2@
+
+    __exported by:__ @duckdb_v2.h@
+-}
+pattern DuckDBV2LogicalTypeIdBlob :: DuckDBV2LogicalTypeId
+pattern DuckDBV2LogicalTypeIdBlob = DuckDBV2LogicalTypeId 26
+
+{-| __C declaration:__ @DUCKDB_V2_LOGICAL_TYPE_ID_INTERVAL@
+
+    __defined at:__ @duckdb_v2.h 8998:2@
+
+    __exported by:__ @duckdb_v2.h@
+-}
+pattern DuckDBV2LogicalTypeIdInterval :: DuckDBV2LogicalTypeId
+pattern DuckDBV2LogicalTypeIdInterval = DuckDBV2LogicalTypeId 27
+
+{-| __C declaration:__ @DUCKDB_V2_LOGICAL_TYPE_ID_UTINYINT@
+
+    __defined at:__ @duckdb_v2.h 8999:2@
+
+    __exported by:__ @duckdb_v2.h@
+-}
+pattern DuckDBV2LogicalTypeIdUTinyInt :: DuckDBV2LogicalTypeId
+pattern DuckDBV2LogicalTypeIdUTinyInt = DuckDBV2LogicalTypeId 28
+
+{-| __C declaration:__ @DUCKDB_V2_LOGICAL_TYPE_ID_USMALLINT@
+
+    __defined at:__ @duckdb_v2.h 9000:2@
+
+    __exported by:__ @duckdb_v2.h@
+-}
+pattern DuckDBV2LogicalTypeIdUSmallInt :: DuckDBV2LogicalTypeId
+pattern DuckDBV2LogicalTypeIdUSmallInt = DuckDBV2LogicalTypeId 29
+
+{-| __C declaration:__ @DUCKDB_V2_LOGICAL_TYPE_ID_UINTEGER@
+
+    __defined at:__ @duckdb_v2.h 9001:2@
+
+    __exported by:__ @duckdb_v2.h@
+-}
+pattern DuckDBV2LogicalTypeIdUInteger :: DuckDBV2LogicalTypeId
+pattern DuckDBV2LogicalTypeIdUInteger = DuckDBV2LogicalTypeId 30
+
+{-| __C declaration:__ @DUCKDB_V2_LOGICAL_TYPE_ID_UBIGINT@
+
+    __defined at:__ @duckdb_v2.h 9002:2@
+
+    __exported by:__ @duckdb_v2.h@
+-}
+pattern DuckDBV2LogicalTypeIdUBigInt :: DuckDBV2LogicalTypeId
+pattern DuckDBV2LogicalTypeIdUBigInt = DuckDBV2LogicalTypeId 31
+
+{-| 64-bit microseconds since epoch, timezone-aware.
+
+    __C declaration:__ @DUCKDB_V2_LOGICAL_TYPE_ID_TIMESTAMP_TZ@
+
+    __defined at:__ @duckdb_v2.h 9005:2@
+
+    __exported by:__ @duckdb_v2.h@
+-}
+pattern DuckDBV2LogicalTypeIdTimestampTz :: DuckDBV2LogicalTypeId
+pattern DuckDBV2LogicalTypeIdTimestampTz = DuckDBV2LogicalTypeId 32
+
+{-| 64-bit nanoseconds since epoch, timezone-aware.
+
+    __C declaration:__ @DUCKDB_V2_LOGICAL_TYPE_ID_TIMESTAMP_TZ_NS@
+
+    __defined at:__ @duckdb_v2.h 9008:2@
+
+    __exported by:__ @duckdb_v2.h@
+-}
+pattern DuckDBV2LogicalTypeIdTimestampTzNs :: DuckDBV2LogicalTypeId
+pattern DuckDBV2LogicalTypeIdTimestampTzNs = DuckDBV2LogicalTypeId 33
+
+{-| 64-bit microseconds since midnight + 32-bit offset.
+
+    __C declaration:__ @DUCKDB_V2_LOGICAL_TYPE_ID_TIME_TZ@
+
+    __defined at:__ @duckdb_v2.h 9011:2@
+
+    __exported by:__ @duckdb_v2.h@
+-}
+pattern DuckDBV2LogicalTypeIdTimeTz :: DuckDBV2LogicalTypeId
+pattern DuckDBV2LogicalTypeIdTimeTz = DuckDBV2LogicalTypeId 34
+
+{-| 64-bit nanoseconds since midnight.
+
+    __C declaration:__ @DUCKDB_V2_LOGICAL_TYPE_ID_TIME_NS@
+
+    __defined at:__ @duckdb_v2.h 9014:2@
+
+    __exported by:__ @duckdb_v2.h@
+-}
+pattern DuckDBV2LogicalTypeIdTimeNs :: DuckDBV2LogicalTypeId
+pattern DuckDBV2LogicalTypeIdTimeNs = DuckDBV2LogicalTypeId 35
+
+{-| __C declaration:__ @DUCKDB_V2_LOGICAL_TYPE_ID_BIT@
+
+    __defined at:__ @duckdb_v2.h 9015:2@
+
+    __exported by:__ @duckdb_v2.h@
+-}
+pattern DuckDBV2LogicalTypeIdBit :: DuckDBV2LogicalTypeId
+pattern DuckDBV2LogicalTypeIdBit = DuckDBV2LogicalTypeId 36
+
+{-| Arbitrary-precision integer (VARINT-encoded).
+
+    __C declaration:__ @DUCKDB_V2_LOGICAL_TYPE_ID_BIGNUM@
+
+    __defined at:__ @duckdb_v2.h 9018:2@
+
+    __exported by:__ @duckdb_v2.h@
+-}
+pattern DuckDBV2LogicalTypeIdBigNum :: DuckDBV2LogicalTypeId
+pattern DuckDBV2LogicalTypeIdBigNum = DuckDBV2LogicalTypeId 39
+
+{-| __C declaration:__ @DUCKDB_V2_LOGICAL_TYPE_ID_UHUGEINT@
+
+    __defined at:__ @duckdb_v2.h 9019:2@
+
+    __exported by:__ @duckdb_v2.h@
+-}
+pattern DuckDBV2LogicalTypeIdUHugeInt :: DuckDBV2LogicalTypeId
+pattern DuckDBV2LogicalTypeIdUHugeInt = DuckDBV2LogicalTypeId 49
+
+{-| __C declaration:__ @DUCKDB_V2_LOGICAL_TYPE_ID_HUGEINT@
+
+    __defined at:__ @duckdb_v2.h 9020:2@
+
+    __exported by:__ @duckdb_v2.h@
+-}
+pattern DuckDBV2LogicalTypeIdHugeInt :: DuckDBV2LogicalTypeId
+pattern DuckDBV2LogicalTypeIdHugeInt = DuckDBV2LogicalTypeId 50
+
+{-| __C declaration:__ @DUCKDB_V2_LOGICAL_TYPE_ID_UUID@
+
+    __defined at:__ @duckdb_v2.h 9021:2@
+
+    __exported by:__ @duckdb_v2.h@
+-}
+pattern DuckDBV2LogicalTypeIdUUID :: DuckDBV2LogicalTypeId
+pattern DuckDBV2LogicalTypeIdUUID = DuckDBV2LogicalTypeId 54
+
+{-| Geometry (spatial extension).
+
+    __C declaration:__ @DUCKDB_V2_LOGICAL_TYPE_ID_GEOMETRY@
+
+    __defined at:__ @duckdb_v2.h 9024:2@
+
+    __exported by:__ @duckdb_v2.h@
+-}
+pattern DuckDBV2LogicalTypeIdGeometry :: DuckDBV2LogicalTypeId
+pattern DuckDBV2LogicalTypeIdGeometry = DuckDBV2LogicalTypeId 60
+
+{-| __C declaration:__ @DUCKDB_V2_LOGICAL_TYPE_ID_STRUCT@
+
+    __defined at:__ @duckdb_v2.h 9025:2@
+
+    __exported by:__ @duckdb_v2.h@
+-}
+pattern DuckDBV2LogicalTypeIdStruct :: DuckDBV2LogicalTypeId
+pattern DuckDBV2LogicalTypeIdStruct = DuckDBV2LogicalTypeId 100
+
+{-| __C declaration:__ @DUCKDB_V2_LOGICAL_TYPE_ID_LIST@
+
+    __defined at:__ @duckdb_v2.h 9026:2@
+
+    __exported by:__ @duckdb_v2.h@
+-}
+pattern DuckDBV2LogicalTypeIdList :: DuckDBV2LogicalTypeId
+pattern DuckDBV2LogicalTypeIdList = DuckDBV2LogicalTypeId 101
+
+{-| __C declaration:__ @DUCKDB_V2_LOGICAL_TYPE_ID_MAP@
+
+    __defined at:__ @duckdb_v2.h 9027:2@
+
+    __exported by:__ @duckdb_v2.h@
+-}
+pattern DuckDBV2LogicalTypeIdMap :: DuckDBV2LogicalTypeId
+pattern DuckDBV2LogicalTypeIdMap = DuckDBV2LogicalTypeId 102
+
+{-| __C declaration:__ @DUCKDB_V2_LOGICAL_TYPE_ID_ENUM@
+
+    __defined at:__ @duckdb_v2.h 9028:2@
+
+    __exported by:__ @duckdb_v2.h@
+-}
+pattern DuckDBV2LogicalTypeIdEnum :: DuckDBV2LogicalTypeId
+pattern DuckDBV2LogicalTypeIdEnum = DuckDBV2LogicalTypeId 104
+
+{-| __C declaration:__ @DUCKDB_V2_LOGICAL_TYPE_ID_UNION@
+
+    __defined at:__ @duckdb_v2.h 9029:2@
+
+    __exported by:__ @duckdb_v2.h@
+-}
+pattern DuckDBV2LogicalTypeIdUnion :: DuckDBV2LogicalTypeId
+pattern DuckDBV2LogicalTypeIdUnion = DuckDBV2LogicalTypeId 107
+
+{-| __C declaration:__ @DUCKDB_V2_LOGICAL_TYPE_ID_ARRAY@
+
+    __defined at:__ @duckdb_v2.h 9030:2@
+
+    __exported by:__ @duckdb_v2.h@
+-}
+pattern DuckDBV2LogicalTypeIdArray :: DuckDBV2LogicalTypeId
+pattern DuckDBV2LogicalTypeIdArray = DuckDBV2LogicalTypeId 108
+
+{-| __C declaration:__ @DUCKDB_V2_LOGICAL_TYPE_ID_VARIANT@
+
+    __defined at:__ @duckdb_v2.h 9031:2@
+
+    __exported by:__ @duckdb_v2.h@
+-}
+pattern DuckDBV2LogicalTypeIdVariant :: DuckDBV2LogicalTypeId
+pattern DuckDBV2LogicalTypeIdVariant = DuckDBV2LogicalTypeId 109
+
+{-| Unnamed struct; shares the physical representation of STRUCT.
+
+    __C declaration:__ @DUCKDB_V2_LOGICAL_TYPE_ID_TUPLE@
+
+    __defined at:__ @duckdb_v2.h 9034:2@
+
+    __exported by:__ @duckdb_v2.h@
+-}
+pattern DuckDBV2LogicalTypeIdTuple :: DuckDBV2LogicalTypeId
+pattern DuckDBV2LogicalTypeIdTuple = DuckDBV2LogicalTypeId 110
+
+{-| __C declaration:__ @DUCKDB_V2_LOGICAL_TYPE_ID_MAX_ENUM@
+
+    __defined at:__ @duckdb_v2.h 9035:2@
+
+    __exported by:__ @duckdb_v2.h@
+-}
+pattern DuckDBV2LogicalTypeIdMaxEnum :: DuckDBV2LogicalTypeId
+pattern DuckDBV2LogicalTypeIdMaxEnum = DuckDBV2LogicalTypeId 2147483647
+
+{-| The kind of a macro function, deciding how its body is read. Pass one to @duckdb_v2_macro_function_create()@ .
+
+    __C declaration:__ @enum DUCKDB_V2_MACRO_FUNCTION_TYPE@
+
+    __defined at:__ @duckdb_v2.h 9421:14@
+
+    __exported by:__ @duckdb_v2.h@
+-}
+newtype DuckDBV2MacroFunctionType = DuckDBV2MacroFunctionType
+  { unwrap :: BG.CUInt
+  }
+  deriving stock (Eq, BG.Generic, Ord)
+  deriving newtype (BG.HasFFIType)
+
+instance Marshal.StaticSize DuckDBV2MacroFunctionType where
+
+  staticSizeOf = \_ -> (4 :: Int)
+
+  staticAlignment = \_ -> (4 :: Int)
+
+instance Marshal.ReadRaw DuckDBV2MacroFunctionType where
+
+  readRaw =
+    \ptr0 ->
+          pure DuckDBV2MacroFunctionType
+      <*> Marshal.readRawByteOff ptr0 (0 :: Int)
+
+instance Marshal.WriteRaw DuckDBV2MacroFunctionType where
+
+  writeRaw =
+    \ptr0 ->
+      \s1 ->
+        case s1 of
+          DuckDBV2MacroFunctionType unwrap2 ->
+            Marshal.writeRawByteOff ptr0 (0 :: Int) unwrap2
+
+deriving via Marshal.EquivStorable DuckDBV2MacroFunctionType instance BG.Storable DuckDBV2MacroFunctionType
+
+deriving via BG.CUInt instance BG.Prim DuckDBV2MacroFunctionType
+
+instance CEnum.CEnum DuckDBV2MacroFunctionType where
+
+  type CEnumZ DuckDBV2MacroFunctionType = BG.CUInt
+
+  toCEnum = DuckDBV2MacroFunctionType
+
+  fromCEnum = BG.getField @"unwrap"
+
+  declaredValues =
+    \_ ->
+      CEnum.declaredValuesFromList [ (0, BG.singleton "DuckDBV2MacroFunctionTypeScalar")
+                                   , (1, BG.singleton "DuckDBV2MacroFunctionTypeTable")
+                                   , (2147483647, BG.singleton "DuckDBV2MacroFunctionTypeMaxEnum")
+                                   ]
+
+  showsUndeclared =
+    CEnum.showsWrappedUndeclared "DuckDBV2MacroFunctionType"
+
+  readPrecUndeclared =
+    CEnum.readPrecWrappedUndeclared "DuckDBV2MacroFunctionType"
+
+instance Show DuckDBV2MacroFunctionType where
+
+  showsPrec = CEnum.shows
+
+instance Read DuckDBV2MacroFunctionType where
+
+  readPrec = CEnum.readPrec
+
+  readList = BG.readListDefault
+
+  readListPrec = BG.readListPrecDefault
+
+instance ( ty ~ BG.CUInt
+         ) => BG.CompatHasField.HasField "unwrap" DuckDBV2MacroFunctionType ty where
+
+  hasField =
+    \x0 ->
+      (\y1 ->
+         DuckDBV2MacroFunctionType {unwrap = y1}, BG.getField @"unwrap" x0)
+
+instance ( ty ~ BG.CUInt
+         ) => BG.HasField "unwrap" (BG.Ptr DuckDBV2MacroFunctionType) (BG.Ptr ty) where
+
+  getField = HasCField.fromPtr (BG.Proxy @"unwrap")
+
+instance HasCField.HasCField DuckDBV2MacroFunctionType "unwrap" where
+
+  type CFieldType DuckDBV2MacroFunctionType "unwrap" =
+    BG.CUInt
+
+  offset# = \_ -> \_ -> 0
+
+{-| A scalar macro. The body is a single expression, and the macro is called like a scalar function.
+
+    __C declaration:__ @DUCKDB_V2_MACRO_FUNCTION_TYPE_SCALAR@
+
+    __defined at:__ @duckdb_v2.h 9423:2@
+
+    __exported by:__ @duckdb_v2.h@
+-}
+pattern DuckDBV2MacroFunctionTypeScalar :: DuckDBV2MacroFunctionType
+pattern DuckDBV2MacroFunctionTypeScalar = DuckDBV2MacroFunctionType 0
+
+{-| A table macro. The body is a single SELECT query, and the macro is called like a table function.
+
+    __C declaration:__ @DUCKDB_V2_MACRO_FUNCTION_TYPE_TABLE@
+
+    __defined at:__ @duckdb_v2.h 9426:2@
+
+    __exported by:__ @duckdb_v2.h@
+-}
+pattern DuckDBV2MacroFunctionTypeTable :: DuckDBV2MacroFunctionType
+pattern DuckDBV2MacroFunctionTypeTable = DuckDBV2MacroFunctionType 1
+
+{-| __C declaration:__ @DUCKDB_V2_MACRO_FUNCTION_TYPE_MAX_ENUM@
+
+    __defined at:__ @duckdb_v2.h 9427:2@
+
+    __exported by:__ @duckdb_v2.h@
+-}
+pattern DuckDBV2MacroFunctionTypeMaxEnum :: DuckDBV2MacroFunctionType
+pattern DuckDBV2MacroFunctionTypeMaxEnum = DuckDBV2MacroFunctionType 2147483647
+
+{-| An owned opaque handle to a macro function being built. Created with @duckdb_v2_macro_function_create()@ , configured with @duckdb_v2_macro_function_set_name()@ , @duckdb_v2_macro_function_set_body()@ and the signature obtained via @duckdb_v2_macro_function_get_signature()@ , made available with @duckdb_v2_extension_register_macro_function()@ , and destroyed with @duckdb_v2_macro_function_destroy()@ .
+
+    __C declaration:__ @struct _duckdb_v2_macro_function@
+
+    __defined at:__ @duckdb_v2.h 9440:16@
+
+    __exported by:__ @duckdb_v2.h@
+-}
+data DuckDBV2MacroFunctionStruct
+
+instance Marshal.StaticSize DuckDBV2MacroFunctionStruct where
+
+  staticSizeOf = \_ -> (8 :: Int)
+
+  staticAlignment = \_ -> (8 :: Int)
+
+{-| An owned opaque handle to a macro function being built. Created with @duckdb_v2_macro_function_create()@ , configured with @duckdb_v2_macro_function_set_name()@ , @duckdb_v2_macro_function_set_body()@ and the signature obtained via @duckdb_v2_macro_function_get_signature()@ , made available with @duckdb_v2_extension_register_macro_function()@ , and destroyed with @duckdb_v2_macro_function_destroy()@ .
+
+    __C declaration:__ @duckdb_v2_macro_function_handle@
+
+    __defined at:__ @duckdb_v2.h 9442:5@
+
+    __exported by:__ @duckdb_v2.h@
+-}
+newtype DuckDBV2MacroFunctionHandle = DuckDBV2MacroFunctionHandle
+  { unwrap :: BG.Ptr DuckDBV2MacroFunctionStruct
+  }
+  deriving stock (Eq, BG.Generic, Ord, Show)
+  deriving newtype
+    ( BG.HasFFIType
+    , Marshal.ReadRaw
+    , Marshal.StaticSize
+    , BG.Storable
+    , Marshal.WriteRaw
+    )
+
+instance ( ty ~ BG.Ptr DuckDBV2MacroFunctionStruct
+         ) => BG.CompatHasField.HasField "unwrap" DuckDBV2MacroFunctionHandle ty where
+
+  hasField =
+    \x0 ->
+      (\y1 ->
+         DuckDBV2MacroFunctionHandle {unwrap = y1}, BG.getField @"unwrap" x0)
+
+instance ( ty ~ BG.Ptr DuckDBV2MacroFunctionStruct
+         ) => BG.HasField "unwrap" (BG.Ptr DuckDBV2MacroFunctionHandle) (BG.Ptr ty) where
+
+  getField = HasCField.fromPtr (BG.Proxy @"unwrap")
+
+instance HasCField.HasCField DuckDBV2MacroFunctionHandle "unwrap" where
+
+  type CFieldType DuckDBV2MacroFunctionHandle "unwrap" =
+    BG.Ptr DuckDBV2MacroFunctionStruct
+
+  offset# = \_ -> \_ -> 0
+
+{-| An owned opaque handle to a custom pragma function being built. Created with @duckdb_v2_pragma_function_create()@ , configured with the setter functions (e.g. @duckdb_v2_pragma_function_set_name()@ , @duckdb_v2_pragma_function_set_query_callback()@ , etc.) and the signature obtained via @duckdb_v2_pragma_function_get_signature()@ , made available with @duckdb_v2_connection_register_pragma_function()@ or @duckdb_v2_extension_register_pragma_function()@ , and destroyed with @duckdb_v2_pragma_function_destroy()@ .
+
+    __C declaration:__ @struct _duckdb_v2_pragma_function@
+
+    __defined at:__ @duckdb_v2.h 9627:16@
+
+    __exported by:__ @duckdb_v2.h@
+-}
+data DuckDBV2PragmaFunctionStruct
+
+instance Marshal.StaticSize DuckDBV2PragmaFunctionStruct where
+
+  staticSizeOf = \_ -> (8 :: Int)
+
+  staticAlignment = \_ -> (8 :: Int)
+
+{-| An owned opaque handle to a custom pragma function being built. Created with @duckdb_v2_pragma_function_create()@ , configured with the setter functions (e.g. @duckdb_v2_pragma_function_set_name()@ , @duckdb_v2_pragma_function_set_query_callback()@ , etc.) and the signature obtained via @duckdb_v2_pragma_function_get_signature()@ , made available with @duckdb_v2_connection_register_pragma_function()@ or @duckdb_v2_extension_register_pragma_function()@ , and destroyed with @duckdb_v2_pragma_function_destroy()@ .
+
+    __C declaration:__ @duckdb_v2_pragma_function_handle@
+
+    __defined at:__ @duckdb_v2.h 9629:5@
+
+    __exported by:__ @duckdb_v2.h@
+-}
+newtype DuckDBV2PragmaFunctionHandle = DuckDBV2PragmaFunctionHandle
+  { unwrap :: BG.Ptr DuckDBV2PragmaFunctionStruct
+  }
+  deriving stock (Eq, BG.Generic, Ord, Show)
+  deriving newtype
+    ( BG.HasFFIType
+    , Marshal.ReadRaw
+    , Marshal.StaticSize
+    , BG.Storable
+    , Marshal.WriteRaw
+    )
+
+instance ( ty ~ BG.Ptr DuckDBV2PragmaFunctionStruct
+         ) => BG.CompatHasField.HasField "unwrap" DuckDBV2PragmaFunctionHandle ty where
+
+  hasField =
+    \x0 ->
+      (\y1 ->
+         DuckDBV2PragmaFunctionHandle {unwrap = y1}, BG.getField @"unwrap" x0)
+
+instance ( ty ~ BG.Ptr DuckDBV2PragmaFunctionStruct
+         ) => BG.HasField "unwrap" (BG.Ptr DuckDBV2PragmaFunctionHandle) (BG.Ptr ty) where
+
+  getField = HasCField.fromPtr (BG.Proxy @"unwrap")
+
+instance HasCField.HasCField DuckDBV2PragmaFunctionHandle "unwrap" where
+
+  type CFieldType DuckDBV2PragmaFunctionHandle "unwrap" =
+    BG.Ptr DuckDBV2PragmaFunctionStruct
+
+  offset# = \_ -> \_ -> 0
+
+{-| A borrowed opaque handle to the result of a pragma function\'s "query" callback. The query callback receives this handle next to a @t'DuckDBV2FunctionBindInfoHandle'@ , which gives access to the arguments and the user data, and uses it to set the query to run in place of the @PRAGMA@ statement.
+
+    __C declaration:__ @struct _duckdb_v2_pragma_function_query_info@
+
+    __defined at:__ @duckdb_v2.h 9636:16@
+
+    __exported by:__ @duckdb_v2.h@
+-}
+data DuckDBV2PragmaFunctionQueryInfoStruct
+
+instance Marshal.StaticSize DuckDBV2PragmaFunctionQueryInfoStruct where
+
+  staticSizeOf = \_ -> (8 :: Int)
+
+  staticAlignment = \_ -> (8 :: Int)
+
+{-| A borrowed opaque handle to the result of a pragma function\'s "query" callback. The query callback receives this handle next to a @t'DuckDBV2FunctionBindInfoHandle'@ , which gives access to the arguments and the user data, and uses it to set the query to run in place of the @PRAGMA@ statement.
+
+    __C declaration:__ @duckdb_v2_pragma_function_query_info_handle@
+
+    __defined at:__ @duckdb_v2.h 9638:5@
+
+    __exported by:__ @duckdb_v2.h@
+-}
+newtype DuckDBV2PragmaFunctionQueryInfoHandle = DuckDBV2PragmaFunctionQueryInfoHandle
+  { unwrap :: BG.Ptr DuckDBV2PragmaFunctionQueryInfoStruct
+  }
+  deriving stock (Eq, BG.Generic, Ord, Show)
+  deriving newtype
+    ( BG.HasFFIType
+    , Marshal.ReadRaw
+    , Marshal.StaticSize
+    , BG.Storable
+    , Marshal.WriteRaw
+    )
+
+instance ( ty ~ BG.Ptr DuckDBV2PragmaFunctionQueryInfoStruct
+         ) => BG.CompatHasField.HasField "unwrap" DuckDBV2PragmaFunctionQueryInfoHandle ty where
+
+  hasField =
+    \x0 ->
+      ( \y1 ->
+          DuckDBV2PragmaFunctionQueryInfoHandle {unwrap = y1}
+      , BG.getField @"unwrap" x0
+      )
+
+instance ( ty ~ BG.Ptr DuckDBV2PragmaFunctionQueryInfoStruct
+         ) => BG.HasField "unwrap" (BG.Ptr DuckDBV2PragmaFunctionQueryInfoHandle) (BG.Ptr ty) where
+
+  getField = HasCField.fromPtr (BG.Proxy @"unwrap")
+
+instance HasCField.HasCField DuckDBV2PragmaFunctionQueryInfoHandle "unwrap" where
+
+  type CFieldType DuckDBV2PragmaFunctionQueryInfoHandle "unwrap" =
+    BG.Ptr DuckDBV2PragmaFunctionQueryInfoStruct
+
+  offset# = \_ -> \_ -> 0
+
+{-| Auxiliary type used by t'DuckDBV2PragmaFunctionQueryCallbackFn'
+
+    __C declaration:__ @duckdb_v2_pragma_function_query_callback_fn@
+
+    __defined at:__ @duckdb_v2.h 9644:16@
+
+    __exported by:__ @duckdb_v2.h@
+-}
+newtype DuckDBV2PragmaFunctionQueryCallbackFn_Aux = DuckDBV2PragmaFunctionQueryCallbackFn_Aux
+  { unwrap :: DuckDBV2FunctionBindInfoHandle -> DuckDBV2PragmaFunctionQueryInfoHandle -> DuckDBV2ContextHandle -> BG.Ptr DuckDBV2ErrorInfoHandle -> IO ()
+  }
+  deriving stock (BG.Generic)
+
+-- __unique:__ @toDuckDBV2PragmaFunctionQueryCallbackFn_Aux@
+foreign import ccall safe "wrapper" hs_bindgen_c409e278a3c4e476_base ::
+     (BG.Ptr BG.Void -> BG.Ptr BG.Void -> BG.Ptr BG.Void -> BG.Ptr BG.Void -> IO ())
+  -> IO (BG.FunPtr (BG.Ptr BG.Void -> BG.Ptr BG.Void -> BG.Ptr BG.Void -> BG.Ptr BG.Void -> IO ()))
+
+-- __unique:__ @toDuckDBV2PragmaFunctionQueryCallbackFn_Aux@
+hs_bindgen_c409e278a3c4e476 ::
+     DuckDBV2PragmaFunctionQueryCallbackFn_Aux
+  -> IO (BG.FunPtr DuckDBV2PragmaFunctionQueryCallbackFn_Aux)
+hs_bindgen_c409e278a3c4e476 =
+  \fun0 ->
+    fmap BG.castFunPtr (hs_bindgen_c409e278a3c4e476_base (\x1 ->
+                                                            \x2 ->
+                                                              \x3 ->
+                                                                \x4 ->
+                                                                  BG.getField @"unwrap" fun0 (BG.fromFFIType x1) (BG.fromFFIType x2) (BG.fromFFIType x3) (BG.fromFFIType x4)))
+
+-- __unique:__ @fromDuckDBV2PragmaFunctionQueryCallbackFn_Aux@
+foreign import ccall safe "dynamic" hs_bindgen_581d17d645d79752_base ::
+     BG.FunPtr (BG.Ptr BG.Void -> BG.Ptr BG.Void -> BG.Ptr BG.Void -> BG.Ptr BG.Void -> IO ())
+  -> BG.Ptr BG.Void -> BG.Ptr BG.Void -> BG.Ptr BG.Void -> BG.Ptr BG.Void -> IO ()
+
+-- __unique:__ @fromDuckDBV2PragmaFunctionQueryCallbackFn_Aux@
+hs_bindgen_581d17d645d79752 ::
+     BG.FunPtr DuckDBV2PragmaFunctionQueryCallbackFn_Aux
+  -> DuckDBV2PragmaFunctionQueryCallbackFn_Aux
+hs_bindgen_581d17d645d79752 =
+  \funPtr0 ->
+    DuckDBV2PragmaFunctionQueryCallbackFn_Aux (\x1 ->
+                                                 \x2 ->
+                                                   \x3 ->
+                                                     \x4 ->
+                                                       hs_bindgen_581d17d645d79752_base (BG.castFunPtr funPtr0) (BG.toFFIType x1) (BG.toFFIType x2) (BG.toFFIType x3) (BG.toFFIType x4))
+
+instance BG.ToFunPtr DuckDBV2PragmaFunctionQueryCallbackFn_Aux where
+
+  toFunPtr = hs_bindgen_c409e278a3c4e476
+
+instance BG.FromFunPtr DuckDBV2PragmaFunctionQueryCallbackFn_Aux where
+
+  fromFunPtr = hs_bindgen_581d17d645d79752
+
+instance ( ty ~ (DuckDBV2FunctionBindInfoHandle -> DuckDBV2PragmaFunctionQueryInfoHandle -> DuckDBV2ContextHandle -> BG.Ptr DuckDBV2ErrorInfoHandle -> IO ())
+         ) => BG.CompatHasField.HasField "unwrap" DuckDBV2PragmaFunctionQueryCallbackFn_Aux ty where
+
+  hasField =
+    \x0 ->
+      ( \y1 ->
+          DuckDBV2PragmaFunctionQueryCallbackFn_Aux {unwrap = y1}
+      , BG.getField @"unwrap" x0
+      )
+
+instance ( ty ~ (DuckDBV2FunctionBindInfoHandle -> DuckDBV2PragmaFunctionQueryInfoHandle -> DuckDBV2ContextHandle -> BG.Ptr DuckDBV2ErrorInfoHandle -> IO ())
+         ) => BG.HasField "unwrap" (BG.Ptr DuckDBV2PragmaFunctionQueryCallbackFn_Aux) (BG.Ptr ty) where
+
+  getField = HasCField.fromPtr (BG.Proxy @"unwrap")
+
+instance HasCField.HasCField DuckDBV2PragmaFunctionQueryCallbackFn_Aux "unwrap" where
+
+  type CFieldType DuckDBV2PragmaFunctionQueryCallbackFn_Aux "unwrap" =
+    DuckDBV2FunctionBindInfoHandle -> DuckDBV2PragmaFunctionQueryInfoHandle -> DuckDBV2ContextHandle -> BG.Ptr DuckDBV2ErrorInfoHandle -> IO ()
+
+  offset# = \_ -> \_ -> 0
+
+{-| __C declaration:__ @duckdb_v2_pragma_function_query_callback_fn@
+
+    __defined at:__ @duckdb_v2.h 9644:16@
+
+    __exported by:__ @duckdb_v2.h@
+-}
+newtype DuckDBV2PragmaFunctionQueryCallbackFn = DuckDBV2PragmaFunctionQueryCallbackFn
+  { unwrap :: BG.FunPtr DuckDBV2PragmaFunctionQueryCallbackFn_Aux
+  }
+  deriving stock (Eq, BG.Generic, Ord, Show)
+  deriving newtype
+    ( BG.HasFFIType
+    , Marshal.ReadRaw
+    , Marshal.StaticSize
+    , BG.Storable
+    , Marshal.WriteRaw
+    )
+
+instance ( ty ~ BG.FunPtr DuckDBV2PragmaFunctionQueryCallbackFn_Aux
+         ) => BG.CompatHasField.HasField "unwrap" DuckDBV2PragmaFunctionQueryCallbackFn ty where
+
+  hasField =
+    \x0 ->
+      ( \y1 ->
+          DuckDBV2PragmaFunctionQueryCallbackFn {unwrap = y1}
+      , BG.getField @"unwrap" x0
+      )
+
+instance ( ty ~ BG.FunPtr DuckDBV2PragmaFunctionQueryCallbackFn_Aux
+         ) => BG.HasField "unwrap" (BG.Ptr DuckDBV2PragmaFunctionQueryCallbackFn) (BG.Ptr ty) where
+
+  getField = HasCField.fromPtr (BG.Proxy @"unwrap")
+
+instance HasCField.HasCField DuckDBV2PragmaFunctionQueryCallbackFn "unwrap" where
+
+  type CFieldType DuckDBV2PragmaFunctionQueryCallbackFn "unwrap" =
+    BG.FunPtr DuckDBV2PragmaFunctionQueryCallbackFn_Aux
+
+  offset# = \_ -> \_ -> 0
+
+{-| Auxiliary type used by t'DuckDBV2PragmaFunctionExecCallbackFn'
+
+    __C declaration:__ @duckdb_v2_pragma_function_exec_callback_fn@
+
+    __defined at:__ @duckdb_v2.h 9649:16@
+
+    __exported by:__ @duckdb_v2.h@
+-}
+newtype DuckDBV2PragmaFunctionExecCallbackFn_Aux = DuckDBV2PragmaFunctionExecCallbackFn_Aux
+  { unwrap :: DuckDBV2FunctionBindInfoHandle -> DuckDBV2ContextHandle -> BG.Ptr DuckDBV2ErrorInfoHandle -> IO ()
+  }
+  deriving stock (BG.Generic)
+
+-- __unique:__ @toDuckDBV2PragmaFunctionExecCallbackFn_Aux@
+foreign import ccall safe "wrapper" hs_bindgen_d2d15e8c02224d72_base ::
+     (BG.Ptr BG.Void -> BG.Ptr BG.Void -> BG.Ptr BG.Void -> IO ())
+  -> IO (BG.FunPtr (BG.Ptr BG.Void -> BG.Ptr BG.Void -> BG.Ptr BG.Void -> IO ()))
+
+-- __unique:__ @toDuckDBV2PragmaFunctionExecCallbackFn_Aux@
+hs_bindgen_d2d15e8c02224d72 ::
+     DuckDBV2PragmaFunctionExecCallbackFn_Aux
+  -> IO (BG.FunPtr DuckDBV2PragmaFunctionExecCallbackFn_Aux)
+hs_bindgen_d2d15e8c02224d72 =
+  \fun0 ->
+    fmap BG.castFunPtr (hs_bindgen_d2d15e8c02224d72_base (\x1 ->
+                                                            \x2 ->
+                                                              \x3 ->
+                                                                BG.getField @"unwrap" fun0 (BG.fromFFIType x1) (BG.fromFFIType x2) (BG.fromFFIType x3)))
+
+-- __unique:__ @fromDuckDBV2PragmaFunctionExecCallbackFn_Aux@
+foreign import ccall safe "dynamic" hs_bindgen_426128dd15473ee2_base ::
+     BG.FunPtr (BG.Ptr BG.Void -> BG.Ptr BG.Void -> BG.Ptr BG.Void -> IO ())
+  -> BG.Ptr BG.Void -> BG.Ptr BG.Void -> BG.Ptr BG.Void -> IO ()
+
+-- __unique:__ @fromDuckDBV2PragmaFunctionExecCallbackFn_Aux@
+hs_bindgen_426128dd15473ee2 ::
+     BG.FunPtr DuckDBV2PragmaFunctionExecCallbackFn_Aux
+  -> DuckDBV2PragmaFunctionExecCallbackFn_Aux
+hs_bindgen_426128dd15473ee2 =
+  \funPtr0 ->
+    DuckDBV2PragmaFunctionExecCallbackFn_Aux (\x1 ->
+                                                \x2 ->
+                                                  \x3 ->
+                                                    hs_bindgen_426128dd15473ee2_base (BG.castFunPtr funPtr0) (BG.toFFIType x1) (BG.toFFIType x2) (BG.toFFIType x3))
+
+instance BG.ToFunPtr DuckDBV2PragmaFunctionExecCallbackFn_Aux where
+
+  toFunPtr = hs_bindgen_d2d15e8c02224d72
+
+instance BG.FromFunPtr DuckDBV2PragmaFunctionExecCallbackFn_Aux where
+
+  fromFunPtr = hs_bindgen_426128dd15473ee2
+
+instance ( ty ~ (DuckDBV2FunctionBindInfoHandle -> DuckDBV2ContextHandle -> BG.Ptr DuckDBV2ErrorInfoHandle -> IO ())
+         ) => BG.CompatHasField.HasField "unwrap" DuckDBV2PragmaFunctionExecCallbackFn_Aux ty where
+
+  hasField =
+    \x0 ->
+      ( \y1 ->
+          DuckDBV2PragmaFunctionExecCallbackFn_Aux {unwrap = y1}
+      , BG.getField @"unwrap" x0
+      )
+
+instance ( ty ~ (DuckDBV2FunctionBindInfoHandle -> DuckDBV2ContextHandle -> BG.Ptr DuckDBV2ErrorInfoHandle -> IO ())
+         ) => BG.HasField "unwrap" (BG.Ptr DuckDBV2PragmaFunctionExecCallbackFn_Aux) (BG.Ptr ty) where
+
+  getField = HasCField.fromPtr (BG.Proxy @"unwrap")
+
+instance HasCField.HasCField DuckDBV2PragmaFunctionExecCallbackFn_Aux "unwrap" where
+
+  type CFieldType DuckDBV2PragmaFunctionExecCallbackFn_Aux "unwrap" =
+    DuckDBV2FunctionBindInfoHandle -> DuckDBV2ContextHandle -> BG.Ptr DuckDBV2ErrorInfoHandle -> IO ()
+
+  offset# = \_ -> \_ -> 0
+
+{-| __C declaration:__ @duckdb_v2_pragma_function_exec_callback_fn@
+
+    __defined at:__ @duckdb_v2.h 9649:16@
+
+    __exported by:__ @duckdb_v2.h@
+-}
+newtype DuckDBV2PragmaFunctionExecCallbackFn = DuckDBV2PragmaFunctionExecCallbackFn
+  { unwrap :: BG.FunPtr DuckDBV2PragmaFunctionExecCallbackFn_Aux
+  }
+  deriving stock (Eq, BG.Generic, Ord, Show)
+  deriving newtype
+    ( BG.HasFFIType
+    , Marshal.ReadRaw
+    , Marshal.StaticSize
+    , BG.Storable
+    , Marshal.WriteRaw
+    )
+
+instance ( ty ~ BG.FunPtr DuckDBV2PragmaFunctionExecCallbackFn_Aux
+         ) => BG.CompatHasField.HasField "unwrap" DuckDBV2PragmaFunctionExecCallbackFn ty where
+
+  hasField =
+    \x0 ->
+      ( \y1 ->
+          DuckDBV2PragmaFunctionExecCallbackFn {unwrap = y1}
+      , BG.getField @"unwrap" x0
+      )
+
+instance ( ty ~ BG.FunPtr DuckDBV2PragmaFunctionExecCallbackFn_Aux
+         ) => BG.HasField "unwrap" (BG.Ptr DuckDBV2PragmaFunctionExecCallbackFn) (BG.Ptr ty) where
+
+  getField = HasCField.fromPtr (BG.Proxy @"unwrap")
+
+instance HasCField.HasCField DuckDBV2PragmaFunctionExecCallbackFn "unwrap" where
+
+  type CFieldType DuckDBV2PragmaFunctionExecCallbackFn "unwrap" =
+    BG.FunPtr DuckDBV2PragmaFunctionExecCallbackFn_Aux
+
+  offset# = \_ -> \_ -> 0
+
+{-| An owned opaque handle to a replacement scan being built. Created with @duckdb_v2_replacement_scan_create()@ , configured with @duckdb_v2_replacement_scan_set_callback()@ and @duckdb_v2_replacement_scan_set_user_data()@ , made available with @duckdb_v2_connection_register_replacement_scan()@ , @duckdb_v2_instance_register_replacement_scan()@ or @duckdb_v2_extension_register_replacement_scan()@ , and destroyed with @duckdb_v2_replacement_scan_destroy()@ .
+
+    __C declaration:__ @struct _duckdb_v2_replacement_scan@
+
+    __defined at:__ @duckdb_v2.h 9917:16@
+
+    __exported by:__ @duckdb_v2.h@
+-}
+data DuckDBV2ReplacementScanStruct
+
+instance Marshal.StaticSize DuckDBV2ReplacementScanStruct where
+
+  staticSizeOf = \_ -> (8 :: Int)
+
+  staticAlignment = \_ -> (8 :: Int)
+
+{-| An owned opaque handle to a replacement scan being built. Created with @duckdb_v2_replacement_scan_create()@ , configured with @duckdb_v2_replacement_scan_set_callback()@ and @duckdb_v2_replacement_scan_set_user_data()@ , made available with @duckdb_v2_connection_register_replacement_scan()@ , @duckdb_v2_instance_register_replacement_scan()@ or @duckdb_v2_extension_register_replacement_scan()@ , and destroyed with @duckdb_v2_replacement_scan_destroy()@ .
+
+    __C declaration:__ @duckdb_v2_replacement_scan_handle@
+
+    __defined at:__ @duckdb_v2.h 9919:5@
+
+    __exported by:__ @duckdb_v2.h@
+-}
+newtype DuckDBV2ReplacementScanHandle = DuckDBV2ReplacementScanHandle
+  { unwrap :: BG.Ptr DuckDBV2ReplacementScanStruct
+  }
+  deriving stock (Eq, BG.Generic, Ord, Show)
+  deriving newtype
+    ( BG.HasFFIType
+    , Marshal.ReadRaw
+    , Marshal.StaticSize
+    , BG.Storable
+    , Marshal.WriteRaw
+    )
+
+instance ( ty ~ BG.Ptr DuckDBV2ReplacementScanStruct
+         ) => BG.CompatHasField.HasField "unwrap" DuckDBV2ReplacementScanHandle ty where
+
+  hasField =
+    \x0 ->
+      ( \y1 -> DuckDBV2ReplacementScanHandle {unwrap = y1}
+      , BG.getField @"unwrap" x0
+      )
+
+instance ( ty ~ BG.Ptr DuckDBV2ReplacementScanStruct
+         ) => BG.HasField "unwrap" (BG.Ptr DuckDBV2ReplacementScanHandle) (BG.Ptr ty) where
+
+  getField = HasCField.fromPtr (BG.Proxy @"unwrap")
+
+instance HasCField.HasCField DuckDBV2ReplacementScanHandle "unwrap" where
+
+  type CFieldType DuckDBV2ReplacementScanHandle "unwrap" =
+    BG.Ptr DuckDBV2ReplacementScanStruct
+
+  offset# = \_ -> \_ -> 0
+
+{-| A borrowed opaque handle to the arguments supplied to a replacement scan when the binder consults it. The callback receives this handle and can use it to inspect the unresolved name and to claim it by naming what to read instead. Valid only for the duration of the callback; the name it hands out is owned separately and outlives it.
+
+    __C declaration:__ @struct _duckdb_v2_replacement_scan_info@
+
+    __defined at:__ @duckdb_v2.h 9926:16@
+
+    __exported by:__ @duckdb_v2.h@
+-}
+data DuckDBV2ReplacementScanInfoStruct
+
+instance Marshal.StaticSize DuckDBV2ReplacementScanInfoStruct where
+
+  staticSizeOf = \_ -> (8 :: Int)
+
+  staticAlignment = \_ -> (8 :: Int)
+
+{-| A borrowed opaque handle to the arguments supplied to a replacement scan when the binder consults it. The callback receives this handle and can use it to inspect the unresolved name and to claim it by naming what to read instead. Valid only for the duration of the callback; the name it hands out is owned separately and outlives it.
+
+    __C declaration:__ @duckdb_v2_replacement_scan_info_handle@
+
+    __defined at:__ @duckdb_v2.h 9928:5@
+
+    __exported by:__ @duckdb_v2.h@
+-}
+newtype DuckDBV2ReplacementScanInfoHandle = DuckDBV2ReplacementScanInfoHandle
+  { unwrap :: BG.Ptr DuckDBV2ReplacementScanInfoStruct
+  }
+  deriving stock (Eq, BG.Generic, Ord, Show)
+  deriving newtype
+    ( BG.HasFFIType
+    , Marshal.ReadRaw
+    , Marshal.StaticSize
+    , BG.Storable
+    , Marshal.WriteRaw
+    )
+
+instance ( ty ~ BG.Ptr DuckDBV2ReplacementScanInfoStruct
+         ) => BG.CompatHasField.HasField "unwrap" DuckDBV2ReplacementScanInfoHandle ty where
+
+  hasField =
+    \x0 ->
+      ( \y1 ->
+          DuckDBV2ReplacementScanInfoHandle {unwrap = y1}
+      , BG.getField @"unwrap" x0
+      )
+
+instance ( ty ~ BG.Ptr DuckDBV2ReplacementScanInfoStruct
+         ) => BG.HasField "unwrap" (BG.Ptr DuckDBV2ReplacementScanInfoHandle) (BG.Ptr ty) where
+
+  getField = HasCField.fromPtr (BG.Proxy @"unwrap")
+
+instance HasCField.HasCField DuckDBV2ReplacementScanInfoHandle "unwrap" where
+
+  type CFieldType DuckDBV2ReplacementScanInfoHandle "unwrap" =
+    BG.Ptr DuckDBV2ReplacementScanInfoStruct
+
+  offset# = \_ -> \_ -> 0
+
+{-| Auxiliary type used by t'DuckDBV2ReplacementScanCallbackFn'
+
+    __C declaration:__ @duckdb_v2_replacement_scan_callback_fn@
+
+    __defined at:__ @duckdb_v2.h 9934:16@
+
+    __exported by:__ @duckdb_v2.h@
+-}
+newtype DuckDBV2ReplacementScanCallbackFn_Aux = DuckDBV2ReplacementScanCallbackFn_Aux
+  { unwrap :: DuckDBV2ReplacementScanInfoHandle -> DuckDBV2ContextHandle -> BG.Ptr DuckDBV2ErrorInfoHandle -> IO ()
+  }
+  deriving stock (BG.Generic)
+
+-- __unique:__ @toDuckDBV2ReplacementScanCallbackFn_Aux@
+foreign import ccall safe "wrapper" hs_bindgen_00d9b6a3eb7dba99_base ::
+     (BG.Ptr BG.Void -> BG.Ptr BG.Void -> BG.Ptr BG.Void -> IO ())
+  -> IO (BG.FunPtr (BG.Ptr BG.Void -> BG.Ptr BG.Void -> BG.Ptr BG.Void -> IO ()))
+
+-- __unique:__ @toDuckDBV2ReplacementScanCallbackFn_Aux@
+hs_bindgen_00d9b6a3eb7dba99 ::
+     DuckDBV2ReplacementScanCallbackFn_Aux
+  -> IO (BG.FunPtr DuckDBV2ReplacementScanCallbackFn_Aux)
+hs_bindgen_00d9b6a3eb7dba99 =
+  \fun0 ->
+    fmap BG.castFunPtr (hs_bindgen_00d9b6a3eb7dba99_base (\x1 ->
+                                                            \x2 ->
+                                                              \x3 ->
+                                                                BG.getField @"unwrap" fun0 (BG.fromFFIType x1) (BG.fromFFIType x2) (BG.fromFFIType x3)))
+
+-- __unique:__ @fromDuckDBV2ReplacementScanCallbackFn_Aux@
+foreign import ccall safe "dynamic" hs_bindgen_52f3a53236bdcbd5_base ::
+     BG.FunPtr (BG.Ptr BG.Void -> BG.Ptr BG.Void -> BG.Ptr BG.Void -> IO ())
+  -> BG.Ptr BG.Void -> BG.Ptr BG.Void -> BG.Ptr BG.Void -> IO ()
+
+-- __unique:__ @fromDuckDBV2ReplacementScanCallbackFn_Aux@
+hs_bindgen_52f3a53236bdcbd5 ::
+     BG.FunPtr DuckDBV2ReplacementScanCallbackFn_Aux
+  -> DuckDBV2ReplacementScanCallbackFn_Aux
+hs_bindgen_52f3a53236bdcbd5 =
+  \funPtr0 ->
+    DuckDBV2ReplacementScanCallbackFn_Aux (\x1 ->
+                                             \x2 ->
+                                               \x3 ->
+                                                 hs_bindgen_52f3a53236bdcbd5_base (BG.castFunPtr funPtr0) (BG.toFFIType x1) (BG.toFFIType x2) (BG.toFFIType x3))
+
+instance BG.ToFunPtr DuckDBV2ReplacementScanCallbackFn_Aux where
+
+  toFunPtr = hs_bindgen_00d9b6a3eb7dba99
+
+instance BG.FromFunPtr DuckDBV2ReplacementScanCallbackFn_Aux where
+
+  fromFunPtr = hs_bindgen_52f3a53236bdcbd5
+
+instance ( ty ~ (DuckDBV2ReplacementScanInfoHandle -> DuckDBV2ContextHandle -> BG.Ptr DuckDBV2ErrorInfoHandle -> IO ())
+         ) => BG.CompatHasField.HasField "unwrap" DuckDBV2ReplacementScanCallbackFn_Aux ty where
+
+  hasField =
+    \x0 ->
+      ( \y1 ->
+          DuckDBV2ReplacementScanCallbackFn_Aux {unwrap = y1}
+      , BG.getField @"unwrap" x0
+      )
+
+instance ( ty ~ (DuckDBV2ReplacementScanInfoHandle -> DuckDBV2ContextHandle -> BG.Ptr DuckDBV2ErrorInfoHandle -> IO ())
+         ) => BG.HasField "unwrap" (BG.Ptr DuckDBV2ReplacementScanCallbackFn_Aux) (BG.Ptr ty) where
+
+  getField = HasCField.fromPtr (BG.Proxy @"unwrap")
+
+instance HasCField.HasCField DuckDBV2ReplacementScanCallbackFn_Aux "unwrap" where
+
+  type CFieldType DuckDBV2ReplacementScanCallbackFn_Aux "unwrap" =
+    DuckDBV2ReplacementScanInfoHandle -> DuckDBV2ContextHandle -> BG.Ptr DuckDBV2ErrorInfoHandle -> IO ()
+
+  offset# = \_ -> \_ -> 0
+
+{-| __C declaration:__ @duckdb_v2_replacement_scan_callback_fn@
+
+    __defined at:__ @duckdb_v2.h 9934:16@
+
+    __exported by:__ @duckdb_v2.h@
+-}
+newtype DuckDBV2ReplacementScanCallbackFn = DuckDBV2ReplacementScanCallbackFn
+  { unwrap :: BG.FunPtr DuckDBV2ReplacementScanCallbackFn_Aux
+  }
+  deriving stock (Eq, BG.Generic, Ord, Show)
+  deriving newtype
+    ( BG.HasFFIType
+    , Marshal.ReadRaw
+    , Marshal.StaticSize
+    , BG.Storable
+    , Marshal.WriteRaw
+    )
+
+instance ( ty ~ BG.FunPtr DuckDBV2ReplacementScanCallbackFn_Aux
+         ) => BG.CompatHasField.HasField "unwrap" DuckDBV2ReplacementScanCallbackFn ty where
+
+  hasField =
+    \x0 ->
+      ( \y1 ->
+          DuckDBV2ReplacementScanCallbackFn {unwrap = y1}
+      , BG.getField @"unwrap" x0
+      )
+
+instance ( ty ~ BG.FunPtr DuckDBV2ReplacementScanCallbackFn_Aux
+         ) => BG.HasField "unwrap" (BG.Ptr DuckDBV2ReplacementScanCallbackFn) (BG.Ptr ty) where
+
+  getField = HasCField.fromPtr (BG.Proxy @"unwrap")
+
+instance HasCField.HasCField DuckDBV2ReplacementScanCallbackFn "unwrap" where
+
+  type CFieldType DuckDBV2ReplacementScanCallbackFn "unwrap" =
+    BG.FunPtr DuckDBV2ReplacementScanCallbackFn_Aux
+
+  offset# = \_ -> \_ -> 0
+
+{-| An owned opaque handle to a custom scalar function being built. Created with @duckdb_v2_scalar_function_create()@ , configured with the setter functions (e.g. @duckdb_v2_scalar_function_set_name()@ , @duckdb_v2_scalar_function_set_exec_callback()@ , etc.) and the signature obtained via @duckdb_v2_scalar_function_get_signature()@ , made available with @duckdb_v2_connection_register_scalar_function()@ or @duckdb_v2_extension_register_scalar_function()@ , and destroyed with @duckdb_v2_scalar_function_destroy()@ .
+
+    __C declaration:__ @struct _duckdb_v2_scalar_function@
+
+    __defined at:__ @duckdb_v2.h 10330:16@
+
+    __exported by:__ @duckdb_v2.h@
+-}
+data DuckDBV2ScalarFunctionStruct
+
+instance Marshal.StaticSize DuckDBV2ScalarFunctionStruct where
+
+  staticSizeOf = \_ -> (8 :: Int)
+
+  staticAlignment = \_ -> (8 :: Int)
+
+{-| An owned opaque handle to a custom scalar function being built. Created with @duckdb_v2_scalar_function_create()@ , configured with the setter functions (e.g. @duckdb_v2_scalar_function_set_name()@ , @duckdb_v2_scalar_function_set_exec_callback()@ , etc.) and the signature obtained via @duckdb_v2_scalar_function_get_signature()@ , made available with @duckdb_v2_connection_register_scalar_function()@ or @duckdb_v2_extension_register_scalar_function()@ , and destroyed with @duckdb_v2_scalar_function_destroy()@ .
+
+    __C declaration:__ @duckdb_v2_scalar_function_handle@
+
+    __defined at:__ @duckdb_v2.h 10332:5@
+
+    __exported by:__ @duckdb_v2.h@
+-}
+newtype DuckDBV2ScalarFunctionHandle = DuckDBV2ScalarFunctionHandle
+  { unwrap :: BG.Ptr DuckDBV2ScalarFunctionStruct
+  }
+  deriving stock (Eq, BG.Generic, Ord, Show)
+  deriving newtype
+    ( BG.HasFFIType
+    , Marshal.ReadRaw
+    , Marshal.StaticSize
+    , BG.Storable
+    , Marshal.WriteRaw
+    )
+
+instance ( ty ~ BG.Ptr DuckDBV2ScalarFunctionStruct
+         ) => BG.CompatHasField.HasField "unwrap" DuckDBV2ScalarFunctionHandle ty where
+
+  hasField =
+    \x0 ->
+      (\y1 ->
+         DuckDBV2ScalarFunctionHandle {unwrap = y1}, BG.getField @"unwrap" x0)
+
+instance ( ty ~ BG.Ptr DuckDBV2ScalarFunctionStruct
+         ) => BG.HasField "unwrap" (BG.Ptr DuckDBV2ScalarFunctionHandle) (BG.Ptr ty) where
+
+  getField = HasCField.fromPtr (BG.Proxy @"unwrap")
+
+instance HasCField.HasCField DuckDBV2ScalarFunctionHandle "unwrap" where
+
+  type CFieldType DuckDBV2ScalarFunctionHandle "unwrap" =
+    BG.Ptr DuckDBV2ScalarFunctionStruct
+
+  offset# = \_ -> \_ -> 0
+
+{-| A borrowed opaque handle to the result of a scalar function\'s "resolve types" phase. The "resolve types" callback receives this handle next to a @t'DuckDBV2FunctionBindInfoHandle'@ , which gives access to the arguments and the user data, and can use it to set the return type of the call site being bound.
+
+    __C declaration:__ @struct _duckdb_v2_scalar_function_resolve_types_info@
+
+    __defined at:__ @duckdb_v2.h 10339:16@
+
+    __exported by:__ @duckdb_v2.h@
+-}
+data DuckDBV2ScalarFunctionResolveTypesInfoStruct
+
+instance Marshal.StaticSize DuckDBV2ScalarFunctionResolveTypesInfoStruct where
+
+  staticSizeOf = \_ -> (8 :: Int)
+
+  staticAlignment = \_ -> (8 :: Int)
+
+{-| A borrowed opaque handle to the result of a scalar function\'s "resolve types" phase. The "resolve types" callback receives this handle next to a @t'DuckDBV2FunctionBindInfoHandle'@ , which gives access to the arguments and the user data, and can use it to set the return type of the call site being bound.
+
+    __C declaration:__ @duckdb_v2_scalar_function_resolve_types_info_handle@
+
+    __defined at:__ @duckdb_v2.h 10341:5@
+
+    __exported by:__ @duckdb_v2.h@
+-}
+newtype DuckDBV2ScalarFunctionResolveTypesInfoHandle = DuckDBV2ScalarFunctionResolveTypesInfoHandle
+  { unwrap :: BG.Ptr DuckDBV2ScalarFunctionResolveTypesInfoStruct
+  }
+  deriving stock (Eq, BG.Generic, Ord, Show)
+  deriving newtype
+    ( BG.HasFFIType
+    , Marshal.ReadRaw
+    , Marshal.StaticSize
+    , BG.Storable
+    , Marshal.WriteRaw
+    )
+
+instance ( ty ~ BG.Ptr DuckDBV2ScalarFunctionResolveTypesInfoStruct
+         ) => BG.CompatHasField.HasField "unwrap" DuckDBV2ScalarFunctionResolveTypesInfoHandle ty where
+
+  hasField =
+    \x0 ->
+      ( \y1 ->
+          DuckDBV2ScalarFunctionResolveTypesInfoHandle {unwrap = y1}
+      , BG.getField @"unwrap" x0
+      )
+
+instance ( ty ~ BG.Ptr DuckDBV2ScalarFunctionResolveTypesInfoStruct
+         ) => BG.HasField "unwrap" (BG.Ptr DuckDBV2ScalarFunctionResolveTypesInfoHandle) (BG.Ptr ty) where
+
+  getField = HasCField.fromPtr (BG.Proxy @"unwrap")
+
+instance HasCField.HasCField DuckDBV2ScalarFunctionResolveTypesInfoHandle "unwrap" where
+
+  type CFieldType DuckDBV2ScalarFunctionResolveTypesInfoHandle "unwrap" =
+    BG.Ptr DuckDBV2ScalarFunctionResolveTypesInfoStruct
+
+  offset# = \_ -> \_ -> 0
+
+{-| A borrowed opaque handle to the result of a scalar function\'s "bind" phase. The "bind" callback receives this handle next to a @t'DuckDBV2FunctionBindInfoHandle'@ , which gives access to the arguments and the user data, and can use it to set the bind data of the call site being bound.
+
+    __C declaration:__ @struct _duckdb_v2_scalar_function_bind_info@
+
+    __defined at:__ @duckdb_v2.h 10348:16@
+
+    __exported by:__ @duckdb_v2.h@
+-}
+data DuckDBV2ScalarFunctionBindInfoStruct
+
+instance Marshal.StaticSize DuckDBV2ScalarFunctionBindInfoStruct where
+
+  staticSizeOf = \_ -> (8 :: Int)
+
+  staticAlignment = \_ -> (8 :: Int)
+
+{-| A borrowed opaque handle to the result of a scalar function\'s "bind" phase. The "bind" callback receives this handle next to a @t'DuckDBV2FunctionBindInfoHandle'@ , which gives access to the arguments and the user data, and can use it to set the bind data of the call site being bound.
+
+    __C declaration:__ @duckdb_v2_scalar_function_bind_info_handle@
+
+    __defined at:__ @duckdb_v2.h 10350:5@
+
+    __exported by:__ @duckdb_v2.h@
+-}
+newtype DuckDBV2ScalarFunctionBindInfoHandle = DuckDBV2ScalarFunctionBindInfoHandle
+  { unwrap :: BG.Ptr DuckDBV2ScalarFunctionBindInfoStruct
+  }
+  deriving stock (Eq, BG.Generic, Ord, Show)
+  deriving newtype
+    ( BG.HasFFIType
+    , Marshal.ReadRaw
+    , Marshal.StaticSize
+    , BG.Storable
+    , Marshal.WriteRaw
+    )
+
+instance ( ty ~ BG.Ptr DuckDBV2ScalarFunctionBindInfoStruct
+         ) => BG.CompatHasField.HasField "unwrap" DuckDBV2ScalarFunctionBindInfoHandle ty where
+
+  hasField =
+    \x0 ->
+      ( \y1 ->
+          DuckDBV2ScalarFunctionBindInfoHandle {unwrap = y1}
+      , BG.getField @"unwrap" x0
+      )
+
+instance ( ty ~ BG.Ptr DuckDBV2ScalarFunctionBindInfoStruct
+         ) => BG.HasField "unwrap" (BG.Ptr DuckDBV2ScalarFunctionBindInfoHandle) (BG.Ptr ty) where
+
+  getField = HasCField.fromPtr (BG.Proxy @"unwrap")
+
+instance HasCField.HasCField DuckDBV2ScalarFunctionBindInfoHandle "unwrap" where
+
+  type CFieldType DuckDBV2ScalarFunctionBindInfoHandle "unwrap" =
+    BG.Ptr DuckDBV2ScalarFunctionBindInfoStruct
+
+  offset# = \_ -> \_ -> 0
+
+{-| A borrowed opaque handle to the arguments supplied to a scalar function during the local state initialization "init" phase. The "init" callback receives this handle and can use it to e.g. set up local state reusable across invocations of the "exec" execution callback.
+
+    __C declaration:__ @struct _duckdb_v2_scalar_function_init_info@
+
+    __defined at:__ @duckdb_v2.h 10357:16@
+
+    __exported by:__ @duckdb_v2.h@
+-}
+data DuckDBV2ScalarFunctionInitInfoStruct
+
+instance Marshal.StaticSize DuckDBV2ScalarFunctionInitInfoStruct where
+
+  staticSizeOf = \_ -> (8 :: Int)
+
+  staticAlignment = \_ -> (8 :: Int)
+
+{-| A borrowed opaque handle to the arguments supplied to a scalar function during the local state initialization "init" phase. The "init" callback receives this handle and can use it to e.g. set up local state reusable across invocations of the "exec" execution callback.
+
+    __C declaration:__ @duckdb_v2_scalar_function_init_info_handle@
+
+    __defined at:__ @duckdb_v2.h 10359:5@
+
+    __exported by:__ @duckdb_v2.h@
+-}
+newtype DuckDBV2ScalarFunctionInitInfoHandle = DuckDBV2ScalarFunctionInitInfoHandle
+  { unwrap :: BG.Ptr DuckDBV2ScalarFunctionInitInfoStruct
+  }
+  deriving stock (Eq, BG.Generic, Ord, Show)
+  deriving newtype
+    ( BG.HasFFIType
+    , Marshal.ReadRaw
+    , Marshal.StaticSize
+    , BG.Storable
+    , Marshal.WriteRaw
+    )
+
+instance ( ty ~ BG.Ptr DuckDBV2ScalarFunctionInitInfoStruct
+         ) => BG.CompatHasField.HasField "unwrap" DuckDBV2ScalarFunctionInitInfoHandle ty where
+
+  hasField =
+    \x0 ->
+      ( \y1 ->
+          DuckDBV2ScalarFunctionInitInfoHandle {unwrap = y1}
+      , BG.getField @"unwrap" x0
+      )
+
+instance ( ty ~ BG.Ptr DuckDBV2ScalarFunctionInitInfoStruct
+         ) => BG.HasField "unwrap" (BG.Ptr DuckDBV2ScalarFunctionInitInfoHandle) (BG.Ptr ty) where
+
+  getField = HasCField.fromPtr (BG.Proxy @"unwrap")
+
+instance HasCField.HasCField DuckDBV2ScalarFunctionInitInfoHandle "unwrap" where
+
+  type CFieldType DuckDBV2ScalarFunctionInitInfoHandle "unwrap" =
+    BG.Ptr DuckDBV2ScalarFunctionInitInfoStruct
+
+  offset# = \_ -> \_ -> 0
+
+{-| A borrowed opaque handle to the arguments supplied to a scalar function during the execution "exec" phase. The "exec" callback receives this handle and can use it to e.g. access the input argument vectors, retrieve the number of rows to process, and write results to the output vector.
+
+    __C declaration:__ @struct _duckdb_v2_scalar_function_exec_info@
+
+    __defined at:__ @duckdb_v2.h 10366:16@
+
+    __exported by:__ @duckdb_v2.h@
+-}
+data DuckDBV2ScalarFunctionExecInfoStruct
+
+instance Marshal.StaticSize DuckDBV2ScalarFunctionExecInfoStruct where
+
+  staticSizeOf = \_ -> (8 :: Int)
+
+  staticAlignment = \_ -> (8 :: Int)
+
+{-| A borrowed opaque handle to the arguments supplied to a scalar function during the execution "exec" phase. The "exec" callback receives this handle and can use it to e.g. access the input argument vectors, retrieve the number of rows to process, and write results to the output vector.
+
+    __C declaration:__ @duckdb_v2_scalar_function_exec_info_handle@
+
+    __defined at:__ @duckdb_v2.h 10368:5@
+
+    __exported by:__ @duckdb_v2.h@
+-}
+newtype DuckDBV2ScalarFunctionExecInfoHandle = DuckDBV2ScalarFunctionExecInfoHandle
+  { unwrap :: BG.Ptr DuckDBV2ScalarFunctionExecInfoStruct
+  }
+  deriving stock (Eq, BG.Generic, Ord, Show)
+  deriving newtype
+    ( BG.HasFFIType
+    , Marshal.ReadRaw
+    , Marshal.StaticSize
+    , BG.Storable
+    , Marshal.WriteRaw
+    )
+
+instance ( ty ~ BG.Ptr DuckDBV2ScalarFunctionExecInfoStruct
+         ) => BG.CompatHasField.HasField "unwrap" DuckDBV2ScalarFunctionExecInfoHandle ty where
+
+  hasField =
+    \x0 ->
+      ( \y1 ->
+          DuckDBV2ScalarFunctionExecInfoHandle {unwrap = y1}
+      , BG.getField @"unwrap" x0
+      )
+
+instance ( ty ~ BG.Ptr DuckDBV2ScalarFunctionExecInfoStruct
+         ) => BG.HasField "unwrap" (BG.Ptr DuckDBV2ScalarFunctionExecInfoHandle) (BG.Ptr ty) where
+
+  getField = HasCField.fromPtr (BG.Proxy @"unwrap")
+
+instance HasCField.HasCField DuckDBV2ScalarFunctionExecInfoHandle "unwrap" where
+
+  type CFieldType DuckDBV2ScalarFunctionExecInfoHandle "unwrap" =
+    BG.Ptr DuckDBV2ScalarFunctionExecInfoStruct
+
+  offset# = \_ -> \_ -> 0
+
+{-| Auxiliary type used by t'DuckDBV2ScalarFunctionResolveTypesCallbackFn'
+
+    __C declaration:__ @duckdb_v2_scalar_function_resolve_types_callback_fn@
+
+    __defined at:__ @duckdb_v2.h 10374:16@
+
+    __exported by:__ @duckdb_v2.h@
+-}
+newtype DuckDBV2ScalarFunctionResolveTypesCallbackFn_Aux = DuckDBV2ScalarFunctionResolveTypesCallbackFn_Aux
+  { unwrap :: DuckDBV2FunctionBindInfoHandle -> DuckDBV2ScalarFunctionResolveTypesInfoHandle -> DuckDBV2ContextHandle -> BG.Ptr DuckDBV2ErrorInfoHandle -> IO ()
+  }
+  deriving stock (BG.Generic)
+
+-- __unique:__ @toDuckDBV2ScalarFunctionResolveTypesCallbackFn_Aux@
+foreign import ccall safe "wrapper" hs_bindgen_d33bd58cba751dd5_base ::
+     (BG.Ptr BG.Void -> BG.Ptr BG.Void -> BG.Ptr BG.Void -> BG.Ptr BG.Void -> IO ())
+  -> IO (BG.FunPtr (BG.Ptr BG.Void -> BG.Ptr BG.Void -> BG.Ptr BG.Void -> BG.Ptr BG.Void -> IO ()))
+
+-- __unique:__ @toDuckDBV2ScalarFunctionResolveTypesCallbackFn_Aux@
+hs_bindgen_d33bd58cba751dd5 ::
+     DuckDBV2ScalarFunctionResolveTypesCallbackFn_Aux
+  -> IO (BG.FunPtr DuckDBV2ScalarFunctionResolveTypesCallbackFn_Aux)
+hs_bindgen_d33bd58cba751dd5 =
+  \fun0 ->
+    fmap BG.castFunPtr (hs_bindgen_d33bd58cba751dd5_base (\x1 ->
+                                                            \x2 ->
+                                                              \x3 ->
+                                                                \x4 ->
+                                                                  BG.getField @"unwrap" fun0 (BG.fromFFIType x1) (BG.fromFFIType x2) (BG.fromFFIType x3) (BG.fromFFIType x4)))
+
+-- __unique:__ @fromDuckDBV2ScalarFunctionResolveTypesCallbackFn_Aux@
+foreign import ccall safe "dynamic" hs_bindgen_8a70a297e8108d0c_base ::
+     BG.FunPtr (BG.Ptr BG.Void -> BG.Ptr BG.Void -> BG.Ptr BG.Void -> BG.Ptr BG.Void -> IO ())
+  -> BG.Ptr BG.Void -> BG.Ptr BG.Void -> BG.Ptr BG.Void -> BG.Ptr BG.Void -> IO ()
+
+-- __unique:__ @fromDuckDBV2ScalarFunctionResolveTypesCallbackFn_Aux@
+hs_bindgen_8a70a297e8108d0c ::
+     BG.FunPtr DuckDBV2ScalarFunctionResolveTypesCallbackFn_Aux
+  -> DuckDBV2ScalarFunctionResolveTypesCallbackFn_Aux
+hs_bindgen_8a70a297e8108d0c =
+  \funPtr0 ->
+    DuckDBV2ScalarFunctionResolveTypesCallbackFn_Aux (\x1 ->
+                                                        \x2 ->
+                                                          \x3 ->
+                                                            \x4 ->
+                                                              hs_bindgen_8a70a297e8108d0c_base (BG.castFunPtr funPtr0) (BG.toFFIType x1) (BG.toFFIType x2) (BG.toFFIType x3) (BG.toFFIType x4))
+
+instance BG.ToFunPtr DuckDBV2ScalarFunctionResolveTypesCallbackFn_Aux where
+
+  toFunPtr = hs_bindgen_d33bd58cba751dd5
+
+instance BG.FromFunPtr DuckDBV2ScalarFunctionResolveTypesCallbackFn_Aux where
+
+  fromFunPtr = hs_bindgen_8a70a297e8108d0c
+
+instance ( ty ~ (DuckDBV2FunctionBindInfoHandle -> DuckDBV2ScalarFunctionResolveTypesInfoHandle -> DuckDBV2ContextHandle -> BG.Ptr DuckDBV2ErrorInfoHandle -> IO ())
+         ) => BG.CompatHasField.HasField "unwrap" DuckDBV2ScalarFunctionResolveTypesCallbackFn_Aux ty where
+
+  hasField =
+    \x0 ->
+      ( \y1 ->
+          DuckDBV2ScalarFunctionResolveTypesCallbackFn_Aux {unwrap = y1}
+      , BG.getField @"unwrap" x0
+      )
+
+instance ( ty ~ (DuckDBV2FunctionBindInfoHandle -> DuckDBV2ScalarFunctionResolveTypesInfoHandle -> DuckDBV2ContextHandle -> BG.Ptr DuckDBV2ErrorInfoHandle -> IO ())
+         ) => BG.HasField "unwrap" (BG.Ptr DuckDBV2ScalarFunctionResolveTypesCallbackFn_Aux) (BG.Ptr ty) where
+
+  getField = HasCField.fromPtr (BG.Proxy @"unwrap")
+
+instance HasCField.HasCField DuckDBV2ScalarFunctionResolveTypesCallbackFn_Aux "unwrap" where
+
+  type CFieldType DuckDBV2ScalarFunctionResolveTypesCallbackFn_Aux "unwrap" =
+    DuckDBV2FunctionBindInfoHandle -> DuckDBV2ScalarFunctionResolveTypesInfoHandle -> DuckDBV2ContextHandle -> BG.Ptr DuckDBV2ErrorInfoHandle -> IO ()
+
+  offset# = \_ -> \_ -> 0
+
+{-| __C declaration:__ @duckdb_v2_scalar_function_resolve_types_callback_fn@
+
+    __defined at:__ @duckdb_v2.h 10374:16@
+
+    __exported by:__ @duckdb_v2.h@
+-}
+newtype DuckDBV2ScalarFunctionResolveTypesCallbackFn = DuckDBV2ScalarFunctionResolveTypesCallbackFn
+  { unwrap :: BG.FunPtr DuckDBV2ScalarFunctionResolveTypesCallbackFn_Aux
+  }
+  deriving stock (Eq, BG.Generic, Ord, Show)
+  deriving newtype
+    ( BG.HasFFIType
+    , Marshal.ReadRaw
+    , Marshal.StaticSize
+    , BG.Storable
+    , Marshal.WriteRaw
+    )
+
+instance ( ty ~ BG.FunPtr DuckDBV2ScalarFunctionResolveTypesCallbackFn_Aux
+         ) => BG.CompatHasField.HasField "unwrap" DuckDBV2ScalarFunctionResolveTypesCallbackFn ty where
+
+  hasField =
+    \x0 ->
+      ( \y1 ->
+          DuckDBV2ScalarFunctionResolveTypesCallbackFn {unwrap = y1}
+      , BG.getField @"unwrap" x0
+      )
+
+instance ( ty ~ BG.FunPtr DuckDBV2ScalarFunctionResolveTypesCallbackFn_Aux
+         ) => BG.HasField "unwrap" (BG.Ptr DuckDBV2ScalarFunctionResolveTypesCallbackFn) (BG.Ptr ty) where
+
+  getField = HasCField.fromPtr (BG.Proxy @"unwrap")
+
+instance HasCField.HasCField DuckDBV2ScalarFunctionResolveTypesCallbackFn "unwrap" where
+
+  type CFieldType DuckDBV2ScalarFunctionResolveTypesCallbackFn "unwrap" =
+    BG.FunPtr DuckDBV2ScalarFunctionResolveTypesCallbackFn_Aux
+
+  offset# = \_ -> \_ -> 0
+
+{-| Auxiliary type used by t'DuckDBV2ScalarFunctionBindCallbackFn'
+
+    __C declaration:__ @duckdb_v2_scalar_function_bind_callback_fn@
+
+    __defined at:__ @duckdb_v2.h 10378:16@
+
+    __exported by:__ @duckdb_v2.h@
+-}
+newtype DuckDBV2ScalarFunctionBindCallbackFn_Aux = DuckDBV2ScalarFunctionBindCallbackFn_Aux
+  { unwrap :: DuckDBV2FunctionBindInfoHandle -> DuckDBV2ScalarFunctionBindInfoHandle -> DuckDBV2ContextHandle -> BG.Ptr DuckDBV2ErrorInfoHandle -> IO ()
+  }
+  deriving stock (BG.Generic)
+
+-- __unique:__ @toDuckDBV2ScalarFunctionBindCallbackFn_Aux@
+foreign import ccall safe "wrapper" hs_bindgen_7b5049de92144cd0_base ::
+     (BG.Ptr BG.Void -> BG.Ptr BG.Void -> BG.Ptr BG.Void -> BG.Ptr BG.Void -> IO ())
+  -> IO (BG.FunPtr (BG.Ptr BG.Void -> BG.Ptr BG.Void -> BG.Ptr BG.Void -> BG.Ptr BG.Void -> IO ()))
+
+-- __unique:__ @toDuckDBV2ScalarFunctionBindCallbackFn_Aux@
+hs_bindgen_7b5049de92144cd0 ::
+     DuckDBV2ScalarFunctionBindCallbackFn_Aux
+  -> IO (BG.FunPtr DuckDBV2ScalarFunctionBindCallbackFn_Aux)
+hs_bindgen_7b5049de92144cd0 =
+  \fun0 ->
+    fmap BG.castFunPtr (hs_bindgen_7b5049de92144cd0_base (\x1 ->
+                                                            \x2 ->
+                                                              \x3 ->
+                                                                \x4 ->
+                                                                  BG.getField @"unwrap" fun0 (BG.fromFFIType x1) (BG.fromFFIType x2) (BG.fromFFIType x3) (BG.fromFFIType x4)))
+
+-- __unique:__ @fromDuckDBV2ScalarFunctionBindCallbackFn_Aux@
+foreign import ccall safe "dynamic" hs_bindgen_a6466867a738020b_base ::
+     BG.FunPtr (BG.Ptr BG.Void -> BG.Ptr BG.Void -> BG.Ptr BG.Void -> BG.Ptr BG.Void -> IO ())
+  -> BG.Ptr BG.Void -> BG.Ptr BG.Void -> BG.Ptr BG.Void -> BG.Ptr BG.Void -> IO ()
+
+-- __unique:__ @fromDuckDBV2ScalarFunctionBindCallbackFn_Aux@
+hs_bindgen_a6466867a738020b ::
+     BG.FunPtr DuckDBV2ScalarFunctionBindCallbackFn_Aux
+  -> DuckDBV2ScalarFunctionBindCallbackFn_Aux
+hs_bindgen_a6466867a738020b =
+  \funPtr0 ->
+    DuckDBV2ScalarFunctionBindCallbackFn_Aux (\x1 ->
+                                                \x2 ->
+                                                  \x3 ->
+                                                    \x4 ->
+                                                      hs_bindgen_a6466867a738020b_base (BG.castFunPtr funPtr0) (BG.toFFIType x1) (BG.toFFIType x2) (BG.toFFIType x3) (BG.toFFIType x4))
+
+instance BG.ToFunPtr DuckDBV2ScalarFunctionBindCallbackFn_Aux where
+
+  toFunPtr = hs_bindgen_7b5049de92144cd0
+
+instance BG.FromFunPtr DuckDBV2ScalarFunctionBindCallbackFn_Aux where
+
+  fromFunPtr = hs_bindgen_a6466867a738020b
+
+instance ( ty ~ (DuckDBV2FunctionBindInfoHandle -> DuckDBV2ScalarFunctionBindInfoHandle -> DuckDBV2ContextHandle -> BG.Ptr DuckDBV2ErrorInfoHandle -> IO ())
+         ) => BG.CompatHasField.HasField "unwrap" DuckDBV2ScalarFunctionBindCallbackFn_Aux ty where
+
+  hasField =
+    \x0 ->
+      ( \y1 ->
+          DuckDBV2ScalarFunctionBindCallbackFn_Aux {unwrap = y1}
+      , BG.getField @"unwrap" x0
+      )
+
+instance ( ty ~ (DuckDBV2FunctionBindInfoHandle -> DuckDBV2ScalarFunctionBindInfoHandle -> DuckDBV2ContextHandle -> BG.Ptr DuckDBV2ErrorInfoHandle -> IO ())
+         ) => BG.HasField "unwrap" (BG.Ptr DuckDBV2ScalarFunctionBindCallbackFn_Aux) (BG.Ptr ty) where
+
+  getField = HasCField.fromPtr (BG.Proxy @"unwrap")
+
+instance HasCField.HasCField DuckDBV2ScalarFunctionBindCallbackFn_Aux "unwrap" where
+
+  type CFieldType DuckDBV2ScalarFunctionBindCallbackFn_Aux "unwrap" =
+    DuckDBV2FunctionBindInfoHandle -> DuckDBV2ScalarFunctionBindInfoHandle -> DuckDBV2ContextHandle -> BG.Ptr DuckDBV2ErrorInfoHandle -> IO ()
+
+  offset# = \_ -> \_ -> 0
+
+{-| __C declaration:__ @duckdb_v2_scalar_function_bind_callback_fn@
+
+    __defined at:__ @duckdb_v2.h 10378:16@
+
+    __exported by:__ @duckdb_v2.h@
+-}
+newtype DuckDBV2ScalarFunctionBindCallbackFn = DuckDBV2ScalarFunctionBindCallbackFn
+  { unwrap :: BG.FunPtr DuckDBV2ScalarFunctionBindCallbackFn_Aux
+  }
+  deriving stock (Eq, BG.Generic, Ord, Show)
+  deriving newtype
+    ( BG.HasFFIType
+    , Marshal.ReadRaw
+    , Marshal.StaticSize
+    , BG.Storable
+    , Marshal.WriteRaw
+    )
+
+instance ( ty ~ BG.FunPtr DuckDBV2ScalarFunctionBindCallbackFn_Aux
+         ) => BG.CompatHasField.HasField "unwrap" DuckDBV2ScalarFunctionBindCallbackFn ty where
+
+  hasField =
+    \x0 ->
+      ( \y1 ->
+          DuckDBV2ScalarFunctionBindCallbackFn {unwrap = y1}
+      , BG.getField @"unwrap" x0
+      )
+
+instance ( ty ~ BG.FunPtr DuckDBV2ScalarFunctionBindCallbackFn_Aux
+         ) => BG.HasField "unwrap" (BG.Ptr DuckDBV2ScalarFunctionBindCallbackFn) (BG.Ptr ty) where
+
+  getField = HasCField.fromPtr (BG.Proxy @"unwrap")
+
+instance HasCField.HasCField DuckDBV2ScalarFunctionBindCallbackFn "unwrap" where
+
+  type CFieldType DuckDBV2ScalarFunctionBindCallbackFn "unwrap" =
+    BG.FunPtr DuckDBV2ScalarFunctionBindCallbackFn_Aux
+
+  offset# = \_ -> \_ -> 0
+
+{-| Auxiliary type used by t'DuckDBV2ScalarFunctionInitCallbackFn'
+
+    __C declaration:__ @duckdb_v2_scalar_function_init_callback_fn@
+
+    __defined at:__ @duckdb_v2.h 10383:16@
+
+    __exported by:__ @duckdb_v2.h@
+-}
+newtype DuckDBV2ScalarFunctionInitCallbackFn_Aux = DuckDBV2ScalarFunctionInitCallbackFn_Aux
+  { unwrap :: DuckDBV2ScalarFunctionInitInfoHandle -> DuckDBV2ContextHandle -> BG.Ptr DuckDBV2ErrorInfoHandle -> IO ()
+  }
+  deriving stock (BG.Generic)
+
+-- __unique:__ @toDuckDBV2ScalarFunctionInitCallbackFn_Aux@
+foreign import ccall safe "wrapper" hs_bindgen_7fd7f00eb8a90187_base ::
+     (BG.Ptr BG.Void -> BG.Ptr BG.Void -> BG.Ptr BG.Void -> IO ())
+  -> IO (BG.FunPtr (BG.Ptr BG.Void -> BG.Ptr BG.Void -> BG.Ptr BG.Void -> IO ()))
+
+-- __unique:__ @toDuckDBV2ScalarFunctionInitCallbackFn_Aux@
+hs_bindgen_7fd7f00eb8a90187 ::
+     DuckDBV2ScalarFunctionInitCallbackFn_Aux
+  -> IO (BG.FunPtr DuckDBV2ScalarFunctionInitCallbackFn_Aux)
+hs_bindgen_7fd7f00eb8a90187 =
+  \fun0 ->
+    fmap BG.castFunPtr (hs_bindgen_7fd7f00eb8a90187_base (\x1 ->
+                                                            \x2 ->
+                                                              \x3 ->
+                                                                BG.getField @"unwrap" fun0 (BG.fromFFIType x1) (BG.fromFFIType x2) (BG.fromFFIType x3)))
+
+-- __unique:__ @fromDuckDBV2ScalarFunctionInitCallbackFn_Aux@
+foreign import ccall safe "dynamic" hs_bindgen_76764d7e6ea21124_base ::
+     BG.FunPtr (BG.Ptr BG.Void -> BG.Ptr BG.Void -> BG.Ptr BG.Void -> IO ())
+  -> BG.Ptr BG.Void -> BG.Ptr BG.Void -> BG.Ptr BG.Void -> IO ()
+
+-- __unique:__ @fromDuckDBV2ScalarFunctionInitCallbackFn_Aux@
+hs_bindgen_76764d7e6ea21124 ::
+     BG.FunPtr DuckDBV2ScalarFunctionInitCallbackFn_Aux
+  -> DuckDBV2ScalarFunctionInitCallbackFn_Aux
+hs_bindgen_76764d7e6ea21124 =
+  \funPtr0 ->
+    DuckDBV2ScalarFunctionInitCallbackFn_Aux (\x1 ->
+                                                \x2 ->
+                                                  \x3 ->
+                                                    hs_bindgen_76764d7e6ea21124_base (BG.castFunPtr funPtr0) (BG.toFFIType x1) (BG.toFFIType x2) (BG.toFFIType x3))
+
+instance BG.ToFunPtr DuckDBV2ScalarFunctionInitCallbackFn_Aux where
+
+  toFunPtr = hs_bindgen_7fd7f00eb8a90187
+
+instance BG.FromFunPtr DuckDBV2ScalarFunctionInitCallbackFn_Aux where
+
+  fromFunPtr = hs_bindgen_76764d7e6ea21124
+
+instance ( ty ~ (DuckDBV2ScalarFunctionInitInfoHandle -> DuckDBV2ContextHandle -> BG.Ptr DuckDBV2ErrorInfoHandle -> IO ())
+         ) => BG.CompatHasField.HasField "unwrap" DuckDBV2ScalarFunctionInitCallbackFn_Aux ty where
+
+  hasField =
+    \x0 ->
+      ( \y1 ->
+          DuckDBV2ScalarFunctionInitCallbackFn_Aux {unwrap = y1}
+      , BG.getField @"unwrap" x0
+      )
+
+instance ( ty ~ (DuckDBV2ScalarFunctionInitInfoHandle -> DuckDBV2ContextHandle -> BG.Ptr DuckDBV2ErrorInfoHandle -> IO ())
+         ) => BG.HasField "unwrap" (BG.Ptr DuckDBV2ScalarFunctionInitCallbackFn_Aux) (BG.Ptr ty) where
+
+  getField = HasCField.fromPtr (BG.Proxy @"unwrap")
+
+instance HasCField.HasCField DuckDBV2ScalarFunctionInitCallbackFn_Aux "unwrap" where
+
+  type CFieldType DuckDBV2ScalarFunctionInitCallbackFn_Aux "unwrap" =
+    DuckDBV2ScalarFunctionInitInfoHandle -> DuckDBV2ContextHandle -> BG.Ptr DuckDBV2ErrorInfoHandle -> IO ()
+
+  offset# = \_ -> \_ -> 0
+
+{-| __C declaration:__ @duckdb_v2_scalar_function_init_callback_fn@
+
+    __defined at:__ @duckdb_v2.h 10383:16@
+
+    __exported by:__ @duckdb_v2.h@
+-}
+newtype DuckDBV2ScalarFunctionInitCallbackFn = DuckDBV2ScalarFunctionInitCallbackFn
+  { unwrap :: BG.FunPtr DuckDBV2ScalarFunctionInitCallbackFn_Aux
+  }
+  deriving stock (Eq, BG.Generic, Ord, Show)
+  deriving newtype
+    ( BG.HasFFIType
+    , Marshal.ReadRaw
+    , Marshal.StaticSize
+    , BG.Storable
+    , Marshal.WriteRaw
+    )
+
+instance ( ty ~ BG.FunPtr DuckDBV2ScalarFunctionInitCallbackFn_Aux
+         ) => BG.CompatHasField.HasField "unwrap" DuckDBV2ScalarFunctionInitCallbackFn ty where
+
+  hasField =
+    \x0 ->
+      ( \y1 ->
+          DuckDBV2ScalarFunctionInitCallbackFn {unwrap = y1}
+      , BG.getField @"unwrap" x0
+      )
+
+instance ( ty ~ BG.FunPtr DuckDBV2ScalarFunctionInitCallbackFn_Aux
+         ) => BG.HasField "unwrap" (BG.Ptr DuckDBV2ScalarFunctionInitCallbackFn) (BG.Ptr ty) where
+
+  getField = HasCField.fromPtr (BG.Proxy @"unwrap")
+
+instance HasCField.HasCField DuckDBV2ScalarFunctionInitCallbackFn "unwrap" where
+
+  type CFieldType DuckDBV2ScalarFunctionInitCallbackFn "unwrap" =
+    BG.FunPtr DuckDBV2ScalarFunctionInitCallbackFn_Aux
+
+  offset# = \_ -> \_ -> 0
+
+{-| Auxiliary type used by t'DuckDBV2ScalarFunctionExecCallbackFn'
+
+    __C declaration:__ @duckdb_v2_scalar_function_exec_callback_fn@
+
+    __defined at:__ @duckdb_v2.h 10387:16@
+
+    __exported by:__ @duckdb_v2.h@
+-}
+newtype DuckDBV2ScalarFunctionExecCallbackFn_Aux = DuckDBV2ScalarFunctionExecCallbackFn_Aux
+  { unwrap :: DuckDBV2ScalarFunctionExecInfoHandle -> DuckDBV2ContextHandle -> BG.Ptr DuckDBV2ErrorInfoHandle -> IO ()
+  }
+  deriving stock (BG.Generic)
+
+-- __unique:__ @toDuckDBV2ScalarFunctionExecCallbackFn_Aux@
+foreign import ccall safe "wrapper" hs_bindgen_8841f82c0af5fd5b_base ::
+     (BG.Ptr BG.Void -> BG.Ptr BG.Void -> BG.Ptr BG.Void -> IO ())
+  -> IO (BG.FunPtr (BG.Ptr BG.Void -> BG.Ptr BG.Void -> BG.Ptr BG.Void -> IO ()))
+
+-- __unique:__ @toDuckDBV2ScalarFunctionExecCallbackFn_Aux@
+hs_bindgen_8841f82c0af5fd5b ::
+     DuckDBV2ScalarFunctionExecCallbackFn_Aux
+  -> IO (BG.FunPtr DuckDBV2ScalarFunctionExecCallbackFn_Aux)
+hs_bindgen_8841f82c0af5fd5b =
+  \fun0 ->
+    fmap BG.castFunPtr (hs_bindgen_8841f82c0af5fd5b_base (\x1 ->
+                                                            \x2 ->
+                                                              \x3 ->
+                                                                BG.getField @"unwrap" fun0 (BG.fromFFIType x1) (BG.fromFFIType x2) (BG.fromFFIType x3)))
+
+-- __unique:__ @fromDuckDBV2ScalarFunctionExecCallbackFn_Aux@
+foreign import ccall safe "dynamic" hs_bindgen_27a7a95eb25deabf_base ::
+     BG.FunPtr (BG.Ptr BG.Void -> BG.Ptr BG.Void -> BG.Ptr BG.Void -> IO ())
+  -> BG.Ptr BG.Void -> BG.Ptr BG.Void -> BG.Ptr BG.Void -> IO ()
+
+-- __unique:__ @fromDuckDBV2ScalarFunctionExecCallbackFn_Aux@
+hs_bindgen_27a7a95eb25deabf ::
+     BG.FunPtr DuckDBV2ScalarFunctionExecCallbackFn_Aux
+  -> DuckDBV2ScalarFunctionExecCallbackFn_Aux
+hs_bindgen_27a7a95eb25deabf =
+  \funPtr0 ->
+    DuckDBV2ScalarFunctionExecCallbackFn_Aux (\x1 ->
+                                                \x2 ->
+                                                  \x3 ->
+                                                    hs_bindgen_27a7a95eb25deabf_base (BG.castFunPtr funPtr0) (BG.toFFIType x1) (BG.toFFIType x2) (BG.toFFIType x3))
+
+instance BG.ToFunPtr DuckDBV2ScalarFunctionExecCallbackFn_Aux where
+
+  toFunPtr = hs_bindgen_8841f82c0af5fd5b
+
+instance BG.FromFunPtr DuckDBV2ScalarFunctionExecCallbackFn_Aux where
+
+  fromFunPtr = hs_bindgen_27a7a95eb25deabf
+
+instance ( ty ~ (DuckDBV2ScalarFunctionExecInfoHandle -> DuckDBV2ContextHandle -> BG.Ptr DuckDBV2ErrorInfoHandle -> IO ())
+         ) => BG.CompatHasField.HasField "unwrap" DuckDBV2ScalarFunctionExecCallbackFn_Aux ty where
+
+  hasField =
+    \x0 ->
+      ( \y1 ->
+          DuckDBV2ScalarFunctionExecCallbackFn_Aux {unwrap = y1}
+      , BG.getField @"unwrap" x0
+      )
+
+instance ( ty ~ (DuckDBV2ScalarFunctionExecInfoHandle -> DuckDBV2ContextHandle -> BG.Ptr DuckDBV2ErrorInfoHandle -> IO ())
+         ) => BG.HasField "unwrap" (BG.Ptr DuckDBV2ScalarFunctionExecCallbackFn_Aux) (BG.Ptr ty) where
+
+  getField = HasCField.fromPtr (BG.Proxy @"unwrap")
+
+instance HasCField.HasCField DuckDBV2ScalarFunctionExecCallbackFn_Aux "unwrap" where
+
+  type CFieldType DuckDBV2ScalarFunctionExecCallbackFn_Aux "unwrap" =
+    DuckDBV2ScalarFunctionExecInfoHandle -> DuckDBV2ContextHandle -> BG.Ptr DuckDBV2ErrorInfoHandle -> IO ()
+
+  offset# = \_ -> \_ -> 0
+
+{-| __C declaration:__ @duckdb_v2_scalar_function_exec_callback_fn@
+
+    __defined at:__ @duckdb_v2.h 10387:16@
+
+    __exported by:__ @duckdb_v2.h@
+-}
+newtype DuckDBV2ScalarFunctionExecCallbackFn = DuckDBV2ScalarFunctionExecCallbackFn
+  { unwrap :: BG.FunPtr DuckDBV2ScalarFunctionExecCallbackFn_Aux
+  }
+  deriving stock (Eq, BG.Generic, Ord, Show)
+  deriving newtype
+    ( BG.HasFFIType
+    , Marshal.ReadRaw
+    , Marshal.StaticSize
+    , BG.Storable
+    , Marshal.WriteRaw
+    )
+
+instance ( ty ~ BG.FunPtr DuckDBV2ScalarFunctionExecCallbackFn_Aux
+         ) => BG.CompatHasField.HasField "unwrap" DuckDBV2ScalarFunctionExecCallbackFn ty where
+
+  hasField =
+    \x0 ->
+      ( \y1 ->
+          DuckDBV2ScalarFunctionExecCallbackFn {unwrap = y1}
+      , BG.getField @"unwrap" x0
+      )
+
+instance ( ty ~ BG.FunPtr DuckDBV2ScalarFunctionExecCallbackFn_Aux
+         ) => BG.HasField "unwrap" (BG.Ptr DuckDBV2ScalarFunctionExecCallbackFn) (BG.Ptr ty) where
+
+  getField = HasCField.fromPtr (BG.Proxy @"unwrap")
+
+instance HasCField.HasCField DuckDBV2ScalarFunctionExecCallbackFn "unwrap" where
+
+  type CFieldType DuckDBV2ScalarFunctionExecCallbackFn "unwrap" =
+    BG.FunPtr DuckDBV2ScalarFunctionExecCallbackFn_Aux
+
+  offset# = \_ -> \_ -> 0
+
+{-| SQL statement type of a parsed statement or an executed query.
+
+    __C declaration:__ @enum DUCKDB_V2_STATEMENT_TYPE@
+
+    __defined at:__ @duckdb_v2.h 10939:14@
+
+    __exported by:__ @duckdb_v2.h@
+-}
+newtype DuckDBV2StatementType = DuckDBV2StatementType
+  { unwrap :: BG.CUInt
+  }
+  deriving stock (Eq, BG.Generic, Ord)
+  deriving newtype (BG.HasFFIType)
+
+instance Marshal.StaticSize DuckDBV2StatementType where
+
+  staticSizeOf = \_ -> (4 :: Int)
+
+  staticAlignment = \_ -> (4 :: Int)
+
+instance Marshal.ReadRaw DuckDBV2StatementType where
+
+  readRaw =
+    \ptr0 ->
+          pure DuckDBV2StatementType
+      <*> Marshal.readRawByteOff ptr0 (0 :: Int)
+
+instance Marshal.WriteRaw DuckDBV2StatementType where
+
+  writeRaw =
+    \ptr0 ->
+      \s1 ->
+        case s1 of
+          DuckDBV2StatementType unwrap2 ->
+            Marshal.writeRawByteOff ptr0 (0 :: Int) unwrap2
+
+deriving via Marshal.EquivStorable DuckDBV2StatementType instance BG.Storable DuckDBV2StatementType
+
+deriving via BG.CUInt instance BG.Prim DuckDBV2StatementType
+
+instance CEnum.CEnum DuckDBV2StatementType where
+
+  type CEnumZ DuckDBV2StatementType = BG.CUInt
+
+  toCEnum = DuckDBV2StatementType
+
+  fromCEnum = BG.getField @"unwrap"
+
+  declaredValues =
+    \_ ->
+      CEnum.declaredValuesFromList [ (0, BG.singleton "DuckDBV2StatementTypeInvalid")
+                                   , (1, BG.singleton "DuckDBV2StatementTypeSelect")
+                                   , (2, BG.singleton "DuckDBV2StatementTypeInsert")
+                                   , (3, BG.singleton "DuckDBV2StatementTypeUpdate")
+                                   , (4, BG.singleton "DuckDBV2StatementTypeCreate")
+                                   , (5, BG.singleton "DuckDBV2StatementTypeDelete")
+                                   , (6, BG.singleton "DuckDBV2StatementTypePrepare")
+                                   , (7, BG.singleton "DuckDBV2StatementTypeExecute")
+                                   , (8, BG.singleton "DuckDBV2StatementTypeAlter")
+                                   , (9, BG.singleton "DuckDBV2StatementTypeTransaction")
+                                   , (10, BG.singleton "DuckDBV2StatementTypeCopy")
+                                   , (11, BG.singleton "DuckDBV2StatementTypeAnalyze")
+                                   , (12, BG.singleton "DuckDBV2StatementTypeVariableSet")
+                                   , (13, BG.singleton "DuckDBV2StatementTypeCreateFunc")
+                                   , (14, BG.singleton "DuckDBV2StatementTypeExplain")
+                                   , (15, BG.singleton "DuckDBV2StatementTypeDrop")
+                                   , (16, BG.singleton "DuckDBV2StatementTypeExport")
+                                   , (17, BG.singleton "DuckDBV2StatementTypePragma")
+                                   , (18, BG.singleton "DuckDBV2StatementTypeVacuum")
+                                   , (19, BG.singleton "DuckDBV2StatementTypeCall")
+                                   , (20, BG.singleton "DuckDBV2StatementTypeSet")
+                                   , (21, BG.singleton "DuckDBV2StatementTypeLoad")
+                                   , (22, BG.singleton "DuckDBV2StatementTypeRelation")
+                                   , (23, BG.singleton "DuckDBV2StatementTypeExtension")
+                                   , (24, BG.singleton "DuckDBV2StatementTypeLogicalPlan")
+                                   , (25, BG.singleton "DuckDBV2StatementTypeAttach")
+                                   , (26, BG.singleton "DuckDBV2StatementTypeDetach")
+                                   , (27, BG.singleton "DuckDBV2StatementTypeMulti")
+                                   , (28, BG.singleton "DuckDBV2StatementTypeCopyDatabase")
+                                   , (29, BG.singleton "DuckDBV2StatementTypeUpdateExtensions")
+                                   , (30, BG.singleton "DuckDBV2StatementTypeMergeInto")
+                                   , (31, BG.singleton "DuckDBV2StatementTypeConnect")
+                                   , (32, BG.singleton "DuckDBV2StatementTypeDisconnect")
+                                   , (33, BG.singleton "DuckDBV2StatementTypeExternalResource")
+                                   , (34, BG.singleton "DuckDBV2StatementTypePassthrough")
+                                   , (2147483647, BG.singleton "DuckDBV2StatementTypeMaxEnum")
+                                   ]
+
+  showsUndeclared =
+    CEnum.showsWrappedUndeclared "DuckDBV2StatementType"
+
+  readPrecUndeclared =
+    CEnum.readPrecWrappedUndeclared "DuckDBV2StatementType"
+
+instance Show DuckDBV2StatementType where
+
+  showsPrec = CEnum.shows
+
+instance Read DuckDBV2StatementType where
+
+  readPrec = CEnum.readPrec
+
+  readList = BG.readListDefault
+
+  readListPrec = BG.readListPrecDefault
+
+instance ( ty ~ BG.CUInt
+         ) => BG.CompatHasField.HasField "unwrap" DuckDBV2StatementType ty where
+
+  hasField =
+    \x0 ->
+      (\y1 ->
+         DuckDBV2StatementType {unwrap = y1}, BG.getField @"unwrap" x0)
+
+instance ( ty ~ BG.CUInt
+         ) => BG.HasField "unwrap" (BG.Ptr DuckDBV2StatementType) (BG.Ptr ty) where
+
+  getField = HasCField.fromPtr (BG.Proxy @"unwrap")
+
+instance HasCField.HasCField DuckDBV2StatementType "unwrap" where
+
+  type CFieldType DuckDBV2StatementType "unwrap" =
+    BG.CUInt
+
+  offset# = \_ -> \_ -> 0
+
+{-| __C declaration:__ @DUCKDB_V2_STATEMENT_TYPE_INVALID@
+
+    __defined at:__ @duckdb_v2.h 10940:2@
+
+    __exported by:__ @duckdb_v2.h@
+-}
+pattern DuckDBV2StatementTypeInvalid :: DuckDBV2StatementType
+pattern DuckDBV2StatementTypeInvalid = DuckDBV2StatementType 0
+
+{-| __C declaration:__ @DUCKDB_V2_STATEMENT_TYPE_SELECT@
+
+    __defined at:__ @duckdb_v2.h 10941:2@
+
+    __exported by:__ @duckdb_v2.h@
+-}
+pattern DuckDBV2StatementTypeSelect :: DuckDBV2StatementType
+pattern DuckDBV2StatementTypeSelect = DuckDBV2StatementType 1
+
+{-| __C declaration:__ @DUCKDB_V2_STATEMENT_TYPE_INSERT@
+
+    __defined at:__ @duckdb_v2.h 10942:2@
+
+    __exported by:__ @duckdb_v2.h@
+-}
+pattern DuckDBV2StatementTypeInsert :: DuckDBV2StatementType
+pattern DuckDBV2StatementTypeInsert = DuckDBV2StatementType 2
+
+{-| __C declaration:__ @DUCKDB_V2_STATEMENT_TYPE_UPDATE@
+
+    __defined at:__ @duckdb_v2.h 10943:2@
+
+    __exported by:__ @duckdb_v2.h@
+-}
+pattern DuckDBV2StatementTypeUpdate :: DuckDBV2StatementType
+pattern DuckDBV2StatementTypeUpdate = DuckDBV2StatementType 3
+
+{-| __C declaration:__ @DUCKDB_V2_STATEMENT_TYPE_CREATE@
+
+    __defined at:__ @duckdb_v2.h 10944:2@
+
+    __exported by:__ @duckdb_v2.h@
+-}
+pattern DuckDBV2StatementTypeCreate :: DuckDBV2StatementType
+pattern DuckDBV2StatementTypeCreate = DuckDBV2StatementType 4
+
+{-| __C declaration:__ @DUCKDB_V2_STATEMENT_TYPE_DELETE@
+
+    __defined at:__ @duckdb_v2.h 10945:2@
+
+    __exported by:__ @duckdb_v2.h@
+-}
+pattern DuckDBV2StatementTypeDelete :: DuckDBV2StatementType
+pattern DuckDBV2StatementTypeDelete = DuckDBV2StatementType 5
+
+{-| __C declaration:__ @DUCKDB_V2_STATEMENT_TYPE_PREPARE@
+
+    __defined at:__ @duckdb_v2.h 10946:2@
+
+    __exported by:__ @duckdb_v2.h@
+-}
+pattern DuckDBV2StatementTypePrepare :: DuckDBV2StatementType
+pattern DuckDBV2StatementTypePrepare = DuckDBV2StatementType 6
+
+{-| __C declaration:__ @DUCKDB_V2_STATEMENT_TYPE_EXECUTE@
+
+    __defined at:__ @duckdb_v2.h 10947:2@
+
+    __exported by:__ @duckdb_v2.h@
+-}
+pattern DuckDBV2StatementTypeExecute :: DuckDBV2StatementType
+pattern DuckDBV2StatementTypeExecute = DuckDBV2StatementType 7
+
+{-| __C declaration:__ @DUCKDB_V2_STATEMENT_TYPE_ALTER@
+
+    __defined at:__ @duckdb_v2.h 10948:2@
+
+    __exported by:__ @duckdb_v2.h@
+-}
+pattern DuckDBV2StatementTypeAlter :: DuckDBV2StatementType
+pattern DuckDBV2StatementTypeAlter = DuckDBV2StatementType 8
+
+{-| __C declaration:__ @DUCKDB_V2_STATEMENT_TYPE_TRANSACTION@
+
+    __defined at:__ @duckdb_v2.h 10949:2@
+
+    __exported by:__ @duckdb_v2.h@
+-}
+pattern DuckDBV2StatementTypeTransaction :: DuckDBV2StatementType
+pattern DuckDBV2StatementTypeTransaction = DuckDBV2StatementType 9
+
+{-| __C declaration:__ @DUCKDB_V2_STATEMENT_TYPE_COPY@
+
+    __defined at:__ @duckdb_v2.h 10950:2@
+
+    __exported by:__ @duckdb_v2.h@
+-}
+pattern DuckDBV2StatementTypeCopy :: DuckDBV2StatementType
+pattern DuckDBV2StatementTypeCopy = DuckDBV2StatementType 10
+
+{-| __C declaration:__ @DUCKDB_V2_STATEMENT_TYPE_ANALYZE@
+
+    __defined at:__ @duckdb_v2.h 10951:2@
+
+    __exported by:__ @duckdb_v2.h@
+-}
+pattern DuckDBV2StatementTypeAnalyze :: DuckDBV2StatementType
+pattern DuckDBV2StatementTypeAnalyze = DuckDBV2StatementType 11
+
+{-| __C declaration:__ @DUCKDB_V2_STATEMENT_TYPE_VARIABLE_SET@
+
+    __defined at:__ @duckdb_v2.h 10952:2@
+
+    __exported by:__ @duckdb_v2.h@
+-}
+pattern DuckDBV2StatementTypeVariableSet :: DuckDBV2StatementType
+pattern DuckDBV2StatementTypeVariableSet = DuckDBV2StatementType 12
+
+{-| __C declaration:__ @DUCKDB_V2_STATEMENT_TYPE_CREATE_FUNC@
+
+    __defined at:__ @duckdb_v2.h 10953:2@
+
+    __exported by:__ @duckdb_v2.h@
+-}
+pattern DuckDBV2StatementTypeCreateFunc :: DuckDBV2StatementType
+pattern DuckDBV2StatementTypeCreateFunc = DuckDBV2StatementType 13
+
+{-| __C declaration:__ @DUCKDB_V2_STATEMENT_TYPE_EXPLAIN@
+
+    __defined at:__ @duckdb_v2.h 10954:2@
+
+    __exported by:__ @duckdb_v2.h@
+-}
+pattern DuckDBV2StatementTypeExplain :: DuckDBV2StatementType
+pattern DuckDBV2StatementTypeExplain = DuckDBV2StatementType 14
+
+{-| __C declaration:__ @DUCKDB_V2_STATEMENT_TYPE_DROP@
+
+    __defined at:__ @duckdb_v2.h 10955:2@
+
+    __exported by:__ @duckdb_v2.h@
+-}
+pattern DuckDBV2StatementTypeDrop :: DuckDBV2StatementType
+pattern DuckDBV2StatementTypeDrop = DuckDBV2StatementType 15
+
+{-| __C declaration:__ @DUCKDB_V2_STATEMENT_TYPE_EXPORT@
+
+    __defined at:__ @duckdb_v2.h 10956:2@
+
+    __exported by:__ @duckdb_v2.h@
+-}
+pattern DuckDBV2StatementTypeExport :: DuckDBV2StatementType
+pattern DuckDBV2StatementTypeExport = DuckDBV2StatementType 16
+
+{-| __C declaration:__ @DUCKDB_V2_STATEMENT_TYPE_PRAGMA@
+
+    __defined at:__ @duckdb_v2.h 10957:2@
+
+    __exported by:__ @duckdb_v2.h@
+-}
+pattern DuckDBV2StatementTypePragma :: DuckDBV2StatementType
+pattern DuckDBV2StatementTypePragma = DuckDBV2StatementType 17
+
+{-| __C declaration:__ @DUCKDB_V2_STATEMENT_TYPE_VACUUM@
+
+    __defined at:__ @duckdb_v2.h 10958:2@
+
+    __exported by:__ @duckdb_v2.h@
+-}
+pattern DuckDBV2StatementTypeVacuum :: DuckDBV2StatementType
+pattern DuckDBV2StatementTypeVacuum = DuckDBV2StatementType 18
+
+{-| __C declaration:__ @DUCKDB_V2_STATEMENT_TYPE_CALL@
+
+    __defined at:__ @duckdb_v2.h 10959:2@
+
+    __exported by:__ @duckdb_v2.h@
+-}
+pattern DuckDBV2StatementTypeCall :: DuckDBV2StatementType
+pattern DuckDBV2StatementTypeCall = DuckDBV2StatementType 19
+
+{-| __C declaration:__ @DUCKDB_V2_STATEMENT_TYPE_SET@
+
+    __defined at:__ @duckdb_v2.h 10960:2@
+
+    __exported by:__ @duckdb_v2.h@
+-}
+pattern DuckDBV2StatementTypeSet :: DuckDBV2StatementType
+pattern DuckDBV2StatementTypeSet = DuckDBV2StatementType 20
+
+{-| __C declaration:__ @DUCKDB_V2_STATEMENT_TYPE_LOAD@
+
+    __defined at:__ @duckdb_v2.h 10961:2@
+
+    __exported by:__ @duckdb_v2.h@
+-}
+pattern DuckDBV2StatementTypeLoad :: DuckDBV2StatementType
+pattern DuckDBV2StatementTypeLoad = DuckDBV2StatementType 21
+
+{-| __C declaration:__ @DUCKDB_V2_STATEMENT_TYPE_RELATION@
+
+    __defined at:__ @duckdb_v2.h 10962:2@
+
+    __exported by:__ @duckdb_v2.h@
+-}
+pattern DuckDBV2StatementTypeRelation :: DuckDBV2StatementType
+pattern DuckDBV2StatementTypeRelation = DuckDBV2StatementType 22
+
+{-| __C declaration:__ @DUCKDB_V2_STATEMENT_TYPE_EXTENSION@
+
+    __defined at:__ @duckdb_v2.h 10963:2@
+
+    __exported by:__ @duckdb_v2.h@
+-}
+pattern DuckDBV2StatementTypeExtension :: DuckDBV2StatementType
+pattern DuckDBV2StatementTypeExtension = DuckDBV2StatementType 23
+
+{-| __C declaration:__ @DUCKDB_V2_STATEMENT_TYPE_LOGICAL_PLAN@
+
+    __defined at:__ @duckdb_v2.h 10964:2@
+
+    __exported by:__ @duckdb_v2.h@
+-}
+pattern DuckDBV2StatementTypeLogicalPlan :: DuckDBV2StatementType
+pattern DuckDBV2StatementTypeLogicalPlan = DuckDBV2StatementType 24
+
+{-| __C declaration:__ @DUCKDB_V2_STATEMENT_TYPE_ATTACH@
+
+    __defined at:__ @duckdb_v2.h 10965:2@
+
+    __exported by:__ @duckdb_v2.h@
+-}
+pattern DuckDBV2StatementTypeAttach :: DuckDBV2StatementType
+pattern DuckDBV2StatementTypeAttach = DuckDBV2StatementType 25
+
+{-| __C declaration:__ @DUCKDB_V2_STATEMENT_TYPE_DETACH@
+
+    __defined at:__ @duckdb_v2.h 10966:2@
+
+    __exported by:__ @duckdb_v2.h@
+-}
+pattern DuckDBV2StatementTypeDetach :: DuckDBV2StatementType
+pattern DuckDBV2StatementTypeDetach = DuckDBV2StatementType 26
+
+{-| __C declaration:__ @DUCKDB_V2_STATEMENT_TYPE_MULTI@
+
+    __defined at:__ @duckdb_v2.h 10967:2@
+
+    __exported by:__ @duckdb_v2.h@
+-}
+pattern DuckDBV2StatementTypeMulti :: DuckDBV2StatementType
+pattern DuckDBV2StatementTypeMulti = DuckDBV2StatementType 27
+
+{-| __C declaration:__ @DUCKDB_V2_STATEMENT_TYPE_COPY_DATABASE@
+
+    __defined at:__ @duckdb_v2.h 10968:2@
+
+    __exported by:__ @duckdb_v2.h@
+-}
+pattern DuckDBV2StatementTypeCopyDatabase :: DuckDBV2StatementType
+pattern DuckDBV2StatementTypeCopyDatabase = DuckDBV2StatementType 28
+
+{-| __C declaration:__ @DUCKDB_V2_STATEMENT_TYPE_UPDATE_EXTENSIONS@
+
+    __defined at:__ @duckdb_v2.h 10969:2@
+
+    __exported by:__ @duckdb_v2.h@
+-}
+pattern DuckDBV2StatementTypeUpdateExtensions :: DuckDBV2StatementType
+pattern DuckDBV2StatementTypeUpdateExtensions = DuckDBV2StatementType 29
+
+{-| __C declaration:__ @DUCKDB_V2_STATEMENT_TYPE_MERGE_INTO@
+
+    __defined at:__ @duckdb_v2.h 10970:2@
+
+    __exported by:__ @duckdb_v2.h@
+-}
+pattern DuckDBV2StatementTypeMergeInto :: DuckDBV2StatementType
+pattern DuckDBV2StatementTypeMergeInto = DuckDBV2StatementType 30
+
+{-| __C declaration:__ @DUCKDB_V2_STATEMENT_TYPE_CONNECT@
+
+    __defined at:__ @duckdb_v2.h 10971:2@
+
+    __exported by:__ @duckdb_v2.h@
+-}
+pattern DuckDBV2StatementTypeConnect :: DuckDBV2StatementType
+pattern DuckDBV2StatementTypeConnect = DuckDBV2StatementType 31
+
+{-| __C declaration:__ @DUCKDB_V2_STATEMENT_TYPE_DISCONNECT@
+
+    __defined at:__ @duckdb_v2.h 10972:2@
+
+    __exported by:__ @duckdb_v2.h@
+-}
+pattern DuckDBV2StatementTypeDisconnect :: DuckDBV2StatementType
+pattern DuckDBV2StatementTypeDisconnect = DuckDBV2StatementType 32
+
+{-| __C declaration:__ @DUCKDB_V2_STATEMENT_TYPE_EXTERNAL_RESOURCE@
+
+    __defined at:__ @duckdb_v2.h 10973:2@
+
+    __exported by:__ @duckdb_v2.h@
+-}
+pattern DuckDBV2StatementTypeExternalResource :: DuckDBV2StatementType
+pattern DuckDBV2StatementTypeExternalResource = DuckDBV2StatementType 33
+
+{-| __C declaration:__ @DUCKDB_V2_STATEMENT_TYPE_PASSTHROUGH@
+
+    __defined at:__ @duckdb_v2.h 10974:2@
+
+    __exported by:__ @duckdb_v2.h@
+-}
+pattern DuckDBV2StatementTypePassthrough :: DuckDBV2StatementType
+pattern DuckDBV2StatementTypePassthrough = DuckDBV2StatementType 34
+
+{-| __C declaration:__ @DUCKDB_V2_STATEMENT_TYPE_MAX_ENUM@
+
+    __defined at:__ @duckdb_v2.h 10975:2@
+
+    __exported by:__ @duckdb_v2.h@
+-}
+pattern DuckDBV2StatementTypeMaxEnum :: DuckDBV2StatementType
+pattern DuckDBV2StatementTypeMaxEnum = DuckDBV2StatementType 2147483647
+
+{-| An opaque, owned handle to a single parsed SQL statement, produced by statement_iterator_next. statement_execute runs it without consuming it; the caller always destroys it via sql_statement_destroy.
+
+    __C declaration:__ @struct _duckdb_v2_sql_statement@
+
+    __defined at:__ @duckdb_v2.h 10986:16@
+
+    __exported by:__ @duckdb_v2.h@
+-}
+data DuckDBV2SqlStatementStruct
+
+instance Marshal.StaticSize DuckDBV2SqlStatementStruct where
+
+  staticSizeOf = \_ -> (8 :: Int)
+
+  staticAlignment = \_ -> (8 :: Int)
+
+{-| An opaque, owned handle to a single parsed SQL statement, produced by statement_iterator_next. statement_execute runs it without consuming it; the caller always destroys it via sql_statement_destroy.
+
+    __C declaration:__ @duckdb_v2_sql_statement_handle@
+
+    __defined at:__ @duckdb_v2.h 10988:5@
+
+    __exported by:__ @duckdb_v2.h@
+-}
+newtype DuckDBV2SqlStatementHandle = DuckDBV2SqlStatementHandle
+  { unwrap :: BG.Ptr DuckDBV2SqlStatementStruct
+  }
+  deriving stock (Eq, BG.Generic, Ord, Show)
+  deriving newtype
+    ( BG.HasFFIType
+    , Marshal.ReadRaw
+    , Marshal.StaticSize
+    , BG.Storable
+    , Marshal.WriteRaw
+    )
+
+instance ( ty ~ BG.Ptr DuckDBV2SqlStatementStruct
+         ) => BG.CompatHasField.HasField "unwrap" DuckDBV2SqlStatementHandle ty where
+
+  hasField =
+    \x0 ->
+      (\y1 ->
+         DuckDBV2SqlStatementHandle {unwrap = y1}, BG.getField @"unwrap" x0)
+
+instance ( ty ~ BG.Ptr DuckDBV2SqlStatementStruct
+         ) => BG.HasField "unwrap" (BG.Ptr DuckDBV2SqlStatementHandle) (BG.Ptr ty) where
+
+  getField = HasCField.fromPtr (BG.Proxy @"unwrap")
+
+instance HasCField.HasCField DuckDBV2SqlStatementHandle "unwrap" where
+
+  type CFieldType DuckDBV2SqlStatementHandle "unwrap" =
+    BG.Ptr DuckDBV2SqlStatementStruct
+
+  offset# = \_ -> \_ -> 0
+
+{-| An opaque, owned handle to an iterator over the statements of a SQL string, produced by parse_sql. Destroy it via statement_iterator_destroy; statements it already yielded are independently owned and unaffected.
+
+    __C declaration:__ @struct _duckdb_v2_statement_iterator@
+
+    __defined at:__ @duckdb_v2.h 10994:16@
+
+    __exported by:__ @duckdb_v2.h@
+-}
+data DuckDBV2StatementIteratorStruct
+
+instance Marshal.StaticSize DuckDBV2StatementIteratorStruct where
+
+  staticSizeOf = \_ -> (8 :: Int)
+
+  staticAlignment = \_ -> (8 :: Int)
+
+{-| An opaque, owned handle to an iterator over the statements of a SQL string, produced by parse_sql. Destroy it via statement_iterator_destroy; statements it already yielded are independently owned and unaffected.
+
+    __C declaration:__ @duckdb_v2_statement_iterator_handle@
+
+    __defined at:__ @duckdb_v2.h 10996:5@
+
+    __exported by:__ @duckdb_v2.h@
+-}
+newtype DuckDBV2StatementIteratorHandle = DuckDBV2StatementIteratorHandle
+  { unwrap :: BG.Ptr DuckDBV2StatementIteratorStruct
+  }
+  deriving stock (Eq, BG.Generic, Ord, Show)
+  deriving newtype
+    ( BG.HasFFIType
+    , Marshal.ReadRaw
+    , Marshal.StaticSize
+    , BG.Storable
+    , Marshal.WriteRaw
+    )
+
+instance ( ty ~ BG.Ptr DuckDBV2StatementIteratorStruct
+         ) => BG.CompatHasField.HasField "unwrap" DuckDBV2StatementIteratorHandle ty where
+
+  hasField =
+    \x0 ->
+      ( \y1 ->
+          DuckDBV2StatementIteratorHandle {unwrap = y1}
+      , BG.getField @"unwrap" x0
+      )
+
+instance ( ty ~ BG.Ptr DuckDBV2StatementIteratorStruct
+         ) => BG.HasField "unwrap" (BG.Ptr DuckDBV2StatementIteratorHandle) (BG.Ptr ty) where
+
+  getField = HasCField.fromPtr (BG.Proxy @"unwrap")
+
+instance HasCField.HasCField DuckDBV2StatementIteratorHandle "unwrap" where
+
+  type CFieldType DuckDBV2StatementIteratorHandle "unwrap" =
+    BG.Ptr DuckDBV2StatementIteratorStruct
+
+  offset# = \_ -> \_ -> 0
+
+{-| Internal representation of a vector, with FSST / SEQUENCE / SHREDDED collapsed into OTHER: the view getter rejects those and requires an explicit vector_flatten first. OTHER is the 0-value, so a zero-initialized out-param reads as "unspecified, needs flatten" rather than silently looking like FLAT.
+
+    __C declaration:__ @enum DUCKDB_V2_VECTOR_TYPE@
+
+    __defined at:__ @duckdb_v2.h 11263:14@
+
+    __exported by:__ @duckdb_v2.h@
+-}
+newtype DuckDBV2VectorType = DuckDBV2VectorType
+  { unwrap :: BG.CUInt
+  }
+  deriving stock (Eq, BG.Generic, Ord)
+  deriving newtype (BG.HasFFIType)
+
+instance Marshal.StaticSize DuckDBV2VectorType where
+
+  staticSizeOf = \_ -> (4 :: Int)
+
+  staticAlignment = \_ -> (4 :: Int)
+
+instance Marshal.ReadRaw DuckDBV2VectorType where
+
+  readRaw =
+    \ptr0 ->
+          pure DuckDBV2VectorType
+      <*> Marshal.readRawByteOff ptr0 (0 :: Int)
+
+instance Marshal.WriteRaw DuckDBV2VectorType where
+
+  writeRaw =
+    \ptr0 ->
+      \s1 ->
+        case s1 of
+          DuckDBV2VectorType unwrap2 ->
+            Marshal.writeRawByteOff ptr0 (0 :: Int) unwrap2
+
+deriving via Marshal.EquivStorable DuckDBV2VectorType instance BG.Storable DuckDBV2VectorType
+
+deriving via BG.CUInt instance BG.Prim DuckDBV2VectorType
+
+instance CEnum.CEnum DuckDBV2VectorType where
+
+  type CEnumZ DuckDBV2VectorType = BG.CUInt
+
+  toCEnum = DuckDBV2VectorType
+
+  fromCEnum = BG.getField @"unwrap"
+
+  declaredValues =
+    \_ ->
+      CEnum.declaredValuesFromList [ (0, BG.singleton "DuckDBV2VectorTypeOther")
+                                   , (1, BG.singleton "DuckDBV2VectorTypeFlat")
+                                   , (2, BG.singleton "DuckDBV2VectorTypeConstant")
+                                   , (3, BG.singleton "DuckDBV2VectorTypeDictionary")
+                                   , (2147483647, BG.singleton "DuckDBV2VectorTypeMaxEnum")
+                                   ]
+
+  showsUndeclared =
+    CEnum.showsWrappedUndeclared "DuckDBV2VectorType"
+
+  readPrecUndeclared =
+    CEnum.readPrecWrappedUndeclared "DuckDBV2VectorType"
+
+instance Show DuckDBV2VectorType where
+
+  showsPrec = CEnum.shows
+
+instance Read DuckDBV2VectorType where
+
+  readPrec = CEnum.readPrec
+
+  readList = BG.readListDefault
+
+  readListPrec = BG.readListPrecDefault
+
+instance ( ty ~ BG.CUInt
+         ) => BG.CompatHasField.HasField "unwrap" DuckDBV2VectorType ty where
+
+  hasField =
+    \x0 ->
+      (\y1 ->
+         DuckDBV2VectorType {unwrap = y1}, BG.getField @"unwrap" x0)
+
+instance ( ty ~ BG.CUInt
+         ) => BG.HasField "unwrap" (BG.Ptr DuckDBV2VectorType) (BG.Ptr ty) where
+
+  getField = HasCField.fromPtr (BG.Proxy @"unwrap")
+
+instance HasCField.HasCField DuckDBV2VectorType "unwrap" where
+
+  type CFieldType DuckDBV2VectorType "unwrap" =
+    BG.CUInt
+
+  offset# = \_ -> \_ -> 0
+
+{-| Default for zero-init. Covers FSST / SEQUENCE / SHREDDED — call vector_flatten first.
+
+    __C declaration:__ @DUCKDB_V2_VECTOR_TYPE_OTHER@
+
+    __defined at:__ @duckdb_v2.h 11265:2@
+
+    __exported by:__ @duckdb_v2.h@
+-}
+pattern DuckDBV2VectorTypeOther :: DuckDBV2VectorType
+pattern DuckDBV2VectorTypeOther = DuckDBV2VectorType 0
+
+{-| Standard per-row storage.
+
+    __C declaration:__ @DUCKDB_V2_VECTOR_TYPE_FLAT@
+
+    __defined at:__ @duckdb_v2.h 11268:2@
+
+    __exported by:__ @duckdb_v2.h@
+-}
+pattern DuckDBV2VectorTypeFlat :: DuckDBV2VectorType
+pattern DuckDBV2VectorTypeFlat = DuckDBV2VectorType 1
+
+{-| A single value applies to every row in the vector.
+
+    __C declaration:__ @DUCKDB_V2_VECTOR_TYPE_CONSTANT@
+
+    __defined at:__ @duckdb_v2.h 11271:2@
+
+    __exported by:__ @duckdb_v2.h@
+-}
+pattern DuckDBV2VectorTypeConstant :: DuckDBV2VectorType
+pattern DuckDBV2VectorTypeConstant = DuckDBV2VectorType 2
+
+{-| Data + selection vector indirection into another vector.
+
+    __C declaration:__ @DUCKDB_V2_VECTOR_TYPE_DICTIONARY@
+
+    __defined at:__ @duckdb_v2.h 11274:2@
+
+    __exported by:__ @duckdb_v2.h@
+-}
+pattern DuckDBV2VectorTypeDictionary :: DuckDBV2VectorType
+pattern DuckDBV2VectorTypeDictionary = DuckDBV2VectorType 3
+
+{-| __C declaration:__ @DUCKDB_V2_VECTOR_TYPE_MAX_ENUM@
+
+    __defined at:__ @duckdb_v2.h 11275:2@
+
+    __exported by:__ @duckdb_v2.h@
+-}
+pattern DuckDBV2VectorTypeMaxEnum :: DuckDBV2VectorType
+pattern DuckDBV2VectorTypeMaxEnum = DuckDBV2VectorType 2147483647
+
+{-| __C declaration:__ @struct duckdb_v2_vector_view@
+
+    __defined at:__ @duckdb_v2.h 11844:8@
+
+    __exported by:__ @duckdb_v2.h@
+-}
+data DuckDBV2VectorView = DuckDBV2VectorView
+  { data' :: PtrConst.PtrConst BG.Void
+    {- ^ __C declaration:__ @data@
+
+         __defined at:__ @duckdb_v2.h 11845:14@
+
+         __exported by:__ @duckdb_v2.h@
+    -}
+  , validity :: PtrConst.PtrConst HsBindgen.Runtime.LibC.Word64
+    {- ^ __C declaration:__ @validity@
+
+         __defined at:__ @duckdb_v2.h 11846:18@
+
+         __exported by:__ @duckdb_v2.h@
+    -}
+  , sel :: PtrConst.PtrConst DuckDBV2SelT
+    {- ^ __C declaration:__ @sel@
+
+         __defined at:__ @duckdb_v2.h 11847:25@
+
+         __exported by:__ @duckdb_v2.h@
+    -}
+  , count :: DuckDBIdx
+    {- ^ __C declaration:__ @count@
+
+         __defined at:__ @duckdb_v2.h 11848:8@
+
+         __exported by:__ @duckdb_v2.h@
+    -}
+  }
+  deriving stock (Eq, BG.Generic, Show)
+
+instance Marshal.StaticSize DuckDBV2VectorView where
+
+  staticSizeOf = \_ -> (32 :: Int)
+
+  staticAlignment = \_ -> (8 :: Int)
+
+instance Marshal.ReadRaw DuckDBV2VectorView where
+
+  readRaw =
+    \ptr0 ->
+          pure DuckDBV2VectorView
+      <*> HasCField.readRaw (BG.Proxy @"data'") ptr0
+      <*> HasCField.readRaw (BG.Proxy @"validity") ptr0
+      <*> HasCField.readRaw (BG.Proxy @"sel") ptr0
+      <*> HasCField.readRaw (BG.Proxy @"count") ptr0
+
+instance Marshal.WriteRaw DuckDBV2VectorView where
+
+  writeRaw =
+    \ptr0 ->
+      \s1 ->
+        case s1 of
+          DuckDBV2VectorView data'2 validity3 sel4 count5 ->
+               HasCField.writeRaw (BG.Proxy @"data'") ptr0 data'2
+            >> HasCField.writeRaw (BG.Proxy @"validity") ptr0 validity3
+            >> HasCField.writeRaw (BG.Proxy @"sel") ptr0 sel4
+            >> HasCField.writeRaw (BG.Proxy @"count") ptr0 count5
+
+deriving via Marshal.EquivStorable DuckDBV2VectorView instance BG.Storable DuckDBV2VectorView
+
+deriving via Struct.IsStructViaReadRaw DuckDBV2VectorView instance Struct.IsStruct DuckDBV2VectorView
+
+{-| __C declaration:__ @data@
+
+    __defined at:__ @duckdb_v2.h 11845:14@
+
+    __exported by:__ @duckdb_v2.h@
+-}
+instance ( ty ~ PtrConst.PtrConst BG.Void
+         ) => BG.CompatHasField.HasField "data'" DuckDBV2VectorView ty where
+
+  hasField =
+    \x0 ->
+      ( \y1 ->
+          DuckDBV2VectorView { data' = y1
+                             , validity = BG.getField @"validity" x0
+                             , sel = BG.getField @"sel" x0
+                             , count = BG.getField @"count" x0
+                             }
+      , BG.getField @"data'" x0
+      )
+
+instance ( ty ~ PtrConst.PtrConst BG.Void
+         ) => BG.HasField "data'" (BG.Ptr DuckDBV2VectorView) (BG.Ptr ty) where
+
+  getField = HasCField.fromPtr (BG.Proxy @"data'")
+
+instance HasCField.HasCField DuckDBV2VectorView "data'" where
+
+  type CFieldType DuckDBV2VectorView "data'" =
+    PtrConst.PtrConst BG.Void
+
+  offset# = \_ -> \_ -> 0
+
+{-| __C declaration:__ @validity@
+
+    __defined at:__ @duckdb_v2.h 11846:18@
+
+    __exported by:__ @duckdb_v2.h@
+-}
+instance ( ty ~ PtrConst.PtrConst HsBindgen.Runtime.LibC.Word64
+         ) => BG.CompatHasField.HasField "validity" DuckDBV2VectorView ty where
+
+  hasField =
+    \x0 ->
+      ( \y1 ->
+          DuckDBV2VectorView { validity = y1
+                             , data' = BG.getField @"data'" x0
+                             , sel = BG.getField @"sel" x0
+                             , count = BG.getField @"count" x0
+                             }
+      , BG.getField @"validity" x0
+      )
+
+instance ( ty ~ PtrConst.PtrConst HsBindgen.Runtime.LibC.Word64
+         ) => BG.HasField "validity" (BG.Ptr DuckDBV2VectorView) (BG.Ptr ty) where
+
+  getField = HasCField.fromPtr (BG.Proxy @"validity")
+
+instance HasCField.HasCField DuckDBV2VectorView "validity" where
+
+  type CFieldType DuckDBV2VectorView "validity" =
+    PtrConst.PtrConst HsBindgen.Runtime.LibC.Word64
+
+  offset# = \_ -> \_ -> 8
+
+{-| __C declaration:__ @sel@
+
+    __defined at:__ @duckdb_v2.h 11847:25@
+
+    __exported by:__ @duckdb_v2.h@
+-}
+instance ( ty ~ PtrConst.PtrConst DuckDBV2SelT
+         ) => BG.CompatHasField.HasField "sel" DuckDBV2VectorView ty where
+
+  hasField =
+    \x0 ->
+      ( \y1 ->
+          DuckDBV2VectorView { sel = y1
+                             , data' = BG.getField @"data'" x0
+                             , validity = BG.getField @"validity" x0
+                             , count = BG.getField @"count" x0
+                             }
+      , BG.getField @"sel" x0
+      )
+
+instance ( ty ~ PtrConst.PtrConst DuckDBV2SelT
+         ) => BG.HasField "sel" (BG.Ptr DuckDBV2VectorView) (BG.Ptr ty) where
+
+  getField = HasCField.fromPtr (BG.Proxy @"sel")
+
+instance HasCField.HasCField DuckDBV2VectorView "sel" where
+
+  type CFieldType DuckDBV2VectorView "sel" =
+    PtrConst.PtrConst DuckDBV2SelT
+
+  offset# = \_ -> \_ -> 16
+
+{-| __C declaration:__ @count@
+
+    __defined at:__ @duckdb_v2.h 11848:8@
+
+    __exported by:__ @duckdb_v2.h@
+-}
+instance ( ty ~ DuckDBIdx
+         ) => BG.CompatHasField.HasField "count" DuckDBV2VectorView ty where
+
+  hasField =
+    \x0 ->
+      ( \y1 ->
+          DuckDBV2VectorView { count = y1
+                             , data' = BG.getField @"data'" x0
+                             , validity = BG.getField @"validity" x0
+                             , sel = BG.getField @"sel" x0
+                             }
+      , BG.getField @"count" x0
+      )
+
+instance ( ty ~ DuckDBIdx
+         ) => BG.HasField "count" (BG.Ptr DuckDBV2VectorView) (BG.Ptr ty) where
+
+  getField = HasCField.fromPtr (BG.Proxy @"count")
+
+instance HasCField.HasCField DuckDBV2VectorView "count" where
+
+  type CFieldType DuckDBV2VectorView "count" =
+    DuckDBIdx
+
+  offset# = \_ -> \_ -> 24
+
+{-| __C declaration:__ @struct duckdb_v2_list_entry@
+
+    __defined at:__ @duckdb_v2.h 11851:8@
+
+    __exported by:__ @duckdb_v2.h@
+-}
+data DuckDBV2ListEntry = DuckDBV2ListEntry
+  { offset :: DuckDBIdx
+    {- ^ __C declaration:__ @offset@
+
+         __defined at:__ @duckdb_v2.h 11852:8@
+
+         __exported by:__ @duckdb_v2.h@
+    -}
+  , length :: DuckDBIdx
+    {- ^ __C declaration:__ @length@
+
+         __defined at:__ @duckdb_v2.h 11853:8@
+
+         __exported by:__ @duckdb_v2.h@
+    -}
+  }
+  deriving stock (Eq, BG.Generic, Show)
+
+instance Marshal.StaticSize DuckDBV2ListEntry where
+
+  staticSizeOf = \_ -> (16 :: Int)
+
+  staticAlignment = \_ -> (8 :: Int)
+
+instance Marshal.ReadRaw DuckDBV2ListEntry where
+
+  readRaw =
+    \ptr0 ->
+          pure DuckDBV2ListEntry
+      <*> HasCField.readRaw (BG.Proxy @"offset") ptr0
+      <*> HasCField.readRaw (BG.Proxy @"length") ptr0
+
+instance Marshal.WriteRaw DuckDBV2ListEntry where
+
+  writeRaw =
+    \ptr0 ->
+      \s1 ->
+        case s1 of
+          DuckDBV2ListEntry offset2 length3 ->
+               HasCField.writeRaw (BG.Proxy @"offset") ptr0 offset2
+            >> HasCField.writeRaw (BG.Proxy @"length") ptr0 length3
+
+deriving via Marshal.EquivStorable DuckDBV2ListEntry instance BG.Storable DuckDBV2ListEntry
+
+deriving via Struct.IsStructViaReadRaw DuckDBV2ListEntry instance Struct.IsStruct DuckDBV2ListEntry
+
+{-| __C declaration:__ @offset@
+
+    __defined at:__ @duckdb_v2.h 11852:8@
+
+    __exported by:__ @duckdb_v2.h@
+-}
+instance ( ty ~ DuckDBIdx
+         ) => BG.CompatHasField.HasField "offset" DuckDBV2ListEntry ty where
+
+  hasField =
+    \x0 ->
+      ( \y1 ->
+          DuckDBV2ListEntry {offset = y1, length = BG.getField @"length" x0}
+      , BG.getField @"offset" x0
+      )
+
+instance ( ty ~ DuckDBIdx
+         ) => BG.HasField "offset" (BG.Ptr DuckDBV2ListEntry) (BG.Ptr ty) where
+
+  getField = HasCField.fromPtr (BG.Proxy @"offset")
+
+instance HasCField.HasCField DuckDBV2ListEntry "offset" where
+
+  type CFieldType DuckDBV2ListEntry "offset" =
+    DuckDBIdx
+
+  offset# = \_ -> \_ -> 0
+
+{-| __C declaration:__ @length@
+
+    __defined at:__ @duckdb_v2.h 11853:8@
+
+    __exported by:__ @duckdb_v2.h@
+-}
+instance ( ty ~ DuckDBIdx
+         ) => BG.CompatHasField.HasField "length" DuckDBV2ListEntry ty where
+
+  hasField =
+    \x0 ->
+      ( \y1 ->
+          DuckDBV2ListEntry {length = y1, offset = BG.getField @"offset" x0}
+      , BG.getField @"length" x0
+      )
+
+instance ( ty ~ DuckDBIdx
+         ) => BG.HasField "length" (BG.Ptr DuckDBV2ListEntry) (BG.Ptr ty) where
+
+  getField = HasCField.fromPtr (BG.Proxy @"length")
+
+instance HasCField.HasCField DuckDBV2ListEntry "length" where
+
+  type CFieldType DuckDBV2ListEntry "length" =
+    DuckDBIdx
+
+  offset# = \_ -> \_ -> 8
+
+{-| __C declaration:__ @struct duckdb_v2_hugeint_t@
+
+    __defined at:__ @duckdb_v2.h 11856:8@
+
+    __exported by:__ @duckdb_v2.h@
+-}
+data DuckDBV2HugeintT = DuckDBV2HugeintT
+  { lower :: HsBindgen.Runtime.LibC.Word64
+    {- ^ __C declaration:__ @lower@
+
+         __defined at:__ @duckdb_v2.h 11857:11@
+
+         __exported by:__ @duckdb_v2.h@
+    -}
+  , upper :: HsBindgen.Runtime.LibC.Int64
+    {- ^ __C declaration:__ @upper@
+
+         __defined at:__ @duckdb_v2.h 11858:10@
+
+         __exported by:__ @duckdb_v2.h@
+    -}
+  }
+  deriving stock (Eq, BG.Generic, Show)
+
+instance Marshal.StaticSize DuckDBV2HugeintT where
+
+  staticSizeOf = \_ -> (16 :: Int)
+
+  staticAlignment = \_ -> (8 :: Int)
+
+instance Marshal.ReadRaw DuckDBV2HugeintT where
+
+  readRaw =
+    \ptr0 ->
+          pure DuckDBV2HugeintT
+      <*> HasCField.readRaw (BG.Proxy @"lower") ptr0
+      <*> HasCField.readRaw (BG.Proxy @"upper") ptr0
+
+instance Marshal.WriteRaw DuckDBV2HugeintT where
+
+  writeRaw =
+    \ptr0 ->
+      \s1 ->
+        case s1 of
+          DuckDBV2HugeintT lower2 upper3 ->
+               HasCField.writeRaw (BG.Proxy @"lower") ptr0 lower2
+            >> HasCField.writeRaw (BG.Proxy @"upper") ptr0 upper3
+
+deriving via Marshal.EquivStorable DuckDBV2HugeintT instance BG.Storable DuckDBV2HugeintT
+
+deriving via Struct.IsStructViaReadRaw DuckDBV2HugeintT instance Struct.IsStruct DuckDBV2HugeintT
+
+{-| __C declaration:__ @lower@
+
+    __defined at:__ @duckdb_v2.h 11857:11@
+
+    __exported by:__ @duckdb_v2.h@
+-}
+instance ( ty ~ HsBindgen.Runtime.LibC.Word64
+         ) => BG.CompatHasField.HasField "lower" DuckDBV2HugeintT ty where
+
+  hasField =
+    \x0 ->
+      ( \y1 ->
+          DuckDBV2HugeintT {lower = y1, upper = BG.getField @"upper" x0}
+      , BG.getField @"lower" x0
+      )
+
+instance ( ty ~ HsBindgen.Runtime.LibC.Word64
+         ) => BG.HasField "lower" (BG.Ptr DuckDBV2HugeintT) (BG.Ptr ty) where
+
+  getField = HasCField.fromPtr (BG.Proxy @"lower")
+
+instance HasCField.HasCField DuckDBV2HugeintT "lower" where
+
+  type CFieldType DuckDBV2HugeintT "lower" =
+    HsBindgen.Runtime.LibC.Word64
+
+  offset# = \_ -> \_ -> 0
+
+{-| __C declaration:__ @upper@
+
+    __defined at:__ @duckdb_v2.h 11858:10@
+
+    __exported by:__ @duckdb_v2.h@
+-}
+instance ( ty ~ HsBindgen.Runtime.LibC.Int64
+         ) => BG.CompatHasField.HasField "upper" DuckDBV2HugeintT ty where
+
+  hasField =
+    \x0 ->
+      ( \y1 ->
+          DuckDBV2HugeintT {upper = y1, lower = BG.getField @"lower" x0}
+      , BG.getField @"upper" x0
+      )
+
+instance ( ty ~ HsBindgen.Runtime.LibC.Int64
+         ) => BG.HasField "upper" (BG.Ptr DuckDBV2HugeintT) (BG.Ptr ty) where
+
+  getField = HasCField.fromPtr (BG.Proxy @"upper")
+
+instance HasCField.HasCField DuckDBV2HugeintT "upper" where
+
+  type CFieldType DuckDBV2HugeintT "upper" =
+    HsBindgen.Runtime.LibC.Int64
+
+  offset# = \_ -> \_ -> 8
+
+{-| __C declaration:__ @struct duckdb_v2_uhugeint_t@
+
+    __defined at:__ @duckdb_v2.h 11861:8@
+
+    __exported by:__ @duckdb_v2.h@
+-}
+data DuckDBV2UhugeintT = DuckDBV2UhugeintT
+  { lower :: HsBindgen.Runtime.LibC.Word64
+    {- ^ __C declaration:__ @lower@
+
+         __defined at:__ @duckdb_v2.h 11862:11@
+
+         __exported by:__ @duckdb_v2.h@
+    -}
+  , upper :: HsBindgen.Runtime.LibC.Word64
+    {- ^ __C declaration:__ @upper@
+
+         __defined at:__ @duckdb_v2.h 11863:11@
+
+         __exported by:__ @duckdb_v2.h@
+    -}
+  }
+  deriving stock (Eq, BG.Generic, Show)
+
+instance Marshal.StaticSize DuckDBV2UhugeintT where
+
+  staticSizeOf = \_ -> (16 :: Int)
+
+  staticAlignment = \_ -> (8 :: Int)
+
+instance Marshal.ReadRaw DuckDBV2UhugeintT where
+
+  readRaw =
+    \ptr0 ->
+          pure DuckDBV2UhugeintT
+      <*> HasCField.readRaw (BG.Proxy @"lower") ptr0
+      <*> HasCField.readRaw (BG.Proxy @"upper") ptr0
+
+instance Marshal.WriteRaw DuckDBV2UhugeintT where
+
+  writeRaw =
+    \ptr0 ->
+      \s1 ->
+        case s1 of
+          DuckDBV2UhugeintT lower2 upper3 ->
+               HasCField.writeRaw (BG.Proxy @"lower") ptr0 lower2
+            >> HasCField.writeRaw (BG.Proxy @"upper") ptr0 upper3
+
+deriving via Marshal.EquivStorable DuckDBV2UhugeintT instance BG.Storable DuckDBV2UhugeintT
+
+deriving via Struct.IsStructViaReadRaw DuckDBV2UhugeintT instance Struct.IsStruct DuckDBV2UhugeintT
+
+{-| __C declaration:__ @lower@
+
+    __defined at:__ @duckdb_v2.h 11862:11@
+
+    __exported by:__ @duckdb_v2.h@
+-}
+instance ( ty ~ HsBindgen.Runtime.LibC.Word64
+         ) => BG.CompatHasField.HasField "lower" DuckDBV2UhugeintT ty where
+
+  hasField =
+    \x0 ->
+      ( \y1 ->
+          DuckDBV2UhugeintT {lower = y1, upper = BG.getField @"upper" x0}
+      , BG.getField @"lower" x0
+      )
+
+instance ( ty ~ HsBindgen.Runtime.LibC.Word64
+         ) => BG.HasField "lower" (BG.Ptr DuckDBV2UhugeintT) (BG.Ptr ty) where
+
+  getField = HasCField.fromPtr (BG.Proxy @"lower")
+
+instance HasCField.HasCField DuckDBV2UhugeintT "lower" where
+
+  type CFieldType DuckDBV2UhugeintT "lower" =
+    HsBindgen.Runtime.LibC.Word64
+
+  offset# = \_ -> \_ -> 0
+
+{-| __C declaration:__ @upper@
+
+    __defined at:__ @duckdb_v2.h 11863:11@
+
+    __exported by:__ @duckdb_v2.h@
+-}
+instance ( ty ~ HsBindgen.Runtime.LibC.Word64
+         ) => BG.CompatHasField.HasField "upper" DuckDBV2UhugeintT ty where
+
+  hasField =
+    \x0 ->
+      ( \y1 ->
+          DuckDBV2UhugeintT {upper = y1, lower = BG.getField @"lower" x0}
+      , BG.getField @"upper" x0
+      )
+
+instance ( ty ~ HsBindgen.Runtime.LibC.Word64
+         ) => BG.HasField "upper" (BG.Ptr DuckDBV2UhugeintT) (BG.Ptr ty) where
+
+  getField = HasCField.fromPtr (BG.Proxy @"upper")
+
+instance HasCField.HasCField DuckDBV2UhugeintT "upper" where
+
+  type CFieldType DuckDBV2UhugeintT "upper" =
+    HsBindgen.Runtime.LibC.Word64
+
+  offset# = \_ -> \_ -> 8
+
+{-| __C declaration:__ @struct duckdb_v2_interval_t@
+
+    __defined at:__ @duckdb_v2.h 11866:8@
+
+    __exported by:__ @duckdb_v2.h@
+-}
+data DuckDBV2IntervalT = DuckDBV2IntervalT
+  { months :: HsBindgen.Runtime.LibC.Int32
+    {- ^ __C declaration:__ @months@
+
+         __defined at:__ @duckdb_v2.h 11867:10@
+
+         __exported by:__ @duckdb_v2.h@
+    -}
+  , days :: HsBindgen.Runtime.LibC.Int32
+    {- ^ __C declaration:__ @days@
+
+         __defined at:__ @duckdb_v2.h 11868:10@
+
+         __exported by:__ @duckdb_v2.h@
+    -}
+  , micros :: HsBindgen.Runtime.LibC.Int64
+    {- ^ __C declaration:__ @micros@
+
+         __defined at:__ @duckdb_v2.h 11869:10@
+
+         __exported by:__ @duckdb_v2.h@
+    -}
+  }
+  deriving stock (Eq, BG.Generic, Show)
+
+instance Marshal.StaticSize DuckDBV2IntervalT where
+
+  staticSizeOf = \_ -> (16 :: Int)
+
+  staticAlignment = \_ -> (8 :: Int)
+
+instance Marshal.ReadRaw DuckDBV2IntervalT where
+
+  readRaw =
+    \ptr0 ->
+          pure DuckDBV2IntervalT
+      <*> HasCField.readRaw (BG.Proxy @"months") ptr0
+      <*> HasCField.readRaw (BG.Proxy @"days") ptr0
+      <*> HasCField.readRaw (BG.Proxy @"micros") ptr0
+
+instance Marshal.WriteRaw DuckDBV2IntervalT where
+
+  writeRaw =
+    \ptr0 ->
+      \s1 ->
+        case s1 of
+          DuckDBV2IntervalT months2 days3 micros4 ->
+               HasCField.writeRaw (BG.Proxy @"months") ptr0 months2
+            >> HasCField.writeRaw (BG.Proxy @"days") ptr0 days3
+            >> HasCField.writeRaw (BG.Proxy @"micros") ptr0 micros4
+
+deriving via Marshal.EquivStorable DuckDBV2IntervalT instance BG.Storable DuckDBV2IntervalT
+
+deriving via Struct.IsStructViaReadRaw DuckDBV2IntervalT instance Struct.IsStruct DuckDBV2IntervalT
+
+{-| __C declaration:__ @months@
+
+    __defined at:__ @duckdb_v2.h 11867:10@
+
+    __exported by:__ @duckdb_v2.h@
+-}
+instance ( ty ~ HsBindgen.Runtime.LibC.Int32
+         ) => BG.CompatHasField.HasField "months" DuckDBV2IntervalT ty where
+
+  hasField =
+    \x0 ->
+      ( \y1 ->
+          DuckDBV2IntervalT {months = y1, days = BG.getField @"days" x0, micros = BG.getField @"micros" x0}
+      , BG.getField @"months" x0
+      )
+
+instance ( ty ~ HsBindgen.Runtime.LibC.Int32
+         ) => BG.HasField "months" (BG.Ptr DuckDBV2IntervalT) (BG.Ptr ty) where
+
+  getField = HasCField.fromPtr (BG.Proxy @"months")
+
+instance HasCField.HasCField DuckDBV2IntervalT "months" where
+
+  type CFieldType DuckDBV2IntervalT "months" =
+    HsBindgen.Runtime.LibC.Int32
+
+  offset# = \_ -> \_ -> 0
+
+{-| __C declaration:__ @days@
+
+    __defined at:__ @duckdb_v2.h 11868:10@
+
+    __exported by:__ @duckdb_v2.h@
+-}
+instance ( ty ~ HsBindgen.Runtime.LibC.Int32
+         ) => BG.CompatHasField.HasField "days" DuckDBV2IntervalT ty where
+
+  hasField =
+    \x0 ->
+      ( \y1 ->
+          DuckDBV2IntervalT { days = y1
+                            , months = BG.getField @"months" x0
+                            , micros = BG.getField @"micros" x0
+                            }
+      , BG.getField @"days" x0
+      )
+
+instance ( ty ~ HsBindgen.Runtime.LibC.Int32
+         ) => BG.HasField "days" (BG.Ptr DuckDBV2IntervalT) (BG.Ptr ty) where
+
+  getField = HasCField.fromPtr (BG.Proxy @"days")
+
+instance HasCField.HasCField DuckDBV2IntervalT "days" where
+
+  type CFieldType DuckDBV2IntervalT "days" =
+    HsBindgen.Runtime.LibC.Int32
+
+  offset# = \_ -> \_ -> 4
+
+{-| __C declaration:__ @micros@
+
+    __defined at:__ @duckdb_v2.h 11869:10@
+
+    __exported by:__ @duckdb_v2.h@
+-}
+instance ( ty ~ HsBindgen.Runtime.LibC.Int64
+         ) => BG.CompatHasField.HasField "micros" DuckDBV2IntervalT ty where
+
+  hasField =
+    \x0 ->
+      ( \y1 ->
+          DuckDBV2IntervalT {micros = y1, months = BG.getField @"months" x0, days = BG.getField @"days" x0}
+      , BG.getField @"micros" x0
+      )
+
+instance ( ty ~ HsBindgen.Runtime.LibC.Int64
+         ) => BG.HasField "micros" (BG.Ptr DuckDBV2IntervalT) (BG.Ptr ty) where
+
+  getField = HasCField.fromPtr (BG.Proxy @"micros")
+
+instance HasCField.HasCField DuckDBV2IntervalT "micros" where
+
+  type CFieldType DuckDBV2IntervalT "micros" =
+    HsBindgen.Runtime.LibC.Int64
+
+  offset# = \_ -> \_ -> 8
+
+{-| An owned handle to a statement bound and planned once, executable repeatedly via @duckdb_v2_prepared_statement_execute()@ . Construct with @duckdb_v2_prepared_statement_create()@ and destroy with @duckdb_v2_prepared_statement_destroy()@ . It keeps its connection\'s session alive, so it stays usable across executions and even after the connection is disconnected.
+
+    __C declaration:__ @struct _duckdb_v2_prepared_statement@
+
+    __defined at:__ @duckdb_v2.h 11888:16@
+
+    __exported by:__ @duckdb_v2.h@
+-}
+data DuckDBV2PreparedStatementStruct
+
+instance Marshal.StaticSize DuckDBV2PreparedStatementStruct where
+
+  staticSizeOf = \_ -> (8 :: Int)
+
+  staticAlignment = \_ -> (8 :: Int)
+
+{-| An owned handle to a statement bound and planned once, executable repeatedly via @duckdb_v2_prepared_statement_execute()@ . Construct with @duckdb_v2_prepared_statement_create()@ and destroy with @duckdb_v2_prepared_statement_destroy()@ . It keeps its connection\'s session alive, so it stays usable across executions and even after the connection is disconnected.
+
+    __C declaration:__ @duckdb_v2_prepared_statement_handle@
+
+    __defined at:__ @duckdb_v2.h 11890:5@
+
+    __exported by:__ @duckdb_v2.h@
+-}
+newtype DuckDBV2PreparedStatementHandle = DuckDBV2PreparedStatementHandle
+  { unwrap :: BG.Ptr DuckDBV2PreparedStatementStruct
+  }
+  deriving stock (Eq, BG.Generic, Ord, Show)
+  deriving newtype
+    ( BG.HasFFIType
+    , Marshal.ReadRaw
+    , Marshal.StaticSize
+    , BG.Storable
+    , Marshal.WriteRaw
+    )
+
+instance ( ty ~ BG.Ptr DuckDBV2PreparedStatementStruct
+         ) => BG.CompatHasField.HasField "unwrap" DuckDBV2PreparedStatementHandle ty where
+
+  hasField =
+    \x0 ->
+      ( \y1 ->
+          DuckDBV2PreparedStatementHandle {unwrap = y1}
+      , BG.getField @"unwrap" x0
+      )
+
+instance ( ty ~ BG.Ptr DuckDBV2PreparedStatementStruct
+         ) => BG.HasField "unwrap" (BG.Ptr DuckDBV2PreparedStatementHandle) (BG.Ptr ty) where
+
+  getField = HasCField.fromPtr (BG.Proxy @"unwrap")
+
+instance HasCField.HasCField DuckDBV2PreparedStatementHandle "unwrap" where
+
+  type CFieldType DuckDBV2PreparedStatementHandle "unwrap" =
+    BG.Ptr DuckDBV2PreparedStatementStruct
+
+  offset# = \_ -> \_ -> 0
+
+{-| Shape of a query result. QUERY_RESULT carries rows and columns; CHANGED_ROWS carries an affected row count, as an INSERT, UPDATE, or DELETE without RETURNING produces; NOTHING covers DDL and other statements with no row output.
+
+    __C declaration:__ @enum DUCKDB_V2_RESULT_TYPE@
+
+    __defined at:__ @duckdb_v2.h 12051:14@
+
+    __exported by:__ @duckdb_v2.h@
+-}
+newtype DuckDBV2ResultType = DuckDBV2ResultType
+  { unwrap :: BG.CUInt
+  }
+  deriving stock (Eq, BG.Generic, Ord)
+  deriving newtype (BG.HasFFIType)
+
+instance Marshal.StaticSize DuckDBV2ResultType where
+
+  staticSizeOf = \_ -> (4 :: Int)
+
+  staticAlignment = \_ -> (4 :: Int)
+
+instance Marshal.ReadRaw DuckDBV2ResultType where
+
+  readRaw =
+    \ptr0 ->
+          pure DuckDBV2ResultType
+      <*> Marshal.readRawByteOff ptr0 (0 :: Int)
+
+instance Marshal.WriteRaw DuckDBV2ResultType where
+
+  writeRaw =
+    \ptr0 ->
+      \s1 ->
+        case s1 of
+          DuckDBV2ResultType unwrap2 ->
+            Marshal.writeRawByteOff ptr0 (0 :: Int) unwrap2
+
+deriving via Marshal.EquivStorable DuckDBV2ResultType instance BG.Storable DuckDBV2ResultType
+
+deriving via BG.CUInt instance BG.Prim DuckDBV2ResultType
+
+instance CEnum.CEnum DuckDBV2ResultType where
+
+  type CEnumZ DuckDBV2ResultType = BG.CUInt
+
+  toCEnum = DuckDBV2ResultType
+
+  fromCEnum = BG.getField @"unwrap"
+
+  declaredValues =
+    \_ ->
+      CEnum.declaredValuesFromList [ (0, BG.singleton "DuckDBV2ResultTypeQueryResult")
+                                   , (1, BG.singleton "DuckDBV2ResultTypeChangedRows")
+                                   , (2, BG.singleton "DuckDBV2ResultTypeNothing")
+                                   , (2147483647, BG.singleton "DuckDBV2ResultTypeMaxEnum")
+                                   ]
+
+  showsUndeclared =
+    CEnum.showsWrappedUndeclared "DuckDBV2ResultType"
+
+  readPrecUndeclared =
+    CEnum.readPrecWrappedUndeclared "DuckDBV2ResultType"
+
+instance Show DuckDBV2ResultType where
+
+  showsPrec = CEnum.shows
+
+instance Read DuckDBV2ResultType where
+
+  readPrec = CEnum.readPrec
+
+  readList = BG.readListDefault
+
+  readListPrec = BG.readListPrecDefault
+
+instance ( ty ~ BG.CUInt
+         ) => BG.CompatHasField.HasField "unwrap" DuckDBV2ResultType ty where
+
+  hasField =
+    \x0 ->
+      (\y1 ->
+         DuckDBV2ResultType {unwrap = y1}, BG.getField @"unwrap" x0)
+
+instance ( ty ~ BG.CUInt
+         ) => BG.HasField "unwrap" (BG.Ptr DuckDBV2ResultType) (BG.Ptr ty) where
+
+  getField = HasCField.fromPtr (BG.Proxy @"unwrap")
+
+instance HasCField.HasCField DuckDBV2ResultType "unwrap" where
+
+  type CFieldType DuckDBV2ResultType "unwrap" =
+    BG.CUInt
+
+  offset# = \_ -> \_ -> 0
+
+{-| __C declaration:__ @DUCKDB_V2_RESULT_TYPE_QUERY_RESULT@
+
+    __defined at:__ @duckdb_v2.h 12052:2@
+
+    __exported by:__ @duckdb_v2.h@
+-}
+pattern DuckDBV2ResultTypeQueryResult :: DuckDBV2ResultType
+pattern DuckDBV2ResultTypeQueryResult = DuckDBV2ResultType 0
+
+{-| __C declaration:__ @DUCKDB_V2_RESULT_TYPE_CHANGED_ROWS@
+
+    __defined at:__ @duckdb_v2.h 12053:2@
+
+    __exported by:__ @duckdb_v2.h@
+-}
+pattern DuckDBV2ResultTypeChangedRows :: DuckDBV2ResultType
+pattern DuckDBV2ResultTypeChangedRows = DuckDBV2ResultType 1
+
+{-| __C declaration:__ @DUCKDB_V2_RESULT_TYPE_NOTHING@
+
+    __defined at:__ @duckdb_v2.h 12054:2@
+
+    __exported by:__ @duckdb_v2.h@
+-}
+pattern DuckDBV2ResultTypeNothing :: DuckDBV2ResultType
+pattern DuckDBV2ResultTypeNothing = DuckDBV2ResultType 2
+
+{-| __C declaration:__ @DUCKDB_V2_RESULT_TYPE_MAX_ENUM@
+
+    __defined at:__ @duckdb_v2.h 12055:2@
+
+    __exported by:__ @duckdb_v2.h@
+-}
+pattern DuckDBV2ResultTypeMaxEnum :: DuckDBV2ResultType
+pattern DuckDBV2ResultTypeMaxEnum = DuckDBV2ResultType 2147483647
+
+{-| Outcome of a result_step call. WAITING is the 0-value, so a zero-initialized out-param reads as "no work product yet" rather than CHUNK, the same convention VECTOR_TYPE_OTHER follows. The four states are the ones a consumer acts on; they are deliberately not a projection of any internal enum.
+
+    __C declaration:__ @enum DUCKDB_V2_RESULT_STEP_STATUS@
+
+    __defined at:__ @duckdb_v2.h 12063:14@
+
+    __exported by:__ @duckdb_v2.h@
+-}
+newtype DuckDBV2ResultStepStatus = DuckDBV2ResultStepStatus
+  { unwrap :: BG.CUInt
+  }
+  deriving stock (Eq, BG.Generic, Ord)
+  deriving newtype (BG.HasFFIType)
+
+instance Marshal.StaticSize DuckDBV2ResultStepStatus where
+
+  staticSizeOf = \_ -> (4 :: Int)
+
+  staticAlignment = \_ -> (4 :: Int)
+
+instance Marshal.ReadRaw DuckDBV2ResultStepStatus where
+
+  readRaw =
+    \ptr0 ->
+          pure DuckDBV2ResultStepStatus
+      <*> Marshal.readRawByteOff ptr0 (0 :: Int)
+
+instance Marshal.WriteRaw DuckDBV2ResultStepStatus where
+
+  writeRaw =
+    \ptr0 ->
+      \s1 ->
+        case s1 of
+          DuckDBV2ResultStepStatus unwrap2 ->
+            Marshal.writeRawByteOff ptr0 (0 :: Int) unwrap2
+
+deriving via Marshal.EquivStorable DuckDBV2ResultStepStatus instance BG.Storable DuckDBV2ResultStepStatus
+
+deriving via BG.CUInt instance BG.Prim DuckDBV2ResultStepStatus
+
+instance CEnum.CEnum DuckDBV2ResultStepStatus where
+
+  type CEnumZ DuckDBV2ResultStepStatus = BG.CUInt
+
+  toCEnum = DuckDBV2ResultStepStatus
+
+  fromCEnum = BG.getField @"unwrap"
+
+  declaredValues =
+    \_ ->
+      CEnum.declaredValuesFromList [ (0, BG.singleton "DuckDBV2ResultStepStatusWaiting")
+                                   , (1, BG.singleton "DuckDBV2ResultStepStatusChunk")
+                                   , (2, BG.singleton "DuckDBV2ResultStepStatusFinished")
+                                   , (3, BG.singleton "DuckDBV2ResultStepStatusCancelled")
+                                   , (2147483647, BG.singleton "DuckDBV2ResultStepStatusMaxEnum")
+                                   ]
+
+  showsUndeclared =
+    CEnum.showsWrappedUndeclared "DuckDBV2ResultStepStatus"
+
+  readPrecUndeclared =
+    CEnum.readPrecWrappedUndeclared "DuckDBV2ResultStepStatus"
+
+instance Show DuckDBV2ResultStepStatus where
+
+  showsPrec = CEnum.shows
+
+instance Read DuckDBV2ResultStepStatus where
+
+  readPrec = CEnum.readPrec
+
+  readList = BG.readListDefault
+
+  readListPrec = BG.readListPrecDefault
+
+instance ( ty ~ BG.CUInt
+         ) => BG.CompatHasField.HasField "unwrap" DuckDBV2ResultStepStatus ty where
+
+  hasField =
+    \x0 ->
+      (\y1 ->
+         DuckDBV2ResultStepStatus {unwrap = y1}, BG.getField @"unwrap" x0)
+
+instance ( ty ~ BG.CUInt
+         ) => BG.HasField "unwrap" (BG.Ptr DuckDBV2ResultStepStatus) (BG.Ptr ty) where
+
+  getField = HasCField.fromPtr (BG.Proxy @"unwrap")
+
+instance HasCField.HasCField DuckDBV2ResultStepStatus "unwrap" where
+
+  type CFieldType DuckDBV2ResultStepStatus "unwrap" =
+    BG.CUInt
+
+  offset# = \_ -> \_ -> 0
+
+{-| No chunk yet; step again, or block in result_wait.
+
+    __C declaration:__ @DUCKDB_V2_RESULT_STEP_STATUS_WAITING@
+
+    __defined at:__ @duckdb_v2.h 12065:2@
+
+    __exported by:__ @duckdb_v2.h@
+-}
+pattern DuckDBV2ResultStepStatusWaiting :: DuckDBV2ResultStepStatus
+pattern DuckDBV2ResultStepStatusWaiting = DuckDBV2ResultStepStatus 0
+
+{-| A caller-owned chunk was written to *out_chunk, or an array to *out_array.
+
+    __C declaration:__ @DUCKDB_V2_RESULT_STEP_STATUS_CHUNK@
+
+    __defined at:__ @duckdb_v2.h 12068:2@
+
+    __exported by:__ @duckdb_v2.h@
+-}
+pattern DuckDBV2ResultStepStatusChunk :: DuckDBV2ResultStepStatus
+pattern DuckDBV2ResultStepStatusChunk = DuckDBV2ResultStepStatus 1
+
+{-| Stream exhausted. Sticky.
+
+    __C declaration:__ @DUCKDB_V2_RESULT_STEP_STATUS_FINISHED@
+
+    __defined at:__ @duckdb_v2.h 12071:2@
+
+    __exported by:__ @duckdb_v2.h@
+-}
+pattern DuckDBV2ResultStepStatusFinished :: DuckDBV2ResultStepStatus
+pattern DuckDBV2ResultStepStatusFinished = DuckDBV2ResultStepStatus 2
+
+{-| Query was interrupted. Sticky.
+
+    __C declaration:__ @DUCKDB_V2_RESULT_STEP_STATUS_CANCELLED@
+
+    __defined at:__ @duckdb_v2.h 12074:2@
+
+    __exported by:__ @duckdb_v2.h@
+-}
+pattern DuckDBV2ResultStepStatusCancelled :: DuckDBV2ResultStepStatus
+pattern DuckDBV2ResultStepStatusCancelled = DuckDBV2ResultStepStatus 3
+
+{-| __C declaration:__ @DUCKDB_V2_RESULT_STEP_STATUS_MAX_ENUM@
+
+    __defined at:__ @duckdb_v2.h 12075:2@
+
+    __exported by:__ @duckdb_v2.h@
+-}
+pattern DuckDBV2ResultStepStatusMaxEnum :: DuckDBV2ResultStepStatus
+pattern DuckDBV2ResultStepStatusMaxEnum = DuckDBV2ResultStepStatus 2147483647
+
+{-| Whether a table function\'s scan is partitioned by a given set of columns, and how. Reported by @duckdb_v2_table_function_set_partitioning_callback()@ via @duckdb_v2_table_function_partitioning_set_partition_info()@ .
+
+    __C declaration:__ @enum DUCKDB_V2_TABLE_PARTITION_INFO@
+
+    __defined at:__ @duckdb_v2.h 12401:14@
+
+    __exported by:__ @duckdb_v2.h@
+-}
+newtype DuckDBV2TablePartitionInfo = DuckDBV2TablePartitionInfo
+  { unwrap :: BG.CUInt
+  }
+  deriving stock (Eq, BG.Generic, Ord)
+  deriving newtype (BG.HasFFIType)
+
+instance Marshal.StaticSize DuckDBV2TablePartitionInfo where
+
+  staticSizeOf = \_ -> (4 :: Int)
+
+  staticAlignment = \_ -> (4 :: Int)
+
+instance Marshal.ReadRaw DuckDBV2TablePartitionInfo where
+
+  readRaw =
+    \ptr0 ->
+          pure DuckDBV2TablePartitionInfo
+      <*> Marshal.readRawByteOff ptr0 (0 :: Int)
+
+instance Marshal.WriteRaw DuckDBV2TablePartitionInfo where
+
+  writeRaw =
+    \ptr0 ->
+      \s1 ->
+        case s1 of
+          DuckDBV2TablePartitionInfo unwrap2 ->
+            Marshal.writeRawByteOff ptr0 (0 :: Int) unwrap2
+
+deriving via Marshal.EquivStorable DuckDBV2TablePartitionInfo instance BG.Storable DuckDBV2TablePartitionInfo
+
+deriving via BG.CUInt instance BG.Prim DuckDBV2TablePartitionInfo
+
+instance CEnum.CEnum DuckDBV2TablePartitionInfo where
+
+  type CEnumZ DuckDBV2TablePartitionInfo = BG.CUInt
+
+  toCEnum = DuckDBV2TablePartitionInfo
+
+  fromCEnum = BG.getField @"unwrap"
+
+  declaredValues =
+    \_ ->
+      CEnum.declaredValuesFromList [ (0, BG.singleton "DuckDBV2TablePartitionInfoNotPartitioned")
+                                   , (1, BG.singleton "DuckDBV2TablePartitionInfoSingleValuePartitions")
+                                   , (2, BG.singleton "DuckDBV2TablePartitionInfoOverlappingPartitions")
+                                   , (3, BG.singleton "DuckDBV2TablePartitionInfoDisjointPartitions")
+                                   , (2147483647, BG.singleton "DuckDBV2TablePartitionInfoMaxEnum")
+                                   ]
+
+  showsUndeclared =
+    CEnum.showsWrappedUndeclared "DuckDBV2TablePartitionInfo"
+
+  readPrecUndeclared =
+    CEnum.readPrecWrappedUndeclared "DuckDBV2TablePartitionInfo"
+
+instance Show DuckDBV2TablePartitionInfo where
+
+  showsPrec = CEnum.shows
+
+instance Read DuckDBV2TablePartitionInfo where
+
+  readPrec = CEnum.readPrec
+
+  readList = BG.readListDefault
+
+  readListPrec = BG.readListPrecDefault
+
+instance ( ty ~ BG.CUInt
+         ) => BG.CompatHasField.HasField "unwrap" DuckDBV2TablePartitionInfo ty where
+
+  hasField =
+    \x0 ->
+      (\y1 ->
+         DuckDBV2TablePartitionInfo {unwrap = y1}, BG.getField @"unwrap" x0)
+
+instance ( ty ~ BG.CUInt
+         ) => BG.HasField "unwrap" (BG.Ptr DuckDBV2TablePartitionInfo) (BG.Ptr ty) where
+
+  getField = HasCField.fromPtr (BG.Proxy @"unwrap")
+
+instance HasCField.HasCField DuckDBV2TablePartitionInfo "unwrap" where
+
+  type CFieldType DuckDBV2TablePartitionInfo "unwrap" =
+    BG.CUInt
+
+  offset# = \_ -> \_ -> 0
+
+{-| The scan is not known to be partitioned by the requested columns.
+
+    __C declaration:__ @DUCKDB_V2_TABLE_PARTITION_INFO_NOT_PARTITIONED@
+
+    __defined at:__ @duckdb_v2.h 12403:2@
+
+    __exported by:__ @duckdb_v2.h@
+-}
+pattern DuckDBV2TablePartitionInfoNotPartitioned :: DuckDBV2TablePartitionInfo
+pattern DuckDBV2TablePartitionInfoNotPartitioned = DuckDBV2TablePartitionInfo 0
+
+{-| Each partition the scan produces carries exactly one distinct value for the requested columns.
+
+    __C declaration:__ @DUCKDB_V2_TABLE_PARTITION_INFO_SINGLE_VALUE_PARTITIONS@
+
+    __defined at:__ @duckdb_v2.h 12406:2@
+
+    __exported by:__ @duckdb_v2.h@
+-}
+pattern DuckDBV2TablePartitionInfoSingleValuePartitions :: DuckDBV2TablePartitionInfo
+pattern DuckDBV2TablePartitionInfoSingleValuePartitions = DuckDBV2TablePartitionInfo 1
+
+{-| The partitions the scan produces overlap only at their boundaries.
+
+    __C declaration:__ @DUCKDB_V2_TABLE_PARTITION_INFO_OVERLAPPING_PARTITIONS@
+
+    __defined at:__ @duckdb_v2.h 12409:2@
+
+    __exported by:__ @duckdb_v2.h@
+-}
+pattern DuckDBV2TablePartitionInfoOverlappingPartitions :: DuckDBV2TablePartitionInfo
+pattern DuckDBV2TablePartitionInfoOverlappingPartitions = DuckDBV2TablePartitionInfo 2
+
+{-| The partitions the scan produces are disjoint ranges.
+
+    __C declaration:__ @DUCKDB_V2_TABLE_PARTITION_INFO_DISJOINT_PARTITIONS@
+
+    __defined at:__ @duckdb_v2.h 12412:2@
+
+    __exported by:__ @duckdb_v2.h@
+-}
+pattern DuckDBV2TablePartitionInfoDisjointPartitions :: DuckDBV2TablePartitionInfo
+pattern DuckDBV2TablePartitionInfoDisjointPartitions = DuckDBV2TablePartitionInfo 3
+
+{-| __C declaration:__ @DUCKDB_V2_TABLE_PARTITION_INFO_MAX_ENUM@
+
+    __defined at:__ @duckdb_v2.h 12413:2@
+
+    __exported by:__ @duckdb_v2.h@
+-}
+pattern DuckDBV2TablePartitionInfoMaxEnum :: DuckDBV2TablePartitionInfo
+pattern DuckDBV2TablePartitionInfoMaxEnum = DuckDBV2TablePartitionInfo 2147483647
+
+{-| An owned opaque handle to a custom table function being built. Created with @duckdb_v2_table_function_create()@ , configured with the setter functions (e.g. @duckdb_v2_table_function_set_name()@ , @duckdb_v2_table_function_set_exec_callback()@ , etc.) and the signature obtained via @duckdb_v2_table_function_get_signature()@ , made available with @duckdb_v2_connection_register_table_function()@ or @duckdb_v2_extension_register_table_function()@ , and destroyed with @duckdb_v2_table_function_destroy()@ .
+
+    __C declaration:__ @struct _duckdb_v2_table_function@
+
+    __defined at:__ @duckdb_v2.h 12427:16@
+
+    __exported by:__ @duckdb_v2.h@
+-}
+data DuckDBV2TableFunctionStruct
+
+instance Marshal.StaticSize DuckDBV2TableFunctionStruct where
+
+  staticSizeOf = \_ -> (8 :: Int)
+
+  staticAlignment = \_ -> (8 :: Int)
+
+{-| An owned opaque handle to a custom table function being built. Created with @duckdb_v2_table_function_create()@ , configured with the setter functions (e.g. @duckdb_v2_table_function_set_name()@ , @duckdb_v2_table_function_set_exec_callback()@ , etc.) and the signature obtained via @duckdb_v2_table_function_get_signature()@ , made available with @duckdb_v2_connection_register_table_function()@ or @duckdb_v2_extension_register_table_function()@ , and destroyed with @duckdb_v2_table_function_destroy()@ .
+
+    __C declaration:__ @duckdb_v2_table_function_handle@
+
+    __defined at:__ @duckdb_v2.h 12429:5@
+
+    __exported by:__ @duckdb_v2.h@
+-}
+newtype DuckDBV2TableFunctionHandle = DuckDBV2TableFunctionHandle
+  { unwrap :: BG.Ptr DuckDBV2TableFunctionStruct
+  }
+  deriving stock (Eq, BG.Generic, Ord, Show)
+  deriving newtype
+    ( BG.HasFFIType
+    , Marshal.ReadRaw
+    , Marshal.StaticSize
+    , BG.Storable
+    , Marshal.WriteRaw
+    )
+
+instance ( ty ~ BG.Ptr DuckDBV2TableFunctionStruct
+         ) => BG.CompatHasField.HasField "unwrap" DuckDBV2TableFunctionHandle ty where
+
+  hasField =
+    \x0 ->
+      (\y1 ->
+         DuckDBV2TableFunctionHandle {unwrap = y1}, BG.getField @"unwrap" x0)
+
+instance ( ty ~ BG.Ptr DuckDBV2TableFunctionStruct
+         ) => BG.HasField "unwrap" (BG.Ptr DuckDBV2TableFunctionHandle) (BG.Ptr ty) where
+
+  getField = HasCField.fromPtr (BG.Proxy @"unwrap")
+
+instance HasCField.HasCField DuckDBV2TableFunctionHandle "unwrap" where
+
+  type CFieldType DuckDBV2TableFunctionHandle "unwrap" =
+    BG.Ptr DuckDBV2TableFunctionStruct
+
+  offset# = \_ -> \_ -> 0
+
+{-| A borrowed opaque handle to the result of a table function\'s "bind" phase. The "bind" callback receives this handle next to a @t'DuckDBV2FunctionBindInfoHandle'@ , which gives access to the arguments, the user data and the bind data. It must use this handle to declare the columns the function returns, and can use it to hint at the number of rows the scan will produce.
+
+    __C declaration:__ @struct _duckdb_v2_table_function_bind_info@
+
+    __defined at:__ @duckdb_v2.h 12437:16@
+
+    __exported by:__ @duckdb_v2.h@
+-}
+data DuckDBV2TableFunctionBindInfoStruct
+
+instance Marshal.StaticSize DuckDBV2TableFunctionBindInfoStruct where
+
+  staticSizeOf = \_ -> (8 :: Int)
+
+  staticAlignment = \_ -> (8 :: Int)
+
+{-| A borrowed opaque handle to the result of a table function\'s "bind" phase. The "bind" callback receives this handle next to a @t'DuckDBV2FunctionBindInfoHandle'@ , which gives access to the arguments, the user data and the bind data. It must use this handle to declare the columns the function returns, and can use it to hint at the number of rows the scan will produce.
+
+    __C declaration:__ @duckdb_v2_table_function_bind_info_handle@
+
+    __defined at:__ @duckdb_v2.h 12439:5@
+
+    __exported by:__ @duckdb_v2.h@
+-}
+newtype DuckDBV2TableFunctionBindInfoHandle = DuckDBV2TableFunctionBindInfoHandle
+  { unwrap :: BG.Ptr DuckDBV2TableFunctionBindInfoStruct
+  }
+  deriving stock (Eq, BG.Generic, Ord, Show)
+  deriving newtype
+    ( BG.HasFFIType
+    , Marshal.ReadRaw
+    , Marshal.StaticSize
+    , BG.Storable
+    , Marshal.WriteRaw
+    )
+
+instance ( ty ~ BG.Ptr DuckDBV2TableFunctionBindInfoStruct
+         ) => BG.CompatHasField.HasField "unwrap" DuckDBV2TableFunctionBindInfoHandle ty where
+
+  hasField =
+    \x0 ->
+      ( \y1 ->
+          DuckDBV2TableFunctionBindInfoHandle {unwrap = y1}
+      , BG.getField @"unwrap" x0
+      )
+
+instance ( ty ~ BG.Ptr DuckDBV2TableFunctionBindInfoStruct
+         ) => BG.HasField "unwrap" (BG.Ptr DuckDBV2TableFunctionBindInfoHandle) (BG.Ptr ty) where
+
+  getField = HasCField.fromPtr (BG.Proxy @"unwrap")
+
+instance HasCField.HasCField DuckDBV2TableFunctionBindInfoHandle "unwrap" where
+
+  type CFieldType DuckDBV2TableFunctionBindInfoHandle "unwrap" =
+    BG.Ptr DuckDBV2TableFunctionBindInfoStruct
+
+  offset# = \_ -> \_ -> 0
+
+{-| A borrowed opaque handle to the arguments supplied to a table function during the global state initialization "init global" phase. The "init global" callback receives this handle and can use it to e.g. set up the state shared by every thread scanning the function, and to declare how many threads may scan it.
+
+    __C declaration:__ @struct _duckdb_v2_table_function_init_global_info@
+
+    __defined at:__ @duckdb_v2.h 12446:16@
+
+    __exported by:__ @duckdb_v2.h@
+-}
+data DuckDBV2TableFunctionInitGlobalInfoStruct
+
+instance Marshal.StaticSize DuckDBV2TableFunctionInitGlobalInfoStruct where
+
+  staticSizeOf = \_ -> (8 :: Int)
+
+  staticAlignment = \_ -> (8 :: Int)
+
+{-| A borrowed opaque handle to the arguments supplied to a table function during the global state initialization "init global" phase. The "init global" callback receives this handle and can use it to e.g. set up the state shared by every thread scanning the function, and to declare how many threads may scan it.
+
+    __C declaration:__ @duckdb_v2_table_function_init_global_info_handle@
+
+    __defined at:__ @duckdb_v2.h 12448:5@
+
+    __exported by:__ @duckdb_v2.h@
+-}
+newtype DuckDBV2TableFunctionInitGlobalInfoHandle = DuckDBV2TableFunctionInitGlobalInfoHandle
+  { unwrap :: BG.Ptr DuckDBV2TableFunctionInitGlobalInfoStruct
+  }
+  deriving stock (Eq, BG.Generic, Ord, Show)
+  deriving newtype
+    ( BG.HasFFIType
+    , Marshal.ReadRaw
+    , Marshal.StaticSize
+    , BG.Storable
+    , Marshal.WriteRaw
+    )
+
+instance ( ty ~ BG.Ptr DuckDBV2TableFunctionInitGlobalInfoStruct
+         ) => BG.CompatHasField.HasField "unwrap" DuckDBV2TableFunctionInitGlobalInfoHandle ty where
+
+  hasField =
+    \x0 ->
+      ( \y1 ->
+          DuckDBV2TableFunctionInitGlobalInfoHandle {unwrap = y1}
+      , BG.getField @"unwrap" x0
+      )
+
+instance ( ty ~ BG.Ptr DuckDBV2TableFunctionInitGlobalInfoStruct
+         ) => BG.HasField "unwrap" (BG.Ptr DuckDBV2TableFunctionInitGlobalInfoHandle) (BG.Ptr ty) where
+
+  getField = HasCField.fromPtr (BG.Proxy @"unwrap")
+
+instance HasCField.HasCField DuckDBV2TableFunctionInitGlobalInfoHandle "unwrap" where
+
+  type CFieldType DuckDBV2TableFunctionInitGlobalInfoHandle "unwrap" =
+    BG.Ptr DuckDBV2TableFunctionInitGlobalInfoStruct
+
+  offset# = \_ -> \_ -> 0
+
+{-| A borrowed opaque handle to the arguments supplied to a table function during the local state initialization "init local" phase. The "init local" callback receives this handle and can use it to e.g. set up worker-local state, typically by claiming work from the shared global state.
+
+    __C declaration:__ @struct _duckdb_v2_table_function_init_local_info@
+
+    __defined at:__ @duckdb_v2.h 12455:16@
+
+    __exported by:__ @duckdb_v2.h@
+-}
+data DuckDBV2TableFunctionInitLocalInfoStruct
+
+instance Marshal.StaticSize DuckDBV2TableFunctionInitLocalInfoStruct where
+
+  staticSizeOf = \_ -> (8 :: Int)
+
+  staticAlignment = \_ -> (8 :: Int)
+
+{-| A borrowed opaque handle to the arguments supplied to a table function during the local state initialization "init local" phase. The "init local" callback receives this handle and can use it to e.g. set up worker-local state, typically by claiming work from the shared global state.
+
+    __C declaration:__ @duckdb_v2_table_function_init_local_info_handle@
+
+    __defined at:__ @duckdb_v2.h 12457:5@
+
+    __exported by:__ @duckdb_v2.h@
+-}
+newtype DuckDBV2TableFunctionInitLocalInfoHandle = DuckDBV2TableFunctionInitLocalInfoHandle
+  { unwrap :: BG.Ptr DuckDBV2TableFunctionInitLocalInfoStruct
+  }
+  deriving stock (Eq, BG.Generic, Ord, Show)
+  deriving newtype
+    ( BG.HasFFIType
+    , Marshal.ReadRaw
+    , Marshal.StaticSize
+    , BG.Storable
+    , Marshal.WriteRaw
+    )
+
+instance ( ty ~ BG.Ptr DuckDBV2TableFunctionInitLocalInfoStruct
+         ) => BG.CompatHasField.HasField "unwrap" DuckDBV2TableFunctionInitLocalInfoHandle ty where
+
+  hasField =
+    \x0 ->
+      ( \y1 ->
+          DuckDBV2TableFunctionInitLocalInfoHandle {unwrap = y1}
+      , BG.getField @"unwrap" x0
+      )
+
+instance ( ty ~ BG.Ptr DuckDBV2TableFunctionInitLocalInfoStruct
+         ) => BG.HasField "unwrap" (BG.Ptr DuckDBV2TableFunctionInitLocalInfoHandle) (BG.Ptr ty) where
+
+  getField = HasCField.fromPtr (BG.Proxy @"unwrap")
+
+instance HasCField.HasCField DuckDBV2TableFunctionInitLocalInfoHandle "unwrap" where
+
+  type CFieldType DuckDBV2TableFunctionInitLocalInfoHandle "unwrap" =
+    BG.Ptr DuckDBV2TableFunctionInitLocalInfoStruct
+
+  offset# = \_ -> \_ -> 0
+
+{-| A borrowed opaque handle to the arguments supplied to a table function during the execution "exec" phase. The "exec" callback receives this handle and can use it to e.g. access the global and local state and write the next batch of rows to the output chunk.
+
+    __C declaration:__ @struct _duckdb_v2_table_function_exec_info@
+
+    __defined at:__ @duckdb_v2.h 12464:16@
+
+    __exported by:__ @duckdb_v2.h@
+-}
+data DuckDBV2TableFunctionExecInfoStruct
+
+instance Marshal.StaticSize DuckDBV2TableFunctionExecInfoStruct where
+
+  staticSizeOf = \_ -> (8 :: Int)
+
+  staticAlignment = \_ -> (8 :: Int)
+
+{-| A borrowed opaque handle to the arguments supplied to a table function during the execution "exec" phase. The "exec" callback receives this handle and can use it to e.g. access the global and local state and write the next batch of rows to the output chunk.
+
+    __C declaration:__ @duckdb_v2_table_function_exec_info_handle@
+
+    __defined at:__ @duckdb_v2.h 12466:5@
+
+    __exported by:__ @duckdb_v2.h@
+-}
+newtype DuckDBV2TableFunctionExecInfoHandle = DuckDBV2TableFunctionExecInfoHandle
+  { unwrap :: BG.Ptr DuckDBV2TableFunctionExecInfoStruct
+  }
+  deriving stock (Eq, BG.Generic, Ord, Show)
+  deriving newtype
+    ( BG.HasFFIType
+    , Marshal.ReadRaw
+    , Marshal.StaticSize
+    , BG.Storable
+    , Marshal.WriteRaw
+    )
+
+instance ( ty ~ BG.Ptr DuckDBV2TableFunctionExecInfoStruct
+         ) => BG.CompatHasField.HasField "unwrap" DuckDBV2TableFunctionExecInfoHandle ty where
+
+  hasField =
+    \x0 ->
+      ( \y1 ->
+          DuckDBV2TableFunctionExecInfoHandle {unwrap = y1}
+      , BG.getField @"unwrap" x0
+      )
+
+instance ( ty ~ BG.Ptr DuckDBV2TableFunctionExecInfoStruct
+         ) => BG.HasField "unwrap" (BG.Ptr DuckDBV2TableFunctionExecInfoHandle) (BG.Ptr ty) where
+
+  getField = HasCField.fromPtr (BG.Proxy @"unwrap")
+
+instance HasCField.HasCField DuckDBV2TableFunctionExecInfoHandle "unwrap" where
+
+  type CFieldType DuckDBV2TableFunctionExecInfoHandle "unwrap" =
+    BG.Ptr DuckDBV2TableFunctionExecInfoStruct
+
+  offset# = \_ -> \_ -> 0
+
+{-| A borrowed opaque handle to the arguments supplied to a table function during the "progress" phase. The "progress" callback receives this handle and can use it to report how far the scan has advanced.
+
+    __C declaration:__ @struct _duckdb_v2_table_function_progress_info@
+
+    __defined at:__ @duckdb_v2.h 12472:16@
+
+    __exported by:__ @duckdb_v2.h@
+-}
+data DuckDBV2TableFunctionProgressInfoStruct
+
+instance Marshal.StaticSize DuckDBV2TableFunctionProgressInfoStruct where
+
+  staticSizeOf = \_ -> (8 :: Int)
+
+  staticAlignment = \_ -> (8 :: Int)
+
+{-| A borrowed opaque handle to the arguments supplied to a table function during the "progress" phase. The "progress" callback receives this handle and can use it to report how far the scan has advanced.
+
+    __C declaration:__ @duckdb_v2_table_function_progress_info_handle@
+
+    __defined at:__ @duckdb_v2.h 12474:5@
+
+    __exported by:__ @duckdb_v2.h@
+-}
+newtype DuckDBV2TableFunctionProgressInfoHandle = DuckDBV2TableFunctionProgressInfoHandle
+  { unwrap :: BG.Ptr DuckDBV2TableFunctionProgressInfoStruct
+  }
+  deriving stock (Eq, BG.Generic, Ord, Show)
+  deriving newtype
+    ( BG.HasFFIType
+    , Marshal.ReadRaw
+    , Marshal.StaticSize
+    , BG.Storable
+    , Marshal.WriteRaw
+    )
+
+instance ( ty ~ BG.Ptr DuckDBV2TableFunctionProgressInfoStruct
+         ) => BG.CompatHasField.HasField "unwrap" DuckDBV2TableFunctionProgressInfoHandle ty where
+
+  hasField =
+    \x0 ->
+      ( \y1 ->
+          DuckDBV2TableFunctionProgressInfoHandle {unwrap = y1}
+      , BG.getField @"unwrap" x0
+      )
+
+instance ( ty ~ BG.Ptr DuckDBV2TableFunctionProgressInfoStruct
+         ) => BG.HasField "unwrap" (BG.Ptr DuckDBV2TableFunctionProgressInfoHandle) (BG.Ptr ty) where
+
+  getField = HasCField.fromPtr (BG.Proxy @"unwrap")
+
+instance HasCField.HasCField DuckDBV2TableFunctionProgressInfoHandle "unwrap" where
+
+  type CFieldType DuckDBV2TableFunctionProgressInfoHandle "unwrap" =
+    BG.Ptr DuckDBV2TableFunctionProgressInfoStruct
+
+  offset# = \_ -> \_ -> 0
+
+{-| A borrowed opaque handle to the arguments supplied to a table function during the "filter pushdown" phase of query optimization. The "filter pushdown" callback receives this handle and can use it to inspect the filter predicates the query applies to the function\'s rows, and to accept the ones it will apply itself.
+
+    __C declaration:__ @struct _duckdb_v2_table_function_filter_pushdown_info@
+
+    __defined at:__ @duckdb_v2.h 12481:16@
+
+    __exported by:__ @duckdb_v2.h@
+-}
+data DuckDBV2TableFunctionFilterPushdownInfoStruct
+
+instance Marshal.StaticSize DuckDBV2TableFunctionFilterPushdownInfoStruct where
+
+  staticSizeOf = \_ -> (8 :: Int)
+
+  staticAlignment = \_ -> (8 :: Int)
+
+{-| A borrowed opaque handle to the arguments supplied to a table function during the "filter pushdown" phase of query optimization. The "filter pushdown" callback receives this handle and can use it to inspect the filter predicates the query applies to the function\'s rows, and to accept the ones it will apply itself.
+
+    __C declaration:__ @duckdb_v2_table_function_filter_pushdown_info_handle@
+
+    __defined at:__ @duckdb_v2.h 12483:5@
+
+    __exported by:__ @duckdb_v2.h@
+-}
+newtype DuckDBV2TableFunctionFilterPushdownInfoHandle = DuckDBV2TableFunctionFilterPushdownInfoHandle
+  { unwrap :: BG.Ptr DuckDBV2TableFunctionFilterPushdownInfoStruct
+  }
+  deriving stock (Eq, BG.Generic, Ord, Show)
+  deriving newtype
+    ( BG.HasFFIType
+    , Marshal.ReadRaw
+    , Marshal.StaticSize
+    , BG.Storable
+    , Marshal.WriteRaw
+    )
+
+instance ( ty ~ BG.Ptr DuckDBV2TableFunctionFilterPushdownInfoStruct
+         ) => BG.CompatHasField.HasField "unwrap" DuckDBV2TableFunctionFilterPushdownInfoHandle ty where
+
+  hasField =
+    \x0 ->
+      ( \y1 ->
+          DuckDBV2TableFunctionFilterPushdownInfoHandle {unwrap = y1}
+      , BG.getField @"unwrap" x0
+      )
+
+instance ( ty ~ BG.Ptr DuckDBV2TableFunctionFilterPushdownInfoStruct
+         ) => BG.HasField "unwrap" (BG.Ptr DuckDBV2TableFunctionFilterPushdownInfoHandle) (BG.Ptr ty) where
+
+  getField = HasCField.fromPtr (BG.Proxy @"unwrap")
+
+instance HasCField.HasCField DuckDBV2TableFunctionFilterPushdownInfoHandle "unwrap" where
+
+  type CFieldType DuckDBV2TableFunctionFilterPushdownInfoHandle "unwrap" =
+    BG.Ptr DuckDBV2TableFunctionFilterPushdownInfoStruct
+
+  offset# = \_ -> \_ -> 0
+
+{-| A borrowed opaque handle to the arguments supplied to a table function during the "partition data" phase. The engine invokes the callback on the worker thread that just produced a batch of rows, once per batch, only when a downstream operator needs to know the batch\'s ordering position, the values of a set of partitioning columns, or both; the handle reports which of those were actually requested and receives the answer.
+
+    __C declaration:__ @struct _duckdb_v2_table_function_partition_data_info@
+
+    __defined at:__ @duckdb_v2.h 12491:16@
+
+    __exported by:__ @duckdb_v2.h@
+-}
+data DuckDBV2TableFunctionPartitionDataInfoStruct
+
+instance Marshal.StaticSize DuckDBV2TableFunctionPartitionDataInfoStruct where
+
+  staticSizeOf = \_ -> (8 :: Int)
+
+  staticAlignment = \_ -> (8 :: Int)
+
+{-| A borrowed opaque handle to the arguments supplied to a table function during the "partition data" phase. The engine invokes the callback on the worker thread that just produced a batch of rows, once per batch, only when a downstream operator needs to know the batch\'s ordering position, the values of a set of partitioning columns, or both; the handle reports which of those were actually requested and receives the answer.
+
+    __C declaration:__ @duckdb_v2_table_function_partition_data_info_handle@
+
+    __defined at:__ @duckdb_v2.h 12493:5@
+
+    __exported by:__ @duckdb_v2.h@
+-}
+newtype DuckDBV2TableFunctionPartitionDataInfoHandle = DuckDBV2TableFunctionPartitionDataInfoHandle
+  { unwrap :: BG.Ptr DuckDBV2TableFunctionPartitionDataInfoStruct
+  }
+  deriving stock (Eq, BG.Generic, Ord, Show)
+  deriving newtype
+    ( BG.HasFFIType
+    , Marshal.ReadRaw
+    , Marshal.StaticSize
+    , BG.Storable
+    , Marshal.WriteRaw
+    )
+
+instance ( ty ~ BG.Ptr DuckDBV2TableFunctionPartitionDataInfoStruct
+         ) => BG.CompatHasField.HasField "unwrap" DuckDBV2TableFunctionPartitionDataInfoHandle ty where
+
+  hasField =
+    \x0 ->
+      ( \y1 ->
+          DuckDBV2TableFunctionPartitionDataInfoHandle {unwrap = y1}
+      , BG.getField @"unwrap" x0
+      )
+
+instance ( ty ~ BG.Ptr DuckDBV2TableFunctionPartitionDataInfoStruct
+         ) => BG.HasField "unwrap" (BG.Ptr DuckDBV2TableFunctionPartitionDataInfoHandle) (BG.Ptr ty) where
+
+  getField = HasCField.fromPtr (BG.Proxy @"unwrap")
+
+instance HasCField.HasCField DuckDBV2TableFunctionPartitionDataInfoHandle "unwrap" where
+
+  type CFieldType DuckDBV2TableFunctionPartitionDataInfoHandle "unwrap" =
+    BG.Ptr DuckDBV2TableFunctionPartitionDataInfoStruct
+
+  offset# = \_ -> \_ -> 0
+
+{-| A borrowed opaque handle to the arguments supplied to a table function during the "partitioning" phase of query optimization. The engine invokes the callback once per candidate @GROUP BY@ column set, before execution starts, to decide whether the scan can feed a partitioned aggregate directly instead of hashing.
+
+    __C declaration:__ @struct _duckdb_v2_table_function_partitioning_info@
+
+    __defined at:__ @duckdb_v2.h 12500:16@
+
+    __exported by:__ @duckdb_v2.h@
+-}
+data DuckDBV2TableFunctionPartitioningInfoStruct
+
+instance Marshal.StaticSize DuckDBV2TableFunctionPartitioningInfoStruct where
+
+  staticSizeOf = \_ -> (8 :: Int)
+
+  staticAlignment = \_ -> (8 :: Int)
+
+{-| A borrowed opaque handle to the arguments supplied to a table function during the "partitioning" phase of query optimization. The engine invokes the callback once per candidate @GROUP BY@ column set, before execution starts, to decide whether the scan can feed a partitioned aggregate directly instead of hashing.
+
+    __C declaration:__ @duckdb_v2_table_function_partitioning_info_handle@
+
+    __defined at:__ @duckdb_v2.h 12502:5@
+
+    __exported by:__ @duckdb_v2.h@
+-}
+newtype DuckDBV2TableFunctionPartitioningInfoHandle = DuckDBV2TableFunctionPartitioningInfoHandle
+  { unwrap :: BG.Ptr DuckDBV2TableFunctionPartitioningInfoStruct
+  }
+  deriving stock (Eq, BG.Generic, Ord, Show)
+  deriving newtype
+    ( BG.HasFFIType
+    , Marshal.ReadRaw
+    , Marshal.StaticSize
+    , BG.Storable
+    , Marshal.WriteRaw
+    )
+
+instance ( ty ~ BG.Ptr DuckDBV2TableFunctionPartitioningInfoStruct
+         ) => BG.CompatHasField.HasField "unwrap" DuckDBV2TableFunctionPartitioningInfoHandle ty where
+
+  hasField =
+    \x0 ->
+      ( \y1 ->
+          DuckDBV2TableFunctionPartitioningInfoHandle {unwrap = y1}
+      , BG.getField @"unwrap" x0
+      )
+
+instance ( ty ~ BG.Ptr DuckDBV2TableFunctionPartitioningInfoStruct
+         ) => BG.HasField "unwrap" (BG.Ptr DuckDBV2TableFunctionPartitioningInfoHandle) (BG.Ptr ty) where
+
+  getField = HasCField.fromPtr (BG.Proxy @"unwrap")
+
+instance HasCField.HasCField DuckDBV2TableFunctionPartitioningInfoHandle "unwrap" where
+
+  type CFieldType DuckDBV2TableFunctionPartitioningInfoHandle "unwrap" =
+    BG.Ptr DuckDBV2TableFunctionPartitioningInfoStruct
+
+  offset# = \_ -> \_ -> 0
+
+{-| A borrowed opaque handle to the arguments supplied to a table function when a scanning thread claims its next batch of work. The "claim batch" callback receives this handle and can use it to claim the next part of the scan from the shared global state for the thread\'s local state, and to report whether it claimed one.
+
+    __C declaration:__ @struct _duckdb_v2_table_function_claim_batch_info@
+
+    __defined at:__ @duckdb_v2.h 12509:16@
+
+    __exported by:__ @duckdb_v2.h@
+-}
+data DuckDBV2TableFunctionClaimBatchInfoStruct
+
+instance Marshal.StaticSize DuckDBV2TableFunctionClaimBatchInfoStruct where
+
+  staticSizeOf = \_ -> (8 :: Int)
+
+  staticAlignment = \_ -> (8 :: Int)
+
+{-| A borrowed opaque handle to the arguments supplied to a table function when a scanning thread claims its next batch of work. The "claim batch" callback receives this handle and can use it to claim the next part of the scan from the shared global state for the thread\'s local state, and to report whether it claimed one.
+
+    __C declaration:__ @duckdb_v2_table_function_claim_batch_info_handle@
+
+    __defined at:__ @duckdb_v2.h 12511:5@
+
+    __exported by:__ @duckdb_v2.h@
+-}
+newtype DuckDBV2TableFunctionClaimBatchInfoHandle = DuckDBV2TableFunctionClaimBatchInfoHandle
+  { unwrap :: BG.Ptr DuckDBV2TableFunctionClaimBatchInfoStruct
+  }
+  deriving stock (Eq, BG.Generic, Ord, Show)
+  deriving newtype
+    ( BG.HasFFIType
+    , Marshal.ReadRaw
+    , Marshal.StaticSize
+    , BG.Storable
+    , Marshal.WriteRaw
+    )
+
+instance ( ty ~ BG.Ptr DuckDBV2TableFunctionClaimBatchInfoStruct
+         ) => BG.CompatHasField.HasField "unwrap" DuckDBV2TableFunctionClaimBatchInfoHandle ty where
+
+  hasField =
+    \x0 ->
+      ( \y1 ->
+          DuckDBV2TableFunctionClaimBatchInfoHandle {unwrap = y1}
+      , BG.getField @"unwrap" x0
+      )
+
+instance ( ty ~ BG.Ptr DuckDBV2TableFunctionClaimBatchInfoStruct
+         ) => BG.HasField "unwrap" (BG.Ptr DuckDBV2TableFunctionClaimBatchInfoHandle) (BG.Ptr ty) where
+
+  getField = HasCField.fromPtr (BG.Proxy @"unwrap")
+
+instance HasCField.HasCField DuckDBV2TableFunctionClaimBatchInfoHandle "unwrap" where
+
+  type CFieldType DuckDBV2TableFunctionClaimBatchInfoHandle "unwrap" =
+    BG.Ptr DuckDBV2TableFunctionClaimBatchInfoStruct
+
+  offset# = \_ -> \_ -> 0
+
+{-| A borrowed opaque handle to the arguments supplied to a table function when the engine asks it to describe a bound call. The "get bind info" callback receives this handle, and can use it to describe the call in more detail than its columns: with identifiers of its columns (e.g. field ids), and with options - key-value facts about what the call reads.
+
+    __C declaration:__ @struct _duckdb_v2_table_function_get_bind_info_info@
+
+    __defined at:__ @duckdb_v2.h 12519:16@
+
+    __exported by:__ @duckdb_v2.h@
+-}
+data DuckDBV2TableFunctionGetBindInfoInfoStruct
+
+instance Marshal.StaticSize DuckDBV2TableFunctionGetBindInfoInfoStruct where
+
+  staticSizeOf = \_ -> (8 :: Int)
+
+  staticAlignment = \_ -> (8 :: Int)
+
+{-| A borrowed opaque handle to the arguments supplied to a table function when the engine asks it to describe a bound call. The "get bind info" callback receives this handle, and can use it to describe the call in more detail than its columns: with identifiers of its columns (e.g. field ids), and with options - key-value facts about what the call reads.
+
+    __C declaration:__ @duckdb_v2_table_function_get_bind_info_info_handle@
+
+    __defined at:__ @duckdb_v2.h 12521:5@
+
+    __exported by:__ @duckdb_v2.h@
+-}
+newtype DuckDBV2TableFunctionGetBindInfoInfoHandle = DuckDBV2TableFunctionGetBindInfoInfoHandle
+  { unwrap :: BG.Ptr DuckDBV2TableFunctionGetBindInfoInfoStruct
+  }
+  deriving stock (Eq, BG.Generic, Ord, Show)
+  deriving newtype
+    ( BG.HasFFIType
+    , Marshal.ReadRaw
+    , Marshal.StaticSize
+    , BG.Storable
+    , Marshal.WriteRaw
+    )
+
+instance ( ty ~ BG.Ptr DuckDBV2TableFunctionGetBindInfoInfoStruct
+         ) => BG.CompatHasField.HasField "unwrap" DuckDBV2TableFunctionGetBindInfoInfoHandle ty where
+
+  hasField =
+    \x0 ->
+      ( \y1 ->
+          DuckDBV2TableFunctionGetBindInfoInfoHandle {unwrap = y1}
+      , BG.getField @"unwrap" x0
+      )
+
+instance ( ty ~ BG.Ptr DuckDBV2TableFunctionGetBindInfoInfoStruct
+         ) => BG.HasField "unwrap" (BG.Ptr DuckDBV2TableFunctionGetBindInfoInfoHandle) (BG.Ptr ty) where
+
+  getField = HasCField.fromPtr (BG.Proxy @"unwrap")
+
+instance HasCField.HasCField DuckDBV2TableFunctionGetBindInfoInfoHandle "unwrap" where
+
+  type CFieldType DuckDBV2TableFunctionGetBindInfoInfoHandle "unwrap" =
+    BG.Ptr DuckDBV2TableFunctionGetBindInfoInfoStruct
+
+  offset# = \_ -> \_ -> 0
+
+{-| An owned opaque handle to a multi-file table function being built. A multi-file function wraps an already registered table function that reads a single file, and adds everything that is needed to read many files at once on top of it: globbing, lists of files, hive partitioning, the @filename@ column, @union_by_name@ and the like. Created with @duckdb_v2_multi_file_function_create()@ , configured with the setter functions (e.g. @duckdb_v2_multi_file_function_set_name()@ , @duckdb_v2_multi_file_function_set_single_file_function()@ ), made available with @duckdb_v2_connection_register_multi_file_function()@ or @duckdb_v2_extension_register_multi_file_function()@ , and destroyed with @duckdb_v2_multi_file_function_destroy()@ .
+
+    __C declaration:__ @struct _duckdb_v2_multi_file_function@
+
+    __defined at:__ @duckdb_v2.h 12532:16@
+
+    __exported by:__ @duckdb_v2.h@
+-}
+data DuckDBV2MultiFileFunctionStruct
+
+instance Marshal.StaticSize DuckDBV2MultiFileFunctionStruct where
+
+  staticSizeOf = \_ -> (8 :: Int)
+
+  staticAlignment = \_ -> (8 :: Int)
+
+{-| An owned opaque handle to a multi-file table function being built. A multi-file function wraps an already registered table function that reads a single file, and adds everything that is needed to read many files at once on top of it: globbing, lists of files, hive partitioning, the @filename@ column, @union_by_name@ and the like. Created with @duckdb_v2_multi_file_function_create()@ , configured with the setter functions (e.g. @duckdb_v2_multi_file_function_set_name()@ , @duckdb_v2_multi_file_function_set_single_file_function()@ ), made available with @duckdb_v2_connection_register_multi_file_function()@ or @duckdb_v2_extension_register_multi_file_function()@ , and destroyed with @duckdb_v2_multi_file_function_destroy()@ .
+
+    __C declaration:__ @duckdb_v2_multi_file_function_handle@
+
+    __defined at:__ @duckdb_v2.h 12534:5@
+
+    __exported by:__ @duckdb_v2.h@
+-}
+newtype DuckDBV2MultiFileFunctionHandle = DuckDBV2MultiFileFunctionHandle
+  { unwrap :: BG.Ptr DuckDBV2MultiFileFunctionStruct
+  }
+  deriving stock (Eq, BG.Generic, Ord, Show)
+  deriving newtype
+    ( BG.HasFFIType
+    , Marshal.ReadRaw
+    , Marshal.StaticSize
+    , BG.Storable
+    , Marshal.WriteRaw
+    )
+
+instance ( ty ~ BG.Ptr DuckDBV2MultiFileFunctionStruct
+         ) => BG.CompatHasField.HasField "unwrap" DuckDBV2MultiFileFunctionHandle ty where
+
+  hasField =
+    \x0 ->
+      ( \y1 ->
+          DuckDBV2MultiFileFunctionHandle {unwrap = y1}
+      , BG.getField @"unwrap" x0
+      )
+
+instance ( ty ~ BG.Ptr DuckDBV2MultiFileFunctionStruct
+         ) => BG.HasField "unwrap" (BG.Ptr DuckDBV2MultiFileFunctionHandle) (BG.Ptr ty) where
+
+  getField = HasCField.fromPtr (BG.Proxy @"unwrap")
+
+instance HasCField.HasCField DuckDBV2MultiFileFunctionHandle "unwrap" where
+
+  type CFieldType DuckDBV2MultiFileFunctionHandle "unwrap" =
+    BG.Ptr DuckDBV2MultiFileFunctionStruct
+
+  offset# = \_ -> \_ -> 0
+
+{-| Auxiliary type used by t'DuckDBV2TableFunctionBindCallbackFn'
+
+    __C declaration:__ @duckdb_v2_table_function_bind_callback_fn@
+
+    __defined at:__ @duckdb_v2.h 12540:16@
+
+    __exported by:__ @duckdb_v2.h@
+-}
+newtype DuckDBV2TableFunctionBindCallbackFn_Aux = DuckDBV2TableFunctionBindCallbackFn_Aux
+  { unwrap :: DuckDBV2FunctionBindInfoHandle -> DuckDBV2TableFunctionBindInfoHandle -> DuckDBV2ContextHandle -> BG.Ptr DuckDBV2ErrorInfoHandle -> IO ()
+  }
+  deriving stock (BG.Generic)
+
+-- __unique:__ @toDuckDBV2TableFunctionBindCallbackFn_Aux@
+foreign import ccall safe "wrapper" hs_bindgen_4ac3a5f38eba9716_base ::
+     (BG.Ptr BG.Void -> BG.Ptr BG.Void -> BG.Ptr BG.Void -> BG.Ptr BG.Void -> IO ())
+  -> IO (BG.FunPtr (BG.Ptr BG.Void -> BG.Ptr BG.Void -> BG.Ptr BG.Void -> BG.Ptr BG.Void -> IO ()))
+
+-- __unique:__ @toDuckDBV2TableFunctionBindCallbackFn_Aux@
+hs_bindgen_4ac3a5f38eba9716 ::
+     DuckDBV2TableFunctionBindCallbackFn_Aux
+  -> IO (BG.FunPtr DuckDBV2TableFunctionBindCallbackFn_Aux)
+hs_bindgen_4ac3a5f38eba9716 =
+  \fun0 ->
+    fmap BG.castFunPtr (hs_bindgen_4ac3a5f38eba9716_base (\x1 ->
+                                                            \x2 ->
+                                                              \x3 ->
+                                                                \x4 ->
+                                                                  BG.getField @"unwrap" fun0 (BG.fromFFIType x1) (BG.fromFFIType x2) (BG.fromFFIType x3) (BG.fromFFIType x4)))
+
+-- __unique:__ @fromDuckDBV2TableFunctionBindCallbackFn_Aux@
+foreign import ccall safe "dynamic" hs_bindgen_ce38ade7fc4a9c16_base ::
+     BG.FunPtr (BG.Ptr BG.Void -> BG.Ptr BG.Void -> BG.Ptr BG.Void -> BG.Ptr BG.Void -> IO ())
+  -> BG.Ptr BG.Void -> BG.Ptr BG.Void -> BG.Ptr BG.Void -> BG.Ptr BG.Void -> IO ()
+
+-- __unique:__ @fromDuckDBV2TableFunctionBindCallbackFn_Aux@
+hs_bindgen_ce38ade7fc4a9c16 ::
+     BG.FunPtr DuckDBV2TableFunctionBindCallbackFn_Aux
+  -> DuckDBV2TableFunctionBindCallbackFn_Aux
+hs_bindgen_ce38ade7fc4a9c16 =
+  \funPtr0 ->
+    DuckDBV2TableFunctionBindCallbackFn_Aux (\x1 ->
+                                               \x2 ->
+                                                 \x3 ->
+                                                   \x4 ->
+                                                     hs_bindgen_ce38ade7fc4a9c16_base (BG.castFunPtr funPtr0) (BG.toFFIType x1) (BG.toFFIType x2) (BG.toFFIType x3) (BG.toFFIType x4))
+
+instance BG.ToFunPtr DuckDBV2TableFunctionBindCallbackFn_Aux where
+
+  toFunPtr = hs_bindgen_4ac3a5f38eba9716
+
+instance BG.FromFunPtr DuckDBV2TableFunctionBindCallbackFn_Aux where
+
+  fromFunPtr = hs_bindgen_ce38ade7fc4a9c16
+
+instance ( ty ~ (DuckDBV2FunctionBindInfoHandle -> DuckDBV2TableFunctionBindInfoHandle -> DuckDBV2ContextHandle -> BG.Ptr DuckDBV2ErrorInfoHandle -> IO ())
+         ) => BG.CompatHasField.HasField "unwrap" DuckDBV2TableFunctionBindCallbackFn_Aux ty where
+
+  hasField =
+    \x0 ->
+      ( \y1 ->
+          DuckDBV2TableFunctionBindCallbackFn_Aux {unwrap = y1}
+      , BG.getField @"unwrap" x0
+      )
+
+instance ( ty ~ (DuckDBV2FunctionBindInfoHandle -> DuckDBV2TableFunctionBindInfoHandle -> DuckDBV2ContextHandle -> BG.Ptr DuckDBV2ErrorInfoHandle -> IO ())
+         ) => BG.HasField "unwrap" (BG.Ptr DuckDBV2TableFunctionBindCallbackFn_Aux) (BG.Ptr ty) where
+
+  getField = HasCField.fromPtr (BG.Proxy @"unwrap")
+
+instance HasCField.HasCField DuckDBV2TableFunctionBindCallbackFn_Aux "unwrap" where
+
+  type CFieldType DuckDBV2TableFunctionBindCallbackFn_Aux "unwrap" =
+    DuckDBV2FunctionBindInfoHandle -> DuckDBV2TableFunctionBindInfoHandle -> DuckDBV2ContextHandle -> BG.Ptr DuckDBV2ErrorInfoHandle -> IO ()
+
+  offset# = \_ -> \_ -> 0
+
+{-| __C declaration:__ @duckdb_v2_table_function_bind_callback_fn@
+
+    __defined at:__ @duckdb_v2.h 12540:16@
+
+    __exported by:__ @duckdb_v2.h@
+-}
+newtype DuckDBV2TableFunctionBindCallbackFn = DuckDBV2TableFunctionBindCallbackFn
+  { unwrap :: BG.FunPtr DuckDBV2TableFunctionBindCallbackFn_Aux
+  }
+  deriving stock (Eq, BG.Generic, Ord, Show)
+  deriving newtype
+    ( BG.HasFFIType
+    , Marshal.ReadRaw
+    , Marshal.StaticSize
+    , BG.Storable
+    , Marshal.WriteRaw
+    )
+
+instance ( ty ~ BG.FunPtr DuckDBV2TableFunctionBindCallbackFn_Aux
+         ) => BG.CompatHasField.HasField "unwrap" DuckDBV2TableFunctionBindCallbackFn ty where
+
+  hasField =
+    \x0 ->
+      ( \y1 ->
+          DuckDBV2TableFunctionBindCallbackFn {unwrap = y1}
+      , BG.getField @"unwrap" x0
+      )
+
+instance ( ty ~ BG.FunPtr DuckDBV2TableFunctionBindCallbackFn_Aux
+         ) => BG.HasField "unwrap" (BG.Ptr DuckDBV2TableFunctionBindCallbackFn) (BG.Ptr ty) where
+
+  getField = HasCField.fromPtr (BG.Proxy @"unwrap")
+
+instance HasCField.HasCField DuckDBV2TableFunctionBindCallbackFn "unwrap" where
+
+  type CFieldType DuckDBV2TableFunctionBindCallbackFn "unwrap" =
+    BG.FunPtr DuckDBV2TableFunctionBindCallbackFn_Aux
+
+  offset# = \_ -> \_ -> 0
+
+{-| Auxiliary type used by t'DuckDBV2TableFunctionInitGlobalCallbackFn'
+
+    __C declaration:__ @duckdb_v2_table_function_init_global_callback_fn@
+
+    __defined at:__ @duckdb_v2.h 12545:16@
+
+    __exported by:__ @duckdb_v2.h@
+-}
+newtype DuckDBV2TableFunctionInitGlobalCallbackFn_Aux = DuckDBV2TableFunctionInitGlobalCallbackFn_Aux
+  { unwrap :: DuckDBV2TableFunctionInitGlobalInfoHandle -> DuckDBV2ContextHandle -> BG.Ptr DuckDBV2ErrorInfoHandle -> IO ()
+  }
+  deriving stock (BG.Generic)
+
+-- __unique:__ @toDuckDBV2TableFunctionInitGlobalCallbackFn_Aux@
+foreign import ccall safe "wrapper" hs_bindgen_2254382496b26753_base ::
+     (BG.Ptr BG.Void -> BG.Ptr BG.Void -> BG.Ptr BG.Void -> IO ())
+  -> IO (BG.FunPtr (BG.Ptr BG.Void -> BG.Ptr BG.Void -> BG.Ptr BG.Void -> IO ()))
+
+-- __unique:__ @toDuckDBV2TableFunctionInitGlobalCallbackFn_Aux@
+hs_bindgen_2254382496b26753 ::
+     DuckDBV2TableFunctionInitGlobalCallbackFn_Aux
+  -> IO (BG.FunPtr DuckDBV2TableFunctionInitGlobalCallbackFn_Aux)
+hs_bindgen_2254382496b26753 =
+  \fun0 ->
+    fmap BG.castFunPtr (hs_bindgen_2254382496b26753_base (\x1 ->
+                                                            \x2 ->
+                                                              \x3 ->
+                                                                BG.getField @"unwrap" fun0 (BG.fromFFIType x1) (BG.fromFFIType x2) (BG.fromFFIType x3)))
+
+-- __unique:__ @fromDuckDBV2TableFunctionInitGlobalCallbackFn_Aux@
+foreign import ccall safe "dynamic" hs_bindgen_20c92493320c01b6_base ::
+     BG.FunPtr (BG.Ptr BG.Void -> BG.Ptr BG.Void -> BG.Ptr BG.Void -> IO ())
+  -> BG.Ptr BG.Void -> BG.Ptr BG.Void -> BG.Ptr BG.Void -> IO ()
+
+-- __unique:__ @fromDuckDBV2TableFunctionInitGlobalCallbackFn_Aux@
+hs_bindgen_20c92493320c01b6 ::
+     BG.FunPtr DuckDBV2TableFunctionInitGlobalCallbackFn_Aux
+  -> DuckDBV2TableFunctionInitGlobalCallbackFn_Aux
+hs_bindgen_20c92493320c01b6 =
+  \funPtr0 ->
+    DuckDBV2TableFunctionInitGlobalCallbackFn_Aux (\x1 ->
+                                                     \x2 ->
+                                                       \x3 ->
+                                                         hs_bindgen_20c92493320c01b6_base (BG.castFunPtr funPtr0) (BG.toFFIType x1) (BG.toFFIType x2) (BG.toFFIType x3))
+
+instance BG.ToFunPtr DuckDBV2TableFunctionInitGlobalCallbackFn_Aux where
+
+  toFunPtr = hs_bindgen_2254382496b26753
+
+instance BG.FromFunPtr DuckDBV2TableFunctionInitGlobalCallbackFn_Aux where
+
+  fromFunPtr = hs_bindgen_20c92493320c01b6
+
+instance ( ty ~ (DuckDBV2TableFunctionInitGlobalInfoHandle -> DuckDBV2ContextHandle -> BG.Ptr DuckDBV2ErrorInfoHandle -> IO ())
+         ) => BG.CompatHasField.HasField "unwrap" DuckDBV2TableFunctionInitGlobalCallbackFn_Aux ty where
+
+  hasField =
+    \x0 ->
+      ( \y1 ->
+          DuckDBV2TableFunctionInitGlobalCallbackFn_Aux {unwrap = y1}
+      , BG.getField @"unwrap" x0
+      )
+
+instance ( ty ~ (DuckDBV2TableFunctionInitGlobalInfoHandle -> DuckDBV2ContextHandle -> BG.Ptr DuckDBV2ErrorInfoHandle -> IO ())
+         ) => BG.HasField "unwrap" (BG.Ptr DuckDBV2TableFunctionInitGlobalCallbackFn_Aux) (BG.Ptr ty) where
+
+  getField = HasCField.fromPtr (BG.Proxy @"unwrap")
+
+instance HasCField.HasCField DuckDBV2TableFunctionInitGlobalCallbackFn_Aux "unwrap" where
+
+  type CFieldType DuckDBV2TableFunctionInitGlobalCallbackFn_Aux "unwrap" =
+    DuckDBV2TableFunctionInitGlobalInfoHandle -> DuckDBV2ContextHandle -> BG.Ptr DuckDBV2ErrorInfoHandle -> IO ()
+
+  offset# = \_ -> \_ -> 0
+
+{-| __C declaration:__ @duckdb_v2_table_function_init_global_callback_fn@
+
+    __defined at:__ @duckdb_v2.h 12545:16@
+
+    __exported by:__ @duckdb_v2.h@
+-}
+newtype DuckDBV2TableFunctionInitGlobalCallbackFn = DuckDBV2TableFunctionInitGlobalCallbackFn
+  { unwrap :: BG.FunPtr DuckDBV2TableFunctionInitGlobalCallbackFn_Aux
+  }
+  deriving stock (Eq, BG.Generic, Ord, Show)
+  deriving newtype
+    ( BG.HasFFIType
+    , Marshal.ReadRaw
+    , Marshal.StaticSize
+    , BG.Storable
+    , Marshal.WriteRaw
+    )
+
+instance ( ty ~ BG.FunPtr DuckDBV2TableFunctionInitGlobalCallbackFn_Aux
+         ) => BG.CompatHasField.HasField "unwrap" DuckDBV2TableFunctionInitGlobalCallbackFn ty where
+
+  hasField =
+    \x0 ->
+      ( \y1 ->
+          DuckDBV2TableFunctionInitGlobalCallbackFn {unwrap = y1}
+      , BG.getField @"unwrap" x0
+      )
+
+instance ( ty ~ BG.FunPtr DuckDBV2TableFunctionInitGlobalCallbackFn_Aux
+         ) => BG.HasField "unwrap" (BG.Ptr DuckDBV2TableFunctionInitGlobalCallbackFn) (BG.Ptr ty) where
+
+  getField = HasCField.fromPtr (BG.Proxy @"unwrap")
+
+instance HasCField.HasCField DuckDBV2TableFunctionInitGlobalCallbackFn "unwrap" where
+
+  type CFieldType DuckDBV2TableFunctionInitGlobalCallbackFn "unwrap" =
+    BG.FunPtr DuckDBV2TableFunctionInitGlobalCallbackFn_Aux
+
+  offset# = \_ -> \_ -> 0
+
+{-| Auxiliary type used by t'DuckDBV2TableFunctionInitLocalCallbackFn'
+
+    __C declaration:__ @duckdb_v2_table_function_init_local_callback_fn@
+
+    __defined at:__ @duckdb_v2.h 12549:16@
+
+    __exported by:__ @duckdb_v2.h@
+-}
+newtype DuckDBV2TableFunctionInitLocalCallbackFn_Aux = DuckDBV2TableFunctionInitLocalCallbackFn_Aux
+  { unwrap :: DuckDBV2TableFunctionInitLocalInfoHandle -> DuckDBV2ContextHandle -> BG.Ptr DuckDBV2ErrorInfoHandle -> IO ()
+  }
+  deriving stock (BG.Generic)
+
+-- __unique:__ @toDuckDBV2TableFunctionInitLocalCallbackFn_Aux@
+foreign import ccall safe "wrapper" hs_bindgen_e21a7d8b603ced19_base ::
+     (BG.Ptr BG.Void -> BG.Ptr BG.Void -> BG.Ptr BG.Void -> IO ())
+  -> IO (BG.FunPtr (BG.Ptr BG.Void -> BG.Ptr BG.Void -> BG.Ptr BG.Void -> IO ()))
+
+-- __unique:__ @toDuckDBV2TableFunctionInitLocalCallbackFn_Aux@
+hs_bindgen_e21a7d8b603ced19 ::
+     DuckDBV2TableFunctionInitLocalCallbackFn_Aux
+  -> IO (BG.FunPtr DuckDBV2TableFunctionInitLocalCallbackFn_Aux)
+hs_bindgen_e21a7d8b603ced19 =
+  \fun0 ->
+    fmap BG.castFunPtr (hs_bindgen_e21a7d8b603ced19_base (\x1 ->
+                                                            \x2 ->
+                                                              \x3 ->
+                                                                BG.getField @"unwrap" fun0 (BG.fromFFIType x1) (BG.fromFFIType x2) (BG.fromFFIType x3)))
+
+-- __unique:__ @fromDuckDBV2TableFunctionInitLocalCallbackFn_Aux@
+foreign import ccall safe "dynamic" hs_bindgen_691b4b1923756f5c_base ::
+     BG.FunPtr (BG.Ptr BG.Void -> BG.Ptr BG.Void -> BG.Ptr BG.Void -> IO ())
+  -> BG.Ptr BG.Void -> BG.Ptr BG.Void -> BG.Ptr BG.Void -> IO ()
+
+-- __unique:__ @fromDuckDBV2TableFunctionInitLocalCallbackFn_Aux@
+hs_bindgen_691b4b1923756f5c ::
+     BG.FunPtr DuckDBV2TableFunctionInitLocalCallbackFn_Aux
+  -> DuckDBV2TableFunctionInitLocalCallbackFn_Aux
+hs_bindgen_691b4b1923756f5c =
+  \funPtr0 ->
+    DuckDBV2TableFunctionInitLocalCallbackFn_Aux (\x1 ->
+                                                    \x2 ->
+                                                      \x3 ->
+                                                        hs_bindgen_691b4b1923756f5c_base (BG.castFunPtr funPtr0) (BG.toFFIType x1) (BG.toFFIType x2) (BG.toFFIType x3))
+
+instance BG.ToFunPtr DuckDBV2TableFunctionInitLocalCallbackFn_Aux where
+
+  toFunPtr = hs_bindgen_e21a7d8b603ced19
+
+instance BG.FromFunPtr DuckDBV2TableFunctionInitLocalCallbackFn_Aux where
+
+  fromFunPtr = hs_bindgen_691b4b1923756f5c
+
+instance ( ty ~ (DuckDBV2TableFunctionInitLocalInfoHandle -> DuckDBV2ContextHandle -> BG.Ptr DuckDBV2ErrorInfoHandle -> IO ())
+         ) => BG.CompatHasField.HasField "unwrap" DuckDBV2TableFunctionInitLocalCallbackFn_Aux ty where
+
+  hasField =
+    \x0 ->
+      ( \y1 ->
+          DuckDBV2TableFunctionInitLocalCallbackFn_Aux {unwrap = y1}
+      , BG.getField @"unwrap" x0
+      )
+
+instance ( ty ~ (DuckDBV2TableFunctionInitLocalInfoHandle -> DuckDBV2ContextHandle -> BG.Ptr DuckDBV2ErrorInfoHandle -> IO ())
+         ) => BG.HasField "unwrap" (BG.Ptr DuckDBV2TableFunctionInitLocalCallbackFn_Aux) (BG.Ptr ty) where
+
+  getField = HasCField.fromPtr (BG.Proxy @"unwrap")
+
+instance HasCField.HasCField DuckDBV2TableFunctionInitLocalCallbackFn_Aux "unwrap" where
+
+  type CFieldType DuckDBV2TableFunctionInitLocalCallbackFn_Aux "unwrap" =
+    DuckDBV2TableFunctionInitLocalInfoHandle -> DuckDBV2ContextHandle -> BG.Ptr DuckDBV2ErrorInfoHandle -> IO ()
+
+  offset# = \_ -> \_ -> 0
+
+{-| __C declaration:__ @duckdb_v2_table_function_init_local_callback_fn@
+
+    __defined at:__ @duckdb_v2.h 12549:16@
+
+    __exported by:__ @duckdb_v2.h@
+-}
+newtype DuckDBV2TableFunctionInitLocalCallbackFn = DuckDBV2TableFunctionInitLocalCallbackFn
+  { unwrap :: BG.FunPtr DuckDBV2TableFunctionInitLocalCallbackFn_Aux
+  }
+  deriving stock (Eq, BG.Generic, Ord, Show)
+  deriving newtype
+    ( BG.HasFFIType
+    , Marshal.ReadRaw
+    , Marshal.StaticSize
+    , BG.Storable
+    , Marshal.WriteRaw
+    )
+
+instance ( ty ~ BG.FunPtr DuckDBV2TableFunctionInitLocalCallbackFn_Aux
+         ) => BG.CompatHasField.HasField "unwrap" DuckDBV2TableFunctionInitLocalCallbackFn ty where
+
+  hasField =
+    \x0 ->
+      ( \y1 ->
+          DuckDBV2TableFunctionInitLocalCallbackFn {unwrap = y1}
+      , BG.getField @"unwrap" x0
+      )
+
+instance ( ty ~ BG.FunPtr DuckDBV2TableFunctionInitLocalCallbackFn_Aux
+         ) => BG.HasField "unwrap" (BG.Ptr DuckDBV2TableFunctionInitLocalCallbackFn) (BG.Ptr ty) where
+
+  getField = HasCField.fromPtr (BG.Proxy @"unwrap")
+
+instance HasCField.HasCField DuckDBV2TableFunctionInitLocalCallbackFn "unwrap" where
+
+  type CFieldType DuckDBV2TableFunctionInitLocalCallbackFn "unwrap" =
+    BG.FunPtr DuckDBV2TableFunctionInitLocalCallbackFn_Aux
+
+  offset# = \_ -> \_ -> 0
+
+{-| Auxiliary type used by t'DuckDBV2TableFunctionExecCallbackFn'
+
+    __C declaration:__ @duckdb_v2_table_function_exec_callback_fn@
+
+    __defined at:__ @duckdb_v2.h 12553:16@
+
+    __exported by:__ @duckdb_v2.h@
+-}
+newtype DuckDBV2TableFunctionExecCallbackFn_Aux = DuckDBV2TableFunctionExecCallbackFn_Aux
+  { unwrap :: DuckDBV2TableFunctionExecInfoHandle -> DuckDBV2ContextHandle -> BG.Ptr DuckDBV2ErrorInfoHandle -> IO ()
+  }
+  deriving stock (BG.Generic)
+
+-- __unique:__ @toDuckDBV2TableFunctionExecCallbackFn_Aux@
+foreign import ccall safe "wrapper" hs_bindgen_2e3841160c82dc37_base ::
+     (BG.Ptr BG.Void -> BG.Ptr BG.Void -> BG.Ptr BG.Void -> IO ())
+  -> IO (BG.FunPtr (BG.Ptr BG.Void -> BG.Ptr BG.Void -> BG.Ptr BG.Void -> IO ()))
+
+-- __unique:__ @toDuckDBV2TableFunctionExecCallbackFn_Aux@
+hs_bindgen_2e3841160c82dc37 ::
+     DuckDBV2TableFunctionExecCallbackFn_Aux
+  -> IO (BG.FunPtr DuckDBV2TableFunctionExecCallbackFn_Aux)
+hs_bindgen_2e3841160c82dc37 =
+  \fun0 ->
+    fmap BG.castFunPtr (hs_bindgen_2e3841160c82dc37_base (\x1 ->
+                                                            \x2 ->
+                                                              \x3 ->
+                                                                BG.getField @"unwrap" fun0 (BG.fromFFIType x1) (BG.fromFFIType x2) (BG.fromFFIType x3)))
+
+-- __unique:__ @fromDuckDBV2TableFunctionExecCallbackFn_Aux@
+foreign import ccall safe "dynamic" hs_bindgen_47441c9992ccaf0a_base ::
+     BG.FunPtr (BG.Ptr BG.Void -> BG.Ptr BG.Void -> BG.Ptr BG.Void -> IO ())
+  -> BG.Ptr BG.Void -> BG.Ptr BG.Void -> BG.Ptr BG.Void -> IO ()
+
+-- __unique:__ @fromDuckDBV2TableFunctionExecCallbackFn_Aux@
+hs_bindgen_47441c9992ccaf0a ::
+     BG.FunPtr DuckDBV2TableFunctionExecCallbackFn_Aux
+  -> DuckDBV2TableFunctionExecCallbackFn_Aux
+hs_bindgen_47441c9992ccaf0a =
+  \funPtr0 ->
+    DuckDBV2TableFunctionExecCallbackFn_Aux (\x1 ->
+                                               \x2 ->
+                                                 \x3 ->
+                                                   hs_bindgen_47441c9992ccaf0a_base (BG.castFunPtr funPtr0) (BG.toFFIType x1) (BG.toFFIType x2) (BG.toFFIType x3))
+
+instance BG.ToFunPtr DuckDBV2TableFunctionExecCallbackFn_Aux where
+
+  toFunPtr = hs_bindgen_2e3841160c82dc37
+
+instance BG.FromFunPtr DuckDBV2TableFunctionExecCallbackFn_Aux where
+
+  fromFunPtr = hs_bindgen_47441c9992ccaf0a
+
+instance ( ty ~ (DuckDBV2TableFunctionExecInfoHandle -> DuckDBV2ContextHandle -> BG.Ptr DuckDBV2ErrorInfoHandle -> IO ())
+         ) => BG.CompatHasField.HasField "unwrap" DuckDBV2TableFunctionExecCallbackFn_Aux ty where
+
+  hasField =
+    \x0 ->
+      ( \y1 ->
+          DuckDBV2TableFunctionExecCallbackFn_Aux {unwrap = y1}
+      , BG.getField @"unwrap" x0
+      )
+
+instance ( ty ~ (DuckDBV2TableFunctionExecInfoHandle -> DuckDBV2ContextHandle -> BG.Ptr DuckDBV2ErrorInfoHandle -> IO ())
+         ) => BG.HasField "unwrap" (BG.Ptr DuckDBV2TableFunctionExecCallbackFn_Aux) (BG.Ptr ty) where
+
+  getField = HasCField.fromPtr (BG.Proxy @"unwrap")
+
+instance HasCField.HasCField DuckDBV2TableFunctionExecCallbackFn_Aux "unwrap" where
+
+  type CFieldType DuckDBV2TableFunctionExecCallbackFn_Aux "unwrap" =
+    DuckDBV2TableFunctionExecInfoHandle -> DuckDBV2ContextHandle -> BG.Ptr DuckDBV2ErrorInfoHandle -> IO ()
+
+  offset# = \_ -> \_ -> 0
+
+{-| __C declaration:__ @duckdb_v2_table_function_exec_callback_fn@
+
+    __defined at:__ @duckdb_v2.h 12553:16@
+
+    __exported by:__ @duckdb_v2.h@
+-}
+newtype DuckDBV2TableFunctionExecCallbackFn = DuckDBV2TableFunctionExecCallbackFn
+  { unwrap :: BG.FunPtr DuckDBV2TableFunctionExecCallbackFn_Aux
+  }
+  deriving stock (Eq, BG.Generic, Ord, Show)
+  deriving newtype
+    ( BG.HasFFIType
+    , Marshal.ReadRaw
+    , Marshal.StaticSize
+    , BG.Storable
+    , Marshal.WriteRaw
+    )
+
+instance ( ty ~ BG.FunPtr DuckDBV2TableFunctionExecCallbackFn_Aux
+         ) => BG.CompatHasField.HasField "unwrap" DuckDBV2TableFunctionExecCallbackFn ty where
+
+  hasField =
+    \x0 ->
+      ( \y1 ->
+          DuckDBV2TableFunctionExecCallbackFn {unwrap = y1}
+      , BG.getField @"unwrap" x0
+      )
+
+instance ( ty ~ BG.FunPtr DuckDBV2TableFunctionExecCallbackFn_Aux
+         ) => BG.HasField "unwrap" (BG.Ptr DuckDBV2TableFunctionExecCallbackFn) (BG.Ptr ty) where
+
+  getField = HasCField.fromPtr (BG.Proxy @"unwrap")
+
+instance HasCField.HasCField DuckDBV2TableFunctionExecCallbackFn "unwrap" where
+
+  type CFieldType DuckDBV2TableFunctionExecCallbackFn "unwrap" =
+    BG.FunPtr DuckDBV2TableFunctionExecCallbackFn_Aux
+
+  offset# = \_ -> \_ -> 0
+
+{-| Auxiliary type used by t'DuckDBV2TableFunctionProgressCallbackFn'
+
+    __C declaration:__ @duckdb_v2_table_function_progress_callback_fn@
+
+    __defined at:__ @duckdb_v2.h 12557:16@
+
+    __exported by:__ @duckdb_v2.h@
+-}
+newtype DuckDBV2TableFunctionProgressCallbackFn_Aux = DuckDBV2TableFunctionProgressCallbackFn_Aux
+  { unwrap :: DuckDBV2TableFunctionProgressInfoHandle -> DuckDBV2ContextHandle -> BG.Ptr DuckDBV2ErrorInfoHandle -> IO ()
+  }
+  deriving stock (BG.Generic)
+
+-- __unique:__ @toDuckDBV2TableFunctionProgressCallbackFn_Aux@
+foreign import ccall safe "wrapper" hs_bindgen_b914ac5360d1b68e_base ::
+     (BG.Ptr BG.Void -> BG.Ptr BG.Void -> BG.Ptr BG.Void -> IO ())
+  -> IO (BG.FunPtr (BG.Ptr BG.Void -> BG.Ptr BG.Void -> BG.Ptr BG.Void -> IO ()))
+
+-- __unique:__ @toDuckDBV2TableFunctionProgressCallbackFn_Aux@
+hs_bindgen_b914ac5360d1b68e ::
+     DuckDBV2TableFunctionProgressCallbackFn_Aux
+  -> IO (BG.FunPtr DuckDBV2TableFunctionProgressCallbackFn_Aux)
+hs_bindgen_b914ac5360d1b68e =
+  \fun0 ->
+    fmap BG.castFunPtr (hs_bindgen_b914ac5360d1b68e_base (\x1 ->
+                                                            \x2 ->
+                                                              \x3 ->
+                                                                BG.getField @"unwrap" fun0 (BG.fromFFIType x1) (BG.fromFFIType x2) (BG.fromFFIType x3)))
+
+-- __unique:__ @fromDuckDBV2TableFunctionProgressCallbackFn_Aux@
+foreign import ccall safe "dynamic" hs_bindgen_144259e482bb62cb_base ::
+     BG.FunPtr (BG.Ptr BG.Void -> BG.Ptr BG.Void -> BG.Ptr BG.Void -> IO ())
+  -> BG.Ptr BG.Void -> BG.Ptr BG.Void -> BG.Ptr BG.Void -> IO ()
+
+-- __unique:__ @fromDuckDBV2TableFunctionProgressCallbackFn_Aux@
+hs_bindgen_144259e482bb62cb ::
+     BG.FunPtr DuckDBV2TableFunctionProgressCallbackFn_Aux
+  -> DuckDBV2TableFunctionProgressCallbackFn_Aux
+hs_bindgen_144259e482bb62cb =
+  \funPtr0 ->
+    DuckDBV2TableFunctionProgressCallbackFn_Aux (\x1 ->
+                                                   \x2 ->
+                                                     \x3 ->
+                                                       hs_bindgen_144259e482bb62cb_base (BG.castFunPtr funPtr0) (BG.toFFIType x1) (BG.toFFIType x2) (BG.toFFIType x3))
+
+instance BG.ToFunPtr DuckDBV2TableFunctionProgressCallbackFn_Aux where
+
+  toFunPtr = hs_bindgen_b914ac5360d1b68e
+
+instance BG.FromFunPtr DuckDBV2TableFunctionProgressCallbackFn_Aux where
+
+  fromFunPtr = hs_bindgen_144259e482bb62cb
+
+instance ( ty ~ (DuckDBV2TableFunctionProgressInfoHandle -> DuckDBV2ContextHandle -> BG.Ptr DuckDBV2ErrorInfoHandle -> IO ())
+         ) => BG.CompatHasField.HasField "unwrap" DuckDBV2TableFunctionProgressCallbackFn_Aux ty where
+
+  hasField =
+    \x0 ->
+      ( \y1 ->
+          DuckDBV2TableFunctionProgressCallbackFn_Aux {unwrap = y1}
+      , BG.getField @"unwrap" x0
+      )
+
+instance ( ty ~ (DuckDBV2TableFunctionProgressInfoHandle -> DuckDBV2ContextHandle -> BG.Ptr DuckDBV2ErrorInfoHandle -> IO ())
+         ) => BG.HasField "unwrap" (BG.Ptr DuckDBV2TableFunctionProgressCallbackFn_Aux) (BG.Ptr ty) where
+
+  getField = HasCField.fromPtr (BG.Proxy @"unwrap")
+
+instance HasCField.HasCField DuckDBV2TableFunctionProgressCallbackFn_Aux "unwrap" where
+
+  type CFieldType DuckDBV2TableFunctionProgressCallbackFn_Aux "unwrap" =
+    DuckDBV2TableFunctionProgressInfoHandle -> DuckDBV2ContextHandle -> BG.Ptr DuckDBV2ErrorInfoHandle -> IO ()
+
+  offset# = \_ -> \_ -> 0
+
+{-| __C declaration:__ @duckdb_v2_table_function_progress_callback_fn@
+
+    __defined at:__ @duckdb_v2.h 12557:16@
+
+    __exported by:__ @duckdb_v2.h@
+-}
+newtype DuckDBV2TableFunctionProgressCallbackFn = DuckDBV2TableFunctionProgressCallbackFn
+  { unwrap :: BG.FunPtr DuckDBV2TableFunctionProgressCallbackFn_Aux
+  }
+  deriving stock (Eq, BG.Generic, Ord, Show)
+  deriving newtype
+    ( BG.HasFFIType
+    , Marshal.ReadRaw
+    , Marshal.StaticSize
+    , BG.Storable
+    , Marshal.WriteRaw
+    )
+
+instance ( ty ~ BG.FunPtr DuckDBV2TableFunctionProgressCallbackFn_Aux
+         ) => BG.CompatHasField.HasField "unwrap" DuckDBV2TableFunctionProgressCallbackFn ty where
+
+  hasField =
+    \x0 ->
+      ( \y1 ->
+          DuckDBV2TableFunctionProgressCallbackFn {unwrap = y1}
+      , BG.getField @"unwrap" x0
+      )
+
+instance ( ty ~ BG.FunPtr DuckDBV2TableFunctionProgressCallbackFn_Aux
+         ) => BG.HasField "unwrap" (BG.Ptr DuckDBV2TableFunctionProgressCallbackFn) (BG.Ptr ty) where
+
+  getField = HasCField.fromPtr (BG.Proxy @"unwrap")
+
+instance HasCField.HasCField DuckDBV2TableFunctionProgressCallbackFn "unwrap" where
+
+  type CFieldType DuckDBV2TableFunctionProgressCallbackFn "unwrap" =
+    BG.FunPtr DuckDBV2TableFunctionProgressCallbackFn_Aux
+
+  offset# = \_ -> \_ -> 0
+
+{-| Auxiliary type used by t'DuckDBV2TableFunctionFilterPushdownCallbackFn'
+
+    __C declaration:__ @duckdb_v2_table_function_filter_pushdown_callback_fn@
+
+    __defined at:__ @duckdb_v2.h 12561:16@
+
+    __exported by:__ @duckdb_v2.h@
+-}
+newtype DuckDBV2TableFunctionFilterPushdownCallbackFn_Aux = DuckDBV2TableFunctionFilterPushdownCallbackFn_Aux
+  { unwrap :: DuckDBV2TableFunctionFilterPushdownInfoHandle -> DuckDBV2ContextHandle -> BG.Ptr DuckDBV2ErrorInfoHandle -> IO ()
+  }
+  deriving stock (BG.Generic)
+
+-- __unique:__ @toDuckDBV2TableFunctionFilterPushdownCallbackFn_Aux@
+foreign import ccall safe "wrapper" hs_bindgen_1c9936d79ec2ea8c_base ::
+     (BG.Ptr BG.Void -> BG.Ptr BG.Void -> BG.Ptr BG.Void -> IO ())
+  -> IO (BG.FunPtr (BG.Ptr BG.Void -> BG.Ptr BG.Void -> BG.Ptr BG.Void -> IO ()))
+
+-- __unique:__ @toDuckDBV2TableFunctionFilterPushdownCallbackFn_Aux@
+hs_bindgen_1c9936d79ec2ea8c ::
+     DuckDBV2TableFunctionFilterPushdownCallbackFn_Aux
+  -> IO (BG.FunPtr DuckDBV2TableFunctionFilterPushdownCallbackFn_Aux)
+hs_bindgen_1c9936d79ec2ea8c =
+  \fun0 ->
+    fmap BG.castFunPtr (hs_bindgen_1c9936d79ec2ea8c_base (\x1 ->
+                                                            \x2 ->
+                                                              \x3 ->
+                                                                BG.getField @"unwrap" fun0 (BG.fromFFIType x1) (BG.fromFFIType x2) (BG.fromFFIType x3)))
+
+-- __unique:__ @fromDuckDBV2TableFunctionFilterPushdownCallbackFn_Aux@
+foreign import ccall safe "dynamic" hs_bindgen_514a14ed13f78de0_base ::
+     BG.FunPtr (BG.Ptr BG.Void -> BG.Ptr BG.Void -> BG.Ptr BG.Void -> IO ())
+  -> BG.Ptr BG.Void -> BG.Ptr BG.Void -> BG.Ptr BG.Void -> IO ()
+
+-- __unique:__ @fromDuckDBV2TableFunctionFilterPushdownCallbackFn_Aux@
+hs_bindgen_514a14ed13f78de0 ::
+     BG.FunPtr DuckDBV2TableFunctionFilterPushdownCallbackFn_Aux
+  -> DuckDBV2TableFunctionFilterPushdownCallbackFn_Aux
+hs_bindgen_514a14ed13f78de0 =
+  \funPtr0 ->
+    DuckDBV2TableFunctionFilterPushdownCallbackFn_Aux (\x1 ->
+                                                         \x2 ->
+                                                           \x3 ->
+                                                             hs_bindgen_514a14ed13f78de0_base (BG.castFunPtr funPtr0) (BG.toFFIType x1) (BG.toFFIType x2) (BG.toFFIType x3))
+
+instance BG.ToFunPtr DuckDBV2TableFunctionFilterPushdownCallbackFn_Aux where
+
+  toFunPtr = hs_bindgen_1c9936d79ec2ea8c
+
+instance BG.FromFunPtr DuckDBV2TableFunctionFilterPushdownCallbackFn_Aux where
+
+  fromFunPtr = hs_bindgen_514a14ed13f78de0
+
+instance ( ty ~ (DuckDBV2TableFunctionFilterPushdownInfoHandle -> DuckDBV2ContextHandle -> BG.Ptr DuckDBV2ErrorInfoHandle -> IO ())
+         ) => BG.CompatHasField.HasField "unwrap" DuckDBV2TableFunctionFilterPushdownCallbackFn_Aux ty where
+
+  hasField =
+    \x0 ->
+      ( \y1 ->
+          DuckDBV2TableFunctionFilterPushdownCallbackFn_Aux {unwrap = y1}
+      , BG.getField @"unwrap" x0
+      )
+
+instance ( ty ~ (DuckDBV2TableFunctionFilterPushdownInfoHandle -> DuckDBV2ContextHandle -> BG.Ptr DuckDBV2ErrorInfoHandle -> IO ())
+         ) => BG.HasField "unwrap" (BG.Ptr DuckDBV2TableFunctionFilterPushdownCallbackFn_Aux) (BG.Ptr ty) where
+
+  getField = HasCField.fromPtr (BG.Proxy @"unwrap")
+
+instance HasCField.HasCField DuckDBV2TableFunctionFilterPushdownCallbackFn_Aux "unwrap" where
+
+  type CFieldType DuckDBV2TableFunctionFilterPushdownCallbackFn_Aux "unwrap" =
+    DuckDBV2TableFunctionFilterPushdownInfoHandle -> DuckDBV2ContextHandle -> BG.Ptr DuckDBV2ErrorInfoHandle -> IO ()
+
+  offset# = \_ -> \_ -> 0
+
+{-| __C declaration:__ @duckdb_v2_table_function_filter_pushdown_callback_fn@
+
+    __defined at:__ @duckdb_v2.h 12561:16@
+
+    __exported by:__ @duckdb_v2.h@
+-}
+newtype DuckDBV2TableFunctionFilterPushdownCallbackFn = DuckDBV2TableFunctionFilterPushdownCallbackFn
+  { unwrap :: BG.FunPtr DuckDBV2TableFunctionFilterPushdownCallbackFn_Aux
+  }
+  deriving stock (Eq, BG.Generic, Ord, Show)
+  deriving newtype
+    ( BG.HasFFIType
+    , Marshal.ReadRaw
+    , Marshal.StaticSize
+    , BG.Storable
+    , Marshal.WriteRaw
+    )
+
+instance ( ty ~ BG.FunPtr DuckDBV2TableFunctionFilterPushdownCallbackFn_Aux
+         ) => BG.CompatHasField.HasField "unwrap" DuckDBV2TableFunctionFilterPushdownCallbackFn ty where
+
+  hasField =
+    \x0 ->
+      ( \y1 ->
+          DuckDBV2TableFunctionFilterPushdownCallbackFn {unwrap = y1}
+      , BG.getField @"unwrap" x0
+      )
+
+instance ( ty ~ BG.FunPtr DuckDBV2TableFunctionFilterPushdownCallbackFn_Aux
+         ) => BG.HasField "unwrap" (BG.Ptr DuckDBV2TableFunctionFilterPushdownCallbackFn) (BG.Ptr ty) where
+
+  getField = HasCField.fromPtr (BG.Proxy @"unwrap")
+
+instance HasCField.HasCField DuckDBV2TableFunctionFilterPushdownCallbackFn "unwrap" where
+
+  type CFieldType DuckDBV2TableFunctionFilterPushdownCallbackFn "unwrap" =
+    BG.FunPtr DuckDBV2TableFunctionFilterPushdownCallbackFn_Aux
+
+  offset# = \_ -> \_ -> 0
+
+{-| Auxiliary type used by t'DuckDBV2TableFunctionPartitionDataCallbackFn'
+
+    __C declaration:__ @duckdb_v2_table_function_partition_data_callback_fn@
+
+    __defined at:__ @duckdb_v2.h 12565:16@
+
+    __exported by:__ @duckdb_v2.h@
+-}
+newtype DuckDBV2TableFunctionPartitionDataCallbackFn_Aux = DuckDBV2TableFunctionPartitionDataCallbackFn_Aux
+  { unwrap :: DuckDBV2TableFunctionPartitionDataInfoHandle -> DuckDBV2ContextHandle -> BG.Ptr DuckDBV2ErrorInfoHandle -> IO ()
+  }
+  deriving stock (BG.Generic)
+
+-- __unique:__ @toDuckDBV2TableFunctionPartitionDataCallbackFn_Aux@
+foreign import ccall safe "wrapper" hs_bindgen_a84207c8d5d0bcd7_base ::
+     (BG.Ptr BG.Void -> BG.Ptr BG.Void -> BG.Ptr BG.Void -> IO ())
+  -> IO (BG.FunPtr (BG.Ptr BG.Void -> BG.Ptr BG.Void -> BG.Ptr BG.Void -> IO ()))
+
+-- __unique:__ @toDuckDBV2TableFunctionPartitionDataCallbackFn_Aux@
+hs_bindgen_a84207c8d5d0bcd7 ::
+     DuckDBV2TableFunctionPartitionDataCallbackFn_Aux
+  -> IO (BG.FunPtr DuckDBV2TableFunctionPartitionDataCallbackFn_Aux)
+hs_bindgen_a84207c8d5d0bcd7 =
+  \fun0 ->
+    fmap BG.castFunPtr (hs_bindgen_a84207c8d5d0bcd7_base (\x1 ->
+                                                            \x2 ->
+                                                              \x3 ->
+                                                                BG.getField @"unwrap" fun0 (BG.fromFFIType x1) (BG.fromFFIType x2) (BG.fromFFIType x3)))
+
+-- __unique:__ @fromDuckDBV2TableFunctionPartitionDataCallbackFn_Aux@
+foreign import ccall safe "dynamic" hs_bindgen_14a2e9bd7abda065_base ::
+     BG.FunPtr (BG.Ptr BG.Void -> BG.Ptr BG.Void -> BG.Ptr BG.Void -> IO ())
+  -> BG.Ptr BG.Void -> BG.Ptr BG.Void -> BG.Ptr BG.Void -> IO ()
+
+-- __unique:__ @fromDuckDBV2TableFunctionPartitionDataCallbackFn_Aux@
+hs_bindgen_14a2e9bd7abda065 ::
+     BG.FunPtr DuckDBV2TableFunctionPartitionDataCallbackFn_Aux
+  -> DuckDBV2TableFunctionPartitionDataCallbackFn_Aux
+hs_bindgen_14a2e9bd7abda065 =
+  \funPtr0 ->
+    DuckDBV2TableFunctionPartitionDataCallbackFn_Aux (\x1 ->
+                                                        \x2 ->
+                                                          \x3 ->
+                                                            hs_bindgen_14a2e9bd7abda065_base (BG.castFunPtr funPtr0) (BG.toFFIType x1) (BG.toFFIType x2) (BG.toFFIType x3))
+
+instance BG.ToFunPtr DuckDBV2TableFunctionPartitionDataCallbackFn_Aux where
+
+  toFunPtr = hs_bindgen_a84207c8d5d0bcd7
+
+instance BG.FromFunPtr DuckDBV2TableFunctionPartitionDataCallbackFn_Aux where
+
+  fromFunPtr = hs_bindgen_14a2e9bd7abda065
+
+instance ( ty ~ (DuckDBV2TableFunctionPartitionDataInfoHandle -> DuckDBV2ContextHandle -> BG.Ptr DuckDBV2ErrorInfoHandle -> IO ())
+         ) => BG.CompatHasField.HasField "unwrap" DuckDBV2TableFunctionPartitionDataCallbackFn_Aux ty where
+
+  hasField =
+    \x0 ->
+      ( \y1 ->
+          DuckDBV2TableFunctionPartitionDataCallbackFn_Aux {unwrap = y1}
+      , BG.getField @"unwrap" x0
+      )
+
+instance ( ty ~ (DuckDBV2TableFunctionPartitionDataInfoHandle -> DuckDBV2ContextHandle -> BG.Ptr DuckDBV2ErrorInfoHandle -> IO ())
+         ) => BG.HasField "unwrap" (BG.Ptr DuckDBV2TableFunctionPartitionDataCallbackFn_Aux) (BG.Ptr ty) where
+
+  getField = HasCField.fromPtr (BG.Proxy @"unwrap")
+
+instance HasCField.HasCField DuckDBV2TableFunctionPartitionDataCallbackFn_Aux "unwrap" where
+
+  type CFieldType DuckDBV2TableFunctionPartitionDataCallbackFn_Aux "unwrap" =
+    DuckDBV2TableFunctionPartitionDataInfoHandle -> DuckDBV2ContextHandle -> BG.Ptr DuckDBV2ErrorInfoHandle -> IO ()
+
+  offset# = \_ -> \_ -> 0
+
+{-| __C declaration:__ @duckdb_v2_table_function_partition_data_callback_fn@
+
+    __defined at:__ @duckdb_v2.h 12565:16@
+
+    __exported by:__ @duckdb_v2.h@
+-}
+newtype DuckDBV2TableFunctionPartitionDataCallbackFn = DuckDBV2TableFunctionPartitionDataCallbackFn
+  { unwrap :: BG.FunPtr DuckDBV2TableFunctionPartitionDataCallbackFn_Aux
+  }
+  deriving stock (Eq, BG.Generic, Ord, Show)
+  deriving newtype
+    ( BG.HasFFIType
+    , Marshal.ReadRaw
+    , Marshal.StaticSize
+    , BG.Storable
+    , Marshal.WriteRaw
+    )
+
+instance ( ty ~ BG.FunPtr DuckDBV2TableFunctionPartitionDataCallbackFn_Aux
+         ) => BG.CompatHasField.HasField "unwrap" DuckDBV2TableFunctionPartitionDataCallbackFn ty where
+
+  hasField =
+    \x0 ->
+      ( \y1 ->
+          DuckDBV2TableFunctionPartitionDataCallbackFn {unwrap = y1}
+      , BG.getField @"unwrap" x0
+      )
+
+instance ( ty ~ BG.FunPtr DuckDBV2TableFunctionPartitionDataCallbackFn_Aux
+         ) => BG.HasField "unwrap" (BG.Ptr DuckDBV2TableFunctionPartitionDataCallbackFn) (BG.Ptr ty) where
+
+  getField = HasCField.fromPtr (BG.Proxy @"unwrap")
+
+instance HasCField.HasCField DuckDBV2TableFunctionPartitionDataCallbackFn "unwrap" where
+
+  type CFieldType DuckDBV2TableFunctionPartitionDataCallbackFn "unwrap" =
+    BG.FunPtr DuckDBV2TableFunctionPartitionDataCallbackFn_Aux
+
+  offset# = \_ -> \_ -> 0
+
+{-| Auxiliary type used by t'DuckDBV2TableFunctionPartitioningCallbackFn'
+
+    __C declaration:__ @duckdb_v2_table_function_partitioning_callback_fn@
+
+    __defined at:__ @duckdb_v2.h 12569:16@
+
+    __exported by:__ @duckdb_v2.h@
+-}
+newtype DuckDBV2TableFunctionPartitioningCallbackFn_Aux = DuckDBV2TableFunctionPartitioningCallbackFn_Aux
+  { unwrap :: DuckDBV2TableFunctionPartitioningInfoHandle -> DuckDBV2ContextHandle -> BG.Ptr DuckDBV2ErrorInfoHandle -> IO ()
+  }
+  deriving stock (BG.Generic)
+
+-- __unique:__ @toDuckDBV2TableFunctionPartitioningCallbackFn_Aux@
+foreign import ccall safe "wrapper" hs_bindgen_fa88d4e31d72659e_base ::
+     (BG.Ptr BG.Void -> BG.Ptr BG.Void -> BG.Ptr BG.Void -> IO ())
+  -> IO (BG.FunPtr (BG.Ptr BG.Void -> BG.Ptr BG.Void -> BG.Ptr BG.Void -> IO ()))
+
+-- __unique:__ @toDuckDBV2TableFunctionPartitioningCallbackFn_Aux@
+hs_bindgen_fa88d4e31d72659e ::
+     DuckDBV2TableFunctionPartitioningCallbackFn_Aux
+  -> IO (BG.FunPtr DuckDBV2TableFunctionPartitioningCallbackFn_Aux)
+hs_bindgen_fa88d4e31d72659e =
+  \fun0 ->
+    fmap BG.castFunPtr (hs_bindgen_fa88d4e31d72659e_base (\x1 ->
+                                                            \x2 ->
+                                                              \x3 ->
+                                                                BG.getField @"unwrap" fun0 (BG.fromFFIType x1) (BG.fromFFIType x2) (BG.fromFFIType x3)))
+
+-- __unique:__ @fromDuckDBV2TableFunctionPartitioningCallbackFn_Aux@
+foreign import ccall safe "dynamic" hs_bindgen_ec2b57c9e331f9ca_base ::
+     BG.FunPtr (BG.Ptr BG.Void -> BG.Ptr BG.Void -> BG.Ptr BG.Void -> IO ())
+  -> BG.Ptr BG.Void -> BG.Ptr BG.Void -> BG.Ptr BG.Void -> IO ()
+
+-- __unique:__ @fromDuckDBV2TableFunctionPartitioningCallbackFn_Aux@
+hs_bindgen_ec2b57c9e331f9ca ::
+     BG.FunPtr DuckDBV2TableFunctionPartitioningCallbackFn_Aux
+  -> DuckDBV2TableFunctionPartitioningCallbackFn_Aux
+hs_bindgen_ec2b57c9e331f9ca =
+  \funPtr0 ->
+    DuckDBV2TableFunctionPartitioningCallbackFn_Aux (\x1 ->
+                                                       \x2 ->
+                                                         \x3 ->
+                                                           hs_bindgen_ec2b57c9e331f9ca_base (BG.castFunPtr funPtr0) (BG.toFFIType x1) (BG.toFFIType x2) (BG.toFFIType x3))
+
+instance BG.ToFunPtr DuckDBV2TableFunctionPartitioningCallbackFn_Aux where
+
+  toFunPtr = hs_bindgen_fa88d4e31d72659e
+
+instance BG.FromFunPtr DuckDBV2TableFunctionPartitioningCallbackFn_Aux where
+
+  fromFunPtr = hs_bindgen_ec2b57c9e331f9ca
+
+instance ( ty ~ (DuckDBV2TableFunctionPartitioningInfoHandle -> DuckDBV2ContextHandle -> BG.Ptr DuckDBV2ErrorInfoHandle -> IO ())
+         ) => BG.CompatHasField.HasField "unwrap" DuckDBV2TableFunctionPartitioningCallbackFn_Aux ty where
+
+  hasField =
+    \x0 ->
+      ( \y1 ->
+          DuckDBV2TableFunctionPartitioningCallbackFn_Aux {unwrap = y1}
+      , BG.getField @"unwrap" x0
+      )
+
+instance ( ty ~ (DuckDBV2TableFunctionPartitioningInfoHandle -> DuckDBV2ContextHandle -> BG.Ptr DuckDBV2ErrorInfoHandle -> IO ())
+         ) => BG.HasField "unwrap" (BG.Ptr DuckDBV2TableFunctionPartitioningCallbackFn_Aux) (BG.Ptr ty) where
+
+  getField = HasCField.fromPtr (BG.Proxy @"unwrap")
+
+instance HasCField.HasCField DuckDBV2TableFunctionPartitioningCallbackFn_Aux "unwrap" where
+
+  type CFieldType DuckDBV2TableFunctionPartitioningCallbackFn_Aux "unwrap" =
+    DuckDBV2TableFunctionPartitioningInfoHandle -> DuckDBV2ContextHandle -> BG.Ptr DuckDBV2ErrorInfoHandle -> IO ()
+
+  offset# = \_ -> \_ -> 0
+
+{-| __C declaration:__ @duckdb_v2_table_function_partitioning_callback_fn@
+
+    __defined at:__ @duckdb_v2.h 12569:16@
+
+    __exported by:__ @duckdb_v2.h@
+-}
+newtype DuckDBV2TableFunctionPartitioningCallbackFn = DuckDBV2TableFunctionPartitioningCallbackFn
+  { unwrap :: BG.FunPtr DuckDBV2TableFunctionPartitioningCallbackFn_Aux
+  }
+  deriving stock (Eq, BG.Generic, Ord, Show)
+  deriving newtype
+    ( BG.HasFFIType
+    , Marshal.ReadRaw
+    , Marshal.StaticSize
+    , BG.Storable
+    , Marshal.WriteRaw
+    )
+
+instance ( ty ~ BG.FunPtr DuckDBV2TableFunctionPartitioningCallbackFn_Aux
+         ) => BG.CompatHasField.HasField "unwrap" DuckDBV2TableFunctionPartitioningCallbackFn ty where
+
+  hasField =
+    \x0 ->
+      ( \y1 ->
+          DuckDBV2TableFunctionPartitioningCallbackFn {unwrap = y1}
+      , BG.getField @"unwrap" x0
+      )
+
+instance ( ty ~ BG.FunPtr DuckDBV2TableFunctionPartitioningCallbackFn_Aux
+         ) => BG.HasField "unwrap" (BG.Ptr DuckDBV2TableFunctionPartitioningCallbackFn) (BG.Ptr ty) where
+
+  getField = HasCField.fromPtr (BG.Proxy @"unwrap")
+
+instance HasCField.HasCField DuckDBV2TableFunctionPartitioningCallbackFn "unwrap" where
+
+  type CFieldType DuckDBV2TableFunctionPartitioningCallbackFn "unwrap" =
+    BG.FunPtr DuckDBV2TableFunctionPartitioningCallbackFn_Aux
+
+  offset# = \_ -> \_ -> 0
+
+{-| Auxiliary type used by t'DuckDBV2TableFunctionClaimBatchCallbackFn'
+
+    __C declaration:__ @duckdb_v2_table_function_claim_batch_callback_fn@
+
+    __defined at:__ @duckdb_v2.h 12573:16@
+
+    __exported by:__ @duckdb_v2.h@
+-}
+newtype DuckDBV2TableFunctionClaimBatchCallbackFn_Aux = DuckDBV2TableFunctionClaimBatchCallbackFn_Aux
+  { unwrap :: DuckDBV2TableFunctionClaimBatchInfoHandle -> DuckDBV2ContextHandle -> BG.Ptr DuckDBV2ErrorInfoHandle -> IO ()
+  }
+  deriving stock (BG.Generic)
+
+-- __unique:__ @toDuckDBV2TableFunctionClaimBatchCallbackFn_Aux@
+foreign import ccall safe "wrapper" hs_bindgen_1066e2cf7cc86172_base ::
+     (BG.Ptr BG.Void -> BG.Ptr BG.Void -> BG.Ptr BG.Void -> IO ())
+  -> IO (BG.FunPtr (BG.Ptr BG.Void -> BG.Ptr BG.Void -> BG.Ptr BG.Void -> IO ()))
+
+-- __unique:__ @toDuckDBV2TableFunctionClaimBatchCallbackFn_Aux@
+hs_bindgen_1066e2cf7cc86172 ::
+     DuckDBV2TableFunctionClaimBatchCallbackFn_Aux
+  -> IO (BG.FunPtr DuckDBV2TableFunctionClaimBatchCallbackFn_Aux)
+hs_bindgen_1066e2cf7cc86172 =
+  \fun0 ->
+    fmap BG.castFunPtr (hs_bindgen_1066e2cf7cc86172_base (\x1 ->
+                                                            \x2 ->
+                                                              \x3 ->
+                                                                BG.getField @"unwrap" fun0 (BG.fromFFIType x1) (BG.fromFFIType x2) (BG.fromFFIType x3)))
+
+-- __unique:__ @fromDuckDBV2TableFunctionClaimBatchCallbackFn_Aux@
+foreign import ccall safe "dynamic" hs_bindgen_e7b847c35c37bdbe_base ::
+     BG.FunPtr (BG.Ptr BG.Void -> BG.Ptr BG.Void -> BG.Ptr BG.Void -> IO ())
+  -> BG.Ptr BG.Void -> BG.Ptr BG.Void -> BG.Ptr BG.Void -> IO ()
+
+-- __unique:__ @fromDuckDBV2TableFunctionClaimBatchCallbackFn_Aux@
+hs_bindgen_e7b847c35c37bdbe ::
+     BG.FunPtr DuckDBV2TableFunctionClaimBatchCallbackFn_Aux
+  -> DuckDBV2TableFunctionClaimBatchCallbackFn_Aux
+hs_bindgen_e7b847c35c37bdbe =
+  \funPtr0 ->
+    DuckDBV2TableFunctionClaimBatchCallbackFn_Aux (\x1 ->
+                                                     \x2 ->
+                                                       \x3 ->
+                                                         hs_bindgen_e7b847c35c37bdbe_base (BG.castFunPtr funPtr0) (BG.toFFIType x1) (BG.toFFIType x2) (BG.toFFIType x3))
+
+instance BG.ToFunPtr DuckDBV2TableFunctionClaimBatchCallbackFn_Aux where
+
+  toFunPtr = hs_bindgen_1066e2cf7cc86172
+
+instance BG.FromFunPtr DuckDBV2TableFunctionClaimBatchCallbackFn_Aux where
+
+  fromFunPtr = hs_bindgen_e7b847c35c37bdbe
+
+instance ( ty ~ (DuckDBV2TableFunctionClaimBatchInfoHandle -> DuckDBV2ContextHandle -> BG.Ptr DuckDBV2ErrorInfoHandle -> IO ())
+         ) => BG.CompatHasField.HasField "unwrap" DuckDBV2TableFunctionClaimBatchCallbackFn_Aux ty where
+
+  hasField =
+    \x0 ->
+      ( \y1 ->
+          DuckDBV2TableFunctionClaimBatchCallbackFn_Aux {unwrap = y1}
+      , BG.getField @"unwrap" x0
+      )
+
+instance ( ty ~ (DuckDBV2TableFunctionClaimBatchInfoHandle -> DuckDBV2ContextHandle -> BG.Ptr DuckDBV2ErrorInfoHandle -> IO ())
+         ) => BG.HasField "unwrap" (BG.Ptr DuckDBV2TableFunctionClaimBatchCallbackFn_Aux) (BG.Ptr ty) where
+
+  getField = HasCField.fromPtr (BG.Proxy @"unwrap")
+
+instance HasCField.HasCField DuckDBV2TableFunctionClaimBatchCallbackFn_Aux "unwrap" where
+
+  type CFieldType DuckDBV2TableFunctionClaimBatchCallbackFn_Aux "unwrap" =
+    DuckDBV2TableFunctionClaimBatchInfoHandle -> DuckDBV2ContextHandle -> BG.Ptr DuckDBV2ErrorInfoHandle -> IO ()
+
+  offset# = \_ -> \_ -> 0
+
+{-| __C declaration:__ @duckdb_v2_table_function_claim_batch_callback_fn@
+
+    __defined at:__ @duckdb_v2.h 12573:16@
+
+    __exported by:__ @duckdb_v2.h@
+-}
+newtype DuckDBV2TableFunctionClaimBatchCallbackFn = DuckDBV2TableFunctionClaimBatchCallbackFn
+  { unwrap :: BG.FunPtr DuckDBV2TableFunctionClaimBatchCallbackFn_Aux
+  }
+  deriving stock (Eq, BG.Generic, Ord, Show)
+  deriving newtype
+    ( BG.HasFFIType
+    , Marshal.ReadRaw
+    , Marshal.StaticSize
+    , BG.Storable
+    , Marshal.WriteRaw
+    )
+
+instance ( ty ~ BG.FunPtr DuckDBV2TableFunctionClaimBatchCallbackFn_Aux
+         ) => BG.CompatHasField.HasField "unwrap" DuckDBV2TableFunctionClaimBatchCallbackFn ty where
+
+  hasField =
+    \x0 ->
+      ( \y1 ->
+          DuckDBV2TableFunctionClaimBatchCallbackFn {unwrap = y1}
+      , BG.getField @"unwrap" x0
+      )
+
+instance ( ty ~ BG.FunPtr DuckDBV2TableFunctionClaimBatchCallbackFn_Aux
+         ) => BG.HasField "unwrap" (BG.Ptr DuckDBV2TableFunctionClaimBatchCallbackFn) (BG.Ptr ty) where
+
+  getField = HasCField.fromPtr (BG.Proxy @"unwrap")
+
+instance HasCField.HasCField DuckDBV2TableFunctionClaimBatchCallbackFn "unwrap" where
+
+  type CFieldType DuckDBV2TableFunctionClaimBatchCallbackFn "unwrap" =
+    BG.FunPtr DuckDBV2TableFunctionClaimBatchCallbackFn_Aux
+
+  offset# = \_ -> \_ -> 0
+
+{-| Auxiliary type used by t'DuckDBV2TableFunctionGetBindInfoCallbackFn'
+
+    __C declaration:__ @duckdb_v2_table_function_get_bind_info_callback_fn@
+
+    __defined at:__ @duckdb_v2.h 12577:16@
+
+    __exported by:__ @duckdb_v2.h@
+-}
+newtype DuckDBV2TableFunctionGetBindInfoCallbackFn_Aux = DuckDBV2TableFunctionGetBindInfoCallbackFn_Aux
+  { unwrap :: DuckDBV2TableFunctionGetBindInfoInfoHandle -> DuckDBV2ContextHandle -> BG.Ptr DuckDBV2ErrorInfoHandle -> IO ()
+  }
+  deriving stock (BG.Generic)
+
+-- __unique:__ @toDuckDBV2TableFunctionGetBindInfoCallbackFn_Aux@
+foreign import ccall safe "wrapper" hs_bindgen_10d44f1d731d9c9f_base ::
+     (BG.Ptr BG.Void -> BG.Ptr BG.Void -> BG.Ptr BG.Void -> IO ())
+  -> IO (BG.FunPtr (BG.Ptr BG.Void -> BG.Ptr BG.Void -> BG.Ptr BG.Void -> IO ()))
+
+-- __unique:__ @toDuckDBV2TableFunctionGetBindInfoCallbackFn_Aux@
+hs_bindgen_10d44f1d731d9c9f ::
+     DuckDBV2TableFunctionGetBindInfoCallbackFn_Aux
+  -> IO (BG.FunPtr DuckDBV2TableFunctionGetBindInfoCallbackFn_Aux)
+hs_bindgen_10d44f1d731d9c9f =
+  \fun0 ->
+    fmap BG.castFunPtr (hs_bindgen_10d44f1d731d9c9f_base (\x1 ->
+                                                            \x2 ->
+                                                              \x3 ->
+                                                                BG.getField @"unwrap" fun0 (BG.fromFFIType x1) (BG.fromFFIType x2) (BG.fromFFIType x3)))
+
+-- __unique:__ @fromDuckDBV2TableFunctionGetBindInfoCallbackFn_Aux@
+foreign import ccall safe "dynamic" hs_bindgen_2c9fdf8eadac6eb3_base ::
+     BG.FunPtr (BG.Ptr BG.Void -> BG.Ptr BG.Void -> BG.Ptr BG.Void -> IO ())
+  -> BG.Ptr BG.Void -> BG.Ptr BG.Void -> BG.Ptr BG.Void -> IO ()
+
+-- __unique:__ @fromDuckDBV2TableFunctionGetBindInfoCallbackFn_Aux@
+hs_bindgen_2c9fdf8eadac6eb3 ::
+     BG.FunPtr DuckDBV2TableFunctionGetBindInfoCallbackFn_Aux
+  -> DuckDBV2TableFunctionGetBindInfoCallbackFn_Aux
+hs_bindgen_2c9fdf8eadac6eb3 =
+  \funPtr0 ->
+    DuckDBV2TableFunctionGetBindInfoCallbackFn_Aux (\x1 ->
+                                                      \x2 ->
+                                                        \x3 ->
+                                                          hs_bindgen_2c9fdf8eadac6eb3_base (BG.castFunPtr funPtr0) (BG.toFFIType x1) (BG.toFFIType x2) (BG.toFFIType x3))
+
+instance BG.ToFunPtr DuckDBV2TableFunctionGetBindInfoCallbackFn_Aux where
+
+  toFunPtr = hs_bindgen_10d44f1d731d9c9f
+
+instance BG.FromFunPtr DuckDBV2TableFunctionGetBindInfoCallbackFn_Aux where
+
+  fromFunPtr = hs_bindgen_2c9fdf8eadac6eb3
+
+instance ( ty ~ (DuckDBV2TableFunctionGetBindInfoInfoHandle -> DuckDBV2ContextHandle -> BG.Ptr DuckDBV2ErrorInfoHandle -> IO ())
+         ) => BG.CompatHasField.HasField "unwrap" DuckDBV2TableFunctionGetBindInfoCallbackFn_Aux ty where
+
+  hasField =
+    \x0 ->
+      ( \y1 ->
+          DuckDBV2TableFunctionGetBindInfoCallbackFn_Aux {unwrap = y1}
+      , BG.getField @"unwrap" x0
+      )
+
+instance ( ty ~ (DuckDBV2TableFunctionGetBindInfoInfoHandle -> DuckDBV2ContextHandle -> BG.Ptr DuckDBV2ErrorInfoHandle -> IO ())
+         ) => BG.HasField "unwrap" (BG.Ptr DuckDBV2TableFunctionGetBindInfoCallbackFn_Aux) (BG.Ptr ty) where
+
+  getField = HasCField.fromPtr (BG.Proxy @"unwrap")
+
+instance HasCField.HasCField DuckDBV2TableFunctionGetBindInfoCallbackFn_Aux "unwrap" where
+
+  type CFieldType DuckDBV2TableFunctionGetBindInfoCallbackFn_Aux "unwrap" =
+    DuckDBV2TableFunctionGetBindInfoInfoHandle -> DuckDBV2ContextHandle -> BG.Ptr DuckDBV2ErrorInfoHandle -> IO ()
+
+  offset# = \_ -> \_ -> 0
+
+{-| __C declaration:__ @duckdb_v2_table_function_get_bind_info_callback_fn@
+
+    __defined at:__ @duckdb_v2.h 12577:16@
+
+    __exported by:__ @duckdb_v2.h@
+-}
+newtype DuckDBV2TableFunctionGetBindInfoCallbackFn = DuckDBV2TableFunctionGetBindInfoCallbackFn
+  { unwrap :: BG.FunPtr DuckDBV2TableFunctionGetBindInfoCallbackFn_Aux
+  }
+  deriving stock (Eq, BG.Generic, Ord, Show)
+  deriving newtype
+    ( BG.HasFFIType
+    , Marshal.ReadRaw
+    , Marshal.StaticSize
+    , BG.Storable
+    , Marshal.WriteRaw
+    )
+
+instance ( ty ~ BG.FunPtr DuckDBV2TableFunctionGetBindInfoCallbackFn_Aux
+         ) => BG.CompatHasField.HasField "unwrap" DuckDBV2TableFunctionGetBindInfoCallbackFn ty where
+
+  hasField =
+    \x0 ->
+      ( \y1 ->
+          DuckDBV2TableFunctionGetBindInfoCallbackFn {unwrap = y1}
+      , BG.getField @"unwrap" x0
+      )
+
+instance ( ty ~ BG.FunPtr DuckDBV2TableFunctionGetBindInfoCallbackFn_Aux
+         ) => BG.HasField "unwrap" (BG.Ptr DuckDBV2TableFunctionGetBindInfoCallbackFn) (BG.Ptr ty) where
+
+  getField = HasCField.fromPtr (BG.Proxy @"unwrap")
+
+instance HasCField.HasCField DuckDBV2TableFunctionGetBindInfoCallbackFn "unwrap" where
+
+  type CFieldType DuckDBV2TableFunctionGetBindInfoCallbackFn "unwrap" =
+    BG.FunPtr DuckDBV2TableFunctionGetBindInfoCallbackFn_Aux
+
+  offset# = \_ -> \_ -> 0
+
+{-|
+
+    Converts Arrow arrays into DuckDB data chunks, against one resolved t'ArrowSchema' . Create it with @duckdb_v2_arrow_importer_create()@ , which resolves every column\'s DuckDB type once, so the same importer serves any number of arrays of that shape. @duckdb_v2_arrow_importer_get_schema()@ reports the resolved DuckDB schema. @duckdb_v2_arrow_importer_append()@ takes an array, @duckdb_v2_arrow_importer_next_chunk()@ produces chunks from it, and @duckdb_v2_arrow_importer_destroy()@ frees the importer.
+
+    The importer borrows the context it was created with and must not outlive it. One array is in flight at a time, and an importer must not be used from two threads at once.
+
+    __C declaration:__ @struct _duckdb_v2_arrow_importer@
+
+    __defined at:__ @duckdb_v2.h 15978:16@
+
+    __exported by:__ @duckdb_v2.h@
+-}
+data DuckDBV2ArrowImporterStruct
+
+instance Marshal.StaticSize DuckDBV2ArrowImporterStruct where
+
+  staticSizeOf = \_ -> (8 :: Int)
+
+  staticAlignment = \_ -> (8 :: Int)
+
+{-|
+
+    Converts Arrow arrays into DuckDB data chunks, against one resolved t'ArrowSchema' . Create it with @duckdb_v2_arrow_importer_create()@ , which resolves every column\'s DuckDB type once, so the same importer serves any number of arrays of that shape. @duckdb_v2_arrow_importer_get_schema()@ reports the resolved DuckDB schema. @duckdb_v2_arrow_importer_append()@ takes an array, @duckdb_v2_arrow_importer_next_chunk()@ produces chunks from it, and @duckdb_v2_arrow_importer_destroy()@ frees the importer.
+
+    The importer borrows the context it was created with and must not outlive it. One array is in flight at a time, and an importer must not be used from two threads at once.
+
+    __C declaration:__ @duckdb_v2_arrow_importer_handle@
+
+    __defined at:__ @duckdb_v2.h 15980:5@
+
+    __exported by:__ @duckdb_v2.h@
+-}
+newtype DuckDBV2ArrowImporterHandle = DuckDBV2ArrowImporterHandle
+  { unwrap :: BG.Ptr DuckDBV2ArrowImporterStruct
+  }
+  deriving stock (Eq, BG.Generic, Ord, Show)
+  deriving newtype
+    ( BG.HasFFIType
+    , Marshal.ReadRaw
+    , Marshal.StaticSize
+    , BG.Storable
+    , Marshal.WriteRaw
+    )
+
+instance ( ty ~ BG.Ptr DuckDBV2ArrowImporterStruct
+         ) => BG.CompatHasField.HasField "unwrap" DuckDBV2ArrowImporterHandle ty where
+
+  hasField =
+    \x0 ->
+      (\y1 ->
+         DuckDBV2ArrowImporterHandle {unwrap = y1}, BG.getField @"unwrap" x0)
+
+instance ( ty ~ BG.Ptr DuckDBV2ArrowImporterStruct
+         ) => BG.HasField "unwrap" (BG.Ptr DuckDBV2ArrowImporterHandle) (BG.Ptr ty) where
+
+  getField = HasCField.fromPtr (BG.Proxy @"unwrap")
+
+instance HasCField.HasCField DuckDBV2ArrowImporterHandle "unwrap" where
+
+  type CFieldType DuckDBV2ArrowImporterHandle "unwrap" =
+    BG.Ptr DuckDBV2ArrowImporterStruct
+
+  offset# = \_ -> \_ -> 0
+
+{-| Converts DuckDB data chunks into Arrow arrays, for one fixed list of columns. Create it with @duckdb_v2_arrow_exporter_create()@ , which captures the session\'s Arrow settings and resolves the extension types once. @duckdb_v2_arrow_exporter_get_schema()@ reports the Arrow schema. @duckdb_v2_arrow_exporter_append()@ takes a chunk, @duckdb_v2_arrow_exporter_next_array()@ produces arrays from it, and @duckdb_v2_arrow_exporter_destroy()@ frees the exporter.
+
+    An exporter must not be used from two threads at once.
+
+    __C declaration:__ @struct _duckdb_v2_arrow_exporter@
+
+    __defined at:__ @duckdb_v2.h 15991:16@
+
+    __exported by:__ @duckdb_v2.h@
+-}
+data DuckDBV2ArrowExporterStruct
+
+instance Marshal.StaticSize DuckDBV2ArrowExporterStruct where
+
+  staticSizeOf = \_ -> (8 :: Int)
+
+  staticAlignment = \_ -> (8 :: Int)
+
+{-| Converts DuckDB data chunks into Arrow arrays, for one fixed list of columns. Create it with @duckdb_v2_arrow_exporter_create()@ , which captures the session\'s Arrow settings and resolves the extension types once. @duckdb_v2_arrow_exporter_get_schema()@ reports the Arrow schema. @duckdb_v2_arrow_exporter_append()@ takes a chunk, @duckdb_v2_arrow_exporter_next_array()@ produces arrays from it, and @duckdb_v2_arrow_exporter_destroy()@ frees the exporter.
+
+    An exporter must not be used from two threads at once.
+
+    __C declaration:__ @duckdb_v2_arrow_exporter_handle@
+
+    __defined at:__ @duckdb_v2.h 15993:5@
+
+    __exported by:__ @duckdb_v2.h@
+-}
+newtype DuckDBV2ArrowExporterHandle = DuckDBV2ArrowExporterHandle
+  { unwrap :: BG.Ptr DuckDBV2ArrowExporterStruct
+  }
+  deriving stock (Eq, BG.Generic, Ord, Show)
+  deriving newtype
+    ( BG.HasFFIType
+    , Marshal.ReadRaw
+    , Marshal.StaticSize
+    , BG.Storable
+    , Marshal.WriteRaw
+    )
+
+instance ( ty ~ BG.Ptr DuckDBV2ArrowExporterStruct
+         ) => BG.CompatHasField.HasField "unwrap" DuckDBV2ArrowExporterHandle ty where
+
+  hasField =
+    \x0 ->
+      (\y1 ->
+         DuckDBV2ArrowExporterHandle {unwrap = y1}, BG.getField @"unwrap" x0)
+
+instance ( ty ~ BG.Ptr DuckDBV2ArrowExporterStruct
+         ) => BG.HasField "unwrap" (BG.Ptr DuckDBV2ArrowExporterHandle) (BG.Ptr ty) where
+
+  getField = HasCField.fromPtr (BG.Proxy @"unwrap")
+
+instance HasCField.HasCField DuckDBV2ArrowExporterHandle "unwrap" where
+
+  type CFieldType DuckDBV2ArrowExporterHandle "unwrap" =
+    BG.Ptr DuckDBV2ArrowExporterStruct
+
+  offset# = \_ -> \_ -> 0
+
+{-| A query result that produces Arrow arrays. Works like a result, which produces data chunks. Create it with @duckdb_v2_statement_execute_arrow()@ or @duckdb_v2_prepared_statement_execute_arrow()@ .
+
+    * Use it from one thread at a time.
+
+    * @duckdb_v2_connection_interrupt()@ cancels it: @duckdb_v2_arrow_result_step()@ reports @CANCELLED@ , and @duckdb_v2_arrow_result_fetch_array()@ and a stream\'s @get_next@ fail.
+
+    * Arrays and schemas it hands out belong to the caller and stay valid after the result is destroyed.
+
+    __C declaration:__ @struct _duckdb_v2_arrow_result@
+
+    __defined at:__ @duckdb_v2.h 16004:16@
+
+    __exported by:__ @duckdb_v2.h@
+-}
+data DuckDBV2ArrowResultStruct
+
+instance Marshal.StaticSize DuckDBV2ArrowResultStruct where
+
+  staticSizeOf = \_ -> (8 :: Int)
+
+  staticAlignment = \_ -> (8 :: Int)
+
+{-| A query result that produces Arrow arrays. Works like a result, which produces data chunks. Create it with @duckdb_v2_statement_execute_arrow()@ or @duckdb_v2_prepared_statement_execute_arrow()@ .
+
+    * Use it from one thread at a time.
+
+    * @duckdb_v2_connection_interrupt()@ cancels it: @duckdb_v2_arrow_result_step()@ reports @CANCELLED@ , and @duckdb_v2_arrow_result_fetch_array()@ and a stream\'s @get_next@ fail.
+
+    * Arrays and schemas it hands out belong to the caller and stay valid after the result is destroyed.
+
+    __C declaration:__ @duckdb_v2_arrow_result_handle@
+
+    __defined at:__ @duckdb_v2.h 16006:5@
+
+    __exported by:__ @duckdb_v2.h@
+-}
+newtype DuckDBV2ArrowResultHandle = DuckDBV2ArrowResultHandle
+  { unwrap :: BG.Ptr DuckDBV2ArrowResultStruct
+  }
+  deriving stock (Eq, BG.Generic, Ord, Show)
+  deriving newtype
+    ( BG.HasFFIType
+    , Marshal.ReadRaw
+    , Marshal.StaticSize
+    , BG.Storable
+    , Marshal.WriteRaw
+    )
+
+instance ( ty ~ BG.Ptr DuckDBV2ArrowResultStruct
+         ) => BG.CompatHasField.HasField "unwrap" DuckDBV2ArrowResultHandle ty where
+
+  hasField =
+    \x0 ->
+      (\y1 ->
+         DuckDBV2ArrowResultHandle {unwrap = y1}, BG.getField @"unwrap" x0)
+
+instance ( ty ~ BG.Ptr DuckDBV2ArrowResultStruct
+         ) => BG.HasField "unwrap" (BG.Ptr DuckDBV2ArrowResultHandle) (BG.Ptr ty) where
+
+  getField = HasCField.fromPtr (BG.Proxy @"unwrap")
+
+instance HasCField.HasCField DuckDBV2ArrowResultHandle "unwrap" where
+
+  type CFieldType DuckDBV2ArrowResultHandle "unwrap" =
+    BG.Ptr DuckDBV2ArrowResultStruct
+
+  offset# = \_ -> \_ -> 0
+
+-- __unique:__ @instance ToFunPtr (BG.Ptr ArrowArray -> IO ())@
+foreign import ccall safe "wrapper" hs_bindgen_4d336e4487b32130_base ::
+     (BG.Ptr BG.Void -> IO ())
+  -> IO (BG.FunPtr (BG.Ptr BG.Void -> IO ()))
+
+-- __unique:__ @instance ToFunPtr (BG.Ptr ArrowArray -> IO ())@
+hs_bindgen_4d336e4487b32130 ::
+     (BG.Ptr ArrowArray -> IO ())
+  -> IO (BG.FunPtr (BG.Ptr ArrowArray -> IO ()))
+hs_bindgen_4d336e4487b32130 =
+  \fun0 ->
+    fmap BG.castFunPtr (hs_bindgen_4d336e4487b32130_base (\x1 ->
+                                                            fun0 (BG.fromFFIType x1)))
+
+-- __unique:__ @instance FromFunPtr (BG.Ptr ArrowArray -> IO ())@
+foreign import ccall safe "dynamic" hs_bindgen_0b7012dfcd502374_base ::
+     BG.FunPtr (BG.Ptr BG.Void -> IO ())
+  -> BG.Ptr BG.Void -> IO ()
+
+-- __unique:__ @instance FromFunPtr (BG.Ptr ArrowArray -> IO ())@
+hs_bindgen_0b7012dfcd502374 ::
+     BG.FunPtr (BG.Ptr ArrowArray -> IO ())
+  -> BG.Ptr ArrowArray -> IO ()
+hs_bindgen_0b7012dfcd502374 =
+  \funPtr0 ->
+    \x1 ->
+      hs_bindgen_0b7012dfcd502374_base (BG.castFunPtr funPtr0) (BG.toFFIType x1)
+
+instance BG.ToFunPtr (BG.Ptr ArrowArray -> IO ()) where
+
+  toFunPtr = hs_bindgen_4d336e4487b32130
+
+instance BG.FromFunPtr (BG.Ptr ArrowArray -> IO ()) where
+
+  fromFunPtr = hs_bindgen_0b7012dfcd502374
+
+-- __unique:__ @instance ToFunPtr (BG.Ptr ArrowArrayStream -> IO (PtrConst.PtrConst BG.CChar))@
+foreign import ccall safe "wrapper" hs_bindgen_6b9c94c9d66ac396_base ::
+     (BG.Ptr BG.Void -> IO (BG.Ptr BG.Void))
+  -> IO (BG.FunPtr (BG.Ptr BG.Void -> IO (BG.Ptr BG.Void)))
+
+-- __unique:__ @instance ToFunPtr (BG.Ptr ArrowArrayStream -> IO (PtrConst.PtrConst BG.CChar))@
+hs_bindgen_6b9c94c9d66ac396 ::
+     (BG.Ptr ArrowArrayStream -> IO (PtrConst.PtrConst BG.CChar))
+  -> IO (BG.FunPtr (BG.Ptr ArrowArrayStream -> IO (PtrConst.PtrConst BG.CChar)))
+hs_bindgen_6b9c94c9d66ac396 =
+  \fun0 ->
+    fmap BG.castFunPtr (hs_bindgen_6b9c94c9d66ac396_base (\x1 ->
+                                                            fmap BG.toFFIType (fun0 (BG.fromFFIType x1))))
+
+-- __unique:__ @instance FromFunPtr (BG.Ptr ArrowArrayStream -> IO (PtrConst.PtrConst BG.CChar))@
+foreign import ccall safe "dynamic" hs_bindgen_46babed99c1d98c8_base ::
+     BG.FunPtr (BG.Ptr BG.Void -> IO (BG.Ptr BG.Void))
+  -> BG.Ptr BG.Void -> IO (BG.Ptr BG.Void)
+
+-- __unique:__ @instance FromFunPtr (BG.Ptr ArrowArrayStream -> IO (PtrConst.PtrConst BG.CChar))@
+hs_bindgen_46babed99c1d98c8 ::
+     BG.FunPtr (BG.Ptr ArrowArrayStream -> IO (PtrConst.PtrConst BG.CChar))
+  -> BG.Ptr ArrowArrayStream -> IO (PtrConst.PtrConst BG.CChar)
+hs_bindgen_46babed99c1d98c8 =
+  \funPtr0 ->
+    \x1 ->
+      fmap BG.fromFFIType (hs_bindgen_46babed99c1d98c8_base (BG.castFunPtr funPtr0) (BG.toFFIType x1))
+
+instance BG.ToFunPtr (BG.Ptr ArrowArrayStream -> IO (PtrConst.PtrConst BG.CChar)) where
+
+  toFunPtr = hs_bindgen_6b9c94c9d66ac396
+
+instance BG.FromFunPtr (BG.Ptr ArrowArrayStream -> IO (PtrConst.PtrConst BG.CChar)) where
+
+  fromFunPtr = hs_bindgen_46babed99c1d98c8
+
+-- __unique:__ @instance ToFunPtr (BG.Ptr ArrowArrayStream -> IO ())@
+foreign import ccall safe "wrapper" hs_bindgen_53ecea872b08397c_base ::
+     (BG.Ptr BG.Void -> IO ())
+  -> IO (BG.FunPtr (BG.Ptr BG.Void -> IO ()))
+
+-- __unique:__ @instance ToFunPtr (BG.Ptr ArrowArrayStream -> IO ())@
+hs_bindgen_53ecea872b08397c ::
+     (BG.Ptr ArrowArrayStream -> IO ())
+  -> IO (BG.FunPtr (BG.Ptr ArrowArrayStream -> IO ()))
+hs_bindgen_53ecea872b08397c =
+  \fun0 ->
+    fmap BG.castFunPtr (hs_bindgen_53ecea872b08397c_base (\x1 ->
+                                                            fun0 (BG.fromFFIType x1)))
+
+-- __unique:__ @instance FromFunPtr (BG.Ptr ArrowArrayStream -> IO ())@
+foreign import ccall safe "dynamic" hs_bindgen_eaa751fcbe96e4a5_base ::
+     BG.FunPtr (BG.Ptr BG.Void -> IO ())
+  -> BG.Ptr BG.Void -> IO ()
+
+-- __unique:__ @instance FromFunPtr (BG.Ptr ArrowArrayStream -> IO ())@
+hs_bindgen_eaa751fcbe96e4a5 ::
+     BG.FunPtr (BG.Ptr ArrowArrayStream -> IO ())
+  -> BG.Ptr ArrowArrayStream -> IO ()
+hs_bindgen_eaa751fcbe96e4a5 =
+  \funPtr0 ->
+    \x1 ->
+      hs_bindgen_eaa751fcbe96e4a5_base (BG.castFunPtr funPtr0) (BG.toFFIType x1)
+
+instance BG.ToFunPtr (BG.Ptr ArrowArrayStream -> IO ()) where
+
+  toFunPtr = hs_bindgen_53ecea872b08397c
+
+instance BG.FromFunPtr (BG.Ptr ArrowArrayStream -> IO ()) where
+
+  fromFunPtr = hs_bindgen_eaa751fcbe96e4a5
+
+-- __unique:__ @instance ToFunPtr (BG.Ptr ArrowArrayStream -> BG.Ptr ArrowArray -> IO BG.CInt)@
+foreign import ccall safe "wrapper" hs_bindgen_2a3259863e5e2fb9_base ::
+     (BG.Ptr BG.Void -> BG.Ptr BG.Void -> IO BG.CInt)
+  -> IO (BG.FunPtr (BG.Ptr BG.Void -> BG.Ptr BG.Void -> IO BG.CInt))
+
+-- __unique:__ @instance ToFunPtr (BG.Ptr ArrowArrayStream -> BG.Ptr ArrowArray -> IO BG.CInt)@
+hs_bindgen_2a3259863e5e2fb9 ::
+     (BG.Ptr ArrowArrayStream -> BG.Ptr ArrowArray -> IO BG.CInt)
+  -> IO (BG.FunPtr (BG.Ptr ArrowArrayStream -> BG.Ptr ArrowArray -> IO BG.CInt))
+hs_bindgen_2a3259863e5e2fb9 =
+  \fun0 ->
+    fmap BG.castFunPtr (hs_bindgen_2a3259863e5e2fb9_base (\x1 ->
+                                                            \x2 ->
+                                                              fmap BG.toFFIType (fun0 (BG.fromFFIType x1) (BG.fromFFIType x2))))
+
+-- __unique:__ @instance FromFunPtr (BG.Ptr ArrowArrayStream -> BG.Ptr ArrowArray -> IO BG.CInt)@
+foreign import ccall safe "dynamic" hs_bindgen_b8c200d6c217e573_base ::
+     BG.FunPtr (BG.Ptr BG.Void -> BG.Ptr BG.Void -> IO BG.CInt)
+  -> BG.Ptr BG.Void -> BG.Ptr BG.Void -> IO BG.CInt
+
+-- __unique:__ @instance FromFunPtr (BG.Ptr ArrowArrayStream -> BG.Ptr ArrowArray -> IO BG.CInt)@
+hs_bindgen_b8c200d6c217e573 ::
+     BG.FunPtr (BG.Ptr ArrowArrayStream -> BG.Ptr ArrowArray -> IO BG.CInt)
+  -> BG.Ptr ArrowArrayStream -> BG.Ptr ArrowArray -> IO BG.CInt
+hs_bindgen_b8c200d6c217e573 =
+  \funPtr0 ->
+    \x1 ->
+      \x2 ->
+        fmap BG.fromFFIType (hs_bindgen_b8c200d6c217e573_base (BG.castFunPtr funPtr0) (BG.toFFIType x1) (BG.toFFIType x2))
+
+instance BG.ToFunPtr (BG.Ptr ArrowArrayStream -> BG.Ptr ArrowArray -> IO BG.CInt) where
+
+  toFunPtr = hs_bindgen_2a3259863e5e2fb9
+
+instance BG.FromFunPtr (BG.Ptr ArrowArrayStream -> BG.Ptr ArrowArray -> IO BG.CInt) where
+
+  fromFunPtr = hs_bindgen_b8c200d6c217e573
+
+-- __unique:__ @instance ToFunPtr (BG.Ptr ArrowArrayStream -> BG.Ptr ArrowSchema -> IO BG.CInt)@
+foreign import ccall safe "wrapper" hs_bindgen_1bd5acba953515a9_base ::
+     (BG.Ptr BG.Void -> BG.Ptr BG.Void -> IO BG.CInt)
+  -> IO (BG.FunPtr (BG.Ptr BG.Void -> BG.Ptr BG.Void -> IO BG.CInt))
+
+-- __unique:__ @instance ToFunPtr (BG.Ptr ArrowArrayStream -> BG.Ptr ArrowSchema -> IO BG.CInt)@
+hs_bindgen_1bd5acba953515a9 ::
+     (BG.Ptr ArrowArrayStream -> BG.Ptr ArrowSchema -> IO BG.CInt)
+  -> IO (BG.FunPtr (BG.Ptr ArrowArrayStream -> BG.Ptr ArrowSchema -> IO BG.CInt))
+hs_bindgen_1bd5acba953515a9 =
+  \fun0 ->
+    fmap BG.castFunPtr (hs_bindgen_1bd5acba953515a9_base (\x1 ->
+                                                            \x2 ->
+                                                              fmap BG.toFFIType (fun0 (BG.fromFFIType x1) (BG.fromFFIType x2))))
+
+-- __unique:__ @instance FromFunPtr (BG.Ptr ArrowArrayStream -> BG.Ptr ArrowSchema -> IO BG.CInt)@
+foreign import ccall safe "dynamic" hs_bindgen_be93abfc8b9e05df_base ::
+     BG.FunPtr (BG.Ptr BG.Void -> BG.Ptr BG.Void -> IO BG.CInt)
+  -> BG.Ptr BG.Void -> BG.Ptr BG.Void -> IO BG.CInt
+
+-- __unique:__ @instance FromFunPtr (BG.Ptr ArrowArrayStream -> BG.Ptr ArrowSchema -> IO BG.CInt)@
+hs_bindgen_be93abfc8b9e05df ::
+     BG.FunPtr (BG.Ptr ArrowArrayStream -> BG.Ptr ArrowSchema -> IO BG.CInt)
+  -> BG.Ptr ArrowArrayStream -> BG.Ptr ArrowSchema -> IO BG.CInt
+hs_bindgen_be93abfc8b9e05df =
+  \funPtr0 ->
+    \x1 ->
+      \x2 ->
+        fmap BG.fromFFIType (hs_bindgen_be93abfc8b9e05df_base (BG.castFunPtr funPtr0) (BG.toFFIType x1) (BG.toFFIType x2))
+
+instance BG.ToFunPtr (BG.Ptr ArrowArrayStream -> BG.Ptr ArrowSchema -> IO BG.CInt) where
+
+  toFunPtr = hs_bindgen_1bd5acba953515a9
+
+instance BG.FromFunPtr (BG.Ptr ArrowArrayStream -> BG.Ptr ArrowSchema -> IO BG.CInt) where
+
+  fromFunPtr = hs_bindgen_be93abfc8b9e05df
+
+-- __unique:__ @instance ToFunPtr (BG.Ptr ArrowSchema -> IO ())@
+foreign import ccall safe "wrapper" hs_bindgen_eb4670e8ca3edb75_base ::
+     (BG.Ptr BG.Void -> IO ())
+  -> IO (BG.FunPtr (BG.Ptr BG.Void -> IO ()))
+
+-- __unique:__ @instance ToFunPtr (BG.Ptr ArrowSchema -> IO ())@
+hs_bindgen_eb4670e8ca3edb75 ::
+     (BG.Ptr ArrowSchema -> IO ())
+  -> IO (BG.FunPtr (BG.Ptr ArrowSchema -> IO ()))
+hs_bindgen_eb4670e8ca3edb75 =
+  \fun0 ->
+    fmap BG.castFunPtr (hs_bindgen_eb4670e8ca3edb75_base (\x1 ->
+                                                            fun0 (BG.fromFFIType x1)))
+
+-- __unique:__ @instance FromFunPtr (BG.Ptr ArrowSchema -> IO ())@
+foreign import ccall safe "dynamic" hs_bindgen_cf541a6b0d109282_base ::
+     BG.FunPtr (BG.Ptr BG.Void -> IO ())
+  -> BG.Ptr BG.Void -> IO ()
+
+-- __unique:__ @instance FromFunPtr (BG.Ptr ArrowSchema -> IO ())@
+hs_bindgen_cf541a6b0d109282 ::
+     BG.FunPtr (BG.Ptr ArrowSchema -> IO ())
+  -> BG.Ptr ArrowSchema -> IO ()
+hs_bindgen_cf541a6b0d109282 =
+  \funPtr0 ->
+    \x1 ->
+      hs_bindgen_cf541a6b0d109282_base (BG.castFunPtr funPtr0) (BG.toFFIType x1)
+
+instance BG.ToFunPtr (BG.Ptr ArrowSchema -> IO ()) where
+
+  toFunPtr = hs_bindgen_eb4670e8ca3edb75
+
+instance BG.FromFunPtr (BG.Ptr ArrowSchema -> IO ()) where
+
+  fromFunPtr = hs_bindgen_cf541a6b0d109282
+
+-- __unique:__ @Database_DuckDB_FFI_V2_Database.DuckDB.FFI.V2_Safe_duckdb_v2_arena_allocate@
+foreign import ccall safe "hs_bindgen_63694dde75fd6125" hs_bindgen_63694dde75fd6125_base ::
+     BG.Ptr BG.Void
+  -> HsBindgen.Runtime.LibC.Word64
+  -> BG.Ptr BG.Void
+  -> BG.Ptr BG.Void
+  -> IO BG.CUInt
+
+-- __unique:__ @Database_DuckDB_FFI_V2_Database.DuckDB.FFI.V2_Safe_duckdb_v2_arena_allocate@
+hs_bindgen_63694dde75fd6125 ::
+     DuckDBV2ArenaHandle
+  -> DuckDBIdx
+  -> BG.Ptr (BG.Ptr HsBindgen.Runtime.LibC.Word8)
+  -> BG.Ptr DuckDBV2ErrorInfoHandle
+  -> IO DuckDBV2Error
+hs_bindgen_63694dde75fd6125 =
+  \x0 ->
+    \x1 ->
+      \x2 ->
+        \x3 ->
+          fmap BG.fromFFIType (hs_bindgen_63694dde75fd6125_base (BG.toFFIType x0) (BG.toFFIType x1) (BG.toFFIType x2) (BG.toFFIType x3))
+
+{-| __C declaration:__ @duckdb_v2_arena_allocate@
+
+    __defined at:__ @duckdb_v2.h 823:30@
+
+    __exported by:__ @duckdb_v2.h@
+-}
+c_duckdb_v2_arena_allocate ::
+     DuckDBV2ArenaHandle
+     -- ^ __C declaration:__ @arena@
+  -> DuckDBIdx
+     -- ^ __C declaration:__ @byte_len@
+  -> BG.Ptr (BG.Ptr HsBindgen.Runtime.LibC.Word8)
+     -- ^ __C declaration:__ @out_ptr@
+  -> BG.Ptr DuckDBV2ErrorInfoHandle
+     -- ^ __C declaration:__ @err@
+  -> IO DuckDBV2Error
+c_duckdb_v2_arena_allocate =
+  hs_bindgen_63694dde75fd6125
+
+-- __unique:__ @Database_DuckDB_FFI_V2_Database.DuckDB.FFI.V2_Safe_duckdb_v2_cast_function_create@
+foreign import ccall safe "hs_bindgen_3d4e1db409416097" hs_bindgen_3d4e1db409416097_base ::
+     BG.Ptr BG.Void
+  -> BG.Ptr BG.Void
+  -> BG.Ptr BG.Void
+  -> IO BG.CUInt
+
+-- __unique:__ @Database_DuckDB_FFI_V2_Database.DuckDB.FFI.V2_Safe_duckdb_v2_cast_function_create@
+hs_bindgen_3d4e1db409416097 ::
+     DuckDBV2FactoryHandle
+  -> BG.Ptr DuckDBV2CastFunctionHandle
+  -> BG.Ptr DuckDBV2ErrorInfoHandle
+  -> IO DuckDBV2Error
+hs_bindgen_3d4e1db409416097 =
+  \x0 ->
+    \x1 ->
+      \x2 ->
+        fmap BG.fromFFIType (hs_bindgen_3d4e1db409416097_base (BG.toFFIType x0) (BG.toFFIType x1) (BG.toFFIType x2))
+
+{-| __C declaration:__ @duckdb_v2_cast_function_create@
+
+    __defined at:__ @duckdb_v2.h 908:30@
+
+    __exported by:__ @duckdb_v2.h@
+-}
+c_duckdb_v2_cast_function_create ::
+     DuckDBV2FactoryHandle
+     -- ^ __C declaration:__ @factory@
+  -> BG.Ptr DuckDBV2CastFunctionHandle
+     -- ^ __C declaration:__ @function@
+  -> BG.Ptr DuckDBV2ErrorInfoHandle
+     -- ^ __C declaration:__ @err@
+  -> IO DuckDBV2Error
+c_duckdb_v2_cast_function_create =
+  hs_bindgen_3d4e1db409416097
+
+-- __unique:__ @Database_DuckDB_FFI_V2_Database.DuckDB.FFI.V2_Safe_duckdb_v2_cast_function_set_source_type@
+foreign import ccall safe "hs_bindgen_ef73622b5f1da9e9" hs_bindgen_ef73622b5f1da9e9_base ::
+     BG.Ptr BG.Void
+  -> BG.Ptr BG.Void
+  -> BG.Ptr BG.Void
+  -> IO BG.CUInt
+
+-- __unique:__ @Database_DuckDB_FFI_V2_Database.DuckDB.FFI.V2_Safe_duckdb_v2_cast_function_set_source_type@
+hs_bindgen_ef73622b5f1da9e9 ::
+     DuckDBV2CastFunctionHandle
+  -> DuckDBV2LogicalTypeHandle
+  -> BG.Ptr DuckDBV2ErrorInfoHandle
+  -> IO DuckDBV2Error
+hs_bindgen_ef73622b5f1da9e9 =
+  \x0 ->
+    \x1 ->
+      \x2 ->
+        fmap BG.fromFFIType (hs_bindgen_ef73622b5f1da9e9_base (BG.toFFIType x0) (BG.toFFIType x1) (BG.toFFIType x2))
+
+{-| __C declaration:__ @duckdb_v2_cast_function_set_source_type@
+
+    __defined at:__ @duckdb_v2.h 929:30@
+
+    __exported by:__ @duckdb_v2.h@
+-}
+c_duckdb_v2_cast_function_set_source_type ::
+     DuckDBV2CastFunctionHandle
+     -- ^ __C declaration:__ @function@
+  -> DuckDBV2LogicalTypeHandle
+     -- ^ __C declaration:__ @source_type@
+  -> BG.Ptr DuckDBV2ErrorInfoHandle
+     -- ^ __C declaration:__ @err@
+  -> IO DuckDBV2Error
+c_duckdb_v2_cast_function_set_source_type =
+  hs_bindgen_ef73622b5f1da9e9
+
+-- __unique:__ @Database_DuckDB_FFI_V2_Database.DuckDB.FFI.V2_Safe_duckdb_v2_cast_function_set_target_type@
+foreign import ccall safe "hs_bindgen_a81debc94fb37b8b" hs_bindgen_a81debc94fb37b8b_base ::
+     BG.Ptr BG.Void
+  -> BG.Ptr BG.Void
+  -> BG.Ptr BG.Void
+  -> IO BG.CUInt
+
+-- __unique:__ @Database_DuckDB_FFI_V2_Database.DuckDB.FFI.V2_Safe_duckdb_v2_cast_function_set_target_type@
+hs_bindgen_a81debc94fb37b8b ::
+     DuckDBV2CastFunctionHandle
+  -> DuckDBV2LogicalTypeHandle
+  -> BG.Ptr DuckDBV2ErrorInfoHandle
+  -> IO DuckDBV2Error
+hs_bindgen_a81debc94fb37b8b =
+  \x0 ->
+    \x1 ->
+      \x2 ->
+        fmap BG.fromFFIType (hs_bindgen_a81debc94fb37b8b_base (BG.toFFIType x0) (BG.toFFIType x1) (BG.toFFIType x2))
+
+{-| __C declaration:__ @duckdb_v2_cast_function_set_target_type@
+
+    __defined at:__ @duckdb_v2.h 950:30@
+
+    __exported by:__ @duckdb_v2.h@
+-}
+c_duckdb_v2_cast_function_set_target_type ::
+     DuckDBV2CastFunctionHandle
+     -- ^ __C declaration:__ @function@
+  -> DuckDBV2LogicalTypeHandle
+     -- ^ __C declaration:__ @target_type@
+  -> BG.Ptr DuckDBV2ErrorInfoHandle
+     -- ^ __C declaration:__ @err@
+  -> IO DuckDBV2Error
+c_duckdb_v2_cast_function_set_target_type =
+  hs_bindgen_a81debc94fb37b8b
+
+-- __unique:__ @Database_DuckDB_FFI_V2_Database.DuckDB.FFI.V2_Safe_duckdb_v2_cast_function_set_implicit_cast_cost@
+foreign import ccall safe "hs_bindgen_a255b48c2a58cca5" hs_bindgen_a255b48c2a58cca5_base ::
+     BG.Ptr BG.Void
+  -> HsBindgen.Runtime.LibC.Int64
+  -> BG.Ptr BG.Void
+  -> IO BG.CUInt
+
+-- __unique:__ @Database_DuckDB_FFI_V2_Database.DuckDB.FFI.V2_Safe_duckdb_v2_cast_function_set_implicit_cast_cost@
+hs_bindgen_a255b48c2a58cca5 ::
+     DuckDBV2CastFunctionHandle
+  -> HsBindgen.Runtime.LibC.Int64
+  -> BG.Ptr DuckDBV2ErrorInfoHandle
+  -> IO DuckDBV2Error
+hs_bindgen_a255b48c2a58cca5 =
+  \x0 ->
+    \x1 ->
+      \x2 ->
+        fmap BG.fromFFIType (hs_bindgen_a255b48c2a58cca5_base (BG.toFFIType x0) (BG.toFFIType x1) (BG.toFFIType x2))
+
+{-| __C declaration:__ @duckdb_v2_cast_function_set_implicit_cast_cost@
+
+    __defined at:__ @duckdb_v2.h 973:30@
+
+    __exported by:__ @duckdb_v2.h@
+-}
+c_duckdb_v2_cast_function_set_implicit_cast_cost ::
+     DuckDBV2CastFunctionHandle
+     -- ^ __C declaration:__ @function@
+  -> HsBindgen.Runtime.LibC.Int64
+     -- ^ __C declaration:__ @cost@
+  -> BG.Ptr DuckDBV2ErrorInfoHandle
+     -- ^ __C declaration:__ @err@
+  -> IO DuckDBV2Error
+c_duckdb_v2_cast_function_set_implicit_cast_cost =
+  hs_bindgen_a255b48c2a58cca5
+
+-- __unique:__ @Database_DuckDB_FFI_V2_Database.DuckDB.FFI.V2_Safe_duckdb_v2_cast_function_set_user_data@
+foreign import ccall safe "hs_bindgen_b70e7a978df773c1" hs_bindgen_b70e7a978df773c1_base ::
+     BG.Ptr BG.Void
+  -> BG.Ptr BG.Void
+  -> BG.Ptr BG.Void
+  -> IO BG.CUInt
+
+-- __unique:__ @Database_DuckDB_FFI_V2_Database.DuckDB.FFI.V2_Safe_duckdb_v2_cast_function_set_user_data@
+hs_bindgen_b70e7a978df773c1 ::
+     DuckDBV2CastFunctionHandle
+  -> BG.Ptr DuckDBV2Opaque
+  -> BG.Ptr DuckDBV2ErrorInfoHandle
+  -> IO DuckDBV2Error
+hs_bindgen_b70e7a978df773c1 =
+  \x0 ->
+    \x1 ->
+      \x2 ->
+        fmap BG.fromFFIType (hs_bindgen_b70e7a978df773c1_base (BG.toFFIType x0) (BG.toFFIType x1) (BG.toFFIType x2))
+
+{-| __C declaration:__ @duckdb_v2_cast_function_set_user_data@
+
+    __defined at:__ @duckdb_v2.h 996:30@
+
+    __exported by:__ @duckdb_v2.h@
+-}
+c_duckdb_v2_cast_function_set_user_data ::
+     DuckDBV2CastFunctionHandle
+     -- ^ __C declaration:__ @function@
+  -> BG.Ptr DuckDBV2Opaque
+     -- ^ __C declaration:__ @data@
+  -> BG.Ptr DuckDBV2ErrorInfoHandle
+     -- ^ __C declaration:__ @err@
+  -> IO DuckDBV2Error
+c_duckdb_v2_cast_function_set_user_data =
+  hs_bindgen_b70e7a978df773c1
+
+-- __unique:__ @Database_DuckDB_FFI_V2_Database.DuckDB.FFI.V2_Safe_duckdb_v2_cast_function_set_exec_callback@
+foreign import ccall safe "hs_bindgen_44dae14ea099d32d" hs_bindgen_44dae14ea099d32d_base ::
+     BG.Ptr BG.Void
+  -> BG.FunPtr BG.Void
+  -> BG.Ptr BG.Void
+  -> IO BG.CUInt
+
+-- __unique:__ @Database_DuckDB_FFI_V2_Database.DuckDB.FFI.V2_Safe_duckdb_v2_cast_function_set_exec_callback@
+hs_bindgen_44dae14ea099d32d ::
+     DuckDBV2CastFunctionHandle
+  -> DuckDBV2CastFunctionExecCallbackFn
+  -> BG.Ptr DuckDBV2ErrorInfoHandle
+  -> IO DuckDBV2Error
+hs_bindgen_44dae14ea099d32d =
+  \x0 ->
+    \x1 ->
+      \x2 ->
+        fmap BG.fromFFIType (hs_bindgen_44dae14ea099d32d_base (BG.toFFIType x0) (BG.toFFIType x1) (BG.toFFIType x2))
+
+{-| __C declaration:__ @duckdb_v2_cast_function_set_exec_callback@
+
+    __defined at:__ @duckdb_v2.h 1017:30@
+
+    __exported by:__ @duckdb_v2.h@
+-}
+c_duckdb_v2_cast_function_set_exec_callback ::
+     DuckDBV2CastFunctionHandle
+     -- ^ __C declaration:__ @function@
+  -> DuckDBV2CastFunctionExecCallbackFn
+     -- ^ __C declaration:__ @callback@
+  -> BG.Ptr DuckDBV2ErrorInfoHandle
+     -- ^ __C declaration:__ @err@
+  -> IO DuckDBV2Error
+c_duckdb_v2_cast_function_set_exec_callback =
+  hs_bindgen_44dae14ea099d32d
+
+-- __unique:__ @Database_DuckDB_FFI_V2_Database.DuckDB.FFI.V2_Safe_duckdb_v2_cast_function_exec_get_user_data@
+foreign import ccall safe "hs_bindgen_9cf9b198c77fb382" hs_bindgen_9cf9b198c77fb382_base ::
+     BG.Ptr BG.Void
+  -> BG.Ptr BG.Void
+  -> BG.Ptr BG.Void
+  -> IO BG.CUInt
+
+-- __unique:__ @Database_DuckDB_FFI_V2_Database.DuckDB.FFI.V2_Safe_duckdb_v2_cast_function_exec_get_user_data@
+hs_bindgen_9cf9b198c77fb382 ::
+     DuckDBV2CastFunctionExecInfoHandle
+  -> BG.Ptr (BG.Ptr BG.Void)
+  -> BG.Ptr DuckDBV2ErrorInfoHandle
+  -> IO DuckDBV2Error
+hs_bindgen_9cf9b198c77fb382 =
+  \x0 ->
+    \x1 ->
+      \x2 ->
+        fmap BG.fromFFIType (hs_bindgen_9cf9b198c77fb382_base (BG.toFFIType x0) (BG.toFFIType x1) (BG.toFFIType x2))
+
+{-| __C declaration:__ @duckdb_v2_cast_function_exec_get_user_data@
+
+    __defined at:__ @duckdb_v2.h 1035:30@
+
+    __exported by:__ @duckdb_v2.h@
+-}
+c_duckdb_v2_cast_function_exec_get_user_data ::
+     DuckDBV2CastFunctionExecInfoHandle
+     -- ^ __C declaration:__ @info@
+  -> BG.Ptr (BG.Ptr BG.Void)
+     -- ^ __C declaration:__ @data@
+  -> BG.Ptr DuckDBV2ErrorInfoHandle
+     -- ^ __C declaration:__ @err@
+  -> IO DuckDBV2Error
+c_duckdb_v2_cast_function_exec_get_user_data =
+  hs_bindgen_9cf9b198c77fb382
+
+-- __unique:__ @Database_DuckDB_FFI_V2_Database.DuckDB.FFI.V2_Safe_duckdb_v2_cast_function_exec_get_row_count@
+foreign import ccall safe "hs_bindgen_279208830299f25a" hs_bindgen_279208830299f25a_base ::
+     BG.Ptr BG.Void
+  -> BG.Ptr BG.Void
+  -> BG.Ptr BG.Void
+  -> IO BG.CUInt
+
+-- __unique:__ @Database_DuckDB_FFI_V2_Database.DuckDB.FFI.V2_Safe_duckdb_v2_cast_function_exec_get_row_count@
+hs_bindgen_279208830299f25a ::
+     DuckDBV2CastFunctionExecInfoHandle
+  -> BG.Ptr DuckDBIdx
+  -> BG.Ptr DuckDBV2ErrorInfoHandle
+  -> IO DuckDBV2Error
+hs_bindgen_279208830299f25a =
+  \x0 ->
+    \x1 ->
+      \x2 ->
+        fmap BG.fromFFIType (hs_bindgen_279208830299f25a_base (BG.toFFIType x0) (BG.toFFIType x1) (BG.toFFIType x2))
+
+{-| __C declaration:__ @duckdb_v2_cast_function_exec_get_row_count@
+
+    __defined at:__ @duckdb_v2.h 1056:30@
+
+    __exported by:__ @duckdb_v2.h@
+-}
+c_duckdb_v2_cast_function_exec_get_row_count ::
+     DuckDBV2CastFunctionExecInfoHandle
+     -- ^ __C declaration:__ @info@
+  -> BG.Ptr DuckDBIdx
+     -- ^ __C declaration:__ @count@
+  -> BG.Ptr DuckDBV2ErrorInfoHandle
+     -- ^ __C declaration:__ @err@
+  -> IO DuckDBV2Error
+c_duckdb_v2_cast_function_exec_get_row_count =
+  hs_bindgen_279208830299f25a
+
+-- __unique:__ @Database_DuckDB_FFI_V2_Database.DuckDB.FFI.V2_Safe_duckdb_v2_cast_function_exec_get_input@
+foreign import ccall safe "hs_bindgen_6777f89c9eb28fad" hs_bindgen_6777f89c9eb28fad_base ::
+     BG.Ptr BG.Void
+  -> BG.Ptr BG.Void
+  -> BG.Ptr BG.Void
+  -> IO BG.CUInt
+
+-- __unique:__ @Database_DuckDB_FFI_V2_Database.DuckDB.FFI.V2_Safe_duckdb_v2_cast_function_exec_get_input@
+hs_bindgen_6777f89c9eb28fad ::
+     DuckDBV2CastFunctionExecInfoHandle
+  -> BG.Ptr DuckDBV2VectorHandle
+  -> BG.Ptr DuckDBV2ErrorInfoHandle
+  -> IO DuckDBV2Error
+hs_bindgen_6777f89c9eb28fad =
+  \x0 ->
+    \x1 ->
+      \x2 ->
+        fmap BG.fromFFIType (hs_bindgen_6777f89c9eb28fad_base (BG.toFFIType x0) (BG.toFFIType x1) (BG.toFFIType x2))
+
+{-| __C declaration:__ @duckdb_v2_cast_function_exec_get_input@
+
+    __defined at:__ @duckdb_v2.h 1076:30@
+
+    __exported by:__ @duckdb_v2.h@
+-}
+c_duckdb_v2_cast_function_exec_get_input ::
+     DuckDBV2CastFunctionExecInfoHandle
+     -- ^ __C declaration:__ @info@
+  -> BG.Ptr DuckDBV2VectorHandle
+     -- ^ __C declaration:__ @vector@
+  -> BG.Ptr DuckDBV2ErrorInfoHandle
+     -- ^ __C declaration:__ @err@
+  -> IO DuckDBV2Error
+c_duckdb_v2_cast_function_exec_get_input =
+  hs_bindgen_6777f89c9eb28fad
+
+-- __unique:__ @Database_DuckDB_FFI_V2_Database.DuckDB.FFI.V2_Safe_duckdb_v2_cast_function_exec_get_output@
+foreign import ccall safe "hs_bindgen_c813b8f41a0b4a94" hs_bindgen_c813b8f41a0b4a94_base ::
+     BG.Ptr BG.Void
+  -> BG.Ptr BG.Void
+  -> BG.Ptr BG.Void
+  -> IO BG.CUInt
+
+-- __unique:__ @Database_DuckDB_FFI_V2_Database.DuckDB.FFI.V2_Safe_duckdb_v2_cast_function_exec_get_output@
+hs_bindgen_c813b8f41a0b4a94 ::
+     DuckDBV2CastFunctionExecInfoHandle
+  -> BG.Ptr DuckDBV2VectorHandle
+  -> BG.Ptr DuckDBV2ErrorInfoHandle
+  -> IO DuckDBV2Error
+hs_bindgen_c813b8f41a0b4a94 =
+  \x0 ->
+    \x1 ->
+      \x2 ->
+        fmap BG.fromFFIType (hs_bindgen_c813b8f41a0b4a94_base (BG.toFFIType x0) (BG.toFFIType x1) (BG.toFFIType x2))
+
+{-| __C declaration:__ @duckdb_v2_cast_function_exec_get_output@
+
+    __defined at:__ @duckdb_v2.h 1097:30@
+
+    __exported by:__ @duckdb_v2.h@
+-}
+c_duckdb_v2_cast_function_exec_get_output ::
+     DuckDBV2CastFunctionExecInfoHandle
+     -- ^ __C declaration:__ @info@
+  -> BG.Ptr DuckDBV2VectorHandle
+     -- ^ __C declaration:__ @vector@
+  -> BG.Ptr DuckDBV2ErrorInfoHandle
+     -- ^ __C declaration:__ @err@
+  -> IO DuckDBV2Error
+c_duckdb_v2_cast_function_exec_get_output =
+  hs_bindgen_c813b8f41a0b4a94
+
+-- __unique:__ @Database_DuckDB_FFI_V2_Database.DuckDB.FFI.V2_Safe_duckdb_v2_cast_function_exec_get_mode@
+foreign import ccall safe "hs_bindgen_173673f14fe58fb6" hs_bindgen_173673f14fe58fb6_base ::
+     BG.Ptr BG.Void
+  -> BG.Ptr BG.Void
+  -> BG.Ptr BG.Void
+  -> IO BG.CUInt
+
+-- __unique:__ @Database_DuckDB_FFI_V2_Database.DuckDB.FFI.V2_Safe_duckdb_v2_cast_function_exec_get_mode@
+hs_bindgen_173673f14fe58fb6 ::
+     DuckDBV2CastFunctionExecInfoHandle
+  -> BG.Ptr DuckDBV2CastMode
+  -> BG.Ptr DuckDBV2ErrorInfoHandle
+  -> IO DuckDBV2Error
+hs_bindgen_173673f14fe58fb6 =
+  \x0 ->
+    \x1 ->
+      \x2 ->
+        fmap BG.fromFFIType (hs_bindgen_173673f14fe58fb6_base (BG.toFFIType x0) (BG.toFFIType x1) (BG.toFFIType x2))
+
+{-| __C declaration:__ @duckdb_v2_cast_function_exec_get_mode@
+
+    __defined at:__ @duckdb_v2.h 1118:30@
+
+    __exported by:__ @duckdb_v2.h@
+-}
+c_duckdb_v2_cast_function_exec_get_mode ::
+     DuckDBV2CastFunctionExecInfoHandle
+     -- ^ __C declaration:__ @info@
+  -> BG.Ptr DuckDBV2CastMode
+     -- ^ __C declaration:__ @mode@
+  -> BG.Ptr DuckDBV2ErrorInfoHandle
+     -- ^ __C declaration:__ @err@
+  -> IO DuckDBV2Error
+c_duckdb_v2_cast_function_exec_get_mode =
+  hs_bindgen_173673f14fe58fb6
+
+-- __unique:__ @Database_DuckDB_FFI_V2_Database.DuckDB.FFI.V2_Safe_duckdb_v2_connection_register_cast_function@
+foreign import ccall safe "hs_bindgen_927aa67d3f20cee9" hs_bindgen_927aa67d3f20cee9_base ::
+     BG.Ptr BG.Void
+  -> BG.Ptr BG.Void
+  -> BG.Ptr BG.Void
+  -> IO BG.CUInt
+
+-- __unique:__ @Database_DuckDB_FFI_V2_Database.DuckDB.FFI.V2_Safe_duckdb_v2_connection_register_cast_function@
+hs_bindgen_927aa67d3f20cee9 ::
+     DuckDBV2ConnectionHandle
+  -> DuckDBV2CastFunctionHandle
+  -> BG.Ptr DuckDBV2ErrorInfoHandle
+  -> IO DuckDBV2Error
+hs_bindgen_927aa67d3f20cee9 =
+  \x0 ->
+    \x1 ->
+      \x2 ->
+        fmap BG.fromFFIType (hs_bindgen_927aa67d3f20cee9_base (BG.toFFIType x0) (BG.toFFIType x1) (BG.toFFIType x2))
+
+{-| __C declaration:__ @duckdb_v2_connection_register_cast_function@
+
+    __defined at:__ @duckdb_v2.h 1143:30@
+
+    __exported by:__ @duckdb_v2.h@
+-}
+c_duckdb_v2_connection_register_cast_function ::
+     DuckDBV2ConnectionHandle
+     -- ^ __C declaration:__ @conn@
+  -> DuckDBV2CastFunctionHandle
+     -- ^ __C declaration:__ @function@
+  -> BG.Ptr DuckDBV2ErrorInfoHandle
+     -- ^ __C declaration:__ @err@
+  -> IO DuckDBV2Error
+c_duckdb_v2_connection_register_cast_function =
+  hs_bindgen_927aa67d3f20cee9
+
+-- __unique:__ @Database_DuckDB_FFI_V2_Database.DuckDB.FFI.V2_Safe_duckdb_v2_extension_register_cast_function@
+foreign import ccall safe "hs_bindgen_04f61415af74e3e3" hs_bindgen_04f61415af74e3e3_base ::
+     BG.Ptr BG.Void
+  -> BG.Ptr BG.Void
+  -> BG.Ptr BG.Void
+  -> IO BG.CUInt
+
+-- __unique:__ @Database_DuckDB_FFI_V2_Database.DuckDB.FFI.V2_Safe_duckdb_v2_extension_register_cast_function@
+hs_bindgen_04f61415af74e3e3 ::
+     DuckDBV2ExtensionHandle
+  -> DuckDBV2CastFunctionHandle
+  -> BG.Ptr DuckDBV2ErrorInfoHandle
+  -> IO DuckDBV2Error
+hs_bindgen_04f61415af74e3e3 =
+  \x0 ->
+    \x1 ->
+      \x2 ->
+        fmap BG.fromFFIType (hs_bindgen_04f61415af74e3e3_base (BG.toFFIType x0) (BG.toFFIType x1) (BG.toFFIType x2))
+
+{-| __C declaration:__ @duckdb_v2_extension_register_cast_function@
+
+    __defined at:__ @duckdb_v2.h 1167:30@
+
+    __exported by:__ @duckdb_v2.h@
+-}
+c_duckdb_v2_extension_register_cast_function ::
+     DuckDBV2ExtensionHandle
+     -- ^ __C declaration:__ @extension@
+  -> DuckDBV2CastFunctionHandle
+     -- ^ __C declaration:__ @function@
+  -> BG.Ptr DuckDBV2ErrorInfoHandle
+     -- ^ __C declaration:__ @err@
+  -> IO DuckDBV2Error
+c_duckdb_v2_extension_register_cast_function =
+  hs_bindgen_04f61415af74e3e3
+
+-- __unique:__ @Database_DuckDB_FFI_V2_Database.DuckDB.FFI.V2_Safe_duckdb_v2_cast_function_destroy@
+foreign import ccall safe "hs_bindgen_69e261c2f46b4edf" hs_bindgen_69e261c2f46b4edf_base ::
+     BG.Ptr BG.Void
+  -> IO BG.CUInt
+
+-- __unique:__ @Database_DuckDB_FFI_V2_Database.DuckDB.FFI.V2_Safe_duckdb_v2_cast_function_destroy@
+hs_bindgen_69e261c2f46b4edf ::
+     BG.Ptr DuckDBV2CastFunctionHandle
+  -> IO DuckDBV2Error
+hs_bindgen_69e261c2f46b4edf =
+  \x0 ->
+    fmap BG.fromFFIType (hs_bindgen_69e261c2f46b4edf_base (BG.toFFIType x0))
+
+{-| __C declaration:__ @duckdb_v2_cast_function_destroy@
+
+    __defined at:__ @duckdb_v2.h 1185:30@
+
+    __exported by:__ @duckdb_v2.h@
+-}
+c_duckdb_v2_cast_function_destroy ::
+     BG.Ptr DuckDBV2CastFunctionHandle
+     -- ^ __C declaration:__ @function@
+  -> IO DuckDBV2Error
+c_duckdb_v2_cast_function_destroy =
+  hs_bindgen_69e261c2f46b4edf
+
+-- __unique:__ @Database_DuckDB_FFI_V2_Database.DuckDB.FFI.V2_Safe_duckdb_v2_column_data_collection_create@
+foreign import ccall safe "hs_bindgen_9dff60a24ffcda2e" hs_bindgen_9dff60a24ffcda2e_base ::
+     BG.Ptr BG.Void
+  -> BG.Ptr BG.Void
+  -> HsBindgen.Runtime.LibC.Word64
+  -> BG.Ptr BG.Void
+  -> BG.Ptr BG.Void
+  -> IO BG.CUInt
+
+-- __unique:__ @Database_DuckDB_FFI_V2_Database.DuckDB.FFI.V2_Safe_duckdb_v2_column_data_collection_create@
+hs_bindgen_9dff60a24ffcda2e ::
+     DuckDBV2FactoryHandle
+  -> PtrConst.PtrConst DuckDBV2LogicalTypeHandle
+  -> DuckDBIdx
+  -> BG.Ptr DuckDBV2ColumnDataCollectionHandle
+  -> BG.Ptr DuckDBV2ErrorInfoHandle
+  -> IO DuckDBV2Error
+hs_bindgen_9dff60a24ffcda2e =
+  \x0 ->
+    \x1 ->
+      \x2 ->
+        \x3 ->
+          \x4 ->
+            fmap BG.fromFFIType (hs_bindgen_9dff60a24ffcda2e_base (BG.toFFIType x0) (BG.toFFIType x1) (BG.toFFIType x2) (BG.toFFIType x3) (BG.toFFIType x4))
+
+{-| __C declaration:__ @duckdb_v2_column_data_collection_create@
+
+    __defined at:__ @duckdb_v2.h 1267:30@
+
+    __exported by:__ @duckdb_v2.h@
+-}
+c_duckdb_v2_column_data_collection_create ::
+     DuckDBV2FactoryHandle
+     -- ^ __C declaration:__ @factory@
+  -> PtrConst.PtrConst DuckDBV2LogicalTypeHandle
+     -- ^ __C declaration:__ @types_array@
+  -> DuckDBIdx
+     -- ^ __C declaration:__ @types_count@
+  -> BG.Ptr DuckDBV2ColumnDataCollectionHandle
+     -- ^ __C declaration:__ @out_collection@
+  -> BG.Ptr DuckDBV2ErrorInfoHandle
+     -- ^ __C declaration:__ @err@
+  -> IO DuckDBV2Error
+c_duckdb_v2_column_data_collection_create =
+  hs_bindgen_9dff60a24ffcda2e
+
+-- __unique:__ @Database_DuckDB_FFI_V2_Database.DuckDB.FFI.V2_Safe_duckdb_v2_column_data_collection_reset@
+foreign import ccall safe "hs_bindgen_b23786ec4d650b95" hs_bindgen_b23786ec4d650b95_base ::
+     BG.Ptr BG.Void
+  -> BG.Ptr BG.Void
+  -> IO BG.CUInt
+
+-- __unique:__ @Database_DuckDB_FFI_V2_Database.DuckDB.FFI.V2_Safe_duckdb_v2_column_data_collection_reset@
+hs_bindgen_b23786ec4d650b95 ::
+     DuckDBV2ColumnDataCollectionHandle
+  -> BG.Ptr DuckDBV2ErrorInfoHandle
+  -> IO DuckDBV2Error
+hs_bindgen_b23786ec4d650b95 =
+  \x0 ->
+    \x1 ->
+      fmap BG.fromFFIType (hs_bindgen_b23786ec4d650b95_base (BG.toFFIType x0) (BG.toFFIType x1))
+
+{-| __C declaration:__ @duckdb_v2_column_data_collection_reset@
+
+    __defined at:__ @duckdb_v2.h 1287:30@
+
+    __exported by:__ @duckdb_v2.h@
+-}
+c_duckdb_v2_column_data_collection_reset ::
+     DuckDBV2ColumnDataCollectionHandle
+     -- ^ __C declaration:__ @collection@
+  -> BG.Ptr DuckDBV2ErrorInfoHandle
+     -- ^ __C declaration:__ @err@
+  -> IO DuckDBV2Error
+c_duckdb_v2_column_data_collection_reset =
+  hs_bindgen_b23786ec4d650b95
+
+-- __unique:__ @Database_DuckDB_FFI_V2_Database.DuckDB.FFI.V2_Safe_duckdb_v2_column_data_collection_clear@
+foreign import ccall safe "hs_bindgen_94c5d7956298e53b" hs_bindgen_94c5d7956298e53b_base ::
+     BG.Ptr BG.Void
+  -> BG.Ptr BG.Void
+  -> IO BG.CUInt
+
+-- __unique:__ @Database_DuckDB_FFI_V2_Database.DuckDB.FFI.V2_Safe_duckdb_v2_column_data_collection_clear@
+hs_bindgen_94c5d7956298e53b ::
+     DuckDBV2ColumnDataCollectionHandle
+  -> BG.Ptr DuckDBV2ErrorInfoHandle
+  -> IO DuckDBV2Error
+hs_bindgen_94c5d7956298e53b =
+  \x0 ->
+    \x1 ->
+      fmap BG.fromFFIType (hs_bindgen_94c5d7956298e53b_base (BG.toFFIType x0) (BG.toFFIType x1))
+
+{-| __C declaration:__ @duckdb_v2_column_data_collection_clear@
+
+    __defined at:__ @duckdb_v2.h 1307:30@
+
+    __exported by:__ @duckdb_v2.h@
+-}
+c_duckdb_v2_column_data_collection_clear ::
+     DuckDBV2ColumnDataCollectionHandle
+     -- ^ __C declaration:__ @collection@
+  -> BG.Ptr DuckDBV2ErrorInfoHandle
+     -- ^ __C declaration:__ @err@
+  -> IO DuckDBV2Error
+c_duckdb_v2_column_data_collection_clear =
+  hs_bindgen_94c5d7956298e53b
+
+-- __unique:__ @Database_DuckDB_FFI_V2_Database.DuckDB.FFI.V2_Safe_duckdb_v2_column_data_collection_destroy@
+foreign import ccall safe "hs_bindgen_912fbeaadf6e2a67" hs_bindgen_912fbeaadf6e2a67_base ::
+     BG.Ptr BG.Void
+  -> IO BG.CUInt
+
+-- __unique:__ @Database_DuckDB_FFI_V2_Database.DuckDB.FFI.V2_Safe_duckdb_v2_column_data_collection_destroy@
+hs_bindgen_912fbeaadf6e2a67 ::
+     BG.Ptr DuckDBV2ColumnDataCollectionHandle
+  -> IO DuckDBV2Error
+hs_bindgen_912fbeaadf6e2a67 =
+  \x0 ->
+    fmap BG.fromFFIType (hs_bindgen_912fbeaadf6e2a67_base (BG.toFFIType x0))
+
+{-| __C declaration:__ @duckdb_v2_column_data_collection_destroy@
+
+    __defined at:__ @duckdb_v2.h 1325:1@
+
+    __exported by:__ @duckdb_v2.h@
+-}
+c_duckdb_v2_column_data_collection_destroy ::
+     BG.Ptr DuckDBV2ColumnDataCollectionHandle
+     -- ^ __C declaration:__ @collection@
+  -> IO DuckDBV2Error
+c_duckdb_v2_column_data_collection_destroy =
+  hs_bindgen_912fbeaadf6e2a67
+
+-- __unique:__ @Database_DuckDB_FFI_V2_Database.DuckDB.FFI.V2_Safe_duckdb_v2_column_data_collection_combine@
+foreign import ccall safe "hs_bindgen_5c277886da5b0688" hs_bindgen_5c277886da5b0688_base ::
+     BG.Ptr BG.Void
+  -> BG.Ptr BG.Void
+  -> BG.Ptr BG.Void
+  -> IO BG.CUInt
+
+-- __unique:__ @Database_DuckDB_FFI_V2_Database.DuckDB.FFI.V2_Safe_duckdb_v2_column_data_collection_combine@
+hs_bindgen_5c277886da5b0688 ::
+     DuckDBV2ColumnDataCollectionHandle
+  -> BG.Ptr DuckDBV2ColumnDataCollectionHandle
+  -> BG.Ptr DuckDBV2ErrorInfoHandle
+  -> IO DuckDBV2Error
+hs_bindgen_5c277886da5b0688 =
+  \x0 ->
+    \x1 ->
+      \x2 ->
+        fmap BG.fromFFIType (hs_bindgen_5c277886da5b0688_base (BG.toFFIType x0) (BG.toFFIType x1) (BG.toFFIType x2))
+
+{-| __C declaration:__ @duckdb_v2_column_data_collection_combine@
+
+    __defined at:__ @duckdb_v2.h 1347:30@
+
+    __exported by:__ @duckdb_v2.h@
+-}
+c_duckdb_v2_column_data_collection_combine ::
+     DuckDBV2ColumnDataCollectionHandle
+     -- ^ __C declaration:__ @target@
+  -> BG.Ptr DuckDBV2ColumnDataCollectionHandle
+     -- ^ __C declaration:__ @source@
+  -> BG.Ptr DuckDBV2ErrorInfoHandle
+     -- ^ __C declaration:__ @err@
+  -> IO DuckDBV2Error
+c_duckdb_v2_column_data_collection_combine =
+  hs_bindgen_5c277886da5b0688
+
+-- __unique:__ @Database_DuckDB_FFI_V2_Database.DuckDB.FFI.V2_Safe_duckdb_v2_column_data_collection_row_count@
+foreign import ccall safe "hs_bindgen_913dd376ea4c0bd9" hs_bindgen_913dd376ea4c0bd9_base ::
+     BG.Ptr BG.Void
+  -> BG.Ptr BG.Void
+  -> BG.Ptr BG.Void
+  -> IO BG.CUInt
+
+-- __unique:__ @Database_DuckDB_FFI_V2_Database.DuckDB.FFI.V2_Safe_duckdb_v2_column_data_collection_row_count@
+hs_bindgen_913dd376ea4c0bd9 ::
+     DuckDBV2ColumnDataCollectionHandle
+  -> BG.Ptr DuckDBIdx
+  -> BG.Ptr DuckDBV2ErrorInfoHandle
+  -> IO DuckDBV2Error
+hs_bindgen_913dd376ea4c0bd9 =
+  \x0 ->
+    \x1 ->
+      \x2 ->
+        fmap BG.fromFFIType (hs_bindgen_913dd376ea4c0bd9_base (BG.toFFIType x0) (BG.toFFIType x1) (BG.toFFIType x2))
+
+{-| __C declaration:__ @duckdb_v2_column_data_collection_row_count@
+
+    __defined at:__ @duckdb_v2.h 1367:30@
+
+    __exported by:__ @duckdb_v2.h@
+-}
+c_duckdb_v2_column_data_collection_row_count ::
+     DuckDBV2ColumnDataCollectionHandle
+     -- ^ __C declaration:__ @collection@
+  -> BG.Ptr DuckDBIdx
+     -- ^ __C declaration:__ @out_row_count@
+  -> BG.Ptr DuckDBV2ErrorInfoHandle
+     -- ^ __C declaration:__ @err@
+  -> IO DuckDBV2Error
+c_duckdb_v2_column_data_collection_row_count =
+  hs_bindgen_913dd376ea4c0bd9
+
+-- __unique:__ @Database_DuckDB_FFI_V2_Database.DuckDB.FFI.V2_Safe_duckdb_v2_column_data_collection_append_state_create@
+foreign import ccall safe "hs_bindgen_7da52d05e210451c" hs_bindgen_7da52d05e210451c_base ::
+     BG.Ptr BG.Void
+  -> BG.Ptr BG.Void
+  -> BG.Ptr BG.Void
+  -> IO BG.CUInt
+
+-- __unique:__ @Database_DuckDB_FFI_V2_Database.DuckDB.FFI.V2_Safe_duckdb_v2_column_data_collection_append_state_create@
+hs_bindgen_7da52d05e210451c ::
+     DuckDBV2ColumnDataCollectionHandle
+  -> BG.Ptr DuckDBV2ColumnDataCollectionAppendStateHandle
+  -> BG.Ptr DuckDBV2ErrorInfoHandle
+  -> IO DuckDBV2Error
+hs_bindgen_7da52d05e210451c =
+  \x0 ->
+    \x1 ->
+      \x2 ->
+        fmap BG.fromFFIType (hs_bindgen_7da52d05e210451c_base (BG.toFFIType x0) (BG.toFFIType x1) (BG.toFFIType x2))
+
+{-| __C declaration:__ @duckdb_v2_column_data_collection_append_state_create@
+
+    __defined at:__ @duckdb_v2.h 1386:30@
+
+    __exported by:__ @duckdb_v2.h@
+-}
+c_duckdb_v2_column_data_collection_append_state_create ::
+     DuckDBV2ColumnDataCollectionHandle
+     -- ^ __C declaration:__ @collection@
+  -> BG.Ptr DuckDBV2ColumnDataCollectionAppendStateHandle
+     -- ^ __C declaration:__ @out_state@
+  -> BG.Ptr DuckDBV2ErrorInfoHandle
+     -- ^ __C declaration:__ @err@
+  -> IO DuckDBV2Error
+c_duckdb_v2_column_data_collection_append_state_create =
+  hs_bindgen_7da52d05e210451c
+
+-- __unique:__ @Database_DuckDB_FFI_V2_Database.DuckDB.FFI.V2_Safe_duckdb_v2_column_data_collection_append_state_destroy@
+foreign import ccall safe "hs_bindgen_92fd22e162f14e28" hs_bindgen_92fd22e162f14e28_base ::
+     BG.Ptr BG.Void
+  -> IO BG.CUInt
+
+-- __unique:__ @Database_DuckDB_FFI_V2_Database.DuckDB.FFI.V2_Safe_duckdb_v2_column_data_collection_append_state_destroy@
+hs_bindgen_92fd22e162f14e28 ::
+     BG.Ptr DuckDBV2ColumnDataCollectionAppendStateHandle
+  -> IO DuckDBV2Error
+hs_bindgen_92fd22e162f14e28 =
+  \x0 ->
+    fmap BG.fromFFIType (hs_bindgen_92fd22e162f14e28_base (BG.toFFIType x0))
+
+{-| __C declaration:__ @duckdb_v2_column_data_collection_append_state_destroy@
+
+    __defined at:__ @duckdb_v2.h 1404:1@
+
+    __exported by:__ @duckdb_v2.h@
+-}
+c_duckdb_v2_column_data_collection_append_state_destroy ::
+     BG.Ptr DuckDBV2ColumnDataCollectionAppendStateHandle
+     -- ^ __C declaration:__ @state@
+  -> IO DuckDBV2Error
+c_duckdb_v2_column_data_collection_append_state_destroy =
+  hs_bindgen_92fd22e162f14e28
+
+-- __unique:__ @Database_DuckDB_FFI_V2_Database.DuckDB.FFI.V2_Safe_duckdb_v2_column_data_collection_append@
+foreign import ccall safe "hs_bindgen_c49da7ea0206b365" hs_bindgen_c49da7ea0206b365_base ::
+     BG.Ptr BG.Void
+  -> BG.Ptr BG.Void
+  -> BG.Ptr BG.Void
+  -> BG.Ptr BG.Void
+  -> IO BG.CUInt
+
+-- __unique:__ @Database_DuckDB_FFI_V2_Database.DuckDB.FFI.V2_Safe_duckdb_v2_column_data_collection_append@
+hs_bindgen_c49da7ea0206b365 ::
+     DuckDBV2ColumnDataCollectionHandle
+  -> DuckDBV2ColumnDataCollectionAppendStateHandle
+  -> DuckDBV2DataChunkHandle
+  -> BG.Ptr DuckDBV2ErrorInfoHandle
+  -> IO DuckDBV2Error
+hs_bindgen_c49da7ea0206b365 =
+  \x0 ->
+    \x1 ->
+      \x2 ->
+        \x3 ->
+          fmap BG.fromFFIType (hs_bindgen_c49da7ea0206b365_base (BG.toFFIType x0) (BG.toFFIType x1) (BG.toFFIType x2) (BG.toFFIType x3))
+
+{-| __C declaration:__ @duckdb_v2_column_data_collection_append@
+
+    __defined at:__ @duckdb_v2.h 1425:30@
+
+    __exported by:__ @duckdb_v2.h@
+-}
+c_duckdb_v2_column_data_collection_append ::
+     DuckDBV2ColumnDataCollectionHandle
+     -- ^ __C declaration:__ @collection@
+  -> DuckDBV2ColumnDataCollectionAppendStateHandle
+     -- ^ __C declaration:__ @state@
+  -> DuckDBV2DataChunkHandle
+     -- ^ __C declaration:__ @chunk@
+  -> BG.Ptr DuckDBV2ErrorInfoHandle
+     -- ^ __C declaration:__ @err@
+  -> IO DuckDBV2Error
+c_duckdb_v2_column_data_collection_append =
+  hs_bindgen_c49da7ea0206b365
+
+-- __unique:__ @Database_DuckDB_FFI_V2_Database.DuckDB.FFI.V2_Safe_duckdb_v2_column_data_collection_shared_scan_state_create@
+foreign import ccall safe "hs_bindgen_25fe9c136516c087" hs_bindgen_25fe9c136516c087_base ::
+     BG.Ptr BG.Void
+  -> BG.Ptr BG.Void
+  -> BG.Ptr BG.Void
+  -> IO BG.CUInt
+
+-- __unique:__ @Database_DuckDB_FFI_V2_Database.DuckDB.FFI.V2_Safe_duckdb_v2_column_data_collection_shared_scan_state_create@
+hs_bindgen_25fe9c136516c087 ::
+     DuckDBV2ColumnDataCollectionHandle
+  -> BG.Ptr DuckDBV2ColumnDataCollectionSharedScanStateHandle
+  -> BG.Ptr DuckDBV2ErrorInfoHandle
+  -> IO DuckDBV2Error
+hs_bindgen_25fe9c136516c087 =
+  \x0 ->
+    \x1 ->
+      \x2 ->
+        fmap BG.fromFFIType (hs_bindgen_25fe9c136516c087_base (BG.toFFIType x0) (BG.toFFIType x1) (BG.toFFIType x2))
+
+{-| __C declaration:__ @duckdb_v2_column_data_collection_shared_scan_state_create@
+
+    __defined at:__ @duckdb_v2.h 1445:30@
+
+    __exported by:__ @duckdb_v2.h@
+-}
+c_duckdb_v2_column_data_collection_shared_scan_state_create ::
+     DuckDBV2ColumnDataCollectionHandle
+     -- ^ __C declaration:__ @collection@
+  -> BG.Ptr DuckDBV2ColumnDataCollectionSharedScanStateHandle
+     -- ^ __C declaration:__ @out_state@
+  -> BG.Ptr DuckDBV2ErrorInfoHandle
+     -- ^ __C declaration:__ @err@
+  -> IO DuckDBV2Error
+c_duckdb_v2_column_data_collection_shared_scan_state_create =
+  hs_bindgen_25fe9c136516c087
+
+-- __unique:__ @Database_DuckDB_FFI_V2_Database.DuckDB.FFI.V2_Safe_duckdb_v2_column_data_collection_shared_scan_state_destroy@
+foreign import ccall safe "hs_bindgen_afbd72ed03626d52" hs_bindgen_afbd72ed03626d52_base ::
+     BG.Ptr BG.Void
+  -> IO BG.CUInt
+
+-- __unique:__ @Database_DuckDB_FFI_V2_Database.DuckDB.FFI.V2_Safe_duckdb_v2_column_data_collection_shared_scan_state_destroy@
+hs_bindgen_afbd72ed03626d52 ::
+     BG.Ptr DuckDBV2ColumnDataCollectionSharedScanStateHandle
+  -> IO DuckDBV2Error
+hs_bindgen_afbd72ed03626d52 =
+  \x0 ->
+    fmap BG.fromFFIType (hs_bindgen_afbd72ed03626d52_base (BG.toFFIType x0))
+
+{-| __C declaration:__ @duckdb_v2_column_data_collection_shared_scan_state_destroy@
+
+    __defined at:__ @duckdb_v2.h 1463:30@
+
+    __exported by:__ @duckdb_v2.h@
+-}
+c_duckdb_v2_column_data_collection_shared_scan_state_destroy ::
+     BG.Ptr DuckDBV2ColumnDataCollectionSharedScanStateHandle
+     -- ^ __C declaration:__ @state@
+  -> IO DuckDBV2Error
+c_duckdb_v2_column_data_collection_shared_scan_state_destroy =
+  hs_bindgen_afbd72ed03626d52
+
+-- __unique:__ @Database_DuckDB_FFI_V2_Database.DuckDB.FFI.V2_Safe_duckdb_v2_column_data_collection_worker_scan_state_create@
+foreign import ccall safe "hs_bindgen_376c5d23518529f4" hs_bindgen_376c5d23518529f4_base ::
+     BG.Ptr BG.Void
+  -> BG.Ptr BG.Void
+  -> BG.Ptr BG.Void
+  -> IO BG.CUInt
+
+-- __unique:__ @Database_DuckDB_FFI_V2_Database.DuckDB.FFI.V2_Safe_duckdb_v2_column_data_collection_worker_scan_state_create@
+hs_bindgen_376c5d23518529f4 ::
+     DuckDBV2ColumnDataCollectionHandle
+  -> BG.Ptr DuckDBV2ColumnDataCollectionWorkerScanStateHandle
+  -> BG.Ptr DuckDBV2ErrorInfoHandle
+  -> IO DuckDBV2Error
+hs_bindgen_376c5d23518529f4 =
+  \x0 ->
+    \x1 ->
+      \x2 ->
+        fmap BG.fromFFIType (hs_bindgen_376c5d23518529f4_base (BG.toFFIType x0) (BG.toFFIType x1) (BG.toFFIType x2))
+
+{-| __C declaration:__ @duckdb_v2_column_data_collection_worker_scan_state_create@
+
+    __defined at:__ @duckdb_v2.h 1483:30@
+
+    __exported by:__ @duckdb_v2.h@
+-}
+c_duckdb_v2_column_data_collection_worker_scan_state_create ::
+     DuckDBV2ColumnDataCollectionHandle
+     -- ^ __C declaration:__ @collection@
+  -> BG.Ptr DuckDBV2ColumnDataCollectionWorkerScanStateHandle
+     -- ^ __C declaration:__ @out_state@
+  -> BG.Ptr DuckDBV2ErrorInfoHandle
+     -- ^ __C declaration:__ @err@
+  -> IO DuckDBV2Error
+c_duckdb_v2_column_data_collection_worker_scan_state_create =
+  hs_bindgen_376c5d23518529f4
+
+-- __unique:__ @Database_DuckDB_FFI_V2_Database.DuckDB.FFI.V2_Safe_duckdb_v2_column_data_collection_worker_scan_state_destroy@
+foreign import ccall safe "hs_bindgen_1a6611ac76d4f30b" hs_bindgen_1a6611ac76d4f30b_base ::
+     BG.Ptr BG.Void
+  -> IO BG.CUInt
+
+-- __unique:__ @Database_DuckDB_FFI_V2_Database.DuckDB.FFI.V2_Safe_duckdb_v2_column_data_collection_worker_scan_state_destroy@
+hs_bindgen_1a6611ac76d4f30b ::
+     BG.Ptr DuckDBV2ColumnDataCollectionWorkerScanStateHandle
+  -> IO DuckDBV2Error
+hs_bindgen_1a6611ac76d4f30b =
+  \x0 ->
+    fmap BG.fromFFIType (hs_bindgen_1a6611ac76d4f30b_base (BG.toFFIType x0))
+
+{-| __C declaration:__ @duckdb_v2_column_data_collection_worker_scan_state_destroy@
+
+    __defined at:__ @duckdb_v2.h 1501:30@
+
+    __exported by:__ @duckdb_v2.h@
+-}
+c_duckdb_v2_column_data_collection_worker_scan_state_destroy ::
+     BG.Ptr DuckDBV2ColumnDataCollectionWorkerScanStateHandle
+     -- ^ __C declaration:__ @state@
+  -> IO DuckDBV2Error
+c_duckdb_v2_column_data_collection_worker_scan_state_destroy =
+  hs_bindgen_1a6611ac76d4f30b
+
+-- __unique:__ @Database_DuckDB_FFI_V2_Database.DuckDB.FFI.V2_Safe_duckdb_v2_column_data_collection_scan@
+foreign import ccall safe "hs_bindgen_17f3458526cb44e4" hs_bindgen_17f3458526cb44e4_base ::
+     BG.Ptr BG.Void
+  -> BG.Ptr BG.Void
+  -> BG.Ptr BG.Void
+  -> BG.Ptr BG.Void
+  -> BG.Ptr BG.Void
+  -> BG.Ptr BG.Void
+  -> IO BG.CUInt
+
+-- __unique:__ @Database_DuckDB_FFI_V2_Database.DuckDB.FFI.V2_Safe_duckdb_v2_column_data_collection_scan@
+hs_bindgen_17f3458526cb44e4 ::
+     DuckDBV2ColumnDataCollectionHandle
+  -> DuckDBV2ColumnDataCollectionSharedScanStateHandle
+  -> DuckDBV2ColumnDataCollectionWorkerScanStateHandle
+  -> DuckDBV2DataChunkHandle
+  -> BG.Ptr BG.CBool
+  -> BG.Ptr DuckDBV2ErrorInfoHandle
+  -> IO DuckDBV2Error
+hs_bindgen_17f3458526cb44e4 =
+  \x0 ->
+    \x1 ->
+      \x2 ->
+        \x3 ->
+          \x4 ->
+            \x5 ->
+              fmap BG.fromFFIType (hs_bindgen_17f3458526cb44e4_base (BG.toFFIType x0) (BG.toFFIType x1) (BG.toFFIType x2) (BG.toFFIType x3) (BG.toFFIType x4) (BG.toFFIType x5))
+
+{-| __C declaration:__ @duckdb_v2_column_data_collection_scan@
+
+    __defined at:__ @duckdb_v2.h 1531:30@
+
+    __exported by:__ @duckdb_v2.h@
+-}
+c_duckdb_v2_column_data_collection_scan ::
+     DuckDBV2ColumnDataCollectionHandle
+     -- ^ __C declaration:__ @collection@
+  -> DuckDBV2ColumnDataCollectionSharedScanStateHandle
+     -- ^ __C declaration:__ @shared_state@
+  -> DuckDBV2ColumnDataCollectionWorkerScanStateHandle
+     -- ^ __C declaration:__ @worker_state@
+  -> DuckDBV2DataChunkHandle
+     -- ^ __C declaration:__ @out_chunk@
+  -> BG.Ptr BG.CBool
+     -- ^ __C declaration:__ @did_produce_chunk@
+  -> BG.Ptr DuckDBV2ErrorInfoHandle
+     -- ^ __C declaration:__ @err@
+  -> IO DuckDBV2Error
+c_duckdb_v2_column_data_collection_scan =
+  hs_bindgen_17f3458526cb44e4
+
+-- __unique:__ @Database_DuckDB_FFI_V2_Database.DuckDB.FFI.V2_Safe_duckdb_v2_instance_get_config@
+foreign import ccall safe "hs_bindgen_4beee4f040cabb60" hs_bindgen_4beee4f040cabb60_base ::
+     BG.Ptr BG.Void
+  -> BG.Ptr BG.Void
+  -> BG.Ptr BG.Void
+  -> IO BG.CUInt
+
+-- __unique:__ @Database_DuckDB_FFI_V2_Database.DuckDB.FFI.V2_Safe_duckdb_v2_instance_get_config@
+hs_bindgen_4beee4f040cabb60 ::
+     DuckDBV2InstanceHandle
+  -> BG.Ptr DuckDBV2ConfigHandle
+  -> BG.Ptr DuckDBV2ErrorInfoHandle
+  -> IO DuckDBV2Error
+hs_bindgen_4beee4f040cabb60 =
+  \x0 ->
+    \x1 ->
+      \x2 ->
+        fmap BG.fromFFIType (hs_bindgen_4beee4f040cabb60_base (BG.toFFIType x0) (BG.toFFIType x1) (BG.toFFIType x2))
+
+{-| __C declaration:__ @duckdb_v2_instance_get_config@
+
+    __defined at:__ @duckdb_v2.h 1592:30@
+
+    __exported by:__ @duckdb_v2.h@
+-}
+c_duckdb_v2_instance_get_config ::
+     DuckDBV2InstanceHandle
+     -- ^ __C declaration:__ @instance@
+  -> BG.Ptr DuckDBV2ConfigHandle
+     -- ^ __C declaration:__ @out_config@
+  -> BG.Ptr DuckDBV2ErrorInfoHandle
+     -- ^ __C declaration:__ @err@
+  -> IO DuckDBV2Error
+c_duckdb_v2_instance_get_config =
+  hs_bindgen_4beee4f040cabb60
+
+-- __unique:__ @Database_DuckDB_FFI_V2_Database.DuckDB.FFI.V2_Safe_duckdb_v2_connection_get_config@
+foreign import ccall safe "hs_bindgen_e72eac585a1c21ee" hs_bindgen_e72eac585a1c21ee_base ::
+     BG.Ptr BG.Void
+  -> BG.Ptr BG.Void
+  -> BG.Ptr BG.Void
+  -> IO BG.CUInt
+
+-- __unique:__ @Database_DuckDB_FFI_V2_Database.DuckDB.FFI.V2_Safe_duckdb_v2_connection_get_config@
+hs_bindgen_e72eac585a1c21ee ::
+     DuckDBV2ConnectionHandle
+  -> BG.Ptr DuckDBV2ConfigHandle
+  -> BG.Ptr DuckDBV2ErrorInfoHandle
+  -> IO DuckDBV2Error
+hs_bindgen_e72eac585a1c21ee =
+  \x0 ->
+    \x1 ->
+      \x2 ->
+        fmap BG.fromFFIType (hs_bindgen_e72eac585a1c21ee_base (BG.toFFIType x0) (BG.toFFIType x1) (BG.toFFIType x2))
+
+{-| __C declaration:__ @duckdb_v2_connection_get_config@
+
+    __defined at:__ @duckdb_v2.h 1614:30@
+
+    __exported by:__ @duckdb_v2.h@
+-}
+c_duckdb_v2_connection_get_config ::
+     DuckDBV2ConnectionHandle
+     -- ^ __C declaration:__ @conn@
+  -> BG.Ptr DuckDBV2ConfigHandle
+     -- ^ __C declaration:__ @out_config@
+  -> BG.Ptr DuckDBV2ErrorInfoHandle
+     -- ^ __C declaration:__ @err@
+  -> IO DuckDBV2Error
+c_duckdb_v2_connection_get_config =
+  hs_bindgen_e72eac585a1c21ee
+
+-- __unique:__ @Database_DuckDB_FFI_V2_Database.DuckDB.FFI.V2_Safe_duckdb_v2_context_get_config@
+foreign import ccall safe "hs_bindgen_9ad8ab4a89c46a58" hs_bindgen_9ad8ab4a89c46a58_base ::
+     BG.Ptr BG.Void
+  -> BG.Ptr BG.Void
+  -> BG.Ptr BG.Void
+  -> IO BG.CUInt
+
+-- __unique:__ @Database_DuckDB_FFI_V2_Database.DuckDB.FFI.V2_Safe_duckdb_v2_context_get_config@
+hs_bindgen_9ad8ab4a89c46a58 ::
+     DuckDBV2ContextHandle
+  -> BG.Ptr DuckDBV2ConfigHandle
+  -> BG.Ptr DuckDBV2ErrorInfoHandle
+  -> IO DuckDBV2Error
+hs_bindgen_9ad8ab4a89c46a58 =
+  \x0 ->
+    \x1 ->
+      \x2 ->
+        fmap BG.fromFFIType (hs_bindgen_9ad8ab4a89c46a58_base (BG.toFFIType x0) (BG.toFFIType x1) (BG.toFFIType x2))
+
+{-| __C declaration:__ @duckdb_v2_context_get_config@
+
+    __defined at:__ @duckdb_v2.h 1635:30@
+
+    __exported by:__ @duckdb_v2.h@
+-}
+c_duckdb_v2_context_get_config ::
+     DuckDBV2ContextHandle
+     -- ^ __C declaration:__ @ctx@
+  -> BG.Ptr DuckDBV2ConfigHandle
+     -- ^ __C declaration:__ @out_config@
+  -> BG.Ptr DuckDBV2ErrorInfoHandle
+     -- ^ __C declaration:__ @err@
+  -> IO DuckDBV2Error
+c_duckdb_v2_context_get_config =
+  hs_bindgen_9ad8ab4a89c46a58
+
+-- __unique:__ @Database_DuckDB_FFI_V2_Database.DuckDB.FFI.V2_Safe_duckdb_v2_config_get_option_value@
+foreign import ccall safe "hs_bindgen_27fbc60cf4891fdc" hs_bindgen_27fbc60cf4891fdc_base ::
+     BG.Ptr BG.Void
+  -> BG.Ptr BG.Void
+  -> BG.Ptr BG.Void
+  -> BG.Ptr BG.Void
+  -> BG.Ptr BG.Void
+  -> IO BG.CUInt
+
+-- __unique:__ @Database_DuckDB_FFI_V2_Database.DuckDB.FFI.V2_Safe_duckdb_v2_config_get_option_value@
+hs_bindgen_27fbc60cf4891fdc ::
+     DuckDBV2ConfigHandle
+  -> PtrConst.PtrConst DuckDBV2IdentifierT
+  -> BG.Ptr DuckDBV2ValueHandle
+  -> BG.Ptr DuckDBV2SettingScope
+  -> BG.Ptr DuckDBV2ErrorInfoHandle
+  -> IO DuckDBV2Error
+hs_bindgen_27fbc60cf4891fdc =
+  \x0 ->
+    \x1 ->
+      \x2 ->
+        \x3 ->
+          \x4 ->
+            fmap BG.fromFFIType (hs_bindgen_27fbc60cf4891fdc_base (BG.toFFIType x0) (BG.toFFIType x1) (BG.toFFIType x2) (BG.toFFIType x3) (BG.toFFIType x4))
+
+{-| __C declaration:__ @duckdb_v2_config_get_option_value@
+
+    __defined at:__ @duckdb_v2.h 1658:30@
+
+    __exported by:__ @duckdb_v2.h@
+-}
+c_duckdb_v2_config_get_option_value ::
+     DuckDBV2ConfigHandle
+     -- ^ __C declaration:__ @config@
+  -> PtrConst.PtrConst DuckDBV2IdentifierT
+     -- ^ __C declaration:__ @name@
+  -> BG.Ptr DuckDBV2ValueHandle
+     -- ^ __C declaration:__ @out_value@
+  -> BG.Ptr DuckDBV2SettingScope
+     -- ^ __C declaration:__ @out_scope@
+  -> BG.Ptr DuckDBV2ErrorInfoHandle
+     -- ^ __C declaration:__ @err@
+  -> IO DuckDBV2Error
+c_duckdb_v2_config_get_option_value =
+  hs_bindgen_27fbc60cf4891fdc
+
+-- __unique:__ @Database_DuckDB_FFI_V2_Database.DuckDB.FFI.V2_Safe_duckdb_v2_config_set_option_value@
+foreign import ccall safe "hs_bindgen_1f2e16826680e38c" hs_bindgen_1f2e16826680e38c_base ::
+     BG.Ptr BG.Void
+  -> BG.Ptr BG.Void
+  -> BG.Ptr BG.Void
+  -> BG.CUInt
+  -> BG.Ptr BG.Void
+  -> IO BG.CUInt
+
+-- __unique:__ @Database_DuckDB_FFI_V2_Database.DuckDB.FFI.V2_Safe_duckdb_v2_config_set_option_value@
+hs_bindgen_1f2e16826680e38c ::
+     DuckDBV2ConfigHandle
+  -> PtrConst.PtrConst DuckDBV2IdentifierT
+  -> DuckDBV2ValueHandle
+  -> DuckDBV2SettingScope
+  -> BG.Ptr DuckDBV2ErrorInfoHandle
+  -> IO DuckDBV2Error
+hs_bindgen_1f2e16826680e38c =
+  \x0 ->
+    \x1 ->
+      \x2 ->
+        \x3 ->
+          \x4 ->
+            fmap BG.fromFFIType (hs_bindgen_1f2e16826680e38c_base (BG.toFFIType x0) (BG.toFFIType x1) (BG.toFFIType x2) (BG.toFFIType x3) (BG.toFFIType x4))
+
+{-| __C declaration:__ @duckdb_v2_config_set_option_value@
+
+    __defined at:__ @duckdb_v2.h 1689:30@
+
+    __exported by:__ @duckdb_v2.h@
+-}
+c_duckdb_v2_config_set_option_value ::
+     DuckDBV2ConfigHandle
+     -- ^ __C declaration:__ @config@
+  -> PtrConst.PtrConst DuckDBV2IdentifierT
+     -- ^ __C declaration:__ @name@
+  -> DuckDBV2ValueHandle
+     -- ^ __C declaration:__ @value@
+  -> DuckDBV2SettingScope
+     -- ^ __C declaration:__ @scope@
+  -> BG.Ptr DuckDBV2ErrorInfoHandle
+     -- ^ __C declaration:__ @err@
+  -> IO DuckDBV2Error
+c_duckdb_v2_config_set_option_value =
+  hs_bindgen_1f2e16826680e38c
+
+-- __unique:__ @Database_DuckDB_FFI_V2_Database.DuckDB.FFI.V2_Safe_duckdb_v2_config_set_option_text@
+foreign import ccall safe "hs_bindgen_89af9327ea2ff7ac" hs_bindgen_89af9327ea2ff7ac_base ::
+     BG.Ptr BG.Void
+  -> BG.Ptr BG.Void
+  -> BG.Ptr BG.Void
+  -> BG.CUInt
+  -> BG.Ptr BG.Void
+  -> IO BG.CUInt
+
+-- __unique:__ @Database_DuckDB_FFI_V2_Database.DuckDB.FFI.V2_Safe_duckdb_v2_config_set_option_text@
+hs_bindgen_89af9327ea2ff7ac ::
+     DuckDBV2ConfigHandle
+  -> PtrConst.PtrConst DuckDBV2IdentifierT
+  -> PtrConst.PtrConst DuckDBV2Str
+  -> DuckDBV2SettingScope
+  -> BG.Ptr DuckDBV2ErrorInfoHandle
+  -> IO DuckDBV2Error
+hs_bindgen_89af9327ea2ff7ac =
+  \x0 ->
+    \x1 ->
+      \x2 ->
+        \x3 ->
+          \x4 ->
+            fmap BG.fromFFIType (hs_bindgen_89af9327ea2ff7ac_base (BG.toFFIType x0) (BG.toFFIType x1) (BG.toFFIType x2) (BG.toFFIType x3) (BG.toFFIType x4))
+
+{-| __C declaration:__ @duckdb_v2_config_set_option_text@
+
+    __defined at:__ @duckdb_v2.h 1715:30@
+
+    __exported by:__ @duckdb_v2.h@
+-}
+c_duckdb_v2_config_set_option_text ::
+     DuckDBV2ConfigHandle
+     -- ^ __C declaration:__ @config@
+  -> PtrConst.PtrConst DuckDBV2IdentifierT
+     -- ^ __C declaration:__ @name@
+  -> PtrConst.PtrConst DuckDBV2Str
+     -- ^ __C declaration:__ @setting@
+  -> DuckDBV2SettingScope
+     -- ^ __C declaration:__ @scope@
+  -> BG.Ptr DuckDBV2ErrorInfoHandle
+     -- ^ __C declaration:__ @err@
+  -> IO DuckDBV2Error
+c_duckdb_v2_config_set_option_text =
+  hs_bindgen_89af9327ea2ff7ac
+
+-- __unique:__ @Database_DuckDB_FFI_V2_Database.DuckDB.FFI.V2_Safe_duckdb_v2_config_get_option_by_name@
+foreign import ccall safe "hs_bindgen_c7038af6a6f91b7a" hs_bindgen_c7038af6a6f91b7a_base ::
+     BG.Ptr BG.Void
+  -> BG.Ptr BG.Void
+  -> BG.Ptr BG.Void
+  -> BG.Ptr BG.Void
+  -> IO BG.CUInt
+
+-- __unique:__ @Database_DuckDB_FFI_V2_Database.DuckDB.FFI.V2_Safe_duckdb_v2_config_get_option_by_name@
+hs_bindgen_c7038af6a6f91b7a ::
+     DuckDBV2ConfigHandle
+  -> PtrConst.PtrConst DuckDBV2IdentifierT
+  -> BG.Ptr DuckDBV2OptionHandle
+  -> BG.Ptr DuckDBV2ErrorInfoHandle
+  -> IO DuckDBV2Error
+hs_bindgen_c7038af6a6f91b7a =
+  \x0 ->
+    \x1 ->
+      \x2 ->
+        \x3 ->
+          fmap BG.fromFFIType (hs_bindgen_c7038af6a6f91b7a_base (BG.toFFIType x0) (BG.toFFIType x1) (BG.toFFIType x2) (BG.toFFIType x3))
+
+{-| __C declaration:__ @duckdb_v2_config_get_option_by_name@
+
+    __defined at:__ @duckdb_v2.h 1741:30@
+
+    __exported by:__ @duckdb_v2.h@
+-}
+c_duckdb_v2_config_get_option_by_name ::
+     DuckDBV2ConfigHandle
+     -- ^ __C declaration:__ @config@
+  -> PtrConst.PtrConst DuckDBV2IdentifierT
+     -- ^ __C declaration:__ @name@
+  -> BG.Ptr DuckDBV2OptionHandle
+     -- ^ __C declaration:__ @out_option@
+  -> BG.Ptr DuckDBV2ErrorInfoHandle
+     -- ^ __C declaration:__ @err@
+  -> IO DuckDBV2Error
+c_duckdb_v2_config_get_option_by_name =
+  hs_bindgen_c7038af6a6f91b7a
+
+-- __unique:__ @Database_DuckDB_FFI_V2_Database.DuckDB.FFI.V2_Safe_duckdb_v2_config_get_option_count@
+foreign import ccall safe "hs_bindgen_bd34112ea81d094b" hs_bindgen_bd34112ea81d094b_base ::
+     BG.Ptr BG.Void
+  -> BG.Ptr BG.Void
+  -> BG.Ptr BG.Void
+  -> IO BG.CUInt
+
+-- __unique:__ @Database_DuckDB_FFI_V2_Database.DuckDB.FFI.V2_Safe_duckdb_v2_config_get_option_count@
+hs_bindgen_bd34112ea81d094b ::
+     DuckDBV2ConfigHandle
+  -> BG.Ptr DuckDBIdx
+  -> BG.Ptr DuckDBV2ErrorInfoHandle
+  -> IO DuckDBV2Error
+hs_bindgen_bd34112ea81d094b =
+  \x0 ->
+    \x1 ->
+      \x2 ->
+        fmap BG.fromFFIType (hs_bindgen_bd34112ea81d094b_base (BG.toFFIType x0) (BG.toFFIType x1) (BG.toFFIType x2))
+
+{-| __C declaration:__ @duckdb_v2_config_get_option_count@
+
+    __defined at:__ @duckdb_v2.h 1763:30@
+
+    __exported by:__ @duckdb_v2.h@
+-}
+c_duckdb_v2_config_get_option_count ::
+     DuckDBV2ConfigHandle
+     -- ^ __C declaration:__ @config@
+  -> BG.Ptr DuckDBIdx
+     -- ^ __C declaration:__ @out_count@
+  -> BG.Ptr DuckDBV2ErrorInfoHandle
+     -- ^ __C declaration:__ @err@
+  -> IO DuckDBV2Error
+c_duckdb_v2_config_get_option_count =
+  hs_bindgen_bd34112ea81d094b
+
+-- __unique:__ @Database_DuckDB_FFI_V2_Database.DuckDB.FFI.V2_Safe_duckdb_v2_config_get_option_by_index@
+foreign import ccall safe "hs_bindgen_9a89021a895213c4" hs_bindgen_9a89021a895213c4_base ::
+     BG.Ptr BG.Void
+  -> HsBindgen.Runtime.LibC.Word64
+  -> BG.Ptr BG.Void
+  -> BG.Ptr BG.Void
+  -> IO BG.CUInt
+
+-- __unique:__ @Database_DuckDB_FFI_V2_Database.DuckDB.FFI.V2_Safe_duckdb_v2_config_get_option_by_index@
+hs_bindgen_9a89021a895213c4 ::
+     DuckDBV2ConfigHandle
+  -> DuckDBIdx
+  -> BG.Ptr DuckDBV2OptionHandle
+  -> BG.Ptr DuckDBV2ErrorInfoHandle
+  -> IO DuckDBV2Error
+hs_bindgen_9a89021a895213c4 =
+  \x0 ->
+    \x1 ->
+      \x2 ->
+        \x3 ->
+          fmap BG.fromFFIType (hs_bindgen_9a89021a895213c4_base (BG.toFFIType x0) (BG.toFFIType x1) (BG.toFFIType x2) (BG.toFFIType x3))
+
+{-| __C declaration:__ @duckdb_v2_config_get_option_by_index@
+
+    __defined at:__ @duckdb_v2.h 1785:30@
+
+    __exported by:__ @duckdb_v2.h@
+-}
+c_duckdb_v2_config_get_option_by_index ::
+     DuckDBV2ConfigHandle
+     -- ^ __C declaration:__ @config@
+  -> DuckDBIdx
+     -- ^ __C declaration:__ @index@
+  -> BG.Ptr DuckDBV2OptionHandle
+     -- ^ __C declaration:__ @out_option@
+  -> BG.Ptr DuckDBV2ErrorInfoHandle
+     -- ^ __C declaration:__ @err@
+  -> IO DuckDBV2Error
+c_duckdb_v2_config_get_option_by_index =
+  hs_bindgen_9a89021a895213c4
+
+-- __unique:__ @Database_DuckDB_FFI_V2_Database.DuckDB.FFI.V2_Safe_duckdb_v2_option_destroy@
+foreign import ccall safe "hs_bindgen_566956b019b9d7ee" hs_bindgen_566956b019b9d7ee_base ::
+     BG.Ptr BG.Void
+  -> IO BG.CUInt
+
+-- __unique:__ @Database_DuckDB_FFI_V2_Database.DuckDB.FFI.V2_Safe_duckdb_v2_option_destroy@
+hs_bindgen_566956b019b9d7ee ::
+     BG.Ptr DuckDBV2OptionHandle
+  -> IO DuckDBV2Error
+hs_bindgen_566956b019b9d7ee =
+  \x0 ->
+    fmap BG.fromFFIType (hs_bindgen_566956b019b9d7ee_base (BG.toFFIType x0))
+
+{-| __C declaration:__ @duckdb_v2_option_destroy@
+
+    __defined at:__ @duckdb_v2.h 1803:30@
+
+    __exported by:__ @duckdb_v2.h@
+-}
+c_duckdb_v2_option_destroy ::
+     BG.Ptr DuckDBV2OptionHandle
+     -- ^ __C declaration:__ @option@
+  -> IO DuckDBV2Error
+c_duckdb_v2_option_destroy =
+  hs_bindgen_566956b019b9d7ee
+
+-- __unique:__ @Database_DuckDB_FFI_V2_Database.DuckDB.FFI.V2_Safe_duckdb_v2_option_get_name@
+foreign import ccall safe "hs_bindgen_d3be4886e75d39f7" hs_bindgen_d3be4886e75d39f7_base ::
+     BG.Ptr BG.Void
+  -> BG.Ptr BG.Void
+  -> BG.Ptr BG.Void
+  -> IO BG.CUInt
+
+-- __unique:__ @Database_DuckDB_FFI_V2_Database.DuckDB.FFI.V2_Safe_duckdb_v2_option_get_name@
+hs_bindgen_d3be4886e75d39f7 ::
+     DuckDBV2OptionHandle
+  -> BG.Ptr DuckDBV2IdentifierT
+  -> BG.Ptr DuckDBV2ErrorInfoHandle
+  -> IO DuckDBV2Error
+hs_bindgen_d3be4886e75d39f7 =
+  \x0 ->
+    \x1 ->
+      \x2 ->
+        fmap BG.fromFFIType (hs_bindgen_d3be4886e75d39f7_base (BG.toFFIType x0) (BG.toFFIType x1) (BG.toFFIType x2))
+
+{-| __C declaration:__ @duckdb_v2_option_get_name@
+
+    __defined at:__ @duckdb_v2.h 1822:30@
+
+    __exported by:__ @duckdb_v2.h@
+-}
+c_duckdb_v2_option_get_name ::
+     DuckDBV2OptionHandle
+     -- ^ __C declaration:__ @option@
+  -> BG.Ptr DuckDBV2IdentifierT
+     -- ^ __C declaration:__ @out_name@
+  -> BG.Ptr DuckDBV2ErrorInfoHandle
+     -- ^ __C declaration:__ @err@
+  -> IO DuckDBV2Error
+c_duckdb_v2_option_get_name =
+  hs_bindgen_d3be4886e75d39f7
+
+-- __unique:__ @Database_DuckDB_FFI_V2_Database.DuckDB.FFI.V2_Safe_duckdb_v2_option_get_default_value@
+foreign import ccall safe "hs_bindgen_1b3e2d961afd5895" hs_bindgen_1b3e2d961afd5895_base ::
+     BG.Ptr BG.Void
+  -> BG.Ptr BG.Void
+  -> BG.Ptr BG.Void
+  -> IO BG.CUInt
+
+-- __unique:__ @Database_DuckDB_FFI_V2_Database.DuckDB.FFI.V2_Safe_duckdb_v2_option_get_default_value@
+hs_bindgen_1b3e2d961afd5895 ::
+     DuckDBV2OptionHandle
+  -> BG.Ptr DuckDBV2ValueHandle
+  -> BG.Ptr DuckDBV2ErrorInfoHandle
+  -> IO DuckDBV2Error
+hs_bindgen_1b3e2d961afd5895 =
+  \x0 ->
+    \x1 ->
+      \x2 ->
+        fmap BG.fromFFIType (hs_bindgen_1b3e2d961afd5895_base (BG.toFFIType x0) (BG.toFFIType x1) (BG.toFFIType x2))
+
+{-| __C declaration:__ @duckdb_v2_option_get_default_value@
+
+    __defined at:__ @duckdb_v2.h 1841:30@
+
+    __exported by:__ @duckdb_v2.h@
+-}
+c_duckdb_v2_option_get_default_value ::
+     DuckDBV2OptionHandle
+     -- ^ __C declaration:__ @option@
+  -> BG.Ptr DuckDBV2ValueHandle
+     -- ^ __C declaration:__ @out_value@
+  -> BG.Ptr DuckDBV2ErrorInfoHandle
+     -- ^ __C declaration:__ @err@
+  -> IO DuckDBV2Error
+c_duckdb_v2_option_get_default_value =
+  hs_bindgen_1b3e2d961afd5895
+
+-- __unique:__ @Database_DuckDB_FFI_V2_Database.DuckDB.FFI.V2_Safe_duckdb_v2_option_get_description@
+foreign import ccall safe "hs_bindgen_42ecc9ecd149c818" hs_bindgen_42ecc9ecd149c818_base ::
+     BG.Ptr BG.Void
+  -> BG.Ptr BG.Void
+  -> BG.Ptr BG.Void
+  -> IO BG.CUInt
+
+-- __unique:__ @Database_DuckDB_FFI_V2_Database.DuckDB.FFI.V2_Safe_duckdb_v2_option_get_description@
+hs_bindgen_42ecc9ecd149c818 ::
+     DuckDBV2OptionHandle
+  -> BG.Ptr DuckDBV2Str
+  -> BG.Ptr DuckDBV2ErrorInfoHandle
+  -> IO DuckDBV2Error
+hs_bindgen_42ecc9ecd149c818 =
+  \x0 ->
+    \x1 ->
+      \x2 ->
+        fmap BG.fromFFIType (hs_bindgen_42ecc9ecd149c818_base (BG.toFFIType x0) (BG.toFFIType x1) (BG.toFFIType x2))
+
+{-| __C declaration:__ @duckdb_v2_option_get_description@
+
+    __defined at:__ @duckdb_v2.h 1859:30@
+
+    __exported by:__ @duckdb_v2.h@
+-}
+c_duckdb_v2_option_get_description ::
+     DuckDBV2OptionHandle
+     -- ^ __C declaration:__ @option@
+  -> BG.Ptr DuckDBV2Str
+     -- ^ __C declaration:__ @out_description@
+  -> BG.Ptr DuckDBV2ErrorInfoHandle
+     -- ^ __C declaration:__ @err@
+  -> IO DuckDBV2Error
+c_duckdb_v2_option_get_description =
+  hs_bindgen_42ecc9ecd149c818
+
+-- __unique:__ @Database_DuckDB_FFI_V2_Database.DuckDB.FFI.V2_Safe_duckdb_v2_option_supports_scope@
+foreign import ccall safe "hs_bindgen_30b1730423201145" hs_bindgen_30b1730423201145_base ::
+     BG.Ptr BG.Void
+  -> BG.CUInt
+  -> BG.Ptr BG.Void
+  -> BG.Ptr BG.Void
+  -> IO BG.CUInt
+
+-- __unique:__ @Database_DuckDB_FFI_V2_Database.DuckDB.FFI.V2_Safe_duckdb_v2_option_supports_scope@
+hs_bindgen_30b1730423201145 ::
+     DuckDBV2OptionHandle
+  -> DuckDBV2SettingScope
+  -> BG.Ptr BG.CBool
+  -> BG.Ptr DuckDBV2ErrorInfoHandle
+  -> IO DuckDBV2Error
+hs_bindgen_30b1730423201145 =
+  \x0 ->
+    \x1 ->
+      \x2 ->
+        \x3 ->
+          fmap BG.fromFFIType (hs_bindgen_30b1730423201145_base (BG.toFFIType x0) (BG.toFFIType x1) (BG.toFFIType x2) (BG.toFFIType x3))
+
+{-| __C declaration:__ @duckdb_v2_option_supports_scope@
+
+    __defined at:__ @duckdb_v2.h 1881:30@
+
+    __exported by:__ @duckdb_v2.h@
+-}
+c_duckdb_v2_option_supports_scope ::
+     DuckDBV2OptionHandle
+     -- ^ __C declaration:__ @option@
+  -> DuckDBV2SettingScope
+     -- ^ __C declaration:__ @scope@
+  -> BG.Ptr BG.CBool
+     -- ^ __C declaration:__ @out_supported@
+  -> BG.Ptr DuckDBV2ErrorInfoHandle
+     -- ^ __C declaration:__ @err@
+  -> IO DuckDBV2Error
+c_duckdb_v2_option_supports_scope =
+  hs_bindgen_30b1730423201145
+
+-- __unique:__ @Database_DuckDB_FFI_V2_Database.DuckDB.FFI.V2_Safe_duckdb_v2_option_get_default_scope@
+foreign import ccall safe "hs_bindgen_74f6c48afd3dce15" hs_bindgen_74f6c48afd3dce15_base ::
+     BG.Ptr BG.Void
+  -> BG.Ptr BG.Void
+  -> BG.Ptr BG.Void
+  -> IO BG.CUInt
+
+-- __unique:__ @Database_DuckDB_FFI_V2_Database.DuckDB.FFI.V2_Safe_duckdb_v2_option_get_default_scope@
+hs_bindgen_74f6c48afd3dce15 ::
+     DuckDBV2OptionHandle
+  -> BG.Ptr DuckDBV2SettingScope
+  -> BG.Ptr DuckDBV2ErrorInfoHandle
+  -> IO DuckDBV2Error
+hs_bindgen_74f6c48afd3dce15 =
+  \x0 ->
+    \x1 ->
+      \x2 ->
+        fmap BG.fromFFIType (hs_bindgen_74f6c48afd3dce15_base (BG.toFFIType x0) (BG.toFFIType x1) (BG.toFFIType x2))
+
+{-| __C declaration:__ @duckdb_v2_option_get_default_scope@
+
+    __defined at:__ @duckdb_v2.h 1899:30@
+
+    __exported by:__ @duckdb_v2.h@
+-}
+c_duckdb_v2_option_get_default_scope ::
+     DuckDBV2OptionHandle
+     -- ^ __C declaration:__ @option@
+  -> BG.Ptr DuckDBV2SettingScope
+     -- ^ __C declaration:__ @out_scope@
+  -> BG.Ptr DuckDBV2ErrorInfoHandle
+     -- ^ __C declaration:__ @err@
+  -> IO DuckDBV2Error
+c_duckdb_v2_option_get_default_scope =
+  hs_bindgen_74f6c48afd3dce15
+
+-- __unique:__ @Database_DuckDB_FFI_V2_Database.DuckDB.FFI.V2_Safe_duckdb_v2_option_get_alias_count@
+foreign import ccall safe "hs_bindgen_c9d0217eb4ca39de" hs_bindgen_c9d0217eb4ca39de_base ::
+     BG.Ptr BG.Void
+  -> BG.Ptr BG.Void
+  -> BG.Ptr BG.Void
+  -> IO BG.CUInt
+
+-- __unique:__ @Database_DuckDB_FFI_V2_Database.DuckDB.FFI.V2_Safe_duckdb_v2_option_get_alias_count@
+hs_bindgen_c9d0217eb4ca39de ::
+     DuckDBV2OptionHandle
+  -> BG.Ptr DuckDBIdx
+  -> BG.Ptr DuckDBV2ErrorInfoHandle
+  -> IO DuckDBV2Error
+hs_bindgen_c9d0217eb4ca39de =
+  \x0 ->
+    \x1 ->
+      \x2 ->
+        fmap BG.fromFFIType (hs_bindgen_c9d0217eb4ca39de_base (BG.toFFIType x0) (BG.toFFIType x1) (BG.toFFIType x2))
+
+{-| __C declaration:__ @duckdb_v2_option_get_alias_count@
+
+    __defined at:__ @duckdb_v2.h 1919:30@
+
+    __exported by:__ @duckdb_v2.h@
+-}
+c_duckdb_v2_option_get_alias_count ::
+     DuckDBV2OptionHandle
+     -- ^ __C declaration:__ @option@
+  -> BG.Ptr DuckDBIdx
+     -- ^ __C declaration:__ @out_count@
+  -> BG.Ptr DuckDBV2ErrorInfoHandle
+     -- ^ __C declaration:__ @err@
+  -> IO DuckDBV2Error
+c_duckdb_v2_option_get_alias_count =
+  hs_bindgen_c9d0217eb4ca39de
+
+-- __unique:__ @Database_DuckDB_FFI_V2_Database.DuckDB.FFI.V2_Safe_duckdb_v2_option_get_alias@
+foreign import ccall safe "hs_bindgen_50f09b8c10860793" hs_bindgen_50f09b8c10860793_base ::
+     BG.Ptr BG.Void
+  -> HsBindgen.Runtime.LibC.Word64
+  -> BG.Ptr BG.Void
+  -> BG.Ptr BG.Void
+  -> IO BG.CUInt
+
+-- __unique:__ @Database_DuckDB_FFI_V2_Database.DuckDB.FFI.V2_Safe_duckdb_v2_option_get_alias@
+hs_bindgen_50f09b8c10860793 ::
+     DuckDBV2OptionHandle
+  -> DuckDBIdx
+  -> BG.Ptr DuckDBV2IdentifierT
+  -> BG.Ptr DuckDBV2ErrorInfoHandle
+  -> IO DuckDBV2Error
+hs_bindgen_50f09b8c10860793 =
+  \x0 ->
+    \x1 ->
+      \x2 ->
+        \x3 ->
+          fmap BG.fromFFIType (hs_bindgen_50f09b8c10860793_base (BG.toFFIType x0) (BG.toFFIType x1) (BG.toFFIType x2) (BG.toFFIType x3))
+
+{-| __C declaration:__ @duckdb_v2_option_get_alias@
+
+    __defined at:__ @duckdb_v2.h 1939:30@
+
+    __exported by:__ @duckdb_v2.h@
+-}
+c_duckdb_v2_option_get_alias ::
+     DuckDBV2OptionHandle
+     -- ^ __C declaration:__ @option@
+  -> DuckDBIdx
+     -- ^ __C declaration:__ @index@
+  -> BG.Ptr DuckDBV2IdentifierT
+     -- ^ __C declaration:__ @out_alias@
+  -> BG.Ptr DuckDBV2ErrorInfoHandle
+     -- ^ __C declaration:__ @err@
+  -> IO DuckDBV2Error
+c_duckdb_v2_option_get_alias =
+  hs_bindgen_50f09b8c10860793
+
+-- __unique:__ @Database_DuckDB_FFI_V2_Database.DuckDB.FFI.V2_Safe_duckdb_v2_connection_create@
+foreign import ccall safe "hs_bindgen_3271d2900cdc5519" hs_bindgen_3271d2900cdc5519_base ::
+     BG.Ptr BG.Void
+  -> BG.Ptr BG.Void
+  -> BG.Ptr BG.Void
+  -> IO BG.CUInt
+
+-- __unique:__ @Database_DuckDB_FFI_V2_Database.DuckDB.FFI.V2_Safe_duckdb_v2_connection_create@
+hs_bindgen_3271d2900cdc5519 ::
+     DuckDBV2InstanceHandle
+  -> BG.Ptr DuckDBV2ConnectionHandle
+  -> BG.Ptr DuckDBV2ErrorInfoHandle
+  -> IO DuckDBV2Error
+hs_bindgen_3271d2900cdc5519 =
+  \x0 ->
+    \x1 ->
+      \x2 ->
+        fmap BG.fromFFIType (hs_bindgen_3271d2900cdc5519_base (BG.toFFIType x0) (BG.toFFIType x1) (BG.toFFIType x2))
+
+{-| __C declaration:__ @duckdb_v2_connection_create@
+
+    __defined at:__ @duckdb_v2.h 1980:30@
+
+    __exported by:__ @duckdb_v2.h@
+-}
+c_duckdb_v2_connection_create ::
+     DuckDBV2InstanceHandle
+     -- ^ __C declaration:__ @instance@
+  -> BG.Ptr DuckDBV2ConnectionHandle
+     -- ^ __C declaration:__ @out_conn@
+  -> BG.Ptr DuckDBV2ErrorInfoHandle
+     -- ^ __C declaration:__ @err@
+  -> IO DuckDBV2Error
+c_duckdb_v2_connection_create =
+  hs_bindgen_3271d2900cdc5519
+
+-- __unique:__ @Database_DuckDB_FFI_V2_Database.DuckDB.FFI.V2_Safe_duckdb_v2_connection_destroy@
+foreign import ccall safe "hs_bindgen_c5bf0ceca89852bf" hs_bindgen_c5bf0ceca89852bf_base ::
+     BG.Ptr BG.Void
+  -> IO BG.CUInt
+
+-- __unique:__ @Database_DuckDB_FFI_V2_Database.DuckDB.FFI.V2_Safe_duckdb_v2_connection_destroy@
+hs_bindgen_c5bf0ceca89852bf ::
+     BG.Ptr DuckDBV2ConnectionHandle
+  -> IO DuckDBV2Error
+hs_bindgen_c5bf0ceca89852bf =
+  \x0 ->
+    fmap BG.fromFFIType (hs_bindgen_c5bf0ceca89852bf_base (BG.toFFIType x0))
+
+{-| __C declaration:__ @duckdb_v2_connection_destroy@
+
+    __defined at:__ @duckdb_v2.h 1998:30@
+
+    __exported by:__ @duckdb_v2.h@
+-}
+c_duckdb_v2_connection_destroy ::
+     BG.Ptr DuckDBV2ConnectionHandle
+     -- ^ __C declaration:__ @conn@
+  -> IO DuckDBV2Error
+c_duckdb_v2_connection_destroy =
+  hs_bindgen_c5bf0ceca89852bf
+
+-- __unique:__ @Database_DuckDB_FFI_V2_Database.DuckDB.FFI.V2_Safe_duckdb_v2_connection_interrupt@
+foreign import ccall safe "hs_bindgen_7867e003657ab2a8" hs_bindgen_7867e003657ab2a8_base ::
+     BG.Ptr BG.Void
+  -> BG.Ptr BG.Void
+  -> IO BG.CUInt
+
+-- __unique:__ @Database_DuckDB_FFI_V2_Database.DuckDB.FFI.V2_Safe_duckdb_v2_connection_interrupt@
+hs_bindgen_7867e003657ab2a8 ::
+     DuckDBV2ConnectionHandle
+  -> BG.Ptr DuckDBV2ErrorInfoHandle
+  -> IO DuckDBV2Error
+hs_bindgen_7867e003657ab2a8 =
+  \x0 ->
+    \x1 ->
+      fmap BG.fromFFIType (hs_bindgen_7867e003657ab2a8_base (BG.toFFIType x0) (BG.toFFIType x1))
+
+{-| __C declaration:__ @duckdb_v2_connection_interrupt@
+
+    __defined at:__ @duckdb_v2.h 2018:30@
+
+    __exported by:__ @duckdb_v2.h@
+-}
+c_duckdb_v2_connection_interrupt ::
+     DuckDBV2ConnectionHandle
+     -- ^ __C declaration:__ @conn@
+  -> BG.Ptr DuckDBV2ErrorInfoHandle
+     -- ^ __C declaration:__ @err@
+  -> IO DuckDBV2Error
+c_duckdb_v2_connection_interrupt =
+  hs_bindgen_7867e003657ab2a8
+
+-- __unique:__ @Database_DuckDB_FFI_V2_Database.DuckDB.FFI.V2_Safe_duckdb_v2_connection_progress_get@
+foreign import ccall safe "hs_bindgen_58c450e34adca788" hs_bindgen_58c450e34adca788_base ::
+     BG.Ptr BG.Void
+  -> BG.Ptr BG.Void
+  -> BG.Ptr BG.Void
+  -> BG.Ptr BG.Void
+  -> BG.Ptr BG.Void
+  -> IO BG.CUInt
+
+-- __unique:__ @Database_DuckDB_FFI_V2_Database.DuckDB.FFI.V2_Safe_duckdb_v2_connection_progress_get@
+hs_bindgen_58c450e34adca788 ::
+     DuckDBV2ConnectionHandle
+  -> BG.Ptr BG.CDouble
+  -> BG.Ptr HsBindgen.Runtime.LibC.Word64
+  -> BG.Ptr HsBindgen.Runtime.LibC.Word64
+  -> BG.Ptr DuckDBV2ErrorInfoHandle
+  -> IO DuckDBV2Error
+hs_bindgen_58c450e34adca788 =
+  \x0 ->
+    \x1 ->
+      \x2 ->
+        \x3 ->
+          \x4 ->
+            fmap BG.fromFFIType (hs_bindgen_58c450e34adca788_base (BG.toFFIType x0) (BG.toFFIType x1) (BG.toFFIType x2) (BG.toFFIType x3) (BG.toFFIType x4))
+
+{-| __C declaration:__ @duckdb_v2_connection_progress_get@
+
+    __defined at:__ @duckdb_v2.h 2045:30@
+
+    __exported by:__ @duckdb_v2.h@
+-}
+c_duckdb_v2_connection_progress_get ::
+     DuckDBV2ConnectionHandle
+     -- ^ __C declaration:__ @conn@
+  -> BG.Ptr BG.CDouble
+     -- ^ __C declaration:__ @out_percentage@
+  -> BG.Ptr HsBindgen.Runtime.LibC.Word64
+     -- ^ __C declaration:__ @out_rows_processed@
+  -> BG.Ptr HsBindgen.Runtime.LibC.Word64
+     -- ^ __C declaration:__ @out_total_rows_to_process@
+  -> BG.Ptr DuckDBV2ErrorInfoHandle
+     -- ^ __C declaration:__ @err@
+  -> IO DuckDBV2Error
+c_duckdb_v2_connection_progress_get =
+  hs_bindgen_58c450e34adca788
+
+-- __unique:__ @Database_DuckDB_FFI_V2_Database.DuckDB.FFI.V2_Safe_duckdb_v2_custom_type_create@
+foreign import ccall safe "hs_bindgen_c8109c39449b5ed8" hs_bindgen_c8109c39449b5ed8_base ::
+     BG.Ptr BG.Void
+  -> BG.Ptr BG.Void
+  -> BG.Ptr BG.Void
+  -> IO BG.CUInt
+
+-- __unique:__ @Database_DuckDB_FFI_V2_Database.DuckDB.FFI.V2_Safe_duckdb_v2_custom_type_create@
+hs_bindgen_c8109c39449b5ed8 ::
+     DuckDBV2FactoryHandle
+  -> BG.Ptr DuckDBV2CustomTypeHandle
+  -> BG.Ptr DuckDBV2ErrorInfoHandle
+  -> IO DuckDBV2Error
+hs_bindgen_c8109c39449b5ed8 =
+  \x0 ->
+    \x1 ->
+      \x2 ->
+        fmap BG.fromFFIType (hs_bindgen_c8109c39449b5ed8_base (BG.toFFIType x0) (BG.toFFIType x1) (BG.toFFIType x2))
+
+{-| __C declaration:__ @duckdb_v2_custom_type_create@
+
+    __defined at:__ @duckdb_v2.h 2099:30@
+
+    __exported by:__ @duckdb_v2.h@
+-}
+c_duckdb_v2_custom_type_create ::
+     DuckDBV2FactoryHandle
+     -- ^ __C declaration:__ @factory@
+  -> BG.Ptr DuckDBV2CustomTypeHandle
+     -- ^ __C declaration:__ @type@
+  -> BG.Ptr DuckDBV2ErrorInfoHandle
+     -- ^ __C declaration:__ @err@
+  -> IO DuckDBV2Error
+c_duckdb_v2_custom_type_create =
+  hs_bindgen_c8109c39449b5ed8
+
+-- __unique:__ @Database_DuckDB_FFI_V2_Database.DuckDB.FFI.V2_Safe_duckdb_v2_custom_type_set_name@
+foreign import ccall safe "hs_bindgen_953d55bf7eec4908" hs_bindgen_953d55bf7eec4908_base ::
+     BG.Ptr BG.Void
+  -> BG.Ptr BG.Void
+  -> BG.Ptr BG.Void
+  -> IO BG.CUInt
+
+-- __unique:__ @Database_DuckDB_FFI_V2_Database.DuckDB.FFI.V2_Safe_duckdb_v2_custom_type_set_name@
+hs_bindgen_953d55bf7eec4908 ::
+     DuckDBV2CustomTypeHandle
+  -> PtrConst.PtrConst DuckDBV2IdentifierT
+  -> BG.Ptr DuckDBV2ErrorInfoHandle
+  -> IO DuckDBV2Error
+hs_bindgen_953d55bf7eec4908 =
+  \x0 ->
+    \x1 ->
+      \x2 ->
+        fmap BG.fromFFIType (hs_bindgen_953d55bf7eec4908_base (BG.toFFIType x0) (BG.toFFIType x1) (BG.toFFIType x2))
+
+{-| __C declaration:__ @duckdb_v2_custom_type_set_name@
+
+    __defined at:__ @duckdb_v2.h 2120:30@
+
+    __exported by:__ @duckdb_v2.h@
+-}
+c_duckdb_v2_custom_type_set_name ::
+     DuckDBV2CustomTypeHandle
+     -- ^ __C declaration:__ @type@
+  -> PtrConst.PtrConst DuckDBV2IdentifierT
+     -- ^ __C declaration:__ @name@
+  -> BG.Ptr DuckDBV2ErrorInfoHandle
+     -- ^ __C declaration:__ @err@
+  -> IO DuckDBV2Error
+c_duckdb_v2_custom_type_set_name =
+  hs_bindgen_953d55bf7eec4908
+
+-- __unique:__ @Database_DuckDB_FFI_V2_Database.DuckDB.FFI.V2_Safe_duckdb_v2_custom_type_set_base_type@
+foreign import ccall safe "hs_bindgen_1be20a2ba0faa5e1" hs_bindgen_1be20a2ba0faa5e1_base ::
+     BG.Ptr BG.Void
+  -> BG.Ptr BG.Void
+  -> BG.Ptr BG.Void
+  -> IO BG.CUInt
+
+-- __unique:__ @Database_DuckDB_FFI_V2_Database.DuckDB.FFI.V2_Safe_duckdb_v2_custom_type_set_base_type@
+hs_bindgen_1be20a2ba0faa5e1 ::
+     DuckDBV2CustomTypeHandle
+  -> DuckDBV2LogicalTypeHandle
+  -> BG.Ptr DuckDBV2ErrorInfoHandle
+  -> IO DuckDBV2Error
+hs_bindgen_1be20a2ba0faa5e1 =
+  \x0 ->
+    \x1 ->
+      \x2 ->
+        fmap BG.fromFFIType (hs_bindgen_1be20a2ba0faa5e1_base (BG.toFFIType x0) (BG.toFFIType x1) (BG.toFFIType x2))
+
+{-| __C declaration:__ @duckdb_v2_custom_type_set_base_type@
+
+    __defined at:__ @duckdb_v2.h 2143:30@
+
+    __exported by:__ @duckdb_v2.h@
+-}
+c_duckdb_v2_custom_type_set_base_type ::
+     DuckDBV2CustomTypeHandle
+     -- ^ __C declaration:__ @type@
+  -> DuckDBV2LogicalTypeHandle
+     -- ^ __C declaration:__ @base_type@
+  -> BG.Ptr DuckDBV2ErrorInfoHandle
+     -- ^ __C declaration:__ @err@
+  -> IO DuckDBV2Error
+c_duckdb_v2_custom_type_set_base_type =
+  hs_bindgen_1be20a2ba0faa5e1
+
+-- __unique:__ @Database_DuckDB_FFI_V2_Database.DuckDB.FFI.V2_Safe_duckdb_v2_connection_register_custom_type@
+foreign import ccall safe "hs_bindgen_4169f518e7bb3b23" hs_bindgen_4169f518e7bb3b23_base ::
+     BG.Ptr BG.Void
+  -> BG.Ptr BG.Void
+  -> BG.Ptr BG.Void
+  -> IO BG.CUInt
+
+-- __unique:__ @Database_DuckDB_FFI_V2_Database.DuckDB.FFI.V2_Safe_duckdb_v2_connection_register_custom_type@
+hs_bindgen_4169f518e7bb3b23 ::
+     DuckDBV2ConnectionHandle
+  -> DuckDBV2CustomTypeHandle
+  -> BG.Ptr DuckDBV2ErrorInfoHandle
+  -> IO DuckDBV2Error
+hs_bindgen_4169f518e7bb3b23 =
+  \x0 ->
+    \x1 ->
+      \x2 ->
+        fmap BG.fromFFIType (hs_bindgen_4169f518e7bb3b23_base (BG.toFFIType x0) (BG.toFFIType x1) (BG.toFFIType x2))
+
+{-| __C declaration:__ @duckdb_v2_connection_register_custom_type@
+
+    __defined at:__ @duckdb_v2.h 2167:30@
+
+    __exported by:__ @duckdb_v2.h@
+-}
+c_duckdb_v2_connection_register_custom_type ::
+     DuckDBV2ConnectionHandle
+     -- ^ __C declaration:__ @conn@
+  -> DuckDBV2CustomTypeHandle
+     -- ^ __C declaration:__ @type@
+  -> BG.Ptr DuckDBV2ErrorInfoHandle
+     -- ^ __C declaration:__ @err@
+  -> IO DuckDBV2Error
+c_duckdb_v2_connection_register_custom_type =
+  hs_bindgen_4169f518e7bb3b23
+
+-- __unique:__ @Database_DuckDB_FFI_V2_Database.DuckDB.FFI.V2_Safe_duckdb_v2_extension_register_custom_type@
+foreign import ccall safe "hs_bindgen_a833805e0916f364" hs_bindgen_a833805e0916f364_base ::
+     BG.Ptr BG.Void
+  -> BG.Ptr BG.Void
+  -> BG.Ptr BG.Void
+  -> IO BG.CUInt
+
+-- __unique:__ @Database_DuckDB_FFI_V2_Database.DuckDB.FFI.V2_Safe_duckdb_v2_extension_register_custom_type@
+hs_bindgen_a833805e0916f364 ::
+     DuckDBV2ExtensionHandle
+  -> DuckDBV2CustomTypeHandle
+  -> BG.Ptr DuckDBV2ErrorInfoHandle
+  -> IO DuckDBV2Error
+hs_bindgen_a833805e0916f364 =
+  \x0 ->
+    \x1 ->
+      \x2 ->
+        fmap BG.fromFFIType (hs_bindgen_a833805e0916f364_base (BG.toFFIType x0) (BG.toFFIType x1) (BG.toFFIType x2))
+
+{-| __C declaration:__ @duckdb_v2_extension_register_custom_type@
+
+    __defined at:__ @duckdb_v2.h 2190:30@
+
+    __exported by:__ @duckdb_v2.h@
+-}
+c_duckdb_v2_extension_register_custom_type ::
+     DuckDBV2ExtensionHandle
+     -- ^ __C declaration:__ @extension@
+  -> DuckDBV2CustomTypeHandle
+     -- ^ __C declaration:__ @type@
+  -> BG.Ptr DuckDBV2ErrorInfoHandle
+     -- ^ __C declaration:__ @err@
+  -> IO DuckDBV2Error
+c_duckdb_v2_extension_register_custom_type =
+  hs_bindgen_a833805e0916f364
+
+-- __unique:__ @Database_DuckDB_FFI_V2_Database.DuckDB.FFI.V2_Safe_duckdb_v2_custom_type_destroy@
+foreign import ccall safe "hs_bindgen_704b887e14cb4822" hs_bindgen_704b887e14cb4822_base ::
+     BG.Ptr BG.Void
+  -> IO BG.CUInt
+
+-- __unique:__ @Database_DuckDB_FFI_V2_Database.DuckDB.FFI.V2_Safe_duckdb_v2_custom_type_destroy@
+hs_bindgen_704b887e14cb4822 ::
+     BG.Ptr DuckDBV2CustomTypeHandle
+  -> IO DuckDBV2Error
+hs_bindgen_704b887e14cb4822 =
+  \x0 ->
+    fmap BG.fromFFIType (hs_bindgen_704b887e14cb4822_base (BG.toFFIType x0))
+
+{-| __C declaration:__ @duckdb_v2_custom_type_destroy@
+
+    __defined at:__ @duckdb_v2.h 2208:30@
+
+    __exported by:__ @duckdb_v2.h@
+-}
+c_duckdb_v2_custom_type_destroy ::
+     BG.Ptr DuckDBV2CustomTypeHandle
+     -- ^ __C declaration:__ @type@
+  -> IO DuckDBV2Error
+c_duckdb_v2_custom_type_destroy =
+  hs_bindgen_704b887e14cb4822
+
+-- __unique:__ @Database_DuckDB_FFI_V2_Database.DuckDB.FFI.V2_Safe_duckdb_v2_data_chunk_create@
+foreign import ccall safe "hs_bindgen_c8667c82da51f6fa" hs_bindgen_c8667c82da51f6fa_base ::
+     BG.Ptr BG.Void
+  -> BG.Ptr BG.Void
+  -> HsBindgen.Runtime.LibC.Word64
+  -> BG.Ptr BG.Void
+  -> BG.Ptr BG.Void
+  -> IO BG.CUInt
+
+-- __unique:__ @Database_DuckDB_FFI_V2_Database.DuckDB.FFI.V2_Safe_duckdb_v2_data_chunk_create@
+hs_bindgen_c8667c82da51f6fa ::
+     DuckDBV2FactoryHandle
+  -> PtrConst.PtrConst DuckDBV2LogicalTypeHandle
+  -> DuckDBIdx
+  -> BG.Ptr DuckDBV2DataChunkHandle
+  -> BG.Ptr DuckDBV2ErrorInfoHandle
+  -> IO DuckDBV2Error
+hs_bindgen_c8667c82da51f6fa =
+  \x0 ->
+    \x1 ->
+      \x2 ->
+        \x3 ->
+          \x4 ->
+            fmap BG.fromFFIType (hs_bindgen_c8667c82da51f6fa_base (BG.toFFIType x0) (BG.toFFIType x1) (BG.toFFIType x2) (BG.toFFIType x3) (BG.toFFIType x4))
+
+{-| __C declaration:__ @duckdb_v2_data_chunk_create@
+
+    __defined at:__ @duckdb_v2.h 2248:30@
+
+    __exported by:__ @duckdb_v2.h@
+-}
+c_duckdb_v2_data_chunk_create ::
+     DuckDBV2FactoryHandle
+     -- ^ __C declaration:__ @factory@
+  -> PtrConst.PtrConst DuckDBV2LogicalTypeHandle
+     -- ^ __C declaration:__ @types@
+  -> DuckDBIdx
+     -- ^ __C declaration:__ @column_count@
+  -> BG.Ptr DuckDBV2DataChunkHandle
+     -- ^ __C declaration:__ @out_chunk@
+  -> BG.Ptr DuckDBV2ErrorInfoHandle
+     -- ^ __C declaration:__ @err@
+  -> IO DuckDBV2Error
+c_duckdb_v2_data_chunk_create =
+  hs_bindgen_c8667c82da51f6fa
+
+-- __unique:__ @Database_DuckDB_FFI_V2_Database.DuckDB.FFI.V2_Safe_duckdb_v2_data_chunk_copy@
+foreign import ccall safe "hs_bindgen_986410f0edd00849" hs_bindgen_986410f0edd00849_base ::
+     BG.Ptr BG.Void
+  -> BG.Ptr BG.Void
+  -> BG.Ptr BG.Void
+  -> BG.Ptr BG.Void
+  -> IO BG.CUInt
+
+-- __unique:__ @Database_DuckDB_FFI_V2_Database.DuckDB.FFI.V2_Safe_duckdb_v2_data_chunk_copy@
+hs_bindgen_986410f0edd00849 ::
+     DuckDBV2FactoryHandle
+  -> DuckDBV2DataChunkHandle
+  -> BG.Ptr DuckDBV2DataChunkHandle
+  -> BG.Ptr DuckDBV2ErrorInfoHandle
+  -> IO DuckDBV2Error
+hs_bindgen_986410f0edd00849 =
+  \x0 ->
+    \x1 ->
+      \x2 ->
+        \x3 ->
+          fmap BG.fromFFIType (hs_bindgen_986410f0edd00849_base (BG.toFFIType x0) (BG.toFFIType x1) (BG.toFFIType x2) (BG.toFFIType x3))
+
+{-| __C declaration:__ @duckdb_v2_data_chunk_copy@
+
+    __defined at:__ @duckdb_v2.h 2272:30@
+
+    __exported by:__ @duckdb_v2.h@
+-}
+c_duckdb_v2_data_chunk_copy ::
+     DuckDBV2FactoryHandle
+     -- ^ __C declaration:__ @factory@
+  -> DuckDBV2DataChunkHandle
+     -- ^ __C declaration:__ @chunk@
+  -> BG.Ptr DuckDBV2DataChunkHandle
+     -- ^ __C declaration:__ @out_chunk@
+  -> BG.Ptr DuckDBV2ErrorInfoHandle
+     -- ^ __C declaration:__ @err@
+  -> IO DuckDBV2Error
+c_duckdb_v2_data_chunk_copy =
+  hs_bindgen_986410f0edd00849
+
+-- __unique:__ @Database_DuckDB_FFI_V2_Database.DuckDB.FFI.V2_Safe_duckdb_v2_data_chunk_destroy@
+foreign import ccall safe "hs_bindgen_3fa1cd2928f089f3" hs_bindgen_3fa1cd2928f089f3_base ::
+     BG.Ptr BG.Void
+  -> IO BG.CUInt
+
+-- __unique:__ @Database_DuckDB_FFI_V2_Database.DuckDB.FFI.V2_Safe_duckdb_v2_data_chunk_destroy@
+hs_bindgen_3fa1cd2928f089f3 ::
+     BG.Ptr DuckDBV2DataChunkHandle
+  -> IO DuckDBV2Error
+hs_bindgen_3fa1cd2928f089f3 =
+  \x0 ->
+    fmap BG.fromFFIType (hs_bindgen_3fa1cd2928f089f3_base (BG.toFFIType x0))
+
+{-| __C declaration:__ @duckdb_v2_data_chunk_destroy@
+
+    __defined at:__ @duckdb_v2.h 2291:30@
+
+    __exported by:__ @duckdb_v2.h@
+-}
+c_duckdb_v2_data_chunk_destroy ::
+     BG.Ptr DuckDBV2DataChunkHandle
+     -- ^ __C declaration:__ @chunk@
+  -> IO DuckDBV2Error
+c_duckdb_v2_data_chunk_destroy =
+  hs_bindgen_3fa1cd2928f089f3
+
+-- __unique:__ @Database_DuckDB_FFI_V2_Database.DuckDB.FFI.V2_Safe_duckdb_v2_data_chunk_clear@
+foreign import ccall safe "hs_bindgen_3b8f7ab391c7469c" hs_bindgen_3b8f7ab391c7469c_base ::
+     BG.Ptr BG.Void
+  -> BG.Ptr BG.Void
+  -> IO BG.CUInt
+
+-- __unique:__ @Database_DuckDB_FFI_V2_Database.DuckDB.FFI.V2_Safe_duckdb_v2_data_chunk_clear@
+hs_bindgen_3b8f7ab391c7469c ::
+     DuckDBV2DataChunkHandle
+  -> BG.Ptr DuckDBV2ErrorInfoHandle
+  -> IO DuckDBV2Error
+hs_bindgen_3b8f7ab391c7469c =
+  \x0 ->
+    \x1 ->
+      fmap BG.fromFFIType (hs_bindgen_3b8f7ab391c7469c_base (BG.toFFIType x0) (BG.toFFIType x1))
+
+{-| __C declaration:__ @duckdb_v2_data_chunk_clear@
+
+    __defined at:__ @duckdb_v2.h 2310:30@
+
+    __exported by:__ @duckdb_v2.h@
+-}
+c_duckdb_v2_data_chunk_clear ::
+     DuckDBV2DataChunkHandle
+     -- ^ __C declaration:__ @chunk@
+  -> BG.Ptr DuckDBV2ErrorInfoHandle
+     -- ^ __C declaration:__ @err@
+  -> IO DuckDBV2Error
+c_duckdb_v2_data_chunk_clear =
+  hs_bindgen_3b8f7ab391c7469c
+
+-- __unique:__ @Database_DuckDB_FFI_V2_Database.DuckDB.FFI.V2_Safe_duckdb_v2_data_chunk_get_size@
+foreign import ccall safe "hs_bindgen_c39520ea51c50c30" hs_bindgen_c39520ea51c50c30_base ::
+     BG.Ptr BG.Void
+  -> BG.Ptr BG.Void
+  -> BG.Ptr BG.Void
+  -> IO BG.CUInt
+
+-- __unique:__ @Database_DuckDB_FFI_V2_Database.DuckDB.FFI.V2_Safe_duckdb_v2_data_chunk_get_size@
+hs_bindgen_c39520ea51c50c30 ::
+     DuckDBV2DataChunkHandle
+  -> BG.Ptr DuckDBIdx
+  -> BG.Ptr DuckDBV2ErrorInfoHandle
+  -> IO DuckDBV2Error
+hs_bindgen_c39520ea51c50c30 =
+  \x0 ->
+    \x1 ->
+      \x2 ->
+        fmap BG.fromFFIType (hs_bindgen_c39520ea51c50c30_base (BG.toFFIType x0) (BG.toFFIType x1) (BG.toFFIType x2))
+
+{-| __C declaration:__ @duckdb_v2_data_chunk_get_size@
+
+    __defined at:__ @duckdb_v2.h 2326:30@
+
+    __exported by:__ @duckdb_v2.h@
+-}
+c_duckdb_v2_data_chunk_get_size ::
+     DuckDBV2DataChunkHandle
+     -- ^ __C declaration:__ @chunk@
+  -> BG.Ptr DuckDBIdx
+     -- ^ __C declaration:__ @out_size@
+  -> BG.Ptr DuckDBV2ErrorInfoHandle
+     -- ^ __C declaration:__ @err@
+  -> IO DuckDBV2Error
+c_duckdb_v2_data_chunk_get_size =
+  hs_bindgen_c39520ea51c50c30
+
+-- __unique:__ @Database_DuckDB_FFI_V2_Database.DuckDB.FFI.V2_Safe_duckdb_v2_data_chunk_get_capacity@
+foreign import ccall safe "hs_bindgen_548fa422e64bf73f" hs_bindgen_548fa422e64bf73f_base ::
+     BG.Ptr BG.Void
+  -> BG.Ptr BG.Void
+  -> BG.Ptr BG.Void
+  -> IO BG.CUInt
+
+-- __unique:__ @Database_DuckDB_FFI_V2_Database.DuckDB.FFI.V2_Safe_duckdb_v2_data_chunk_get_capacity@
+hs_bindgen_548fa422e64bf73f ::
+     DuckDBV2DataChunkHandle
+  -> BG.Ptr DuckDBIdx
+  -> BG.Ptr DuckDBV2ErrorInfoHandle
+  -> IO DuckDBV2Error
+hs_bindgen_548fa422e64bf73f =
+  \x0 ->
+    \x1 ->
+      \x2 ->
+        fmap BG.fromFFIType (hs_bindgen_548fa422e64bf73f_base (BG.toFFIType x0) (BG.toFFIType x1) (BG.toFFIType x2))
+
+{-| __C declaration:__ @duckdb_v2_data_chunk_get_capacity@
+
+    __defined at:__ @duckdb_v2.h 2343:30@
+
+    __exported by:__ @duckdb_v2.h@
+-}
+c_duckdb_v2_data_chunk_get_capacity ::
+     DuckDBV2DataChunkHandle
+     -- ^ __C declaration:__ @chunk@
+  -> BG.Ptr DuckDBIdx
+     -- ^ __C declaration:__ @out_capacity@
+  -> BG.Ptr DuckDBV2ErrorInfoHandle
+     -- ^ __C declaration:__ @err@
+  -> IO DuckDBV2Error
+c_duckdb_v2_data_chunk_get_capacity =
+  hs_bindgen_548fa422e64bf73f
+
+-- __unique:__ @Database_DuckDB_FFI_V2_Database.DuckDB.FFI.V2_Safe_duckdb_v2_data_chunk_get_vector_count@
+foreign import ccall safe "hs_bindgen_13b9589932c3b637" hs_bindgen_13b9589932c3b637_base ::
+     BG.Ptr BG.Void
+  -> BG.Ptr BG.Void
+  -> BG.Ptr BG.Void
+  -> IO BG.CUInt
+
+-- __unique:__ @Database_DuckDB_FFI_V2_Database.DuckDB.FFI.V2_Safe_duckdb_v2_data_chunk_get_vector_count@
+hs_bindgen_13b9589932c3b637 ::
+     DuckDBV2DataChunkHandle
+  -> BG.Ptr DuckDBIdx
+  -> BG.Ptr DuckDBV2ErrorInfoHandle
+  -> IO DuckDBV2Error
+hs_bindgen_13b9589932c3b637 =
+  \x0 ->
+    \x1 ->
+      \x2 ->
+        fmap BG.fromFFIType (hs_bindgen_13b9589932c3b637_base (BG.toFFIType x0) (BG.toFFIType x1) (BG.toFFIType x2))
+
+{-| __C declaration:__ @duckdb_v2_data_chunk_get_vector_count@
+
+    __defined at:__ @duckdb_v2.h 2361:30@
+
+    __exported by:__ @duckdb_v2.h@
+-}
+c_duckdb_v2_data_chunk_get_vector_count ::
+     DuckDBV2DataChunkHandle
+     -- ^ __C declaration:__ @chunk@
+  -> BG.Ptr DuckDBIdx
+     -- ^ __C declaration:__ @out_count@
+  -> BG.Ptr DuckDBV2ErrorInfoHandle
+     -- ^ __C declaration:__ @err@
+  -> IO DuckDBV2Error
+c_duckdb_v2_data_chunk_get_vector_count =
+  hs_bindgen_13b9589932c3b637
+
+-- __unique:__ @Database_DuckDB_FFI_V2_Database.DuckDB.FFI.V2_Safe_duckdb_v2_data_chunk_get_vector@
+foreign import ccall safe "hs_bindgen_0604ecf0b34bfa42" hs_bindgen_0604ecf0b34bfa42_base ::
+     BG.Ptr BG.Void
+  -> HsBindgen.Runtime.LibC.Word64
+  -> BG.Ptr BG.Void
+  -> BG.Ptr BG.Void
+  -> IO BG.CUInt
+
+-- __unique:__ @Database_DuckDB_FFI_V2_Database.DuckDB.FFI.V2_Safe_duckdb_v2_data_chunk_get_vector@
+hs_bindgen_0604ecf0b34bfa42 ::
+     DuckDBV2DataChunkHandle
+  -> DuckDBIdx
+  -> BG.Ptr DuckDBV2VectorHandle
+  -> BG.Ptr DuckDBV2ErrorInfoHandle
+  -> IO DuckDBV2Error
+hs_bindgen_0604ecf0b34bfa42 =
+  \x0 ->
+    \x1 ->
+      \x2 ->
+        \x3 ->
+          fmap BG.fromFFIType (hs_bindgen_0604ecf0b34bfa42_base (BG.toFFIType x0) (BG.toFFIType x1) (BG.toFFIType x2) (BG.toFFIType x3))
+
+{-| __C declaration:__ @duckdb_v2_data_chunk_get_vector@
+
+    __defined at:__ @duckdb_v2.h 2381:30@
+
+    __exported by:__ @duckdb_v2.h@
+-}
+c_duckdb_v2_data_chunk_get_vector ::
+     DuckDBV2DataChunkHandle
+     -- ^ __C declaration:__ @chunk@
+  -> DuckDBIdx
+     -- ^ __C declaration:__ @index@
+  -> BG.Ptr DuckDBV2VectorHandle
+     -- ^ __C declaration:__ @out_vector@
+  -> BG.Ptr DuckDBV2ErrorInfoHandle
+     -- ^ __C declaration:__ @err@
+  -> IO DuckDBV2Error
+c_duckdb_v2_data_chunk_get_vector =
+  hs_bindgen_0604ecf0b34bfa42
+
+-- __unique:__ @Database_DuckDB_FFI_V2_Database.DuckDB.FFI.V2_Safe_duckdb_v2_environment_create@
+foreign import ccall safe "hs_bindgen_0d6e1ef9888bf38b" hs_bindgen_0d6e1ef9888bf38b_base ::
+     BG.Ptr BG.Void
+  -> BG.Ptr BG.Void
+  -> IO BG.CUInt
+
+-- __unique:__ @Database_DuckDB_FFI_V2_Database.DuckDB.FFI.V2_Safe_duckdb_v2_environment_create@
+hs_bindgen_0d6e1ef9888bf38b ::
+     BG.Ptr DuckDBV2EnvironmentHandle
+  -> BG.Ptr DuckDBV2ErrorInfoHandle
+  -> IO DuckDBV2Error
+hs_bindgen_0d6e1ef9888bf38b =
+  \x0 ->
+    \x1 ->
+      fmap BG.fromFFIType (hs_bindgen_0d6e1ef9888bf38b_base (BG.toFFIType x0) (BG.toFFIType x1))
+
+{-| __C declaration:__ @duckdb_v2_environment_create@
+
+    __defined at:__ @duckdb_v2.h 2416:30@
+
+    __exported by:__ @duckdb_v2.h@
+-}
+c_duckdb_v2_environment_create ::
+     BG.Ptr DuckDBV2EnvironmentHandle
+     -- ^ __C declaration:__ @out_env@
+  -> BG.Ptr DuckDBV2ErrorInfoHandle
+     -- ^ __C declaration:__ @err@
+  -> IO DuckDBV2Error
+c_duckdb_v2_environment_create =
+  hs_bindgen_0d6e1ef9888bf38b
+
+-- __unique:__ @Database_DuckDB_FFI_V2_Database.DuckDB.FFI.V2_Safe_duckdb_v2_environment_destroy@
+foreign import ccall safe "hs_bindgen_6f011a47d1d2a512" hs_bindgen_6f011a47d1d2a512_base ::
+     BG.Ptr BG.Void
+  -> IO BG.CUInt
+
+-- __unique:__ @Database_DuckDB_FFI_V2_Database.DuckDB.FFI.V2_Safe_duckdb_v2_environment_destroy@
+hs_bindgen_6f011a47d1d2a512 ::
+     BG.Ptr DuckDBV2EnvironmentHandle
+  -> IO DuckDBV2Error
+hs_bindgen_6f011a47d1d2a512 =
+  \x0 ->
+    fmap BG.fromFFIType (hs_bindgen_6f011a47d1d2a512_base (BG.toFFIType x0))
+
+{-| __C declaration:__ @duckdb_v2_environment_destroy@
+
+    __defined at:__ @duckdb_v2.h 2433:30@
+
+    __exported by:__ @duckdb_v2.h@
+-}
+c_duckdb_v2_environment_destroy ::
+     BG.Ptr DuckDBV2EnvironmentHandle
+     -- ^ __C declaration:__ @env@
+  -> IO DuckDBV2Error
+c_duckdb_v2_environment_destroy =
+  hs_bindgen_6f011a47d1d2a512
+
+-- __unique:__ @Database_DuckDB_FFI_V2_Database.DuckDB.FFI.V2_Safe_duckdb_v2_environment_get_instance_count@
+foreign import ccall safe "hs_bindgen_db07f075791341a1" hs_bindgen_db07f075791341a1_base ::
+     BG.Ptr BG.Void
+  -> BG.Ptr BG.Void
+  -> BG.Ptr BG.Void
+  -> IO BG.CUInt
+
+-- __unique:__ @Database_DuckDB_FFI_V2_Database.DuckDB.FFI.V2_Safe_duckdb_v2_environment_get_instance_count@
+hs_bindgen_db07f075791341a1 ::
+     DuckDBV2EnvironmentHandle
+  -> BG.Ptr DuckDBIdx
+  -> BG.Ptr DuckDBV2ErrorInfoHandle
+  -> IO DuckDBV2Error
+hs_bindgen_db07f075791341a1 =
+  \x0 ->
+    \x1 ->
+      \x2 ->
+        fmap BG.fromFFIType (hs_bindgen_db07f075791341a1_base (BG.toFFIType x0) (BG.toFFIType x1) (BG.toFFIType x2))
+
+{-| __C declaration:__ @duckdb_v2_environment_get_instance_count@
+
+    __defined at:__ @duckdb_v2.h 2452:30@
+
+    __exported by:__ @duckdb_v2.h@
+-}
+c_duckdb_v2_environment_get_instance_count ::
+     DuckDBV2EnvironmentHandle
+     -- ^ __C declaration:__ @env@
+  -> BG.Ptr DuckDBIdx
+     -- ^ __C declaration:__ @out_count@
+  -> BG.Ptr DuckDBV2ErrorInfoHandle
+     -- ^ __C declaration:__ @err@
+  -> IO DuckDBV2Error
+c_duckdb_v2_environment_get_instance_count =
+  hs_bindgen_db07f075791341a1
+
+-- __unique:__ @Database_DuckDB_FFI_V2_Database.DuckDB.FFI.V2_Safe_duckdb_v2_error_info_get_code@
+foreign import ccall safe "hs_bindgen_552e1c73da925f47" hs_bindgen_552e1c73da925f47_base ::
+     BG.Ptr BG.Void
+  -> BG.Ptr BG.Void
+  -> IO BG.CUInt
+
+-- __unique:__ @Database_DuckDB_FFI_V2_Database.DuckDB.FFI.V2_Safe_duckdb_v2_error_info_get_code@
+hs_bindgen_552e1c73da925f47 ::
+     DuckDBV2ErrorInfoHandle
+  -> BG.Ptr DuckDBV2Error
+  -> IO DuckDBV2Error
+hs_bindgen_552e1c73da925f47 =
+  \x0 ->
+    \x1 ->
+      fmap BG.fromFFIType (hs_bindgen_552e1c73da925f47_base (BG.toFFIType x0) (BG.toFFIType x1))
+
+{-| __C declaration:__ @duckdb_v2_error_info_get_code@
+
+    __defined at:__ @duckdb_v2.h 2489:30@
+
+    __exported by:__ @duckdb_v2.h@
+-}
+c_duckdb_v2_error_info_get_code ::
+     DuckDBV2ErrorInfoHandle
+     -- ^ __C declaration:__ @info@
+  -> BG.Ptr DuckDBV2Error
+     -- ^ __C declaration:__ @out_code@
+  -> IO DuckDBV2Error
+c_duckdb_v2_error_info_get_code =
+  hs_bindgen_552e1c73da925f47
+
+-- __unique:__ @Database_DuckDB_FFI_V2_Database.DuckDB.FFI.V2_Safe_duckdb_v2_error_info_get_text@
+foreign import ccall safe "hs_bindgen_03df4b92bc4be03f" hs_bindgen_03df4b92bc4be03f_base ::
+     BG.Ptr BG.Void
+  -> BG.Ptr BG.Void
+  -> IO BG.CUInt
+
+-- __unique:__ @Database_DuckDB_FFI_V2_Database.DuckDB.FFI.V2_Safe_duckdb_v2_error_info_get_text@
+hs_bindgen_03df4b92bc4be03f ::
+     DuckDBV2ErrorInfoHandle
+  -> BG.Ptr DuckDBV2Str
+  -> IO DuckDBV2Error
+hs_bindgen_03df4b92bc4be03f =
+  \x0 ->
+    \x1 ->
+      fmap BG.fromFFIType (hs_bindgen_03df4b92bc4be03f_base (BG.toFFIType x0) (BG.toFFIType x1))
+
+{-| __C declaration:__ @duckdb_v2_error_info_get_text@
+
+    __defined at:__ @duckdb_v2.h 2507:30@
+
+    __exported by:__ @duckdb_v2.h@
+-}
+c_duckdb_v2_error_info_get_text ::
+     DuckDBV2ErrorInfoHandle
+     -- ^ __C declaration:__ @info@
+  -> BG.Ptr DuckDBV2Str
+     -- ^ __C declaration:__ @out_text@
+  -> IO DuckDBV2Error
+c_duckdb_v2_error_info_get_text =
+  hs_bindgen_03df4b92bc4be03f
+
+-- __unique:__ @Database_DuckDB_FFI_V2_Database.DuckDB.FFI.V2_Safe_duckdb_v2_error_info_get_raw_text@
+foreign import ccall safe "hs_bindgen_32a1e95c1b01b1de" hs_bindgen_32a1e95c1b01b1de_base ::
+     BG.Ptr BG.Void
+  -> BG.Ptr BG.Void
+  -> IO BG.CUInt
+
+-- __unique:__ @Database_DuckDB_FFI_V2_Database.DuckDB.FFI.V2_Safe_duckdb_v2_error_info_get_raw_text@
+hs_bindgen_32a1e95c1b01b1de ::
+     DuckDBV2ErrorInfoHandle
+  -> BG.Ptr DuckDBV2Str
+  -> IO DuckDBV2Error
+hs_bindgen_32a1e95c1b01b1de =
+  \x0 ->
+    \x1 ->
+      fmap BG.fromFFIType (hs_bindgen_32a1e95c1b01b1de_base (BG.toFFIType x0) (BG.toFFIType x1))
+
+{-| __C declaration:__ @duckdb_v2_error_info_get_raw_text@
+
+    __defined at:__ @duckdb_v2.h 2528:30@
+
+    __exported by:__ @duckdb_v2.h@
+-}
+c_duckdb_v2_error_info_get_raw_text ::
+     DuckDBV2ErrorInfoHandle
+     -- ^ __C declaration:__ @info@
+  -> BG.Ptr DuckDBV2Str
+     -- ^ __C declaration:__ @out_raw_text@
+  -> IO DuckDBV2Error
+c_duckdb_v2_error_info_get_raw_text =
+  hs_bindgen_32a1e95c1b01b1de
+
+-- __unique:__ @Database_DuckDB_FFI_V2_Database.DuckDB.FFI.V2_Safe_duckdb_v2_error_info_set_code@
+foreign import ccall safe "hs_bindgen_326085f2ffcfc342" hs_bindgen_326085f2ffcfc342_base ::
+     BG.Ptr BG.Void
+  -> BG.CUInt
+  -> IO BG.CUInt
+
+-- __unique:__ @Database_DuckDB_FFI_V2_Database.DuckDB.FFI.V2_Safe_duckdb_v2_error_info_set_code@
+hs_bindgen_326085f2ffcfc342 ::
+     DuckDBV2ErrorInfoHandle
+  -> DuckDBV2Error
+  -> IO DuckDBV2Error
+hs_bindgen_326085f2ffcfc342 =
+  \x0 ->
+    \x1 ->
+      fmap BG.fromFFIType (hs_bindgen_326085f2ffcfc342_base (BG.toFFIType x0) (BG.toFFIType x1))
+
+{-| __C declaration:__ @duckdb_v2_error_info_set_code@
+
+    __defined at:__ @duckdb_v2.h 2546:30@
+
+    __exported by:__ @duckdb_v2.h@
+-}
+c_duckdb_v2_error_info_set_code ::
+     DuckDBV2ErrorInfoHandle
+     -- ^ __C declaration:__ @info@
+  -> DuckDBV2Error
+     -- ^ __C declaration:__ @code@
+  -> IO DuckDBV2Error
+c_duckdb_v2_error_info_set_code =
+  hs_bindgen_326085f2ffcfc342
+
+-- __unique:__ @Database_DuckDB_FFI_V2_Database.DuckDB.FFI.V2_Safe_duckdb_v2_error_info_set_text@
+foreign import ccall safe "hs_bindgen_e6b5e7387b836896" hs_bindgen_e6b5e7387b836896_base ::
+     BG.Ptr BG.Void
+  -> BG.Ptr BG.Void
+  -> IO BG.CUInt
+
+-- __unique:__ @Database_DuckDB_FFI_V2_Database.DuckDB.FFI.V2_Safe_duckdb_v2_error_info_set_text@
+hs_bindgen_e6b5e7387b836896 ::
+     DuckDBV2ErrorInfoHandle
+  -> PtrConst.PtrConst DuckDBV2Str
+  -> IO DuckDBV2Error
+hs_bindgen_e6b5e7387b836896 =
+  \x0 ->
+    \x1 ->
+      fmap BG.fromFFIType (hs_bindgen_e6b5e7387b836896_base (BG.toFFIType x0) (BG.toFFIType x1))
+
+{-| __C declaration:__ @duckdb_v2_error_info_set_text@
+
+    __defined at:__ @duckdb_v2.h 2563:30@
+
+    __exported by:__ @duckdb_v2.h@
+-}
+c_duckdb_v2_error_info_set_text ::
+     DuckDBV2ErrorInfoHandle
+     -- ^ __C declaration:__ @info@
+  -> PtrConst.PtrConst DuckDBV2Str
+     -- ^ __C declaration:__ @text@
+  -> IO DuckDBV2Error
+c_duckdb_v2_error_info_set_text =
+  hs_bindgen_e6b5e7387b836896
+
+-- __unique:__ @Database_DuckDB_FFI_V2_Database.DuckDB.FFI.V2_Safe_duckdb_v2_error_info_destroy@
+foreign import ccall safe "hs_bindgen_77cae354c53e33b0" hs_bindgen_77cae354c53e33b0_base ::
+     BG.Ptr BG.Void
+  -> IO BG.CUInt
+
+-- __unique:__ @Database_DuckDB_FFI_V2_Database.DuckDB.FFI.V2_Safe_duckdb_v2_error_info_destroy@
+hs_bindgen_77cae354c53e33b0 ::
+     BG.Ptr DuckDBV2ErrorInfoHandle
+  -> IO DuckDBV2Error
+hs_bindgen_77cae354c53e33b0 =
+  \x0 ->
+    fmap BG.fromFFIType (hs_bindgen_77cae354c53e33b0_base (BG.toFFIType x0))
+
+{-| __C declaration:__ @duckdb_v2_error_info_destroy@
+
+    __defined at:__ @duckdb_v2.h 2579:30@
+
+    __exported by:__ @duckdb_v2.h@
+-}
+c_duckdb_v2_error_info_destroy ::
+     BG.Ptr DuckDBV2ErrorInfoHandle
+     -- ^ __C declaration:__ @info@
+  -> IO DuckDBV2Error
+c_duckdb_v2_error_info_destroy =
+  hs_bindgen_77cae354c53e33b0
+
+-- __unique:__ @Database_DuckDB_FFI_V2_Database.DuckDB.FFI.V2_Safe_duckdb_v2_instance_get_factory@
+foreign import ccall safe "hs_bindgen_e018ef8a87cb6cfa" hs_bindgen_e018ef8a87cb6cfa_base ::
+     BG.Ptr BG.Void
+  -> BG.Ptr BG.Void
+  -> BG.Ptr BG.Void
+  -> IO BG.CUInt
+
+-- __unique:__ @Database_DuckDB_FFI_V2_Database.DuckDB.FFI.V2_Safe_duckdb_v2_instance_get_factory@
+hs_bindgen_e018ef8a87cb6cfa ::
+     DuckDBV2InstanceHandle
+  -> BG.Ptr DuckDBV2FactoryHandle
+  -> BG.Ptr DuckDBV2ErrorInfoHandle
+  -> IO DuckDBV2Error
+hs_bindgen_e018ef8a87cb6cfa =
+  \x0 ->
+    \x1 ->
+      \x2 ->
+        fmap BG.fromFFIType (hs_bindgen_e018ef8a87cb6cfa_base (BG.toFFIType x0) (BG.toFFIType x1) (BG.toFFIType x2))
+
+{-| __C declaration:__ @duckdb_v2_instance_get_factory@
+
+    __defined at:__ @duckdb_v2.h 2674:30@
+
+    __exported by:__ @duckdb_v2.h@
+-}
+c_duckdb_v2_instance_get_factory ::
+     DuckDBV2InstanceHandle
+     -- ^ __C declaration:__ @instance@
+  -> BG.Ptr DuckDBV2FactoryHandle
+     -- ^ __C declaration:__ @out_factory@
+  -> BG.Ptr DuckDBV2ErrorInfoHandle
+     -- ^ __C declaration:__ @err@
+  -> IO DuckDBV2Error
+c_duckdb_v2_instance_get_factory =
+  hs_bindgen_e018ef8a87cb6cfa
+
+-- __unique:__ @Database_DuckDB_FFI_V2_Database.DuckDB.FFI.V2_Safe_duckdb_v2_connection_get_factory@
+foreign import ccall safe "hs_bindgen_404bc6fa8a1d8482" hs_bindgen_404bc6fa8a1d8482_base ::
+     BG.Ptr BG.Void
+  -> BG.Ptr BG.Void
+  -> BG.Ptr BG.Void
+  -> IO BG.CUInt
+
+-- __unique:__ @Database_DuckDB_FFI_V2_Database.DuckDB.FFI.V2_Safe_duckdb_v2_connection_get_factory@
+hs_bindgen_404bc6fa8a1d8482 ::
+     DuckDBV2ConnectionHandle
+  -> BG.Ptr DuckDBV2FactoryHandle
+  -> BG.Ptr DuckDBV2ErrorInfoHandle
+  -> IO DuckDBV2Error
+hs_bindgen_404bc6fa8a1d8482 =
+  \x0 ->
+    \x1 ->
+      \x2 ->
+        fmap BG.fromFFIType (hs_bindgen_404bc6fa8a1d8482_base (BG.toFFIType x0) (BG.toFFIType x1) (BG.toFFIType x2))
+
+{-| __C declaration:__ @duckdb_v2_connection_get_factory@
+
+    __defined at:__ @duckdb_v2.h 2696:30@
+
+    __exported by:__ @duckdb_v2.h@
+-}
+c_duckdb_v2_connection_get_factory ::
+     DuckDBV2ConnectionHandle
+     -- ^ __C declaration:__ @conn@
+  -> BG.Ptr DuckDBV2FactoryHandle
+     -- ^ __C declaration:__ @out_factory@
+  -> BG.Ptr DuckDBV2ErrorInfoHandle
+     -- ^ __C declaration:__ @err@
+  -> IO DuckDBV2Error
+c_duckdb_v2_connection_get_factory =
+  hs_bindgen_404bc6fa8a1d8482
+
+-- __unique:__ @Database_DuckDB_FFI_V2_Database.DuckDB.FFI.V2_Safe_duckdb_v2_context_get_factory@
+foreign import ccall safe "hs_bindgen_171cd09b93febf18" hs_bindgen_171cd09b93febf18_base ::
+     BG.Ptr BG.Void
+  -> BG.Ptr BG.Void
+  -> BG.Ptr BG.Void
+  -> IO BG.CUInt
+
+-- __unique:__ @Database_DuckDB_FFI_V2_Database.DuckDB.FFI.V2_Safe_duckdb_v2_context_get_factory@
+hs_bindgen_171cd09b93febf18 ::
+     DuckDBV2ContextHandle
+  -> BG.Ptr DuckDBV2FactoryHandle
+  -> BG.Ptr DuckDBV2ErrorInfoHandle
+  -> IO DuckDBV2Error
+hs_bindgen_171cd09b93febf18 =
+  \x0 ->
+    \x1 ->
+      \x2 ->
+        fmap BG.fromFFIType (hs_bindgen_171cd09b93febf18_base (BG.toFFIType x0) (BG.toFFIType x1) (BG.toFFIType x2))
+
+{-| __C declaration:__ @duckdb_v2_context_get_factory@
+
+    __defined at:__ @duckdb_v2.h 2717:30@
+
+    __exported by:__ @duckdb_v2.h@
+-}
+c_duckdb_v2_context_get_factory ::
+     DuckDBV2ContextHandle
+     -- ^ __C declaration:__ @ctx@
+  -> BG.Ptr DuckDBV2FactoryHandle
+     -- ^ __C declaration:__ @out_factory@
+  -> BG.Ptr DuckDBV2ErrorInfoHandle
+     -- ^ __C declaration:__ @err@
+  -> IO DuckDBV2Error
+c_duckdb_v2_context_get_factory =
+  hs_bindgen_171cd09b93febf18
+
+-- __unique:__ @Database_DuckDB_FFI_V2_Database.DuckDB.FFI.V2_Safe_duckdb_v2_context_get_file_system@
+foreign import ccall safe "hs_bindgen_480977e243515f9b" hs_bindgen_480977e243515f9b_base ::
+     BG.Ptr BG.Void
+  -> BG.Ptr BG.Void
+  -> BG.Ptr BG.Void
+  -> IO BG.CUInt
+
+-- __unique:__ @Database_DuckDB_FFI_V2_Database.DuckDB.FFI.V2_Safe_duckdb_v2_context_get_file_system@
+hs_bindgen_480977e243515f9b ::
+     DuckDBV2ContextHandle
+  -> BG.Ptr DuckDBV2FileSystemHandle
+  -> BG.Ptr DuckDBV2ErrorInfoHandle
+  -> IO DuckDBV2Error
+hs_bindgen_480977e243515f9b =
+  \x0 ->
+    \x1 ->
+      \x2 ->
+        fmap BG.fromFFIType (hs_bindgen_480977e243515f9b_base (BG.toFFIType x0) (BG.toFFIType x1) (BG.toFFIType x2))
+
+{-| __C declaration:__ @duckdb_v2_context_get_file_system@
+
+    __defined at:__ @duckdb_v2.h 2841:30@
+
+    __exported by:__ @duckdb_v2.h@
+-}
+c_duckdb_v2_context_get_file_system ::
+     DuckDBV2ContextHandle
+     -- ^ __C declaration:__ @context@
+  -> BG.Ptr DuckDBV2FileSystemHandle
+     -- ^ __C declaration:__ @file_system@
+  -> BG.Ptr DuckDBV2ErrorInfoHandle
+     -- ^ __C declaration:__ @err@
+  -> IO DuckDBV2Error
+c_duckdb_v2_context_get_file_system =
+  hs_bindgen_480977e243515f9b
+
+-- __unique:__ @Database_DuckDB_FFI_V2_Database.DuckDB.FFI.V2_Safe_duckdb_v2_instance_get_file_system@
+foreign import ccall safe "hs_bindgen_1182a1b34bb4b5d8" hs_bindgen_1182a1b34bb4b5d8_base ::
+     BG.Ptr BG.Void
+  -> BG.Ptr BG.Void
+  -> BG.Ptr BG.Void
+  -> IO BG.CUInt
+
+-- __unique:__ @Database_DuckDB_FFI_V2_Database.DuckDB.FFI.V2_Safe_duckdb_v2_instance_get_file_system@
+hs_bindgen_1182a1b34bb4b5d8 ::
+     DuckDBV2InstanceHandle
+  -> BG.Ptr DuckDBV2FileSystemHandle
+  -> BG.Ptr DuckDBV2ErrorInfoHandle
+  -> IO DuckDBV2Error
+hs_bindgen_1182a1b34bb4b5d8 =
+  \x0 ->
+    \x1 ->
+      \x2 ->
+        fmap BG.fromFFIType (hs_bindgen_1182a1b34bb4b5d8_base (BG.toFFIType x0) (BG.toFFIType x1) (BG.toFFIType x2))
+
+{-| __C declaration:__ @duckdb_v2_instance_get_file_system@
+
+    __defined at:__ @duckdb_v2.h 2863:30@
+
+    __exported by:__ @duckdb_v2.h@
+-}
+c_duckdb_v2_instance_get_file_system ::
+     DuckDBV2InstanceHandle
+     -- ^ __C declaration:__ @instance@
+  -> BG.Ptr DuckDBV2FileSystemHandle
+     -- ^ __C declaration:__ @file_system@
+  -> BG.Ptr DuckDBV2ErrorInfoHandle
+     -- ^ __C declaration:__ @err@
+  -> IO DuckDBV2Error
+c_duckdb_v2_instance_get_file_system =
+  hs_bindgen_1182a1b34bb4b5d8
+
+-- __unique:__ @Database_DuckDB_FFI_V2_Database.DuckDB.FFI.V2_Safe_duckdb_v2_connection_get_file_system@
+foreign import ccall safe "hs_bindgen_c3c4dbd17ed425d7" hs_bindgen_c3c4dbd17ed425d7_base ::
+     BG.Ptr BG.Void
+  -> BG.Ptr BG.Void
+  -> BG.Ptr BG.Void
+  -> IO BG.CUInt
+
+-- __unique:__ @Database_DuckDB_FFI_V2_Database.DuckDB.FFI.V2_Safe_duckdb_v2_connection_get_file_system@
+hs_bindgen_c3c4dbd17ed425d7 ::
+     DuckDBV2ConnectionHandle
+  -> BG.Ptr DuckDBV2FileSystemHandle
+  -> BG.Ptr DuckDBV2ErrorInfoHandle
+  -> IO DuckDBV2Error
+hs_bindgen_c3c4dbd17ed425d7 =
+  \x0 ->
+    \x1 ->
+      \x2 ->
+        fmap BG.fromFFIType (hs_bindgen_c3c4dbd17ed425d7_base (BG.toFFIType x0) (BG.toFFIType x1) (BG.toFFIType x2))
+
+{-| __C declaration:__ @duckdb_v2_connection_get_file_system@
+
+    __defined at:__ @duckdb_v2.h 2886:30@
+
+    __exported by:__ @duckdb_v2.h@
+-}
+c_duckdb_v2_connection_get_file_system ::
+     DuckDBV2ConnectionHandle
+     -- ^ __C declaration:__ @conn@
+  -> BG.Ptr DuckDBV2FileSystemHandle
+     -- ^ __C declaration:__ @file_system@
+  -> BG.Ptr DuckDBV2ErrorInfoHandle
+     -- ^ __C declaration:__ @err@
+  -> IO DuckDBV2Error
+c_duckdb_v2_connection_get_file_system =
+  hs_bindgen_c3c4dbd17ed425d7
+
+-- __unique:__ @Database_DuckDB_FFI_V2_Database.DuckDB.FFI.V2_Safe_duckdb_v2_file_open_options_create@
+foreign import ccall safe "hs_bindgen_3b95d687bcc454dc" hs_bindgen_3b95d687bcc454dc_base ::
+     BG.Ptr BG.Void
+  -> BG.Ptr BG.Void
+  -> BG.Ptr BG.Void
+  -> IO BG.CUInt
+
+-- __unique:__ @Database_DuckDB_FFI_V2_Database.DuckDB.FFI.V2_Safe_duckdb_v2_file_open_options_create@
+hs_bindgen_3b95d687bcc454dc ::
+     DuckDBV2FileSystemHandle
+  -> BG.Ptr DuckDBV2FileOpenOptionsHandle
+  -> BG.Ptr DuckDBV2ErrorInfoHandle
+  -> IO DuckDBV2Error
+hs_bindgen_3b95d687bcc454dc =
+  \x0 ->
+    \x1 ->
+      \x2 ->
+        fmap BG.fromFFIType (hs_bindgen_3b95d687bcc454dc_base (BG.toFFIType x0) (BG.toFFIType x1) (BG.toFFIType x2))
+
+{-| __C declaration:__ @duckdb_v2_file_open_options_create@
+
+    __defined at:__ @duckdb_v2.h 2913:30@
+
+    __exported by:__ @duckdb_v2.h@
+-}
+c_duckdb_v2_file_open_options_create ::
+     DuckDBV2FileSystemHandle
+     -- ^ __C declaration:__ @file_system@
+  -> BG.Ptr DuckDBV2FileOpenOptionsHandle
+     -- ^ __C declaration:__ @options@
+  -> BG.Ptr DuckDBV2ErrorInfoHandle
+     -- ^ __C declaration:__ @err@
+  -> IO DuckDBV2Error
+c_duckdb_v2_file_open_options_create =
+  hs_bindgen_3b95d687bcc454dc
+
+-- __unique:__ @Database_DuckDB_FFI_V2_Database.DuckDB.FFI.V2_Safe_duckdb_v2_file_open_options_set_flag@
+foreign import ccall safe "hs_bindgen_13b837fa457c05ab" hs_bindgen_13b837fa457c05ab_base ::
+     BG.Ptr BG.Void
+  -> BG.CUInt
+  -> BG.Ptr BG.Void
+  -> IO BG.CUInt
+
+-- __unique:__ @Database_DuckDB_FFI_V2_Database.DuckDB.FFI.V2_Safe_duckdb_v2_file_open_options_set_flag@
+hs_bindgen_13b837fa457c05ab ::
+     DuckDBV2FileOpenOptionsHandle
+  -> DuckDBV2FileFlag
+  -> BG.Ptr DuckDBV2ErrorInfoHandle
+  -> IO DuckDBV2Error
+hs_bindgen_13b837fa457c05ab =
+  \x0 ->
+    \x1 ->
+      \x2 ->
+        fmap BG.fromFFIType (hs_bindgen_13b837fa457c05ab_base (BG.toFFIType x0) (BG.toFFIType x1) (BG.toFFIType x2))
+
+{-| __C declaration:__ @duckdb_v2_file_open_options_set_flag@
+
+    __defined at:__ @duckdb_v2.h 2937:30@
+
+    __exported by:__ @duckdb_v2.h@
+-}
+c_duckdb_v2_file_open_options_set_flag ::
+     DuckDBV2FileOpenOptionsHandle
+     -- ^ __C declaration:__ @options@
+  -> DuckDBV2FileFlag
+     -- ^ __C declaration:__ @flag@
+  -> BG.Ptr DuckDBV2ErrorInfoHandle
+     -- ^ __C declaration:__ @err@
+  -> IO DuckDBV2Error
+c_duckdb_v2_file_open_options_set_flag =
+  hs_bindgen_13b837fa457c05ab
+
+-- __unique:__ @Database_DuckDB_FFI_V2_Database.DuckDB.FFI.V2_Safe_duckdb_v2_file_open_options_set_value@
+foreign import ccall safe "hs_bindgen_8057d4fdc98cb7a0" hs_bindgen_8057d4fdc98cb7a0_base ::
+     BG.Ptr BG.Void
+  -> BG.Ptr BG.Void
+  -> BG.Ptr BG.Void
+  -> BG.Ptr BG.Void
+  -> IO BG.CUInt
+
+-- __unique:__ @Database_DuckDB_FFI_V2_Database.DuckDB.FFI.V2_Safe_duckdb_v2_file_open_options_set_value@
+hs_bindgen_8057d4fdc98cb7a0 ::
+     DuckDBV2FileOpenOptionsHandle
+  -> PtrConst.PtrConst DuckDBV2Str
+  -> DuckDBV2ValueHandle
+  -> BG.Ptr DuckDBV2ErrorInfoHandle
+  -> IO DuckDBV2Error
+hs_bindgen_8057d4fdc98cb7a0 =
+  \x0 ->
+    \x1 ->
+      \x2 ->
+        \x3 ->
+          fmap BG.fromFFIType (hs_bindgen_8057d4fdc98cb7a0_base (BG.toFFIType x0) (BG.toFFIType x1) (BG.toFFIType x2) (BG.toFFIType x3))
+
+{-| __C declaration:__ @duckdb_v2_file_open_options_set_value@
+
+    __defined at:__ @duckdb_v2.h 2964:30@
+
+    __exported by:__ @duckdb_v2.h@
+-}
+c_duckdb_v2_file_open_options_set_value ::
+     DuckDBV2FileOpenOptionsHandle
+     -- ^ __C declaration:__ @options@
+  -> PtrConst.PtrConst DuckDBV2Str
+     -- ^ __C declaration:__ @name@
+  -> DuckDBV2ValueHandle
+     -- ^ __C declaration:__ @value@
+  -> BG.Ptr DuckDBV2ErrorInfoHandle
+     -- ^ __C declaration:__ @err@
+  -> IO DuckDBV2Error
+c_duckdb_v2_file_open_options_set_value =
+  hs_bindgen_8057d4fdc98cb7a0
+
+-- __unique:__ @Database_DuckDB_FFI_V2_Database.DuckDB.FFI.V2_Safe_duckdb_v2_file_open_options_destroy@
+foreign import ccall safe "hs_bindgen_eee66d4dc0272778" hs_bindgen_eee66d4dc0272778_base ::
+     BG.Ptr BG.Void
+  -> IO BG.CUInt
+
+-- __unique:__ @Database_DuckDB_FFI_V2_Database.DuckDB.FFI.V2_Safe_duckdb_v2_file_open_options_destroy@
+hs_bindgen_eee66d4dc0272778 ::
+     BG.Ptr DuckDBV2FileOpenOptionsHandle
+  -> IO DuckDBV2Error
+hs_bindgen_eee66d4dc0272778 =
+  \x0 ->
+    fmap BG.fromFFIType (hs_bindgen_eee66d4dc0272778_base (BG.toFFIType x0))
+
+{-| __C declaration:__ @duckdb_v2_file_open_options_destroy@
+
+    __defined at:__ @duckdb_v2.h 2983:30@
+
+    __exported by:__ @duckdb_v2.h@
+-}
+c_duckdb_v2_file_open_options_destroy ::
+     BG.Ptr DuckDBV2FileOpenOptionsHandle
+     -- ^ __C declaration:__ @options@
+  -> IO DuckDBV2Error
+c_duckdb_v2_file_open_options_destroy =
+  hs_bindgen_eee66d4dc0272778
+
+-- __unique:__ @Database_DuckDB_FFI_V2_Database.DuckDB.FFI.V2_Safe_duckdb_v2_file_system_open@
+foreign import ccall safe "hs_bindgen_d095a79fe561d117" hs_bindgen_d095a79fe561d117_base ::
+     BG.Ptr BG.Void
+  -> BG.Ptr BG.Void
+  -> BG.Ptr BG.Void
+  -> BG.Ptr BG.Void
+  -> BG.Ptr BG.Void
+  -> IO BG.CUInt
+
+-- __unique:__ @Database_DuckDB_FFI_V2_Database.DuckDB.FFI.V2_Safe_duckdb_v2_file_system_open@
+hs_bindgen_d095a79fe561d117 ::
+     DuckDBV2FileSystemHandle
+  -> PtrConst.PtrConst DuckDBV2Str
+  -> DuckDBV2FileOpenOptionsHandle
+  -> BG.Ptr DuckDBV2FileHandle
+  -> BG.Ptr DuckDBV2ErrorInfoHandle
+  -> IO DuckDBV2Error
+hs_bindgen_d095a79fe561d117 =
+  \x0 ->
+    \x1 ->
+      \x2 ->
+        \x3 ->
+          \x4 ->
+            fmap BG.fromFFIType (hs_bindgen_d095a79fe561d117_base (BG.toFFIType x0) (BG.toFFIType x1) (BG.toFFIType x2) (BG.toFFIType x3) (BG.toFFIType x4))
+
+{-| __C declaration:__ @duckdb_v2_file_system_open@
+
+    __defined at:__ @duckdb_v2.h 3015:30@
+
+    __exported by:__ @duckdb_v2.h@
+-}
+c_duckdb_v2_file_system_open ::
+     DuckDBV2FileSystemHandle
+     -- ^ __C declaration:__ @file_system@
+  -> PtrConst.PtrConst DuckDBV2Str
+     -- ^ __C declaration:__ @file_path@
+  -> DuckDBV2FileOpenOptionsHandle
+     -- ^ __C declaration:__ @options@
+  -> BG.Ptr DuckDBV2FileHandle
+     -- ^ __C declaration:__ @file@
+  -> BG.Ptr DuckDBV2ErrorInfoHandle
+     -- ^ __C declaration:__ @err@
+  -> IO DuckDBV2Error
+c_duckdb_v2_file_system_open =
+  hs_bindgen_d095a79fe561d117
+
+-- __unique:__ @Database_DuckDB_FFI_V2_Database.DuckDB.FFI.V2_Safe_duckdb_v2_file_system_path_exists@
+foreign import ccall safe "hs_bindgen_88b4f0f72cbdbead" hs_bindgen_88b4f0f72cbdbead_base ::
+     BG.Ptr BG.Void
+  -> BG.Ptr BG.Void
+  -> BG.Ptr BG.Void
+  -> BG.Ptr BG.Void
+  -> IO BG.CUInt
+
+-- __unique:__ @Database_DuckDB_FFI_V2_Database.DuckDB.FFI.V2_Safe_duckdb_v2_file_system_path_exists@
+hs_bindgen_88b4f0f72cbdbead ::
+     DuckDBV2FileSystemHandle
+  -> PtrConst.PtrConst DuckDBV2Str
+  -> BG.Ptr BG.CBool
+  -> BG.Ptr DuckDBV2ErrorInfoHandle
+  -> IO DuckDBV2Error
+hs_bindgen_88b4f0f72cbdbead =
+  \x0 ->
+    \x1 ->
+      \x2 ->
+        \x3 ->
+          fmap BG.fromFFIType (hs_bindgen_88b4f0f72cbdbead_base (BG.toFFIType x0) (BG.toFFIType x1) (BG.toFFIType x2) (BG.toFFIType x3))
+
+{-| __C declaration:__ @duckdb_v2_file_system_path_exists@
+
+    __defined at:__ @duckdb_v2.h 3038:30@
+
+    __exported by:__ @duckdb_v2.h@
+-}
+c_duckdb_v2_file_system_path_exists ::
+     DuckDBV2FileSystemHandle
+     -- ^ __C declaration:__ @file_system@
+  -> PtrConst.PtrConst DuckDBV2Str
+     -- ^ __C declaration:__ @path@
+  -> BG.Ptr BG.CBool
+     -- ^ __C declaration:__ @out_exists@
+  -> BG.Ptr DuckDBV2ErrorInfoHandle
+     -- ^ __C declaration:__ @err@
+  -> IO DuckDBV2Error
+c_duckdb_v2_file_system_path_exists =
+  hs_bindgen_88b4f0f72cbdbead
+
+-- __unique:__ @Database_DuckDB_FFI_V2_Database.DuckDB.FFI.V2_Safe_duckdb_v2_file_system_path_is_remote@
+foreign import ccall safe "hs_bindgen_a339f857b407ee61" hs_bindgen_a339f857b407ee61_base ::
+     BG.Ptr BG.Void
+  -> BG.Ptr BG.Void
+  -> BG.Ptr BG.Void
+  -> BG.Ptr BG.Void
+  -> IO BG.CUInt
+
+-- __unique:__ @Database_DuckDB_FFI_V2_Database.DuckDB.FFI.V2_Safe_duckdb_v2_file_system_path_is_remote@
+hs_bindgen_a339f857b407ee61 ::
+     DuckDBV2FileSystemHandle
+  -> PtrConst.PtrConst DuckDBV2Str
+  -> BG.Ptr BG.CBool
+  -> BG.Ptr DuckDBV2ErrorInfoHandle
+  -> IO DuckDBV2Error
+hs_bindgen_a339f857b407ee61 =
+  \x0 ->
+    \x1 ->
+      \x2 ->
+        \x3 ->
+          fmap BG.fromFFIType (hs_bindgen_a339f857b407ee61_base (BG.toFFIType x0) (BG.toFFIType x1) (BG.toFFIType x2) (BG.toFFIType x3))
+
+{-| __C declaration:__ @duckdb_v2_file_system_path_is_remote@
+
+    __defined at:__ @duckdb_v2.h 3060:30@
+
+    __exported by:__ @duckdb_v2.h@
+-}
+c_duckdb_v2_file_system_path_is_remote ::
+     DuckDBV2FileSystemHandle
+     -- ^ __C declaration:__ @file_system@
+  -> PtrConst.PtrConst DuckDBV2Str
+     -- ^ __C declaration:__ @path@
+  -> BG.Ptr BG.CBool
+     -- ^ __C declaration:__ @out_is_remote@
+  -> BG.Ptr DuckDBV2ErrorInfoHandle
+     -- ^ __C declaration:__ @err@
+  -> IO DuckDBV2Error
+c_duckdb_v2_file_system_path_is_remote =
+  hs_bindgen_a339f857b407ee61
+
+-- __unique:__ @Database_DuckDB_FFI_V2_Database.DuckDB.FFI.V2_Safe_duckdb_v2_file_system_path_expand@
+foreign import ccall safe "hs_bindgen_371e0d86cbe6ddc1" hs_bindgen_371e0d86cbe6ddc1_base ::
+     BG.Ptr BG.Void
+  -> BG.Ptr BG.Void
+  -> BG.FunPtr BG.Void
+  -> BG.Ptr BG.Void
+  -> BG.Ptr BG.Void
+  -> IO BG.CUInt
+
+-- __unique:__ @Database_DuckDB_FFI_V2_Database.DuckDB.FFI.V2_Safe_duckdb_v2_file_system_path_expand@
+hs_bindgen_371e0d86cbe6ddc1 ::
+     DuckDBV2FileSystemHandle
+  -> PtrConst.PtrConst DuckDBV2Str
+  -> DuckDBV2TextSinkFn
+  -> BG.Ptr BG.Void
+  -> BG.Ptr DuckDBV2ErrorInfoHandle
+  -> IO DuckDBV2Error
+hs_bindgen_371e0d86cbe6ddc1 =
+  \x0 ->
+    \x1 ->
+      \x2 ->
+        \x3 ->
+          \x4 ->
+            fmap BG.fromFFIType (hs_bindgen_371e0d86cbe6ddc1_base (BG.toFFIType x0) (BG.toFFIType x1) (BG.toFFIType x2) (BG.toFFIType x3) (BG.toFFIType x4))
+
+{-| __C declaration:__ @duckdb_v2_file_system_path_expand@
+
+    __defined at:__ @duckdb_v2.h 3084:30@
+
+    __exported by:__ @duckdb_v2.h@
+-}
+c_duckdb_v2_file_system_path_expand ::
+     DuckDBV2FileSystemHandle
+     -- ^ __C declaration:__ @file_system@
+  -> PtrConst.PtrConst DuckDBV2Str
+     -- ^ __C declaration:__ @path@
+  -> DuckDBV2TextSinkFn
+     -- ^ __C declaration:__ @sink@
+  -> BG.Ptr BG.Void
+     -- ^ __C declaration:__ @user_data@
+  -> BG.Ptr DuckDBV2ErrorInfoHandle
+     -- ^ __C declaration:__ @err@
+  -> IO DuckDBV2Error
+c_duckdb_v2_file_system_path_expand =
+  hs_bindgen_371e0d86cbe6ddc1
+
+-- __unique:__ @Database_DuckDB_FFI_V2_Database.DuckDB.FFI.V2_Safe_duckdb_v2_file_system_path_glob@
+foreign import ccall safe "hs_bindgen_7d20eee7c5ccd236" hs_bindgen_7d20eee7c5ccd236_base ::
+     BG.Ptr BG.Void
+  -> BG.Ptr BG.Void
+  -> BG.FunPtr BG.Void
+  -> BG.Ptr BG.Void
+  -> BG.Ptr BG.Void
+  -> IO BG.CUInt
+
+-- __unique:__ @Database_DuckDB_FFI_V2_Database.DuckDB.FFI.V2_Safe_duckdb_v2_file_system_path_glob@
+hs_bindgen_7d20eee7c5ccd236 ::
+     DuckDBV2FileSystemHandle
+  -> PtrConst.PtrConst DuckDBV2Str
+  -> DuckDBV2FileSystemPathGlobCallbackFn
+  -> BG.Ptr BG.Void
+  -> BG.Ptr DuckDBV2ErrorInfoHandle
+  -> IO DuckDBV2Error
+hs_bindgen_7d20eee7c5ccd236 =
+  \x0 ->
+    \x1 ->
+      \x2 ->
+        \x3 ->
+          \x4 ->
+            fmap BG.fromFFIType (hs_bindgen_7d20eee7c5ccd236_base (BG.toFFIType x0) (BG.toFFIType x1) (BG.toFFIType x2) (BG.toFFIType x3) (BG.toFFIType x4))
+
+{-| __C declaration:__ @duckdb_v2_file_system_path_glob@
+
+    __defined at:__ @duckdb_v2.h 3110:30@
+
+    __exported by:__ @duckdb_v2.h@
+-}
+c_duckdb_v2_file_system_path_glob ::
+     DuckDBV2FileSystemHandle
+     -- ^ __C declaration:__ @file_system@
+  -> PtrConst.PtrConst DuckDBV2Str
+     -- ^ __C declaration:__ @pattern@
+  -> DuckDBV2FileSystemPathGlobCallbackFn
+     -- ^ __C declaration:__ @callback@
+  -> BG.Ptr BG.Void
+     -- ^ __C declaration:__ @user_data@
+  -> BG.Ptr DuckDBV2ErrorInfoHandle
+     -- ^ __C declaration:__ @err@
+  -> IO DuckDBV2Error
+c_duckdb_v2_file_system_path_glob =
+  hs_bindgen_7d20eee7c5ccd236
+
+-- __unique:__ @Database_DuckDB_FFI_V2_Database.DuckDB.FFI.V2_Safe_duckdb_v2_file_system_path_move@
+foreign import ccall safe "hs_bindgen_d565d6819ab07083" hs_bindgen_d565d6819ab07083_base ::
+     BG.Ptr BG.Void
+  -> BG.Ptr BG.Void
+  -> BG.Ptr BG.Void
+  -> BG.Ptr BG.Void
+  -> IO BG.CUInt
+
+-- __unique:__ @Database_DuckDB_FFI_V2_Database.DuckDB.FFI.V2_Safe_duckdb_v2_file_system_path_move@
+hs_bindgen_d565d6819ab07083 ::
+     DuckDBV2FileSystemHandle
+  -> PtrConst.PtrConst DuckDBV2Str
+  -> PtrConst.PtrConst DuckDBV2Str
+  -> BG.Ptr DuckDBV2ErrorInfoHandle
+  -> IO DuckDBV2Error
+hs_bindgen_d565d6819ab07083 =
+  \x0 ->
+    \x1 ->
+      \x2 ->
+        \x3 ->
+          fmap BG.fromFFIType (hs_bindgen_d565d6819ab07083_base (BG.toFFIType x0) (BG.toFFIType x1) (BG.toFFIType x2) (BG.toFFIType x3))
+
+{-| __C declaration:__ @duckdb_v2_file_system_path_move@
+
+    __defined at:__ @duckdb_v2.h 3134:30@
+
+    __exported by:__ @duckdb_v2.h@
+-}
+c_duckdb_v2_file_system_path_move ::
+     DuckDBV2FileSystemHandle
+     -- ^ __C declaration:__ @file_system@
+  -> PtrConst.PtrConst DuckDBV2Str
+     -- ^ __C declaration:__ @source@
+  -> PtrConst.PtrConst DuckDBV2Str
+     -- ^ __C declaration:__ @target@
+  -> BG.Ptr DuckDBV2ErrorInfoHandle
+     -- ^ __C declaration:__ @err@
+  -> IO DuckDBV2Error
+c_duckdb_v2_file_system_path_move =
+  hs_bindgen_d565d6819ab07083
+
+-- __unique:__ @Database_DuckDB_FFI_V2_Database.DuckDB.FFI.V2_Safe_duckdb_v2_file_system_path_remove@
+foreign import ccall safe "hs_bindgen_0c10dec5f12a1394" hs_bindgen_0c10dec5f12a1394_base ::
+     BG.Ptr BG.Void
+  -> BG.Ptr BG.Void
+  -> BG.Ptr BG.Void
+  -> BG.Ptr BG.Void
+  -> IO BG.CUInt
+
+-- __unique:__ @Database_DuckDB_FFI_V2_Database.DuckDB.FFI.V2_Safe_duckdb_v2_file_system_path_remove@
+hs_bindgen_0c10dec5f12a1394 ::
+     DuckDBV2FileSystemHandle
+  -> PtrConst.PtrConst DuckDBV2Str
+  -> BG.Ptr BG.CBool
+  -> BG.Ptr DuckDBV2ErrorInfoHandle
+  -> IO DuckDBV2Error
+hs_bindgen_0c10dec5f12a1394 =
+  \x0 ->
+    \x1 ->
+      \x2 ->
+        \x3 ->
+          fmap BG.fromFFIType (hs_bindgen_0c10dec5f12a1394_base (BG.toFFIType x0) (BG.toFFIType x1) (BG.toFFIType x2) (BG.toFFIType x3))
+
+{-| __C declaration:__ @duckdb_v2_file_system_path_remove@
+
+    __defined at:__ @duckdb_v2.h 3156:30@
+
+    __exported by:__ @duckdb_v2.h@
+-}
+c_duckdb_v2_file_system_path_remove ::
+     DuckDBV2FileSystemHandle
+     -- ^ __C declaration:__ @file_system@
+  -> PtrConst.PtrConst DuckDBV2Str
+     -- ^ __C declaration:__ @path@
+  -> BG.Ptr BG.CBool
+     -- ^ __C declaration:__ @out_removed@
+  -> BG.Ptr DuckDBV2ErrorInfoHandle
+     -- ^ __C declaration:__ @err@
+  -> IO DuckDBV2Error
+c_duckdb_v2_file_system_path_remove =
+  hs_bindgen_0c10dec5f12a1394
+
+-- __unique:__ @Database_DuckDB_FFI_V2_Database.DuckDB.FFI.V2_Safe_duckdb_v2_file_read@
+foreign import ccall safe "hs_bindgen_52c313658d6f37ba" hs_bindgen_52c313658d6f37ba_base ::
+     BG.Ptr BG.Void
+  -> BG.Ptr BG.Void
+  -> HsBindgen.Runtime.LibC.Word64
+  -> BG.Ptr BG.Void
+  -> BG.Ptr BG.Void
+  -> IO BG.CUInt
+
+-- __unique:__ @Database_DuckDB_FFI_V2_Database.DuckDB.FFI.V2_Safe_duckdb_v2_file_read@
+hs_bindgen_52c313658d6f37ba ::
+     DuckDBV2FileHandle
+  -> BG.Ptr BG.Void
+  -> DuckDBIdx
+  -> BG.Ptr DuckDBIdx
+  -> BG.Ptr DuckDBV2ErrorInfoHandle
+  -> IO DuckDBV2Error
+hs_bindgen_52c313658d6f37ba =
+  \x0 ->
+    \x1 ->
+      \x2 ->
+        \x3 ->
+          \x4 ->
+            fmap BG.fromFFIType (hs_bindgen_52c313658d6f37ba_base (BG.toFFIType x0) (BG.toFFIType x1) (BG.toFFIType x2) (BG.toFFIType x3) (BG.toFFIType x4))
+
+{-| __C declaration:__ @duckdb_v2_file_read@
+
+    __defined at:__ @duckdb_v2.h 3184:30@
+
+    __exported by:__ @duckdb_v2.h@
+-}
+c_duckdb_v2_file_read ::
+     DuckDBV2FileHandle
+     -- ^ __C declaration:__ @file@
+  -> BG.Ptr BG.Void
+     -- ^ __C declaration:__ @buffer@
+  -> DuckDBIdx
+     -- ^ __C declaration:__ @buffer_size@
+  -> BG.Ptr DuckDBIdx
+     -- ^ __C declaration:__ @bytes_read@
+  -> BG.Ptr DuckDBV2ErrorInfoHandle
+     -- ^ __C declaration:__ @err@
+  -> IO DuckDBV2Error
+c_duckdb_v2_file_read = hs_bindgen_52c313658d6f37ba
+
+-- __unique:__ @Database_DuckDB_FFI_V2_Database.DuckDB.FFI.V2_Safe_duckdb_v2_file_write@
+foreign import ccall safe "hs_bindgen_bed92f205a27136a" hs_bindgen_bed92f205a27136a_base ::
+     BG.Ptr BG.Void
+  -> BG.Ptr BG.Void
+  -> HsBindgen.Runtime.LibC.Word64
+  -> BG.Ptr BG.Void
+  -> BG.Ptr BG.Void
+  -> IO BG.CUInt
+
+-- __unique:__ @Database_DuckDB_FFI_V2_Database.DuckDB.FFI.V2_Safe_duckdb_v2_file_write@
+hs_bindgen_bed92f205a27136a ::
+     DuckDBV2FileHandle
+  -> PtrConst.PtrConst BG.Void
+  -> DuckDBIdx
+  -> BG.Ptr DuckDBIdx
+  -> BG.Ptr DuckDBV2ErrorInfoHandle
+  -> IO DuckDBV2Error
+hs_bindgen_bed92f205a27136a =
+  \x0 ->
+    \x1 ->
+      \x2 ->
+        \x3 ->
+          \x4 ->
+            fmap BG.fromFFIType (hs_bindgen_bed92f205a27136a_base (BG.toFFIType x0) (BG.toFFIType x1) (BG.toFFIType x2) (BG.toFFIType x3) (BG.toFFIType x4))
+
+{-| __C declaration:__ @duckdb_v2_file_write@
+
+    __defined at:__ @duckdb_v2.h 3210:30@
+
+    __exported by:__ @duckdb_v2.h@
+-}
+c_duckdb_v2_file_write ::
+     DuckDBV2FileHandle
+     -- ^ __C declaration:__ @file@
+  -> PtrConst.PtrConst BG.Void
+     -- ^ __C declaration:__ @buffer@
+  -> DuckDBIdx
+     -- ^ __C declaration:__ @buffer_size@
+  -> BG.Ptr DuckDBIdx
+     -- ^ __C declaration:__ @bytes_written@
+  -> BG.Ptr DuckDBV2ErrorInfoHandle
+     -- ^ __C declaration:__ @err@
+  -> IO DuckDBV2Error
+c_duckdb_v2_file_write = hs_bindgen_bed92f205a27136a
+
+-- __unique:__ @Database_DuckDB_FFI_V2_Database.DuckDB.FFI.V2_Safe_duckdb_v2_file_read_at@
+foreign import ccall safe "hs_bindgen_937b677782a1e78a" hs_bindgen_937b677782a1e78a_base ::
+     BG.Ptr BG.Void
+  -> BG.Ptr BG.Void
+  -> HsBindgen.Runtime.LibC.Word64
+  -> HsBindgen.Runtime.LibC.Word64
+  -> BG.Ptr BG.Void
+  -> IO BG.CUInt
+
+-- __unique:__ @Database_DuckDB_FFI_V2_Database.DuckDB.FFI.V2_Safe_duckdb_v2_file_read_at@
+hs_bindgen_937b677782a1e78a ::
+     DuckDBV2FileHandle
+  -> BG.Ptr BG.Void
+  -> DuckDBIdx
+  -> DuckDBIdx
+  -> BG.Ptr DuckDBV2ErrorInfoHandle
+  -> IO DuckDBV2Error
+hs_bindgen_937b677782a1e78a =
+  \x0 ->
+    \x1 ->
+      \x2 ->
+        \x3 ->
+          \x4 ->
+            fmap BG.fromFFIType (hs_bindgen_937b677782a1e78a_base (BG.toFFIType x0) (BG.toFFIType x1) (BG.toFFIType x2) (BG.toFFIType x3) (BG.toFFIType x4))
+
+{-| __C declaration:__ @duckdb_v2_file_read_at@
+
+    __defined at:__ @duckdb_v2.h 3236:30@
+
+    __exported by:__ @duckdb_v2.h@
+-}
+c_duckdb_v2_file_read_at ::
+     DuckDBV2FileHandle
+     -- ^ __C declaration:__ @file@
+  -> BG.Ptr BG.Void
+     -- ^ __C declaration:__ @buffer@
+  -> DuckDBIdx
+     -- ^ __C declaration:__ @buffer_size@
+  -> DuckDBIdx
+     -- ^ __C declaration:__ @location@
+  -> BG.Ptr DuckDBV2ErrorInfoHandle
+     -- ^ __C declaration:__ @err@
+  -> IO DuckDBV2Error
+c_duckdb_v2_file_read_at =
+  hs_bindgen_937b677782a1e78a
+
+-- __unique:__ @Database_DuckDB_FFI_V2_Database.DuckDB.FFI.V2_Safe_duckdb_v2_file_write_at@
+foreign import ccall safe "hs_bindgen_15bd243f5702e4f2" hs_bindgen_15bd243f5702e4f2_base ::
+     BG.Ptr BG.Void
+  -> BG.Ptr BG.Void
+  -> HsBindgen.Runtime.LibC.Word64
+  -> HsBindgen.Runtime.LibC.Word64
+  -> BG.Ptr BG.Void
+  -> IO BG.CUInt
+
+-- __unique:__ @Database_DuckDB_FFI_V2_Database.DuckDB.FFI.V2_Safe_duckdb_v2_file_write_at@
+hs_bindgen_15bd243f5702e4f2 ::
+     DuckDBV2FileHandle
+  -> PtrConst.PtrConst BG.Void
+  -> DuckDBIdx
+  -> DuckDBIdx
+  -> BG.Ptr DuckDBV2ErrorInfoHandle
+  -> IO DuckDBV2Error
+hs_bindgen_15bd243f5702e4f2 =
+  \x0 ->
+    \x1 ->
+      \x2 ->
+        \x3 ->
+          \x4 ->
+            fmap BG.fromFFIType (hs_bindgen_15bd243f5702e4f2_base (BG.toFFIType x0) (BG.toFFIType x1) (BG.toFFIType x2) (BG.toFFIType x3) (BG.toFFIType x4))
+
+{-| __C declaration:__ @duckdb_v2_file_write_at@
+
+    __defined at:__ @duckdb_v2.h 3263:30@
+
+    __exported by:__ @duckdb_v2.h@
+-}
+c_duckdb_v2_file_write_at ::
+     DuckDBV2FileHandle
+     -- ^ __C declaration:__ @file@
+  -> PtrConst.PtrConst BG.Void
+     -- ^ __C declaration:__ @buffer@
+  -> DuckDBIdx
+     -- ^ __C declaration:__ @buffer_size@
+  -> DuckDBIdx
+     -- ^ __C declaration:__ @location@
+  -> BG.Ptr DuckDBV2ErrorInfoHandle
+     -- ^ __C declaration:__ @err@
+  -> IO DuckDBV2Error
+c_duckdb_v2_file_write_at =
+  hs_bindgen_15bd243f5702e4f2
+
+-- __unique:__ @Database_DuckDB_FFI_V2_Database.DuckDB.FFI.V2_Safe_duckdb_v2_file_tell@
+foreign import ccall safe "hs_bindgen_f5bb93448c5f8957" hs_bindgen_f5bb93448c5f8957_base ::
+     BG.Ptr BG.Void
+  -> BG.Ptr BG.Void
+  -> BG.Ptr BG.Void
+  -> IO BG.CUInt
+
+-- __unique:__ @Database_DuckDB_FFI_V2_Database.DuckDB.FFI.V2_Safe_duckdb_v2_file_tell@
+hs_bindgen_f5bb93448c5f8957 ::
+     DuckDBV2FileHandle
+  -> BG.Ptr DuckDBIdx
+  -> BG.Ptr DuckDBV2ErrorInfoHandle
+  -> IO DuckDBV2Error
+hs_bindgen_f5bb93448c5f8957 =
+  \x0 ->
+    \x1 ->
+      \x2 ->
+        fmap BG.fromFFIType (hs_bindgen_f5bb93448c5f8957_base (BG.toFFIType x0) (BG.toFFIType x1) (BG.toFFIType x2))
+
+{-| __C declaration:__ @duckdb_v2_file_tell@
+
+    __defined at:__ @duckdb_v2.h 3280:30@
+
+    __exported by:__ @duckdb_v2.h@
+-}
+c_duckdb_v2_file_tell ::
+     DuckDBV2FileHandle
+     -- ^ __C declaration:__ @file@
+  -> BG.Ptr DuckDBIdx
+     -- ^ __C declaration:__ @position@
+  -> BG.Ptr DuckDBV2ErrorInfoHandle
+     -- ^ __C declaration:__ @err@
+  -> IO DuckDBV2Error
+c_duckdb_v2_file_tell = hs_bindgen_f5bb93448c5f8957
+
+-- __unique:__ @Database_DuckDB_FFI_V2_Database.DuckDB.FFI.V2_Safe_duckdb_v2_file_size@
+foreign import ccall safe "hs_bindgen_75b07ce11b78f1d6" hs_bindgen_75b07ce11b78f1d6_base ::
+     BG.Ptr BG.Void
+  -> BG.Ptr BG.Void
+  -> BG.Ptr BG.Void
+  -> IO BG.CUInt
+
+-- __unique:__ @Database_DuckDB_FFI_V2_Database.DuckDB.FFI.V2_Safe_duckdb_v2_file_size@
+hs_bindgen_75b07ce11b78f1d6 ::
+     DuckDBV2FileHandle
+  -> BG.Ptr DuckDBIdx
+  -> BG.Ptr DuckDBV2ErrorInfoHandle
+  -> IO DuckDBV2Error
+hs_bindgen_75b07ce11b78f1d6 =
+  \x0 ->
+    \x1 ->
+      \x2 ->
+        fmap BG.fromFFIType (hs_bindgen_75b07ce11b78f1d6_base (BG.toFFIType x0) (BG.toFFIType x1) (BG.toFFIType x2))
+
+{-| __C declaration:__ @duckdb_v2_file_size@
+
+    __defined at:__ @duckdb_v2.h 3297:30@
+
+    __exported by:__ @duckdb_v2.h@
+-}
+c_duckdb_v2_file_size ::
+     DuckDBV2FileHandle
+     -- ^ __C declaration:__ @file@
+  -> BG.Ptr DuckDBIdx
+     -- ^ __C declaration:__ @size@
+  -> BG.Ptr DuckDBV2ErrorInfoHandle
+     -- ^ __C declaration:__ @err@
+  -> IO DuckDBV2Error
+c_duckdb_v2_file_size = hs_bindgen_75b07ce11b78f1d6
+
+-- __unique:__ @Database_DuckDB_FFI_V2_Database.DuckDB.FFI.V2_Safe_duckdb_v2_file_seek@
+foreign import ccall safe "hs_bindgen_26d8df7e33d02083" hs_bindgen_26d8df7e33d02083_base ::
+     BG.Ptr BG.Void
+  -> HsBindgen.Runtime.LibC.Word64
+  -> BG.Ptr BG.Void
+  -> IO BG.CUInt
+
+-- __unique:__ @Database_DuckDB_FFI_V2_Database.DuckDB.FFI.V2_Safe_duckdb_v2_file_seek@
+hs_bindgen_26d8df7e33d02083 ::
+     DuckDBV2FileHandle
+  -> DuckDBIdx
+  -> BG.Ptr DuckDBV2ErrorInfoHandle
+  -> IO DuckDBV2Error
+hs_bindgen_26d8df7e33d02083 =
+  \x0 ->
+    \x1 ->
+      \x2 ->
+        fmap BG.fromFFIType (hs_bindgen_26d8df7e33d02083_base (BG.toFFIType x0) (BG.toFFIType x1) (BG.toFFIType x2))
+
+{-| __C declaration:__ @duckdb_v2_file_seek@
+
+    __defined at:__ @duckdb_v2.h 3317:30@
+
+    __exported by:__ @duckdb_v2.h@
+-}
+c_duckdb_v2_file_seek ::
+     DuckDBV2FileHandle
+     -- ^ __C declaration:__ @file@
+  -> DuckDBIdx
+     -- ^ __C declaration:__ @position@
+  -> BG.Ptr DuckDBV2ErrorInfoHandle
+     -- ^ __C declaration:__ @err@
+  -> IO DuckDBV2Error
+c_duckdb_v2_file_seek = hs_bindgen_26d8df7e33d02083
+
+-- __unique:__ @Database_DuckDB_FFI_V2_Database.DuckDB.FFI.V2_Safe_duckdb_v2_file_sync@
+foreign import ccall safe "hs_bindgen_0c19ed1ebed8cac7" hs_bindgen_0c19ed1ebed8cac7_base ::
+     BG.Ptr BG.Void
+  -> BG.Ptr BG.Void
+  -> IO BG.CUInt
+
+-- __unique:__ @Database_DuckDB_FFI_V2_Database.DuckDB.FFI.V2_Safe_duckdb_v2_file_sync@
+hs_bindgen_0c19ed1ebed8cac7 ::
+     DuckDBV2FileHandle
+  -> BG.Ptr DuckDBV2ErrorInfoHandle
+  -> IO DuckDBV2Error
+hs_bindgen_0c19ed1ebed8cac7 =
+  \x0 ->
+    \x1 ->
+      fmap BG.fromFFIType (hs_bindgen_0c19ed1ebed8cac7_base (BG.toFFIType x0) (BG.toFFIType x1))
+
+{-| __C declaration:__ @duckdb_v2_file_sync@
+
+    __defined at:__ @duckdb_v2.h 3336:30@
+
+    __exported by:__ @duckdb_v2.h@
+-}
+c_duckdb_v2_file_sync ::
+     DuckDBV2FileHandle
+     -- ^ __C declaration:__ @file@
+  -> BG.Ptr DuckDBV2ErrorInfoHandle
+     -- ^ __C declaration:__ @err@
+  -> IO DuckDBV2Error
+c_duckdb_v2_file_sync = hs_bindgen_0c19ed1ebed8cac7
+
+-- __unique:__ @Database_DuckDB_FFI_V2_Database.DuckDB.FFI.V2_Safe_duckdb_v2_file_close@
+foreign import ccall safe "hs_bindgen_b7b4550fbf8627f4" hs_bindgen_b7b4550fbf8627f4_base ::
+     BG.Ptr BG.Void
+  -> BG.Ptr BG.Void
+  -> IO BG.CUInt
+
+-- __unique:__ @Database_DuckDB_FFI_V2_Database.DuckDB.FFI.V2_Safe_duckdb_v2_file_close@
+hs_bindgen_b7b4550fbf8627f4 ::
+     DuckDBV2FileHandle
+  -> BG.Ptr DuckDBV2ErrorInfoHandle
+  -> IO DuckDBV2Error
+hs_bindgen_b7b4550fbf8627f4 =
+  \x0 ->
+    \x1 ->
+      fmap BG.fromFFIType (hs_bindgen_b7b4550fbf8627f4_base (BG.toFFIType x0) (BG.toFFIType x1))
+
+{-| __C declaration:__ @duckdb_v2_file_close@
+
+    __defined at:__ @duckdb_v2.h 3354:30@
+
+    __exported by:__ @duckdb_v2.h@
+-}
+c_duckdb_v2_file_close ::
+     DuckDBV2FileHandle
+     -- ^ __C declaration:__ @file@
+  -> BG.Ptr DuckDBV2ErrorInfoHandle
+     -- ^ __C declaration:__ @err@
+  -> IO DuckDBV2Error
+c_duckdb_v2_file_close = hs_bindgen_b7b4550fbf8627f4
+
+-- __unique:__ @Database_DuckDB_FFI_V2_Database.DuckDB.FFI.V2_Safe_duckdb_v2_file_destroy@
+foreign import ccall safe "hs_bindgen_5c6f7b7ba5c2bc2c" hs_bindgen_5c6f7b7ba5c2bc2c_base ::
+     BG.Ptr BG.Void
+  -> IO BG.CUInt
+
+-- __unique:__ @Database_DuckDB_FFI_V2_Database.DuckDB.FFI.V2_Safe_duckdb_v2_file_destroy@
+hs_bindgen_5c6f7b7ba5c2bc2c ::
+     BG.Ptr DuckDBV2FileHandle
+  -> IO DuckDBV2Error
+hs_bindgen_5c6f7b7ba5c2bc2c =
+  \x0 ->
+    fmap BG.fromFFIType (hs_bindgen_5c6f7b7ba5c2bc2c_base (BG.toFFIType x0))
+
+{-| __C declaration:__ @duckdb_v2_file_destroy@
+
+    __defined at:__ @duckdb_v2.h 3370:30@
+
+    __exported by:__ @duckdb_v2.h@
+-}
+c_duckdb_v2_file_destroy ::
+     BG.Ptr DuckDBV2FileHandle
+     -- ^ __C declaration:__ @file@
+  -> IO DuckDBV2Error
+c_duckdb_v2_file_destroy =
+  hs_bindgen_5c6f7b7ba5c2bc2c
+
+-- __unique:__ @Database_DuckDB_FFI_V2_Database.DuckDB.FFI.V2_Safe_duckdb_v2_function_bind_get_user_data@
+foreign import ccall safe "hs_bindgen_4616f88449a9cdf2" hs_bindgen_4616f88449a9cdf2_base ::
+     BG.Ptr BG.Void
+  -> BG.Ptr BG.Void
+  -> BG.Ptr BG.Void
+  -> IO BG.CUInt
+
+-- __unique:__ @Database_DuckDB_FFI_V2_Database.DuckDB.FFI.V2_Safe_duckdb_v2_function_bind_get_user_data@
+hs_bindgen_4616f88449a9cdf2 ::
+     DuckDBV2FunctionBindInfoHandle
+  -> BG.Ptr (BG.Ptr BG.Void)
+  -> BG.Ptr DuckDBV2ErrorInfoHandle
+  -> IO DuckDBV2Error
+hs_bindgen_4616f88449a9cdf2 =
+  \x0 ->
+    \x1 ->
+      \x2 ->
+        fmap BG.fromFFIType (hs_bindgen_4616f88449a9cdf2_base (BG.toFFIType x0) (BG.toFFIType x1) (BG.toFFIType x2))
+
+{-| __C declaration:__ @duckdb_v2_function_bind_get_user_data@
+
+    __defined at:__ @duckdb_v2.h 3419:30@
+
+    __exported by:__ @duckdb_v2.h@
+-}
+c_duckdb_v2_function_bind_get_user_data ::
+     DuckDBV2FunctionBindInfoHandle
+     -- ^ __C declaration:__ @info@
+  -> BG.Ptr (BG.Ptr BG.Void)
+     -- ^ __C declaration:__ @data@
+  -> BG.Ptr DuckDBV2ErrorInfoHandle
+     -- ^ __C declaration:__ @err@
+  -> IO DuckDBV2Error
+c_duckdb_v2_function_bind_get_user_data =
+  hs_bindgen_4616f88449a9cdf2
+
+-- __unique:__ @Database_DuckDB_FFI_V2_Database.DuckDB.FFI.V2_Safe_duckdb_v2_function_bind_set_bind_data@
+foreign import ccall safe "hs_bindgen_5616d90ac6da1a33" hs_bindgen_5616d90ac6da1a33_base ::
+     BG.Ptr BG.Void
+  -> BG.Ptr BG.Void
+  -> BG.Ptr BG.Void
+  -> IO BG.CUInt
+
+-- __unique:__ @Database_DuckDB_FFI_V2_Database.DuckDB.FFI.V2_Safe_duckdb_v2_function_bind_set_bind_data@
+hs_bindgen_5616d90ac6da1a33 ::
+     DuckDBV2FunctionBindInfoHandle
+  -> BG.Ptr DuckDBV2Opaque
+  -> BG.Ptr DuckDBV2ErrorInfoHandle
+  -> IO DuckDBV2Error
+hs_bindgen_5616d90ac6da1a33 =
+  \x0 ->
+    \x1 ->
+      \x2 ->
+        fmap BG.fromFFIType (hs_bindgen_5616d90ac6da1a33_base (BG.toFFIType x0) (BG.toFFIType x1) (BG.toFFIType x2))
+
+{-| __C declaration:__ @duckdb_v2_function_bind_set_bind_data@
+
+    __defined at:__ @duckdb_v2.h 3441:30@
+
+    __exported by:__ @duckdb_v2.h@
+-}
+c_duckdb_v2_function_bind_set_bind_data ::
+     DuckDBV2FunctionBindInfoHandle
+     -- ^ __C declaration:__ @info@
+  -> BG.Ptr DuckDBV2Opaque
+     -- ^ __C declaration:__ @data@
+  -> BG.Ptr DuckDBV2ErrorInfoHandle
+     -- ^ __C declaration:__ @err@
+  -> IO DuckDBV2Error
+c_duckdb_v2_function_bind_set_bind_data =
+  hs_bindgen_5616d90ac6da1a33
+
+-- __unique:__ @Database_DuckDB_FFI_V2_Database.DuckDB.FFI.V2_Safe_duckdb_v2_function_bind_get_arg_count@
+foreign import ccall safe "hs_bindgen_3a58dcb29442c12d" hs_bindgen_3a58dcb29442c12d_base ::
+     BG.Ptr BG.Void
+  -> BG.Ptr BG.Void
+  -> BG.Ptr BG.Void
+  -> BG.Ptr BG.Void
+  -> BG.Ptr BG.Void
+  -> BG.Ptr BG.Void
+  -> IO BG.CUInt
+
+-- __unique:__ @Database_DuckDB_FFI_V2_Database.DuckDB.FFI.V2_Safe_duckdb_v2_function_bind_get_arg_count@
+hs_bindgen_3a58dcb29442c12d ::
+     DuckDBV2FunctionBindInfoHandle
+  -> BG.Ptr DuckDBIdx
+  -> BG.Ptr DuckDBIdx
+  -> BG.Ptr DuckDBIdx
+  -> BG.Ptr DuckDBIdx
+  -> BG.Ptr DuckDBV2ErrorInfoHandle
+  -> IO DuckDBV2Error
+hs_bindgen_3a58dcb29442c12d =
+  \x0 ->
+    \x1 ->
+      \x2 ->
+        \x3 ->
+          \x4 ->
+            \x5 ->
+              fmap BG.fromFFIType (hs_bindgen_3a58dcb29442c12d_base (BG.toFFIType x0) (BG.toFFIType x1) (BG.toFFIType x2) (BG.toFFIType x3) (BG.toFFIType x4) (BG.toFFIType x5))
+
+{-| __C declaration:__ @duckdb_v2_function_bind_get_arg_count@
+
+    __defined at:__ @duckdb_v2.h 3469:30@
+
+    __exported by:__ @duckdb_v2.h@
+-}
+c_duckdb_v2_function_bind_get_arg_count ::
+     DuckDBV2FunctionBindInfoHandle
+     -- ^ __C declaration:__ @info@
+  -> BG.Ptr DuckDBIdx
+     -- ^ __C declaration:__ @positional_fixed@
+  -> BG.Ptr DuckDBIdx
+     -- ^ __C declaration:__ @positional_variadic@
+  -> BG.Ptr DuckDBIdx
+     -- ^ __C declaration:__ @named_fixed@
+  -> BG.Ptr DuckDBIdx
+     -- ^ __C declaration:__ @named_variadic@
+  -> BG.Ptr DuckDBV2ErrorInfoHandle
+     -- ^ __C declaration:__ @err@
+  -> IO DuckDBV2Error
+c_duckdb_v2_function_bind_get_arg_count =
+  hs_bindgen_3a58dcb29442c12d
+
+-- __unique:__ @Database_DuckDB_FFI_V2_Database.DuckDB.FFI.V2_Safe_duckdb_v2_function_bind_get_arg_type@
+foreign import ccall safe "hs_bindgen_511e5a20beee3a30" hs_bindgen_511e5a20beee3a30_base ::
+     BG.Ptr BG.Void
+  -> HsBindgen.Runtime.LibC.Word64
+  -> BG.Ptr BG.Void
+  -> BG.Ptr BG.Void
+  -> IO BG.CUInt
+
+-- __unique:__ @Database_DuckDB_FFI_V2_Database.DuckDB.FFI.V2_Safe_duckdb_v2_function_bind_get_arg_type@
+hs_bindgen_511e5a20beee3a30 ::
+     DuckDBV2FunctionBindInfoHandle
+  -> DuckDBIdx
+  -> BG.Ptr DuckDBV2LogicalTypeHandle
+  -> BG.Ptr DuckDBV2ErrorInfoHandle
+  -> IO DuckDBV2Error
+hs_bindgen_511e5a20beee3a30 =
+  \x0 ->
+    \x1 ->
+      \x2 ->
+        \x3 ->
+          fmap BG.fromFFIType (hs_bindgen_511e5a20beee3a30_base (BG.toFFIType x0) (BG.toFFIType x1) (BG.toFFIType x2) (BG.toFFIType x3))
+
+{-| __C declaration:__ @duckdb_v2_function_bind_get_arg_type@
+
+    __defined at:__ @duckdb_v2.h 3492:30@
+
+    __exported by:__ @duckdb_v2.h@
+-}
+c_duckdb_v2_function_bind_get_arg_type ::
+     DuckDBV2FunctionBindInfoHandle
+     -- ^ __C declaration:__ @info@
+  -> DuckDBIdx
+     -- ^ __C declaration:__ @index@
+  -> BG.Ptr DuckDBV2LogicalTypeHandle
+     -- ^ __C declaration:__ @type@
+  -> BG.Ptr DuckDBV2ErrorInfoHandle
+     -- ^ __C declaration:__ @err@
+  -> IO DuckDBV2Error
+c_duckdb_v2_function_bind_get_arg_type =
+  hs_bindgen_511e5a20beee3a30
+
+-- __unique:__ @Database_DuckDB_FFI_V2_Database.DuckDB.FFI.V2_Safe_duckdb_v2_function_bind_get_arg_value@
+foreign import ccall safe "hs_bindgen_80de77fffc115749" hs_bindgen_80de77fffc115749_base ::
+     BG.Ptr BG.Void
+  -> HsBindgen.Runtime.LibC.Word64
+  -> BG.Ptr BG.Void
+  -> BG.Ptr BG.Void
+  -> IO BG.CUInt
+
+-- __unique:__ @Database_DuckDB_FFI_V2_Database.DuckDB.FFI.V2_Safe_duckdb_v2_function_bind_get_arg_value@
+hs_bindgen_80de77fffc115749 ::
+     DuckDBV2FunctionBindInfoHandle
+  -> DuckDBIdx
+  -> BG.Ptr DuckDBV2ValueHandle
+  -> BG.Ptr DuckDBV2ErrorInfoHandle
+  -> IO DuckDBV2Error
+hs_bindgen_80de77fffc115749 =
+  \x0 ->
+    \x1 ->
+      \x2 ->
+        \x3 ->
+          fmap BG.fromFFIType (hs_bindgen_80de77fffc115749_base (BG.toFFIType x0) (BG.toFFIType x1) (BG.toFFIType x2) (BG.toFFIType x3))
+
+{-| __C declaration:__ @duckdb_v2_function_bind_get_arg_value@
+
+    __defined at:__ @duckdb_v2.h 3515:30@
+
+    __exported by:__ @duckdb_v2.h@
+-}
+c_duckdb_v2_function_bind_get_arg_value ::
+     DuckDBV2FunctionBindInfoHandle
+     -- ^ __C declaration:__ @info@
+  -> DuckDBIdx
+     -- ^ __C declaration:__ @index@
+  -> BG.Ptr DuckDBV2ValueHandle
+     -- ^ __C declaration:__ @value@
+  -> BG.Ptr DuckDBV2ErrorInfoHandle
+     -- ^ __C declaration:__ @err@
+  -> IO DuckDBV2Error
+c_duckdb_v2_function_bind_get_arg_value =
+  hs_bindgen_80de77fffc115749
+
+-- __unique:__ @Database_DuckDB_FFI_V2_Database.DuckDB.FFI.V2_Safe_duckdb_v2_function_bind_get_arg_name@
+foreign import ccall safe "hs_bindgen_0511a6b316270315" hs_bindgen_0511a6b316270315_base ::
+     BG.Ptr BG.Void
+  -> HsBindgen.Runtime.LibC.Word64
+  -> BG.Ptr BG.Void
+  -> BG.Ptr BG.Void
+  -> IO BG.CUInt
+
+-- __unique:__ @Database_DuckDB_FFI_V2_Database.DuckDB.FFI.V2_Safe_duckdb_v2_function_bind_get_arg_name@
+hs_bindgen_0511a6b316270315 ::
+     DuckDBV2FunctionBindInfoHandle
+  -> DuckDBIdx
+  -> BG.Ptr DuckDBV2IdentifierT
+  -> BG.Ptr DuckDBV2ErrorInfoHandle
+  -> IO DuckDBV2Error
+hs_bindgen_0511a6b316270315 =
+  \x0 ->
+    \x1 ->
+      \x2 ->
+        \x3 ->
+          fmap BG.fromFFIType (hs_bindgen_0511a6b316270315_base (BG.toFFIType x0) (BG.toFFIType x1) (BG.toFFIType x2) (BG.toFFIType x3))
+
+{-| __C declaration:__ @duckdb_v2_function_bind_get_arg_name@
+
+    __defined at:__ @duckdb_v2.h 3539:30@
+
+    __exported by:__ @duckdb_v2.h@
+-}
+c_duckdb_v2_function_bind_get_arg_name ::
+     DuckDBV2FunctionBindInfoHandle
+     -- ^ __C declaration:__ @info@
+  -> DuckDBIdx
+     -- ^ __C declaration:__ @index@
+  -> BG.Ptr DuckDBV2IdentifierT
+     -- ^ __C declaration:__ @name@
+  -> BG.Ptr DuckDBV2ErrorInfoHandle
+     -- ^ __C declaration:__ @err@
+  -> IO DuckDBV2Error
+c_duckdb_v2_function_bind_get_arg_name =
+  hs_bindgen_0511a6b316270315
+
+-- __unique:__ @Database_DuckDB_FFI_V2_Database.DuckDB.FFI.V2_Safe_duckdb_v2_function_bind_get_arg_index@
+foreign import ccall safe "hs_bindgen_a877f5bdc11a26db" hs_bindgen_a877f5bdc11a26db_base ::
+     BG.Ptr BG.Void
+  -> BG.Ptr BG.Void
+  -> BG.Ptr BG.Void
+  -> BG.Ptr BG.Void
+  -> BG.Ptr BG.Void
+  -> IO BG.CUInt
+
+-- __unique:__ @Database_DuckDB_FFI_V2_Database.DuckDB.FFI.V2_Safe_duckdb_v2_function_bind_get_arg_index@
+hs_bindgen_a877f5bdc11a26db ::
+     DuckDBV2FunctionBindInfoHandle
+  -> PtrConst.PtrConst DuckDBV2IdentifierT
+  -> BG.Ptr DuckDBIdx
+  -> BG.Ptr BG.CBool
+  -> BG.Ptr DuckDBV2ErrorInfoHandle
+  -> IO DuckDBV2Error
+hs_bindgen_a877f5bdc11a26db =
+  \x0 ->
+    \x1 ->
+      \x2 ->
+        \x3 ->
+          \x4 ->
+            fmap BG.fromFFIType (hs_bindgen_a877f5bdc11a26db_base (BG.toFFIType x0) (BG.toFFIType x1) (BG.toFFIType x2) (BG.toFFIType x3) (BG.toFFIType x4))
+
+{-| __C declaration:__ @duckdb_v2_function_bind_get_arg_index@
+
+    __defined at:__ @duckdb_v2.h 3565:30@
+
+    __exported by:__ @duckdb_v2.h@
+-}
+c_duckdb_v2_function_bind_get_arg_index ::
+     DuckDBV2FunctionBindInfoHandle
+     -- ^ __C declaration:__ @info@
+  -> PtrConst.PtrConst DuckDBV2IdentifierT
+     -- ^ __C declaration:__ @name@
+  -> BG.Ptr DuckDBIdx
+     -- ^ __C declaration:__ @index@
+  -> BG.Ptr BG.CBool
+     -- ^ __C declaration:__ @found@
+  -> BG.Ptr DuckDBV2ErrorInfoHandle
+     -- ^ __C declaration:__ @err@
+  -> IO DuckDBV2Error
+c_duckdb_v2_function_bind_get_arg_index =
+  hs_bindgen_a877f5bdc11a26db
+
+-- __unique:__ @Database_DuckDB_FFI_V2_Database.DuckDB.FFI.V2_Safe_duckdb_v2_function_docs_set_description@
+foreign import ccall safe "hs_bindgen_812ff41ab1d4e439" hs_bindgen_812ff41ab1d4e439_base ::
+     BG.Ptr BG.Void
+  -> BG.Ptr BG.Void
+  -> BG.Ptr BG.Void
+  -> IO BG.CUInt
+
+-- __unique:__ @Database_DuckDB_FFI_V2_Database.DuckDB.FFI.V2_Safe_duckdb_v2_function_docs_set_description@
+hs_bindgen_812ff41ab1d4e439 ::
+     DuckDBV2FunctionDocsHandle
+  -> PtrConst.PtrConst DuckDBV2Str
+  -> BG.Ptr DuckDBV2ErrorInfoHandle
+  -> IO DuckDBV2Error
+hs_bindgen_812ff41ab1d4e439 =
+  \x0 ->
+    \x1 ->
+      \x2 ->
+        fmap BG.fromFFIType (hs_bindgen_812ff41ab1d4e439_base (BG.toFFIType x0) (BG.toFFIType x1) (BG.toFFIType x2))
+
+{-| __C declaration:__ @duckdb_v2_function_docs_set_description@
+
+    __defined at:__ @duckdb_v2.h 3614:30@
+
+    __exported by:__ @duckdb_v2.h@
+-}
+c_duckdb_v2_function_docs_set_description ::
+     DuckDBV2FunctionDocsHandle
+     -- ^ __C declaration:__ @docs@
+  -> PtrConst.PtrConst DuckDBV2Str
+     -- ^ __C declaration:__ @description@
+  -> BG.Ptr DuckDBV2ErrorInfoHandle
+     -- ^ __C declaration:__ @err@
+  -> IO DuckDBV2Error
+c_duckdb_v2_function_docs_set_description =
+  hs_bindgen_812ff41ab1d4e439
+
+-- __unique:__ @Database_DuckDB_FFI_V2_Database.DuckDB.FFI.V2_Safe_duckdb_v2_function_docs_add_example@
+foreign import ccall safe "hs_bindgen_d63b7ffdb1926c27" hs_bindgen_d63b7ffdb1926c27_base ::
+     BG.Ptr BG.Void
+  -> BG.Ptr BG.Void
+  -> BG.Ptr BG.Void
+  -> BG.Ptr BG.Void
+  -> IO BG.CUInt
+
+-- __unique:__ @Database_DuckDB_FFI_V2_Database.DuckDB.FFI.V2_Safe_duckdb_v2_function_docs_add_example@
+hs_bindgen_d63b7ffdb1926c27 ::
+     DuckDBV2FunctionDocsHandle
+  -> PtrConst.PtrConst DuckDBV2Str
+  -> PtrConst.PtrConst DuckDBV2Str
+  -> BG.Ptr DuckDBV2ErrorInfoHandle
+  -> IO DuckDBV2Error
+hs_bindgen_d63b7ffdb1926c27 =
+  \x0 ->
+    \x1 ->
+      \x2 ->
+        \x3 ->
+          fmap BG.fromFFIType (hs_bindgen_d63b7ffdb1926c27_base (BG.toFFIType x0) (BG.toFFIType x1) (BG.toFFIType x2) (BG.toFFIType x3))
+
+{-| __C declaration:__ @duckdb_v2_function_docs_add_example@
+
+    __defined at:__ @duckdb_v2.h 3635:30@
+
+    __exported by:__ @duckdb_v2.h@
+-}
+c_duckdb_v2_function_docs_add_example ::
+     DuckDBV2FunctionDocsHandle
+     -- ^ __C declaration:__ @docs@
+  -> PtrConst.PtrConst DuckDBV2Str
+     -- ^ __C declaration:__ @title@
+  -> PtrConst.PtrConst DuckDBV2Str
+     -- ^ __C declaration:__ @example@
+  -> BG.Ptr DuckDBV2ErrorInfoHandle
+     -- ^ __C declaration:__ @err@
+  -> IO DuckDBV2Error
+c_duckdb_v2_function_docs_add_example =
+  hs_bindgen_d63b7ffdb1926c27
+
+-- __unique:__ @Database_DuckDB_FFI_V2_Database.DuckDB.FFI.V2_Safe_duckdb_v2_function_docs_add_category@
+foreign import ccall safe "hs_bindgen_8c0ae6a612e9d656" hs_bindgen_8c0ae6a612e9d656_base ::
+     BG.Ptr BG.Void
+  -> BG.Ptr BG.Void
+  -> BG.Ptr BG.Void
+  -> IO BG.CUInt
+
+-- __unique:__ @Database_DuckDB_FFI_V2_Database.DuckDB.FFI.V2_Safe_duckdb_v2_function_docs_add_category@
+hs_bindgen_8c0ae6a612e9d656 ::
+     DuckDBV2FunctionDocsHandle
+  -> PtrConst.PtrConst DuckDBV2Str
+  -> BG.Ptr DuckDBV2ErrorInfoHandle
+  -> IO DuckDBV2Error
+hs_bindgen_8c0ae6a612e9d656 =
+  \x0 ->
+    \x1 ->
+      \x2 ->
+        fmap BG.fromFFIType (hs_bindgen_8c0ae6a612e9d656_base (BG.toFFIType x0) (BG.toFFIType x1) (BG.toFFIType x2))
+
+{-| __C declaration:__ @duckdb_v2_function_docs_add_category@
+
+    __defined at:__ @duckdb_v2.h 3656:30@
+
+    __exported by:__ @duckdb_v2.h@
+-}
+c_duckdb_v2_function_docs_add_category ::
+     DuckDBV2FunctionDocsHandle
+     -- ^ __C declaration:__ @docs@
+  -> PtrConst.PtrConst DuckDBV2Str
+     -- ^ __C declaration:__ @category@
+  -> BG.Ptr DuckDBV2ErrorInfoHandle
+     -- ^ __C declaration:__ @err@
+  -> IO DuckDBV2Error
+c_duckdb_v2_function_docs_add_category =
+  hs_bindgen_8c0ae6a612e9d656
+
+-- __unique:__ @Database_DuckDB_FFI_V2_Database.DuckDB.FFI.V2_Safe_duckdb_v2_function_signature_add_parameter@
+foreign import ccall safe "hs_bindgen_7bc5242fb1a27934" hs_bindgen_7bc5242fb1a27934_base ::
+     BG.Ptr BG.Void
+  -> BG.Ptr BG.Void
+  -> BG.Ptr BG.Void
+  -> BG.Ptr BG.Void
+  -> BG.CUInt
+  -> BG.Ptr BG.Void
+  -> IO BG.CUInt
+
+-- __unique:__ @Database_DuckDB_FFI_V2_Database.DuckDB.FFI.V2_Safe_duckdb_v2_function_signature_add_parameter@
+hs_bindgen_7bc5242fb1a27934 ::
+     DuckDBV2FunctionSignatureHandle
+  -> PtrConst.PtrConst DuckDBV2IdentifierT
+  -> DuckDBV2LogicalTypeHandle
+  -> DuckDBV2ValueHandle
+  -> DuckDBV2FunctionParameterKind
+  -> BG.Ptr DuckDBV2ErrorInfoHandle
+  -> IO DuckDBV2Error
+hs_bindgen_7bc5242fb1a27934 =
+  \x0 ->
+    \x1 ->
+      \x2 ->
+        \x3 ->
+          \x4 ->
+            \x5 ->
+              fmap BG.fromFFIType (hs_bindgen_7bc5242fb1a27934_base (BG.toFFIType x0) (BG.toFFIType x1) (BG.toFFIType x2) (BG.toFFIType x3) (BG.toFFIType x4) (BG.toFFIType x5))
+
+{-| __C declaration:__ @duckdb_v2_function_signature_add_parameter@
+
+    __defined at:__ @duckdb_v2.h 3740:30@
+
+    __exported by:__ @duckdb_v2.h@
+-}
+c_duckdb_v2_function_signature_add_parameter ::
+     DuckDBV2FunctionSignatureHandle
+     -- ^ __C declaration:__ @sig@
+  -> PtrConst.PtrConst DuckDBV2IdentifierT
+     -- ^ __C declaration:__ @name@
+  -> DuckDBV2LogicalTypeHandle
+     -- ^ __C declaration:__ @type@
+  -> DuckDBV2ValueHandle
+     -- ^ __C declaration:__ @value@
+  -> DuckDBV2FunctionParameterKind
+     -- ^ __C declaration:__ @kind@
+  -> BG.Ptr DuckDBV2ErrorInfoHandle
+     -- ^ __C declaration:__ @err@
+  -> IO DuckDBV2Error
+c_duckdb_v2_function_signature_add_parameter =
+  hs_bindgen_7bc5242fb1a27934
+
+-- __unique:__ @Database_DuckDB_FFI_V2_Database.DuckDB.FFI.V2_Safe_duckdb_v2_function_signature_set_return_type@
+foreign import ccall safe "hs_bindgen_d44dad353372974b" hs_bindgen_d44dad353372974b_base ::
+     BG.Ptr BG.Void
+  -> BG.Ptr BG.Void
+  -> BG.Ptr BG.Void
+  -> IO BG.CUInt
+
+-- __unique:__ @Database_DuckDB_FFI_V2_Database.DuckDB.FFI.V2_Safe_duckdb_v2_function_signature_set_return_type@
+hs_bindgen_d44dad353372974b ::
+     DuckDBV2FunctionSignatureHandle
+  -> DuckDBV2LogicalTypeHandle
+  -> BG.Ptr DuckDBV2ErrorInfoHandle
+  -> IO DuckDBV2Error
+hs_bindgen_d44dad353372974b =
+  \x0 ->
+    \x1 ->
+      \x2 ->
+        fmap BG.fromFFIType (hs_bindgen_d44dad353372974b_base (BG.toFFIType x0) (BG.toFFIType x1) (BG.toFFIType x2))
+
+{-| __C declaration:__ @duckdb_v2_function_signature_set_return_type@
+
+    __defined at:__ @duckdb_v2.h 3761:30@
+
+    __exported by:__ @duckdb_v2.h@
+-}
+c_duckdb_v2_function_signature_set_return_type ::
+     DuckDBV2FunctionSignatureHandle
+     -- ^ __C declaration:__ @sig@
+  -> DuckDBV2LogicalTypeHandle
+     -- ^ __C declaration:__ @type@
+  -> BG.Ptr DuckDBV2ErrorInfoHandle
+     -- ^ __C declaration:__ @err@
+  -> IO DuckDBV2Error
+c_duckdb_v2_function_signature_set_return_type =
+  hs_bindgen_d44dad353372974b
+
+-- __unique:__ @Database_DuckDB_FFI_V2_Database.DuckDB.FFI.V2_Safe_duckdb_v2_identifier_render_quoted@
+foreign import ccall safe "hs_bindgen_648d1059972cfe31" hs_bindgen_648d1059972cfe31_base ::
+     BG.Ptr BG.Void
+  -> BG.Ptr BG.Void
+  -> HsBindgen.Runtime.LibC.Word64
+  -> BG.Ptr BG.Void
+  -> BG.Ptr BG.Void
+  -> IO BG.CUInt
+
+-- __unique:__ @Database_DuckDB_FFI_V2_Database.DuckDB.FFI.V2_Safe_duckdb_v2_identifier_render_quoted@
+hs_bindgen_648d1059972cfe31 ::
+     PtrConst.PtrConst DuckDBV2IdentifierT
+  -> BG.Ptr BG.CChar
+  -> DuckDBIdx
+  -> BG.Ptr DuckDBIdx
+  -> BG.Ptr DuckDBV2ErrorInfoHandle
+  -> IO DuckDBV2Error
+hs_bindgen_648d1059972cfe31 =
+  \x0 ->
+    \x1 ->
+      \x2 ->
+        \x3 ->
+          \x4 ->
+            fmap BG.fromFFIType (hs_bindgen_648d1059972cfe31_base (BG.toFFIType x0) (BG.toFFIType x1) (BG.toFFIType x2) (BG.toFFIType x3) (BG.toFFIType x4))
+
+{-| __C declaration:__ @duckdb_v2_identifier_render_quoted@
+
+    __defined at:__ @duckdb_v2.h 3813:30@
+
+    __exported by:__ @duckdb_v2.h@
+-}
+c_duckdb_v2_identifier_render_quoted ::
+     PtrConst.PtrConst DuckDBV2IdentifierT
+     -- ^ __C declaration:__ @name@
+  -> BG.Ptr BG.CChar
+     -- ^ __C declaration:__ @out_text@
+  -> DuckDBIdx
+     -- ^ __C declaration:__ @out_capacity@
+  -> BG.Ptr DuckDBIdx
+     -- ^ __C declaration:__ @out_length@
+  -> BG.Ptr DuckDBV2ErrorInfoHandle
+     -- ^ __C declaration:__ @err@
+  -> IO DuckDBV2Error
+c_duckdb_v2_identifier_render_quoted =
+  hs_bindgen_648d1059972cfe31
+
+-- __unique:__ @Database_DuckDB_FFI_V2_Database.DuckDB.FFI.V2_Safe_duckdb_v2_instance_create@
+foreign import ccall safe "hs_bindgen_a284cf08a8a65feb" hs_bindgen_a284cf08a8a65feb_base ::
+     BG.Ptr BG.Void
+  -> BG.Ptr BG.Void
+  -> BG.Ptr BG.Void
+  -> IO BG.CUInt
+
+-- __unique:__ @Database_DuckDB_FFI_V2_Database.DuckDB.FFI.V2_Safe_duckdb_v2_instance_create@
+hs_bindgen_a284cf08a8a65feb ::
+     DuckDBV2EnvironmentHandle
+  -> BG.Ptr DuckDBV2InstanceHandle
+  -> BG.Ptr DuckDBV2ErrorInfoHandle
+  -> IO DuckDBV2Error
+hs_bindgen_a284cf08a8a65feb =
+  \x0 ->
+    \x1 ->
+      \x2 ->
+        fmap BG.fromFFIType (hs_bindgen_a284cf08a8a65feb_base (BG.toFFIType x0) (BG.toFFIType x1) (BG.toFFIType x2))
+
+{-| __C declaration:__ @duckdb_v2_instance_create@
+
+    __defined at:__ @duckdb_v2.h 3864:30@
+
+    __exported by:__ @duckdb_v2.h@
+-}
+c_duckdb_v2_instance_create ::
+     DuckDBV2EnvironmentHandle
+     -- ^ __C declaration:__ @env@
+  -> BG.Ptr DuckDBV2InstanceHandle
+     -- ^ __C declaration:__ @out_instance@
+  -> BG.Ptr DuckDBV2ErrorInfoHandle
+     -- ^ __C declaration:__ @err@
+  -> IO DuckDBV2Error
+c_duckdb_v2_instance_create =
+  hs_bindgen_a284cf08a8a65feb
+
+-- __unique:__ @Database_DuckDB_FFI_V2_Database.DuckDB.FFI.V2_Safe_duckdb_v2_instance_create_with_options@
+foreign import ccall safe "hs_bindgen_73bea1b0baf1b37c" hs_bindgen_73bea1b0baf1b37c_base ::
+     BG.Ptr BG.Void
+  -> BG.Ptr BG.Void
+  -> BG.Ptr BG.Void
+  -> HsBindgen.Runtime.LibC.Word64
+  -> BG.Ptr BG.Void
+  -> BG.Ptr BG.Void
+  -> IO BG.CUInt
+
+-- __unique:__ @Database_DuckDB_FFI_V2_Database.DuckDB.FFI.V2_Safe_duckdb_v2_instance_create_with_options@
+hs_bindgen_73bea1b0baf1b37c ::
+     DuckDBV2EnvironmentHandle
+  -> PtrConst.PtrConst DuckDBV2Str
+  -> PtrConst.PtrConst DuckDBV2Str
+  -> DuckDBIdx
+  -> BG.Ptr DuckDBV2InstanceHandle
+  -> BG.Ptr DuckDBV2ErrorInfoHandle
+  -> IO DuckDBV2Error
+hs_bindgen_73bea1b0baf1b37c =
+  \x0 ->
+    \x1 ->
+      \x2 ->
+        \x3 ->
+          \x4 ->
+            \x5 ->
+              fmap BG.fromFFIType (hs_bindgen_73bea1b0baf1b37c_base (BG.toFFIType x0) (BG.toFFIType x1) (BG.toFFIType x2) (BG.toFFIType x3) (BG.toFFIType x4) (BG.toFFIType x5))
+
+{-| __C declaration:__ @duckdb_v2_instance_create_with_options@
+
+    __defined at:__ @duckdb_v2.h 3897:30@
+
+    __exported by:__ @duckdb_v2.h@
+-}
+c_duckdb_v2_instance_create_with_options ::
+     DuckDBV2EnvironmentHandle
+     -- ^ __C declaration:__ @env@
+  -> PtrConst.PtrConst DuckDBV2Str
+     -- ^ __C declaration:__ @option_names@
+  -> PtrConst.PtrConst DuckDBV2Str
+     -- ^ __C declaration:__ @option_values@
+  -> DuckDBIdx
+     -- ^ __C declaration:__ @option_count@
+  -> BG.Ptr DuckDBV2InstanceHandle
+     -- ^ __C declaration:__ @out_instance@
+  -> BG.Ptr DuckDBV2ErrorInfoHandle
+     -- ^ __C declaration:__ @err@
+  -> IO DuckDBV2Error
+c_duckdb_v2_instance_create_with_options =
+  hs_bindgen_73bea1b0baf1b37c
+
+-- __unique:__ @Database_DuckDB_FFI_V2_Database.DuckDB.FFI.V2_Safe_duckdb_v2_instance_destroy@
+foreign import ccall safe "hs_bindgen_56df03d6894ed76a" hs_bindgen_56df03d6894ed76a_base ::
+     BG.Ptr BG.Void
+  -> IO BG.CUInt
+
+-- __unique:__ @Database_DuckDB_FFI_V2_Database.DuckDB.FFI.V2_Safe_duckdb_v2_instance_destroy@
+hs_bindgen_56df03d6894ed76a ::
+     BG.Ptr DuckDBV2InstanceHandle
+  -> IO DuckDBV2Error
+hs_bindgen_56df03d6894ed76a =
+  \x0 ->
+    fmap BG.fromFFIType (hs_bindgen_56df03d6894ed76a_base (BG.toFFIType x0))
+
+{-| __C declaration:__ @duckdb_v2_instance_destroy@
+
+    __defined at:__ @duckdb_v2.h 3916:30@
+
+    __exported by:__ @duckdb_v2.h@
+-}
+c_duckdb_v2_instance_destroy ::
+     BG.Ptr DuckDBV2InstanceHandle
+     -- ^ __C declaration:__ @instance@
+  -> IO DuckDBV2Error
+c_duckdb_v2_instance_destroy =
+  hs_bindgen_56df03d6894ed76a
+
+-- __unique:__ @Database_DuckDB_FFI_V2_Database.DuckDB.FFI.V2_Safe_duckdb_v2_instance_attach@
+foreign import ccall safe "hs_bindgen_463a516d6c190a96" hs_bindgen_463a516d6c190a96_base ::
+     BG.Ptr BG.Void
+  -> BG.Ptr BG.Void
+  -> BG.Ptr BG.Void
+  -> BG.Ptr BG.Void
+  -> BG.CBool
+  -> BG.Ptr BG.Void
+  -> IO BG.CUInt
+
+-- __unique:__ @Database_DuckDB_FFI_V2_Database.DuckDB.FFI.V2_Safe_duckdb_v2_instance_attach@
+hs_bindgen_463a516d6c190a96 ::
+     DuckDBV2InstanceHandle
+  -> PtrConst.PtrConst DuckDBV2IdentifierT
+  -> PtrConst.PtrConst DuckDBV2Str
+  -> DuckDBV2AttachOptionsHandle
+  -> BG.CBool
+  -> BG.Ptr DuckDBV2ErrorInfoHandle
+  -> IO DuckDBV2Error
+hs_bindgen_463a516d6c190a96 =
+  \x0 ->
+    \x1 ->
+      \x2 ->
+        \x3 ->
+          \x4 ->
+            \x5 ->
+              fmap BG.fromFFIType (hs_bindgen_463a516d6c190a96_base (BG.toFFIType x0) (BG.toFFIType x1) (BG.toFFIType x2) (BG.toFFIType x3) (BG.toFFIType x4) (BG.toFFIType x5))
+
+{-| __C declaration:__ @duckdb_v2_instance_attach@
+
+    __defined at:__ @duckdb_v2.h 3954:30@
+
+    __exported by:__ @duckdb_v2.h@
+-}
+c_duckdb_v2_instance_attach ::
+     DuckDBV2InstanceHandle
+     -- ^ __C declaration:__ @instance@
+  -> PtrConst.PtrConst DuckDBV2IdentifierT
+     -- ^ __C declaration:__ @name@
+  -> PtrConst.PtrConst DuckDBV2Str
+     -- ^ __C declaration:__ @path@
+  -> DuckDBV2AttachOptionsHandle
+     -- ^ __C declaration:__ @options@
+  -> BG.CBool
+     -- ^ __C declaration:__ @make_default@
+  -> BG.Ptr DuckDBV2ErrorInfoHandle
+     -- ^ __C declaration:__ @err@
+  -> IO DuckDBV2Error
+c_duckdb_v2_instance_attach =
+  hs_bindgen_463a516d6c190a96
+
+-- __unique:__ @Database_DuckDB_FFI_V2_Database.DuckDB.FFI.V2_Safe_duckdb_v2_instance_detach@
+foreign import ccall safe "hs_bindgen_4378df5ac40df0b9" hs_bindgen_4378df5ac40df0b9_base ::
+     BG.Ptr BG.Void
+  -> BG.Ptr BG.Void
+  -> BG.Ptr BG.Void
+  -> IO BG.CUInt
+
+-- __unique:__ @Database_DuckDB_FFI_V2_Database.DuckDB.FFI.V2_Safe_duckdb_v2_instance_detach@
+hs_bindgen_4378df5ac40df0b9 ::
+     DuckDBV2InstanceHandle
+  -> PtrConst.PtrConst DuckDBV2IdentifierT
+  -> BG.Ptr DuckDBV2ErrorInfoHandle
+  -> IO DuckDBV2Error
+hs_bindgen_4378df5ac40df0b9 =
+  \x0 ->
+    \x1 ->
+      \x2 ->
+        fmap BG.fromFFIType (hs_bindgen_4378df5ac40df0b9_base (BG.toFFIType x0) (BG.toFFIType x1) (BG.toFFIType x2))
+
+{-| __C declaration:__ @duckdb_v2_instance_detach@
+
+    __defined at:__ @duckdb_v2.h 3979:30@
+
+    __exported by:__ @duckdb_v2.h@
+-}
+c_duckdb_v2_instance_detach ::
+     DuckDBV2InstanceHandle
+     -- ^ __C declaration:__ @instance@
+  -> PtrConst.PtrConst DuckDBV2IdentifierT
+     -- ^ __C declaration:__ @name@
+  -> BG.Ptr DuckDBV2ErrorInfoHandle
+     -- ^ __C declaration:__ @err@
+  -> IO DuckDBV2Error
+c_duckdb_v2_instance_detach =
+  hs_bindgen_4378df5ac40df0b9
+
+-- __unique:__ @Database_DuckDB_FFI_V2_Database.DuckDB.FFI.V2_Safe_duckdb_v2_instance_set_default@
+foreign import ccall safe "hs_bindgen_ce4ad4a876e755a4" hs_bindgen_ce4ad4a876e755a4_base ::
+     BG.Ptr BG.Void
+  -> BG.Ptr BG.Void
+  -> BG.Ptr BG.Void
+  -> IO BG.CUInt
+
+-- __unique:__ @Database_DuckDB_FFI_V2_Database.DuckDB.FFI.V2_Safe_duckdb_v2_instance_set_default@
+hs_bindgen_ce4ad4a876e755a4 ::
+     DuckDBV2InstanceHandle
+  -> PtrConst.PtrConst DuckDBV2IdentifierT
+  -> BG.Ptr DuckDBV2ErrorInfoHandle
+  -> IO DuckDBV2Error
+hs_bindgen_ce4ad4a876e755a4 =
+  \x0 ->
+    \x1 ->
+      \x2 ->
+        fmap BG.fromFFIType (hs_bindgen_ce4ad4a876e755a4_base (BG.toFFIType x0) (BG.toFFIType x1) (BG.toFFIType x2))
+
+{-| __C declaration:__ @duckdb_v2_instance_set_default@
+
+    __defined at:__ @duckdb_v2.h 4004:30@
+
+    __exported by:__ @duckdb_v2.h@
+-}
+c_duckdb_v2_instance_set_default ::
+     DuckDBV2InstanceHandle
+     -- ^ __C declaration:__ @instance@
+  -> PtrConst.PtrConst DuckDBV2IdentifierT
+     -- ^ __C declaration:__ @name@
+  -> BG.Ptr DuckDBV2ErrorInfoHandle
+     -- ^ __C declaration:__ @err@
+  -> IO DuckDBV2Error
+c_duckdb_v2_instance_set_default =
+  hs_bindgen_ce4ad4a876e755a4
+
+-- __unique:__ @Database_DuckDB_FFI_V2_Database.DuckDB.FFI.V2_Safe_duckdb_v2_attach_options_create@
+foreign import ccall safe "hs_bindgen_5b74dc8fe1ab3f0b" hs_bindgen_5b74dc8fe1ab3f0b_base ::
+     BG.Ptr BG.Void
+  -> BG.Ptr BG.Void
+  -> BG.Ptr BG.Void
+  -> IO BG.CUInt
+
+-- __unique:__ @Database_DuckDB_FFI_V2_Database.DuckDB.FFI.V2_Safe_duckdb_v2_attach_options_create@
+hs_bindgen_5b74dc8fe1ab3f0b ::
+     DuckDBV2InstanceHandle
+  -> BG.Ptr DuckDBV2AttachOptionsHandle
+  -> BG.Ptr DuckDBV2ErrorInfoHandle
+  -> IO DuckDBV2Error
+hs_bindgen_5b74dc8fe1ab3f0b =
+  \x0 ->
+    \x1 ->
+      \x2 ->
+        fmap BG.fromFFIType (hs_bindgen_5b74dc8fe1ab3f0b_base (BG.toFFIType x0) (BG.toFFIType x1) (BG.toFFIType x2))
+
+{-| __C declaration:__ @duckdb_v2_attach_options_create@
+
+    __defined at:__ @duckdb_v2.h 4025:30@
+
+    __exported by:__ @duckdb_v2.h@
+-}
+c_duckdb_v2_attach_options_create ::
+     DuckDBV2InstanceHandle
+     -- ^ __C declaration:__ @instance@
+  -> BG.Ptr DuckDBV2AttachOptionsHandle
+     -- ^ __C declaration:__ @out_options@
+  -> BG.Ptr DuckDBV2ErrorInfoHandle
+     -- ^ __C declaration:__ @err@
+  -> IO DuckDBV2Error
+c_duckdb_v2_attach_options_create =
+  hs_bindgen_5b74dc8fe1ab3f0b
+
+-- __unique:__ @Database_DuckDB_FFI_V2_Database.DuckDB.FFI.V2_Safe_duckdb_v2_attach_options_set@
+foreign import ccall safe "hs_bindgen_dc6215eb5d970dcf" hs_bindgen_dc6215eb5d970dcf_base ::
+     BG.Ptr BG.Void
+  -> BG.Ptr BG.Void
+  -> BG.Ptr BG.Void
+  -> BG.Ptr BG.Void
+  -> IO BG.CUInt
+
+-- __unique:__ @Database_DuckDB_FFI_V2_Database.DuckDB.FFI.V2_Safe_duckdb_v2_attach_options_set@
+hs_bindgen_dc6215eb5d970dcf ::
+     DuckDBV2AttachOptionsHandle
+  -> PtrConst.PtrConst DuckDBV2IdentifierT
+  -> PtrConst.PtrConst DuckDBV2Str
+  -> BG.Ptr DuckDBV2ErrorInfoHandle
+  -> IO DuckDBV2Error
+hs_bindgen_dc6215eb5d970dcf =
+  \x0 ->
+    \x1 ->
+      \x2 ->
+        \x3 ->
+          fmap BG.fromFFIType (hs_bindgen_dc6215eb5d970dcf_base (BG.toFFIType x0) (BG.toFFIType x1) (BG.toFFIType x2) (BG.toFFIType x3))
+
+{-| __C declaration:__ @duckdb_v2_attach_options_set@
+
+    __defined at:__ @duckdb_v2.h 4050:30@
+
+    __exported by:__ @duckdb_v2.h@
+-}
+c_duckdb_v2_attach_options_set ::
+     DuckDBV2AttachOptionsHandle
+     -- ^ __C declaration:__ @options@
+  -> PtrConst.PtrConst DuckDBV2IdentifierT
+     -- ^ __C declaration:__ @key@
+  -> PtrConst.PtrConst DuckDBV2Str
+     -- ^ __C declaration:__ @setting@
+  -> BG.Ptr DuckDBV2ErrorInfoHandle
+     -- ^ __C declaration:__ @err@
+  -> IO DuckDBV2Error
+c_duckdb_v2_attach_options_set =
+  hs_bindgen_dc6215eb5d970dcf
+
+-- __unique:__ @Database_DuckDB_FFI_V2_Database.DuckDB.FFI.V2_Safe_duckdb_v2_attach_options_destroy@
+foreign import ccall safe "hs_bindgen_f36c9f1fe2a3a8a3" hs_bindgen_f36c9f1fe2a3a8a3_base ::
+     BG.Ptr BG.Void
+  -> IO BG.CUInt
+
+-- __unique:__ @Database_DuckDB_FFI_V2_Database.DuckDB.FFI.V2_Safe_duckdb_v2_attach_options_destroy@
+hs_bindgen_f36c9f1fe2a3a8a3 ::
+     BG.Ptr DuckDBV2AttachOptionsHandle
+  -> IO DuckDBV2Error
+hs_bindgen_f36c9f1fe2a3a8a3 =
+  \x0 ->
+    fmap BG.fromFFIType (hs_bindgen_f36c9f1fe2a3a8a3_base (BG.toFFIType x0))
+
+{-| __C declaration:__ @duckdb_v2_attach_options_destroy@
+
+    __defined at:__ @duckdb_v2.h 4068:30@
+
+    __exported by:__ @duckdb_v2.h@
+-}
+c_duckdb_v2_attach_options_destroy ::
+     BG.Ptr DuckDBV2AttachOptionsHandle
+     -- ^ __C declaration:__ @options@
+  -> IO DuckDBV2Error
+c_duckdb_v2_attach_options_destroy =
+  hs_bindgen_f36c9f1fe2a3a8a3
+
+-- __unique:__ @Database_DuckDB_FFI_V2_Database.DuckDB.FFI.V2_Safe_duckdb_v2_library_version@
+foreign import ccall safe "hs_bindgen_87f034a4e6a0ebd7" hs_bindgen_87f034a4e6a0ebd7_base ::
+     BG.Ptr BG.Void
+  -> BG.Ptr BG.Void
+  -> IO BG.CUInt
+
+-- __unique:__ @Database_DuckDB_FFI_V2_Database.DuckDB.FFI.V2_Safe_duckdb_v2_library_version@
+hs_bindgen_87f034a4e6a0ebd7 ::
+     BG.Ptr DuckDBV2Str
+  -> BG.Ptr DuckDBV2ErrorInfoHandle
+  -> IO DuckDBV2Error
+hs_bindgen_87f034a4e6a0ebd7 =
+  \x0 ->
+    \x1 ->
+      fmap BG.fromFFIType (hs_bindgen_87f034a4e6a0ebd7_base (BG.toFFIType x0) (BG.toFFIType x1))
+
+{-| __C declaration:__ @duckdb_v2_library_version@
+
+    __defined at:__ @duckdb_v2.h 4083:30@
+
+    __exported by:__ @duckdb_v2.h@
+-}
+c_duckdb_v2_library_version ::
+     BG.Ptr DuckDBV2Str
+     -- ^ __C declaration:__ @out_version@
+  -> BG.Ptr DuckDBV2ErrorInfoHandle
+     -- ^ __C declaration:__ @err@
+  -> IO DuckDBV2Error
+c_duckdb_v2_library_version =
+  hs_bindgen_87f034a4e6a0ebd7
+
+-- __unique:__ @Database_DuckDB_FFI_V2_Database.DuckDB.FFI.V2_Safe_duckdb_v2_context_log@
+foreign import ccall safe "hs_bindgen_c380cb64ce856729" hs_bindgen_c380cb64ce856729_base ::
+     BG.Ptr BG.Void
+  -> BG.CUInt
+  -> BG.Ptr BG.Void
+  -> BG.Ptr BG.Void
+  -> BG.Ptr BG.Void
+  -> IO BG.CUInt
+
+-- __unique:__ @Database_DuckDB_FFI_V2_Database.DuckDB.FFI.V2_Safe_duckdb_v2_context_log@
+hs_bindgen_c380cb64ce856729 ::
+     DuckDBV2ContextHandle
+  -> DuckDBV2LogLevel
+  -> PtrConst.PtrConst DuckDBV2Str
+  -> PtrConst.PtrConst DuckDBV2Str
+  -> BG.Ptr DuckDBV2ErrorInfoHandle
+  -> IO DuckDBV2Error
+hs_bindgen_c380cb64ce856729 =
+  \x0 ->
+    \x1 ->
+      \x2 ->
+        \x3 ->
+          \x4 ->
+            fmap BG.fromFFIType (hs_bindgen_c380cb64ce856729_base (BG.toFFIType x0) (BG.toFFIType x1) (BG.toFFIType x2) (BG.toFFIType x3) (BG.toFFIType x4))
+
+{-| __C declaration:__ @duckdb_v2_context_log@
+
+    __defined at:__ @duckdb_v2.h 4148:30@
+
+    __exported by:__ @duckdb_v2.h@
+-}
+c_duckdb_v2_context_log ::
+     DuckDBV2ContextHandle
+     -- ^ __C declaration:__ @ctx@
+  -> DuckDBV2LogLevel
+     -- ^ __C declaration:__ @level@
+  -> PtrConst.PtrConst DuckDBV2Str
+     -- ^ __C declaration:__ @log_type@
+  -> PtrConst.PtrConst DuckDBV2Str
+     -- ^ __C declaration:__ @message@
+  -> BG.Ptr DuckDBV2ErrorInfoHandle
+     -- ^ __C declaration:__ @err@
+  -> IO DuckDBV2Error
+c_duckdb_v2_context_log = hs_bindgen_c380cb64ce856729
+
+-- __unique:__ @Database_DuckDB_FFI_V2_Database.DuckDB.FFI.V2_Safe_duckdb_v2_instance_log@
+foreign import ccall safe "hs_bindgen_fc0bdf1b87677558" hs_bindgen_fc0bdf1b87677558_base ::
+     BG.Ptr BG.Void
+  -> BG.CUInt
+  -> BG.Ptr BG.Void
+  -> BG.Ptr BG.Void
+  -> BG.Ptr BG.Void
+  -> IO BG.CUInt
+
+-- __unique:__ @Database_DuckDB_FFI_V2_Database.DuckDB.FFI.V2_Safe_duckdb_v2_instance_log@
+hs_bindgen_fc0bdf1b87677558 ::
+     DuckDBV2InstanceHandle
+  -> DuckDBV2LogLevel
+  -> PtrConst.PtrConst DuckDBV2Str
+  -> PtrConst.PtrConst DuckDBV2Str
+  -> BG.Ptr DuckDBV2ErrorInfoHandle
+  -> IO DuckDBV2Error
+hs_bindgen_fc0bdf1b87677558 =
+  \x0 ->
+    \x1 ->
+      \x2 ->
+        \x3 ->
+          \x4 ->
+            fmap BG.fromFFIType (hs_bindgen_fc0bdf1b87677558_base (BG.toFFIType x0) (BG.toFFIType x1) (BG.toFFIType x2) (BG.toFFIType x3) (BG.toFFIType x4))
+
+{-| __C declaration:__ @duckdb_v2_instance_log@
+
+    __defined at:__ @duckdb_v2.h 4172:30@
+
+    __exported by:__ @duckdb_v2.h@
+-}
+c_duckdb_v2_instance_log ::
+     DuckDBV2InstanceHandle
+     -- ^ __C declaration:__ @instance@
+  -> DuckDBV2LogLevel
+     -- ^ __C declaration:__ @level@
+  -> PtrConst.PtrConst DuckDBV2Str
+     -- ^ __C declaration:__ @log_type@
+  -> PtrConst.PtrConst DuckDBV2Str
+     -- ^ __C declaration:__ @message@
+  -> BG.Ptr DuckDBV2ErrorInfoHandle
+     -- ^ __C declaration:__ @err@
+  -> IO DuckDBV2Error
+c_duckdb_v2_instance_log =
+  hs_bindgen_fc0bdf1b87677558
+
+-- __unique:__ @Database_DuckDB_FFI_V2_Database.DuckDB.FFI.V2_Safe_duckdb_v2_connection_log@
+foreign import ccall safe "hs_bindgen_94c3752a727ebc9d" hs_bindgen_94c3752a727ebc9d_base ::
+     BG.Ptr BG.Void
+  -> BG.CUInt
+  -> BG.Ptr BG.Void
+  -> BG.Ptr BG.Void
+  -> BG.Ptr BG.Void
+  -> IO BG.CUInt
+
+-- __unique:__ @Database_DuckDB_FFI_V2_Database.DuckDB.FFI.V2_Safe_duckdb_v2_connection_log@
+hs_bindgen_94c3752a727ebc9d ::
+     DuckDBV2ConnectionHandle
+  -> DuckDBV2LogLevel
+  -> PtrConst.PtrConst DuckDBV2Str
+  -> PtrConst.PtrConst DuckDBV2Str
+  -> BG.Ptr DuckDBV2ErrorInfoHandle
+  -> IO DuckDBV2Error
+hs_bindgen_94c3752a727ebc9d =
+  \x0 ->
+    \x1 ->
+      \x2 ->
+        \x3 ->
+          \x4 ->
+            fmap BG.fromFFIType (hs_bindgen_94c3752a727ebc9d_base (BG.toFFIType x0) (BG.toFFIType x1) (BG.toFFIType x2) (BG.toFFIType x3) (BG.toFFIType x4))
+
+{-| __C declaration:__ @duckdb_v2_connection_log@
+
+    __defined at:__ @duckdb_v2.h 4196:30@
+
+    __exported by:__ @duckdb_v2.h@
+-}
+c_duckdb_v2_connection_log ::
+     DuckDBV2ConnectionHandle
+     -- ^ __C declaration:__ @conn@
+  -> DuckDBV2LogLevel
+     -- ^ __C declaration:__ @level@
+  -> PtrConst.PtrConst DuckDBV2Str
+     -- ^ __C declaration:__ @log_type@
+  -> PtrConst.PtrConst DuckDBV2Str
+     -- ^ __C declaration:__ @message@
+  -> BG.Ptr DuckDBV2ErrorInfoHandle
+     -- ^ __C declaration:__ @err@
+  -> IO DuckDBV2Error
+c_duckdb_v2_connection_log =
+  hs_bindgen_94c3752a727ebc9d
+
+-- __unique:__ @Database_DuckDB_FFI_V2_Database.DuckDB.FFI.V2_Safe_duckdb_v2_qname_parse@
+foreign import ccall safe "hs_bindgen_572fa6ba39fa9c2f" hs_bindgen_572fa6ba39fa9c2f_base ::
+     BG.Ptr BG.Void
+  -> BG.Ptr BG.Void
+  -> BG.Ptr BG.Void
+  -> IO BG.CUInt
+
+-- __unique:__ @Database_DuckDB_FFI_V2_Database.DuckDB.FFI.V2_Safe_duckdb_v2_qname_parse@
+hs_bindgen_572fa6ba39fa9c2f ::
+     PtrConst.PtrConst DuckDBV2Str
+  -> BG.Ptr DuckDBV2QnameHandle
+  -> BG.Ptr DuckDBV2ErrorInfoHandle
+  -> IO DuckDBV2Error
+hs_bindgen_572fa6ba39fa9c2f =
+  \x0 ->
+    \x1 ->
+      \x2 ->
+        fmap BG.fromFFIType (hs_bindgen_572fa6ba39fa9c2f_base (BG.toFFIType x0) (BG.toFFIType x1) (BG.toFFIType x2))
+
+{-| __C declaration:__ @duckdb_v2_qname_parse@
+
+    __defined at:__ @duckdb_v2.h 4248:30@
+
+    __exported by:__ @duckdb_v2.h@
+-}
+c_duckdb_v2_qname_parse ::
+     PtrConst.PtrConst DuckDBV2Str
+     -- ^ __C declaration:__ @text@
+  -> BG.Ptr DuckDBV2QnameHandle
+     -- ^ __C declaration:__ @name@
+  -> BG.Ptr DuckDBV2ErrorInfoHandle
+     -- ^ __C declaration:__ @err@
+  -> IO DuckDBV2Error
+c_duckdb_v2_qname_parse = hs_bindgen_572fa6ba39fa9c2f
+
+-- __unique:__ @Database_DuckDB_FFI_V2_Database.DuckDB.FFI.V2_Safe_duckdb_v2_qname_create@
+foreign import ccall safe "hs_bindgen_938fba9bffb14be4" hs_bindgen_938fba9bffb14be4_base ::
+     BG.Ptr BG.Void
+  -> HsBindgen.Runtime.LibC.Word64
+  -> BG.Ptr BG.Void
+  -> BG.Ptr BG.Void
+  -> IO BG.CUInt
+
+-- __unique:__ @Database_DuckDB_FFI_V2_Database.DuckDB.FFI.V2_Safe_duckdb_v2_qname_create@
+hs_bindgen_938fba9bffb14be4 ::
+     PtrConst.PtrConst DuckDBV2IdentifierT
+  -> DuckDBIdx
+  -> BG.Ptr DuckDBV2QnameHandle
+  -> BG.Ptr DuckDBV2ErrorInfoHandle
+  -> IO DuckDBV2Error
+hs_bindgen_938fba9bffb14be4 =
+  \x0 ->
+    \x1 ->
+      \x2 ->
+        \x3 ->
+          fmap BG.fromFFIType (hs_bindgen_938fba9bffb14be4_base (BG.toFFIType x0) (BG.toFFIType x1) (BG.toFFIType x2) (BG.toFFIType x3))
+
+{-| __C declaration:__ @duckdb_v2_qname_create@
+
+    __defined at:__ @duckdb_v2.h 4271:30@
+
+    __exported by:__ @duckdb_v2.h@
+-}
+c_duckdb_v2_qname_create ::
+     PtrConst.PtrConst DuckDBV2IdentifierT
+     -- ^ __C declaration:__ @parts@
+  -> DuckDBIdx
+     -- ^ __C declaration:__ @part_count@
+  -> BG.Ptr DuckDBV2QnameHandle
+     -- ^ __C declaration:__ @name@
+  -> BG.Ptr DuckDBV2ErrorInfoHandle
+     -- ^ __C declaration:__ @err@
+  -> IO DuckDBV2Error
+c_duckdb_v2_qname_create =
+  hs_bindgen_938fba9bffb14be4
+
+-- __unique:__ @Database_DuckDB_FFI_V2_Database.DuckDB.FFI.V2_Safe_duckdb_v2_qname_get_part_count@
+foreign import ccall safe "hs_bindgen_cc75a574b2500f25" hs_bindgen_cc75a574b2500f25_base ::
+     BG.Ptr BG.Void
+  -> BG.Ptr BG.Void
+  -> BG.Ptr BG.Void
+  -> IO BG.CUInt
+
+-- __unique:__ @Database_DuckDB_FFI_V2_Database.DuckDB.FFI.V2_Safe_duckdb_v2_qname_get_part_count@
+hs_bindgen_cc75a574b2500f25 ::
+     DuckDBV2QnameHandle
+  -> BG.Ptr DuckDBIdx
+  -> BG.Ptr DuckDBV2ErrorInfoHandle
+  -> IO DuckDBV2Error
+hs_bindgen_cc75a574b2500f25 =
+  \x0 ->
+    \x1 ->
+      \x2 ->
+        fmap BG.fromFFIType (hs_bindgen_cc75a574b2500f25_base (BG.toFFIType x0) (BG.toFFIType x1) (BG.toFFIType x2))
+
+{-| __C declaration:__ @duckdb_v2_qname_get_part_count@
+
+    __defined at:__ @duckdb_v2.h 4291:30@
+
+    __exported by:__ @duckdb_v2.h@
+-}
+c_duckdb_v2_qname_get_part_count ::
+     DuckDBV2QnameHandle
+     -- ^ __C declaration:__ @name@
+  -> BG.Ptr DuckDBIdx
+     -- ^ __C declaration:__ @count@
+  -> BG.Ptr DuckDBV2ErrorInfoHandle
+     -- ^ __C declaration:__ @err@
+  -> IO DuckDBV2Error
+c_duckdb_v2_qname_get_part_count =
+  hs_bindgen_cc75a574b2500f25
+
+-- __unique:__ @Database_DuckDB_FFI_V2_Database.DuckDB.FFI.V2_Safe_duckdb_v2_qname_get_part@
+foreign import ccall safe "hs_bindgen_39e8720dd2ac4515" hs_bindgen_39e8720dd2ac4515_base ::
+     BG.Ptr BG.Void
+  -> HsBindgen.Runtime.LibC.Word64
+  -> BG.Ptr BG.Void
+  -> BG.Ptr BG.Void
+  -> IO BG.CUInt
+
+-- __unique:__ @Database_DuckDB_FFI_V2_Database.DuckDB.FFI.V2_Safe_duckdb_v2_qname_get_part@
+hs_bindgen_39e8720dd2ac4515 ::
+     DuckDBV2QnameHandle
+  -> DuckDBIdx
+  -> BG.Ptr DuckDBV2IdentifierT
+  -> BG.Ptr DuckDBV2ErrorInfoHandle
+  -> IO DuckDBV2Error
+hs_bindgen_39e8720dd2ac4515 =
+  \x0 ->
+    \x1 ->
+      \x2 ->
+        \x3 ->
+          fmap BG.fromFFIType (hs_bindgen_39e8720dd2ac4515_base (BG.toFFIType x0) (BG.toFFIType x1) (BG.toFFIType x2) (BG.toFFIType x3))
+
+{-| __C declaration:__ @duckdb_v2_qname_get_part@
+
+    __defined at:__ @duckdb_v2.h 4313:30@
+
+    __exported by:__ @duckdb_v2.h@
+-}
+c_duckdb_v2_qname_get_part ::
+     DuckDBV2QnameHandle
+     -- ^ __C declaration:__ @name@
+  -> DuckDBIdx
+     -- ^ __C declaration:__ @index@
+  -> BG.Ptr DuckDBV2IdentifierT
+     -- ^ __C declaration:__ @part@
+  -> BG.Ptr DuckDBV2ErrorInfoHandle
+     -- ^ __C declaration:__ @err@
+  -> IO DuckDBV2Error
+c_duckdb_v2_qname_get_part =
+  hs_bindgen_39e8720dd2ac4515
+
+-- __unique:__ @Database_DuckDB_FFI_V2_Database.DuckDB.FFI.V2_Safe_duckdb_v2_qname_render@
+foreign import ccall safe "hs_bindgen_faf3d53022aa7b0a" hs_bindgen_faf3d53022aa7b0a_base ::
+     BG.Ptr BG.Void
+  -> BG.Ptr BG.Void
+  -> HsBindgen.Runtime.LibC.Word64
+  -> BG.Ptr BG.Void
+  -> BG.Ptr BG.Void
+  -> IO BG.CUInt
+
+-- __unique:__ @Database_DuckDB_FFI_V2_Database.DuckDB.FFI.V2_Safe_duckdb_v2_qname_render@
+hs_bindgen_faf3d53022aa7b0a ::
+     DuckDBV2QnameHandle
+  -> BG.Ptr BG.CChar
+  -> DuckDBIdx
+  -> BG.Ptr DuckDBIdx
+  -> BG.Ptr DuckDBV2ErrorInfoHandle
+  -> IO DuckDBV2Error
+hs_bindgen_faf3d53022aa7b0a =
+  \x0 ->
+    \x1 ->
+      \x2 ->
+        \x3 ->
+          \x4 ->
+            fmap BG.fromFFIType (hs_bindgen_faf3d53022aa7b0a_base (BG.toFFIType x0) (BG.toFFIType x1) (BG.toFFIType x2) (BG.toFFIType x3) (BG.toFFIType x4))
+
+{-| __C declaration:__ @duckdb_v2_qname_render@
+
+    __defined at:__ @duckdb_v2.h 4345:30@
+
+    __exported by:__ @duckdb_v2.h@
+-}
+c_duckdb_v2_qname_render ::
+     DuckDBV2QnameHandle
+     -- ^ __C declaration:__ @name@
+  -> BG.Ptr BG.CChar
+     -- ^ __C declaration:__ @out_text@
+  -> DuckDBIdx
+     -- ^ __C declaration:__ @out_capacity@
+  -> BG.Ptr DuckDBIdx
+     -- ^ __C declaration:__ @out_length@
+  -> BG.Ptr DuckDBV2ErrorInfoHandle
+     -- ^ __C declaration:__ @err@
+  -> IO DuckDBV2Error
+c_duckdb_v2_qname_render =
+  hs_bindgen_faf3d53022aa7b0a
+
+-- __unique:__ @Database_DuckDB_FFI_V2_Database.DuckDB.FFI.V2_Safe_duckdb_v2_qname_equals@
+foreign import ccall safe "hs_bindgen_854da8ea8294a421" hs_bindgen_854da8ea8294a421_base ::
+     BG.Ptr BG.Void
+  -> BG.Ptr BG.Void
+  -> BG.Ptr BG.Void
+  -> BG.Ptr BG.Void
+  -> IO BG.CUInt
+
+-- __unique:__ @Database_DuckDB_FFI_V2_Database.DuckDB.FFI.V2_Safe_duckdb_v2_qname_equals@
+hs_bindgen_854da8ea8294a421 ::
+     DuckDBV2QnameHandle
+  -> DuckDBV2QnameHandle
+  -> BG.Ptr BG.CBool
+  -> BG.Ptr DuckDBV2ErrorInfoHandle
+  -> IO DuckDBV2Error
+hs_bindgen_854da8ea8294a421 =
+  \x0 ->
+    \x1 ->
+      \x2 ->
+        \x3 ->
+          fmap BG.fromFFIType (hs_bindgen_854da8ea8294a421_base (BG.toFFIType x0) (BG.toFFIType x1) (BG.toFFIType x2) (BG.toFFIType x3))
+
+{-| __C declaration:__ @duckdb_v2_qname_equals@
+
+    __defined at:__ @duckdb_v2.h 4367:30@
+
+    __exported by:__ @duckdb_v2.h@
+-}
+c_duckdb_v2_qname_equals ::
+     DuckDBV2QnameHandle
+     -- ^ __C declaration:__ @left@
+  -> DuckDBV2QnameHandle
+     -- ^ __C declaration:__ @right@
+  -> BG.Ptr BG.CBool
+     -- ^ __C declaration:__ @result@
+  -> BG.Ptr DuckDBV2ErrorInfoHandle
+     -- ^ __C declaration:__ @err@
+  -> IO DuckDBV2Error
+c_duckdb_v2_qname_equals =
+  hs_bindgen_854da8ea8294a421
+
+-- __unique:__ @Database_DuckDB_FFI_V2_Database.DuckDB.FFI.V2_Safe_duckdb_v2_qname_hash@
+foreign import ccall safe "hs_bindgen_9fee0613a71e86f8" hs_bindgen_9fee0613a71e86f8_base ::
+     BG.Ptr BG.Void
+  -> BG.Ptr BG.Void
+  -> BG.Ptr BG.Void
+  -> IO BG.CUInt
+
+-- __unique:__ @Database_DuckDB_FFI_V2_Database.DuckDB.FFI.V2_Safe_duckdb_v2_qname_hash@
+hs_bindgen_9fee0613a71e86f8 ::
+     DuckDBV2QnameHandle
+  -> BG.Ptr HsBindgen.Runtime.LibC.Word64
+  -> BG.Ptr DuckDBV2ErrorInfoHandle
+  -> IO DuckDBV2Error
+hs_bindgen_9fee0613a71e86f8 =
+  \x0 ->
+    \x1 ->
+      \x2 ->
+        fmap BG.fromFFIType (hs_bindgen_9fee0613a71e86f8_base (BG.toFFIType x0) (BG.toFFIType x1) (BG.toFFIType x2))
+
+{-| __C declaration:__ @duckdb_v2_qname_hash@
+
+    __defined at:__ @duckdb_v2.h 4388:30@
+
+    __exported by:__ @duckdb_v2.h@
+-}
+c_duckdb_v2_qname_hash ::
+     DuckDBV2QnameHandle
+     -- ^ __C declaration:__ @name@
+  -> BG.Ptr HsBindgen.Runtime.LibC.Word64
+     -- ^ __C declaration:__ @hash@
+  -> BG.Ptr DuckDBV2ErrorInfoHandle
+     -- ^ __C declaration:__ @err@
+  -> IO DuckDBV2Error
+c_duckdb_v2_qname_hash = hs_bindgen_9fee0613a71e86f8
+
+-- __unique:__ @Database_DuckDB_FFI_V2_Database.DuckDB.FFI.V2_Safe_duckdb_v2_qname_destroy@
+foreign import ccall safe "hs_bindgen_48c103a2f73deaad" hs_bindgen_48c103a2f73deaad_base ::
+     BG.Ptr BG.Void
+  -> IO BG.CUInt
+
+-- __unique:__ @Database_DuckDB_FFI_V2_Database.DuckDB.FFI.V2_Safe_duckdb_v2_qname_destroy@
+hs_bindgen_48c103a2f73deaad ::
+     BG.Ptr DuckDBV2QnameHandle
+  -> IO DuckDBV2Error
+hs_bindgen_48c103a2f73deaad =
+  \x0 ->
+    fmap BG.fromFFIType (hs_bindgen_48c103a2f73deaad_base (BG.toFFIType x0))
+
+{-| __C declaration:__ @duckdb_v2_qname_destroy@
+
+    __defined at:__ @duckdb_v2.h 4405:30@
+
+    __exported by:__ @duckdb_v2.h@
+-}
+c_duckdb_v2_qname_destroy ::
+     BG.Ptr DuckDBV2QnameHandle
+     -- ^ __C declaration:__ @name@
+  -> IO DuckDBV2Error
+c_duckdb_v2_qname_destroy =
+  hs_bindgen_48c103a2f73deaad
+
+-- __unique:__ @Database_DuckDB_FFI_V2_Database.DuckDB.FFI.V2_Safe_duckdb_v2_connection_get_query_metrics@
+foreign import ccall safe "hs_bindgen_aee239d64332d77b" hs_bindgen_aee239d64332d77b_base ::
+     BG.Ptr BG.Void
+  -> BG.Ptr BG.Void
+  -> BG.Ptr BG.Void
+  -> IO BG.CUInt
+
+-- __unique:__ @Database_DuckDB_FFI_V2_Database.DuckDB.FFI.V2_Safe_duckdb_v2_connection_get_query_metrics@
+hs_bindgen_aee239d64332d77b ::
+     DuckDBV2ConnectionHandle
+  -> BG.Ptr DuckDBV2QueryMetricsHandle
+  -> BG.Ptr DuckDBV2ErrorInfoHandle
+  -> IO DuckDBV2Error
+hs_bindgen_aee239d64332d77b =
+  \x0 ->
+    \x1 ->
+      \x2 ->
+        fmap BG.fromFFIType (hs_bindgen_aee239d64332d77b_base (BG.toFFIType x0) (BG.toFFIType x1) (BG.toFFIType x2))
+
+{-| __C declaration:__ @duckdb_v2_connection_get_query_metrics@
+
+    __defined at:__ @duckdb_v2.h 4464:30@
+
+    __exported by:__ @duckdb_v2.h@
+-}
+c_duckdb_v2_connection_get_query_metrics ::
+     DuckDBV2ConnectionHandle
+     -- ^ __C declaration:__ @conn@
+  -> BG.Ptr DuckDBV2QueryMetricsHandle
+     -- ^ __C declaration:__ @metrics@
+  -> BG.Ptr DuckDBV2ErrorInfoHandle
+     -- ^ __C declaration:__ @err@
+  -> IO DuckDBV2Error
+c_duckdb_v2_connection_get_query_metrics =
+  hs_bindgen_aee239d64332d77b
+
+-- __unique:__ @Database_DuckDB_FFI_V2_Database.DuckDB.FFI.V2_Safe_duckdb_v2_connection_enable_profiling@
+foreign import ccall safe "hs_bindgen_0bdbb410fd4dd19b" hs_bindgen_0bdbb410fd4dd19b_base ::
+     BG.Ptr BG.Void
+  -> BG.CBool
+  -> BG.Ptr BG.Void
+  -> IO BG.CUInt
+
+-- __unique:__ @Database_DuckDB_FFI_V2_Database.DuckDB.FFI.V2_Safe_duckdb_v2_connection_enable_profiling@
+hs_bindgen_0bdbb410fd4dd19b ::
+     DuckDBV2ConnectionHandle
+  -> BG.CBool
+  -> BG.Ptr DuckDBV2ErrorInfoHandle
+  -> IO DuckDBV2Error
+hs_bindgen_0bdbb410fd4dd19b =
+  \x0 ->
+    \x1 ->
+      \x2 ->
+        fmap BG.fromFFIType (hs_bindgen_0bdbb410fd4dd19b_base (BG.toFFIType x0) (BG.toFFIType x1) (BG.toFFIType x2))
+
+{-| __C declaration:__ @duckdb_v2_connection_enable_profiling@
+
+    __defined at:__ @duckdb_v2.h 4487:30@
+
+    __exported by:__ @duckdb_v2.h@
+-}
+c_duckdb_v2_connection_enable_profiling ::
+     DuckDBV2ConnectionHandle
+     -- ^ __C declaration:__ @conn@
+  -> BG.CBool
+     -- ^ __C declaration:__ @enabled@
+  -> BG.Ptr DuckDBV2ErrorInfoHandle
+     -- ^ __C declaration:__ @err@
+  -> IO DuckDBV2Error
+c_duckdb_v2_connection_enable_profiling =
+  hs_bindgen_0bdbb410fd4dd19b
+
+-- __unique:__ @Database_DuckDB_FFI_V2_Database.DuckDB.FFI.V2_Safe_duckdb_v2_query_metrics_get_root@
+foreign import ccall safe "hs_bindgen_6e9c9ddf02db4b6f" hs_bindgen_6e9c9ddf02db4b6f_base ::
+     BG.Ptr BG.Void
+  -> BG.Ptr BG.Void
+  -> BG.Ptr BG.Void
+  -> IO BG.CUInt
+
+-- __unique:__ @Database_DuckDB_FFI_V2_Database.DuckDB.FFI.V2_Safe_duckdb_v2_query_metrics_get_root@
+hs_bindgen_6e9c9ddf02db4b6f ::
+     DuckDBV2QueryMetricsHandle
+  -> BG.Ptr DuckDBV2QueryMetricsNodeHandle
+  -> BG.Ptr DuckDBV2ErrorInfoHandle
+  -> IO DuckDBV2Error
+hs_bindgen_6e9c9ddf02db4b6f =
+  \x0 ->
+    \x1 ->
+      \x2 ->
+        fmap BG.fromFFIType (hs_bindgen_6e9c9ddf02db4b6f_base (BG.toFFIType x0) (BG.toFFIType x1) (BG.toFFIType x2))
+
+{-| __C declaration:__ @duckdb_v2_query_metrics_get_root@
+
+    __defined at:__ @duckdb_v2.h 4505:30@
+
+    __exported by:__ @duckdb_v2.h@
+-}
+c_duckdb_v2_query_metrics_get_root ::
+     DuckDBV2QueryMetricsHandle
+     -- ^ __C declaration:__ @metrics@
+  -> BG.Ptr DuckDBV2QueryMetricsNodeHandle
+     -- ^ __C declaration:__ @node@
+  -> BG.Ptr DuckDBV2ErrorInfoHandle
+     -- ^ __C declaration:__ @err@
+  -> IO DuckDBV2Error
+c_duckdb_v2_query_metrics_get_root =
+  hs_bindgen_6e9c9ddf02db4b6f
+
+-- __unique:__ @Database_DuckDB_FFI_V2_Database.DuckDB.FFI.V2_Safe_duckdb_v2_query_metrics_node_get_name@
+foreign import ccall safe "hs_bindgen_dff83b8c50618b55" hs_bindgen_dff83b8c50618b55_base ::
+     BG.Ptr BG.Void
+  -> BG.Ptr BG.Void
+  -> BG.Ptr BG.Void
+  -> IO BG.CUInt
+
+-- __unique:__ @Database_DuckDB_FFI_V2_Database.DuckDB.FFI.V2_Safe_duckdb_v2_query_metrics_node_get_name@
+hs_bindgen_dff83b8c50618b55 ::
+     DuckDBV2QueryMetricsNodeHandle
+  -> BG.Ptr DuckDBV2Str
+  -> BG.Ptr DuckDBV2ErrorInfoHandle
+  -> IO DuckDBV2Error
+hs_bindgen_dff83b8c50618b55 =
+  \x0 ->
+    \x1 ->
+      \x2 ->
+        fmap BG.fromFFIType (hs_bindgen_dff83b8c50618b55_base (BG.toFFIType x0) (BG.toFFIType x1) (BG.toFFIType x2))
+
+{-| __C declaration:__ @duckdb_v2_query_metrics_node_get_name@
+
+    __defined at:__ @duckdb_v2.h 4524:30@
+
+    __exported by:__ @duckdb_v2.h@
+-}
+c_duckdb_v2_query_metrics_node_get_name ::
+     DuckDBV2QueryMetricsNodeHandle
+     -- ^ __C declaration:__ @node@
+  -> BG.Ptr DuckDBV2Str
+     -- ^ __C declaration:__ @name@
+  -> BG.Ptr DuckDBV2ErrorInfoHandle
+     -- ^ __C declaration:__ @err@
+  -> IO DuckDBV2Error
+c_duckdb_v2_query_metrics_node_get_name =
+  hs_bindgen_dff83b8c50618b55
+
+-- __unique:__ @Database_DuckDB_FFI_V2_Database.DuckDB.FFI.V2_Safe_duckdb_v2_query_metrics_node_get_child_count@
+foreign import ccall safe "hs_bindgen_5e364693a7caeb31" hs_bindgen_5e364693a7caeb31_base ::
+     BG.Ptr BG.Void
+  -> BG.Ptr BG.Void
+  -> BG.Ptr BG.Void
+  -> IO BG.CUInt
+
+-- __unique:__ @Database_DuckDB_FFI_V2_Database.DuckDB.FFI.V2_Safe_duckdb_v2_query_metrics_node_get_child_count@
+hs_bindgen_5e364693a7caeb31 ::
+     DuckDBV2QueryMetricsNodeHandle
+  -> BG.Ptr DuckDBIdx
+  -> BG.Ptr DuckDBV2ErrorInfoHandle
+  -> IO DuckDBV2Error
+hs_bindgen_5e364693a7caeb31 =
+  \x0 ->
+    \x1 ->
+      \x2 ->
+        fmap BG.fromFFIType (hs_bindgen_5e364693a7caeb31_base (BG.toFFIType x0) (BG.toFFIType x1) (BG.toFFIType x2))
+
+{-| __C declaration:__ @duckdb_v2_query_metrics_node_get_child_count@
+
+    __defined at:__ @duckdb_v2.h 4543:30@
+
+    __exported by:__ @duckdb_v2.h@
+-}
+c_duckdb_v2_query_metrics_node_get_child_count ::
+     DuckDBV2QueryMetricsNodeHandle
+     -- ^ __C declaration:__ @node@
+  -> BG.Ptr DuckDBIdx
+     -- ^ __C declaration:__ @count@
+  -> BG.Ptr DuckDBV2ErrorInfoHandle
+     -- ^ __C declaration:__ @err@
+  -> IO DuckDBV2Error
+c_duckdb_v2_query_metrics_node_get_child_count =
+  hs_bindgen_5e364693a7caeb31
+
+-- __unique:__ @Database_DuckDB_FFI_V2_Database.DuckDB.FFI.V2_Safe_duckdb_v2_query_metrics_node_get_child@
+foreign import ccall safe "hs_bindgen_533edb40a7cdfba6" hs_bindgen_533edb40a7cdfba6_base ::
+     BG.Ptr BG.Void
+  -> HsBindgen.Runtime.LibC.Word64
+  -> BG.Ptr BG.Void
+  -> BG.Ptr BG.Void
+  -> IO BG.CUInt
+
+-- __unique:__ @Database_DuckDB_FFI_V2_Database.DuckDB.FFI.V2_Safe_duckdb_v2_query_metrics_node_get_child@
+hs_bindgen_533edb40a7cdfba6 ::
+     DuckDBV2QueryMetricsNodeHandle
+  -> DuckDBIdx
+  -> BG.Ptr DuckDBV2QueryMetricsNodeHandle
+  -> BG.Ptr DuckDBV2ErrorInfoHandle
+  -> IO DuckDBV2Error
+hs_bindgen_533edb40a7cdfba6 =
+  \x0 ->
+    \x1 ->
+      \x2 ->
+        \x3 ->
+          fmap BG.fromFFIType (hs_bindgen_533edb40a7cdfba6_base (BG.toFFIType x0) (BG.toFFIType x1) (BG.toFFIType x2) (BG.toFFIType x3))
+
+{-| __C declaration:__ @duckdb_v2_query_metrics_node_get_child@
+
+    __defined at:__ @duckdb_v2.h 4562:30@
+
+    __exported by:__ @duckdb_v2.h@
+-}
+c_duckdb_v2_query_metrics_node_get_child ::
+     DuckDBV2QueryMetricsNodeHandle
+     -- ^ __C declaration:__ @node@
+  -> DuckDBIdx
+     -- ^ __C declaration:__ @index@
+  -> BG.Ptr DuckDBV2QueryMetricsNodeHandle
+     -- ^ __C declaration:__ @child@
+  -> BG.Ptr DuckDBV2ErrorInfoHandle
+     -- ^ __C declaration:__ @err@
+  -> IO DuckDBV2Error
+c_duckdb_v2_query_metrics_node_get_child =
+  hs_bindgen_533edb40a7cdfba6
+
+-- __unique:__ @Database_DuckDB_FFI_V2_Database.DuckDB.FFI.V2_Safe_duckdb_v2_query_metrics_node_get_metric_count@
+foreign import ccall safe "hs_bindgen_8390ceea4cb7401a" hs_bindgen_8390ceea4cb7401a_base ::
+     BG.Ptr BG.Void
+  -> BG.Ptr BG.Void
+  -> BG.Ptr BG.Void
+  -> IO BG.CUInt
+
+-- __unique:__ @Database_DuckDB_FFI_V2_Database.DuckDB.FFI.V2_Safe_duckdb_v2_query_metrics_node_get_metric_count@
+hs_bindgen_8390ceea4cb7401a ::
+     DuckDBV2QueryMetricsNodeHandle
+  -> BG.Ptr DuckDBIdx
+  -> BG.Ptr DuckDBV2ErrorInfoHandle
+  -> IO DuckDBV2Error
+hs_bindgen_8390ceea4cb7401a =
+  \x0 ->
+    \x1 ->
+      \x2 ->
+        fmap BG.fromFFIType (hs_bindgen_8390ceea4cb7401a_base (BG.toFFIType x0) (BG.toFFIType x1) (BG.toFFIType x2))
+
+{-| __C declaration:__ @duckdb_v2_query_metrics_node_get_metric_count@
+
+    __defined at:__ @duckdb_v2.h 4582:30@
+
+    __exported by:__ @duckdb_v2.h@
+-}
+c_duckdb_v2_query_metrics_node_get_metric_count ::
+     DuckDBV2QueryMetricsNodeHandle
+     -- ^ __C declaration:__ @node@
+  -> BG.Ptr DuckDBIdx
+     -- ^ __C declaration:__ @count@
+  -> BG.Ptr DuckDBV2ErrorInfoHandle
+     -- ^ __C declaration:__ @err@
+  -> IO DuckDBV2Error
+c_duckdb_v2_query_metrics_node_get_metric_count =
+  hs_bindgen_8390ceea4cb7401a
+
+-- __unique:__ @Database_DuckDB_FFI_V2_Database.DuckDB.FFI.V2_Safe_duckdb_v2_query_metrics_node_get_metric_name@
+foreign import ccall safe "hs_bindgen_f5b6f537f8e71b7a" hs_bindgen_f5b6f537f8e71b7a_base ::
+     BG.Ptr BG.Void
+  -> HsBindgen.Runtime.LibC.Word64
+  -> BG.Ptr BG.Void
+  -> BG.Ptr BG.Void
+  -> IO BG.CUInt
+
+-- __unique:__ @Database_DuckDB_FFI_V2_Database.DuckDB.FFI.V2_Safe_duckdb_v2_query_metrics_node_get_metric_name@
+hs_bindgen_f5b6f537f8e71b7a ::
+     DuckDBV2QueryMetricsNodeHandle
+  -> DuckDBIdx
+  -> BG.Ptr DuckDBV2Str
+  -> BG.Ptr DuckDBV2ErrorInfoHandle
+  -> IO DuckDBV2Error
+hs_bindgen_f5b6f537f8e71b7a =
+  \x0 ->
+    \x1 ->
+      \x2 ->
+        \x3 ->
+          fmap BG.fromFFIType (hs_bindgen_f5b6f537f8e71b7a_base (BG.toFFIType x0) (BG.toFFIType x1) (BG.toFFIType x2) (BG.toFFIType x3))
+
+{-| __C declaration:__ @duckdb_v2_query_metrics_node_get_metric_name@
+
+    __defined at:__ @duckdb_v2.h 4602:30@
+
+    __exported by:__ @duckdb_v2.h@
+-}
+c_duckdb_v2_query_metrics_node_get_metric_name ::
+     DuckDBV2QueryMetricsNodeHandle
+     -- ^ __C declaration:__ @node@
+  -> DuckDBIdx
+     -- ^ __C declaration:__ @index@
+  -> BG.Ptr DuckDBV2Str
+     -- ^ __C declaration:__ @name@
+  -> BG.Ptr DuckDBV2ErrorInfoHandle
+     -- ^ __C declaration:__ @err@
+  -> IO DuckDBV2Error
+c_duckdb_v2_query_metrics_node_get_metric_name =
+  hs_bindgen_f5b6f537f8e71b7a
+
+-- __unique:__ @Database_DuckDB_FFI_V2_Database.DuckDB.FFI.V2_Safe_duckdb_v2_query_metrics_node_get_metric_value@
+foreign import ccall safe "hs_bindgen_041ad3ea7d99ea9e" hs_bindgen_041ad3ea7d99ea9e_base ::
+     BG.Ptr BG.Void
+  -> HsBindgen.Runtime.LibC.Word64
+  -> BG.Ptr BG.Void
+  -> BG.Ptr BG.Void
+  -> IO BG.CUInt
+
+-- __unique:__ @Database_DuckDB_FFI_V2_Database.DuckDB.FFI.V2_Safe_duckdb_v2_query_metrics_node_get_metric_value@
+hs_bindgen_041ad3ea7d99ea9e ::
+     DuckDBV2QueryMetricsNodeHandle
+  -> DuckDBIdx
+  -> BG.Ptr DuckDBV2ValueHandle
+  -> BG.Ptr DuckDBV2ErrorInfoHandle
+  -> IO DuckDBV2Error
+hs_bindgen_041ad3ea7d99ea9e =
+  \x0 ->
+    \x1 ->
+      \x2 ->
+        \x3 ->
+          fmap BG.fromFFIType (hs_bindgen_041ad3ea7d99ea9e_base (BG.toFFIType x0) (BG.toFFIType x1) (BG.toFFIType x2) (BG.toFFIType x3))
+
+{-| __C declaration:__ @duckdb_v2_query_metrics_node_get_metric_value@
+
+    __defined at:__ @duckdb_v2.h 4622:30@
+
+    __exported by:__ @duckdb_v2.h@
+-}
+c_duckdb_v2_query_metrics_node_get_metric_value ::
+     DuckDBV2QueryMetricsNodeHandle
+     -- ^ __C declaration:__ @node@
+  -> DuckDBIdx
+     -- ^ __C declaration:__ @index@
+  -> BG.Ptr DuckDBV2ValueHandle
+     -- ^ __C declaration:__ @value@
+  -> BG.Ptr DuckDBV2ErrorInfoHandle
+     -- ^ __C declaration:__ @err@
+  -> IO DuckDBV2Error
+c_duckdb_v2_query_metrics_node_get_metric_value =
+  hs_bindgen_041ad3ea7d99ea9e
+
+-- __unique:__ @Database_DuckDB_FFI_V2_Database.DuckDB.FFI.V2_Safe_duckdb_v2_query_metrics_node_get_metric@
+foreign import ccall safe "hs_bindgen_1222733778a4b36c" hs_bindgen_1222733778a4b36c_base ::
+     BG.Ptr BG.Void
+  -> BG.Ptr BG.Void
+  -> BG.Ptr BG.Void
+  -> BG.Ptr BG.Void
+  -> BG.Ptr BG.Void
+  -> IO BG.CUInt
+
+-- __unique:__ @Database_DuckDB_FFI_V2_Database.DuckDB.FFI.V2_Safe_duckdb_v2_query_metrics_node_get_metric@
+hs_bindgen_1222733778a4b36c ::
+     DuckDBV2QueryMetricsNodeHandle
+  -> PtrConst.PtrConst DuckDBV2Str
+  -> BG.Ptr DuckDBV2ValueHandle
+  -> BG.Ptr BG.CBool
+  -> BG.Ptr DuckDBV2ErrorInfoHandle
+  -> IO DuckDBV2Error
+hs_bindgen_1222733778a4b36c =
+  \x0 ->
+    \x1 ->
+      \x2 ->
+        \x3 ->
+          \x4 ->
+            fmap BG.fromFFIType (hs_bindgen_1222733778a4b36c_base (BG.toFFIType x0) (BG.toFFIType x1) (BG.toFFIType x2) (BG.toFFIType x3) (BG.toFFIType x4))
+
+{-| __C declaration:__ @duckdb_v2_query_metrics_node_get_metric@
+
+    __defined at:__ @duckdb_v2.h 4643:30@
+
+    __exported by:__ @duckdb_v2.h@
+-}
+c_duckdb_v2_query_metrics_node_get_metric ::
+     DuckDBV2QueryMetricsNodeHandle
+     -- ^ __C declaration:__ @node@
+  -> PtrConst.PtrConst DuckDBV2Str
+     -- ^ __C declaration:__ @name@
+  -> BG.Ptr DuckDBV2ValueHandle
+     -- ^ __C declaration:__ @value@
+  -> BG.Ptr BG.CBool
+     -- ^ __C declaration:__ @present@
+  -> BG.Ptr DuckDBV2ErrorInfoHandle
+     -- ^ __C declaration:__ @err@
+  -> IO DuckDBV2Error
+c_duckdb_v2_query_metrics_node_get_metric =
+  hs_bindgen_1222733778a4b36c
+
+-- __unique:__ @Database_DuckDB_FFI_V2_Database.DuckDB.FFI.V2_Safe_duckdb_v2_query_metrics_destroy@
+foreign import ccall safe "hs_bindgen_fddb763a22a5c4ad" hs_bindgen_fddb763a22a5c4ad_base ::
+     BG.Ptr BG.Void
+  -> IO BG.CUInt
+
+-- __unique:__ @Database_DuckDB_FFI_V2_Database.DuckDB.FFI.V2_Safe_duckdb_v2_query_metrics_destroy@
+hs_bindgen_fddb763a22a5c4ad ::
+     BG.Ptr DuckDBV2QueryMetricsHandle
+  -> IO DuckDBV2Error
+hs_bindgen_fddb763a22a5c4ad =
+  \x0 ->
+    fmap BG.fromFFIType (hs_bindgen_fddb763a22a5c4ad_base (BG.toFFIType x0))
+
+{-| __C declaration:__ @duckdb_v2_query_metrics_destroy@
+
+    __defined at:__ @duckdb_v2.h 4662:30@
+
+    __exported by:__ @duckdb_v2.h@
+-}
+c_duckdb_v2_query_metrics_destroy ::
+     BG.Ptr DuckDBV2QueryMetricsHandle
+     -- ^ __C declaration:__ @metrics@
+  -> IO DuckDBV2Error
+c_duckdb_v2_query_metrics_destroy =
+  hs_bindgen_fddb763a22a5c4ad
+
+-- __unique:__ @Database_DuckDB_FFI_V2_Database.DuckDB.FFI.V2_Safe_duckdb_v2_schema_get_count@
+foreign import ccall safe "hs_bindgen_3153e0ec5d5ca736" hs_bindgen_3153e0ec5d5ca736_base ::
+     BG.Ptr BG.Void
+  -> BG.Ptr BG.Void
+  -> BG.Ptr BG.Void
+  -> IO BG.CUInt
+
+-- __unique:__ @Database_DuckDB_FFI_V2_Database.DuckDB.FFI.V2_Safe_duckdb_v2_schema_get_count@
+hs_bindgen_3153e0ec5d5ca736 ::
+     DuckDBV2SchemaHandle
+  -> BG.Ptr DuckDBIdx
+  -> BG.Ptr DuckDBV2ErrorInfoHandle
+  -> IO DuckDBV2Error
+hs_bindgen_3153e0ec5d5ca736 =
+  \x0 ->
+    \x1 ->
+      \x2 ->
+        fmap BG.fromFFIType (hs_bindgen_3153e0ec5d5ca736_base (BG.toFFIType x0) (BG.toFFIType x1) (BG.toFFIType x2))
+
+{-| __C declaration:__ @duckdb_v2_schema_get_count@
+
+    __defined at:__ @duckdb_v2.h 4703:30@
+
+    __exported by:__ @duckdb_v2.h@
+-}
+c_duckdb_v2_schema_get_count ::
+     DuckDBV2SchemaHandle
+     -- ^ __C declaration:__ @schema@
+  -> BG.Ptr DuckDBIdx
+     -- ^ __C declaration:__ @out_count@
+  -> BG.Ptr DuckDBV2ErrorInfoHandle
+     -- ^ __C declaration:__ @err@
+  -> IO DuckDBV2Error
+c_duckdb_v2_schema_get_count =
+  hs_bindgen_3153e0ec5d5ca736
+
+-- __unique:__ @Database_DuckDB_FFI_V2_Database.DuckDB.FFI.V2_Safe_duckdb_v2_schema_get_field@
+foreign import ccall safe "hs_bindgen_f6a923bbcc88cfd8" hs_bindgen_f6a923bbcc88cfd8_base ::
+     BG.Ptr BG.Void
+  -> HsBindgen.Runtime.LibC.Word64
+  -> BG.Ptr BG.Void
+  -> BG.Ptr BG.Void
+  -> BG.Ptr BG.Void
+  -> IO BG.CUInt
+
+-- __unique:__ @Database_DuckDB_FFI_V2_Database.DuckDB.FFI.V2_Safe_duckdb_v2_schema_get_field@
+hs_bindgen_f6a923bbcc88cfd8 ::
+     DuckDBV2SchemaHandle
+  -> DuckDBIdx
+  -> BG.Ptr DuckDBV2IdentifierT
+  -> BG.Ptr DuckDBV2LogicalTypeHandle
+  -> BG.Ptr DuckDBV2ErrorInfoHandle
+  -> IO DuckDBV2Error
+hs_bindgen_f6a923bbcc88cfd8 =
+  \x0 ->
+    \x1 ->
+      \x2 ->
+        \x3 ->
+          \x4 ->
+            fmap BG.fromFFIType (hs_bindgen_f6a923bbcc88cfd8_base (BG.toFFIType x0) (BG.toFFIType x1) (BG.toFFIType x2) (BG.toFFIType x3) (BG.toFFIType x4))
+
+{-| __C declaration:__ @duckdb_v2_schema_get_field@
+
+    __defined at:__ @duckdb_v2.h 4724:30@
+
+    __exported by:__ @duckdb_v2.h@
+-}
+c_duckdb_v2_schema_get_field ::
+     DuckDBV2SchemaHandle
+     -- ^ __C declaration:__ @schema@
+  -> DuckDBIdx
+     -- ^ __C declaration:__ @index@
+  -> BG.Ptr DuckDBV2IdentifierT
+     -- ^ __C declaration:__ @out_name@
+  -> BG.Ptr DuckDBV2LogicalTypeHandle
+     -- ^ __C declaration:__ @out_type@
+  -> BG.Ptr DuckDBV2ErrorInfoHandle
+     -- ^ __C declaration:__ @err@
+  -> IO DuckDBV2Error
+c_duckdb_v2_schema_get_field =
+  hs_bindgen_f6a923bbcc88cfd8
+
+-- __unique:__ @Database_DuckDB_FFI_V2_Database.DuckDB.FFI.V2_Safe_duckdb_v2_schema_destroy@
+foreign import ccall safe "hs_bindgen_6fd0ddc1718938a3" hs_bindgen_6fd0ddc1718938a3_base ::
+     BG.Ptr BG.Void
+  -> IO BG.CUInt
+
+-- __unique:__ @Database_DuckDB_FFI_V2_Database.DuckDB.FFI.V2_Safe_duckdb_v2_schema_destroy@
+hs_bindgen_6fd0ddc1718938a3 ::
+     BG.Ptr DuckDBV2SchemaHandle
+  -> IO DuckDBV2Error
+hs_bindgen_6fd0ddc1718938a3 =
+  \x0 ->
+    fmap BG.fromFFIType (hs_bindgen_6fd0ddc1718938a3_base (BG.toFFIType x0))
+
+{-| __C declaration:__ @duckdb_v2_schema_destroy@
+
+    __defined at:__ @duckdb_v2.h 4743:30@
+
+    __exported by:__ @duckdb_v2.h@
+-}
+c_duckdb_v2_schema_destroy ::
+     BG.Ptr DuckDBV2SchemaHandle
+     -- ^ __C declaration:__ @schema@
+  -> IO DuckDBV2Error
+c_duckdb_v2_schema_destroy =
+  hs_bindgen_6fd0ddc1718938a3
+
+-- __unique:__ @Database_DuckDB_FFI_V2_Database.DuckDB.FFI.V2_Safe_duckdb_v2_tokenize_sql@
+foreign import ccall safe "hs_bindgen_75088b1e73c315b5" hs_bindgen_75088b1e73c315b5_base ::
+     BG.Ptr BG.Void
+  -> BG.Ptr BG.Void
+  -> BG.Ptr BG.Void
+  -> BG.Ptr BG.Void
+  -> IO BG.CUInt
+
+-- __unique:__ @Database_DuckDB_FFI_V2_Database.DuckDB.FFI.V2_Safe_duckdb_v2_tokenize_sql@
+hs_bindgen_75088b1e73c315b5 ::
+     DuckDBV2ConnectionHandle
+  -> PtrConst.PtrConst DuckDBV2Str
+  -> BG.Ptr DuckDBV2TokenIteratorHandle
+  -> BG.Ptr DuckDBV2ErrorInfoHandle
+  -> IO DuckDBV2Error
+hs_bindgen_75088b1e73c315b5 =
+  \x0 ->
+    \x1 ->
+      \x2 ->
+        \x3 ->
+          fmap BG.fromFFIType (hs_bindgen_75088b1e73c315b5_base (BG.toFFIType x0) (BG.toFFIType x1) (BG.toFFIType x2) (BG.toFFIType x3))
+
+{-| __C declaration:__ @duckdb_v2_tokenize_sql@
+
+    __defined at:__ @duckdb_v2.h 4823:30@
+
+    __exported by:__ @duckdb_v2.h@
+-}
+c_duckdb_v2_tokenize_sql ::
+     DuckDBV2ConnectionHandle
+     -- ^ __C declaration:__ @conn@
+  -> PtrConst.PtrConst DuckDBV2Str
+     -- ^ __C declaration:__ @sql@
+  -> BG.Ptr DuckDBV2TokenIteratorHandle
+     -- ^ __C declaration:__ @out_iterator@
+  -> BG.Ptr DuckDBV2ErrorInfoHandle
+     -- ^ __C declaration:__ @err@
+  -> IO DuckDBV2Error
+c_duckdb_v2_tokenize_sql =
+  hs_bindgen_75088b1e73c315b5
+
+-- __unique:__ @Database_DuckDB_FFI_V2_Database.DuckDB.FFI.V2_Safe_duckdb_v2_token_iterator_next@
+foreign import ccall safe "hs_bindgen_3cfdd08b2282d0b5" hs_bindgen_3cfdd08b2282d0b5_base ::
+     BG.Ptr BG.Void
+  -> BG.Ptr BG.Void
+  -> BG.Ptr BG.Void
+  -> BG.Ptr BG.Void
+  -> BG.Ptr BG.Void
+  -> IO BG.CUInt
+
+-- __unique:__ @Database_DuckDB_FFI_V2_Database.DuckDB.FFI.V2_Safe_duckdb_v2_token_iterator_next@
+hs_bindgen_3cfdd08b2282d0b5 ::
+     DuckDBV2TokenIteratorHandle
+  -> BG.Ptr DuckDBV2TokenType
+  -> BG.Ptr DuckDBIdx
+  -> BG.Ptr DuckDBIdx
+  -> BG.Ptr DuckDBV2ErrorInfoHandle
+  -> IO DuckDBV2Error
+hs_bindgen_3cfdd08b2282d0b5 =
+  \x0 ->
+    \x1 ->
+      \x2 ->
+        \x3 ->
+          \x4 ->
+            fmap BG.fromFFIType (hs_bindgen_3cfdd08b2282d0b5_base (BG.toFFIType x0) (BG.toFFIType x1) (BG.toFFIType x2) (BG.toFFIType x3) (BG.toFFIType x4))
+
+{-| __C declaration:__ @duckdb_v2_token_iterator_next@
+
+    __defined at:__ @duckdb_v2.h 4846:30@
+
+    __exported by:__ @duckdb_v2.h@
+-}
+c_duckdb_v2_token_iterator_next ::
+     DuckDBV2TokenIteratorHandle
+     -- ^ __C declaration:__ @iterator@
+  -> BG.Ptr DuckDBV2TokenType
+     -- ^ __C declaration:__ @out_type@
+  -> BG.Ptr DuckDBIdx
+     -- ^ __C declaration:__ @out_start@
+  -> BG.Ptr DuckDBIdx
+     -- ^ __C declaration:__ @out_length@
+  -> BG.Ptr DuckDBV2ErrorInfoHandle
+     -- ^ __C declaration:__ @err@
+  -> IO DuckDBV2Error
+c_duckdb_v2_token_iterator_next =
+  hs_bindgen_3cfdd08b2282d0b5
+
+-- __unique:__ @Database_DuckDB_FFI_V2_Database.DuckDB.FFI.V2_Safe_duckdb_v2_token_iterator_ends_unterminated@
+foreign import ccall safe "hs_bindgen_4953d5311b118142" hs_bindgen_4953d5311b118142_base ::
+     BG.Ptr BG.Void
+  -> BG.Ptr BG.Void
+  -> BG.Ptr BG.Void
+  -> IO BG.CUInt
+
+-- __unique:__ @Database_DuckDB_FFI_V2_Database.DuckDB.FFI.V2_Safe_duckdb_v2_token_iterator_ends_unterminated@
+hs_bindgen_4953d5311b118142 ::
+     DuckDBV2TokenIteratorHandle
+  -> BG.Ptr BG.CBool
+  -> BG.Ptr DuckDBV2ErrorInfoHandle
+  -> IO DuckDBV2Error
+hs_bindgen_4953d5311b118142 =
+  \x0 ->
+    \x1 ->
+      \x2 ->
+        fmap BG.fromFFIType (hs_bindgen_4953d5311b118142_base (BG.toFFIType x0) (BG.toFFIType x1) (BG.toFFIType x2))
+
+{-| __C declaration:__ @duckdb_v2_token_iterator_ends_unterminated@
+
+    __defined at:__ @duckdb_v2.h 4869:30@
+
+    __exported by:__ @duckdb_v2.h@
+-}
+c_duckdb_v2_token_iterator_ends_unterminated ::
+     DuckDBV2TokenIteratorHandle
+     -- ^ __C declaration:__ @iterator@
+  -> BG.Ptr BG.CBool
+     -- ^ __C declaration:__ @out_ends_unterminated@
+  -> BG.Ptr DuckDBV2ErrorInfoHandle
+     -- ^ __C declaration:__ @err@
+  -> IO DuckDBV2Error
+c_duckdb_v2_token_iterator_ends_unterminated =
+  hs_bindgen_4953d5311b118142
+
+-- __unique:__ @Database_DuckDB_FFI_V2_Database.DuckDB.FFI.V2_Safe_duckdb_v2_token_iterator_destroy@
+foreign import ccall safe "hs_bindgen_26fa817a17ff8ac4" hs_bindgen_26fa817a17ff8ac4_base ::
+     BG.Ptr BG.Void
+  -> IO BG.CUInt
+
+-- __unique:__ @Database_DuckDB_FFI_V2_Database.DuckDB.FFI.V2_Safe_duckdb_v2_token_iterator_destroy@
+hs_bindgen_26fa817a17ff8ac4 ::
+     BG.Ptr DuckDBV2TokenIteratorHandle
+  -> IO DuckDBV2Error
+hs_bindgen_26fa817a17ff8ac4 =
+  \x0 ->
+    fmap BG.fromFFIType (hs_bindgen_26fa817a17ff8ac4_base (BG.toFFIType x0))
+
+{-| __C declaration:__ @duckdb_v2_token_iterator_destroy@
+
+    __defined at:__ @duckdb_v2.h 4884:30@
+
+    __exported by:__ @duckdb_v2.h@
+-}
+c_duckdb_v2_token_iterator_destroy ::
+     BG.Ptr DuckDBV2TokenIteratorHandle
+     -- ^ __C declaration:__ @iterator@
+  -> IO DuckDBV2Error
+c_duckdb_v2_token_iterator_destroy =
+  hs_bindgen_26fa817a17ff8ac4
+
+-- __unique:__ @Database_DuckDB_FFI_V2_Database.DuckDB.FFI.V2_Safe_duckdb_v2_aggregate_function_create@
+foreign import ccall safe "hs_bindgen_c8397766adf171de" hs_bindgen_c8397766adf171de_base ::
+     BG.Ptr BG.Void
+  -> BG.Ptr BG.Void
+  -> BG.Ptr BG.Void
+  -> IO BG.CUInt
+
+-- __unique:__ @Database_DuckDB_FFI_V2_Database.DuckDB.FFI.V2_Safe_duckdb_v2_aggregate_function_create@
+hs_bindgen_c8397766adf171de ::
+     DuckDBV2FactoryHandle
+  -> BG.Ptr DuckDBV2AggregateFunctionHandle
+  -> BG.Ptr DuckDBV2ErrorInfoHandle
+  -> IO DuckDBV2Error
+hs_bindgen_c8397766adf171de =
+  \x0 ->
+    \x1 ->
+      \x2 ->
+        fmap BG.fromFFIType (hs_bindgen_c8397766adf171de_base (BG.toFFIType x0) (BG.toFFIType x1) (BG.toFFIType x2))
+
+{-| __C declaration:__ @duckdb_v2_aggregate_function_create@
+
+    __defined at:__ @duckdb_v2.h 5023:30@
+
+    __exported by:__ @duckdb_v2.h@
+-}
+c_duckdb_v2_aggregate_function_create ::
+     DuckDBV2FactoryHandle
+     -- ^ __C declaration:__ @factory@
+  -> BG.Ptr DuckDBV2AggregateFunctionHandle
+     -- ^ __C declaration:__ @function@
+  -> BG.Ptr DuckDBV2ErrorInfoHandle
+     -- ^ __C declaration:__ @err@
+  -> IO DuckDBV2Error
+c_duckdb_v2_aggregate_function_create =
+  hs_bindgen_c8397766adf171de
+
+-- __unique:__ @Database_DuckDB_FFI_V2_Database.DuckDB.FFI.V2_Safe_duckdb_v2_aggregate_function_set_name@
+foreign import ccall safe "hs_bindgen_f436b75dad10c820" hs_bindgen_f436b75dad10c820_base ::
+     BG.Ptr BG.Void
+  -> BG.Ptr BG.Void
+  -> BG.Ptr BG.Void
+  -> IO BG.CUInt
+
+-- __unique:__ @Database_DuckDB_FFI_V2_Database.DuckDB.FFI.V2_Safe_duckdb_v2_aggregate_function_set_name@
+hs_bindgen_f436b75dad10c820 ::
+     DuckDBV2AggregateFunctionHandle
+  -> PtrConst.PtrConst DuckDBV2IdentifierT
+  -> BG.Ptr DuckDBV2ErrorInfoHandle
+  -> IO DuckDBV2Error
+hs_bindgen_f436b75dad10c820 =
+  \x0 ->
+    \x1 ->
+      \x2 ->
+        fmap BG.fromFFIType (hs_bindgen_f436b75dad10c820_base (BG.toFFIType x0) (BG.toFFIType x1) (BG.toFFIType x2))
+
+{-| __C declaration:__ @duckdb_v2_aggregate_function_set_name@
+
+    __defined at:__ @duckdb_v2.h 5044:30@
+
+    __exported by:__ @duckdb_v2.h@
+-}
+c_duckdb_v2_aggregate_function_set_name ::
+     DuckDBV2AggregateFunctionHandle
+     -- ^ __C declaration:__ @function@
+  -> PtrConst.PtrConst DuckDBV2IdentifierT
+     -- ^ __C declaration:__ @name@
+  -> BG.Ptr DuckDBV2ErrorInfoHandle
+     -- ^ __C declaration:__ @err@
+  -> IO DuckDBV2Error
+c_duckdb_v2_aggregate_function_set_name =
+  hs_bindgen_f436b75dad10c820
+
+-- __unique:__ @Database_DuckDB_FFI_V2_Database.DuckDB.FFI.V2_Safe_duckdb_v2_aggregate_function_get_docs@
+foreign import ccall safe "hs_bindgen_1b291982b1956416" hs_bindgen_1b291982b1956416_base ::
+     BG.Ptr BG.Void
+  -> BG.Ptr BG.Void
+  -> BG.Ptr BG.Void
+  -> IO BG.CUInt
+
+-- __unique:__ @Database_DuckDB_FFI_V2_Database.DuckDB.FFI.V2_Safe_duckdb_v2_aggregate_function_get_docs@
+hs_bindgen_1b291982b1956416 ::
+     DuckDBV2AggregateFunctionHandle
+  -> BG.Ptr DuckDBV2FunctionDocsHandle
+  -> BG.Ptr DuckDBV2ErrorInfoHandle
+  -> IO DuckDBV2Error
+hs_bindgen_1b291982b1956416 =
+  \x0 ->
+    \x1 ->
+      \x2 ->
+        fmap BG.fromFFIType (hs_bindgen_1b291982b1956416_base (BG.toFFIType x0) (BG.toFFIType x1) (BG.toFFIType x2))
+
+{-| __C declaration:__ @duckdb_v2_aggregate_function_get_docs@
+
+    __defined at:__ @duckdb_v2.h 5066:30@
+
+    __exported by:__ @duckdb_v2.h@
+-}
+c_duckdb_v2_aggregate_function_get_docs ::
+     DuckDBV2AggregateFunctionHandle
+     -- ^ __C declaration:__ @function@
+  -> BG.Ptr DuckDBV2FunctionDocsHandle
+     -- ^ __C declaration:__ @docs@
+  -> BG.Ptr DuckDBV2ErrorInfoHandle
+     -- ^ __C declaration:__ @err@
+  -> IO DuckDBV2Error
+c_duckdb_v2_aggregate_function_get_docs =
+  hs_bindgen_1b291982b1956416
+
+-- __unique:__ @Database_DuckDB_FFI_V2_Database.DuckDB.FFI.V2_Safe_duckdb_v2_aggregate_function_get_signature@
+foreign import ccall safe "hs_bindgen_9ba4b7d35bae6d6c" hs_bindgen_9ba4b7d35bae6d6c_base ::
+     BG.Ptr BG.Void
+  -> BG.Ptr BG.Void
+  -> BG.Ptr BG.Void
+  -> IO BG.CUInt
+
+-- __unique:__ @Database_DuckDB_FFI_V2_Database.DuckDB.FFI.V2_Safe_duckdb_v2_aggregate_function_get_signature@
+hs_bindgen_9ba4b7d35bae6d6c ::
+     DuckDBV2AggregateFunctionHandle
+  -> BG.Ptr DuckDBV2FunctionSignatureHandle
+  -> BG.Ptr DuckDBV2ErrorInfoHandle
+  -> IO DuckDBV2Error
+hs_bindgen_9ba4b7d35bae6d6c =
+  \x0 ->
+    \x1 ->
+      \x2 ->
+        fmap BG.fromFFIType (hs_bindgen_9ba4b7d35bae6d6c_base (BG.toFFIType x0) (BG.toFFIType x1) (BG.toFFIType x2))
+
+{-| __C declaration:__ @duckdb_v2_aggregate_function_get_signature@
+
+    __defined at:__ @duckdb_v2.h 5088:30@
+
+    __exported by:__ @duckdb_v2.h@
+-}
+c_duckdb_v2_aggregate_function_get_signature ::
+     DuckDBV2AggregateFunctionHandle
+     -- ^ __C declaration:__ @function@
+  -> BG.Ptr DuckDBV2FunctionSignatureHandle
+     -- ^ __C declaration:__ @sig@
+  -> BG.Ptr DuckDBV2ErrorInfoHandle
+     -- ^ __C declaration:__ @err@
+  -> IO DuckDBV2Error
+c_duckdb_v2_aggregate_function_get_signature =
+  hs_bindgen_9ba4b7d35bae6d6c
+
+-- __unique:__ @Database_DuckDB_FFI_V2_Database.DuckDB.FFI.V2_Safe_duckdb_v2_aggregate_function_set_user_data@
+foreign import ccall safe "hs_bindgen_0bc6d5c1ec072ce6" hs_bindgen_0bc6d5c1ec072ce6_base ::
+     BG.Ptr BG.Void
+  -> BG.Ptr BG.Void
+  -> BG.Ptr BG.Void
+  -> IO BG.CUInt
+
+-- __unique:__ @Database_DuckDB_FFI_V2_Database.DuckDB.FFI.V2_Safe_duckdb_v2_aggregate_function_set_user_data@
+hs_bindgen_0bc6d5c1ec072ce6 ::
+     DuckDBV2AggregateFunctionHandle
+  -> BG.Ptr DuckDBV2Opaque
+  -> BG.Ptr DuckDBV2ErrorInfoHandle
+  -> IO DuckDBV2Error
+hs_bindgen_0bc6d5c1ec072ce6 =
+  \x0 ->
+    \x1 ->
+      \x2 ->
+        fmap BG.fromFFIType (hs_bindgen_0bc6d5c1ec072ce6_base (BG.toFFIType x0) (BG.toFFIType x1) (BG.toFFIType x2))
+
+{-| __C declaration:__ @duckdb_v2_aggregate_function_set_user_data@
+
+    __defined at:__ @duckdb_v2.h 5110:30@
+
+    __exported by:__ @duckdb_v2.h@
+-}
+c_duckdb_v2_aggregate_function_set_user_data ::
+     DuckDBV2AggregateFunctionHandle
+     -- ^ __C declaration:__ @function@
+  -> BG.Ptr DuckDBV2Opaque
+     -- ^ __C declaration:__ @data@
+  -> BG.Ptr DuckDBV2ErrorInfoHandle
+     -- ^ __C declaration:__ @err@
+  -> IO DuckDBV2Error
+c_duckdb_v2_aggregate_function_set_user_data =
+  hs_bindgen_0bc6d5c1ec072ce6
+
+-- __unique:__ @Database_DuckDB_FFI_V2_Database.DuckDB.FFI.V2_Safe_duckdb_v2_aggregate_function_set_property@
+foreign import ccall safe "hs_bindgen_bdf9d43799abc2b6" hs_bindgen_bdf9d43799abc2b6_base ::
+     BG.Ptr BG.Void
+  -> BG.CUInt
+  -> BG.CUInt
+  -> BG.Ptr BG.Void
+  -> IO BG.CUInt
+
+-- __unique:__ @Database_DuckDB_FFI_V2_Database.DuckDB.FFI.V2_Safe_duckdb_v2_aggregate_function_set_property@
+hs_bindgen_bdf9d43799abc2b6 ::
+     DuckDBV2AggregateFunctionHandle
+  -> DuckDBV2FunctionPropertyKey
+  -> DuckDBV2FunctionPropertyValue
+  -> BG.Ptr DuckDBV2ErrorInfoHandle
+  -> IO DuckDBV2Error
+hs_bindgen_bdf9d43799abc2b6 =
+  \x0 ->
+    \x1 ->
+      \x2 ->
+        \x3 ->
+          fmap BG.fromFFIType (hs_bindgen_bdf9d43799abc2b6_base (BG.toFFIType x0) (BG.toFFIType x1) (BG.toFFIType x2) (BG.toFFIType x3))
+
+{-| __C declaration:__ @duckdb_v2_aggregate_function_set_property@
+
+    __defined at:__ @duckdb_v2.h 5134:30@
+
+    __exported by:__ @duckdb_v2.h@
+-}
+c_duckdb_v2_aggregate_function_set_property ::
+     DuckDBV2AggregateFunctionHandle
+     -- ^ __C declaration:__ @function@
+  -> DuckDBV2FunctionPropertyKey
+     -- ^ __C declaration:__ @key@
+  -> DuckDBV2FunctionPropertyValue
+     -- ^ __C declaration:__ @value@
+  -> BG.Ptr DuckDBV2ErrorInfoHandle
+     -- ^ __C declaration:__ @err@
+  -> IO DuckDBV2Error
+c_duckdb_v2_aggregate_function_set_property =
+  hs_bindgen_bdf9d43799abc2b6
+
+-- __unique:__ @Database_DuckDB_FFI_V2_Database.DuckDB.FFI.V2_Safe_duckdb_v2_aggregate_function_set_bind_callback@
+foreign import ccall safe "hs_bindgen_9a6452902b78eae7" hs_bindgen_9a6452902b78eae7_base ::
+     BG.Ptr BG.Void
+  -> BG.FunPtr BG.Void
+  -> BG.Ptr BG.Void
+  -> IO BG.CUInt
+
+-- __unique:__ @Database_DuckDB_FFI_V2_Database.DuckDB.FFI.V2_Safe_duckdb_v2_aggregate_function_set_bind_callback@
+hs_bindgen_9a6452902b78eae7 ::
+     DuckDBV2AggregateFunctionHandle
+  -> DuckDBV2AggregateFunctionBindCallbackFn
+  -> BG.Ptr DuckDBV2ErrorInfoHandle
+  -> IO DuckDBV2Error
+hs_bindgen_9a6452902b78eae7 =
+  \x0 ->
+    \x1 ->
+      \x2 ->
+        fmap BG.fromFFIType (hs_bindgen_9a6452902b78eae7_base (BG.toFFIType x0) (BG.toFFIType x1) (BG.toFFIType x2))
+
+{-| __C declaration:__ @duckdb_v2_aggregate_function_set_bind_callback@
+
+    __defined at:__ @duckdb_v2.h 5158:30@
+
+    __exported by:__ @duckdb_v2.h@
+-}
+c_duckdb_v2_aggregate_function_set_bind_callback ::
+     DuckDBV2AggregateFunctionHandle
+     -- ^ __C declaration:__ @function@
+  -> DuckDBV2AggregateFunctionBindCallbackFn
+     -- ^ __C declaration:__ @callback@
+  -> BG.Ptr DuckDBV2ErrorInfoHandle
+     -- ^ __C declaration:__ @err@
+  -> IO DuckDBV2Error
+c_duckdb_v2_aggregate_function_set_bind_callback =
+  hs_bindgen_9a6452902b78eae7
+
+-- __unique:__ @Database_DuckDB_FFI_V2_Database.DuckDB.FFI.V2_Safe_duckdb_v2_aggregate_function_set_size_callback@
+foreign import ccall safe "hs_bindgen_5a532af8d9e4bcf8" hs_bindgen_5a532af8d9e4bcf8_base ::
+     BG.Ptr BG.Void
+  -> BG.FunPtr BG.Void
+  -> BG.Ptr BG.Void
+  -> IO BG.CUInt
+
+-- __unique:__ @Database_DuckDB_FFI_V2_Database.DuckDB.FFI.V2_Safe_duckdb_v2_aggregate_function_set_size_callback@
+hs_bindgen_5a532af8d9e4bcf8 ::
+     DuckDBV2AggregateFunctionHandle
+  -> DuckDBV2AggregateFunctionSizeCallbackFn
+  -> BG.Ptr DuckDBV2ErrorInfoHandle
+  -> IO DuckDBV2Error
+hs_bindgen_5a532af8d9e4bcf8 =
+  \x0 ->
+    \x1 ->
+      \x2 ->
+        fmap BG.fromFFIType (hs_bindgen_5a532af8d9e4bcf8_base (BG.toFFIType x0) (BG.toFFIType x1) (BG.toFFIType x2))
+
+{-| __C declaration:__ @duckdb_v2_aggregate_function_set_size_callback@
+
+    __defined at:__ @duckdb_v2.h 5180:30@
+
+    __exported by:__ @duckdb_v2.h@
+-}
+c_duckdb_v2_aggregate_function_set_size_callback ::
+     DuckDBV2AggregateFunctionHandle
+     -- ^ __C declaration:__ @function@
+  -> DuckDBV2AggregateFunctionSizeCallbackFn
+     -- ^ __C declaration:__ @callback@
+  -> BG.Ptr DuckDBV2ErrorInfoHandle
+     -- ^ __C declaration:__ @err@
+  -> IO DuckDBV2Error
+c_duckdb_v2_aggregate_function_set_size_callback =
+  hs_bindgen_5a532af8d9e4bcf8
+
+-- __unique:__ @Database_DuckDB_FFI_V2_Database.DuckDB.FFI.V2_Safe_duckdb_v2_aggregate_function_set_init_callback@
+foreign import ccall safe "hs_bindgen_20e557f15bb18397" hs_bindgen_20e557f15bb18397_base ::
+     BG.Ptr BG.Void
+  -> BG.FunPtr BG.Void
+  -> BG.Ptr BG.Void
+  -> IO BG.CUInt
+
+-- __unique:__ @Database_DuckDB_FFI_V2_Database.DuckDB.FFI.V2_Safe_duckdb_v2_aggregate_function_set_init_callback@
+hs_bindgen_20e557f15bb18397 ::
+     DuckDBV2AggregateFunctionHandle
+  -> DuckDBV2AggregateFunctionInitCallbackFn
+  -> BG.Ptr DuckDBV2ErrorInfoHandle
+  -> IO DuckDBV2Error
+hs_bindgen_20e557f15bb18397 =
+  \x0 ->
+    \x1 ->
+      \x2 ->
+        fmap BG.fromFFIType (hs_bindgen_20e557f15bb18397_base (BG.toFFIType x0) (BG.toFFIType x1) (BG.toFFIType x2))
+
+{-| __C declaration:__ @duckdb_v2_aggregate_function_set_init_callback@
+
+    __defined at:__ @duckdb_v2.h 5201:30@
+
+    __exported by:__ @duckdb_v2.h@
+-}
+c_duckdb_v2_aggregate_function_set_init_callback ::
+     DuckDBV2AggregateFunctionHandle
+     -- ^ __C declaration:__ @function@
+  -> DuckDBV2AggregateFunctionInitCallbackFn
+     -- ^ __C declaration:__ @callback@
+  -> BG.Ptr DuckDBV2ErrorInfoHandle
+     -- ^ __C declaration:__ @err@
+  -> IO DuckDBV2Error
+c_duckdb_v2_aggregate_function_set_init_callback =
+  hs_bindgen_20e557f15bb18397
+
+-- __unique:__ @Database_DuckDB_FFI_V2_Database.DuckDB.FFI.V2_Safe_duckdb_v2_aggregate_function_set_update_callback@
+foreign import ccall safe "hs_bindgen_f941c706b3c71e2e" hs_bindgen_f941c706b3c71e2e_base ::
+     BG.Ptr BG.Void
+  -> BG.FunPtr BG.Void
+  -> BG.Ptr BG.Void
+  -> IO BG.CUInt
+
+-- __unique:__ @Database_DuckDB_FFI_V2_Database.DuckDB.FFI.V2_Safe_duckdb_v2_aggregate_function_set_update_callback@
+hs_bindgen_f941c706b3c71e2e ::
+     DuckDBV2AggregateFunctionHandle
+  -> DuckDBV2AggregateFunctionUpdateCallbackFn
+  -> BG.Ptr DuckDBV2ErrorInfoHandle
+  -> IO DuckDBV2Error
+hs_bindgen_f941c706b3c71e2e =
+  \x0 ->
+    \x1 ->
+      \x2 ->
+        fmap BG.fromFFIType (hs_bindgen_f941c706b3c71e2e_base (BG.toFFIType x0) (BG.toFFIType x1) (BG.toFFIType x2))
+
+{-| __C declaration:__ @duckdb_v2_aggregate_function_set_update_callback@
+
+    __defined at:__ @duckdb_v2.h 5222:30@
+
+    __exported by:__ @duckdb_v2.h@
+-}
+c_duckdb_v2_aggregate_function_set_update_callback ::
+     DuckDBV2AggregateFunctionHandle
+     -- ^ __C declaration:__ @function@
+  -> DuckDBV2AggregateFunctionUpdateCallbackFn
+     -- ^ __C declaration:__ @callback@
+  -> BG.Ptr DuckDBV2ErrorInfoHandle
+     -- ^ __C declaration:__ @err@
+  -> IO DuckDBV2Error
+c_duckdb_v2_aggregate_function_set_update_callback =
+  hs_bindgen_f941c706b3c71e2e
+
+-- __unique:__ @Database_DuckDB_FFI_V2_Database.DuckDB.FFI.V2_Safe_duckdb_v2_aggregate_function_set_combine_callback@
+foreign import ccall safe "hs_bindgen_30f6675842bc34bf" hs_bindgen_30f6675842bc34bf_base ::
+     BG.Ptr BG.Void
+  -> BG.FunPtr BG.Void
+  -> BG.Ptr BG.Void
+  -> IO BG.CUInt
+
+-- __unique:__ @Database_DuckDB_FFI_V2_Database.DuckDB.FFI.V2_Safe_duckdb_v2_aggregate_function_set_combine_callback@
+hs_bindgen_30f6675842bc34bf ::
+     DuckDBV2AggregateFunctionHandle
+  -> DuckDBV2AggregateFunctionCombineCallbackFn
+  -> BG.Ptr DuckDBV2ErrorInfoHandle
+  -> IO DuckDBV2Error
+hs_bindgen_30f6675842bc34bf =
+  \x0 ->
+    \x1 ->
+      \x2 ->
+        fmap BG.fromFFIType (hs_bindgen_30f6675842bc34bf_base (BG.toFFIType x0) (BG.toFFIType x1) (BG.toFFIType x2))
+
+{-| __C declaration:__ @duckdb_v2_aggregate_function_set_combine_callback@
+
+    __defined at:__ @duckdb_v2.h 5243:30@
+
+    __exported by:__ @duckdb_v2.h@
+-}
+c_duckdb_v2_aggregate_function_set_combine_callback ::
+     DuckDBV2AggregateFunctionHandle
+     -- ^ __C declaration:__ @function@
+  -> DuckDBV2AggregateFunctionCombineCallbackFn
+     -- ^ __C declaration:__ @callback@
+  -> BG.Ptr DuckDBV2ErrorInfoHandle
+     -- ^ __C declaration:__ @err@
+  -> IO DuckDBV2Error
+c_duckdb_v2_aggregate_function_set_combine_callback =
+  hs_bindgen_30f6675842bc34bf
+
+-- __unique:__ @Database_DuckDB_FFI_V2_Database.DuckDB.FFI.V2_Safe_duckdb_v2_aggregate_function_set_finalize_callback@
+foreign import ccall safe "hs_bindgen_1f0a84d781cdf63b" hs_bindgen_1f0a84d781cdf63b_base ::
+     BG.Ptr BG.Void
+  -> BG.FunPtr BG.Void
+  -> BG.Ptr BG.Void
+  -> IO BG.CUInt
+
+-- __unique:__ @Database_DuckDB_FFI_V2_Database.DuckDB.FFI.V2_Safe_duckdb_v2_aggregate_function_set_finalize_callback@
+hs_bindgen_1f0a84d781cdf63b ::
+     DuckDBV2AggregateFunctionHandle
+  -> DuckDBV2AggregateFunctionFinalizeCallbackFn
+  -> BG.Ptr DuckDBV2ErrorInfoHandle
+  -> IO DuckDBV2Error
+hs_bindgen_1f0a84d781cdf63b =
+  \x0 ->
+    \x1 ->
+      \x2 ->
+        fmap BG.fromFFIType (hs_bindgen_1f0a84d781cdf63b_base (BG.toFFIType x0) (BG.toFFIType x1) (BG.toFFIType x2))
+
+{-| __C declaration:__ @duckdb_v2_aggregate_function_set_finalize_callback@
+
+    __defined at:__ @duckdb_v2.h 5264:30@
+
+    __exported by:__ @duckdb_v2.h@
+-}
+c_duckdb_v2_aggregate_function_set_finalize_callback ::
+     DuckDBV2AggregateFunctionHandle
+     -- ^ __C declaration:__ @function@
+  -> DuckDBV2AggregateFunctionFinalizeCallbackFn
+     -- ^ __C declaration:__ @callback@
+  -> BG.Ptr DuckDBV2ErrorInfoHandle
+     -- ^ __C declaration:__ @err@
+  -> IO DuckDBV2Error
+c_duckdb_v2_aggregate_function_set_finalize_callback =
+  hs_bindgen_1f0a84d781cdf63b
+
+-- __unique:__ @Database_DuckDB_FFI_V2_Database.DuckDB.FFI.V2_Safe_duckdb_v2_aggregate_function_set_destroy_callback@
+foreign import ccall safe "hs_bindgen_1384b088054cd4f3" hs_bindgen_1384b088054cd4f3_base ::
+     BG.Ptr BG.Void
+  -> BG.FunPtr BG.Void
+  -> BG.Ptr BG.Void
+  -> IO BG.CUInt
+
+-- __unique:__ @Database_DuckDB_FFI_V2_Database.DuckDB.FFI.V2_Safe_duckdb_v2_aggregate_function_set_destroy_callback@
+hs_bindgen_1384b088054cd4f3 ::
+     DuckDBV2AggregateFunctionHandle
+  -> DuckDBV2AggregateFunctionDestroyCallbackFn
+  -> BG.Ptr DuckDBV2ErrorInfoHandle
+  -> IO DuckDBV2Error
+hs_bindgen_1384b088054cd4f3 =
+  \x0 ->
+    \x1 ->
+      \x2 ->
+        fmap BG.fromFFIType (hs_bindgen_1384b088054cd4f3_base (BG.toFFIType x0) (BG.toFFIType x1) (BG.toFFIType x2))
+
+{-| __C declaration:__ @duckdb_v2_aggregate_function_set_destroy_callback@
+
+    __defined at:__ @duckdb_v2.h 5284:30@
+
+    __exported by:__ @duckdb_v2.h@
+-}
+c_duckdb_v2_aggregate_function_set_destroy_callback ::
+     DuckDBV2AggregateFunctionHandle
+     -- ^ __C declaration:__ @function@
+  -> DuckDBV2AggregateFunctionDestroyCallbackFn
+     -- ^ __C declaration:__ @callback@
+  -> BG.Ptr DuckDBV2ErrorInfoHandle
+     -- ^ __C declaration:__ @err@
+  -> IO DuckDBV2Error
+c_duckdb_v2_aggregate_function_set_destroy_callback =
+  hs_bindgen_1384b088054cd4f3
+
+-- __unique:__ @Database_DuckDB_FFI_V2_Database.DuckDB.FFI.V2_Safe_duckdb_v2_aggregate_function_bind_set_return_type@
+foreign import ccall safe "hs_bindgen_68dbe2a8ba129a0c" hs_bindgen_68dbe2a8ba129a0c_base ::
+     BG.Ptr BG.Void
+  -> BG.Ptr BG.Void
+  -> BG.Ptr BG.Void
+  -> IO BG.CUInt
+
+-- __unique:__ @Database_DuckDB_FFI_V2_Database.DuckDB.FFI.V2_Safe_duckdb_v2_aggregate_function_bind_set_return_type@
+hs_bindgen_68dbe2a8ba129a0c ::
+     DuckDBV2AggregateFunctionBindInfoHandle
+  -> DuckDBV2LogicalTypeHandle
+  -> BG.Ptr DuckDBV2ErrorInfoHandle
+  -> IO DuckDBV2Error
+hs_bindgen_68dbe2a8ba129a0c =
+  \x0 ->
+    \x1 ->
+      \x2 ->
+        fmap BG.fromFFIType (hs_bindgen_68dbe2a8ba129a0c_base (BG.toFFIType x0) (BG.toFFIType x1) (BG.toFFIType x2))
+
+{-| __C declaration:__ @duckdb_v2_aggregate_function_bind_set_return_type@
+
+    __defined at:__ @duckdb_v2.h 5306:30@
+
+    __exported by:__ @duckdb_v2.h@
+-}
+c_duckdb_v2_aggregate_function_bind_set_return_type ::
+     DuckDBV2AggregateFunctionBindInfoHandle
+     -- ^ __C declaration:__ @info@
+  -> DuckDBV2LogicalTypeHandle
+     -- ^ __C declaration:__ @return_type@
+  -> BG.Ptr DuckDBV2ErrorInfoHandle
+     -- ^ __C declaration:__ @err@
+  -> IO DuckDBV2Error
+c_duckdb_v2_aggregate_function_bind_set_return_type =
+  hs_bindgen_68dbe2a8ba129a0c
+
+-- __unique:__ @Database_DuckDB_FFI_V2_Database.DuckDB.FFI.V2_Safe_duckdb_v2_aggregate_function_size_get_user_data@
+foreign import ccall safe "hs_bindgen_54889afe4c039009" hs_bindgen_54889afe4c039009_base ::
+     BG.Ptr BG.Void
+  -> BG.Ptr BG.Void
+  -> BG.Ptr BG.Void
+  -> IO BG.CUInt
+
+-- __unique:__ @Database_DuckDB_FFI_V2_Database.DuckDB.FFI.V2_Safe_duckdb_v2_aggregate_function_size_get_user_data@
+hs_bindgen_54889afe4c039009 ::
+     DuckDBV2AggregateFunctionSizeInfoHandle
+  -> BG.Ptr (BG.Ptr BG.Void)
+  -> BG.Ptr DuckDBV2ErrorInfoHandle
+  -> IO DuckDBV2Error
+hs_bindgen_54889afe4c039009 =
+  \x0 ->
+    \x1 ->
+      \x2 ->
+        fmap BG.fromFFIType (hs_bindgen_54889afe4c039009_base (BG.toFFIType x0) (BG.toFFIType x1) (BG.toFFIType x2))
+
+{-| __C declaration:__ @duckdb_v2_aggregate_function_size_get_user_data@
+
+    __defined at:__ @duckdb_v2.h 5324:30@
+
+    __exported by:__ @duckdb_v2.h@
+-}
+c_duckdb_v2_aggregate_function_size_get_user_data ::
+     DuckDBV2AggregateFunctionSizeInfoHandle
+     -- ^ __C declaration:__ @info@
+  -> BG.Ptr (BG.Ptr BG.Void)
+     -- ^ __C declaration:__ @data@
+  -> BG.Ptr DuckDBV2ErrorInfoHandle
+     -- ^ __C declaration:__ @err@
+  -> IO DuckDBV2Error
+c_duckdb_v2_aggregate_function_size_get_user_data =
+  hs_bindgen_54889afe4c039009
+
+-- __unique:__ @Database_DuckDB_FFI_V2_Database.DuckDB.FFI.V2_Safe_duckdb_v2_aggregate_function_size_get_bind_data@
+foreign import ccall safe "hs_bindgen_21da38c7c236eafe" hs_bindgen_21da38c7c236eafe_base ::
+     BG.Ptr BG.Void
+  -> BG.Ptr BG.Void
+  -> BG.Ptr BG.Void
+  -> IO BG.CUInt
+
+-- __unique:__ @Database_DuckDB_FFI_V2_Database.DuckDB.FFI.V2_Safe_duckdb_v2_aggregate_function_size_get_bind_data@
+hs_bindgen_21da38c7c236eafe ::
+     DuckDBV2AggregateFunctionSizeInfoHandle
+  -> BG.Ptr (BG.Ptr BG.Void)
+  -> BG.Ptr DuckDBV2ErrorInfoHandle
+  -> IO DuckDBV2Error
+hs_bindgen_21da38c7c236eafe =
+  \x0 ->
+    \x1 ->
+      \x2 ->
+        fmap BG.fromFFIType (hs_bindgen_21da38c7c236eafe_base (BG.toFFIType x0) (BG.toFFIType x1) (BG.toFFIType x2))
+
+{-| __C declaration:__ @duckdb_v2_aggregate_function_size_get_bind_data@
+
+    __defined at:__ @duckdb_v2.h 5341:30@
+
+    __exported by:__ @duckdb_v2.h@
+-}
+c_duckdb_v2_aggregate_function_size_get_bind_data ::
+     DuckDBV2AggregateFunctionSizeInfoHandle
+     -- ^ __C declaration:__ @info@
+  -> BG.Ptr (BG.Ptr BG.Void)
+     -- ^ __C declaration:__ @data@
+  -> BG.Ptr DuckDBV2ErrorInfoHandle
+     -- ^ __C declaration:__ @err@
+  -> IO DuckDBV2Error
+c_duckdb_v2_aggregate_function_size_get_bind_data =
+  hs_bindgen_21da38c7c236eafe
+
+-- __unique:__ @Database_DuckDB_FFI_V2_Database.DuckDB.FFI.V2_Safe_duckdb_v2_aggregate_function_size_set_state_size@
+foreign import ccall safe "hs_bindgen_8574517b46d6d782" hs_bindgen_8574517b46d6d782_base ::
+     BG.Ptr BG.Void
+  -> HsBindgen.Runtime.LibC.Word64
+  -> BG.Ptr BG.Void
+  -> IO BG.CUInt
+
+-- __unique:__ @Database_DuckDB_FFI_V2_Database.DuckDB.FFI.V2_Safe_duckdb_v2_aggregate_function_size_set_state_size@
+hs_bindgen_8574517b46d6d782 ::
+     DuckDBV2AggregateFunctionSizeInfoHandle
+  -> DuckDBIdx
+  -> BG.Ptr DuckDBV2ErrorInfoHandle
+  -> IO DuckDBV2Error
+hs_bindgen_8574517b46d6d782 =
+  \x0 ->
+    \x1 ->
+      \x2 ->
+        fmap BG.fromFFIType (hs_bindgen_8574517b46d6d782_base (BG.toFFIType x0) (BG.toFFIType x1) (BG.toFFIType x2))
+
+{-| __C declaration:__ @duckdb_v2_aggregate_function_size_set_state_size@
+
+    __defined at:__ @duckdb_v2.h 5359:30@
+
+    __exported by:__ @duckdb_v2.h@
+-}
+c_duckdb_v2_aggregate_function_size_set_state_size ::
+     DuckDBV2AggregateFunctionSizeInfoHandle
+     -- ^ __C declaration:__ @info@
+  -> DuckDBIdx
+     -- ^ __C declaration:__ @size@
+  -> BG.Ptr DuckDBV2ErrorInfoHandle
+     -- ^ __C declaration:__ @err@
+  -> IO DuckDBV2Error
+c_duckdb_v2_aggregate_function_size_set_state_size =
+  hs_bindgen_8574517b46d6d782
+
+-- __unique:__ @Database_DuckDB_FFI_V2_Database.DuckDB.FFI.V2_Safe_duckdb_v2_aggregate_function_init_get_user_data@
+foreign import ccall safe "hs_bindgen_632c73c824a0d9e4" hs_bindgen_632c73c824a0d9e4_base ::
+     BG.Ptr BG.Void
+  -> BG.Ptr BG.Void
+  -> BG.Ptr BG.Void
+  -> IO BG.CUInt
+
+-- __unique:__ @Database_DuckDB_FFI_V2_Database.DuckDB.FFI.V2_Safe_duckdb_v2_aggregate_function_init_get_user_data@
+hs_bindgen_632c73c824a0d9e4 ::
+     DuckDBV2AggregateFunctionInitInfoHandle
+  -> BG.Ptr (BG.Ptr BG.Void)
+  -> BG.Ptr DuckDBV2ErrorInfoHandle
+  -> IO DuckDBV2Error
+hs_bindgen_632c73c824a0d9e4 =
+  \x0 ->
+    \x1 ->
+      \x2 ->
+        fmap BG.fromFFIType (hs_bindgen_632c73c824a0d9e4_base (BG.toFFIType x0) (BG.toFFIType x1) (BG.toFFIType x2))
+
+{-| __C declaration:__ @duckdb_v2_aggregate_function_init_get_user_data@
+
+    __defined at:__ @duckdb_v2.h 5376:30@
+
+    __exported by:__ @duckdb_v2.h@
+-}
+c_duckdb_v2_aggregate_function_init_get_user_data ::
+     DuckDBV2AggregateFunctionInitInfoHandle
+     -- ^ __C declaration:__ @info@
+  -> BG.Ptr (BG.Ptr BG.Void)
+     -- ^ __C declaration:__ @data@
+  -> BG.Ptr DuckDBV2ErrorInfoHandle
+     -- ^ __C declaration:__ @err@
+  -> IO DuckDBV2Error
+c_duckdb_v2_aggregate_function_init_get_user_data =
+  hs_bindgen_632c73c824a0d9e4
+
+-- __unique:__ @Database_DuckDB_FFI_V2_Database.DuckDB.FFI.V2_Safe_duckdb_v2_aggregate_function_init_get_bind_data@
+foreign import ccall safe "hs_bindgen_1722d0f33fe0a35d" hs_bindgen_1722d0f33fe0a35d_base ::
+     BG.Ptr BG.Void
+  -> BG.Ptr BG.Void
+  -> BG.Ptr BG.Void
+  -> IO BG.CUInt
+
+-- __unique:__ @Database_DuckDB_FFI_V2_Database.DuckDB.FFI.V2_Safe_duckdb_v2_aggregate_function_init_get_bind_data@
+hs_bindgen_1722d0f33fe0a35d ::
+     DuckDBV2AggregateFunctionInitInfoHandle
+  -> BG.Ptr (BG.Ptr BG.Void)
+  -> BG.Ptr DuckDBV2ErrorInfoHandle
+  -> IO DuckDBV2Error
+hs_bindgen_1722d0f33fe0a35d =
+  \x0 ->
+    \x1 ->
+      \x2 ->
+        fmap BG.fromFFIType (hs_bindgen_1722d0f33fe0a35d_base (BG.toFFIType x0) (BG.toFFIType x1) (BG.toFFIType x2))
+
+{-| __C declaration:__ @duckdb_v2_aggregate_function_init_get_bind_data@
+
+    __defined at:__ @duckdb_v2.h 5393:30@
+
+    __exported by:__ @duckdb_v2.h@
+-}
+c_duckdb_v2_aggregate_function_init_get_bind_data ::
+     DuckDBV2AggregateFunctionInitInfoHandle
+     -- ^ __C declaration:__ @info@
+  -> BG.Ptr (BG.Ptr BG.Void)
+     -- ^ __C declaration:__ @data@
+  -> BG.Ptr DuckDBV2ErrorInfoHandle
+     -- ^ __C declaration:__ @err@
+  -> IO DuckDBV2Error
+c_duckdb_v2_aggregate_function_init_get_bind_data =
+  hs_bindgen_1722d0f33fe0a35d
+
+-- __unique:__ @Database_DuckDB_FFI_V2_Database.DuckDB.FFI.V2_Safe_duckdb_v2_aggregate_function_init_get_state_count@
+foreign import ccall safe "hs_bindgen_90692f4406391c34" hs_bindgen_90692f4406391c34_base ::
+     BG.Ptr BG.Void
+  -> BG.Ptr BG.Void
+  -> BG.Ptr BG.Void
+  -> IO BG.CUInt
+
+-- __unique:__ @Database_DuckDB_FFI_V2_Database.DuckDB.FFI.V2_Safe_duckdb_v2_aggregate_function_init_get_state_count@
+hs_bindgen_90692f4406391c34 ::
+     DuckDBV2AggregateFunctionInitInfoHandle
+  -> BG.Ptr DuckDBIdx
+  -> BG.Ptr DuckDBV2ErrorInfoHandle
+  -> IO DuckDBV2Error
+hs_bindgen_90692f4406391c34 =
+  \x0 ->
+    \x1 ->
+      \x2 ->
+        fmap BG.fromFFIType (hs_bindgen_90692f4406391c34_base (BG.toFFIType x0) (BG.toFFIType x1) (BG.toFFIType x2))
+
+{-| __C declaration:__ @duckdb_v2_aggregate_function_init_get_state_count@
+
+    __defined at:__ @duckdb_v2.h 5411:30@
+
+    __exported by:__ @duckdb_v2.h@
+-}
+c_duckdb_v2_aggregate_function_init_get_state_count ::
+     DuckDBV2AggregateFunctionInitInfoHandle
+     -- ^ __C declaration:__ @info@
+  -> BG.Ptr DuckDBIdx
+     -- ^ __C declaration:__ @count@
+  -> BG.Ptr DuckDBV2ErrorInfoHandle
+     -- ^ __C declaration:__ @err@
+  -> IO DuckDBV2Error
+c_duckdb_v2_aggregate_function_init_get_state_count =
+  hs_bindgen_90692f4406391c34
+
+-- __unique:__ @Database_DuckDB_FFI_V2_Database.DuckDB.FFI.V2_Safe_duckdb_v2_aggregate_function_init_get_states@
+foreign import ccall safe "hs_bindgen_60b65f5dc431c2ca" hs_bindgen_60b65f5dc431c2ca_base ::
+     BG.Ptr BG.Void
+  -> BG.Ptr BG.Void
+  -> BG.Ptr BG.Void
+  -> IO BG.CUInt
+
+-- __unique:__ @Database_DuckDB_FFI_V2_Database.DuckDB.FFI.V2_Safe_duckdb_v2_aggregate_function_init_get_states@
+hs_bindgen_60b65f5dc431c2ca ::
+     DuckDBV2AggregateFunctionInitInfoHandle
+  -> BG.Ptr (BG.Ptr (BG.Ptr BG.Void))
+  -> BG.Ptr DuckDBV2ErrorInfoHandle
+  -> IO DuckDBV2Error
+hs_bindgen_60b65f5dc431c2ca =
+  \x0 ->
+    \x1 ->
+      \x2 ->
+        fmap BG.fromFFIType (hs_bindgen_60b65f5dc431c2ca_base (BG.toFFIType x0) (BG.toFFIType x1) (BG.toFFIType x2))
+
+{-| __C declaration:__ @duckdb_v2_aggregate_function_init_get_states@
+
+    __defined at:__ @duckdb_v2.h 5429:30@
+
+    __exported by:__ @duckdb_v2.h@
+-}
+c_duckdb_v2_aggregate_function_init_get_states ::
+     DuckDBV2AggregateFunctionInitInfoHandle
+     -- ^ __C declaration:__ @info@
+  -> BG.Ptr (BG.Ptr (BG.Ptr BG.Void))
+     -- ^ __C declaration:__ @states@
+  -> BG.Ptr DuckDBV2ErrorInfoHandle
+     -- ^ __C declaration:__ @err@
+  -> IO DuckDBV2Error
+c_duckdb_v2_aggregate_function_init_get_states =
+  hs_bindgen_60b65f5dc431c2ca
+
+-- __unique:__ @Database_DuckDB_FFI_V2_Database.DuckDB.FFI.V2_Safe_duckdb_v2_aggregate_function_update_get_user_data@
+foreign import ccall safe "hs_bindgen_ab277c38ab0400e0" hs_bindgen_ab277c38ab0400e0_base ::
+     BG.Ptr BG.Void
+  -> BG.Ptr BG.Void
+  -> BG.Ptr BG.Void
+  -> IO BG.CUInt
+
+-- __unique:__ @Database_DuckDB_FFI_V2_Database.DuckDB.FFI.V2_Safe_duckdb_v2_aggregate_function_update_get_user_data@
+hs_bindgen_ab277c38ab0400e0 ::
+     DuckDBV2AggregateFunctionUpdateInfoHandle
+  -> BG.Ptr (BG.Ptr BG.Void)
+  -> BG.Ptr DuckDBV2ErrorInfoHandle
+  -> IO DuckDBV2Error
+hs_bindgen_ab277c38ab0400e0 =
+  \x0 ->
+    \x1 ->
+      \x2 ->
+        fmap BG.fromFFIType (hs_bindgen_ab277c38ab0400e0_base (BG.toFFIType x0) (BG.toFFIType x1) (BG.toFFIType x2))
+
+{-| __C declaration:__ @duckdb_v2_aggregate_function_update_get_user_data@
+
+    __defined at:__ @duckdb_v2.h 5446:30@
+
+    __exported by:__ @duckdb_v2.h@
+-}
+c_duckdb_v2_aggregate_function_update_get_user_data ::
+     DuckDBV2AggregateFunctionUpdateInfoHandle
+     -- ^ __C declaration:__ @info@
+  -> BG.Ptr (BG.Ptr BG.Void)
+     -- ^ __C declaration:__ @data@
+  -> BG.Ptr DuckDBV2ErrorInfoHandle
+     -- ^ __C declaration:__ @err@
+  -> IO DuckDBV2Error
+c_duckdb_v2_aggregate_function_update_get_user_data =
+  hs_bindgen_ab277c38ab0400e0
+
+-- __unique:__ @Database_DuckDB_FFI_V2_Database.DuckDB.FFI.V2_Safe_duckdb_v2_aggregate_function_update_get_bind_data@
+foreign import ccall safe "hs_bindgen_fcf1bef32339fe0f" hs_bindgen_fcf1bef32339fe0f_base ::
+     BG.Ptr BG.Void
+  -> BG.Ptr BG.Void
+  -> BG.Ptr BG.Void
+  -> IO BG.CUInt
+
+-- __unique:__ @Database_DuckDB_FFI_V2_Database.DuckDB.FFI.V2_Safe_duckdb_v2_aggregate_function_update_get_bind_data@
+hs_bindgen_fcf1bef32339fe0f ::
+     DuckDBV2AggregateFunctionUpdateInfoHandle
+  -> BG.Ptr (BG.Ptr BG.Void)
+  -> BG.Ptr DuckDBV2ErrorInfoHandle
+  -> IO DuckDBV2Error
+hs_bindgen_fcf1bef32339fe0f =
+  \x0 ->
+    \x1 ->
+      \x2 ->
+        fmap BG.fromFFIType (hs_bindgen_fcf1bef32339fe0f_base (BG.toFFIType x0) (BG.toFFIType x1) (BG.toFFIType x2))
+
+{-| __C declaration:__ @duckdb_v2_aggregate_function_update_get_bind_data@
+
+    __defined at:__ @duckdb_v2.h 5463:30@
+
+    __exported by:__ @duckdb_v2.h@
+-}
+c_duckdb_v2_aggregate_function_update_get_bind_data ::
+     DuckDBV2AggregateFunctionUpdateInfoHandle
+     -- ^ __C declaration:__ @info@
+  -> BG.Ptr (BG.Ptr BG.Void)
+     -- ^ __C declaration:__ @data@
+  -> BG.Ptr DuckDBV2ErrorInfoHandle
+     -- ^ __C declaration:__ @err@
+  -> IO DuckDBV2Error
+c_duckdb_v2_aggregate_function_update_get_bind_data =
+  hs_bindgen_fcf1bef32339fe0f
+
+-- __unique:__ @Database_DuckDB_FFI_V2_Database.DuckDB.FFI.V2_Safe_duckdb_v2_aggregate_function_update_get_row_count@
+foreign import ccall safe "hs_bindgen_fae4da92d121adb1" hs_bindgen_fae4da92d121adb1_base ::
+     BG.Ptr BG.Void
+  -> BG.Ptr BG.Void
+  -> BG.Ptr BG.Void
+  -> IO BG.CUInt
+
+-- __unique:__ @Database_DuckDB_FFI_V2_Database.DuckDB.FFI.V2_Safe_duckdb_v2_aggregate_function_update_get_row_count@
+hs_bindgen_fae4da92d121adb1 ::
+     DuckDBV2AggregateFunctionUpdateInfoHandle
+  -> BG.Ptr DuckDBIdx
+  -> BG.Ptr DuckDBV2ErrorInfoHandle
+  -> IO DuckDBV2Error
+hs_bindgen_fae4da92d121adb1 =
+  \x0 ->
+    \x1 ->
+      \x2 ->
+        fmap BG.fromFFIType (hs_bindgen_fae4da92d121adb1_base (BG.toFFIType x0) (BG.toFFIType x1) (BG.toFFIType x2))
+
+{-| __C declaration:__ @duckdb_v2_aggregate_function_update_get_row_count@
+
+    __defined at:__ @duckdb_v2.h 5481:30@
+
+    __exported by:__ @duckdb_v2.h@
+-}
+c_duckdb_v2_aggregate_function_update_get_row_count ::
+     DuckDBV2AggregateFunctionUpdateInfoHandle
+     -- ^ __C declaration:__ @info@
+  -> BG.Ptr DuckDBIdx
+     -- ^ __C declaration:__ @count@
+  -> BG.Ptr DuckDBV2ErrorInfoHandle
+     -- ^ __C declaration:__ @err@
+  -> IO DuckDBV2Error
+c_duckdb_v2_aggregate_function_update_get_row_count =
+  hs_bindgen_fae4da92d121adb1
+
+-- __unique:__ @Database_DuckDB_FFI_V2_Database.DuckDB.FFI.V2_Safe_duckdb_v2_aggregate_function_update_get_arg_count@
+foreign import ccall safe "hs_bindgen_ff26144b83dfadcf" hs_bindgen_ff26144b83dfadcf_base ::
+     BG.Ptr BG.Void
+  -> BG.Ptr BG.Void
+  -> BG.Ptr BG.Void
+  -> BG.Ptr BG.Void
+  -> BG.Ptr BG.Void
+  -> BG.Ptr BG.Void
+  -> IO BG.CUInt
+
+-- __unique:__ @Database_DuckDB_FFI_V2_Database.DuckDB.FFI.V2_Safe_duckdb_v2_aggregate_function_update_get_arg_count@
+hs_bindgen_ff26144b83dfadcf ::
+     DuckDBV2AggregateFunctionUpdateInfoHandle
+  -> BG.Ptr DuckDBIdx
+  -> BG.Ptr DuckDBIdx
+  -> BG.Ptr DuckDBIdx
+  -> BG.Ptr DuckDBIdx
+  -> BG.Ptr DuckDBV2ErrorInfoHandle
+  -> IO DuckDBV2Error
+hs_bindgen_ff26144b83dfadcf =
+  \x0 ->
+    \x1 ->
+      \x2 ->
+        \x3 ->
+          \x4 ->
+            \x5 ->
+              fmap BG.fromFFIType (hs_bindgen_ff26144b83dfadcf_base (BG.toFFIType x0) (BG.toFFIType x1) (BG.toFFIType x2) (BG.toFFIType x3) (BG.toFFIType x4) (BG.toFFIType x5))
+
+{-| __C declaration:__ @duckdb_v2_aggregate_function_update_get_arg_count@
+
+    __defined at:__ @duckdb_v2.h 5506:30@
+
+    __exported by:__ @duckdb_v2.h@
+-}
+c_duckdb_v2_aggregate_function_update_get_arg_count ::
+     DuckDBV2AggregateFunctionUpdateInfoHandle
+     -- ^ __C declaration:__ @info@
+  -> BG.Ptr DuckDBIdx
+     -- ^ __C declaration:__ @positional_fixed@
+  -> BG.Ptr DuckDBIdx
+     -- ^ __C declaration:__ @positional_variadic@
+  -> BG.Ptr DuckDBIdx
+     -- ^ __C declaration:__ @named_fixed@
+  -> BG.Ptr DuckDBIdx
+     -- ^ __C declaration:__ @named_variadic@
+  -> BG.Ptr DuckDBV2ErrorInfoHandle
+     -- ^ __C declaration:__ @err@
+  -> IO DuckDBV2Error
+c_duckdb_v2_aggregate_function_update_get_arg_count =
+  hs_bindgen_ff26144b83dfadcf
+
+-- __unique:__ @Database_DuckDB_FFI_V2_Database.DuckDB.FFI.V2_Safe_duckdb_v2_aggregate_function_update_get_arg@
+foreign import ccall safe "hs_bindgen_956340ebc344a3d1" hs_bindgen_956340ebc344a3d1_base ::
+     BG.Ptr BG.Void
+  -> HsBindgen.Runtime.LibC.Word64
+  -> BG.Ptr BG.Void
+  -> BG.Ptr BG.Void
+  -> IO BG.CUInt
+
+-- __unique:__ @Database_DuckDB_FFI_V2_Database.DuckDB.FFI.V2_Safe_duckdb_v2_aggregate_function_update_get_arg@
+hs_bindgen_956340ebc344a3d1 ::
+     DuckDBV2AggregateFunctionUpdateInfoHandle
+  -> DuckDBIdx
+  -> BG.Ptr DuckDBV2VectorHandle
+  -> BG.Ptr DuckDBV2ErrorInfoHandle
+  -> IO DuckDBV2Error
+hs_bindgen_956340ebc344a3d1 =
+  \x0 ->
+    \x1 ->
+      \x2 ->
+        \x3 ->
+          fmap BG.fromFFIType (hs_bindgen_956340ebc344a3d1_base (BG.toFFIType x0) (BG.toFFIType x1) (BG.toFFIType x2) (BG.toFFIType x3))
+
+{-| __C declaration:__ @duckdb_v2_aggregate_function_update_get_arg@
+
+    __defined at:__ @duckdb_v2.h 5531:1@
+
+    __exported by:__ @duckdb_v2.h@
+-}
+c_duckdb_v2_aggregate_function_update_get_arg ::
+     DuckDBV2AggregateFunctionUpdateInfoHandle
+     -- ^ __C declaration:__ @info@
+  -> DuckDBIdx
+     -- ^ __C declaration:__ @index@
+  -> BG.Ptr DuckDBV2VectorHandle
+     -- ^ __C declaration:__ @vector@
+  -> BG.Ptr DuckDBV2ErrorInfoHandle
+     -- ^ __C declaration:__ @err@
+  -> IO DuckDBV2Error
+c_duckdb_v2_aggregate_function_update_get_arg =
+  hs_bindgen_956340ebc344a3d1
+
+-- __unique:__ @Database_DuckDB_FFI_V2_Database.DuckDB.FFI.V2_Safe_duckdb_v2_aggregate_function_update_get_states@
+foreign import ccall safe "hs_bindgen_23c8a2f6274d7f13" hs_bindgen_23c8a2f6274d7f13_base ::
+     BG.Ptr BG.Void
+  -> BG.Ptr BG.Void
+  -> BG.Ptr BG.Void
+  -> IO BG.CUInt
+
+-- __unique:__ @Database_DuckDB_FFI_V2_Database.DuckDB.FFI.V2_Safe_duckdb_v2_aggregate_function_update_get_states@
+hs_bindgen_23c8a2f6274d7f13 ::
+     DuckDBV2AggregateFunctionUpdateInfoHandle
+  -> BG.Ptr (BG.Ptr (BG.Ptr BG.Void))
+  -> BG.Ptr DuckDBV2ErrorInfoHandle
+  -> IO DuckDBV2Error
+hs_bindgen_23c8a2f6274d7f13 =
+  \x0 ->
+    \x1 ->
+      \x2 ->
+        fmap BG.fromFFIType (hs_bindgen_23c8a2f6274d7f13_base (BG.toFFIType x0) (BG.toFFIType x1) (BG.toFFIType x2))
+
+{-| __C declaration:__ @duckdb_v2_aggregate_function_update_get_states@
+
+    __defined at:__ @duckdb_v2.h 5549:30@
+
+    __exported by:__ @duckdb_v2.h@
+-}
+c_duckdb_v2_aggregate_function_update_get_states ::
+     DuckDBV2AggregateFunctionUpdateInfoHandle
+     -- ^ __C declaration:__ @info@
+  -> BG.Ptr (BG.Ptr (BG.Ptr BG.Void))
+     -- ^ __C declaration:__ @states@
+  -> BG.Ptr DuckDBV2ErrorInfoHandle
+     -- ^ __C declaration:__ @err@
+  -> IO DuckDBV2Error
+c_duckdb_v2_aggregate_function_update_get_states =
+  hs_bindgen_23c8a2f6274d7f13
+
+-- __unique:__ @Database_DuckDB_FFI_V2_Database.DuckDB.FFI.V2_Safe_duckdb_v2_aggregate_function_combine_get_user_data@
+foreign import ccall safe "hs_bindgen_0ba10b8aedb08052" hs_bindgen_0ba10b8aedb08052_base ::
+     BG.Ptr BG.Void
+  -> BG.Ptr BG.Void
+  -> BG.Ptr BG.Void
+  -> IO BG.CUInt
+
+-- __unique:__ @Database_DuckDB_FFI_V2_Database.DuckDB.FFI.V2_Safe_duckdb_v2_aggregate_function_combine_get_user_data@
+hs_bindgen_0ba10b8aedb08052 ::
+     DuckDBV2AggregateFunctionCombineInfoHandle
+  -> BG.Ptr (BG.Ptr BG.Void)
+  -> BG.Ptr DuckDBV2ErrorInfoHandle
+  -> IO DuckDBV2Error
+hs_bindgen_0ba10b8aedb08052 =
+  \x0 ->
+    \x1 ->
+      \x2 ->
+        fmap BG.fromFFIType (hs_bindgen_0ba10b8aedb08052_base (BG.toFFIType x0) (BG.toFFIType x1) (BG.toFFIType x2))
+
+{-| __C declaration:__ @duckdb_v2_aggregate_function_combine_get_user_data@
+
+    __defined at:__ @duckdb_v2.h 5566:30@
+
+    __exported by:__ @duckdb_v2.h@
+-}
+c_duckdb_v2_aggregate_function_combine_get_user_data ::
+     DuckDBV2AggregateFunctionCombineInfoHandle
+     -- ^ __C declaration:__ @info@
+  -> BG.Ptr (BG.Ptr BG.Void)
+     -- ^ __C declaration:__ @data@
+  -> BG.Ptr DuckDBV2ErrorInfoHandle
+     -- ^ __C declaration:__ @err@
+  -> IO DuckDBV2Error
+c_duckdb_v2_aggregate_function_combine_get_user_data =
+  hs_bindgen_0ba10b8aedb08052
+
+-- __unique:__ @Database_DuckDB_FFI_V2_Database.DuckDB.FFI.V2_Safe_duckdb_v2_aggregate_function_combine_get_bind_data@
+foreign import ccall safe "hs_bindgen_c8c4df64367a3503" hs_bindgen_c8c4df64367a3503_base ::
+     BG.Ptr BG.Void
+  -> BG.Ptr BG.Void
+  -> BG.Ptr BG.Void
+  -> IO BG.CUInt
+
+-- __unique:__ @Database_DuckDB_FFI_V2_Database.DuckDB.FFI.V2_Safe_duckdb_v2_aggregate_function_combine_get_bind_data@
+hs_bindgen_c8c4df64367a3503 ::
+     DuckDBV2AggregateFunctionCombineInfoHandle
+  -> BG.Ptr (BG.Ptr BG.Void)
+  -> BG.Ptr DuckDBV2ErrorInfoHandle
+  -> IO DuckDBV2Error
+hs_bindgen_c8c4df64367a3503 =
+  \x0 ->
+    \x1 ->
+      \x2 ->
+        fmap BG.fromFFIType (hs_bindgen_c8c4df64367a3503_base (BG.toFFIType x0) (BG.toFFIType x1) (BG.toFFIType x2))
+
+{-| __C declaration:__ @duckdb_v2_aggregate_function_combine_get_bind_data@
+
+    __defined at:__ @duckdb_v2.h 5583:30@
+
+    __exported by:__ @duckdb_v2.h@
+-}
+c_duckdb_v2_aggregate_function_combine_get_bind_data ::
+     DuckDBV2AggregateFunctionCombineInfoHandle
+     -- ^ __C declaration:__ @info@
+  -> BG.Ptr (BG.Ptr BG.Void)
+     -- ^ __C declaration:__ @data@
+  -> BG.Ptr DuckDBV2ErrorInfoHandle
+     -- ^ __C declaration:__ @err@
+  -> IO DuckDBV2Error
+c_duckdb_v2_aggregate_function_combine_get_bind_data =
+  hs_bindgen_c8c4df64367a3503
+
+-- __unique:__ @Database_DuckDB_FFI_V2_Database.DuckDB.FFI.V2_Safe_duckdb_v2_aggregate_function_combine_get_state_count@
+foreign import ccall safe "hs_bindgen_a4a77d26f51774e4" hs_bindgen_a4a77d26f51774e4_base ::
+     BG.Ptr BG.Void
+  -> BG.Ptr BG.Void
+  -> BG.Ptr BG.Void
+  -> IO BG.CUInt
+
+-- __unique:__ @Database_DuckDB_FFI_V2_Database.DuckDB.FFI.V2_Safe_duckdb_v2_aggregate_function_combine_get_state_count@
+hs_bindgen_a4a77d26f51774e4 ::
+     DuckDBV2AggregateFunctionCombineInfoHandle
+  -> BG.Ptr DuckDBIdx
+  -> BG.Ptr DuckDBV2ErrorInfoHandle
+  -> IO DuckDBV2Error
+hs_bindgen_a4a77d26f51774e4 =
+  \x0 ->
+    \x1 ->
+      \x2 ->
+        fmap BG.fromFFIType (hs_bindgen_a4a77d26f51774e4_base (BG.toFFIType x0) (BG.toFFIType x1) (BG.toFFIType x2))
+
+{-| __C declaration:__ @duckdb_v2_aggregate_function_combine_get_state_count@
+
+    __defined at:__ @duckdb_v2.h 5601:30@
+
+    __exported by:__ @duckdb_v2.h@
+-}
+c_duckdb_v2_aggregate_function_combine_get_state_count ::
+     DuckDBV2AggregateFunctionCombineInfoHandle
+     -- ^ __C declaration:__ @info@
+  -> BG.Ptr DuckDBIdx
+     -- ^ __C declaration:__ @count@
+  -> BG.Ptr DuckDBV2ErrorInfoHandle
+     -- ^ __C declaration:__ @err@
+  -> IO DuckDBV2Error
+c_duckdb_v2_aggregate_function_combine_get_state_count =
+  hs_bindgen_a4a77d26f51774e4
+
+-- __unique:__ @Database_DuckDB_FFI_V2_Database.DuckDB.FFI.V2_Safe_duckdb_v2_aggregate_function_combine_get_sources@
+foreign import ccall safe "hs_bindgen_2987ded318e1f1db" hs_bindgen_2987ded318e1f1db_base ::
+     BG.Ptr BG.Void
+  -> BG.Ptr BG.Void
+  -> BG.Ptr BG.Void
+  -> IO BG.CUInt
+
+-- __unique:__ @Database_DuckDB_FFI_V2_Database.DuckDB.FFI.V2_Safe_duckdb_v2_aggregate_function_combine_get_sources@
+hs_bindgen_2987ded318e1f1db ::
+     DuckDBV2AggregateFunctionCombineInfoHandle
+  -> BG.Ptr (BG.Ptr (BG.Ptr BG.Void))
+  -> BG.Ptr DuckDBV2ErrorInfoHandle
+  -> IO DuckDBV2Error
+hs_bindgen_2987ded318e1f1db =
+  \x0 ->
+    \x1 ->
+      \x2 ->
+        fmap BG.fromFFIType (hs_bindgen_2987ded318e1f1db_base (BG.toFFIType x0) (BG.toFFIType x1) (BG.toFFIType x2))
+
+{-| __C declaration:__ @duckdb_v2_aggregate_function_combine_get_sources@
+
+    __defined at:__ @duckdb_v2.h 5620:30@
+
+    __exported by:__ @duckdb_v2.h@
+-}
+c_duckdb_v2_aggregate_function_combine_get_sources ::
+     DuckDBV2AggregateFunctionCombineInfoHandle
+     -- ^ __C declaration:__ @info@
+  -> BG.Ptr (BG.Ptr (BG.Ptr BG.Void))
+     -- ^ __C declaration:__ @states@
+  -> BG.Ptr DuckDBV2ErrorInfoHandle
+     -- ^ __C declaration:__ @err@
+  -> IO DuckDBV2Error
+c_duckdb_v2_aggregate_function_combine_get_sources =
+  hs_bindgen_2987ded318e1f1db
+
+-- __unique:__ @Database_DuckDB_FFI_V2_Database.DuckDB.FFI.V2_Safe_duckdb_v2_aggregate_function_combine_get_targets@
+foreign import ccall safe "hs_bindgen_6f9c2484ce7951d9" hs_bindgen_6f9c2484ce7951d9_base ::
+     BG.Ptr BG.Void
+  -> BG.Ptr BG.Void
+  -> BG.Ptr BG.Void
+  -> IO BG.CUInt
+
+-- __unique:__ @Database_DuckDB_FFI_V2_Database.DuckDB.FFI.V2_Safe_duckdb_v2_aggregate_function_combine_get_targets@
+hs_bindgen_6f9c2484ce7951d9 ::
+     DuckDBV2AggregateFunctionCombineInfoHandle
+  -> BG.Ptr (BG.Ptr (BG.Ptr BG.Void))
+  -> BG.Ptr DuckDBV2ErrorInfoHandle
+  -> IO DuckDBV2Error
+hs_bindgen_6f9c2484ce7951d9 =
+  \x0 ->
+    \x1 ->
+      \x2 ->
+        fmap BG.fromFFIType (hs_bindgen_6f9c2484ce7951d9_base (BG.toFFIType x0) (BG.toFFIType x1) (BG.toFFIType x2))
+
+{-| __C declaration:__ @duckdb_v2_aggregate_function_combine_get_targets@
+
+    __defined at:__ @duckdb_v2.h 5638:30@
+
+    __exported by:__ @duckdb_v2.h@
+-}
+c_duckdb_v2_aggregate_function_combine_get_targets ::
+     DuckDBV2AggregateFunctionCombineInfoHandle
+     -- ^ __C declaration:__ @info@
+  -> BG.Ptr (BG.Ptr (BG.Ptr BG.Void))
+     -- ^ __C declaration:__ @states@
+  -> BG.Ptr DuckDBV2ErrorInfoHandle
+     -- ^ __C declaration:__ @err@
+  -> IO DuckDBV2Error
+c_duckdb_v2_aggregate_function_combine_get_targets =
+  hs_bindgen_6f9c2484ce7951d9
+
+-- __unique:__ @Database_DuckDB_FFI_V2_Database.DuckDB.FFI.V2_Safe_duckdb_v2_aggregate_function_finalize_get_user_data@
+foreign import ccall safe "hs_bindgen_4551399ab145cb9f" hs_bindgen_4551399ab145cb9f_base ::
+     BG.Ptr BG.Void
+  -> BG.Ptr BG.Void
+  -> BG.Ptr BG.Void
+  -> IO BG.CUInt
+
+-- __unique:__ @Database_DuckDB_FFI_V2_Database.DuckDB.FFI.V2_Safe_duckdb_v2_aggregate_function_finalize_get_user_data@
+hs_bindgen_4551399ab145cb9f ::
+     DuckDBV2AggregateFunctionFinalizeInfoHandle
+  -> BG.Ptr (BG.Ptr BG.Void)
+  -> BG.Ptr DuckDBV2ErrorInfoHandle
+  -> IO DuckDBV2Error
+hs_bindgen_4551399ab145cb9f =
+  \x0 ->
+    \x1 ->
+      \x2 ->
+        fmap BG.fromFFIType (hs_bindgen_4551399ab145cb9f_base (BG.toFFIType x0) (BG.toFFIType x1) (BG.toFFIType x2))
+
+{-| __C declaration:__ @duckdb_v2_aggregate_function_finalize_get_user_data@
+
+    __defined at:__ @duckdb_v2.h 5655:30@
+
+    __exported by:__ @duckdb_v2.h@
+-}
+c_duckdb_v2_aggregate_function_finalize_get_user_data ::
+     DuckDBV2AggregateFunctionFinalizeInfoHandle
+     -- ^ __C declaration:__ @info@
+  -> BG.Ptr (BG.Ptr BG.Void)
+     -- ^ __C declaration:__ @data@
+  -> BG.Ptr DuckDBV2ErrorInfoHandle
+     -- ^ __C declaration:__ @err@
+  -> IO DuckDBV2Error
+c_duckdb_v2_aggregate_function_finalize_get_user_data =
+  hs_bindgen_4551399ab145cb9f
+
+-- __unique:__ @Database_DuckDB_FFI_V2_Database.DuckDB.FFI.V2_Safe_duckdb_v2_aggregate_function_finalize_get_bind_data@
+foreign import ccall safe "hs_bindgen_911b6b58312bcd71" hs_bindgen_911b6b58312bcd71_base ::
+     BG.Ptr BG.Void
+  -> BG.Ptr BG.Void
+  -> BG.Ptr BG.Void
+  -> IO BG.CUInt
+
+-- __unique:__ @Database_DuckDB_FFI_V2_Database.DuckDB.FFI.V2_Safe_duckdb_v2_aggregate_function_finalize_get_bind_data@
+hs_bindgen_911b6b58312bcd71 ::
+     DuckDBV2AggregateFunctionFinalizeInfoHandle
+  -> BG.Ptr (BG.Ptr BG.Void)
+  -> BG.Ptr DuckDBV2ErrorInfoHandle
+  -> IO DuckDBV2Error
+hs_bindgen_911b6b58312bcd71 =
+  \x0 ->
+    \x1 ->
+      \x2 ->
+        fmap BG.fromFFIType (hs_bindgen_911b6b58312bcd71_base (BG.toFFIType x0) (BG.toFFIType x1) (BG.toFFIType x2))
+
+{-| __C declaration:__ @duckdb_v2_aggregate_function_finalize_get_bind_data@
+
+    __defined at:__ @duckdb_v2.h 5672:30@
+
+    __exported by:__ @duckdb_v2.h@
+-}
+c_duckdb_v2_aggregate_function_finalize_get_bind_data ::
+     DuckDBV2AggregateFunctionFinalizeInfoHandle
+     -- ^ __C declaration:__ @info@
+  -> BG.Ptr (BG.Ptr BG.Void)
+     -- ^ __C declaration:__ @data@
+  -> BG.Ptr DuckDBV2ErrorInfoHandle
+     -- ^ __C declaration:__ @err@
+  -> IO DuckDBV2Error
+c_duckdb_v2_aggregate_function_finalize_get_bind_data =
+  hs_bindgen_911b6b58312bcd71
+
+-- __unique:__ @Database_DuckDB_FFI_V2_Database.DuckDB.FFI.V2_Safe_duckdb_v2_aggregate_function_finalize_get_state_count@
+foreign import ccall safe "hs_bindgen_ce017d7afc4fee25" hs_bindgen_ce017d7afc4fee25_base ::
+     BG.Ptr BG.Void
+  -> BG.Ptr BG.Void
+  -> BG.Ptr BG.Void
+  -> IO BG.CUInt
+
+-- __unique:__ @Database_DuckDB_FFI_V2_Database.DuckDB.FFI.V2_Safe_duckdb_v2_aggregate_function_finalize_get_state_count@
+hs_bindgen_ce017d7afc4fee25 ::
+     DuckDBV2AggregateFunctionFinalizeInfoHandle
+  -> BG.Ptr DuckDBIdx
+  -> BG.Ptr DuckDBV2ErrorInfoHandle
+  -> IO DuckDBV2Error
+hs_bindgen_ce017d7afc4fee25 =
+  \x0 ->
+    \x1 ->
+      \x2 ->
+        fmap BG.fromFFIType (hs_bindgen_ce017d7afc4fee25_base (BG.toFFIType x0) (BG.toFFIType x1) (BG.toFFIType x2))
+
+{-| __C declaration:__ @duckdb_v2_aggregate_function_finalize_get_state_count@
+
+    __defined at:__ @duckdb_v2.h 5690:30@
+
+    __exported by:__ @duckdb_v2.h@
+-}
+c_duckdb_v2_aggregate_function_finalize_get_state_count ::
+     DuckDBV2AggregateFunctionFinalizeInfoHandle
+     -- ^ __C declaration:__ @info@
+  -> BG.Ptr DuckDBIdx
+     -- ^ __C declaration:__ @count@
+  -> BG.Ptr DuckDBV2ErrorInfoHandle
+     -- ^ __C declaration:__ @err@
+  -> IO DuckDBV2Error
+c_duckdb_v2_aggregate_function_finalize_get_state_count =
+  hs_bindgen_ce017d7afc4fee25
+
+-- __unique:__ @Database_DuckDB_FFI_V2_Database.DuckDB.FFI.V2_Safe_duckdb_v2_aggregate_function_finalize_get_states@
+foreign import ccall safe "hs_bindgen_65d33d4acafc8a49" hs_bindgen_65d33d4acafc8a49_base ::
+     BG.Ptr BG.Void
+  -> BG.Ptr BG.Void
+  -> BG.Ptr BG.Void
+  -> IO BG.CUInt
+
+-- __unique:__ @Database_DuckDB_FFI_V2_Database.DuckDB.FFI.V2_Safe_duckdb_v2_aggregate_function_finalize_get_states@
+hs_bindgen_65d33d4acafc8a49 ::
+     DuckDBV2AggregateFunctionFinalizeInfoHandle
+  -> BG.Ptr (BG.Ptr (BG.Ptr BG.Void))
+  -> BG.Ptr DuckDBV2ErrorInfoHandle
+  -> IO DuckDBV2Error
+hs_bindgen_65d33d4acafc8a49 =
+  \x0 ->
+    \x1 ->
+      \x2 ->
+        fmap BG.fromFFIType (hs_bindgen_65d33d4acafc8a49_base (BG.toFFIType x0) (BG.toFFIType x1) (BG.toFFIType x2))
+
+{-| __C declaration:__ @duckdb_v2_aggregate_function_finalize_get_states@
+
+    __defined at:__ @duckdb_v2.h 5708:30@
+
+    __exported by:__ @duckdb_v2.h@
+-}
+c_duckdb_v2_aggregate_function_finalize_get_states ::
+     DuckDBV2AggregateFunctionFinalizeInfoHandle
+     -- ^ __C declaration:__ @info@
+  -> BG.Ptr (BG.Ptr (BG.Ptr BG.Void))
+     -- ^ __C declaration:__ @states@
+  -> BG.Ptr DuckDBV2ErrorInfoHandle
+     -- ^ __C declaration:__ @err@
+  -> IO DuckDBV2Error
+c_duckdb_v2_aggregate_function_finalize_get_states =
+  hs_bindgen_65d33d4acafc8a49
+
+-- __unique:__ @Database_DuckDB_FFI_V2_Database.DuckDB.FFI.V2_Safe_duckdb_v2_aggregate_function_finalize_get_result@
+foreign import ccall safe "hs_bindgen_6461ecbe1586fbe2" hs_bindgen_6461ecbe1586fbe2_base ::
+     BG.Ptr BG.Void
+  -> BG.Ptr BG.Void
+  -> BG.Ptr BG.Void
+  -> IO BG.CUInt
+
+-- __unique:__ @Database_DuckDB_FFI_V2_Database.DuckDB.FFI.V2_Safe_duckdb_v2_aggregate_function_finalize_get_result@
+hs_bindgen_6461ecbe1586fbe2 ::
+     DuckDBV2AggregateFunctionFinalizeInfoHandle
+  -> BG.Ptr DuckDBV2VectorHandle
+  -> BG.Ptr DuckDBV2ErrorInfoHandle
+  -> IO DuckDBV2Error
+hs_bindgen_6461ecbe1586fbe2 =
+  \x0 ->
+    \x1 ->
+      \x2 ->
+        fmap BG.fromFFIType (hs_bindgen_6461ecbe1586fbe2_base (BG.toFFIType x0) (BG.toFFIType x1) (BG.toFFIType x2))
+
+{-| __C declaration:__ @duckdb_v2_aggregate_function_finalize_get_result@
+
+    __defined at:__ @duckdb_v2.h 5729:1@
+
+    __exported by:__ @duckdb_v2.h@
+-}
+c_duckdb_v2_aggregate_function_finalize_get_result ::
+     DuckDBV2AggregateFunctionFinalizeInfoHandle
+     -- ^ __C declaration:__ @info@
+  -> BG.Ptr DuckDBV2VectorHandle
+     -- ^ __C declaration:__ @vector@
+  -> BG.Ptr DuckDBV2ErrorInfoHandle
+     -- ^ __C declaration:__ @err@
+  -> IO DuckDBV2Error
+c_duckdb_v2_aggregate_function_finalize_get_result =
+  hs_bindgen_6461ecbe1586fbe2
+
+-- __unique:__ @Database_DuckDB_FFI_V2_Database.DuckDB.FFI.V2_Safe_duckdb_v2_aggregate_function_finalize_get_result_offset@
+foreign import ccall safe "hs_bindgen_21966eba6ecbf203" hs_bindgen_21966eba6ecbf203_base ::
+     BG.Ptr BG.Void
+  -> BG.Ptr BG.Void
+  -> BG.Ptr BG.Void
+  -> IO BG.CUInt
+
+-- __unique:__ @Database_DuckDB_FFI_V2_Database.DuckDB.FFI.V2_Safe_duckdb_v2_aggregate_function_finalize_get_result_offset@
+hs_bindgen_21966eba6ecbf203 ::
+     DuckDBV2AggregateFunctionFinalizeInfoHandle
+  -> BG.Ptr DuckDBIdx
+  -> BG.Ptr DuckDBV2ErrorInfoHandle
+  -> IO DuckDBV2Error
+hs_bindgen_21966eba6ecbf203 =
+  \x0 ->
+    \x1 ->
+      \x2 ->
+        fmap BG.fromFFIType (hs_bindgen_21966eba6ecbf203_base (BG.toFFIType x0) (BG.toFFIType x1) (BG.toFFIType x2))
+
+{-| __C declaration:__ @duckdb_v2_aggregate_function_finalize_get_result_offset@
+
+    __defined at:__ @duckdb_v2.h 5747:30@
+
+    __exported by:__ @duckdb_v2.h@
+-}
+c_duckdb_v2_aggregate_function_finalize_get_result_offset ::
+     DuckDBV2AggregateFunctionFinalizeInfoHandle
+     -- ^ __C declaration:__ @info@
+  -> BG.Ptr DuckDBIdx
+     -- ^ __C declaration:__ @offset@
+  -> BG.Ptr DuckDBV2ErrorInfoHandle
+     -- ^ __C declaration:__ @err@
+  -> IO DuckDBV2Error
+c_duckdb_v2_aggregate_function_finalize_get_result_offset =
+  hs_bindgen_21966eba6ecbf203
+
+-- __unique:__ @Database_DuckDB_FFI_V2_Database.DuckDB.FFI.V2_Safe_duckdb_v2_aggregate_function_destroy_get_user_data@
+foreign import ccall safe "hs_bindgen_0a5215fdc2ad0556" hs_bindgen_0a5215fdc2ad0556_base ::
+     BG.Ptr BG.Void
+  -> BG.Ptr BG.Void
+  -> BG.Ptr BG.Void
+  -> IO BG.CUInt
+
+-- __unique:__ @Database_DuckDB_FFI_V2_Database.DuckDB.FFI.V2_Safe_duckdb_v2_aggregate_function_destroy_get_user_data@
+hs_bindgen_0a5215fdc2ad0556 ::
+     DuckDBV2AggregateFunctionDestroyInfoHandle
+  -> BG.Ptr (BG.Ptr BG.Void)
+  -> BG.Ptr DuckDBV2ErrorInfoHandle
+  -> IO DuckDBV2Error
+hs_bindgen_0a5215fdc2ad0556 =
+  \x0 ->
+    \x1 ->
+      \x2 ->
+        fmap BG.fromFFIType (hs_bindgen_0a5215fdc2ad0556_base (BG.toFFIType x0) (BG.toFFIType x1) (BG.toFFIType x2))
+
+{-| __C declaration:__ @duckdb_v2_aggregate_function_destroy_get_user_data@
+
+    __defined at:__ @duckdb_v2.h 5764:30@
+
+    __exported by:__ @duckdb_v2.h@
+-}
+c_duckdb_v2_aggregate_function_destroy_get_user_data ::
+     DuckDBV2AggregateFunctionDestroyInfoHandle
+     -- ^ __C declaration:__ @info@
+  -> BG.Ptr (BG.Ptr BG.Void)
+     -- ^ __C declaration:__ @data@
+  -> BG.Ptr DuckDBV2ErrorInfoHandle
+     -- ^ __C declaration:__ @err@
+  -> IO DuckDBV2Error
+c_duckdb_v2_aggregate_function_destroy_get_user_data =
+  hs_bindgen_0a5215fdc2ad0556
+
+-- __unique:__ @Database_DuckDB_FFI_V2_Database.DuckDB.FFI.V2_Safe_duckdb_v2_aggregate_function_destroy_get_bind_data@
+foreign import ccall safe "hs_bindgen_496b2f57d5f5295c" hs_bindgen_496b2f57d5f5295c_base ::
+     BG.Ptr BG.Void
+  -> BG.Ptr BG.Void
+  -> BG.Ptr BG.Void
+  -> IO BG.CUInt
+
+-- __unique:__ @Database_DuckDB_FFI_V2_Database.DuckDB.FFI.V2_Safe_duckdb_v2_aggregate_function_destroy_get_bind_data@
+hs_bindgen_496b2f57d5f5295c ::
+     DuckDBV2AggregateFunctionDestroyInfoHandle
+  -> BG.Ptr (BG.Ptr BG.Void)
+  -> BG.Ptr DuckDBV2ErrorInfoHandle
+  -> IO DuckDBV2Error
+hs_bindgen_496b2f57d5f5295c =
+  \x0 ->
+    \x1 ->
+      \x2 ->
+        fmap BG.fromFFIType (hs_bindgen_496b2f57d5f5295c_base (BG.toFFIType x0) (BG.toFFIType x1) (BG.toFFIType x2))
+
+{-| __C declaration:__ @duckdb_v2_aggregate_function_destroy_get_bind_data@
+
+    __defined at:__ @duckdb_v2.h 5781:30@
+
+    __exported by:__ @duckdb_v2.h@
+-}
+c_duckdb_v2_aggregate_function_destroy_get_bind_data ::
+     DuckDBV2AggregateFunctionDestroyInfoHandle
+     -- ^ __C declaration:__ @info@
+  -> BG.Ptr (BG.Ptr BG.Void)
+     -- ^ __C declaration:__ @data@
+  -> BG.Ptr DuckDBV2ErrorInfoHandle
+     -- ^ __C declaration:__ @err@
+  -> IO DuckDBV2Error
+c_duckdb_v2_aggregate_function_destroy_get_bind_data =
+  hs_bindgen_496b2f57d5f5295c
+
+-- __unique:__ @Database_DuckDB_FFI_V2_Database.DuckDB.FFI.V2_Safe_duckdb_v2_aggregate_function_destroy_get_state_count@
+foreign import ccall safe "hs_bindgen_2de1505847e7b0d1" hs_bindgen_2de1505847e7b0d1_base ::
+     BG.Ptr BG.Void
+  -> BG.Ptr BG.Void
+  -> BG.Ptr BG.Void
+  -> IO BG.CUInt
+
+-- __unique:__ @Database_DuckDB_FFI_V2_Database.DuckDB.FFI.V2_Safe_duckdb_v2_aggregate_function_destroy_get_state_count@
+hs_bindgen_2de1505847e7b0d1 ::
+     DuckDBV2AggregateFunctionDestroyInfoHandle
+  -> BG.Ptr DuckDBIdx
+  -> BG.Ptr DuckDBV2ErrorInfoHandle
+  -> IO DuckDBV2Error
+hs_bindgen_2de1505847e7b0d1 =
+  \x0 ->
+    \x1 ->
+      \x2 ->
+        fmap BG.fromFFIType (hs_bindgen_2de1505847e7b0d1_base (BG.toFFIType x0) (BG.toFFIType x1) (BG.toFFIType x2))
+
+{-| __C declaration:__ @duckdb_v2_aggregate_function_destroy_get_state_count@
+
+    __defined at:__ @duckdb_v2.h 5798:30@
+
+    __exported by:__ @duckdb_v2.h@
+-}
+c_duckdb_v2_aggregate_function_destroy_get_state_count ::
+     DuckDBV2AggregateFunctionDestroyInfoHandle
+     -- ^ __C declaration:__ @info@
+  -> BG.Ptr DuckDBIdx
+     -- ^ __C declaration:__ @count@
+  -> BG.Ptr DuckDBV2ErrorInfoHandle
+     -- ^ __C declaration:__ @err@
+  -> IO DuckDBV2Error
+c_duckdb_v2_aggregate_function_destroy_get_state_count =
+  hs_bindgen_2de1505847e7b0d1
+
+-- __unique:__ @Database_DuckDB_FFI_V2_Database.DuckDB.FFI.V2_Safe_duckdb_v2_aggregate_function_destroy_get_states@
+foreign import ccall safe "hs_bindgen_50bb744b724818a5" hs_bindgen_50bb744b724818a5_base ::
+     BG.Ptr BG.Void
+  -> BG.Ptr BG.Void
+  -> BG.Ptr BG.Void
+  -> IO BG.CUInt
+
+-- __unique:__ @Database_DuckDB_FFI_V2_Database.DuckDB.FFI.V2_Safe_duckdb_v2_aggregate_function_destroy_get_states@
+hs_bindgen_50bb744b724818a5 ::
+     DuckDBV2AggregateFunctionDestroyInfoHandle
+  -> BG.Ptr (BG.Ptr (BG.Ptr BG.Void))
+  -> BG.Ptr DuckDBV2ErrorInfoHandle
+  -> IO DuckDBV2Error
+hs_bindgen_50bb744b724818a5 =
+  \x0 ->
+    \x1 ->
+      \x2 ->
+        fmap BG.fromFFIType (hs_bindgen_50bb744b724818a5_base (BG.toFFIType x0) (BG.toFFIType x1) (BG.toFFIType x2))
+
+{-| __C declaration:__ @duckdb_v2_aggregate_function_destroy_get_states@
+
+    __defined at:__ @duckdb_v2.h 5816:30@
+
+    __exported by:__ @duckdb_v2.h@
+-}
+c_duckdb_v2_aggregate_function_destroy_get_states ::
+     DuckDBV2AggregateFunctionDestroyInfoHandle
+     -- ^ __C declaration:__ @info@
+  -> BG.Ptr (BG.Ptr (BG.Ptr BG.Void))
+     -- ^ __C declaration:__ @states@
+  -> BG.Ptr DuckDBV2ErrorInfoHandle
+     -- ^ __C declaration:__ @err@
+  -> IO DuckDBV2Error
+c_duckdb_v2_aggregate_function_destroy_get_states =
+  hs_bindgen_50bb744b724818a5
+
+-- __unique:__ @Database_DuckDB_FFI_V2_Database.DuckDB.FFI.V2_Safe_duckdb_v2_connection_register_aggregate_function@
+foreign import ccall safe "hs_bindgen_a8317136cc0e9f77" hs_bindgen_a8317136cc0e9f77_base ::
+     BG.Ptr BG.Void
+  -> BG.Ptr BG.Void
+  -> BG.Ptr BG.Void
+  -> IO BG.CUInt
+
+-- __unique:__ @Database_DuckDB_FFI_V2_Database.DuckDB.FFI.V2_Safe_duckdb_v2_connection_register_aggregate_function@
+hs_bindgen_a8317136cc0e9f77 ::
+     DuckDBV2ConnectionHandle
+  -> DuckDBV2AggregateFunctionHandle
+  -> BG.Ptr DuckDBV2ErrorInfoHandle
+  -> IO DuckDBV2Error
+hs_bindgen_a8317136cc0e9f77 =
+  \x0 ->
+    \x1 ->
+      \x2 ->
+        fmap BG.fromFFIType (hs_bindgen_a8317136cc0e9f77_base (BG.toFFIType x0) (BG.toFFIType x1) (BG.toFFIType x2))
+
+{-| __C declaration:__ @duckdb_v2_connection_register_aggregate_function@
+
+    __defined at:__ @duckdb_v2.h 5841:30@
+
+    __exported by:__ @duckdb_v2.h@
+-}
+c_duckdb_v2_connection_register_aggregate_function ::
+     DuckDBV2ConnectionHandle
+     -- ^ __C declaration:__ @conn@
+  -> DuckDBV2AggregateFunctionHandle
+     -- ^ __C declaration:__ @function@
+  -> BG.Ptr DuckDBV2ErrorInfoHandle
+     -- ^ __C declaration:__ @err@
+  -> IO DuckDBV2Error
+c_duckdb_v2_connection_register_aggregate_function =
+  hs_bindgen_a8317136cc0e9f77
+
+-- __unique:__ @Database_DuckDB_FFI_V2_Database.DuckDB.FFI.V2_Safe_duckdb_v2_extension_register_aggregate_function@
+foreign import ccall safe "hs_bindgen_8fd37fe935e348db" hs_bindgen_8fd37fe935e348db_base ::
+     BG.Ptr BG.Void
+  -> BG.Ptr BG.Void
+  -> BG.Ptr BG.Void
+  -> IO BG.CUInt
+
+-- __unique:__ @Database_DuckDB_FFI_V2_Database.DuckDB.FFI.V2_Safe_duckdb_v2_extension_register_aggregate_function@
+hs_bindgen_8fd37fe935e348db ::
+     DuckDBV2ExtensionHandle
+  -> DuckDBV2AggregateFunctionHandle
+  -> BG.Ptr DuckDBV2ErrorInfoHandle
+  -> IO DuckDBV2Error
+hs_bindgen_8fd37fe935e348db =
+  \x0 ->
+    \x1 ->
+      \x2 ->
+        fmap BG.fromFFIType (hs_bindgen_8fd37fe935e348db_base (BG.toFFIType x0) (BG.toFFIType x1) (BG.toFFIType x2))
+
+{-| __C declaration:__ @duckdb_v2_extension_register_aggregate_function@
+
+    __defined at:__ @duckdb_v2.h 5865:30@
+
+    __exported by:__ @duckdb_v2.h@
+-}
+c_duckdb_v2_extension_register_aggregate_function ::
+     DuckDBV2ExtensionHandle
+     -- ^ __C declaration:__ @extension@
+  -> DuckDBV2AggregateFunctionHandle
+     -- ^ __C declaration:__ @function@
+  -> BG.Ptr DuckDBV2ErrorInfoHandle
+     -- ^ __C declaration:__ @err@
+  -> IO DuckDBV2Error
+c_duckdb_v2_extension_register_aggregate_function =
+  hs_bindgen_8fd37fe935e348db
+
+-- __unique:__ @Database_DuckDB_FFI_V2_Database.DuckDB.FFI.V2_Safe_duckdb_v2_aggregate_function_destroy@
+foreign import ccall safe "hs_bindgen_924c3d4d25c5d198" hs_bindgen_924c3d4d25c5d198_base ::
+     BG.Ptr BG.Void
+  -> IO BG.CUInt
+
+-- __unique:__ @Database_DuckDB_FFI_V2_Database.DuckDB.FFI.V2_Safe_duckdb_v2_aggregate_function_destroy@
+hs_bindgen_924c3d4d25c5d198 ::
+     BG.Ptr DuckDBV2AggregateFunctionHandle
+  -> IO DuckDBV2Error
+hs_bindgen_924c3d4d25c5d198 =
+  \x0 ->
+    fmap BG.fromFFIType (hs_bindgen_924c3d4d25c5d198_base (BG.toFFIType x0))
+
+{-| __C declaration:__ @duckdb_v2_aggregate_function_destroy@
+
+    __defined at:__ @duckdb_v2.h 5883:30@
+
+    __exported by:__ @duckdb_v2.h@
+-}
+c_duckdb_v2_aggregate_function_destroy ::
+     BG.Ptr DuckDBV2AggregateFunctionHandle
+     -- ^ __C declaration:__ @function@
+  -> IO DuckDBV2Error
+c_duckdb_v2_aggregate_function_destroy =
+  hs_bindgen_924c3d4d25c5d198
+
+-- __unique:__ @Database_DuckDB_FFI_V2_Database.DuckDB.FFI.V2_Safe_duckdb_v2_connection_describe_table@
+foreign import ccall safe "hs_bindgen_66fecc41919077b0" hs_bindgen_66fecc41919077b0_base ::
+     BG.Ptr BG.Void
+  -> BG.Ptr BG.Void
+  -> BG.Ptr BG.Void
+  -> BG.Ptr BG.Void
+  -> IO BG.CUInt
+
+-- __unique:__ @Database_DuckDB_FFI_V2_Database.DuckDB.FFI.V2_Safe_duckdb_v2_connection_describe_table@
+hs_bindgen_66fecc41919077b0 ::
+     DuckDBV2ConnectionHandle
+  -> DuckDBV2QnameHandle
+  -> BG.Ptr DuckDBV2TableDescriptionHandle
+  -> BG.Ptr DuckDBV2ErrorInfoHandle
+  -> IO DuckDBV2Error
+hs_bindgen_66fecc41919077b0 =
+  \x0 ->
+    \x1 ->
+      \x2 ->
+        \x3 ->
+          fmap BG.fromFFIType (hs_bindgen_66fecc41919077b0_base (BG.toFFIType x0) (BG.toFFIType x1) (BG.toFFIType x2) (BG.toFFIType x3))
+
+{-| __C declaration:__ @duckdb_v2_connection_describe_table@
+
+    __defined at:__ @duckdb_v2.h 5946:30@
+
+    __exported by:__ @duckdb_v2.h@
+-}
+c_duckdb_v2_connection_describe_table ::
+     DuckDBV2ConnectionHandle
+     -- ^ __C declaration:__ @conn@
+  -> DuckDBV2QnameHandle
+     -- ^ __C declaration:__ @name@
+  -> BG.Ptr DuckDBV2TableDescriptionHandle
+     -- ^ __C declaration:__ @desc@
+  -> BG.Ptr DuckDBV2ErrorInfoHandle
+     -- ^ __C declaration:__ @err@
+  -> IO DuckDBV2Error
+c_duckdb_v2_connection_describe_table =
+  hs_bindgen_66fecc41919077b0
+
+-- __unique:__ @Database_DuckDB_FFI_V2_Database.DuckDB.FFI.V2_Safe_duckdb_v2_table_description_get_qname@
+foreign import ccall safe "hs_bindgen_e1e1723713423fb0" hs_bindgen_e1e1723713423fb0_base ::
+     BG.Ptr BG.Void
+  -> BG.Ptr BG.Void
+  -> BG.Ptr BG.Void
+  -> IO BG.CUInt
+
+-- __unique:__ @Database_DuckDB_FFI_V2_Database.DuckDB.FFI.V2_Safe_duckdb_v2_table_description_get_qname@
+hs_bindgen_e1e1723713423fb0 ::
+     DuckDBV2TableDescriptionHandle
+  -> BG.Ptr DuckDBV2QnameHandle
+  -> BG.Ptr DuckDBV2ErrorInfoHandle
+  -> IO DuckDBV2Error
+hs_bindgen_e1e1723713423fb0 =
+  \x0 ->
+    \x1 ->
+      \x2 ->
+        fmap BG.fromFFIType (hs_bindgen_e1e1723713423fb0_base (BG.toFFIType x0) (BG.toFFIType x1) (BG.toFFIType x2))
+
+{-| __C declaration:__ @duckdb_v2_table_description_get_qname@
+
+    __defined at:__ @duckdb_v2.h 5969:30@
+
+    __exported by:__ @duckdb_v2.h@
+-}
+c_duckdb_v2_table_description_get_qname ::
+     DuckDBV2TableDescriptionHandle
+     -- ^ __C declaration:__ @desc@
+  -> BG.Ptr DuckDBV2QnameHandle
+     -- ^ __C declaration:__ @name@
+  -> BG.Ptr DuckDBV2ErrorInfoHandle
+     -- ^ __C declaration:__ @err@
+  -> IO DuckDBV2Error
+c_duckdb_v2_table_description_get_qname =
+  hs_bindgen_e1e1723713423fb0
+
+-- __unique:__ @Database_DuckDB_FFI_V2_Database.DuckDB.FFI.V2_Safe_duckdb_v2_table_description_is_readonly@
+foreign import ccall safe "hs_bindgen_77eaaf8183d9fdb1" hs_bindgen_77eaaf8183d9fdb1_base ::
+     BG.Ptr BG.Void
+  -> BG.Ptr BG.Void
+  -> BG.Ptr BG.Void
+  -> IO BG.CUInt
+
+-- __unique:__ @Database_DuckDB_FFI_V2_Database.DuckDB.FFI.V2_Safe_duckdb_v2_table_description_is_readonly@
+hs_bindgen_77eaaf8183d9fdb1 ::
+     DuckDBV2TableDescriptionHandle
+  -> BG.Ptr BG.CBool
+  -> BG.Ptr DuckDBV2ErrorInfoHandle
+  -> IO DuckDBV2Error
+hs_bindgen_77eaaf8183d9fdb1 =
+  \x0 ->
+    \x1 ->
+      \x2 ->
+        fmap BG.fromFFIType (hs_bindgen_77eaaf8183d9fdb1_base (BG.toFFIType x0) (BG.toFFIType x1) (BG.toFFIType x2))
+
+{-| __C declaration:__ @duckdb_v2_table_description_is_readonly@
+
+    __defined at:__ @duckdb_v2.h 5990:30@
+
+    __exported by:__ @duckdb_v2.h@
+-}
+c_duckdb_v2_table_description_is_readonly ::
+     DuckDBV2TableDescriptionHandle
+     -- ^ __C declaration:__ @desc@
+  -> BG.Ptr BG.CBool
+     -- ^ __C declaration:__ @readonly@
+  -> BG.Ptr DuckDBV2ErrorInfoHandle
+     -- ^ __C declaration:__ @err@
+  -> IO DuckDBV2Error
+c_duckdb_v2_table_description_is_readonly =
+  hs_bindgen_77eaaf8183d9fdb1
+
+-- __unique:__ @Database_DuckDB_FFI_V2_Database.DuckDB.FFI.V2_Safe_duckdb_v2_table_description_get_column_count@
+foreign import ccall safe "hs_bindgen_39447e03d9f1d155" hs_bindgen_39447e03d9f1d155_base ::
+     BG.Ptr BG.Void
+  -> BG.Ptr BG.Void
+  -> BG.Ptr BG.Void
+  -> IO BG.CUInt
+
+-- __unique:__ @Database_DuckDB_FFI_V2_Database.DuckDB.FFI.V2_Safe_duckdb_v2_table_description_get_column_count@
+hs_bindgen_39447e03d9f1d155 ::
+     DuckDBV2TableDescriptionHandle
+  -> BG.Ptr DuckDBIdx
+  -> BG.Ptr DuckDBV2ErrorInfoHandle
+  -> IO DuckDBV2Error
+hs_bindgen_39447e03d9f1d155 =
+  \x0 ->
+    \x1 ->
+      \x2 ->
+        fmap BG.fromFFIType (hs_bindgen_39447e03d9f1d155_base (BG.toFFIType x0) (BG.toFFIType x1) (BG.toFFIType x2))
+
+{-| __C declaration:__ @duckdb_v2_table_description_get_column_count@
+
+    __defined at:__ @duckdb_v2.h 6010:30@
+
+    __exported by:__ @duckdb_v2.h@
+-}
+c_duckdb_v2_table_description_get_column_count ::
+     DuckDBV2TableDescriptionHandle
+     -- ^ __C declaration:__ @desc@
+  -> BG.Ptr DuckDBIdx
+     -- ^ __C declaration:__ @count@
+  -> BG.Ptr DuckDBV2ErrorInfoHandle
+     -- ^ __C declaration:__ @err@
+  -> IO DuckDBV2Error
+c_duckdb_v2_table_description_get_column_count =
+  hs_bindgen_39447e03d9f1d155
+
+-- __unique:__ @Database_DuckDB_FFI_V2_Database.DuckDB.FFI.V2_Safe_duckdb_v2_table_description_get_column@
+foreign import ccall safe "hs_bindgen_3fab6b1834ba9570" hs_bindgen_3fab6b1834ba9570_base ::
+     BG.Ptr BG.Void
+  -> HsBindgen.Runtime.LibC.Word64
+  -> BG.Ptr BG.Void
+  -> BG.Ptr BG.Void
+  -> IO BG.CUInt
+
+-- __unique:__ @Database_DuckDB_FFI_V2_Database.DuckDB.FFI.V2_Safe_duckdb_v2_table_description_get_column@
+hs_bindgen_3fab6b1834ba9570 ::
+     DuckDBV2TableDescriptionHandle
+  -> DuckDBIdx
+  -> BG.Ptr DuckDBV2ColumnDescriptionHandle
+  -> BG.Ptr DuckDBV2ErrorInfoHandle
+  -> IO DuckDBV2Error
+hs_bindgen_3fab6b1834ba9570 =
+  \x0 ->
+    \x1 ->
+      \x2 ->
+        \x3 ->
+          fmap BG.fromFFIType (hs_bindgen_3fab6b1834ba9570_base (BG.toFFIType x0) (BG.toFFIType x1) (BG.toFFIType x2) (BG.toFFIType x3))
+
+{-| __C declaration:__ @duckdb_v2_table_description_get_column@
+
+    __defined at:__ @duckdb_v2.h 6032:30@
+
+    __exported by:__ @duckdb_v2.h@
+-}
+c_duckdb_v2_table_description_get_column ::
+     DuckDBV2TableDescriptionHandle
+     -- ^ __C declaration:__ @desc@
+  -> DuckDBIdx
+     -- ^ __C declaration:__ @index@
+  -> BG.Ptr DuckDBV2ColumnDescriptionHandle
+     -- ^ __C declaration:__ @column@
+  -> BG.Ptr DuckDBV2ErrorInfoHandle
+     -- ^ __C declaration:__ @err@
+  -> IO DuckDBV2Error
+c_duckdb_v2_table_description_get_column =
+  hs_bindgen_3fab6b1834ba9570
+
+-- __unique:__ @Database_DuckDB_FFI_V2_Database.DuckDB.FFI.V2_Safe_duckdb_v2_table_description_destroy@
+foreign import ccall safe "hs_bindgen_503d9b718ec6652d" hs_bindgen_503d9b718ec6652d_base ::
+     BG.Ptr BG.Void
+  -> IO BG.CUInt
+
+-- __unique:__ @Database_DuckDB_FFI_V2_Database.DuckDB.FFI.V2_Safe_duckdb_v2_table_description_destroy@
+hs_bindgen_503d9b718ec6652d ::
+     BG.Ptr DuckDBV2TableDescriptionHandle
+  -> IO DuckDBV2Error
+hs_bindgen_503d9b718ec6652d =
+  \x0 ->
+    fmap BG.fromFFIType (hs_bindgen_503d9b718ec6652d_base (BG.toFFIType x0))
+
+{-| __C declaration:__ @duckdb_v2_table_description_destroy@
+
+    __defined at:__ @duckdb_v2.h 6051:30@
+
+    __exported by:__ @duckdb_v2.h@
+-}
+c_duckdb_v2_table_description_destroy ::
+     BG.Ptr DuckDBV2TableDescriptionHandle
+     -- ^ __C declaration:__ @desc@
+  -> IO DuckDBV2Error
+c_duckdb_v2_table_description_destroy =
+  hs_bindgen_503d9b718ec6652d
+
+-- __unique:__ @Database_DuckDB_FFI_V2_Database.DuckDB.FFI.V2_Safe_duckdb_v2_column_description_get_name@
+foreign import ccall safe "hs_bindgen_4e5323a1f0159c54" hs_bindgen_4e5323a1f0159c54_base ::
+     BG.Ptr BG.Void
+  -> BG.Ptr BG.Void
+  -> BG.Ptr BG.Void
+  -> IO BG.CUInt
+
+-- __unique:__ @Database_DuckDB_FFI_V2_Database.DuckDB.FFI.V2_Safe_duckdb_v2_column_description_get_name@
+hs_bindgen_4e5323a1f0159c54 ::
+     DuckDBV2ColumnDescriptionHandle
+  -> BG.Ptr DuckDBV2IdentifierT
+  -> BG.Ptr DuckDBV2ErrorInfoHandle
+  -> IO DuckDBV2Error
+hs_bindgen_4e5323a1f0159c54 =
+  \x0 ->
+    \x1 ->
+      \x2 ->
+        fmap BG.fromFFIType (hs_bindgen_4e5323a1f0159c54_base (BG.toFFIType x0) (BG.toFFIType x1) (BG.toFFIType x2))
+
+{-| __C declaration:__ @duckdb_v2_column_description_get_name@
+
+    __defined at:__ @duckdb_v2.h 6069:30@
+
+    __exported by:__ @duckdb_v2.h@
+-}
+c_duckdb_v2_column_description_get_name ::
+     DuckDBV2ColumnDescriptionHandle
+     -- ^ __C declaration:__ @column@
+  -> BG.Ptr DuckDBV2IdentifierT
+     -- ^ __C declaration:__ @name@
+  -> BG.Ptr DuckDBV2ErrorInfoHandle
+     -- ^ __C declaration:__ @err@
+  -> IO DuckDBV2Error
+c_duckdb_v2_column_description_get_name =
+  hs_bindgen_4e5323a1f0159c54
+
+-- __unique:__ @Database_DuckDB_FFI_V2_Database.DuckDB.FFI.V2_Safe_duckdb_v2_column_description_get_type@
+foreign import ccall safe "hs_bindgen_76c4fc89924dbc4f" hs_bindgen_76c4fc89924dbc4f_base ::
+     BG.Ptr BG.Void
+  -> BG.Ptr BG.Void
+  -> BG.Ptr BG.Void
+  -> IO BG.CUInt
+
+-- __unique:__ @Database_DuckDB_FFI_V2_Database.DuckDB.FFI.V2_Safe_duckdb_v2_column_description_get_type@
+hs_bindgen_76c4fc89924dbc4f ::
+     DuckDBV2ColumnDescriptionHandle
+  -> BG.Ptr DuckDBV2LogicalTypeHandle
+  -> BG.Ptr DuckDBV2ErrorInfoHandle
+  -> IO DuckDBV2Error
+hs_bindgen_76c4fc89924dbc4f =
+  \x0 ->
+    \x1 ->
+      \x2 ->
+        fmap BG.fromFFIType (hs_bindgen_76c4fc89924dbc4f_base (BG.toFFIType x0) (BG.toFFIType x1) (BG.toFFIType x2))
+
+{-| __C declaration:__ @duckdb_v2_column_description_get_type@
+
+    __defined at:__ @duckdb_v2.h 6087:30@
+
+    __exported by:__ @duckdb_v2.h@
+-}
+c_duckdb_v2_column_description_get_type ::
+     DuckDBV2ColumnDescriptionHandle
+     -- ^ __C declaration:__ @column@
+  -> BG.Ptr DuckDBV2LogicalTypeHandle
+     -- ^ __C declaration:__ @type@
+  -> BG.Ptr DuckDBV2ErrorInfoHandle
+     -- ^ __C declaration:__ @err@
+  -> IO DuckDBV2Error
+c_duckdb_v2_column_description_get_type =
+  hs_bindgen_76c4fc89924dbc4f
+
+-- __unique:__ @Database_DuckDB_FFI_V2_Database.DuckDB.FFI.V2_Safe_duckdb_v2_column_description_has_default@
+foreign import ccall safe "hs_bindgen_cb70a2fa3379aed9" hs_bindgen_cb70a2fa3379aed9_base ::
+     BG.Ptr BG.Void
+  -> BG.Ptr BG.Void
+  -> BG.Ptr BG.Void
+  -> IO BG.CUInt
+
+-- __unique:__ @Database_DuckDB_FFI_V2_Database.DuckDB.FFI.V2_Safe_duckdb_v2_column_description_has_default@
+hs_bindgen_cb70a2fa3379aed9 ::
+     DuckDBV2ColumnDescriptionHandle
+  -> BG.Ptr BG.CBool
+  -> BG.Ptr DuckDBV2ErrorInfoHandle
+  -> IO DuckDBV2Error
+hs_bindgen_cb70a2fa3379aed9 =
+  \x0 ->
+    \x1 ->
+      \x2 ->
+        fmap BG.fromFFIType (hs_bindgen_cb70a2fa3379aed9_base (BG.toFFIType x0) (BG.toFFIType x1) (BG.toFFIType x2))
+
+{-| __C declaration:__ @duckdb_v2_column_description_has_default@
+
+    __defined at:__ @duckdb_v2.h 6108:30@
+
+    __exported by:__ @duckdb_v2.h@
+-}
+c_duckdb_v2_column_description_has_default ::
+     DuckDBV2ColumnDescriptionHandle
+     -- ^ __C declaration:__ @column@
+  -> BG.Ptr BG.CBool
+     -- ^ __C declaration:__ @has_default@
+  -> BG.Ptr DuckDBV2ErrorInfoHandle
+     -- ^ __C declaration:__ @err@
+  -> IO DuckDBV2Error
+c_duckdb_v2_column_description_has_default =
+  hs_bindgen_cb70a2fa3379aed9
+
+-- __unique:__ @Database_DuckDB_FFI_V2_Database.DuckDB.FFI.V2_Safe_duckdb_v2_column_description_has_generated@
+foreign import ccall safe "hs_bindgen_1d6a7a57a7a76147" hs_bindgen_1d6a7a57a7a76147_base ::
+     BG.Ptr BG.Void
+  -> BG.Ptr BG.Void
+  -> BG.Ptr BG.Void
+  -> IO BG.CUInt
+
+-- __unique:__ @Database_DuckDB_FFI_V2_Database.DuckDB.FFI.V2_Safe_duckdb_v2_column_description_has_generated@
+hs_bindgen_1d6a7a57a7a76147 ::
+     DuckDBV2ColumnDescriptionHandle
+  -> BG.Ptr BG.CBool
+  -> BG.Ptr DuckDBV2ErrorInfoHandle
+  -> IO DuckDBV2Error
+hs_bindgen_1d6a7a57a7a76147 =
+  \x0 ->
+    \x1 ->
+      \x2 ->
+        fmap BG.fromFFIType (hs_bindgen_1d6a7a57a7a76147_base (BG.toFFIType x0) (BG.toFFIType x1) (BG.toFFIType x2))
+
+{-| __C declaration:__ @duckdb_v2_column_description_has_generated@
+
+    __defined at:__ @duckdb_v2.h 6128:30@
+
+    __exported by:__ @duckdb_v2.h@
+-}
+c_duckdb_v2_column_description_has_generated ::
+     DuckDBV2ColumnDescriptionHandle
+     -- ^ __C declaration:__ @column@
+  -> BG.Ptr BG.CBool
+     -- ^ __C declaration:__ @has_generated@
+  -> BG.Ptr DuckDBV2ErrorInfoHandle
+     -- ^ __C declaration:__ @err@
+  -> IO DuckDBV2Error
+c_duckdb_v2_column_description_has_generated =
+  hs_bindgen_1d6a7a57a7a76147
+
+-- __unique:__ @Database_DuckDB_FFI_V2_Database.DuckDB.FFI.V2_Safe_duckdb_v2_column_description_destroy@
+foreign import ccall safe "hs_bindgen_4ec962f4910944a5" hs_bindgen_4ec962f4910944a5_base ::
+     BG.Ptr BG.Void
+  -> IO BG.CUInt
+
+-- __unique:__ @Database_DuckDB_FFI_V2_Database.DuckDB.FFI.V2_Safe_duckdb_v2_column_description_destroy@
+hs_bindgen_4ec962f4910944a5 ::
+     BG.Ptr DuckDBV2ColumnDescriptionHandle
+  -> IO DuckDBV2Error
+hs_bindgen_4ec962f4910944a5 =
+  \x0 ->
+    fmap BG.fromFFIType (hs_bindgen_4ec962f4910944a5_base (BG.toFFIType x0))
+
+{-| __C declaration:__ @duckdb_v2_column_description_destroy@
+
+    __defined at:__ @duckdb_v2.h 6146:30@
+
+    __exported by:__ @duckdb_v2.h@
+-}
+c_duckdb_v2_column_description_destroy ::
+     BG.Ptr DuckDBV2ColumnDescriptionHandle
+     -- ^ __C declaration:__ @column@
+  -> IO DuckDBV2Error
+c_duckdb_v2_column_description_destroy =
+  hs_bindgen_4ec962f4910944a5
+
+-- __unique:__ @Database_DuckDB_FFI_V2_Database.DuckDB.FFI.V2_Safe_duckdb_v2_copy_function_create@
+foreign import ccall safe "hs_bindgen_5a22fa811ee59c70" hs_bindgen_5a22fa811ee59c70_base ::
+     BG.Ptr BG.Void
+  -> BG.Ptr BG.Void
+  -> BG.Ptr BG.Void
+  -> IO BG.CUInt
+
+-- __unique:__ @Database_DuckDB_FFI_V2_Database.DuckDB.FFI.V2_Safe_duckdb_v2_copy_function_create@
+hs_bindgen_5a22fa811ee59c70 ::
+     DuckDBV2FactoryHandle
+  -> BG.Ptr DuckDBV2CopyFunctionHandle
+  -> BG.Ptr DuckDBV2ErrorInfoHandle
+  -> IO DuckDBV2Error
+hs_bindgen_5a22fa811ee59c70 =
+  \x0 ->
+    \x1 ->
+      \x2 ->
+        fmap BG.fromFFIType (hs_bindgen_5a22fa811ee59c70_base (BG.toFFIType x0) (BG.toFFIType x1) (BG.toFFIType x2))
+
+{-| __C declaration:__ @duckdb_v2_copy_function_create@
+
+    __defined at:__ @duckdb_v2.h 6352:30@
+
+    __exported by:__ @duckdb_v2.h@
+-}
+c_duckdb_v2_copy_function_create ::
+     DuckDBV2FactoryHandle
+     -- ^ __C declaration:__ @factory@
+  -> BG.Ptr DuckDBV2CopyFunctionHandle
+     -- ^ __C declaration:__ @function@
+  -> BG.Ptr DuckDBV2ErrorInfoHandle
+     -- ^ __C declaration:__ @err@
+  -> IO DuckDBV2Error
+c_duckdb_v2_copy_function_create =
+  hs_bindgen_5a22fa811ee59c70
+
+-- __unique:__ @Database_DuckDB_FFI_V2_Database.DuckDB.FFI.V2_Safe_duckdb_v2_copy_function_set_name@
+foreign import ccall safe "hs_bindgen_c82d1052e04727af" hs_bindgen_c82d1052e04727af_base ::
+     BG.Ptr BG.Void
+  -> BG.Ptr BG.Void
+  -> BG.Ptr BG.Void
+  -> IO BG.CUInt
+
+-- __unique:__ @Database_DuckDB_FFI_V2_Database.DuckDB.FFI.V2_Safe_duckdb_v2_copy_function_set_name@
+hs_bindgen_c82d1052e04727af ::
+     DuckDBV2CopyFunctionHandle
+  -> PtrConst.PtrConst DuckDBV2IdentifierT
+  -> BG.Ptr DuckDBV2ErrorInfoHandle
+  -> IO DuckDBV2Error
+hs_bindgen_c82d1052e04727af =
+  \x0 ->
+    \x1 ->
+      \x2 ->
+        fmap BG.fromFFIType (hs_bindgen_c82d1052e04727af_base (BG.toFFIType x0) (BG.toFFIType x1) (BG.toFFIType x2))
+
+{-| __C declaration:__ @duckdb_v2_copy_function_set_name@
+
+    __defined at:__ @duckdb_v2.h 6374:30@
+
+    __exported by:__ @duckdb_v2.h@
+-}
+c_duckdb_v2_copy_function_set_name ::
+     DuckDBV2CopyFunctionHandle
+     -- ^ __C declaration:__ @function@
+  -> PtrConst.PtrConst DuckDBV2IdentifierT
+     -- ^ __C declaration:__ @name@
+  -> BG.Ptr DuckDBV2ErrorInfoHandle
+     -- ^ __C declaration:__ @err@
+  -> IO DuckDBV2Error
+c_duckdb_v2_copy_function_set_name =
+  hs_bindgen_c82d1052e04727af
+
+-- __unique:__ @Database_DuckDB_FFI_V2_Database.DuckDB.FFI.V2_Safe_duckdb_v2_copy_function_set_file_extension@
+foreign import ccall safe "hs_bindgen_896e694dbb437dc4" hs_bindgen_896e694dbb437dc4_base ::
+     BG.Ptr BG.Void
+  -> BG.Ptr BG.Void
+  -> BG.Ptr BG.Void
+  -> IO BG.CUInt
+
+-- __unique:__ @Database_DuckDB_FFI_V2_Database.DuckDB.FFI.V2_Safe_duckdb_v2_copy_function_set_file_extension@
+hs_bindgen_896e694dbb437dc4 ::
+     DuckDBV2CopyFunctionHandle
+  -> PtrConst.PtrConst DuckDBV2Str
+  -> BG.Ptr DuckDBV2ErrorInfoHandle
+  -> IO DuckDBV2Error
+hs_bindgen_896e694dbb437dc4 =
+  \x0 ->
+    \x1 ->
+      \x2 ->
+        fmap BG.fromFFIType (hs_bindgen_896e694dbb437dc4_base (BG.toFFIType x0) (BG.toFFIType x1) (BG.toFFIType x2))
+
+{-| __C declaration:__ @duckdb_v2_copy_function_set_file_extension@
+
+    __defined at:__ @duckdb_v2.h 6397:30@
+
+    __exported by:__ @duckdb_v2.h@
+-}
+c_duckdb_v2_copy_function_set_file_extension ::
+     DuckDBV2CopyFunctionHandle
+     -- ^ __C declaration:__ @function@
+  -> PtrConst.PtrConst DuckDBV2Str
+     -- ^ __C declaration:__ @extension@
+  -> BG.Ptr DuckDBV2ErrorInfoHandle
+     -- ^ __C declaration:__ @err@
+  -> IO DuckDBV2Error
+c_duckdb_v2_copy_function_set_file_extension =
+  hs_bindgen_896e694dbb437dc4
+
+-- __unique:__ @Database_DuckDB_FFI_V2_Database.DuckDB.FFI.V2_Safe_duckdb_v2_copy_function_set_user_data@
+foreign import ccall safe "hs_bindgen_137b1aa7a6c369c3" hs_bindgen_137b1aa7a6c369c3_base ::
+     BG.Ptr BG.Void
+  -> BG.Ptr BG.Void
+  -> BG.Ptr BG.Void
+  -> IO BG.CUInt
+
+-- __unique:__ @Database_DuckDB_FFI_V2_Database.DuckDB.FFI.V2_Safe_duckdb_v2_copy_function_set_user_data@
+hs_bindgen_137b1aa7a6c369c3 ::
+     DuckDBV2CopyFunctionHandle
+  -> BG.Ptr DuckDBV2Opaque
+  -> BG.Ptr DuckDBV2ErrorInfoHandle
+  -> IO DuckDBV2Error
+hs_bindgen_137b1aa7a6c369c3 =
+  \x0 ->
+    \x1 ->
+      \x2 ->
+        fmap BG.fromFFIType (hs_bindgen_137b1aa7a6c369c3_base (BG.toFFIType x0) (BG.toFFIType x1) (BG.toFFIType x2))
+
+{-| __C declaration:__ @duckdb_v2_copy_function_set_user_data@
+
+    __defined at:__ @duckdb_v2.h 6419:30@
+
+    __exported by:__ @duckdb_v2.h@
+-}
+c_duckdb_v2_copy_function_set_user_data ::
+     DuckDBV2CopyFunctionHandle
+     -- ^ __C declaration:__ @function@
+  -> BG.Ptr DuckDBV2Opaque
+     -- ^ __C declaration:__ @data@
+  -> BG.Ptr DuckDBV2ErrorInfoHandle
+     -- ^ __C declaration:__ @err@
+  -> IO DuckDBV2Error
+c_duckdb_v2_copy_function_set_user_data =
+  hs_bindgen_137b1aa7a6c369c3
+
+-- __unique:__ @Database_DuckDB_FFI_V2_Database.DuckDB.FFI.V2_Safe_duckdb_v2_copy_to_set_bind_callback@
+foreign import ccall safe "hs_bindgen_3f0c177697bfd8ee" hs_bindgen_3f0c177697bfd8ee_base ::
+     BG.Ptr BG.Void
+  -> BG.FunPtr BG.Void
+  -> BG.Ptr BG.Void
+  -> IO BG.CUInt
+
+-- __unique:__ @Database_DuckDB_FFI_V2_Database.DuckDB.FFI.V2_Safe_duckdb_v2_copy_to_set_bind_callback@
+hs_bindgen_3f0c177697bfd8ee ::
+     DuckDBV2CopyFunctionHandle
+  -> DuckDBV2CopyToBindCallbackFn
+  -> BG.Ptr DuckDBV2ErrorInfoHandle
+  -> IO DuckDBV2Error
+hs_bindgen_3f0c177697bfd8ee =
+  \x0 ->
+    \x1 ->
+      \x2 ->
+        fmap BG.fromFFIType (hs_bindgen_3f0c177697bfd8ee_base (BG.toFFIType x0) (BG.toFFIType x1) (BG.toFFIType x2))
+
+{-| __C declaration:__ @duckdb_v2_copy_to_set_bind_callback@
+
+    __defined at:__ @duckdb_v2.h 6441:30@
+
+    __exported by:__ @duckdb_v2.h@
+-}
+c_duckdb_v2_copy_to_set_bind_callback ::
+     DuckDBV2CopyFunctionHandle
+     -- ^ __C declaration:__ @function@
+  -> DuckDBV2CopyToBindCallbackFn
+     -- ^ __C declaration:__ @callback@
+  -> BG.Ptr DuckDBV2ErrorInfoHandle
+     -- ^ __C declaration:__ @err@
+  -> IO DuckDBV2Error
+c_duckdb_v2_copy_to_set_bind_callback =
+  hs_bindgen_3f0c177697bfd8ee
+
+-- __unique:__ @Database_DuckDB_FFI_V2_Database.DuckDB.FFI.V2_Safe_duckdb_v2_copy_to_set_batch_size_callback@
+foreign import ccall safe "hs_bindgen_2d899e01b43de8e2" hs_bindgen_2d899e01b43de8e2_base ::
+     BG.Ptr BG.Void
+  -> BG.FunPtr BG.Void
+  -> BG.Ptr BG.Void
+  -> IO BG.CUInt
+
+-- __unique:__ @Database_DuckDB_FFI_V2_Database.DuckDB.FFI.V2_Safe_duckdb_v2_copy_to_set_batch_size_callback@
+hs_bindgen_2d899e01b43de8e2 ::
+     DuckDBV2CopyFunctionHandle
+  -> DuckDBV2CopyToBatchSizeCallbackFn
+  -> BG.Ptr DuckDBV2ErrorInfoHandle
+  -> IO DuckDBV2Error
+hs_bindgen_2d899e01b43de8e2 =
+  \x0 ->
+    \x1 ->
+      \x2 ->
+        fmap BG.fromFFIType (hs_bindgen_2d899e01b43de8e2_base (BG.toFFIType x0) (BG.toFFIType x1) (BG.toFFIType x2))
+
+{-| __C declaration:__ @duckdb_v2_copy_to_set_batch_size_callback@
+
+    __defined at:__ @duckdb_v2.h 6466:30@
+
+    __exported by:__ @duckdb_v2.h@
+-}
+c_duckdb_v2_copy_to_set_batch_size_callback ::
+     DuckDBV2CopyFunctionHandle
+     -- ^ __C declaration:__ @function@
+  -> DuckDBV2CopyToBatchSizeCallbackFn
+     -- ^ __C declaration:__ @callback@
+  -> BG.Ptr DuckDBV2ErrorInfoHandle
+     -- ^ __C declaration:__ @err@
+  -> IO DuckDBV2Error
+c_duckdb_v2_copy_to_set_batch_size_callback =
+  hs_bindgen_2d899e01b43de8e2
+
+-- __unique:__ @Database_DuckDB_FFI_V2_Database.DuckDB.FFI.V2_Safe_duckdb_v2_copy_to_set_init_callback@
+foreign import ccall safe "hs_bindgen_3b90b0509edc4ee0" hs_bindgen_3b90b0509edc4ee0_base ::
+     BG.Ptr BG.Void
+  -> BG.FunPtr BG.Void
+  -> BG.Ptr BG.Void
+  -> IO BG.CUInt
+
+-- __unique:__ @Database_DuckDB_FFI_V2_Database.DuckDB.FFI.V2_Safe_duckdb_v2_copy_to_set_init_callback@
+hs_bindgen_3b90b0509edc4ee0 ::
+     DuckDBV2CopyFunctionHandle
+  -> DuckDBV2CopyToInitCallbackFn
+  -> BG.Ptr DuckDBV2ErrorInfoHandle
+  -> IO DuckDBV2Error
+hs_bindgen_3b90b0509edc4ee0 =
+  \x0 ->
+    \x1 ->
+      \x2 ->
+        fmap BG.fromFFIType (hs_bindgen_3b90b0509edc4ee0_base (BG.toFFIType x0) (BG.toFFIType x1) (BG.toFFIType x2))
+
+{-| __C declaration:__ @duckdb_v2_copy_to_set_init_callback@
+
+    __defined at:__ @duckdb_v2.h 6489:30@
+
+    __exported by:__ @duckdb_v2.h@
+-}
+c_duckdb_v2_copy_to_set_init_callback ::
+     DuckDBV2CopyFunctionHandle
+     -- ^ __C declaration:__ @function@
+  -> DuckDBV2CopyToInitCallbackFn
+     -- ^ __C declaration:__ @callback@
+  -> BG.Ptr DuckDBV2ErrorInfoHandle
+     -- ^ __C declaration:__ @err@
+  -> IO DuckDBV2Error
+c_duckdb_v2_copy_to_set_init_callback =
+  hs_bindgen_3b90b0509edc4ee0
+
+-- __unique:__ @Database_DuckDB_FFI_V2_Database.DuckDB.FFI.V2_Safe_duckdb_v2_copy_to_set_batch_callback@
+foreign import ccall safe "hs_bindgen_f5c52f827520706b" hs_bindgen_f5c52f827520706b_base ::
+     BG.Ptr BG.Void
+  -> BG.FunPtr BG.Void
+  -> BG.Ptr BG.Void
+  -> IO BG.CUInt
+
+-- __unique:__ @Database_DuckDB_FFI_V2_Database.DuckDB.FFI.V2_Safe_duckdb_v2_copy_to_set_batch_callback@
+hs_bindgen_f5c52f827520706b ::
+     DuckDBV2CopyFunctionHandle
+  -> DuckDBV2CopyToBatchCallbackFn
+  -> BG.Ptr DuckDBV2ErrorInfoHandle
+  -> IO DuckDBV2Error
+hs_bindgen_f5c52f827520706b =
+  \x0 ->
+    \x1 ->
+      \x2 ->
+        fmap BG.fromFFIType (hs_bindgen_f5c52f827520706b_base (BG.toFFIType x0) (BG.toFFIType x1) (BG.toFFIType x2))
+
+{-| __C declaration:__ @duckdb_v2_copy_to_set_batch_callback@
+
+    __defined at:__ @duckdb_v2.h 6513:30@
+
+    __exported by:__ @duckdb_v2.h@
+-}
+c_duckdb_v2_copy_to_set_batch_callback ::
+     DuckDBV2CopyFunctionHandle
+     -- ^ __C declaration:__ @function@
+  -> DuckDBV2CopyToBatchCallbackFn
+     -- ^ __C declaration:__ @callback@
+  -> BG.Ptr DuckDBV2ErrorInfoHandle
+     -- ^ __C declaration:__ @err@
+  -> IO DuckDBV2Error
+c_duckdb_v2_copy_to_set_batch_callback =
+  hs_bindgen_f5c52f827520706b
+
+-- __unique:__ @Database_DuckDB_FFI_V2_Database.DuckDB.FFI.V2_Safe_duckdb_v2_copy_to_set_flush_callback@
+foreign import ccall safe "hs_bindgen_64029a2d5ef70633" hs_bindgen_64029a2d5ef70633_base ::
+     BG.Ptr BG.Void
+  -> BG.FunPtr BG.Void
+  -> BG.Ptr BG.Void
+  -> IO BG.CUInt
+
+-- __unique:__ @Database_DuckDB_FFI_V2_Database.DuckDB.FFI.V2_Safe_duckdb_v2_copy_to_set_flush_callback@
+hs_bindgen_64029a2d5ef70633 ::
+     DuckDBV2CopyFunctionHandle
+  -> DuckDBV2CopyToFlushCallbackFn
+  -> BG.Ptr DuckDBV2ErrorInfoHandle
+  -> IO DuckDBV2Error
+hs_bindgen_64029a2d5ef70633 =
+  \x0 ->
+    \x1 ->
+      \x2 ->
+        fmap BG.fromFFIType (hs_bindgen_64029a2d5ef70633_base (BG.toFFIType x0) (BG.toFFIType x1) (BG.toFFIType x2))
+
+{-| __C declaration:__ @duckdb_v2_copy_to_set_flush_callback@
+
+    __defined at:__ @duckdb_v2.h 6535:30@
+
+    __exported by:__ @duckdb_v2.h@
+-}
+c_duckdb_v2_copy_to_set_flush_callback ::
+     DuckDBV2CopyFunctionHandle
+     -- ^ __C declaration:__ @function@
+  -> DuckDBV2CopyToFlushCallbackFn
+     -- ^ __C declaration:__ @callback@
+  -> BG.Ptr DuckDBV2ErrorInfoHandle
+     -- ^ __C declaration:__ @err@
+  -> IO DuckDBV2Error
+c_duckdb_v2_copy_to_set_flush_callback =
+  hs_bindgen_64029a2d5ef70633
+
+-- __unique:__ @Database_DuckDB_FFI_V2_Database.DuckDB.FFI.V2_Safe_duckdb_v2_copy_to_set_finalize_callback@
+foreign import ccall safe "hs_bindgen_596a08db4e0079c3" hs_bindgen_596a08db4e0079c3_base ::
+     BG.Ptr BG.Void
+  -> BG.FunPtr BG.Void
+  -> BG.Ptr BG.Void
+  -> IO BG.CUInt
+
+-- __unique:__ @Database_DuckDB_FFI_V2_Database.DuckDB.FFI.V2_Safe_duckdb_v2_copy_to_set_finalize_callback@
+hs_bindgen_596a08db4e0079c3 ::
+     DuckDBV2CopyFunctionHandle
+  -> DuckDBV2CopyToFinalizeCallbackFn
+  -> BG.Ptr DuckDBV2ErrorInfoHandle
+  -> IO DuckDBV2Error
+hs_bindgen_596a08db4e0079c3 =
+  \x0 ->
+    \x1 ->
+      \x2 ->
+        fmap BG.fromFFIType (hs_bindgen_596a08db4e0079c3_base (BG.toFFIType x0) (BG.toFFIType x1) (BG.toFFIType x2))
+
+{-| __C declaration:__ @duckdb_v2_copy_to_set_finalize_callback@
+
+    __defined at:__ @duckdb_v2.h 6556:30@
+
+    __exported by:__ @duckdb_v2.h@
+-}
+c_duckdb_v2_copy_to_set_finalize_callback ::
+     DuckDBV2CopyFunctionHandle
+     -- ^ __C declaration:__ @function@
+  -> DuckDBV2CopyToFinalizeCallbackFn
+     -- ^ __C declaration:__ @callback@
+  -> BG.Ptr DuckDBV2ErrorInfoHandle
+     -- ^ __C declaration:__ @err@
+  -> IO DuckDBV2Error
+c_duckdb_v2_copy_to_set_finalize_callback =
+  hs_bindgen_596a08db4e0079c3
+
+-- __unique:__ @Database_DuckDB_FFI_V2_Database.DuckDB.FFI.V2_Safe_duckdb_v2_copy_to_bind_get_user_data@
+foreign import ccall safe "hs_bindgen_eb0ea355c070737c" hs_bindgen_eb0ea355c070737c_base ::
+     BG.Ptr BG.Void
+  -> BG.Ptr BG.Void
+  -> BG.Ptr BG.Void
+  -> IO BG.CUInt
+
+-- __unique:__ @Database_DuckDB_FFI_V2_Database.DuckDB.FFI.V2_Safe_duckdb_v2_copy_to_bind_get_user_data@
+hs_bindgen_eb0ea355c070737c ::
+     DuckDBV2CopyToBindInfoHandle
+  -> BG.Ptr (BG.Ptr BG.Void)
+  -> BG.Ptr DuckDBV2ErrorInfoHandle
+  -> IO DuckDBV2Error
+hs_bindgen_eb0ea355c070737c =
+  \x0 ->
+    \x1 ->
+      \x2 ->
+        fmap BG.fromFFIType (hs_bindgen_eb0ea355c070737c_base (BG.toFFIType x0) (BG.toFFIType x1) (BG.toFFIType x2))
+
+{-| __C declaration:__ @duckdb_v2_copy_to_bind_get_user_data@
+
+    __defined at:__ @duckdb_v2.h 6574:30@
+
+    __exported by:__ @duckdb_v2.h@
+-}
+c_duckdb_v2_copy_to_bind_get_user_data ::
+     DuckDBV2CopyToBindInfoHandle
+     -- ^ __C declaration:__ @info@
+  -> BG.Ptr (BG.Ptr BG.Void)
+     -- ^ __C declaration:__ @data@
+  -> BG.Ptr DuckDBV2ErrorInfoHandle
+     -- ^ __C declaration:__ @err@
+  -> IO DuckDBV2Error
+c_duckdb_v2_copy_to_bind_get_user_data =
+  hs_bindgen_eb0ea355c070737c
+
+-- __unique:__ @Database_DuckDB_FFI_V2_Database.DuckDB.FFI.V2_Safe_duckdb_v2_copy_to_bind_set_bind_data@
+foreign import ccall safe "hs_bindgen_844d7a894ae769fb" hs_bindgen_844d7a894ae769fb_base ::
+     BG.Ptr BG.Void
+  -> BG.Ptr BG.Void
+  -> BG.Ptr BG.Void
+  -> IO BG.CUInt
+
+-- __unique:__ @Database_DuckDB_FFI_V2_Database.DuckDB.FFI.V2_Safe_duckdb_v2_copy_to_bind_set_bind_data@
+hs_bindgen_844d7a894ae769fb ::
+     DuckDBV2CopyToBindInfoHandle
+  -> BG.Ptr DuckDBV2Opaque
+  -> BG.Ptr DuckDBV2ErrorInfoHandle
+  -> IO DuckDBV2Error
+hs_bindgen_844d7a894ae769fb =
+  \x0 ->
+    \x1 ->
+      \x2 ->
+        fmap BG.fromFFIType (hs_bindgen_844d7a894ae769fb_base (BG.toFFIType x0) (BG.toFFIType x1) (BG.toFFIType x2))
+
+{-| __C declaration:__ @duckdb_v2_copy_to_bind_set_bind_data@
+
+    __defined at:__ @duckdb_v2.h 6595:30@
+
+    __exported by:__ @duckdb_v2.h@
+-}
+c_duckdb_v2_copy_to_bind_set_bind_data ::
+     DuckDBV2CopyToBindInfoHandle
+     -- ^ __C declaration:__ @info@
+  -> BG.Ptr DuckDBV2Opaque
+     -- ^ __C declaration:__ @data@
+  -> BG.Ptr DuckDBV2ErrorInfoHandle
+     -- ^ __C declaration:__ @err@
+  -> IO DuckDBV2Error
+c_duckdb_v2_copy_to_bind_set_bind_data =
+  hs_bindgen_844d7a894ae769fb
+
+-- __unique:__ @Database_DuckDB_FFI_V2_Database.DuckDB.FFI.V2_Safe_duckdb_v2_copy_to_bind_get_file_path@
+foreign import ccall safe "hs_bindgen_e18f5ba81ede3548" hs_bindgen_e18f5ba81ede3548_base ::
+     BG.Ptr BG.Void
+  -> BG.Ptr BG.Void
+  -> BG.Ptr BG.Void
+  -> IO BG.CUInt
+
+-- __unique:__ @Database_DuckDB_FFI_V2_Database.DuckDB.FFI.V2_Safe_duckdb_v2_copy_to_bind_get_file_path@
+hs_bindgen_e18f5ba81ede3548 ::
+     DuckDBV2CopyToBindInfoHandle
+  -> BG.Ptr DuckDBV2Str
+  -> BG.Ptr DuckDBV2ErrorInfoHandle
+  -> IO DuckDBV2Error
+hs_bindgen_e18f5ba81ede3548 =
+  \x0 ->
+    \x1 ->
+      \x2 ->
+        fmap BG.fromFFIType (hs_bindgen_e18f5ba81ede3548_base (BG.toFFIType x0) (BG.toFFIType x1) (BG.toFFIType x2))
+
+{-| __C declaration:__ @duckdb_v2_copy_to_bind_get_file_path@
+
+    __defined at:__ @duckdb_v2.h 6617:30@
+
+    __exported by:__ @duckdb_v2.h@
+-}
+c_duckdb_v2_copy_to_bind_get_file_path ::
+     DuckDBV2CopyToBindInfoHandle
+     -- ^ __C declaration:__ @info@
+  -> BG.Ptr DuckDBV2Str
+     -- ^ __C declaration:__ @path@
+  -> BG.Ptr DuckDBV2ErrorInfoHandle
+     -- ^ __C declaration:__ @err@
+  -> IO DuckDBV2Error
+c_duckdb_v2_copy_to_bind_get_file_path =
+  hs_bindgen_e18f5ba81ede3548
+
+-- __unique:__ @Database_DuckDB_FFI_V2_Database.DuckDB.FFI.V2_Safe_duckdb_v2_copy_to_bind_get_column_count@
+foreign import ccall safe "hs_bindgen_4a6f50ee26628014" hs_bindgen_4a6f50ee26628014_base ::
+     BG.Ptr BG.Void
+  -> BG.Ptr BG.Void
+  -> BG.Ptr BG.Void
+  -> IO BG.CUInt
+
+-- __unique:__ @Database_DuckDB_FFI_V2_Database.DuckDB.FFI.V2_Safe_duckdb_v2_copy_to_bind_get_column_count@
+hs_bindgen_4a6f50ee26628014 ::
+     DuckDBV2CopyToBindInfoHandle
+  -> BG.Ptr DuckDBIdx
+  -> BG.Ptr DuckDBV2ErrorInfoHandle
+  -> IO DuckDBV2Error
+hs_bindgen_4a6f50ee26628014 =
+  \x0 ->
+    \x1 ->
+      \x2 ->
+        fmap BG.fromFFIType (hs_bindgen_4a6f50ee26628014_base (BG.toFFIType x0) (BG.toFFIType x1) (BG.toFFIType x2))
+
+{-| __C declaration:__ @duckdb_v2_copy_to_bind_get_column_count@
+
+    __defined at:__ @duckdb_v2.h 6638:30@
+
+    __exported by:__ @duckdb_v2.h@
+-}
+c_duckdb_v2_copy_to_bind_get_column_count ::
+     DuckDBV2CopyToBindInfoHandle
+     -- ^ __C declaration:__ @info@
+  -> BG.Ptr DuckDBIdx
+     -- ^ __C declaration:__ @count@
+  -> BG.Ptr DuckDBV2ErrorInfoHandle
+     -- ^ __C declaration:__ @err@
+  -> IO DuckDBV2Error
+c_duckdb_v2_copy_to_bind_get_column_count =
+  hs_bindgen_4a6f50ee26628014
+
+-- __unique:__ @Database_DuckDB_FFI_V2_Database.DuckDB.FFI.V2_Safe_duckdb_v2_copy_to_bind_get_column_type@
+foreign import ccall safe "hs_bindgen_f25197ced57faa9a" hs_bindgen_f25197ced57faa9a_base ::
+     BG.Ptr BG.Void
+  -> HsBindgen.Runtime.LibC.Word64
+  -> BG.Ptr BG.Void
+  -> BG.Ptr BG.Void
+  -> IO BG.CUInt
+
+-- __unique:__ @Database_DuckDB_FFI_V2_Database.DuckDB.FFI.V2_Safe_duckdb_v2_copy_to_bind_get_column_type@
+hs_bindgen_f25197ced57faa9a ::
+     DuckDBV2CopyToBindInfoHandle
+  -> DuckDBIdx
+  -> BG.Ptr DuckDBV2LogicalTypeHandle
+  -> BG.Ptr DuckDBV2ErrorInfoHandle
+  -> IO DuckDBV2Error
+hs_bindgen_f25197ced57faa9a =
+  \x0 ->
+    \x1 ->
+      \x2 ->
+        \x3 ->
+          fmap BG.fromFFIType (hs_bindgen_f25197ced57faa9a_base (BG.toFFIType x0) (BG.toFFIType x1) (BG.toFFIType x2) (BG.toFFIType x3))
+
+{-| __C declaration:__ @duckdb_v2_copy_to_bind_get_column_type@
+
+    __defined at:__ @duckdb_v2.h 6659:30@
+
+    __exported by:__ @duckdb_v2.h@
+-}
+c_duckdb_v2_copy_to_bind_get_column_type ::
+     DuckDBV2CopyToBindInfoHandle
+     -- ^ __C declaration:__ @info@
+  -> DuckDBIdx
+     -- ^ __C declaration:__ @index@
+  -> BG.Ptr DuckDBV2LogicalTypeHandle
+     -- ^ __C declaration:__ @type@
+  -> BG.Ptr DuckDBV2ErrorInfoHandle
+     -- ^ __C declaration:__ @err@
+  -> IO DuckDBV2Error
+c_duckdb_v2_copy_to_bind_get_column_type =
+  hs_bindgen_f25197ced57faa9a
+
+-- __unique:__ @Database_DuckDB_FFI_V2_Database.DuckDB.FFI.V2_Safe_duckdb_v2_copy_to_bind_get_column_name@
+foreign import ccall safe "hs_bindgen_cfeec59f624c4d87" hs_bindgen_cfeec59f624c4d87_base ::
+     BG.Ptr BG.Void
+  -> HsBindgen.Runtime.LibC.Word64
+  -> BG.Ptr BG.Void
+  -> BG.Ptr BG.Void
+  -> IO BG.CUInt
+
+-- __unique:__ @Database_DuckDB_FFI_V2_Database.DuckDB.FFI.V2_Safe_duckdb_v2_copy_to_bind_get_column_name@
+hs_bindgen_cfeec59f624c4d87 ::
+     DuckDBV2CopyToBindInfoHandle
+  -> DuckDBIdx
+  -> BG.Ptr DuckDBV2IdentifierT
+  -> BG.Ptr DuckDBV2ErrorInfoHandle
+  -> IO DuckDBV2Error
+hs_bindgen_cfeec59f624c4d87 =
+  \x0 ->
+    \x1 ->
+      \x2 ->
+        \x3 ->
+          fmap BG.fromFFIType (hs_bindgen_cfeec59f624c4d87_base (BG.toFFIType x0) (BG.toFFIType x1) (BG.toFFIType x2) (BG.toFFIType x3))
+
+{-| __C declaration:__ @duckdb_v2_copy_to_bind_get_column_name@
+
+    __defined at:__ @duckdb_v2.h 6680:30@
+
+    __exported by:__ @duckdb_v2.h@
+-}
+c_duckdb_v2_copy_to_bind_get_column_name ::
+     DuckDBV2CopyToBindInfoHandle
+     -- ^ __C declaration:__ @info@
+  -> DuckDBIdx
+     -- ^ __C declaration:__ @index@
+  -> BG.Ptr DuckDBV2IdentifierT
+     -- ^ __C declaration:__ @name@
+  -> BG.Ptr DuckDBV2ErrorInfoHandle
+     -- ^ __C declaration:__ @err@
+  -> IO DuckDBV2Error
+c_duckdb_v2_copy_to_bind_get_column_name =
+  hs_bindgen_cfeec59f624c4d87
+
+-- __unique:__ @Database_DuckDB_FFI_V2_Database.DuckDB.FFI.V2_Safe_duckdb_v2_copy_to_bind_get_option_count@
+foreign import ccall safe "hs_bindgen_714b1ca5c3311fac" hs_bindgen_714b1ca5c3311fac_base ::
+     BG.Ptr BG.Void
+  -> BG.Ptr BG.Void
+  -> BG.Ptr BG.Void
+  -> IO BG.CUInt
+
+-- __unique:__ @Database_DuckDB_FFI_V2_Database.DuckDB.FFI.V2_Safe_duckdb_v2_copy_to_bind_get_option_count@
+hs_bindgen_714b1ca5c3311fac ::
+     DuckDBV2CopyToBindInfoHandle
+  -> BG.Ptr DuckDBIdx
+  -> BG.Ptr DuckDBV2ErrorInfoHandle
+  -> IO DuckDBV2Error
+hs_bindgen_714b1ca5c3311fac =
+  \x0 ->
+    \x1 ->
+      \x2 ->
+        fmap BG.fromFFIType (hs_bindgen_714b1ca5c3311fac_base (BG.toFFIType x0) (BG.toFFIType x1) (BG.toFFIType x2))
+
+{-| __C declaration:__ @duckdb_v2_copy_to_bind_get_option_count@
+
+    __defined at:__ @duckdb_v2.h 6702:30@
+
+    __exported by:__ @duckdb_v2.h@
+-}
+c_duckdb_v2_copy_to_bind_get_option_count ::
+     DuckDBV2CopyToBindInfoHandle
+     -- ^ __C declaration:__ @info@
+  -> BG.Ptr DuckDBIdx
+     -- ^ __C declaration:__ @count@
+  -> BG.Ptr DuckDBV2ErrorInfoHandle
+     -- ^ __C declaration:__ @err@
+  -> IO DuckDBV2Error
+c_duckdb_v2_copy_to_bind_get_option_count =
+  hs_bindgen_714b1ca5c3311fac
+
+-- __unique:__ @Database_DuckDB_FFI_V2_Database.DuckDB.FFI.V2_Safe_duckdb_v2_copy_to_bind_get_option_name@
+foreign import ccall safe "hs_bindgen_fc830fb6ed393ca6" hs_bindgen_fc830fb6ed393ca6_base ::
+     BG.Ptr BG.Void
+  -> HsBindgen.Runtime.LibC.Word64
+  -> BG.Ptr BG.Void
+  -> BG.Ptr BG.Void
+  -> IO BG.CUInt
+
+-- __unique:__ @Database_DuckDB_FFI_V2_Database.DuckDB.FFI.V2_Safe_duckdb_v2_copy_to_bind_get_option_name@
+hs_bindgen_fc830fb6ed393ca6 ::
+     DuckDBV2CopyToBindInfoHandle
+  -> DuckDBIdx
+  -> BG.Ptr DuckDBV2IdentifierT
+  -> BG.Ptr DuckDBV2ErrorInfoHandle
+  -> IO DuckDBV2Error
+hs_bindgen_fc830fb6ed393ca6 =
+  \x0 ->
+    \x1 ->
+      \x2 ->
+        \x3 ->
+          fmap BG.fromFFIType (hs_bindgen_fc830fb6ed393ca6_base (BG.toFFIType x0) (BG.toFFIType x1) (BG.toFFIType x2) (BG.toFFIType x3))
+
+{-| __C declaration:__ @duckdb_v2_copy_to_bind_get_option_name@
+
+    __defined at:__ @duckdb_v2.h 6723:30@
+
+    __exported by:__ @duckdb_v2.h@
+-}
+c_duckdb_v2_copy_to_bind_get_option_name ::
+     DuckDBV2CopyToBindInfoHandle
+     -- ^ __C declaration:__ @info@
+  -> DuckDBIdx
+     -- ^ __C declaration:__ @index@
+  -> BG.Ptr DuckDBV2IdentifierT
+     -- ^ __C declaration:__ @name@
+  -> BG.Ptr DuckDBV2ErrorInfoHandle
+     -- ^ __C declaration:__ @err@
+  -> IO DuckDBV2Error
+c_duckdb_v2_copy_to_bind_get_option_name =
+  hs_bindgen_fc830fb6ed393ca6
+
+-- __unique:__ @Database_DuckDB_FFI_V2_Database.DuckDB.FFI.V2_Safe_duckdb_v2_copy_to_bind_get_option_value@
+foreign import ccall safe "hs_bindgen_80058144eba82b8a" hs_bindgen_80058144eba82b8a_base ::
+     BG.Ptr BG.Void
+  -> HsBindgen.Runtime.LibC.Word64
+  -> BG.Ptr BG.Void
+  -> BG.Ptr BG.Void
+  -> IO BG.CUInt
+
+-- __unique:__ @Database_DuckDB_FFI_V2_Database.DuckDB.FFI.V2_Safe_duckdb_v2_copy_to_bind_get_option_value@
+hs_bindgen_80058144eba82b8a ::
+     DuckDBV2CopyToBindInfoHandle
+  -> DuckDBIdx
+  -> BG.Ptr DuckDBV2ValueHandle
+  -> BG.Ptr DuckDBV2ErrorInfoHandle
+  -> IO DuckDBV2Error
+hs_bindgen_80058144eba82b8a =
+  \x0 ->
+    \x1 ->
+      \x2 ->
+        \x3 ->
+          fmap BG.fromFFIType (hs_bindgen_80058144eba82b8a_base (BG.toFFIType x0) (BG.toFFIType x1) (BG.toFFIType x2) (BG.toFFIType x3))
+
+{-| __C declaration:__ @duckdb_v2_copy_to_bind_get_option_value@
+
+    __defined at:__ @duckdb_v2.h 6747:30@
+
+    __exported by:__ @duckdb_v2.h@
+-}
+c_duckdb_v2_copy_to_bind_get_option_value ::
+     DuckDBV2CopyToBindInfoHandle
+     -- ^ __C declaration:__ @info@
+  -> DuckDBIdx
+     -- ^ __C declaration:__ @index@
+  -> BG.Ptr DuckDBV2ValueHandle
+     -- ^ __C declaration:__ @value@
+  -> BG.Ptr DuckDBV2ErrorInfoHandle
+     -- ^ __C declaration:__ @err@
+  -> IO DuckDBV2Error
+c_duckdb_v2_copy_to_bind_get_option_value =
+  hs_bindgen_80058144eba82b8a
+
+-- __unique:__ @Database_DuckDB_FFI_V2_Database.DuckDB.FFI.V2_Safe_duckdb_v2_copy_to_batch_size_get_user_data@
+foreign import ccall safe "hs_bindgen_2f5eebf6f95a9505" hs_bindgen_2f5eebf6f95a9505_base ::
+     BG.Ptr BG.Void
+  -> BG.Ptr BG.Void
+  -> BG.Ptr BG.Void
+  -> IO BG.CUInt
+
+-- __unique:__ @Database_DuckDB_FFI_V2_Database.DuckDB.FFI.V2_Safe_duckdb_v2_copy_to_batch_size_get_user_data@
+hs_bindgen_2f5eebf6f95a9505 ::
+     DuckDBV2CopyToBatchSizeInfoHandle
+  -> BG.Ptr (BG.Ptr BG.Void)
+  -> BG.Ptr DuckDBV2ErrorInfoHandle
+  -> IO DuckDBV2Error
+hs_bindgen_2f5eebf6f95a9505 =
+  \x0 ->
+    \x1 ->
+      \x2 ->
+        fmap BG.fromFFIType (hs_bindgen_2f5eebf6f95a9505_base (BG.toFFIType x0) (BG.toFFIType x1) (BG.toFFIType x2))
+
+{-| __C declaration:__ @duckdb_v2_copy_to_batch_size_get_user_data@
+
+    __defined at:__ @duckdb_v2.h 6765:30@
+
+    __exported by:__ @duckdb_v2.h@
+-}
+c_duckdb_v2_copy_to_batch_size_get_user_data ::
+     DuckDBV2CopyToBatchSizeInfoHandle
+     -- ^ __C declaration:__ @info@
+  -> BG.Ptr (BG.Ptr BG.Void)
+     -- ^ __C declaration:__ @data@
+  -> BG.Ptr DuckDBV2ErrorInfoHandle
+     -- ^ __C declaration:__ @err@
+  -> IO DuckDBV2Error
+c_duckdb_v2_copy_to_batch_size_get_user_data =
+  hs_bindgen_2f5eebf6f95a9505
+
+-- __unique:__ @Database_DuckDB_FFI_V2_Database.DuckDB.FFI.V2_Safe_duckdb_v2_copy_to_batch_size_get_bind_data@
+foreign import ccall safe "hs_bindgen_5d8c7f87d651ec5a" hs_bindgen_5d8c7f87d651ec5a_base ::
+     BG.Ptr BG.Void
+  -> BG.Ptr BG.Void
+  -> BG.Ptr BG.Void
+  -> IO BG.CUInt
+
+-- __unique:__ @Database_DuckDB_FFI_V2_Database.DuckDB.FFI.V2_Safe_duckdb_v2_copy_to_batch_size_get_bind_data@
+hs_bindgen_5d8c7f87d651ec5a ::
+     DuckDBV2CopyToBatchSizeInfoHandle
+  -> BG.Ptr (BG.Ptr BG.Void)
+  -> BG.Ptr DuckDBV2ErrorInfoHandle
+  -> IO DuckDBV2Error
+hs_bindgen_5d8c7f87d651ec5a =
+  \x0 ->
+    \x1 ->
+      \x2 ->
+        fmap BG.fromFFIType (hs_bindgen_5d8c7f87d651ec5a_base (BG.toFFIType x0) (BG.toFFIType x1) (BG.toFFIType x2))
+
+{-| __C declaration:__ @duckdb_v2_copy_to_batch_size_get_bind_data@
+
+    __defined at:__ @duckdb_v2.h 6782:30@
+
+    __exported by:__ @duckdb_v2.h@
+-}
+c_duckdb_v2_copy_to_batch_size_get_bind_data ::
+     DuckDBV2CopyToBatchSizeInfoHandle
+     -- ^ __C declaration:__ @info@
+  -> BG.Ptr (BG.Ptr BG.Void)
+     -- ^ __C declaration:__ @data@
+  -> BG.Ptr DuckDBV2ErrorInfoHandle
+     -- ^ __C declaration:__ @err@
+  -> IO DuckDBV2Error
+c_duckdb_v2_copy_to_batch_size_get_bind_data =
+  hs_bindgen_5d8c7f87d651ec5a
+
+-- __unique:__ @Database_DuckDB_FFI_V2_Database.DuckDB.FFI.V2_Safe_duckdb_v2_copy_to_batch_size_set_target@
+foreign import ccall safe "hs_bindgen_66061bf318aef235" hs_bindgen_66061bf318aef235_base ::
+     BG.Ptr BG.Void
+  -> HsBindgen.Runtime.LibC.Word64
+  -> BG.Ptr BG.Void
+  -> IO BG.CUInt
+
+-- __unique:__ @Database_DuckDB_FFI_V2_Database.DuckDB.FFI.V2_Safe_duckdb_v2_copy_to_batch_size_set_target@
+hs_bindgen_66061bf318aef235 ::
+     DuckDBV2CopyToBatchSizeInfoHandle
+  -> DuckDBIdx
+  -> BG.Ptr DuckDBV2ErrorInfoHandle
+  -> IO DuckDBV2Error
+hs_bindgen_66061bf318aef235 =
+  \x0 ->
+    \x1 ->
+      \x2 ->
+        fmap BG.fromFFIType (hs_bindgen_66061bf318aef235_base (BG.toFFIType x0) (BG.toFFIType x1) (BG.toFFIType x2))
+
+{-| __C declaration:__ @duckdb_v2_copy_to_batch_size_set_target@
+
+    __defined at:__ @duckdb_v2.h 6801:30@
+
+    __exported by:__ @duckdb_v2.h@
+-}
+c_duckdb_v2_copy_to_batch_size_set_target ::
+     DuckDBV2CopyToBatchSizeInfoHandle
+     -- ^ __C declaration:__ @info@
+  -> DuckDBIdx
+     -- ^ __C declaration:__ @rows@
+  -> BG.Ptr DuckDBV2ErrorInfoHandle
+     -- ^ __C declaration:__ @err@
+  -> IO DuckDBV2Error
+c_duckdb_v2_copy_to_batch_size_set_target =
+  hs_bindgen_66061bf318aef235
+
+-- __unique:__ @Database_DuckDB_FFI_V2_Database.DuckDB.FFI.V2_Safe_duckdb_v2_copy_to_init_get_user_data@
+foreign import ccall safe "hs_bindgen_017a284bf00d390f" hs_bindgen_017a284bf00d390f_base ::
+     BG.Ptr BG.Void
+  -> BG.Ptr BG.Void
+  -> BG.Ptr BG.Void
+  -> IO BG.CUInt
+
+-- __unique:__ @Database_DuckDB_FFI_V2_Database.DuckDB.FFI.V2_Safe_duckdb_v2_copy_to_init_get_user_data@
+hs_bindgen_017a284bf00d390f ::
+     DuckDBV2CopyToInitInfoHandle
+  -> BG.Ptr (BG.Ptr BG.Void)
+  -> BG.Ptr DuckDBV2ErrorInfoHandle
+  -> IO DuckDBV2Error
+hs_bindgen_017a284bf00d390f =
+  \x0 ->
+    \x1 ->
+      \x2 ->
+        fmap BG.fromFFIType (hs_bindgen_017a284bf00d390f_base (BG.toFFIType x0) (BG.toFFIType x1) (BG.toFFIType x2))
+
+{-| __C declaration:__ @duckdb_v2_copy_to_init_get_user_data@
+
+    __defined at:__ @duckdb_v2.h 6818:30@
+
+    __exported by:__ @duckdb_v2.h@
+-}
+c_duckdb_v2_copy_to_init_get_user_data ::
+     DuckDBV2CopyToInitInfoHandle
+     -- ^ __C declaration:__ @info@
+  -> BG.Ptr (BG.Ptr BG.Void)
+     -- ^ __C declaration:__ @data@
+  -> BG.Ptr DuckDBV2ErrorInfoHandle
+     -- ^ __C declaration:__ @err@
+  -> IO DuckDBV2Error
+c_duckdb_v2_copy_to_init_get_user_data =
+  hs_bindgen_017a284bf00d390f
+
+-- __unique:__ @Database_DuckDB_FFI_V2_Database.DuckDB.FFI.V2_Safe_duckdb_v2_copy_to_init_get_bind_data@
+foreign import ccall safe "hs_bindgen_33d2e5ca775e0165" hs_bindgen_33d2e5ca775e0165_base ::
+     BG.Ptr BG.Void
+  -> BG.Ptr BG.Void
+  -> BG.Ptr BG.Void
+  -> IO BG.CUInt
+
+-- __unique:__ @Database_DuckDB_FFI_V2_Database.DuckDB.FFI.V2_Safe_duckdb_v2_copy_to_init_get_bind_data@
+hs_bindgen_33d2e5ca775e0165 ::
+     DuckDBV2CopyToInitInfoHandle
+  -> BG.Ptr (BG.Ptr BG.Void)
+  -> BG.Ptr DuckDBV2ErrorInfoHandle
+  -> IO DuckDBV2Error
+hs_bindgen_33d2e5ca775e0165 =
+  \x0 ->
+    \x1 ->
+      \x2 ->
+        fmap BG.fromFFIType (hs_bindgen_33d2e5ca775e0165_base (BG.toFFIType x0) (BG.toFFIType x1) (BG.toFFIType x2))
+
+{-| __C declaration:__ @duckdb_v2_copy_to_init_get_bind_data@
+
+    __defined at:__ @duckdb_v2.h 6835:30@
+
+    __exported by:__ @duckdb_v2.h@
+-}
+c_duckdb_v2_copy_to_init_get_bind_data ::
+     DuckDBV2CopyToInitInfoHandle
+     -- ^ __C declaration:__ @info@
+  -> BG.Ptr (BG.Ptr BG.Void)
+     -- ^ __C declaration:__ @data@
+  -> BG.Ptr DuckDBV2ErrorInfoHandle
+     -- ^ __C declaration:__ @err@
+  -> IO DuckDBV2Error
+c_duckdb_v2_copy_to_init_get_bind_data =
+  hs_bindgen_33d2e5ca775e0165
+
+-- __unique:__ @Database_DuckDB_FFI_V2_Database.DuckDB.FFI.V2_Safe_duckdb_v2_copy_to_init_get_file_path@
+foreign import ccall safe "hs_bindgen_2a1da2e88945b462" hs_bindgen_2a1da2e88945b462_base ::
+     BG.Ptr BG.Void
+  -> BG.Ptr BG.Void
+  -> BG.Ptr BG.Void
+  -> IO BG.CUInt
+
+-- __unique:__ @Database_DuckDB_FFI_V2_Database.DuckDB.FFI.V2_Safe_duckdb_v2_copy_to_init_get_file_path@
+hs_bindgen_2a1da2e88945b462 ::
+     DuckDBV2CopyToInitInfoHandle
+  -> BG.Ptr DuckDBV2Str
+  -> BG.Ptr DuckDBV2ErrorInfoHandle
+  -> IO DuckDBV2Error
+hs_bindgen_2a1da2e88945b462 =
+  \x0 ->
+    \x1 ->
+      \x2 ->
+        fmap BG.fromFFIType (hs_bindgen_2a1da2e88945b462_base (BG.toFFIType x0) (BG.toFFIType x1) (BG.toFFIType x2))
+
+{-| __C declaration:__ @duckdb_v2_copy_to_init_get_file_path@
+
+    __defined at:__ @duckdb_v2.h 6856:30@
+
+    __exported by:__ @duckdb_v2.h@
+-}
+c_duckdb_v2_copy_to_init_get_file_path ::
+     DuckDBV2CopyToInitInfoHandle
+     -- ^ __C declaration:__ @info@
+  -> BG.Ptr DuckDBV2Str
+     -- ^ __C declaration:__ @path@
+  -> BG.Ptr DuckDBV2ErrorInfoHandle
+     -- ^ __C declaration:__ @err@
+  -> IO DuckDBV2Error
+c_duckdb_v2_copy_to_init_get_file_path =
+  hs_bindgen_2a1da2e88945b462
+
+-- __unique:__ @Database_DuckDB_FFI_V2_Database.DuckDB.FFI.V2_Safe_duckdb_v2_copy_to_init_set_init_data@
+foreign import ccall safe "hs_bindgen_2aea517dbce1d596" hs_bindgen_2aea517dbce1d596_base ::
+     BG.Ptr BG.Void
+  -> BG.Ptr BG.Void
+  -> BG.Ptr BG.Void
+  -> IO BG.CUInt
+
+-- __unique:__ @Database_DuckDB_FFI_V2_Database.DuckDB.FFI.V2_Safe_duckdb_v2_copy_to_init_set_init_data@
+hs_bindgen_2aea517dbce1d596 ::
+     DuckDBV2CopyToInitInfoHandle
+  -> BG.Ptr DuckDBV2Opaque
+  -> BG.Ptr DuckDBV2ErrorInfoHandle
+  -> IO DuckDBV2Error
+hs_bindgen_2aea517dbce1d596 =
+  \x0 ->
+    \x1 ->
+      \x2 ->
+        fmap BG.fromFFIType (hs_bindgen_2aea517dbce1d596_base (BG.toFFIType x0) (BG.toFFIType x1) (BG.toFFIType x2))
+
+{-| __C declaration:__ @duckdb_v2_copy_to_init_set_init_data@
+
+    __defined at:__ @duckdb_v2.h 6879:30@
+
+    __exported by:__ @duckdb_v2.h@
+-}
+c_duckdb_v2_copy_to_init_set_init_data ::
+     DuckDBV2CopyToInitInfoHandle
+     -- ^ __C declaration:__ @info@
+  -> BG.Ptr DuckDBV2Opaque
+     -- ^ __C declaration:__ @data@
+  -> BG.Ptr DuckDBV2ErrorInfoHandle
+     -- ^ __C declaration:__ @err@
+  -> IO DuckDBV2Error
+c_duckdb_v2_copy_to_init_set_init_data =
+  hs_bindgen_2aea517dbce1d596
+
+-- __unique:__ @Database_DuckDB_FFI_V2_Database.DuckDB.FFI.V2_Safe_duckdb_v2_copy_to_batch_get_user_data@
+foreign import ccall safe "hs_bindgen_7aec697d75a762bd" hs_bindgen_7aec697d75a762bd_base ::
+     BG.Ptr BG.Void
+  -> BG.Ptr BG.Void
+  -> BG.Ptr BG.Void
+  -> IO BG.CUInt
+
+-- __unique:__ @Database_DuckDB_FFI_V2_Database.DuckDB.FFI.V2_Safe_duckdb_v2_copy_to_batch_get_user_data@
+hs_bindgen_7aec697d75a762bd ::
+     DuckDBV2CopyToBatchInfoHandle
+  -> BG.Ptr (BG.Ptr BG.Void)
+  -> BG.Ptr DuckDBV2ErrorInfoHandle
+  -> IO DuckDBV2Error
+hs_bindgen_7aec697d75a762bd =
+  \x0 ->
+    \x1 ->
+      \x2 ->
+        fmap BG.fromFFIType (hs_bindgen_7aec697d75a762bd_base (BG.toFFIType x0) (BG.toFFIType x1) (BG.toFFIType x2))
+
+{-| __C declaration:__ @duckdb_v2_copy_to_batch_get_user_data@
+
+    __defined at:__ @duckdb_v2.h 6897:30@
+
+    __exported by:__ @duckdb_v2.h@
+-}
+c_duckdb_v2_copy_to_batch_get_user_data ::
+     DuckDBV2CopyToBatchInfoHandle
+     -- ^ __C declaration:__ @info@
+  -> BG.Ptr (BG.Ptr BG.Void)
+     -- ^ __C declaration:__ @data@
+  -> BG.Ptr DuckDBV2ErrorInfoHandle
+     -- ^ __C declaration:__ @err@
+  -> IO DuckDBV2Error
+c_duckdb_v2_copy_to_batch_get_user_data =
+  hs_bindgen_7aec697d75a762bd
+
+-- __unique:__ @Database_DuckDB_FFI_V2_Database.DuckDB.FFI.V2_Safe_duckdb_v2_copy_to_batch_get_bind_data@
+foreign import ccall safe "hs_bindgen_b3998087abd3a493" hs_bindgen_b3998087abd3a493_base ::
+     BG.Ptr BG.Void
+  -> BG.Ptr BG.Void
+  -> BG.Ptr BG.Void
+  -> IO BG.CUInt
+
+-- __unique:__ @Database_DuckDB_FFI_V2_Database.DuckDB.FFI.V2_Safe_duckdb_v2_copy_to_batch_get_bind_data@
+hs_bindgen_b3998087abd3a493 ::
+     DuckDBV2CopyToBatchInfoHandle
+  -> BG.Ptr (BG.Ptr BG.Void)
+  -> BG.Ptr DuckDBV2ErrorInfoHandle
+  -> IO DuckDBV2Error
+hs_bindgen_b3998087abd3a493 =
+  \x0 ->
+    \x1 ->
+      \x2 ->
+        fmap BG.fromFFIType (hs_bindgen_b3998087abd3a493_base (BG.toFFIType x0) (BG.toFFIType x1) (BG.toFFIType x2))
+
+{-| __C declaration:__ @duckdb_v2_copy_to_batch_get_bind_data@
+
+    __defined at:__ @duckdb_v2.h 6914:30@
+
+    __exported by:__ @duckdb_v2.h@
+-}
+c_duckdb_v2_copy_to_batch_get_bind_data ::
+     DuckDBV2CopyToBatchInfoHandle
+     -- ^ __C declaration:__ @info@
+  -> BG.Ptr (BG.Ptr BG.Void)
+     -- ^ __C declaration:__ @data@
+  -> BG.Ptr DuckDBV2ErrorInfoHandle
+     -- ^ __C declaration:__ @err@
+  -> IO DuckDBV2Error
+c_duckdb_v2_copy_to_batch_get_bind_data =
+  hs_bindgen_b3998087abd3a493
+
+-- __unique:__ @Database_DuckDB_FFI_V2_Database.DuckDB.FFI.V2_Safe_duckdb_v2_copy_to_batch_get_init_data@
+foreign import ccall safe "hs_bindgen_cc14f2e9a70dfd4b" hs_bindgen_cc14f2e9a70dfd4b_base ::
+     BG.Ptr BG.Void
+  -> BG.Ptr BG.Void
+  -> BG.Ptr BG.Void
+  -> IO BG.CUInt
+
+-- __unique:__ @Database_DuckDB_FFI_V2_Database.DuckDB.FFI.V2_Safe_duckdb_v2_copy_to_batch_get_init_data@
+hs_bindgen_cc14f2e9a70dfd4b ::
+     DuckDBV2CopyToBatchInfoHandle
+  -> BG.Ptr (BG.Ptr BG.Void)
+  -> BG.Ptr DuckDBV2ErrorInfoHandle
+  -> IO DuckDBV2Error
+hs_bindgen_cc14f2e9a70dfd4b =
+  \x0 ->
+    \x1 ->
+      \x2 ->
+        fmap BG.fromFFIType (hs_bindgen_cc14f2e9a70dfd4b_base (BG.toFFIType x0) (BG.toFFIType x1) (BG.toFFIType x2))
+
+{-| __C declaration:__ @duckdb_v2_copy_to_batch_get_init_data@
+
+    __defined at:__ @duckdb_v2.h 6931:30@
+
+    __exported by:__ @duckdb_v2.h@
+-}
+c_duckdb_v2_copy_to_batch_get_init_data ::
+     DuckDBV2CopyToBatchInfoHandle
+     -- ^ __C declaration:__ @info@
+  -> BG.Ptr (BG.Ptr BG.Void)
+     -- ^ __C declaration:__ @data@
+  -> BG.Ptr DuckDBV2ErrorInfoHandle
+     -- ^ __C declaration:__ @err@
+  -> IO DuckDBV2Error
+c_duckdb_v2_copy_to_batch_get_init_data =
+  hs_bindgen_cc14f2e9a70dfd4b
+
+-- __unique:__ @Database_DuckDB_FFI_V2_Database.DuckDB.FFI.V2_Safe_duckdb_v2_copy_to_batch_take_input@
+foreign import ccall safe "hs_bindgen_edbfcefd6244b718" hs_bindgen_edbfcefd6244b718_base ::
+     BG.Ptr BG.Void
+  -> BG.Ptr BG.Void
+  -> BG.Ptr BG.Void
+  -> IO BG.CUInt
+
+-- __unique:__ @Database_DuckDB_FFI_V2_Database.DuckDB.FFI.V2_Safe_duckdb_v2_copy_to_batch_take_input@
+hs_bindgen_edbfcefd6244b718 ::
+     DuckDBV2CopyToBatchInfoHandle
+  -> BG.Ptr DuckDBV2ColumnDataCollectionHandle
+  -> BG.Ptr DuckDBV2ErrorInfoHandle
+  -> IO DuckDBV2Error
+hs_bindgen_edbfcefd6244b718 =
+  \x0 ->
+    \x1 ->
+      \x2 ->
+        fmap BG.fromFFIType (hs_bindgen_edbfcefd6244b718_base (BG.toFFIType x0) (BG.toFFIType x1) (BG.toFFIType x2))
+
+{-| __C declaration:__ @duckdb_v2_copy_to_batch_take_input@
+
+    __defined at:__ @duckdb_v2.h 6955:30@
+
+    __exported by:__ @duckdb_v2.h@
+-}
+c_duckdb_v2_copy_to_batch_take_input ::
+     DuckDBV2CopyToBatchInfoHandle
+     -- ^ __C declaration:__ @info@
+  -> BG.Ptr DuckDBV2ColumnDataCollectionHandle
+     -- ^ __C declaration:__ @collection@
+  -> BG.Ptr DuckDBV2ErrorInfoHandle
+     -- ^ __C declaration:__ @err@
+  -> IO DuckDBV2Error
+c_duckdb_v2_copy_to_batch_take_input =
+  hs_bindgen_edbfcefd6244b718
+
+-- __unique:__ @Database_DuckDB_FFI_V2_Database.DuckDB.FFI.V2_Safe_duckdb_v2_copy_to_batch_set_batch_data@
+foreign import ccall safe "hs_bindgen_11da5d2fd6040855" hs_bindgen_11da5d2fd6040855_base ::
+     BG.Ptr BG.Void
+  -> BG.Ptr BG.Void
+  -> BG.Ptr BG.Void
+  -> IO BG.CUInt
+
+-- __unique:__ @Database_DuckDB_FFI_V2_Database.DuckDB.FFI.V2_Safe_duckdb_v2_copy_to_batch_set_batch_data@
+hs_bindgen_11da5d2fd6040855 ::
+     DuckDBV2CopyToBatchInfoHandle
+  -> BG.Ptr DuckDBV2Opaque
+  -> BG.Ptr DuckDBV2ErrorInfoHandle
+  -> IO DuckDBV2Error
+hs_bindgen_11da5d2fd6040855 =
+  \x0 ->
+    \x1 ->
+      \x2 ->
+        fmap BG.fromFFIType (hs_bindgen_11da5d2fd6040855_base (BG.toFFIType x0) (BG.toFFIType x1) (BG.toFFIType x2))
+
+{-| __C declaration:__ @duckdb_v2_copy_to_batch_set_batch_data@
+
+    __defined at:__ @duckdb_v2.h 6977:30@
+
+    __exported by:__ @duckdb_v2.h@
+-}
+c_duckdb_v2_copy_to_batch_set_batch_data ::
+     DuckDBV2CopyToBatchInfoHandle
+     -- ^ __C declaration:__ @info@
+  -> BG.Ptr DuckDBV2Opaque
+     -- ^ __C declaration:__ @data@
+  -> BG.Ptr DuckDBV2ErrorInfoHandle
+     -- ^ __C declaration:__ @err@
+  -> IO DuckDBV2Error
+c_duckdb_v2_copy_to_batch_set_batch_data =
+  hs_bindgen_11da5d2fd6040855
+
+-- __unique:__ @Database_DuckDB_FFI_V2_Database.DuckDB.FFI.V2_Safe_duckdb_v2_copy_to_flush_get_user_data@
+foreign import ccall safe "hs_bindgen_ab56a26ee665070d" hs_bindgen_ab56a26ee665070d_base ::
+     BG.Ptr BG.Void
+  -> BG.Ptr BG.Void
+  -> BG.Ptr BG.Void
+  -> IO BG.CUInt
+
+-- __unique:__ @Database_DuckDB_FFI_V2_Database.DuckDB.FFI.V2_Safe_duckdb_v2_copy_to_flush_get_user_data@
+hs_bindgen_ab56a26ee665070d ::
+     DuckDBV2CopyToFlushInfoHandle
+  -> BG.Ptr (BG.Ptr BG.Void)
+  -> BG.Ptr DuckDBV2ErrorInfoHandle
+  -> IO DuckDBV2Error
+hs_bindgen_ab56a26ee665070d =
+  \x0 ->
+    \x1 ->
+      \x2 ->
+        fmap BG.fromFFIType (hs_bindgen_ab56a26ee665070d_base (BG.toFFIType x0) (BG.toFFIType x1) (BG.toFFIType x2))
+
+{-| __C declaration:__ @duckdb_v2_copy_to_flush_get_user_data@
+
+    __defined at:__ @duckdb_v2.h 6995:30@
+
+    __exported by:__ @duckdb_v2.h@
+-}
+c_duckdb_v2_copy_to_flush_get_user_data ::
+     DuckDBV2CopyToFlushInfoHandle
+     -- ^ __C declaration:__ @info@
+  -> BG.Ptr (BG.Ptr BG.Void)
+     -- ^ __C declaration:__ @data@
+  -> BG.Ptr DuckDBV2ErrorInfoHandle
+     -- ^ __C declaration:__ @err@
+  -> IO DuckDBV2Error
+c_duckdb_v2_copy_to_flush_get_user_data =
+  hs_bindgen_ab56a26ee665070d
+
+-- __unique:__ @Database_DuckDB_FFI_V2_Database.DuckDB.FFI.V2_Safe_duckdb_v2_copy_to_flush_get_bind_data@
+foreign import ccall safe "hs_bindgen_5a6ebe126ac99497" hs_bindgen_5a6ebe126ac99497_base ::
+     BG.Ptr BG.Void
+  -> BG.Ptr BG.Void
+  -> BG.Ptr BG.Void
+  -> IO BG.CUInt
+
+-- __unique:__ @Database_DuckDB_FFI_V2_Database.DuckDB.FFI.V2_Safe_duckdb_v2_copy_to_flush_get_bind_data@
+hs_bindgen_5a6ebe126ac99497 ::
+     DuckDBV2CopyToFlushInfoHandle
+  -> BG.Ptr (BG.Ptr BG.Void)
+  -> BG.Ptr DuckDBV2ErrorInfoHandle
+  -> IO DuckDBV2Error
+hs_bindgen_5a6ebe126ac99497 =
+  \x0 ->
+    \x1 ->
+      \x2 ->
+        fmap BG.fromFFIType (hs_bindgen_5a6ebe126ac99497_base (BG.toFFIType x0) (BG.toFFIType x1) (BG.toFFIType x2))
+
+{-| __C declaration:__ @duckdb_v2_copy_to_flush_get_bind_data@
+
+    __defined at:__ @duckdb_v2.h 7012:30@
+
+    __exported by:__ @duckdb_v2.h@
+-}
+c_duckdb_v2_copy_to_flush_get_bind_data ::
+     DuckDBV2CopyToFlushInfoHandle
+     -- ^ __C declaration:__ @info@
+  -> BG.Ptr (BG.Ptr BG.Void)
+     -- ^ __C declaration:__ @data@
+  -> BG.Ptr DuckDBV2ErrorInfoHandle
+     -- ^ __C declaration:__ @err@
+  -> IO DuckDBV2Error
+c_duckdb_v2_copy_to_flush_get_bind_data =
+  hs_bindgen_5a6ebe126ac99497
+
+-- __unique:__ @Database_DuckDB_FFI_V2_Database.DuckDB.FFI.V2_Safe_duckdb_v2_copy_to_flush_get_init_data@
+foreign import ccall safe "hs_bindgen_1a0fbeb347a0d040" hs_bindgen_1a0fbeb347a0d040_base ::
+     BG.Ptr BG.Void
+  -> BG.Ptr BG.Void
+  -> BG.Ptr BG.Void
+  -> IO BG.CUInt
+
+-- __unique:__ @Database_DuckDB_FFI_V2_Database.DuckDB.FFI.V2_Safe_duckdb_v2_copy_to_flush_get_init_data@
+hs_bindgen_1a0fbeb347a0d040 ::
+     DuckDBV2CopyToFlushInfoHandle
+  -> BG.Ptr (BG.Ptr BG.Void)
+  -> BG.Ptr DuckDBV2ErrorInfoHandle
+  -> IO DuckDBV2Error
+hs_bindgen_1a0fbeb347a0d040 =
+  \x0 ->
+    \x1 ->
+      \x2 ->
+        fmap BG.fromFFIType (hs_bindgen_1a0fbeb347a0d040_base (BG.toFFIType x0) (BG.toFFIType x1) (BG.toFFIType x2))
+
+{-| __C declaration:__ @duckdb_v2_copy_to_flush_get_init_data@
+
+    __defined at:__ @duckdb_v2.h 7029:30@
+
+    __exported by:__ @duckdb_v2.h@
+-}
+c_duckdb_v2_copy_to_flush_get_init_data ::
+     DuckDBV2CopyToFlushInfoHandle
+     -- ^ __C declaration:__ @info@
+  -> BG.Ptr (BG.Ptr BG.Void)
+     -- ^ __C declaration:__ @data@
+  -> BG.Ptr DuckDBV2ErrorInfoHandle
+     -- ^ __C declaration:__ @err@
+  -> IO DuckDBV2Error
+c_duckdb_v2_copy_to_flush_get_init_data =
+  hs_bindgen_1a0fbeb347a0d040
+
+-- __unique:__ @Database_DuckDB_FFI_V2_Database.DuckDB.FFI.V2_Safe_duckdb_v2_copy_to_flush_get_batch_data@
+foreign import ccall safe "hs_bindgen_8cd2b2480c2e9d70" hs_bindgen_8cd2b2480c2e9d70_base ::
+     BG.Ptr BG.Void
+  -> BG.Ptr BG.Void
+  -> BG.Ptr BG.Void
+  -> IO BG.CUInt
+
+-- __unique:__ @Database_DuckDB_FFI_V2_Database.DuckDB.FFI.V2_Safe_duckdb_v2_copy_to_flush_get_batch_data@
+hs_bindgen_8cd2b2480c2e9d70 ::
+     DuckDBV2CopyToFlushInfoHandle
+  -> BG.Ptr (BG.Ptr BG.Void)
+  -> BG.Ptr DuckDBV2ErrorInfoHandle
+  -> IO DuckDBV2Error
+hs_bindgen_8cd2b2480c2e9d70 =
+  \x0 ->
+    \x1 ->
+      \x2 ->
+        fmap BG.fromFFIType (hs_bindgen_8cd2b2480c2e9d70_base (BG.toFFIType x0) (BG.toFFIType x1) (BG.toFFIType x2))
+
+{-| __C declaration:__ @duckdb_v2_copy_to_flush_get_batch_data@
+
+    __defined at:__ @duckdb_v2.h 7046:30@
+
+    __exported by:__ @duckdb_v2.h@
+-}
+c_duckdb_v2_copy_to_flush_get_batch_data ::
+     DuckDBV2CopyToFlushInfoHandle
+     -- ^ __C declaration:__ @info@
+  -> BG.Ptr (BG.Ptr BG.Void)
+     -- ^ __C declaration:__ @data@
+  -> BG.Ptr DuckDBV2ErrorInfoHandle
+     -- ^ __C declaration:__ @err@
+  -> IO DuckDBV2Error
+c_duckdb_v2_copy_to_flush_get_batch_data =
+  hs_bindgen_8cd2b2480c2e9d70
+
+-- __unique:__ @Database_DuckDB_FFI_V2_Database.DuckDB.FFI.V2_Safe_duckdb_v2_copy_to_finalize_get_user_data@
+foreign import ccall safe "hs_bindgen_81cb7ace0ca893de" hs_bindgen_81cb7ace0ca893de_base ::
+     BG.Ptr BG.Void
+  -> BG.Ptr BG.Void
+  -> BG.Ptr BG.Void
+  -> IO BG.CUInt
+
+-- __unique:__ @Database_DuckDB_FFI_V2_Database.DuckDB.FFI.V2_Safe_duckdb_v2_copy_to_finalize_get_user_data@
+hs_bindgen_81cb7ace0ca893de ::
+     DuckDBV2CopyToFinalizeInfoHandle
+  -> BG.Ptr (BG.Ptr BG.Void)
+  -> BG.Ptr DuckDBV2ErrorInfoHandle
+  -> IO DuckDBV2Error
+hs_bindgen_81cb7ace0ca893de =
+  \x0 ->
+    \x1 ->
+      \x2 ->
+        fmap BG.fromFFIType (hs_bindgen_81cb7ace0ca893de_base (BG.toFFIType x0) (BG.toFFIType x1) (BG.toFFIType x2))
+
+{-| __C declaration:__ @duckdb_v2_copy_to_finalize_get_user_data@
+
+    __defined at:__ @duckdb_v2.h 7063:30@
+
+    __exported by:__ @duckdb_v2.h@
+-}
+c_duckdb_v2_copy_to_finalize_get_user_data ::
+     DuckDBV2CopyToFinalizeInfoHandle
+     -- ^ __C declaration:__ @info@
+  -> BG.Ptr (BG.Ptr BG.Void)
+     -- ^ __C declaration:__ @data@
+  -> BG.Ptr DuckDBV2ErrorInfoHandle
+     -- ^ __C declaration:__ @err@
+  -> IO DuckDBV2Error
+c_duckdb_v2_copy_to_finalize_get_user_data =
+  hs_bindgen_81cb7ace0ca893de
+
+-- __unique:__ @Database_DuckDB_FFI_V2_Database.DuckDB.FFI.V2_Safe_duckdb_v2_copy_to_finalize_get_bind_data@
+foreign import ccall safe "hs_bindgen_eab24c449e5e48d9" hs_bindgen_eab24c449e5e48d9_base ::
+     BG.Ptr BG.Void
+  -> BG.Ptr BG.Void
+  -> BG.Ptr BG.Void
+  -> IO BG.CUInt
+
+-- __unique:__ @Database_DuckDB_FFI_V2_Database.DuckDB.FFI.V2_Safe_duckdb_v2_copy_to_finalize_get_bind_data@
+hs_bindgen_eab24c449e5e48d9 ::
+     DuckDBV2CopyToFinalizeInfoHandle
+  -> BG.Ptr (BG.Ptr BG.Void)
+  -> BG.Ptr DuckDBV2ErrorInfoHandle
+  -> IO DuckDBV2Error
+hs_bindgen_eab24c449e5e48d9 =
+  \x0 ->
+    \x1 ->
+      \x2 ->
+        fmap BG.fromFFIType (hs_bindgen_eab24c449e5e48d9_base (BG.toFFIType x0) (BG.toFFIType x1) (BG.toFFIType x2))
+
+{-| __C declaration:__ @duckdb_v2_copy_to_finalize_get_bind_data@
+
+    __defined at:__ @duckdb_v2.h 7080:30@
+
+    __exported by:__ @duckdb_v2.h@
+-}
+c_duckdb_v2_copy_to_finalize_get_bind_data ::
+     DuckDBV2CopyToFinalizeInfoHandle
+     -- ^ __C declaration:__ @info@
+  -> BG.Ptr (BG.Ptr BG.Void)
+     -- ^ __C declaration:__ @data@
+  -> BG.Ptr DuckDBV2ErrorInfoHandle
+     -- ^ __C declaration:__ @err@
+  -> IO DuckDBV2Error
+c_duckdb_v2_copy_to_finalize_get_bind_data =
+  hs_bindgen_eab24c449e5e48d9
+
+-- __unique:__ @Database_DuckDB_FFI_V2_Database.DuckDB.FFI.V2_Safe_duckdb_v2_copy_to_finalize_get_init_data@
+foreign import ccall safe "hs_bindgen_1728693bccaabc9f" hs_bindgen_1728693bccaabc9f_base ::
+     BG.Ptr BG.Void
+  -> BG.Ptr BG.Void
+  -> BG.Ptr BG.Void
+  -> IO BG.CUInt
+
+-- __unique:__ @Database_DuckDB_FFI_V2_Database.DuckDB.FFI.V2_Safe_duckdb_v2_copy_to_finalize_get_init_data@
+hs_bindgen_1728693bccaabc9f ::
+     DuckDBV2CopyToFinalizeInfoHandle
+  -> BG.Ptr (BG.Ptr BG.Void)
+  -> BG.Ptr DuckDBV2ErrorInfoHandle
+  -> IO DuckDBV2Error
+hs_bindgen_1728693bccaabc9f =
+  \x0 ->
+    \x1 ->
+      \x2 ->
+        fmap BG.fromFFIType (hs_bindgen_1728693bccaabc9f_base (BG.toFFIType x0) (BG.toFFIType x1) (BG.toFFIType x2))
+
+{-| __C declaration:__ @duckdb_v2_copy_to_finalize_get_init_data@
+
+    __defined at:__ @duckdb_v2.h 7097:30@
+
+    __exported by:__ @duckdb_v2.h@
+-}
+c_duckdb_v2_copy_to_finalize_get_init_data ::
+     DuckDBV2CopyToFinalizeInfoHandle
+     -- ^ __C declaration:__ @info@
+  -> BG.Ptr (BG.Ptr BG.Void)
+     -- ^ __C declaration:__ @data@
+  -> BG.Ptr DuckDBV2ErrorInfoHandle
+     -- ^ __C declaration:__ @err@
+  -> IO DuckDBV2Error
+c_duckdb_v2_copy_to_finalize_get_init_data =
+  hs_bindgen_1728693bccaabc9f
+
+-- __unique:__ @Database_DuckDB_FFI_V2_Database.DuckDB.FFI.V2_Safe_duckdb_v2_copy_from_set_bind_callback@
+foreign import ccall safe "hs_bindgen_a7fa393848569792" hs_bindgen_a7fa393848569792_base ::
+     BG.Ptr BG.Void
+  -> BG.FunPtr BG.Void
+  -> BG.Ptr BG.Void
+  -> IO BG.CUInt
+
+-- __unique:__ @Database_DuckDB_FFI_V2_Database.DuckDB.FFI.V2_Safe_duckdb_v2_copy_from_set_bind_callback@
+hs_bindgen_a7fa393848569792 ::
+     DuckDBV2CopyFunctionHandle
+  -> DuckDBV2CopyFromBindCallbackFn
+  -> BG.Ptr DuckDBV2ErrorInfoHandle
+  -> IO DuckDBV2Error
+hs_bindgen_a7fa393848569792 =
+  \x0 ->
+    \x1 ->
+      \x2 ->
+        fmap BG.fromFFIType (hs_bindgen_a7fa393848569792_base (BG.toFFIType x0) (BG.toFFIType x1) (BG.toFFIType x2))
+
+{-| __C declaration:__ @duckdb_v2_copy_from_set_bind_callback@
+
+    __defined at:__ @duckdb_v2.h 7120:30@
+
+    __exported by:__ @duckdb_v2.h@
+-}
+c_duckdb_v2_copy_from_set_bind_callback ::
+     DuckDBV2CopyFunctionHandle
+     -- ^ __C declaration:__ @function@
+  -> DuckDBV2CopyFromBindCallbackFn
+     -- ^ __C declaration:__ @callback@
+  -> BG.Ptr DuckDBV2ErrorInfoHandle
+     -- ^ __C declaration:__ @err@
+  -> IO DuckDBV2Error
+c_duckdb_v2_copy_from_set_bind_callback =
+  hs_bindgen_a7fa393848569792
+
+-- __unique:__ @Database_DuckDB_FFI_V2_Database.DuckDB.FFI.V2_Safe_duckdb_v2_copy_from_set_init_global_callback@
+foreign import ccall safe "hs_bindgen_96288a021a4369ed" hs_bindgen_96288a021a4369ed_base ::
+     BG.Ptr BG.Void
+  -> BG.FunPtr BG.Void
+  -> BG.Ptr BG.Void
+  -> IO BG.CUInt
+
+-- __unique:__ @Database_DuckDB_FFI_V2_Database.DuckDB.FFI.V2_Safe_duckdb_v2_copy_from_set_init_global_callback@
+hs_bindgen_96288a021a4369ed ::
+     DuckDBV2CopyFunctionHandle
+  -> DuckDBV2CopyFromInitGlobalCallbackFn
+  -> BG.Ptr DuckDBV2ErrorInfoHandle
+  -> IO DuckDBV2Error
+hs_bindgen_96288a021a4369ed =
+  \x0 ->
+    \x1 ->
+      \x2 ->
+        fmap BG.fromFFIType (hs_bindgen_96288a021a4369ed_base (BG.toFFIType x0) (BG.toFFIType x1) (BG.toFFIType x2))
+
+{-| __C declaration:__ @duckdb_v2_copy_from_set_init_global_callback@
+
+    __defined at:__ @duckdb_v2.h 7142:30@
+
+    __exported by:__ @duckdb_v2.h@
+-}
+c_duckdb_v2_copy_from_set_init_global_callback ::
+     DuckDBV2CopyFunctionHandle
+     -- ^ __C declaration:__ @function@
+  -> DuckDBV2CopyFromInitGlobalCallbackFn
+     -- ^ __C declaration:__ @callback@
+  -> BG.Ptr DuckDBV2ErrorInfoHandle
+     -- ^ __C declaration:__ @err@
+  -> IO DuckDBV2Error
+c_duckdb_v2_copy_from_set_init_global_callback =
+  hs_bindgen_96288a021a4369ed
+
+-- __unique:__ @Database_DuckDB_FFI_V2_Database.DuckDB.FFI.V2_Safe_duckdb_v2_copy_from_set_init_local_callback@
+foreign import ccall safe "hs_bindgen_5045d8628a5d27fe" hs_bindgen_5045d8628a5d27fe_base ::
+     BG.Ptr BG.Void
+  -> BG.FunPtr BG.Void
+  -> BG.Ptr BG.Void
+  -> IO BG.CUInt
+
+-- __unique:__ @Database_DuckDB_FFI_V2_Database.DuckDB.FFI.V2_Safe_duckdb_v2_copy_from_set_init_local_callback@
+hs_bindgen_5045d8628a5d27fe ::
+     DuckDBV2CopyFunctionHandle
+  -> DuckDBV2CopyFromInitLocalCallbackFn
+  -> BG.Ptr DuckDBV2ErrorInfoHandle
+  -> IO DuckDBV2Error
+hs_bindgen_5045d8628a5d27fe =
+  \x0 ->
+    \x1 ->
+      \x2 ->
+        fmap BG.fromFFIType (hs_bindgen_5045d8628a5d27fe_base (BG.toFFIType x0) (BG.toFFIType x1) (BG.toFFIType x2))
+
+{-| __C declaration:__ @duckdb_v2_copy_from_set_init_local_callback@
+
+    __defined at:__ @duckdb_v2.h 7163:30@
+
+    __exported by:__ @duckdb_v2.h@
+-}
+c_duckdb_v2_copy_from_set_init_local_callback ::
+     DuckDBV2CopyFunctionHandle
+     -- ^ __C declaration:__ @function@
+  -> DuckDBV2CopyFromInitLocalCallbackFn
+     -- ^ __C declaration:__ @callback@
+  -> BG.Ptr DuckDBV2ErrorInfoHandle
+     -- ^ __C declaration:__ @err@
+  -> IO DuckDBV2Error
+c_duckdb_v2_copy_from_set_init_local_callback =
+  hs_bindgen_5045d8628a5d27fe
+
+-- __unique:__ @Database_DuckDB_FFI_V2_Database.DuckDB.FFI.V2_Safe_duckdb_v2_copy_from_set_exec_callback@
+foreign import ccall safe "hs_bindgen_cc2a55de291c0c0a" hs_bindgen_cc2a55de291c0c0a_base ::
+     BG.Ptr BG.Void
+  -> BG.FunPtr BG.Void
+  -> BG.Ptr BG.Void
+  -> IO BG.CUInt
+
+-- __unique:__ @Database_DuckDB_FFI_V2_Database.DuckDB.FFI.V2_Safe_duckdb_v2_copy_from_set_exec_callback@
+hs_bindgen_cc2a55de291c0c0a ::
+     DuckDBV2CopyFunctionHandle
+  -> DuckDBV2CopyFromExecCallbackFn
+  -> BG.Ptr DuckDBV2ErrorInfoHandle
+  -> IO DuckDBV2Error
+hs_bindgen_cc2a55de291c0c0a =
+  \x0 ->
+    \x1 ->
+      \x2 ->
+        fmap BG.fromFFIType (hs_bindgen_cc2a55de291c0c0a_base (BG.toFFIType x0) (BG.toFFIType x1) (BG.toFFIType x2))
+
+{-| __C declaration:__ @duckdb_v2_copy_from_set_exec_callback@
+
+    __defined at:__ @duckdb_v2.h 7185:30@
+
+    __exported by:__ @duckdb_v2.h@
+-}
+c_duckdb_v2_copy_from_set_exec_callback ::
+     DuckDBV2CopyFunctionHandle
+     -- ^ __C declaration:__ @function@
+  -> DuckDBV2CopyFromExecCallbackFn
+     -- ^ __C declaration:__ @callback@
+  -> BG.Ptr DuckDBV2ErrorInfoHandle
+     -- ^ __C declaration:__ @err@
+  -> IO DuckDBV2Error
+c_duckdb_v2_copy_from_set_exec_callback =
+  hs_bindgen_cc2a55de291c0c0a
+
+-- __unique:__ @Database_DuckDB_FFI_V2_Database.DuckDB.FFI.V2_Safe_duckdb_v2_copy_from_set_progress_callback@
+foreign import ccall safe "hs_bindgen_bd43c3bdedce42fd" hs_bindgen_bd43c3bdedce42fd_base ::
+     BG.Ptr BG.Void
+  -> BG.FunPtr BG.Void
+  -> BG.Ptr BG.Void
+  -> IO BG.CUInt
+
+-- __unique:__ @Database_DuckDB_FFI_V2_Database.DuckDB.FFI.V2_Safe_duckdb_v2_copy_from_set_progress_callback@
+hs_bindgen_bd43c3bdedce42fd ::
+     DuckDBV2CopyFunctionHandle
+  -> DuckDBV2CopyFromProgressCallbackFn
+  -> BG.Ptr DuckDBV2ErrorInfoHandle
+  -> IO DuckDBV2Error
+hs_bindgen_bd43c3bdedce42fd =
+  \x0 ->
+    \x1 ->
+      \x2 ->
+        fmap BG.fromFFIType (hs_bindgen_bd43c3bdedce42fd_base (BG.toFFIType x0) (BG.toFFIType x1) (BG.toFFIType x2))
+
+{-| __C declaration:__ @duckdb_v2_copy_from_set_progress_callback@
+
+    __defined at:__ @duckdb_v2.h 7207:30@
+
+    __exported by:__ @duckdb_v2.h@
+-}
+c_duckdb_v2_copy_from_set_progress_callback ::
+     DuckDBV2CopyFunctionHandle
+     -- ^ __C declaration:__ @function@
+  -> DuckDBV2CopyFromProgressCallbackFn
+     -- ^ __C declaration:__ @callback@
+  -> BG.Ptr DuckDBV2ErrorInfoHandle
+     -- ^ __C declaration:__ @err@
+  -> IO DuckDBV2Error
+c_duckdb_v2_copy_from_set_progress_callback =
+  hs_bindgen_bd43c3bdedce42fd
+
+-- __unique:__ @Database_DuckDB_FFI_V2_Database.DuckDB.FFI.V2_Safe_duckdb_v2_copy_from_bind_get_user_data@
+foreign import ccall safe "hs_bindgen_919a7e52dfb4f754" hs_bindgen_919a7e52dfb4f754_base ::
+     BG.Ptr BG.Void
+  -> BG.Ptr BG.Void
+  -> BG.Ptr BG.Void
+  -> IO BG.CUInt
+
+-- __unique:__ @Database_DuckDB_FFI_V2_Database.DuckDB.FFI.V2_Safe_duckdb_v2_copy_from_bind_get_user_data@
+hs_bindgen_919a7e52dfb4f754 ::
+     DuckDBV2CopyFromBindInfoHandle
+  -> BG.Ptr (BG.Ptr BG.Void)
+  -> BG.Ptr DuckDBV2ErrorInfoHandle
+  -> IO DuckDBV2Error
+hs_bindgen_919a7e52dfb4f754 =
+  \x0 ->
+    \x1 ->
+      \x2 ->
+        fmap BG.fromFFIType (hs_bindgen_919a7e52dfb4f754_base (BG.toFFIType x0) (BG.toFFIType x1) (BG.toFFIType x2))
+
+{-| __C declaration:__ @duckdb_v2_copy_from_bind_get_user_data@
+
+    __defined at:__ @duckdb_v2.h 7225:30@
+
+    __exported by:__ @duckdb_v2.h@
+-}
+c_duckdb_v2_copy_from_bind_get_user_data ::
+     DuckDBV2CopyFromBindInfoHandle
+     -- ^ __C declaration:__ @info@
+  -> BG.Ptr (BG.Ptr BG.Void)
+     -- ^ __C declaration:__ @data@
+  -> BG.Ptr DuckDBV2ErrorInfoHandle
+     -- ^ __C declaration:__ @err@
+  -> IO DuckDBV2Error
+c_duckdb_v2_copy_from_bind_get_user_data =
+  hs_bindgen_919a7e52dfb4f754
+
+-- __unique:__ @Database_DuckDB_FFI_V2_Database.DuckDB.FFI.V2_Safe_duckdb_v2_copy_from_bind_set_bind_data@
+foreign import ccall safe "hs_bindgen_077251a9c46e448e" hs_bindgen_077251a9c46e448e_base ::
+     BG.Ptr BG.Void
+  -> BG.Ptr BG.Void
+  -> BG.Ptr BG.Void
+  -> IO BG.CUInt
+
+-- __unique:__ @Database_DuckDB_FFI_V2_Database.DuckDB.FFI.V2_Safe_duckdb_v2_copy_from_bind_set_bind_data@
+hs_bindgen_077251a9c46e448e ::
+     DuckDBV2CopyFromBindInfoHandle
+  -> BG.Ptr DuckDBV2Opaque
+  -> BG.Ptr DuckDBV2ErrorInfoHandle
+  -> IO DuckDBV2Error
+hs_bindgen_077251a9c46e448e =
+  \x0 ->
+    \x1 ->
+      \x2 ->
+        fmap BG.fromFFIType (hs_bindgen_077251a9c46e448e_base (BG.toFFIType x0) (BG.toFFIType x1) (BG.toFFIType x2))
+
+{-| __C declaration:__ @duckdb_v2_copy_from_bind_set_bind_data@
+
+    __defined at:__ @duckdb_v2.h 7246:30@
+
+    __exported by:__ @duckdb_v2.h@
+-}
+c_duckdb_v2_copy_from_bind_set_bind_data ::
+     DuckDBV2CopyFromBindInfoHandle
+     -- ^ __C declaration:__ @info@
+  -> BG.Ptr DuckDBV2Opaque
+     -- ^ __C declaration:__ @data@
+  -> BG.Ptr DuckDBV2ErrorInfoHandle
+     -- ^ __C declaration:__ @err@
+  -> IO DuckDBV2Error
+c_duckdb_v2_copy_from_bind_set_bind_data =
+  hs_bindgen_077251a9c46e448e
+
+-- __unique:__ @Database_DuckDB_FFI_V2_Database.DuckDB.FFI.V2_Safe_duckdb_v2_copy_from_bind_get_file_path@
+foreign import ccall safe "hs_bindgen_0b754a2907b72d27" hs_bindgen_0b754a2907b72d27_base ::
+     BG.Ptr BG.Void
+  -> BG.Ptr BG.Void
+  -> BG.Ptr BG.Void
+  -> IO BG.CUInt
+
+-- __unique:__ @Database_DuckDB_FFI_V2_Database.DuckDB.FFI.V2_Safe_duckdb_v2_copy_from_bind_get_file_path@
+hs_bindgen_0b754a2907b72d27 ::
+     DuckDBV2CopyFromBindInfoHandle
+  -> BG.Ptr DuckDBV2Str
+  -> BG.Ptr DuckDBV2ErrorInfoHandle
+  -> IO DuckDBV2Error
+hs_bindgen_0b754a2907b72d27 =
+  \x0 ->
+    \x1 ->
+      \x2 ->
+        fmap BG.fromFFIType (hs_bindgen_0b754a2907b72d27_base (BG.toFFIType x0) (BG.toFFIType x1) (BG.toFFIType x2))
+
+{-| __C declaration:__ @duckdb_v2_copy_from_bind_get_file_path@
+
+    __defined at:__ @duckdb_v2.h 7267:30@
+
+    __exported by:__ @duckdb_v2.h@
+-}
+c_duckdb_v2_copy_from_bind_get_file_path ::
+     DuckDBV2CopyFromBindInfoHandle
+     -- ^ __C declaration:__ @info@
+  -> BG.Ptr DuckDBV2Str
+     -- ^ __C declaration:__ @path@
+  -> BG.Ptr DuckDBV2ErrorInfoHandle
+     -- ^ __C declaration:__ @err@
+  -> IO DuckDBV2Error
+c_duckdb_v2_copy_from_bind_get_file_path =
+  hs_bindgen_0b754a2907b72d27
+
+-- __unique:__ @Database_DuckDB_FFI_V2_Database.DuckDB.FFI.V2_Safe_duckdb_v2_copy_from_bind_get_column_count@
+foreign import ccall safe "hs_bindgen_6183f085d1045b62" hs_bindgen_6183f085d1045b62_base ::
+     BG.Ptr BG.Void
+  -> BG.Ptr BG.Void
+  -> BG.Ptr BG.Void
+  -> IO BG.CUInt
+
+-- __unique:__ @Database_DuckDB_FFI_V2_Database.DuckDB.FFI.V2_Safe_duckdb_v2_copy_from_bind_get_column_count@
+hs_bindgen_6183f085d1045b62 ::
+     DuckDBV2CopyFromBindInfoHandle
+  -> BG.Ptr DuckDBIdx
+  -> BG.Ptr DuckDBV2ErrorInfoHandle
+  -> IO DuckDBV2Error
+hs_bindgen_6183f085d1045b62 =
+  \x0 ->
+    \x1 ->
+      \x2 ->
+        fmap BG.fromFFIType (hs_bindgen_6183f085d1045b62_base (BG.toFFIType x0) (BG.toFFIType x1) (BG.toFFIType x2))
+
+{-| __C declaration:__ @duckdb_v2_copy_from_bind_get_column_count@
+
+    __defined at:__ @duckdb_v2.h 7289:30@
+
+    __exported by:__ @duckdb_v2.h@
+-}
+c_duckdb_v2_copy_from_bind_get_column_count ::
+     DuckDBV2CopyFromBindInfoHandle
+     -- ^ __C declaration:__ @info@
+  -> BG.Ptr DuckDBIdx
+     -- ^ __C declaration:__ @count@
+  -> BG.Ptr DuckDBV2ErrorInfoHandle
+     -- ^ __C declaration:__ @err@
+  -> IO DuckDBV2Error
+c_duckdb_v2_copy_from_bind_get_column_count =
+  hs_bindgen_6183f085d1045b62
+
+-- __unique:__ @Database_DuckDB_FFI_V2_Database.DuckDB.FFI.V2_Safe_duckdb_v2_copy_from_bind_get_column_type@
+foreign import ccall safe "hs_bindgen_3449290c4f64678d" hs_bindgen_3449290c4f64678d_base ::
+     BG.Ptr BG.Void
+  -> HsBindgen.Runtime.LibC.Word64
+  -> BG.Ptr BG.Void
+  -> BG.Ptr BG.Void
+  -> IO BG.CUInt
+
+-- __unique:__ @Database_DuckDB_FFI_V2_Database.DuckDB.FFI.V2_Safe_duckdb_v2_copy_from_bind_get_column_type@
+hs_bindgen_3449290c4f64678d ::
+     DuckDBV2CopyFromBindInfoHandle
+  -> DuckDBIdx
+  -> BG.Ptr DuckDBV2LogicalTypeHandle
+  -> BG.Ptr DuckDBV2ErrorInfoHandle
+  -> IO DuckDBV2Error
+hs_bindgen_3449290c4f64678d =
+  \x0 ->
+    \x1 ->
+      \x2 ->
+        \x3 ->
+          fmap BG.fromFFIType (hs_bindgen_3449290c4f64678d_base (BG.toFFIType x0) (BG.toFFIType x1) (BG.toFFIType x2) (BG.toFFIType x3))
+
+{-| __C declaration:__ @duckdb_v2_copy_from_bind_get_column_type@
+
+    __defined at:__ @duckdb_v2.h 7310:30@
+
+    __exported by:__ @duckdb_v2.h@
+-}
+c_duckdb_v2_copy_from_bind_get_column_type ::
+     DuckDBV2CopyFromBindInfoHandle
+     -- ^ __C declaration:__ @info@
+  -> DuckDBIdx
+     -- ^ __C declaration:__ @index@
+  -> BG.Ptr DuckDBV2LogicalTypeHandle
+     -- ^ __C declaration:__ @type@
+  -> BG.Ptr DuckDBV2ErrorInfoHandle
+     -- ^ __C declaration:__ @err@
+  -> IO DuckDBV2Error
+c_duckdb_v2_copy_from_bind_get_column_type =
+  hs_bindgen_3449290c4f64678d
+
+-- __unique:__ @Database_DuckDB_FFI_V2_Database.DuckDB.FFI.V2_Safe_duckdb_v2_copy_from_bind_get_column_name@
+foreign import ccall safe "hs_bindgen_3684f9eaa4f328c5" hs_bindgen_3684f9eaa4f328c5_base ::
+     BG.Ptr BG.Void
+  -> HsBindgen.Runtime.LibC.Word64
+  -> BG.Ptr BG.Void
+  -> BG.Ptr BG.Void
+  -> IO BG.CUInt
+
+-- __unique:__ @Database_DuckDB_FFI_V2_Database.DuckDB.FFI.V2_Safe_duckdb_v2_copy_from_bind_get_column_name@
+hs_bindgen_3684f9eaa4f328c5 ::
+     DuckDBV2CopyFromBindInfoHandle
+  -> DuckDBIdx
+  -> BG.Ptr DuckDBV2IdentifierT
+  -> BG.Ptr DuckDBV2ErrorInfoHandle
+  -> IO DuckDBV2Error
+hs_bindgen_3684f9eaa4f328c5 =
+  \x0 ->
+    \x1 ->
+      \x2 ->
+        \x3 ->
+          fmap BG.fromFFIType (hs_bindgen_3684f9eaa4f328c5_base (BG.toFFIType x0) (BG.toFFIType x1) (BG.toFFIType x2) (BG.toFFIType x3))
+
+{-| __C declaration:__ @duckdb_v2_copy_from_bind_get_column_name@
+
+    __defined at:__ @duckdb_v2.h 7331:30@
+
+    __exported by:__ @duckdb_v2.h@
+-}
+c_duckdb_v2_copy_from_bind_get_column_name ::
+     DuckDBV2CopyFromBindInfoHandle
+     -- ^ __C declaration:__ @info@
+  -> DuckDBIdx
+     -- ^ __C declaration:__ @index@
+  -> BG.Ptr DuckDBV2IdentifierT
+     -- ^ __C declaration:__ @name@
+  -> BG.Ptr DuckDBV2ErrorInfoHandle
+     -- ^ __C declaration:__ @err@
+  -> IO DuckDBV2Error
+c_duckdb_v2_copy_from_bind_get_column_name =
+  hs_bindgen_3684f9eaa4f328c5
+
+-- __unique:__ @Database_DuckDB_FFI_V2_Database.DuckDB.FFI.V2_Safe_duckdb_v2_copy_from_bind_get_option_count@
+foreign import ccall safe "hs_bindgen_a2d5f43b93427b87" hs_bindgen_a2d5f43b93427b87_base ::
+     BG.Ptr BG.Void
+  -> BG.Ptr BG.Void
+  -> BG.Ptr BG.Void
+  -> IO BG.CUInt
+
+-- __unique:__ @Database_DuckDB_FFI_V2_Database.DuckDB.FFI.V2_Safe_duckdb_v2_copy_from_bind_get_option_count@
+hs_bindgen_a2d5f43b93427b87 ::
+     DuckDBV2CopyFromBindInfoHandle
+  -> BG.Ptr DuckDBIdx
+  -> BG.Ptr DuckDBV2ErrorInfoHandle
+  -> IO DuckDBV2Error
+hs_bindgen_a2d5f43b93427b87 =
+  \x0 ->
+    \x1 ->
+      \x2 ->
+        fmap BG.fromFFIType (hs_bindgen_a2d5f43b93427b87_base (BG.toFFIType x0) (BG.toFFIType x1) (BG.toFFIType x2))
+
+{-| __C declaration:__ @duckdb_v2_copy_from_bind_get_option_count@
+
+    __defined at:__ @duckdb_v2.h 7352:30@
+
+    __exported by:__ @duckdb_v2.h@
+-}
+c_duckdb_v2_copy_from_bind_get_option_count ::
+     DuckDBV2CopyFromBindInfoHandle
+     -- ^ __C declaration:__ @info@
+  -> BG.Ptr DuckDBIdx
+     -- ^ __C declaration:__ @count@
+  -> BG.Ptr DuckDBV2ErrorInfoHandle
+     -- ^ __C declaration:__ @err@
+  -> IO DuckDBV2Error
+c_duckdb_v2_copy_from_bind_get_option_count =
+  hs_bindgen_a2d5f43b93427b87
+
+-- __unique:__ @Database_DuckDB_FFI_V2_Database.DuckDB.FFI.V2_Safe_duckdb_v2_copy_from_bind_get_option_name@
+foreign import ccall safe "hs_bindgen_9adeda560effcce9" hs_bindgen_9adeda560effcce9_base ::
+     BG.Ptr BG.Void
+  -> HsBindgen.Runtime.LibC.Word64
+  -> BG.Ptr BG.Void
+  -> BG.Ptr BG.Void
+  -> IO BG.CUInt
+
+-- __unique:__ @Database_DuckDB_FFI_V2_Database.DuckDB.FFI.V2_Safe_duckdb_v2_copy_from_bind_get_option_name@
+hs_bindgen_9adeda560effcce9 ::
+     DuckDBV2CopyFromBindInfoHandle
+  -> DuckDBIdx
+  -> BG.Ptr DuckDBV2IdentifierT
+  -> BG.Ptr DuckDBV2ErrorInfoHandle
+  -> IO DuckDBV2Error
+hs_bindgen_9adeda560effcce9 =
+  \x0 ->
+    \x1 ->
+      \x2 ->
+        \x3 ->
+          fmap BG.fromFFIType (hs_bindgen_9adeda560effcce9_base (BG.toFFIType x0) (BG.toFFIType x1) (BG.toFFIType x2) (BG.toFFIType x3))
+
+{-| __C declaration:__ @duckdb_v2_copy_from_bind_get_option_name@
+
+    __defined at:__ @duckdb_v2.h 7373:30@
+
+    __exported by:__ @duckdb_v2.h@
+-}
+c_duckdb_v2_copy_from_bind_get_option_name ::
+     DuckDBV2CopyFromBindInfoHandle
+     -- ^ __C declaration:__ @info@
+  -> DuckDBIdx
+     -- ^ __C declaration:__ @index@
+  -> BG.Ptr DuckDBV2IdentifierT
+     -- ^ __C declaration:__ @name@
+  -> BG.Ptr DuckDBV2ErrorInfoHandle
+     -- ^ __C declaration:__ @err@
+  -> IO DuckDBV2Error
+c_duckdb_v2_copy_from_bind_get_option_name =
+  hs_bindgen_9adeda560effcce9
+
+-- __unique:__ @Database_DuckDB_FFI_V2_Database.DuckDB.FFI.V2_Safe_duckdb_v2_copy_from_bind_get_option_value@
+foreign import ccall safe "hs_bindgen_36686c2484142b90" hs_bindgen_36686c2484142b90_base ::
+     BG.Ptr BG.Void
+  -> HsBindgen.Runtime.LibC.Word64
+  -> BG.Ptr BG.Void
+  -> BG.Ptr BG.Void
+  -> IO BG.CUInt
+
+-- __unique:__ @Database_DuckDB_FFI_V2_Database.DuckDB.FFI.V2_Safe_duckdb_v2_copy_from_bind_get_option_value@
+hs_bindgen_36686c2484142b90 ::
+     DuckDBV2CopyFromBindInfoHandle
+  -> DuckDBIdx
+  -> BG.Ptr DuckDBV2ValueHandle
+  -> BG.Ptr DuckDBV2ErrorInfoHandle
+  -> IO DuckDBV2Error
+hs_bindgen_36686c2484142b90 =
+  \x0 ->
+    \x1 ->
+      \x2 ->
+        \x3 ->
+          fmap BG.fromFFIType (hs_bindgen_36686c2484142b90_base (BG.toFFIType x0) (BG.toFFIType x1) (BG.toFFIType x2) (BG.toFFIType x3))
+
+{-| __C declaration:__ @duckdb_v2_copy_from_bind_get_option_value@
+
+    __defined at:__ @duckdb_v2.h 7397:30@
+
+    __exported by:__ @duckdb_v2.h@
+-}
+c_duckdb_v2_copy_from_bind_get_option_value ::
+     DuckDBV2CopyFromBindInfoHandle
+     -- ^ __C declaration:__ @info@
+  -> DuckDBIdx
+     -- ^ __C declaration:__ @index@
+  -> BG.Ptr DuckDBV2ValueHandle
+     -- ^ __C declaration:__ @value@
+  -> BG.Ptr DuckDBV2ErrorInfoHandle
+     -- ^ __C declaration:__ @err@
+  -> IO DuckDBV2Error
+c_duckdb_v2_copy_from_bind_get_option_value =
+  hs_bindgen_36686c2484142b90
+
+-- __unique:__ @Database_DuckDB_FFI_V2_Database.DuckDB.FFI.V2_Safe_duckdb_v2_copy_from_bind_set_cardinality@
+foreign import ccall safe "hs_bindgen_b10c7124294cce11" hs_bindgen_b10c7124294cce11_base ::
+     BG.Ptr BG.Void
+  -> HsBindgen.Runtime.LibC.Word64
+  -> BG.CBool
+  -> BG.Ptr BG.Void
+  -> IO BG.CUInt
+
+-- __unique:__ @Database_DuckDB_FFI_V2_Database.DuckDB.FFI.V2_Safe_duckdb_v2_copy_from_bind_set_cardinality@
+hs_bindgen_b10c7124294cce11 ::
+     DuckDBV2CopyFromBindInfoHandle
+  -> DuckDBIdx
+  -> BG.CBool
+  -> BG.Ptr DuckDBV2ErrorInfoHandle
+  -> IO DuckDBV2Error
+hs_bindgen_b10c7124294cce11 =
+  \x0 ->
+    \x1 ->
+      \x2 ->
+        \x3 ->
+          fmap BG.fromFFIType (hs_bindgen_b10c7124294cce11_base (BG.toFFIType x0) (BG.toFFIType x1) (BG.toFFIType x2) (BG.toFFIType x3))
+
+{-| __C declaration:__ @duckdb_v2_copy_from_bind_set_cardinality@
+
+    __defined at:__ @duckdb_v2.h 7419:30@
+
+    __exported by:__ @duckdb_v2.h@
+-}
+c_duckdb_v2_copy_from_bind_set_cardinality ::
+     DuckDBV2CopyFromBindInfoHandle
+     -- ^ __C declaration:__ @info@
+  -> DuckDBIdx
+     -- ^ __C declaration:__ @cardinality@
+  -> BG.CBool
+     -- ^ __C declaration:__ @is_exact@
+  -> BG.Ptr DuckDBV2ErrorInfoHandle
+     -- ^ __C declaration:__ @err@
+  -> IO DuckDBV2Error
+c_duckdb_v2_copy_from_bind_set_cardinality =
+  hs_bindgen_b10c7124294cce11
+
+-- __unique:__ @Database_DuckDB_FFI_V2_Database.DuckDB.FFI.V2_Safe_duckdb_v2_copy_from_init_global_get_user_data@
+foreign import ccall safe "hs_bindgen_5498acdf9b26c847" hs_bindgen_5498acdf9b26c847_base ::
+     BG.Ptr BG.Void
+  -> BG.Ptr BG.Void
+  -> BG.Ptr BG.Void
+  -> IO BG.CUInt
+
+-- __unique:__ @Database_DuckDB_FFI_V2_Database.DuckDB.FFI.V2_Safe_duckdb_v2_copy_from_init_global_get_user_data@
+hs_bindgen_5498acdf9b26c847 ::
+     DuckDBV2CopyFromInitGlobalInfoHandle
+  -> BG.Ptr (BG.Ptr BG.Void)
+  -> BG.Ptr DuckDBV2ErrorInfoHandle
+  -> IO DuckDBV2Error
+hs_bindgen_5498acdf9b26c847 =
+  \x0 ->
+    \x1 ->
+      \x2 ->
+        fmap BG.fromFFIType (hs_bindgen_5498acdf9b26c847_base (BG.toFFIType x0) (BG.toFFIType x1) (BG.toFFIType x2))
+
+{-| __C declaration:__ @duckdb_v2_copy_from_init_global_get_user_data@
+
+    __defined at:__ @duckdb_v2.h 7437:30@
+
+    __exported by:__ @duckdb_v2.h@
+-}
+c_duckdb_v2_copy_from_init_global_get_user_data ::
+     DuckDBV2CopyFromInitGlobalInfoHandle
+     -- ^ __C declaration:__ @info@
+  -> BG.Ptr (BG.Ptr BG.Void)
+     -- ^ __C declaration:__ @data@
+  -> BG.Ptr DuckDBV2ErrorInfoHandle
+     -- ^ __C declaration:__ @err@
+  -> IO DuckDBV2Error
+c_duckdb_v2_copy_from_init_global_get_user_data =
+  hs_bindgen_5498acdf9b26c847
+
+-- __unique:__ @Database_DuckDB_FFI_V2_Database.DuckDB.FFI.V2_Safe_duckdb_v2_copy_from_init_global_get_bind_data@
+foreign import ccall safe "hs_bindgen_9883ac3e9f8b569a" hs_bindgen_9883ac3e9f8b569a_base ::
+     BG.Ptr BG.Void
+  -> BG.Ptr BG.Void
+  -> BG.Ptr BG.Void
+  -> IO BG.CUInt
+
+-- __unique:__ @Database_DuckDB_FFI_V2_Database.DuckDB.FFI.V2_Safe_duckdb_v2_copy_from_init_global_get_bind_data@
+hs_bindgen_9883ac3e9f8b569a ::
+     DuckDBV2CopyFromInitGlobalInfoHandle
+  -> BG.Ptr (BG.Ptr BG.Void)
+  -> BG.Ptr DuckDBV2ErrorInfoHandle
+  -> IO DuckDBV2Error
+hs_bindgen_9883ac3e9f8b569a =
+  \x0 ->
+    \x1 ->
+      \x2 ->
+        fmap BG.fromFFIType (hs_bindgen_9883ac3e9f8b569a_base (BG.toFFIType x0) (BG.toFFIType x1) (BG.toFFIType x2))
+
+{-| __C declaration:__ @duckdb_v2_copy_from_init_global_get_bind_data@
+
+    __defined at:__ @duckdb_v2.h 7454:30@
+
+    __exported by:__ @duckdb_v2.h@
+-}
+c_duckdb_v2_copy_from_init_global_get_bind_data ::
+     DuckDBV2CopyFromInitGlobalInfoHandle
+     -- ^ __C declaration:__ @info@
+  -> BG.Ptr (BG.Ptr BG.Void)
+     -- ^ __C declaration:__ @data@
+  -> BG.Ptr DuckDBV2ErrorInfoHandle
+     -- ^ __C declaration:__ @err@
+  -> IO DuckDBV2Error
+c_duckdb_v2_copy_from_init_global_get_bind_data =
+  hs_bindgen_9883ac3e9f8b569a
+
+-- __unique:__ @Database_DuckDB_FFI_V2_Database.DuckDB.FFI.V2_Safe_duckdb_v2_copy_from_init_global_set_global_state@
+foreign import ccall safe "hs_bindgen_689f04e301c50c88" hs_bindgen_689f04e301c50c88_base ::
+     BG.Ptr BG.Void
+  -> BG.Ptr BG.Void
+  -> BG.Ptr BG.Void
+  -> IO BG.CUInt
+
+-- __unique:__ @Database_DuckDB_FFI_V2_Database.DuckDB.FFI.V2_Safe_duckdb_v2_copy_from_init_global_set_global_state@
+hs_bindgen_689f04e301c50c88 ::
+     DuckDBV2CopyFromInitGlobalInfoHandle
+  -> BG.Ptr DuckDBV2Opaque
+  -> BG.Ptr DuckDBV2ErrorInfoHandle
+  -> IO DuckDBV2Error
+hs_bindgen_689f04e301c50c88 =
+  \x0 ->
+    \x1 ->
+      \x2 ->
+        fmap BG.fromFFIType (hs_bindgen_689f04e301c50c88_base (BG.toFFIType x0) (BG.toFFIType x1) (BG.toFFIType x2))
+
+{-| __C declaration:__ @duckdb_v2_copy_from_init_global_set_global_state@
+
+    __defined at:__ @duckdb_v2.h 7475:30@
+
+    __exported by:__ @duckdb_v2.h@
+-}
+c_duckdb_v2_copy_from_init_global_set_global_state ::
+     DuckDBV2CopyFromInitGlobalInfoHandle
+     -- ^ __C declaration:__ @info@
+  -> BG.Ptr DuckDBV2Opaque
+     -- ^ __C declaration:__ @data@
+  -> BG.Ptr DuckDBV2ErrorInfoHandle
+     -- ^ __C declaration:__ @err@
+  -> IO DuckDBV2Error
+c_duckdb_v2_copy_from_init_global_set_global_state =
+  hs_bindgen_689f04e301c50c88
+
+-- __unique:__ @Database_DuckDB_FFI_V2_Database.DuckDB.FFI.V2_Safe_duckdb_v2_copy_from_init_global_set_max_threads@
+foreign import ccall safe "hs_bindgen_9bdb3847d8cbf9b8" hs_bindgen_9bdb3847d8cbf9b8_base ::
+     BG.Ptr BG.Void
+  -> HsBindgen.Runtime.LibC.Word64
+  -> BG.Ptr BG.Void
+  -> IO BG.CUInt
+
+-- __unique:__ @Database_DuckDB_FFI_V2_Database.DuckDB.FFI.V2_Safe_duckdb_v2_copy_from_init_global_set_max_threads@
+hs_bindgen_9bdb3847d8cbf9b8 ::
+     DuckDBV2CopyFromInitGlobalInfoHandle
+  -> DuckDBIdx
+  -> BG.Ptr DuckDBV2ErrorInfoHandle
+  -> IO DuckDBV2Error
+hs_bindgen_9bdb3847d8cbf9b8 =
+  \x0 ->
+    \x1 ->
+      \x2 ->
+        fmap BG.fromFFIType (hs_bindgen_9bdb3847d8cbf9b8_base (BG.toFFIType x0) (BG.toFFIType x1) (BG.toFFIType x2))
+
+{-| __C declaration:__ @duckdb_v2_copy_from_init_global_set_max_threads@
+
+    __defined at:__ @duckdb_v2.h 7495:30@
+
+    __exported by:__ @duckdb_v2.h@
+-}
+c_duckdb_v2_copy_from_init_global_set_max_threads ::
+     DuckDBV2CopyFromInitGlobalInfoHandle
+     -- ^ __C declaration:__ @info@
+  -> DuckDBIdx
+     -- ^ __C declaration:__ @max_threads@
+  -> BG.Ptr DuckDBV2ErrorInfoHandle
+     -- ^ __C declaration:__ @err@
+  -> IO DuckDBV2Error
+c_duckdb_v2_copy_from_init_global_set_max_threads =
+  hs_bindgen_9bdb3847d8cbf9b8
+
+-- __unique:__ @Database_DuckDB_FFI_V2_Database.DuckDB.FFI.V2_Safe_duckdb_v2_copy_from_init_local_get_user_data@
+foreign import ccall safe "hs_bindgen_9eeb19bc716c6897" hs_bindgen_9eeb19bc716c6897_base ::
+     BG.Ptr BG.Void
+  -> BG.Ptr BG.Void
+  -> BG.Ptr BG.Void
+  -> IO BG.CUInt
+
+-- __unique:__ @Database_DuckDB_FFI_V2_Database.DuckDB.FFI.V2_Safe_duckdb_v2_copy_from_init_local_get_user_data@
+hs_bindgen_9eeb19bc716c6897 ::
+     DuckDBV2CopyFromInitLocalInfoHandle
+  -> BG.Ptr (BG.Ptr BG.Void)
+  -> BG.Ptr DuckDBV2ErrorInfoHandle
+  -> IO DuckDBV2Error
+hs_bindgen_9eeb19bc716c6897 =
+  \x0 ->
+    \x1 ->
+      \x2 ->
+        fmap BG.fromFFIType (hs_bindgen_9eeb19bc716c6897_base (BG.toFFIType x0) (BG.toFFIType x1) (BG.toFFIType x2))
+
+{-| __C declaration:__ @duckdb_v2_copy_from_init_local_get_user_data@
+
+    __defined at:__ @duckdb_v2.h 7512:30@
+
+    __exported by:__ @duckdb_v2.h@
+-}
+c_duckdb_v2_copy_from_init_local_get_user_data ::
+     DuckDBV2CopyFromInitLocalInfoHandle
+     -- ^ __C declaration:__ @info@
+  -> BG.Ptr (BG.Ptr BG.Void)
+     -- ^ __C declaration:__ @data@
+  -> BG.Ptr DuckDBV2ErrorInfoHandle
+     -- ^ __C declaration:__ @err@
+  -> IO DuckDBV2Error
+c_duckdb_v2_copy_from_init_local_get_user_data =
+  hs_bindgen_9eeb19bc716c6897
+
+-- __unique:__ @Database_DuckDB_FFI_V2_Database.DuckDB.FFI.V2_Safe_duckdb_v2_copy_from_init_local_get_bind_data@
+foreign import ccall safe "hs_bindgen_76c31c62120fb670" hs_bindgen_76c31c62120fb670_base ::
+     BG.Ptr BG.Void
+  -> BG.Ptr BG.Void
+  -> BG.Ptr BG.Void
+  -> IO BG.CUInt
+
+-- __unique:__ @Database_DuckDB_FFI_V2_Database.DuckDB.FFI.V2_Safe_duckdb_v2_copy_from_init_local_get_bind_data@
+hs_bindgen_76c31c62120fb670 ::
+     DuckDBV2CopyFromInitLocalInfoHandle
+  -> BG.Ptr (BG.Ptr BG.Void)
+  -> BG.Ptr DuckDBV2ErrorInfoHandle
+  -> IO DuckDBV2Error
+hs_bindgen_76c31c62120fb670 =
+  \x0 ->
+    \x1 ->
+      \x2 ->
+        fmap BG.fromFFIType (hs_bindgen_76c31c62120fb670_base (BG.toFFIType x0) (BG.toFFIType x1) (BG.toFFIType x2))
+
+{-| __C declaration:__ @duckdb_v2_copy_from_init_local_get_bind_data@
+
+    __defined at:__ @duckdb_v2.h 7529:30@
+
+    __exported by:__ @duckdb_v2.h@
+-}
+c_duckdb_v2_copy_from_init_local_get_bind_data ::
+     DuckDBV2CopyFromInitLocalInfoHandle
+     -- ^ __C declaration:__ @info@
+  -> BG.Ptr (BG.Ptr BG.Void)
+     -- ^ __C declaration:__ @data@
+  -> BG.Ptr DuckDBV2ErrorInfoHandle
+     -- ^ __C declaration:__ @err@
+  -> IO DuckDBV2Error
+c_duckdb_v2_copy_from_init_local_get_bind_data =
+  hs_bindgen_76c31c62120fb670
+
+-- __unique:__ @Database_DuckDB_FFI_V2_Database.DuckDB.FFI.V2_Safe_duckdb_v2_copy_from_init_local_get_global_state@
+foreign import ccall safe "hs_bindgen_fd32efaaa0b94469" hs_bindgen_fd32efaaa0b94469_base ::
+     BG.Ptr BG.Void
+  -> BG.Ptr BG.Void
+  -> BG.Ptr BG.Void
+  -> IO BG.CUInt
+
+-- __unique:__ @Database_DuckDB_FFI_V2_Database.DuckDB.FFI.V2_Safe_duckdb_v2_copy_from_init_local_get_global_state@
+hs_bindgen_fd32efaaa0b94469 ::
+     DuckDBV2CopyFromInitLocalInfoHandle
+  -> BG.Ptr (BG.Ptr BG.Void)
+  -> BG.Ptr DuckDBV2ErrorInfoHandle
+  -> IO DuckDBV2Error
+hs_bindgen_fd32efaaa0b94469 =
+  \x0 ->
+    \x1 ->
+      \x2 ->
+        fmap BG.fromFFIType (hs_bindgen_fd32efaaa0b94469_base (BG.toFFIType x0) (BG.toFFIType x1) (BG.toFFIType x2))
+
+{-| __C declaration:__ @duckdb_v2_copy_from_init_local_get_global_state@
+
+    __defined at:__ @duckdb_v2.h 7548:30@
+
+    __exported by:__ @duckdb_v2.h@
+-}
+c_duckdb_v2_copy_from_init_local_get_global_state ::
+     DuckDBV2CopyFromInitLocalInfoHandle
+     -- ^ __C declaration:__ @info@
+  -> BG.Ptr (BG.Ptr BG.Void)
+     -- ^ __C declaration:__ @data@
+  -> BG.Ptr DuckDBV2ErrorInfoHandle
+     -- ^ __C declaration:__ @err@
+  -> IO DuckDBV2Error
+c_duckdb_v2_copy_from_init_local_get_global_state =
+  hs_bindgen_fd32efaaa0b94469
+
+-- __unique:__ @Database_DuckDB_FFI_V2_Database.DuckDB.FFI.V2_Safe_duckdb_v2_copy_from_init_local_set_local_state@
+foreign import ccall safe "hs_bindgen_b3a1bc99145f103c" hs_bindgen_b3a1bc99145f103c_base ::
+     BG.Ptr BG.Void
+  -> BG.Ptr BG.Void
+  -> BG.Ptr BG.Void
+  -> IO BG.CUInt
+
+-- __unique:__ @Database_DuckDB_FFI_V2_Database.DuckDB.FFI.V2_Safe_duckdb_v2_copy_from_init_local_set_local_state@
+hs_bindgen_b3a1bc99145f103c ::
+     DuckDBV2CopyFromInitLocalInfoHandle
+  -> BG.Ptr DuckDBV2Opaque
+  -> BG.Ptr DuckDBV2ErrorInfoHandle
+  -> IO DuckDBV2Error
+hs_bindgen_b3a1bc99145f103c =
+  \x0 ->
+    \x1 ->
+      \x2 ->
+        fmap BG.fromFFIType (hs_bindgen_b3a1bc99145f103c_base (BG.toFFIType x0) (BG.toFFIType x1) (BG.toFFIType x2))
+
+{-| __C declaration:__ @duckdb_v2_copy_from_init_local_set_local_state@
+
+    __defined at:__ @duckdb_v2.h 7570:30@
+
+    __exported by:__ @duckdb_v2.h@
+-}
+c_duckdb_v2_copy_from_init_local_set_local_state ::
+     DuckDBV2CopyFromInitLocalInfoHandle
+     -- ^ __C declaration:__ @info@
+  -> BG.Ptr DuckDBV2Opaque
+     -- ^ __C declaration:__ @data@
+  -> BG.Ptr DuckDBV2ErrorInfoHandle
+     -- ^ __C declaration:__ @err@
+  -> IO DuckDBV2Error
+c_duckdb_v2_copy_from_init_local_set_local_state =
+  hs_bindgen_b3a1bc99145f103c
+
+-- __unique:__ @Database_DuckDB_FFI_V2_Database.DuckDB.FFI.V2_Safe_duckdb_v2_copy_from_exec_get_user_data@
+foreign import ccall safe "hs_bindgen_c3e524ecdd5ded5e" hs_bindgen_c3e524ecdd5ded5e_base ::
+     BG.Ptr BG.Void
+  -> BG.Ptr BG.Void
+  -> BG.Ptr BG.Void
+  -> IO BG.CUInt
+
+-- __unique:__ @Database_DuckDB_FFI_V2_Database.DuckDB.FFI.V2_Safe_duckdb_v2_copy_from_exec_get_user_data@
+hs_bindgen_c3e524ecdd5ded5e ::
+     DuckDBV2CopyFromExecInfoHandle
+  -> BG.Ptr (BG.Ptr BG.Void)
+  -> BG.Ptr DuckDBV2ErrorInfoHandle
+  -> IO DuckDBV2Error
+hs_bindgen_c3e524ecdd5ded5e =
+  \x0 ->
+    \x1 ->
+      \x2 ->
+        fmap BG.fromFFIType (hs_bindgen_c3e524ecdd5ded5e_base (BG.toFFIType x0) (BG.toFFIType x1) (BG.toFFIType x2))
+
+{-| __C declaration:__ @duckdb_v2_copy_from_exec_get_user_data@
+
+    __defined at:__ @duckdb_v2.h 7587:30@
+
+    __exported by:__ @duckdb_v2.h@
+-}
+c_duckdb_v2_copy_from_exec_get_user_data ::
+     DuckDBV2CopyFromExecInfoHandle
+     -- ^ __C declaration:__ @info@
+  -> BG.Ptr (BG.Ptr BG.Void)
+     -- ^ __C declaration:__ @data@
+  -> BG.Ptr DuckDBV2ErrorInfoHandle
+     -- ^ __C declaration:__ @err@
+  -> IO DuckDBV2Error
+c_duckdb_v2_copy_from_exec_get_user_data =
+  hs_bindgen_c3e524ecdd5ded5e
+
+-- __unique:__ @Database_DuckDB_FFI_V2_Database.DuckDB.FFI.V2_Safe_duckdb_v2_copy_from_exec_get_bind_data@
+foreign import ccall safe "hs_bindgen_276b7b88ce95f441" hs_bindgen_276b7b88ce95f441_base ::
+     BG.Ptr BG.Void
+  -> BG.Ptr BG.Void
+  -> BG.Ptr BG.Void
+  -> IO BG.CUInt
+
+-- __unique:__ @Database_DuckDB_FFI_V2_Database.DuckDB.FFI.V2_Safe_duckdb_v2_copy_from_exec_get_bind_data@
+hs_bindgen_276b7b88ce95f441 ::
+     DuckDBV2CopyFromExecInfoHandle
+  -> BG.Ptr (BG.Ptr BG.Void)
+  -> BG.Ptr DuckDBV2ErrorInfoHandle
+  -> IO DuckDBV2Error
+hs_bindgen_276b7b88ce95f441 =
+  \x0 ->
+    \x1 ->
+      \x2 ->
+        fmap BG.fromFFIType (hs_bindgen_276b7b88ce95f441_base (BG.toFFIType x0) (BG.toFFIType x1) (BG.toFFIType x2))
+
+{-| __C declaration:__ @duckdb_v2_copy_from_exec_get_bind_data@
+
+    __defined at:__ @duckdb_v2.h 7604:30@
+
+    __exported by:__ @duckdb_v2.h@
+-}
+c_duckdb_v2_copy_from_exec_get_bind_data ::
+     DuckDBV2CopyFromExecInfoHandle
+     -- ^ __C declaration:__ @info@
+  -> BG.Ptr (BG.Ptr BG.Void)
+     -- ^ __C declaration:__ @data@
+  -> BG.Ptr DuckDBV2ErrorInfoHandle
+     -- ^ __C declaration:__ @err@
+  -> IO DuckDBV2Error
+c_duckdb_v2_copy_from_exec_get_bind_data =
+  hs_bindgen_276b7b88ce95f441
+
+-- __unique:__ @Database_DuckDB_FFI_V2_Database.DuckDB.FFI.V2_Safe_duckdb_v2_copy_from_exec_get_global_state@
+foreign import ccall safe "hs_bindgen_a0118223d2a6676a" hs_bindgen_a0118223d2a6676a_base ::
+     BG.Ptr BG.Void
+  -> BG.Ptr BG.Void
+  -> BG.Ptr BG.Void
+  -> IO BG.CUInt
+
+-- __unique:__ @Database_DuckDB_FFI_V2_Database.DuckDB.FFI.V2_Safe_duckdb_v2_copy_from_exec_get_global_state@
+hs_bindgen_a0118223d2a6676a ::
+     DuckDBV2CopyFromExecInfoHandle
+  -> BG.Ptr (BG.Ptr BG.Void)
+  -> BG.Ptr DuckDBV2ErrorInfoHandle
+  -> IO DuckDBV2Error
+hs_bindgen_a0118223d2a6676a =
+  \x0 ->
+    \x1 ->
+      \x2 ->
+        fmap BG.fromFFIType (hs_bindgen_a0118223d2a6676a_base (BG.toFFIType x0) (BG.toFFIType x1) (BG.toFFIType x2))
+
+{-| __C declaration:__ @duckdb_v2_copy_from_exec_get_global_state@
+
+    __defined at:__ @duckdb_v2.h 7623:30@
+
+    __exported by:__ @duckdb_v2.h@
+-}
+c_duckdb_v2_copy_from_exec_get_global_state ::
+     DuckDBV2CopyFromExecInfoHandle
+     -- ^ __C declaration:__ @info@
+  -> BG.Ptr (BG.Ptr BG.Void)
+     -- ^ __C declaration:__ @data@
+  -> BG.Ptr DuckDBV2ErrorInfoHandle
+     -- ^ __C declaration:__ @err@
+  -> IO DuckDBV2Error
+c_duckdb_v2_copy_from_exec_get_global_state =
+  hs_bindgen_a0118223d2a6676a
+
+-- __unique:__ @Database_DuckDB_FFI_V2_Database.DuckDB.FFI.V2_Safe_duckdb_v2_copy_from_exec_get_local_state@
+foreign import ccall safe "hs_bindgen_b3a43cb63564909d" hs_bindgen_b3a43cb63564909d_base ::
+     BG.Ptr BG.Void
+  -> BG.Ptr BG.Void
+  -> BG.Ptr BG.Void
+  -> IO BG.CUInt
+
+-- __unique:__ @Database_DuckDB_FFI_V2_Database.DuckDB.FFI.V2_Safe_duckdb_v2_copy_from_exec_get_local_state@
+hs_bindgen_b3a43cb63564909d ::
+     DuckDBV2CopyFromExecInfoHandle
+  -> BG.Ptr (BG.Ptr BG.Void)
+  -> BG.Ptr DuckDBV2ErrorInfoHandle
+  -> IO DuckDBV2Error
+hs_bindgen_b3a43cb63564909d =
+  \x0 ->
+    \x1 ->
+      \x2 ->
+        fmap BG.fromFFIType (hs_bindgen_b3a43cb63564909d_base (BG.toFFIType x0) (BG.toFFIType x1) (BG.toFFIType x2))
+
+{-| __C declaration:__ @duckdb_v2_copy_from_exec_get_local_state@
+
+    __defined at:__ @duckdb_v2.h 7640:30@
+
+    __exported by:__ @duckdb_v2.h@
+-}
+c_duckdb_v2_copy_from_exec_get_local_state ::
+     DuckDBV2CopyFromExecInfoHandle
+     -- ^ __C declaration:__ @info@
+  -> BG.Ptr (BG.Ptr BG.Void)
+     -- ^ __C declaration:__ @data@
+  -> BG.Ptr DuckDBV2ErrorInfoHandle
+     -- ^ __C declaration:__ @err@
+  -> IO DuckDBV2Error
+c_duckdb_v2_copy_from_exec_get_local_state =
+  hs_bindgen_b3a43cb63564909d
+
+-- __unique:__ @Database_DuckDB_FFI_V2_Database.DuckDB.FFI.V2_Safe_duckdb_v2_copy_from_exec_get_output_chunk@
+foreign import ccall safe "hs_bindgen_e970103092fac840" hs_bindgen_e970103092fac840_base ::
+     BG.Ptr BG.Void
+  -> BG.Ptr BG.Void
+  -> BG.Ptr BG.Void
+  -> IO BG.CUInt
+
+-- __unique:__ @Database_DuckDB_FFI_V2_Database.DuckDB.FFI.V2_Safe_duckdb_v2_copy_from_exec_get_output_chunk@
+hs_bindgen_e970103092fac840 ::
+     DuckDBV2CopyFromExecInfoHandle
+  -> BG.Ptr DuckDBV2DataChunkHandle
+  -> BG.Ptr DuckDBV2ErrorInfoHandle
+  -> IO DuckDBV2Error
+hs_bindgen_e970103092fac840 =
+  \x0 ->
+    \x1 ->
+      \x2 ->
+        fmap BG.fromFFIType (hs_bindgen_e970103092fac840_base (BG.toFFIType x0) (BG.toFFIType x1) (BG.toFFIType x2))
+
+{-| __C declaration:__ @duckdb_v2_copy_from_exec_get_output_chunk@
+
+    __defined at:__ @duckdb_v2.h 7663:30@
+
+    __exported by:__ @duckdb_v2.h@
+-}
+c_duckdb_v2_copy_from_exec_get_output_chunk ::
+     DuckDBV2CopyFromExecInfoHandle
+     -- ^ __C declaration:__ @info@
+  -> BG.Ptr DuckDBV2DataChunkHandle
+     -- ^ __C declaration:__ @chunk@
+  -> BG.Ptr DuckDBV2ErrorInfoHandle
+     -- ^ __C declaration:__ @err@
+  -> IO DuckDBV2Error
+c_duckdb_v2_copy_from_exec_get_output_chunk =
+  hs_bindgen_e970103092fac840
+
+-- __unique:__ @Database_DuckDB_FFI_V2_Database.DuckDB.FFI.V2_Safe_duckdb_v2_copy_from_progress_get_user_data@
+foreign import ccall safe "hs_bindgen_ea17c550641c5981" hs_bindgen_ea17c550641c5981_base ::
+     BG.Ptr BG.Void
+  -> BG.Ptr BG.Void
+  -> BG.Ptr BG.Void
+  -> IO BG.CUInt
+
+-- __unique:__ @Database_DuckDB_FFI_V2_Database.DuckDB.FFI.V2_Safe_duckdb_v2_copy_from_progress_get_user_data@
+hs_bindgen_ea17c550641c5981 ::
+     DuckDBV2CopyFromProgressInfoHandle
+  -> BG.Ptr (BG.Ptr BG.Void)
+  -> BG.Ptr DuckDBV2ErrorInfoHandle
+  -> IO DuckDBV2Error
+hs_bindgen_ea17c550641c5981 =
+  \x0 ->
+    \x1 ->
+      \x2 ->
+        fmap BG.fromFFIType (hs_bindgen_ea17c550641c5981_base (BG.toFFIType x0) (BG.toFFIType x1) (BG.toFFIType x2))
+
+{-| __C declaration:__ @duckdb_v2_copy_from_progress_get_user_data@
+
+    __defined at:__ @duckdb_v2.h 7681:30@
+
+    __exported by:__ @duckdb_v2.h@
+-}
+c_duckdb_v2_copy_from_progress_get_user_data ::
+     DuckDBV2CopyFromProgressInfoHandle
+     -- ^ __C declaration:__ @info@
+  -> BG.Ptr (BG.Ptr BG.Void)
+     -- ^ __C declaration:__ @data@
+  -> BG.Ptr DuckDBV2ErrorInfoHandle
+     -- ^ __C declaration:__ @err@
+  -> IO DuckDBV2Error
+c_duckdb_v2_copy_from_progress_get_user_data =
+  hs_bindgen_ea17c550641c5981
+
+-- __unique:__ @Database_DuckDB_FFI_V2_Database.DuckDB.FFI.V2_Safe_duckdb_v2_copy_from_progress_get_bind_data@
+foreign import ccall safe "hs_bindgen_da9a29284de389b6" hs_bindgen_da9a29284de389b6_base ::
+     BG.Ptr BG.Void
+  -> BG.Ptr BG.Void
+  -> BG.Ptr BG.Void
+  -> IO BG.CUInt
+
+-- __unique:__ @Database_DuckDB_FFI_V2_Database.DuckDB.FFI.V2_Safe_duckdb_v2_copy_from_progress_get_bind_data@
+hs_bindgen_da9a29284de389b6 ::
+     DuckDBV2CopyFromProgressInfoHandle
+  -> BG.Ptr (BG.Ptr BG.Void)
+  -> BG.Ptr DuckDBV2ErrorInfoHandle
+  -> IO DuckDBV2Error
+hs_bindgen_da9a29284de389b6 =
+  \x0 ->
+    \x1 ->
+      \x2 ->
+        fmap BG.fromFFIType (hs_bindgen_da9a29284de389b6_base (BG.toFFIType x0) (BG.toFFIType x1) (BG.toFFIType x2))
+
+{-| __C declaration:__ @duckdb_v2_copy_from_progress_get_bind_data@
+
+    __defined at:__ @duckdb_v2.h 7698:30@
+
+    __exported by:__ @duckdb_v2.h@
+-}
+c_duckdb_v2_copy_from_progress_get_bind_data ::
+     DuckDBV2CopyFromProgressInfoHandle
+     -- ^ __C declaration:__ @info@
+  -> BG.Ptr (BG.Ptr BG.Void)
+     -- ^ __C declaration:__ @data@
+  -> BG.Ptr DuckDBV2ErrorInfoHandle
+     -- ^ __C declaration:__ @err@
+  -> IO DuckDBV2Error
+c_duckdb_v2_copy_from_progress_get_bind_data =
+  hs_bindgen_da9a29284de389b6
+
+-- __unique:__ @Database_DuckDB_FFI_V2_Database.DuckDB.FFI.V2_Safe_duckdb_v2_copy_from_progress_get_global_state@
+foreign import ccall safe "hs_bindgen_5515b2cbe7220255" hs_bindgen_5515b2cbe7220255_base ::
+     BG.Ptr BG.Void
+  -> BG.Ptr BG.Void
+  -> BG.Ptr BG.Void
+  -> IO BG.CUInt
+
+-- __unique:__ @Database_DuckDB_FFI_V2_Database.DuckDB.FFI.V2_Safe_duckdb_v2_copy_from_progress_get_global_state@
+hs_bindgen_5515b2cbe7220255 ::
+     DuckDBV2CopyFromProgressInfoHandle
+  -> BG.Ptr (BG.Ptr BG.Void)
+  -> BG.Ptr DuckDBV2ErrorInfoHandle
+  -> IO DuckDBV2Error
+hs_bindgen_5515b2cbe7220255 =
+  \x0 ->
+    \x1 ->
+      \x2 ->
+        fmap BG.fromFFIType (hs_bindgen_5515b2cbe7220255_base (BG.toFFIType x0) (BG.toFFIType x1) (BG.toFFIType x2))
+
+{-| __C declaration:__ @duckdb_v2_copy_from_progress_get_global_state@
+
+    __defined at:__ @duckdb_v2.h 7718:30@
+
+    __exported by:__ @duckdb_v2.h@
+-}
+c_duckdb_v2_copy_from_progress_get_global_state ::
+     DuckDBV2CopyFromProgressInfoHandle
+     -- ^ __C declaration:__ @info@
+  -> BG.Ptr (BG.Ptr BG.Void)
+     -- ^ __C declaration:__ @data@
+  -> BG.Ptr DuckDBV2ErrorInfoHandle
+     -- ^ __C declaration:__ @err@
+  -> IO DuckDBV2Error
+c_duckdb_v2_copy_from_progress_get_global_state =
+  hs_bindgen_5515b2cbe7220255
+
+-- __unique:__ @Database_DuckDB_FFI_V2_Database.DuckDB.FFI.V2_Safe_duckdb_v2_copy_from_progress_set_progress@
+foreign import ccall safe "hs_bindgen_fb3589bcc060b4d5" hs_bindgen_fb3589bcc060b4d5_base ::
+     BG.Ptr BG.Void
+  -> BG.CDouble
+  -> BG.Ptr BG.Void
+  -> IO BG.CUInt
+
+-- __unique:__ @Database_DuckDB_FFI_V2_Database.DuckDB.FFI.V2_Safe_duckdb_v2_copy_from_progress_set_progress@
+hs_bindgen_fb3589bcc060b4d5 ::
+     DuckDBV2CopyFromProgressInfoHandle
+  -> BG.CDouble
+  -> BG.Ptr DuckDBV2ErrorInfoHandle
+  -> IO DuckDBV2Error
+hs_bindgen_fb3589bcc060b4d5 =
+  \x0 ->
+    \x1 ->
+      \x2 ->
+        fmap BG.fromFFIType (hs_bindgen_fb3589bcc060b4d5_base (BG.toFFIType x0) (BG.toFFIType x1) (BG.toFFIType x2))
+
+{-| __C declaration:__ @duckdb_v2_copy_from_progress_set_progress@
+
+    __defined at:__ @duckdb_v2.h 7738:30@
+
+    __exported by:__ @duckdb_v2.h@
+-}
+c_duckdb_v2_copy_from_progress_set_progress ::
+     DuckDBV2CopyFromProgressInfoHandle
+     -- ^ __C declaration:__ @info@
+  -> BG.CDouble
+     -- ^ __C declaration:__ @progress@
+  -> BG.Ptr DuckDBV2ErrorInfoHandle
+     -- ^ __C declaration:__ @err@
+  -> IO DuckDBV2Error
+c_duckdb_v2_copy_from_progress_set_progress =
+  hs_bindgen_fb3589bcc060b4d5
+
+-- __unique:__ @Database_DuckDB_FFI_V2_Database.DuckDB.FFI.V2_Safe_duckdb_v2_connection_register_copy_function@
+foreign import ccall safe "hs_bindgen_9435150f1c60aa19" hs_bindgen_9435150f1c60aa19_base ::
+     BG.Ptr BG.Void
+  -> BG.Ptr BG.Void
+  -> BG.Ptr BG.Void
+  -> IO BG.CUInt
+
+-- __unique:__ @Database_DuckDB_FFI_V2_Database.DuckDB.FFI.V2_Safe_duckdb_v2_connection_register_copy_function@
+hs_bindgen_9435150f1c60aa19 ::
+     DuckDBV2ConnectionHandle
+  -> DuckDBV2CopyFunctionHandle
+  -> BG.Ptr DuckDBV2ErrorInfoHandle
+  -> IO DuckDBV2Error
+hs_bindgen_9435150f1c60aa19 =
+  \x0 ->
+    \x1 ->
+      \x2 ->
+        fmap BG.fromFFIType (hs_bindgen_9435150f1c60aa19_base (BG.toFFIType x0) (BG.toFFIType x1) (BG.toFFIType x2))
+
+{-| __C declaration:__ @duckdb_v2_connection_register_copy_function@
+
+    __defined at:__ @duckdb_v2.h 7764:30@
+
+    __exported by:__ @duckdb_v2.h@
+-}
+c_duckdb_v2_connection_register_copy_function ::
+     DuckDBV2ConnectionHandle
+     -- ^ __C declaration:__ @conn@
+  -> DuckDBV2CopyFunctionHandle
+     -- ^ __C declaration:__ @function@
+  -> BG.Ptr DuckDBV2ErrorInfoHandle
+     -- ^ __C declaration:__ @err@
+  -> IO DuckDBV2Error
+c_duckdb_v2_connection_register_copy_function =
+  hs_bindgen_9435150f1c60aa19
+
+-- __unique:__ @Database_DuckDB_FFI_V2_Database.DuckDB.FFI.V2_Safe_duckdb_v2_extension_register_copy_function@
+foreign import ccall safe "hs_bindgen_331b29a03d5f62fd" hs_bindgen_331b29a03d5f62fd_base ::
+     BG.Ptr BG.Void
+  -> BG.Ptr BG.Void
+  -> BG.Ptr BG.Void
+  -> IO BG.CUInt
+
+-- __unique:__ @Database_DuckDB_FFI_V2_Database.DuckDB.FFI.V2_Safe_duckdb_v2_extension_register_copy_function@
+hs_bindgen_331b29a03d5f62fd ::
+     DuckDBV2ExtensionHandle
+  -> DuckDBV2CopyFunctionHandle
+  -> BG.Ptr DuckDBV2ErrorInfoHandle
+  -> IO DuckDBV2Error
+hs_bindgen_331b29a03d5f62fd =
+  \x0 ->
+    \x1 ->
+      \x2 ->
+        fmap BG.fromFFIType (hs_bindgen_331b29a03d5f62fd_base (BG.toFFIType x0) (BG.toFFIType x1) (BG.toFFIType x2))
+
+{-| __C declaration:__ @duckdb_v2_extension_register_copy_function@
+
+    __defined at:__ @duckdb_v2.h 7789:30@
+
+    __exported by:__ @duckdb_v2.h@
+-}
+c_duckdb_v2_extension_register_copy_function ::
+     DuckDBV2ExtensionHandle
+     -- ^ __C declaration:__ @extension@
+  -> DuckDBV2CopyFunctionHandle
+     -- ^ __C declaration:__ @function@
+  -> BG.Ptr DuckDBV2ErrorInfoHandle
+     -- ^ __C declaration:__ @err@
+  -> IO DuckDBV2Error
+c_duckdb_v2_extension_register_copy_function =
+  hs_bindgen_331b29a03d5f62fd
+
+-- __unique:__ @Database_DuckDB_FFI_V2_Database.DuckDB.FFI.V2_Safe_duckdb_v2_copy_function_destroy@
+foreign import ccall safe "hs_bindgen_a36230d6e9c8fab5" hs_bindgen_a36230d6e9c8fab5_base ::
+     BG.Ptr BG.Void
+  -> IO BG.CUInt
+
+-- __unique:__ @Database_DuckDB_FFI_V2_Database.DuckDB.FFI.V2_Safe_duckdb_v2_copy_function_destroy@
+hs_bindgen_a36230d6e9c8fab5 ::
+     BG.Ptr DuckDBV2CopyFunctionHandle
+  -> IO DuckDBV2Error
+hs_bindgen_a36230d6e9c8fab5 =
+  \x0 ->
+    fmap BG.fromFFIType (hs_bindgen_a36230d6e9c8fab5_base (BG.toFFIType x0))
+
+{-| __C declaration:__ @duckdb_v2_copy_function_destroy@
+
+    __defined at:__ @duckdb_v2.h 7807:30@
+
+    __exported by:__ @duckdb_v2.h@
+-}
+c_duckdb_v2_copy_function_destroy ::
+     BG.Ptr DuckDBV2CopyFunctionHandle
+     -- ^ __C declaration:__ @function@
+  -> IO DuckDBV2Error
+c_duckdb_v2_copy_function_destroy =
+  hs_bindgen_a36230d6e9c8fab5
+
+-- __unique:__ @Database_DuckDB_FFI_V2_Database.DuckDB.FFI.V2_Safe_duckdb_v2_copy_to_set_statistics_callback@
+foreign import ccall safe "hs_bindgen_0356879db98ba3fc" hs_bindgen_0356879db98ba3fc_base ::
+     BG.Ptr BG.Void
+  -> BG.FunPtr BG.Void
+  -> BG.Ptr BG.Void
+  -> IO BG.CUInt
+
+-- __unique:__ @Database_DuckDB_FFI_V2_Database.DuckDB.FFI.V2_Safe_duckdb_v2_copy_to_set_statistics_callback@
+hs_bindgen_0356879db98ba3fc ::
+     DuckDBV2CopyFunctionHandle
+  -> DuckDBV2CopyToStatisticsCallbackFn
+  -> BG.Ptr DuckDBV2ErrorInfoHandle
+  -> IO DuckDBV2Error
+hs_bindgen_0356879db98ba3fc =
+  \x0 ->
+    \x1 ->
+      \x2 ->
+        fmap BG.fromFFIType (hs_bindgen_0356879db98ba3fc_base (BG.toFFIType x0) (BG.toFFIType x1) (BG.toFFIType x2))
+
+{-| __C declaration:__ @duckdb_v2_copy_to_set_statistics_callback@
+
+    __defined at:__ @duckdb_v2.h 7828:30@
+
+    __exported by:__ @duckdb_v2.h@
+-}
+c_duckdb_v2_copy_to_set_statistics_callback ::
+     DuckDBV2CopyFunctionHandle
+     -- ^ __C declaration:__ @function@
+  -> DuckDBV2CopyToStatisticsCallbackFn
+     -- ^ __C declaration:__ @callback@
+  -> BG.Ptr DuckDBV2ErrorInfoHandle
+     -- ^ __C declaration:__ @err@
+  -> IO DuckDBV2Error
+c_duckdb_v2_copy_to_set_statistics_callback =
+  hs_bindgen_0356879db98ba3fc
+
+-- __unique:__ @Database_DuckDB_FFI_V2_Database.DuckDB.FFI.V2_Safe_duckdb_v2_copy_to_statistics_get_user_data@
+foreign import ccall safe "hs_bindgen_52e52eb853fc599f" hs_bindgen_52e52eb853fc599f_base ::
+     BG.Ptr BG.Void
+  -> BG.Ptr BG.Void
+  -> BG.Ptr BG.Void
+  -> IO BG.CUInt
+
+-- __unique:__ @Database_DuckDB_FFI_V2_Database.DuckDB.FFI.V2_Safe_duckdb_v2_copy_to_statistics_get_user_data@
+hs_bindgen_52e52eb853fc599f ::
+     DuckDBV2CopyToStatisticsInfoHandle
+  -> BG.Ptr (BG.Ptr BG.Void)
+  -> BG.Ptr DuckDBV2ErrorInfoHandle
+  -> IO DuckDBV2Error
+hs_bindgen_52e52eb853fc599f =
+  \x0 ->
+    \x1 ->
+      \x2 ->
+        fmap BG.fromFFIType (hs_bindgen_52e52eb853fc599f_base (BG.toFFIType x0) (BG.toFFIType x1) (BG.toFFIType x2))
+
+{-| __C declaration:__ @duckdb_v2_copy_to_statistics_get_user_data@
+
+    __defined at:__ @duckdb_v2.h 7846:30@
+
+    __exported by:__ @duckdb_v2.h@
+-}
+c_duckdb_v2_copy_to_statistics_get_user_data ::
+     DuckDBV2CopyToStatisticsInfoHandle
+     -- ^ __C declaration:__ @info@
+  -> BG.Ptr (BG.Ptr BG.Void)
+     -- ^ __C declaration:__ @data@
+  -> BG.Ptr DuckDBV2ErrorInfoHandle
+     -- ^ __C declaration:__ @err@
+  -> IO DuckDBV2Error
+c_duckdb_v2_copy_to_statistics_get_user_data =
+  hs_bindgen_52e52eb853fc599f
+
+-- __unique:__ @Database_DuckDB_FFI_V2_Database.DuckDB.FFI.V2_Safe_duckdb_v2_copy_to_statistics_get_bind_data@
+foreign import ccall safe "hs_bindgen_85172ed21f6cdbcd" hs_bindgen_85172ed21f6cdbcd_base ::
+     BG.Ptr BG.Void
+  -> BG.Ptr BG.Void
+  -> BG.Ptr BG.Void
+  -> IO BG.CUInt
+
+-- __unique:__ @Database_DuckDB_FFI_V2_Database.DuckDB.FFI.V2_Safe_duckdb_v2_copy_to_statistics_get_bind_data@
+hs_bindgen_85172ed21f6cdbcd ::
+     DuckDBV2CopyToStatisticsInfoHandle
+  -> BG.Ptr (BG.Ptr BG.Void)
+  -> BG.Ptr DuckDBV2ErrorInfoHandle
+  -> IO DuckDBV2Error
+hs_bindgen_85172ed21f6cdbcd =
+  \x0 ->
+    \x1 ->
+      \x2 ->
+        fmap BG.fromFFIType (hs_bindgen_85172ed21f6cdbcd_base (BG.toFFIType x0) (BG.toFFIType x1) (BG.toFFIType x2))
+
+{-| __C declaration:__ @duckdb_v2_copy_to_statistics_get_bind_data@
+
+    __defined at:__ @duckdb_v2.h 7863:30@
+
+    __exported by:__ @duckdb_v2.h@
+-}
+c_duckdb_v2_copy_to_statistics_get_bind_data ::
+     DuckDBV2CopyToStatisticsInfoHandle
+     -- ^ __C declaration:__ @info@
+  -> BG.Ptr (BG.Ptr BG.Void)
+     -- ^ __C declaration:__ @data@
+  -> BG.Ptr DuckDBV2ErrorInfoHandle
+     -- ^ __C declaration:__ @err@
+  -> IO DuckDBV2Error
+c_duckdb_v2_copy_to_statistics_get_bind_data =
+  hs_bindgen_85172ed21f6cdbcd
+
+-- __unique:__ @Database_DuckDB_FFI_V2_Database.DuckDB.FFI.V2_Safe_duckdb_v2_copy_to_statistics_get_init_data@
+foreign import ccall safe "hs_bindgen_a8aaaca8bd785940" hs_bindgen_a8aaaca8bd785940_base ::
+     BG.Ptr BG.Void
+  -> BG.Ptr BG.Void
+  -> BG.Ptr BG.Void
+  -> IO BG.CUInt
+
+-- __unique:__ @Database_DuckDB_FFI_V2_Database.DuckDB.FFI.V2_Safe_duckdb_v2_copy_to_statistics_get_init_data@
+hs_bindgen_a8aaaca8bd785940 ::
+     DuckDBV2CopyToStatisticsInfoHandle
+  -> BG.Ptr (BG.Ptr BG.Void)
+  -> BG.Ptr DuckDBV2ErrorInfoHandle
+  -> IO DuckDBV2Error
+hs_bindgen_a8aaaca8bd785940 =
+  \x0 ->
+    \x1 ->
+      \x2 ->
+        fmap BG.fromFFIType (hs_bindgen_a8aaaca8bd785940_base (BG.toFFIType x0) (BG.toFFIType x1) (BG.toFFIType x2))
+
+{-| __C declaration:__ @duckdb_v2_copy_to_statistics_get_init_data@
+
+    __defined at:__ @duckdb_v2.h 7880:30@
+
+    __exported by:__ @duckdb_v2.h@
+-}
+c_duckdb_v2_copy_to_statistics_get_init_data ::
+     DuckDBV2CopyToStatisticsInfoHandle
+     -- ^ __C declaration:__ @info@
+  -> BG.Ptr (BG.Ptr BG.Void)
+     -- ^ __C declaration:__ @data@
+  -> BG.Ptr DuckDBV2ErrorInfoHandle
+     -- ^ __C declaration:__ @err@
+  -> IO DuckDBV2Error
+c_duckdb_v2_copy_to_statistics_get_init_data =
+  hs_bindgen_a8aaaca8bd785940
+
+-- __unique:__ @Database_DuckDB_FFI_V2_Database.DuckDB.FFI.V2_Safe_duckdb_v2_copy_to_statistics_set_row_count@
+foreign import ccall safe "hs_bindgen_b368f75210bde589" hs_bindgen_b368f75210bde589_base ::
+     BG.Ptr BG.Void
+  -> HsBindgen.Runtime.LibC.Word64
+  -> BG.Ptr BG.Void
+  -> IO BG.CUInt
+
+-- __unique:__ @Database_DuckDB_FFI_V2_Database.DuckDB.FFI.V2_Safe_duckdb_v2_copy_to_statistics_set_row_count@
+hs_bindgen_b368f75210bde589 ::
+     DuckDBV2CopyToStatisticsInfoHandle
+  -> DuckDBIdx
+  -> BG.Ptr DuckDBV2ErrorInfoHandle
+  -> IO DuckDBV2Error
+hs_bindgen_b368f75210bde589 =
+  \x0 ->
+    \x1 ->
+      \x2 ->
+        fmap BG.fromFFIType (hs_bindgen_b368f75210bde589_base (BG.toFFIType x0) (BG.toFFIType x1) (BG.toFFIType x2))
+
+{-| __C declaration:__ @duckdb_v2_copy_to_statistics_set_row_count@
+
+    __defined at:__ @duckdb_v2.h 7897:30@
+
+    __exported by:__ @duckdb_v2.h@
+-}
+c_duckdb_v2_copy_to_statistics_set_row_count ::
+     DuckDBV2CopyToStatisticsInfoHandle
+     -- ^ __C declaration:__ @info@
+  -> DuckDBIdx
+     -- ^ __C declaration:__ @row_count@
+  -> BG.Ptr DuckDBV2ErrorInfoHandle
+     -- ^ __C declaration:__ @err@
+  -> IO DuckDBV2Error
+c_duckdb_v2_copy_to_statistics_set_row_count =
+  hs_bindgen_b368f75210bde589
+
+-- __unique:__ @Database_DuckDB_FFI_V2_Database.DuckDB.FFI.V2_Safe_duckdb_v2_copy_to_statistics_set_file_size@
+foreign import ccall safe "hs_bindgen_abea998929c6469b" hs_bindgen_abea998929c6469b_base ::
+     BG.Ptr BG.Void
+  -> HsBindgen.Runtime.LibC.Word64
+  -> BG.Ptr BG.Void
+  -> IO BG.CUInt
+
+-- __unique:__ @Database_DuckDB_FFI_V2_Database.DuckDB.FFI.V2_Safe_duckdb_v2_copy_to_statistics_set_file_size@
+hs_bindgen_abea998929c6469b ::
+     DuckDBV2CopyToStatisticsInfoHandle
+  -> DuckDBIdx
+  -> BG.Ptr DuckDBV2ErrorInfoHandle
+  -> IO DuckDBV2Error
+hs_bindgen_abea998929c6469b =
+  \x0 ->
+    \x1 ->
+      \x2 ->
+        fmap BG.fromFFIType (hs_bindgen_abea998929c6469b_base (BG.toFFIType x0) (BG.toFFIType x1) (BG.toFFIType x2))
+
+{-| __C declaration:__ @duckdb_v2_copy_to_statistics_set_file_size@
+
+    __defined at:__ @duckdb_v2.h 7915:30@
+
+    __exported by:__ @duckdb_v2.h@
+-}
+c_duckdb_v2_copy_to_statistics_set_file_size ::
+     DuckDBV2CopyToStatisticsInfoHandle
+     -- ^ __C declaration:__ @info@
+  -> DuckDBIdx
+     -- ^ __C declaration:__ @file_size_bytes@
+  -> BG.Ptr DuckDBV2ErrorInfoHandle
+     -- ^ __C declaration:__ @err@
+  -> IO DuckDBV2Error
+c_duckdb_v2_copy_to_statistics_set_file_size =
+  hs_bindgen_abea998929c6469b
+
+-- __unique:__ @Database_DuckDB_FFI_V2_Database.DuckDB.FFI.V2_Safe_duckdb_v2_custom_option_create@
+foreign import ccall safe "hs_bindgen_75eb1ceeec8f3516" hs_bindgen_75eb1ceeec8f3516_base ::
+     BG.Ptr BG.Void
+  -> BG.Ptr BG.Void
+  -> BG.Ptr BG.Void
+  -> IO BG.CUInt
+
+-- __unique:__ @Database_DuckDB_FFI_V2_Database.DuckDB.FFI.V2_Safe_duckdb_v2_custom_option_create@
+hs_bindgen_75eb1ceeec8f3516 ::
+     DuckDBV2FactoryHandle
+  -> BG.Ptr DuckDBV2CustomOptionHandle
+  -> BG.Ptr DuckDBV2ErrorInfoHandle
+  -> IO DuckDBV2Error
+hs_bindgen_75eb1ceeec8f3516 =
+  \x0 ->
+    \x1 ->
+      \x2 ->
+        fmap BG.fromFFIType (hs_bindgen_75eb1ceeec8f3516_base (BG.toFFIType x0) (BG.toFFIType x1) (BG.toFFIType x2))
+
+{-| __C declaration:__ @duckdb_v2_custom_option_create@
+
+    __defined at:__ @duckdb_v2.h 7979:30@
+
+    __exported by:__ @duckdb_v2.h@
+-}
+c_duckdb_v2_custom_option_create ::
+     DuckDBV2FactoryHandle
+     -- ^ __C declaration:__ @factory@
+  -> BG.Ptr DuckDBV2CustomOptionHandle
+     -- ^ __C declaration:__ @option@
+  -> BG.Ptr DuckDBV2ErrorInfoHandle
+     -- ^ __C declaration:__ @err@
+  -> IO DuckDBV2Error
+c_duckdb_v2_custom_option_create =
+  hs_bindgen_75eb1ceeec8f3516
+
+-- __unique:__ @Database_DuckDB_FFI_V2_Database.DuckDB.FFI.V2_Safe_duckdb_v2_custom_option_set_name@
+foreign import ccall safe "hs_bindgen_9ab1bf28e6b1dd85" hs_bindgen_9ab1bf28e6b1dd85_base ::
+     BG.Ptr BG.Void
+  -> BG.Ptr BG.Void
+  -> BG.Ptr BG.Void
+  -> IO BG.CUInt
+
+-- __unique:__ @Database_DuckDB_FFI_V2_Database.DuckDB.FFI.V2_Safe_duckdb_v2_custom_option_set_name@
+hs_bindgen_9ab1bf28e6b1dd85 ::
+     DuckDBV2CustomOptionHandle
+  -> PtrConst.PtrConst DuckDBV2IdentifierT
+  -> BG.Ptr DuckDBV2ErrorInfoHandle
+  -> IO DuckDBV2Error
+hs_bindgen_9ab1bf28e6b1dd85 =
+  \x0 ->
+    \x1 ->
+      \x2 ->
+        fmap BG.fromFFIType (hs_bindgen_9ab1bf28e6b1dd85_base (BG.toFFIType x0) (BG.toFFIType x1) (BG.toFFIType x2))
+
+{-| __C declaration:__ @duckdb_v2_custom_option_set_name@
+
+    __defined at:__ @duckdb_v2.h 8000:30@
+
+    __exported by:__ @duckdb_v2.h@
+-}
+c_duckdb_v2_custom_option_set_name ::
+     DuckDBV2CustomOptionHandle
+     -- ^ __C declaration:__ @option@
+  -> PtrConst.PtrConst DuckDBV2IdentifierT
+     -- ^ __C declaration:__ @name@
+  -> BG.Ptr DuckDBV2ErrorInfoHandle
+     -- ^ __C declaration:__ @err@
+  -> IO DuckDBV2Error
+c_duckdb_v2_custom_option_set_name =
+  hs_bindgen_9ab1bf28e6b1dd85
+
+-- __unique:__ @Database_DuckDB_FFI_V2_Database.DuckDB.FFI.V2_Safe_duckdb_v2_custom_option_set_type@
+foreign import ccall safe "hs_bindgen_f9a091e8b7254362" hs_bindgen_f9a091e8b7254362_base ::
+     BG.Ptr BG.Void
+  -> BG.Ptr BG.Void
+  -> BG.Ptr BG.Void
+  -> IO BG.CUInt
+
+-- __unique:__ @Database_DuckDB_FFI_V2_Database.DuckDB.FFI.V2_Safe_duckdb_v2_custom_option_set_type@
+hs_bindgen_f9a091e8b7254362 ::
+     DuckDBV2CustomOptionHandle
+  -> DuckDBV2LogicalTypeHandle
+  -> BG.Ptr DuckDBV2ErrorInfoHandle
+  -> IO DuckDBV2Error
+hs_bindgen_f9a091e8b7254362 =
+  \x0 ->
+    \x1 ->
+      \x2 ->
+        fmap BG.fromFFIType (hs_bindgen_f9a091e8b7254362_base (BG.toFFIType x0) (BG.toFFIType x1) (BG.toFFIType x2))
+
+{-| __C declaration:__ @duckdb_v2_custom_option_set_type@
+
+    __defined at:__ @duckdb_v2.h 8020:30@
+
+    __exported by:__ @duckdb_v2.h@
+-}
+c_duckdb_v2_custom_option_set_type ::
+     DuckDBV2CustomOptionHandle
+     -- ^ __C declaration:__ @option@
+  -> DuckDBV2LogicalTypeHandle
+     -- ^ __C declaration:__ @type@
+  -> BG.Ptr DuckDBV2ErrorInfoHandle
+     -- ^ __C declaration:__ @err@
+  -> IO DuckDBV2Error
+c_duckdb_v2_custom_option_set_type =
+  hs_bindgen_f9a091e8b7254362
+
+-- __unique:__ @Database_DuckDB_FFI_V2_Database.DuckDB.FFI.V2_Safe_duckdb_v2_custom_option_set_default_value@
+foreign import ccall safe "hs_bindgen_8b1bd2012b18e856" hs_bindgen_8b1bd2012b18e856_base ::
+     BG.Ptr BG.Void
+  -> BG.Ptr BG.Void
+  -> BG.Ptr BG.Void
+  -> IO BG.CUInt
+
+-- __unique:__ @Database_DuckDB_FFI_V2_Database.DuckDB.FFI.V2_Safe_duckdb_v2_custom_option_set_default_value@
+hs_bindgen_8b1bd2012b18e856 ::
+     DuckDBV2CustomOptionHandle
+  -> DuckDBV2ValueHandle
+  -> BG.Ptr DuckDBV2ErrorInfoHandle
+  -> IO DuckDBV2Error
+hs_bindgen_8b1bd2012b18e856 =
+  \x0 ->
+    \x1 ->
+      \x2 ->
+        fmap BG.fromFFIType (hs_bindgen_8b1bd2012b18e856_base (BG.toFFIType x0) (BG.toFFIType x1) (BG.toFFIType x2))
+
+{-| __C declaration:__ @duckdb_v2_custom_option_set_default_value@
+
+    __defined at:__ @duckdb_v2.h 8041:30@
+
+    __exported by:__ @duckdb_v2.h@
+-}
+c_duckdb_v2_custom_option_set_default_value ::
+     DuckDBV2CustomOptionHandle
+     -- ^ __C declaration:__ @option@
+  -> DuckDBV2ValueHandle
+     -- ^ __C declaration:__ @value@
+  -> BG.Ptr DuckDBV2ErrorInfoHandle
+     -- ^ __C declaration:__ @err@
+  -> IO DuckDBV2Error
+c_duckdb_v2_custom_option_set_default_value =
+  hs_bindgen_8b1bd2012b18e856
+
+-- __unique:__ @Database_DuckDB_FFI_V2_Database.DuckDB.FFI.V2_Safe_duckdb_v2_custom_option_set_description@
+foreign import ccall safe "hs_bindgen_3e3600b5ab808934" hs_bindgen_3e3600b5ab808934_base ::
+     BG.Ptr BG.Void
+  -> BG.Ptr BG.Void
+  -> BG.Ptr BG.Void
+  -> IO BG.CUInt
+
+-- __unique:__ @Database_DuckDB_FFI_V2_Database.DuckDB.FFI.V2_Safe_duckdb_v2_custom_option_set_description@
+hs_bindgen_3e3600b5ab808934 ::
+     DuckDBV2CustomOptionHandle
+  -> PtrConst.PtrConst DuckDBV2Str
+  -> BG.Ptr DuckDBV2ErrorInfoHandle
+  -> IO DuckDBV2Error
+hs_bindgen_3e3600b5ab808934 =
+  \x0 ->
+    \x1 ->
+      \x2 ->
+        fmap BG.fromFFIType (hs_bindgen_3e3600b5ab808934_base (BG.toFFIType x0) (BG.toFFIType x1) (BG.toFFIType x2))
+
+{-| __C declaration:__ @duckdb_v2_custom_option_set_description@
+
+    __defined at:__ @duckdb_v2.h 8061:30@
+
+    __exported by:__ @duckdb_v2.h@
+-}
+c_duckdb_v2_custom_option_set_description ::
+     DuckDBV2CustomOptionHandle
+     -- ^ __C declaration:__ @option@
+  -> PtrConst.PtrConst DuckDBV2Str
+     -- ^ __C declaration:__ @description@
+  -> BG.Ptr DuckDBV2ErrorInfoHandle
+     -- ^ __C declaration:__ @err@
+  -> IO DuckDBV2Error
+c_duckdb_v2_custom_option_set_description =
+  hs_bindgen_3e3600b5ab808934
+
+-- __unique:__ @Database_DuckDB_FFI_V2_Database.DuckDB.FFI.V2_Safe_duckdb_v2_custom_option_set_default_scope@
+foreign import ccall safe "hs_bindgen_a9e19e0203102b31" hs_bindgen_a9e19e0203102b31_base ::
+     BG.Ptr BG.Void
+  -> BG.CUInt
+  -> BG.Ptr BG.Void
+  -> IO BG.CUInt
+
+-- __unique:__ @Database_DuckDB_FFI_V2_Database.DuckDB.FFI.V2_Safe_duckdb_v2_custom_option_set_default_scope@
+hs_bindgen_a9e19e0203102b31 ::
+     DuckDBV2CustomOptionHandle
+  -> DuckDBV2SettingScope
+  -> BG.Ptr DuckDBV2ErrorInfoHandle
+  -> IO DuckDBV2Error
+hs_bindgen_a9e19e0203102b31 =
+  \x0 ->
+    \x1 ->
+      \x2 ->
+        fmap BG.fromFFIType (hs_bindgen_a9e19e0203102b31_base (BG.toFFIType x0) (BG.toFFIType x1) (BG.toFFIType x2))
+
+{-| __C declaration:__ @duckdb_v2_custom_option_set_default_scope@
+
+    __defined at:__ @duckdb_v2.h 8082:30@
+
+    __exported by:__ @duckdb_v2.h@
+-}
+c_duckdb_v2_custom_option_set_default_scope ::
+     DuckDBV2CustomOptionHandle
+     -- ^ __C declaration:__ @option@
+  -> DuckDBV2SettingScope
+     -- ^ __C declaration:__ @scope@
+  -> BG.Ptr DuckDBV2ErrorInfoHandle
+     -- ^ __C declaration:__ @err@
+  -> IO DuckDBV2Error
+c_duckdb_v2_custom_option_set_default_scope =
+  hs_bindgen_a9e19e0203102b31
+
+-- __unique:__ @Database_DuckDB_FFI_V2_Database.DuckDB.FFI.V2_Safe_duckdb_v2_custom_option_set_supports_scope@
+foreign import ccall safe "hs_bindgen_ed63d573db6c901c" hs_bindgen_ed63d573db6c901c_base ::
+     BG.Ptr BG.Void
+  -> BG.CUInt
+  -> BG.CBool
+  -> BG.Ptr BG.Void
+  -> IO BG.CUInt
+
+-- __unique:__ @Database_DuckDB_FFI_V2_Database.DuckDB.FFI.V2_Safe_duckdb_v2_custom_option_set_supports_scope@
+hs_bindgen_ed63d573db6c901c ::
+     DuckDBV2CustomOptionHandle
+  -> DuckDBV2SettingScope
+  -> BG.CBool
+  -> BG.Ptr DuckDBV2ErrorInfoHandle
+  -> IO DuckDBV2Error
+hs_bindgen_ed63d573db6c901c =
+  \x0 ->
+    \x1 ->
+      \x2 ->
+        \x3 ->
+          fmap BG.fromFFIType (hs_bindgen_ed63d573db6c901c_base (BG.toFFIType x0) (BG.toFFIType x1) (BG.toFFIType x2) (BG.toFFIType x3))
+
+{-| __C declaration:__ @duckdb_v2_custom_option_set_supports_scope@
+
+    __defined at:__ @duckdb_v2.h 8104:30@
+
+    __exported by:__ @duckdb_v2.h@
+-}
+c_duckdb_v2_custom_option_set_supports_scope ::
+     DuckDBV2CustomOptionHandle
+     -- ^ __C declaration:__ @option@
+  -> DuckDBV2SettingScope
+     -- ^ __C declaration:__ @scope@
+  -> BG.CBool
+     -- ^ __C declaration:__ @supported@
+  -> BG.Ptr DuckDBV2ErrorInfoHandle
+     -- ^ __C declaration:__ @err@
+  -> IO DuckDBV2Error
+c_duckdb_v2_custom_option_set_supports_scope =
+  hs_bindgen_ed63d573db6c901c
+
+-- __unique:__ @Database_DuckDB_FFI_V2_Database.DuckDB.FFI.V2_Safe_duckdb_v2_custom_option_set_user_data@
+foreign import ccall safe "hs_bindgen_c05c2e5fc7802f0b" hs_bindgen_c05c2e5fc7802f0b_base ::
+     BG.Ptr BG.Void
+  -> BG.Ptr BG.Void
+  -> BG.Ptr BG.Void
+  -> IO BG.CUInt
+
+-- __unique:__ @Database_DuckDB_FFI_V2_Database.DuckDB.FFI.V2_Safe_duckdb_v2_custom_option_set_user_data@
+hs_bindgen_c05c2e5fc7802f0b ::
+     DuckDBV2CustomOptionHandle
+  -> BG.Ptr DuckDBV2Opaque
+  -> BG.Ptr DuckDBV2ErrorInfoHandle
+  -> IO DuckDBV2Error
+hs_bindgen_c05c2e5fc7802f0b =
+  \x0 ->
+    \x1 ->
+      \x2 ->
+        fmap BG.fromFFIType (hs_bindgen_c05c2e5fc7802f0b_base (BG.toFFIType x0) (BG.toFFIType x1) (BG.toFFIType x2))
+
+{-| __C declaration:__ @duckdb_v2_custom_option_set_user_data@
+
+    __defined at:__ @duckdb_v2.h 8127:30@
+
+    __exported by:__ @duckdb_v2.h@
+-}
+c_duckdb_v2_custom_option_set_user_data ::
+     DuckDBV2CustomOptionHandle
+     -- ^ __C declaration:__ @option@
+  -> BG.Ptr DuckDBV2Opaque
+     -- ^ __C declaration:__ @data@
+  -> BG.Ptr DuckDBV2ErrorInfoHandle
+     -- ^ __C declaration:__ @err@
+  -> IO DuckDBV2Error
+c_duckdb_v2_custom_option_set_user_data =
+  hs_bindgen_c05c2e5fc7802f0b
+
+-- __unique:__ @Database_DuckDB_FFI_V2_Database.DuckDB.FFI.V2_Safe_duckdb_v2_custom_option_set_update_callback@
+foreign import ccall safe "hs_bindgen_32ea8d6514b8867b" hs_bindgen_32ea8d6514b8867b_base ::
+     BG.Ptr BG.Void
+  -> BG.FunPtr BG.Void
+  -> BG.Ptr BG.Void
+  -> IO BG.CUInt
+
+-- __unique:__ @Database_DuckDB_FFI_V2_Database.DuckDB.FFI.V2_Safe_duckdb_v2_custom_option_set_update_callback@
+hs_bindgen_32ea8d6514b8867b ::
+     DuckDBV2CustomOptionHandle
+  -> DuckDBV2CustomOptionUpdateCallbackFn
+  -> BG.Ptr DuckDBV2ErrorInfoHandle
+  -> IO DuckDBV2Error
+hs_bindgen_32ea8d6514b8867b =
+  \x0 ->
+    \x1 ->
+      \x2 ->
+        fmap BG.fromFFIType (hs_bindgen_32ea8d6514b8867b_base (BG.toFFIType x0) (BG.toFFIType x1) (BG.toFFIType x2))
+
+{-| __C declaration:__ @duckdb_v2_custom_option_set_update_callback@
+
+    __defined at:__ @duckdb_v2.h 8150:30@
+
+    __exported by:__ @duckdb_v2.h@
+-}
+c_duckdb_v2_custom_option_set_update_callback ::
+     DuckDBV2CustomOptionHandle
+     -- ^ __C declaration:__ @option@
+  -> DuckDBV2CustomOptionUpdateCallbackFn
+     -- ^ __C declaration:__ @callback@
+  -> BG.Ptr DuckDBV2ErrorInfoHandle
+     -- ^ __C declaration:__ @err@
+  -> IO DuckDBV2Error
+c_duckdb_v2_custom_option_set_update_callback =
+  hs_bindgen_32ea8d6514b8867b
+
+-- __unique:__ @Database_DuckDB_FFI_V2_Database.DuckDB.FFI.V2_Safe_duckdb_v2_custom_option_update_get_user_data@
+foreign import ccall safe "hs_bindgen_683786e2ba5d7815" hs_bindgen_683786e2ba5d7815_base ::
+     BG.Ptr BG.Void
+  -> BG.Ptr BG.Void
+  -> BG.Ptr BG.Void
+  -> IO BG.CUInt
+
+-- __unique:__ @Database_DuckDB_FFI_V2_Database.DuckDB.FFI.V2_Safe_duckdb_v2_custom_option_update_get_user_data@
+hs_bindgen_683786e2ba5d7815 ::
+     DuckDBV2CustomOptionUpdateInfoHandle
+  -> BG.Ptr (BG.Ptr BG.Void)
+  -> BG.Ptr DuckDBV2ErrorInfoHandle
+  -> IO DuckDBV2Error
+hs_bindgen_683786e2ba5d7815 =
+  \x0 ->
+    \x1 ->
+      \x2 ->
+        fmap BG.fromFFIType (hs_bindgen_683786e2ba5d7815_base (BG.toFFIType x0) (BG.toFFIType x1) (BG.toFFIType x2))
+
+{-| __C declaration:__ @duckdb_v2_custom_option_update_get_user_data@
+
+    __defined at:__ @duckdb_v2.h 8168:30@
+
+    __exported by:__ @duckdb_v2.h@
+-}
+c_duckdb_v2_custom_option_update_get_user_data ::
+     DuckDBV2CustomOptionUpdateInfoHandle
+     -- ^ __C declaration:__ @info@
+  -> BG.Ptr (BG.Ptr BG.Void)
+     -- ^ __C declaration:__ @data@
+  -> BG.Ptr DuckDBV2ErrorInfoHandle
+     -- ^ __C declaration:__ @err@
+  -> IO DuckDBV2Error
+c_duckdb_v2_custom_option_update_get_user_data =
+  hs_bindgen_683786e2ba5d7815
+
+-- __unique:__ @Database_DuckDB_FFI_V2_Database.DuckDB.FFI.V2_Safe_duckdb_v2_custom_option_update_get_value@
+foreign import ccall safe "hs_bindgen_0f00bbef3aa4bcee" hs_bindgen_0f00bbef3aa4bcee_base ::
+     BG.Ptr BG.Void
+  -> BG.Ptr BG.Void
+  -> BG.Ptr BG.Void
+  -> IO BG.CUInt
+
+-- __unique:__ @Database_DuckDB_FFI_V2_Database.DuckDB.FFI.V2_Safe_duckdb_v2_custom_option_update_get_value@
+hs_bindgen_0f00bbef3aa4bcee ::
+     DuckDBV2CustomOptionUpdateInfoHandle
+  -> BG.Ptr DuckDBV2ValueHandle
+  -> BG.Ptr DuckDBV2ErrorInfoHandle
+  -> IO DuckDBV2Error
+hs_bindgen_0f00bbef3aa4bcee =
+  \x0 ->
+    \x1 ->
+      \x2 ->
+        fmap BG.fromFFIType (hs_bindgen_0f00bbef3aa4bcee_base (BG.toFFIType x0) (BG.toFFIType x1) (BG.toFFIType x2))
+
+{-| __C declaration:__ @duckdb_v2_custom_option_update_get_value@
+
+    __defined at:__ @duckdb_v2.h 8187:30@
+
+    __exported by:__ @duckdb_v2.h@
+-}
+c_duckdb_v2_custom_option_update_get_value ::
+     DuckDBV2CustomOptionUpdateInfoHandle
+     -- ^ __C declaration:__ @info@
+  -> BG.Ptr DuckDBV2ValueHandle
+     -- ^ __C declaration:__ @value@
+  -> BG.Ptr DuckDBV2ErrorInfoHandle
+     -- ^ __C declaration:__ @err@
+  -> IO DuckDBV2Error
+c_duckdb_v2_custom_option_update_get_value =
+  hs_bindgen_0f00bbef3aa4bcee
+
+-- __unique:__ @Database_DuckDB_FFI_V2_Database.DuckDB.FFI.V2_Safe_duckdb_v2_custom_option_update_set_value@
+foreign import ccall safe "hs_bindgen_7327534204ca5be8" hs_bindgen_7327534204ca5be8_base ::
+     BG.Ptr BG.Void
+  -> BG.Ptr BG.Void
+  -> BG.Ptr BG.Void
+  -> IO BG.CUInt
+
+-- __unique:__ @Database_DuckDB_FFI_V2_Database.DuckDB.FFI.V2_Safe_duckdb_v2_custom_option_update_set_value@
+hs_bindgen_7327534204ca5be8 ::
+     DuckDBV2CustomOptionUpdateInfoHandle
+  -> DuckDBV2ValueHandle
+  -> BG.Ptr DuckDBV2ErrorInfoHandle
+  -> IO DuckDBV2Error
+hs_bindgen_7327534204ca5be8 =
+  \x0 ->
+    \x1 ->
+      \x2 ->
+        fmap BG.fromFFIType (hs_bindgen_7327534204ca5be8_base (BG.toFFIType x0) (BG.toFFIType x1) (BG.toFFIType x2))
+
+{-| __C declaration:__ @duckdb_v2_custom_option_update_set_value@
+
+    __defined at:__ @duckdb_v2.h 8206:30@
+
+    __exported by:__ @duckdb_v2.h@
+-}
+c_duckdb_v2_custom_option_update_set_value ::
+     DuckDBV2CustomOptionUpdateInfoHandle
+     -- ^ __C declaration:__ @info@
+  -> DuckDBV2ValueHandle
+     -- ^ __C declaration:__ @value@
+  -> BG.Ptr DuckDBV2ErrorInfoHandle
+     -- ^ __C declaration:__ @err@
+  -> IO DuckDBV2Error
+c_duckdb_v2_custom_option_update_set_value =
+  hs_bindgen_7327534204ca5be8
+
+-- __unique:__ @Database_DuckDB_FFI_V2_Database.DuckDB.FFI.V2_Safe_duckdb_v2_custom_option_update_get_scope@
+foreign import ccall safe "hs_bindgen_51867bf9028193d3" hs_bindgen_51867bf9028193d3_base ::
+     BG.Ptr BG.Void
+  -> BG.Ptr BG.Void
+  -> BG.Ptr BG.Void
+  -> IO BG.CUInt
+
+-- __unique:__ @Database_DuckDB_FFI_V2_Database.DuckDB.FFI.V2_Safe_duckdb_v2_custom_option_update_get_scope@
+hs_bindgen_51867bf9028193d3 ::
+     DuckDBV2CustomOptionUpdateInfoHandle
+  -> BG.Ptr DuckDBV2SettingScope
+  -> BG.Ptr DuckDBV2ErrorInfoHandle
+  -> IO DuckDBV2Error
+hs_bindgen_51867bf9028193d3 =
+  \x0 ->
+    \x1 ->
+      \x2 ->
+        fmap BG.fromFFIType (hs_bindgen_51867bf9028193d3_base (BG.toFFIType x0) (BG.toFFIType x1) (BG.toFFIType x2))
+
+{-| __C declaration:__ @duckdb_v2_custom_option_update_get_scope@
+
+    __defined at:__ @duckdb_v2.h 8225:30@
+
+    __exported by:__ @duckdb_v2.h@
+-}
+c_duckdb_v2_custom_option_update_get_scope ::
+     DuckDBV2CustomOptionUpdateInfoHandle
+     -- ^ __C declaration:__ @info@
+  -> BG.Ptr DuckDBV2SettingScope
+     -- ^ __C declaration:__ @scope@
+  -> BG.Ptr DuckDBV2ErrorInfoHandle
+     -- ^ __C declaration:__ @err@
+  -> IO DuckDBV2Error
+c_duckdb_v2_custom_option_update_get_scope =
+  hs_bindgen_51867bf9028193d3
+
+-- __unique:__ @Database_DuckDB_FFI_V2_Database.DuckDB.FFI.V2_Safe_duckdb_v2_custom_option_update_is_reset@
+foreign import ccall safe "hs_bindgen_7225307377501320" hs_bindgen_7225307377501320_base ::
+     BG.Ptr BG.Void
+  -> BG.Ptr BG.Void
+  -> BG.Ptr BG.Void
+  -> IO BG.CUInt
+
+-- __unique:__ @Database_DuckDB_FFI_V2_Database.DuckDB.FFI.V2_Safe_duckdb_v2_custom_option_update_is_reset@
+hs_bindgen_7225307377501320 ::
+     DuckDBV2CustomOptionUpdateInfoHandle
+  -> BG.Ptr BG.CBool
+  -> BG.Ptr DuckDBV2ErrorInfoHandle
+  -> IO DuckDBV2Error
+hs_bindgen_7225307377501320 =
+  \x0 ->
+    \x1 ->
+      \x2 ->
+        fmap BG.fromFFIType (hs_bindgen_7225307377501320_base (BG.toFFIType x0) (BG.toFFIType x1) (BG.toFFIType x2))
+
+{-| __C declaration:__ @duckdb_v2_custom_option_update_is_reset@
+
+    __defined at:__ @duckdb_v2.h 8243:30@
+
+    __exported by:__ @duckdb_v2.h@
+-}
+c_duckdb_v2_custom_option_update_is_reset ::
+     DuckDBV2CustomOptionUpdateInfoHandle
+     -- ^ __C declaration:__ @info@
+  -> BG.Ptr BG.CBool
+     -- ^ __C declaration:__ @is_reset@
+  -> BG.Ptr DuckDBV2ErrorInfoHandle
+     -- ^ __C declaration:__ @err@
+  -> IO DuckDBV2Error
+c_duckdb_v2_custom_option_update_is_reset =
+  hs_bindgen_7225307377501320
+
+-- __unique:__ @Database_DuckDB_FFI_V2_Database.DuckDB.FFI.V2_Safe_duckdb_v2_connection_register_custom_option@
+foreign import ccall safe "hs_bindgen_f8426cfe22416fb0" hs_bindgen_f8426cfe22416fb0_base ::
+     BG.Ptr BG.Void
+  -> BG.Ptr BG.Void
+  -> BG.Ptr BG.Void
+  -> IO BG.CUInt
+
+-- __unique:__ @Database_DuckDB_FFI_V2_Database.DuckDB.FFI.V2_Safe_duckdb_v2_connection_register_custom_option@
+hs_bindgen_f8426cfe22416fb0 ::
+     DuckDBV2ConnectionHandle
+  -> DuckDBV2CustomOptionHandle
+  -> BG.Ptr DuckDBV2ErrorInfoHandle
+  -> IO DuckDBV2Error
+hs_bindgen_f8426cfe22416fb0 =
+  \x0 ->
+    \x1 ->
+      \x2 ->
+        fmap BG.fromFFIType (hs_bindgen_f8426cfe22416fb0_base (BG.toFFIType x0) (BG.toFFIType x1) (BG.toFFIType x2))
+
+{-| __C declaration:__ @duckdb_v2_connection_register_custom_option@
+
+    __defined at:__ @duckdb_v2.h 8266:30@
+
+    __exported by:__ @duckdb_v2.h@
+-}
+c_duckdb_v2_connection_register_custom_option ::
+     DuckDBV2ConnectionHandle
+     -- ^ __C declaration:__ @conn@
+  -> DuckDBV2CustomOptionHandle
+     -- ^ __C declaration:__ @option@
+  -> BG.Ptr DuckDBV2ErrorInfoHandle
+     -- ^ __C declaration:__ @err@
+  -> IO DuckDBV2Error
+c_duckdb_v2_connection_register_custom_option =
+  hs_bindgen_f8426cfe22416fb0
+
+-- __unique:__ @Database_DuckDB_FFI_V2_Database.DuckDB.FFI.V2_Safe_duckdb_v2_extension_register_custom_option@
+foreign import ccall safe "hs_bindgen_aa5cf4de986fc2c8" hs_bindgen_aa5cf4de986fc2c8_base ::
+     BG.Ptr BG.Void
+  -> BG.Ptr BG.Void
+  -> BG.Ptr BG.Void
+  -> IO BG.CUInt
+
+-- __unique:__ @Database_DuckDB_FFI_V2_Database.DuckDB.FFI.V2_Safe_duckdb_v2_extension_register_custom_option@
+hs_bindgen_aa5cf4de986fc2c8 ::
+     DuckDBV2ExtensionHandle
+  -> DuckDBV2CustomOptionHandle
+  -> BG.Ptr DuckDBV2ErrorInfoHandle
+  -> IO DuckDBV2Error
+hs_bindgen_aa5cf4de986fc2c8 =
+  \x0 ->
+    \x1 ->
+      \x2 ->
+        fmap BG.fromFFIType (hs_bindgen_aa5cf4de986fc2c8_base (BG.toFFIType x0) (BG.toFFIType x1) (BG.toFFIType x2))
+
+{-| __C declaration:__ @duckdb_v2_extension_register_custom_option@
+
+    __defined at:__ @duckdb_v2.h 8290:30@
+
+    __exported by:__ @duckdb_v2.h@
+-}
+c_duckdb_v2_extension_register_custom_option ::
+     DuckDBV2ExtensionHandle
+     -- ^ __C declaration:__ @extension@
+  -> DuckDBV2CustomOptionHandle
+     -- ^ __C declaration:__ @option@
+  -> BG.Ptr DuckDBV2ErrorInfoHandle
+     -- ^ __C declaration:__ @err@
+  -> IO DuckDBV2Error
+c_duckdb_v2_extension_register_custom_option =
+  hs_bindgen_aa5cf4de986fc2c8
+
+-- __unique:__ @Database_DuckDB_FFI_V2_Database.DuckDB.FFI.V2_Safe_duckdb_v2_custom_option_destroy@
+foreign import ccall safe "hs_bindgen_984c5652201b6bfd" hs_bindgen_984c5652201b6bfd_base ::
+     BG.Ptr BG.Void
+  -> IO BG.CUInt
+
+-- __unique:__ @Database_DuckDB_FFI_V2_Database.DuckDB.FFI.V2_Safe_duckdb_v2_custom_option_destroy@
+hs_bindgen_984c5652201b6bfd ::
+     BG.Ptr DuckDBV2CustomOptionHandle
+  -> IO DuckDBV2Error
+hs_bindgen_984c5652201b6bfd =
+  \x0 ->
+    fmap BG.fromFFIType (hs_bindgen_984c5652201b6bfd_base (BG.toFFIType x0))
+
+{-| __C declaration:__ @duckdb_v2_custom_option_destroy@
+
+    __defined at:__ @duckdb_v2.h 8308:30@
+
+    __exported by:__ @duckdb_v2.h@
+-}
+c_duckdb_v2_custom_option_destroy ::
+     BG.Ptr DuckDBV2CustomOptionHandle
+     -- ^ __C declaration:__ @option@
+  -> IO DuckDBV2Error
+c_duckdb_v2_custom_option_destroy =
+  hs_bindgen_984c5652201b6bfd
+
+-- __unique:__ @Database_DuckDB_FFI_V2_Database.DuckDB.FFI.V2_Safe_duckdb_v2_expression_get_type@
+foreign import ccall safe "hs_bindgen_454025ed7a148077" hs_bindgen_454025ed7a148077_base ::
+     BG.Ptr BG.Void
+  -> BG.Ptr BG.Void
+  -> BG.Ptr BG.Void
+  -> IO BG.CUInt
+
+-- __unique:__ @Database_DuckDB_FFI_V2_Database.DuckDB.FFI.V2_Safe_duckdb_v2_expression_get_type@
+hs_bindgen_454025ed7a148077 ::
+     DuckDBV2ExpressionHandle
+  -> BG.Ptr DuckDBV2ExpressionType
+  -> BG.Ptr DuckDBV2ErrorInfoHandle
+  -> IO DuckDBV2Error
+hs_bindgen_454025ed7a148077 =
+  \x0 ->
+    \x1 ->
+      \x2 ->
+        fmap BG.fromFFIType (hs_bindgen_454025ed7a148077_base (BG.toFFIType x0) (BG.toFFIType x1) (BG.toFFIType x2))
+
+{-| __C declaration:__ @duckdb_v2_expression_get_type@
+
+    __defined at:__ @duckdb_v2.h 8444:30@
+
+    __exported by:__ @duckdb_v2.h@
+-}
+c_duckdb_v2_expression_get_type ::
+     DuckDBV2ExpressionHandle
+     -- ^ __C declaration:__ @expression@
+  -> BG.Ptr DuckDBV2ExpressionType
+     -- ^ __C declaration:__ @type@
+  -> BG.Ptr DuckDBV2ErrorInfoHandle
+     -- ^ __C declaration:__ @err@
+  -> IO DuckDBV2Error
+c_duckdb_v2_expression_get_type =
+  hs_bindgen_454025ed7a148077
+
+-- __unique:__ @Database_DuckDB_FFI_V2_Database.DuckDB.FFI.V2_Safe_duckdb_v2_expression_get_return_type@
+foreign import ccall safe "hs_bindgen_a4b528ffaae2d550" hs_bindgen_a4b528ffaae2d550_base ::
+     BG.Ptr BG.Void
+  -> BG.Ptr BG.Void
+  -> BG.Ptr BG.Void
+  -> IO BG.CUInt
+
+-- __unique:__ @Database_DuckDB_FFI_V2_Database.DuckDB.FFI.V2_Safe_duckdb_v2_expression_get_return_type@
+hs_bindgen_a4b528ffaae2d550 ::
+     DuckDBV2ExpressionHandle
+  -> BG.Ptr DuckDBV2LogicalTypeHandle
+  -> BG.Ptr DuckDBV2ErrorInfoHandle
+  -> IO DuckDBV2Error
+hs_bindgen_a4b528ffaae2d550 =
+  \x0 ->
+    \x1 ->
+      \x2 ->
+        fmap BG.fromFFIType (hs_bindgen_a4b528ffaae2d550_base (BG.toFFIType x0) (BG.toFFIType x1) (BG.toFFIType x2))
+
+{-| __C declaration:__ @duckdb_v2_expression_get_return_type@
+
+    __defined at:__ @duckdb_v2.h 8465:30@
+
+    __exported by:__ @duckdb_v2.h@
+-}
+c_duckdb_v2_expression_get_return_type ::
+     DuckDBV2ExpressionHandle
+     -- ^ __C declaration:__ @expression@
+  -> BG.Ptr DuckDBV2LogicalTypeHandle
+     -- ^ __C declaration:__ @type@
+  -> BG.Ptr DuckDBV2ErrorInfoHandle
+     -- ^ __C declaration:__ @err@
+  -> IO DuckDBV2Error
+c_duckdb_v2_expression_get_return_type =
+  hs_bindgen_a4b528ffaae2d550
+
+-- __unique:__ @Database_DuckDB_FFI_V2_Database.DuckDB.FFI.V2_Safe_duckdb_v2_expression_get_child_count@
+foreign import ccall safe "hs_bindgen_ad153da3449a850a" hs_bindgen_ad153da3449a850a_base ::
+     BG.Ptr BG.Void
+  -> BG.Ptr BG.Void
+  -> BG.Ptr BG.Void
+  -> IO BG.CUInt
+
+-- __unique:__ @Database_DuckDB_FFI_V2_Database.DuckDB.FFI.V2_Safe_duckdb_v2_expression_get_child_count@
+hs_bindgen_ad153da3449a850a ::
+     DuckDBV2ExpressionHandle
+  -> BG.Ptr DuckDBIdx
+  -> BG.Ptr DuckDBV2ErrorInfoHandle
+  -> IO DuckDBV2Error
+hs_bindgen_ad153da3449a850a =
+  \x0 ->
+    \x1 ->
+      \x2 ->
+        fmap BG.fromFFIType (hs_bindgen_ad153da3449a850a_base (BG.toFFIType x0) (BG.toFFIType x1) (BG.toFFIType x2))
+
+{-| __C declaration:__ @duckdb_v2_expression_get_child_count@
+
+    __defined at:__ @duckdb_v2.h 8486:30@
+
+    __exported by:__ @duckdb_v2.h@
+-}
+c_duckdb_v2_expression_get_child_count ::
+     DuckDBV2ExpressionHandle
+     -- ^ __C declaration:__ @expression@
+  -> BG.Ptr DuckDBIdx
+     -- ^ __C declaration:__ @count@
+  -> BG.Ptr DuckDBV2ErrorInfoHandle
+     -- ^ __C declaration:__ @err@
+  -> IO DuckDBV2Error
+c_duckdb_v2_expression_get_child_count =
+  hs_bindgen_ad153da3449a850a
+
+-- __unique:__ @Database_DuckDB_FFI_V2_Database.DuckDB.FFI.V2_Safe_duckdb_v2_expression_get_child@
+foreign import ccall safe "hs_bindgen_0773b30cb80a252e" hs_bindgen_0773b30cb80a252e_base ::
+     BG.Ptr BG.Void
+  -> HsBindgen.Runtime.LibC.Word64
+  -> BG.Ptr BG.Void
+  -> BG.Ptr BG.Void
+  -> IO BG.CUInt
+
+-- __unique:__ @Database_DuckDB_FFI_V2_Database.DuckDB.FFI.V2_Safe_duckdb_v2_expression_get_child@
+hs_bindgen_0773b30cb80a252e ::
+     DuckDBV2ExpressionHandle
+  -> DuckDBIdx
+  -> BG.Ptr DuckDBV2ExpressionHandle
+  -> BG.Ptr DuckDBV2ErrorInfoHandle
+  -> IO DuckDBV2Error
+hs_bindgen_0773b30cb80a252e =
+  \x0 ->
+    \x1 ->
+      \x2 ->
+        \x3 ->
+          fmap BG.fromFFIType (hs_bindgen_0773b30cb80a252e_base (BG.toFFIType x0) (BG.toFFIType x1) (BG.toFFIType x2) (BG.toFFIType x3))
+
+{-| __C declaration:__ @duckdb_v2_expression_get_child@
+
+    __defined at:__ @duckdb_v2.h 8507:30@
+
+    __exported by:__ @duckdb_v2.h@
+-}
+c_duckdb_v2_expression_get_child ::
+     DuckDBV2ExpressionHandle
+     -- ^ __C declaration:__ @expression@
+  -> DuckDBIdx
+     -- ^ __C declaration:__ @index@
+  -> BG.Ptr DuckDBV2ExpressionHandle
+     -- ^ __C declaration:__ @child@
+  -> BG.Ptr DuckDBV2ErrorInfoHandle
+     -- ^ __C declaration:__ @err@
+  -> IO DuckDBV2Error
+c_duckdb_v2_expression_get_child =
+  hs_bindgen_0773b30cb80a252e
+
+-- __unique:__ @Database_DuckDB_FFI_V2_Database.DuckDB.FFI.V2_Safe_duckdb_v2_expression_constant_get_value@
+foreign import ccall safe "hs_bindgen_cead2d1a1c759d0f" hs_bindgen_cead2d1a1c759d0f_base ::
+     BG.Ptr BG.Void
+  -> BG.Ptr BG.Void
+  -> BG.Ptr BG.Void
+  -> IO BG.CUInt
+
+-- __unique:__ @Database_DuckDB_FFI_V2_Database.DuckDB.FFI.V2_Safe_duckdb_v2_expression_constant_get_value@
+hs_bindgen_cead2d1a1c759d0f ::
+     DuckDBV2ExpressionHandle
+  -> BG.Ptr DuckDBV2ValueHandle
+  -> BG.Ptr DuckDBV2ErrorInfoHandle
+  -> IO DuckDBV2Error
+hs_bindgen_cead2d1a1c759d0f =
+  \x0 ->
+    \x1 ->
+      \x2 ->
+        fmap BG.fromFFIType (hs_bindgen_cead2d1a1c759d0f_base (BG.toFFIType x0) (BG.toFFIType x1) (BG.toFFIType x2))
+
+{-| __C declaration:__ @duckdb_v2_expression_constant_get_value@
+
+    __defined at:__ @duckdb_v2.h 8528:30@
+
+    __exported by:__ @duckdb_v2.h@
+-}
+c_duckdb_v2_expression_constant_get_value ::
+     DuckDBV2ExpressionHandle
+     -- ^ __C declaration:__ @expression@
+  -> BG.Ptr DuckDBV2ValueHandle
+     -- ^ __C declaration:__ @value@
+  -> BG.Ptr DuckDBV2ErrorInfoHandle
+     -- ^ __C declaration:__ @err@
+  -> IO DuckDBV2Error
+c_duckdb_v2_expression_constant_get_value =
+  hs_bindgen_cead2d1a1c759d0f
+
+-- __unique:__ @Database_DuckDB_FFI_V2_Database.DuckDB.FFI.V2_Safe_duckdb_v2_expression_column_ref_get_index@
+foreign import ccall safe "hs_bindgen_2fb1769d1f358201" hs_bindgen_2fb1769d1f358201_base ::
+     BG.Ptr BG.Void
+  -> BG.Ptr BG.Void
+  -> BG.Ptr BG.Void
+  -> IO BG.CUInt
+
+-- __unique:__ @Database_DuckDB_FFI_V2_Database.DuckDB.FFI.V2_Safe_duckdb_v2_expression_column_ref_get_index@
+hs_bindgen_2fb1769d1f358201 ::
+     DuckDBV2ExpressionHandle
+  -> BG.Ptr DuckDBIdx
+  -> BG.Ptr DuckDBV2ErrorInfoHandle
+  -> IO DuckDBV2Error
+hs_bindgen_2fb1769d1f358201 =
+  \x0 ->
+    \x1 ->
+      \x2 ->
+        fmap BG.fromFFIType (hs_bindgen_2fb1769d1f358201_base (BG.toFFIType x0) (BG.toFFIType x1) (BG.toFFIType x2))
+
+{-| __C declaration:__ @duckdb_v2_expression_column_ref_get_index@
+
+    __defined at:__ @duckdb_v2.h 8551:30@
+
+    __exported by:__ @duckdb_v2.h@
+-}
+c_duckdb_v2_expression_column_ref_get_index ::
+     DuckDBV2ExpressionHandle
+     -- ^ __C declaration:__ @expression@
+  -> BG.Ptr DuckDBIdx
+     -- ^ __C declaration:__ @index@
+  -> BG.Ptr DuckDBV2ErrorInfoHandle
+     -- ^ __C declaration:__ @err@
+  -> IO DuckDBV2Error
+c_duckdb_v2_expression_column_ref_get_index =
+  hs_bindgen_2fb1769d1f358201
+
+-- __unique:__ @Database_DuckDB_FFI_V2_Database.DuckDB.FFI.V2_Safe_duckdb_v2_expression_function_get_name@
+foreign import ccall safe "hs_bindgen_a375c9e45ac1c7f7" hs_bindgen_a375c9e45ac1c7f7_base ::
+     BG.Ptr BG.Void
+  -> BG.Ptr BG.Void
+  -> BG.Ptr BG.Void
+  -> IO BG.CUInt
+
+-- __unique:__ @Database_DuckDB_FFI_V2_Database.DuckDB.FFI.V2_Safe_duckdb_v2_expression_function_get_name@
+hs_bindgen_a375c9e45ac1c7f7 ::
+     DuckDBV2ExpressionHandle
+  -> BG.Ptr DuckDBV2IdentifierT
+  -> BG.Ptr DuckDBV2ErrorInfoHandle
+  -> IO DuckDBV2Error
+hs_bindgen_a375c9e45ac1c7f7 =
+  \x0 ->
+    \x1 ->
+      \x2 ->
+        fmap BG.fromFFIType (hs_bindgen_a375c9e45ac1c7f7_base (BG.toFFIType x0) (BG.toFFIType x1) (BG.toFFIType x2))
+
+{-| __C declaration:__ @duckdb_v2_expression_function_get_name@
+
+    __defined at:__ @duckdb_v2.h 8573:30@
+
+    __exported by:__ @duckdb_v2.h@
+-}
+c_duckdb_v2_expression_function_get_name ::
+     DuckDBV2ExpressionHandle
+     -- ^ __C declaration:__ @expression@
+  -> BG.Ptr DuckDBV2IdentifierT
+     -- ^ __C declaration:__ @name@
+  -> BG.Ptr DuckDBV2ErrorInfoHandle
+     -- ^ __C declaration:__ @err@
+  -> IO DuckDBV2Error
+c_duckdb_v2_expression_function_get_name =
+  hs_bindgen_a375c9e45ac1c7f7
+
+-- __unique:__ @Database_DuckDB_FFI_V2_Database.DuckDB.FFI.V2_Safe_duckdb_v2_expression_function_get_qname@
+foreign import ccall safe "hs_bindgen_7d5e13a396e3a4ab" hs_bindgen_7d5e13a396e3a4ab_base ::
+     BG.Ptr BG.Void
+  -> BG.Ptr BG.Void
+  -> BG.Ptr BG.Void
+  -> IO BG.CUInt
+
+-- __unique:__ @Database_DuckDB_FFI_V2_Database.DuckDB.FFI.V2_Safe_duckdb_v2_expression_function_get_qname@
+hs_bindgen_7d5e13a396e3a4ab ::
+     DuckDBV2ExpressionHandle
+  -> BG.Ptr DuckDBV2QnameHandle
+  -> BG.Ptr DuckDBV2ErrorInfoHandle
+  -> IO DuckDBV2Error
+hs_bindgen_7d5e13a396e3a4ab =
+  \x0 ->
+    \x1 ->
+      \x2 ->
+        fmap BG.fromFFIType (hs_bindgen_7d5e13a396e3a4ab_base (BG.toFFIType x0) (BG.toFFIType x1) (BG.toFFIType x2))
+
+{-| __C declaration:__ @duckdb_v2_expression_function_get_qname@
+
+    __defined at:__ @duckdb_v2.h 8595:30@
+
+    __exported by:__ @duckdb_v2.h@
+-}
+c_duckdb_v2_expression_function_get_qname ::
+     DuckDBV2ExpressionHandle
+     -- ^ __C declaration:__ @expression@
+  -> BG.Ptr DuckDBV2QnameHandle
+     -- ^ __C declaration:__ @name@
+  -> BG.Ptr DuckDBV2ErrorInfoHandle
+     -- ^ __C declaration:__ @err@
+  -> IO DuckDBV2Error
+c_duckdb_v2_expression_function_get_qname =
+  hs_bindgen_7d5e13a396e3a4ab
+
+-- __unique:__ @Database_DuckDB_FFI_V2_Database.DuckDB.FFI.V2_Safe_duckdb_v2_expression_cast_get_mode@
+foreign import ccall safe "hs_bindgen_c975ae511aa02980" hs_bindgen_c975ae511aa02980_base ::
+     BG.Ptr BG.Void
+  -> BG.Ptr BG.Void
+  -> BG.Ptr BG.Void
+  -> IO BG.CUInt
+
+-- __unique:__ @Database_DuckDB_FFI_V2_Database.DuckDB.FFI.V2_Safe_duckdb_v2_expression_cast_get_mode@
+hs_bindgen_c975ae511aa02980 ::
+     DuckDBV2ExpressionHandle
+  -> BG.Ptr DuckDBV2CastMode
+  -> BG.Ptr DuckDBV2ErrorInfoHandle
+  -> IO DuckDBV2Error
+hs_bindgen_c975ae511aa02980 =
+  \x0 ->
+    \x1 ->
+      \x2 ->
+        fmap BG.fromFFIType (hs_bindgen_c975ae511aa02980_base (BG.toFFIType x0) (BG.toFFIType x1) (BG.toFFIType x2))
+
+{-| __C declaration:__ @duckdb_v2_expression_cast_get_mode@
+
+    __defined at:__ @duckdb_v2.h 8616:30@
+
+    __exported by:__ @duckdb_v2.h@
+-}
+c_duckdb_v2_expression_cast_get_mode ::
+     DuckDBV2ExpressionHandle
+     -- ^ __C declaration:__ @expression@
+  -> BG.Ptr DuckDBV2CastMode
+     -- ^ __C declaration:__ @mode@
+  -> BG.Ptr DuckDBV2ErrorInfoHandle
+     -- ^ __C declaration:__ @err@
+  -> IO DuckDBV2Error
+c_duckdb_v2_expression_cast_get_mode =
+  hs_bindgen_c975ae511aa02980
+
+-- __unique:__ @Database_DuckDB_FFI_V2_Database.DuckDB.FFI.V2_Safe_duckdb_v2_log_sink_create@
+foreign import ccall safe "hs_bindgen_6358822ed8d27ef0" hs_bindgen_6358822ed8d27ef0_base ::
+     BG.Ptr BG.Void
+  -> BG.Ptr BG.Void
+  -> BG.Ptr BG.Void
+  -> IO BG.CUInt
+
+-- __unique:__ @Database_DuckDB_FFI_V2_Database.DuckDB.FFI.V2_Safe_duckdb_v2_log_sink_create@
+hs_bindgen_6358822ed8d27ef0 ::
+     DuckDBV2FactoryHandle
+  -> BG.Ptr DuckDBV2LogSinkHandle
+  -> BG.Ptr DuckDBV2ErrorInfoHandle
+  -> IO DuckDBV2Error
+hs_bindgen_6358822ed8d27ef0 =
+  \x0 ->
+    \x1 ->
+      \x2 ->
+        fmap BG.fromFFIType (hs_bindgen_6358822ed8d27ef0_base (BG.toFFIType x0) (BG.toFFIType x1) (BG.toFFIType x2))
+
+{-| __C declaration:__ @duckdb_v2_log_sink_create@
+
+    __defined at:__ @duckdb_v2.h 8706:30@
+
+    __exported by:__ @duckdb_v2.h@
+-}
+c_duckdb_v2_log_sink_create ::
+     DuckDBV2FactoryHandle
+     -- ^ __C declaration:__ @factory@
+  -> BG.Ptr DuckDBV2LogSinkHandle
+     -- ^ __C declaration:__ @sink@
+  -> BG.Ptr DuckDBV2ErrorInfoHandle
+     -- ^ __C declaration:__ @err@
+  -> IO DuckDBV2Error
+c_duckdb_v2_log_sink_create =
+  hs_bindgen_6358822ed8d27ef0
+
+-- __unique:__ @Database_DuckDB_FFI_V2_Database.DuckDB.FFI.V2_Safe_duckdb_v2_log_sink_set_name@
+foreign import ccall safe "hs_bindgen_492898c1c449c3fe" hs_bindgen_492898c1c449c3fe_base ::
+     BG.Ptr BG.Void
+  -> BG.Ptr BG.Void
+  -> BG.Ptr BG.Void
+  -> IO BG.CUInt
+
+-- __unique:__ @Database_DuckDB_FFI_V2_Database.DuckDB.FFI.V2_Safe_duckdb_v2_log_sink_set_name@
+hs_bindgen_492898c1c449c3fe ::
+     DuckDBV2LogSinkHandle
+  -> PtrConst.PtrConst DuckDBV2IdentifierT
+  -> BG.Ptr DuckDBV2ErrorInfoHandle
+  -> IO DuckDBV2Error
+hs_bindgen_492898c1c449c3fe =
+  \x0 ->
+    \x1 ->
+      \x2 ->
+        fmap BG.fromFFIType (hs_bindgen_492898c1c449c3fe_base (BG.toFFIType x0) (BG.toFFIType x1) (BG.toFFIType x2))
+
+{-| __C declaration:__ @duckdb_v2_log_sink_set_name@
+
+    __defined at:__ @duckdb_v2.h 8727:30@
+
+    __exported by:__ @duckdb_v2.h@
+-}
+c_duckdb_v2_log_sink_set_name ::
+     DuckDBV2LogSinkHandle
+     -- ^ __C declaration:__ @sink@
+  -> PtrConst.PtrConst DuckDBV2IdentifierT
+     -- ^ __C declaration:__ @name@
+  -> BG.Ptr DuckDBV2ErrorInfoHandle
+     -- ^ __C declaration:__ @err@
+  -> IO DuckDBV2Error
+c_duckdb_v2_log_sink_set_name =
+  hs_bindgen_492898c1c449c3fe
+
+-- __unique:__ @Database_DuckDB_FFI_V2_Database.DuckDB.FFI.V2_Safe_duckdb_v2_log_sink_set_user_data@
+foreign import ccall safe "hs_bindgen_7b9de9e8aa64154c" hs_bindgen_7b9de9e8aa64154c_base ::
+     BG.Ptr BG.Void
+  -> BG.Ptr BG.Void
+  -> BG.Ptr BG.Void
+  -> IO BG.CUInt
+
+-- __unique:__ @Database_DuckDB_FFI_V2_Database.DuckDB.FFI.V2_Safe_duckdb_v2_log_sink_set_user_data@
+hs_bindgen_7b9de9e8aa64154c ::
+     DuckDBV2LogSinkHandle
+  -> BG.Ptr DuckDBV2Opaque
+  -> BG.Ptr DuckDBV2ErrorInfoHandle
+  -> IO DuckDBV2Error
+hs_bindgen_7b9de9e8aa64154c =
+  \x0 ->
+    \x1 ->
+      \x2 ->
+        fmap BG.fromFFIType (hs_bindgen_7b9de9e8aa64154c_base (BG.toFFIType x0) (BG.toFFIType x1) (BG.toFFIType x2))
+
+{-| __C declaration:__ @duckdb_v2_log_sink_set_user_data@
+
+    __defined at:__ @duckdb_v2.h 8749:30@
+
+    __exported by:__ @duckdb_v2.h@
+-}
+c_duckdb_v2_log_sink_set_user_data ::
+     DuckDBV2LogSinkHandle
+     -- ^ __C declaration:__ @sink@
+  -> BG.Ptr DuckDBV2Opaque
+     -- ^ __C declaration:__ @data@
+  -> BG.Ptr DuckDBV2ErrorInfoHandle
+     -- ^ __C declaration:__ @err@
+  -> IO DuckDBV2Error
+c_duckdb_v2_log_sink_set_user_data =
+  hs_bindgen_7b9de9e8aa64154c
+
+-- __unique:__ @Database_DuckDB_FFI_V2_Database.DuckDB.FFI.V2_Safe_duckdb_v2_log_sink_set_write_callback@
+foreign import ccall safe "hs_bindgen_dffbee0b81e5642c" hs_bindgen_dffbee0b81e5642c_base ::
+     BG.Ptr BG.Void
+  -> BG.FunPtr BG.Void
+  -> BG.Ptr BG.Void
+  -> IO BG.CUInt
+
+-- __unique:__ @Database_DuckDB_FFI_V2_Database.DuckDB.FFI.V2_Safe_duckdb_v2_log_sink_set_write_callback@
+hs_bindgen_dffbee0b81e5642c ::
+     DuckDBV2LogSinkHandle
+  -> DuckDBV2LogSinkWriteCallbackFn
+  -> BG.Ptr DuckDBV2ErrorInfoHandle
+  -> IO DuckDBV2Error
+hs_bindgen_dffbee0b81e5642c =
+  \x0 ->
+    \x1 ->
+      \x2 ->
+        fmap BG.fromFFIType (hs_bindgen_dffbee0b81e5642c_base (BG.toFFIType x0) (BG.toFFIType x1) (BG.toFFIType x2))
+
+{-| __C declaration:__ @duckdb_v2_log_sink_set_write_callback@
+
+    __defined at:__ @duckdb_v2.h 8769:30@
+
+    __exported by:__ @duckdb_v2.h@
+-}
+c_duckdb_v2_log_sink_set_write_callback ::
+     DuckDBV2LogSinkHandle
+     -- ^ __C declaration:__ @sink@
+  -> DuckDBV2LogSinkWriteCallbackFn
+     -- ^ __C declaration:__ @callback@
+  -> BG.Ptr DuckDBV2ErrorInfoHandle
+     -- ^ __C declaration:__ @err@
+  -> IO DuckDBV2Error
+c_duckdb_v2_log_sink_set_write_callback =
+  hs_bindgen_dffbee0b81e5642c
+
+-- __unique:__ @Database_DuckDB_FFI_V2_Database.DuckDB.FFI.V2_Safe_duckdb_v2_log_sink_set_flush_callback@
+foreign import ccall safe "hs_bindgen_0a7a3d98c0a85a84" hs_bindgen_0a7a3d98c0a85a84_base ::
+     BG.Ptr BG.Void
+  -> BG.FunPtr BG.Void
+  -> BG.Ptr BG.Void
+  -> IO BG.CUInt
+
+-- __unique:__ @Database_DuckDB_FFI_V2_Database.DuckDB.FFI.V2_Safe_duckdb_v2_log_sink_set_flush_callback@
+hs_bindgen_0a7a3d98c0a85a84 ::
+     DuckDBV2LogSinkHandle
+  -> DuckDBV2LogSinkFlushCallbackFn
+  -> BG.Ptr DuckDBV2ErrorInfoHandle
+  -> IO DuckDBV2Error
+hs_bindgen_0a7a3d98c0a85a84 =
+  \x0 ->
+    \x1 ->
+      \x2 ->
+        fmap BG.fromFFIType (hs_bindgen_0a7a3d98c0a85a84_base (BG.toFFIType x0) (BG.toFFIType x1) (BG.toFFIType x2))
+
+{-| __C declaration:__ @duckdb_v2_log_sink_set_flush_callback@
+
+    __defined at:__ @duckdb_v2.h 8791:30@
+
+    __exported by:__ @duckdb_v2.h@
+-}
+c_duckdb_v2_log_sink_set_flush_callback ::
+     DuckDBV2LogSinkHandle
+     -- ^ __C declaration:__ @sink@
+  -> DuckDBV2LogSinkFlushCallbackFn
+     -- ^ __C declaration:__ @callback@
+  -> BG.Ptr DuckDBV2ErrorInfoHandle
+     -- ^ __C declaration:__ @err@
+  -> IO DuckDBV2Error
+c_duckdb_v2_log_sink_set_flush_callback =
+  hs_bindgen_0a7a3d98c0a85a84
+
+-- __unique:__ @Database_DuckDB_FFI_V2_Database.DuckDB.FFI.V2_Safe_duckdb_v2_log_sink_write_info_get_connection_id@
+foreign import ccall safe "hs_bindgen_727d4c291ab6b5d7" hs_bindgen_727d4c291ab6b5d7_base ::
+     BG.Ptr BG.Void
+  -> BG.Ptr BG.Void
+  -> BG.Ptr BG.Void
+  -> BG.Ptr BG.Void
+  -> IO BG.CUInt
+
+-- __unique:__ @Database_DuckDB_FFI_V2_Database.DuckDB.FFI.V2_Safe_duckdb_v2_log_sink_write_info_get_connection_id@
+hs_bindgen_727d4c291ab6b5d7 ::
+     DuckDBV2LogSinkWriteInfoHandle
+  -> BG.Ptr DuckDBIdx
+  -> BG.Ptr BG.CBool
+  -> BG.Ptr DuckDBV2ErrorInfoHandle
+  -> IO DuckDBV2Error
+hs_bindgen_727d4c291ab6b5d7 =
+  \x0 ->
+    \x1 ->
+      \x2 ->
+        \x3 ->
+          fmap BG.fromFFIType (hs_bindgen_727d4c291ab6b5d7_base (BG.toFFIType x0) (BG.toFFIType x1) (BG.toFFIType x2) (BG.toFFIType x3))
+
+{-| __C declaration:__ @duckdb_v2_log_sink_write_info_get_connection_id@
+
+    __defined at:__ @duckdb_v2.h 8811:30@
+
+    __exported by:__ @duckdb_v2.h@
+-}
+c_duckdb_v2_log_sink_write_info_get_connection_id ::
+     DuckDBV2LogSinkWriteInfoHandle
+     -- ^ __C declaration:__ @info@
+  -> BG.Ptr DuckDBIdx
+     -- ^ __C declaration:__ @id@
+  -> BG.Ptr BG.CBool
+     -- ^ __C declaration:__ @present@
+  -> BG.Ptr DuckDBV2ErrorInfoHandle
+     -- ^ __C declaration:__ @err@
+  -> IO DuckDBV2Error
+c_duckdb_v2_log_sink_write_info_get_connection_id =
+  hs_bindgen_727d4c291ab6b5d7
+
+-- __unique:__ @Database_DuckDB_FFI_V2_Database.DuckDB.FFI.V2_Safe_duckdb_v2_log_sink_write_info_get_transaction_id@
+foreign import ccall safe "hs_bindgen_728828d2ac24012d" hs_bindgen_728828d2ac24012d_base ::
+     BG.Ptr BG.Void
+  -> BG.Ptr BG.Void
+  -> BG.Ptr BG.Void
+  -> BG.Ptr BG.Void
+  -> IO BG.CUInt
+
+-- __unique:__ @Database_DuckDB_FFI_V2_Database.DuckDB.FFI.V2_Safe_duckdb_v2_log_sink_write_info_get_transaction_id@
+hs_bindgen_728828d2ac24012d ::
+     DuckDBV2LogSinkWriteInfoHandle
+  -> BG.Ptr DuckDBIdx
+  -> BG.Ptr BG.CBool
+  -> BG.Ptr DuckDBV2ErrorInfoHandle
+  -> IO DuckDBV2Error
+hs_bindgen_728828d2ac24012d =
+  \x0 ->
+    \x1 ->
+      \x2 ->
+        \x3 ->
+          fmap BG.fromFFIType (hs_bindgen_728828d2ac24012d_base (BG.toFFIType x0) (BG.toFFIType x1) (BG.toFFIType x2) (BG.toFFIType x3))
+
+{-| __C declaration:__ @duckdb_v2_log_sink_write_info_get_transaction_id@
+
+    __defined at:__ @duckdb_v2.h 8831:30@
+
+    __exported by:__ @duckdb_v2.h@
+-}
+c_duckdb_v2_log_sink_write_info_get_transaction_id ::
+     DuckDBV2LogSinkWriteInfoHandle
+     -- ^ __C declaration:__ @info@
+  -> BG.Ptr DuckDBIdx
+     -- ^ __C declaration:__ @id@
+  -> BG.Ptr BG.CBool
+     -- ^ __C declaration:__ @present@
+  -> BG.Ptr DuckDBV2ErrorInfoHandle
+     -- ^ __C declaration:__ @err@
+  -> IO DuckDBV2Error
+c_duckdb_v2_log_sink_write_info_get_transaction_id =
+  hs_bindgen_728828d2ac24012d
+
+-- __unique:__ @Database_DuckDB_FFI_V2_Database.DuckDB.FFI.V2_Safe_duckdb_v2_log_sink_write_info_get_query_id@
+foreign import ccall safe "hs_bindgen_12c9960d2dc79668" hs_bindgen_12c9960d2dc79668_base ::
+     BG.Ptr BG.Void
+  -> BG.Ptr BG.Void
+  -> BG.Ptr BG.Void
+  -> BG.Ptr BG.Void
+  -> IO BG.CUInt
+
+-- __unique:__ @Database_DuckDB_FFI_V2_Database.DuckDB.FFI.V2_Safe_duckdb_v2_log_sink_write_info_get_query_id@
+hs_bindgen_12c9960d2dc79668 ::
+     DuckDBV2LogSinkWriteInfoHandle
+  -> BG.Ptr DuckDBIdx
+  -> BG.Ptr BG.CBool
+  -> BG.Ptr DuckDBV2ErrorInfoHandle
+  -> IO DuckDBV2Error
+hs_bindgen_12c9960d2dc79668 =
+  \x0 ->
+    \x1 ->
+      \x2 ->
+        \x3 ->
+          fmap BG.fromFFIType (hs_bindgen_12c9960d2dc79668_base (BG.toFFIType x0) (BG.toFFIType x1) (BG.toFFIType x2) (BG.toFFIType x3))
+
+{-| __C declaration:__ @duckdb_v2_log_sink_write_info_get_query_id@
+
+    __defined at:__ @duckdb_v2.h 8851:30@
+
+    __exported by:__ @duckdb_v2.h@
+-}
+c_duckdb_v2_log_sink_write_info_get_query_id ::
+     DuckDBV2LogSinkWriteInfoHandle
+     -- ^ __C declaration:__ @info@
+  -> BG.Ptr DuckDBIdx
+     -- ^ __C declaration:__ @id@
+  -> BG.Ptr BG.CBool
+     -- ^ __C declaration:__ @present@
+  -> BG.Ptr DuckDBV2ErrorInfoHandle
+     -- ^ __C declaration:__ @err@
+  -> IO DuckDBV2Error
+c_duckdb_v2_log_sink_write_info_get_query_id =
+  hs_bindgen_12c9960d2dc79668
+
+-- __unique:__ @Database_DuckDB_FFI_V2_Database.DuckDB.FFI.V2_Safe_duckdb_v2_log_sink_write_info_get_thread_id@
+foreign import ccall safe "hs_bindgen_8d5cf935dad2ba3f" hs_bindgen_8d5cf935dad2ba3f_base ::
+     BG.Ptr BG.Void
+  -> BG.Ptr BG.Void
+  -> BG.Ptr BG.Void
+  -> BG.Ptr BG.Void
+  -> IO BG.CUInt
+
+-- __unique:__ @Database_DuckDB_FFI_V2_Database.DuckDB.FFI.V2_Safe_duckdb_v2_log_sink_write_info_get_thread_id@
+hs_bindgen_8d5cf935dad2ba3f ::
+     DuckDBV2LogSinkWriteInfoHandle
+  -> BG.Ptr DuckDBIdx
+  -> BG.Ptr BG.CBool
+  -> BG.Ptr DuckDBV2ErrorInfoHandle
+  -> IO DuckDBV2Error
+hs_bindgen_8d5cf935dad2ba3f =
+  \x0 ->
+    \x1 ->
+      \x2 ->
+        \x3 ->
+          fmap BG.fromFFIType (hs_bindgen_8d5cf935dad2ba3f_base (BG.toFFIType x0) (BG.toFFIType x1) (BG.toFFIType x2) (BG.toFFIType x3))
+
+{-| __C declaration:__ @duckdb_v2_log_sink_write_info_get_thread_id@
+
+    __defined at:__ @duckdb_v2.h 8872:30@
+
+    __exported by:__ @duckdb_v2.h@
+-}
+c_duckdb_v2_log_sink_write_info_get_thread_id ::
+     DuckDBV2LogSinkWriteInfoHandle
+     -- ^ __C declaration:__ @info@
+  -> BG.Ptr DuckDBIdx
+     -- ^ __C declaration:__ @id@
+  -> BG.Ptr BG.CBool
+     -- ^ __C declaration:__ @present@
+  -> BG.Ptr DuckDBV2ErrorInfoHandle
+     -- ^ __C declaration:__ @err@
+  -> IO DuckDBV2Error
+c_duckdb_v2_log_sink_write_info_get_thread_id =
+  hs_bindgen_8d5cf935dad2ba3f
+
+-- __unique:__ @Database_DuckDB_FFI_V2_Database.DuckDB.FFI.V2_Safe_duckdb_v2_instance_register_log_sink@
+foreign import ccall safe "hs_bindgen_658c58ec8ec8b03a" hs_bindgen_658c58ec8ec8b03a_base ::
+     BG.Ptr BG.Void
+  -> BG.Ptr BG.Void
+  -> BG.Ptr BG.Void
+  -> IO BG.CUInt
+
+-- __unique:__ @Database_DuckDB_FFI_V2_Database.DuckDB.FFI.V2_Safe_duckdb_v2_instance_register_log_sink@
+hs_bindgen_658c58ec8ec8b03a ::
+     DuckDBV2InstanceHandle
+  -> DuckDBV2LogSinkHandle
+  -> BG.Ptr DuckDBV2ErrorInfoHandle
+  -> IO DuckDBV2Error
+hs_bindgen_658c58ec8ec8b03a =
+  \x0 ->
+    \x1 ->
+      \x2 ->
+        fmap BG.fromFFIType (hs_bindgen_658c58ec8ec8b03a_base (BG.toFFIType x0) (BG.toFFIType x1) (BG.toFFIType x2))
+
+{-| __C declaration:__ @duckdb_v2_instance_register_log_sink@
+
+    __defined at:__ @duckdb_v2.h 8897:30@
+
+    __exported by:__ @duckdb_v2.h@
+-}
+c_duckdb_v2_instance_register_log_sink ::
+     DuckDBV2InstanceHandle
+     -- ^ __C declaration:__ @instance@
+  -> DuckDBV2LogSinkHandle
+     -- ^ __C declaration:__ @sink@
+  -> BG.Ptr DuckDBV2ErrorInfoHandle
+     -- ^ __C declaration:__ @err@
+  -> IO DuckDBV2Error
+c_duckdb_v2_instance_register_log_sink =
+  hs_bindgen_658c58ec8ec8b03a
+
+-- __unique:__ @Database_DuckDB_FFI_V2_Database.DuckDB.FFI.V2_Safe_duckdb_v2_extension_register_log_sink@
+foreign import ccall safe "hs_bindgen_f22104c93312913d" hs_bindgen_f22104c93312913d_base ::
+     BG.Ptr BG.Void
+  -> BG.Ptr BG.Void
+  -> BG.Ptr BG.Void
+  -> IO BG.CUInt
+
+-- __unique:__ @Database_DuckDB_FFI_V2_Database.DuckDB.FFI.V2_Safe_duckdb_v2_extension_register_log_sink@
+hs_bindgen_f22104c93312913d ::
+     DuckDBV2ExtensionHandle
+  -> DuckDBV2LogSinkHandle
+  -> BG.Ptr DuckDBV2ErrorInfoHandle
+  -> IO DuckDBV2Error
+hs_bindgen_f22104c93312913d =
+  \x0 ->
+    \x1 ->
+      \x2 ->
+        fmap BG.fromFFIType (hs_bindgen_f22104c93312913d_base (BG.toFFIType x0) (BG.toFFIType x1) (BG.toFFIType x2))
+
+{-| __C declaration:__ @duckdb_v2_extension_register_log_sink@
+
+    __defined at:__ @duckdb_v2.h 8919:30@
+
+    __exported by:__ @duckdb_v2.h@
+-}
+c_duckdb_v2_extension_register_log_sink ::
+     DuckDBV2ExtensionHandle
+     -- ^ __C declaration:__ @extension@
+  -> DuckDBV2LogSinkHandle
+     -- ^ __C declaration:__ @sink@
+  -> BG.Ptr DuckDBV2ErrorInfoHandle
+     -- ^ __C declaration:__ @err@
+  -> IO DuckDBV2Error
+c_duckdb_v2_extension_register_log_sink =
+  hs_bindgen_f22104c93312913d
+
+-- __unique:__ @Database_DuckDB_FFI_V2_Database.DuckDB.FFI.V2_Safe_duckdb_v2_log_sink_destroy@
+foreign import ccall safe "hs_bindgen_827c72fefc1ae923" hs_bindgen_827c72fefc1ae923_base ::
+     BG.Ptr BG.Void
+  -> IO BG.CUInt
+
+-- __unique:__ @Database_DuckDB_FFI_V2_Database.DuckDB.FFI.V2_Safe_duckdb_v2_log_sink_destroy@
+hs_bindgen_827c72fefc1ae923 ::
+     BG.Ptr DuckDBV2LogSinkHandle
+  -> IO DuckDBV2Error
+hs_bindgen_827c72fefc1ae923 =
+  \x0 ->
+    fmap BG.fromFFIType (hs_bindgen_827c72fefc1ae923_base (BG.toFFIType x0))
+
+{-| __C declaration:__ @duckdb_v2_log_sink_destroy@
+
+    __defined at:__ @duckdb_v2.h 8937:30@
+
+    __exported by:__ @duckdb_v2.h@
+-}
+c_duckdb_v2_log_sink_destroy ::
+     BG.Ptr DuckDBV2LogSinkHandle
+     -- ^ __C declaration:__ @sink@
+  -> IO DuckDBV2Error
+c_duckdb_v2_log_sink_destroy =
+  hs_bindgen_827c72fefc1ae923
+
+-- __unique:__ @Database_DuckDB_FFI_V2_Database.DuckDB.FFI.V2_Safe_duckdb_v2_factory_create_type_from_id@
+foreign import ccall safe "hs_bindgen_7c0a920f70a1fbc0" hs_bindgen_7c0a920f70a1fbc0_base ::
+     BG.Ptr BG.Void
+  -> BG.CUInt
+  -> BG.Ptr BG.Void
+  -> BG.Ptr BG.Void
+  -> HsBindgen.Runtime.LibC.Word64
+  -> BG.Ptr BG.Void
+  -> BG.Ptr BG.Void
+  -> IO BG.CUInt
+
+-- __unique:__ @Database_DuckDB_FFI_V2_Database.DuckDB.FFI.V2_Safe_duckdb_v2_factory_create_type_from_id@
+hs_bindgen_7c0a920f70a1fbc0 ::
+     DuckDBV2FactoryHandle
+  -> DuckDBV2LogicalTypeId
+  -> PtrConst.PtrConst DuckDBV2IdentifierT
+  -> PtrConst.PtrConst DuckDBV2ValueHandle
+  -> DuckDBIdx
+  -> BG.Ptr DuckDBV2LogicalTypeHandle
+  -> BG.Ptr DuckDBV2ErrorInfoHandle
+  -> IO DuckDBV2Error
+hs_bindgen_7c0a920f70a1fbc0 =
+  \x0 ->
+    \x1 ->
+      \x2 ->
+        \x3 ->
+          \x4 ->
+            \x5 ->
+              \x6 ->
+                fmap BG.fromFFIType (hs_bindgen_7c0a920f70a1fbc0_base (BG.toFFIType x0) (BG.toFFIType x1) (BG.toFFIType x2) (BG.toFFIType x3) (BG.toFFIType x4) (BG.toFFIType x5) (BG.toFFIType x6))
+
+{-| __C declaration:__ @duckdb_v2_factory_create_type_from_id@
+
+    __defined at:__ @duckdb_v2.h 9084:30@
+
+    __exported by:__ @duckdb_v2.h@
+-}
+c_duckdb_v2_factory_create_type_from_id ::
+     DuckDBV2FactoryHandle
+     -- ^ __C declaration:__ @factory@
+  -> DuckDBV2LogicalTypeId
+     -- ^ __C declaration:__ @type_id@
+  -> PtrConst.PtrConst DuckDBV2IdentifierT
+     -- ^ __C declaration:__ @param_names@
+  -> PtrConst.PtrConst DuckDBV2ValueHandle
+     -- ^ __C declaration:__ @param_values@
+  -> DuckDBIdx
+     -- ^ __C declaration:__ @param_count@
+  -> BG.Ptr DuckDBV2LogicalTypeHandle
+     -- ^ __C declaration:__ @out_type@
+  -> BG.Ptr DuckDBV2ErrorInfoHandle
+     -- ^ __C declaration:__ @err@
+  -> IO DuckDBV2Error
+c_duckdb_v2_factory_create_type_from_id =
+  hs_bindgen_7c0a920f70a1fbc0
+
+-- __unique:__ @Database_DuckDB_FFI_V2_Database.DuckDB.FFI.V2_Safe_duckdb_v2_factory_create_type_from_name@
+foreign import ccall safe "hs_bindgen_51b5d65c0ddb67d9" hs_bindgen_51b5d65c0ddb67d9_base ::
+     BG.Ptr BG.Void
+  -> BG.Ptr BG.Void
+  -> BG.Ptr BG.Void
+  -> BG.Ptr BG.Void
+  -> HsBindgen.Runtime.LibC.Word64
+  -> BG.Ptr BG.Void
+  -> BG.Ptr BG.Void
+  -> IO BG.CUInt
+
+-- __unique:__ @Database_DuckDB_FFI_V2_Database.DuckDB.FFI.V2_Safe_duckdb_v2_factory_create_type_from_name@
+hs_bindgen_51b5d65c0ddb67d9 ::
+     DuckDBV2FactoryHandle
+  -> DuckDBV2QnameHandle
+  -> PtrConst.PtrConst DuckDBV2IdentifierT
+  -> PtrConst.PtrConst DuckDBV2ValueHandle
+  -> DuckDBIdx
+  -> BG.Ptr DuckDBV2LogicalTypeHandle
+  -> BG.Ptr DuckDBV2ErrorInfoHandle
+  -> IO DuckDBV2Error
+hs_bindgen_51b5d65c0ddb67d9 =
+  \x0 ->
+    \x1 ->
+      \x2 ->
+        \x3 ->
+          \x4 ->
+            \x5 ->
+              \x6 ->
+                fmap BG.fromFFIType (hs_bindgen_51b5d65c0ddb67d9_base (BG.toFFIType x0) (BG.toFFIType x1) (BG.toFFIType x2) (BG.toFFIType x3) (BG.toFFIType x4) (BG.toFFIType x5) (BG.toFFIType x6))
+
+{-| __C declaration:__ @duckdb_v2_factory_create_type_from_name@
+
+    __defined at:__ @duckdb_v2.h 9133:30@
+
+    __exported by:__ @duckdb_v2.h@
+-}
+c_duckdb_v2_factory_create_type_from_name ::
+     DuckDBV2FactoryHandle
+     -- ^ __C declaration:__ @factory@
+  -> DuckDBV2QnameHandle
+     -- ^ __C declaration:__ @name@
+  -> PtrConst.PtrConst DuckDBV2IdentifierT
+     -- ^ __C declaration:__ @param_names@
+  -> PtrConst.PtrConst DuckDBV2ValueHandle
+     -- ^ __C declaration:__ @param_values@
+  -> DuckDBIdx
+     -- ^ __C declaration:__ @param_count@
+  -> BG.Ptr DuckDBV2LogicalTypeHandle
+     -- ^ __C declaration:__ @out_type@
+  -> BG.Ptr DuckDBV2ErrorInfoHandle
+     -- ^ __C declaration:__ @err@
+  -> IO DuckDBV2Error
+c_duckdb_v2_factory_create_type_from_name =
+  hs_bindgen_51b5d65c0ddb67d9
+
+-- __unique:__ @Database_DuckDB_FFI_V2_Database.DuckDB.FFI.V2_Safe_duckdb_v2_factory_create_type_from_text@
+foreign import ccall safe "hs_bindgen_c04603fdc9cd2c68" hs_bindgen_c04603fdc9cd2c68_base ::
+     BG.Ptr BG.Void
+  -> BG.Ptr BG.Void
+  -> BG.Ptr BG.Void
+  -> BG.Ptr BG.Void
+  -> IO BG.CUInt
+
+-- __unique:__ @Database_DuckDB_FFI_V2_Database.DuckDB.FFI.V2_Safe_duckdb_v2_factory_create_type_from_text@
+hs_bindgen_c04603fdc9cd2c68 ::
+     DuckDBV2FactoryHandle
+  -> PtrConst.PtrConst DuckDBV2Str
+  -> BG.Ptr DuckDBV2LogicalTypeHandle
+  -> BG.Ptr DuckDBV2ErrorInfoHandle
+  -> IO DuckDBV2Error
+hs_bindgen_c04603fdc9cd2c68 =
+  \x0 ->
+    \x1 ->
+      \x2 ->
+        \x3 ->
+          fmap BG.fromFFIType (hs_bindgen_c04603fdc9cd2c68_base (BG.toFFIType x0) (BG.toFFIType x1) (BG.toFFIType x2) (BG.toFFIType x3))
+
+{-| __C declaration:__ @duckdb_v2_factory_create_type_from_text@
+
+    __defined at:__ @duckdb_v2.h 9166:30@
+
+    __exported by:__ @duckdb_v2.h@
+-}
+c_duckdb_v2_factory_create_type_from_text ::
+     DuckDBV2FactoryHandle
+     -- ^ __C declaration:__ @factory@
+  -> PtrConst.PtrConst DuckDBV2Str
+     -- ^ __C declaration:__ @text@
+  -> BG.Ptr DuckDBV2LogicalTypeHandle
+     -- ^ __C declaration:__ @out_type@
+  -> BG.Ptr DuckDBV2ErrorInfoHandle
+     -- ^ __C declaration:__ @err@
+  -> IO DuckDBV2Error
+c_duckdb_v2_factory_create_type_from_text =
+  hs_bindgen_c04603fdc9cd2c68
+
+-- __unique:__ @Database_DuckDB_FFI_V2_Database.DuckDB.FFI.V2_Safe_duckdb_v2_logical_type_copy@
+foreign import ccall safe "hs_bindgen_b71b046351f8c916" hs_bindgen_b71b046351f8c916_base ::
+     BG.Ptr BG.Void
+  -> BG.Ptr BG.Void
+  -> BG.Ptr BG.Void
+  -> IO BG.CUInt
+
+-- __unique:__ @Database_DuckDB_FFI_V2_Database.DuckDB.FFI.V2_Safe_duckdb_v2_logical_type_copy@
+hs_bindgen_b71b046351f8c916 ::
+     DuckDBV2LogicalTypeHandle
+  -> BG.Ptr DuckDBV2LogicalTypeHandle
+  -> BG.Ptr DuckDBV2ErrorInfoHandle
+  -> IO DuckDBV2Error
+hs_bindgen_b71b046351f8c916 =
+  \x0 ->
+    \x1 ->
+      \x2 ->
+        fmap BG.fromFFIType (hs_bindgen_b71b046351f8c916_base (BG.toFFIType x0) (BG.toFFIType x1) (BG.toFFIType x2))
+
+{-| __C declaration:__ @duckdb_v2_logical_type_copy@
+
+    __defined at:__ @duckdb_v2.h 9186:30@
+
+    __exported by:__ @duckdb_v2.h@
+-}
+c_duckdb_v2_logical_type_copy ::
+     DuckDBV2LogicalTypeHandle
+     -- ^ __C declaration:__ @type@
+  -> BG.Ptr DuckDBV2LogicalTypeHandle
+     -- ^ __C declaration:__ @out_type@
+  -> BG.Ptr DuckDBV2ErrorInfoHandle
+     -- ^ __C declaration:__ @err@
+  -> IO DuckDBV2Error
+c_duckdb_v2_logical_type_copy =
+  hs_bindgen_b71b046351f8c916
+
+-- __unique:__ @Database_DuckDB_FFI_V2_Database.DuckDB.FFI.V2_Safe_duckdb_v2_logical_type_destroy@
+foreign import ccall safe "hs_bindgen_3aad55c5964702f7" hs_bindgen_3aad55c5964702f7_base ::
+     BG.Ptr BG.Void
+  -> IO BG.CUInt
+
+-- __unique:__ @Database_DuckDB_FFI_V2_Database.DuckDB.FFI.V2_Safe_duckdb_v2_logical_type_destroy@
+hs_bindgen_3aad55c5964702f7 ::
+     BG.Ptr DuckDBV2LogicalTypeHandle
+  -> IO DuckDBV2Error
+hs_bindgen_3aad55c5964702f7 =
+  \x0 ->
+    fmap BG.fromFFIType (hs_bindgen_3aad55c5964702f7_base (BG.toFFIType x0))
+
+{-| __C declaration:__ @duckdb_v2_logical_type_destroy@
+
+    __defined at:__ @duckdb_v2.h 9203:30@
+
+    __exported by:__ @duckdb_v2.h@
+-}
+c_duckdb_v2_logical_type_destroy ::
+     BG.Ptr DuckDBV2LogicalTypeHandle
+     -- ^ __C declaration:__ @type@
+  -> IO DuckDBV2Error
+c_duckdb_v2_logical_type_destroy =
+  hs_bindgen_3aad55c5964702f7
+
+-- __unique:__ @Database_DuckDB_FFI_V2_Database.DuckDB.FFI.V2_Safe_duckdb_v2_logical_type_is_equal@
+foreign import ccall safe "hs_bindgen_da8cacd6c97feb4c" hs_bindgen_da8cacd6c97feb4c_base ::
+     BG.Ptr BG.Void
+  -> BG.Ptr BG.Void
+  -> BG.Ptr BG.Void
+  -> BG.Ptr BG.Void
+  -> IO BG.CUInt
+
+-- __unique:__ @Database_DuckDB_FFI_V2_Database.DuckDB.FFI.V2_Safe_duckdb_v2_logical_type_is_equal@
+hs_bindgen_da8cacd6c97feb4c ::
+     DuckDBV2LogicalTypeHandle
+  -> DuckDBV2LogicalTypeHandle
+  -> BG.Ptr BG.CBool
+  -> BG.Ptr DuckDBV2ErrorInfoHandle
+  -> IO DuckDBV2Error
+hs_bindgen_da8cacd6c97feb4c =
+  \x0 ->
+    \x1 ->
+      \x2 ->
+        \x3 ->
+          fmap BG.fromFFIType (hs_bindgen_da8cacd6c97feb4c_base (BG.toFFIType x0) (BG.toFFIType x1) (BG.toFFIType x2) (BG.toFFIType x3))
+
+{-| __C declaration:__ @duckdb_v2_logical_type_is_equal@
+
+    __defined at:__ @duckdb_v2.h 9223:30@
+
+    __exported by:__ @duckdb_v2.h@
+-}
+c_duckdb_v2_logical_type_is_equal ::
+     DuckDBV2LogicalTypeHandle
+     -- ^ __C declaration:__ @left@
+  -> DuckDBV2LogicalTypeHandle
+     -- ^ __C declaration:__ @right@
+  -> BG.Ptr BG.CBool
+     -- ^ __C declaration:__ @result@
+  -> BG.Ptr DuckDBV2ErrorInfoHandle
+     -- ^ __C declaration:__ @err@
+  -> IO DuckDBV2Error
+c_duckdb_v2_logical_type_is_equal =
+  hs_bindgen_da8cacd6c97feb4c
+
+-- __unique:__ @Database_DuckDB_FFI_V2_Database.DuckDB.FFI.V2_Safe_duckdb_v2_logical_type_get_id@
+foreign import ccall safe "hs_bindgen_315b8d3c078ce6f7" hs_bindgen_315b8d3c078ce6f7_base ::
+     BG.Ptr BG.Void
+  -> BG.Ptr BG.Void
+  -> BG.Ptr BG.Void
+  -> IO BG.CUInt
+
+-- __unique:__ @Database_DuckDB_FFI_V2_Database.DuckDB.FFI.V2_Safe_duckdb_v2_logical_type_get_id@
+hs_bindgen_315b8d3c078ce6f7 ::
+     DuckDBV2LogicalTypeHandle
+  -> BG.Ptr DuckDBV2LogicalTypeId
+  -> BG.Ptr DuckDBV2ErrorInfoHandle
+  -> IO DuckDBV2Error
+hs_bindgen_315b8d3c078ce6f7 =
+  \x0 ->
+    \x1 ->
+      \x2 ->
+        fmap BG.fromFFIType (hs_bindgen_315b8d3c078ce6f7_base (BG.toFFIType x0) (BG.toFFIType x1) (BG.toFFIType x2))
+
+{-| __C declaration:__ @duckdb_v2_logical_type_get_id@
+
+    __defined at:__ @duckdb_v2.h 9240:30@
+
+    __exported by:__ @duckdb_v2.h@
+-}
+c_duckdb_v2_logical_type_get_id ::
+     DuckDBV2LogicalTypeHandle
+     -- ^ __C declaration:__ @type@
+  -> BG.Ptr DuckDBV2LogicalTypeId
+     -- ^ __C declaration:__ @out_id@
+  -> BG.Ptr DuckDBV2ErrorInfoHandle
+     -- ^ __C declaration:__ @err@
+  -> IO DuckDBV2Error
+c_duckdb_v2_logical_type_get_id =
+  hs_bindgen_315b8d3c078ce6f7
+
+-- __unique:__ @Database_DuckDB_FFI_V2_Database.DuckDB.FFI.V2_Safe_duckdb_v2_logical_type_get_name@
+foreign import ccall safe "hs_bindgen_000999a513f4671d" hs_bindgen_000999a513f4671d_base ::
+     BG.Ptr BG.Void
+  -> BG.Ptr BG.Void
+  -> BG.Ptr BG.Void
+  -> IO BG.CUInt
+
+-- __unique:__ @Database_DuckDB_FFI_V2_Database.DuckDB.FFI.V2_Safe_duckdb_v2_logical_type_get_name@
+hs_bindgen_000999a513f4671d ::
+     DuckDBV2LogicalTypeHandle
+  -> BG.Ptr DuckDBV2IdentifierT
+  -> BG.Ptr DuckDBV2ErrorInfoHandle
+  -> IO DuckDBV2Error
+hs_bindgen_000999a513f4671d =
+  \x0 ->
+    \x1 ->
+      \x2 ->
+        fmap BG.fromFFIType (hs_bindgen_000999a513f4671d_base (BG.toFFIType x0) (BG.toFFIType x1) (BG.toFFIType x2))
+
+{-| __C declaration:__ @duckdb_v2_logical_type_get_name@
+
+    __defined at:__ @duckdb_v2.h 9262:30@
+
+    __exported by:__ @duckdb_v2.h@
+-}
+c_duckdb_v2_logical_type_get_name ::
+     DuckDBV2LogicalTypeHandle
+     -- ^ __C declaration:__ @type@
+  -> BG.Ptr DuckDBV2IdentifierT
+     -- ^ __C declaration:__ @out_name@
+  -> BG.Ptr DuckDBV2ErrorInfoHandle
+     -- ^ __C declaration:__ @err@
+  -> IO DuckDBV2Error
+c_duckdb_v2_logical_type_get_name =
+  hs_bindgen_000999a513f4671d
+
+-- __unique:__ @Database_DuckDB_FFI_V2_Database.DuckDB.FFI.V2_Safe_duckdb_v2_logical_type_to_text@
+foreign import ccall safe "hs_bindgen_f3c1e302546be432" hs_bindgen_f3c1e302546be432_base ::
+     BG.Ptr BG.Void
+  -> BG.Ptr BG.Void
+  -> HsBindgen.Runtime.LibC.Word64
+  -> BG.Ptr BG.Void
+  -> BG.Ptr BG.Void
+  -> IO BG.CUInt
+
+-- __unique:__ @Database_DuckDB_FFI_V2_Database.DuckDB.FFI.V2_Safe_duckdb_v2_logical_type_to_text@
+hs_bindgen_f3c1e302546be432 ::
+     DuckDBV2LogicalTypeHandle
+  -> BG.Ptr BG.CChar
+  -> DuckDBIdx
+  -> BG.Ptr DuckDBIdx
+  -> BG.Ptr DuckDBV2ErrorInfoHandle
+  -> IO DuckDBV2Error
+hs_bindgen_f3c1e302546be432 =
+  \x0 ->
+    \x1 ->
+      \x2 ->
+        \x3 ->
+          \x4 ->
+            fmap BG.fromFFIType (hs_bindgen_f3c1e302546be432_base (BG.toFFIType x0) (BG.toFFIType x1) (BG.toFFIType x2) (BG.toFFIType x3) (BG.toFFIType x4))
+
+{-| __C declaration:__ @duckdb_v2_logical_type_to_text@
+
+    __defined at:__ @duckdb_v2.h 9296:30@
+
+    __exported by:__ @duckdb_v2.h@
+-}
+c_duckdb_v2_logical_type_to_text ::
+     DuckDBV2LogicalTypeHandle
+     -- ^ __C declaration:__ @type@
+  -> BG.Ptr BG.CChar
+     -- ^ __C declaration:__ @out_text@
+  -> DuckDBIdx
+     -- ^ __C declaration:__ @out_capacity@
+  -> BG.Ptr DuckDBIdx
+     -- ^ __C declaration:__ @out_length@
+  -> BG.Ptr DuckDBV2ErrorInfoHandle
+     -- ^ __C declaration:__ @err@
+  -> IO DuckDBV2Error
+c_duckdb_v2_logical_type_to_text =
+  hs_bindgen_f3c1e302546be432
+
+-- __unique:__ @Database_DuckDB_FFI_V2_Database.DuckDB.FFI.V2_Safe_duckdb_v2_logical_type_get_param_count@
+foreign import ccall safe "hs_bindgen_556856654e08fce7" hs_bindgen_556856654e08fce7_base ::
+     BG.Ptr BG.Void
+  -> BG.Ptr BG.Void
+  -> BG.Ptr BG.Void
+  -> IO BG.CUInt
+
+-- __unique:__ @Database_DuckDB_FFI_V2_Database.DuckDB.FFI.V2_Safe_duckdb_v2_logical_type_get_param_count@
+hs_bindgen_556856654e08fce7 ::
+     DuckDBV2LogicalTypeHandle
+  -> BG.Ptr DuckDBIdx
+  -> BG.Ptr DuckDBV2ErrorInfoHandle
+  -> IO DuckDBV2Error
+hs_bindgen_556856654e08fce7 =
+  \x0 ->
+    \x1 ->
+      \x2 ->
+        fmap BG.fromFFIType (hs_bindgen_556856654e08fce7_base (BG.toFFIType x0) (BG.toFFIType x1) (BG.toFFIType x2))
+
+{-| __C declaration:__ @duckdb_v2_logical_type_get_param_count@
+
+    __defined at:__ @duckdb_v2.h 9319:30@
+
+    __exported by:__ @duckdb_v2.h@
+-}
+c_duckdb_v2_logical_type_get_param_count ::
+     DuckDBV2LogicalTypeHandle
+     -- ^ __C declaration:__ @type@
+  -> BG.Ptr DuckDBIdx
+     -- ^ __C declaration:__ @out_count@
+  -> BG.Ptr DuckDBV2ErrorInfoHandle
+     -- ^ __C declaration:__ @err@
+  -> IO DuckDBV2Error
+c_duckdb_v2_logical_type_get_param_count =
+  hs_bindgen_556856654e08fce7
+
+-- __unique:__ @Database_DuckDB_FFI_V2_Database.DuckDB.FFI.V2_Safe_duckdb_v2_logical_type_get_param@
+foreign import ccall safe "hs_bindgen_eb8ccfd9c31ac1a9" hs_bindgen_eb8ccfd9c31ac1a9_base ::
+     BG.Ptr BG.Void
+  -> HsBindgen.Runtime.LibC.Word64
+  -> BG.Ptr BG.Void
+  -> BG.Ptr BG.Void
+  -> BG.Ptr BG.Void
+  -> IO BG.CUInt
+
+-- __unique:__ @Database_DuckDB_FFI_V2_Database.DuckDB.FFI.V2_Safe_duckdb_v2_logical_type_get_param@
+hs_bindgen_eb8ccfd9c31ac1a9 ::
+     DuckDBV2LogicalTypeHandle
+  -> DuckDBIdx
+  -> BG.Ptr DuckDBV2IdentifierT
+  -> BG.Ptr DuckDBV2ValueHandle
+  -> BG.Ptr DuckDBV2ErrorInfoHandle
+  -> IO DuckDBV2Error
+hs_bindgen_eb8ccfd9c31ac1a9 =
+  \x0 ->
+    \x1 ->
+      \x2 ->
+        \x3 ->
+          \x4 ->
+            fmap BG.fromFFIType (hs_bindgen_eb8ccfd9c31ac1a9_base (BG.toFFIType x0) (BG.toFFIType x1) (BG.toFFIType x2) (BG.toFFIType x3) (BG.toFFIType x4))
+
+{-| __C declaration:__ @duckdb_v2_logical_type_get_param@
+
+    __defined at:__ @duckdb_v2.h 9344:30@
+
+    __exported by:__ @duckdb_v2.h@
+-}
+c_duckdb_v2_logical_type_get_param ::
+     DuckDBV2LogicalTypeHandle
+     -- ^ __C declaration:__ @type@
+  -> DuckDBIdx
+     -- ^ __C declaration:__ @index@
+  -> BG.Ptr DuckDBV2IdentifierT
+     -- ^ __C declaration:__ @out_name@
+  -> BG.Ptr DuckDBV2ValueHandle
+     -- ^ __C declaration:__ @out_value@
+  -> BG.Ptr DuckDBV2ErrorInfoHandle
+     -- ^ __C declaration:__ @err@
+  -> IO DuckDBV2Error
+c_duckdb_v2_logical_type_get_param =
+  hs_bindgen_eb8ccfd9c31ac1a9
+
+-- __unique:__ @Database_DuckDB_FFI_V2_Database.DuckDB.FFI.V2_Safe_duckdb_v2_factory_create_type_with_alias@
+foreign import ccall safe "hs_bindgen_4d26c25b506fdc43" hs_bindgen_4d26c25b506fdc43_base ::
+     BG.Ptr BG.Void
+  -> BG.Ptr BG.Void
+  -> BG.Ptr BG.Void
+  -> BG.Ptr BG.Void
+  -> BG.Ptr BG.Void
+  -> IO BG.CUInt
+
+-- __unique:__ @Database_DuckDB_FFI_V2_Database.DuckDB.FFI.V2_Safe_duckdb_v2_factory_create_type_with_alias@
+hs_bindgen_4d26c25b506fdc43 ::
+     DuckDBV2FactoryHandle
+  -> DuckDBV2LogicalTypeHandle
+  -> PtrConst.PtrConst DuckDBV2IdentifierT
+  -> BG.Ptr DuckDBV2LogicalTypeHandle
+  -> BG.Ptr DuckDBV2ErrorInfoHandle
+  -> IO DuckDBV2Error
+hs_bindgen_4d26c25b506fdc43 =
+  \x0 ->
+    \x1 ->
+      \x2 ->
+        \x3 ->
+          \x4 ->
+            fmap BG.fromFFIType (hs_bindgen_4d26c25b506fdc43_base (BG.toFFIType x0) (BG.toFFIType x1) (BG.toFFIType x2) (BG.toFFIType x3) (BG.toFFIType x4))
+
+{-| __C declaration:__ @duckdb_v2_factory_create_type_with_alias@
+
+    __defined at:__ @duckdb_v2.h 9372:30@
+
+    __exported by:__ @duckdb_v2.h@
+-}
+c_duckdb_v2_factory_create_type_with_alias ::
+     DuckDBV2FactoryHandle
+     -- ^ __C declaration:__ @factory@
+  -> DuckDBV2LogicalTypeHandle
+     -- ^ __C declaration:__ @base_type@
+  -> PtrConst.PtrConst DuckDBV2IdentifierT
+     -- ^ __C declaration:__ @alias_name@
+  -> BG.Ptr DuckDBV2LogicalTypeHandle
+     -- ^ __C declaration:__ @out_type@
+  -> BG.Ptr DuckDBV2ErrorInfoHandle
+     -- ^ __C declaration:__ @err@
+  -> IO DuckDBV2Error
+c_duckdb_v2_factory_create_type_with_alias =
+  hs_bindgen_4d26c25b506fdc43
+
+-- __unique:__ @Database_DuckDB_FFI_V2_Database.DuckDB.FFI.V2_Safe_duckdb_v2_factory_create_common_type@
+foreign import ccall safe "hs_bindgen_cc99c1f96b585442" hs_bindgen_cc99c1f96b585442_base ::
+     BG.Ptr BG.Void
+  -> BG.Ptr BG.Void
+  -> HsBindgen.Runtime.LibC.Word64
+  -> BG.Ptr BG.Void
+  -> BG.Ptr BG.Void
+  -> IO BG.CUInt
+
+-- __unique:__ @Database_DuckDB_FFI_V2_Database.DuckDB.FFI.V2_Safe_duckdb_v2_factory_create_common_type@
+hs_bindgen_cc99c1f96b585442 ::
+     DuckDBV2FactoryHandle
+  -> PtrConst.PtrConst DuckDBV2LogicalTypeHandle
+  -> DuckDBIdx
+  -> BG.Ptr DuckDBV2LogicalTypeHandle
+  -> BG.Ptr DuckDBV2ErrorInfoHandle
+  -> IO DuckDBV2Error
+hs_bindgen_cc99c1f96b585442 =
+  \x0 ->
+    \x1 ->
+      \x2 ->
+        \x3 ->
+          \x4 ->
+            fmap BG.fromFFIType (hs_bindgen_cc99c1f96b585442_base (BG.toFFIType x0) (BG.toFFIType x1) (BG.toFFIType x2) (BG.toFFIType x3) (BG.toFFIType x4))
+
+{-| __C declaration:__ @duckdb_v2_factory_create_common_type@
+
+    __defined at:__ @duckdb_v2.h 9405:30@
+
+    __exported by:__ @duckdb_v2.h@
+-}
+c_duckdb_v2_factory_create_common_type ::
+     DuckDBV2FactoryHandle
+     -- ^ __C declaration:__ @factory@
+  -> PtrConst.PtrConst DuckDBV2LogicalTypeHandle
+     -- ^ __C declaration:__ @types@
+  -> DuckDBIdx
+     -- ^ __C declaration:__ @type_count@
+  -> BG.Ptr DuckDBV2LogicalTypeHandle
+     -- ^ __C declaration:__ @out_type@
+  -> BG.Ptr DuckDBV2ErrorInfoHandle
+     -- ^ __C declaration:__ @err@
+  -> IO DuckDBV2Error
+c_duckdb_v2_factory_create_common_type =
+  hs_bindgen_cc99c1f96b585442
+
+-- __unique:__ @Database_DuckDB_FFI_V2_Database.DuckDB.FFI.V2_Safe_duckdb_v2_macro_function_create@
+foreign import ccall safe "hs_bindgen_0ec6f47de28749e2" hs_bindgen_0ec6f47de28749e2_base ::
+     BG.Ptr BG.Void
+  -> BG.CUInt
+  -> BG.Ptr BG.Void
+  -> BG.Ptr BG.Void
+  -> IO BG.CUInt
+
+-- __unique:__ @Database_DuckDB_FFI_V2_Database.DuckDB.FFI.V2_Safe_duckdb_v2_macro_function_create@
+hs_bindgen_0ec6f47de28749e2 ::
+     DuckDBV2FactoryHandle
+  -> DuckDBV2MacroFunctionType
+  -> BG.Ptr DuckDBV2MacroFunctionHandle
+  -> BG.Ptr DuckDBV2ErrorInfoHandle
+  -> IO DuckDBV2Error
+hs_bindgen_0ec6f47de28749e2 =
+  \x0 ->
+    \x1 ->
+      \x2 ->
+        \x3 ->
+          fmap BG.fromFFIType (hs_bindgen_0ec6f47de28749e2_base (BG.toFFIType x0) (BG.toFFIType x1) (BG.toFFIType x2) (BG.toFFIType x3))
+
+{-| __C declaration:__ @duckdb_v2_macro_function_create@
+
+    __defined at:__ @duckdb_v2.h 9471:30@
+
+    __exported by:__ @duckdb_v2.h@
+-}
+c_duckdb_v2_macro_function_create ::
+     DuckDBV2FactoryHandle
+     -- ^ __C declaration:__ @factory@
+  -> DuckDBV2MacroFunctionType
+     -- ^ __C declaration:__ @type@
+  -> BG.Ptr DuckDBV2MacroFunctionHandle
+     -- ^ __C declaration:__ @function@
+  -> BG.Ptr DuckDBV2ErrorInfoHandle
+     -- ^ __C declaration:__ @err@
+  -> IO DuckDBV2Error
+c_duckdb_v2_macro_function_create =
+  hs_bindgen_0ec6f47de28749e2
+
+-- __unique:__ @Database_DuckDB_FFI_V2_Database.DuckDB.FFI.V2_Safe_duckdb_v2_macro_function_set_name@
+foreign import ccall safe "hs_bindgen_fbc9bc7caa2b478e" hs_bindgen_fbc9bc7caa2b478e_base ::
+     BG.Ptr BG.Void
+  -> BG.Ptr BG.Void
+  -> BG.Ptr BG.Void
+  -> IO BG.CUInt
+
+-- __unique:__ @Database_DuckDB_FFI_V2_Database.DuckDB.FFI.V2_Safe_duckdb_v2_macro_function_set_name@
+hs_bindgen_fbc9bc7caa2b478e ::
+     DuckDBV2MacroFunctionHandle
+  -> PtrConst.PtrConst DuckDBV2IdentifierT
+  -> BG.Ptr DuckDBV2ErrorInfoHandle
+  -> IO DuckDBV2Error
+hs_bindgen_fbc9bc7caa2b478e =
+  \x0 ->
+    \x1 ->
+      \x2 ->
+        fmap BG.fromFFIType (hs_bindgen_fbc9bc7caa2b478e_base (BG.toFFIType x0) (BG.toFFIType x1) (BG.toFFIType x2))
+
+{-| __C declaration:__ @duckdb_v2_macro_function_set_name@
+
+    __defined at:__ @duckdb_v2.h 9493:30@
+
+    __exported by:__ @duckdb_v2.h@
+-}
+c_duckdb_v2_macro_function_set_name ::
+     DuckDBV2MacroFunctionHandle
+     -- ^ __C declaration:__ @function@
+  -> PtrConst.PtrConst DuckDBV2IdentifierT
+     -- ^ __C declaration:__ @name@
+  -> BG.Ptr DuckDBV2ErrorInfoHandle
+     -- ^ __C declaration:__ @err@
+  -> IO DuckDBV2Error
+c_duckdb_v2_macro_function_set_name =
+  hs_bindgen_fbc9bc7caa2b478e
+
+-- __unique:__ @Database_DuckDB_FFI_V2_Database.DuckDB.FFI.V2_Safe_duckdb_v2_macro_function_set_body@
+foreign import ccall safe "hs_bindgen_8974df2b60571bd5" hs_bindgen_8974df2b60571bd5_base ::
+     BG.Ptr BG.Void
+  -> BG.Ptr BG.Void
+  -> BG.Ptr BG.Void
+  -> IO BG.CUInt
+
+-- __unique:__ @Database_DuckDB_FFI_V2_Database.DuckDB.FFI.V2_Safe_duckdb_v2_macro_function_set_body@
+hs_bindgen_8974df2b60571bd5 ::
+     DuckDBV2MacroFunctionHandle
+  -> PtrConst.PtrConst DuckDBV2Str
+  -> BG.Ptr DuckDBV2ErrorInfoHandle
+  -> IO DuckDBV2Error
+hs_bindgen_8974df2b60571bd5 =
+  \x0 ->
+    \x1 ->
+      \x2 ->
+        fmap BG.fromFFIType (hs_bindgen_8974df2b60571bd5_base (BG.toFFIType x0) (BG.toFFIType x1) (BG.toFFIType x2))
+
+{-| __C declaration:__ @duckdb_v2_macro_function_set_body@
+
+    __defined at:__ @duckdb_v2.h 9516:30@
+
+    __exported by:__ @duckdb_v2.h@
+-}
+c_duckdb_v2_macro_function_set_body ::
+     DuckDBV2MacroFunctionHandle
+     -- ^ __C declaration:__ @function@
+  -> PtrConst.PtrConst DuckDBV2Str
+     -- ^ __C declaration:__ @body@
+  -> BG.Ptr DuckDBV2ErrorInfoHandle
+     -- ^ __C declaration:__ @err@
+  -> IO DuckDBV2Error
+c_duckdb_v2_macro_function_set_body =
+  hs_bindgen_8974df2b60571bd5
+
+-- __unique:__ @Database_DuckDB_FFI_V2_Database.DuckDB.FFI.V2_Safe_duckdb_v2_macro_function_get_signature@
+foreign import ccall safe "hs_bindgen_b175b543b7110600" hs_bindgen_b175b543b7110600_base ::
+     BG.Ptr BG.Void
+  -> BG.Ptr BG.Void
+  -> BG.Ptr BG.Void
+  -> IO BG.CUInt
+
+-- __unique:__ @Database_DuckDB_FFI_V2_Database.DuckDB.FFI.V2_Safe_duckdb_v2_macro_function_get_signature@
+hs_bindgen_b175b543b7110600 ::
+     DuckDBV2MacroFunctionHandle
+  -> BG.Ptr DuckDBV2FunctionSignatureHandle
+  -> BG.Ptr DuckDBV2ErrorInfoHandle
+  -> IO DuckDBV2Error
+hs_bindgen_b175b543b7110600 =
+  \x0 ->
+    \x1 ->
+      \x2 ->
+        fmap BG.fromFFIType (hs_bindgen_b175b543b7110600_base (BG.toFFIType x0) (BG.toFFIType x1) (BG.toFFIType x2))
+
+{-| __C declaration:__ @duckdb_v2_macro_function_get_signature@
+
+    __defined at:__ @duckdb_v2.h 9540:30@
+
+    __exported by:__ @duckdb_v2.h@
+-}
+c_duckdb_v2_macro_function_get_signature ::
+     DuckDBV2MacroFunctionHandle
+     -- ^ __C declaration:__ @function@
+  -> BG.Ptr DuckDBV2FunctionSignatureHandle
+     -- ^ __C declaration:__ @sig@
+  -> BG.Ptr DuckDBV2ErrorInfoHandle
+     -- ^ __C declaration:__ @err@
+  -> IO DuckDBV2Error
+c_duckdb_v2_macro_function_get_signature =
+  hs_bindgen_b175b543b7110600
+
+-- __unique:__ @Database_DuckDB_FFI_V2_Database.DuckDB.FFI.V2_Safe_duckdb_v2_macro_function_get_docs@
+foreign import ccall safe "hs_bindgen_db8a42ade972ac8a" hs_bindgen_db8a42ade972ac8a_base ::
+     BG.Ptr BG.Void
+  -> BG.Ptr BG.Void
+  -> BG.Ptr BG.Void
+  -> IO BG.CUInt
+
+-- __unique:__ @Database_DuckDB_FFI_V2_Database.DuckDB.FFI.V2_Safe_duckdb_v2_macro_function_get_docs@
+hs_bindgen_db8a42ade972ac8a ::
+     DuckDBV2MacroFunctionHandle
+  -> BG.Ptr DuckDBV2FunctionDocsHandle
+  -> BG.Ptr DuckDBV2ErrorInfoHandle
+  -> IO DuckDBV2Error
+hs_bindgen_db8a42ade972ac8a =
+  \x0 ->
+    \x1 ->
+      \x2 ->
+        fmap BG.fromFFIType (hs_bindgen_db8a42ade972ac8a_base (BG.toFFIType x0) (BG.toFFIType x1) (BG.toFFIType x2))
+
+{-| __C declaration:__ @duckdb_v2_macro_function_get_docs@
+
+    __defined at:__ @duckdb_v2.h 9562:30@
+
+    __exported by:__ @duckdb_v2.h@
+-}
+c_duckdb_v2_macro_function_get_docs ::
+     DuckDBV2MacroFunctionHandle
+     -- ^ __C declaration:__ @function@
+  -> BG.Ptr DuckDBV2FunctionDocsHandle
+     -- ^ __C declaration:__ @docs@
+  -> BG.Ptr DuckDBV2ErrorInfoHandle
+     -- ^ __C declaration:__ @err@
+  -> IO DuckDBV2Error
+c_duckdb_v2_macro_function_get_docs =
+  hs_bindgen_db8a42ade972ac8a
+
+-- __unique:__ @Database_DuckDB_FFI_V2_Database.DuckDB.FFI.V2_Safe_duckdb_v2_extension_register_macro_function@
+foreign import ccall safe "hs_bindgen_5ca6b4239899f807" hs_bindgen_5ca6b4239899f807_base ::
+     BG.Ptr BG.Void
+  -> BG.Ptr BG.Void
+  -> BG.Ptr BG.Void
+  -> IO BG.CUInt
+
+-- __unique:__ @Database_DuckDB_FFI_V2_Database.DuckDB.FFI.V2_Safe_duckdb_v2_extension_register_macro_function@
+hs_bindgen_5ca6b4239899f807 ::
+     DuckDBV2ExtensionHandle
+  -> DuckDBV2MacroFunctionHandle
+  -> BG.Ptr DuckDBV2ErrorInfoHandle
+  -> IO DuckDBV2Error
+hs_bindgen_5ca6b4239899f807 =
+  \x0 ->
+    \x1 ->
+      \x2 ->
+        fmap BG.fromFFIType (hs_bindgen_5ca6b4239899f807_base (BG.toFFIType x0) (BG.toFFIType x1) (BG.toFFIType x2))
+
+{-| __C declaration:__ @duckdb_v2_extension_register_macro_function@
+
+    __defined at:__ @duckdb_v2.h 9587:30@
+
+    __exported by:__ @duckdb_v2.h@
+-}
+c_duckdb_v2_extension_register_macro_function ::
+     DuckDBV2ExtensionHandle
+     -- ^ __C declaration:__ @extension@
+  -> DuckDBV2MacroFunctionHandle
+     -- ^ __C declaration:__ @function@
+  -> BG.Ptr DuckDBV2ErrorInfoHandle
+     -- ^ __C declaration:__ @err@
+  -> IO DuckDBV2Error
+c_duckdb_v2_extension_register_macro_function =
+  hs_bindgen_5ca6b4239899f807
+
+-- __unique:__ @Database_DuckDB_FFI_V2_Database.DuckDB.FFI.V2_Safe_duckdb_v2_macro_function_destroy@
+foreign import ccall safe "hs_bindgen_2fff35927f226418" hs_bindgen_2fff35927f226418_base ::
+     BG.Ptr BG.Void
+  -> IO BG.CUInt
+
+-- __unique:__ @Database_DuckDB_FFI_V2_Database.DuckDB.FFI.V2_Safe_duckdb_v2_macro_function_destroy@
+hs_bindgen_2fff35927f226418 ::
+     BG.Ptr DuckDBV2MacroFunctionHandle
+  -> IO DuckDBV2Error
+hs_bindgen_2fff35927f226418 =
+  \x0 ->
+    fmap BG.fromFFIType (hs_bindgen_2fff35927f226418_base (BG.toFFIType x0))
+
+{-| __C declaration:__ @duckdb_v2_macro_function_destroy@
+
+    __defined at:__ @duckdb_v2.h 9605:30@
+
+    __exported by:__ @duckdb_v2.h@
+-}
+c_duckdb_v2_macro_function_destroy ::
+     BG.Ptr DuckDBV2MacroFunctionHandle
+     -- ^ __C declaration:__ @function@
+  -> IO DuckDBV2Error
+c_duckdb_v2_macro_function_destroy =
+  hs_bindgen_2fff35927f226418
+
+-- __unique:__ @Database_DuckDB_FFI_V2_Database.DuckDB.FFI.V2_Safe_duckdb_v2_pragma_function_create@
+foreign import ccall safe "hs_bindgen_48eaeacc5a484d09" hs_bindgen_48eaeacc5a484d09_base ::
+     BG.Ptr BG.Void
+  -> BG.Ptr BG.Void
+  -> BG.Ptr BG.Void
+  -> IO BG.CUInt
+
+-- __unique:__ @Database_DuckDB_FFI_V2_Database.DuckDB.FFI.V2_Safe_duckdb_v2_pragma_function_create@
+hs_bindgen_48eaeacc5a484d09 ::
+     DuckDBV2FactoryHandle
+  -> BG.Ptr DuckDBV2PragmaFunctionHandle
+  -> BG.Ptr DuckDBV2ErrorInfoHandle
+  -> IO DuckDBV2Error
+hs_bindgen_48eaeacc5a484d09 =
+  \x0 ->
+    \x1 ->
+      \x2 ->
+        fmap BG.fromFFIType (hs_bindgen_48eaeacc5a484d09_base (BG.toFFIType x0) (BG.toFFIType x1) (BG.toFFIType x2))
+
+{-| __C declaration:__ @duckdb_v2_pragma_function_create@
+
+    __defined at:__ @duckdb_v2.h 9676:30@
+
+    __exported by:__ @duckdb_v2.h@
+-}
+c_duckdb_v2_pragma_function_create ::
+     DuckDBV2FactoryHandle
+     -- ^ __C declaration:__ @factory@
+  -> BG.Ptr DuckDBV2PragmaFunctionHandle
+     -- ^ __C declaration:__ @function@
+  -> BG.Ptr DuckDBV2ErrorInfoHandle
+     -- ^ __C declaration:__ @err@
+  -> IO DuckDBV2Error
+c_duckdb_v2_pragma_function_create =
+  hs_bindgen_48eaeacc5a484d09
+
+-- __unique:__ @Database_DuckDB_FFI_V2_Database.DuckDB.FFI.V2_Safe_duckdb_v2_pragma_function_set_name@
+foreign import ccall safe "hs_bindgen_ce9f59e68b8a9710" hs_bindgen_ce9f59e68b8a9710_base ::
+     BG.Ptr BG.Void
+  -> BG.Ptr BG.Void
+  -> BG.Ptr BG.Void
+  -> IO BG.CUInt
+
+-- __unique:__ @Database_DuckDB_FFI_V2_Database.DuckDB.FFI.V2_Safe_duckdb_v2_pragma_function_set_name@
+hs_bindgen_ce9f59e68b8a9710 ::
+     DuckDBV2PragmaFunctionHandle
+  -> PtrConst.PtrConst DuckDBV2IdentifierT
+  -> BG.Ptr DuckDBV2ErrorInfoHandle
+  -> IO DuckDBV2Error
+hs_bindgen_ce9f59e68b8a9710 =
+  \x0 ->
+    \x1 ->
+      \x2 ->
+        fmap BG.fromFFIType (hs_bindgen_ce9f59e68b8a9710_base (BG.toFFIType x0) (BG.toFFIType x1) (BG.toFFIType x2))
+
+{-| __C declaration:__ @duckdb_v2_pragma_function_set_name@
+
+    __defined at:__ @duckdb_v2.h 9697:30@
+
+    __exported by:__ @duckdb_v2.h@
+-}
+c_duckdb_v2_pragma_function_set_name ::
+     DuckDBV2PragmaFunctionHandle
+     -- ^ __C declaration:__ @function@
+  -> PtrConst.PtrConst DuckDBV2IdentifierT
+     -- ^ __C declaration:__ @name@
+  -> BG.Ptr DuckDBV2ErrorInfoHandle
+     -- ^ __C declaration:__ @err@
+  -> IO DuckDBV2Error
+c_duckdb_v2_pragma_function_set_name =
+  hs_bindgen_ce9f59e68b8a9710
+
+-- __unique:__ @Database_DuckDB_FFI_V2_Database.DuckDB.FFI.V2_Safe_duckdb_v2_pragma_function_get_docs@
+foreign import ccall safe "hs_bindgen_2dcad178887151dc" hs_bindgen_2dcad178887151dc_base ::
+     BG.Ptr BG.Void
+  -> BG.Ptr BG.Void
+  -> BG.Ptr BG.Void
+  -> IO BG.CUInt
+
+-- __unique:__ @Database_DuckDB_FFI_V2_Database.DuckDB.FFI.V2_Safe_duckdb_v2_pragma_function_get_docs@
+hs_bindgen_2dcad178887151dc ::
+     DuckDBV2PragmaFunctionHandle
+  -> BG.Ptr DuckDBV2FunctionDocsHandle
+  -> BG.Ptr DuckDBV2ErrorInfoHandle
+  -> IO DuckDBV2Error
+hs_bindgen_2dcad178887151dc =
+  \x0 ->
+    \x1 ->
+      \x2 ->
+        fmap BG.fromFFIType (hs_bindgen_2dcad178887151dc_base (BG.toFFIType x0) (BG.toFFIType x1) (BG.toFFIType x2))
+
+{-| __C declaration:__ @duckdb_v2_pragma_function_get_docs@
+
+    __defined at:__ @duckdb_v2.h 9719:30@
+
+    __exported by:__ @duckdb_v2.h@
+-}
+c_duckdb_v2_pragma_function_get_docs ::
+     DuckDBV2PragmaFunctionHandle
+     -- ^ __C declaration:__ @function@
+  -> BG.Ptr DuckDBV2FunctionDocsHandle
+     -- ^ __C declaration:__ @docs@
+  -> BG.Ptr DuckDBV2ErrorInfoHandle
+     -- ^ __C declaration:__ @err@
+  -> IO DuckDBV2Error
+c_duckdb_v2_pragma_function_get_docs =
+  hs_bindgen_2dcad178887151dc
+
+-- __unique:__ @Database_DuckDB_FFI_V2_Database.DuckDB.FFI.V2_Safe_duckdb_v2_pragma_function_get_signature@
+foreign import ccall safe "hs_bindgen_cfc9a98383af3415" hs_bindgen_cfc9a98383af3415_base ::
+     BG.Ptr BG.Void
+  -> BG.Ptr BG.Void
+  -> BG.Ptr BG.Void
+  -> IO BG.CUInt
+
+-- __unique:__ @Database_DuckDB_FFI_V2_Database.DuckDB.FFI.V2_Safe_duckdb_v2_pragma_function_get_signature@
+hs_bindgen_cfc9a98383af3415 ::
+     DuckDBV2PragmaFunctionHandle
+  -> BG.Ptr DuckDBV2FunctionSignatureHandle
+  -> BG.Ptr DuckDBV2ErrorInfoHandle
+  -> IO DuckDBV2Error
+hs_bindgen_cfc9a98383af3415 =
+  \x0 ->
+    \x1 ->
+      \x2 ->
+        fmap BG.fromFFIType (hs_bindgen_cfc9a98383af3415_base (BG.toFFIType x0) (BG.toFFIType x1) (BG.toFFIType x2))
+
+{-| __C declaration:__ @duckdb_v2_pragma_function_get_signature@
+
+    __defined at:__ @duckdb_v2.h 9741:30@
+
+    __exported by:__ @duckdb_v2.h@
+-}
+c_duckdb_v2_pragma_function_get_signature ::
+     DuckDBV2PragmaFunctionHandle
+     -- ^ __C declaration:__ @function@
+  -> BG.Ptr DuckDBV2FunctionSignatureHandle
+     -- ^ __C declaration:__ @sig@
+  -> BG.Ptr DuckDBV2ErrorInfoHandle
+     -- ^ __C declaration:__ @err@
+  -> IO DuckDBV2Error
+c_duckdb_v2_pragma_function_get_signature =
+  hs_bindgen_cfc9a98383af3415
+
+-- __unique:__ @Database_DuckDB_FFI_V2_Database.DuckDB.FFI.V2_Safe_duckdb_v2_pragma_function_set_user_data@
+foreign import ccall safe "hs_bindgen_44b0dd64abaa1c0c" hs_bindgen_44b0dd64abaa1c0c_base ::
+     BG.Ptr BG.Void
+  -> BG.Ptr BG.Void
+  -> BG.Ptr BG.Void
+  -> IO BG.CUInt
+
+-- __unique:__ @Database_DuckDB_FFI_V2_Database.DuckDB.FFI.V2_Safe_duckdb_v2_pragma_function_set_user_data@
+hs_bindgen_44b0dd64abaa1c0c ::
+     DuckDBV2PragmaFunctionHandle
+  -> BG.Ptr DuckDBV2Opaque
+  -> BG.Ptr DuckDBV2ErrorInfoHandle
+  -> IO DuckDBV2Error
+hs_bindgen_44b0dd64abaa1c0c =
+  \x0 ->
+    \x1 ->
+      \x2 ->
+        fmap BG.fromFFIType (hs_bindgen_44b0dd64abaa1c0c_base (BG.toFFIType x0) (BG.toFFIType x1) (BG.toFFIType x2))
+
+{-| __C declaration:__ @duckdb_v2_pragma_function_set_user_data@
+
+    __defined at:__ @duckdb_v2.h 9763:30@
+
+    __exported by:__ @duckdb_v2.h@
+-}
+c_duckdb_v2_pragma_function_set_user_data ::
+     DuckDBV2PragmaFunctionHandle
+     -- ^ __C declaration:__ @function@
+  -> BG.Ptr DuckDBV2Opaque
+     -- ^ __C declaration:__ @data@
+  -> BG.Ptr DuckDBV2ErrorInfoHandle
+     -- ^ __C declaration:__ @err@
+  -> IO DuckDBV2Error
+c_duckdb_v2_pragma_function_set_user_data =
+  hs_bindgen_44b0dd64abaa1c0c
+
+-- __unique:__ @Database_DuckDB_FFI_V2_Database.DuckDB.FFI.V2_Safe_duckdb_v2_pragma_function_set_query_callback@
+foreign import ccall safe "hs_bindgen_5d6de7f3388be2c4" hs_bindgen_5d6de7f3388be2c4_base ::
+     BG.Ptr BG.Void
+  -> BG.FunPtr BG.Void
+  -> BG.Ptr BG.Void
+  -> IO BG.CUInt
+
+-- __unique:__ @Database_DuckDB_FFI_V2_Database.DuckDB.FFI.V2_Safe_duckdb_v2_pragma_function_set_query_callback@
+hs_bindgen_5d6de7f3388be2c4 ::
+     DuckDBV2PragmaFunctionHandle
+  -> DuckDBV2PragmaFunctionQueryCallbackFn
+  -> BG.Ptr DuckDBV2ErrorInfoHandle
+  -> IO DuckDBV2Error
+hs_bindgen_5d6de7f3388be2c4 =
+  \x0 ->
+    \x1 ->
+      \x2 ->
+        fmap BG.fromFFIType (hs_bindgen_5d6de7f3388be2c4_base (BG.toFFIType x0) (BG.toFFIType x1) (BG.toFFIType x2))
+
+{-| __C declaration:__ @duckdb_v2_pragma_function_set_query_callback@
+
+    __defined at:__ @duckdb_v2.h 9786:30@
+
+    __exported by:__ @duckdb_v2.h@
+-}
+c_duckdb_v2_pragma_function_set_query_callback ::
+     DuckDBV2PragmaFunctionHandle
+     -- ^ __C declaration:__ @function@
+  -> DuckDBV2PragmaFunctionQueryCallbackFn
+     -- ^ __C declaration:__ @callback@
+  -> BG.Ptr DuckDBV2ErrorInfoHandle
+     -- ^ __C declaration:__ @err@
+  -> IO DuckDBV2Error
+c_duckdb_v2_pragma_function_set_query_callback =
+  hs_bindgen_5d6de7f3388be2c4
+
+-- __unique:__ @Database_DuckDB_FFI_V2_Database.DuckDB.FFI.V2_Safe_duckdb_v2_pragma_function_set_exec_callback@
+foreign import ccall safe "hs_bindgen_4b951b7060351cad" hs_bindgen_4b951b7060351cad_base ::
+     BG.Ptr BG.Void
+  -> BG.FunPtr BG.Void
+  -> BG.Ptr BG.Void
+  -> IO BG.CUInt
+
+-- __unique:__ @Database_DuckDB_FFI_V2_Database.DuckDB.FFI.V2_Safe_duckdb_v2_pragma_function_set_exec_callback@
+hs_bindgen_4b951b7060351cad ::
+     DuckDBV2PragmaFunctionHandle
+  -> DuckDBV2PragmaFunctionExecCallbackFn
+  -> BG.Ptr DuckDBV2ErrorInfoHandle
+  -> IO DuckDBV2Error
+hs_bindgen_4b951b7060351cad =
+  \x0 ->
+    \x1 ->
+      \x2 ->
+        fmap BG.fromFFIType (hs_bindgen_4b951b7060351cad_base (BG.toFFIType x0) (BG.toFFIType x1) (BG.toFFIType x2))
+
+{-| __C declaration:__ @duckdb_v2_pragma_function_set_exec_callback@
+
+    __defined at:__ @duckdb_v2.h 9808:30@
+
+    __exported by:__ @duckdb_v2.h@
+-}
+c_duckdb_v2_pragma_function_set_exec_callback ::
+     DuckDBV2PragmaFunctionHandle
+     -- ^ __C declaration:__ @function@
+  -> DuckDBV2PragmaFunctionExecCallbackFn
+     -- ^ __C declaration:__ @callback@
+  -> BG.Ptr DuckDBV2ErrorInfoHandle
+     -- ^ __C declaration:__ @err@
+  -> IO DuckDBV2Error
+c_duckdb_v2_pragma_function_set_exec_callback =
+  hs_bindgen_4b951b7060351cad
+
+-- __unique:__ @Database_DuckDB_FFI_V2_Database.DuckDB.FFI.V2_Safe_duckdb_v2_pragma_function_query_set_query@
+foreign import ccall safe "hs_bindgen_b801373b24c488d6" hs_bindgen_b801373b24c488d6_base ::
+     BG.Ptr BG.Void
+  -> BG.Ptr BG.Void
+  -> BG.Ptr BG.Void
+  -> IO BG.CUInt
+
+-- __unique:__ @Database_DuckDB_FFI_V2_Database.DuckDB.FFI.V2_Safe_duckdb_v2_pragma_function_query_set_query@
+hs_bindgen_b801373b24c488d6 ::
+     DuckDBV2PragmaFunctionQueryInfoHandle
+  -> PtrConst.PtrConst DuckDBV2Str
+  -> BG.Ptr DuckDBV2ErrorInfoHandle
+  -> IO DuckDBV2Error
+hs_bindgen_b801373b24c488d6 =
+  \x0 ->
+    \x1 ->
+      \x2 ->
+        fmap BG.fromFFIType (hs_bindgen_b801373b24c488d6_base (BG.toFFIType x0) (BG.toFFIType x1) (BG.toFFIType x2))
+
+{-| __C declaration:__ @duckdb_v2_pragma_function_query_set_query@
+
+    __defined at:__ @duckdb_v2.h 9829:30@
+
+    __exported by:__ @duckdb_v2.h@
+-}
+c_duckdb_v2_pragma_function_query_set_query ::
+     DuckDBV2PragmaFunctionQueryInfoHandle
+     -- ^ __C declaration:__ @info@
+  -> PtrConst.PtrConst DuckDBV2Str
+     -- ^ __C declaration:__ @query@
+  -> BG.Ptr DuckDBV2ErrorInfoHandle
+     -- ^ __C declaration:__ @err@
+  -> IO DuckDBV2Error
+c_duckdb_v2_pragma_function_query_set_query =
+  hs_bindgen_b801373b24c488d6
+
+-- __unique:__ @Database_DuckDB_FFI_V2_Database.DuckDB.FFI.V2_Safe_duckdb_v2_connection_register_pragma_function@
+foreign import ccall safe "hs_bindgen_039a9dadc75b2b29" hs_bindgen_039a9dadc75b2b29_base ::
+     BG.Ptr BG.Void
+  -> BG.Ptr BG.Void
+  -> BG.Ptr BG.Void
+  -> IO BG.CUInt
+
+-- __unique:__ @Database_DuckDB_FFI_V2_Database.DuckDB.FFI.V2_Safe_duckdb_v2_connection_register_pragma_function@
+hs_bindgen_039a9dadc75b2b29 ::
+     DuckDBV2ConnectionHandle
+  -> DuckDBV2PragmaFunctionHandle
+  -> BG.Ptr DuckDBV2ErrorInfoHandle
+  -> IO DuckDBV2Error
+hs_bindgen_039a9dadc75b2b29 =
+  \x0 ->
+    \x1 ->
+      \x2 ->
+        fmap BG.fromFFIType (hs_bindgen_039a9dadc75b2b29_base (BG.toFFIType x0) (BG.toFFIType x1) (BG.toFFIType x2))
+
+{-| __C declaration:__ @duckdb_v2_connection_register_pragma_function@
+
+    __defined at:__ @duckdb_v2.h 9854:30@
+
+    __exported by:__ @duckdb_v2.h@
+-}
+c_duckdb_v2_connection_register_pragma_function ::
+     DuckDBV2ConnectionHandle
+     -- ^ __C declaration:__ @conn@
+  -> DuckDBV2PragmaFunctionHandle
+     -- ^ __C declaration:__ @function@
+  -> BG.Ptr DuckDBV2ErrorInfoHandle
+     -- ^ __C declaration:__ @err@
+  -> IO DuckDBV2Error
+c_duckdb_v2_connection_register_pragma_function =
+  hs_bindgen_039a9dadc75b2b29
+
+-- __unique:__ @Database_DuckDB_FFI_V2_Database.DuckDB.FFI.V2_Safe_duckdb_v2_extension_register_pragma_function@
+foreign import ccall safe "hs_bindgen_e6919d9feffe14b6" hs_bindgen_e6919d9feffe14b6_base ::
+     BG.Ptr BG.Void
+  -> BG.Ptr BG.Void
+  -> BG.Ptr BG.Void
+  -> IO BG.CUInt
+
+-- __unique:__ @Database_DuckDB_FFI_V2_Database.DuckDB.FFI.V2_Safe_duckdb_v2_extension_register_pragma_function@
+hs_bindgen_e6919d9feffe14b6 ::
+     DuckDBV2ExtensionHandle
+  -> DuckDBV2PragmaFunctionHandle
+  -> BG.Ptr DuckDBV2ErrorInfoHandle
+  -> IO DuckDBV2Error
+hs_bindgen_e6919d9feffe14b6 =
+  \x0 ->
+    \x1 ->
+      \x2 ->
+        fmap BG.fromFFIType (hs_bindgen_e6919d9feffe14b6_base (BG.toFFIType x0) (BG.toFFIType x1) (BG.toFFIType x2))
+
+{-| __C declaration:__ @duckdb_v2_extension_register_pragma_function@
+
+    __defined at:__ @duckdb_v2.h 9878:30@
+
+    __exported by:__ @duckdb_v2.h@
+-}
+c_duckdb_v2_extension_register_pragma_function ::
+     DuckDBV2ExtensionHandle
+     -- ^ __C declaration:__ @extension@
+  -> DuckDBV2PragmaFunctionHandle
+     -- ^ __C declaration:__ @function@
+  -> BG.Ptr DuckDBV2ErrorInfoHandle
+     -- ^ __C declaration:__ @err@
+  -> IO DuckDBV2Error
+c_duckdb_v2_extension_register_pragma_function =
+  hs_bindgen_e6919d9feffe14b6
+
+-- __unique:__ @Database_DuckDB_FFI_V2_Database.DuckDB.FFI.V2_Safe_duckdb_v2_pragma_function_destroy@
+foreign import ccall safe "hs_bindgen_8b887df3599166b2" hs_bindgen_8b887df3599166b2_base ::
+     BG.Ptr BG.Void
+  -> IO BG.CUInt
+
+-- __unique:__ @Database_DuckDB_FFI_V2_Database.DuckDB.FFI.V2_Safe_duckdb_v2_pragma_function_destroy@
+hs_bindgen_8b887df3599166b2 ::
+     BG.Ptr DuckDBV2PragmaFunctionHandle
+  -> IO DuckDBV2Error
+hs_bindgen_8b887df3599166b2 =
+  \x0 ->
+    fmap BG.fromFFIType (hs_bindgen_8b887df3599166b2_base (BG.toFFIType x0))
+
+{-| __C declaration:__ @duckdb_v2_pragma_function_destroy@
+
+    __defined at:__ @duckdb_v2.h 9896:30@
+
+    __exported by:__ @duckdb_v2.h@
+-}
+c_duckdb_v2_pragma_function_destroy ::
+     BG.Ptr DuckDBV2PragmaFunctionHandle
+     -- ^ __C declaration:__ @function@
+  -> IO DuckDBV2Error
+c_duckdb_v2_pragma_function_destroy =
+  hs_bindgen_8b887df3599166b2
+
+-- __unique:__ @Database_DuckDB_FFI_V2_Database.DuckDB.FFI.V2_Safe_duckdb_v2_replacement_scan_create@
+foreign import ccall safe "hs_bindgen_9a9c477c199679ce" hs_bindgen_9a9c477c199679ce_base ::
+     BG.Ptr BG.Void
+  -> BG.Ptr BG.Void
+  -> BG.Ptr BG.Void
+  -> IO BG.CUInt
+
+-- __unique:__ @Database_DuckDB_FFI_V2_Database.DuckDB.FFI.V2_Safe_duckdb_v2_replacement_scan_create@
+hs_bindgen_9a9c477c199679ce ::
+     DuckDBV2FactoryHandle
+  -> BG.Ptr DuckDBV2ReplacementScanHandle
+  -> BG.Ptr DuckDBV2ErrorInfoHandle
+  -> IO DuckDBV2Error
+hs_bindgen_9a9c477c199679ce =
+  \x0 ->
+    \x1 ->
+      \x2 ->
+        fmap BG.fromFFIType (hs_bindgen_9a9c477c199679ce_base (BG.toFFIType x0) (BG.toFFIType x1) (BG.toFFIType x2))
+
+{-| __C declaration:__ @duckdb_v2_replacement_scan_create@
+
+    __defined at:__ @duckdb_v2.h 9961:30@
+
+    __exported by:__ @duckdb_v2.h@
+-}
+c_duckdb_v2_replacement_scan_create ::
+     DuckDBV2FactoryHandle
+     -- ^ __C declaration:__ @factory@
+  -> BG.Ptr DuckDBV2ReplacementScanHandle
+     -- ^ __C declaration:__ @scan@
+  -> BG.Ptr DuckDBV2ErrorInfoHandle
+     -- ^ __C declaration:__ @err@
+  -> IO DuckDBV2Error
+c_duckdb_v2_replacement_scan_create =
+  hs_bindgen_9a9c477c199679ce
+
+-- __unique:__ @Database_DuckDB_FFI_V2_Database.DuckDB.FFI.V2_Safe_duckdb_v2_replacement_scan_set_callback@
+foreign import ccall safe "hs_bindgen_6d9b9297faec84c9" hs_bindgen_6d9b9297faec84c9_base ::
+     BG.Ptr BG.Void
+  -> BG.FunPtr BG.Void
+  -> BG.Ptr BG.Void
+  -> IO BG.CUInt
+
+-- __unique:__ @Database_DuckDB_FFI_V2_Database.DuckDB.FFI.V2_Safe_duckdb_v2_replacement_scan_set_callback@
+hs_bindgen_6d9b9297faec84c9 ::
+     DuckDBV2ReplacementScanHandle
+  -> DuckDBV2ReplacementScanCallbackFn
+  -> BG.Ptr DuckDBV2ErrorInfoHandle
+  -> IO DuckDBV2Error
+hs_bindgen_6d9b9297faec84c9 =
+  \x0 ->
+    \x1 ->
+      \x2 ->
+        fmap BG.fromFFIType (hs_bindgen_6d9b9297faec84c9_base (BG.toFFIType x0) (BG.toFFIType x1) (BG.toFFIType x2))
+
+{-| __C declaration:__ @duckdb_v2_replacement_scan_set_callback@
+
+    __defined at:__ @duckdb_v2.h 9985:30@
+
+    __exported by:__ @duckdb_v2.h@
+-}
+c_duckdb_v2_replacement_scan_set_callback ::
+     DuckDBV2ReplacementScanHandle
+     -- ^ __C declaration:__ @scan@
+  -> DuckDBV2ReplacementScanCallbackFn
+     -- ^ __C declaration:__ @callback@
+  -> BG.Ptr DuckDBV2ErrorInfoHandle
+     -- ^ __C declaration:__ @err@
+  -> IO DuckDBV2Error
+c_duckdb_v2_replacement_scan_set_callback =
+  hs_bindgen_6d9b9297faec84c9
+
+-- __unique:__ @Database_DuckDB_FFI_V2_Database.DuckDB.FFI.V2_Safe_duckdb_v2_replacement_scan_set_user_data@
+foreign import ccall safe "hs_bindgen_13a4465156ae64d7" hs_bindgen_13a4465156ae64d7_base ::
+     BG.Ptr BG.Void
+  -> BG.Ptr BG.Void
+  -> BG.Ptr BG.Void
+  -> IO BG.CUInt
+
+-- __unique:__ @Database_DuckDB_FFI_V2_Database.DuckDB.FFI.V2_Safe_duckdb_v2_replacement_scan_set_user_data@
+hs_bindgen_13a4465156ae64d7 ::
+     DuckDBV2ReplacementScanHandle
+  -> BG.Ptr DuckDBV2Opaque
+  -> BG.Ptr DuckDBV2ErrorInfoHandle
+  -> IO DuckDBV2Error
+hs_bindgen_13a4465156ae64d7 =
+  \x0 ->
+    \x1 ->
+      \x2 ->
+        fmap BG.fromFFIType (hs_bindgen_13a4465156ae64d7_base (BG.toFFIType x0) (BG.toFFIType x1) (BG.toFFIType x2))
+
+{-| __C declaration:__ @duckdb_v2_replacement_scan_set_user_data@
+
+    __defined at:__ @duckdb_v2.h 10008:30@
+
+    __exported by:__ @duckdb_v2.h@
+-}
+c_duckdb_v2_replacement_scan_set_user_data ::
+     DuckDBV2ReplacementScanHandle
+     -- ^ __C declaration:__ @scan@
+  -> BG.Ptr DuckDBV2Opaque
+     -- ^ __C declaration:__ @data@
+  -> BG.Ptr DuckDBV2ErrorInfoHandle
+     -- ^ __C declaration:__ @err@
+  -> IO DuckDBV2Error
+c_duckdb_v2_replacement_scan_set_user_data =
+  hs_bindgen_13a4465156ae64d7
+
+-- __unique:__ @Database_DuckDB_FFI_V2_Database.DuckDB.FFI.V2_Safe_duckdb_v2_replacement_scan_get_user_data@
+foreign import ccall safe "hs_bindgen_d0be9d4e018884b3" hs_bindgen_d0be9d4e018884b3_base ::
+     BG.Ptr BG.Void
+  -> BG.Ptr BG.Void
+  -> BG.Ptr BG.Void
+  -> IO BG.CUInt
+
+-- __unique:__ @Database_DuckDB_FFI_V2_Database.DuckDB.FFI.V2_Safe_duckdb_v2_replacement_scan_get_user_data@
+hs_bindgen_d0be9d4e018884b3 ::
+     DuckDBV2ReplacementScanInfoHandle
+  -> BG.Ptr (BG.Ptr BG.Void)
+  -> BG.Ptr DuckDBV2ErrorInfoHandle
+  -> IO DuckDBV2Error
+hs_bindgen_d0be9d4e018884b3 =
+  \x0 ->
+    \x1 ->
+      \x2 ->
+        fmap BG.fromFFIType (hs_bindgen_d0be9d4e018884b3_base (BG.toFFIType x0) (BG.toFFIType x1) (BG.toFFIType x2))
+
+{-| __C declaration:__ @duckdb_v2_replacement_scan_get_user_data@
+
+    __defined at:__ @duckdb_v2.h 10026:30@
+
+    __exported by:__ @duckdb_v2.h@
+-}
+c_duckdb_v2_replacement_scan_get_user_data ::
+     DuckDBV2ReplacementScanInfoHandle
+     -- ^ __C declaration:__ @info@
+  -> BG.Ptr (BG.Ptr BG.Void)
+     -- ^ __C declaration:__ @data@
+  -> BG.Ptr DuckDBV2ErrorInfoHandle
+     -- ^ __C declaration:__ @err@
+  -> IO DuckDBV2Error
+c_duckdb_v2_replacement_scan_get_user_data =
+  hs_bindgen_d0be9d4e018884b3
+
+-- __unique:__ @Database_DuckDB_FFI_V2_Database.DuckDB.FFI.V2_Safe_duckdb_v2_replacement_scan_get_name@
+foreign import ccall safe "hs_bindgen_60b13e3e17341dc4" hs_bindgen_60b13e3e17341dc4_base ::
+     BG.Ptr BG.Void
+  -> BG.Ptr BG.Void
+  -> BG.Ptr BG.Void
+  -> IO BG.CUInt
+
+-- __unique:__ @Database_DuckDB_FFI_V2_Database.DuckDB.FFI.V2_Safe_duckdb_v2_replacement_scan_get_name@
+hs_bindgen_60b13e3e17341dc4 ::
+     DuckDBV2ReplacementScanInfoHandle
+  -> BG.Ptr DuckDBV2QnameHandle
+  -> BG.Ptr DuckDBV2ErrorInfoHandle
+  -> IO DuckDBV2Error
+hs_bindgen_60b13e3e17341dc4 =
+  \x0 ->
+    \x1 ->
+      \x2 ->
+        fmap BG.fromFFIType (hs_bindgen_60b13e3e17341dc4_base (BG.toFFIType x0) (BG.toFFIType x1) (BG.toFFIType x2))
+
+{-| __C declaration:__ @duckdb_v2_replacement_scan_get_name@
+
+    __defined at:__ @duckdb_v2.h 10048:30@
+
+    __exported by:__ @duckdb_v2.h@
+-}
+c_duckdb_v2_replacement_scan_get_name ::
+     DuckDBV2ReplacementScanInfoHandle
+     -- ^ __C declaration:__ @info@
+  -> BG.Ptr DuckDBV2QnameHandle
+     -- ^ __C declaration:__ @name@
+  -> BG.Ptr DuckDBV2ErrorInfoHandle
+     -- ^ __C declaration:__ @err@
+  -> IO DuckDBV2Error
+c_duckdb_v2_replacement_scan_get_name =
+  hs_bindgen_60b13e3e17341dc4
+
+-- __unique:__ @Database_DuckDB_FFI_V2_Database.DuckDB.FFI.V2_Safe_duckdb_v2_replacement_scan_set_function_name@
+foreign import ccall safe "hs_bindgen_275dcb99adeb56bf" hs_bindgen_275dcb99adeb56bf_base ::
+     BG.Ptr BG.Void
+  -> BG.Ptr BG.Void
+  -> BG.Ptr BG.Void
+  -> IO BG.CUInt
+
+-- __unique:__ @Database_DuckDB_FFI_V2_Database.DuckDB.FFI.V2_Safe_duckdb_v2_replacement_scan_set_function_name@
+hs_bindgen_275dcb99adeb56bf ::
+     DuckDBV2ReplacementScanInfoHandle
+  -> DuckDBV2QnameHandle
+  -> BG.Ptr DuckDBV2ErrorInfoHandle
+  -> IO DuckDBV2Error
+hs_bindgen_275dcb99adeb56bf =
+  \x0 ->
+    \x1 ->
+      \x2 ->
+        fmap BG.fromFFIType (hs_bindgen_275dcb99adeb56bf_base (BG.toFFIType x0) (BG.toFFIType x1) (BG.toFFIType x2))
+
+{-| __C declaration:__ @duckdb_v2_replacement_scan_set_function_name@
+
+    __defined at:__ @duckdb_v2.h 10076:30@
+
+    __exported by:__ @duckdb_v2.h@
+-}
+c_duckdb_v2_replacement_scan_set_function_name ::
+     DuckDBV2ReplacementScanInfoHandle
+     -- ^ __C declaration:__ @info@
+  -> DuckDBV2QnameHandle
+     -- ^ __C declaration:__ @name@
+  -> BG.Ptr DuckDBV2ErrorInfoHandle
+     -- ^ __C declaration:__ @err@
+  -> IO DuckDBV2Error
+c_duckdb_v2_replacement_scan_set_function_name =
+  hs_bindgen_275dcb99adeb56bf
+
+-- __unique:__ @Database_DuckDB_FFI_V2_Database.DuckDB.FFI.V2_Safe_duckdb_v2_replacement_scan_add_argument@
+foreign import ccall safe "hs_bindgen_b4c78412a057de08" hs_bindgen_b4c78412a057de08_base ::
+     BG.Ptr BG.Void
+  -> BG.Ptr BG.Void
+  -> BG.Ptr BG.Void
+  -> IO BG.CUInt
+
+-- __unique:__ @Database_DuckDB_FFI_V2_Database.DuckDB.FFI.V2_Safe_duckdb_v2_replacement_scan_add_argument@
+hs_bindgen_b4c78412a057de08 ::
+     DuckDBV2ReplacementScanInfoHandle
+  -> DuckDBV2ValueHandle
+  -> BG.Ptr DuckDBV2ErrorInfoHandle
+  -> IO DuckDBV2Error
+hs_bindgen_b4c78412a057de08 =
+  \x0 ->
+    \x1 ->
+      \x2 ->
+        fmap BG.fromFFIType (hs_bindgen_b4c78412a057de08_base (BG.toFFIType x0) (BG.toFFIType x1) (BG.toFFIType x2))
+
+{-| __C declaration:__ @duckdb_v2_replacement_scan_add_argument@
+
+    __defined at:__ @duckdb_v2.h 10098:30@
+
+    __exported by:__ @duckdb_v2.h@
+-}
+c_duckdb_v2_replacement_scan_add_argument ::
+     DuckDBV2ReplacementScanInfoHandle
+     -- ^ __C declaration:__ @info@
+  -> DuckDBV2ValueHandle
+     -- ^ __C declaration:__ @value@
+  -> BG.Ptr DuckDBV2ErrorInfoHandle
+     -- ^ __C declaration:__ @err@
+  -> IO DuckDBV2Error
+c_duckdb_v2_replacement_scan_add_argument =
+  hs_bindgen_b4c78412a057de08
+
+-- __unique:__ @Database_DuckDB_FFI_V2_Database.DuckDB.FFI.V2_Safe_duckdb_v2_replacement_scan_add_named_argument@
+foreign import ccall safe "hs_bindgen_5b0e8f4b06bdf6af" hs_bindgen_5b0e8f4b06bdf6af_base ::
+     BG.Ptr BG.Void
+  -> BG.Ptr BG.Void
+  -> BG.Ptr BG.Void
+  -> BG.Ptr BG.Void
+  -> IO BG.CUInt
+
+-- __unique:__ @Database_DuckDB_FFI_V2_Database.DuckDB.FFI.V2_Safe_duckdb_v2_replacement_scan_add_named_argument@
+hs_bindgen_5b0e8f4b06bdf6af ::
+     DuckDBV2ReplacementScanInfoHandle
+  -> PtrConst.PtrConst DuckDBV2IdentifierT
+  -> DuckDBV2ValueHandle
+  -> BG.Ptr DuckDBV2ErrorInfoHandle
+  -> IO DuckDBV2Error
+hs_bindgen_5b0e8f4b06bdf6af =
+  \x0 ->
+    \x1 ->
+      \x2 ->
+        \x3 ->
+          fmap BG.fromFFIType (hs_bindgen_5b0e8f4b06bdf6af_base (BG.toFFIType x0) (BG.toFFIType x1) (BG.toFFIType x2) (BG.toFFIType x3))
+
+{-| __C declaration:__ @duckdb_v2_replacement_scan_add_named_argument@
+
+    __defined at:__ @duckdb_v2.h 10121:30@
+
+    __exported by:__ @duckdb_v2.h@
+-}
+c_duckdb_v2_replacement_scan_add_named_argument ::
+     DuckDBV2ReplacementScanInfoHandle
+     -- ^ __C declaration:__ @info@
+  -> PtrConst.PtrConst DuckDBV2IdentifierT
+     -- ^ __C declaration:__ @name@
+  -> DuckDBV2ValueHandle
+     -- ^ __C declaration:__ @value@
+  -> BG.Ptr DuckDBV2ErrorInfoHandle
+     -- ^ __C declaration:__ @err@
+  -> IO DuckDBV2Error
+c_duckdb_v2_replacement_scan_add_named_argument =
+  hs_bindgen_5b0e8f4b06bdf6af
+
+-- __unique:__ @Database_DuckDB_FFI_V2_Database.DuckDB.FFI.V2_Safe_duckdb_v2_replacement_scan_set_collection@
+foreign import ccall safe "hs_bindgen_b0fa215fb44418e1" hs_bindgen_b0fa215fb44418e1_base ::
+     BG.Ptr BG.Void
+  -> BG.Ptr BG.Void
+  -> BG.Ptr BG.Void
+  -> HsBindgen.Runtime.LibC.Word64
+  -> BG.Ptr BG.Void
+  -> IO BG.CUInt
+
+-- __unique:__ @Database_DuckDB_FFI_V2_Database.DuckDB.FFI.V2_Safe_duckdb_v2_replacement_scan_set_collection@
+hs_bindgen_b0fa215fb44418e1 ::
+     DuckDBV2ReplacementScanInfoHandle
+  -> DuckDBV2ColumnDataCollectionHandle
+  -> PtrConst.PtrConst DuckDBV2IdentifierT
+  -> DuckDBIdx
+  -> BG.Ptr DuckDBV2ErrorInfoHandle
+  -> IO DuckDBV2Error
+hs_bindgen_b0fa215fb44418e1 =
+  \x0 ->
+    \x1 ->
+      \x2 ->
+        \x3 ->
+          \x4 ->
+            fmap BG.fromFFIType (hs_bindgen_b0fa215fb44418e1_base (BG.toFFIType x0) (BG.toFFIType x1) (BG.toFFIType x2) (BG.toFFIType x3) (BG.toFFIType x4))
+
+{-| __C declaration:__ @duckdb_v2_replacement_scan_set_collection@
+
+    __defined at:__ @duckdb_v2.h 10163:30@
+
+    __exported by:__ @duckdb_v2.h@
+-}
+c_duckdb_v2_replacement_scan_set_collection ::
+     DuckDBV2ReplacementScanInfoHandle
+     -- ^ __C declaration:__ @info@
+  -> DuckDBV2ColumnDataCollectionHandle
+     -- ^ __C declaration:__ @collection@
+  -> PtrConst.PtrConst DuckDBV2IdentifierT
+     -- ^ __C declaration:__ @column_names@
+  -> DuckDBIdx
+     -- ^ __C declaration:__ @column_count@
+  -> BG.Ptr DuckDBV2ErrorInfoHandle
+     -- ^ __C declaration:__ @err@
+  -> IO DuckDBV2Error
+c_duckdb_v2_replacement_scan_set_collection =
+  hs_bindgen_b0fa215fb44418e1
+
+-- __unique:__ @Database_DuckDB_FFI_V2_Database.DuckDB.FFI.V2_Safe_duckdb_v2_replacement_scan_set_subquery@
+foreign import ccall safe "hs_bindgen_144e586318b59139" hs_bindgen_144e586318b59139_base ::
+     BG.Ptr BG.Void
+  -> BG.Ptr BG.Void
+  -> BG.Ptr BG.Void
+  -> IO BG.CUInt
+
+-- __unique:__ @Database_DuckDB_FFI_V2_Database.DuckDB.FFI.V2_Safe_duckdb_v2_replacement_scan_set_subquery@
+hs_bindgen_144e586318b59139 ::
+     DuckDBV2ReplacementScanInfoHandle
+  -> PtrConst.PtrConst DuckDBV2Str
+  -> BG.Ptr DuckDBV2ErrorInfoHandle
+  -> IO DuckDBV2Error
+hs_bindgen_144e586318b59139 =
+  \x0 ->
+    \x1 ->
+      \x2 ->
+        fmap BG.fromFFIType (hs_bindgen_144e586318b59139_base (BG.toFFIType x0) (BG.toFFIType x1) (BG.toFFIType x2))
+
+{-| __C declaration:__ @duckdb_v2_replacement_scan_set_subquery@
+
+    __defined at:__ @duckdb_v2.h 10190:30@
+
+    __exported by:__ @duckdb_v2.h@
+-}
+c_duckdb_v2_replacement_scan_set_subquery ::
+     DuckDBV2ReplacementScanInfoHandle
+     -- ^ __C declaration:__ @info@
+  -> PtrConst.PtrConst DuckDBV2Str
+     -- ^ __C declaration:__ @sql@
+  -> BG.Ptr DuckDBV2ErrorInfoHandle
+     -- ^ __C declaration:__ @err@
+  -> IO DuckDBV2Error
+c_duckdb_v2_replacement_scan_set_subquery =
+  hs_bindgen_144e586318b59139
+
+-- __unique:__ @Database_DuckDB_FFI_V2_Database.DuckDB.FFI.V2_Safe_duckdb_v2_replacement_scan_set_alias@
+foreign import ccall safe "hs_bindgen_0c37cfe083a44d27" hs_bindgen_0c37cfe083a44d27_base ::
+     BG.Ptr BG.Void
+  -> BG.Ptr BG.Void
+  -> BG.Ptr BG.Void
+  -> IO BG.CUInt
+
+-- __unique:__ @Database_DuckDB_FFI_V2_Database.DuckDB.FFI.V2_Safe_duckdb_v2_replacement_scan_set_alias@
+hs_bindgen_0c37cfe083a44d27 ::
+     DuckDBV2ReplacementScanInfoHandle
+  -> PtrConst.PtrConst DuckDBV2IdentifierT
+  -> BG.Ptr DuckDBV2ErrorInfoHandle
+  -> IO DuckDBV2Error
+hs_bindgen_0c37cfe083a44d27 =
+  \x0 ->
+    \x1 ->
+      \x2 ->
+        fmap BG.fromFFIType (hs_bindgen_0c37cfe083a44d27_base (BG.toFFIType x0) (BG.toFFIType x1) (BG.toFFIType x2))
+
+{-| __C declaration:__ @duckdb_v2_replacement_scan_set_alias@
+
+    __defined at:__ @duckdb_v2.h 10212:30@
+
+    __exported by:__ @duckdb_v2.h@
+-}
+c_duckdb_v2_replacement_scan_set_alias ::
+     DuckDBV2ReplacementScanInfoHandle
+     -- ^ __C declaration:__ @info@
+  -> PtrConst.PtrConst DuckDBV2IdentifierT
+     -- ^ __C declaration:__ @alias@
+  -> BG.Ptr DuckDBV2ErrorInfoHandle
+     -- ^ __C declaration:__ @err@
+  -> IO DuckDBV2Error
+c_duckdb_v2_replacement_scan_set_alias =
+  hs_bindgen_0c37cfe083a44d27
+
+-- __unique:__ @Database_DuckDB_FFI_V2_Database.DuckDB.FFI.V2_Safe_duckdb_v2_connection_register_replacement_scan@
+foreign import ccall safe "hs_bindgen_e57429e0c52c2e37" hs_bindgen_e57429e0c52c2e37_base ::
+     BG.Ptr BG.Void
+  -> BG.Ptr BG.Void
+  -> BG.Ptr BG.Void
+  -> IO BG.CUInt
+
+-- __unique:__ @Database_DuckDB_FFI_V2_Database.DuckDB.FFI.V2_Safe_duckdb_v2_connection_register_replacement_scan@
+hs_bindgen_e57429e0c52c2e37 ::
+     DuckDBV2ConnectionHandle
+  -> DuckDBV2ReplacementScanHandle
+  -> BG.Ptr DuckDBV2ErrorInfoHandle
+  -> IO DuckDBV2Error
+hs_bindgen_e57429e0c52c2e37 =
+  \x0 ->
+    \x1 ->
+      \x2 ->
+        fmap BG.fromFFIType (hs_bindgen_e57429e0c52c2e37_base (BG.toFFIType x0) (BG.toFFIType x1) (BG.toFFIType x2))
+
+{-| __C declaration:__ @duckdb_v2_connection_register_replacement_scan@
+
+    __defined at:__ @duckdb_v2.h 10238:30@
+
+    __exported by:__ @duckdb_v2.h@
+-}
+c_duckdb_v2_connection_register_replacement_scan ::
+     DuckDBV2ConnectionHandle
+     -- ^ __C declaration:__ @conn@
+  -> DuckDBV2ReplacementScanHandle
+     -- ^ __C declaration:__ @scan@
+  -> BG.Ptr DuckDBV2ErrorInfoHandle
+     -- ^ __C declaration:__ @err@
+  -> IO DuckDBV2Error
+c_duckdb_v2_connection_register_replacement_scan =
+  hs_bindgen_e57429e0c52c2e37
+
+-- __unique:__ @Database_DuckDB_FFI_V2_Database.DuckDB.FFI.V2_Safe_duckdb_v2_instance_register_replacement_scan@
+foreign import ccall safe "hs_bindgen_b7c7467789b7fc1c" hs_bindgen_b7c7467789b7fc1c_base ::
+     BG.Ptr BG.Void
+  -> BG.Ptr BG.Void
+  -> BG.Ptr BG.Void
+  -> IO BG.CUInt
+
+-- __unique:__ @Database_DuckDB_FFI_V2_Database.DuckDB.FFI.V2_Safe_duckdb_v2_instance_register_replacement_scan@
+hs_bindgen_b7c7467789b7fc1c ::
+     DuckDBV2InstanceHandle
+  -> DuckDBV2ReplacementScanHandle
+  -> BG.Ptr DuckDBV2ErrorInfoHandle
+  -> IO DuckDBV2Error
+hs_bindgen_b7c7467789b7fc1c =
+  \x0 ->
+    \x1 ->
+      \x2 ->
+        fmap BG.fromFFIType (hs_bindgen_b7c7467789b7fc1c_base (BG.toFFIType x0) (BG.toFFIType x1) (BG.toFFIType x2))
+
+{-| __C declaration:__ @duckdb_v2_instance_register_replacement_scan@
+
+    __defined at:__ @duckdb_v2.h 10264:30@
+
+    __exported by:__ @duckdb_v2.h@
+-}
+c_duckdb_v2_instance_register_replacement_scan ::
+     DuckDBV2InstanceHandle
+     -- ^ __C declaration:__ @instance@
+  -> DuckDBV2ReplacementScanHandle
+     -- ^ __C declaration:__ @scan@
+  -> BG.Ptr DuckDBV2ErrorInfoHandle
+     -- ^ __C declaration:__ @err@
+  -> IO DuckDBV2Error
+c_duckdb_v2_instance_register_replacement_scan =
+  hs_bindgen_b7c7467789b7fc1c
+
+-- __unique:__ @Database_DuckDB_FFI_V2_Database.DuckDB.FFI.V2_Safe_duckdb_v2_extension_register_replacement_scan@
+foreign import ccall safe "hs_bindgen_14d15707b0c6050f" hs_bindgen_14d15707b0c6050f_base ::
+     BG.Ptr BG.Void
+  -> BG.Ptr BG.Void
+  -> BG.Ptr BG.Void
+  -> IO BG.CUInt
+
+-- __unique:__ @Database_DuckDB_FFI_V2_Database.DuckDB.FFI.V2_Safe_duckdb_v2_extension_register_replacement_scan@
+hs_bindgen_14d15707b0c6050f ::
+     DuckDBV2ExtensionHandle
+  -> DuckDBV2ReplacementScanHandle
+  -> BG.Ptr DuckDBV2ErrorInfoHandle
+  -> IO DuckDBV2Error
+hs_bindgen_14d15707b0c6050f =
+  \x0 ->
+    \x1 ->
+      \x2 ->
+        fmap BG.fromFFIType (hs_bindgen_14d15707b0c6050f_base (BG.toFFIType x0) (BG.toFFIType x1) (BG.toFFIType x2))
+
+{-| __C declaration:__ @duckdb_v2_extension_register_replacement_scan@
+
+    __defined at:__ @duckdb_v2.h 10290:30@
+
+    __exported by:__ @duckdb_v2.h@
+-}
+c_duckdb_v2_extension_register_replacement_scan ::
+     DuckDBV2ExtensionHandle
+     -- ^ __C declaration:__ @extension@
+  -> DuckDBV2ReplacementScanHandle
+     -- ^ __C declaration:__ @scan@
+  -> BG.Ptr DuckDBV2ErrorInfoHandle
+     -- ^ __C declaration:__ @err@
+  -> IO DuckDBV2Error
+c_duckdb_v2_extension_register_replacement_scan =
+  hs_bindgen_14d15707b0c6050f
+
+-- __unique:__ @Database_DuckDB_FFI_V2_Database.DuckDB.FFI.V2_Safe_duckdb_v2_replacement_scan_destroy@
+foreign import ccall safe "hs_bindgen_315b4557190f4c0a" hs_bindgen_315b4557190f4c0a_base ::
+     BG.Ptr BG.Void
+  -> IO BG.CUInt
+
+-- __unique:__ @Database_DuckDB_FFI_V2_Database.DuckDB.FFI.V2_Safe_duckdb_v2_replacement_scan_destroy@
+hs_bindgen_315b4557190f4c0a ::
+     BG.Ptr DuckDBV2ReplacementScanHandle
+  -> IO DuckDBV2Error
+hs_bindgen_315b4557190f4c0a =
+  \x0 ->
+    fmap BG.fromFFIType (hs_bindgen_315b4557190f4c0a_base (BG.toFFIType x0))
+
+{-| __C declaration:__ @duckdb_v2_replacement_scan_destroy@
+
+    __defined at:__ @duckdb_v2.h 10308:30@
+
+    __exported by:__ @duckdb_v2.h@
+-}
+c_duckdb_v2_replacement_scan_destroy ::
+     BG.Ptr DuckDBV2ReplacementScanHandle
+     -- ^ __C declaration:__ @scan@
+  -> IO DuckDBV2Error
+c_duckdb_v2_replacement_scan_destroy =
+  hs_bindgen_315b4557190f4c0a
+
+-- __unique:__ @Database_DuckDB_FFI_V2_Database.DuckDB.FFI.V2_Safe_duckdb_v2_scalar_function_create@
+foreign import ccall safe "hs_bindgen_742f0751928cb67d" hs_bindgen_742f0751928cb67d_base ::
+     BG.Ptr BG.Void
+  -> BG.Ptr BG.Void
+  -> BG.Ptr BG.Void
+  -> IO BG.CUInt
+
+-- __unique:__ @Database_DuckDB_FFI_V2_Database.DuckDB.FFI.V2_Safe_duckdb_v2_scalar_function_create@
+hs_bindgen_742f0751928cb67d ::
+     DuckDBV2FactoryHandle
+  -> BG.Ptr DuckDBV2ScalarFunctionHandle
+  -> BG.Ptr DuckDBV2ErrorInfoHandle
+  -> IO DuckDBV2Error
+hs_bindgen_742f0751928cb67d =
+  \x0 ->
+    \x1 ->
+      \x2 ->
+        fmap BG.fromFFIType (hs_bindgen_742f0751928cb67d_base (BG.toFFIType x0) (BG.toFFIType x1) (BG.toFFIType x2))
+
+{-| __C declaration:__ @duckdb_v2_scalar_function_create@
+
+    __defined at:__ @duckdb_v2.h 10414:30@
+
+    __exported by:__ @duckdb_v2.h@
+-}
+c_duckdb_v2_scalar_function_create ::
+     DuckDBV2FactoryHandle
+     -- ^ __C declaration:__ @factory@
+  -> BG.Ptr DuckDBV2ScalarFunctionHandle
+     -- ^ __C declaration:__ @function@
+  -> BG.Ptr DuckDBV2ErrorInfoHandle
+     -- ^ __C declaration:__ @err@
+  -> IO DuckDBV2Error
+c_duckdb_v2_scalar_function_create =
+  hs_bindgen_742f0751928cb67d
+
+-- __unique:__ @Database_DuckDB_FFI_V2_Database.DuckDB.FFI.V2_Safe_duckdb_v2_scalar_function_set_name@
+foreign import ccall safe "hs_bindgen_aa81d34a271fa43e" hs_bindgen_aa81d34a271fa43e_base ::
+     BG.Ptr BG.Void
+  -> BG.Ptr BG.Void
+  -> BG.Ptr BG.Void
+  -> IO BG.CUInt
+
+-- __unique:__ @Database_DuckDB_FFI_V2_Database.DuckDB.FFI.V2_Safe_duckdb_v2_scalar_function_set_name@
+hs_bindgen_aa81d34a271fa43e ::
+     DuckDBV2ScalarFunctionHandle
+  -> PtrConst.PtrConst DuckDBV2IdentifierT
+  -> BG.Ptr DuckDBV2ErrorInfoHandle
+  -> IO DuckDBV2Error
+hs_bindgen_aa81d34a271fa43e =
+  \x0 ->
+    \x1 ->
+      \x2 ->
+        fmap BG.fromFFIType (hs_bindgen_aa81d34a271fa43e_base (BG.toFFIType x0) (BG.toFFIType x1) (BG.toFFIType x2))
+
+{-| __C declaration:__ @duckdb_v2_scalar_function_set_name@
+
+    __defined at:__ @duckdb_v2.h 10435:30@
+
+    __exported by:__ @duckdb_v2.h@
+-}
+c_duckdb_v2_scalar_function_set_name ::
+     DuckDBV2ScalarFunctionHandle
+     -- ^ __C declaration:__ @function@
+  -> PtrConst.PtrConst DuckDBV2IdentifierT
+     -- ^ __C declaration:__ @name@
+  -> BG.Ptr DuckDBV2ErrorInfoHandle
+     -- ^ __C declaration:__ @err@
+  -> IO DuckDBV2Error
+c_duckdb_v2_scalar_function_set_name =
+  hs_bindgen_aa81d34a271fa43e
+
+-- __unique:__ @Database_DuckDB_FFI_V2_Database.DuckDB.FFI.V2_Safe_duckdb_v2_scalar_function_get_docs@
+foreign import ccall safe "hs_bindgen_40a9e1f8dd5b6e31" hs_bindgen_40a9e1f8dd5b6e31_base ::
+     BG.Ptr BG.Void
+  -> BG.Ptr BG.Void
+  -> BG.Ptr BG.Void
+  -> IO BG.CUInt
+
+-- __unique:__ @Database_DuckDB_FFI_V2_Database.DuckDB.FFI.V2_Safe_duckdb_v2_scalar_function_get_docs@
+hs_bindgen_40a9e1f8dd5b6e31 ::
+     DuckDBV2ScalarFunctionHandle
+  -> BG.Ptr DuckDBV2FunctionDocsHandle
+  -> BG.Ptr DuckDBV2ErrorInfoHandle
+  -> IO DuckDBV2Error
+hs_bindgen_40a9e1f8dd5b6e31 =
+  \x0 ->
+    \x1 ->
+      \x2 ->
+        fmap BG.fromFFIType (hs_bindgen_40a9e1f8dd5b6e31_base (BG.toFFIType x0) (BG.toFFIType x1) (BG.toFFIType x2))
+
+{-| __C declaration:__ @duckdb_v2_scalar_function_get_docs@
+
+    __defined at:__ @duckdb_v2.h 10457:30@
+
+    __exported by:__ @duckdb_v2.h@
+-}
+c_duckdb_v2_scalar_function_get_docs ::
+     DuckDBV2ScalarFunctionHandle
+     -- ^ __C declaration:__ @function@
+  -> BG.Ptr DuckDBV2FunctionDocsHandle
+     -- ^ __C declaration:__ @docs@
+  -> BG.Ptr DuckDBV2ErrorInfoHandle
+     -- ^ __C declaration:__ @err@
+  -> IO DuckDBV2Error
+c_duckdb_v2_scalar_function_get_docs =
+  hs_bindgen_40a9e1f8dd5b6e31
+
+-- __unique:__ @Database_DuckDB_FFI_V2_Database.DuckDB.FFI.V2_Safe_duckdb_v2_scalar_function_get_signature@
+foreign import ccall safe "hs_bindgen_f119236c665eadd6" hs_bindgen_f119236c665eadd6_base ::
+     BG.Ptr BG.Void
+  -> BG.Ptr BG.Void
+  -> BG.Ptr BG.Void
+  -> IO BG.CUInt
+
+-- __unique:__ @Database_DuckDB_FFI_V2_Database.DuckDB.FFI.V2_Safe_duckdb_v2_scalar_function_get_signature@
+hs_bindgen_f119236c665eadd6 ::
+     DuckDBV2ScalarFunctionHandle
+  -> BG.Ptr DuckDBV2FunctionSignatureHandle
+  -> BG.Ptr DuckDBV2ErrorInfoHandle
+  -> IO DuckDBV2Error
+hs_bindgen_f119236c665eadd6 =
+  \x0 ->
+    \x1 ->
+      \x2 ->
+        fmap BG.fromFFIType (hs_bindgen_f119236c665eadd6_base (BG.toFFIType x0) (BG.toFFIType x1) (BG.toFFIType x2))
+
+{-| __C declaration:__ @duckdb_v2_scalar_function_get_signature@
+
+    __defined at:__ @duckdb_v2.h 10479:30@
+
+    __exported by:__ @duckdb_v2.h@
+-}
+c_duckdb_v2_scalar_function_get_signature ::
+     DuckDBV2ScalarFunctionHandle
+     -- ^ __C declaration:__ @function@
+  -> BG.Ptr DuckDBV2FunctionSignatureHandle
+     -- ^ __C declaration:__ @sig@
+  -> BG.Ptr DuckDBV2ErrorInfoHandle
+     -- ^ __C declaration:__ @err@
+  -> IO DuckDBV2Error
+c_duckdb_v2_scalar_function_get_signature =
+  hs_bindgen_f119236c665eadd6
+
+-- __unique:__ @Database_DuckDB_FFI_V2_Database.DuckDB.FFI.V2_Safe_duckdb_v2_scalar_function_set_user_data@
+foreign import ccall safe "hs_bindgen_4da7a6f078093aab" hs_bindgen_4da7a6f078093aab_base ::
+     BG.Ptr BG.Void
+  -> BG.Ptr BG.Void
+  -> BG.Ptr BG.Void
+  -> IO BG.CUInt
+
+-- __unique:__ @Database_DuckDB_FFI_V2_Database.DuckDB.FFI.V2_Safe_duckdb_v2_scalar_function_set_user_data@
+hs_bindgen_4da7a6f078093aab ::
+     DuckDBV2ScalarFunctionHandle
+  -> BG.Ptr DuckDBV2Opaque
+  -> BG.Ptr DuckDBV2ErrorInfoHandle
+  -> IO DuckDBV2Error
+hs_bindgen_4da7a6f078093aab =
+  \x0 ->
+    \x1 ->
+      \x2 ->
+        fmap BG.fromFFIType (hs_bindgen_4da7a6f078093aab_base (BG.toFFIType x0) (BG.toFFIType x1) (BG.toFFIType x2))
+
+{-| __C declaration:__ @duckdb_v2_scalar_function_set_user_data@
+
+    __defined at:__ @duckdb_v2.h 10502:30@
+
+    __exported by:__ @duckdb_v2.h@
+-}
+c_duckdb_v2_scalar_function_set_user_data ::
+     DuckDBV2ScalarFunctionHandle
+     -- ^ __C declaration:__ @function@
+  -> BG.Ptr DuckDBV2Opaque
+     -- ^ __C declaration:__ @data@
+  -> BG.Ptr DuckDBV2ErrorInfoHandle
+     -- ^ __C declaration:__ @err@
+  -> IO DuckDBV2Error
+c_duckdb_v2_scalar_function_set_user_data =
+  hs_bindgen_4da7a6f078093aab
+
+-- __unique:__ @Database_DuckDB_FFI_V2_Database.DuckDB.FFI.V2_Safe_duckdb_v2_scalar_function_set_property@
+foreign import ccall safe "hs_bindgen_87c5fb31da0ecdb9" hs_bindgen_87c5fb31da0ecdb9_base ::
+     BG.Ptr BG.Void
+  -> BG.CUInt
+  -> BG.CUInt
+  -> BG.Ptr BG.Void
+  -> IO BG.CUInt
+
+-- __unique:__ @Database_DuckDB_FFI_V2_Database.DuckDB.FFI.V2_Safe_duckdb_v2_scalar_function_set_property@
+hs_bindgen_87c5fb31da0ecdb9 ::
+     DuckDBV2ScalarFunctionHandle
+  -> DuckDBV2FunctionPropertyKey
+  -> DuckDBV2FunctionPropertyValue
+  -> BG.Ptr DuckDBV2ErrorInfoHandle
+  -> IO DuckDBV2Error
+hs_bindgen_87c5fb31da0ecdb9 =
+  \x0 ->
+    \x1 ->
+      \x2 ->
+        \x3 ->
+          fmap BG.fromFFIType (hs_bindgen_87c5fb31da0ecdb9_base (BG.toFFIType x0) (BG.toFFIType x1) (BG.toFFIType x2) (BG.toFFIType x3))
+
+{-| __C declaration:__ @duckdb_v2_scalar_function_set_property@
+
+    __defined at:__ @duckdb_v2.h 10526:30@
+
+    __exported by:__ @duckdb_v2.h@
+-}
+c_duckdb_v2_scalar_function_set_property ::
+     DuckDBV2ScalarFunctionHandle
+     -- ^ __C declaration:__ @function@
+  -> DuckDBV2FunctionPropertyKey
+     -- ^ __C declaration:__ @key@
+  -> DuckDBV2FunctionPropertyValue
+     -- ^ __C declaration:__ @value@
+  -> BG.Ptr DuckDBV2ErrorInfoHandle
+     -- ^ __C declaration:__ @err@
+  -> IO DuckDBV2Error
+c_duckdb_v2_scalar_function_set_property =
+  hs_bindgen_87c5fb31da0ecdb9
+
+-- __unique:__ @Database_DuckDB_FFI_V2_Database.DuckDB.FFI.V2_Safe_duckdb_v2_scalar_function_set_resolve_types_callback@
+foreign import ccall safe "hs_bindgen_035bd2a2a872ead7" hs_bindgen_035bd2a2a872ead7_base ::
+     BG.Ptr BG.Void
+  -> BG.FunPtr BG.Void
+  -> BG.Ptr BG.Void
+  -> IO BG.CUInt
+
+-- __unique:__ @Database_DuckDB_FFI_V2_Database.DuckDB.FFI.V2_Safe_duckdb_v2_scalar_function_set_resolve_types_callback@
+hs_bindgen_035bd2a2a872ead7 ::
+     DuckDBV2ScalarFunctionHandle
+  -> DuckDBV2ScalarFunctionResolveTypesCallbackFn
+  -> BG.Ptr DuckDBV2ErrorInfoHandle
+  -> IO DuckDBV2Error
+hs_bindgen_035bd2a2a872ead7 =
+  \x0 ->
+    \x1 ->
+      \x2 ->
+        fmap BG.fromFFIType (hs_bindgen_035bd2a2a872ead7_base (BG.toFFIType x0) (BG.toFFIType x1) (BG.toFFIType x2))
+
+{-| __C declaration:__ @duckdb_v2_scalar_function_set_resolve_types_callback@
+
+    __defined at:__ @duckdb_v2.h 10551:30@
+
+    __exported by:__ @duckdb_v2.h@
+-}
+c_duckdb_v2_scalar_function_set_resolve_types_callback ::
+     DuckDBV2ScalarFunctionHandle
+     -- ^ __C declaration:__ @function@
+  -> DuckDBV2ScalarFunctionResolveTypesCallbackFn
+     -- ^ __C declaration:__ @callback@
+  -> BG.Ptr DuckDBV2ErrorInfoHandle
+     -- ^ __C declaration:__ @err@
+  -> IO DuckDBV2Error
+c_duckdb_v2_scalar_function_set_resolve_types_callback =
+  hs_bindgen_035bd2a2a872ead7
+
+-- __unique:__ @Database_DuckDB_FFI_V2_Database.DuckDB.FFI.V2_Safe_duckdb_v2_scalar_function_set_bind_callback@
+foreign import ccall safe "hs_bindgen_2ecbf5ac124df320" hs_bindgen_2ecbf5ac124df320_base ::
+     BG.Ptr BG.Void
+  -> BG.FunPtr BG.Void
+  -> BG.Ptr BG.Void
+  -> IO BG.CUInt
+
+-- __unique:__ @Database_DuckDB_FFI_V2_Database.DuckDB.FFI.V2_Safe_duckdb_v2_scalar_function_set_bind_callback@
+hs_bindgen_2ecbf5ac124df320 ::
+     DuckDBV2ScalarFunctionHandle
+  -> DuckDBV2ScalarFunctionBindCallbackFn
+  -> BG.Ptr DuckDBV2ErrorInfoHandle
+  -> IO DuckDBV2Error
+hs_bindgen_2ecbf5ac124df320 =
+  \x0 ->
+    \x1 ->
+      \x2 ->
+        fmap BG.fromFFIType (hs_bindgen_2ecbf5ac124df320_base (BG.toFFIType x0) (BG.toFFIType x1) (BG.toFFIType x2))
+
+{-| __C declaration:__ @duckdb_v2_scalar_function_set_bind_callback@
+
+    __defined at:__ @duckdb_v2.h 10575:30@
+
+    __exported by:__ @duckdb_v2.h@
+-}
+c_duckdb_v2_scalar_function_set_bind_callback ::
+     DuckDBV2ScalarFunctionHandle
+     -- ^ __C declaration:__ @function@
+  -> DuckDBV2ScalarFunctionBindCallbackFn
+     -- ^ __C declaration:__ @callback@
+  -> BG.Ptr DuckDBV2ErrorInfoHandle
+     -- ^ __C declaration:__ @err@
+  -> IO DuckDBV2Error
+c_duckdb_v2_scalar_function_set_bind_callback =
+  hs_bindgen_2ecbf5ac124df320
+
+-- __unique:__ @Database_DuckDB_FFI_V2_Database.DuckDB.FFI.V2_Safe_duckdb_v2_scalar_function_set_init_callback@
+foreign import ccall safe "hs_bindgen_6453f4493e0f17a6" hs_bindgen_6453f4493e0f17a6_base ::
+     BG.Ptr BG.Void
+  -> BG.FunPtr BG.Void
+  -> BG.Ptr BG.Void
+  -> IO BG.CUInt
+
+-- __unique:__ @Database_DuckDB_FFI_V2_Database.DuckDB.FFI.V2_Safe_duckdb_v2_scalar_function_set_init_callback@
+hs_bindgen_6453f4493e0f17a6 ::
+     DuckDBV2ScalarFunctionHandle
+  -> DuckDBV2ScalarFunctionInitCallbackFn
+  -> BG.Ptr DuckDBV2ErrorInfoHandle
+  -> IO DuckDBV2Error
+hs_bindgen_6453f4493e0f17a6 =
+  \x0 ->
+    \x1 ->
+      \x2 ->
+        fmap BG.fromFFIType (hs_bindgen_6453f4493e0f17a6_base (BG.toFFIType x0) (BG.toFFIType x1) (BG.toFFIType x2))
+
+{-| __C declaration:__ @duckdb_v2_scalar_function_set_init_callback@
+
+    __defined at:__ @duckdb_v2.h 10597:30@
+
+    __exported by:__ @duckdb_v2.h@
+-}
+c_duckdb_v2_scalar_function_set_init_callback ::
+     DuckDBV2ScalarFunctionHandle
+     -- ^ __C declaration:__ @function@
+  -> DuckDBV2ScalarFunctionInitCallbackFn
+     -- ^ __C declaration:__ @callback@
+  -> BG.Ptr DuckDBV2ErrorInfoHandle
+     -- ^ __C declaration:__ @err@
+  -> IO DuckDBV2Error
+c_duckdb_v2_scalar_function_set_init_callback =
+  hs_bindgen_6453f4493e0f17a6
+
+-- __unique:__ @Database_DuckDB_FFI_V2_Database.DuckDB.FFI.V2_Safe_duckdb_v2_scalar_function_set_exec_callback@
+foreign import ccall safe "hs_bindgen_c069501cdd5bd694" hs_bindgen_c069501cdd5bd694_base ::
+     BG.Ptr BG.Void
+  -> BG.FunPtr BG.Void
+  -> BG.Ptr BG.Void
+  -> IO BG.CUInt
+
+-- __unique:__ @Database_DuckDB_FFI_V2_Database.DuckDB.FFI.V2_Safe_duckdb_v2_scalar_function_set_exec_callback@
+hs_bindgen_c069501cdd5bd694 ::
+     DuckDBV2ScalarFunctionHandle
+  -> DuckDBV2ScalarFunctionExecCallbackFn
+  -> BG.Ptr DuckDBV2ErrorInfoHandle
+  -> IO DuckDBV2Error
+hs_bindgen_c069501cdd5bd694 =
+  \x0 ->
+    \x1 ->
+      \x2 ->
+        fmap BG.fromFFIType (hs_bindgen_c069501cdd5bd694_base (BG.toFFIType x0) (BG.toFFIType x1) (BG.toFFIType x2))
+
+{-| __C declaration:__ @duckdb_v2_scalar_function_set_exec_callback@
+
+    __defined at:__ @duckdb_v2.h 10618:30@
+
+    __exported by:__ @duckdb_v2.h@
+-}
+c_duckdb_v2_scalar_function_set_exec_callback ::
+     DuckDBV2ScalarFunctionHandle
+     -- ^ __C declaration:__ @function@
+  -> DuckDBV2ScalarFunctionExecCallbackFn
+     -- ^ __C declaration:__ @callback@
+  -> BG.Ptr DuckDBV2ErrorInfoHandle
+     -- ^ __C declaration:__ @err@
+  -> IO DuckDBV2Error
+c_duckdb_v2_scalar_function_set_exec_callback =
+  hs_bindgen_c069501cdd5bd694
+
+-- __unique:__ @Database_DuckDB_FFI_V2_Database.DuckDB.FFI.V2_Safe_duckdb_v2_scalar_function_resolve_types_set_return_type@
+foreign import ccall safe "hs_bindgen_8034f09b5951e789" hs_bindgen_8034f09b5951e789_base ::
+     BG.Ptr BG.Void
+  -> BG.Ptr BG.Void
+  -> BG.Ptr BG.Void
+  -> IO BG.CUInt
+
+-- __unique:__ @Database_DuckDB_FFI_V2_Database.DuckDB.FFI.V2_Safe_duckdb_v2_scalar_function_resolve_types_set_return_type@
+hs_bindgen_8034f09b5951e789 ::
+     DuckDBV2ScalarFunctionResolveTypesInfoHandle
+  -> DuckDBV2LogicalTypeHandle
+  -> BG.Ptr DuckDBV2ErrorInfoHandle
+  -> IO DuckDBV2Error
+hs_bindgen_8034f09b5951e789 =
+  \x0 ->
+    \x1 ->
+      \x2 ->
+        fmap BG.fromFFIType (hs_bindgen_8034f09b5951e789_base (BG.toFFIType x0) (BG.toFFIType x1) (BG.toFFIType x2))
+
+{-| __C declaration:__ @duckdb_v2_scalar_function_resolve_types_set_return_type@
+
+    __defined at:__ @duckdb_v2.h 10640:30@
+
+    __exported by:__ @duckdb_v2.h@
+-}
+c_duckdb_v2_scalar_function_resolve_types_set_return_type ::
+     DuckDBV2ScalarFunctionResolveTypesInfoHandle
+     -- ^ __C declaration:__ @info@
+  -> DuckDBV2LogicalTypeHandle
+     -- ^ __C declaration:__ @return_type@
+  -> BG.Ptr DuckDBV2ErrorInfoHandle
+     -- ^ __C declaration:__ @err@
+  -> IO DuckDBV2Error
+c_duckdb_v2_scalar_function_resolve_types_set_return_type =
+  hs_bindgen_8034f09b5951e789
+
+-- __unique:__ @Database_DuckDB_FFI_V2_Database.DuckDB.FFI.V2_Safe_duckdb_v2_scalar_function_bind_set_bind_data@
+foreign import ccall safe "hs_bindgen_a3bf8400ceea5f93" hs_bindgen_a3bf8400ceea5f93_base ::
+     BG.Ptr BG.Void
+  -> BG.Ptr BG.Void
+  -> BG.Ptr BG.Void
+  -> IO BG.CUInt
+
+-- __unique:__ @Database_DuckDB_FFI_V2_Database.DuckDB.FFI.V2_Safe_duckdb_v2_scalar_function_bind_set_bind_data@
+hs_bindgen_a3bf8400ceea5f93 ::
+     DuckDBV2ScalarFunctionBindInfoHandle
+  -> BG.Ptr DuckDBV2Opaque
+  -> BG.Ptr DuckDBV2ErrorInfoHandle
+  -> IO DuckDBV2Error
+hs_bindgen_a3bf8400ceea5f93 =
+  \x0 ->
+    \x1 ->
+      \x2 ->
+        fmap BG.fromFFIType (hs_bindgen_a3bf8400ceea5f93_base (BG.toFFIType x0) (BG.toFFIType x1) (BG.toFFIType x2))
+
+{-| __C declaration:__ @duckdb_v2_scalar_function_bind_set_bind_data@
+
+    __defined at:__ @duckdb_v2.h 10663:30@
+
+    __exported by:__ @duckdb_v2.h@
+-}
+c_duckdb_v2_scalar_function_bind_set_bind_data ::
+     DuckDBV2ScalarFunctionBindInfoHandle
+     -- ^ __C declaration:__ @info@
+  -> BG.Ptr DuckDBV2Opaque
+     -- ^ __C declaration:__ @data@
+  -> BG.Ptr DuckDBV2ErrorInfoHandle
+     -- ^ __C declaration:__ @err@
+  -> IO DuckDBV2Error
+c_duckdb_v2_scalar_function_bind_set_bind_data =
+  hs_bindgen_a3bf8400ceea5f93
+
+-- __unique:__ @Database_DuckDB_FFI_V2_Database.DuckDB.FFI.V2_Safe_duckdb_v2_scalar_function_init_get_user_data@
+foreign import ccall safe "hs_bindgen_2e2070b4fd19c126" hs_bindgen_2e2070b4fd19c126_base ::
+     BG.Ptr BG.Void
+  -> BG.Ptr BG.Void
+  -> BG.Ptr BG.Void
+  -> IO BG.CUInt
+
+-- __unique:__ @Database_DuckDB_FFI_V2_Database.DuckDB.FFI.V2_Safe_duckdb_v2_scalar_function_init_get_user_data@
+hs_bindgen_2e2070b4fd19c126 ::
+     DuckDBV2ScalarFunctionInitInfoHandle
+  -> BG.Ptr (BG.Ptr BG.Void)
+  -> BG.Ptr DuckDBV2ErrorInfoHandle
+  -> IO DuckDBV2Error
+hs_bindgen_2e2070b4fd19c126 =
+  \x0 ->
+    \x1 ->
+      \x2 ->
+        fmap BG.fromFFIType (hs_bindgen_2e2070b4fd19c126_base (BG.toFFIType x0) (BG.toFFIType x1) (BG.toFFIType x2))
+
+{-| __C declaration:__ @duckdb_v2_scalar_function_init_get_user_data@
+
+    __defined at:__ @duckdb_v2.h 10680:30@
+
+    __exported by:__ @duckdb_v2.h@
+-}
+c_duckdb_v2_scalar_function_init_get_user_data ::
+     DuckDBV2ScalarFunctionInitInfoHandle
+     -- ^ __C declaration:__ @info@
+  -> BG.Ptr (BG.Ptr BG.Void)
+     -- ^ __C declaration:__ @data@
+  -> BG.Ptr DuckDBV2ErrorInfoHandle
+     -- ^ __C declaration:__ @err@
+  -> IO DuckDBV2Error
+c_duckdb_v2_scalar_function_init_get_user_data =
+  hs_bindgen_2e2070b4fd19c126
+
+-- __unique:__ @Database_DuckDB_FFI_V2_Database.DuckDB.FFI.V2_Safe_duckdb_v2_scalar_function_init_get_bind_data@
+foreign import ccall safe "hs_bindgen_9c5500523d3ef710" hs_bindgen_9c5500523d3ef710_base ::
+     BG.Ptr BG.Void
+  -> BG.Ptr BG.Void
+  -> BG.Ptr BG.Void
+  -> IO BG.CUInt
+
+-- __unique:__ @Database_DuckDB_FFI_V2_Database.DuckDB.FFI.V2_Safe_duckdb_v2_scalar_function_init_get_bind_data@
+hs_bindgen_9c5500523d3ef710 ::
+     DuckDBV2ScalarFunctionInitInfoHandle
+  -> BG.Ptr (BG.Ptr BG.Void)
+  -> BG.Ptr DuckDBV2ErrorInfoHandle
+  -> IO DuckDBV2Error
+hs_bindgen_9c5500523d3ef710 =
+  \x0 ->
+    \x1 ->
+      \x2 ->
+        fmap BG.fromFFIType (hs_bindgen_9c5500523d3ef710_base (BG.toFFIType x0) (BG.toFFIType x1) (BG.toFFIType x2))
+
+{-| __C declaration:__ @duckdb_v2_scalar_function_init_get_bind_data@
+
+    __defined at:__ @duckdb_v2.h 10697:30@
+
+    __exported by:__ @duckdb_v2.h@
+-}
+c_duckdb_v2_scalar_function_init_get_bind_data ::
+     DuckDBV2ScalarFunctionInitInfoHandle
+     -- ^ __C declaration:__ @info@
+  -> BG.Ptr (BG.Ptr BG.Void)
+     -- ^ __C declaration:__ @data@
+  -> BG.Ptr DuckDBV2ErrorInfoHandle
+     -- ^ __C declaration:__ @err@
+  -> IO DuckDBV2Error
+c_duckdb_v2_scalar_function_init_get_bind_data =
+  hs_bindgen_9c5500523d3ef710
+
+-- __unique:__ @Database_DuckDB_FFI_V2_Database.DuckDB.FFI.V2_Safe_duckdb_v2_scalar_function_init_set_init_data@
+foreign import ccall safe "hs_bindgen_524f86b44e9294e9" hs_bindgen_524f86b44e9294e9_base ::
+     BG.Ptr BG.Void
+  -> BG.Ptr BG.Void
+  -> BG.Ptr BG.Void
+  -> IO BG.CUInt
+
+-- __unique:__ @Database_DuckDB_FFI_V2_Database.DuckDB.FFI.V2_Safe_duckdb_v2_scalar_function_init_set_init_data@
+hs_bindgen_524f86b44e9294e9 ::
+     DuckDBV2ScalarFunctionInitInfoHandle
+  -> BG.Ptr DuckDBV2Opaque
+  -> BG.Ptr DuckDBV2ErrorInfoHandle
+  -> IO DuckDBV2Error
+hs_bindgen_524f86b44e9294e9 =
+  \x0 ->
+    \x1 ->
+      \x2 ->
+        fmap BG.fromFFIType (hs_bindgen_524f86b44e9294e9_base (BG.toFFIType x0) (BG.toFFIType x1) (BG.toFFIType x2))
+
+{-| __C declaration:__ @duckdb_v2_scalar_function_init_set_init_data@
+
+    __defined at:__ @duckdb_v2.h 10718:30@
+
+    __exported by:__ @duckdb_v2.h@
+-}
+c_duckdb_v2_scalar_function_init_set_init_data ::
+     DuckDBV2ScalarFunctionInitInfoHandle
+     -- ^ __C declaration:__ @info@
+  -> BG.Ptr DuckDBV2Opaque
+     -- ^ __C declaration:__ @data@
+  -> BG.Ptr DuckDBV2ErrorInfoHandle
+     -- ^ __C declaration:__ @err@
+  -> IO DuckDBV2Error
+c_duckdb_v2_scalar_function_init_set_init_data =
+  hs_bindgen_524f86b44e9294e9
+
+-- __unique:__ @Database_DuckDB_FFI_V2_Database.DuckDB.FFI.V2_Safe_duckdb_v2_scalar_function_exec_get_user_data@
+foreign import ccall safe "hs_bindgen_39ada4fd8f023c38" hs_bindgen_39ada4fd8f023c38_base ::
+     BG.Ptr BG.Void
+  -> BG.Ptr BG.Void
+  -> BG.Ptr BG.Void
+  -> IO BG.CUInt
+
+-- __unique:__ @Database_DuckDB_FFI_V2_Database.DuckDB.FFI.V2_Safe_duckdb_v2_scalar_function_exec_get_user_data@
+hs_bindgen_39ada4fd8f023c38 ::
+     DuckDBV2ScalarFunctionExecInfoHandle
+  -> BG.Ptr (BG.Ptr BG.Void)
+  -> BG.Ptr DuckDBV2ErrorInfoHandle
+  -> IO DuckDBV2Error
+hs_bindgen_39ada4fd8f023c38 =
+  \x0 ->
+    \x1 ->
+      \x2 ->
+        fmap BG.fromFFIType (hs_bindgen_39ada4fd8f023c38_base (BG.toFFIType x0) (BG.toFFIType x1) (BG.toFFIType x2))
+
+{-| __C declaration:__ @duckdb_v2_scalar_function_exec_get_user_data@
+
+    __defined at:__ @duckdb_v2.h 10735:30@
+
+    __exported by:__ @duckdb_v2.h@
+-}
+c_duckdb_v2_scalar_function_exec_get_user_data ::
+     DuckDBV2ScalarFunctionExecInfoHandle
+     -- ^ __C declaration:__ @info@
+  -> BG.Ptr (BG.Ptr BG.Void)
+     -- ^ __C declaration:__ @data@
+  -> BG.Ptr DuckDBV2ErrorInfoHandle
+     -- ^ __C declaration:__ @err@
+  -> IO DuckDBV2Error
+c_duckdb_v2_scalar_function_exec_get_user_data =
+  hs_bindgen_39ada4fd8f023c38
+
+-- __unique:__ @Database_DuckDB_FFI_V2_Database.DuckDB.FFI.V2_Safe_duckdb_v2_scalar_function_exec_get_bind_data@
+foreign import ccall safe "hs_bindgen_41ac6ee4fdc43266" hs_bindgen_41ac6ee4fdc43266_base ::
+     BG.Ptr BG.Void
+  -> BG.Ptr BG.Void
+  -> BG.Ptr BG.Void
+  -> IO BG.CUInt
+
+-- __unique:__ @Database_DuckDB_FFI_V2_Database.DuckDB.FFI.V2_Safe_duckdb_v2_scalar_function_exec_get_bind_data@
+hs_bindgen_41ac6ee4fdc43266 ::
+     DuckDBV2ScalarFunctionExecInfoHandle
+  -> BG.Ptr (BG.Ptr BG.Void)
+  -> BG.Ptr DuckDBV2ErrorInfoHandle
+  -> IO DuckDBV2Error
+hs_bindgen_41ac6ee4fdc43266 =
+  \x0 ->
+    \x1 ->
+      \x2 ->
+        fmap BG.fromFFIType (hs_bindgen_41ac6ee4fdc43266_base (BG.toFFIType x0) (BG.toFFIType x1) (BG.toFFIType x2))
+
+{-| __C declaration:__ @duckdb_v2_scalar_function_exec_get_bind_data@
+
+    __defined at:__ @duckdb_v2.h 10752:30@
+
+    __exported by:__ @duckdb_v2.h@
+-}
+c_duckdb_v2_scalar_function_exec_get_bind_data ::
+     DuckDBV2ScalarFunctionExecInfoHandle
+     -- ^ __C declaration:__ @info@
+  -> BG.Ptr (BG.Ptr BG.Void)
+     -- ^ __C declaration:__ @data@
+  -> BG.Ptr DuckDBV2ErrorInfoHandle
+     -- ^ __C declaration:__ @err@
+  -> IO DuckDBV2Error
+c_duckdb_v2_scalar_function_exec_get_bind_data =
+  hs_bindgen_41ac6ee4fdc43266
+
+-- __unique:__ @Database_DuckDB_FFI_V2_Database.DuckDB.FFI.V2_Safe_duckdb_v2_scalar_function_exec_get_init_data@
+foreign import ccall safe "hs_bindgen_3e730e841383a6f9" hs_bindgen_3e730e841383a6f9_base ::
+     BG.Ptr BG.Void
+  -> BG.Ptr BG.Void
+  -> BG.Ptr BG.Void
+  -> IO BG.CUInt
+
+-- __unique:__ @Database_DuckDB_FFI_V2_Database.DuckDB.FFI.V2_Safe_duckdb_v2_scalar_function_exec_get_init_data@
+hs_bindgen_3e730e841383a6f9 ::
+     DuckDBV2ScalarFunctionExecInfoHandle
+  -> BG.Ptr (BG.Ptr BG.Void)
+  -> BG.Ptr DuckDBV2ErrorInfoHandle
+  -> IO DuckDBV2Error
+hs_bindgen_3e730e841383a6f9 =
+  \x0 ->
+    \x1 ->
+      \x2 ->
+        fmap BG.fromFFIType (hs_bindgen_3e730e841383a6f9_base (BG.toFFIType x0) (BG.toFFIType x1) (BG.toFFIType x2))
+
+{-| __C declaration:__ @duckdb_v2_scalar_function_exec_get_init_data@
+
+    __defined at:__ @duckdb_v2.h 10769:30@
+
+    __exported by:__ @duckdb_v2.h@
+-}
+c_duckdb_v2_scalar_function_exec_get_init_data ::
+     DuckDBV2ScalarFunctionExecInfoHandle
+     -- ^ __C declaration:__ @info@
+  -> BG.Ptr (BG.Ptr BG.Void)
+     -- ^ __C declaration:__ @data@
+  -> BG.Ptr DuckDBV2ErrorInfoHandle
+     -- ^ __C declaration:__ @err@
+  -> IO DuckDBV2Error
+c_duckdb_v2_scalar_function_exec_get_init_data =
+  hs_bindgen_3e730e841383a6f9
+
+-- __unique:__ @Database_DuckDB_FFI_V2_Database.DuckDB.FFI.V2_Safe_duckdb_v2_scalar_function_exec_get_row_count@
+foreign import ccall safe "hs_bindgen_32c2e586fb938a4a" hs_bindgen_32c2e586fb938a4a_base ::
+     BG.Ptr BG.Void
+  -> BG.Ptr BG.Void
+  -> BG.Ptr BG.Void
+  -> IO BG.CUInt
+
+-- __unique:__ @Database_DuckDB_FFI_V2_Database.DuckDB.FFI.V2_Safe_duckdb_v2_scalar_function_exec_get_row_count@
+hs_bindgen_32c2e586fb938a4a ::
+     DuckDBV2ScalarFunctionExecInfoHandle
+  -> BG.Ptr DuckDBIdx
+  -> BG.Ptr DuckDBV2ErrorInfoHandle
+  -> IO DuckDBV2Error
+hs_bindgen_32c2e586fb938a4a =
+  \x0 ->
+    \x1 ->
+      \x2 ->
+        fmap BG.fromFFIType (hs_bindgen_32c2e586fb938a4a_base (BG.toFFIType x0) (BG.toFFIType x1) (BG.toFFIType x2))
+
+{-| __C declaration:__ @duckdb_v2_scalar_function_exec_get_row_count@
+
+    __defined at:__ @duckdb_v2.h 10788:30@
+
+    __exported by:__ @duckdb_v2.h@
+-}
+c_duckdb_v2_scalar_function_exec_get_row_count ::
+     DuckDBV2ScalarFunctionExecInfoHandle
+     -- ^ __C declaration:__ @info@
+  -> BG.Ptr DuckDBIdx
+     -- ^ __C declaration:__ @count@
+  -> BG.Ptr DuckDBV2ErrorInfoHandle
+     -- ^ __C declaration:__ @err@
+  -> IO DuckDBV2Error
+c_duckdb_v2_scalar_function_exec_get_row_count =
+  hs_bindgen_32c2e586fb938a4a
+
+-- __unique:__ @Database_DuckDB_FFI_V2_Database.DuckDB.FFI.V2_Safe_duckdb_v2_scalar_function_exec_get_arg_count@
+foreign import ccall safe "hs_bindgen_68835dd5d850a124" hs_bindgen_68835dd5d850a124_base ::
+     BG.Ptr BG.Void
+  -> BG.Ptr BG.Void
+  -> BG.Ptr BG.Void
+  -> BG.Ptr BG.Void
+  -> BG.Ptr BG.Void
+  -> BG.Ptr BG.Void
+  -> IO BG.CUInt
+
+-- __unique:__ @Database_DuckDB_FFI_V2_Database.DuckDB.FFI.V2_Safe_duckdb_v2_scalar_function_exec_get_arg_count@
+hs_bindgen_68835dd5d850a124 ::
+     DuckDBV2ScalarFunctionExecInfoHandle
+  -> BG.Ptr DuckDBIdx
+  -> BG.Ptr DuckDBIdx
+  -> BG.Ptr DuckDBIdx
+  -> BG.Ptr DuckDBIdx
+  -> BG.Ptr DuckDBV2ErrorInfoHandle
+  -> IO DuckDBV2Error
+hs_bindgen_68835dd5d850a124 =
+  \x0 ->
+    \x1 ->
+      \x2 ->
+        \x3 ->
+          \x4 ->
+            \x5 ->
+              fmap BG.fromFFIType (hs_bindgen_68835dd5d850a124_base (BG.toFFIType x0) (BG.toFFIType x1) (BG.toFFIType x2) (BG.toFFIType x3) (BG.toFFIType x4) (BG.toFFIType x5))
+
+{-| __C declaration:__ @duckdb_v2_scalar_function_exec_get_arg_count@
+
+    __defined at:__ @duckdb_v2.h 10813:30@
+
+    __exported by:__ @duckdb_v2.h@
+-}
+c_duckdb_v2_scalar_function_exec_get_arg_count ::
+     DuckDBV2ScalarFunctionExecInfoHandle
+     -- ^ __C declaration:__ @info@
+  -> BG.Ptr DuckDBIdx
+     -- ^ __C declaration:__ @positional_fixed@
+  -> BG.Ptr DuckDBIdx
+     -- ^ __C declaration:__ @positional_variadic@
+  -> BG.Ptr DuckDBIdx
+     -- ^ __C declaration:__ @named_fixed@
+  -> BG.Ptr DuckDBIdx
+     -- ^ __C declaration:__ @named_variadic@
+  -> BG.Ptr DuckDBV2ErrorInfoHandle
+     -- ^ __C declaration:__ @err@
+  -> IO DuckDBV2Error
+c_duckdb_v2_scalar_function_exec_get_arg_count =
+  hs_bindgen_68835dd5d850a124
+
+-- __unique:__ @Database_DuckDB_FFI_V2_Database.DuckDB.FFI.V2_Safe_duckdb_v2_scalar_function_exec_get_arg@
+foreign import ccall safe "hs_bindgen_e0074e12bc64fc47" hs_bindgen_e0074e12bc64fc47_base ::
+     BG.Ptr BG.Void
+  -> HsBindgen.Runtime.LibC.Word64
+  -> BG.Ptr BG.Void
+  -> BG.Ptr BG.Void
+  -> IO BG.CUInt
+
+-- __unique:__ @Database_DuckDB_FFI_V2_Database.DuckDB.FFI.V2_Safe_duckdb_v2_scalar_function_exec_get_arg@
+hs_bindgen_e0074e12bc64fc47 ::
+     DuckDBV2ScalarFunctionExecInfoHandle
+  -> DuckDBIdx
+  -> BG.Ptr DuckDBV2VectorHandle
+  -> BG.Ptr DuckDBV2ErrorInfoHandle
+  -> IO DuckDBV2Error
+hs_bindgen_e0074e12bc64fc47 =
+  \x0 ->
+    \x1 ->
+      \x2 ->
+        \x3 ->
+          fmap BG.fromFFIType (hs_bindgen_e0074e12bc64fc47_base (BG.toFFIType x0) (BG.toFFIType x1) (BG.toFFIType x2) (BG.toFFIType x3))
+
+{-| __C declaration:__ @duckdb_v2_scalar_function_exec_get_arg@
+
+    __defined at:__ @duckdb_v2.h 10837:30@
+
+    __exported by:__ @duckdb_v2.h@
+-}
+c_duckdb_v2_scalar_function_exec_get_arg ::
+     DuckDBV2ScalarFunctionExecInfoHandle
+     -- ^ __C declaration:__ @info@
+  -> DuckDBIdx
+     -- ^ __C declaration:__ @index@
+  -> BG.Ptr DuckDBV2VectorHandle
+     -- ^ __C declaration:__ @vector@
+  -> BG.Ptr DuckDBV2ErrorInfoHandle
+     -- ^ __C declaration:__ @err@
+  -> IO DuckDBV2Error
+c_duckdb_v2_scalar_function_exec_get_arg =
+  hs_bindgen_e0074e12bc64fc47
+
+-- __unique:__ @Database_DuckDB_FFI_V2_Database.DuckDB.FFI.V2_Safe_duckdb_v2_scalar_function_exec_get_result@
+foreign import ccall safe "hs_bindgen_c99a611fbb136c9c" hs_bindgen_c99a611fbb136c9c_base ::
+     BG.Ptr BG.Void
+  -> BG.Ptr BG.Void
+  -> BG.Ptr BG.Void
+  -> IO BG.CUInt
+
+-- __unique:__ @Database_DuckDB_FFI_V2_Database.DuckDB.FFI.V2_Safe_duckdb_v2_scalar_function_exec_get_result@
+hs_bindgen_c99a611fbb136c9c ::
+     DuckDBV2ScalarFunctionExecInfoHandle
+  -> BG.Ptr DuckDBV2VectorHandle
+  -> BG.Ptr DuckDBV2ErrorInfoHandle
+  -> IO DuckDBV2Error
+hs_bindgen_c99a611fbb136c9c =
+  \x0 ->
+    \x1 ->
+      \x2 ->
+        fmap BG.fromFFIType (hs_bindgen_c99a611fbb136c9c_base (BG.toFFIType x0) (BG.toFFIType x1) (BG.toFFIType x2))
+
+{-| __C declaration:__ @duckdb_v2_scalar_function_exec_get_result@
+
+    __defined at:__ @duckdb_v2.h 10858:30@
+
+    __exported by:__ @duckdb_v2.h@
+-}
+c_duckdb_v2_scalar_function_exec_get_result ::
+     DuckDBV2ScalarFunctionExecInfoHandle
+     -- ^ __C declaration:__ @info@
+  -> BG.Ptr DuckDBV2VectorHandle
+     -- ^ __C declaration:__ @vector@
+  -> BG.Ptr DuckDBV2ErrorInfoHandle
+     -- ^ __C declaration:__ @err@
+  -> IO DuckDBV2Error
+c_duckdb_v2_scalar_function_exec_get_result =
+  hs_bindgen_c99a611fbb136c9c
+
+-- __unique:__ @Database_DuckDB_FFI_V2_Database.DuckDB.FFI.V2_Safe_duckdb_v2_connection_register_scalar_function@
+foreign import ccall safe "hs_bindgen_3228d55aaf4faa5d" hs_bindgen_3228d55aaf4faa5d_base ::
+     BG.Ptr BG.Void
+  -> BG.Ptr BG.Void
+  -> BG.Ptr BG.Void
+  -> IO BG.CUInt
+
+-- __unique:__ @Database_DuckDB_FFI_V2_Database.DuckDB.FFI.V2_Safe_duckdb_v2_connection_register_scalar_function@
+hs_bindgen_3228d55aaf4faa5d ::
+     DuckDBV2ConnectionHandle
+  -> DuckDBV2ScalarFunctionHandle
+  -> BG.Ptr DuckDBV2ErrorInfoHandle
+  -> IO DuckDBV2Error
+hs_bindgen_3228d55aaf4faa5d =
+  \x0 ->
+    \x1 ->
+      \x2 ->
+        fmap BG.fromFFIType (hs_bindgen_3228d55aaf4faa5d_base (BG.toFFIType x0) (BG.toFFIType x1) (BG.toFFIType x2))
+
+{-| __C declaration:__ @duckdb_v2_connection_register_scalar_function@
+
+    __defined at:__ @duckdb_v2.h 10884:30@
+
+    __exported by:__ @duckdb_v2.h@
+-}
+c_duckdb_v2_connection_register_scalar_function ::
+     DuckDBV2ConnectionHandle
+     -- ^ __C declaration:__ @conn@
+  -> DuckDBV2ScalarFunctionHandle
+     -- ^ __C declaration:__ @function@
+  -> BG.Ptr DuckDBV2ErrorInfoHandle
+     -- ^ __C declaration:__ @err@
+  -> IO DuckDBV2Error
+c_duckdb_v2_connection_register_scalar_function =
+  hs_bindgen_3228d55aaf4faa5d
+
+-- __unique:__ @Database_DuckDB_FFI_V2_Database.DuckDB.FFI.V2_Safe_duckdb_v2_extension_register_scalar_function@
+foreign import ccall safe "hs_bindgen_b4c56cb9397e1a66" hs_bindgen_b4c56cb9397e1a66_base ::
+     BG.Ptr BG.Void
+  -> BG.Ptr BG.Void
+  -> BG.Ptr BG.Void
+  -> IO BG.CUInt
+
+-- __unique:__ @Database_DuckDB_FFI_V2_Database.DuckDB.FFI.V2_Safe_duckdb_v2_extension_register_scalar_function@
+hs_bindgen_b4c56cb9397e1a66 ::
+     DuckDBV2ExtensionHandle
+  -> DuckDBV2ScalarFunctionHandle
+  -> BG.Ptr DuckDBV2ErrorInfoHandle
+  -> IO DuckDBV2Error
+hs_bindgen_b4c56cb9397e1a66 =
+  \x0 ->
+    \x1 ->
+      \x2 ->
+        fmap BG.fromFFIType (hs_bindgen_b4c56cb9397e1a66_base (BG.toFFIType x0) (BG.toFFIType x1) (BG.toFFIType x2))
+
+{-| __C declaration:__ @duckdb_v2_extension_register_scalar_function@
+
+    __defined at:__ @duckdb_v2.h 10909:30@
+
+    __exported by:__ @duckdb_v2.h@
+-}
+c_duckdb_v2_extension_register_scalar_function ::
+     DuckDBV2ExtensionHandle
+     -- ^ __C declaration:__ @extension@
+  -> DuckDBV2ScalarFunctionHandle
+     -- ^ __C declaration:__ @function@
+  -> BG.Ptr DuckDBV2ErrorInfoHandle
+     -- ^ __C declaration:__ @err@
+  -> IO DuckDBV2Error
+c_duckdb_v2_extension_register_scalar_function =
+  hs_bindgen_b4c56cb9397e1a66
+
+-- __unique:__ @Database_DuckDB_FFI_V2_Database.DuckDB.FFI.V2_Safe_duckdb_v2_scalar_function_destroy@
+foreign import ccall safe "hs_bindgen_169e77dabc8b9d4e" hs_bindgen_169e77dabc8b9d4e_base ::
+     BG.Ptr BG.Void
+  -> IO BG.CUInt
+
+-- __unique:__ @Database_DuckDB_FFI_V2_Database.DuckDB.FFI.V2_Safe_duckdb_v2_scalar_function_destroy@
+hs_bindgen_169e77dabc8b9d4e ::
+     BG.Ptr DuckDBV2ScalarFunctionHandle
+  -> IO DuckDBV2Error
+hs_bindgen_169e77dabc8b9d4e =
+  \x0 ->
+    fmap BG.fromFFIType (hs_bindgen_169e77dabc8b9d4e_base (BG.toFFIType x0))
+
+{-| __C declaration:__ @duckdb_v2_scalar_function_destroy@
+
+    __defined at:__ @duckdb_v2.h 10927:30@
+
+    __exported by:__ @duckdb_v2.h@
+-}
+c_duckdb_v2_scalar_function_destroy ::
+     BG.Ptr DuckDBV2ScalarFunctionHandle
+     -- ^ __C declaration:__ @function@
+  -> IO DuckDBV2Error
+c_duckdb_v2_scalar_function_destroy =
+  hs_bindgen_169e77dabc8b9d4e
+
+-- __unique:__ @Database_DuckDB_FFI_V2_Database.DuckDB.FFI.V2_Safe_duckdb_v2_parse_sql@
+foreign import ccall safe "hs_bindgen_79641f15c4620dae" hs_bindgen_79641f15c4620dae_base ::
+     BG.Ptr BG.Void
+  -> BG.Ptr BG.Void
+  -> BG.Ptr BG.Void
+  -> BG.Ptr BG.Void
+  -> IO BG.CUInt
+
+-- __unique:__ @Database_DuckDB_FFI_V2_Database.DuckDB.FFI.V2_Safe_duckdb_v2_parse_sql@
+hs_bindgen_79641f15c4620dae ::
+     DuckDBV2ConnectionHandle
+  -> PtrConst.PtrConst BG.CChar
+  -> BG.Ptr DuckDBV2StatementIteratorHandle
+  -> BG.Ptr DuckDBV2ErrorInfoHandle
+  -> IO DuckDBV2Error
+hs_bindgen_79641f15c4620dae =
+  \x0 ->
+    \x1 ->
+      \x2 ->
+        \x3 ->
+          fmap BG.fromFFIType (hs_bindgen_79641f15c4620dae_base (BG.toFFIType x0) (BG.toFFIType x1) (BG.toFFIType x2) (BG.toFFIType x3))
+
+{-| __C declaration:__ @duckdb_v2_parse_sql@
+
+    __defined at:__ @duckdb_v2.h 11022:30@
+
+    __exported by:__ @duckdb_v2.h@
+-}
+c_duckdb_v2_parse_sql ::
+     DuckDBV2ConnectionHandle
+     -- ^ __C declaration:__ @conn@
+  -> PtrConst.PtrConst BG.CChar
+     -- ^ __C declaration:__ @sql@
+  -> BG.Ptr DuckDBV2StatementIteratorHandle
+     -- ^ __C declaration:__ @out_iterator@
+  -> BG.Ptr DuckDBV2ErrorInfoHandle
+     -- ^ __C declaration:__ @err@
+  -> IO DuckDBV2Error
+c_duckdb_v2_parse_sql = hs_bindgen_79641f15c4620dae
+
+-- __unique:__ @Database_DuckDB_FFI_V2_Database.DuckDB.FFI.V2_Safe_duckdb_v2_statement_iterator_next@
+foreign import ccall safe "hs_bindgen_415cf6bf4e5157c3" hs_bindgen_415cf6bf4e5157c3_base ::
+     BG.Ptr BG.Void
+  -> BG.Ptr BG.Void
+  -> BG.Ptr BG.Void
+  -> IO BG.CUInt
+
+-- __unique:__ @Database_DuckDB_FFI_V2_Database.DuckDB.FFI.V2_Safe_duckdb_v2_statement_iterator_next@
+hs_bindgen_415cf6bf4e5157c3 ::
+     DuckDBV2StatementIteratorHandle
+  -> BG.Ptr DuckDBV2SqlStatementHandle
+  -> BG.Ptr DuckDBV2ErrorInfoHandle
+  -> IO DuckDBV2Error
+hs_bindgen_415cf6bf4e5157c3 =
+  \x0 ->
+    \x1 ->
+      \x2 ->
+        fmap BG.fromFFIType (hs_bindgen_415cf6bf4e5157c3_base (BG.toFFIType x0) (BG.toFFIType x1) (BG.toFFIType x2))
+
+{-| __C declaration:__ @duckdb_v2_statement_iterator_next@
+
+    __defined at:__ @duckdb_v2.h 11044:30@
+
+    __exported by:__ @duckdb_v2.h@
+-}
+c_duckdb_v2_statement_iterator_next ::
+     DuckDBV2StatementIteratorHandle
+     -- ^ __C declaration:__ @iterator@
+  -> BG.Ptr DuckDBV2SqlStatementHandle
+     -- ^ __C declaration:__ @out_statement@
+  -> BG.Ptr DuckDBV2ErrorInfoHandle
+     -- ^ __C declaration:__ @err@
+  -> IO DuckDBV2Error
+c_duckdb_v2_statement_iterator_next =
+  hs_bindgen_415cf6bf4e5157c3
+
+-- __unique:__ @Database_DuckDB_FFI_V2_Database.DuckDB.FFI.V2_Safe_duckdb_v2_statement_bind@
+foreign import ccall safe "hs_bindgen_9a54c46c0b4406d4" hs_bindgen_9a54c46c0b4406d4_base ::
+     BG.Ptr BG.Void
+  -> BG.Ptr BG.Void
+  -> BG.Ptr BG.Void
+  -> BG.Ptr BG.Void
+  -> BG.Ptr BG.Void
+  -> IO BG.CUInt
+
+-- __unique:__ @Database_DuckDB_FFI_V2_Database.DuckDB.FFI.V2_Safe_duckdb_v2_statement_bind@
+hs_bindgen_9a54c46c0b4406d4 ::
+     DuckDBV2ConnectionHandle
+  -> DuckDBV2SqlStatementHandle
+  -> BG.Ptr DuckDBV2SchemaHandle
+  -> BG.Ptr DuckDBV2SchemaHandle
+  -> BG.Ptr DuckDBV2ErrorInfoHandle
+  -> IO DuckDBV2Error
+hs_bindgen_9a54c46c0b4406d4 =
+  \x0 ->
+    \x1 ->
+      \x2 ->
+        \x3 ->
+          \x4 ->
+            fmap BG.fromFFIType (hs_bindgen_9a54c46c0b4406d4_base (BG.toFFIType x0) (BG.toFFIType x1) (BG.toFFIType x2) (BG.toFFIType x3) (BG.toFFIType x4))
+
+{-| __C declaration:__ @duckdb_v2_statement_bind@
+
+    __defined at:__ @duckdb_v2.h 11080:30@
+
+    __exported by:__ @duckdb_v2.h@
+-}
+c_duckdb_v2_statement_bind ::
+     DuckDBV2ConnectionHandle
+     -- ^ __C declaration:__ @conn@
+  -> DuckDBV2SqlStatementHandle
+     -- ^ __C declaration:__ @statement@
+  -> BG.Ptr DuckDBV2SchemaHandle
+     -- ^ __C declaration:__ @out_schema@
+  -> BG.Ptr DuckDBV2SchemaHandle
+     -- ^ __C declaration:__ @out_parameters@
+  -> BG.Ptr DuckDBV2ErrorInfoHandle
+     -- ^ __C declaration:__ @err@
+  -> IO DuckDBV2Error
+c_duckdb_v2_statement_bind =
+  hs_bindgen_9a54c46c0b4406d4
+
+-- __unique:__ @Database_DuckDB_FFI_V2_Database.DuckDB.FFI.V2_Safe_duckdb_v2_statement_add_collection@
+foreign import ccall safe "hs_bindgen_ace6940be7595af0" hs_bindgen_ace6940be7595af0_base ::
+     BG.Ptr BG.Void
+  -> BG.Ptr BG.Void
+  -> BG.Ptr BG.Void
+  -> BG.Ptr BG.Void
+  -> HsBindgen.Runtime.LibC.Word64
+  -> BG.Ptr BG.Void
+  -> IO BG.CUInt
+
+-- __unique:__ @Database_DuckDB_FFI_V2_Database.DuckDB.FFI.V2_Safe_duckdb_v2_statement_add_collection@
+hs_bindgen_ace6940be7595af0 ::
+     DuckDBV2SqlStatementHandle
+  -> PtrConst.PtrConst DuckDBV2IdentifierT
+  -> DuckDBV2ColumnDataCollectionHandle
+  -> PtrConst.PtrConst DuckDBV2IdentifierT
+  -> DuckDBIdx
+  -> BG.Ptr DuckDBV2ErrorInfoHandle
+  -> IO DuckDBV2Error
+hs_bindgen_ace6940be7595af0 =
+  \x0 ->
+    \x1 ->
+      \x2 ->
+        \x3 ->
+          \x4 ->
+            \x5 ->
+              fmap BG.fromFFIType (hs_bindgen_ace6940be7595af0_base (BG.toFFIType x0) (BG.toFFIType x1) (BG.toFFIType x2) (BG.toFFIType x3) (BG.toFFIType x4) (BG.toFFIType x5))
+
+{-| __C declaration:__ @duckdb_v2_statement_add_collection@
+
+    __defined at:__ @duckdb_v2.h 11121:30@
+
+    __exported by:__ @duckdb_v2.h@
+-}
+c_duckdb_v2_statement_add_collection ::
+     DuckDBV2SqlStatementHandle
+     -- ^ __C declaration:__ @statement@
+  -> PtrConst.PtrConst DuckDBV2IdentifierT
+     -- ^ __C declaration:__ @name@
+  -> DuckDBV2ColumnDataCollectionHandle
+     -- ^ __C declaration:__ @collection@
+  -> PtrConst.PtrConst DuckDBV2IdentifierT
+     -- ^ __C declaration:__ @column_names@
+  -> DuckDBIdx
+     -- ^ __C declaration:__ @column_count@
+  -> BG.Ptr DuckDBV2ErrorInfoHandle
+     -- ^ __C declaration:__ @err@
+  -> IO DuckDBV2Error
+c_duckdb_v2_statement_add_collection =
+  hs_bindgen_ace6940be7595af0
+
+-- __unique:__ @Database_DuckDB_FFI_V2_Database.DuckDB.FFI.V2_Safe_duckdb_v2_sql_statement_get_type@
+foreign import ccall safe "hs_bindgen_077080c7f83655d5" hs_bindgen_077080c7f83655d5_base ::
+     BG.Ptr BG.Void
+  -> BG.Ptr BG.Void
+  -> BG.Ptr BG.Void
+  -> IO BG.CUInt
+
+-- __unique:__ @Database_DuckDB_FFI_V2_Database.DuckDB.FFI.V2_Safe_duckdb_v2_sql_statement_get_type@
+hs_bindgen_077080c7f83655d5 ::
+     DuckDBV2SqlStatementHandle
+  -> BG.Ptr DuckDBV2StatementType
+  -> BG.Ptr DuckDBV2ErrorInfoHandle
+  -> IO DuckDBV2Error
+hs_bindgen_077080c7f83655d5 =
+  \x0 ->
+    \x1 ->
+      \x2 ->
+        fmap BG.fromFFIType (hs_bindgen_077080c7f83655d5_base (BG.toFFIType x0) (BG.toFFIType x1) (BG.toFFIType x2))
+
+{-| __C declaration:__ @duckdb_v2_sql_statement_get_type@
+
+    __defined at:__ @duckdb_v2.h 11146:30@
+
+    __exported by:__ @duckdb_v2.h@
+-}
+c_duckdb_v2_sql_statement_get_type ::
+     DuckDBV2SqlStatementHandle
+     -- ^ __C declaration:__ @statement@
+  -> BG.Ptr DuckDBV2StatementType
+     -- ^ __C declaration:__ @out_type@
+  -> BG.Ptr DuckDBV2ErrorInfoHandle
+     -- ^ __C declaration:__ @err@
+  -> IO DuckDBV2Error
+c_duckdb_v2_sql_statement_get_type =
+  hs_bindgen_077080c7f83655d5
+
+-- __unique:__ @Database_DuckDB_FFI_V2_Database.DuckDB.FFI.V2_Safe_duckdb_v2_sql_statement_get_text@
+foreign import ccall safe "hs_bindgen_8c1303762f1b18be" hs_bindgen_8c1303762f1b18be_base ::
+     BG.Ptr BG.Void
+  -> BG.Ptr BG.Void
+  -> BG.Ptr BG.Void
+  -> IO BG.CUInt
+
+-- __unique:__ @Database_DuckDB_FFI_V2_Database.DuckDB.FFI.V2_Safe_duckdb_v2_sql_statement_get_text@
+hs_bindgen_8c1303762f1b18be ::
+     DuckDBV2SqlStatementHandle
+  -> BG.Ptr DuckDBV2Str
+  -> BG.Ptr DuckDBV2ErrorInfoHandle
+  -> IO DuckDBV2Error
+hs_bindgen_8c1303762f1b18be =
+  \x0 ->
+    \x1 ->
+      \x2 ->
+        fmap BG.fromFFIType (hs_bindgen_8c1303762f1b18be_base (BG.toFFIType x0) (BG.toFFIType x1) (BG.toFFIType x2))
+
+{-| __C declaration:__ @duckdb_v2_sql_statement_get_text@
+
+    __defined at:__ @duckdb_v2.h 11168:30@
+
+    __exported by:__ @duckdb_v2.h@
+-}
+c_duckdb_v2_sql_statement_get_text ::
+     DuckDBV2SqlStatementHandle
+     -- ^ __C declaration:__ @statement@
+  -> BG.Ptr DuckDBV2Str
+     -- ^ __C declaration:__ @out_text@
+  -> BG.Ptr DuckDBV2ErrorInfoHandle
+     -- ^ __C declaration:__ @err@
+  -> IO DuckDBV2Error
+c_duckdb_v2_sql_statement_get_text =
+  hs_bindgen_8c1303762f1b18be
+
+-- __unique:__ @Database_DuckDB_FFI_V2_Database.DuckDB.FFI.V2_Safe_duckdb_v2_sql_statement_get_parameter_count@
+foreign import ccall safe "hs_bindgen_06ef57dab7d3ab4c" hs_bindgen_06ef57dab7d3ab4c_base ::
+     BG.Ptr BG.Void
+  -> BG.Ptr BG.Void
+  -> BG.Ptr BG.Void
+  -> IO BG.CUInt
+
+-- __unique:__ @Database_DuckDB_FFI_V2_Database.DuckDB.FFI.V2_Safe_duckdb_v2_sql_statement_get_parameter_count@
+hs_bindgen_06ef57dab7d3ab4c ::
+     DuckDBV2SqlStatementHandle
+  -> BG.Ptr DuckDBIdx
+  -> BG.Ptr DuckDBV2ErrorInfoHandle
+  -> IO DuckDBV2Error
+hs_bindgen_06ef57dab7d3ab4c =
+  \x0 ->
+    \x1 ->
+      \x2 ->
+        fmap BG.fromFFIType (hs_bindgen_06ef57dab7d3ab4c_base (BG.toFFIType x0) (BG.toFFIType x1) (BG.toFFIType x2))
+
+{-| __C declaration:__ @duckdb_v2_sql_statement_get_parameter_count@
+
+    __defined at:__ @duckdb_v2.h 11188:30@
+
+    __exported by:__ @duckdb_v2.h@
+-}
+c_duckdb_v2_sql_statement_get_parameter_count ::
+     DuckDBV2SqlStatementHandle
+     -- ^ __C declaration:__ @statement@
+  -> BG.Ptr DuckDBIdx
+     -- ^ __C declaration:__ @out_count@
+  -> BG.Ptr DuckDBV2ErrorInfoHandle
+     -- ^ __C declaration:__ @err@
+  -> IO DuckDBV2Error
+c_duckdb_v2_sql_statement_get_parameter_count =
+  hs_bindgen_06ef57dab7d3ab4c
+
+-- __unique:__ @Database_DuckDB_FFI_V2_Database.DuckDB.FFI.V2_Safe_duckdb_v2_sql_statement_get_parameter_name@
+foreign import ccall safe "hs_bindgen_c17b046439fba3da" hs_bindgen_c17b046439fba3da_base ::
+     BG.Ptr BG.Void
+  -> HsBindgen.Runtime.LibC.Word64
+  -> BG.Ptr BG.Void
+  -> BG.Ptr BG.Void
+  -> IO BG.CUInt
+
+-- __unique:__ @Database_DuckDB_FFI_V2_Database.DuckDB.FFI.V2_Safe_duckdb_v2_sql_statement_get_parameter_name@
+hs_bindgen_c17b046439fba3da ::
+     DuckDBV2SqlStatementHandle
+  -> DuckDBIdx
+  -> BG.Ptr DuckDBV2IdentifierT
+  -> BG.Ptr DuckDBV2ErrorInfoHandle
+  -> IO DuckDBV2Error
+hs_bindgen_c17b046439fba3da =
+  \x0 ->
+    \x1 ->
+      \x2 ->
+        \x3 ->
+          fmap BG.fromFFIType (hs_bindgen_c17b046439fba3da_base (BG.toFFIType x0) (BG.toFFIType x1) (BG.toFFIType x2) (BG.toFFIType x3))
+
+{-| __C declaration:__ @duckdb_v2_sql_statement_get_parameter_name@
+
+    __defined at:__ @duckdb_v2.h 11213:30@
+
+    __exported by:__ @duckdb_v2.h@
+-}
+c_duckdb_v2_sql_statement_get_parameter_name ::
+     DuckDBV2SqlStatementHandle
+     -- ^ __C declaration:__ @statement@
+  -> DuckDBIdx
+     -- ^ __C declaration:__ @index@
+  -> BG.Ptr DuckDBV2IdentifierT
+     -- ^ __C declaration:__ @out_name@
+  -> BG.Ptr DuckDBV2ErrorInfoHandle
+     -- ^ __C declaration:__ @err@
+  -> IO DuckDBV2Error
+c_duckdb_v2_sql_statement_get_parameter_name =
+  hs_bindgen_c17b046439fba3da
+
+-- __unique:__ @Database_DuckDB_FFI_V2_Database.DuckDB.FFI.V2_Safe_duckdb_v2_sql_statement_destroy@
+foreign import ccall safe "hs_bindgen_abc4ad5be777e482" hs_bindgen_abc4ad5be777e482_base ::
+     BG.Ptr BG.Void
+  -> IO BG.CUInt
+
+-- __unique:__ @Database_DuckDB_FFI_V2_Database.DuckDB.FFI.V2_Safe_duckdb_v2_sql_statement_destroy@
+hs_bindgen_abc4ad5be777e482 ::
+     BG.Ptr DuckDBV2SqlStatementHandle
+  -> IO DuckDBV2Error
+hs_bindgen_abc4ad5be777e482 =
+  \x0 ->
+    fmap BG.fromFFIType (hs_bindgen_abc4ad5be777e482_base (BG.toFFIType x0))
+
+{-| __C declaration:__ @duckdb_v2_sql_statement_destroy@
+
+    __defined at:__ @duckdb_v2.h 11231:30@
+
+    __exported by:__ @duckdb_v2.h@
+-}
+c_duckdb_v2_sql_statement_destroy ::
+     BG.Ptr DuckDBV2SqlStatementHandle
+     -- ^ __C declaration:__ @statement@
+  -> IO DuckDBV2Error
+c_duckdb_v2_sql_statement_destroy =
+  hs_bindgen_abc4ad5be777e482
+
+-- __unique:__ @Database_DuckDB_FFI_V2_Database.DuckDB.FFI.V2_Safe_duckdb_v2_statement_iterator_destroy@
+foreign import ccall safe "hs_bindgen_799899533c3f22fc" hs_bindgen_799899533c3f22fc_base ::
+     BG.Ptr BG.Void
+  -> IO BG.CUInt
+
+-- __unique:__ @Database_DuckDB_FFI_V2_Database.DuckDB.FFI.V2_Safe_duckdb_v2_statement_iterator_destroy@
+hs_bindgen_799899533c3f22fc ::
+     BG.Ptr DuckDBV2StatementIteratorHandle
+  -> IO DuckDBV2Error
+hs_bindgen_799899533c3f22fc =
+  \x0 ->
+    fmap BG.fromFFIType (hs_bindgen_799899533c3f22fc_base (BG.toFFIType x0))
+
+{-| __C declaration:__ @duckdb_v2_statement_iterator_destroy@
+
+    __defined at:__ @duckdb_v2.h 11247:30@
+
+    __exported by:__ @duckdb_v2.h@
+-}
+c_duckdb_v2_statement_iterator_destroy ::
+     BG.Ptr DuckDBV2StatementIteratorHandle
+     -- ^ __C declaration:__ @iterator@
+  -> IO DuckDBV2Error
+c_duckdb_v2_statement_iterator_destroy =
+  hs_bindgen_799899533c3f22fc
+
+-- __unique:__ @Database_DuckDB_FFI_V2_Database.DuckDB.FFI.V2_Safe_duckdb_v2_vector_get_vector_type@
+foreign import ccall safe "hs_bindgen_c3aba412a137899c" hs_bindgen_c3aba412a137899c_base ::
+     BG.Ptr BG.Void
+  -> BG.Ptr BG.Void
+  -> BG.Ptr BG.Void
+  -> IO BG.CUInt
+
+-- __unique:__ @Database_DuckDB_FFI_V2_Database.DuckDB.FFI.V2_Safe_duckdb_v2_vector_get_vector_type@
+hs_bindgen_c3aba412a137899c ::
+     DuckDBV2VectorHandle
+  -> BG.Ptr DuckDBV2VectorType
+  -> BG.Ptr DuckDBV2ErrorInfoHandle
+  -> IO DuckDBV2Error
+hs_bindgen_c3aba412a137899c =
+  \x0 ->
+    \x1 ->
+      \x2 ->
+        fmap BG.fromFFIType (hs_bindgen_c3aba412a137899c_base (BG.toFFIType x0) (BG.toFFIType x1) (BG.toFFIType x2))
+
+{-| __C declaration:__ @duckdb_v2_vector_get_vector_type@
+
+    __defined at:__ @duckdb_v2.h 11313:30@
+
+    __exported by:__ @duckdb_v2.h@
+-}
+c_duckdb_v2_vector_get_vector_type ::
+     DuckDBV2VectorHandle
+     -- ^ __C declaration:__ @vector@
+  -> BG.Ptr DuckDBV2VectorType
+     -- ^ __C declaration:__ @out_type@
+  -> BG.Ptr DuckDBV2ErrorInfoHandle
+     -- ^ __C declaration:__ @err@
+  -> IO DuckDBV2Error
+c_duckdb_v2_vector_get_vector_type =
+  hs_bindgen_c3aba412a137899c
+
+-- __unique:__ @Database_DuckDB_FFI_V2_Database.DuckDB.FFI.V2_Safe_duckdb_v2_vector_get_logical_type@
+foreign import ccall safe "hs_bindgen_ad9a536cbf47b7ae" hs_bindgen_ad9a536cbf47b7ae_base ::
+     BG.Ptr BG.Void
+  -> BG.Ptr BG.Void
+  -> BG.Ptr BG.Void
+  -> IO BG.CUInt
+
+-- __unique:__ @Database_DuckDB_FFI_V2_Database.DuckDB.FFI.V2_Safe_duckdb_v2_vector_get_logical_type@
+hs_bindgen_ad9a536cbf47b7ae ::
+     DuckDBV2VectorHandle
+  -> BG.Ptr DuckDBV2LogicalTypeHandle
+  -> BG.Ptr DuckDBV2ErrorInfoHandle
+  -> IO DuckDBV2Error
+hs_bindgen_ad9a536cbf47b7ae =
+  \x0 ->
+    \x1 ->
+      \x2 ->
+        fmap BG.fromFFIType (hs_bindgen_ad9a536cbf47b7ae_base (BG.toFFIType x0) (BG.toFFIType x1) (BG.toFFIType x2))
+
+{-| __C declaration:__ @duckdb_v2_vector_get_logical_type@
+
+    __defined at:__ @duckdb_v2.h 11333:30@
+
+    __exported by:__ @duckdb_v2.h@
+-}
+c_duckdb_v2_vector_get_logical_type ::
+     DuckDBV2VectorHandle
+     -- ^ __C declaration:__ @vector@
+  -> BG.Ptr DuckDBV2LogicalTypeHandle
+     -- ^ __C declaration:__ @out_type@
+  -> BG.Ptr DuckDBV2ErrorInfoHandle
+     -- ^ __C declaration:__ @err@
+  -> IO DuckDBV2Error
+c_duckdb_v2_vector_get_logical_type =
+  hs_bindgen_ad9a536cbf47b7ae
+
+-- __unique:__ @Database_DuckDB_FFI_V2_Database.DuckDB.FFI.V2_Safe_duckdb_v2_vector_get_view@
+foreign import ccall safe "hs_bindgen_18642405dbd6e0ba" hs_bindgen_18642405dbd6e0ba_base ::
+     BG.Ptr BG.Void
+  -> BG.Ptr BG.Void
+  -> BG.Ptr BG.Void
+  -> IO BG.CUInt
+
+-- __unique:__ @Database_DuckDB_FFI_V2_Database.DuckDB.FFI.V2_Safe_duckdb_v2_vector_get_view@
+hs_bindgen_18642405dbd6e0ba ::
+     DuckDBV2VectorHandle
+  -> BG.Ptr DuckDBV2VectorView
+  -> BG.Ptr DuckDBV2ErrorInfoHandle
+  -> IO DuckDBV2Error
+hs_bindgen_18642405dbd6e0ba =
+  \x0 ->
+    \x1 ->
+      \x2 ->
+        fmap BG.fromFFIType (hs_bindgen_18642405dbd6e0ba_base (BG.toFFIType x0) (BG.toFFIType x1) (BG.toFFIType x2))
+
+{-| __C declaration:__ @duckdb_v2_vector_get_view@
+
+    __defined at:__ @duckdb_v2.h 11369:30@
+
+    __exported by:__ @duckdb_v2.h@
+-}
+c_duckdb_v2_vector_get_view ::
+     DuckDBV2VectorHandle
+     -- ^ __C declaration:__ @vector@
+  -> BG.Ptr DuckDBV2VectorView
+     -- ^ __C declaration:__ @out_view@
+  -> BG.Ptr DuckDBV2ErrorInfoHandle
+     -- ^ __C declaration:__ @err@
+  -> IO DuckDBV2Error
+c_duckdb_v2_vector_get_view =
+  hs_bindgen_18642405dbd6e0ba
+
+-- __unique:__ @Database_DuckDB_FFI_V2_Database.DuckDB.FFI.V2_Safe_duckdb_v2_vector_get_size@
+foreign import ccall safe "hs_bindgen_8121bd80fbc2d87d" hs_bindgen_8121bd80fbc2d87d_base ::
+     BG.Ptr BG.Void
+  -> BG.Ptr BG.Void
+  -> BG.Ptr BG.Void
+  -> IO BG.CUInt
+
+-- __unique:__ @Database_DuckDB_FFI_V2_Database.DuckDB.FFI.V2_Safe_duckdb_v2_vector_get_size@
+hs_bindgen_8121bd80fbc2d87d ::
+     DuckDBV2VectorHandle
+  -> BG.Ptr DuckDBIdx
+  -> BG.Ptr DuckDBV2ErrorInfoHandle
+  -> IO DuckDBV2Error
+hs_bindgen_8121bd80fbc2d87d =
+  \x0 ->
+    \x1 ->
+      \x2 ->
+        fmap BG.fromFFIType (hs_bindgen_8121bd80fbc2d87d_base (BG.toFFIType x0) (BG.toFFIType x1) (BG.toFFIType x2))
+
+{-| __C declaration:__ @duckdb_v2_vector_get_size@
+
+    __defined at:__ @duckdb_v2.h 11389:30@
+
+    __exported by:__ @duckdb_v2.h@
+-}
+c_duckdb_v2_vector_get_size ::
+     DuckDBV2VectorHandle
+     -- ^ __C declaration:__ @vector@
+  -> BG.Ptr DuckDBIdx
+     -- ^ __C declaration:__ @out_size@
+  -> BG.Ptr DuckDBV2ErrorInfoHandle
+     -- ^ __C declaration:__ @err@
+  -> IO DuckDBV2Error
+c_duckdb_v2_vector_get_size =
+  hs_bindgen_8121bd80fbc2d87d
+
+-- __unique:__ @Database_DuckDB_FFI_V2_Database.DuckDB.FFI.V2_Safe_duckdb_v2_vector_set_size@
+foreign import ccall safe "hs_bindgen_3f3cdc8e0a00d71f" hs_bindgen_3f3cdc8e0a00d71f_base ::
+     BG.Ptr BG.Void
+  -> HsBindgen.Runtime.LibC.Word64
+  -> BG.Ptr BG.Void
+  -> IO BG.CUInt
+
+-- __unique:__ @Database_DuckDB_FFI_V2_Database.DuckDB.FFI.V2_Safe_duckdb_v2_vector_set_size@
+hs_bindgen_3f3cdc8e0a00d71f ::
+     DuckDBV2VectorHandle
+  -> DuckDBIdx
+  -> BG.Ptr DuckDBV2ErrorInfoHandle
+  -> IO DuckDBV2Error
+hs_bindgen_3f3cdc8e0a00d71f =
+  \x0 ->
+    \x1 ->
+      \x2 ->
+        fmap BG.fromFFIType (hs_bindgen_3f3cdc8e0a00d71f_base (BG.toFFIType x0) (BG.toFFIType x1) (BG.toFFIType x2))
+
+{-| __C declaration:__ @duckdb_v2_vector_set_size@
+
+    __defined at:__ @duckdb_v2.h 11408:30@
+
+    __exported by:__ @duckdb_v2.h@
+-}
+c_duckdb_v2_vector_set_size ::
+     DuckDBV2VectorHandle
+     -- ^ __C declaration:__ @vector@
+  -> DuckDBIdx
+     -- ^ __C declaration:__ @size@
+  -> BG.Ptr DuckDBV2ErrorInfoHandle
+     -- ^ __C declaration:__ @err@
+  -> IO DuckDBV2Error
+c_duckdb_v2_vector_set_size =
+  hs_bindgen_3f3cdc8e0a00d71f
+
+-- __unique:__ @Database_DuckDB_FFI_V2_Database.DuckDB.FFI.V2_Safe_duckdb_v2_vector_get_value@
+foreign import ccall safe "hs_bindgen_fc26d7ca89346169" hs_bindgen_fc26d7ca89346169_base ::
+     BG.Ptr BG.Void
+  -> HsBindgen.Runtime.LibC.Word64
+  -> BG.Ptr BG.Void
+  -> BG.Ptr BG.Void
+  -> IO BG.CUInt
+
+-- __unique:__ @Database_DuckDB_FFI_V2_Database.DuckDB.FFI.V2_Safe_duckdb_v2_vector_get_value@
+hs_bindgen_fc26d7ca89346169 ::
+     DuckDBV2VectorHandle
+  -> DuckDBIdx
+  -> BG.Ptr DuckDBV2ValueHandle
+  -> BG.Ptr DuckDBV2ErrorInfoHandle
+  -> IO DuckDBV2Error
+hs_bindgen_fc26d7ca89346169 =
+  \x0 ->
+    \x1 ->
+      \x2 ->
+        \x3 ->
+          fmap BG.fromFFIType (hs_bindgen_fc26d7ca89346169_base (BG.toFFIType x0) (BG.toFFIType x1) (BG.toFFIType x2) (BG.toFFIType x3))
+
+{-| __C declaration:__ @duckdb_v2_vector_get_value@
+
+    __defined at:__ @duckdb_v2.h 11433:30@
+
+    __exported by:__ @duckdb_v2.h@
+-}
+c_duckdb_v2_vector_get_value ::
+     DuckDBV2VectorHandle
+     -- ^ __C declaration:__ @vector@
+  -> DuckDBIdx
+     -- ^ __C declaration:__ @row@
+  -> BG.Ptr DuckDBV2ValueHandle
+     -- ^ __C declaration:__ @out_value@
+  -> BG.Ptr DuckDBV2ErrorInfoHandle
+     -- ^ __C declaration:__ @err@
+  -> IO DuckDBV2Error
+c_duckdb_v2_vector_get_value =
+  hs_bindgen_fc26d7ca89346169
+
+-- __unique:__ @Database_DuckDB_FFI_V2_Database.DuckDB.FFI.V2_Safe_duckdb_v2_vector_set_value@
+foreign import ccall safe "hs_bindgen_abe26b9e4eedf6a2" hs_bindgen_abe26b9e4eedf6a2_base ::
+     BG.Ptr BG.Void
+  -> HsBindgen.Runtime.LibC.Word64
+  -> BG.Ptr BG.Void
+  -> BG.Ptr BG.Void
+  -> IO BG.CUInt
+
+-- __unique:__ @Database_DuckDB_FFI_V2_Database.DuckDB.FFI.V2_Safe_duckdb_v2_vector_set_value@
+hs_bindgen_abe26b9e4eedf6a2 ::
+     DuckDBV2VectorHandle
+  -> DuckDBIdx
+  -> DuckDBV2ValueHandle
+  -> BG.Ptr DuckDBV2ErrorInfoHandle
+  -> IO DuckDBV2Error
+hs_bindgen_abe26b9e4eedf6a2 =
+  \x0 ->
+    \x1 ->
+      \x2 ->
+        \x3 ->
+          fmap BG.fromFFIType (hs_bindgen_abe26b9e4eedf6a2_base (BG.toFFIType x0) (BG.toFFIType x1) (BG.toFFIType x2) (BG.toFFIType x3))
+
+{-| __C declaration:__ @duckdb_v2_vector_set_value@
+
+    __defined at:__ @duckdb_v2.h 11461:30@
+
+    __exported by:__ @duckdb_v2.h@
+-}
+c_duckdb_v2_vector_set_value ::
+     DuckDBV2VectorHandle
+     -- ^ __C declaration:__ @vector@
+  -> DuckDBIdx
+     -- ^ __C declaration:__ @row@
+  -> DuckDBV2ValueHandle
+     -- ^ __C declaration:__ @value@
+  -> BG.Ptr DuckDBV2ErrorInfoHandle
+     -- ^ __C declaration:__ @err@
+  -> IO DuckDBV2Error
+c_duckdb_v2_vector_set_value =
+  hs_bindgen_abe26b9e4eedf6a2
+
+-- __unique:__ @Database_DuckDB_FFI_V2_Database.DuckDB.FFI.V2_Safe_duckdb_v2_vector_get_data_mutable@
+foreign import ccall safe "hs_bindgen_02fd2701725237a4" hs_bindgen_02fd2701725237a4_base ::
+     BG.Ptr BG.Void
+  -> BG.Ptr BG.Void
+  -> BG.Ptr BG.Void
+  -> IO BG.CUInt
+
+-- __unique:__ @Database_DuckDB_FFI_V2_Database.DuckDB.FFI.V2_Safe_duckdb_v2_vector_get_data_mutable@
+hs_bindgen_02fd2701725237a4 ::
+     DuckDBV2VectorHandle
+  -> BG.Ptr (BG.Ptr BG.Void)
+  -> BG.Ptr DuckDBV2ErrorInfoHandle
+  -> IO DuckDBV2Error
+hs_bindgen_02fd2701725237a4 =
+  \x0 ->
+    \x1 ->
+      \x2 ->
+        fmap BG.fromFFIType (hs_bindgen_02fd2701725237a4_base (BG.toFFIType x0) (BG.toFFIType x1) (BG.toFFIType x2))
+
+{-| __C declaration:__ @duckdb_v2_vector_get_data_mutable@
+
+    __defined at:__ @duckdb_v2.h 11482:30@
+
+    __exported by:__ @duckdb_v2.h@
+-}
+c_duckdb_v2_vector_get_data_mutable ::
+     DuckDBV2VectorHandle
+     -- ^ __C declaration:__ @vector@
+  -> BG.Ptr (BG.Ptr BG.Void)
+     -- ^ __C declaration:__ @out_data@
+  -> BG.Ptr DuckDBV2ErrorInfoHandle
+     -- ^ __C declaration:__ @err@
+  -> IO DuckDBV2Error
+c_duckdb_v2_vector_get_data_mutable =
+  hs_bindgen_02fd2701725237a4
+
+-- __unique:__ @Database_DuckDB_FFI_V2_Database.DuckDB.FFI.V2_Safe_duckdb_v2_vector_flatten@
+foreign import ccall safe "hs_bindgen_1a8dba55edf7203d" hs_bindgen_1a8dba55edf7203d_base ::
+     BG.Ptr BG.Void
+  -> BG.Ptr BG.Void
+  -> IO BG.CUInt
+
+-- __unique:__ @Database_DuckDB_FFI_V2_Database.DuckDB.FFI.V2_Safe_duckdb_v2_vector_flatten@
+hs_bindgen_1a8dba55edf7203d ::
+     DuckDBV2VectorHandle
+  -> BG.Ptr DuckDBV2ErrorInfoHandle
+  -> IO DuckDBV2Error
+hs_bindgen_1a8dba55edf7203d =
+  \x0 ->
+    \x1 ->
+      fmap BG.fromFFIType (hs_bindgen_1a8dba55edf7203d_base (BG.toFFIType x0) (BG.toFFIType x1))
+
+{-| __C declaration:__ @duckdb_v2_vector_flatten@
+
+    __defined at:__ @duckdb_v2.h 11502:30@
+
+    __exported by:__ @duckdb_v2.h@
+-}
+c_duckdb_v2_vector_flatten ::
+     DuckDBV2VectorHandle
+     -- ^ __C declaration:__ @vector@
+  -> BG.Ptr DuckDBV2ErrorInfoHandle
+     -- ^ __C declaration:__ @err@
+  -> IO DuckDBV2Error
+c_duckdb_v2_vector_flatten =
+  hs_bindgen_1a8dba55edf7203d
+
+-- __unique:__ @Database_DuckDB_FFI_V2_Database.DuckDB.FFI.V2_Safe_duckdb_v2_vector_cast@
+foreign import ccall safe "hs_bindgen_8d58a83ff47c5ea7" hs_bindgen_8d58a83ff47c5ea7_base ::
+     BG.Ptr BG.Void
+  -> BG.Ptr BG.Void
+  -> BG.Ptr BG.Void
+  -> BG.CUInt
+  -> BG.Ptr BG.Void
+  -> BG.Ptr BG.Void
+  -> BG.Ptr BG.Void
+  -> IO BG.CUInt
+
+-- __unique:__ @Database_DuckDB_FFI_V2_Database.DuckDB.FFI.V2_Safe_duckdb_v2_vector_cast@
+hs_bindgen_8d58a83ff47c5ea7 ::
+     DuckDBV2FactoryHandle
+  -> DuckDBV2VectorHandle
+  -> DuckDBV2VectorHandle
+  -> DuckDBV2CastMode
+  -> BG.Ptr BG.CBool
+  -> BG.Ptr DuckDBV2ErrorInfoHandle
+  -> BG.Ptr DuckDBV2ErrorInfoHandle
+  -> IO DuckDBV2Error
+hs_bindgen_8d58a83ff47c5ea7 =
+  \x0 ->
+    \x1 ->
+      \x2 ->
+        \x3 ->
+          \x4 ->
+            \x5 ->
+              \x6 ->
+                fmap BG.fromFFIType (hs_bindgen_8d58a83ff47c5ea7_base (BG.toFFIType x0) (BG.toFFIType x1) (BG.toFFIType x2) (BG.toFFIType x3) (BG.toFFIType x4) (BG.toFFIType x5) (BG.toFFIType x6))
+
+{-| __C declaration:__ @duckdb_v2_vector_cast@
+
+    __defined at:__ @duckdb_v2.h 11537:30@
+
+    __exported by:__ @duckdb_v2.h@
+-}
+c_duckdb_v2_vector_cast ::
+     DuckDBV2FactoryHandle
+     -- ^ __C declaration:__ @factory@
+  -> DuckDBV2VectorHandle
+     -- ^ __C declaration:__ @source@
+  -> DuckDBV2VectorHandle
+     -- ^ __C declaration:__ @target@
+  -> DuckDBV2CastMode
+     -- ^ __C declaration:__ @mode@
+  -> BG.Ptr BG.CBool
+     -- ^ __C declaration:__ @out_converted@
+  -> BG.Ptr DuckDBV2ErrorInfoHandle
+     -- ^ __C declaration:__ @cast_err@
+  -> BG.Ptr DuckDBV2ErrorInfoHandle
+     -- ^ __C declaration:__ @err@
+  -> IO DuckDBV2Error
+c_duckdb_v2_vector_cast = hs_bindgen_8d58a83ff47c5ea7
+
+-- __unique:__ @Database_DuckDB_FFI_V2_Database.DuckDB.FFI.V2_Safe_duckdb_v2_vector_reference@
+foreign import ccall safe "hs_bindgen_7576829d7aab2af7" hs_bindgen_7576829d7aab2af7_base ::
+     BG.Ptr BG.Void
+  -> BG.Ptr BG.Void
+  -> BG.Ptr BG.Void
+  -> IO BG.CUInt
+
+-- __unique:__ @Database_DuckDB_FFI_V2_Database.DuckDB.FFI.V2_Safe_duckdb_v2_vector_reference@
+hs_bindgen_7576829d7aab2af7 ::
+     DuckDBV2VectorHandle
+  -> DuckDBV2VectorHandle
+  -> BG.Ptr DuckDBV2ErrorInfoHandle
+  -> IO DuckDBV2Error
+hs_bindgen_7576829d7aab2af7 =
+  \x0 ->
+    \x1 ->
+      \x2 ->
+        fmap BG.fromFFIType (hs_bindgen_7576829d7aab2af7_base (BG.toFFIType x0) (BG.toFFIType x1) (BG.toFFIType x2))
+
+{-| __C declaration:__ @duckdb_v2_vector_reference@
+
+    __defined at:__ @duckdb_v2.h 11560:30@
+
+    __exported by:__ @duckdb_v2.h@
+-}
+c_duckdb_v2_vector_reference ::
+     DuckDBV2VectorHandle
+     -- ^ __C declaration:__ @vector@
+  -> DuckDBV2VectorHandle
+     -- ^ __C declaration:__ @source@
+  -> BG.Ptr DuckDBV2ErrorInfoHandle
+     -- ^ __C declaration:__ @err@
+  -> IO DuckDBV2Error
+c_duckdb_v2_vector_reference =
+  hs_bindgen_7576829d7aab2af7
+
+-- __unique:__ @Database_DuckDB_FFI_V2_Database.DuckDB.FFI.V2_Safe_duckdb_v2_vector_make_constant@
+foreign import ccall safe "hs_bindgen_47468c5392ad1c43" hs_bindgen_47468c5392ad1c43_base ::
+     BG.Ptr BG.Void
+  -> BG.Ptr BG.Void
+  -> HsBindgen.Runtime.LibC.Word64
+  -> BG.Ptr BG.Void
+  -> IO BG.CUInt
+
+-- __unique:__ @Database_DuckDB_FFI_V2_Database.DuckDB.FFI.V2_Safe_duckdb_v2_vector_make_constant@
+hs_bindgen_47468c5392ad1c43 ::
+     DuckDBV2VectorHandle
+  -> DuckDBV2ValueHandle
+  -> DuckDBIdx
+  -> BG.Ptr DuckDBV2ErrorInfoHandle
+  -> IO DuckDBV2Error
+hs_bindgen_47468c5392ad1c43 =
+  \x0 ->
+    \x1 ->
+      \x2 ->
+        \x3 ->
+          fmap BG.fromFFIType (hs_bindgen_47468c5392ad1c43_base (BG.toFFIType x0) (BG.toFFIType x1) (BG.toFFIType x2) (BG.toFFIType x3))
+
+{-| __C declaration:__ @duckdb_v2_vector_make_constant@
+
+    __defined at:__ @duckdb_v2.h 11581:30@
+
+    __exported by:__ @duckdb_v2.h@
+-}
+c_duckdb_v2_vector_make_constant ::
+     DuckDBV2VectorHandle
+     -- ^ __C declaration:__ @vector@
+  -> DuckDBV2ValueHandle
+     -- ^ __C declaration:__ @value@
+  -> DuckDBIdx
+     -- ^ __C declaration:__ @count@
+  -> BG.Ptr DuckDBV2ErrorInfoHandle
+     -- ^ __C declaration:__ @err@
+  -> IO DuckDBV2Error
+c_duckdb_v2_vector_make_constant =
+  hs_bindgen_47468c5392ad1c43
+
+-- __unique:__ @Database_DuckDB_FFI_V2_Database.DuckDB.FFI.V2_Safe_duckdb_v2_vector_make_sequence@
+foreign import ccall safe "hs_bindgen_9077799b85b9faee" hs_bindgen_9077799b85b9faee_base ::
+     BG.Ptr BG.Void
+  -> HsBindgen.Runtime.LibC.Int64
+  -> HsBindgen.Runtime.LibC.Int64
+  -> HsBindgen.Runtime.LibC.Word64
+  -> BG.Ptr BG.Void
+  -> IO BG.CUInt
+
+-- __unique:__ @Database_DuckDB_FFI_V2_Database.DuckDB.FFI.V2_Safe_duckdb_v2_vector_make_sequence@
+hs_bindgen_9077799b85b9faee ::
+     DuckDBV2VectorHandle
+  -> HsBindgen.Runtime.LibC.Int64
+  -> HsBindgen.Runtime.LibC.Int64
+  -> DuckDBIdx
+  -> BG.Ptr DuckDBV2ErrorInfoHandle
+  -> IO DuckDBV2Error
+hs_bindgen_9077799b85b9faee =
+  \x0 ->
+    \x1 ->
+      \x2 ->
+        \x3 ->
+          \x4 ->
+            fmap BG.fromFFIType (hs_bindgen_9077799b85b9faee_base (BG.toFFIType x0) (BG.toFFIType x1) (BG.toFFIType x2) (BG.toFFIType x3) (BG.toFFIType x4))
+
+{-| __C declaration:__ @duckdb_v2_vector_make_sequence@
+
+    __defined at:__ @duckdb_v2.h 11603:30@
+
+    __exported by:__ @duckdb_v2.h@
+-}
+c_duckdb_v2_vector_make_sequence ::
+     DuckDBV2VectorHandle
+     -- ^ __C declaration:__ @vector@
+  -> HsBindgen.Runtime.LibC.Int64
+     -- ^ __C declaration:__ @start@
+  -> HsBindgen.Runtime.LibC.Int64
+     -- ^ __C declaration:__ @increment@
+  -> DuckDBIdx
+     -- ^ __C declaration:__ @count@
+  -> BG.Ptr DuckDBV2ErrorInfoHandle
+     -- ^ __C declaration:__ @err@
+  -> IO DuckDBV2Error
+c_duckdb_v2_vector_make_sequence =
+  hs_bindgen_9077799b85b9faee
+
+-- __unique:__ @Database_DuckDB_FFI_V2_Database.DuckDB.FFI.V2_Safe_duckdb_v2_vector_set_null@
+foreign import ccall safe "hs_bindgen_d0800bbe0a6ec46d" hs_bindgen_d0800bbe0a6ec46d_base ::
+     BG.Ptr BG.Void
+  -> HsBindgen.Runtime.LibC.Word64
+  -> BG.Ptr BG.Void
+  -> IO BG.CUInt
+
+-- __unique:__ @Database_DuckDB_FFI_V2_Database.DuckDB.FFI.V2_Safe_duckdb_v2_vector_set_null@
+hs_bindgen_d0800bbe0a6ec46d ::
+     DuckDBV2VectorHandle
+  -> DuckDBIdx
+  -> BG.Ptr DuckDBV2ErrorInfoHandle
+  -> IO DuckDBV2Error
+hs_bindgen_d0800bbe0a6ec46d =
+  \x0 ->
+    \x1 ->
+      \x2 ->
+        fmap BG.fromFFIType (hs_bindgen_d0800bbe0a6ec46d_base (BG.toFFIType x0) (BG.toFFIType x1) (BG.toFFIType x2))
+
+{-| __C declaration:__ @duckdb_v2_vector_set_null@
+
+    __defined at:__ @duckdb_v2.h 11630:30@
+
+    __exported by:__ @duckdb_v2.h@
+-}
+c_duckdb_v2_vector_set_null ::
+     DuckDBV2VectorHandle
+     -- ^ __C declaration:__ @vector@
+  -> DuckDBIdx
+     -- ^ __C declaration:__ @row@
+  -> BG.Ptr DuckDBV2ErrorInfoHandle
+     -- ^ __C declaration:__ @err@
+  -> IO DuckDBV2Error
+c_duckdb_v2_vector_set_null =
+  hs_bindgen_d0800bbe0a6ec46d
+
+-- __unique:__ @Database_DuckDB_FFI_V2_Database.DuckDB.FFI.V2_Safe_duckdb_v2_vector_flat_get_validity_mutable@
+foreign import ccall safe "hs_bindgen_cc2a481c5acaa93a" hs_bindgen_cc2a481c5acaa93a_base ::
+     BG.Ptr BG.Void
+  -> BG.Ptr BG.Void
+  -> BG.Ptr BG.Void
+  -> IO BG.CUInt
+
+-- __unique:__ @Database_DuckDB_FFI_V2_Database.DuckDB.FFI.V2_Safe_duckdb_v2_vector_flat_get_validity_mutable@
+hs_bindgen_cc2a481c5acaa93a ::
+     DuckDBV2VectorHandle
+  -> BG.Ptr (BG.Ptr HsBindgen.Runtime.LibC.Word64)
+  -> BG.Ptr DuckDBV2ErrorInfoHandle
+  -> IO DuckDBV2Error
+hs_bindgen_cc2a481c5acaa93a =
+  \x0 ->
+    \x1 ->
+      \x2 ->
+        fmap BG.fromFFIType (hs_bindgen_cc2a481c5acaa93a_base (BG.toFFIType x0) (BG.toFFIType x1) (BG.toFFIType x2))
+
+{-| __C declaration:__ @duckdb_v2_vector_flat_get_validity_mutable@
+
+    __defined at:__ @duckdb_v2.h 11654:30@
+
+    __exported by:__ @duckdb_v2.h@
+-}
+c_duckdb_v2_vector_flat_get_validity_mutable ::
+     DuckDBV2VectorHandle
+     -- ^ __C declaration:__ @vector@
+  -> BG.Ptr (BG.Ptr HsBindgen.Runtime.LibC.Word64)
+     -- ^ __C declaration:__ @out_validity@
+  -> BG.Ptr DuckDBV2ErrorInfoHandle
+     -- ^ __C declaration:__ @err@
+  -> IO DuckDBV2Error
+c_duckdb_v2_vector_flat_get_validity_mutable =
+  hs_bindgen_cc2a481c5acaa93a
+
+-- __unique:__ @Database_DuckDB_FFI_V2_Database.DuckDB.FFI.V2_Safe_duckdb_v2_vector_constant_set_valid@
+foreign import ccall safe "hs_bindgen_ed6850bb8e6e6615" hs_bindgen_ed6850bb8e6e6615_base ::
+     BG.Ptr BG.Void
+  -> BG.CBool
+  -> BG.Ptr BG.Void
+  -> IO BG.CUInt
+
+-- __unique:__ @Database_DuckDB_FFI_V2_Database.DuckDB.FFI.V2_Safe_duckdb_v2_vector_constant_set_valid@
+hs_bindgen_ed6850bb8e6e6615 ::
+     DuckDBV2VectorHandle
+  -> BG.CBool
+  -> BG.Ptr DuckDBV2ErrorInfoHandle
+  -> IO DuckDBV2Error
+hs_bindgen_ed6850bb8e6e6615 =
+  \x0 ->
+    \x1 ->
+      \x2 ->
+        fmap BG.fromFFIType (hs_bindgen_ed6850bb8e6e6615_base (BG.toFFIType x0) (BG.toFFIType x1) (BG.toFFIType x2))
+
+{-| __C declaration:__ @duckdb_v2_vector_constant_set_valid@
+
+    __defined at:__ @duckdb_v2.h 11673:30@
+
+    __exported by:__ @duckdb_v2.h@
+-}
+c_duckdb_v2_vector_constant_set_valid ::
+     DuckDBV2VectorHandle
+     -- ^ __C declaration:__ @vector@
+  -> BG.CBool
+     -- ^ __C declaration:__ @validity@
+  -> BG.Ptr DuckDBV2ErrorInfoHandle
+     -- ^ __C declaration:__ @err@
+  -> IO DuckDBV2Error
+c_duckdb_v2_vector_constant_set_valid =
+  hs_bindgen_ed6850bb8e6e6615
+
+-- __unique:__ @Database_DuckDB_FFI_V2_Database.DuckDB.FFI.V2_Safe_duckdb_v2_vector_get_arena@
+foreign import ccall safe "hs_bindgen_c3e450b1717e0aec" hs_bindgen_c3e450b1717e0aec_base ::
+     BG.Ptr BG.Void
+  -> BG.Ptr BG.Void
+  -> BG.Ptr BG.Void
+  -> IO BG.CUInt
+
+-- __unique:__ @Database_DuckDB_FFI_V2_Database.DuckDB.FFI.V2_Safe_duckdb_v2_vector_get_arena@
+hs_bindgen_c3e450b1717e0aec ::
+     DuckDBV2VectorHandle
+  -> BG.Ptr DuckDBV2ArenaHandle
+  -> BG.Ptr DuckDBV2ErrorInfoHandle
+  -> IO DuckDBV2Error
+hs_bindgen_c3e450b1717e0aec =
+  \x0 ->
+    \x1 ->
+      \x2 ->
+        fmap BG.fromFFIType (hs_bindgen_c3e450b1717e0aec_base (BG.toFFIType x0) (BG.toFFIType x1) (BG.toFFIType x2))
+
+{-| __C declaration:__ @duckdb_v2_vector_get_arena@
+
+    __defined at:__ @duckdb_v2.h 11693:30@
+
+    __exported by:__ @duckdb_v2.h@
+-}
+c_duckdb_v2_vector_get_arena ::
+     DuckDBV2VectorHandle
+     -- ^ __C declaration:__ @vector@
+  -> BG.Ptr DuckDBV2ArenaHandle
+     -- ^ __C declaration:__ @out_arena@
+  -> BG.Ptr DuckDBV2ErrorInfoHandle
+     -- ^ __C declaration:__ @err@
+  -> IO DuckDBV2Error
+c_duckdb_v2_vector_get_arena =
+  hs_bindgen_c3e450b1717e0aec
+
+-- __unique:__ @Database_DuckDB_FFI_V2_Database.DuckDB.FFI.V2_Safe_duckdb_v2_vector_get_child_count@
+foreign import ccall safe "hs_bindgen_b42cb55351e1fd06" hs_bindgen_b42cb55351e1fd06_base ::
+     BG.Ptr BG.Void
+  -> BG.Ptr BG.Void
+  -> BG.Ptr BG.Void
+  -> IO BG.CUInt
+
+-- __unique:__ @Database_DuckDB_FFI_V2_Database.DuckDB.FFI.V2_Safe_duckdb_v2_vector_get_child_count@
+hs_bindgen_b42cb55351e1fd06 ::
+     DuckDBV2VectorHandle
+  -> BG.Ptr DuckDBIdx
+  -> BG.Ptr DuckDBV2ErrorInfoHandle
+  -> IO DuckDBV2Error
+hs_bindgen_b42cb55351e1fd06 =
+  \x0 ->
+    \x1 ->
+      \x2 ->
+        fmap BG.fromFFIType (hs_bindgen_b42cb55351e1fd06_base (BG.toFFIType x0) (BG.toFFIType x1) (BG.toFFIType x2))
+
+{-| __C declaration:__ @duckdb_v2_vector_get_child_count@
+
+    __defined at:__ @duckdb_v2.h 11713:30@
+
+    __exported by:__ @duckdb_v2.h@
+-}
+c_duckdb_v2_vector_get_child_count ::
+     DuckDBV2VectorHandle
+     -- ^ __C declaration:__ @vector@
+  -> BG.Ptr DuckDBIdx
+     -- ^ __C declaration:__ @out_count@
+  -> BG.Ptr DuckDBV2ErrorInfoHandle
+     -- ^ __C declaration:__ @err@
+  -> IO DuckDBV2Error
+c_duckdb_v2_vector_get_child_count =
+  hs_bindgen_b42cb55351e1fd06
+
+-- __unique:__ @Database_DuckDB_FFI_V2_Database.DuckDB.FFI.V2_Safe_duckdb_v2_vector_get_child@
+foreign import ccall safe "hs_bindgen_7b9e0d949dd7f8a5" hs_bindgen_7b9e0d949dd7f8a5_base ::
+     BG.Ptr BG.Void
+  -> HsBindgen.Runtime.LibC.Word64
+  -> BG.Ptr BG.Void
+  -> BG.Ptr BG.Void
+  -> IO BG.CUInt
+
+-- __unique:__ @Database_DuckDB_FFI_V2_Database.DuckDB.FFI.V2_Safe_duckdb_v2_vector_get_child@
+hs_bindgen_7b9e0d949dd7f8a5 ::
+     DuckDBV2VectorHandle
+  -> DuckDBIdx
+  -> BG.Ptr DuckDBV2VectorHandle
+  -> BG.Ptr DuckDBV2ErrorInfoHandle
+  -> IO DuckDBV2Error
+hs_bindgen_7b9e0d949dd7f8a5 =
+  \x0 ->
+    \x1 ->
+      \x2 ->
+        \x3 ->
+          fmap BG.fromFFIType (hs_bindgen_7b9e0d949dd7f8a5_base (BG.toFFIType x0) (BG.toFFIType x1) (BG.toFFIType x2) (BG.toFFIType x3))
+
+{-| __C declaration:__ @duckdb_v2_vector_get_child@
+
+    __defined at:__ @duckdb_v2.h 11737:30@
+
+    __exported by:__ @duckdb_v2.h@
+-}
+c_duckdb_v2_vector_get_child ::
+     DuckDBV2VectorHandle
+     -- ^ __C declaration:__ @vector@
+  -> DuckDBIdx
+     -- ^ __C declaration:__ @index@
+  -> BG.Ptr DuckDBV2VectorHandle
+     -- ^ __C declaration:__ @out_child@
+  -> BG.Ptr DuckDBV2ErrorInfoHandle
+     -- ^ __C declaration:__ @err@
+  -> IO DuckDBV2Error
+c_duckdb_v2_vector_get_child =
+  hs_bindgen_7b9e0d949dd7f8a5
+
+-- __unique:__ @Database_DuckDB_FFI_V2_Database.DuckDB.FFI.V2_Safe_duckdb_v2_bignum_decode@
+foreign import ccall safe "hs_bindgen_30a232980daceef5" hs_bindgen_30a232980daceef5_base ::
+     BG.Ptr BG.Void
+  -> HsBindgen.Runtime.LibC.Word64
+  -> BG.Ptr BG.Void
+  -> HsBindgen.Runtime.LibC.Word64
+  -> BG.Ptr BG.Void
+  -> BG.Ptr BG.Void
+  -> BG.Ptr BG.Void
+  -> IO BG.CUInt
+
+-- __unique:__ @Database_DuckDB_FFI_V2_Database.DuckDB.FFI.V2_Safe_duckdb_v2_bignum_decode@
+hs_bindgen_30a232980daceef5 ::
+     PtrConst.PtrConst HsBindgen.Runtime.LibC.Word8
+  -> DuckDBIdx
+  -> BG.Ptr HsBindgen.Runtime.LibC.Word8
+  -> DuckDBIdx
+  -> BG.Ptr DuckDBIdx
+  -> BG.Ptr BG.CBool
+  -> BG.Ptr DuckDBV2ErrorInfoHandle
+  -> IO DuckDBV2Error
+hs_bindgen_30a232980daceef5 =
+  \x0 ->
+    \x1 ->
+      \x2 ->
+        \x3 ->
+          \x4 ->
+            \x5 ->
+              \x6 ->
+                fmap BG.fromFFIType (hs_bindgen_30a232980daceef5_base (BG.toFFIType x0) (BG.toFFIType x1) (BG.toFFIType x2) (BG.toFFIType x3) (BG.toFFIType x4) (BG.toFFIType x5) (BG.toFFIType x6))
+
+{-| __C declaration:__ @duckdb_v2_bignum_decode@
+
+    __defined at:__ @duckdb_v2.h 11778:30@
+
+    __exported by:__ @duckdb_v2.h@
+-}
+c_duckdb_v2_bignum_decode ::
+     PtrConst.PtrConst HsBindgen.Runtime.LibC.Word8
+     -- ^ __C declaration:__ @in_data@
+  -> DuckDBIdx
+     -- ^ __C declaration:__ @in_length@
+  -> BG.Ptr HsBindgen.Runtime.LibC.Word8
+     -- ^ __C declaration:__ @out_data@
+  -> DuckDBIdx
+     -- ^ __C declaration:__ @out_capacity@
+  -> BG.Ptr DuckDBIdx
+     -- ^ __C declaration:__ @out_length@
+  -> BG.Ptr BG.CBool
+     -- ^ __C declaration:__ @out_is_negative@
+  -> BG.Ptr DuckDBV2ErrorInfoHandle
+     -- ^ __C declaration:__ @err@
+  -> IO DuckDBV2Error
+c_duckdb_v2_bignum_decode =
+  hs_bindgen_30a232980daceef5
+
+-- __unique:__ @Database_DuckDB_FFI_V2_Database.DuckDB.FFI.V2_Safe_duckdb_v2_bignum_encode@
+foreign import ccall safe "hs_bindgen_fe4f11ee6f2d6af1" hs_bindgen_fe4f11ee6f2d6af1_base ::
+     BG.Ptr BG.Void
+  -> HsBindgen.Runtime.LibC.Word64
+  -> BG.CBool
+  -> BG.Ptr BG.Void
+  -> HsBindgen.Runtime.LibC.Word64
+  -> BG.Ptr BG.Void
+  -> BG.Ptr BG.Void
+  -> IO BG.CUInt
+
+-- __unique:__ @Database_DuckDB_FFI_V2_Database.DuckDB.FFI.V2_Safe_duckdb_v2_bignum_encode@
+hs_bindgen_fe4f11ee6f2d6af1 ::
+     PtrConst.PtrConst HsBindgen.Runtime.LibC.Word8
+  -> DuckDBIdx
+  -> BG.CBool
+  -> BG.Ptr HsBindgen.Runtime.LibC.Word8
+  -> DuckDBIdx
+  -> BG.Ptr DuckDBIdx
+  -> BG.Ptr DuckDBV2ErrorInfoHandle
+  -> IO DuckDBV2Error
+hs_bindgen_fe4f11ee6f2d6af1 =
+  \x0 ->
+    \x1 ->
+      \x2 ->
+        \x3 ->
+          \x4 ->
+            \x5 ->
+              \x6 ->
+                fmap BG.fromFFIType (hs_bindgen_fe4f11ee6f2d6af1_base (BG.toFFIType x0) (BG.toFFIType x1) (BG.toFFIType x2) (BG.toFFIType x3) (BG.toFFIType x4) (BG.toFFIType x5) (BG.toFFIType x6))
+
+{-| __C declaration:__ @duckdb_v2_bignum_encode@
+
+    __defined at:__ @duckdb_v2.h 11816:30@
+
+    __exported by:__ @duckdb_v2.h@
+-}
+c_duckdb_v2_bignum_encode ::
+     PtrConst.PtrConst HsBindgen.Runtime.LibC.Word8
+     -- ^ __C declaration:__ @in_data@
+  -> DuckDBIdx
+     -- ^ __C declaration:__ @in_length@
+  -> BG.CBool
+     -- ^ __C declaration:__ @is_negative@
+  -> BG.Ptr HsBindgen.Runtime.LibC.Word8
+     -- ^ __C declaration:__ @out_data@
+  -> DuckDBIdx
+     -- ^ __C declaration:__ @out_capacity@
+  -> BG.Ptr DuckDBIdx
+     -- ^ __C declaration:__ @out_length@
+  -> BG.Ptr DuckDBV2ErrorInfoHandle
+     -- ^ __C declaration:__ @err@
+  -> IO DuckDBV2Error
+c_duckdb_v2_bignum_encode =
+  hs_bindgen_fe4f11ee6f2d6af1
+
+-- __unique:__ @Database_DuckDB_FFI_V2_Database.DuckDB.FFI.V2_Safe_duckdb_v2_validate_utf8@
+foreign import ccall safe "hs_bindgen_8a1d4d4e86271de2" hs_bindgen_8a1d4d4e86271de2_base ::
+     BG.Ptr BG.Void
+  -> BG.Ptr BG.Void
+  -> IO BG.CUInt
+
+-- __unique:__ @Database_DuckDB_FFI_V2_Database.DuckDB.FFI.V2_Safe_duckdb_v2_validate_utf8@
+hs_bindgen_8a1d4d4e86271de2 ::
+     PtrConst.PtrConst DuckDBV2Str
+  -> BG.Ptr DuckDBV2ErrorInfoHandle
+  -> IO DuckDBV2Error
+hs_bindgen_8a1d4d4e86271de2 =
+  \x0 ->
+    \x1 ->
+      fmap BG.fromFFIType (hs_bindgen_8a1d4d4e86271de2_base (BG.toFFIType x0) (BG.toFFIType x1))
+
+{-| __C declaration:__ @duckdb_v2_validate_utf8@
+
+    __defined at:__ @duckdb_v2.h 11839:30@
+
+    __exported by:__ @duckdb_v2.h@
+-}
+c_duckdb_v2_validate_utf8 ::
+     PtrConst.PtrConst DuckDBV2Str
+     -- ^ __C declaration:__ @text@
+  -> BG.Ptr DuckDBV2ErrorInfoHandle
+     -- ^ __C declaration:__ @err@
+  -> IO DuckDBV2Error
+c_duckdb_v2_validate_utf8 =
+  hs_bindgen_8a1d4d4e86271de2
+
+-- __unique:__ @Database_DuckDB_FFI_V2_Database.DuckDB.FFI.V2_Safe_duckdb_v2_prepared_statement_create@
+foreign import ccall safe "hs_bindgen_b9246b8938bd6700" hs_bindgen_b9246b8938bd6700_base ::
+     BG.Ptr BG.Void
+  -> BG.Ptr BG.Void
+  -> BG.CBool
+  -> BG.Ptr BG.Void
+  -> BG.Ptr BG.Void
+  -> IO BG.CUInt
+
+-- __unique:__ @Database_DuckDB_FFI_V2_Database.DuckDB.FFI.V2_Safe_duckdb_v2_prepared_statement_create@
+hs_bindgen_b9246b8938bd6700 ::
+     DuckDBV2ConnectionHandle
+  -> DuckDBV2SqlStatementHandle
+  -> BG.CBool
+  -> BG.Ptr DuckDBV2PreparedStatementHandle
+  -> BG.Ptr DuckDBV2ErrorInfoHandle
+  -> IO DuckDBV2Error
+hs_bindgen_b9246b8938bd6700 =
+  \x0 ->
+    \x1 ->
+      \x2 ->
+        \x3 ->
+          \x4 ->
+            fmap BG.fromFFIType (hs_bindgen_b9246b8938bd6700_base (BG.toFFIType x0) (BG.toFFIType x1) (BG.toFFIType x2) (BG.toFFIType x3) (BG.toFFIType x4))
+
+{-| __C declaration:__ @duckdb_v2_prepared_statement_create@
+
+    __defined at:__ @duckdb_v2.h 11935:30@
+
+    __exported by:__ @duckdb_v2.h@
+-}
+c_duckdb_v2_prepared_statement_create ::
+     DuckDBV2ConnectionHandle
+     -- ^ __C declaration:__ @conn@
+  -> DuckDBV2SqlStatementHandle
+     -- ^ __C declaration:__ @statement@
+  -> BG.CBool
+     -- ^ __C declaration:__ @require_cacheable@
+  -> BG.Ptr DuckDBV2PreparedStatementHandle
+     -- ^ __C declaration:__ @out_prepared@
+  -> BG.Ptr DuckDBV2ErrorInfoHandle
+     -- ^ __C declaration:__ @err@
+  -> IO DuckDBV2Error
+c_duckdb_v2_prepared_statement_create =
+  hs_bindgen_b9246b8938bd6700
+
+-- __unique:__ @Database_DuckDB_FFI_V2_Database.DuckDB.FFI.V2_Safe_duckdb_v2_prepared_statement_execute@
+foreign import ccall safe "hs_bindgen_1358aa1f8c69ea14" hs_bindgen_1358aa1f8c69ea14_base ::
+     BG.Ptr BG.Void
+  -> BG.Ptr BG.Void
+  -> BG.Ptr BG.Void
+  -> HsBindgen.Runtime.LibC.Word64
+  -> BG.Ptr BG.Void
+  -> BG.Ptr BG.Void
+  -> IO BG.CUInt
+
+-- __unique:__ @Database_DuckDB_FFI_V2_Database.DuckDB.FFI.V2_Safe_duckdb_v2_prepared_statement_execute@
+hs_bindgen_1358aa1f8c69ea14 ::
+     DuckDBV2PreparedStatementHandle
+  -> PtrConst.PtrConst DuckDBV2IdentifierT
+  -> PtrConst.PtrConst DuckDBV2ValueHandle
+  -> DuckDBIdx
+  -> BG.Ptr DuckDBV2ResultHandle
+  -> BG.Ptr DuckDBV2ErrorInfoHandle
+  -> IO DuckDBV2Error
+hs_bindgen_1358aa1f8c69ea14 =
+  \x0 ->
+    \x1 ->
+      \x2 ->
+        \x3 ->
+          \x4 ->
+            \x5 ->
+              fmap BG.fromFFIType (hs_bindgen_1358aa1f8c69ea14_base (BG.toFFIType x0) (BG.toFFIType x1) (BG.toFFIType x2) (BG.toFFIType x3) (BG.toFFIType x4) (BG.toFFIType x5))
+
+{-| __C declaration:__ @duckdb_v2_prepared_statement_execute@
+
+    __defined at:__ @duckdb_v2.h 11985:30@
+
+    __exported by:__ @duckdb_v2.h@
+-}
+c_duckdb_v2_prepared_statement_execute ::
+     DuckDBV2PreparedStatementHandle
+     -- ^ __C declaration:__ @prepared@
+  -> PtrConst.PtrConst DuckDBV2IdentifierT
+     -- ^ __C declaration:__ @parameter_names@
+  -> PtrConst.PtrConst DuckDBV2ValueHandle
+     -- ^ __C declaration:__ @parameter_values@
+  -> DuckDBIdx
+     -- ^ __C declaration:__ @parameter_count@
+  -> BG.Ptr DuckDBV2ResultHandle
+     -- ^ __C declaration:__ @out_result@
+  -> BG.Ptr DuckDBV2ErrorInfoHandle
+     -- ^ __C declaration:__ @err@
+  -> IO DuckDBV2Error
+c_duckdb_v2_prepared_statement_execute =
+  hs_bindgen_1358aa1f8c69ea14
+
+-- __unique:__ @Database_DuckDB_FFI_V2_Database.DuckDB.FFI.V2_Safe_duckdb_v2_prepared_statement_reuses_plan@
+foreign import ccall safe "hs_bindgen_605ebc6c17f6f506" hs_bindgen_605ebc6c17f6f506_base ::
+     BG.Ptr BG.Void
+  -> BG.Ptr BG.Void
+  -> BG.Ptr BG.Void
+  -> IO BG.CUInt
+
+-- __unique:__ @Database_DuckDB_FFI_V2_Database.DuckDB.FFI.V2_Safe_duckdb_v2_prepared_statement_reuses_plan@
+hs_bindgen_605ebc6c17f6f506 ::
+     DuckDBV2PreparedStatementHandle
+  -> BG.Ptr BG.CBool
+  -> BG.Ptr DuckDBV2ErrorInfoHandle
+  -> IO DuckDBV2Error
+hs_bindgen_605ebc6c17f6f506 =
+  \x0 ->
+    \x1 ->
+      \x2 ->
+        fmap BG.fromFFIType (hs_bindgen_605ebc6c17f6f506_base (BG.toFFIType x0) (BG.toFFIType x1) (BG.toFFIType x2))
+
+{-| __C declaration:__ @duckdb_v2_prepared_statement_reuses_plan@
+
+    __defined at:__ @duckdb_v2.h 12017:30@
+
+    __exported by:__ @duckdb_v2.h@
+-}
+c_duckdb_v2_prepared_statement_reuses_plan ::
+     DuckDBV2PreparedStatementHandle
+     -- ^ __C declaration:__ @prepared@
+  -> BG.Ptr BG.CBool
+     -- ^ __C declaration:__ @out_reuses@
+  -> BG.Ptr DuckDBV2ErrorInfoHandle
+     -- ^ __C declaration:__ @err@
+  -> IO DuckDBV2Error
+c_duckdb_v2_prepared_statement_reuses_plan =
+  hs_bindgen_605ebc6c17f6f506
+
+-- __unique:__ @Database_DuckDB_FFI_V2_Database.DuckDB.FFI.V2_Safe_duckdb_v2_prepared_statement_destroy@
+foreign import ccall safe "hs_bindgen_d25880906eff71c0" hs_bindgen_d25880906eff71c0_base ::
+     BG.Ptr BG.Void
+  -> IO BG.CUInt
+
+-- __unique:__ @Database_DuckDB_FFI_V2_Database.DuckDB.FFI.V2_Safe_duckdb_v2_prepared_statement_destroy@
+hs_bindgen_d25880906eff71c0 ::
+     BG.Ptr DuckDBV2PreparedStatementHandle
+  -> IO DuckDBV2Error
+hs_bindgen_d25880906eff71c0 =
+  \x0 ->
+    fmap BG.fromFFIType (hs_bindgen_d25880906eff71c0_base (BG.toFFIType x0))
+
+{-| __C declaration:__ @duckdb_v2_prepared_statement_destroy@
+
+    __defined at:__ @duckdb_v2.h 12036:30@
+
+    __exported by:__ @duckdb_v2.h@
+-}
+c_duckdb_v2_prepared_statement_destroy ::
+     BG.Ptr DuckDBV2PreparedStatementHandle
+     -- ^ __C declaration:__ @prepared@
+  -> IO DuckDBV2Error
+c_duckdb_v2_prepared_statement_destroy =
+  hs_bindgen_d25880906eff71c0
+
+-- __unique:__ @Database_DuckDB_FFI_V2_Database.DuckDB.FFI.V2_Safe_duckdb_v2_statement_execute@
+foreign import ccall safe "hs_bindgen_6f34761779a741e9" hs_bindgen_6f34761779a741e9_base ::
+     BG.Ptr BG.Void
+  -> BG.Ptr BG.Void
+  -> BG.Ptr BG.Void
+  -> BG.Ptr BG.Void
+  -> HsBindgen.Runtime.LibC.Word64
+  -> BG.Ptr BG.Void
+  -> BG.Ptr BG.Void
+  -> IO BG.CUInt
+
+-- __unique:__ @Database_DuckDB_FFI_V2_Database.DuckDB.FFI.V2_Safe_duckdb_v2_statement_execute@
+hs_bindgen_6f34761779a741e9 ::
+     DuckDBV2ConnectionHandle
+  -> DuckDBV2SqlStatementHandle
+  -> PtrConst.PtrConst DuckDBV2IdentifierT
+  -> PtrConst.PtrConst DuckDBV2ValueHandle
+  -> DuckDBIdx
+  -> BG.Ptr DuckDBV2ResultHandle
+  -> BG.Ptr DuckDBV2ErrorInfoHandle
+  -> IO DuckDBV2Error
+hs_bindgen_6f34761779a741e9 =
+  \x0 ->
+    \x1 ->
+      \x2 ->
+        \x3 ->
+          \x4 ->
+            \x5 ->
+              \x6 ->
+                fmap BG.fromFFIType (hs_bindgen_6f34761779a741e9_base (BG.toFFIType x0) (BG.toFFIType x1) (BG.toFFIType x2) (BG.toFFIType x3) (BG.toFFIType x4) (BG.toFFIType x5) (BG.toFFIType x6))
+
+{-| __C declaration:__ @duckdb_v2_statement_execute@
+
+    __defined at:__ @duckdb_v2.h 12140:30@
+
+    __exported by:__ @duckdb_v2.h@
+-}
+c_duckdb_v2_statement_execute ::
+     DuckDBV2ConnectionHandle
+     -- ^ __C declaration:__ @conn@
+  -> DuckDBV2SqlStatementHandle
+     -- ^ __C declaration:__ @statement@
+  -> PtrConst.PtrConst DuckDBV2IdentifierT
+     -- ^ __C declaration:__ @parameter_names@
+  -> PtrConst.PtrConst DuckDBV2ValueHandle
+     -- ^ __C declaration:__ @parameter_values@
+  -> DuckDBIdx
+     -- ^ __C declaration:__ @parameter_count@
+  -> BG.Ptr DuckDBV2ResultHandle
+     -- ^ __C declaration:__ @out_result@
+  -> BG.Ptr DuckDBV2ErrorInfoHandle
+     -- ^ __C declaration:__ @err@
+  -> IO DuckDBV2Error
+c_duckdb_v2_statement_execute =
+  hs_bindgen_6f34761779a741e9
+
+-- __unique:__ @Database_DuckDB_FFI_V2_Database.DuckDB.FFI.V2_Safe_duckdb_v2_result_destroy@
+foreign import ccall safe "hs_bindgen_66a764cfa998a75d" hs_bindgen_66a764cfa998a75d_base ::
+     BG.Ptr BG.Void
+  -> IO BG.CUInt
+
+-- __unique:__ @Database_DuckDB_FFI_V2_Database.DuckDB.FFI.V2_Safe_duckdb_v2_result_destroy@
+hs_bindgen_66a764cfa998a75d ::
+     BG.Ptr DuckDBV2ResultHandle
+  -> IO DuckDBV2Error
+hs_bindgen_66a764cfa998a75d =
+  \x0 ->
+    fmap BG.fromFFIType (hs_bindgen_66a764cfa998a75d_base (BG.toFFIType x0))
+
+{-| __C declaration:__ @duckdb_v2_result_destroy@
+
+    __defined at:__ @duckdb_v2.h 12164:30@
+
+    __exported by:__ @duckdb_v2.h@
+-}
+c_duckdb_v2_result_destroy ::
+     BG.Ptr DuckDBV2ResultHandle
+     -- ^ __C declaration:__ @result@
+  -> IO DuckDBV2Error
+c_duckdb_v2_result_destroy =
+  hs_bindgen_66a764cfa998a75d
+
+-- __unique:__ @Database_DuckDB_FFI_V2_Database.DuckDB.FFI.V2_Safe_duckdb_v2_result_step@
+foreign import ccall safe "hs_bindgen_0b00e1f00ca06883" hs_bindgen_0b00e1f00ca06883_base ::
+     BG.Ptr BG.Void
+  -> BG.Ptr BG.Void
+  -> BG.Ptr BG.Void
+  -> BG.Ptr BG.Void
+  -> IO BG.CUInt
+
+-- __unique:__ @Database_DuckDB_FFI_V2_Database.DuckDB.FFI.V2_Safe_duckdb_v2_result_step@
+hs_bindgen_0b00e1f00ca06883 ::
+     DuckDBV2ResultHandle
+  -> BG.Ptr DuckDBV2DataChunkHandle
+  -> BG.Ptr DuckDBV2ResultStepStatus
+  -> BG.Ptr DuckDBV2ErrorInfoHandle
+  -> IO DuckDBV2Error
+hs_bindgen_0b00e1f00ca06883 =
+  \x0 ->
+    \x1 ->
+      \x2 ->
+        \x3 ->
+          fmap BG.fromFFIType (hs_bindgen_0b00e1f00ca06883_base (BG.toFFIType x0) (BG.toFFIType x1) (BG.toFFIType x2) (BG.toFFIType x3))
+
+{-| __C declaration:__ @duckdb_v2_result_step@
+
+    __defined at:__ @duckdb_v2.h 12196:30@
+
+    __exported by:__ @duckdb_v2.h@
+-}
+c_duckdb_v2_result_step ::
+     DuckDBV2ResultHandle
+     -- ^ __C declaration:__ @result@
+  -> BG.Ptr DuckDBV2DataChunkHandle
+     -- ^ __C declaration:__ @out_chunk@
+  -> BG.Ptr DuckDBV2ResultStepStatus
+     -- ^ __C declaration:__ @out_status@
+  -> BG.Ptr DuckDBV2ErrorInfoHandle
+     -- ^ __C declaration:__ @err@
+  -> IO DuckDBV2Error
+c_duckdb_v2_result_step = hs_bindgen_0b00e1f00ca06883
+
+-- __unique:__ @Database_DuckDB_FFI_V2_Database.DuckDB.FFI.V2_Safe_duckdb_v2_result_fetch_chunk@
+foreign import ccall safe "hs_bindgen_5a9c2831f75d0684" hs_bindgen_5a9c2831f75d0684_base ::
+     BG.Ptr BG.Void
+  -> BG.Ptr BG.Void
+  -> BG.Ptr BG.Void
+  -> IO BG.CUInt
+
+-- __unique:__ @Database_DuckDB_FFI_V2_Database.DuckDB.FFI.V2_Safe_duckdb_v2_result_fetch_chunk@
+hs_bindgen_5a9c2831f75d0684 ::
+     DuckDBV2ResultHandle
+  -> BG.Ptr DuckDBV2DataChunkHandle
+  -> BG.Ptr DuckDBV2ErrorInfoHandle
+  -> IO DuckDBV2Error
+hs_bindgen_5a9c2831f75d0684 =
+  \x0 ->
+    \x1 ->
+      \x2 ->
+        fmap BG.fromFFIType (hs_bindgen_5a9c2831f75d0684_base (BG.toFFIType x0) (BG.toFFIType x1) (BG.toFFIType x2))
+
+{-| __C declaration:__ @duckdb_v2_result_fetch_chunk@
+
+    __defined at:__ @duckdb_v2.h 12223:30@
+
+    __exported by:__ @duckdb_v2.h@
+-}
+c_duckdb_v2_result_fetch_chunk ::
+     DuckDBV2ResultHandle
+     -- ^ __C declaration:__ @result@
+  -> BG.Ptr DuckDBV2DataChunkHandle
+     -- ^ __C declaration:__ @out_chunk@
+  -> BG.Ptr DuckDBV2ErrorInfoHandle
+     -- ^ __C declaration:__ @err@
+  -> IO DuckDBV2Error
+c_duckdb_v2_result_fetch_chunk =
+  hs_bindgen_5a9c2831f75d0684
+
+-- __unique:__ @Database_DuckDB_FFI_V2_Database.DuckDB.FFI.V2_Safe_duckdb_v2_result_wait@
+foreign import ccall safe "hs_bindgen_0e4429c34e59a1b5" hs_bindgen_0e4429c34e59a1b5_base ::
+     BG.Ptr BG.Void
+  -> BG.Ptr BG.Void
+  -> IO BG.CUInt
+
+-- __unique:__ @Database_DuckDB_FFI_V2_Database.DuckDB.FFI.V2_Safe_duckdb_v2_result_wait@
+hs_bindgen_0e4429c34e59a1b5 ::
+     DuckDBV2ResultHandle
+  -> BG.Ptr DuckDBV2ErrorInfoHandle
+  -> IO DuckDBV2Error
+hs_bindgen_0e4429c34e59a1b5 =
+  \x0 ->
+    \x1 ->
+      fmap BG.fromFFIType (hs_bindgen_0e4429c34e59a1b5_base (BG.toFFIType x0) (BG.toFFIType x1))
+
+{-| __C declaration:__ @duckdb_v2_result_wait@
+
+    __defined at:__ @duckdb_v2.h 12243:30@
+
+    __exported by:__ @duckdb_v2.h@
+-}
+c_duckdb_v2_result_wait ::
+     DuckDBV2ResultHandle
+     -- ^ __C declaration:__ @result@
+  -> BG.Ptr DuckDBV2ErrorInfoHandle
+     -- ^ __C declaration:__ @err@
+  -> IO DuckDBV2Error
+c_duckdb_v2_result_wait = hs_bindgen_0e4429c34e59a1b5
+
+-- __unique:__ @Database_DuckDB_FFI_V2_Database.DuckDB.FFI.V2_Safe_duckdb_v2_result_render_box@
+foreign import ccall safe "hs_bindgen_ce024cb402576a11" hs_bindgen_ce024cb402576a11_base ::
+     BG.Ptr BG.Void
+  -> HsBindgen.Runtime.LibC.Word64
+  -> HsBindgen.Runtime.LibC.Word64
+  -> HsBindgen.Runtime.LibC.Word64
+  -> BG.Ptr BG.Void
+  -> HsBindgen.Runtime.LibC.Word64
+  -> HsBindgen.Runtime.LibC.Word64
+  -> BG.FunPtr BG.Void
+  -> BG.Ptr BG.Void
+  -> BG.Ptr BG.Void
+  -> IO BG.CUInt
+
+-- __unique:__ @Database_DuckDB_FFI_V2_Database.DuckDB.FFI.V2_Safe_duckdb_v2_result_render_box@
+hs_bindgen_ce024cb402576a11 ::
+     BG.Ptr DuckDBV2ResultHandle
+  -> DuckDBIdx
+  -> DuckDBIdx
+  -> DuckDBIdx
+  -> PtrConst.PtrConst DuckDBV2Str
+  -> DuckDBIdx
+  -> DuckDBIdx
+  -> DuckDBV2TextSinkFn
+  -> BG.Ptr BG.Void
+  -> BG.Ptr DuckDBV2ErrorInfoHandle
+  -> IO DuckDBV2Error
+hs_bindgen_ce024cb402576a11 =
+  \x0 ->
+    \x1 ->
+      \x2 ->
+        \x3 ->
+          \x4 ->
+            \x5 ->
+              \x6 ->
+                \x7 ->
+                  \x8 ->
+                    \x9 ->
+                      fmap BG.fromFFIType (hs_bindgen_ce024cb402576a11_base (BG.toFFIType x0) (BG.toFFIType x1) (BG.toFFIType x2) (BG.toFFIType x3) (BG.toFFIType x4) (BG.toFFIType x5) (BG.toFFIType x6) (BG.toFFIType x7) (BG.toFFIType x8) (BG.toFFIType x9))
+
+{-| __C declaration:__ @duckdb_v2_result_render_box@
+
+    __defined at:__ @duckdb_v2.h 12286:30@
+
+    __exported by:__ @duckdb_v2.h@
+-}
+c_duckdb_v2_result_render_box ::
+     BG.Ptr DuckDBV2ResultHandle
+     -- ^ __C declaration:__ @result@
+  -> DuckDBIdx
+     -- ^ __C declaration:__ @max_rows@
+  -> DuckDBIdx
+     -- ^ __C declaration:__ @max_width@
+  -> DuckDBIdx
+     -- ^ __C declaration:__ @max_col_width@
+  -> PtrConst.PtrConst DuckDBV2Str
+     -- ^ __C declaration:__ @null_value@
+  -> DuckDBIdx
+     -- ^ __C declaration:__ @render_mode@
+  -> DuckDBIdx
+     -- ^ __C declaration:__ @limit@
+  -> DuckDBV2TextSinkFn
+     -- ^ __C declaration:__ @sink@
+  -> BG.Ptr BG.Void
+     -- ^ __C declaration:__ @user_data@
+  -> BG.Ptr DuckDBV2ErrorInfoHandle
+     -- ^ __C declaration:__ @err@
+  -> IO DuckDBV2Error
+c_duckdb_v2_result_render_box =
+  hs_bindgen_ce024cb402576a11
+
+-- __unique:__ @Database_DuckDB_FFI_V2_Database.DuckDB.FFI.V2_Safe_duckdb_v2_result_drain@
+foreign import ccall safe "hs_bindgen_9dcda3b02c8ae4a6" hs_bindgen_9dcda3b02c8ae4a6_base ::
+     BG.Ptr BG.Void
+  -> BG.Ptr BG.Void
+  -> BG.Ptr BG.Void
+  -> IO BG.CUInt
+
+-- __unique:__ @Database_DuckDB_FFI_V2_Database.DuckDB.FFI.V2_Safe_duckdb_v2_result_drain@
+hs_bindgen_9dcda3b02c8ae4a6 ::
+     DuckDBV2ResultHandle
+  -> BG.Ptr DuckDBIdx
+  -> BG.Ptr DuckDBV2ErrorInfoHandle
+  -> IO DuckDBV2Error
+hs_bindgen_9dcda3b02c8ae4a6 =
+  \x0 ->
+    \x1 ->
+      \x2 ->
+        fmap BG.fromFFIType (hs_bindgen_9dcda3b02c8ae4a6_base (BG.toFFIType x0) (BG.toFFIType x1) (BG.toFFIType x2))
+
+{-| __C declaration:__ @duckdb_v2_result_drain@
+
+    __defined at:__ @duckdb_v2.h 12313:30@
+
+    __exported by:__ @duckdb_v2.h@
+-}
+c_duckdb_v2_result_drain ::
+     DuckDBV2ResultHandle
+     -- ^ __C declaration:__ @result@
+  -> BG.Ptr DuckDBIdx
+     -- ^ __C declaration:__ @out_rows_changed@
+  -> BG.Ptr DuckDBV2ErrorInfoHandle
+     -- ^ __C declaration:__ @err@
+  -> IO DuckDBV2Error
+c_duckdb_v2_result_drain =
+  hs_bindgen_9dcda3b02c8ae4a6
+
+-- __unique:__ @Database_DuckDB_FFI_V2_Database.DuckDB.FFI.V2_Safe_duckdb_v2_result_get_result_type@
+foreign import ccall safe "hs_bindgen_51b942a49ae35ec3" hs_bindgen_51b942a49ae35ec3_base ::
+     BG.Ptr BG.Void
+  -> BG.Ptr BG.Void
+  -> BG.Ptr BG.Void
+  -> IO BG.CUInt
+
+-- __unique:__ @Database_DuckDB_FFI_V2_Database.DuckDB.FFI.V2_Safe_duckdb_v2_result_get_result_type@
+hs_bindgen_51b942a49ae35ec3 ::
+     DuckDBV2ResultHandle
+  -> BG.Ptr DuckDBV2ResultType
+  -> BG.Ptr DuckDBV2ErrorInfoHandle
+  -> IO DuckDBV2Error
+hs_bindgen_51b942a49ae35ec3 =
+  \x0 ->
+    \x1 ->
+      \x2 ->
+        fmap BG.fromFFIType (hs_bindgen_51b942a49ae35ec3_base (BG.toFFIType x0) (BG.toFFIType x1) (BG.toFFIType x2))
+
+{-| __C declaration:__ @duckdb_v2_result_get_result_type@
+
+    __defined at:__ @duckdb_v2.h 12336:30@
+
+    __exported by:__ @duckdb_v2.h@
+-}
+c_duckdb_v2_result_get_result_type ::
+     DuckDBV2ResultHandle
+     -- ^ __C declaration:__ @result@
+  -> BG.Ptr DuckDBV2ResultType
+     -- ^ __C declaration:__ @out_type@
+  -> BG.Ptr DuckDBV2ErrorInfoHandle
+     -- ^ __C declaration:__ @err@
+  -> IO DuckDBV2Error
+c_duckdb_v2_result_get_result_type =
+  hs_bindgen_51b942a49ae35ec3
+
+-- __unique:__ @Database_DuckDB_FFI_V2_Database.DuckDB.FFI.V2_Safe_duckdb_v2_result_get_statement_type@
+foreign import ccall safe "hs_bindgen_72821b70c768d2f5" hs_bindgen_72821b70c768d2f5_base ::
+     BG.Ptr BG.Void
+  -> BG.Ptr BG.Void
+  -> BG.Ptr BG.Void
+  -> IO BG.CUInt
+
+-- __unique:__ @Database_DuckDB_FFI_V2_Database.DuckDB.FFI.V2_Safe_duckdb_v2_result_get_statement_type@
+hs_bindgen_72821b70c768d2f5 ::
+     DuckDBV2ResultHandle
+  -> BG.Ptr DuckDBV2StatementType
+  -> BG.Ptr DuckDBV2ErrorInfoHandle
+  -> IO DuckDBV2Error
+hs_bindgen_72821b70c768d2f5 =
+  \x0 ->
+    \x1 ->
+      \x2 ->
+        fmap BG.fromFFIType (hs_bindgen_72821b70c768d2f5_base (BG.toFFIType x0) (BG.toFFIType x1) (BG.toFFIType x2))
+
+{-| __C declaration:__ @duckdb_v2_result_get_statement_type@
+
+    __defined at:__ @duckdb_v2.h 12356:30@
+
+    __exported by:__ @duckdb_v2.h@
+-}
+c_duckdb_v2_result_get_statement_type ::
+     DuckDBV2ResultHandle
+     -- ^ __C declaration:__ @result@
+  -> BG.Ptr DuckDBV2StatementType
+     -- ^ __C declaration:__ @out_type@
+  -> BG.Ptr DuckDBV2ErrorInfoHandle
+     -- ^ __C declaration:__ @err@
+  -> IO DuckDBV2Error
+c_duckdb_v2_result_get_statement_type =
+  hs_bindgen_72821b70c768d2f5
+
+-- __unique:__ @Database_DuckDB_FFI_V2_Database.DuckDB.FFI.V2_Safe_duckdb_v2_result_get_schema@
+foreign import ccall safe "hs_bindgen_d5bff92c871a172c" hs_bindgen_d5bff92c871a172c_base ::
+     BG.Ptr BG.Void
+  -> BG.Ptr BG.Void
+  -> BG.Ptr BG.Void
+  -> IO BG.CUInt
+
+-- __unique:__ @Database_DuckDB_FFI_V2_Database.DuckDB.FFI.V2_Safe_duckdb_v2_result_get_schema@
+hs_bindgen_d5bff92c871a172c ::
+     DuckDBV2ResultHandle
+  -> BG.Ptr DuckDBV2SchemaHandle
+  -> BG.Ptr DuckDBV2ErrorInfoHandle
+  -> IO DuckDBV2Error
+hs_bindgen_d5bff92c871a172c =
+  \x0 ->
+    \x1 ->
+      \x2 ->
+        fmap BG.fromFFIType (hs_bindgen_d5bff92c871a172c_base (BG.toFFIType x0) (BG.toFFIType x1) (BG.toFFIType x2))
+
+{-| __C declaration:__ @duckdb_v2_result_get_schema@
+
+    __defined at:__ @duckdb_v2.h 12383:30@
+
+    __exported by:__ @duckdb_v2.h@
+-}
+c_duckdb_v2_result_get_schema ::
+     DuckDBV2ResultHandle
+     -- ^ __C declaration:__ @result@
+  -> BG.Ptr DuckDBV2SchemaHandle
+     -- ^ __C declaration:__ @out_schema@
+  -> BG.Ptr DuckDBV2ErrorInfoHandle
+     -- ^ __C declaration:__ @err@
+  -> IO DuckDBV2Error
+c_duckdb_v2_result_get_schema =
+  hs_bindgen_d5bff92c871a172c
+
+-- __unique:__ @Database_DuckDB_FFI_V2_Database.DuckDB.FFI.V2_Safe_duckdb_v2_table_function_create@
+foreign import ccall safe "hs_bindgen_61d284c9af297e34" hs_bindgen_61d284c9af297e34_base ::
+     BG.Ptr BG.Void
+  -> BG.Ptr BG.Void
+  -> BG.Ptr BG.Void
+  -> IO BG.CUInt
+
+-- __unique:__ @Database_DuckDB_FFI_V2_Database.DuckDB.FFI.V2_Safe_duckdb_v2_table_function_create@
+hs_bindgen_61d284c9af297e34 ::
+     DuckDBV2FactoryHandle
+  -> BG.Ptr DuckDBV2TableFunctionHandle
+  -> BG.Ptr DuckDBV2ErrorInfoHandle
+  -> IO DuckDBV2Error
+hs_bindgen_61d284c9af297e34 =
+  \x0 ->
+    \x1 ->
+      \x2 ->
+        fmap BG.fromFFIType (hs_bindgen_61d284c9af297e34_base (BG.toFFIType x0) (BG.toFFIType x1) (BG.toFFIType x2))
+
+{-| __C declaration:__ @duckdb_v2_table_function_create@
+
+    __defined at:__ @duckdb_v2.h 12604:30@
+
+    __exported by:__ @duckdb_v2.h@
+-}
+c_duckdb_v2_table_function_create ::
+     DuckDBV2FactoryHandle
+     -- ^ __C declaration:__ @factory@
+  -> BG.Ptr DuckDBV2TableFunctionHandle
+     -- ^ __C declaration:__ @function@
+  -> BG.Ptr DuckDBV2ErrorInfoHandle
+     -- ^ __C declaration:__ @err@
+  -> IO DuckDBV2Error
+c_duckdb_v2_table_function_create =
+  hs_bindgen_61d284c9af297e34
+
+-- __unique:__ @Database_DuckDB_FFI_V2_Database.DuckDB.FFI.V2_Safe_duckdb_v2_table_function_set_name@
+foreign import ccall safe "hs_bindgen_fee371a3c30f3680" hs_bindgen_fee371a3c30f3680_base ::
+     BG.Ptr BG.Void
+  -> BG.Ptr BG.Void
+  -> BG.Ptr BG.Void
+  -> IO BG.CUInt
+
+-- __unique:__ @Database_DuckDB_FFI_V2_Database.DuckDB.FFI.V2_Safe_duckdb_v2_table_function_set_name@
+hs_bindgen_fee371a3c30f3680 ::
+     DuckDBV2TableFunctionHandle
+  -> PtrConst.PtrConst DuckDBV2IdentifierT
+  -> BG.Ptr DuckDBV2ErrorInfoHandle
+  -> IO DuckDBV2Error
+hs_bindgen_fee371a3c30f3680 =
+  \x0 ->
+    \x1 ->
+      \x2 ->
+        fmap BG.fromFFIType (hs_bindgen_fee371a3c30f3680_base (BG.toFFIType x0) (BG.toFFIType x1) (BG.toFFIType x2))
+
+{-| __C declaration:__ @duckdb_v2_table_function_set_name@
+
+    __defined at:__ @duckdb_v2.h 12625:30@
+
+    __exported by:__ @duckdb_v2.h@
+-}
+c_duckdb_v2_table_function_set_name ::
+     DuckDBV2TableFunctionHandle
+     -- ^ __C declaration:__ @function@
+  -> PtrConst.PtrConst DuckDBV2IdentifierT
+     -- ^ __C declaration:__ @name@
+  -> BG.Ptr DuckDBV2ErrorInfoHandle
+     -- ^ __C declaration:__ @err@
+  -> IO DuckDBV2Error
+c_duckdb_v2_table_function_set_name =
+  hs_bindgen_fee371a3c30f3680
+
+-- __unique:__ @Database_DuckDB_FFI_V2_Database.DuckDB.FFI.V2_Safe_duckdb_v2_table_function_get_docs@
+foreign import ccall safe "hs_bindgen_574753c003d123f1" hs_bindgen_574753c003d123f1_base ::
+     BG.Ptr BG.Void
+  -> BG.Ptr BG.Void
+  -> BG.Ptr BG.Void
+  -> IO BG.CUInt
+
+-- __unique:__ @Database_DuckDB_FFI_V2_Database.DuckDB.FFI.V2_Safe_duckdb_v2_table_function_get_docs@
+hs_bindgen_574753c003d123f1 ::
+     DuckDBV2TableFunctionHandle
+  -> BG.Ptr DuckDBV2FunctionDocsHandle
+  -> BG.Ptr DuckDBV2ErrorInfoHandle
+  -> IO DuckDBV2Error
+hs_bindgen_574753c003d123f1 =
+  \x0 ->
+    \x1 ->
+      \x2 ->
+        fmap BG.fromFFIType (hs_bindgen_574753c003d123f1_base (BG.toFFIType x0) (BG.toFFIType x1) (BG.toFFIType x2))
+
+{-| __C declaration:__ @duckdb_v2_table_function_get_docs@
+
+    __defined at:__ @duckdb_v2.h 12647:30@
+
+    __exported by:__ @duckdb_v2.h@
+-}
+c_duckdb_v2_table_function_get_docs ::
+     DuckDBV2TableFunctionHandle
+     -- ^ __C declaration:__ @function@
+  -> BG.Ptr DuckDBV2FunctionDocsHandle
+     -- ^ __C declaration:__ @docs@
+  -> BG.Ptr DuckDBV2ErrorInfoHandle
+     -- ^ __C declaration:__ @err@
+  -> IO DuckDBV2Error
+c_duckdb_v2_table_function_get_docs =
+  hs_bindgen_574753c003d123f1
+
+-- __unique:__ @Database_DuckDB_FFI_V2_Database.DuckDB.FFI.V2_Safe_duckdb_v2_table_function_get_signature@
+foreign import ccall safe "hs_bindgen_a39f5939f3ff51da" hs_bindgen_a39f5939f3ff51da_base ::
+     BG.Ptr BG.Void
+  -> BG.Ptr BG.Void
+  -> BG.Ptr BG.Void
+  -> IO BG.CUInt
+
+-- __unique:__ @Database_DuckDB_FFI_V2_Database.DuckDB.FFI.V2_Safe_duckdb_v2_table_function_get_signature@
+hs_bindgen_a39f5939f3ff51da ::
+     DuckDBV2TableFunctionHandle
+  -> BG.Ptr DuckDBV2FunctionSignatureHandle
+  -> BG.Ptr DuckDBV2ErrorInfoHandle
+  -> IO DuckDBV2Error
+hs_bindgen_a39f5939f3ff51da =
+  \x0 ->
+    \x1 ->
+      \x2 ->
+        fmap BG.fromFFIType (hs_bindgen_a39f5939f3ff51da_base (BG.toFFIType x0) (BG.toFFIType x1) (BG.toFFIType x2))
+
+{-| __C declaration:__ @duckdb_v2_table_function_get_signature@
+
+    __defined at:__ @duckdb_v2.h 12669:30@
+
+    __exported by:__ @duckdb_v2.h@
+-}
+c_duckdb_v2_table_function_get_signature ::
+     DuckDBV2TableFunctionHandle
+     -- ^ __C declaration:__ @function@
+  -> BG.Ptr DuckDBV2FunctionSignatureHandle
+     -- ^ __C declaration:__ @sig@
+  -> BG.Ptr DuckDBV2ErrorInfoHandle
+     -- ^ __C declaration:__ @err@
+  -> IO DuckDBV2Error
+c_duckdb_v2_table_function_get_signature =
+  hs_bindgen_a39f5939f3ff51da
+
+-- __unique:__ @Database_DuckDB_FFI_V2_Database.DuckDB.FFI.V2_Safe_duckdb_v2_table_function_set_user_data@
+foreign import ccall safe "hs_bindgen_db810193f6248613" hs_bindgen_db810193f6248613_base ::
+     BG.Ptr BG.Void
+  -> BG.Ptr BG.Void
+  -> BG.Ptr BG.Void
+  -> IO BG.CUInt
+
+-- __unique:__ @Database_DuckDB_FFI_V2_Database.DuckDB.FFI.V2_Safe_duckdb_v2_table_function_set_user_data@
+hs_bindgen_db810193f6248613 ::
+     DuckDBV2TableFunctionHandle
+  -> BG.Ptr DuckDBV2Opaque
+  -> BG.Ptr DuckDBV2ErrorInfoHandle
+  -> IO DuckDBV2Error
+hs_bindgen_db810193f6248613 =
+  \x0 ->
+    \x1 ->
+      \x2 ->
+        fmap BG.fromFFIType (hs_bindgen_db810193f6248613_base (BG.toFFIType x0) (BG.toFFIType x1) (BG.toFFIType x2))
+
+{-| __C declaration:__ @duckdb_v2_table_function_set_user_data@
+
+    __defined at:__ @duckdb_v2.h 12692:30@
+
+    __exported by:__ @duckdb_v2.h@
+-}
+c_duckdb_v2_table_function_set_user_data ::
+     DuckDBV2TableFunctionHandle
+     -- ^ __C declaration:__ @function@
+  -> BG.Ptr DuckDBV2Opaque
+     -- ^ __C declaration:__ @data@
+  -> BG.Ptr DuckDBV2ErrorInfoHandle
+     -- ^ __C declaration:__ @err@
+  -> IO DuckDBV2Error
+c_duckdb_v2_table_function_set_user_data =
+  hs_bindgen_db810193f6248613
+
+-- __unique:__ @Database_DuckDB_FFI_V2_Database.DuckDB.FFI.V2_Safe_duckdb_v2_table_function_set_bind_callback@
+foreign import ccall safe "hs_bindgen_d230471ae19015d9" hs_bindgen_d230471ae19015d9_base ::
+     BG.Ptr BG.Void
+  -> BG.FunPtr BG.Void
+  -> BG.Ptr BG.Void
+  -> IO BG.CUInt
+
+-- __unique:__ @Database_DuckDB_FFI_V2_Database.DuckDB.FFI.V2_Safe_duckdb_v2_table_function_set_bind_callback@
+hs_bindgen_d230471ae19015d9 ::
+     DuckDBV2TableFunctionHandle
+  -> DuckDBV2TableFunctionBindCallbackFn
+  -> BG.Ptr DuckDBV2ErrorInfoHandle
+  -> IO DuckDBV2Error
+hs_bindgen_d230471ae19015d9 =
+  \x0 ->
+    \x1 ->
+      \x2 ->
+        fmap BG.fromFFIType (hs_bindgen_d230471ae19015d9_base (BG.toFFIType x0) (BG.toFFIType x1) (BG.toFFIType x2))
+
+{-| __C declaration:__ @duckdb_v2_table_function_set_bind_callback@
+
+    __defined at:__ @duckdb_v2.h 12715:30@
+
+    __exported by:__ @duckdb_v2.h@
+-}
+c_duckdb_v2_table_function_set_bind_callback ::
+     DuckDBV2TableFunctionHandle
+     -- ^ __C declaration:__ @function@
+  -> DuckDBV2TableFunctionBindCallbackFn
+     -- ^ __C declaration:__ @callback@
+  -> BG.Ptr DuckDBV2ErrorInfoHandle
+     -- ^ __C declaration:__ @err@
+  -> IO DuckDBV2Error
+c_duckdb_v2_table_function_set_bind_callback =
+  hs_bindgen_d230471ae19015d9
+
+-- __unique:__ @Database_DuckDB_FFI_V2_Database.DuckDB.FFI.V2_Safe_duckdb_v2_table_function_set_init_global_callback@
+foreign import ccall safe "hs_bindgen_99d851dc0c2a3c67" hs_bindgen_99d851dc0c2a3c67_base ::
+     BG.Ptr BG.Void
+  -> BG.FunPtr BG.Void
+  -> BG.Ptr BG.Void
+  -> IO BG.CUInt
+
+-- __unique:__ @Database_DuckDB_FFI_V2_Database.DuckDB.FFI.V2_Safe_duckdb_v2_table_function_set_init_global_callback@
+hs_bindgen_99d851dc0c2a3c67 ::
+     DuckDBV2TableFunctionHandle
+  -> DuckDBV2TableFunctionInitGlobalCallbackFn
+  -> BG.Ptr DuckDBV2ErrorInfoHandle
+  -> IO DuckDBV2Error
+hs_bindgen_99d851dc0c2a3c67 =
+  \x0 ->
+    \x1 ->
+      \x2 ->
+        fmap BG.fromFFIType (hs_bindgen_99d851dc0c2a3c67_base (BG.toFFIType x0) (BG.toFFIType x1) (BG.toFFIType x2))
+
+{-| __C declaration:__ @duckdb_v2_table_function_set_init_global_callback@
+
+    __defined at:__ @duckdb_v2.h 12737:30@
+
+    __exported by:__ @duckdb_v2.h@
+-}
+c_duckdb_v2_table_function_set_init_global_callback ::
+     DuckDBV2TableFunctionHandle
+     -- ^ __C declaration:__ @function@
+  -> DuckDBV2TableFunctionInitGlobalCallbackFn
+     -- ^ __C declaration:__ @callback@
+  -> BG.Ptr DuckDBV2ErrorInfoHandle
+     -- ^ __C declaration:__ @err@
+  -> IO DuckDBV2Error
+c_duckdb_v2_table_function_set_init_global_callback =
+  hs_bindgen_99d851dc0c2a3c67
+
+-- __unique:__ @Database_DuckDB_FFI_V2_Database.DuckDB.FFI.V2_Safe_duckdb_v2_table_function_set_init_local_callback@
+foreign import ccall safe "hs_bindgen_18399d2bc5d0a7cc" hs_bindgen_18399d2bc5d0a7cc_base ::
+     BG.Ptr BG.Void
+  -> BG.FunPtr BG.Void
+  -> BG.Ptr BG.Void
+  -> IO BG.CUInt
+
+-- __unique:__ @Database_DuckDB_FFI_V2_Database.DuckDB.FFI.V2_Safe_duckdb_v2_table_function_set_init_local_callback@
+hs_bindgen_18399d2bc5d0a7cc ::
+     DuckDBV2TableFunctionHandle
+  -> DuckDBV2TableFunctionInitLocalCallbackFn
+  -> BG.Ptr DuckDBV2ErrorInfoHandle
+  -> IO DuckDBV2Error
+hs_bindgen_18399d2bc5d0a7cc =
+  \x0 ->
+    \x1 ->
+      \x2 ->
+        fmap BG.fromFFIType (hs_bindgen_18399d2bc5d0a7cc_base (BG.toFFIType x0) (BG.toFFIType x1) (BG.toFFIType x2))
+
+{-| __C declaration:__ @duckdb_v2_table_function_set_init_local_callback@
+
+    __defined at:__ @duckdb_v2.h 12758:30@
+
+    __exported by:__ @duckdb_v2.h@
+-}
+c_duckdb_v2_table_function_set_init_local_callback ::
+     DuckDBV2TableFunctionHandle
+     -- ^ __C declaration:__ @function@
+  -> DuckDBV2TableFunctionInitLocalCallbackFn
+     -- ^ __C declaration:__ @callback@
+  -> BG.Ptr DuckDBV2ErrorInfoHandle
+     -- ^ __C declaration:__ @err@
+  -> IO DuckDBV2Error
+c_duckdb_v2_table_function_set_init_local_callback =
+  hs_bindgen_18399d2bc5d0a7cc
+
+-- __unique:__ @Database_DuckDB_FFI_V2_Database.DuckDB.FFI.V2_Safe_duckdb_v2_table_function_set_exec_callback@
+foreign import ccall safe "hs_bindgen_17879214c12b18e7" hs_bindgen_17879214c12b18e7_base ::
+     BG.Ptr BG.Void
+  -> BG.FunPtr BG.Void
+  -> BG.Ptr BG.Void
+  -> IO BG.CUInt
+
+-- __unique:__ @Database_DuckDB_FFI_V2_Database.DuckDB.FFI.V2_Safe_duckdb_v2_table_function_set_exec_callback@
+hs_bindgen_17879214c12b18e7 ::
+     DuckDBV2TableFunctionHandle
+  -> DuckDBV2TableFunctionExecCallbackFn
+  -> BG.Ptr DuckDBV2ErrorInfoHandle
+  -> IO DuckDBV2Error
+hs_bindgen_17879214c12b18e7 =
+  \x0 ->
+    \x1 ->
+      \x2 ->
+        fmap BG.fromFFIType (hs_bindgen_17879214c12b18e7_base (BG.toFFIType x0) (BG.toFFIType x1) (BG.toFFIType x2))
+
+{-| __C declaration:__ @duckdb_v2_table_function_set_exec_callback@
+
+    __defined at:__ @duckdb_v2.h 12780:30@
+
+    __exported by:__ @duckdb_v2.h@
+-}
+c_duckdb_v2_table_function_set_exec_callback ::
+     DuckDBV2TableFunctionHandle
+     -- ^ __C declaration:__ @function@
+  -> DuckDBV2TableFunctionExecCallbackFn
+     -- ^ __C declaration:__ @callback@
+  -> BG.Ptr DuckDBV2ErrorInfoHandle
+     -- ^ __C declaration:__ @err@
+  -> IO DuckDBV2Error
+c_duckdb_v2_table_function_set_exec_callback =
+  hs_bindgen_17879214c12b18e7
+
+-- __unique:__ @Database_DuckDB_FFI_V2_Database.DuckDB.FFI.V2_Safe_duckdb_v2_table_function_set_progress_callback@
+foreign import ccall safe "hs_bindgen_e3d89062a6f3b691" hs_bindgen_e3d89062a6f3b691_base ::
+     BG.Ptr BG.Void
+  -> BG.FunPtr BG.Void
+  -> BG.Ptr BG.Void
+  -> IO BG.CUInt
+
+-- __unique:__ @Database_DuckDB_FFI_V2_Database.DuckDB.FFI.V2_Safe_duckdb_v2_table_function_set_progress_callback@
+hs_bindgen_e3d89062a6f3b691 ::
+     DuckDBV2TableFunctionHandle
+  -> DuckDBV2TableFunctionProgressCallbackFn
+  -> BG.Ptr DuckDBV2ErrorInfoHandle
+  -> IO DuckDBV2Error
+hs_bindgen_e3d89062a6f3b691 =
+  \x0 ->
+    \x1 ->
+      \x2 ->
+        fmap BG.fromFFIType (hs_bindgen_e3d89062a6f3b691_base (BG.toFFIType x0) (BG.toFFIType x1) (BG.toFFIType x2))
+
+{-| __C declaration:__ @duckdb_v2_table_function_set_progress_callback@
+
+    __defined at:__ @duckdb_v2.h 12802:30@
+
+    __exported by:__ @duckdb_v2.h@
+-}
+c_duckdb_v2_table_function_set_progress_callback ::
+     DuckDBV2TableFunctionHandle
+     -- ^ __C declaration:__ @function@
+  -> DuckDBV2TableFunctionProgressCallbackFn
+     -- ^ __C declaration:__ @callback@
+  -> BG.Ptr DuckDBV2ErrorInfoHandle
+     -- ^ __C declaration:__ @err@
+  -> IO DuckDBV2Error
+c_duckdb_v2_table_function_set_progress_callback =
+  hs_bindgen_e3d89062a6f3b691
+
+-- __unique:__ @Database_DuckDB_FFI_V2_Database.DuckDB.FFI.V2_Safe_duckdb_v2_table_function_set_projection_pushdown@
+foreign import ccall safe "hs_bindgen_850375d29beab802" hs_bindgen_850375d29beab802_base ::
+     BG.Ptr BG.Void
+  -> BG.CBool
+  -> BG.Ptr BG.Void
+  -> IO BG.CUInt
+
+-- __unique:__ @Database_DuckDB_FFI_V2_Database.DuckDB.FFI.V2_Safe_duckdb_v2_table_function_set_projection_pushdown@
+hs_bindgen_850375d29beab802 ::
+     DuckDBV2TableFunctionHandle
+  -> BG.CBool
+  -> BG.Ptr DuckDBV2ErrorInfoHandle
+  -> IO DuckDBV2Error
+hs_bindgen_850375d29beab802 =
+  \x0 ->
+    \x1 ->
+      \x2 ->
+        fmap BG.fromFFIType (hs_bindgen_850375d29beab802_base (BG.toFFIType x0) (BG.toFFIType x1) (BG.toFFIType x2))
+
+{-| __C declaration:__ @duckdb_v2_table_function_set_projection_pushdown@
+
+    __defined at:__ @duckdb_v2.h 12826:30@
+
+    __exported by:__ @duckdb_v2.h@
+-}
+c_duckdb_v2_table_function_set_projection_pushdown ::
+     DuckDBV2TableFunctionHandle
+     -- ^ __C declaration:__ @function@
+  -> BG.CBool
+     -- ^ __C declaration:__ @enable@
+  -> BG.Ptr DuckDBV2ErrorInfoHandle
+     -- ^ __C declaration:__ @err@
+  -> IO DuckDBV2Error
+c_duckdb_v2_table_function_set_projection_pushdown =
+  hs_bindgen_850375d29beab802
+
+-- __unique:__ @Database_DuckDB_FFI_V2_Database.DuckDB.FFI.V2_Safe_duckdb_v2_table_function_set_filter_pushdown_callback@
+foreign import ccall safe "hs_bindgen_dd56f9fb845d8b62" hs_bindgen_dd56f9fb845d8b62_base ::
+     BG.Ptr BG.Void
+  -> BG.FunPtr BG.Void
+  -> BG.Ptr BG.Void
+  -> IO BG.CUInt
+
+-- __unique:__ @Database_DuckDB_FFI_V2_Database.DuckDB.FFI.V2_Safe_duckdb_v2_table_function_set_filter_pushdown_callback@
+hs_bindgen_dd56f9fb845d8b62 ::
+     DuckDBV2TableFunctionHandle
+  -> DuckDBV2TableFunctionFilterPushdownCallbackFn
+  -> BG.Ptr DuckDBV2ErrorInfoHandle
+  -> IO DuckDBV2Error
+hs_bindgen_dd56f9fb845d8b62 =
+  \x0 ->
+    \x1 ->
+      \x2 ->
+        fmap BG.fromFFIType (hs_bindgen_dd56f9fb845d8b62_base (BG.toFFIType x0) (BG.toFFIType x1) (BG.toFFIType x2))
+
+{-| __C declaration:__ @duckdb_v2_table_function_set_filter_pushdown_callback@
+
+    __defined at:__ @duckdb_v2.h 12852:30@
+
+    __exported by:__ @duckdb_v2.h@
+-}
+c_duckdb_v2_table_function_set_filter_pushdown_callback ::
+     DuckDBV2TableFunctionHandle
+     -- ^ __C declaration:__ @function@
+  -> DuckDBV2TableFunctionFilterPushdownCallbackFn
+     -- ^ __C declaration:__ @callback@
+  -> BG.Ptr DuckDBV2ErrorInfoHandle
+     -- ^ __C declaration:__ @err@
+  -> IO DuckDBV2Error
+c_duckdb_v2_table_function_set_filter_pushdown_callback =
+  hs_bindgen_dd56f9fb845d8b62
+
+-- __unique:__ @Database_DuckDB_FFI_V2_Database.DuckDB.FFI.V2_Safe_duckdb_v2_table_function_set_partition_data_callback@
+foreign import ccall safe "hs_bindgen_cba5db6a3260b7d8" hs_bindgen_cba5db6a3260b7d8_base ::
+     BG.Ptr BG.Void
+  -> BG.FunPtr BG.Void
+  -> BG.Ptr BG.Void
+  -> IO BG.CUInt
+
+-- __unique:__ @Database_DuckDB_FFI_V2_Database.DuckDB.FFI.V2_Safe_duckdb_v2_table_function_set_partition_data_callback@
+hs_bindgen_cba5db6a3260b7d8 ::
+     DuckDBV2TableFunctionHandle
+  -> DuckDBV2TableFunctionPartitionDataCallbackFn
+  -> BG.Ptr DuckDBV2ErrorInfoHandle
+  -> IO DuckDBV2Error
+hs_bindgen_cba5db6a3260b7d8 =
+  \x0 ->
+    \x1 ->
+      \x2 ->
+        fmap BG.fromFFIType (hs_bindgen_cba5db6a3260b7d8_base (BG.toFFIType x0) (BG.toFFIType x1) (BG.toFFIType x2))
+
+{-| __C declaration:__ @duckdb_v2_table_function_set_partition_data_callback@
+
+    __defined at:__ @duckdb_v2.h 12876:30@
+
+    __exported by:__ @duckdb_v2.h@
+-}
+c_duckdb_v2_table_function_set_partition_data_callback ::
+     DuckDBV2TableFunctionHandle
+     -- ^ __C declaration:__ @function@
+  -> DuckDBV2TableFunctionPartitionDataCallbackFn
+     -- ^ __C declaration:__ @callback@
+  -> BG.Ptr DuckDBV2ErrorInfoHandle
+     -- ^ __C declaration:__ @err@
+  -> IO DuckDBV2Error
+c_duckdb_v2_table_function_set_partition_data_callback =
+  hs_bindgen_cba5db6a3260b7d8
+
+-- __unique:__ @Database_DuckDB_FFI_V2_Database.DuckDB.FFI.V2_Safe_duckdb_v2_table_function_set_partitioning_callback@
+foreign import ccall safe "hs_bindgen_2f2bcf72e3527454" hs_bindgen_2f2bcf72e3527454_base ::
+     BG.Ptr BG.Void
+  -> BG.FunPtr BG.Void
+  -> BG.Ptr BG.Void
+  -> IO BG.CUInt
+
+-- __unique:__ @Database_DuckDB_FFI_V2_Database.DuckDB.FFI.V2_Safe_duckdb_v2_table_function_set_partitioning_callback@
+hs_bindgen_2f2bcf72e3527454 ::
+     DuckDBV2TableFunctionHandle
+  -> DuckDBV2TableFunctionPartitioningCallbackFn
+  -> BG.Ptr DuckDBV2ErrorInfoHandle
+  -> IO DuckDBV2Error
+hs_bindgen_2f2bcf72e3527454 =
+  \x0 ->
+    \x1 ->
+      \x2 ->
+        fmap BG.fromFFIType (hs_bindgen_2f2bcf72e3527454_base (BG.toFFIType x0) (BG.toFFIType x1) (BG.toFFIType x2))
+
+{-| __C declaration:__ @duckdb_v2_table_function_set_partitioning_callback@
+
+    __defined at:__ @duckdb_v2.h 12902:30@
+
+    __exported by:__ @duckdb_v2.h@
+-}
+c_duckdb_v2_table_function_set_partitioning_callback ::
+     DuckDBV2TableFunctionHandle
+     -- ^ __C declaration:__ @function@
+  -> DuckDBV2TableFunctionPartitioningCallbackFn
+     -- ^ __C declaration:__ @callback@
+  -> BG.Ptr DuckDBV2ErrorInfoHandle
+     -- ^ __C declaration:__ @err@
+  -> IO DuckDBV2Error
+c_duckdb_v2_table_function_set_partitioning_callback =
+  hs_bindgen_2f2bcf72e3527454
+
+-- __unique:__ @Database_DuckDB_FFI_V2_Database.DuckDB.FFI.V2_Safe_duckdb_v2_table_function_bind_add_result_column@
+foreign import ccall safe "hs_bindgen_3a2b9acfaf0f193c" hs_bindgen_3a2b9acfaf0f193c_base ::
+     BG.Ptr BG.Void
+  -> BG.Ptr BG.Void
+  -> BG.Ptr BG.Void
+  -> BG.Ptr BG.Void
+  -> IO BG.CUInt
+
+-- __unique:__ @Database_DuckDB_FFI_V2_Database.DuckDB.FFI.V2_Safe_duckdb_v2_table_function_bind_add_result_column@
+hs_bindgen_3a2b9acfaf0f193c ::
+     DuckDBV2TableFunctionBindInfoHandle
+  -> PtrConst.PtrConst DuckDBV2IdentifierT
+  -> DuckDBV2LogicalTypeHandle
+  -> BG.Ptr DuckDBV2ErrorInfoHandle
+  -> IO DuckDBV2Error
+hs_bindgen_3a2b9acfaf0f193c =
+  \x0 ->
+    \x1 ->
+      \x2 ->
+        \x3 ->
+          fmap BG.fromFFIType (hs_bindgen_3a2b9acfaf0f193c_base (BG.toFFIType x0) (BG.toFFIType x1) (BG.toFFIType x2) (BG.toFFIType x3))
+
+{-| __C declaration:__ @duckdb_v2_table_function_bind_add_result_column@
+
+    __defined at:__ @duckdb_v2.h 12926:30@
+
+    __exported by:__ @duckdb_v2.h@
+-}
+c_duckdb_v2_table_function_bind_add_result_column ::
+     DuckDBV2TableFunctionBindInfoHandle
+     -- ^ __C declaration:__ @info@
+  -> PtrConst.PtrConst DuckDBV2IdentifierT
+     -- ^ __C declaration:__ @name@
+  -> DuckDBV2LogicalTypeHandle
+     -- ^ __C declaration:__ @type@
+  -> BG.Ptr DuckDBV2ErrorInfoHandle
+     -- ^ __C declaration:__ @err@
+  -> IO DuckDBV2Error
+c_duckdb_v2_table_function_bind_add_result_column =
+  hs_bindgen_3a2b9acfaf0f193c
+
+-- __unique:__ @Database_DuckDB_FFI_V2_Database.DuckDB.FFI.V2_Safe_duckdb_v2_table_function_bind_set_cardinality@
+foreign import ccall safe "hs_bindgen_1d02e031e9380cf7" hs_bindgen_1d02e031e9380cf7_base ::
+     BG.Ptr BG.Void
+  -> HsBindgen.Runtime.LibC.Word64
+  -> BG.CBool
+  -> BG.Ptr BG.Void
+  -> IO BG.CUInt
+
+-- __unique:__ @Database_DuckDB_FFI_V2_Database.DuckDB.FFI.V2_Safe_duckdb_v2_table_function_bind_set_cardinality@
+hs_bindgen_1d02e031e9380cf7 ::
+     DuckDBV2TableFunctionBindInfoHandle
+  -> DuckDBIdx
+  -> BG.CBool
+  -> BG.Ptr DuckDBV2ErrorInfoHandle
+  -> IO DuckDBV2Error
+hs_bindgen_1d02e031e9380cf7 =
+  \x0 ->
+    \x1 ->
+      \x2 ->
+        \x3 ->
+          fmap BG.fromFFIType (hs_bindgen_1d02e031e9380cf7_base (BG.toFFIType x0) (BG.toFFIType x1) (BG.toFFIType x2) (BG.toFFIType x3))
+
+{-| __C declaration:__ @duckdb_v2_table_function_bind_set_cardinality@
+
+    __defined at:__ @duckdb_v2.h 12948:30@
+
+    __exported by:__ @duckdb_v2.h@
+-}
+c_duckdb_v2_table_function_bind_set_cardinality ::
+     DuckDBV2TableFunctionBindInfoHandle
+     -- ^ __C declaration:__ @info@
+  -> DuckDBIdx
+     -- ^ __C declaration:__ @cardinality@
+  -> BG.CBool
+     -- ^ __C declaration:__ @is_exact@
+  -> BG.Ptr DuckDBV2ErrorInfoHandle
+     -- ^ __C declaration:__ @err@
+  -> IO DuckDBV2Error
+c_duckdb_v2_table_function_bind_set_cardinality =
+  hs_bindgen_1d02e031e9380cf7
+
+-- __unique:__ @Database_DuckDB_FFI_V2_Database.DuckDB.FFI.V2_Safe_duckdb_v2_table_function_bind_set_order_preservation@
+foreign import ccall safe "hs_bindgen_99db736f7b370f72" hs_bindgen_99db736f7b370f72_base ::
+     BG.Ptr BG.Void
+  -> BG.CUInt
+  -> BG.Ptr BG.Void
+  -> IO BG.CUInt
+
+-- __unique:__ @Database_DuckDB_FFI_V2_Database.DuckDB.FFI.V2_Safe_duckdb_v2_table_function_bind_set_order_preservation@
+hs_bindgen_99db736f7b370f72 ::
+     DuckDBV2TableFunctionBindInfoHandle
+  -> DuckDBV2OrderPreservation
+  -> BG.Ptr DuckDBV2ErrorInfoHandle
+  -> IO DuckDBV2Error
+hs_bindgen_99db736f7b370f72 =
+  \x0 ->
+    \x1 ->
+      \x2 ->
+        fmap BG.fromFFIType (hs_bindgen_99db736f7b370f72_base (BG.toFFIType x0) (BG.toFFIType x1) (BG.toFFIType x2))
+
+{-| __C declaration:__ @duckdb_v2_table_function_bind_set_order_preservation@
+
+    __defined at:__ @duckdb_v2.h 12972:30@
+
+    __exported by:__ @duckdb_v2.h@
+-}
+c_duckdb_v2_table_function_bind_set_order_preservation ::
+     DuckDBV2TableFunctionBindInfoHandle
+     -- ^ __C declaration:__ @info@
+  -> DuckDBV2OrderPreservation
+     -- ^ __C declaration:__ @order@
+  -> BG.Ptr DuckDBV2ErrorInfoHandle
+     -- ^ __C declaration:__ @err@
+  -> IO DuckDBV2Error
+c_duckdb_v2_table_function_bind_set_order_preservation =
+  hs_bindgen_99db736f7b370f72
+
+-- __unique:__ @Database_DuckDB_FFI_V2_Database.DuckDB.FFI.V2_Safe_duckdb_v2_table_function_init_global_get_user_data@
+foreign import ccall safe "hs_bindgen_bcb42d983502d204" hs_bindgen_bcb42d983502d204_base ::
+     BG.Ptr BG.Void
+  -> BG.Ptr BG.Void
+  -> BG.Ptr BG.Void
+  -> IO BG.CUInt
+
+-- __unique:__ @Database_DuckDB_FFI_V2_Database.DuckDB.FFI.V2_Safe_duckdb_v2_table_function_init_global_get_user_data@
+hs_bindgen_bcb42d983502d204 ::
+     DuckDBV2TableFunctionInitGlobalInfoHandle
+  -> BG.Ptr (BG.Ptr BG.Void)
+  -> BG.Ptr DuckDBV2ErrorInfoHandle
+  -> IO DuckDBV2Error
+hs_bindgen_bcb42d983502d204 =
+  \x0 ->
+    \x1 ->
+      \x2 ->
+        fmap BG.fromFFIType (hs_bindgen_bcb42d983502d204_base (BG.toFFIType x0) (BG.toFFIType x1) (BG.toFFIType x2))
+
+{-| __C declaration:__ @duckdb_v2_table_function_init_global_get_user_data@
+
+    __defined at:__ @duckdb_v2.h 12990:30@
+
+    __exported by:__ @duckdb_v2.h@
+-}
+c_duckdb_v2_table_function_init_global_get_user_data ::
+     DuckDBV2TableFunctionInitGlobalInfoHandle
+     -- ^ __C declaration:__ @info@
+  -> BG.Ptr (BG.Ptr BG.Void)
+     -- ^ __C declaration:__ @data@
+  -> BG.Ptr DuckDBV2ErrorInfoHandle
+     -- ^ __C declaration:__ @err@
+  -> IO DuckDBV2Error
+c_duckdb_v2_table_function_init_global_get_user_data =
+  hs_bindgen_bcb42d983502d204
+
+-- __unique:__ @Database_DuckDB_FFI_V2_Database.DuckDB.FFI.V2_Safe_duckdb_v2_table_function_init_global_get_bind_data@
+foreign import ccall safe "hs_bindgen_594bd43792a96384" hs_bindgen_594bd43792a96384_base ::
+     BG.Ptr BG.Void
+  -> BG.Ptr BG.Void
+  -> BG.Ptr BG.Void
+  -> IO BG.CUInt
+
+-- __unique:__ @Database_DuckDB_FFI_V2_Database.DuckDB.FFI.V2_Safe_duckdb_v2_table_function_init_global_get_bind_data@
+hs_bindgen_594bd43792a96384 ::
+     DuckDBV2TableFunctionInitGlobalInfoHandle
+  -> BG.Ptr (BG.Ptr BG.Void)
+  -> BG.Ptr DuckDBV2ErrorInfoHandle
+  -> IO DuckDBV2Error
+hs_bindgen_594bd43792a96384 =
+  \x0 ->
+    \x1 ->
+      \x2 ->
+        fmap BG.fromFFIType (hs_bindgen_594bd43792a96384_base (BG.toFFIType x0) (BG.toFFIType x1) (BG.toFFIType x2))
+
+{-| __C declaration:__ @duckdb_v2_table_function_init_global_get_bind_data@
+
+    __defined at:__ @duckdb_v2.h 13007:30@
+
+    __exported by:__ @duckdb_v2.h@
+-}
+c_duckdb_v2_table_function_init_global_get_bind_data ::
+     DuckDBV2TableFunctionInitGlobalInfoHandle
+     -- ^ __C declaration:__ @info@
+  -> BG.Ptr (BG.Ptr BG.Void)
+     -- ^ __C declaration:__ @data@
+  -> BG.Ptr DuckDBV2ErrorInfoHandle
+     -- ^ __C declaration:__ @err@
+  -> IO DuckDBV2Error
+c_duckdb_v2_table_function_init_global_get_bind_data =
+  hs_bindgen_594bd43792a96384
+
+-- __unique:__ @Database_DuckDB_FFI_V2_Database.DuckDB.FFI.V2_Safe_duckdb_v2_table_function_init_global_set_global_state@
+foreign import ccall safe "hs_bindgen_15387cf426dc90ab" hs_bindgen_15387cf426dc90ab_base ::
+     BG.Ptr BG.Void
+  -> BG.Ptr BG.Void
+  -> BG.Ptr BG.Void
+  -> IO BG.CUInt
+
+-- __unique:__ @Database_DuckDB_FFI_V2_Database.DuckDB.FFI.V2_Safe_duckdb_v2_table_function_init_global_set_global_state@
+hs_bindgen_15387cf426dc90ab ::
+     DuckDBV2TableFunctionInitGlobalInfoHandle
+  -> BG.Ptr DuckDBV2Opaque
+  -> BG.Ptr DuckDBV2ErrorInfoHandle
+  -> IO DuckDBV2Error
+hs_bindgen_15387cf426dc90ab =
+  \x0 ->
+    \x1 ->
+      \x2 ->
+        fmap BG.fromFFIType (hs_bindgen_15387cf426dc90ab_base (BG.toFFIType x0) (BG.toFFIType x1) (BG.toFFIType x2))
+
+{-| __C declaration:__ @duckdb_v2_table_function_init_global_set_global_state@
+
+    __defined at:__ @duckdb_v2.h 13028:30@
+
+    __exported by:__ @duckdb_v2.h@
+-}
+c_duckdb_v2_table_function_init_global_set_global_state ::
+     DuckDBV2TableFunctionInitGlobalInfoHandle
+     -- ^ __C declaration:__ @info@
+  -> BG.Ptr DuckDBV2Opaque
+     -- ^ __C declaration:__ @data@
+  -> BG.Ptr DuckDBV2ErrorInfoHandle
+     -- ^ __C declaration:__ @err@
+  -> IO DuckDBV2Error
+c_duckdb_v2_table_function_init_global_set_global_state =
+  hs_bindgen_15387cf426dc90ab
+
+-- __unique:__ @Database_DuckDB_FFI_V2_Database.DuckDB.FFI.V2_Safe_duckdb_v2_table_function_init_global_set_max_threads@
+foreign import ccall safe "hs_bindgen_1de9a55568a3b83c" hs_bindgen_1de9a55568a3b83c_base ::
+     BG.Ptr BG.Void
+  -> HsBindgen.Runtime.LibC.Word64
+  -> BG.Ptr BG.Void
+  -> IO BG.CUInt
+
+-- __unique:__ @Database_DuckDB_FFI_V2_Database.DuckDB.FFI.V2_Safe_duckdb_v2_table_function_init_global_set_max_threads@
+hs_bindgen_1de9a55568a3b83c ::
+     DuckDBV2TableFunctionInitGlobalInfoHandle
+  -> DuckDBIdx
+  -> BG.Ptr DuckDBV2ErrorInfoHandle
+  -> IO DuckDBV2Error
+hs_bindgen_1de9a55568a3b83c =
+  \x0 ->
+    \x1 ->
+      \x2 ->
+        fmap BG.fromFFIType (hs_bindgen_1de9a55568a3b83c_base (BG.toFFIType x0) (BG.toFFIType x1) (BG.toFFIType x2))
+
+{-| __C declaration:__ @duckdb_v2_table_function_init_global_set_max_threads@
+
+    __defined at:__ @duckdb_v2.h 13048:30@
+
+    __exported by:__ @duckdb_v2.h@
+-}
+c_duckdb_v2_table_function_init_global_set_max_threads ::
+     DuckDBV2TableFunctionInitGlobalInfoHandle
+     -- ^ __C declaration:__ @info@
+  -> DuckDBIdx
+     -- ^ __C declaration:__ @max_threads@
+  -> BG.Ptr DuckDBV2ErrorInfoHandle
+     -- ^ __C declaration:__ @err@
+  -> IO DuckDBV2Error
+c_duckdb_v2_table_function_init_global_set_max_threads =
+  hs_bindgen_1de9a55568a3b83c
+
+-- __unique:__ @Database_DuckDB_FFI_V2_Database.DuckDB.FFI.V2_Safe_duckdb_v2_table_function_init_global_get_column_count@
+foreign import ccall safe "hs_bindgen_eef33e332f588b1c" hs_bindgen_eef33e332f588b1c_base ::
+     BG.Ptr BG.Void
+  -> BG.Ptr BG.Void
+  -> BG.Ptr BG.Void
+  -> IO BG.CUInt
+
+-- __unique:__ @Database_DuckDB_FFI_V2_Database.DuckDB.FFI.V2_Safe_duckdb_v2_table_function_init_global_get_column_count@
+hs_bindgen_eef33e332f588b1c ::
+     DuckDBV2TableFunctionInitGlobalInfoHandle
+  -> BG.Ptr DuckDBIdx
+  -> BG.Ptr DuckDBV2ErrorInfoHandle
+  -> IO DuckDBV2Error
+hs_bindgen_eef33e332f588b1c =
+  \x0 ->
+    \x1 ->
+      \x2 ->
+        fmap BG.fromFFIType (hs_bindgen_eef33e332f588b1c_base (BG.toFFIType x0) (BG.toFFIType x1) (BG.toFFIType x2))
+
+{-| __C declaration:__ @duckdb_v2_table_function_init_global_get_column_count@
+
+    __defined at:__ @duckdb_v2.h 13070:30@
+
+    __exported by:__ @duckdb_v2.h@
+-}
+c_duckdb_v2_table_function_init_global_get_column_count ::
+     DuckDBV2TableFunctionInitGlobalInfoHandle
+     -- ^ __C declaration:__ @info@
+  -> BG.Ptr DuckDBIdx
+     -- ^ __C declaration:__ @count@
+  -> BG.Ptr DuckDBV2ErrorInfoHandle
+     -- ^ __C declaration:__ @err@
+  -> IO DuckDBV2Error
+c_duckdb_v2_table_function_init_global_get_column_count =
+  hs_bindgen_eef33e332f588b1c
+
+-- __unique:__ @Database_DuckDB_FFI_V2_Database.DuckDB.FFI.V2_Safe_duckdb_v2_table_function_init_global_get_column_index@
+foreign import ccall safe "hs_bindgen_f0194d9095a9ee5e" hs_bindgen_f0194d9095a9ee5e_base ::
+     BG.Ptr BG.Void
+  -> HsBindgen.Runtime.LibC.Word64
+  -> BG.Ptr BG.Void
+  -> BG.Ptr BG.Void
+  -> IO BG.CUInt
+
+-- __unique:__ @Database_DuckDB_FFI_V2_Database.DuckDB.FFI.V2_Safe_duckdb_v2_table_function_init_global_get_column_index@
+hs_bindgen_f0194d9095a9ee5e ::
+     DuckDBV2TableFunctionInitGlobalInfoHandle
+  -> DuckDBIdx
+  -> BG.Ptr DuckDBIdx
+  -> BG.Ptr DuckDBV2ErrorInfoHandle
+  -> IO DuckDBV2Error
+hs_bindgen_f0194d9095a9ee5e =
+  \x0 ->
+    \x1 ->
+      \x2 ->
+        \x3 ->
+          fmap BG.fromFFIType (hs_bindgen_f0194d9095a9ee5e_base (BG.toFFIType x0) (BG.toFFIType x1) (BG.toFFIType x2) (BG.toFFIType x3))
+
+{-| __C declaration:__ @duckdb_v2_table_function_init_global_get_column_index@
+
+    __defined at:__ @duckdb_v2.h 13092:30@
+
+    __exported by:__ @duckdb_v2.h@
+-}
+c_duckdb_v2_table_function_init_global_get_column_index ::
+     DuckDBV2TableFunctionInitGlobalInfoHandle
+     -- ^ __C declaration:__ @info@
+  -> DuckDBIdx
+     -- ^ __C declaration:__ @index@
+  -> BG.Ptr DuckDBIdx
+     -- ^ __C declaration:__ @column_index@
+  -> BG.Ptr DuckDBV2ErrorInfoHandle
+     -- ^ __C declaration:__ @err@
+  -> IO DuckDBV2Error
+c_duckdb_v2_table_function_init_global_get_column_index =
+  hs_bindgen_f0194d9095a9ee5e
+
+-- __unique:__ @Database_DuckDB_FFI_V2_Database.DuckDB.FFI.V2_Safe_duckdb_v2_table_function_init_local_get_user_data@
+foreign import ccall safe "hs_bindgen_4886b8732bf62461" hs_bindgen_4886b8732bf62461_base ::
+     BG.Ptr BG.Void
+  -> BG.Ptr BG.Void
+  -> BG.Ptr BG.Void
+  -> IO BG.CUInt
+
+-- __unique:__ @Database_DuckDB_FFI_V2_Database.DuckDB.FFI.V2_Safe_duckdb_v2_table_function_init_local_get_user_data@
+hs_bindgen_4886b8732bf62461 ::
+     DuckDBV2TableFunctionInitLocalInfoHandle
+  -> BG.Ptr (BG.Ptr BG.Void)
+  -> BG.Ptr DuckDBV2ErrorInfoHandle
+  -> IO DuckDBV2Error
+hs_bindgen_4886b8732bf62461 =
+  \x0 ->
+    \x1 ->
+      \x2 ->
+        fmap BG.fromFFIType (hs_bindgen_4886b8732bf62461_base (BG.toFFIType x0) (BG.toFFIType x1) (BG.toFFIType x2))
+
+{-| __C declaration:__ @duckdb_v2_table_function_init_local_get_user_data@
+
+    __defined at:__ @duckdb_v2.h 13110:30@
+
+    __exported by:__ @duckdb_v2.h@
+-}
+c_duckdb_v2_table_function_init_local_get_user_data ::
+     DuckDBV2TableFunctionInitLocalInfoHandle
+     -- ^ __C declaration:__ @info@
+  -> BG.Ptr (BG.Ptr BG.Void)
+     -- ^ __C declaration:__ @data@
+  -> BG.Ptr DuckDBV2ErrorInfoHandle
+     -- ^ __C declaration:__ @err@
+  -> IO DuckDBV2Error
+c_duckdb_v2_table_function_init_local_get_user_data =
+  hs_bindgen_4886b8732bf62461
+
+-- __unique:__ @Database_DuckDB_FFI_V2_Database.DuckDB.FFI.V2_Safe_duckdb_v2_table_function_init_local_get_bind_data@
+foreign import ccall safe "hs_bindgen_347565870e1787bc" hs_bindgen_347565870e1787bc_base ::
+     BG.Ptr BG.Void
+  -> BG.Ptr BG.Void
+  -> BG.Ptr BG.Void
+  -> IO BG.CUInt
+
+-- __unique:__ @Database_DuckDB_FFI_V2_Database.DuckDB.FFI.V2_Safe_duckdb_v2_table_function_init_local_get_bind_data@
+hs_bindgen_347565870e1787bc ::
+     DuckDBV2TableFunctionInitLocalInfoHandle
+  -> BG.Ptr (BG.Ptr BG.Void)
+  -> BG.Ptr DuckDBV2ErrorInfoHandle
+  -> IO DuckDBV2Error
+hs_bindgen_347565870e1787bc =
+  \x0 ->
+    \x1 ->
+      \x2 ->
+        fmap BG.fromFFIType (hs_bindgen_347565870e1787bc_base (BG.toFFIType x0) (BG.toFFIType x1) (BG.toFFIType x2))
+
+{-| __C declaration:__ @duckdb_v2_table_function_init_local_get_bind_data@
+
+    __defined at:__ @duckdb_v2.h 13127:30@
+
+    __exported by:__ @duckdb_v2.h@
+-}
+c_duckdb_v2_table_function_init_local_get_bind_data ::
+     DuckDBV2TableFunctionInitLocalInfoHandle
+     -- ^ __C declaration:__ @info@
+  -> BG.Ptr (BG.Ptr BG.Void)
+     -- ^ __C declaration:__ @data@
+  -> BG.Ptr DuckDBV2ErrorInfoHandle
+     -- ^ __C declaration:__ @err@
+  -> IO DuckDBV2Error
+c_duckdb_v2_table_function_init_local_get_bind_data =
+  hs_bindgen_347565870e1787bc
+
+-- __unique:__ @Database_DuckDB_FFI_V2_Database.DuckDB.FFI.V2_Safe_duckdb_v2_table_function_init_local_get_global_state@
+foreign import ccall safe "hs_bindgen_0113c71cd8eacb6f" hs_bindgen_0113c71cd8eacb6f_base ::
+     BG.Ptr BG.Void
+  -> BG.Ptr BG.Void
+  -> BG.Ptr BG.Void
+  -> IO BG.CUInt
+
+-- __unique:__ @Database_DuckDB_FFI_V2_Database.DuckDB.FFI.V2_Safe_duckdb_v2_table_function_init_local_get_global_state@
+hs_bindgen_0113c71cd8eacb6f ::
+     DuckDBV2TableFunctionInitLocalInfoHandle
+  -> BG.Ptr (BG.Ptr BG.Void)
+  -> BG.Ptr DuckDBV2ErrorInfoHandle
+  -> IO DuckDBV2Error
+hs_bindgen_0113c71cd8eacb6f =
+  \x0 ->
+    \x1 ->
+      \x2 ->
+        fmap BG.fromFFIType (hs_bindgen_0113c71cd8eacb6f_base (BG.toFFIType x0) (BG.toFFIType x1) (BG.toFFIType x2))
+
+{-| __C declaration:__ @duckdb_v2_table_function_init_local_get_global_state@
+
+    __defined at:__ @duckdb_v2.h 13146:30@
+
+    __exported by:__ @duckdb_v2.h@
+-}
+c_duckdb_v2_table_function_init_local_get_global_state ::
+     DuckDBV2TableFunctionInitLocalInfoHandle
+     -- ^ __C declaration:__ @info@
+  -> BG.Ptr (BG.Ptr BG.Void)
+     -- ^ __C declaration:__ @data@
+  -> BG.Ptr DuckDBV2ErrorInfoHandle
+     -- ^ __C declaration:__ @err@
+  -> IO DuckDBV2Error
+c_duckdb_v2_table_function_init_local_get_global_state =
+  hs_bindgen_0113c71cd8eacb6f
+
+-- __unique:__ @Database_DuckDB_FFI_V2_Database.DuckDB.FFI.V2_Safe_duckdb_v2_table_function_init_local_set_local_state@
+foreign import ccall safe "hs_bindgen_f6ae35e7d61cb905" hs_bindgen_f6ae35e7d61cb905_base ::
+     BG.Ptr BG.Void
+  -> BG.Ptr BG.Void
+  -> BG.Ptr BG.Void
+  -> IO BG.CUInt
+
+-- __unique:__ @Database_DuckDB_FFI_V2_Database.DuckDB.FFI.V2_Safe_duckdb_v2_table_function_init_local_set_local_state@
+hs_bindgen_f6ae35e7d61cb905 ::
+     DuckDBV2TableFunctionInitLocalInfoHandle
+  -> BG.Ptr DuckDBV2Opaque
+  -> BG.Ptr DuckDBV2ErrorInfoHandle
+  -> IO DuckDBV2Error
+hs_bindgen_f6ae35e7d61cb905 =
+  \x0 ->
+    \x1 ->
+      \x2 ->
+        fmap BG.fromFFIType (hs_bindgen_f6ae35e7d61cb905_base (BG.toFFIType x0) (BG.toFFIType x1) (BG.toFFIType x2))
+
+{-| __C declaration:__ @duckdb_v2_table_function_init_local_set_local_state@
+
+    __defined at:__ @duckdb_v2.h 13168:30@
+
+    __exported by:__ @duckdb_v2.h@
+-}
+c_duckdb_v2_table_function_init_local_set_local_state ::
+     DuckDBV2TableFunctionInitLocalInfoHandle
+     -- ^ __C declaration:__ @info@
+  -> BG.Ptr DuckDBV2Opaque
+     -- ^ __C declaration:__ @data@
+  -> BG.Ptr DuckDBV2ErrorInfoHandle
+     -- ^ __C declaration:__ @err@
+  -> IO DuckDBV2Error
+c_duckdb_v2_table_function_init_local_set_local_state =
+  hs_bindgen_f6ae35e7d61cb905
+
+-- __unique:__ @Database_DuckDB_FFI_V2_Database.DuckDB.FFI.V2_Safe_duckdb_v2_table_function_init_local_get_column_count@
+foreign import ccall safe "hs_bindgen_f40572be1a129973" hs_bindgen_f40572be1a129973_base ::
+     BG.Ptr BG.Void
+  -> BG.Ptr BG.Void
+  -> BG.Ptr BG.Void
+  -> IO BG.CUInt
+
+-- __unique:__ @Database_DuckDB_FFI_V2_Database.DuckDB.FFI.V2_Safe_duckdb_v2_table_function_init_local_get_column_count@
+hs_bindgen_f40572be1a129973 ::
+     DuckDBV2TableFunctionInitLocalInfoHandle
+  -> BG.Ptr DuckDBIdx
+  -> BG.Ptr DuckDBV2ErrorInfoHandle
+  -> IO DuckDBV2Error
+hs_bindgen_f40572be1a129973 =
+  \x0 ->
+    \x1 ->
+      \x2 ->
+        fmap BG.fromFFIType (hs_bindgen_f40572be1a129973_base (BG.toFFIType x0) (BG.toFFIType x1) (BG.toFFIType x2))
+
+{-| __C declaration:__ @duckdb_v2_table_function_init_local_get_column_count@
+
+    __defined at:__ @duckdb_v2.h 13190:30@
+
+    __exported by:__ @duckdb_v2.h@
+-}
+c_duckdb_v2_table_function_init_local_get_column_count ::
+     DuckDBV2TableFunctionInitLocalInfoHandle
+     -- ^ __C declaration:__ @info@
+  -> BG.Ptr DuckDBIdx
+     -- ^ __C declaration:__ @count@
+  -> BG.Ptr DuckDBV2ErrorInfoHandle
+     -- ^ __C declaration:__ @err@
+  -> IO DuckDBV2Error
+c_duckdb_v2_table_function_init_local_get_column_count =
+  hs_bindgen_f40572be1a129973
+
+-- __unique:__ @Database_DuckDB_FFI_V2_Database.DuckDB.FFI.V2_Safe_duckdb_v2_table_function_init_local_get_column_index@
+foreign import ccall safe "hs_bindgen_726441c2f211fcef" hs_bindgen_726441c2f211fcef_base ::
+     BG.Ptr BG.Void
+  -> HsBindgen.Runtime.LibC.Word64
+  -> BG.Ptr BG.Void
+  -> BG.Ptr BG.Void
+  -> IO BG.CUInt
+
+-- __unique:__ @Database_DuckDB_FFI_V2_Database.DuckDB.FFI.V2_Safe_duckdb_v2_table_function_init_local_get_column_index@
+hs_bindgen_726441c2f211fcef ::
+     DuckDBV2TableFunctionInitLocalInfoHandle
+  -> DuckDBIdx
+  -> BG.Ptr DuckDBIdx
+  -> BG.Ptr DuckDBV2ErrorInfoHandle
+  -> IO DuckDBV2Error
+hs_bindgen_726441c2f211fcef =
+  \x0 ->
+    \x1 ->
+      \x2 ->
+        \x3 ->
+          fmap BG.fromFFIType (hs_bindgen_726441c2f211fcef_base (BG.toFFIType x0) (BG.toFFIType x1) (BG.toFFIType x2) (BG.toFFIType x3))
+
+{-| __C declaration:__ @duckdb_v2_table_function_init_local_get_column_index@
+
+    __defined at:__ @duckdb_v2.h 13213:1@
+
+    __exported by:__ @duckdb_v2.h@
+-}
+c_duckdb_v2_table_function_init_local_get_column_index ::
+     DuckDBV2TableFunctionInitLocalInfoHandle
+     -- ^ __C declaration:__ @info@
+  -> DuckDBIdx
+     -- ^ __C declaration:__ @index@
+  -> BG.Ptr DuckDBIdx
+     -- ^ __C declaration:__ @column_index@
+  -> BG.Ptr DuckDBV2ErrorInfoHandle
+     -- ^ __C declaration:__ @err@
+  -> IO DuckDBV2Error
+c_duckdb_v2_table_function_init_local_get_column_index =
+  hs_bindgen_726441c2f211fcef
+
+-- __unique:__ @Database_DuckDB_FFI_V2_Database.DuckDB.FFI.V2_Safe_duckdb_v2_table_function_exec_get_user_data@
+foreign import ccall safe "hs_bindgen_78a0b090ff8d7af3" hs_bindgen_78a0b090ff8d7af3_base ::
+     BG.Ptr BG.Void
+  -> BG.Ptr BG.Void
+  -> BG.Ptr BG.Void
+  -> IO BG.CUInt
+
+-- __unique:__ @Database_DuckDB_FFI_V2_Database.DuckDB.FFI.V2_Safe_duckdb_v2_table_function_exec_get_user_data@
+hs_bindgen_78a0b090ff8d7af3 ::
+     DuckDBV2TableFunctionExecInfoHandle
+  -> BG.Ptr (BG.Ptr BG.Void)
+  -> BG.Ptr DuckDBV2ErrorInfoHandle
+  -> IO DuckDBV2Error
+hs_bindgen_78a0b090ff8d7af3 =
+  \x0 ->
+    \x1 ->
+      \x2 ->
+        fmap BG.fromFFIType (hs_bindgen_78a0b090ff8d7af3_base (BG.toFFIType x0) (BG.toFFIType x1) (BG.toFFIType x2))
+
+{-| __C declaration:__ @duckdb_v2_table_function_exec_get_user_data@
+
+    __defined at:__ @duckdb_v2.h 13230:30@
+
+    __exported by:__ @duckdb_v2.h@
+-}
+c_duckdb_v2_table_function_exec_get_user_data ::
+     DuckDBV2TableFunctionExecInfoHandle
+     -- ^ __C declaration:__ @info@
+  -> BG.Ptr (BG.Ptr BG.Void)
+     -- ^ __C declaration:__ @data@
+  -> BG.Ptr DuckDBV2ErrorInfoHandle
+     -- ^ __C declaration:__ @err@
+  -> IO DuckDBV2Error
+c_duckdb_v2_table_function_exec_get_user_data =
+  hs_bindgen_78a0b090ff8d7af3
+
+-- __unique:__ @Database_DuckDB_FFI_V2_Database.DuckDB.FFI.V2_Safe_duckdb_v2_table_function_exec_get_bind_data@
+foreign import ccall safe "hs_bindgen_d50ab9edbbc73dbf" hs_bindgen_d50ab9edbbc73dbf_base ::
+     BG.Ptr BG.Void
+  -> BG.Ptr BG.Void
+  -> BG.Ptr BG.Void
+  -> IO BG.CUInt
+
+-- __unique:__ @Database_DuckDB_FFI_V2_Database.DuckDB.FFI.V2_Safe_duckdb_v2_table_function_exec_get_bind_data@
+hs_bindgen_d50ab9edbbc73dbf ::
+     DuckDBV2TableFunctionExecInfoHandle
+  -> BG.Ptr (BG.Ptr BG.Void)
+  -> BG.Ptr DuckDBV2ErrorInfoHandle
+  -> IO DuckDBV2Error
+hs_bindgen_d50ab9edbbc73dbf =
+  \x0 ->
+    \x1 ->
+      \x2 ->
+        fmap BG.fromFFIType (hs_bindgen_d50ab9edbbc73dbf_base (BG.toFFIType x0) (BG.toFFIType x1) (BG.toFFIType x2))
+
+{-| __C declaration:__ @duckdb_v2_table_function_exec_get_bind_data@
+
+    __defined at:__ @duckdb_v2.h 13247:30@
+
+    __exported by:__ @duckdb_v2.h@
+-}
+c_duckdb_v2_table_function_exec_get_bind_data ::
+     DuckDBV2TableFunctionExecInfoHandle
+     -- ^ __C declaration:__ @info@
+  -> BG.Ptr (BG.Ptr BG.Void)
+     -- ^ __C declaration:__ @data@
+  -> BG.Ptr DuckDBV2ErrorInfoHandle
+     -- ^ __C declaration:__ @err@
+  -> IO DuckDBV2Error
+c_duckdb_v2_table_function_exec_get_bind_data =
+  hs_bindgen_d50ab9edbbc73dbf
+
+-- __unique:__ @Database_DuckDB_FFI_V2_Database.DuckDB.FFI.V2_Safe_duckdb_v2_table_function_exec_get_global_state@
+foreign import ccall safe "hs_bindgen_c833d297d2307e8b" hs_bindgen_c833d297d2307e8b_base ::
+     BG.Ptr BG.Void
+  -> BG.Ptr BG.Void
+  -> BG.Ptr BG.Void
+  -> IO BG.CUInt
+
+-- __unique:__ @Database_DuckDB_FFI_V2_Database.DuckDB.FFI.V2_Safe_duckdb_v2_table_function_exec_get_global_state@
+hs_bindgen_c833d297d2307e8b ::
+     DuckDBV2TableFunctionExecInfoHandle
+  -> BG.Ptr (BG.Ptr BG.Void)
+  -> BG.Ptr DuckDBV2ErrorInfoHandle
+  -> IO DuckDBV2Error
+hs_bindgen_c833d297d2307e8b =
+  \x0 ->
+    \x1 ->
+      \x2 ->
+        fmap BG.fromFFIType (hs_bindgen_c833d297d2307e8b_base (BG.toFFIType x0) (BG.toFFIType x1) (BG.toFFIType x2))
+
+{-| __C declaration:__ @duckdb_v2_table_function_exec_get_global_state@
+
+    __defined at:__ @duckdb_v2.h 13266:30@
+
+    __exported by:__ @duckdb_v2.h@
+-}
+c_duckdb_v2_table_function_exec_get_global_state ::
+     DuckDBV2TableFunctionExecInfoHandle
+     -- ^ __C declaration:__ @info@
+  -> BG.Ptr (BG.Ptr BG.Void)
+     -- ^ __C declaration:__ @data@
+  -> BG.Ptr DuckDBV2ErrorInfoHandle
+     -- ^ __C declaration:__ @err@
+  -> IO DuckDBV2Error
+c_duckdb_v2_table_function_exec_get_global_state =
+  hs_bindgen_c833d297d2307e8b
+
+-- __unique:__ @Database_DuckDB_FFI_V2_Database.DuckDB.FFI.V2_Safe_duckdb_v2_table_function_exec_get_local_state@
+foreign import ccall safe "hs_bindgen_b6852ffa8009ca44" hs_bindgen_b6852ffa8009ca44_base ::
+     BG.Ptr BG.Void
+  -> BG.Ptr BG.Void
+  -> BG.Ptr BG.Void
+  -> IO BG.CUInt
+
+-- __unique:__ @Database_DuckDB_FFI_V2_Database.DuckDB.FFI.V2_Safe_duckdb_v2_table_function_exec_get_local_state@
+hs_bindgen_b6852ffa8009ca44 ::
+     DuckDBV2TableFunctionExecInfoHandle
+  -> BG.Ptr (BG.Ptr BG.Void)
+  -> BG.Ptr DuckDBV2ErrorInfoHandle
+  -> IO DuckDBV2Error
+hs_bindgen_b6852ffa8009ca44 =
+  \x0 ->
+    \x1 ->
+      \x2 ->
+        fmap BG.fromFFIType (hs_bindgen_b6852ffa8009ca44_base (BG.toFFIType x0) (BG.toFFIType x1) (BG.toFFIType x2))
+
+{-| __C declaration:__ @duckdb_v2_table_function_exec_get_local_state@
+
+    __defined at:__ @duckdb_v2.h 13283:30@
+
+    __exported by:__ @duckdb_v2.h@
+-}
+c_duckdb_v2_table_function_exec_get_local_state ::
+     DuckDBV2TableFunctionExecInfoHandle
+     -- ^ __C declaration:__ @info@
+  -> BG.Ptr (BG.Ptr BG.Void)
+     -- ^ __C declaration:__ @data@
+  -> BG.Ptr DuckDBV2ErrorInfoHandle
+     -- ^ __C declaration:__ @err@
+  -> IO DuckDBV2Error
+c_duckdb_v2_table_function_exec_get_local_state =
+  hs_bindgen_b6852ffa8009ca44
+
+-- __unique:__ @Database_DuckDB_FFI_V2_Database.DuckDB.FFI.V2_Safe_duckdb_v2_table_function_exec_get_output_chunk@
+foreign import ccall safe "hs_bindgen_860d56c8d885d624" hs_bindgen_860d56c8d885d624_base ::
+     BG.Ptr BG.Void
+  -> BG.Ptr BG.Void
+  -> BG.Ptr BG.Void
+  -> IO BG.CUInt
+
+-- __unique:__ @Database_DuckDB_FFI_V2_Database.DuckDB.FFI.V2_Safe_duckdb_v2_table_function_exec_get_output_chunk@
+hs_bindgen_860d56c8d885d624 ::
+     DuckDBV2TableFunctionExecInfoHandle
+  -> BG.Ptr DuckDBV2DataChunkHandle
+  -> BG.Ptr DuckDBV2ErrorInfoHandle
+  -> IO DuckDBV2Error
+hs_bindgen_860d56c8d885d624 =
+  \x0 ->
+    \x1 ->
+      \x2 ->
+        fmap BG.fromFFIType (hs_bindgen_860d56c8d885d624_base (BG.toFFIType x0) (BG.toFFIType x1) (BG.toFFIType x2))
+
+{-| __C declaration:__ @duckdb_v2_table_function_exec_get_output_chunk@
+
+    __defined at:__ @duckdb_v2.h 13307:1@
+
+    __exported by:__ @duckdb_v2.h@
+-}
+c_duckdb_v2_table_function_exec_get_output_chunk ::
+     DuckDBV2TableFunctionExecInfoHandle
+     -- ^ __C declaration:__ @info@
+  -> BG.Ptr DuckDBV2DataChunkHandle
+     -- ^ __C declaration:__ @chunk@
+  -> BG.Ptr DuckDBV2ErrorInfoHandle
+     -- ^ __C declaration:__ @err@
+  -> IO DuckDBV2Error
+c_duckdb_v2_table_function_exec_get_output_chunk =
+  hs_bindgen_860d56c8d885d624
+
+-- __unique:__ @Database_DuckDB_FFI_V2_Database.DuckDB.FFI.V2_Safe_duckdb_v2_table_function_exec_get_column_count@
+foreign import ccall safe "hs_bindgen_cc532ba466dfbcba" hs_bindgen_cc532ba466dfbcba_base ::
+     BG.Ptr BG.Void
+  -> BG.Ptr BG.Void
+  -> BG.Ptr BG.Void
+  -> IO BG.CUInt
+
+-- __unique:__ @Database_DuckDB_FFI_V2_Database.DuckDB.FFI.V2_Safe_duckdb_v2_table_function_exec_get_column_count@
+hs_bindgen_cc532ba466dfbcba ::
+     DuckDBV2TableFunctionExecInfoHandle
+  -> BG.Ptr DuckDBIdx
+  -> BG.Ptr DuckDBV2ErrorInfoHandle
+  -> IO DuckDBV2Error
+hs_bindgen_cc532ba466dfbcba =
+  \x0 ->
+    \x1 ->
+      \x2 ->
+        fmap BG.fromFFIType (hs_bindgen_cc532ba466dfbcba_base (BG.toFFIType x0) (BG.toFFIType x1) (BG.toFFIType x2))
+
+{-| __C declaration:__ @duckdb_v2_table_function_exec_get_column_count@
+
+    __defined at:__ @duckdb_v2.h 13329:30@
+
+    __exported by:__ @duckdb_v2.h@
+-}
+c_duckdb_v2_table_function_exec_get_column_count ::
+     DuckDBV2TableFunctionExecInfoHandle
+     -- ^ __C declaration:__ @info@
+  -> BG.Ptr DuckDBIdx
+     -- ^ __C declaration:__ @count@
+  -> BG.Ptr DuckDBV2ErrorInfoHandle
+     -- ^ __C declaration:__ @err@
+  -> IO DuckDBV2Error
+c_duckdb_v2_table_function_exec_get_column_count =
+  hs_bindgen_cc532ba466dfbcba
+
+-- __unique:__ @Database_DuckDB_FFI_V2_Database.DuckDB.FFI.V2_Safe_duckdb_v2_table_function_exec_get_column_index@
+foreign import ccall safe "hs_bindgen_4badc2888a6d5d0b" hs_bindgen_4badc2888a6d5d0b_base ::
+     BG.Ptr BG.Void
+  -> HsBindgen.Runtime.LibC.Word64
+  -> BG.Ptr BG.Void
+  -> BG.Ptr BG.Void
+  -> IO BG.CUInt
+
+-- __unique:__ @Database_DuckDB_FFI_V2_Database.DuckDB.FFI.V2_Safe_duckdb_v2_table_function_exec_get_column_index@
+hs_bindgen_4badc2888a6d5d0b ::
+     DuckDBV2TableFunctionExecInfoHandle
+  -> DuckDBIdx
+  -> BG.Ptr DuckDBIdx
+  -> BG.Ptr DuckDBV2ErrorInfoHandle
+  -> IO DuckDBV2Error
+hs_bindgen_4badc2888a6d5d0b =
+  \x0 ->
+    \x1 ->
+      \x2 ->
+        \x3 ->
+          fmap BG.fromFFIType (hs_bindgen_4badc2888a6d5d0b_base (BG.toFFIType x0) (BG.toFFIType x1) (BG.toFFIType x2) (BG.toFFIType x3))
+
+{-| __C declaration:__ @duckdb_v2_table_function_exec_get_column_index@
+
+    __defined at:__ @duckdb_v2.h 13351:30@
+
+    __exported by:__ @duckdb_v2.h@
+-}
+c_duckdb_v2_table_function_exec_get_column_index ::
+     DuckDBV2TableFunctionExecInfoHandle
+     -- ^ __C declaration:__ @info@
+  -> DuckDBIdx
+     -- ^ __C declaration:__ @index@
+  -> BG.Ptr DuckDBIdx
+     -- ^ __C declaration:__ @column_index@
+  -> BG.Ptr DuckDBV2ErrorInfoHandle
+     -- ^ __C declaration:__ @err@
+  -> IO DuckDBV2Error
+c_duckdb_v2_table_function_exec_get_column_index =
+  hs_bindgen_4badc2888a6d5d0b
+
+-- __unique:__ @Database_DuckDB_FFI_V2_Database.DuckDB.FFI.V2_Safe_duckdb_v2_table_function_progress_get_user_data@
+foreign import ccall safe "hs_bindgen_087cb2c6d4e809ea" hs_bindgen_087cb2c6d4e809ea_base ::
+     BG.Ptr BG.Void
+  -> BG.Ptr BG.Void
+  -> BG.Ptr BG.Void
+  -> IO BG.CUInt
+
+-- __unique:__ @Database_DuckDB_FFI_V2_Database.DuckDB.FFI.V2_Safe_duckdb_v2_table_function_progress_get_user_data@
+hs_bindgen_087cb2c6d4e809ea ::
+     DuckDBV2TableFunctionProgressInfoHandle
+  -> BG.Ptr (BG.Ptr BG.Void)
+  -> BG.Ptr DuckDBV2ErrorInfoHandle
+  -> IO DuckDBV2Error
+hs_bindgen_087cb2c6d4e809ea =
+  \x0 ->
+    \x1 ->
+      \x2 ->
+        fmap BG.fromFFIType (hs_bindgen_087cb2c6d4e809ea_base (BG.toFFIType x0) (BG.toFFIType x1) (BG.toFFIType x2))
+
+{-| __C declaration:__ @duckdb_v2_table_function_progress_get_user_data@
+
+    __defined at:__ @duckdb_v2.h 13368:30@
+
+    __exported by:__ @duckdb_v2.h@
+-}
+c_duckdb_v2_table_function_progress_get_user_data ::
+     DuckDBV2TableFunctionProgressInfoHandle
+     -- ^ __C declaration:__ @info@
+  -> BG.Ptr (BG.Ptr BG.Void)
+     -- ^ __C declaration:__ @data@
+  -> BG.Ptr DuckDBV2ErrorInfoHandle
+     -- ^ __C declaration:__ @err@
+  -> IO DuckDBV2Error
+c_duckdb_v2_table_function_progress_get_user_data =
+  hs_bindgen_087cb2c6d4e809ea
+
+-- __unique:__ @Database_DuckDB_FFI_V2_Database.DuckDB.FFI.V2_Safe_duckdb_v2_table_function_progress_get_bind_data@
+foreign import ccall safe "hs_bindgen_0441109e7aba7bf2" hs_bindgen_0441109e7aba7bf2_base ::
+     BG.Ptr BG.Void
+  -> BG.Ptr BG.Void
+  -> BG.Ptr BG.Void
+  -> IO BG.CUInt
+
+-- __unique:__ @Database_DuckDB_FFI_V2_Database.DuckDB.FFI.V2_Safe_duckdb_v2_table_function_progress_get_bind_data@
+hs_bindgen_0441109e7aba7bf2 ::
+     DuckDBV2TableFunctionProgressInfoHandle
+  -> BG.Ptr (BG.Ptr BG.Void)
+  -> BG.Ptr DuckDBV2ErrorInfoHandle
+  -> IO DuckDBV2Error
+hs_bindgen_0441109e7aba7bf2 =
+  \x0 ->
+    \x1 ->
+      \x2 ->
+        fmap BG.fromFFIType (hs_bindgen_0441109e7aba7bf2_base (BG.toFFIType x0) (BG.toFFIType x1) (BG.toFFIType x2))
+
+{-| __C declaration:__ @duckdb_v2_table_function_progress_get_bind_data@
+
+    __defined at:__ @duckdb_v2.h 13385:30@
+
+    __exported by:__ @duckdb_v2.h@
+-}
+c_duckdb_v2_table_function_progress_get_bind_data ::
+     DuckDBV2TableFunctionProgressInfoHandle
+     -- ^ __C declaration:__ @info@
+  -> BG.Ptr (BG.Ptr BG.Void)
+     -- ^ __C declaration:__ @data@
+  -> BG.Ptr DuckDBV2ErrorInfoHandle
+     -- ^ __C declaration:__ @err@
+  -> IO DuckDBV2Error
+c_duckdb_v2_table_function_progress_get_bind_data =
+  hs_bindgen_0441109e7aba7bf2
+
+-- __unique:__ @Database_DuckDB_FFI_V2_Database.DuckDB.FFI.V2_Safe_duckdb_v2_table_function_progress_get_global_state@
+foreign import ccall safe "hs_bindgen_68dd8d5fa07f048c" hs_bindgen_68dd8d5fa07f048c_base ::
+     BG.Ptr BG.Void
+  -> BG.Ptr BG.Void
+  -> BG.Ptr BG.Void
+  -> IO BG.CUInt
+
+-- __unique:__ @Database_DuckDB_FFI_V2_Database.DuckDB.FFI.V2_Safe_duckdb_v2_table_function_progress_get_global_state@
+hs_bindgen_68dd8d5fa07f048c ::
+     DuckDBV2TableFunctionProgressInfoHandle
+  -> BG.Ptr (BG.Ptr BG.Void)
+  -> BG.Ptr DuckDBV2ErrorInfoHandle
+  -> IO DuckDBV2Error
+hs_bindgen_68dd8d5fa07f048c =
+  \x0 ->
+    \x1 ->
+      \x2 ->
+        fmap BG.fromFFIType (hs_bindgen_68dd8d5fa07f048c_base (BG.toFFIType x0) (BG.toFFIType x1) (BG.toFFIType x2))
+
+{-| __C declaration:__ @duckdb_v2_table_function_progress_get_global_state@
+
+    __defined at:__ @duckdb_v2.h 13405:30@
+
+    __exported by:__ @duckdb_v2.h@
+-}
+c_duckdb_v2_table_function_progress_get_global_state ::
+     DuckDBV2TableFunctionProgressInfoHandle
+     -- ^ __C declaration:__ @info@
+  -> BG.Ptr (BG.Ptr BG.Void)
+     -- ^ __C declaration:__ @data@
+  -> BG.Ptr DuckDBV2ErrorInfoHandle
+     -- ^ __C declaration:__ @err@
+  -> IO DuckDBV2Error
+c_duckdb_v2_table_function_progress_get_global_state =
+  hs_bindgen_68dd8d5fa07f048c
+
+-- __unique:__ @Database_DuckDB_FFI_V2_Database.DuckDB.FFI.V2_Safe_duckdb_v2_table_function_progress_set_progress@
+foreign import ccall safe "hs_bindgen_d16c2e0c7fe027ee" hs_bindgen_d16c2e0c7fe027ee_base ::
+     BG.Ptr BG.Void
+  -> BG.CDouble
+  -> BG.Ptr BG.Void
+  -> IO BG.CUInt
+
+-- __unique:__ @Database_DuckDB_FFI_V2_Database.DuckDB.FFI.V2_Safe_duckdb_v2_table_function_progress_set_progress@
+hs_bindgen_d16c2e0c7fe027ee ::
+     DuckDBV2TableFunctionProgressInfoHandle
+  -> BG.CDouble
+  -> BG.Ptr DuckDBV2ErrorInfoHandle
+  -> IO DuckDBV2Error
+hs_bindgen_d16c2e0c7fe027ee =
+  \x0 ->
+    \x1 ->
+      \x2 ->
+        fmap BG.fromFFIType (hs_bindgen_d16c2e0c7fe027ee_base (BG.toFFIType x0) (BG.toFFIType x1) (BG.toFFIType x2))
+
+{-| __C declaration:__ @duckdb_v2_table_function_progress_set_progress@
+
+    __defined at:__ @duckdb_v2.h 13425:30@
+
+    __exported by:__ @duckdb_v2.h@
+-}
+c_duckdb_v2_table_function_progress_set_progress ::
+     DuckDBV2TableFunctionProgressInfoHandle
+     -- ^ __C declaration:__ @info@
+  -> BG.CDouble
+     -- ^ __C declaration:__ @progress@
+  -> BG.Ptr DuckDBV2ErrorInfoHandle
+     -- ^ __C declaration:__ @err@
+  -> IO DuckDBV2Error
+c_duckdb_v2_table_function_progress_set_progress =
+  hs_bindgen_d16c2e0c7fe027ee
+
+-- __unique:__ @Database_DuckDB_FFI_V2_Database.DuckDB.FFI.V2_Safe_duckdb_v2_table_function_filter_pushdown_get_user_data@
+foreign import ccall safe "hs_bindgen_d7a5d31099aa0be3" hs_bindgen_d7a5d31099aa0be3_base ::
+     BG.Ptr BG.Void
+  -> BG.Ptr BG.Void
+  -> BG.Ptr BG.Void
+  -> IO BG.CUInt
+
+-- __unique:__ @Database_DuckDB_FFI_V2_Database.DuckDB.FFI.V2_Safe_duckdb_v2_table_function_filter_pushdown_get_user_data@
+hs_bindgen_d7a5d31099aa0be3 ::
+     DuckDBV2TableFunctionFilterPushdownInfoHandle
+  -> BG.Ptr (BG.Ptr BG.Void)
+  -> BG.Ptr DuckDBV2ErrorInfoHandle
+  -> IO DuckDBV2Error
+hs_bindgen_d7a5d31099aa0be3 =
+  \x0 ->
+    \x1 ->
+      \x2 ->
+        fmap BG.fromFFIType (hs_bindgen_d7a5d31099aa0be3_base (BG.toFFIType x0) (BG.toFFIType x1) (BG.toFFIType x2))
+
+{-| __C declaration:__ @duckdb_v2_table_function_filter_pushdown_get_user_data@
+
+    __defined at:__ @duckdb_v2.h 13442:30@
+
+    __exported by:__ @duckdb_v2.h@
+-}
+c_duckdb_v2_table_function_filter_pushdown_get_user_data ::
+     DuckDBV2TableFunctionFilterPushdownInfoHandle
+     -- ^ __C declaration:__ @info@
+  -> BG.Ptr (BG.Ptr BG.Void)
+     -- ^ __C declaration:__ @data@
+  -> BG.Ptr DuckDBV2ErrorInfoHandle
+     -- ^ __C declaration:__ @err@
+  -> IO DuckDBV2Error
+c_duckdb_v2_table_function_filter_pushdown_get_user_data =
+  hs_bindgen_d7a5d31099aa0be3
+
+-- __unique:__ @Database_DuckDB_FFI_V2_Database.DuckDB.FFI.V2_Safe_duckdb_v2_table_function_filter_pushdown_get_bind_data@
+foreign import ccall safe "hs_bindgen_6446a8d127208048" hs_bindgen_6446a8d127208048_base ::
+     BG.Ptr BG.Void
+  -> BG.Ptr BG.Void
+  -> BG.Ptr BG.Void
+  -> IO BG.CUInt
+
+-- __unique:__ @Database_DuckDB_FFI_V2_Database.DuckDB.FFI.V2_Safe_duckdb_v2_table_function_filter_pushdown_get_bind_data@
+hs_bindgen_6446a8d127208048 ::
+     DuckDBV2TableFunctionFilterPushdownInfoHandle
+  -> BG.Ptr (BG.Ptr BG.Void)
+  -> BG.Ptr DuckDBV2ErrorInfoHandle
+  -> IO DuckDBV2Error
+hs_bindgen_6446a8d127208048 =
+  \x0 ->
+    \x1 ->
+      \x2 ->
+        fmap BG.fromFFIType (hs_bindgen_6446a8d127208048_base (BG.toFFIType x0) (BG.toFFIType x1) (BG.toFFIType x2))
+
+{-| __C declaration:__ @duckdb_v2_table_function_filter_pushdown_get_bind_data@
+
+    __defined at:__ @duckdb_v2.h 13462:30@
+
+    __exported by:__ @duckdb_v2.h@
+-}
+c_duckdb_v2_table_function_filter_pushdown_get_bind_data ::
+     DuckDBV2TableFunctionFilterPushdownInfoHandle
+     -- ^ __C declaration:__ @info@
+  -> BG.Ptr (BG.Ptr BG.Void)
+     -- ^ __C declaration:__ @data@
+  -> BG.Ptr DuckDBV2ErrorInfoHandle
+     -- ^ __C declaration:__ @err@
+  -> IO DuckDBV2Error
+c_duckdb_v2_table_function_filter_pushdown_get_bind_data =
+  hs_bindgen_6446a8d127208048
+
+-- __unique:__ @Database_DuckDB_FFI_V2_Database.DuckDB.FFI.V2_Safe_duckdb_v2_table_function_filter_pushdown_get_filter_count@
+foreign import ccall safe "hs_bindgen_b0331a679559389f" hs_bindgen_b0331a679559389f_base ::
+     BG.Ptr BG.Void
+  -> BG.Ptr BG.Void
+  -> BG.Ptr BG.Void
+  -> IO BG.CUInt
+
+-- __unique:__ @Database_DuckDB_FFI_V2_Database.DuckDB.FFI.V2_Safe_duckdb_v2_table_function_filter_pushdown_get_filter_count@
+hs_bindgen_b0331a679559389f ::
+     DuckDBV2TableFunctionFilterPushdownInfoHandle
+  -> BG.Ptr DuckDBIdx
+  -> BG.Ptr DuckDBV2ErrorInfoHandle
+  -> IO DuckDBV2Error
+hs_bindgen_b0331a679559389f =
+  \x0 ->
+    \x1 ->
+      \x2 ->
+        fmap BG.fromFFIType (hs_bindgen_b0331a679559389f_base (BG.toFFIType x0) (BG.toFFIType x1) (BG.toFFIType x2))
+
+{-| __C declaration:__ @duckdb_v2_table_function_filter_pushdown_get_filter_count@
+
+    __defined at:__ @duckdb_v2.h 13483:30@
+
+    __exported by:__ @duckdb_v2.h@
+-}
+c_duckdb_v2_table_function_filter_pushdown_get_filter_count ::
+     DuckDBV2TableFunctionFilterPushdownInfoHandle
+     -- ^ __C declaration:__ @info@
+  -> BG.Ptr DuckDBIdx
+     -- ^ __C declaration:__ @count@
+  -> BG.Ptr DuckDBV2ErrorInfoHandle
+     -- ^ __C declaration:__ @err@
+  -> IO DuckDBV2Error
+c_duckdb_v2_table_function_filter_pushdown_get_filter_count =
+  hs_bindgen_b0331a679559389f
+
+-- __unique:__ @Database_DuckDB_FFI_V2_Database.DuckDB.FFI.V2_Safe_duckdb_v2_table_function_filter_pushdown_get_filter@
+foreign import ccall safe "hs_bindgen_3fce1781e46440da" hs_bindgen_3fce1781e46440da_base ::
+     BG.Ptr BG.Void
+  -> HsBindgen.Runtime.LibC.Word64
+  -> BG.Ptr BG.Void
+  -> BG.Ptr BG.Void
+  -> IO BG.CUInt
+
+-- __unique:__ @Database_DuckDB_FFI_V2_Database.DuckDB.FFI.V2_Safe_duckdb_v2_table_function_filter_pushdown_get_filter@
+hs_bindgen_3fce1781e46440da ::
+     DuckDBV2TableFunctionFilterPushdownInfoHandle
+  -> DuckDBIdx
+  -> BG.Ptr DuckDBV2ExpressionHandle
+  -> BG.Ptr DuckDBV2ErrorInfoHandle
+  -> IO DuckDBV2Error
+hs_bindgen_3fce1781e46440da =
+  \x0 ->
+    \x1 ->
+      \x2 ->
+        \x3 ->
+          fmap BG.fromFFIType (hs_bindgen_3fce1781e46440da_base (BG.toFFIType x0) (BG.toFFIType x1) (BG.toFFIType x2) (BG.toFFIType x3))
+
+{-| __C declaration:__ @duckdb_v2_table_function_filter_pushdown_get_filter@
+
+    __defined at:__ @duckdb_v2.h 13506:30@
+
+    __exported by:__ @duckdb_v2.h@
+-}
+c_duckdb_v2_table_function_filter_pushdown_get_filter ::
+     DuckDBV2TableFunctionFilterPushdownInfoHandle
+     -- ^ __C declaration:__ @info@
+  -> DuckDBIdx
+     -- ^ __C declaration:__ @index@
+  -> BG.Ptr DuckDBV2ExpressionHandle
+     -- ^ __C declaration:__ @filter@
+  -> BG.Ptr DuckDBV2ErrorInfoHandle
+     -- ^ __C declaration:__ @err@
+  -> IO DuckDBV2Error
+c_duckdb_v2_table_function_filter_pushdown_get_filter =
+  hs_bindgen_3fce1781e46440da
+
+-- __unique:__ @Database_DuckDB_FFI_V2_Database.DuckDB.FFI.V2_Safe_duckdb_v2_table_function_filter_pushdown_accept@
+foreign import ccall safe "hs_bindgen_99099150da26b05e" hs_bindgen_99099150da26b05e_base ::
+     BG.Ptr BG.Void
+  -> HsBindgen.Runtime.LibC.Word64
+  -> BG.Ptr BG.Void
+  -> IO BG.CUInt
+
+-- __unique:__ @Database_DuckDB_FFI_V2_Database.DuckDB.FFI.V2_Safe_duckdb_v2_table_function_filter_pushdown_accept@
+hs_bindgen_99099150da26b05e ::
+     DuckDBV2TableFunctionFilterPushdownInfoHandle
+  -> DuckDBIdx
+  -> BG.Ptr DuckDBV2ErrorInfoHandle
+  -> IO DuckDBV2Error
+hs_bindgen_99099150da26b05e =
+  \x0 ->
+    \x1 ->
+      \x2 ->
+        fmap BG.fromFFIType (hs_bindgen_99099150da26b05e_base (BG.toFFIType x0) (BG.toFFIType x1) (BG.toFFIType x2))
+
+{-| __C declaration:__ @duckdb_v2_table_function_filter_pushdown_accept@
+
+    __defined at:__ @duckdb_v2.h 13528:30@
+
+    __exported by:__ @duckdb_v2.h@
+-}
+c_duckdb_v2_table_function_filter_pushdown_accept ::
+     DuckDBV2TableFunctionFilterPushdownInfoHandle
+     -- ^ __C declaration:__ @info@
+  -> DuckDBIdx
+     -- ^ __C declaration:__ @index@
+  -> BG.Ptr DuckDBV2ErrorInfoHandle
+     -- ^ __C declaration:__ @err@
+  -> IO DuckDBV2Error
+c_duckdb_v2_table_function_filter_pushdown_accept =
+  hs_bindgen_99099150da26b05e
+
+-- __unique:__ @Database_DuckDB_FFI_V2_Database.DuckDB.FFI.V2_Safe_duckdb_v2_table_function_filter_pushdown_get_column_count@
+foreign import ccall safe "hs_bindgen_65fc674ea4fdc1f3" hs_bindgen_65fc674ea4fdc1f3_base ::
+     BG.Ptr BG.Void
+  -> BG.Ptr BG.Void
+  -> BG.Ptr BG.Void
+  -> IO BG.CUInt
+
+-- __unique:__ @Database_DuckDB_FFI_V2_Database.DuckDB.FFI.V2_Safe_duckdb_v2_table_function_filter_pushdown_get_column_count@
+hs_bindgen_65fc674ea4fdc1f3 ::
+     DuckDBV2TableFunctionFilterPushdownInfoHandle
+  -> BG.Ptr DuckDBIdx
+  -> BG.Ptr DuckDBV2ErrorInfoHandle
+  -> IO DuckDBV2Error
+hs_bindgen_65fc674ea4fdc1f3 =
+  \x0 ->
+    \x1 ->
+      \x2 ->
+        fmap BG.fromFFIType (hs_bindgen_65fc674ea4fdc1f3_base (BG.toFFIType x0) (BG.toFFIType x1) (BG.toFFIType x2))
+
+{-| __C declaration:__ @duckdb_v2_table_function_filter_pushdown_get_column_count@
+
+    __defined at:__ @duckdb_v2.h 13549:30@
+
+    __exported by:__ @duckdb_v2.h@
+-}
+c_duckdb_v2_table_function_filter_pushdown_get_column_count ::
+     DuckDBV2TableFunctionFilterPushdownInfoHandle
+     -- ^ __C declaration:__ @info@
+  -> BG.Ptr DuckDBIdx
+     -- ^ __C declaration:__ @count@
+  -> BG.Ptr DuckDBV2ErrorInfoHandle
+     -- ^ __C declaration:__ @err@
+  -> IO DuckDBV2Error
+c_duckdb_v2_table_function_filter_pushdown_get_column_count =
+  hs_bindgen_65fc674ea4fdc1f3
+
+-- __unique:__ @Database_DuckDB_FFI_V2_Database.DuckDB.FFI.V2_Safe_duckdb_v2_table_function_filter_pushdown_get_column_index@
+foreign import ccall safe "hs_bindgen_e113c0615574991d" hs_bindgen_e113c0615574991d_base ::
+     BG.Ptr BG.Void
+  -> HsBindgen.Runtime.LibC.Word64
+  -> BG.Ptr BG.Void
+  -> BG.Ptr BG.Void
+  -> IO BG.CUInt
+
+-- __unique:__ @Database_DuckDB_FFI_V2_Database.DuckDB.FFI.V2_Safe_duckdb_v2_table_function_filter_pushdown_get_column_index@
+hs_bindgen_e113c0615574991d ::
+     DuckDBV2TableFunctionFilterPushdownInfoHandle
+  -> DuckDBIdx
+  -> BG.Ptr DuckDBIdx
+  -> BG.Ptr DuckDBV2ErrorInfoHandle
+  -> IO DuckDBV2Error
+hs_bindgen_e113c0615574991d =
+  \x0 ->
+    \x1 ->
+      \x2 ->
+        \x3 ->
+          fmap BG.fromFFIType (hs_bindgen_e113c0615574991d_base (BG.toFFIType x0) (BG.toFFIType x1) (BG.toFFIType x2) (BG.toFFIType x3))
+
+{-| __C declaration:__ @duckdb_v2_table_function_filter_pushdown_get_column_index@
+
+    __defined at:__ @duckdb_v2.h 13571:30@
+
+    __exported by:__ @duckdb_v2.h@
+-}
+c_duckdb_v2_table_function_filter_pushdown_get_column_index ::
+     DuckDBV2TableFunctionFilterPushdownInfoHandle
+     -- ^ __C declaration:__ @info@
+  -> DuckDBIdx
+     -- ^ __C declaration:__ @index@
+  -> BG.Ptr DuckDBIdx
+     -- ^ __C declaration:__ @column_index@
+  -> BG.Ptr DuckDBV2ErrorInfoHandle
+     -- ^ __C declaration:__ @err@
+  -> IO DuckDBV2Error
+c_duckdb_v2_table_function_filter_pushdown_get_column_index =
+  hs_bindgen_e113c0615574991d
+
+-- __unique:__ @Database_DuckDB_FFI_V2_Database.DuckDB.FFI.V2_Safe_duckdb_v2_table_function_partition_data_get_user_data@
+foreign import ccall safe "hs_bindgen_70a7024399147586" hs_bindgen_70a7024399147586_base ::
+     BG.Ptr BG.Void
+  -> BG.Ptr BG.Void
+  -> BG.Ptr BG.Void
+  -> IO BG.CUInt
+
+-- __unique:__ @Database_DuckDB_FFI_V2_Database.DuckDB.FFI.V2_Safe_duckdb_v2_table_function_partition_data_get_user_data@
+hs_bindgen_70a7024399147586 ::
+     DuckDBV2TableFunctionPartitionDataInfoHandle
+  -> BG.Ptr (BG.Ptr BG.Void)
+  -> BG.Ptr DuckDBV2ErrorInfoHandle
+  -> IO DuckDBV2Error
+hs_bindgen_70a7024399147586 =
+  \x0 ->
+    \x1 ->
+      \x2 ->
+        fmap BG.fromFFIType (hs_bindgen_70a7024399147586_base (BG.toFFIType x0) (BG.toFFIType x1) (BG.toFFIType x2))
+
+{-| __C declaration:__ @duckdb_v2_table_function_partition_data_get_user_data@
+
+    __defined at:__ @duckdb_v2.h 13589:30@
+
+    __exported by:__ @duckdb_v2.h@
+-}
+c_duckdb_v2_table_function_partition_data_get_user_data ::
+     DuckDBV2TableFunctionPartitionDataInfoHandle
+     -- ^ __C declaration:__ @info@
+  -> BG.Ptr (BG.Ptr BG.Void)
+     -- ^ __C declaration:__ @data@
+  -> BG.Ptr DuckDBV2ErrorInfoHandle
+     -- ^ __C declaration:__ @err@
+  -> IO DuckDBV2Error
+c_duckdb_v2_table_function_partition_data_get_user_data =
+  hs_bindgen_70a7024399147586
+
+-- __unique:__ @Database_DuckDB_FFI_V2_Database.DuckDB.FFI.V2_Safe_duckdb_v2_table_function_partition_data_get_bind_data@
+foreign import ccall safe "hs_bindgen_d363a045c5cce5ea" hs_bindgen_d363a045c5cce5ea_base ::
+     BG.Ptr BG.Void
+  -> BG.Ptr BG.Void
+  -> BG.Ptr BG.Void
+  -> IO BG.CUInt
+
+-- __unique:__ @Database_DuckDB_FFI_V2_Database.DuckDB.FFI.V2_Safe_duckdb_v2_table_function_partition_data_get_bind_data@
+hs_bindgen_d363a045c5cce5ea ::
+     DuckDBV2TableFunctionPartitionDataInfoHandle
+  -> BG.Ptr (BG.Ptr BG.Void)
+  -> BG.Ptr DuckDBV2ErrorInfoHandle
+  -> IO DuckDBV2Error
+hs_bindgen_d363a045c5cce5ea =
+  \x0 ->
+    \x1 ->
+      \x2 ->
+        fmap BG.fromFFIType (hs_bindgen_d363a045c5cce5ea_base (BG.toFFIType x0) (BG.toFFIType x1) (BG.toFFIType x2))
+
+{-| __C declaration:__ @duckdb_v2_table_function_partition_data_get_bind_data@
+
+    __defined at:__ @duckdb_v2.h 13606:30@
+
+    __exported by:__ @duckdb_v2.h@
+-}
+c_duckdb_v2_table_function_partition_data_get_bind_data ::
+     DuckDBV2TableFunctionPartitionDataInfoHandle
+     -- ^ __C declaration:__ @info@
+  -> BG.Ptr (BG.Ptr BG.Void)
+     -- ^ __C declaration:__ @data@
+  -> BG.Ptr DuckDBV2ErrorInfoHandle
+     -- ^ __C declaration:__ @err@
+  -> IO DuckDBV2Error
+c_duckdb_v2_table_function_partition_data_get_bind_data =
+  hs_bindgen_d363a045c5cce5ea
+
+-- __unique:__ @Database_DuckDB_FFI_V2_Database.DuckDB.FFI.V2_Safe_duckdb_v2_table_function_partition_data_get_global_state@
+foreign import ccall safe "hs_bindgen_86109e535d0bc157" hs_bindgen_86109e535d0bc157_base ::
+     BG.Ptr BG.Void
+  -> BG.Ptr BG.Void
+  -> BG.Ptr BG.Void
+  -> IO BG.CUInt
+
+-- __unique:__ @Database_DuckDB_FFI_V2_Database.DuckDB.FFI.V2_Safe_duckdb_v2_table_function_partition_data_get_global_state@
+hs_bindgen_86109e535d0bc157 ::
+     DuckDBV2TableFunctionPartitionDataInfoHandle
+  -> BG.Ptr (BG.Ptr BG.Void)
+  -> BG.Ptr DuckDBV2ErrorInfoHandle
+  -> IO DuckDBV2Error
+hs_bindgen_86109e535d0bc157 =
+  \x0 ->
+    \x1 ->
+      \x2 ->
+        fmap BG.fromFFIType (hs_bindgen_86109e535d0bc157_base (BG.toFFIType x0) (BG.toFFIType x1) (BG.toFFIType x2))
+
+{-| __C declaration:__ @duckdb_v2_table_function_partition_data_get_global_state@
+
+    __defined at:__ @duckdb_v2.h 13625:30@
+
+    __exported by:__ @duckdb_v2.h@
+-}
+c_duckdb_v2_table_function_partition_data_get_global_state ::
+     DuckDBV2TableFunctionPartitionDataInfoHandle
+     -- ^ __C declaration:__ @info@
+  -> BG.Ptr (BG.Ptr BG.Void)
+     -- ^ __C declaration:__ @data@
+  -> BG.Ptr DuckDBV2ErrorInfoHandle
+     -- ^ __C declaration:__ @err@
+  -> IO DuckDBV2Error
+c_duckdb_v2_table_function_partition_data_get_global_state =
+  hs_bindgen_86109e535d0bc157
+
+-- __unique:__ @Database_DuckDB_FFI_V2_Database.DuckDB.FFI.V2_Safe_duckdb_v2_table_function_partition_data_get_local_state@
+foreign import ccall safe "hs_bindgen_29605ce2d0a81284" hs_bindgen_29605ce2d0a81284_base ::
+     BG.Ptr BG.Void
+  -> BG.Ptr BG.Void
+  -> BG.Ptr BG.Void
+  -> IO BG.CUInt
+
+-- __unique:__ @Database_DuckDB_FFI_V2_Database.DuckDB.FFI.V2_Safe_duckdb_v2_table_function_partition_data_get_local_state@
+hs_bindgen_29605ce2d0a81284 ::
+     DuckDBV2TableFunctionPartitionDataInfoHandle
+  -> BG.Ptr (BG.Ptr BG.Void)
+  -> BG.Ptr DuckDBV2ErrorInfoHandle
+  -> IO DuckDBV2Error
+hs_bindgen_29605ce2d0a81284 =
+  \x0 ->
+    \x1 ->
+      \x2 ->
+        fmap BG.fromFFIType (hs_bindgen_29605ce2d0a81284_base (BG.toFFIType x0) (BG.toFFIType x1) (BG.toFFIType x2))
+
+{-| __C declaration:__ @duckdb_v2_table_function_partition_data_get_local_state@
+
+    __defined at:__ @duckdb_v2.h 13643:30@
+
+    __exported by:__ @duckdb_v2.h@
+-}
+c_duckdb_v2_table_function_partition_data_get_local_state ::
+     DuckDBV2TableFunctionPartitionDataInfoHandle
+     -- ^ __C declaration:__ @info@
+  -> BG.Ptr (BG.Ptr BG.Void)
+     -- ^ __C declaration:__ @data@
+  -> BG.Ptr DuckDBV2ErrorInfoHandle
+     -- ^ __C declaration:__ @err@
+  -> IO DuckDBV2Error
+c_duckdb_v2_table_function_partition_data_get_local_state =
+  hs_bindgen_29605ce2d0a81284
+
+-- __unique:__ @Database_DuckDB_FFI_V2_Database.DuckDB.FFI.V2_Safe_duckdb_v2_table_function_partition_data_requires_batch_index@
+foreign import ccall safe "hs_bindgen_472e8853c25b15e3" hs_bindgen_472e8853c25b15e3_base ::
+     BG.Ptr BG.Void
+  -> BG.Ptr BG.Void
+  -> BG.Ptr BG.Void
+  -> IO BG.CUInt
+
+-- __unique:__ @Database_DuckDB_FFI_V2_Database.DuckDB.FFI.V2_Safe_duckdb_v2_table_function_partition_data_requires_batch_index@
+hs_bindgen_472e8853c25b15e3 ::
+     DuckDBV2TableFunctionPartitionDataInfoHandle
+  -> BG.Ptr BG.CBool
+  -> BG.Ptr DuckDBV2ErrorInfoHandle
+  -> IO DuckDBV2Error
+hs_bindgen_472e8853c25b15e3 =
+  \x0 ->
+    \x1 ->
+      \x2 ->
+        fmap BG.fromFFIType (hs_bindgen_472e8853c25b15e3_base (BG.toFFIType x0) (BG.toFFIType x1) (BG.toFFIType x2))
+
+{-| __C declaration:__ @duckdb_v2_table_function_partition_data_requires_batch_index@
+
+    __defined at:__ @duckdb_v2.h 13664:30@
+
+    __exported by:__ @duckdb_v2.h@
+-}
+c_duckdb_v2_table_function_partition_data_requires_batch_index ::
+     DuckDBV2TableFunctionPartitionDataInfoHandle
+     -- ^ __C declaration:__ @info@
+  -> BG.Ptr BG.CBool
+     -- ^ __C declaration:__ @required@
+  -> BG.Ptr DuckDBV2ErrorInfoHandle
+     -- ^ __C declaration:__ @err@
+  -> IO DuckDBV2Error
+c_duckdb_v2_table_function_partition_data_requires_batch_index =
+  hs_bindgen_472e8853c25b15e3
+
+-- __unique:__ @Database_DuckDB_FFI_V2_Database.DuckDB.FFI.V2_Safe_duckdb_v2_table_function_partition_data_requires_partition_columns@
+foreign import ccall safe "hs_bindgen_8f6d32d89bf2c5e1" hs_bindgen_8f6d32d89bf2c5e1_base ::
+     BG.Ptr BG.Void
+  -> BG.Ptr BG.Void
+  -> BG.Ptr BG.Void
+  -> IO BG.CUInt
+
+-- __unique:__ @Database_DuckDB_FFI_V2_Database.DuckDB.FFI.V2_Safe_duckdb_v2_table_function_partition_data_requires_partition_columns@
+hs_bindgen_8f6d32d89bf2c5e1 ::
+     DuckDBV2TableFunctionPartitionDataInfoHandle
+  -> BG.Ptr BG.CBool
+  -> BG.Ptr DuckDBV2ErrorInfoHandle
+  -> IO DuckDBV2Error
+hs_bindgen_8f6d32d89bf2c5e1 =
+  \x0 ->
+    \x1 ->
+      \x2 ->
+        fmap BG.fromFFIType (hs_bindgen_8f6d32d89bf2c5e1_base (BG.toFFIType x0) (BG.toFFIType x1) (BG.toFFIType x2))
+
+{-| __C declaration:__ @duckdb_v2_table_function_partition_data_requires_partition_columns@
+
+    __defined at:__ @duckdb_v2.h 13684:30@
+
+    __exported by:__ @duckdb_v2.h@
+-}
+c_duckdb_v2_table_function_partition_data_requires_partition_columns ::
+     DuckDBV2TableFunctionPartitionDataInfoHandle
+     -- ^ __C declaration:__ @info@
+  -> BG.Ptr BG.CBool
+     -- ^ __C declaration:__ @required@
+  -> BG.Ptr DuckDBV2ErrorInfoHandle
+     -- ^ __C declaration:__ @err@
+  -> IO DuckDBV2Error
+c_duckdb_v2_table_function_partition_data_requires_partition_columns =
+  hs_bindgen_8f6d32d89bf2c5e1
+
+-- __unique:__ @Database_DuckDB_FFI_V2_Database.DuckDB.FFI.V2_Safe_duckdb_v2_table_function_partition_data_get_partition_column_count@
+foreign import ccall safe "hs_bindgen_51c5821229259a9e" hs_bindgen_51c5821229259a9e_base ::
+     BG.Ptr BG.Void
+  -> BG.Ptr BG.Void
+  -> BG.Ptr BG.Void
+  -> IO BG.CUInt
+
+-- __unique:__ @Database_DuckDB_FFI_V2_Database.DuckDB.FFI.V2_Safe_duckdb_v2_table_function_partition_data_get_partition_column_count@
+hs_bindgen_51c5821229259a9e ::
+     DuckDBV2TableFunctionPartitionDataInfoHandle
+  -> BG.Ptr DuckDBIdx
+  -> BG.Ptr DuckDBV2ErrorInfoHandle
+  -> IO DuckDBV2Error
+hs_bindgen_51c5821229259a9e =
+  \x0 ->
+    \x1 ->
+      \x2 ->
+        fmap BG.fromFFIType (hs_bindgen_51c5821229259a9e_base (BG.toFFIType x0) (BG.toFFIType x1) (BG.toFFIType x2))
+
+{-| __C declaration:__ @duckdb_v2_table_function_partition_data_get_partition_column_count@
+
+    __defined at:__ @duckdb_v2.h 13705:30@
+
+    __exported by:__ @duckdb_v2.h@
+-}
+c_duckdb_v2_table_function_partition_data_get_partition_column_count ::
+     DuckDBV2TableFunctionPartitionDataInfoHandle
+     -- ^ __C declaration:__ @info@
+  -> BG.Ptr DuckDBIdx
+     -- ^ __C declaration:__ @count@
+  -> BG.Ptr DuckDBV2ErrorInfoHandle
+     -- ^ __C declaration:__ @err@
+  -> IO DuckDBV2Error
+c_duckdb_v2_table_function_partition_data_get_partition_column_count =
+  hs_bindgen_51c5821229259a9e
+
+-- __unique:__ @Database_DuckDB_FFI_V2_Database.DuckDB.FFI.V2_Safe_duckdb_v2_table_function_partition_data_get_partition_column_index@
+foreign import ccall safe "hs_bindgen_3e72a638c06af7ec" hs_bindgen_3e72a638c06af7ec_base ::
+     BG.Ptr BG.Void
+  -> HsBindgen.Runtime.LibC.Word64
+  -> BG.Ptr BG.Void
+  -> BG.Ptr BG.Void
+  -> IO BG.CUInt
+
+-- __unique:__ @Database_DuckDB_FFI_V2_Database.DuckDB.FFI.V2_Safe_duckdb_v2_table_function_partition_data_get_partition_column_index@
+hs_bindgen_3e72a638c06af7ec ::
+     DuckDBV2TableFunctionPartitionDataInfoHandle
+  -> DuckDBIdx
+  -> BG.Ptr DuckDBIdx
+  -> BG.Ptr DuckDBV2ErrorInfoHandle
+  -> IO DuckDBV2Error
+hs_bindgen_3e72a638c06af7ec =
+  \x0 ->
+    \x1 ->
+      \x2 ->
+        \x3 ->
+          fmap BG.fromFFIType (hs_bindgen_3e72a638c06af7ec_base (BG.toFFIType x0) (BG.toFFIType x1) (BG.toFFIType x2) (BG.toFFIType x3))
+
+{-| __C declaration:__ @duckdb_v2_table_function_partition_data_get_partition_column_index@
+
+    __defined at:__ @duckdb_v2.h 13726:30@
+
+    __exported by:__ @duckdb_v2.h@
+-}
+c_duckdb_v2_table_function_partition_data_get_partition_column_index ::
+     DuckDBV2TableFunctionPartitionDataInfoHandle
+     -- ^ __C declaration:__ @info@
+  -> DuckDBIdx
+     -- ^ __C declaration:__ @index@
+  -> BG.Ptr DuckDBIdx
+     -- ^ __C declaration:__ @column_index@
+  -> BG.Ptr DuckDBV2ErrorInfoHandle
+     -- ^ __C declaration:__ @err@
+  -> IO DuckDBV2Error
+c_duckdb_v2_table_function_partition_data_get_partition_column_index =
+  hs_bindgen_3e72a638c06af7ec
+
+-- __unique:__ @Database_DuckDB_FFI_V2_Database.DuckDB.FFI.V2_Safe_duckdb_v2_table_function_partition_data_set_batch_index@
+foreign import ccall safe "hs_bindgen_756227b9867112c7" hs_bindgen_756227b9867112c7_base ::
+     BG.Ptr BG.Void
+  -> HsBindgen.Runtime.LibC.Word64
+  -> BG.Ptr BG.Void
+  -> IO BG.CUInt
+
+-- __unique:__ @Database_DuckDB_FFI_V2_Database.DuckDB.FFI.V2_Safe_duckdb_v2_table_function_partition_data_set_batch_index@
+hs_bindgen_756227b9867112c7 ::
+     DuckDBV2TableFunctionPartitionDataInfoHandle
+  -> DuckDBIdx
+  -> BG.Ptr DuckDBV2ErrorInfoHandle
+  -> IO DuckDBV2Error
+hs_bindgen_756227b9867112c7 =
+  \x0 ->
+    \x1 ->
+      \x2 ->
+        fmap BG.fromFFIType (hs_bindgen_756227b9867112c7_base (BG.toFFIType x0) (BG.toFFIType x1) (BG.toFFIType x2))
+
+{-| __C declaration:__ @duckdb_v2_table_function_partition_data_set_batch_index@
+
+    __defined at:__ @duckdb_v2.h 13753:30@
+
+    __exported by:__ @duckdb_v2.h@
+-}
+c_duckdb_v2_table_function_partition_data_set_batch_index ::
+     DuckDBV2TableFunctionPartitionDataInfoHandle
+     -- ^ __C declaration:__ @info@
+  -> DuckDBIdx
+     -- ^ __C declaration:__ @batch_index@
+  -> BG.Ptr DuckDBV2ErrorInfoHandle
+     -- ^ __C declaration:__ @err@
+  -> IO DuckDBV2Error
+c_duckdb_v2_table_function_partition_data_set_batch_index =
+  hs_bindgen_756227b9867112c7
+
+-- __unique:__ @Database_DuckDB_FFI_V2_Database.DuckDB.FFI.V2_Safe_duckdb_v2_table_function_partition_data_set_partition_value@
+foreign import ccall safe "hs_bindgen_bdeeb6f63d89c30c" hs_bindgen_bdeeb6f63d89c30c_base ::
+     BG.Ptr BG.Void
+  -> HsBindgen.Runtime.LibC.Word64
+  -> BG.Ptr BG.Void
+  -> BG.Ptr BG.Void
+  -> IO BG.CUInt
+
+-- __unique:__ @Database_DuckDB_FFI_V2_Database.DuckDB.FFI.V2_Safe_duckdb_v2_table_function_partition_data_set_partition_value@
+hs_bindgen_bdeeb6f63d89c30c ::
+     DuckDBV2TableFunctionPartitionDataInfoHandle
+  -> DuckDBIdx
+  -> DuckDBV2ValueHandle
+  -> BG.Ptr DuckDBV2ErrorInfoHandle
+  -> IO DuckDBV2Error
+hs_bindgen_bdeeb6f63d89c30c =
+  \x0 ->
+    \x1 ->
+      \x2 ->
+        \x3 ->
+          fmap BG.fromFFIType (hs_bindgen_bdeeb6f63d89c30c_base (BG.toFFIType x0) (BG.toFFIType x1) (BG.toFFIType x2) (BG.toFFIType x3))
+
+{-| __C declaration:__ @duckdb_v2_table_function_partition_data_set_partition_value@
+
+    __defined at:__ @duckdb_v2.h 13781:30@
+
+    __exported by:__ @duckdb_v2.h@
+-}
+c_duckdb_v2_table_function_partition_data_set_partition_value ::
+     DuckDBV2TableFunctionPartitionDataInfoHandle
+     -- ^ __C declaration:__ @info@
+  -> DuckDBIdx
+     -- ^ __C declaration:__ @index@
+  -> DuckDBV2ValueHandle
+     -- ^ __C declaration:__ @value@
+  -> BG.Ptr DuckDBV2ErrorInfoHandle
+     -- ^ __C declaration:__ @err@
+  -> IO DuckDBV2Error
+c_duckdb_v2_table_function_partition_data_set_partition_value =
+  hs_bindgen_bdeeb6f63d89c30c
+
+-- __unique:__ @Database_DuckDB_FFI_V2_Database.DuckDB.FFI.V2_Safe_duckdb_v2_table_function_partitioning_get_user_data@
+foreign import ccall safe "hs_bindgen_ff39060def052198" hs_bindgen_ff39060def052198_base ::
+     BG.Ptr BG.Void
+  -> BG.Ptr BG.Void
+  -> BG.Ptr BG.Void
+  -> IO BG.CUInt
+
+-- __unique:__ @Database_DuckDB_FFI_V2_Database.DuckDB.FFI.V2_Safe_duckdb_v2_table_function_partitioning_get_user_data@
+hs_bindgen_ff39060def052198 ::
+     DuckDBV2TableFunctionPartitioningInfoHandle
+  -> BG.Ptr (BG.Ptr BG.Void)
+  -> BG.Ptr DuckDBV2ErrorInfoHandle
+  -> IO DuckDBV2Error
+hs_bindgen_ff39060def052198 =
+  \x0 ->
+    \x1 ->
+      \x2 ->
+        fmap BG.fromFFIType (hs_bindgen_ff39060def052198_base (BG.toFFIType x0) (BG.toFFIType x1) (BG.toFFIType x2))
+
+{-| __C declaration:__ @duckdb_v2_table_function_partitioning_get_user_data@
+
+    __defined at:__ @duckdb_v2.h 13799:30@
+
+    __exported by:__ @duckdb_v2.h@
+-}
+c_duckdb_v2_table_function_partitioning_get_user_data ::
+     DuckDBV2TableFunctionPartitioningInfoHandle
+     -- ^ __C declaration:__ @info@
+  -> BG.Ptr (BG.Ptr BG.Void)
+     -- ^ __C declaration:__ @data@
+  -> BG.Ptr DuckDBV2ErrorInfoHandle
+     -- ^ __C declaration:__ @err@
+  -> IO DuckDBV2Error
+c_duckdb_v2_table_function_partitioning_get_user_data =
+  hs_bindgen_ff39060def052198
+
+-- __unique:__ @Database_DuckDB_FFI_V2_Database.DuckDB.FFI.V2_Safe_duckdb_v2_table_function_partitioning_get_bind_data@
+foreign import ccall safe "hs_bindgen_8dd43b06a11f6b8d" hs_bindgen_8dd43b06a11f6b8d_base ::
+     BG.Ptr BG.Void
+  -> BG.Ptr BG.Void
+  -> BG.Ptr BG.Void
+  -> IO BG.CUInt
+
+-- __unique:__ @Database_DuckDB_FFI_V2_Database.DuckDB.FFI.V2_Safe_duckdb_v2_table_function_partitioning_get_bind_data@
+hs_bindgen_8dd43b06a11f6b8d ::
+     DuckDBV2TableFunctionPartitioningInfoHandle
+  -> BG.Ptr (BG.Ptr BG.Void)
+  -> BG.Ptr DuckDBV2ErrorInfoHandle
+  -> IO DuckDBV2Error
+hs_bindgen_8dd43b06a11f6b8d =
+  \x0 ->
+    \x1 ->
+      \x2 ->
+        fmap BG.fromFFIType (hs_bindgen_8dd43b06a11f6b8d_base (BG.toFFIType x0) (BG.toFFIType x1) (BG.toFFIType x2))
+
+{-| __C declaration:__ @duckdb_v2_table_function_partitioning_get_bind_data@
+
+    __defined at:__ @duckdb_v2.h 13816:30@
+
+    __exported by:__ @duckdb_v2.h@
+-}
+c_duckdb_v2_table_function_partitioning_get_bind_data ::
+     DuckDBV2TableFunctionPartitioningInfoHandle
+     -- ^ __C declaration:__ @info@
+  -> BG.Ptr (BG.Ptr BG.Void)
+     -- ^ __C declaration:__ @data@
+  -> BG.Ptr DuckDBV2ErrorInfoHandle
+     -- ^ __C declaration:__ @err@
+  -> IO DuckDBV2Error
+c_duckdb_v2_table_function_partitioning_get_bind_data =
+  hs_bindgen_8dd43b06a11f6b8d
+
+-- __unique:__ @Database_DuckDB_FFI_V2_Database.DuckDB.FFI.V2_Safe_duckdb_v2_table_function_partitioning_get_partition_column_count@
+foreign import ccall safe "hs_bindgen_15d230141f8f5c35" hs_bindgen_15d230141f8f5c35_base ::
+     BG.Ptr BG.Void
+  -> BG.Ptr BG.Void
+  -> BG.Ptr BG.Void
+  -> IO BG.CUInt
+
+-- __unique:__ @Database_DuckDB_FFI_V2_Database.DuckDB.FFI.V2_Safe_duckdb_v2_table_function_partitioning_get_partition_column_count@
+hs_bindgen_15d230141f8f5c35 ::
+     DuckDBV2TableFunctionPartitioningInfoHandle
+  -> BG.Ptr DuckDBIdx
+  -> BG.Ptr DuckDBV2ErrorInfoHandle
+  -> IO DuckDBV2Error
+hs_bindgen_15d230141f8f5c35 =
+  \x0 ->
+    \x1 ->
+      \x2 ->
+        fmap BG.fromFFIType (hs_bindgen_15d230141f8f5c35_base (BG.toFFIType x0) (BG.toFFIType x1) (BG.toFFIType x2))
+
+{-| __C declaration:__ @duckdb_v2_table_function_partitioning_get_partition_column_count@
+
+    __defined at:__ @duckdb_v2.h 13836:30@
+
+    __exported by:__ @duckdb_v2.h@
+-}
+c_duckdb_v2_table_function_partitioning_get_partition_column_count ::
+     DuckDBV2TableFunctionPartitioningInfoHandle
+     -- ^ __C declaration:__ @info@
+  -> BG.Ptr DuckDBIdx
+     -- ^ __C declaration:__ @count@
+  -> BG.Ptr DuckDBV2ErrorInfoHandle
+     -- ^ __C declaration:__ @err@
+  -> IO DuckDBV2Error
+c_duckdb_v2_table_function_partitioning_get_partition_column_count =
+  hs_bindgen_15d230141f8f5c35
+
+-- __unique:__ @Database_DuckDB_FFI_V2_Database.DuckDB.FFI.V2_Safe_duckdb_v2_table_function_partitioning_get_partition_column_index@
+foreign import ccall safe "hs_bindgen_e91aef7f35be59d7" hs_bindgen_e91aef7f35be59d7_base ::
+     BG.Ptr BG.Void
+  -> HsBindgen.Runtime.LibC.Word64
+  -> BG.Ptr BG.Void
+  -> BG.Ptr BG.Void
+  -> IO BG.CUInt
+
+-- __unique:__ @Database_DuckDB_FFI_V2_Database.DuckDB.FFI.V2_Safe_duckdb_v2_table_function_partitioning_get_partition_column_index@
+hs_bindgen_e91aef7f35be59d7 ::
+     DuckDBV2TableFunctionPartitioningInfoHandle
+  -> DuckDBIdx
+  -> BG.Ptr DuckDBIdx
+  -> BG.Ptr DuckDBV2ErrorInfoHandle
+  -> IO DuckDBV2Error
+hs_bindgen_e91aef7f35be59d7 =
+  \x0 ->
+    \x1 ->
+      \x2 ->
+        \x3 ->
+          fmap BG.fromFFIType (hs_bindgen_e91aef7f35be59d7_base (BG.toFFIType x0) (BG.toFFIType x1) (BG.toFFIType x2) (BG.toFFIType x3))
+
+{-| __C declaration:__ @duckdb_v2_table_function_partitioning_get_partition_column_index@
+
+    __defined at:__ @duckdb_v2.h 13857:30@
+
+    __exported by:__ @duckdb_v2.h@
+-}
+c_duckdb_v2_table_function_partitioning_get_partition_column_index ::
+     DuckDBV2TableFunctionPartitioningInfoHandle
+     -- ^ __C declaration:__ @info@
+  -> DuckDBIdx
+     -- ^ __C declaration:__ @index@
+  -> BG.Ptr DuckDBIdx
+     -- ^ __C declaration:__ @column_index@
+  -> BG.Ptr DuckDBV2ErrorInfoHandle
+     -- ^ __C declaration:__ @err@
+  -> IO DuckDBV2Error
+c_duckdb_v2_table_function_partitioning_get_partition_column_index =
+  hs_bindgen_e91aef7f35be59d7
+
+-- __unique:__ @Database_DuckDB_FFI_V2_Database.DuckDB.FFI.V2_Safe_duckdb_v2_table_function_partitioning_set_partition_info@
+foreign import ccall safe "hs_bindgen_ddea7fbd94a03432" hs_bindgen_ddea7fbd94a03432_base ::
+     BG.Ptr BG.Void
+  -> BG.CUInt
+  -> BG.Ptr BG.Void
+  -> IO BG.CUInt
+
+-- __unique:__ @Database_DuckDB_FFI_V2_Database.DuckDB.FFI.V2_Safe_duckdb_v2_table_function_partitioning_set_partition_info@
+hs_bindgen_ddea7fbd94a03432 ::
+     DuckDBV2TableFunctionPartitioningInfoHandle
+  -> DuckDBV2TablePartitionInfo
+  -> BG.Ptr DuckDBV2ErrorInfoHandle
+  -> IO DuckDBV2Error
+hs_bindgen_ddea7fbd94a03432 =
+  \x0 ->
+    \x1 ->
+      \x2 ->
+        fmap BG.fromFFIType (hs_bindgen_ddea7fbd94a03432_base (BG.toFFIType x0) (BG.toFFIType x1) (BG.toFFIType x2))
+
+{-| __C declaration:__ @duckdb_v2_table_function_partitioning_set_partition_info@
+
+    __defined at:__ @duckdb_v2.h 13881:30@
+
+    __exported by:__ @duckdb_v2.h@
+-}
+c_duckdb_v2_table_function_partitioning_set_partition_info ::
+     DuckDBV2TableFunctionPartitioningInfoHandle
+     -- ^ __C declaration:__ @info@
+  -> DuckDBV2TablePartitionInfo
+     -- ^ __C declaration:__ @partition_info@
+  -> BG.Ptr DuckDBV2ErrorInfoHandle
+     -- ^ __C declaration:__ @err@
+  -> IO DuckDBV2Error
+c_duckdb_v2_table_function_partitioning_set_partition_info =
+  hs_bindgen_ddea7fbd94a03432
+
+-- __unique:__ @Database_DuckDB_FFI_V2_Database.DuckDB.FFI.V2_Safe_duckdb_v2_connection_register_table_function@
+foreign import ccall safe "hs_bindgen_45822929a1ed3d54" hs_bindgen_45822929a1ed3d54_base ::
+     BG.Ptr BG.Void
+  -> BG.Ptr BG.Void
+  -> BG.Ptr BG.Void
+  -> IO BG.CUInt
+
+-- __unique:__ @Database_DuckDB_FFI_V2_Database.DuckDB.FFI.V2_Safe_duckdb_v2_connection_register_table_function@
+hs_bindgen_45822929a1ed3d54 ::
+     DuckDBV2ConnectionHandle
+  -> DuckDBV2TableFunctionHandle
+  -> BG.Ptr DuckDBV2ErrorInfoHandle
+  -> IO DuckDBV2Error
+hs_bindgen_45822929a1ed3d54 =
+  \x0 ->
+    \x1 ->
+      \x2 ->
+        fmap BG.fromFFIType (hs_bindgen_45822929a1ed3d54_base (BG.toFFIType x0) (BG.toFFIType x1) (BG.toFFIType x2))
+
+{-| __C declaration:__ @duckdb_v2_connection_register_table_function@
+
+    __defined at:__ @duckdb_v2.h 13907:30@
+
+    __exported by:__ @duckdb_v2.h@
+-}
+c_duckdb_v2_connection_register_table_function ::
+     DuckDBV2ConnectionHandle
+     -- ^ __C declaration:__ @conn@
+  -> DuckDBV2TableFunctionHandle
+     -- ^ __C declaration:__ @function@
+  -> BG.Ptr DuckDBV2ErrorInfoHandle
+     -- ^ __C declaration:__ @err@
+  -> IO DuckDBV2Error
+c_duckdb_v2_connection_register_table_function =
+  hs_bindgen_45822929a1ed3d54
+
+-- __unique:__ @Database_DuckDB_FFI_V2_Database.DuckDB.FFI.V2_Safe_duckdb_v2_extension_register_table_function@
+foreign import ccall safe "hs_bindgen_b68623d8964d2c4f" hs_bindgen_b68623d8964d2c4f_base ::
+     BG.Ptr BG.Void
+  -> BG.Ptr BG.Void
+  -> BG.Ptr BG.Void
+  -> IO BG.CUInt
+
+-- __unique:__ @Database_DuckDB_FFI_V2_Database.DuckDB.FFI.V2_Safe_duckdb_v2_extension_register_table_function@
+hs_bindgen_b68623d8964d2c4f ::
+     DuckDBV2ExtensionHandle
+  -> DuckDBV2TableFunctionHandle
+  -> BG.Ptr DuckDBV2ErrorInfoHandle
+  -> IO DuckDBV2Error
+hs_bindgen_b68623d8964d2c4f =
+  \x0 ->
+    \x1 ->
+      \x2 ->
+        fmap BG.fromFFIType (hs_bindgen_b68623d8964d2c4f_base (BG.toFFIType x0) (BG.toFFIType x1) (BG.toFFIType x2))
+
+{-| __C declaration:__ @duckdb_v2_extension_register_table_function@
+
+    __defined at:__ @duckdb_v2.h 13932:30@
+
+    __exported by:__ @duckdb_v2.h@
+-}
+c_duckdb_v2_extension_register_table_function ::
+     DuckDBV2ExtensionHandle
+     -- ^ __C declaration:__ @extension@
+  -> DuckDBV2TableFunctionHandle
+     -- ^ __C declaration:__ @function@
+  -> BG.Ptr DuckDBV2ErrorInfoHandle
+     -- ^ __C declaration:__ @err@
+  -> IO DuckDBV2Error
+c_duckdb_v2_extension_register_table_function =
+  hs_bindgen_b68623d8964d2c4f
+
+-- __unique:__ @Database_DuckDB_FFI_V2_Database.DuckDB.FFI.V2_Safe_duckdb_v2_table_function_destroy@
+foreign import ccall safe "hs_bindgen_0a6c6bcb445fe4dc" hs_bindgen_0a6c6bcb445fe4dc_base ::
+     BG.Ptr BG.Void
+  -> IO BG.CUInt
+
+-- __unique:__ @Database_DuckDB_FFI_V2_Database.DuckDB.FFI.V2_Safe_duckdb_v2_table_function_destroy@
+hs_bindgen_0a6c6bcb445fe4dc ::
+     BG.Ptr DuckDBV2TableFunctionHandle
+  -> IO DuckDBV2Error
+hs_bindgen_0a6c6bcb445fe4dc =
+  \x0 ->
+    fmap BG.fromFFIType (hs_bindgen_0a6c6bcb445fe4dc_base (BG.toFFIType x0))
+
+{-| __C declaration:__ @duckdb_v2_table_function_destroy@
+
+    __defined at:__ @duckdb_v2.h 13950:30@
+
+    __exported by:__ @duckdb_v2.h@
+-}
+c_duckdb_v2_table_function_destroy ::
+     BG.Ptr DuckDBV2TableFunctionHandle
+     -- ^ __C declaration:__ @function@
+  -> IO DuckDBV2Error
+c_duckdb_v2_table_function_destroy =
+  hs_bindgen_0a6c6bcb445fe4dc
+
+-- __unique:__ @Database_DuckDB_FFI_V2_Database.DuckDB.FFI.V2_Safe_duckdb_v2_table_function_set_claim_batch_callback@
+foreign import ccall safe "hs_bindgen_0b5a4324a94f3e1b" hs_bindgen_0b5a4324a94f3e1b_base ::
+     BG.Ptr BG.Void
+  -> BG.FunPtr BG.Void
+  -> BG.Ptr BG.Void
+  -> IO BG.CUInt
+
+-- __unique:__ @Database_DuckDB_FFI_V2_Database.DuckDB.FFI.V2_Safe_duckdb_v2_table_function_set_claim_batch_callback@
+hs_bindgen_0b5a4324a94f3e1b ::
+     DuckDBV2TableFunctionHandle
+  -> DuckDBV2TableFunctionClaimBatchCallbackFn
+  -> BG.Ptr DuckDBV2ErrorInfoHandle
+  -> IO DuckDBV2Error
+hs_bindgen_0b5a4324a94f3e1b =
+  \x0 ->
+    \x1 ->
+      \x2 ->
+        fmap BG.fromFFIType (hs_bindgen_0b5a4324a94f3e1b_base (BG.toFFIType x0) (BG.toFFIType x1) (BG.toFFIType x2))
+
+{-| __C declaration:__ @duckdb_v2_table_function_set_claim_batch_callback@
+
+    __defined at:__ @duckdb_v2.h 13982:30@
+
+    __exported by:__ @duckdb_v2.h@
+-}
+c_duckdb_v2_table_function_set_claim_batch_callback ::
+     DuckDBV2TableFunctionHandle
+     -- ^ __C declaration:__ @function@
+  -> DuckDBV2TableFunctionClaimBatchCallbackFn
+     -- ^ __C declaration:__ @callback@
+  -> BG.Ptr DuckDBV2ErrorInfoHandle
+     -- ^ __C declaration:__ @err@
+  -> IO DuckDBV2Error
+c_duckdb_v2_table_function_set_claim_batch_callback =
+  hs_bindgen_0b5a4324a94f3e1b
+
+-- __unique:__ @Database_DuckDB_FFI_V2_Database.DuckDB.FFI.V2_Safe_duckdb_v2_table_function_claim_batch_get_user_data@
+foreign import ccall safe "hs_bindgen_4ae88de2742a54ca" hs_bindgen_4ae88de2742a54ca_base ::
+     BG.Ptr BG.Void
+  -> BG.Ptr BG.Void
+  -> BG.Ptr BG.Void
+  -> IO BG.CUInt
+
+-- __unique:__ @Database_DuckDB_FFI_V2_Database.DuckDB.FFI.V2_Safe_duckdb_v2_table_function_claim_batch_get_user_data@
+hs_bindgen_4ae88de2742a54ca ::
+     DuckDBV2TableFunctionClaimBatchInfoHandle
+  -> BG.Ptr (BG.Ptr BG.Void)
+  -> BG.Ptr DuckDBV2ErrorInfoHandle
+  -> IO DuckDBV2Error
+hs_bindgen_4ae88de2742a54ca =
+  \x0 ->
+    \x1 ->
+      \x2 ->
+        fmap BG.fromFFIType (hs_bindgen_4ae88de2742a54ca_base (BG.toFFIType x0) (BG.toFFIType x1) (BG.toFFIType x2))
+
+{-| __C declaration:__ @duckdb_v2_table_function_claim_batch_get_user_data@
+
+    __defined at:__ @duckdb_v2.h 14000:30@
+
+    __exported by:__ @duckdb_v2.h@
+-}
+c_duckdb_v2_table_function_claim_batch_get_user_data ::
+     DuckDBV2TableFunctionClaimBatchInfoHandle
+     -- ^ __C declaration:__ @info@
+  -> BG.Ptr (BG.Ptr BG.Void)
+     -- ^ __C declaration:__ @data@
+  -> BG.Ptr DuckDBV2ErrorInfoHandle
+     -- ^ __C declaration:__ @err@
+  -> IO DuckDBV2Error
+c_duckdb_v2_table_function_claim_batch_get_user_data =
+  hs_bindgen_4ae88de2742a54ca
+
+-- __unique:__ @Database_DuckDB_FFI_V2_Database.DuckDB.FFI.V2_Safe_duckdb_v2_table_function_claim_batch_get_bind_data@
+foreign import ccall safe "hs_bindgen_bea3238755746cd7" hs_bindgen_bea3238755746cd7_base ::
+     BG.Ptr BG.Void
+  -> BG.Ptr BG.Void
+  -> BG.Ptr BG.Void
+  -> IO BG.CUInt
+
+-- __unique:__ @Database_DuckDB_FFI_V2_Database.DuckDB.FFI.V2_Safe_duckdb_v2_table_function_claim_batch_get_bind_data@
+hs_bindgen_bea3238755746cd7 ::
+     DuckDBV2TableFunctionClaimBatchInfoHandle
+  -> BG.Ptr (BG.Ptr BG.Void)
+  -> BG.Ptr DuckDBV2ErrorInfoHandle
+  -> IO DuckDBV2Error
+hs_bindgen_bea3238755746cd7 =
+  \x0 ->
+    \x1 ->
+      \x2 ->
+        fmap BG.fromFFIType (hs_bindgen_bea3238755746cd7_base (BG.toFFIType x0) (BG.toFFIType x1) (BG.toFFIType x2))
+
+{-| __C declaration:__ @duckdb_v2_table_function_claim_batch_get_bind_data@
+
+    __defined at:__ @duckdb_v2.h 14017:30@
+
+    __exported by:__ @duckdb_v2.h@
+-}
+c_duckdb_v2_table_function_claim_batch_get_bind_data ::
+     DuckDBV2TableFunctionClaimBatchInfoHandle
+     -- ^ __C declaration:__ @info@
+  -> BG.Ptr (BG.Ptr BG.Void)
+     -- ^ __C declaration:__ @data@
+  -> BG.Ptr DuckDBV2ErrorInfoHandle
+     -- ^ __C declaration:__ @err@
+  -> IO DuckDBV2Error
+c_duckdb_v2_table_function_claim_batch_get_bind_data =
+  hs_bindgen_bea3238755746cd7
+
+-- __unique:__ @Database_DuckDB_FFI_V2_Database.DuckDB.FFI.V2_Safe_duckdb_v2_table_function_claim_batch_get_global_state@
+foreign import ccall safe "hs_bindgen_76da5357e6653548" hs_bindgen_76da5357e6653548_base ::
+     BG.Ptr BG.Void
+  -> BG.Ptr BG.Void
+  -> BG.Ptr BG.Void
+  -> IO BG.CUInt
+
+-- __unique:__ @Database_DuckDB_FFI_V2_Database.DuckDB.FFI.V2_Safe_duckdb_v2_table_function_claim_batch_get_global_state@
+hs_bindgen_76da5357e6653548 ::
+     DuckDBV2TableFunctionClaimBatchInfoHandle
+  -> BG.Ptr (BG.Ptr BG.Void)
+  -> BG.Ptr DuckDBV2ErrorInfoHandle
+  -> IO DuckDBV2Error
+hs_bindgen_76da5357e6653548 =
+  \x0 ->
+    \x1 ->
+      \x2 ->
+        fmap BG.fromFFIType (hs_bindgen_76da5357e6653548_base (BG.toFFIType x0) (BG.toFFIType x1) (BG.toFFIType x2))
+
+{-| __C declaration:__ @duckdb_v2_table_function_claim_batch_get_global_state@
+
+    __defined at:__ @duckdb_v2.h 14036:30@
+
+    __exported by:__ @duckdb_v2.h@
+-}
+c_duckdb_v2_table_function_claim_batch_get_global_state ::
+     DuckDBV2TableFunctionClaimBatchInfoHandle
+     -- ^ __C declaration:__ @info@
+  -> BG.Ptr (BG.Ptr BG.Void)
+     -- ^ __C declaration:__ @data@
+  -> BG.Ptr DuckDBV2ErrorInfoHandle
+     -- ^ __C declaration:__ @err@
+  -> IO DuckDBV2Error
+c_duckdb_v2_table_function_claim_batch_get_global_state =
+  hs_bindgen_76da5357e6653548
+
+-- __unique:__ @Database_DuckDB_FFI_V2_Database.DuckDB.FFI.V2_Safe_duckdb_v2_table_function_claim_batch_get_local_state@
+foreign import ccall safe "hs_bindgen_2cbd79f8b6dc7864" hs_bindgen_2cbd79f8b6dc7864_base ::
+     BG.Ptr BG.Void
+  -> BG.Ptr BG.Void
+  -> BG.Ptr BG.Void
+  -> IO BG.CUInt
+
+-- __unique:__ @Database_DuckDB_FFI_V2_Database.DuckDB.FFI.V2_Safe_duckdb_v2_table_function_claim_batch_get_local_state@
+hs_bindgen_2cbd79f8b6dc7864 ::
+     DuckDBV2TableFunctionClaimBatchInfoHandle
+  -> BG.Ptr (BG.Ptr BG.Void)
+  -> BG.Ptr DuckDBV2ErrorInfoHandle
+  -> IO DuckDBV2Error
+hs_bindgen_2cbd79f8b6dc7864 =
+  \x0 ->
+    \x1 ->
+      \x2 ->
+        fmap BG.fromFFIType (hs_bindgen_2cbd79f8b6dc7864_base (BG.toFFIType x0) (BG.toFFIType x1) (BG.toFFIType x2))
+
+{-| __C declaration:__ @duckdb_v2_table_function_claim_batch_get_local_state@
+
+    __defined at:__ @duckdb_v2.h 14053:30@
+
+    __exported by:__ @duckdb_v2.h@
+-}
+c_duckdb_v2_table_function_claim_batch_get_local_state ::
+     DuckDBV2TableFunctionClaimBatchInfoHandle
+     -- ^ __C declaration:__ @info@
+  -> BG.Ptr (BG.Ptr BG.Void)
+     -- ^ __C declaration:__ @data@
+  -> BG.Ptr DuckDBV2ErrorInfoHandle
+     -- ^ __C declaration:__ @err@
+  -> IO DuckDBV2Error
+c_duckdb_v2_table_function_claim_batch_get_local_state =
+  hs_bindgen_2cbd79f8b6dc7864
+
+-- __unique:__ @Database_DuckDB_FFI_V2_Database.DuckDB.FFI.V2_Safe_duckdb_v2_table_function_claim_batch_set_claimed@
+foreign import ccall safe "hs_bindgen_1d6ee8a1f8df1725" hs_bindgen_1d6ee8a1f8df1725_base ::
+     BG.Ptr BG.Void
+  -> BG.CBool
+  -> BG.Ptr BG.Void
+  -> IO BG.CUInt
+
+-- __unique:__ @Database_DuckDB_FFI_V2_Database.DuckDB.FFI.V2_Safe_duckdb_v2_table_function_claim_batch_set_claimed@
+hs_bindgen_1d6ee8a1f8df1725 ::
+     DuckDBV2TableFunctionClaimBatchInfoHandle
+  -> BG.CBool
+  -> BG.Ptr DuckDBV2ErrorInfoHandle
+  -> IO DuckDBV2Error
+hs_bindgen_1d6ee8a1f8df1725 =
+  \x0 ->
+    \x1 ->
+      \x2 ->
+        fmap BG.fromFFIType (hs_bindgen_1d6ee8a1f8df1725_base (BG.toFFIType x0) (BG.toFFIType x1) (BG.toFFIType x2))
+
+{-| __C declaration:__ @duckdb_v2_table_function_claim_batch_set_claimed@
+
+    __defined at:__ @duckdb_v2.h 14072:30@
+
+    __exported by:__ @duckdb_v2.h@
+-}
+c_duckdb_v2_table_function_claim_batch_set_claimed ::
+     DuckDBV2TableFunctionClaimBatchInfoHandle
+     -- ^ __C declaration:__ @info@
+  -> BG.CBool
+     -- ^ __C declaration:__ @claimed@
+  -> BG.Ptr DuckDBV2ErrorInfoHandle
+     -- ^ __C declaration:__ @err@
+  -> IO DuckDBV2Error
+c_duckdb_v2_table_function_claim_batch_set_claimed =
+  hs_bindgen_1d6ee8a1f8df1725
+
+-- __unique:__ @Database_DuckDB_FFI_V2_Database.DuckDB.FFI.V2_Safe_duckdb_v2_table_function_set_get_bind_info_callback@
+foreign import ccall safe "hs_bindgen_49f8f9ef6c5c2c3d" hs_bindgen_49f8f9ef6c5c2c3d_base ::
+     BG.Ptr BG.Void
+  -> BG.FunPtr BG.Void
+  -> BG.Ptr BG.Void
+  -> IO BG.CUInt
+
+-- __unique:__ @Database_DuckDB_FFI_V2_Database.DuckDB.FFI.V2_Safe_duckdb_v2_table_function_set_get_bind_info_callback@
+hs_bindgen_49f8f9ef6c5c2c3d ::
+     DuckDBV2TableFunctionHandle
+  -> DuckDBV2TableFunctionGetBindInfoCallbackFn
+  -> BG.Ptr DuckDBV2ErrorInfoHandle
+  -> IO DuckDBV2Error
+hs_bindgen_49f8f9ef6c5c2c3d =
+  \x0 ->
+    \x1 ->
+      \x2 ->
+        fmap BG.fromFFIType (hs_bindgen_49f8f9ef6c5c2c3d_base (BG.toFFIType x0) (BG.toFFIType x1) (BG.toFFIType x2))
+
+{-| __C declaration:__ @duckdb_v2_table_function_set_get_bind_info_callback@
+
+    __defined at:__ @duckdb_v2.h 14096:30@
+
+    __exported by:__ @duckdb_v2.h@
+-}
+c_duckdb_v2_table_function_set_get_bind_info_callback ::
+     DuckDBV2TableFunctionHandle
+     -- ^ __C declaration:__ @function@
+  -> DuckDBV2TableFunctionGetBindInfoCallbackFn
+     -- ^ __C declaration:__ @callback@
+  -> BG.Ptr DuckDBV2ErrorInfoHandle
+     -- ^ __C declaration:__ @err@
+  -> IO DuckDBV2Error
+c_duckdb_v2_table_function_set_get_bind_info_callback =
+  hs_bindgen_49f8f9ef6c5c2c3d
+
+-- __unique:__ @Database_DuckDB_FFI_V2_Database.DuckDB.FFI.V2_Safe_duckdb_v2_table_function_get_bind_info_get_user_data@
+foreign import ccall safe "hs_bindgen_a6ea2965714f798a" hs_bindgen_a6ea2965714f798a_base ::
+     BG.Ptr BG.Void
+  -> BG.Ptr BG.Void
+  -> BG.Ptr BG.Void
+  -> IO BG.CUInt
+
+-- __unique:__ @Database_DuckDB_FFI_V2_Database.DuckDB.FFI.V2_Safe_duckdb_v2_table_function_get_bind_info_get_user_data@
+hs_bindgen_a6ea2965714f798a ::
+     DuckDBV2TableFunctionGetBindInfoInfoHandle
+  -> BG.Ptr (BG.Ptr BG.Void)
+  -> BG.Ptr DuckDBV2ErrorInfoHandle
+  -> IO DuckDBV2Error
+hs_bindgen_a6ea2965714f798a =
+  \x0 ->
+    \x1 ->
+      \x2 ->
+        fmap BG.fromFFIType (hs_bindgen_a6ea2965714f798a_base (BG.toFFIType x0) (BG.toFFIType x1) (BG.toFFIType x2))
+
+{-| __C declaration:__ @duckdb_v2_table_function_get_bind_info_get_user_data@
+
+    __defined at:__ @duckdb_v2.h 14114:30@
+
+    __exported by:__ @duckdb_v2.h@
+-}
+c_duckdb_v2_table_function_get_bind_info_get_user_data ::
+     DuckDBV2TableFunctionGetBindInfoInfoHandle
+     -- ^ __C declaration:__ @info@
+  -> BG.Ptr (BG.Ptr BG.Void)
+     -- ^ __C declaration:__ @data@
+  -> BG.Ptr DuckDBV2ErrorInfoHandle
+     -- ^ __C declaration:__ @err@
+  -> IO DuckDBV2Error
+c_duckdb_v2_table_function_get_bind_info_get_user_data =
+  hs_bindgen_a6ea2965714f798a
+
+-- __unique:__ @Database_DuckDB_FFI_V2_Database.DuckDB.FFI.V2_Safe_duckdb_v2_table_function_get_bind_info_get_bind_data@
+foreign import ccall safe "hs_bindgen_0dfe9d7889b3679f" hs_bindgen_0dfe9d7889b3679f_base ::
+     BG.Ptr BG.Void
+  -> BG.Ptr BG.Void
+  -> BG.Ptr BG.Void
+  -> IO BG.CUInt
+
+-- __unique:__ @Database_DuckDB_FFI_V2_Database.DuckDB.FFI.V2_Safe_duckdb_v2_table_function_get_bind_info_get_bind_data@
+hs_bindgen_0dfe9d7889b3679f ::
+     DuckDBV2TableFunctionGetBindInfoInfoHandle
+  -> BG.Ptr (BG.Ptr BG.Void)
+  -> BG.Ptr DuckDBV2ErrorInfoHandle
+  -> IO DuckDBV2Error
+hs_bindgen_0dfe9d7889b3679f =
+  \x0 ->
+    \x1 ->
+      \x2 ->
+        fmap BG.fromFFIType (hs_bindgen_0dfe9d7889b3679f_base (BG.toFFIType x0) (BG.toFFIType x1) (BG.toFFIType x2))
+
+{-| __C declaration:__ @duckdb_v2_table_function_get_bind_info_get_bind_data@
+
+    __defined at:__ @duckdb_v2.h 14131:30@
+
+    __exported by:__ @duckdb_v2.h@
+-}
+c_duckdb_v2_table_function_get_bind_info_get_bind_data ::
+     DuckDBV2TableFunctionGetBindInfoInfoHandle
+     -- ^ __C declaration:__ @info@
+  -> BG.Ptr (BG.Ptr BG.Void)
+     -- ^ __C declaration:__ @data@
+  -> BG.Ptr DuckDBV2ErrorInfoHandle
+     -- ^ __C declaration:__ @err@
+  -> IO DuckDBV2Error
+c_duckdb_v2_table_function_get_bind_info_get_bind_data =
+  hs_bindgen_0dfe9d7889b3679f
+
+-- __unique:__ @Database_DuckDB_FFI_V2_Database.DuckDB.FFI.V2_Safe_duckdb_v2_table_function_get_bind_info_set_column_identifier@
+foreign import ccall safe "hs_bindgen_74f97126d16d1ace" hs_bindgen_74f97126d16d1ace_base ::
+     BG.Ptr BG.Void
+  -> HsBindgen.Runtime.LibC.Word64
+  -> BG.Ptr BG.Void
+  -> HsBindgen.Runtime.LibC.Word64
+  -> BG.Ptr BG.Void
+  -> BG.Ptr BG.Void
+  -> IO BG.CUInt
+
+-- __unique:__ @Database_DuckDB_FFI_V2_Database.DuckDB.FFI.V2_Safe_duckdb_v2_table_function_get_bind_info_set_column_identifier@
+hs_bindgen_74f97126d16d1ace ::
+     DuckDBV2TableFunctionGetBindInfoInfoHandle
+  -> DuckDBIdx
+  -> PtrConst.PtrConst DuckDBIdx
+  -> DuckDBIdx
+  -> DuckDBV2ValueHandle
+  -> BG.Ptr DuckDBV2ErrorInfoHandle
+  -> IO DuckDBV2Error
+hs_bindgen_74f97126d16d1ace =
+  \x0 ->
+    \x1 ->
+      \x2 ->
+        \x3 ->
+          \x4 ->
+            \x5 ->
+              fmap BG.fromFFIType (hs_bindgen_74f97126d16d1ace_base (BG.toFFIType x0) (BG.toFFIType x1) (BG.toFFIType x2) (BG.toFFIType x3) (BG.toFFIType x4) (BG.toFFIType x5))
+
+{-| __C declaration:__ @duckdb_v2_table_function_get_bind_info_set_column_identifier@
+
+    __defined at:__ @duckdb_v2.h 14161:30@
+
+    __exported by:__ @duckdb_v2.h@
+-}
+c_duckdb_v2_table_function_get_bind_info_set_column_identifier ::
+     DuckDBV2TableFunctionGetBindInfoInfoHandle
+     -- ^ __C declaration:__ @info@
+  -> DuckDBIdx
+     -- ^ __C declaration:__ @column_index@
+  -> PtrConst.PtrConst DuckDBIdx
+     -- ^ __C declaration:__ @child_path@
+  -> DuckDBIdx
+     -- ^ __C declaration:__ @child_path_length@
+  -> DuckDBV2ValueHandle
+     -- ^ __C declaration:__ @identifier@
+  -> BG.Ptr DuckDBV2ErrorInfoHandle
+     -- ^ __C declaration:__ @err@
+  -> IO DuckDBV2Error
+c_duckdb_v2_table_function_get_bind_info_set_column_identifier =
+  hs_bindgen_74f97126d16d1ace
+
+-- __unique:__ @Database_DuckDB_FFI_V2_Database.DuckDB.FFI.V2_Safe_duckdb_v2_table_function_get_bind_info_set_option@
+foreign import ccall safe "hs_bindgen_213e2fcdcc617c2b" hs_bindgen_213e2fcdcc617c2b_base ::
+     BG.Ptr BG.Void
+  -> BG.Ptr BG.Void
+  -> BG.Ptr BG.Void
+  -> BG.Ptr BG.Void
+  -> IO BG.CUInt
+
+-- __unique:__ @Database_DuckDB_FFI_V2_Database.DuckDB.FFI.V2_Safe_duckdb_v2_table_function_get_bind_info_set_option@
+hs_bindgen_213e2fcdcc617c2b ::
+     DuckDBV2TableFunctionGetBindInfoInfoHandle
+  -> BG.Ptr DuckDBV2Str
+  -> DuckDBV2ValueHandle
+  -> BG.Ptr DuckDBV2ErrorInfoHandle
+  -> IO DuckDBV2Error
+hs_bindgen_213e2fcdcc617c2b =
+  \x0 ->
+    \x1 ->
+      \x2 ->
+        \x3 ->
+          fmap BG.fromFFIType (hs_bindgen_213e2fcdcc617c2b_base (BG.toFFIType x0) (BG.toFFIType x1) (BG.toFFIType x2) (BG.toFFIType x3))
+
+{-| __C declaration:__ @duckdb_v2_table_function_get_bind_info_set_option@
+
+    __defined at:__ @duckdb_v2.h 14185:30@
+
+    __exported by:__ @duckdb_v2.h@
+-}
+c_duckdb_v2_table_function_get_bind_info_set_option ::
+     DuckDBV2TableFunctionGetBindInfoInfoHandle
+     -- ^ __C declaration:__ @info@
+  -> BG.Ptr DuckDBV2Str
+     -- ^ __C declaration:__ @key@
+  -> DuckDBV2ValueHandle
+     -- ^ __C declaration:__ @value@
+  -> BG.Ptr DuckDBV2ErrorInfoHandle
+     -- ^ __C declaration:__ @err@
+  -> IO DuckDBV2Error
+c_duckdb_v2_table_function_get_bind_info_set_option =
+  hs_bindgen_213e2fcdcc617c2b
+
+-- __unique:__ @Database_DuckDB_FFI_V2_Database.DuckDB.FFI.V2_Safe_duckdb_v2_multi_file_function_create@
+foreign import ccall safe "hs_bindgen_76350e2af97981c0" hs_bindgen_76350e2af97981c0_base ::
+     BG.Ptr BG.Void
+  -> BG.Ptr BG.Void
+  -> BG.Ptr BG.Void
+  -> IO BG.CUInt
+
+-- __unique:__ @Database_DuckDB_FFI_V2_Database.DuckDB.FFI.V2_Safe_duckdb_v2_multi_file_function_create@
+hs_bindgen_76350e2af97981c0 ::
+     DuckDBV2FactoryHandle
+  -> BG.Ptr DuckDBV2MultiFileFunctionHandle
+  -> BG.Ptr DuckDBV2ErrorInfoHandle
+  -> IO DuckDBV2Error
+hs_bindgen_76350e2af97981c0 =
+  \x0 ->
+    \x1 ->
+      \x2 ->
+        fmap BG.fromFFIType (hs_bindgen_76350e2af97981c0_base (BG.toFFIType x0) (BG.toFFIType x1) (BG.toFFIType x2))
+
+{-| __C declaration:__ @duckdb_v2_multi_file_function_create@
+
+    __defined at:__ @duckdb_v2.h 14211:30@
+
+    __exported by:__ @duckdb_v2.h@
+-}
+c_duckdb_v2_multi_file_function_create ::
+     DuckDBV2FactoryHandle
+     -- ^ __C declaration:__ @factory@
+  -> BG.Ptr DuckDBV2MultiFileFunctionHandle
+     -- ^ __C declaration:__ @function@
+  -> BG.Ptr DuckDBV2ErrorInfoHandle
+     -- ^ __C declaration:__ @err@
+  -> IO DuckDBV2Error
+c_duckdb_v2_multi_file_function_create =
+  hs_bindgen_76350e2af97981c0
+
+-- __unique:__ @Database_DuckDB_FFI_V2_Database.DuckDB.FFI.V2_Safe_duckdb_v2_multi_file_function_set_name@
+foreign import ccall safe "hs_bindgen_3114331ea8c67f69" hs_bindgen_3114331ea8c67f69_base ::
+     BG.Ptr BG.Void
+  -> BG.Ptr BG.Void
+  -> BG.Ptr BG.Void
+  -> IO BG.CUInt
+
+-- __unique:__ @Database_DuckDB_FFI_V2_Database.DuckDB.FFI.V2_Safe_duckdb_v2_multi_file_function_set_name@
+hs_bindgen_3114331ea8c67f69 ::
+     DuckDBV2MultiFileFunctionHandle
+  -> BG.Ptr DuckDBV2Str
+  -> BG.Ptr DuckDBV2ErrorInfoHandle
+  -> IO DuckDBV2Error
+hs_bindgen_3114331ea8c67f69 =
+  \x0 ->
+    \x1 ->
+      \x2 ->
+        fmap BG.fromFFIType (hs_bindgen_3114331ea8c67f69_base (BG.toFFIType x0) (BG.toFFIType x1) (BG.toFFIType x2))
+
+{-| __C declaration:__ @duckdb_v2_multi_file_function_set_name@
+
+    __defined at:__ @duckdb_v2.h 14232:30@
+
+    __exported by:__ @duckdb_v2.h@
+-}
+c_duckdb_v2_multi_file_function_set_name ::
+     DuckDBV2MultiFileFunctionHandle
+     -- ^ __C declaration:__ @function@
+  -> BG.Ptr DuckDBV2Str
+     -- ^ __C declaration:__ @name@
+  -> BG.Ptr DuckDBV2ErrorInfoHandle
+     -- ^ __C declaration:__ @err@
+  -> IO DuckDBV2Error
+c_duckdb_v2_multi_file_function_set_name =
+  hs_bindgen_3114331ea8c67f69
+
+-- __unique:__ @Database_DuckDB_FFI_V2_Database.DuckDB.FFI.V2_Safe_duckdb_v2_multi_file_function_set_single_file_function@
+foreign import ccall safe "hs_bindgen_93bfff0d12987d3d" hs_bindgen_93bfff0d12987d3d_base ::
+     BG.Ptr BG.Void
+  -> BG.Ptr BG.Void
+  -> BG.Ptr BG.Void
+  -> IO BG.CUInt
+
+-- __unique:__ @Database_DuckDB_FFI_V2_Database.DuckDB.FFI.V2_Safe_duckdb_v2_multi_file_function_set_single_file_function@
+hs_bindgen_93bfff0d12987d3d ::
+     DuckDBV2MultiFileFunctionHandle
+  -> BG.Ptr DuckDBV2Str
+  -> BG.Ptr DuckDBV2ErrorInfoHandle
+  -> IO DuckDBV2Error
+hs_bindgen_93bfff0d12987d3d =
+  \x0 ->
+    \x1 ->
+      \x2 ->
+        fmap BG.fromFFIType (hs_bindgen_93bfff0d12987d3d_base (BG.toFFIType x0) (BG.toFFIType x1) (BG.toFFIType x2))
+
+{-| __C declaration:__ @duckdb_v2_multi_file_function_set_single_file_function@
+
+    __defined at:__ @duckdb_v2.h 14264:30@
+
+    __exported by:__ @duckdb_v2.h@
+-}
+c_duckdb_v2_multi_file_function_set_single_file_function ::
+     DuckDBV2MultiFileFunctionHandle
+     -- ^ __C declaration:__ @function@
+  -> BG.Ptr DuckDBV2Str
+     -- ^ __C declaration:__ @name@
+  -> BG.Ptr DuckDBV2ErrorInfoHandle
+     -- ^ __C declaration:__ @err@
+  -> IO DuckDBV2Error
+c_duckdb_v2_multi_file_function_set_single_file_function =
+  hs_bindgen_93bfff0d12987d3d
+
+-- __unique:__ @Database_DuckDB_FFI_V2_Database.DuckDB.FFI.V2_Safe_duckdb_v2_multi_file_function_set_reader_type@
+foreign import ccall safe "hs_bindgen_bc3af1f9a2f89979" hs_bindgen_bc3af1f9a2f89979_base ::
+     BG.Ptr BG.Void
+  -> BG.Ptr BG.Void
+  -> BG.Ptr BG.Void
+  -> IO BG.CUInt
+
+-- __unique:__ @Database_DuckDB_FFI_V2_Database.DuckDB.FFI.V2_Safe_duckdb_v2_multi_file_function_set_reader_type@
+hs_bindgen_bc3af1f9a2f89979 ::
+     DuckDBV2MultiFileFunctionHandle
+  -> BG.Ptr DuckDBV2Str
+  -> BG.Ptr DuckDBV2ErrorInfoHandle
+  -> IO DuckDBV2Error
+hs_bindgen_bc3af1f9a2f89979 =
+  \x0 ->
+    \x1 ->
+      \x2 ->
+        fmap BG.fromFFIType (hs_bindgen_bc3af1f9a2f89979_base (BG.toFFIType x0) (BG.toFFIType x1) (BG.toFFIType x2))
+
+{-| __C declaration:__ @duckdb_v2_multi_file_function_set_reader_type@
+
+    __defined at:__ @duckdb_v2.h 14284:30@
+
+    __exported by:__ @duckdb_v2.h@
+-}
+c_duckdb_v2_multi_file_function_set_reader_type ::
+     DuckDBV2MultiFileFunctionHandle
+     -- ^ __C declaration:__ @function@
+  -> BG.Ptr DuckDBV2Str
+     -- ^ __C declaration:__ @reader_type@
+  -> BG.Ptr DuckDBV2ErrorInfoHandle
+     -- ^ __C declaration:__ @err@
+  -> IO DuckDBV2Error
+c_duckdb_v2_multi_file_function_set_reader_type =
+  hs_bindgen_bc3af1f9a2f89979
+
+-- __unique:__ @Database_DuckDB_FFI_V2_Database.DuckDB.FFI.V2_Safe_duckdb_v2_multi_file_function_set_file_extension@
+foreign import ccall safe "hs_bindgen_15e91fdbb9b0ffcc" hs_bindgen_15e91fdbb9b0ffcc_base ::
+     BG.Ptr BG.Void
+  -> BG.Ptr BG.Void
+  -> BG.Ptr BG.Void
+  -> IO BG.CUInt
+
+-- __unique:__ @Database_DuckDB_FFI_V2_Database.DuckDB.FFI.V2_Safe_duckdb_v2_multi_file_function_set_file_extension@
+hs_bindgen_15e91fdbb9b0ffcc ::
+     DuckDBV2MultiFileFunctionHandle
+  -> BG.Ptr DuckDBV2Str
+  -> BG.Ptr DuckDBV2ErrorInfoHandle
+  -> IO DuckDBV2Error
+hs_bindgen_15e91fdbb9b0ffcc =
+  \x0 ->
+    \x1 ->
+      \x2 ->
+        fmap BG.fromFFIType (hs_bindgen_15e91fdbb9b0ffcc_base (BG.toFFIType x0) (BG.toFFIType x1) (BG.toFFIType x2))
+
+{-| __C declaration:__ @duckdb_v2_multi_file_function_set_file_extension@
+
+    __defined at:__ @duckdb_v2.h 14305:30@
+
+    __exported by:__ @duckdb_v2.h@
+-}
+c_duckdb_v2_multi_file_function_set_file_extension ::
+     DuckDBV2MultiFileFunctionHandle
+     -- ^ __C declaration:__ @function@
+  -> BG.Ptr DuckDBV2Str
+     -- ^ __C declaration:__ @extension@
+  -> BG.Ptr DuckDBV2ErrorInfoHandle
+     -- ^ __C declaration:__ @err@
+  -> IO DuckDBV2Error
+c_duckdb_v2_multi_file_function_set_file_extension =
+  hs_bindgen_15e91fdbb9b0ffcc
+
+-- __unique:__ @Database_DuckDB_FFI_V2_Database.DuckDB.FFI.V2_Safe_duckdb_v2_connection_register_multi_file_function@
+foreign import ccall safe "hs_bindgen_bbc5afea7eae54a3" hs_bindgen_bbc5afea7eae54a3_base ::
+     BG.Ptr BG.Void
+  -> BG.Ptr BG.Void
+  -> BG.Ptr BG.Void
+  -> IO BG.CUInt
+
+-- __unique:__ @Database_DuckDB_FFI_V2_Database.DuckDB.FFI.V2_Safe_duckdb_v2_connection_register_multi_file_function@
+hs_bindgen_bbc5afea7eae54a3 ::
+     DuckDBV2ConnectionHandle
+  -> DuckDBV2MultiFileFunctionHandle
+  -> BG.Ptr DuckDBV2ErrorInfoHandle
+  -> IO DuckDBV2Error
+hs_bindgen_bbc5afea7eae54a3 =
+  \x0 ->
+    \x1 ->
+      \x2 ->
+        fmap BG.fromFFIType (hs_bindgen_bbc5afea7eae54a3_base (BG.toFFIType x0) (BG.toFFIType x1) (BG.toFFIType x2))
+
+{-| __C declaration:__ @duckdb_v2_connection_register_multi_file_function@
+
+    __defined at:__ @duckdb_v2.h 14332:30@
+
+    __exported by:__ @duckdb_v2.h@
+-}
+c_duckdb_v2_connection_register_multi_file_function ::
+     DuckDBV2ConnectionHandle
+     -- ^ __C declaration:__ @conn@
+  -> DuckDBV2MultiFileFunctionHandle
+     -- ^ __C declaration:__ @function@
+  -> BG.Ptr DuckDBV2ErrorInfoHandle
+     -- ^ __C declaration:__ @err@
+  -> IO DuckDBV2Error
+c_duckdb_v2_connection_register_multi_file_function =
+  hs_bindgen_bbc5afea7eae54a3
+
+-- __unique:__ @Database_DuckDB_FFI_V2_Database.DuckDB.FFI.V2_Safe_duckdb_v2_extension_register_multi_file_function@
+foreign import ccall safe "hs_bindgen_9f30b7fefa852dca" hs_bindgen_9f30b7fefa852dca_base ::
+     BG.Ptr BG.Void
+  -> BG.Ptr BG.Void
+  -> BG.Ptr BG.Void
+  -> IO BG.CUInt
+
+-- __unique:__ @Database_DuckDB_FFI_V2_Database.DuckDB.FFI.V2_Safe_duckdb_v2_extension_register_multi_file_function@
+hs_bindgen_9f30b7fefa852dca ::
+     DuckDBV2ExtensionHandle
+  -> DuckDBV2MultiFileFunctionHandle
+  -> BG.Ptr DuckDBV2ErrorInfoHandle
+  -> IO DuckDBV2Error
+hs_bindgen_9f30b7fefa852dca =
+  \x0 ->
+    \x1 ->
+      \x2 ->
+        fmap BG.fromFFIType (hs_bindgen_9f30b7fefa852dca_base (BG.toFFIType x0) (BG.toFFIType x1) (BG.toFFIType x2))
+
+{-| __C declaration:__ @duckdb_v2_extension_register_multi_file_function@
+
+    __defined at:__ @duckdb_v2.h 14358:30@
+
+    __exported by:__ @duckdb_v2.h@
+-}
+c_duckdb_v2_extension_register_multi_file_function ::
+     DuckDBV2ExtensionHandle
+     -- ^ __C declaration:__ @extension@
+  -> DuckDBV2MultiFileFunctionHandle
+     -- ^ __C declaration:__ @function@
+  -> BG.Ptr DuckDBV2ErrorInfoHandle
+     -- ^ __C declaration:__ @err@
+  -> IO DuckDBV2Error
+c_duckdb_v2_extension_register_multi_file_function =
+  hs_bindgen_9f30b7fefa852dca
+
+-- __unique:__ @Database_DuckDB_FFI_V2_Database.DuckDB.FFI.V2_Safe_duckdb_v2_multi_file_function_destroy@
+foreign import ccall safe "hs_bindgen_3828911399bdcc87" hs_bindgen_3828911399bdcc87_base ::
+     BG.Ptr BG.Void
+  -> IO BG.CUInt
+
+-- __unique:__ @Database_DuckDB_FFI_V2_Database.DuckDB.FFI.V2_Safe_duckdb_v2_multi_file_function_destroy@
+hs_bindgen_3828911399bdcc87 ::
+     BG.Ptr DuckDBV2MultiFileFunctionHandle
+  -> IO DuckDBV2Error
+hs_bindgen_3828911399bdcc87 =
+  \x0 ->
+    fmap BG.fromFFIType (hs_bindgen_3828911399bdcc87_base (BG.toFFIType x0))
+
+{-| __C declaration:__ @duckdb_v2_multi_file_function_destroy@
+
+    __defined at:__ @duckdb_v2.h 14376:30@
+
+    __exported by:__ @duckdb_v2.h@
+-}
+c_duckdb_v2_multi_file_function_destroy ::
+     BG.Ptr DuckDBV2MultiFileFunctionHandle
+     -- ^ __C declaration:__ @function@
+  -> IO DuckDBV2Error
+c_duckdb_v2_multi_file_function_destroy =
+  hs_bindgen_3828911399bdcc87
+
+-- __unique:__ @Database_DuckDB_FFI_V2_Database.DuckDB.FFI.V2_Safe_duckdb_v2_value_destroy@
+foreign import ccall safe "hs_bindgen_05ac09c9be5a4021" hs_bindgen_05ac09c9be5a4021_base ::
+     BG.Ptr BG.Void
+  -> IO BG.CUInt
+
+-- __unique:__ @Database_DuckDB_FFI_V2_Database.DuckDB.FFI.V2_Safe_duckdb_v2_value_destroy@
+hs_bindgen_05ac09c9be5a4021 ::
+     BG.Ptr DuckDBV2ValueHandle
+  -> IO DuckDBV2Error
+hs_bindgen_05ac09c9be5a4021 =
+  \x0 ->
+    fmap BG.fromFFIType (hs_bindgen_05ac09c9be5a4021_base (BG.toFFIType x0))
+
+{-| __C declaration:__ @duckdb_v2_value_destroy@
+
+    __defined at:__ @duckdb_v2.h 14409:30@
+
+    __exported by:__ @duckdb_v2.h@
+-}
+c_duckdb_v2_value_destroy ::
+     BG.Ptr DuckDBV2ValueHandle
+     -- ^ __C declaration:__ @value@
+  -> IO DuckDBV2Error
+c_duckdb_v2_value_destroy =
+  hs_bindgen_05ac09c9be5a4021
+
+-- __unique:__ @Database_DuckDB_FFI_V2_Database.DuckDB.FFI.V2_Safe_duckdb_v2_value_get_bool@
+foreign import ccall safe "hs_bindgen_39756f700939b775" hs_bindgen_39756f700939b775_base ::
+     BG.Ptr BG.Void
+  -> BG.Ptr BG.Void
+  -> BG.Ptr BG.Void
+  -> IO BG.CUInt
+
+-- __unique:__ @Database_DuckDB_FFI_V2_Database.DuckDB.FFI.V2_Safe_duckdb_v2_value_get_bool@
+hs_bindgen_39756f700939b775 ::
+     DuckDBV2ValueHandle
+  -> BG.Ptr BG.CBool
+  -> BG.Ptr DuckDBV2ErrorInfoHandle
+  -> IO DuckDBV2Error
+hs_bindgen_39756f700939b775 =
+  \x0 ->
+    \x1 ->
+      \x2 ->
+        fmap BG.fromFFIType (hs_bindgen_39756f700939b775_base (BG.toFFIType x0) (BG.toFFIType x1) (BG.toFFIType x2))
+
+{-| __C declaration:__ @duckdb_v2_value_get_bool@
+
+    __defined at:__ @duckdb_v2.h 14427:30@
+
+    __exported by:__ @duckdb_v2.h@
+-}
+c_duckdb_v2_value_get_bool ::
+     DuckDBV2ValueHandle
+     -- ^ __C declaration:__ @value@
+  -> BG.Ptr BG.CBool
+     -- ^ __C declaration:__ @out@
+  -> BG.Ptr DuckDBV2ErrorInfoHandle
+     -- ^ __C declaration:__ @err@
+  -> IO DuckDBV2Error
+c_duckdb_v2_value_get_bool =
+  hs_bindgen_39756f700939b775
+
+-- __unique:__ @Database_DuckDB_FFI_V2_Database.DuckDB.FFI.V2_Safe_duckdb_v2_value_get_utinyint@
+foreign import ccall safe "hs_bindgen_c766e44b55c10466" hs_bindgen_c766e44b55c10466_base ::
+     BG.Ptr BG.Void
+  -> BG.Ptr BG.Void
+  -> BG.Ptr BG.Void
+  -> IO BG.CUInt
+
+-- __unique:__ @Database_DuckDB_FFI_V2_Database.DuckDB.FFI.V2_Safe_duckdb_v2_value_get_utinyint@
+hs_bindgen_c766e44b55c10466 ::
+     DuckDBV2ValueHandle
+  -> BG.Ptr HsBindgen.Runtime.LibC.Word8
+  -> BG.Ptr DuckDBV2ErrorInfoHandle
+  -> IO DuckDBV2Error
+hs_bindgen_c766e44b55c10466 =
+  \x0 ->
+    \x1 ->
+      \x2 ->
+        fmap BG.fromFFIType (hs_bindgen_c766e44b55c10466_base (BG.toFFIType x0) (BG.toFFIType x1) (BG.toFFIType x2))
+
+{-| __C declaration:__ @duckdb_v2_value_get_utinyint@
+
+    __defined at:__ @duckdb_v2.h 14446:30@
+
+    __exported by:__ @duckdb_v2.h@
+-}
+c_duckdb_v2_value_get_utinyint ::
+     DuckDBV2ValueHandle
+     -- ^ __C declaration:__ @value@
+  -> BG.Ptr HsBindgen.Runtime.LibC.Word8
+     -- ^ __C declaration:__ @out@
+  -> BG.Ptr DuckDBV2ErrorInfoHandle
+     -- ^ __C declaration:__ @err@
+  -> IO DuckDBV2Error
+c_duckdb_v2_value_get_utinyint =
+  hs_bindgen_c766e44b55c10466
+
+-- __unique:__ @Database_DuckDB_FFI_V2_Database.DuckDB.FFI.V2_Safe_duckdb_v2_value_get_usmallint@
+foreign import ccall safe "hs_bindgen_c2c8be9c47379447" hs_bindgen_c2c8be9c47379447_base ::
+     BG.Ptr BG.Void
+  -> BG.Ptr BG.Void
+  -> BG.Ptr BG.Void
+  -> IO BG.CUInt
+
+-- __unique:__ @Database_DuckDB_FFI_V2_Database.DuckDB.FFI.V2_Safe_duckdb_v2_value_get_usmallint@
+hs_bindgen_c2c8be9c47379447 ::
+     DuckDBV2ValueHandle
+  -> BG.Ptr HsBindgen.Runtime.LibC.Word16
+  -> BG.Ptr DuckDBV2ErrorInfoHandle
+  -> IO DuckDBV2Error
+hs_bindgen_c2c8be9c47379447 =
+  \x0 ->
+    \x1 ->
+      \x2 ->
+        fmap BG.fromFFIType (hs_bindgen_c2c8be9c47379447_base (BG.toFFIType x0) (BG.toFFIType x1) (BG.toFFIType x2))
+
+{-| __C declaration:__ @duckdb_v2_value_get_usmallint@
+
+    __defined at:__ @duckdb_v2.h 14465:30@
+
+    __exported by:__ @duckdb_v2.h@
+-}
+c_duckdb_v2_value_get_usmallint ::
+     DuckDBV2ValueHandle
+     -- ^ __C declaration:__ @value@
+  -> BG.Ptr HsBindgen.Runtime.LibC.Word16
+     -- ^ __C declaration:__ @out@
+  -> BG.Ptr DuckDBV2ErrorInfoHandle
+     -- ^ __C declaration:__ @err@
+  -> IO DuckDBV2Error
+c_duckdb_v2_value_get_usmallint =
+  hs_bindgen_c2c8be9c47379447
+
+-- __unique:__ @Database_DuckDB_FFI_V2_Database.DuckDB.FFI.V2_Safe_duckdb_v2_value_get_uint@
+foreign import ccall safe "hs_bindgen_51e59eb3b1593456" hs_bindgen_51e59eb3b1593456_base ::
+     BG.Ptr BG.Void
+  -> BG.Ptr BG.Void
+  -> BG.Ptr BG.Void
+  -> IO BG.CUInt
+
+-- __unique:__ @Database_DuckDB_FFI_V2_Database.DuckDB.FFI.V2_Safe_duckdb_v2_value_get_uint@
+hs_bindgen_51e59eb3b1593456 ::
+     DuckDBV2ValueHandle
+  -> BG.Ptr HsBindgen.Runtime.LibC.Word32
+  -> BG.Ptr DuckDBV2ErrorInfoHandle
+  -> IO DuckDBV2Error
+hs_bindgen_51e59eb3b1593456 =
+  \x0 ->
+    \x1 ->
+      \x2 ->
+        fmap BG.fromFFIType (hs_bindgen_51e59eb3b1593456_base (BG.toFFIType x0) (BG.toFFIType x1) (BG.toFFIType x2))
+
+{-| __C declaration:__ @duckdb_v2_value_get_uint@
+
+    __defined at:__ @duckdb_v2.h 14484:30@
+
+    __exported by:__ @duckdb_v2.h@
+-}
+c_duckdb_v2_value_get_uint ::
+     DuckDBV2ValueHandle
+     -- ^ __C declaration:__ @value@
+  -> BG.Ptr HsBindgen.Runtime.LibC.Word32
+     -- ^ __C declaration:__ @out@
+  -> BG.Ptr DuckDBV2ErrorInfoHandle
+     -- ^ __C declaration:__ @err@
+  -> IO DuckDBV2Error
+c_duckdb_v2_value_get_uint =
+  hs_bindgen_51e59eb3b1593456
+
+-- __unique:__ @Database_DuckDB_FFI_V2_Database.DuckDB.FFI.V2_Safe_duckdb_v2_value_get_ubigint@
+foreign import ccall safe "hs_bindgen_a38e8f8bb381782c" hs_bindgen_a38e8f8bb381782c_base ::
+     BG.Ptr BG.Void
+  -> BG.Ptr BG.Void
+  -> BG.Ptr BG.Void
+  -> IO BG.CUInt
+
+-- __unique:__ @Database_DuckDB_FFI_V2_Database.DuckDB.FFI.V2_Safe_duckdb_v2_value_get_ubigint@
+hs_bindgen_a38e8f8bb381782c ::
+     DuckDBV2ValueHandle
+  -> BG.Ptr HsBindgen.Runtime.LibC.Word64
+  -> BG.Ptr DuckDBV2ErrorInfoHandle
+  -> IO DuckDBV2Error
+hs_bindgen_a38e8f8bb381782c =
+  \x0 ->
+    \x1 ->
+      \x2 ->
+        fmap BG.fromFFIType (hs_bindgen_a38e8f8bb381782c_base (BG.toFFIType x0) (BG.toFFIType x1) (BG.toFFIType x2))
+
+{-| __C declaration:__ @duckdb_v2_value_get_ubigint@
+
+    __defined at:__ @duckdb_v2.h 14503:30@
+
+    __exported by:__ @duckdb_v2.h@
+-}
+c_duckdb_v2_value_get_ubigint ::
+     DuckDBV2ValueHandle
+     -- ^ __C declaration:__ @value@
+  -> BG.Ptr HsBindgen.Runtime.LibC.Word64
+     -- ^ __C declaration:__ @out@
+  -> BG.Ptr DuckDBV2ErrorInfoHandle
+     -- ^ __C declaration:__ @err@
+  -> IO DuckDBV2Error
+c_duckdb_v2_value_get_ubigint =
+  hs_bindgen_a38e8f8bb381782c
+
+-- __unique:__ @Database_DuckDB_FFI_V2_Database.DuckDB.FFI.V2_Safe_duckdb_v2_value_get_uhugeint@
+foreign import ccall safe "hs_bindgen_51c5a5c17fd68cd0" hs_bindgen_51c5a5c17fd68cd0_base ::
+     BG.Ptr BG.Void
+  -> BG.Ptr BG.Void
+  -> BG.Ptr BG.Void
+  -> IO BG.CUInt
+
+-- __unique:__ @Database_DuckDB_FFI_V2_Database.DuckDB.FFI.V2_Safe_duckdb_v2_value_get_uhugeint@
+hs_bindgen_51c5a5c17fd68cd0 ::
+     DuckDBV2ValueHandle
+  -> BG.Ptr DuckDBV2UhugeintT
+  -> BG.Ptr DuckDBV2ErrorInfoHandle
+  -> IO DuckDBV2Error
+hs_bindgen_51c5a5c17fd68cd0 =
+  \x0 ->
+    \x1 ->
+      \x2 ->
+        fmap BG.fromFFIType (hs_bindgen_51c5a5c17fd68cd0_base (BG.toFFIType x0) (BG.toFFIType x1) (BG.toFFIType x2))
+
+{-| __C declaration:__ @duckdb_v2_value_get_uhugeint@
+
+    __defined at:__ @duckdb_v2.h 14522:30@
+
+    __exported by:__ @duckdb_v2.h@
+-}
+c_duckdb_v2_value_get_uhugeint ::
+     DuckDBV2ValueHandle
+     -- ^ __C declaration:__ @value@
+  -> BG.Ptr DuckDBV2UhugeintT
+     -- ^ __C declaration:__ @out@
+  -> BG.Ptr DuckDBV2ErrorInfoHandle
+     -- ^ __C declaration:__ @err@
+  -> IO DuckDBV2Error
+c_duckdb_v2_value_get_uhugeint =
+  hs_bindgen_51c5a5c17fd68cd0
+
+-- __unique:__ @Database_DuckDB_FFI_V2_Database.DuckDB.FFI.V2_Safe_duckdb_v2_value_get_tinyint@
+foreign import ccall safe "hs_bindgen_045486df7d6dcf11" hs_bindgen_045486df7d6dcf11_base ::
+     BG.Ptr BG.Void
+  -> BG.Ptr BG.Void
+  -> BG.Ptr BG.Void
+  -> IO BG.CUInt
+
+-- __unique:__ @Database_DuckDB_FFI_V2_Database.DuckDB.FFI.V2_Safe_duckdb_v2_value_get_tinyint@
+hs_bindgen_045486df7d6dcf11 ::
+     DuckDBV2ValueHandle
+  -> BG.Ptr HsBindgen.Runtime.LibC.Int8
+  -> BG.Ptr DuckDBV2ErrorInfoHandle
+  -> IO DuckDBV2Error
+hs_bindgen_045486df7d6dcf11 =
+  \x0 ->
+    \x1 ->
+      \x2 ->
+        fmap BG.fromFFIType (hs_bindgen_045486df7d6dcf11_base (BG.toFFIType x0) (BG.toFFIType x1) (BG.toFFIType x2))
+
+{-| __C declaration:__ @duckdb_v2_value_get_tinyint@
+
+    __defined at:__ @duckdb_v2.h 14541:30@
+
+    __exported by:__ @duckdb_v2.h@
+-}
+c_duckdb_v2_value_get_tinyint ::
+     DuckDBV2ValueHandle
+     -- ^ __C declaration:__ @value@
+  -> BG.Ptr HsBindgen.Runtime.LibC.Int8
+     -- ^ __C declaration:__ @out@
+  -> BG.Ptr DuckDBV2ErrorInfoHandle
+     -- ^ __C declaration:__ @err@
+  -> IO DuckDBV2Error
+c_duckdb_v2_value_get_tinyint =
+  hs_bindgen_045486df7d6dcf11
+
+-- __unique:__ @Database_DuckDB_FFI_V2_Database.DuckDB.FFI.V2_Safe_duckdb_v2_value_get_smallint@
+foreign import ccall safe "hs_bindgen_9b7f777a260cde64" hs_bindgen_9b7f777a260cde64_base ::
+     BG.Ptr BG.Void
+  -> BG.Ptr BG.Void
+  -> BG.Ptr BG.Void
+  -> IO BG.CUInt
+
+-- __unique:__ @Database_DuckDB_FFI_V2_Database.DuckDB.FFI.V2_Safe_duckdb_v2_value_get_smallint@
+hs_bindgen_9b7f777a260cde64 ::
+     DuckDBV2ValueHandle
+  -> BG.Ptr HsBindgen.Runtime.LibC.Int16
+  -> BG.Ptr DuckDBV2ErrorInfoHandle
+  -> IO DuckDBV2Error
+hs_bindgen_9b7f777a260cde64 =
+  \x0 ->
+    \x1 ->
+      \x2 ->
+        fmap BG.fromFFIType (hs_bindgen_9b7f777a260cde64_base (BG.toFFIType x0) (BG.toFFIType x1) (BG.toFFIType x2))
+
+{-| __C declaration:__ @duckdb_v2_value_get_smallint@
+
+    __defined at:__ @duckdb_v2.h 14560:30@
+
+    __exported by:__ @duckdb_v2.h@
+-}
+c_duckdb_v2_value_get_smallint ::
+     DuckDBV2ValueHandle
+     -- ^ __C declaration:__ @value@
+  -> BG.Ptr HsBindgen.Runtime.LibC.Int16
+     -- ^ __C declaration:__ @out@
+  -> BG.Ptr DuckDBV2ErrorInfoHandle
+     -- ^ __C declaration:__ @err@
+  -> IO DuckDBV2Error
+c_duckdb_v2_value_get_smallint =
+  hs_bindgen_9b7f777a260cde64
+
+-- __unique:__ @Database_DuckDB_FFI_V2_Database.DuckDB.FFI.V2_Safe_duckdb_v2_value_get_int@
+foreign import ccall safe "hs_bindgen_ad2f4d0358ba054b" hs_bindgen_ad2f4d0358ba054b_base ::
+     BG.Ptr BG.Void
+  -> BG.Ptr BG.Void
+  -> BG.Ptr BG.Void
+  -> IO BG.CUInt
+
+-- __unique:__ @Database_DuckDB_FFI_V2_Database.DuckDB.FFI.V2_Safe_duckdb_v2_value_get_int@
+hs_bindgen_ad2f4d0358ba054b ::
+     DuckDBV2ValueHandle
+  -> BG.Ptr HsBindgen.Runtime.LibC.Int32
+  -> BG.Ptr DuckDBV2ErrorInfoHandle
+  -> IO DuckDBV2Error
+hs_bindgen_ad2f4d0358ba054b =
+  \x0 ->
+    \x1 ->
+      \x2 ->
+        fmap BG.fromFFIType (hs_bindgen_ad2f4d0358ba054b_base (BG.toFFIType x0) (BG.toFFIType x1) (BG.toFFIType x2))
+
+{-| __C declaration:__ @duckdb_v2_value_get_int@
+
+    __defined at:__ @duckdb_v2.h 14579:30@
+
+    __exported by:__ @duckdb_v2.h@
+-}
+c_duckdb_v2_value_get_int ::
+     DuckDBV2ValueHandle
+     -- ^ __C declaration:__ @value@
+  -> BG.Ptr HsBindgen.Runtime.LibC.Int32
+     -- ^ __C declaration:__ @out@
+  -> BG.Ptr DuckDBV2ErrorInfoHandle
+     -- ^ __C declaration:__ @err@
+  -> IO DuckDBV2Error
+c_duckdb_v2_value_get_int =
+  hs_bindgen_ad2f4d0358ba054b
+
+-- __unique:__ @Database_DuckDB_FFI_V2_Database.DuckDB.FFI.V2_Safe_duckdb_v2_value_get_bigint@
+foreign import ccall safe "hs_bindgen_3785208a3e88cdf7" hs_bindgen_3785208a3e88cdf7_base ::
+     BG.Ptr BG.Void
+  -> BG.Ptr BG.Void
+  -> BG.Ptr BG.Void
+  -> IO BG.CUInt
+
+-- __unique:__ @Database_DuckDB_FFI_V2_Database.DuckDB.FFI.V2_Safe_duckdb_v2_value_get_bigint@
+hs_bindgen_3785208a3e88cdf7 ::
+     DuckDBV2ValueHandle
+  -> BG.Ptr HsBindgen.Runtime.LibC.Int64
+  -> BG.Ptr DuckDBV2ErrorInfoHandle
+  -> IO DuckDBV2Error
+hs_bindgen_3785208a3e88cdf7 =
+  \x0 ->
+    \x1 ->
+      \x2 ->
+        fmap BG.fromFFIType (hs_bindgen_3785208a3e88cdf7_base (BG.toFFIType x0) (BG.toFFIType x1) (BG.toFFIType x2))
+
+{-| __C declaration:__ @duckdb_v2_value_get_bigint@
+
+    __defined at:__ @duckdb_v2.h 14598:30@
+
+    __exported by:__ @duckdb_v2.h@
+-}
+c_duckdb_v2_value_get_bigint ::
+     DuckDBV2ValueHandle
+     -- ^ __C declaration:__ @value@
+  -> BG.Ptr HsBindgen.Runtime.LibC.Int64
+     -- ^ __C declaration:__ @out@
+  -> BG.Ptr DuckDBV2ErrorInfoHandle
+     -- ^ __C declaration:__ @err@
+  -> IO DuckDBV2Error
+c_duckdb_v2_value_get_bigint =
+  hs_bindgen_3785208a3e88cdf7
+
+-- __unique:__ @Database_DuckDB_FFI_V2_Database.DuckDB.FFI.V2_Safe_duckdb_v2_value_get_hugeint@
+foreign import ccall safe "hs_bindgen_c0b189023ab92265" hs_bindgen_c0b189023ab92265_base ::
+     BG.Ptr BG.Void
+  -> BG.Ptr BG.Void
+  -> BG.Ptr BG.Void
+  -> IO BG.CUInt
+
+-- __unique:__ @Database_DuckDB_FFI_V2_Database.DuckDB.FFI.V2_Safe_duckdb_v2_value_get_hugeint@
+hs_bindgen_c0b189023ab92265 ::
+     DuckDBV2ValueHandle
+  -> BG.Ptr DuckDBV2HugeintT
+  -> BG.Ptr DuckDBV2ErrorInfoHandle
+  -> IO DuckDBV2Error
+hs_bindgen_c0b189023ab92265 =
+  \x0 ->
+    \x1 ->
+      \x2 ->
+        fmap BG.fromFFIType (hs_bindgen_c0b189023ab92265_base (BG.toFFIType x0) (BG.toFFIType x1) (BG.toFFIType x2))
+
+{-| __C declaration:__ @duckdb_v2_value_get_hugeint@
+
+    __defined at:__ @duckdb_v2.h 14617:30@
+
+    __exported by:__ @duckdb_v2.h@
+-}
+c_duckdb_v2_value_get_hugeint ::
+     DuckDBV2ValueHandle
+     -- ^ __C declaration:__ @value@
+  -> BG.Ptr DuckDBV2HugeintT
+     -- ^ __C declaration:__ @out@
+  -> BG.Ptr DuckDBV2ErrorInfoHandle
+     -- ^ __C declaration:__ @err@
+  -> IO DuckDBV2Error
+c_duckdb_v2_value_get_hugeint =
+  hs_bindgen_c0b189023ab92265
+
+-- __unique:__ @Database_DuckDB_FFI_V2_Database.DuckDB.FFI.V2_Safe_duckdb_v2_value_get_varchar@
+foreign import ccall safe "hs_bindgen_2b847cce94fb8e60" hs_bindgen_2b847cce94fb8e60_base ::
+     BG.Ptr BG.Void
+  -> BG.Ptr BG.Void
+  -> BG.Ptr BG.Void
+  -> IO BG.CUInt
+
+-- __unique:__ @Database_DuckDB_FFI_V2_Database.DuckDB.FFI.V2_Safe_duckdb_v2_value_get_varchar@
+hs_bindgen_2b847cce94fb8e60 ::
+     DuckDBV2ValueHandle
+  -> BG.Ptr DuckDBV2Str
+  -> BG.Ptr DuckDBV2ErrorInfoHandle
+  -> IO DuckDBV2Error
+hs_bindgen_2b847cce94fb8e60 =
+  \x0 ->
+    \x1 ->
+      \x2 ->
+        fmap BG.fromFFIType (hs_bindgen_2b847cce94fb8e60_base (BG.toFFIType x0) (BG.toFFIType x1) (BG.toFFIType x2))
+
+{-| __C declaration:__ @duckdb_v2_value_get_varchar@
+
+    __defined at:__ @duckdb_v2.h 14638:30@
+
+    __exported by:__ @duckdb_v2.h@
+-}
+c_duckdb_v2_value_get_varchar ::
+     DuckDBV2ValueHandle
+     -- ^ __C declaration:__ @value@
+  -> BG.Ptr DuckDBV2Str
+     -- ^ __C declaration:__ @out@
+  -> BG.Ptr DuckDBV2ErrorInfoHandle
+     -- ^ __C declaration:__ @err@
+  -> IO DuckDBV2Error
+c_duckdb_v2_value_get_varchar =
+  hs_bindgen_2b847cce94fb8e60
+
+-- __unique:__ @Database_DuckDB_FFI_V2_Database.DuckDB.FFI.V2_Safe_duckdb_v2_value_get_blob@
+foreign import ccall safe "hs_bindgen_098348ddb2669fc7" hs_bindgen_098348ddb2669fc7_base ::
+     BG.Ptr BG.Void
+  -> BG.Ptr BG.Void
+  -> BG.Ptr BG.Void
+  -> IO BG.CUInt
+
+-- __unique:__ @Database_DuckDB_FFI_V2_Database.DuckDB.FFI.V2_Safe_duckdb_v2_value_get_blob@
+hs_bindgen_098348ddb2669fc7 ::
+     DuckDBV2ValueHandle
+  -> BG.Ptr DuckDBV2Str
+  -> BG.Ptr DuckDBV2ErrorInfoHandle
+  -> IO DuckDBV2Error
+hs_bindgen_098348ddb2669fc7 =
+  \x0 ->
+    \x1 ->
+      \x2 ->
+        fmap BG.fromFFIType (hs_bindgen_098348ddb2669fc7_base (BG.toFFIType x0) (BG.toFFIType x1) (BG.toFFIType x2))
+
+{-| __C declaration:__ @duckdb_v2_value_get_blob@
+
+    __defined at:__ @duckdb_v2.h 14659:30@
+
+    __exported by:__ @duckdb_v2.h@
+-}
+c_duckdb_v2_value_get_blob ::
+     DuckDBV2ValueHandle
+     -- ^ __C declaration:__ @value@
+  -> BG.Ptr DuckDBV2Str
+     -- ^ __C declaration:__ @out@
+  -> BG.Ptr DuckDBV2ErrorInfoHandle
+     -- ^ __C declaration:__ @err@
+  -> IO DuckDBV2Error
+c_duckdb_v2_value_get_blob =
+  hs_bindgen_098348ddb2669fc7
+
+-- __unique:__ @Database_DuckDB_FFI_V2_Database.DuckDB.FFI.V2_Safe_duckdb_v2_value_get_float@
+foreign import ccall safe "hs_bindgen_b9c2656fbd9907ac" hs_bindgen_b9c2656fbd9907ac_base ::
+     BG.Ptr BG.Void
+  -> BG.Ptr BG.Void
+  -> BG.Ptr BG.Void
+  -> IO BG.CUInt
+
+-- __unique:__ @Database_DuckDB_FFI_V2_Database.DuckDB.FFI.V2_Safe_duckdb_v2_value_get_float@
+hs_bindgen_b9c2656fbd9907ac ::
+     DuckDBV2ValueHandle
+  -> BG.Ptr BG.CFloat
+  -> BG.Ptr DuckDBV2ErrorInfoHandle
+  -> IO DuckDBV2Error
+hs_bindgen_b9c2656fbd9907ac =
+  \x0 ->
+    \x1 ->
+      \x2 ->
+        fmap BG.fromFFIType (hs_bindgen_b9c2656fbd9907ac_base (BG.toFFIType x0) (BG.toFFIType x1) (BG.toFFIType x2))
+
+{-| __C declaration:__ @duckdb_v2_value_get_float@
+
+    __defined at:__ @duckdb_v2.h 14678:30@
+
+    __exported by:__ @duckdb_v2.h@
+-}
+c_duckdb_v2_value_get_float ::
+     DuckDBV2ValueHandle
+     -- ^ __C declaration:__ @value@
+  -> BG.Ptr BG.CFloat
+     -- ^ __C declaration:__ @out@
+  -> BG.Ptr DuckDBV2ErrorInfoHandle
+     -- ^ __C declaration:__ @err@
+  -> IO DuckDBV2Error
+c_duckdb_v2_value_get_float =
+  hs_bindgen_b9c2656fbd9907ac
+
+-- __unique:__ @Database_DuckDB_FFI_V2_Database.DuckDB.FFI.V2_Safe_duckdb_v2_value_get_double@
+foreign import ccall safe "hs_bindgen_0dc27faab0b6c53f" hs_bindgen_0dc27faab0b6c53f_base ::
+     BG.Ptr BG.Void
+  -> BG.Ptr BG.Void
+  -> BG.Ptr BG.Void
+  -> IO BG.CUInt
+
+-- __unique:__ @Database_DuckDB_FFI_V2_Database.DuckDB.FFI.V2_Safe_duckdb_v2_value_get_double@
+hs_bindgen_0dc27faab0b6c53f ::
+     DuckDBV2ValueHandle
+  -> BG.Ptr BG.CDouble
+  -> BG.Ptr DuckDBV2ErrorInfoHandle
+  -> IO DuckDBV2Error
+hs_bindgen_0dc27faab0b6c53f =
+  \x0 ->
+    \x1 ->
+      \x2 ->
+        fmap BG.fromFFIType (hs_bindgen_0dc27faab0b6c53f_base (BG.toFFIType x0) (BG.toFFIType x1) (BG.toFFIType x2))
+
+{-| __C declaration:__ @duckdb_v2_value_get_double@
+
+    __defined at:__ @duckdb_v2.h 14697:30@
+
+    __exported by:__ @duckdb_v2.h@
+-}
+c_duckdb_v2_value_get_double ::
+     DuckDBV2ValueHandle
+     -- ^ __C declaration:__ @value@
+  -> BG.Ptr BG.CDouble
+     -- ^ __C declaration:__ @out@
+  -> BG.Ptr DuckDBV2ErrorInfoHandle
+     -- ^ __C declaration:__ @err@
+  -> IO DuckDBV2Error
+c_duckdb_v2_value_get_double =
+  hs_bindgen_0dc27faab0b6c53f
+
+-- __unique:__ @Database_DuckDB_FFI_V2_Database.DuckDB.FFI.V2_Safe_duckdb_v2_value_get_date@
+foreign import ccall safe "hs_bindgen_e5424260d1544531" hs_bindgen_e5424260d1544531_base ::
+     BG.Ptr BG.Void
+  -> BG.Ptr BG.Void
+  -> BG.Ptr BG.Void
+  -> IO BG.CUInt
+
+-- __unique:__ @Database_DuckDB_FFI_V2_Database.DuckDB.FFI.V2_Safe_duckdb_v2_value_get_date@
+hs_bindgen_e5424260d1544531 ::
+     DuckDBV2ValueHandle
+  -> BG.Ptr HsBindgen.Runtime.LibC.Int32
+  -> BG.Ptr DuckDBV2ErrorInfoHandle
+  -> IO DuckDBV2Error
+hs_bindgen_e5424260d1544531 =
+  \x0 ->
+    \x1 ->
+      \x2 ->
+        fmap BG.fromFFIType (hs_bindgen_e5424260d1544531_base (BG.toFFIType x0) (BG.toFFIType x1) (BG.toFFIType x2))
+
+{-| __C declaration:__ @duckdb_v2_value_get_date@
+
+    __defined at:__ @duckdb_v2.h 14718:30@
+
+    __exported by:__ @duckdb_v2.h@
+-}
+c_duckdb_v2_value_get_date ::
+     DuckDBV2ValueHandle
+     -- ^ __C declaration:__ @value@
+  -> BG.Ptr HsBindgen.Runtime.LibC.Int32
+     -- ^ __C declaration:__ @out@
+  -> BG.Ptr DuckDBV2ErrorInfoHandle
+     -- ^ __C declaration:__ @err@
+  -> IO DuckDBV2Error
+c_duckdb_v2_value_get_date =
+  hs_bindgen_e5424260d1544531
+
+-- __unique:__ @Database_DuckDB_FFI_V2_Database.DuckDB.FFI.V2_Safe_duckdb_v2_value_get_time@
+foreign import ccall safe "hs_bindgen_f49d3291d05e527c" hs_bindgen_f49d3291d05e527c_base ::
+     BG.Ptr BG.Void
+  -> BG.Ptr BG.Void
+  -> BG.Ptr BG.Void
+  -> IO BG.CUInt
+
+-- __unique:__ @Database_DuckDB_FFI_V2_Database.DuckDB.FFI.V2_Safe_duckdb_v2_value_get_time@
+hs_bindgen_f49d3291d05e527c ::
+     DuckDBV2ValueHandle
+  -> BG.Ptr HsBindgen.Runtime.LibC.Int64
+  -> BG.Ptr DuckDBV2ErrorInfoHandle
+  -> IO DuckDBV2Error
+hs_bindgen_f49d3291d05e527c =
+  \x0 ->
+    \x1 ->
+      \x2 ->
+        fmap BG.fromFFIType (hs_bindgen_f49d3291d05e527c_base (BG.toFFIType x0) (BG.toFFIType x1) (BG.toFFIType x2))
+
+{-| __C declaration:__ @duckdb_v2_value_get_time@
+
+    __defined at:__ @duckdb_v2.h 14739:30@
+
+    __exported by:__ @duckdb_v2.h@
+-}
+c_duckdb_v2_value_get_time ::
+     DuckDBV2ValueHandle
+     -- ^ __C declaration:__ @value@
+  -> BG.Ptr HsBindgen.Runtime.LibC.Int64
+     -- ^ __C declaration:__ @out@
+  -> BG.Ptr DuckDBV2ErrorInfoHandle
+     -- ^ __C declaration:__ @err@
+  -> IO DuckDBV2Error
+c_duckdb_v2_value_get_time =
+  hs_bindgen_f49d3291d05e527c
+
+-- __unique:__ @Database_DuckDB_FFI_V2_Database.DuckDB.FFI.V2_Safe_duckdb_v2_value_get_time_ns@
+foreign import ccall safe "hs_bindgen_84f6244055551531" hs_bindgen_84f6244055551531_base ::
+     BG.Ptr BG.Void
+  -> BG.Ptr BG.Void
+  -> BG.Ptr BG.Void
+  -> IO BG.CUInt
+
+-- __unique:__ @Database_DuckDB_FFI_V2_Database.DuckDB.FFI.V2_Safe_duckdb_v2_value_get_time_ns@
+hs_bindgen_84f6244055551531 ::
+     DuckDBV2ValueHandle
+  -> BG.Ptr HsBindgen.Runtime.LibC.Int64
+  -> BG.Ptr DuckDBV2ErrorInfoHandle
+  -> IO DuckDBV2Error
+hs_bindgen_84f6244055551531 =
+  \x0 ->
+    \x1 ->
+      \x2 ->
+        fmap BG.fromFFIType (hs_bindgen_84f6244055551531_base (BG.toFFIType x0) (BG.toFFIType x1) (BG.toFFIType x2))
+
+{-| __C declaration:__ @duckdb_v2_value_get_time_ns@
+
+    __defined at:__ @duckdb_v2.h 14760:30@
+
+    __exported by:__ @duckdb_v2.h@
+-}
+c_duckdb_v2_value_get_time_ns ::
+     DuckDBV2ValueHandle
+     -- ^ __C declaration:__ @value@
+  -> BG.Ptr HsBindgen.Runtime.LibC.Int64
+     -- ^ __C declaration:__ @out@
+  -> BG.Ptr DuckDBV2ErrorInfoHandle
+     -- ^ __C declaration:__ @err@
+  -> IO DuckDBV2Error
+c_duckdb_v2_value_get_time_ns =
+  hs_bindgen_84f6244055551531
+
+-- __unique:__ @Database_DuckDB_FFI_V2_Database.DuckDB.FFI.V2_Safe_duckdb_v2_value_get_time_tz@
+foreign import ccall safe "hs_bindgen_80a6c91db01dc8ec" hs_bindgen_80a6c91db01dc8ec_base ::
+     BG.Ptr BG.Void
+  -> BG.Ptr BG.Void
+  -> BG.Ptr BG.Void
+  -> IO BG.CUInt
+
+-- __unique:__ @Database_DuckDB_FFI_V2_Database.DuckDB.FFI.V2_Safe_duckdb_v2_value_get_time_tz@
+hs_bindgen_80a6c91db01dc8ec ::
+     DuckDBV2ValueHandle
+  -> BG.Ptr HsBindgen.Runtime.LibC.Word64
+  -> BG.Ptr DuckDBV2ErrorInfoHandle
+  -> IO DuckDBV2Error
+hs_bindgen_80a6c91db01dc8ec =
+  \x0 ->
+    \x1 ->
+      \x2 ->
+        fmap BG.fromFFIType (hs_bindgen_80a6c91db01dc8ec_base (BG.toFFIType x0) (BG.toFFIType x1) (BG.toFFIType x2))
+
+{-| __C declaration:__ @duckdb_v2_value_get_time_tz@
+
+    __defined at:__ @duckdb_v2.h 14782:30@
+
+    __exported by:__ @duckdb_v2.h@
+-}
+c_duckdb_v2_value_get_time_tz ::
+     DuckDBV2ValueHandle
+     -- ^ __C declaration:__ @value@
+  -> BG.Ptr HsBindgen.Runtime.LibC.Word64
+     -- ^ __C declaration:__ @out@
+  -> BG.Ptr DuckDBV2ErrorInfoHandle
+     -- ^ __C declaration:__ @err@
+  -> IO DuckDBV2Error
+c_duckdb_v2_value_get_time_tz =
+  hs_bindgen_80a6c91db01dc8ec
+
+-- __unique:__ @Database_DuckDB_FFI_V2_Database.DuckDB.FFI.V2_Safe_duckdb_v2_value_get_timestamp@
+foreign import ccall safe "hs_bindgen_a799d177e44f5c97" hs_bindgen_a799d177e44f5c97_base ::
+     BG.Ptr BG.Void
+  -> BG.Ptr BG.Void
+  -> BG.Ptr BG.Void
+  -> IO BG.CUInt
+
+-- __unique:__ @Database_DuckDB_FFI_V2_Database.DuckDB.FFI.V2_Safe_duckdb_v2_value_get_timestamp@
+hs_bindgen_a799d177e44f5c97 ::
+     DuckDBV2ValueHandle
+  -> BG.Ptr HsBindgen.Runtime.LibC.Int64
+  -> BG.Ptr DuckDBV2ErrorInfoHandle
+  -> IO DuckDBV2Error
+hs_bindgen_a799d177e44f5c97 =
+  \x0 ->
+    \x1 ->
+      \x2 ->
+        fmap BG.fromFFIType (hs_bindgen_a799d177e44f5c97_base (BG.toFFIType x0) (BG.toFFIType x1) (BG.toFFIType x2))
+
+{-| __C declaration:__ @duckdb_v2_value_get_timestamp@
+
+    __defined at:__ @duckdb_v2.h 14803:30@
+
+    __exported by:__ @duckdb_v2.h@
+-}
+c_duckdb_v2_value_get_timestamp ::
+     DuckDBV2ValueHandle
+     -- ^ __C declaration:__ @value@
+  -> BG.Ptr HsBindgen.Runtime.LibC.Int64
+     -- ^ __C declaration:__ @out@
+  -> BG.Ptr DuckDBV2ErrorInfoHandle
+     -- ^ __C declaration:__ @err@
+  -> IO DuckDBV2Error
+c_duckdb_v2_value_get_timestamp =
+  hs_bindgen_a799d177e44f5c97
+
+-- __unique:__ @Database_DuckDB_FFI_V2_Database.DuckDB.FFI.V2_Safe_duckdb_v2_value_get_timestamp_sec@
+foreign import ccall safe "hs_bindgen_62ae61f1eb4769f6" hs_bindgen_62ae61f1eb4769f6_base ::
+     BG.Ptr BG.Void
+  -> BG.Ptr BG.Void
+  -> BG.Ptr BG.Void
+  -> IO BG.CUInt
+
+-- __unique:__ @Database_DuckDB_FFI_V2_Database.DuckDB.FFI.V2_Safe_duckdb_v2_value_get_timestamp_sec@
+hs_bindgen_62ae61f1eb4769f6 ::
+     DuckDBV2ValueHandle
+  -> BG.Ptr HsBindgen.Runtime.LibC.Int64
+  -> BG.Ptr DuckDBV2ErrorInfoHandle
+  -> IO DuckDBV2Error
+hs_bindgen_62ae61f1eb4769f6 =
+  \x0 ->
+    \x1 ->
+      \x2 ->
+        fmap BG.fromFFIType (hs_bindgen_62ae61f1eb4769f6_base (BG.toFFIType x0) (BG.toFFIType x1) (BG.toFFIType x2))
+
+{-| __C declaration:__ @duckdb_v2_value_get_timestamp_sec@
+
+    __defined at:__ @duckdb_v2.h 14824:30@
+
+    __exported by:__ @duckdb_v2.h@
+-}
+c_duckdb_v2_value_get_timestamp_sec ::
+     DuckDBV2ValueHandle
+     -- ^ __C declaration:__ @value@
+  -> BG.Ptr HsBindgen.Runtime.LibC.Int64
+     -- ^ __C declaration:__ @out@
+  -> BG.Ptr DuckDBV2ErrorInfoHandle
+     -- ^ __C declaration:__ @err@
+  -> IO DuckDBV2Error
+c_duckdb_v2_value_get_timestamp_sec =
+  hs_bindgen_62ae61f1eb4769f6
+
+-- __unique:__ @Database_DuckDB_FFI_V2_Database.DuckDB.FFI.V2_Safe_duckdb_v2_value_get_timestamp_ms@
+foreign import ccall safe "hs_bindgen_3e2cf5344d055396" hs_bindgen_3e2cf5344d055396_base ::
+     BG.Ptr BG.Void
+  -> BG.Ptr BG.Void
+  -> BG.Ptr BG.Void
+  -> IO BG.CUInt
+
+-- __unique:__ @Database_DuckDB_FFI_V2_Database.DuckDB.FFI.V2_Safe_duckdb_v2_value_get_timestamp_ms@
+hs_bindgen_3e2cf5344d055396 ::
+     DuckDBV2ValueHandle
+  -> BG.Ptr HsBindgen.Runtime.LibC.Int64
+  -> BG.Ptr DuckDBV2ErrorInfoHandle
+  -> IO DuckDBV2Error
+hs_bindgen_3e2cf5344d055396 =
+  \x0 ->
+    \x1 ->
+      \x2 ->
+        fmap BG.fromFFIType (hs_bindgen_3e2cf5344d055396_base (BG.toFFIType x0) (BG.toFFIType x1) (BG.toFFIType x2))
+
+{-| __C declaration:__ @duckdb_v2_value_get_timestamp_ms@
+
+    __defined at:__ @duckdb_v2.h 14845:30@
+
+    __exported by:__ @duckdb_v2.h@
+-}
+c_duckdb_v2_value_get_timestamp_ms ::
+     DuckDBV2ValueHandle
+     -- ^ __C declaration:__ @value@
+  -> BG.Ptr HsBindgen.Runtime.LibC.Int64
+     -- ^ __C declaration:__ @out@
+  -> BG.Ptr DuckDBV2ErrorInfoHandle
+     -- ^ __C declaration:__ @err@
+  -> IO DuckDBV2Error
+c_duckdb_v2_value_get_timestamp_ms =
+  hs_bindgen_3e2cf5344d055396
+
+-- __unique:__ @Database_DuckDB_FFI_V2_Database.DuckDB.FFI.V2_Safe_duckdb_v2_value_get_timestamp_ns@
+foreign import ccall safe "hs_bindgen_d9ca87646112e942" hs_bindgen_d9ca87646112e942_base ::
+     BG.Ptr BG.Void
+  -> BG.Ptr BG.Void
+  -> BG.Ptr BG.Void
+  -> IO BG.CUInt
+
+-- __unique:__ @Database_DuckDB_FFI_V2_Database.DuckDB.FFI.V2_Safe_duckdb_v2_value_get_timestamp_ns@
+hs_bindgen_d9ca87646112e942 ::
+     DuckDBV2ValueHandle
+  -> BG.Ptr HsBindgen.Runtime.LibC.Int64
+  -> BG.Ptr DuckDBV2ErrorInfoHandle
+  -> IO DuckDBV2Error
+hs_bindgen_d9ca87646112e942 =
+  \x0 ->
+    \x1 ->
+      \x2 ->
+        fmap BG.fromFFIType (hs_bindgen_d9ca87646112e942_base (BG.toFFIType x0) (BG.toFFIType x1) (BG.toFFIType x2))
+
+{-| __C declaration:__ @duckdb_v2_value_get_timestamp_ns@
+
+    __defined at:__ @duckdb_v2.h 14866:30@
+
+    __exported by:__ @duckdb_v2.h@
+-}
+c_duckdb_v2_value_get_timestamp_ns ::
+     DuckDBV2ValueHandle
+     -- ^ __C declaration:__ @value@
+  -> BG.Ptr HsBindgen.Runtime.LibC.Int64
+     -- ^ __C declaration:__ @out@
+  -> BG.Ptr DuckDBV2ErrorInfoHandle
+     -- ^ __C declaration:__ @err@
+  -> IO DuckDBV2Error
+c_duckdb_v2_value_get_timestamp_ns =
+  hs_bindgen_d9ca87646112e942
+
+-- __unique:__ @Database_DuckDB_FFI_V2_Database.DuckDB.FFI.V2_Safe_duckdb_v2_value_get_timestamp_tz@
+foreign import ccall safe "hs_bindgen_9de5d0f2fa22a17f" hs_bindgen_9de5d0f2fa22a17f_base ::
+     BG.Ptr BG.Void
+  -> BG.Ptr BG.Void
+  -> BG.Ptr BG.Void
+  -> IO BG.CUInt
+
+-- __unique:__ @Database_DuckDB_FFI_V2_Database.DuckDB.FFI.V2_Safe_duckdb_v2_value_get_timestamp_tz@
+hs_bindgen_9de5d0f2fa22a17f ::
+     DuckDBV2ValueHandle
+  -> BG.Ptr HsBindgen.Runtime.LibC.Int64
+  -> BG.Ptr DuckDBV2ErrorInfoHandle
+  -> IO DuckDBV2Error
+hs_bindgen_9de5d0f2fa22a17f =
+  \x0 ->
+    \x1 ->
+      \x2 ->
+        fmap BG.fromFFIType (hs_bindgen_9de5d0f2fa22a17f_base (BG.toFFIType x0) (BG.toFFIType x1) (BG.toFFIType x2))
+
+{-| __C declaration:__ @duckdb_v2_value_get_timestamp_tz@
+
+    __defined at:__ @duckdb_v2.h 14887:30@
+
+    __exported by:__ @duckdb_v2.h@
+-}
+c_duckdb_v2_value_get_timestamp_tz ::
+     DuckDBV2ValueHandle
+     -- ^ __C declaration:__ @value@
+  -> BG.Ptr HsBindgen.Runtime.LibC.Int64
+     -- ^ __C declaration:__ @out@
+  -> BG.Ptr DuckDBV2ErrorInfoHandle
+     -- ^ __C declaration:__ @err@
+  -> IO DuckDBV2Error
+c_duckdb_v2_value_get_timestamp_tz =
+  hs_bindgen_9de5d0f2fa22a17f
+
+-- __unique:__ @Database_DuckDB_FFI_V2_Database.DuckDB.FFI.V2_Safe_duckdb_v2_value_get_timestamp_tz_ns@
+foreign import ccall safe "hs_bindgen_b523af67ff886981" hs_bindgen_b523af67ff886981_base ::
+     BG.Ptr BG.Void
+  -> BG.Ptr BG.Void
+  -> BG.Ptr BG.Void
+  -> IO BG.CUInt
+
+-- __unique:__ @Database_DuckDB_FFI_V2_Database.DuckDB.FFI.V2_Safe_duckdb_v2_value_get_timestamp_tz_ns@
+hs_bindgen_b523af67ff886981 ::
+     DuckDBV2ValueHandle
+  -> BG.Ptr HsBindgen.Runtime.LibC.Int64
+  -> BG.Ptr DuckDBV2ErrorInfoHandle
+  -> IO DuckDBV2Error
+hs_bindgen_b523af67ff886981 =
+  \x0 ->
+    \x1 ->
+      \x2 ->
+        fmap BG.fromFFIType (hs_bindgen_b523af67ff886981_base (BG.toFFIType x0) (BG.toFFIType x1) (BG.toFFIType x2))
+
+{-| __C declaration:__ @duckdb_v2_value_get_timestamp_tz_ns@
+
+    __defined at:__ @duckdb_v2.h 14908:30@
+
+    __exported by:__ @duckdb_v2.h@
+-}
+c_duckdb_v2_value_get_timestamp_tz_ns ::
+     DuckDBV2ValueHandle
+     -- ^ __C declaration:__ @value@
+  -> BG.Ptr HsBindgen.Runtime.LibC.Int64
+     -- ^ __C declaration:__ @out@
+  -> BG.Ptr DuckDBV2ErrorInfoHandle
+     -- ^ __C declaration:__ @err@
+  -> IO DuckDBV2Error
+c_duckdb_v2_value_get_timestamp_tz_ns =
+  hs_bindgen_b523af67ff886981
+
+-- __unique:__ @Database_DuckDB_FFI_V2_Database.DuckDB.FFI.V2_Safe_duckdb_v2_value_get_interval@
+foreign import ccall safe "hs_bindgen_f839a8299f551e8a" hs_bindgen_f839a8299f551e8a_base ::
+     BG.Ptr BG.Void
+  -> BG.Ptr BG.Void
+  -> BG.Ptr BG.Void
+  -> IO BG.CUInt
+
+-- __unique:__ @Database_DuckDB_FFI_V2_Database.DuckDB.FFI.V2_Safe_duckdb_v2_value_get_interval@
+hs_bindgen_f839a8299f551e8a ::
+     DuckDBV2ValueHandle
+  -> BG.Ptr DuckDBV2IntervalT
+  -> BG.Ptr DuckDBV2ErrorInfoHandle
+  -> IO DuckDBV2Error
+hs_bindgen_f839a8299f551e8a =
+  \x0 ->
+    \x1 ->
+      \x2 ->
+        fmap BG.fromFFIType (hs_bindgen_f839a8299f551e8a_base (BG.toFFIType x0) (BG.toFFIType x1) (BG.toFFIType x2))
+
+{-| __C declaration:__ @duckdb_v2_value_get_interval@
+
+    __defined at:__ @duckdb_v2.h 14929:30@
+
+    __exported by:__ @duckdb_v2.h@
+-}
+c_duckdb_v2_value_get_interval ::
+     DuckDBV2ValueHandle
+     -- ^ __C declaration:__ @value@
+  -> BG.Ptr DuckDBV2IntervalT
+     -- ^ __C declaration:__ @out@
+  -> BG.Ptr DuckDBV2ErrorInfoHandle
+     -- ^ __C declaration:__ @err@
+  -> IO DuckDBV2Error
+c_duckdb_v2_value_get_interval =
+  hs_bindgen_f839a8299f551e8a
+
+-- __unique:__ @Database_DuckDB_FFI_V2_Database.DuckDB.FFI.V2_Safe_duckdb_v2_value_get_uuid@
+foreign import ccall safe "hs_bindgen_9139e719ca4b9cf9" hs_bindgen_9139e719ca4b9cf9_base ::
+     BG.Ptr BG.Void
+  -> BG.Ptr BG.Void
+  -> BG.Ptr BG.Void
+  -> IO BG.CUInt
+
+-- __unique:__ @Database_DuckDB_FFI_V2_Database.DuckDB.FFI.V2_Safe_duckdb_v2_value_get_uuid@
+hs_bindgen_9139e719ca4b9cf9 ::
+     DuckDBV2ValueHandle
+  -> BG.Ptr DuckDBV2HugeintT
+  -> BG.Ptr DuckDBV2ErrorInfoHandle
+  -> IO DuckDBV2Error
+hs_bindgen_9139e719ca4b9cf9 =
+  \x0 ->
+    \x1 ->
+      \x2 ->
+        fmap BG.fromFFIType (hs_bindgen_9139e719ca4b9cf9_base (BG.toFFIType x0) (BG.toFFIType x1) (BG.toFFIType x2))
+
+{-| __C declaration:__ @duckdb_v2_value_get_uuid@
+
+    __defined at:__ @duckdb_v2.h 14949:30@
+
+    __exported by:__ @duckdb_v2.h@
+-}
+c_duckdb_v2_value_get_uuid ::
+     DuckDBV2ValueHandle
+     -- ^ __C declaration:__ @value@
+  -> BG.Ptr DuckDBV2HugeintT
+     -- ^ __C declaration:__ @out@
+  -> BG.Ptr DuckDBV2ErrorInfoHandle
+     -- ^ __C declaration:__ @err@
+  -> IO DuckDBV2Error
+c_duckdb_v2_value_get_uuid =
+  hs_bindgen_9139e719ca4b9cf9
+
+-- __unique:__ @Database_DuckDB_FFI_V2_Database.DuckDB.FFI.V2_Safe_duckdb_v2_value_get_decimal@
+foreign import ccall safe "hs_bindgen_1df25feef13beab2" hs_bindgen_1df25feef13beab2_base ::
+     BG.Ptr BG.Void
+  -> BG.Ptr BG.Void
+  -> BG.Ptr BG.Void
+  -> BG.Ptr BG.Void
+  -> BG.Ptr BG.Void
+  -> IO BG.CUInt
+
+-- __unique:__ @Database_DuckDB_FFI_V2_Database.DuckDB.FFI.V2_Safe_duckdb_v2_value_get_decimal@
+hs_bindgen_1df25feef13beab2 ::
+     DuckDBV2ValueHandle
+  -> BG.Ptr DuckDBV2HugeintT
+  -> BG.Ptr HsBindgen.Runtime.LibC.Word8
+  -> BG.Ptr HsBindgen.Runtime.LibC.Word8
+  -> BG.Ptr DuckDBV2ErrorInfoHandle
+  -> IO DuckDBV2Error
+hs_bindgen_1df25feef13beab2 =
+  \x0 ->
+    \x1 ->
+      \x2 ->
+        \x3 ->
+          \x4 ->
+            fmap BG.fromFFIType (hs_bindgen_1df25feef13beab2_base (BG.toFFIType x0) (BG.toFFIType x1) (BG.toFFIType x2) (BG.toFFIType x3) (BG.toFFIType x4))
+
+{-| __C declaration:__ @duckdb_v2_value_get_decimal@
+
+    __defined at:__ @duckdb_v2.h 14972:30@
+
+    __exported by:__ @duckdb_v2.h@
+-}
+c_duckdb_v2_value_get_decimal ::
+     DuckDBV2ValueHandle
+     -- ^ __C declaration:__ @value@
+  -> BG.Ptr DuckDBV2HugeintT
+     -- ^ __C declaration:__ @out@
+  -> BG.Ptr HsBindgen.Runtime.LibC.Word8
+     -- ^ __C declaration:__ @out_width@
+  -> BG.Ptr HsBindgen.Runtime.LibC.Word8
+     -- ^ __C declaration:__ @out_scale@
+  -> BG.Ptr DuckDBV2ErrorInfoHandle
+     -- ^ __C declaration:__ @err@
+  -> IO DuckDBV2Error
+c_duckdb_v2_value_get_decimal =
+  hs_bindgen_1df25feef13beab2
+
+-- __unique:__ @Database_DuckDB_FFI_V2_Database.DuckDB.FFI.V2_Safe_duckdb_v2_value_get_type@
+foreign import ccall safe "hs_bindgen_e7456d094bb3f3d8" hs_bindgen_e7456d094bb3f3d8_base ::
+     BG.Ptr BG.Void
+  -> BG.Ptr BG.Void
+  -> BG.Ptr BG.Void
+  -> IO BG.CUInt
+
+-- __unique:__ @Database_DuckDB_FFI_V2_Database.DuckDB.FFI.V2_Safe_duckdb_v2_value_get_type@
+hs_bindgen_e7456d094bb3f3d8 ::
+     DuckDBV2ValueHandle
+  -> BG.Ptr DuckDBV2LogicalTypeHandle
+  -> BG.Ptr DuckDBV2ErrorInfoHandle
+  -> IO DuckDBV2Error
+hs_bindgen_e7456d094bb3f3d8 =
+  \x0 ->
+    \x1 ->
+      \x2 ->
+        fmap BG.fromFFIType (hs_bindgen_e7456d094bb3f3d8_base (BG.toFFIType x0) (BG.toFFIType x1) (BG.toFFIType x2))
+
+{-| __C declaration:__ @duckdb_v2_value_get_type@
+
+    __defined at:__ @duckdb_v2.h 14992:30@
+
+    __exported by:__ @duckdb_v2.h@
+-}
+c_duckdb_v2_value_get_type ::
+     DuckDBV2ValueHandle
+     -- ^ __C declaration:__ @value@
+  -> BG.Ptr DuckDBV2LogicalTypeHandle
+     -- ^ __C declaration:__ @out_type@
+  -> BG.Ptr DuckDBV2ErrorInfoHandle
+     -- ^ __C declaration:__ @err@
+  -> IO DuckDBV2Error
+c_duckdb_v2_value_get_type =
+  hs_bindgen_e7456d094bb3f3d8
+
+-- __unique:__ @Database_DuckDB_FFI_V2_Database.DuckDB.FFI.V2_Safe_duckdb_v2_value_create_null@
+foreign import ccall safe "hs_bindgen_5114d8d2019785ee" hs_bindgen_5114d8d2019785ee_base ::
+     BG.Ptr BG.Void
+  -> BG.Ptr BG.Void
+  -> BG.Ptr BG.Void
+  -> BG.Ptr BG.Void
+  -> IO BG.CUInt
+
+-- __unique:__ @Database_DuckDB_FFI_V2_Database.DuckDB.FFI.V2_Safe_duckdb_v2_value_create_null@
+hs_bindgen_5114d8d2019785ee ::
+     DuckDBV2FactoryHandle
+  -> DuckDBV2LogicalTypeHandle
+  -> BG.Ptr DuckDBV2ValueHandle
+  -> BG.Ptr DuckDBV2ErrorInfoHandle
+  -> IO DuckDBV2Error
+hs_bindgen_5114d8d2019785ee =
+  \x0 ->
+    \x1 ->
+      \x2 ->
+        \x3 ->
+          fmap BG.fromFFIType (hs_bindgen_5114d8d2019785ee_base (BG.toFFIType x0) (BG.toFFIType x1) (BG.toFFIType x2) (BG.toFFIType x3))
+
+{-| __C declaration:__ @duckdb_v2_value_create_null@
+
+    __defined at:__ @duckdb_v2.h 15012:30@
+
+    __exported by:__ @duckdb_v2.h@
+-}
+c_duckdb_v2_value_create_null ::
+     DuckDBV2FactoryHandle
+     -- ^ __C declaration:__ @factory@
+  -> DuckDBV2LogicalTypeHandle
+     -- ^ __C declaration:__ @type@
+  -> BG.Ptr DuckDBV2ValueHandle
+     -- ^ __C declaration:__ @out_value@
+  -> BG.Ptr DuckDBV2ErrorInfoHandle
+     -- ^ __C declaration:__ @err@
+  -> IO DuckDBV2Error
+c_duckdb_v2_value_create_null =
+  hs_bindgen_5114d8d2019785ee
+
+-- __unique:__ @Database_DuckDB_FFI_V2_Database.DuckDB.FFI.V2_Safe_duckdb_v2_value_create_bool@
+foreign import ccall safe "hs_bindgen_3c9f7040612f4efd" hs_bindgen_3c9f7040612f4efd_base ::
+     BG.Ptr BG.Void
+  -> BG.CBool
+  -> BG.Ptr BG.Void
+  -> BG.Ptr BG.Void
+  -> IO BG.CUInt
+
+-- __unique:__ @Database_DuckDB_FFI_V2_Database.DuckDB.FFI.V2_Safe_duckdb_v2_value_create_bool@
+hs_bindgen_3c9f7040612f4efd ::
+     DuckDBV2FactoryHandle
+  -> BG.CBool
+  -> BG.Ptr DuckDBV2ValueHandle
+  -> BG.Ptr DuckDBV2ErrorInfoHandle
+  -> IO DuckDBV2Error
+hs_bindgen_3c9f7040612f4efd =
+  \x0 ->
+    \x1 ->
+      \x2 ->
+        \x3 ->
+          fmap BG.fromFFIType (hs_bindgen_3c9f7040612f4efd_base (BG.toFFIType x0) (BG.toFFIType x1) (BG.toFFIType x2) (BG.toFFIType x3))
+
+{-| __C declaration:__ @duckdb_v2_value_create_bool@
+
+    __defined at:__ @duckdb_v2.h 15033:30@
+
+    __exported by:__ @duckdb_v2.h@
+-}
+c_duckdb_v2_value_create_bool ::
+     DuckDBV2FactoryHandle
+     -- ^ __C declaration:__ @factory@
+  -> BG.CBool
+     -- ^ __C declaration:__ @in_value@
+  -> BG.Ptr DuckDBV2ValueHandle
+     -- ^ __C declaration:__ @out_value@
+  -> BG.Ptr DuckDBV2ErrorInfoHandle
+     -- ^ __C declaration:__ @err@
+  -> IO DuckDBV2Error
+c_duckdb_v2_value_create_bool =
+  hs_bindgen_3c9f7040612f4efd
+
+-- __unique:__ @Database_DuckDB_FFI_V2_Database.DuckDB.FFI.V2_Safe_duckdb_v2_value_create_utinyint@
+foreign import ccall safe "hs_bindgen_a0bc37a78132eec0" hs_bindgen_a0bc37a78132eec0_base ::
+     BG.Ptr BG.Void
+  -> HsBindgen.Runtime.LibC.Word8
+  -> BG.Ptr BG.Void
+  -> BG.Ptr BG.Void
+  -> IO BG.CUInt
+
+-- __unique:__ @Database_DuckDB_FFI_V2_Database.DuckDB.FFI.V2_Safe_duckdb_v2_value_create_utinyint@
+hs_bindgen_a0bc37a78132eec0 ::
+     DuckDBV2FactoryHandle
+  -> HsBindgen.Runtime.LibC.Word8
+  -> BG.Ptr DuckDBV2ValueHandle
+  -> BG.Ptr DuckDBV2ErrorInfoHandle
+  -> IO DuckDBV2Error
+hs_bindgen_a0bc37a78132eec0 =
+  \x0 ->
+    \x1 ->
+      \x2 ->
+        \x3 ->
+          fmap BG.fromFFIType (hs_bindgen_a0bc37a78132eec0_base (BG.toFFIType x0) (BG.toFFIType x1) (BG.toFFIType x2) (BG.toFFIType x3))
+
+{-| __C declaration:__ @duckdb_v2_value_create_utinyint@
+
+    __defined at:__ @duckdb_v2.h 15053:30@
+
+    __exported by:__ @duckdb_v2.h@
+-}
+c_duckdb_v2_value_create_utinyint ::
+     DuckDBV2FactoryHandle
+     -- ^ __C declaration:__ @factory@
+  -> HsBindgen.Runtime.LibC.Word8
+     -- ^ __C declaration:__ @in_value@
+  -> BG.Ptr DuckDBV2ValueHandle
+     -- ^ __C declaration:__ @out_value@
+  -> BG.Ptr DuckDBV2ErrorInfoHandle
+     -- ^ __C declaration:__ @err@
+  -> IO DuckDBV2Error
+c_duckdb_v2_value_create_utinyint =
+  hs_bindgen_a0bc37a78132eec0
+
+-- __unique:__ @Database_DuckDB_FFI_V2_Database.DuckDB.FFI.V2_Safe_duckdb_v2_value_create_usmallint@
+foreign import ccall safe "hs_bindgen_39545e9bb2a6c8c9" hs_bindgen_39545e9bb2a6c8c9_base ::
+     BG.Ptr BG.Void
+  -> HsBindgen.Runtime.LibC.Word16
+  -> BG.Ptr BG.Void
+  -> BG.Ptr BG.Void
+  -> IO BG.CUInt
+
+-- __unique:__ @Database_DuckDB_FFI_V2_Database.DuckDB.FFI.V2_Safe_duckdb_v2_value_create_usmallint@
+hs_bindgen_39545e9bb2a6c8c9 ::
+     DuckDBV2FactoryHandle
+  -> HsBindgen.Runtime.LibC.Word16
+  -> BG.Ptr DuckDBV2ValueHandle
+  -> BG.Ptr DuckDBV2ErrorInfoHandle
+  -> IO DuckDBV2Error
+hs_bindgen_39545e9bb2a6c8c9 =
+  \x0 ->
+    \x1 ->
+      \x2 ->
+        \x3 ->
+          fmap BG.fromFFIType (hs_bindgen_39545e9bb2a6c8c9_base (BG.toFFIType x0) (BG.toFFIType x1) (BG.toFFIType x2) (BG.toFFIType x3))
+
+{-| __C declaration:__ @duckdb_v2_value_create_usmallint@
+
+    __defined at:__ @duckdb_v2.h 15073:30@
+
+    __exported by:__ @duckdb_v2.h@
+-}
+c_duckdb_v2_value_create_usmallint ::
+     DuckDBV2FactoryHandle
+     -- ^ __C declaration:__ @factory@
+  -> HsBindgen.Runtime.LibC.Word16
+     -- ^ __C declaration:__ @in_value@
+  -> BG.Ptr DuckDBV2ValueHandle
+     -- ^ __C declaration:__ @out_value@
+  -> BG.Ptr DuckDBV2ErrorInfoHandle
+     -- ^ __C declaration:__ @err@
+  -> IO DuckDBV2Error
+c_duckdb_v2_value_create_usmallint =
+  hs_bindgen_39545e9bb2a6c8c9
+
+-- __unique:__ @Database_DuckDB_FFI_V2_Database.DuckDB.FFI.V2_Safe_duckdb_v2_value_create_uint@
+foreign import ccall safe "hs_bindgen_61e712c751a587b3" hs_bindgen_61e712c751a587b3_base ::
+     BG.Ptr BG.Void
+  -> HsBindgen.Runtime.LibC.Word32
+  -> BG.Ptr BG.Void
+  -> BG.Ptr BG.Void
+  -> IO BG.CUInt
+
+-- __unique:__ @Database_DuckDB_FFI_V2_Database.DuckDB.FFI.V2_Safe_duckdb_v2_value_create_uint@
+hs_bindgen_61e712c751a587b3 ::
+     DuckDBV2FactoryHandle
+  -> HsBindgen.Runtime.LibC.Word32
+  -> BG.Ptr DuckDBV2ValueHandle
+  -> BG.Ptr DuckDBV2ErrorInfoHandle
+  -> IO DuckDBV2Error
+hs_bindgen_61e712c751a587b3 =
+  \x0 ->
+    \x1 ->
+      \x2 ->
+        \x3 ->
+          fmap BG.fromFFIType (hs_bindgen_61e712c751a587b3_base (BG.toFFIType x0) (BG.toFFIType x1) (BG.toFFIType x2) (BG.toFFIType x3))
+
+{-| __C declaration:__ @duckdb_v2_value_create_uint@
+
+    __defined at:__ @duckdb_v2.h 15093:30@
+
+    __exported by:__ @duckdb_v2.h@
+-}
+c_duckdb_v2_value_create_uint ::
+     DuckDBV2FactoryHandle
+     -- ^ __C declaration:__ @factory@
+  -> HsBindgen.Runtime.LibC.Word32
+     -- ^ __C declaration:__ @in_value@
+  -> BG.Ptr DuckDBV2ValueHandle
+     -- ^ __C declaration:__ @out_value@
+  -> BG.Ptr DuckDBV2ErrorInfoHandle
+     -- ^ __C declaration:__ @err@
+  -> IO DuckDBV2Error
+c_duckdb_v2_value_create_uint =
+  hs_bindgen_61e712c751a587b3
+
+-- __unique:__ @Database_DuckDB_FFI_V2_Database.DuckDB.FFI.V2_Safe_duckdb_v2_value_create_ubigint@
+foreign import ccall safe "hs_bindgen_d66b8e1f5f9e5557" hs_bindgen_d66b8e1f5f9e5557_base ::
+     BG.Ptr BG.Void
+  -> HsBindgen.Runtime.LibC.Word64
+  -> BG.Ptr BG.Void
+  -> BG.Ptr BG.Void
+  -> IO BG.CUInt
+
+-- __unique:__ @Database_DuckDB_FFI_V2_Database.DuckDB.FFI.V2_Safe_duckdb_v2_value_create_ubigint@
+hs_bindgen_d66b8e1f5f9e5557 ::
+     DuckDBV2FactoryHandle
+  -> HsBindgen.Runtime.LibC.Word64
+  -> BG.Ptr DuckDBV2ValueHandle
+  -> BG.Ptr DuckDBV2ErrorInfoHandle
+  -> IO DuckDBV2Error
+hs_bindgen_d66b8e1f5f9e5557 =
+  \x0 ->
+    \x1 ->
+      \x2 ->
+        \x3 ->
+          fmap BG.fromFFIType (hs_bindgen_d66b8e1f5f9e5557_base (BG.toFFIType x0) (BG.toFFIType x1) (BG.toFFIType x2) (BG.toFFIType x3))
+
+{-| __C declaration:__ @duckdb_v2_value_create_ubigint@
+
+    __defined at:__ @duckdb_v2.h 15113:30@
+
+    __exported by:__ @duckdb_v2.h@
+-}
+c_duckdb_v2_value_create_ubigint ::
+     DuckDBV2FactoryHandle
+     -- ^ __C declaration:__ @factory@
+  -> HsBindgen.Runtime.LibC.Word64
+     -- ^ __C declaration:__ @in_value@
+  -> BG.Ptr DuckDBV2ValueHandle
+     -- ^ __C declaration:__ @out_value@
+  -> BG.Ptr DuckDBV2ErrorInfoHandle
+     -- ^ __C declaration:__ @err@
+  -> IO DuckDBV2Error
+c_duckdb_v2_value_create_ubigint =
+  hs_bindgen_d66b8e1f5f9e5557
+
+-- __unique:__ @Database_DuckDB_FFI_V2_Database.DuckDB.FFI.V2_Safe_duckdb_v2_value_create_uhugeint@
+foreign import ccall safe "hs_bindgen_6b747e16d2b9cdae" hs_bindgen_6b747e16d2b9cdae_base ::
+     BG.Ptr BG.Void
+  -> BG.Ptr BG.Void
+  -> BG.Ptr BG.Void
+  -> BG.Ptr BG.Void
+  -> IO BG.CUInt
+
+-- __unique:__ @Database_DuckDB_FFI_V2_Database.DuckDB.FFI.V2_Safe_duckdb_v2_value_create_uhugeint@
+hs_bindgen_6b747e16d2b9cdae ::
+     DuckDBV2FactoryHandle
+  -> PtrConst.PtrConst DuckDBV2UhugeintT
+  -> BG.Ptr DuckDBV2ValueHandle
+  -> BG.Ptr DuckDBV2ErrorInfoHandle
+  -> IO DuckDBV2Error
+hs_bindgen_6b747e16d2b9cdae =
+  \x0 ->
+    \x1 ->
+      \x2 ->
+        \x3 ->
+          fmap BG.fromFFIType (hs_bindgen_6b747e16d2b9cdae_base (BG.toFFIType x0) (BG.toFFIType x1) (BG.toFFIType x2) (BG.toFFIType x3))
+
+{-| __C declaration:__ @duckdb_v2_value_create_uhugeint@
+
+    __defined at:__ @duckdb_v2.h 15133:30@
+
+    __exported by:__ @duckdb_v2.h@
+-}
+c_duckdb_v2_value_create_uhugeint ::
+     DuckDBV2FactoryHandle
+     -- ^ __C declaration:__ @factory@
+  -> PtrConst.PtrConst DuckDBV2UhugeintT
+     -- ^ __C declaration:__ @in_value@
+  -> BG.Ptr DuckDBV2ValueHandle
+     -- ^ __C declaration:__ @out_value@
+  -> BG.Ptr DuckDBV2ErrorInfoHandle
+     -- ^ __C declaration:__ @err@
+  -> IO DuckDBV2Error
+c_duckdb_v2_value_create_uhugeint =
+  hs_bindgen_6b747e16d2b9cdae
+
+-- __unique:__ @Database_DuckDB_FFI_V2_Database.DuckDB.FFI.V2_Safe_duckdb_v2_value_create_tinyint@
+foreign import ccall safe "hs_bindgen_1c7c990e0e85db52" hs_bindgen_1c7c990e0e85db52_base ::
+     BG.Ptr BG.Void
+  -> HsBindgen.Runtime.LibC.Int8
+  -> BG.Ptr BG.Void
+  -> BG.Ptr BG.Void
+  -> IO BG.CUInt
+
+-- __unique:__ @Database_DuckDB_FFI_V2_Database.DuckDB.FFI.V2_Safe_duckdb_v2_value_create_tinyint@
+hs_bindgen_1c7c990e0e85db52 ::
+     DuckDBV2FactoryHandle
+  -> HsBindgen.Runtime.LibC.Int8
+  -> BG.Ptr DuckDBV2ValueHandle
+  -> BG.Ptr DuckDBV2ErrorInfoHandle
+  -> IO DuckDBV2Error
+hs_bindgen_1c7c990e0e85db52 =
+  \x0 ->
+    \x1 ->
+      \x2 ->
+        \x3 ->
+          fmap BG.fromFFIType (hs_bindgen_1c7c990e0e85db52_base (BG.toFFIType x0) (BG.toFFIType x1) (BG.toFFIType x2) (BG.toFFIType x3))
+
+{-| __C declaration:__ @duckdb_v2_value_create_tinyint@
+
+    __defined at:__ @duckdb_v2.h 15154:30@
+
+    __exported by:__ @duckdb_v2.h@
+-}
+c_duckdb_v2_value_create_tinyint ::
+     DuckDBV2FactoryHandle
+     -- ^ __C declaration:__ @factory@
+  -> HsBindgen.Runtime.LibC.Int8
+     -- ^ __C declaration:__ @in_value@
+  -> BG.Ptr DuckDBV2ValueHandle
+     -- ^ __C declaration:__ @out_value@
+  -> BG.Ptr DuckDBV2ErrorInfoHandle
+     -- ^ __C declaration:__ @err@
+  -> IO DuckDBV2Error
+c_duckdb_v2_value_create_tinyint =
+  hs_bindgen_1c7c990e0e85db52
+
+-- __unique:__ @Database_DuckDB_FFI_V2_Database.DuckDB.FFI.V2_Safe_duckdb_v2_value_create_smallint@
+foreign import ccall safe "hs_bindgen_04db4c5281a5f0d0" hs_bindgen_04db4c5281a5f0d0_base ::
+     BG.Ptr BG.Void
+  -> HsBindgen.Runtime.LibC.Int16
+  -> BG.Ptr BG.Void
+  -> BG.Ptr BG.Void
+  -> IO BG.CUInt
+
+-- __unique:__ @Database_DuckDB_FFI_V2_Database.DuckDB.FFI.V2_Safe_duckdb_v2_value_create_smallint@
+hs_bindgen_04db4c5281a5f0d0 ::
+     DuckDBV2FactoryHandle
+  -> HsBindgen.Runtime.LibC.Int16
+  -> BG.Ptr DuckDBV2ValueHandle
+  -> BG.Ptr DuckDBV2ErrorInfoHandle
+  -> IO DuckDBV2Error
+hs_bindgen_04db4c5281a5f0d0 =
+  \x0 ->
+    \x1 ->
+      \x2 ->
+        \x3 ->
+          fmap BG.fromFFIType (hs_bindgen_04db4c5281a5f0d0_base (BG.toFFIType x0) (BG.toFFIType x1) (BG.toFFIType x2) (BG.toFFIType x3))
+
+{-| __C declaration:__ @duckdb_v2_value_create_smallint@
+
+    __defined at:__ @duckdb_v2.h 15174:30@
+
+    __exported by:__ @duckdb_v2.h@
+-}
+c_duckdb_v2_value_create_smallint ::
+     DuckDBV2FactoryHandle
+     -- ^ __C declaration:__ @factory@
+  -> HsBindgen.Runtime.LibC.Int16
+     -- ^ __C declaration:__ @in_value@
+  -> BG.Ptr DuckDBV2ValueHandle
+     -- ^ __C declaration:__ @out_value@
+  -> BG.Ptr DuckDBV2ErrorInfoHandle
+     -- ^ __C declaration:__ @err@
+  -> IO DuckDBV2Error
+c_duckdb_v2_value_create_smallint =
+  hs_bindgen_04db4c5281a5f0d0
+
+-- __unique:__ @Database_DuckDB_FFI_V2_Database.DuckDB.FFI.V2_Safe_duckdb_v2_value_create_int@
+foreign import ccall safe "hs_bindgen_f1484a1a203e28b4" hs_bindgen_f1484a1a203e28b4_base ::
+     BG.Ptr BG.Void
+  -> HsBindgen.Runtime.LibC.Int32
+  -> BG.Ptr BG.Void
+  -> BG.Ptr BG.Void
+  -> IO BG.CUInt
+
+-- __unique:__ @Database_DuckDB_FFI_V2_Database.DuckDB.FFI.V2_Safe_duckdb_v2_value_create_int@
+hs_bindgen_f1484a1a203e28b4 ::
+     DuckDBV2FactoryHandle
+  -> HsBindgen.Runtime.LibC.Int32
+  -> BG.Ptr DuckDBV2ValueHandle
+  -> BG.Ptr DuckDBV2ErrorInfoHandle
+  -> IO DuckDBV2Error
+hs_bindgen_f1484a1a203e28b4 =
+  \x0 ->
+    \x1 ->
+      \x2 ->
+        \x3 ->
+          fmap BG.fromFFIType (hs_bindgen_f1484a1a203e28b4_base (BG.toFFIType x0) (BG.toFFIType x1) (BG.toFFIType x2) (BG.toFFIType x3))
+
+{-| __C declaration:__ @duckdb_v2_value_create_int@
+
+    __defined at:__ @duckdb_v2.h 15194:30@
+
+    __exported by:__ @duckdb_v2.h@
+-}
+c_duckdb_v2_value_create_int ::
+     DuckDBV2FactoryHandle
+     -- ^ __C declaration:__ @factory@
+  -> HsBindgen.Runtime.LibC.Int32
+     -- ^ __C declaration:__ @in_value@
+  -> BG.Ptr DuckDBV2ValueHandle
+     -- ^ __C declaration:__ @out_value@
+  -> BG.Ptr DuckDBV2ErrorInfoHandle
+     -- ^ __C declaration:__ @err@
+  -> IO DuckDBV2Error
+c_duckdb_v2_value_create_int =
+  hs_bindgen_f1484a1a203e28b4
+
+-- __unique:__ @Database_DuckDB_FFI_V2_Database.DuckDB.FFI.V2_Safe_duckdb_v2_value_create_bigint@
+foreign import ccall safe "hs_bindgen_44115a52f6f7aff2" hs_bindgen_44115a52f6f7aff2_base ::
+     BG.Ptr BG.Void
+  -> HsBindgen.Runtime.LibC.Int64
+  -> BG.Ptr BG.Void
+  -> BG.Ptr BG.Void
+  -> IO BG.CUInt
+
+-- __unique:__ @Database_DuckDB_FFI_V2_Database.DuckDB.FFI.V2_Safe_duckdb_v2_value_create_bigint@
+hs_bindgen_44115a52f6f7aff2 ::
+     DuckDBV2FactoryHandle
+  -> HsBindgen.Runtime.LibC.Int64
+  -> BG.Ptr DuckDBV2ValueHandle
+  -> BG.Ptr DuckDBV2ErrorInfoHandle
+  -> IO DuckDBV2Error
+hs_bindgen_44115a52f6f7aff2 =
+  \x0 ->
+    \x1 ->
+      \x2 ->
+        \x3 ->
+          fmap BG.fromFFIType (hs_bindgen_44115a52f6f7aff2_base (BG.toFFIType x0) (BG.toFFIType x1) (BG.toFFIType x2) (BG.toFFIType x3))
+
+{-| __C declaration:__ @duckdb_v2_value_create_bigint@
+
+    __defined at:__ @duckdb_v2.h 15214:30@
+
+    __exported by:__ @duckdb_v2.h@
+-}
+c_duckdb_v2_value_create_bigint ::
+     DuckDBV2FactoryHandle
+     -- ^ __C declaration:__ @factory@
+  -> HsBindgen.Runtime.LibC.Int64
+     -- ^ __C declaration:__ @in_value@
+  -> BG.Ptr DuckDBV2ValueHandle
+     -- ^ __C declaration:__ @out_value@
+  -> BG.Ptr DuckDBV2ErrorInfoHandle
+     -- ^ __C declaration:__ @err@
+  -> IO DuckDBV2Error
+c_duckdb_v2_value_create_bigint =
+  hs_bindgen_44115a52f6f7aff2
+
+-- __unique:__ @Database_DuckDB_FFI_V2_Database.DuckDB.FFI.V2_Safe_duckdb_v2_value_create_hugeint@
+foreign import ccall safe "hs_bindgen_d389268204e49951" hs_bindgen_d389268204e49951_base ::
+     BG.Ptr BG.Void
+  -> BG.Ptr BG.Void
+  -> BG.Ptr BG.Void
+  -> BG.Ptr BG.Void
+  -> IO BG.CUInt
+
+-- __unique:__ @Database_DuckDB_FFI_V2_Database.DuckDB.FFI.V2_Safe_duckdb_v2_value_create_hugeint@
+hs_bindgen_d389268204e49951 ::
+     DuckDBV2FactoryHandle
+  -> PtrConst.PtrConst DuckDBV2HugeintT
+  -> BG.Ptr DuckDBV2ValueHandle
+  -> BG.Ptr DuckDBV2ErrorInfoHandle
+  -> IO DuckDBV2Error
+hs_bindgen_d389268204e49951 =
+  \x0 ->
+    \x1 ->
+      \x2 ->
+        \x3 ->
+          fmap BG.fromFFIType (hs_bindgen_d389268204e49951_base (BG.toFFIType x0) (BG.toFFIType x1) (BG.toFFIType x2) (BG.toFFIType x3))
+
+{-| __C declaration:__ @duckdb_v2_value_create_hugeint@
+
+    __defined at:__ @duckdb_v2.h 15234:30@
+
+    __exported by:__ @duckdb_v2.h@
+-}
+c_duckdb_v2_value_create_hugeint ::
+     DuckDBV2FactoryHandle
+     -- ^ __C declaration:__ @factory@
+  -> PtrConst.PtrConst DuckDBV2HugeintT
+     -- ^ __C declaration:__ @in_value@
+  -> BG.Ptr DuckDBV2ValueHandle
+     -- ^ __C declaration:__ @out_value@
+  -> BG.Ptr DuckDBV2ErrorInfoHandle
+     -- ^ __C declaration:__ @err@
+  -> IO DuckDBV2Error
+c_duckdb_v2_value_create_hugeint =
+  hs_bindgen_d389268204e49951
+
+-- __unique:__ @Database_DuckDB_FFI_V2_Database.DuckDB.FFI.V2_Safe_duckdb_v2_value_create_varchar@
+foreign import ccall safe "hs_bindgen_4933318e07a2e1bc" hs_bindgen_4933318e07a2e1bc_base ::
+     BG.Ptr BG.Void
+  -> BG.Ptr BG.Void
+  -> BG.Ptr BG.Void
+  -> BG.Ptr BG.Void
+  -> IO BG.CUInt
+
+-- __unique:__ @Database_DuckDB_FFI_V2_Database.DuckDB.FFI.V2_Safe_duckdb_v2_value_create_varchar@
+hs_bindgen_4933318e07a2e1bc ::
+     DuckDBV2FactoryHandle
+  -> PtrConst.PtrConst DuckDBV2Str
+  -> BG.Ptr DuckDBV2ValueHandle
+  -> BG.Ptr DuckDBV2ErrorInfoHandle
+  -> IO DuckDBV2Error
+hs_bindgen_4933318e07a2e1bc =
+  \x0 ->
+    \x1 ->
+      \x2 ->
+        \x3 ->
+          fmap BG.fromFFIType (hs_bindgen_4933318e07a2e1bc_base (BG.toFFIType x0) (BG.toFFIType x1) (BG.toFFIType x2) (BG.toFFIType x3))
+
+{-| __C declaration:__ @duckdb_v2_value_create_varchar@
+
+    __defined at:__ @duckdb_v2.h 15255:30@
+
+    __exported by:__ @duckdb_v2.h@
+-}
+c_duckdb_v2_value_create_varchar ::
+     DuckDBV2FactoryHandle
+     -- ^ __C declaration:__ @factory@
+  -> PtrConst.PtrConst DuckDBV2Str
+     -- ^ __C declaration:__ @in_value@
+  -> BG.Ptr DuckDBV2ValueHandle
+     -- ^ __C declaration:__ @out_value@
+  -> BG.Ptr DuckDBV2ErrorInfoHandle
+     -- ^ __C declaration:__ @err@
+  -> IO DuckDBV2Error
+c_duckdb_v2_value_create_varchar =
+  hs_bindgen_4933318e07a2e1bc
+
+-- __unique:__ @Database_DuckDB_FFI_V2_Database.DuckDB.FFI.V2_Safe_duckdb_v2_value_create_blob@
+foreign import ccall safe "hs_bindgen_ef44c44ca9d42997" hs_bindgen_ef44c44ca9d42997_base ::
+     BG.Ptr BG.Void
+  -> BG.Ptr BG.Void
+  -> BG.Ptr BG.Void
+  -> BG.Ptr BG.Void
+  -> IO BG.CUInt
+
+-- __unique:__ @Database_DuckDB_FFI_V2_Database.DuckDB.FFI.V2_Safe_duckdb_v2_value_create_blob@
+hs_bindgen_ef44c44ca9d42997 ::
+     DuckDBV2FactoryHandle
+  -> PtrConst.PtrConst DuckDBV2Str
+  -> BG.Ptr DuckDBV2ValueHandle
+  -> BG.Ptr DuckDBV2ErrorInfoHandle
+  -> IO DuckDBV2Error
+hs_bindgen_ef44c44ca9d42997 =
+  \x0 ->
+    \x1 ->
+      \x2 ->
+        \x3 ->
+          fmap BG.fromFFIType (hs_bindgen_ef44c44ca9d42997_base (BG.toFFIType x0) (BG.toFFIType x1) (BG.toFFIType x2) (BG.toFFIType x3))
+
+{-| __C declaration:__ @duckdb_v2_value_create_blob@
+
+    __defined at:__ @duckdb_v2.h 15276:30@
+
+    __exported by:__ @duckdb_v2.h@
+-}
+c_duckdb_v2_value_create_blob ::
+     DuckDBV2FactoryHandle
+     -- ^ __C declaration:__ @factory@
+  -> PtrConst.PtrConst DuckDBV2Str
+     -- ^ __C declaration:__ @in_value@
+  -> BG.Ptr DuckDBV2ValueHandle
+     -- ^ __C declaration:__ @out_value@
+  -> BG.Ptr DuckDBV2ErrorInfoHandle
+     -- ^ __C declaration:__ @err@
+  -> IO DuckDBV2Error
+c_duckdb_v2_value_create_blob =
+  hs_bindgen_ef44c44ca9d42997
+
+-- __unique:__ @Database_DuckDB_FFI_V2_Database.DuckDB.FFI.V2_Safe_duckdb_v2_value_create_float@
+foreign import ccall safe "hs_bindgen_57589ffc7a8b4b02" hs_bindgen_57589ffc7a8b4b02_base ::
+     BG.Ptr BG.Void
+  -> BG.CFloat
+  -> BG.Ptr BG.Void
+  -> BG.Ptr BG.Void
+  -> IO BG.CUInt
+
+-- __unique:__ @Database_DuckDB_FFI_V2_Database.DuckDB.FFI.V2_Safe_duckdb_v2_value_create_float@
+hs_bindgen_57589ffc7a8b4b02 ::
+     DuckDBV2FactoryHandle
+  -> BG.CFloat
+  -> BG.Ptr DuckDBV2ValueHandle
+  -> BG.Ptr DuckDBV2ErrorInfoHandle
+  -> IO DuckDBV2Error
+hs_bindgen_57589ffc7a8b4b02 =
+  \x0 ->
+    \x1 ->
+      \x2 ->
+        \x3 ->
+          fmap BG.fromFFIType (hs_bindgen_57589ffc7a8b4b02_base (BG.toFFIType x0) (BG.toFFIType x1) (BG.toFFIType x2) (BG.toFFIType x3))
+
+{-| __C declaration:__ @duckdb_v2_value_create_float@
+
+    __defined at:__ @duckdb_v2.h 15297:30@
+
+    __exported by:__ @duckdb_v2.h@
+-}
+c_duckdb_v2_value_create_float ::
+     DuckDBV2FactoryHandle
+     -- ^ __C declaration:__ @factory@
+  -> BG.CFloat
+     -- ^ __C declaration:__ @in_value@
+  -> BG.Ptr DuckDBV2ValueHandle
+     -- ^ __C declaration:__ @out_value@
+  -> BG.Ptr DuckDBV2ErrorInfoHandle
+     -- ^ __C declaration:__ @err@
+  -> IO DuckDBV2Error
+c_duckdb_v2_value_create_float =
+  hs_bindgen_57589ffc7a8b4b02
+
+-- __unique:__ @Database_DuckDB_FFI_V2_Database.DuckDB.FFI.V2_Safe_duckdb_v2_value_create_double@
+foreign import ccall safe "hs_bindgen_5d9a1739948ffc4a" hs_bindgen_5d9a1739948ffc4a_base ::
+     BG.Ptr BG.Void
+  -> BG.CDouble
+  -> BG.Ptr BG.Void
+  -> BG.Ptr BG.Void
+  -> IO BG.CUInt
+
+-- __unique:__ @Database_DuckDB_FFI_V2_Database.DuckDB.FFI.V2_Safe_duckdb_v2_value_create_double@
+hs_bindgen_5d9a1739948ffc4a ::
+     DuckDBV2FactoryHandle
+  -> BG.CDouble
+  -> BG.Ptr DuckDBV2ValueHandle
+  -> BG.Ptr DuckDBV2ErrorInfoHandle
+  -> IO DuckDBV2Error
+hs_bindgen_5d9a1739948ffc4a =
+  \x0 ->
+    \x1 ->
+      \x2 ->
+        \x3 ->
+          fmap BG.fromFFIType (hs_bindgen_5d9a1739948ffc4a_base (BG.toFFIType x0) (BG.toFFIType x1) (BG.toFFIType x2) (BG.toFFIType x3))
+
+{-| __C declaration:__ @duckdb_v2_value_create_double@
+
+    __defined at:__ @duckdb_v2.h 15317:30@
+
+    __exported by:__ @duckdb_v2.h@
+-}
+c_duckdb_v2_value_create_double ::
+     DuckDBV2FactoryHandle
+     -- ^ __C declaration:__ @factory@
+  -> BG.CDouble
+     -- ^ __C declaration:__ @in_value@
+  -> BG.Ptr DuckDBV2ValueHandle
+     -- ^ __C declaration:__ @out_value@
+  -> BG.Ptr DuckDBV2ErrorInfoHandle
+     -- ^ __C declaration:__ @err@
+  -> IO DuckDBV2Error
+c_duckdb_v2_value_create_double =
+  hs_bindgen_5d9a1739948ffc4a
+
+-- __unique:__ @Database_DuckDB_FFI_V2_Database.DuckDB.FFI.V2_Safe_duckdb_v2_value_create_type@
+foreign import ccall safe "hs_bindgen_191e7b4c2f91f970" hs_bindgen_191e7b4c2f91f970_base ::
+     BG.Ptr BG.Void
+  -> BG.Ptr BG.Void
+  -> BG.Ptr BG.Void
+  -> BG.Ptr BG.Void
+  -> IO BG.CUInt
+
+-- __unique:__ @Database_DuckDB_FFI_V2_Database.DuckDB.FFI.V2_Safe_duckdb_v2_value_create_type@
+hs_bindgen_191e7b4c2f91f970 ::
+     DuckDBV2FactoryHandle
+  -> DuckDBV2LogicalTypeHandle
+  -> BG.Ptr DuckDBV2ValueHandle
+  -> BG.Ptr DuckDBV2ErrorInfoHandle
+  -> IO DuckDBV2Error
+hs_bindgen_191e7b4c2f91f970 =
+  \x0 ->
+    \x1 ->
+      \x2 ->
+        \x3 ->
+          fmap BG.fromFFIType (hs_bindgen_191e7b4c2f91f970_base (BG.toFFIType x0) (BG.toFFIType x1) (BG.toFFIType x2) (BG.toFFIType x3))
+
+{-| __C declaration:__ @duckdb_v2_value_create_type@
+
+    __defined at:__ @duckdb_v2.h 15337:30@
+
+    __exported by:__ @duckdb_v2.h@
+-}
+c_duckdb_v2_value_create_type ::
+     DuckDBV2FactoryHandle
+     -- ^ __C declaration:__ @factory@
+  -> DuckDBV2LogicalTypeHandle
+     -- ^ __C declaration:__ @in_type@
+  -> BG.Ptr DuckDBV2ValueHandle
+     -- ^ __C declaration:__ @out_value@
+  -> BG.Ptr DuckDBV2ErrorInfoHandle
+     -- ^ __C declaration:__ @err@
+  -> IO DuckDBV2Error
+c_duckdb_v2_value_create_type =
+  hs_bindgen_191e7b4c2f91f970
+
+-- __unique:__ @Database_DuckDB_FFI_V2_Database.DuckDB.FFI.V2_Safe_duckdb_v2_value_create_date@
+foreign import ccall safe "hs_bindgen_fe5730eae385199f" hs_bindgen_fe5730eae385199f_base ::
+     BG.Ptr BG.Void
+  -> HsBindgen.Runtime.LibC.Int32
+  -> BG.Ptr BG.Void
+  -> BG.Ptr BG.Void
+  -> IO BG.CUInt
+
+-- __unique:__ @Database_DuckDB_FFI_V2_Database.DuckDB.FFI.V2_Safe_duckdb_v2_value_create_date@
+hs_bindgen_fe5730eae385199f ::
+     DuckDBV2FactoryHandle
+  -> HsBindgen.Runtime.LibC.Int32
+  -> BG.Ptr DuckDBV2ValueHandle
+  -> BG.Ptr DuckDBV2ErrorInfoHandle
+  -> IO DuckDBV2Error
+hs_bindgen_fe5730eae385199f =
+  \x0 ->
+    \x1 ->
+      \x2 ->
+        \x3 ->
+          fmap BG.fromFFIType (hs_bindgen_fe5730eae385199f_base (BG.toFFIType x0) (BG.toFFIType x1) (BG.toFFIType x2) (BG.toFFIType x3))
+
+{-| __C declaration:__ @duckdb_v2_value_create_date@
+
+    __defined at:__ @duckdb_v2.h 15359:30@
+
+    __exported by:__ @duckdb_v2.h@
+-}
+c_duckdb_v2_value_create_date ::
+     DuckDBV2FactoryHandle
+     -- ^ __C declaration:__ @factory@
+  -> HsBindgen.Runtime.LibC.Int32
+     -- ^ __C declaration:__ @in_value@
+  -> BG.Ptr DuckDBV2ValueHandle
+     -- ^ __C declaration:__ @out_value@
+  -> BG.Ptr DuckDBV2ErrorInfoHandle
+     -- ^ __C declaration:__ @err@
+  -> IO DuckDBV2Error
+c_duckdb_v2_value_create_date =
+  hs_bindgen_fe5730eae385199f
+
+-- __unique:__ @Database_DuckDB_FFI_V2_Database.DuckDB.FFI.V2_Safe_duckdb_v2_value_create_time@
+foreign import ccall safe "hs_bindgen_fc290182b17c1a99" hs_bindgen_fc290182b17c1a99_base ::
+     BG.Ptr BG.Void
+  -> HsBindgen.Runtime.LibC.Int64
+  -> BG.Ptr BG.Void
+  -> BG.Ptr BG.Void
+  -> IO BG.CUInt
+
+-- __unique:__ @Database_DuckDB_FFI_V2_Database.DuckDB.FFI.V2_Safe_duckdb_v2_value_create_time@
+hs_bindgen_fc290182b17c1a99 ::
+     DuckDBV2FactoryHandle
+  -> HsBindgen.Runtime.LibC.Int64
+  -> BG.Ptr DuckDBV2ValueHandle
+  -> BG.Ptr DuckDBV2ErrorInfoHandle
+  -> IO DuckDBV2Error
+hs_bindgen_fc290182b17c1a99 =
+  \x0 ->
+    \x1 ->
+      \x2 ->
+        \x3 ->
+          fmap BG.fromFFIType (hs_bindgen_fc290182b17c1a99_base (BG.toFFIType x0) (BG.toFFIType x1) (BG.toFFIType x2) (BG.toFFIType x3))
+
+{-| __C declaration:__ @duckdb_v2_value_create_time@
+
+    __defined at:__ @duckdb_v2.h 15380:30@
+
+    __exported by:__ @duckdb_v2.h@
+-}
+c_duckdb_v2_value_create_time ::
+     DuckDBV2FactoryHandle
+     -- ^ __C declaration:__ @factory@
+  -> HsBindgen.Runtime.LibC.Int64
+     -- ^ __C declaration:__ @in_value@
+  -> BG.Ptr DuckDBV2ValueHandle
+     -- ^ __C declaration:__ @out_value@
+  -> BG.Ptr DuckDBV2ErrorInfoHandle
+     -- ^ __C declaration:__ @err@
+  -> IO DuckDBV2Error
+c_duckdb_v2_value_create_time =
+  hs_bindgen_fc290182b17c1a99
+
+-- __unique:__ @Database_DuckDB_FFI_V2_Database.DuckDB.FFI.V2_Safe_duckdb_v2_value_create_time_ns@
+foreign import ccall safe "hs_bindgen_31a1602e50a9be80" hs_bindgen_31a1602e50a9be80_base ::
+     BG.Ptr BG.Void
+  -> HsBindgen.Runtime.LibC.Int64
+  -> BG.Ptr BG.Void
+  -> BG.Ptr BG.Void
+  -> IO BG.CUInt
+
+-- __unique:__ @Database_DuckDB_FFI_V2_Database.DuckDB.FFI.V2_Safe_duckdb_v2_value_create_time_ns@
+hs_bindgen_31a1602e50a9be80 ::
+     DuckDBV2FactoryHandle
+  -> HsBindgen.Runtime.LibC.Int64
+  -> BG.Ptr DuckDBV2ValueHandle
+  -> BG.Ptr DuckDBV2ErrorInfoHandle
+  -> IO DuckDBV2Error
+hs_bindgen_31a1602e50a9be80 =
+  \x0 ->
+    \x1 ->
+      \x2 ->
+        \x3 ->
+          fmap BG.fromFFIType (hs_bindgen_31a1602e50a9be80_base (BG.toFFIType x0) (BG.toFFIType x1) (BG.toFFIType x2) (BG.toFFIType x3))
+
+{-| __C declaration:__ @duckdb_v2_value_create_time_ns@
+
+    __defined at:__ @duckdb_v2.h 15401:30@
+
+    __exported by:__ @duckdb_v2.h@
+-}
+c_duckdb_v2_value_create_time_ns ::
+     DuckDBV2FactoryHandle
+     -- ^ __C declaration:__ @factory@
+  -> HsBindgen.Runtime.LibC.Int64
+     -- ^ __C declaration:__ @in_value@
+  -> BG.Ptr DuckDBV2ValueHandle
+     -- ^ __C declaration:__ @out_value@
+  -> BG.Ptr DuckDBV2ErrorInfoHandle
+     -- ^ __C declaration:__ @err@
+  -> IO DuckDBV2Error
+c_duckdb_v2_value_create_time_ns =
+  hs_bindgen_31a1602e50a9be80
+
+-- __unique:__ @Database_DuckDB_FFI_V2_Database.DuckDB.FFI.V2_Safe_duckdb_v2_value_create_time_tz@
+foreign import ccall safe "hs_bindgen_58bff52464b9c7dd" hs_bindgen_58bff52464b9c7dd_base ::
+     BG.Ptr BG.Void
+  -> HsBindgen.Runtime.LibC.Word64
+  -> BG.Ptr BG.Void
+  -> BG.Ptr BG.Void
+  -> IO BG.CUInt
+
+-- __unique:__ @Database_DuckDB_FFI_V2_Database.DuckDB.FFI.V2_Safe_duckdb_v2_value_create_time_tz@
+hs_bindgen_58bff52464b9c7dd ::
+     DuckDBV2FactoryHandle
+  -> HsBindgen.Runtime.LibC.Word64
+  -> BG.Ptr DuckDBV2ValueHandle
+  -> BG.Ptr DuckDBV2ErrorInfoHandle
+  -> IO DuckDBV2Error
+hs_bindgen_58bff52464b9c7dd =
+  \x0 ->
+    \x1 ->
+      \x2 ->
+        \x3 ->
+          fmap BG.fromFFIType (hs_bindgen_58bff52464b9c7dd_base (BG.toFFIType x0) (BG.toFFIType x1) (BG.toFFIType x2) (BG.toFFIType x3))
+
+{-| __C declaration:__ @duckdb_v2_value_create_time_tz@
+
+    __defined at:__ @duckdb_v2.h 15423:30@
+
+    __exported by:__ @duckdb_v2.h@
+-}
+c_duckdb_v2_value_create_time_tz ::
+     DuckDBV2FactoryHandle
+     -- ^ __C declaration:__ @factory@
+  -> HsBindgen.Runtime.LibC.Word64
+     -- ^ __C declaration:__ @in_value@
+  -> BG.Ptr DuckDBV2ValueHandle
+     -- ^ __C declaration:__ @out_value@
+  -> BG.Ptr DuckDBV2ErrorInfoHandle
+     -- ^ __C declaration:__ @err@
+  -> IO DuckDBV2Error
+c_duckdb_v2_value_create_time_tz =
+  hs_bindgen_58bff52464b9c7dd
+
+-- __unique:__ @Database_DuckDB_FFI_V2_Database.DuckDB.FFI.V2_Safe_duckdb_v2_value_create_timestamp@
+foreign import ccall safe "hs_bindgen_af8bd23e86ca7f16" hs_bindgen_af8bd23e86ca7f16_base ::
+     BG.Ptr BG.Void
+  -> HsBindgen.Runtime.LibC.Int64
+  -> BG.Ptr BG.Void
+  -> BG.Ptr BG.Void
+  -> IO BG.CUInt
+
+-- __unique:__ @Database_DuckDB_FFI_V2_Database.DuckDB.FFI.V2_Safe_duckdb_v2_value_create_timestamp@
+hs_bindgen_af8bd23e86ca7f16 ::
+     DuckDBV2FactoryHandle
+  -> HsBindgen.Runtime.LibC.Int64
+  -> BG.Ptr DuckDBV2ValueHandle
+  -> BG.Ptr DuckDBV2ErrorInfoHandle
+  -> IO DuckDBV2Error
+hs_bindgen_af8bd23e86ca7f16 =
+  \x0 ->
+    \x1 ->
+      \x2 ->
+        \x3 ->
+          fmap BG.fromFFIType (hs_bindgen_af8bd23e86ca7f16_base (BG.toFFIType x0) (BG.toFFIType x1) (BG.toFFIType x2) (BG.toFFIType x3))
+
+{-| __C declaration:__ @duckdb_v2_value_create_timestamp@
+
+    __defined at:__ @duckdb_v2.h 15444:30@
+
+    __exported by:__ @duckdb_v2.h@
+-}
+c_duckdb_v2_value_create_timestamp ::
+     DuckDBV2FactoryHandle
+     -- ^ __C declaration:__ @factory@
+  -> HsBindgen.Runtime.LibC.Int64
+     -- ^ __C declaration:__ @in_value@
+  -> BG.Ptr DuckDBV2ValueHandle
+     -- ^ __C declaration:__ @out_value@
+  -> BG.Ptr DuckDBV2ErrorInfoHandle
+     -- ^ __C declaration:__ @err@
+  -> IO DuckDBV2Error
+c_duckdb_v2_value_create_timestamp =
+  hs_bindgen_af8bd23e86ca7f16
+
+-- __unique:__ @Database_DuckDB_FFI_V2_Database.DuckDB.FFI.V2_Safe_duckdb_v2_value_create_timestamp_sec@
+foreign import ccall safe "hs_bindgen_5b8f622401e88242" hs_bindgen_5b8f622401e88242_base ::
+     BG.Ptr BG.Void
+  -> HsBindgen.Runtime.LibC.Int64
+  -> BG.Ptr BG.Void
+  -> BG.Ptr BG.Void
+  -> IO BG.CUInt
+
+-- __unique:__ @Database_DuckDB_FFI_V2_Database.DuckDB.FFI.V2_Safe_duckdb_v2_value_create_timestamp_sec@
+hs_bindgen_5b8f622401e88242 ::
+     DuckDBV2FactoryHandle
+  -> HsBindgen.Runtime.LibC.Int64
+  -> BG.Ptr DuckDBV2ValueHandle
+  -> BG.Ptr DuckDBV2ErrorInfoHandle
+  -> IO DuckDBV2Error
+hs_bindgen_5b8f622401e88242 =
+  \x0 ->
+    \x1 ->
+      \x2 ->
+        \x3 ->
+          fmap BG.fromFFIType (hs_bindgen_5b8f622401e88242_base (BG.toFFIType x0) (BG.toFFIType x1) (BG.toFFIType x2) (BG.toFFIType x3))
+
+{-| __C declaration:__ @duckdb_v2_value_create_timestamp_sec@
+
+    __defined at:__ @duckdb_v2.h 15465:30@
+
+    __exported by:__ @duckdb_v2.h@
+-}
+c_duckdb_v2_value_create_timestamp_sec ::
+     DuckDBV2FactoryHandle
+     -- ^ __C declaration:__ @factory@
+  -> HsBindgen.Runtime.LibC.Int64
+     -- ^ __C declaration:__ @in_value@
+  -> BG.Ptr DuckDBV2ValueHandle
+     -- ^ __C declaration:__ @out_value@
+  -> BG.Ptr DuckDBV2ErrorInfoHandle
+     -- ^ __C declaration:__ @err@
+  -> IO DuckDBV2Error
+c_duckdb_v2_value_create_timestamp_sec =
+  hs_bindgen_5b8f622401e88242
+
+-- __unique:__ @Database_DuckDB_FFI_V2_Database.DuckDB.FFI.V2_Safe_duckdb_v2_value_create_timestamp_ms@
+foreign import ccall safe "hs_bindgen_77d04257358a65b6" hs_bindgen_77d04257358a65b6_base ::
+     BG.Ptr BG.Void
+  -> HsBindgen.Runtime.LibC.Int64
+  -> BG.Ptr BG.Void
+  -> BG.Ptr BG.Void
+  -> IO BG.CUInt
+
+-- __unique:__ @Database_DuckDB_FFI_V2_Database.DuckDB.FFI.V2_Safe_duckdb_v2_value_create_timestamp_ms@
+hs_bindgen_77d04257358a65b6 ::
+     DuckDBV2FactoryHandle
+  -> HsBindgen.Runtime.LibC.Int64
+  -> BG.Ptr DuckDBV2ValueHandle
+  -> BG.Ptr DuckDBV2ErrorInfoHandle
+  -> IO DuckDBV2Error
+hs_bindgen_77d04257358a65b6 =
+  \x0 ->
+    \x1 ->
+      \x2 ->
+        \x3 ->
+          fmap BG.fromFFIType (hs_bindgen_77d04257358a65b6_base (BG.toFFIType x0) (BG.toFFIType x1) (BG.toFFIType x2) (BG.toFFIType x3))
+
+{-| __C declaration:__ @duckdb_v2_value_create_timestamp_ms@
+
+    __defined at:__ @duckdb_v2.h 15486:30@
+
+    __exported by:__ @duckdb_v2.h@
+-}
+c_duckdb_v2_value_create_timestamp_ms ::
+     DuckDBV2FactoryHandle
+     -- ^ __C declaration:__ @factory@
+  -> HsBindgen.Runtime.LibC.Int64
+     -- ^ __C declaration:__ @in_value@
+  -> BG.Ptr DuckDBV2ValueHandle
+     -- ^ __C declaration:__ @out_value@
+  -> BG.Ptr DuckDBV2ErrorInfoHandle
+     -- ^ __C declaration:__ @err@
+  -> IO DuckDBV2Error
+c_duckdb_v2_value_create_timestamp_ms =
+  hs_bindgen_77d04257358a65b6
+
+-- __unique:__ @Database_DuckDB_FFI_V2_Database.DuckDB.FFI.V2_Safe_duckdb_v2_value_create_timestamp_ns@
+foreign import ccall safe "hs_bindgen_f230ce063552d6d7" hs_bindgen_f230ce063552d6d7_base ::
+     BG.Ptr BG.Void
+  -> HsBindgen.Runtime.LibC.Int64
+  -> BG.Ptr BG.Void
+  -> BG.Ptr BG.Void
+  -> IO BG.CUInt
+
+-- __unique:__ @Database_DuckDB_FFI_V2_Database.DuckDB.FFI.V2_Safe_duckdb_v2_value_create_timestamp_ns@
+hs_bindgen_f230ce063552d6d7 ::
+     DuckDBV2FactoryHandle
+  -> HsBindgen.Runtime.LibC.Int64
+  -> BG.Ptr DuckDBV2ValueHandle
+  -> BG.Ptr DuckDBV2ErrorInfoHandle
+  -> IO DuckDBV2Error
+hs_bindgen_f230ce063552d6d7 =
+  \x0 ->
+    \x1 ->
+      \x2 ->
+        \x3 ->
+          fmap BG.fromFFIType (hs_bindgen_f230ce063552d6d7_base (BG.toFFIType x0) (BG.toFFIType x1) (BG.toFFIType x2) (BG.toFFIType x3))
+
+{-| __C declaration:__ @duckdb_v2_value_create_timestamp_ns@
+
+    __defined at:__ @duckdb_v2.h 15507:30@
+
+    __exported by:__ @duckdb_v2.h@
+-}
+c_duckdb_v2_value_create_timestamp_ns ::
+     DuckDBV2FactoryHandle
+     -- ^ __C declaration:__ @factory@
+  -> HsBindgen.Runtime.LibC.Int64
+     -- ^ __C declaration:__ @in_value@
+  -> BG.Ptr DuckDBV2ValueHandle
+     -- ^ __C declaration:__ @out_value@
+  -> BG.Ptr DuckDBV2ErrorInfoHandle
+     -- ^ __C declaration:__ @err@
+  -> IO DuckDBV2Error
+c_duckdb_v2_value_create_timestamp_ns =
+  hs_bindgen_f230ce063552d6d7
+
+-- __unique:__ @Database_DuckDB_FFI_V2_Database.DuckDB.FFI.V2_Safe_duckdb_v2_value_create_timestamp_tz@
+foreign import ccall safe "hs_bindgen_d56bfc9d6aef842f" hs_bindgen_d56bfc9d6aef842f_base ::
+     BG.Ptr BG.Void
+  -> HsBindgen.Runtime.LibC.Int64
+  -> BG.Ptr BG.Void
+  -> BG.Ptr BG.Void
+  -> IO BG.CUInt
+
+-- __unique:__ @Database_DuckDB_FFI_V2_Database.DuckDB.FFI.V2_Safe_duckdb_v2_value_create_timestamp_tz@
+hs_bindgen_d56bfc9d6aef842f ::
+     DuckDBV2FactoryHandle
+  -> HsBindgen.Runtime.LibC.Int64
+  -> BG.Ptr DuckDBV2ValueHandle
+  -> BG.Ptr DuckDBV2ErrorInfoHandle
+  -> IO DuckDBV2Error
+hs_bindgen_d56bfc9d6aef842f =
+  \x0 ->
+    \x1 ->
+      \x2 ->
+        \x3 ->
+          fmap BG.fromFFIType (hs_bindgen_d56bfc9d6aef842f_base (BG.toFFIType x0) (BG.toFFIType x1) (BG.toFFIType x2) (BG.toFFIType x3))
+
+{-| __C declaration:__ @duckdb_v2_value_create_timestamp_tz@
+
+    __defined at:__ @duckdb_v2.h 15529:30@
+
+    __exported by:__ @duckdb_v2.h@
+-}
+c_duckdb_v2_value_create_timestamp_tz ::
+     DuckDBV2FactoryHandle
+     -- ^ __C declaration:__ @factory@
+  -> HsBindgen.Runtime.LibC.Int64
+     -- ^ __C declaration:__ @in_value@
+  -> BG.Ptr DuckDBV2ValueHandle
+     -- ^ __C declaration:__ @out_value@
+  -> BG.Ptr DuckDBV2ErrorInfoHandle
+     -- ^ __C declaration:__ @err@
+  -> IO DuckDBV2Error
+c_duckdb_v2_value_create_timestamp_tz =
+  hs_bindgen_d56bfc9d6aef842f
+
+-- __unique:__ @Database_DuckDB_FFI_V2_Database.DuckDB.FFI.V2_Safe_duckdb_v2_value_create_timestamp_tz_ns@
+foreign import ccall safe "hs_bindgen_79fbde4c7b7b05e4" hs_bindgen_79fbde4c7b7b05e4_base ::
+     BG.Ptr BG.Void
+  -> HsBindgen.Runtime.LibC.Int64
+  -> BG.Ptr BG.Void
+  -> BG.Ptr BG.Void
+  -> IO BG.CUInt
+
+-- __unique:__ @Database_DuckDB_FFI_V2_Database.DuckDB.FFI.V2_Safe_duckdb_v2_value_create_timestamp_tz_ns@
+hs_bindgen_79fbde4c7b7b05e4 ::
+     DuckDBV2FactoryHandle
+  -> HsBindgen.Runtime.LibC.Int64
+  -> BG.Ptr DuckDBV2ValueHandle
+  -> BG.Ptr DuckDBV2ErrorInfoHandle
+  -> IO DuckDBV2Error
+hs_bindgen_79fbde4c7b7b05e4 =
+  \x0 ->
+    \x1 ->
+      \x2 ->
+        \x3 ->
+          fmap BG.fromFFIType (hs_bindgen_79fbde4c7b7b05e4_base (BG.toFFIType x0) (BG.toFFIType x1) (BG.toFFIType x2) (BG.toFFIType x3))
+
+{-| __C declaration:__ @duckdb_v2_value_create_timestamp_tz_ns@
+
+    __defined at:__ @duckdb_v2.h 15551:30@
+
+    __exported by:__ @duckdb_v2.h@
+-}
+c_duckdb_v2_value_create_timestamp_tz_ns ::
+     DuckDBV2FactoryHandle
+     -- ^ __C declaration:__ @factory@
+  -> HsBindgen.Runtime.LibC.Int64
+     -- ^ __C declaration:__ @in_value@
+  -> BG.Ptr DuckDBV2ValueHandle
+     -- ^ __C declaration:__ @out_value@
+  -> BG.Ptr DuckDBV2ErrorInfoHandle
+     -- ^ __C declaration:__ @err@
+  -> IO DuckDBV2Error
+c_duckdb_v2_value_create_timestamp_tz_ns =
+  hs_bindgen_79fbde4c7b7b05e4
+
+-- __unique:__ @Database_DuckDB_FFI_V2_Database.DuckDB.FFI.V2_Safe_duckdb_v2_value_create_interval@
+foreign import ccall safe "hs_bindgen_3a9af524a6c247e8" hs_bindgen_3a9af524a6c247e8_base ::
+     BG.Ptr BG.Void
+  -> BG.Ptr BG.Void
+  -> BG.Ptr BG.Void
+  -> BG.Ptr BG.Void
+  -> IO BG.CUInt
+
+-- __unique:__ @Database_DuckDB_FFI_V2_Database.DuckDB.FFI.V2_Safe_duckdb_v2_value_create_interval@
+hs_bindgen_3a9af524a6c247e8 ::
+     DuckDBV2FactoryHandle
+  -> PtrConst.PtrConst DuckDBV2IntervalT
+  -> BG.Ptr DuckDBV2ValueHandle
+  -> BG.Ptr DuckDBV2ErrorInfoHandle
+  -> IO DuckDBV2Error
+hs_bindgen_3a9af524a6c247e8 =
+  \x0 ->
+    \x1 ->
+      \x2 ->
+        \x3 ->
+          fmap BG.fromFFIType (hs_bindgen_3a9af524a6c247e8_base (BG.toFFIType x0) (BG.toFFIType x1) (BG.toFFIType x2) (BG.toFFIType x3))
+
+{-| __C declaration:__ @duckdb_v2_value_create_interval@
+
+    __defined at:__ @duckdb_v2.h 15572:30@
+
+    __exported by:__ @duckdb_v2.h@
+-}
+c_duckdb_v2_value_create_interval ::
+     DuckDBV2FactoryHandle
+     -- ^ __C declaration:__ @factory@
+  -> PtrConst.PtrConst DuckDBV2IntervalT
+     -- ^ __C declaration:__ @in_value@
+  -> BG.Ptr DuckDBV2ValueHandle
+     -- ^ __C declaration:__ @out_value@
+  -> BG.Ptr DuckDBV2ErrorInfoHandle
+     -- ^ __C declaration:__ @err@
+  -> IO DuckDBV2Error
+c_duckdb_v2_value_create_interval =
+  hs_bindgen_3a9af524a6c247e8
+
+-- __unique:__ @Database_DuckDB_FFI_V2_Database.DuckDB.FFI.V2_Safe_duckdb_v2_value_create_decimal@
+foreign import ccall safe "hs_bindgen_6da441e700a19c77" hs_bindgen_6da441e700a19c77_base ::
+     BG.Ptr BG.Void
+  -> BG.Ptr BG.Void
+  -> HsBindgen.Runtime.LibC.Word8
+  -> HsBindgen.Runtime.LibC.Word8
+  -> BG.Ptr BG.Void
+  -> BG.Ptr BG.Void
+  -> IO BG.CUInt
+
+-- __unique:__ @Database_DuckDB_FFI_V2_Database.DuckDB.FFI.V2_Safe_duckdb_v2_value_create_decimal@
+hs_bindgen_6da441e700a19c77 ::
+     DuckDBV2FactoryHandle
+  -> PtrConst.PtrConst DuckDBV2HugeintT
+  -> HsBindgen.Runtime.LibC.Word8
+  -> HsBindgen.Runtime.LibC.Word8
+  -> BG.Ptr DuckDBV2ValueHandle
+  -> BG.Ptr DuckDBV2ErrorInfoHandle
+  -> IO DuckDBV2Error
+hs_bindgen_6da441e700a19c77 =
+  \x0 ->
+    \x1 ->
+      \x2 ->
+        \x3 ->
+          \x4 ->
+            \x5 ->
+              fmap BG.fromFFIType (hs_bindgen_6da441e700a19c77_base (BG.toFFIType x0) (BG.toFFIType x1) (BG.toFFIType x2) (BG.toFFIType x3) (BG.toFFIType x4) (BG.toFFIType x5))
+
+{-| __C declaration:__ @duckdb_v2_value_create_decimal@
+
+    __defined at:__ @duckdb_v2.h 15598:30@
+
+    __exported by:__ @duckdb_v2.h@
+-}
+c_duckdb_v2_value_create_decimal ::
+     DuckDBV2FactoryHandle
+     -- ^ __C declaration:__ @factory@
+  -> PtrConst.PtrConst DuckDBV2HugeintT
+     -- ^ __C declaration:__ @in_value@
+  -> HsBindgen.Runtime.LibC.Word8
+     -- ^ __C declaration:__ @width@
+  -> HsBindgen.Runtime.LibC.Word8
+     -- ^ __C declaration:__ @scale@
+  -> BG.Ptr DuckDBV2ValueHandle
+     -- ^ __C declaration:__ @out_value@
+  -> BG.Ptr DuckDBV2ErrorInfoHandle
+     -- ^ __C declaration:__ @err@
+  -> IO DuckDBV2Error
+c_duckdb_v2_value_create_decimal =
+  hs_bindgen_6da441e700a19c77
+
+-- __unique:__ @Database_DuckDB_FFI_V2_Database.DuckDB.FFI.V2_Safe_duckdb_v2_value_create_uuid@
+foreign import ccall safe "hs_bindgen_c3a7f9c056dfa47b" hs_bindgen_c3a7f9c056dfa47b_base ::
+     BG.Ptr BG.Void
+  -> BG.Ptr BG.Void
+  -> BG.Ptr BG.Void
+  -> BG.Ptr BG.Void
+  -> IO BG.CUInt
+
+-- __unique:__ @Database_DuckDB_FFI_V2_Database.DuckDB.FFI.V2_Safe_duckdb_v2_value_create_uuid@
+hs_bindgen_c3a7f9c056dfa47b ::
+     DuckDBV2FactoryHandle
+  -> PtrConst.PtrConst DuckDBV2HugeintT
+  -> BG.Ptr DuckDBV2ValueHandle
+  -> BG.Ptr DuckDBV2ErrorInfoHandle
+  -> IO DuckDBV2Error
+hs_bindgen_c3a7f9c056dfa47b =
+  \x0 ->
+    \x1 ->
+      \x2 ->
+        \x3 ->
+          fmap BG.fromFFIType (hs_bindgen_c3a7f9c056dfa47b_base (BG.toFFIType x0) (BG.toFFIType x1) (BG.toFFIType x2) (BG.toFFIType x3))
+
+{-| __C declaration:__ @duckdb_v2_value_create_uuid@
+
+    __defined at:__ @duckdb_v2.h 15621:30@
+
+    __exported by:__ @duckdb_v2.h@
+-}
+c_duckdb_v2_value_create_uuid ::
+     DuckDBV2FactoryHandle
+     -- ^ __C declaration:__ @factory@
+  -> PtrConst.PtrConst DuckDBV2HugeintT
+     -- ^ __C declaration:__ @in_value@
+  -> BG.Ptr DuckDBV2ValueHandle
+     -- ^ __C declaration:__ @out_value@
+  -> BG.Ptr DuckDBV2ErrorInfoHandle
+     -- ^ __C declaration:__ @err@
+  -> IO DuckDBV2Error
+c_duckdb_v2_value_create_uuid =
+  hs_bindgen_c3a7f9c056dfa47b
+
+-- __unique:__ @Database_DuckDB_FFI_V2_Database.DuckDB.FFI.V2_Safe_duckdb_v2_value_create_bit@
+foreign import ccall safe "hs_bindgen_24a1843a0540520b" hs_bindgen_24a1843a0540520b_base ::
+     BG.Ptr BG.Void
+  -> BG.Ptr BG.Void
+  -> BG.Ptr BG.Void
+  -> BG.Ptr BG.Void
+  -> IO BG.CUInt
+
+-- __unique:__ @Database_DuckDB_FFI_V2_Database.DuckDB.FFI.V2_Safe_duckdb_v2_value_create_bit@
+hs_bindgen_24a1843a0540520b ::
+     DuckDBV2FactoryHandle
+  -> PtrConst.PtrConst DuckDBV2Str
+  -> BG.Ptr DuckDBV2ValueHandle
+  -> BG.Ptr DuckDBV2ErrorInfoHandle
+  -> IO DuckDBV2Error
+hs_bindgen_24a1843a0540520b =
+  \x0 ->
+    \x1 ->
+      \x2 ->
+        \x3 ->
+          fmap BG.fromFFIType (hs_bindgen_24a1843a0540520b_base (BG.toFFIType x0) (BG.toFFIType x1) (BG.toFFIType x2) (BG.toFFIType x3))
+
+{-| __C declaration:__ @duckdb_v2_value_create_bit@
+
+    __defined at:__ @duckdb_v2.h 15644:30@
+
+    __exported by:__ @duckdb_v2.h@
+-}
+c_duckdb_v2_value_create_bit ::
+     DuckDBV2FactoryHandle
+     -- ^ __C declaration:__ @factory@
+  -> PtrConst.PtrConst DuckDBV2Str
+     -- ^ __C declaration:__ @in_value@
+  -> BG.Ptr DuckDBV2ValueHandle
+     -- ^ __C declaration:__ @out_value@
+  -> BG.Ptr DuckDBV2ErrorInfoHandle
+     -- ^ __C declaration:__ @err@
+  -> IO DuckDBV2Error
+c_duckdb_v2_value_create_bit =
+  hs_bindgen_24a1843a0540520b
+
+-- __unique:__ @Database_DuckDB_FFI_V2_Database.DuckDB.FFI.V2_Safe_duckdb_v2_value_create_bignum@
+foreign import ccall safe "hs_bindgen_4d2585deb143ab9e" hs_bindgen_4d2585deb143ab9e_base ::
+     BG.Ptr BG.Void
+  -> BG.Ptr BG.Void
+  -> BG.Ptr BG.Void
+  -> BG.Ptr BG.Void
+  -> IO BG.CUInt
+
+-- __unique:__ @Database_DuckDB_FFI_V2_Database.DuckDB.FFI.V2_Safe_duckdb_v2_value_create_bignum@
+hs_bindgen_4d2585deb143ab9e ::
+     DuckDBV2FactoryHandle
+  -> PtrConst.PtrConst DuckDBV2Str
+  -> BG.Ptr DuckDBV2ValueHandle
+  -> BG.Ptr DuckDBV2ErrorInfoHandle
+  -> IO DuckDBV2Error
+hs_bindgen_4d2585deb143ab9e =
+  \x0 ->
+    \x1 ->
+      \x2 ->
+        \x3 ->
+          fmap BG.fromFFIType (hs_bindgen_4d2585deb143ab9e_base (BG.toFFIType x0) (BG.toFFIType x1) (BG.toFFIType x2) (BG.toFFIType x3))
+
+{-| __C declaration:__ @duckdb_v2_value_create_bignum@
+
+    __defined at:__ @duckdb_v2.h 15666:30@
+
+    __exported by:__ @duckdb_v2.h@
+-}
+c_duckdb_v2_value_create_bignum ::
+     DuckDBV2FactoryHandle
+     -- ^ __C declaration:__ @factory@
+  -> PtrConst.PtrConst DuckDBV2Str
+     -- ^ __C declaration:__ @in_value@
+  -> BG.Ptr DuckDBV2ValueHandle
+     -- ^ __C declaration:__ @out_value@
+  -> BG.Ptr DuckDBV2ErrorInfoHandle
+     -- ^ __C declaration:__ @err@
+  -> IO DuckDBV2Error
+c_duckdb_v2_value_create_bignum =
+  hs_bindgen_4d2585deb143ab9e
+
+-- __unique:__ @Database_DuckDB_FFI_V2_Database.DuckDB.FFI.V2_Safe_duckdb_v2_value_create_list@
+foreign import ccall safe "hs_bindgen_f93c65da91c2dd98" hs_bindgen_f93c65da91c2dd98_base ::
+     BG.Ptr BG.Void
+  -> BG.Ptr BG.Void
+  -> BG.Ptr BG.Void
+  -> HsBindgen.Runtime.LibC.Word64
+  -> BG.Ptr BG.Void
+  -> BG.Ptr BG.Void
+  -> IO BG.CUInt
+
+-- __unique:__ @Database_DuckDB_FFI_V2_Database.DuckDB.FFI.V2_Safe_duckdb_v2_value_create_list@
+hs_bindgen_f93c65da91c2dd98 ::
+     DuckDBV2FactoryHandle
+  -> DuckDBV2LogicalTypeHandle
+  -> PtrConst.PtrConst DuckDBV2ValueHandle
+  -> DuckDBIdx
+  -> BG.Ptr DuckDBV2ValueHandle
+  -> BG.Ptr DuckDBV2ErrorInfoHandle
+  -> IO DuckDBV2Error
+hs_bindgen_f93c65da91c2dd98 =
+  \x0 ->
+    \x1 ->
+      \x2 ->
+        \x3 ->
+          \x4 ->
+            \x5 ->
+              fmap BG.fromFFIType (hs_bindgen_f93c65da91c2dd98_base (BG.toFFIType x0) (BG.toFFIType x1) (BG.toFFIType x2) (BG.toFFIType x3) (BG.toFFIType x4) (BG.toFFIType x5))
+
+{-| __C declaration:__ @duckdb_v2_value_create_list@
+
+    __defined at:__ @duckdb_v2.h 15695:30@
+
+    __exported by:__ @duckdb_v2.h@
+-}
+c_duckdb_v2_value_create_list ::
+     DuckDBV2FactoryHandle
+     -- ^ __C declaration:__ @factory@
+  -> DuckDBV2LogicalTypeHandle
+     -- ^ __C declaration:__ @child_type@
+  -> PtrConst.PtrConst DuckDBV2ValueHandle
+     -- ^ __C declaration:__ @children@
+  -> DuckDBIdx
+     -- ^ __C declaration:__ @child_count@
+  -> BG.Ptr DuckDBV2ValueHandle
+     -- ^ __C declaration:__ @out_value@
+  -> BG.Ptr DuckDBV2ErrorInfoHandle
+     -- ^ __C declaration:__ @err@
+  -> IO DuckDBV2Error
+c_duckdb_v2_value_create_list =
+  hs_bindgen_f93c65da91c2dd98
+
+-- __unique:__ @Database_DuckDB_FFI_V2_Database.DuckDB.FFI.V2_Safe_duckdb_v2_value_create_array@
+foreign import ccall safe "hs_bindgen_52a1442bbab17e81" hs_bindgen_52a1442bbab17e81_base ::
+     BG.Ptr BG.Void
+  -> BG.Ptr BG.Void
+  -> BG.Ptr BG.Void
+  -> HsBindgen.Runtime.LibC.Word64
+  -> BG.Ptr BG.Void
+  -> BG.Ptr BG.Void
+  -> IO BG.CUInt
+
+-- __unique:__ @Database_DuckDB_FFI_V2_Database.DuckDB.FFI.V2_Safe_duckdb_v2_value_create_array@
+hs_bindgen_52a1442bbab17e81 ::
+     DuckDBV2FactoryHandle
+  -> DuckDBV2LogicalTypeHandle
+  -> PtrConst.PtrConst DuckDBV2ValueHandle
+  -> DuckDBIdx
+  -> BG.Ptr DuckDBV2ValueHandle
+  -> BG.Ptr DuckDBV2ErrorInfoHandle
+  -> IO DuckDBV2Error
+hs_bindgen_52a1442bbab17e81 =
+  \x0 ->
+    \x1 ->
+      \x2 ->
+        \x3 ->
+          \x4 ->
+            \x5 ->
+              fmap BG.fromFFIType (hs_bindgen_52a1442bbab17e81_base (BG.toFFIType x0) (BG.toFFIType x1) (BG.toFFIType x2) (BG.toFFIType x3) (BG.toFFIType x4) (BG.toFFIType x5))
+
+{-| __C declaration:__ @duckdb_v2_value_create_array@
+
+    __defined at:__ @duckdb_v2.h 15722:30@
+
+    __exported by:__ @duckdb_v2.h@
+-}
+c_duckdb_v2_value_create_array ::
+     DuckDBV2FactoryHandle
+     -- ^ __C declaration:__ @factory@
+  -> DuckDBV2LogicalTypeHandle
+     -- ^ __C declaration:__ @child_type@
+  -> PtrConst.PtrConst DuckDBV2ValueHandle
+     -- ^ __C declaration:__ @children@
+  -> DuckDBIdx
+     -- ^ __C declaration:__ @child_count@
+  -> BG.Ptr DuckDBV2ValueHandle
+     -- ^ __C declaration:__ @out_value@
+  -> BG.Ptr DuckDBV2ErrorInfoHandle
+     -- ^ __C declaration:__ @err@
+  -> IO DuckDBV2Error
+c_duckdb_v2_value_create_array =
+  hs_bindgen_52a1442bbab17e81
+
+-- __unique:__ @Database_DuckDB_FFI_V2_Database.DuckDB.FFI.V2_Safe_duckdb_v2_value_create_struct@
+foreign import ccall safe "hs_bindgen_546c97141d36482d" hs_bindgen_546c97141d36482d_base ::
+     BG.Ptr BG.Void
+  -> BG.Ptr BG.Void
+  -> BG.Ptr BG.Void
+  -> HsBindgen.Runtime.LibC.Word64
+  -> BG.Ptr BG.Void
+  -> BG.Ptr BG.Void
+  -> IO BG.CUInt
+
+-- __unique:__ @Database_DuckDB_FFI_V2_Database.DuckDB.FFI.V2_Safe_duckdb_v2_value_create_struct@
+hs_bindgen_546c97141d36482d ::
+     DuckDBV2FactoryHandle
+  -> PtrConst.PtrConst DuckDBV2IdentifierT
+  -> PtrConst.PtrConst DuckDBV2ValueHandle
+  -> DuckDBIdx
+  -> BG.Ptr DuckDBV2ValueHandle
+  -> BG.Ptr DuckDBV2ErrorInfoHandle
+  -> IO DuckDBV2Error
+hs_bindgen_546c97141d36482d =
+  \x0 ->
+    \x1 ->
+      \x2 ->
+        \x3 ->
+          \x4 ->
+            \x5 ->
+              fmap BG.fromFFIType (hs_bindgen_546c97141d36482d_base (BG.toFFIType x0) (BG.toFFIType x1) (BG.toFFIType x2) (BG.toFFIType x3) (BG.toFFIType x4) (BG.toFFIType x5))
+
+{-| __C declaration:__ @duckdb_v2_value_create_struct@
+
+    __defined at:__ @duckdb_v2.h 15750:30@
+
+    __exported by:__ @duckdb_v2.h@
+-}
+c_duckdb_v2_value_create_struct ::
+     DuckDBV2FactoryHandle
+     -- ^ __C declaration:__ @factory@
+  -> PtrConst.PtrConst DuckDBV2IdentifierT
+     -- ^ __C declaration:__ @names@
+  -> PtrConst.PtrConst DuckDBV2ValueHandle
+     -- ^ __C declaration:__ @children@
+  -> DuckDBIdx
+     -- ^ __C declaration:__ @field_count@
+  -> BG.Ptr DuckDBV2ValueHandle
+     -- ^ __C declaration:__ @out_value@
+  -> BG.Ptr DuckDBV2ErrorInfoHandle
+     -- ^ __C declaration:__ @err@
+  -> IO DuckDBV2Error
+c_duckdb_v2_value_create_struct =
+  hs_bindgen_546c97141d36482d
+
+-- __unique:__ @Database_DuckDB_FFI_V2_Database.DuckDB.FFI.V2_Safe_duckdb_v2_value_create_tuple@
+foreign import ccall safe "hs_bindgen_de51802db315078e" hs_bindgen_de51802db315078e_base ::
+     BG.Ptr BG.Void
+  -> BG.Ptr BG.Void
+  -> HsBindgen.Runtime.LibC.Word64
+  -> BG.Ptr BG.Void
+  -> BG.Ptr BG.Void
+  -> IO BG.CUInt
+
+-- __unique:__ @Database_DuckDB_FFI_V2_Database.DuckDB.FFI.V2_Safe_duckdb_v2_value_create_tuple@
+hs_bindgen_de51802db315078e ::
+     DuckDBV2FactoryHandle
+  -> PtrConst.PtrConst DuckDBV2ValueHandle
+  -> DuckDBIdx
+  -> BG.Ptr DuckDBV2ValueHandle
+  -> BG.Ptr DuckDBV2ErrorInfoHandle
+  -> IO DuckDBV2Error
+hs_bindgen_de51802db315078e =
+  \x0 ->
+    \x1 ->
+      \x2 ->
+        \x3 ->
+          \x4 ->
+            fmap BG.fromFFIType (hs_bindgen_de51802db315078e_base (BG.toFFIType x0) (BG.toFFIType x1) (BG.toFFIType x2) (BG.toFFIType x3) (BG.toFFIType x4))
+
+{-| __C declaration:__ @duckdb_v2_value_create_tuple@
+
+    __defined at:__ @duckdb_v2.h 15776:30@
+
+    __exported by:__ @duckdb_v2.h@
+-}
+c_duckdb_v2_value_create_tuple ::
+     DuckDBV2FactoryHandle
+     -- ^ __C declaration:__ @factory@
+  -> PtrConst.PtrConst DuckDBV2ValueHandle
+     -- ^ __C declaration:__ @children@
+  -> DuckDBIdx
+     -- ^ __C declaration:__ @field_count@
+  -> BG.Ptr DuckDBV2ValueHandle
+     -- ^ __C declaration:__ @out_value@
+  -> BG.Ptr DuckDBV2ErrorInfoHandle
+     -- ^ __C declaration:__ @err@
+  -> IO DuckDBV2Error
+c_duckdb_v2_value_create_tuple =
+  hs_bindgen_de51802db315078e
+
+-- __unique:__ @Database_DuckDB_FFI_V2_Database.DuckDB.FFI.V2_Safe_duckdb_v2_value_create_map@
+foreign import ccall safe "hs_bindgen_6865210e4b316857" hs_bindgen_6865210e4b316857_base ::
+     BG.Ptr BG.Void
+  -> BG.Ptr BG.Void
+  -> BG.Ptr BG.Void
+  -> BG.Ptr BG.Void
+  -> BG.Ptr BG.Void
+  -> HsBindgen.Runtime.LibC.Word64
+  -> BG.Ptr BG.Void
+  -> BG.Ptr BG.Void
+  -> IO BG.CUInt
+
+-- __unique:__ @Database_DuckDB_FFI_V2_Database.DuckDB.FFI.V2_Safe_duckdb_v2_value_create_map@
+hs_bindgen_6865210e4b316857 ::
+     DuckDBV2FactoryHandle
+  -> DuckDBV2LogicalTypeHandle
+  -> DuckDBV2LogicalTypeHandle
+  -> PtrConst.PtrConst DuckDBV2ValueHandle
+  -> PtrConst.PtrConst DuckDBV2ValueHandle
+  -> DuckDBIdx
+  -> BG.Ptr DuckDBV2ValueHandle
+  -> BG.Ptr DuckDBV2ErrorInfoHandle
+  -> IO DuckDBV2Error
+hs_bindgen_6865210e4b316857 =
+  \x0 ->
+    \x1 ->
+      \x2 ->
+        \x3 ->
+          \x4 ->
+            \x5 ->
+              \x6 ->
+                \x7 ->
+                  fmap BG.fromFFIType (hs_bindgen_6865210e4b316857_base (BG.toFFIType x0) (BG.toFFIType x1) (BG.toFFIType x2) (BG.toFFIType x3) (BG.toFFIType x4) (BG.toFFIType x5) (BG.toFFIType x6) (BG.toFFIType x7))
+
+{-| __C declaration:__ @duckdb_v2_value_create_map@
+
+    __defined at:__ @duckdb_v2.h 15807:30@
+
+    __exported by:__ @duckdb_v2.h@
+-}
+c_duckdb_v2_value_create_map ::
+     DuckDBV2FactoryHandle
+     -- ^ __C declaration:__ @factory@
+  -> DuckDBV2LogicalTypeHandle
+     -- ^ __C declaration:__ @key_type@
+  -> DuckDBV2LogicalTypeHandle
+     -- ^ __C declaration:__ @value_type@
+  -> PtrConst.PtrConst DuckDBV2ValueHandle
+     -- ^ __C declaration:__ @keys@
+  -> PtrConst.PtrConst DuckDBV2ValueHandle
+     -- ^ __C declaration:__ @values@
+  -> DuckDBIdx
+     -- ^ __C declaration:__ @entry_count@
+  -> BG.Ptr DuckDBV2ValueHandle
+     -- ^ __C declaration:__ @out_value@
+  -> BG.Ptr DuckDBV2ErrorInfoHandle
+     -- ^ __C declaration:__ @err@
+  -> IO DuckDBV2Error
+c_duckdb_v2_value_create_map =
+  hs_bindgen_6865210e4b316857
+
+-- __unique:__ @Database_DuckDB_FFI_V2_Database.DuckDB.FFI.V2_Safe_duckdb_v2_value_get_child_count@
+foreign import ccall safe "hs_bindgen_a79797fd7fb51089" hs_bindgen_a79797fd7fb51089_base ::
+     BG.Ptr BG.Void
+  -> BG.Ptr BG.Void
+  -> BG.Ptr BG.Void
+  -> IO BG.CUInt
+
+-- __unique:__ @Database_DuckDB_FFI_V2_Database.DuckDB.FFI.V2_Safe_duckdb_v2_value_get_child_count@
+hs_bindgen_a79797fd7fb51089 ::
+     DuckDBV2ValueHandle
+  -> BG.Ptr DuckDBIdx
+  -> BG.Ptr DuckDBV2ErrorInfoHandle
+  -> IO DuckDBV2Error
+hs_bindgen_a79797fd7fb51089 =
+  \x0 ->
+    \x1 ->
+      \x2 ->
+        fmap BG.fromFFIType (hs_bindgen_a79797fd7fb51089_base (BG.toFFIType x0) (BG.toFFIType x1) (BG.toFFIType x2))
+
+{-| __C declaration:__ @duckdb_v2_value_get_child_count@
+
+    __defined at:__ @duckdb_v2.h 15829:30@
+
+    __exported by:__ @duckdb_v2.h@
+-}
+c_duckdb_v2_value_get_child_count ::
+     DuckDBV2ValueHandle
+     -- ^ __C declaration:__ @value@
+  -> BG.Ptr DuckDBIdx
+     -- ^ __C declaration:__ @out_count@
+  -> BG.Ptr DuckDBV2ErrorInfoHandle
+     -- ^ __C declaration:__ @err@
+  -> IO DuckDBV2Error
+c_duckdb_v2_value_get_child_count =
+  hs_bindgen_a79797fd7fb51089
+
+-- __unique:__ @Database_DuckDB_FFI_V2_Database.DuckDB.FFI.V2_Safe_duckdb_v2_value_get_child@
+foreign import ccall safe "hs_bindgen_bb5c40aa9d930f6b" hs_bindgen_bb5c40aa9d930f6b_base ::
+     BG.Ptr BG.Void
+  -> HsBindgen.Runtime.LibC.Word64
+  -> BG.Ptr BG.Void
+  -> BG.Ptr BG.Void
+  -> IO BG.CUInt
+
+-- __unique:__ @Database_DuckDB_FFI_V2_Database.DuckDB.FFI.V2_Safe_duckdb_v2_value_get_child@
+hs_bindgen_bb5c40aa9d930f6b ::
+     DuckDBV2ValueHandle
+  -> DuckDBIdx
+  -> BG.Ptr DuckDBV2ValueHandle
+  -> BG.Ptr DuckDBV2ErrorInfoHandle
+  -> IO DuckDBV2Error
+hs_bindgen_bb5c40aa9d930f6b =
+  \x0 ->
+    \x1 ->
+      \x2 ->
+        \x3 ->
+          fmap BG.fromFFIType (hs_bindgen_bb5c40aa9d930f6b_base (BG.toFFIType x0) (BG.toFFIType x1) (BG.toFFIType x2) (BG.toFFIType x3))
+
+{-| __C declaration:__ @duckdb_v2_value_get_child@
+
+    __defined at:__ @duckdb_v2.h 15857:30@
+
+    __exported by:__ @duckdb_v2.h@
+-}
+c_duckdb_v2_value_get_child ::
+     DuckDBV2ValueHandle
+     -- ^ __C declaration:__ @value@
+  -> DuckDBIdx
+     -- ^ __C declaration:__ @index@
+  -> BG.Ptr DuckDBV2ValueHandle
+     -- ^ __C declaration:__ @out_child@
+  -> BG.Ptr DuckDBV2ErrorInfoHandle
+     -- ^ __C declaration:__ @err@
+  -> IO DuckDBV2Error
+c_duckdb_v2_value_get_child =
+  hs_bindgen_bb5c40aa9d930f6b
+
+-- __unique:__ @Database_DuckDB_FFI_V2_Database.DuckDB.FFI.V2_Safe_duckdb_v2_value_cast@
+foreign import ccall safe "hs_bindgen_939b6f0e54e06ba1" hs_bindgen_939b6f0e54e06ba1_base ::
+     BG.Ptr BG.Void
+  -> BG.Ptr BG.Void
+  -> BG.Ptr BG.Void
+  -> BG.Ptr BG.Void
+  -> BG.Ptr BG.Void
+  -> IO BG.CUInt
+
+-- __unique:__ @Database_DuckDB_FFI_V2_Database.DuckDB.FFI.V2_Safe_duckdb_v2_value_cast@
+hs_bindgen_939b6f0e54e06ba1 ::
+     DuckDBV2FactoryHandle
+  -> DuckDBV2ValueHandle
+  -> DuckDBV2LogicalTypeHandle
+  -> BG.Ptr DuckDBV2ValueHandle
+  -> BG.Ptr DuckDBV2ErrorInfoHandle
+  -> IO DuckDBV2Error
+hs_bindgen_939b6f0e54e06ba1 =
+  \x0 ->
+    \x1 ->
+      \x2 ->
+        \x3 ->
+          \x4 ->
+            fmap BG.fromFFIType (hs_bindgen_939b6f0e54e06ba1_base (BG.toFFIType x0) (BG.toFFIType x1) (BG.toFFIType x2) (BG.toFFIType x3) (BG.toFFIType x4))
+
+{-| __C declaration:__ @duckdb_v2_value_cast@
+
+    __defined at:__ @duckdb_v2.h 15886:30@
+
+    __exported by:__ @duckdb_v2.h@
+-}
+c_duckdb_v2_value_cast ::
+     DuckDBV2FactoryHandle
+     -- ^ __C declaration:__ @factory@
+  -> DuckDBV2ValueHandle
+     -- ^ __C declaration:__ @value@
+  -> DuckDBV2LogicalTypeHandle
+     -- ^ __C declaration:__ @target_type@
+  -> BG.Ptr DuckDBV2ValueHandle
+     -- ^ __C declaration:__ @out_value@
+  -> BG.Ptr DuckDBV2ErrorInfoHandle
+     -- ^ __C declaration:__ @err@
+  -> IO DuckDBV2Error
+c_duckdb_v2_value_cast = hs_bindgen_939b6f0e54e06ba1
+
+-- __unique:__ @Database_DuckDB_FFI_V2_Database.DuckDB.FFI.V2_Safe_duckdb_v2_value_is_null@
+foreign import ccall safe "hs_bindgen_b08cf15e7dda52fc" hs_bindgen_b08cf15e7dda52fc_base ::
+     BG.Ptr BG.Void
+  -> BG.Ptr BG.Void
+  -> BG.Ptr BG.Void
+  -> IO BG.CUInt
+
+-- __unique:__ @Database_DuckDB_FFI_V2_Database.DuckDB.FFI.V2_Safe_duckdb_v2_value_is_null@
+hs_bindgen_b08cf15e7dda52fc ::
+     DuckDBV2ValueHandle
+  -> BG.Ptr BG.CBool
+  -> BG.Ptr DuckDBV2ErrorInfoHandle
+  -> IO DuckDBV2Error
+hs_bindgen_b08cf15e7dda52fc =
+  \x0 ->
+    \x1 ->
+      \x2 ->
+        fmap BG.fromFFIType (hs_bindgen_b08cf15e7dda52fc_base (BG.toFFIType x0) (BG.toFFIType x1) (BG.toFFIType x2))
+
+{-| __C declaration:__ @duckdb_v2_value_is_null@
+
+    __defined at:__ @duckdb_v2.h 15903:30@
+
+    __exported by:__ @duckdb_v2.h@
+-}
+c_duckdb_v2_value_is_null ::
+     DuckDBV2ValueHandle
+     -- ^ __C declaration:__ @value@
+  -> BG.Ptr BG.CBool
+     -- ^ __C declaration:__ @out_is_null@
+  -> BG.Ptr DuckDBV2ErrorInfoHandle
+     -- ^ __C declaration:__ @err@
+  -> IO DuckDBV2Error
+c_duckdb_v2_value_is_null =
+  hs_bindgen_b08cf15e7dda52fc
+
+-- __unique:__ @Database_DuckDB_FFI_V2_Database.DuckDB.FFI.V2_Safe_duckdb_v2_value_get_logical_type@
+foreign import ccall safe "hs_bindgen_6b2ca9f5f8833d99" hs_bindgen_6b2ca9f5f8833d99_base ::
+     BG.Ptr BG.Void
+  -> BG.Ptr BG.Void
+  -> BG.Ptr BG.Void
+  -> IO BG.CUInt
+
+-- __unique:__ @Database_DuckDB_FFI_V2_Database.DuckDB.FFI.V2_Safe_duckdb_v2_value_get_logical_type@
+hs_bindgen_6b2ca9f5f8833d99 ::
+     DuckDBV2ValueHandle
+  -> BG.Ptr DuckDBV2LogicalTypeHandle
+  -> BG.Ptr DuckDBV2ErrorInfoHandle
+  -> IO DuckDBV2Error
+hs_bindgen_6b2ca9f5f8833d99 =
+  \x0 ->
+    \x1 ->
+      \x2 ->
+        fmap BG.fromFFIType (hs_bindgen_6b2ca9f5f8833d99_base (BG.toFFIType x0) (BG.toFFIType x1) (BG.toFFIType x2))
+
+{-| __C declaration:__ @duckdb_v2_value_get_logical_type@
+
+    __defined at:__ @duckdb_v2.h 15921:30@
+
+    __exported by:__ @duckdb_v2.h@
+-}
+c_duckdb_v2_value_get_logical_type ::
+     DuckDBV2ValueHandle
+     -- ^ __C declaration:__ @value@
+  -> BG.Ptr DuckDBV2LogicalTypeHandle
+     -- ^ __C declaration:__ @out_type@
+  -> BG.Ptr DuckDBV2ErrorInfoHandle
+     -- ^ __C declaration:__ @err@
+  -> IO DuckDBV2Error
+c_duckdb_v2_value_get_logical_type =
+  hs_bindgen_6b2ca9f5f8833d99
+
+-- __unique:__ @Database_DuckDB_FFI_V2_Database.DuckDB.FFI.V2_Safe_duckdb_v2_value_to_string@
+foreign import ccall safe "hs_bindgen_5b9532c46ecdba0d" hs_bindgen_5b9532c46ecdba0d_base ::
+     BG.Ptr BG.Void
+  -> BG.Ptr BG.Void
+  -> HsBindgen.Runtime.LibC.Word64
+  -> BG.Ptr BG.Void
+  -> BG.Ptr BG.Void
+  -> IO BG.CUInt
+
+-- __unique:__ @Database_DuckDB_FFI_V2_Database.DuckDB.FFI.V2_Safe_duckdb_v2_value_to_string@
+hs_bindgen_5b9532c46ecdba0d ::
+     DuckDBV2ValueHandle
+  -> BG.Ptr BG.CChar
+  -> DuckDBIdx
+  -> BG.Ptr DuckDBIdx
+  -> BG.Ptr DuckDBV2ErrorInfoHandle
+  -> IO DuckDBV2Error
+hs_bindgen_5b9532c46ecdba0d =
+  \x0 ->
+    \x1 ->
+      \x2 ->
+        \x3 ->
+          \x4 ->
+            fmap BG.fromFFIType (hs_bindgen_5b9532c46ecdba0d_base (BG.toFFIType x0) (BG.toFFIType x1) (BG.toFFIType x2) (BG.toFFIType x3) (BG.toFFIType x4))
+
+{-| __C declaration:__ @duckdb_v2_value_to_string@
+
+    __defined at:__ @duckdb_v2.h 15951:30@
+
+    __exported by:__ @duckdb_v2.h@
+-}
+c_duckdb_v2_value_to_string ::
+     DuckDBV2ValueHandle
+     -- ^ __C declaration:__ @value@
+  -> BG.Ptr BG.CChar
+     -- ^ __C declaration:__ @out_string@
+  -> DuckDBIdx
+     -- ^ __C declaration:__ @out_capacity@
+  -> BG.Ptr DuckDBIdx
+     -- ^ __C declaration:__ @out_length@
+  -> BG.Ptr DuckDBV2ErrorInfoHandle
+     -- ^ __C declaration:__ @err@
+  -> IO DuckDBV2Error
+c_duckdb_v2_value_to_string =
+  hs_bindgen_5b9532c46ecdba0d
+
+-- __unique:__ @Database_DuckDB_FFI_V2_Database.DuckDB.FFI.V2_Safe_duckdb_v2_arrow_importer_create@
+foreign import ccall safe "hs_bindgen_43d61d6b8e5afcbe" hs_bindgen_43d61d6b8e5afcbe_base ::
+     BG.Ptr BG.Void
+  -> BG.Ptr BG.Void
+  -> HsBindgen.Runtime.LibC.Word64
+  -> BG.Ptr BG.Void
+  -> BG.Ptr BG.Void
+  -> IO BG.CUInt
+
+-- __unique:__ @Database_DuckDB_FFI_V2_Database.DuckDB.FFI.V2_Safe_duckdb_v2_arrow_importer_create@
+hs_bindgen_43d61d6b8e5afcbe ::
+     DuckDBV2ContextHandle
+  -> BG.Ptr ArrowSchema
+  -> DuckDBIdx
+  -> BG.Ptr DuckDBV2ArrowImporterHandle
+  -> BG.Ptr DuckDBV2ErrorInfoHandle
+  -> IO DuckDBV2Error
+hs_bindgen_43d61d6b8e5afcbe =
+  \x0 ->
+    \x1 ->
+      \x2 ->
+        \x3 ->
+          \x4 ->
+            fmap BG.fromFFIType (hs_bindgen_43d61d6b8e5afcbe_base (BG.toFFIType x0) (BG.toFFIType x1) (BG.toFFIType x2) (BG.toFFIType x3) (BG.toFFIType x4))
+
+{-| __C declaration:__ @duckdb_v2_arrow_importer_create@
+
+    __defined at:__ @duckdb_v2.h 16043:30@
+
+    __exported by:__ @duckdb_v2.h@
+-}
+c_duckdb_v2_arrow_importer_create ::
+     DuckDBV2ContextHandle
+     -- ^ __C declaration:__ @context@
+  -> BG.Ptr ArrowSchema
+     -- ^ __C declaration:__ @schema@
+  -> DuckDBIdx
+     -- ^ __C declaration:__ @batch_size@
+  -> BG.Ptr DuckDBV2ArrowImporterHandle
+     -- ^ __C declaration:__ @out_importer@
+  -> BG.Ptr DuckDBV2ErrorInfoHandle
+     -- ^ __C declaration:__ @err@
+  -> IO DuckDBV2Error
+c_duckdb_v2_arrow_importer_create =
+  hs_bindgen_43d61d6b8e5afcbe
+
+-- __unique:__ @Database_DuckDB_FFI_V2_Database.DuckDB.FFI.V2_Safe_duckdb_v2_arrow_importer_get_schema@
+foreign import ccall safe "hs_bindgen_f1a3bd652ee0abea" hs_bindgen_f1a3bd652ee0abea_base ::
+     BG.Ptr BG.Void
+  -> BG.Ptr BG.Void
+  -> BG.Ptr BG.Void
+  -> IO BG.CUInt
+
+-- __unique:__ @Database_DuckDB_FFI_V2_Database.DuckDB.FFI.V2_Safe_duckdb_v2_arrow_importer_get_schema@
+hs_bindgen_f1a3bd652ee0abea ::
+     DuckDBV2ArrowImporterHandle
+  -> BG.Ptr DuckDBV2SchemaHandle
+  -> BG.Ptr DuckDBV2ErrorInfoHandle
+  -> IO DuckDBV2Error
+hs_bindgen_f1a3bd652ee0abea =
+  \x0 ->
+    \x1 ->
+      \x2 ->
+        fmap BG.fromFFIType (hs_bindgen_f1a3bd652ee0abea_base (BG.toFFIType x0) (BG.toFFIType x1) (BG.toFFIType x2))
+
+{-| __C declaration:__ @duckdb_v2_arrow_importer_get_schema@
+
+    __defined at:__ @duckdb_v2.h 16069:30@
+
+    __exported by:__ @duckdb_v2.h@
+-}
+c_duckdb_v2_arrow_importer_get_schema ::
+     DuckDBV2ArrowImporterHandle
+     -- ^ __C declaration:__ @importer@
+  -> BG.Ptr DuckDBV2SchemaHandle
+     -- ^ __C declaration:__ @out_schema@
+  -> BG.Ptr DuckDBV2ErrorInfoHandle
+     -- ^ __C declaration:__ @err@
+  -> IO DuckDBV2Error
+c_duckdb_v2_arrow_importer_get_schema =
+  hs_bindgen_f1a3bd652ee0abea
+
+-- __unique:__ @Database_DuckDB_FFI_V2_Database.DuckDB.FFI.V2_Safe_duckdb_v2_arrow_importer_append@
+foreign import ccall safe "hs_bindgen_7918df8ebdbfd554" hs_bindgen_7918df8ebdbfd554_base ::
+     BG.Ptr BG.Void
+  -> BG.Ptr BG.Void
+  -> BG.CBool
+  -> BG.CBool
+  -> BG.Ptr BG.Void
+  -> IO BG.CUInt
+
+-- __unique:__ @Database_DuckDB_FFI_V2_Database.DuckDB.FFI.V2_Safe_duckdb_v2_arrow_importer_append@
+hs_bindgen_7918df8ebdbfd554 ::
+     DuckDBV2ArrowImporterHandle
+  -> BG.Ptr ArrowArray
+  -> BG.CBool
+  -> BG.CBool
+  -> BG.Ptr DuckDBV2ErrorInfoHandle
+  -> IO DuckDBV2Error
+hs_bindgen_7918df8ebdbfd554 =
+  \x0 ->
+    \x1 ->
+      \x2 ->
+        \x3 ->
+          \x4 ->
+            fmap BG.fromFFIType (hs_bindgen_7918df8ebdbfd554_base (BG.toFFIType x0) (BG.toFFIType x1) (BG.toFFIType x2) (BG.toFFIType x3) (BG.toFFIType x4))
+
+{-| __C declaration:__ @duckdb_v2_arrow_importer_append@
+
+    __defined at:__ @duckdb_v2.h 16115:30@
+
+    __exported by:__ @duckdb_v2.h@
+-}
+c_duckdb_v2_arrow_importer_append ::
+     DuckDBV2ArrowImporterHandle
+     -- ^ __C declaration:__ @importer@
+  -> BG.Ptr ArrowArray
+     -- ^ __C declaration:__ @array@
+  -> BG.CBool
+     -- ^ __C declaration:__ @consume@
+  -> BG.CBool
+     -- ^ __C declaration:__ @flush@
+  -> BG.Ptr DuckDBV2ErrorInfoHandle
+     -- ^ __C declaration:__ @err@
+  -> IO DuckDBV2Error
+c_duckdb_v2_arrow_importer_append =
+  hs_bindgen_7918df8ebdbfd554
+
+-- __unique:__ @Database_DuckDB_FFI_V2_Database.DuckDB.FFI.V2_Safe_duckdb_v2_arrow_importer_next_chunk@
+foreign import ccall safe "hs_bindgen_23fe015cd74f900f" hs_bindgen_23fe015cd74f900f_base ::
+     BG.Ptr BG.Void
+  -> BG.Ptr BG.Void
+  -> BG.Ptr BG.Void
+  -> IO BG.CUInt
+
+-- __unique:__ @Database_DuckDB_FFI_V2_Database.DuckDB.FFI.V2_Safe_duckdb_v2_arrow_importer_next_chunk@
+hs_bindgen_23fe015cd74f900f ::
+     DuckDBV2ArrowImporterHandle
+  -> BG.Ptr DuckDBV2DataChunkHandle
+  -> BG.Ptr DuckDBV2ErrorInfoHandle
+  -> IO DuckDBV2Error
+hs_bindgen_23fe015cd74f900f =
+  \x0 ->
+    \x1 ->
+      \x2 ->
+        fmap BG.fromFFIType (hs_bindgen_23fe015cd74f900f_base (BG.toFFIType x0) (BG.toFFIType x1) (BG.toFFIType x2))
+
+{-| __C declaration:__ @duckdb_v2_arrow_importer_next_chunk@
+
+    __defined at:__ @duckdb_v2.h 16142:30@
+
+    __exported by:__ @duckdb_v2.h@
+-}
+c_duckdb_v2_arrow_importer_next_chunk ::
+     DuckDBV2ArrowImporterHandle
+     -- ^ __C declaration:__ @importer@
+  -> BG.Ptr DuckDBV2DataChunkHandle
+     -- ^ __C declaration:__ @out_chunk@
+  -> BG.Ptr DuckDBV2ErrorInfoHandle
+     -- ^ __C declaration:__ @err@
+  -> IO DuckDBV2Error
+c_duckdb_v2_arrow_importer_next_chunk =
+  hs_bindgen_23fe015cd74f900f
+
+-- __unique:__ @Database_DuckDB_FFI_V2_Database.DuckDB.FFI.V2_Safe_duckdb_v2_arrow_importer_destroy@
+foreign import ccall safe "hs_bindgen_e6bbce16dd274675" hs_bindgen_e6bbce16dd274675_base ::
+     BG.Ptr BG.Void
+  -> IO BG.CUInt
+
+-- __unique:__ @Database_DuckDB_FFI_V2_Database.DuckDB.FFI.V2_Safe_duckdb_v2_arrow_importer_destroy@
+hs_bindgen_e6bbce16dd274675 ::
+     BG.Ptr DuckDBV2ArrowImporterHandle
+  -> IO DuckDBV2Error
+hs_bindgen_e6bbce16dd274675 =
+  \x0 ->
+    fmap BG.fromFFIType (hs_bindgen_e6bbce16dd274675_base (BG.toFFIType x0))
+
+{-| __C declaration:__ @duckdb_v2_arrow_importer_destroy@
+
+    __defined at:__ @duckdb_v2.h 16161:30@
+
+    __exported by:__ @duckdb_v2.h@
+-}
+c_duckdb_v2_arrow_importer_destroy ::
+     BG.Ptr DuckDBV2ArrowImporterHandle
+     -- ^ __C declaration:__ @importer@
+  -> IO DuckDBV2Error
+c_duckdb_v2_arrow_importer_destroy =
+  hs_bindgen_e6bbce16dd274675
+
+-- __unique:__ @Database_DuckDB_FFI_V2_Database.DuckDB.FFI.V2_Safe_duckdb_v2_arrow_exporter_create@
+foreign import ccall safe "hs_bindgen_0cfd334413b24ade" hs_bindgen_0cfd334413b24ade_base ::
+     BG.Ptr BG.Void
+  -> BG.Ptr BG.Void
+  -> BG.Ptr BG.Void
+  -> HsBindgen.Runtime.LibC.Word64
+  -> HsBindgen.Runtime.LibC.Word64
+  -> BG.Ptr BG.Void
+  -> BG.Ptr BG.Void
+  -> IO BG.CUInt
+
+-- __unique:__ @Database_DuckDB_FFI_V2_Database.DuckDB.FFI.V2_Safe_duckdb_v2_arrow_exporter_create@
+hs_bindgen_0cfd334413b24ade ::
+     DuckDBV2ContextHandle
+  -> PtrConst.PtrConst DuckDBV2LogicalTypeHandle
+  -> PtrConst.PtrConst DuckDBV2Str
+  -> DuckDBIdx
+  -> DuckDBIdx
+  -> BG.Ptr DuckDBV2ArrowExporterHandle
+  -> BG.Ptr DuckDBV2ErrorInfoHandle
+  -> IO DuckDBV2Error
+hs_bindgen_0cfd334413b24ade =
+  \x0 ->
+    \x1 ->
+      \x2 ->
+        \x3 ->
+          \x4 ->
+            \x5 ->
+              \x6 ->
+                fmap BG.fromFFIType (hs_bindgen_0cfd334413b24ade_base (BG.toFFIType x0) (BG.toFFIType x1) (BG.toFFIType x2) (BG.toFFIType x3) (BG.toFFIType x4) (BG.toFFIType x5) (BG.toFFIType x6))
+
+{-| __C declaration:__ @duckdb_v2_arrow_exporter_create@
+
+    __defined at:__ @duckdb_v2.h 16194:30@
+
+    __exported by:__ @duckdb_v2.h@
+-}
+c_duckdb_v2_arrow_exporter_create ::
+     DuckDBV2ContextHandle
+     -- ^ __C declaration:__ @context@
+  -> PtrConst.PtrConst DuckDBV2LogicalTypeHandle
+     -- ^ __C declaration:__ @types@
+  -> PtrConst.PtrConst DuckDBV2Str
+     -- ^ __C declaration:__ @names@
+  -> DuckDBIdx
+     -- ^ __C declaration:__ @count@
+  -> DuckDBIdx
+     -- ^ __C declaration:__ @batch_size@
+  -> BG.Ptr DuckDBV2ArrowExporterHandle
+     -- ^ __C declaration:__ @out_exporter@
+  -> BG.Ptr DuckDBV2ErrorInfoHandle
+     -- ^ __C declaration:__ @err@
+  -> IO DuckDBV2Error
+c_duckdb_v2_arrow_exporter_create =
+  hs_bindgen_0cfd334413b24ade
+
+-- __unique:__ @Database_DuckDB_FFI_V2_Database.DuckDB.FFI.V2_Safe_duckdb_v2_arrow_exporter_get_schema@
+foreign import ccall safe "hs_bindgen_9accaf0a15dfb5de" hs_bindgen_9accaf0a15dfb5de_base ::
+     BG.Ptr BG.Void
+  -> BG.Ptr BG.Void
+  -> BG.Ptr BG.Void
+  -> IO BG.CUInt
+
+-- __unique:__ @Database_DuckDB_FFI_V2_Database.DuckDB.FFI.V2_Safe_duckdb_v2_arrow_exporter_get_schema@
+hs_bindgen_9accaf0a15dfb5de ::
+     DuckDBV2ArrowExporterHandle
+  -> BG.Ptr ArrowSchema
+  -> BG.Ptr DuckDBV2ErrorInfoHandle
+  -> IO DuckDBV2Error
+hs_bindgen_9accaf0a15dfb5de =
+  \x0 ->
+    \x1 ->
+      \x2 ->
+        fmap BG.fromFFIType (hs_bindgen_9accaf0a15dfb5de_base (BG.toFFIType x0) (BG.toFFIType x1) (BG.toFFIType x2))
+
+{-| __C declaration:__ @duckdb_v2_arrow_exporter_get_schema@
+
+    __defined at:__ @duckdb_v2.h 16218:30@
+
+    __exported by:__ @duckdb_v2.h@
+-}
+c_duckdb_v2_arrow_exporter_get_schema ::
+     DuckDBV2ArrowExporterHandle
+     -- ^ __C declaration:__ @exporter@
+  -> BG.Ptr ArrowSchema
+     -- ^ __C declaration:__ @out_schema@
+  -> BG.Ptr DuckDBV2ErrorInfoHandle
+     -- ^ __C declaration:__ @err@
+  -> IO DuckDBV2Error
+c_duckdb_v2_arrow_exporter_get_schema =
+  hs_bindgen_9accaf0a15dfb5de
+
+-- __unique:__ @Database_DuckDB_FFI_V2_Database.DuckDB.FFI.V2_Safe_duckdb_v2_arrow_exporter_append@
+foreign import ccall safe "hs_bindgen_9ff477a8e97d4ef0" hs_bindgen_9ff477a8e97d4ef0_base ::
+     BG.Ptr BG.Void
+  -> BG.Ptr BG.Void
+  -> BG.CBool
+  -> BG.CBool
+  -> BG.Ptr BG.Void
+  -> IO BG.CUInt
+
+-- __unique:__ @Database_DuckDB_FFI_V2_Database.DuckDB.FFI.V2_Safe_duckdb_v2_arrow_exporter_append@
+hs_bindgen_9ff477a8e97d4ef0 ::
+     DuckDBV2ArrowExporterHandle
+  -> BG.Ptr DuckDBV2DataChunkHandle
+  -> BG.CBool
+  -> BG.CBool
+  -> BG.Ptr DuckDBV2ErrorInfoHandle
+  -> IO DuckDBV2Error
+hs_bindgen_9ff477a8e97d4ef0 =
+  \x0 ->
+    \x1 ->
+      \x2 ->
+        \x3 ->
+          \x4 ->
+            fmap BG.fromFFIType (hs_bindgen_9ff477a8e97d4ef0_base (BG.toFFIType x0) (BG.toFFIType x1) (BG.toFFIType x2) (BG.toFFIType x3) (BG.toFFIType x4))
+
+{-| __C declaration:__ @duckdb_v2_arrow_exporter_append@
+
+    __defined at:__ @duckdb_v2.h 16255:30@
+
+    __exported by:__ @duckdb_v2.h@
+-}
+c_duckdb_v2_arrow_exporter_append ::
+     DuckDBV2ArrowExporterHandle
+     -- ^ __C declaration:__ @exporter@
+  -> BG.Ptr DuckDBV2DataChunkHandle
+     -- ^ __C declaration:__ @chunk@
+  -> BG.CBool
+     -- ^ __C declaration:__ @consume@
+  -> BG.CBool
+     -- ^ __C declaration:__ @flush@
+  -> BG.Ptr DuckDBV2ErrorInfoHandle
+     -- ^ __C declaration:__ @err@
+  -> IO DuckDBV2Error
+c_duckdb_v2_arrow_exporter_append =
+  hs_bindgen_9ff477a8e97d4ef0
+
+-- __unique:__ @Database_DuckDB_FFI_V2_Database.DuckDB.FFI.V2_Safe_duckdb_v2_arrow_exporter_next_array@
+foreign import ccall safe "hs_bindgen_1859609c03ba66a2" hs_bindgen_1859609c03ba66a2_base ::
+     BG.Ptr BG.Void
+  -> BG.Ptr BG.Void
+  -> BG.Ptr BG.Void
+  -> IO BG.CUInt
+
+-- __unique:__ @Database_DuckDB_FFI_V2_Database.DuckDB.FFI.V2_Safe_duckdb_v2_arrow_exporter_next_array@
+hs_bindgen_1859609c03ba66a2 ::
+     DuckDBV2ArrowExporterHandle
+  -> BG.Ptr ArrowArray
+  -> BG.Ptr DuckDBV2ErrorInfoHandle
+  -> IO DuckDBV2Error
+hs_bindgen_1859609c03ba66a2 =
+  \x0 ->
+    \x1 ->
+      \x2 ->
+        fmap BG.fromFFIType (hs_bindgen_1859609c03ba66a2_base (BG.toFFIType x0) (BG.toFFIType x1) (BG.toFFIType x2))
+
+{-| __C declaration:__ @duckdb_v2_arrow_exporter_next_array@
+
+    __defined at:__ @duckdb_v2.h 16281:30@
+
+    __exported by:__ @duckdb_v2.h@
+-}
+c_duckdb_v2_arrow_exporter_next_array ::
+     DuckDBV2ArrowExporterHandle
+     -- ^ __C declaration:__ @exporter@
+  -> BG.Ptr ArrowArray
+     -- ^ __C declaration:__ @out_array@
+  -> BG.Ptr DuckDBV2ErrorInfoHandle
+     -- ^ __C declaration:__ @err@
+  -> IO DuckDBV2Error
+c_duckdb_v2_arrow_exporter_next_array =
+  hs_bindgen_1859609c03ba66a2
+
+-- __unique:__ @Database_DuckDB_FFI_V2_Database.DuckDB.FFI.V2_Safe_duckdb_v2_arrow_exporter_destroy@
+foreign import ccall safe "hs_bindgen_cfdf5ff57066ef3b" hs_bindgen_cfdf5ff57066ef3b_base ::
+     BG.Ptr BG.Void
+  -> IO BG.CUInt
+
+-- __unique:__ @Database_DuckDB_FFI_V2_Database.DuckDB.FFI.V2_Safe_duckdb_v2_arrow_exporter_destroy@
+hs_bindgen_cfdf5ff57066ef3b ::
+     BG.Ptr DuckDBV2ArrowExporterHandle
+  -> IO DuckDBV2Error
+hs_bindgen_cfdf5ff57066ef3b =
+  \x0 ->
+    fmap BG.fromFFIType (hs_bindgen_cfdf5ff57066ef3b_base (BG.toFFIType x0))
+
+{-| __C declaration:__ @duckdb_v2_arrow_exporter_destroy@
+
+    __defined at:__ @duckdb_v2.h 16300:30@
+
+    __exported by:__ @duckdb_v2.h@
+-}
+c_duckdb_v2_arrow_exporter_destroy ::
+     BG.Ptr DuckDBV2ArrowExporterHandle
+     -- ^ __C declaration:__ @exporter@
+  -> IO DuckDBV2Error
+c_duckdb_v2_arrow_exporter_destroy =
+  hs_bindgen_cfdf5ff57066ef3b
+
+-- __unique:__ @Database_DuckDB_FFI_V2_Database.DuckDB.FFI.V2_Safe_duckdb_v2_statement_execute_arrow@
+foreign import ccall safe "hs_bindgen_a7feaf45468b159f" hs_bindgen_a7feaf45468b159f_base ::
+     BG.Ptr BG.Void
+  -> BG.Ptr BG.Void
+  -> BG.Ptr BG.Void
+  -> BG.Ptr BG.Void
+  -> HsBindgen.Runtime.LibC.Word64
+  -> HsBindgen.Runtime.LibC.Word64
+  -> BG.Ptr BG.Void
+  -> BG.Ptr BG.Void
+  -> IO BG.CUInt
+
+-- __unique:__ @Database_DuckDB_FFI_V2_Database.DuckDB.FFI.V2_Safe_duckdb_v2_statement_execute_arrow@
+hs_bindgen_a7feaf45468b159f ::
+     DuckDBV2ConnectionHandle
+  -> DuckDBV2SqlStatementHandle
+  -> PtrConst.PtrConst DuckDBV2IdentifierT
+  -> PtrConst.PtrConst DuckDBV2ValueHandle
+  -> DuckDBIdx
+  -> DuckDBIdx
+  -> BG.Ptr DuckDBV2ArrowResultHandle
+  -> BG.Ptr DuckDBV2ErrorInfoHandle
+  -> IO DuckDBV2Error
+hs_bindgen_a7feaf45468b159f =
+  \x0 ->
+    \x1 ->
+      \x2 ->
+        \x3 ->
+          \x4 ->
+            \x5 ->
+              \x6 ->
+                \x7 ->
+                  fmap BG.fromFFIType (hs_bindgen_a7feaf45468b159f_base (BG.toFFIType x0) (BG.toFFIType x1) (BG.toFFIType x2) (BG.toFFIType x3) (BG.toFFIType x4) (BG.toFFIType x5) (BG.toFFIType x6) (BG.toFFIType x7))
+
+{-| __C declaration:__ @duckdb_v2_statement_execute_arrow@
+
+    __defined at:__ @duckdb_v2.h 16323:30@
+
+    __exported by:__ @duckdb_v2.h@
+-}
+c_duckdb_v2_statement_execute_arrow ::
+     DuckDBV2ConnectionHandle
+     -- ^ __C declaration:__ @conn@
+  -> DuckDBV2SqlStatementHandle
+     -- ^ __C declaration:__ @statement@
+  -> PtrConst.PtrConst DuckDBV2IdentifierT
+     -- ^ __C declaration:__ @parameter_names@
+  -> PtrConst.PtrConst DuckDBV2ValueHandle
+     -- ^ __C declaration:__ @parameter_values@
+  -> DuckDBIdx
+     -- ^ __C declaration:__ @parameter_count@
+  -> DuckDBIdx
+     -- ^ __C declaration:__ @batch_size@
+  -> BG.Ptr DuckDBV2ArrowResultHandle
+     -- ^ __C declaration:__ @out_result@
+  -> BG.Ptr DuckDBV2ErrorInfoHandle
+     -- ^ __C declaration:__ @err@
+  -> IO DuckDBV2Error
+c_duckdb_v2_statement_execute_arrow =
+  hs_bindgen_a7feaf45468b159f
+
+-- __unique:__ @Database_DuckDB_FFI_V2_Database.DuckDB.FFI.V2_Safe_duckdb_v2_prepared_statement_execute_arrow@
+foreign import ccall safe "hs_bindgen_9725dce980f6a212" hs_bindgen_9725dce980f6a212_base ::
+     BG.Ptr BG.Void
+  -> BG.Ptr BG.Void
+  -> BG.Ptr BG.Void
+  -> HsBindgen.Runtime.LibC.Word64
+  -> HsBindgen.Runtime.LibC.Word64
+  -> BG.Ptr BG.Void
+  -> BG.Ptr BG.Void
+  -> IO BG.CUInt
+
+-- __unique:__ @Database_DuckDB_FFI_V2_Database.DuckDB.FFI.V2_Safe_duckdb_v2_prepared_statement_execute_arrow@
+hs_bindgen_9725dce980f6a212 ::
+     DuckDBV2PreparedStatementHandle
+  -> PtrConst.PtrConst DuckDBV2IdentifierT
+  -> PtrConst.PtrConst DuckDBV2ValueHandle
+  -> DuckDBIdx
+  -> DuckDBIdx
+  -> BG.Ptr DuckDBV2ArrowResultHandle
+  -> BG.Ptr DuckDBV2ErrorInfoHandle
+  -> IO DuckDBV2Error
+hs_bindgen_9725dce980f6a212 =
+  \x0 ->
+    \x1 ->
+      \x2 ->
+        \x3 ->
+          \x4 ->
+            \x5 ->
+              \x6 ->
+                fmap BG.fromFFIType (hs_bindgen_9725dce980f6a212_base (BG.toFFIType x0) (BG.toFFIType x1) (BG.toFFIType x2) (BG.toFFIType x3) (BG.toFFIType x4) (BG.toFFIType x5) (BG.toFFIType x6))
+
+{-| __C declaration:__ @duckdb_v2_prepared_statement_execute_arrow@
+
+    __defined at:__ @duckdb_v2.h 16351:30@
+
+    __exported by:__ @duckdb_v2.h@
+-}
+c_duckdb_v2_prepared_statement_execute_arrow ::
+     DuckDBV2PreparedStatementHandle
+     -- ^ __C declaration:__ @prepared@
+  -> PtrConst.PtrConst DuckDBV2IdentifierT
+     -- ^ __C declaration:__ @parameter_names@
+  -> PtrConst.PtrConst DuckDBV2ValueHandle
+     -- ^ __C declaration:__ @parameter_values@
+  -> DuckDBIdx
+     -- ^ __C declaration:__ @parameter_count@
+  -> DuckDBIdx
+     -- ^ __C declaration:__ @batch_size@
+  -> BG.Ptr DuckDBV2ArrowResultHandle
+     -- ^ __C declaration:__ @out_result@
+  -> BG.Ptr DuckDBV2ErrorInfoHandle
+     -- ^ __C declaration:__ @err@
+  -> IO DuckDBV2Error
+c_duckdb_v2_prepared_statement_execute_arrow =
+  hs_bindgen_9725dce980f6a212
+
+-- __unique:__ @Database_DuckDB_FFI_V2_Database.DuckDB.FFI.V2_Safe_duckdb_v2_arrow_result_destroy@
+foreign import ccall safe "hs_bindgen_4ba98edb6f024aaa" hs_bindgen_4ba98edb6f024aaa_base ::
+     BG.Ptr BG.Void
+  -> IO BG.CUInt
+
+-- __unique:__ @Database_DuckDB_FFI_V2_Database.DuckDB.FFI.V2_Safe_duckdb_v2_arrow_result_destroy@
+hs_bindgen_4ba98edb6f024aaa ::
+     BG.Ptr DuckDBV2ArrowResultHandle
+  -> IO DuckDBV2Error
+hs_bindgen_4ba98edb6f024aaa =
+  \x0 ->
+    fmap BG.fromFFIType (hs_bindgen_4ba98edb6f024aaa_base (BG.toFFIType x0))
+
+{-| __C declaration:__ @duckdb_v2_arrow_result_destroy@
+
+    __defined at:__ @duckdb_v2.h 16369:30@
+
+    __exported by:__ @duckdb_v2.h@
+-}
+c_duckdb_v2_arrow_result_destroy ::
+     BG.Ptr DuckDBV2ArrowResultHandle
+     -- ^ __C declaration:__ @result@
+  -> IO DuckDBV2Error
+c_duckdb_v2_arrow_result_destroy =
+  hs_bindgen_4ba98edb6f024aaa
+
+-- __unique:__ @Database_DuckDB_FFI_V2_Database.DuckDB.FFI.V2_Safe_duckdb_v2_arrow_result_step@
+foreign import ccall safe "hs_bindgen_f6d3a63b2a6681af" hs_bindgen_f6d3a63b2a6681af_base ::
+     BG.Ptr BG.Void
+  -> BG.Ptr BG.Void
+  -> BG.Ptr BG.Void
+  -> BG.Ptr BG.Void
+  -> IO BG.CUInt
+
+-- __unique:__ @Database_DuckDB_FFI_V2_Database.DuckDB.FFI.V2_Safe_duckdb_v2_arrow_result_step@
+hs_bindgen_f6d3a63b2a6681af ::
+     DuckDBV2ArrowResultHandle
+  -> BG.Ptr ArrowArray
+  -> BG.Ptr DuckDBV2ResultStepStatus
+  -> BG.Ptr DuckDBV2ErrorInfoHandle
+  -> IO DuckDBV2Error
+hs_bindgen_f6d3a63b2a6681af =
+  \x0 ->
+    \x1 ->
+      \x2 ->
+        \x3 ->
+          fmap BG.fromFFIType (hs_bindgen_f6d3a63b2a6681af_base (BG.toFFIType x0) (BG.toFFIType x1) (BG.toFFIType x2) (BG.toFFIType x3))
+
+{-| __C declaration:__ @duckdb_v2_arrow_result_step@
+
+    __defined at:__ @duckdb_v2.h 16389:30@
+
+    __exported by:__ @duckdb_v2.h@
+-}
+c_duckdb_v2_arrow_result_step ::
+     DuckDBV2ArrowResultHandle
+     -- ^ __C declaration:__ @result@
+  -> BG.Ptr ArrowArray
+     -- ^ __C declaration:__ @out_array@
+  -> BG.Ptr DuckDBV2ResultStepStatus
+     -- ^ __C declaration:__ @out_status@
+  -> BG.Ptr DuckDBV2ErrorInfoHandle
+     -- ^ __C declaration:__ @err@
+  -> IO DuckDBV2Error
+c_duckdb_v2_arrow_result_step =
+  hs_bindgen_f6d3a63b2a6681af
+
+-- __unique:__ @Database_DuckDB_FFI_V2_Database.DuckDB.FFI.V2_Safe_duckdb_v2_arrow_result_fetch_array@
+foreign import ccall safe "hs_bindgen_9a4983392d6204a2" hs_bindgen_9a4983392d6204a2_base ::
+     BG.Ptr BG.Void
+  -> BG.Ptr BG.Void
+  -> BG.Ptr BG.Void
+  -> IO BG.CUInt
+
+-- __unique:__ @Database_DuckDB_FFI_V2_Database.DuckDB.FFI.V2_Safe_duckdb_v2_arrow_result_fetch_array@
+hs_bindgen_9a4983392d6204a2 ::
+     DuckDBV2ArrowResultHandle
+  -> BG.Ptr ArrowArray
+  -> BG.Ptr DuckDBV2ErrorInfoHandle
+  -> IO DuckDBV2Error
+hs_bindgen_9a4983392d6204a2 =
+  \x0 ->
+    \x1 ->
+      \x2 ->
+        fmap BG.fromFFIType (hs_bindgen_9a4983392d6204a2_base (BG.toFFIType x0) (BG.toFFIType x1) (BG.toFFIType x2))
+
+{-| __C declaration:__ @duckdb_v2_arrow_result_fetch_array@
+
+    __defined at:__ @duckdb_v2.h 16410:30@
+
+    __exported by:__ @duckdb_v2.h@
+-}
+c_duckdb_v2_arrow_result_fetch_array ::
+     DuckDBV2ArrowResultHandle
+     -- ^ __C declaration:__ @result@
+  -> BG.Ptr ArrowArray
+     -- ^ __C declaration:__ @out_array@
+  -> BG.Ptr DuckDBV2ErrorInfoHandle
+     -- ^ __C declaration:__ @err@
+  -> IO DuckDBV2Error
+c_duckdb_v2_arrow_result_fetch_array =
+  hs_bindgen_9a4983392d6204a2
+
+-- __unique:__ @Database_DuckDB_FFI_V2_Database.DuckDB.FFI.V2_Safe_duckdb_v2_arrow_result_wait@
+foreign import ccall safe "hs_bindgen_08b4ee05f9fc6df0" hs_bindgen_08b4ee05f9fc6df0_base ::
+     BG.Ptr BG.Void
+  -> BG.Ptr BG.Void
+  -> IO BG.CUInt
+
+-- __unique:__ @Database_DuckDB_FFI_V2_Database.DuckDB.FFI.V2_Safe_duckdb_v2_arrow_result_wait@
+hs_bindgen_08b4ee05f9fc6df0 ::
+     DuckDBV2ArrowResultHandle
+  -> BG.Ptr DuckDBV2ErrorInfoHandle
+  -> IO DuckDBV2Error
+hs_bindgen_08b4ee05f9fc6df0 =
+  \x0 ->
+    \x1 ->
+      fmap BG.fromFFIType (hs_bindgen_08b4ee05f9fc6df0_base (BG.toFFIType x0) (BG.toFFIType x1))
+
+{-| __C declaration:__ @duckdb_v2_arrow_result_wait@
+
+    __defined at:__ @duckdb_v2.h 16427:30@
+
+    __exported by:__ @duckdb_v2.h@
+-}
+c_duckdb_v2_arrow_result_wait ::
+     DuckDBV2ArrowResultHandle
+     -- ^ __C declaration:__ @result@
+  -> BG.Ptr DuckDBV2ErrorInfoHandle
+     -- ^ __C declaration:__ @err@
+  -> IO DuckDBV2Error
+c_duckdb_v2_arrow_result_wait =
+  hs_bindgen_08b4ee05f9fc6df0
+
+-- __unique:__ @Database_DuckDB_FFI_V2_Database.DuckDB.FFI.V2_Safe_duckdb_v2_arrow_result_drain@
+foreign import ccall safe "hs_bindgen_9d115d7a4eefcf7d" hs_bindgen_9d115d7a4eefcf7d_base ::
+     BG.Ptr BG.Void
+  -> BG.Ptr BG.Void
+  -> BG.Ptr BG.Void
+  -> IO BG.CUInt
+
+-- __unique:__ @Database_DuckDB_FFI_V2_Database.DuckDB.FFI.V2_Safe_duckdb_v2_arrow_result_drain@
+hs_bindgen_9d115d7a4eefcf7d ::
+     DuckDBV2ArrowResultHandle
+  -> BG.Ptr DuckDBIdx
+  -> BG.Ptr DuckDBV2ErrorInfoHandle
+  -> IO DuckDBV2Error
+hs_bindgen_9d115d7a4eefcf7d =
+  \x0 ->
+    \x1 ->
+      \x2 ->
+        fmap BG.fromFFIType (hs_bindgen_9d115d7a4eefcf7d_base (BG.toFFIType x0) (BG.toFFIType x1) (BG.toFFIType x2))
+
+{-| __C declaration:__ @duckdb_v2_arrow_result_drain@
+
+    __defined at:__ @duckdb_v2.h 16444:30@
+
+    __exported by:__ @duckdb_v2.h@
+-}
+c_duckdb_v2_arrow_result_drain ::
+     DuckDBV2ArrowResultHandle
+     -- ^ __C declaration:__ @result@
+  -> BG.Ptr DuckDBIdx
+     -- ^ __C declaration:__ @out_rows_changed@
+  -> BG.Ptr DuckDBV2ErrorInfoHandle
+     -- ^ __C declaration:__ @err@
+  -> IO DuckDBV2Error
+c_duckdb_v2_arrow_result_drain =
+  hs_bindgen_9d115d7a4eefcf7d
+
+-- __unique:__ @Database_DuckDB_FFI_V2_Database.DuckDB.FFI.V2_Safe_duckdb_v2_arrow_result_get_result_type@
+foreign import ccall safe "hs_bindgen_df90d5b9cdd7d7f4" hs_bindgen_df90d5b9cdd7d7f4_base ::
+     BG.Ptr BG.Void
+  -> BG.Ptr BG.Void
+  -> BG.Ptr BG.Void
+  -> IO BG.CUInt
+
+-- __unique:__ @Database_DuckDB_FFI_V2_Database.DuckDB.FFI.V2_Safe_duckdb_v2_arrow_result_get_result_type@
+hs_bindgen_df90d5b9cdd7d7f4 ::
+     DuckDBV2ArrowResultHandle
+  -> BG.Ptr DuckDBV2ResultType
+  -> BG.Ptr DuckDBV2ErrorInfoHandle
+  -> IO DuckDBV2Error
+hs_bindgen_df90d5b9cdd7d7f4 =
+  \x0 ->
+    \x1 ->
+      \x2 ->
+        fmap BG.fromFFIType (hs_bindgen_df90d5b9cdd7d7f4_base (BG.toFFIType x0) (BG.toFFIType x1) (BG.toFFIType x2))
+
+{-| __C declaration:__ @duckdb_v2_arrow_result_get_result_type@
+
+    __defined at:__ @duckdb_v2.h 16461:30@
+
+    __exported by:__ @duckdb_v2.h@
+-}
+c_duckdb_v2_arrow_result_get_result_type ::
+     DuckDBV2ArrowResultHandle
+     -- ^ __C declaration:__ @result@
+  -> BG.Ptr DuckDBV2ResultType
+     -- ^ __C declaration:__ @out_type@
+  -> BG.Ptr DuckDBV2ErrorInfoHandle
+     -- ^ __C declaration:__ @err@
+  -> IO DuckDBV2Error
+c_duckdb_v2_arrow_result_get_result_type =
+  hs_bindgen_df90d5b9cdd7d7f4
+
+-- __unique:__ @Database_DuckDB_FFI_V2_Database.DuckDB.FFI.V2_Safe_duckdb_v2_arrow_result_get_statement_type@
+foreign import ccall safe "hs_bindgen_9c4be0a3dcd18ff4" hs_bindgen_9c4be0a3dcd18ff4_base ::
+     BG.Ptr BG.Void
+  -> BG.Ptr BG.Void
+  -> BG.Ptr BG.Void
+  -> IO BG.CUInt
+
+-- __unique:__ @Database_DuckDB_FFI_V2_Database.DuckDB.FFI.V2_Safe_duckdb_v2_arrow_result_get_statement_type@
+hs_bindgen_9c4be0a3dcd18ff4 ::
+     DuckDBV2ArrowResultHandle
+  -> BG.Ptr DuckDBV2StatementType
+  -> BG.Ptr DuckDBV2ErrorInfoHandle
+  -> IO DuckDBV2Error
+hs_bindgen_9c4be0a3dcd18ff4 =
+  \x0 ->
+    \x1 ->
+      \x2 ->
+        fmap BG.fromFFIType (hs_bindgen_9c4be0a3dcd18ff4_base (BG.toFFIType x0) (BG.toFFIType x1) (BG.toFFIType x2))
+
+{-| __C declaration:__ @duckdb_v2_arrow_result_get_statement_type@
+
+    __defined at:__ @duckdb_v2.h 16479:30@
+
+    __exported by:__ @duckdb_v2.h@
+-}
+c_duckdb_v2_arrow_result_get_statement_type ::
+     DuckDBV2ArrowResultHandle
+     -- ^ __C declaration:__ @result@
+  -> BG.Ptr DuckDBV2StatementType
+     -- ^ __C declaration:__ @out_type@
+  -> BG.Ptr DuckDBV2ErrorInfoHandle
+     -- ^ __C declaration:__ @err@
+  -> IO DuckDBV2Error
+c_duckdb_v2_arrow_result_get_statement_type =
+  hs_bindgen_9c4be0a3dcd18ff4
+
+-- __unique:__ @Database_DuckDB_FFI_V2_Database.DuckDB.FFI.V2_Safe_duckdb_v2_arrow_result_get_schema@
+foreign import ccall safe "hs_bindgen_0266106004c2a3ba" hs_bindgen_0266106004c2a3ba_base ::
+     BG.Ptr BG.Void
+  -> BG.Ptr BG.Void
+  -> BG.Ptr BG.Void
+  -> IO BG.CUInt
+
+-- __unique:__ @Database_DuckDB_FFI_V2_Database.DuckDB.FFI.V2_Safe_duckdb_v2_arrow_result_get_schema@
+hs_bindgen_0266106004c2a3ba ::
+     DuckDBV2ArrowResultHandle
+  -> BG.Ptr ArrowSchema
+  -> BG.Ptr DuckDBV2ErrorInfoHandle
+  -> IO DuckDBV2Error
+hs_bindgen_0266106004c2a3ba =
+  \x0 ->
+    \x1 ->
+      \x2 ->
+        fmap BG.fromFFIType (hs_bindgen_0266106004c2a3ba_base (BG.toFFIType x0) (BG.toFFIType x1) (BG.toFFIType x2))
+
+{-| __C declaration:__ @duckdb_v2_arrow_result_get_schema@
+
+    __defined at:__ @duckdb_v2.h 16499:30@
+
+    __exported by:__ @duckdb_v2.h@
+-}
+c_duckdb_v2_arrow_result_get_schema ::
+     DuckDBV2ArrowResultHandle
+     -- ^ __C declaration:__ @result@
+  -> BG.Ptr ArrowSchema
+     -- ^ __C declaration:__ @out_schema@
+  -> BG.Ptr DuckDBV2ErrorInfoHandle
+     -- ^ __C declaration:__ @err@
+  -> IO DuckDBV2Error
+c_duckdb_v2_arrow_result_get_schema =
+  hs_bindgen_0266106004c2a3ba
+
+-- __unique:__ @Database_DuckDB_FFI_V2_Database.DuckDB.FFI.V2_Safe_duckdb_v2_arrow_result_to_arrow_c_stream@
+foreign import ccall safe "hs_bindgen_7394c4e3bce82c94" hs_bindgen_7394c4e3bce82c94_base ::
+     BG.Ptr BG.Void
+  -> BG.Ptr BG.Void
+  -> BG.Ptr BG.Void
+  -> IO BG.CUInt
+
+-- __unique:__ @Database_DuckDB_FFI_V2_Database.DuckDB.FFI.V2_Safe_duckdb_v2_arrow_result_to_arrow_c_stream@
+hs_bindgen_7394c4e3bce82c94 ::
+     BG.Ptr DuckDBV2ArrowResultHandle
+  -> BG.Ptr ArrowArrayStream
+  -> BG.Ptr DuckDBV2ErrorInfoHandle
+  -> IO DuckDBV2Error
+hs_bindgen_7394c4e3bce82c94 =
+  \x0 ->
+    \x1 ->
+      \x2 ->
+        fmap BG.fromFFIType (hs_bindgen_7394c4e3bce82c94_base (BG.toFFIType x0) (BG.toFFIType x1) (BG.toFFIType x2))
+
+{-| __C declaration:__ @duckdb_v2_arrow_result_to_arrow_c_stream@
+
+    __defined at:__ @duckdb_v2.h 16524:30@
+
+    __exported by:__ @duckdb_v2.h@
+-}
+c_duckdb_v2_arrow_result_to_arrow_c_stream ::
+     BG.Ptr DuckDBV2ArrowResultHandle
+     -- ^ __C declaration:__ @result@
+  -> BG.Ptr ArrowArrayStream
+     -- ^ __C declaration:__ @out_stream@
+  -> BG.Ptr DuckDBV2ErrorInfoHandle
+     -- ^ __C declaration:__ @err@
+  -> IO DuckDBV2Error
+c_duckdb_v2_arrow_result_to_arrow_c_stream =
+  hs_bindgen_7394c4e3bce82c94
diff --git a/generated/abi-checks-v2.c b/generated/abi-checks-v2.c
new file mode 100644
--- /dev/null
+++ b/generated/abi-checks-v2.c
@@ -0,0 +1,648 @@
+/* Generated by dev/bindings/generate-bindings.sh. Do not edit. */
+#define DUCKDB_V2_API_ALLOW_UNSTABLE 1
+#include "duckdb_v2.h"
+#if !(defined(__linux__) || (defined(__APPLE__) && defined(__ENVIRONMENT_MAC_OS_X_VERSION_MIN_REQUIRED__))) || !(defined(__x86_64__) || defined(__aarch64__))
+#error "duckdb-ffi supports Linux and macOS on x86_64 and aarch64."
+#endif
+_Static_assert(sizeof(struct ArrowArray) == 80, "duckdb-ffi ABI: ArrowArray: size");
+_Static_assert(_Alignof(struct ArrowArray) == 8, "duckdb-ffi ABI: ArrowArray: alignment");
+_Static_assert(sizeof(struct ArrowArrayStream) == 40, "duckdb-ffi ABI: ArrowArrayStream: size");
+_Static_assert(_Alignof(struct ArrowArrayStream) == 8, "duckdb-ffi ABI: ArrowArrayStream: alignment");
+_Static_assert(sizeof(struct ArrowSchema) == 72, "duckdb-ffi ABI: ArrowSchema: size");
+_Static_assert(_Alignof(struct ArrowSchema) == 8, "duckdb-ffi ABI: ArrowSchema: alignment");
+_Static_assert(sizeof(idx_t) == 8, "duckdb-ffi ABI: DuckDBIdx: size");
+_Static_assert(_Alignof(idx_t) == 8, "duckdb-ffi ABI: DuckDBIdx: alignment");
+_Static_assert(sizeof(duckdb_v2_aggregate_function_bind_callback_fn) == 8, "duckdb-ffi ABI: DuckDBV2AggregateFunctionBindCallbackFn: size");
+_Static_assert(_Alignof(duckdb_v2_aggregate_function_bind_callback_fn) == 8, "duckdb-ffi ABI: DuckDBV2AggregateFunctionBindCallbackFn: alignment");
+_Static_assert(sizeof(duckdb_v2_aggregate_function_bind_info_handle) == 8, "duckdb-ffi ABI: DuckDBV2AggregateFunctionBindInfoHandle: size");
+_Static_assert(_Alignof(duckdb_v2_aggregate_function_bind_info_handle) == 8, "duckdb-ffi ABI: DuckDBV2AggregateFunctionBindInfoHandle: alignment");
+_Static_assert(sizeof(struct _duckdb_v2_aggregate_function_bind_info) == 8, "duckdb-ffi ABI: DuckDBV2AggregateFunctionBindInfoStruct: size");
+_Static_assert(_Alignof(struct _duckdb_v2_aggregate_function_bind_info) == 8, "duckdb-ffi ABI: DuckDBV2AggregateFunctionBindInfoStruct: alignment");
+_Static_assert(sizeof(duckdb_v2_aggregate_function_combine_callback_fn) == 8, "duckdb-ffi ABI: DuckDBV2AggregateFunctionCombineCallbackFn: size");
+_Static_assert(_Alignof(duckdb_v2_aggregate_function_combine_callback_fn) == 8, "duckdb-ffi ABI: DuckDBV2AggregateFunctionCombineCallbackFn: alignment");
+_Static_assert(sizeof(duckdb_v2_aggregate_function_combine_info_handle) == 8, "duckdb-ffi ABI: DuckDBV2AggregateFunctionCombineInfoHandle: size");
+_Static_assert(_Alignof(duckdb_v2_aggregate_function_combine_info_handle) == 8, "duckdb-ffi ABI: DuckDBV2AggregateFunctionCombineInfoHandle: alignment");
+_Static_assert(sizeof(struct _duckdb_v2_aggregate_function_combine_info) == 8, "duckdb-ffi ABI: DuckDBV2AggregateFunctionCombineInfoStruct: size");
+_Static_assert(_Alignof(struct _duckdb_v2_aggregate_function_combine_info) == 8, "duckdb-ffi ABI: DuckDBV2AggregateFunctionCombineInfoStruct: alignment");
+_Static_assert(sizeof(duckdb_v2_aggregate_function_destroy_callback_fn) == 8, "duckdb-ffi ABI: DuckDBV2AggregateFunctionDestroyCallbackFn: size");
+_Static_assert(_Alignof(duckdb_v2_aggregate_function_destroy_callback_fn) == 8, "duckdb-ffi ABI: DuckDBV2AggregateFunctionDestroyCallbackFn: alignment");
+_Static_assert(sizeof(duckdb_v2_aggregate_function_destroy_info_handle) == 8, "duckdb-ffi ABI: DuckDBV2AggregateFunctionDestroyInfoHandle: size");
+_Static_assert(_Alignof(duckdb_v2_aggregate_function_destroy_info_handle) == 8, "duckdb-ffi ABI: DuckDBV2AggregateFunctionDestroyInfoHandle: alignment");
+_Static_assert(sizeof(struct _duckdb_v2_aggregate_function_destroy_info) == 8, "duckdb-ffi ABI: DuckDBV2AggregateFunctionDestroyInfoStruct: size");
+_Static_assert(_Alignof(struct _duckdb_v2_aggregate_function_destroy_info) == 8, "duckdb-ffi ABI: DuckDBV2AggregateFunctionDestroyInfoStruct: alignment");
+_Static_assert(sizeof(duckdb_v2_aggregate_function_finalize_callback_fn) == 8, "duckdb-ffi ABI: DuckDBV2AggregateFunctionFinalizeCallbackFn: size");
+_Static_assert(_Alignof(duckdb_v2_aggregate_function_finalize_callback_fn) == 8, "duckdb-ffi ABI: DuckDBV2AggregateFunctionFinalizeCallbackFn: alignment");
+_Static_assert(sizeof(duckdb_v2_aggregate_function_finalize_info_handle) == 8, "duckdb-ffi ABI: DuckDBV2AggregateFunctionFinalizeInfoHandle: size");
+_Static_assert(_Alignof(duckdb_v2_aggregate_function_finalize_info_handle) == 8, "duckdb-ffi ABI: DuckDBV2AggregateFunctionFinalizeInfoHandle: alignment");
+_Static_assert(sizeof(struct _duckdb_v2_aggregate_function_finalize_info) == 8, "duckdb-ffi ABI: DuckDBV2AggregateFunctionFinalizeInfoStruct: size");
+_Static_assert(_Alignof(struct _duckdb_v2_aggregate_function_finalize_info) == 8, "duckdb-ffi ABI: DuckDBV2AggregateFunctionFinalizeInfoStruct: alignment");
+_Static_assert(sizeof(duckdb_v2_aggregate_function_handle) == 8, "duckdb-ffi ABI: DuckDBV2AggregateFunctionHandle: size");
+_Static_assert(_Alignof(duckdb_v2_aggregate_function_handle) == 8, "duckdb-ffi ABI: DuckDBV2AggregateFunctionHandle: alignment");
+_Static_assert(sizeof(duckdb_v2_aggregate_function_init_callback_fn) == 8, "duckdb-ffi ABI: DuckDBV2AggregateFunctionInitCallbackFn: size");
+_Static_assert(_Alignof(duckdb_v2_aggregate_function_init_callback_fn) == 8, "duckdb-ffi ABI: DuckDBV2AggregateFunctionInitCallbackFn: alignment");
+_Static_assert(sizeof(duckdb_v2_aggregate_function_init_info_handle) == 8, "duckdb-ffi ABI: DuckDBV2AggregateFunctionInitInfoHandle: size");
+_Static_assert(_Alignof(duckdb_v2_aggregate_function_init_info_handle) == 8, "duckdb-ffi ABI: DuckDBV2AggregateFunctionInitInfoHandle: alignment");
+_Static_assert(sizeof(struct _duckdb_v2_aggregate_function_init_info) == 8, "duckdb-ffi ABI: DuckDBV2AggregateFunctionInitInfoStruct: size");
+_Static_assert(_Alignof(struct _duckdb_v2_aggregate_function_init_info) == 8, "duckdb-ffi ABI: DuckDBV2AggregateFunctionInitInfoStruct: alignment");
+_Static_assert(sizeof(duckdb_v2_aggregate_function_size_callback_fn) == 8, "duckdb-ffi ABI: DuckDBV2AggregateFunctionSizeCallbackFn: size");
+_Static_assert(_Alignof(duckdb_v2_aggregate_function_size_callback_fn) == 8, "duckdb-ffi ABI: DuckDBV2AggregateFunctionSizeCallbackFn: alignment");
+_Static_assert(sizeof(duckdb_v2_aggregate_function_size_info_handle) == 8, "duckdb-ffi ABI: DuckDBV2AggregateFunctionSizeInfoHandle: size");
+_Static_assert(_Alignof(duckdb_v2_aggregate_function_size_info_handle) == 8, "duckdb-ffi ABI: DuckDBV2AggregateFunctionSizeInfoHandle: alignment");
+_Static_assert(sizeof(struct _duckdb_v2_aggregate_function_size_info) == 8, "duckdb-ffi ABI: DuckDBV2AggregateFunctionSizeInfoStruct: size");
+_Static_assert(_Alignof(struct _duckdb_v2_aggregate_function_size_info) == 8, "duckdb-ffi ABI: DuckDBV2AggregateFunctionSizeInfoStruct: alignment");
+_Static_assert(sizeof(struct _duckdb_v2_aggregate_function) == 8, "duckdb-ffi ABI: DuckDBV2AggregateFunctionStruct: size");
+_Static_assert(_Alignof(struct _duckdb_v2_aggregate_function) == 8, "duckdb-ffi ABI: DuckDBV2AggregateFunctionStruct: alignment");
+_Static_assert(sizeof(duckdb_v2_aggregate_function_update_callback_fn) == 8, "duckdb-ffi ABI: DuckDBV2AggregateFunctionUpdateCallbackFn: size");
+_Static_assert(_Alignof(duckdb_v2_aggregate_function_update_callback_fn) == 8, "duckdb-ffi ABI: DuckDBV2AggregateFunctionUpdateCallbackFn: alignment");
+_Static_assert(sizeof(duckdb_v2_aggregate_function_update_info_handle) == 8, "duckdb-ffi ABI: DuckDBV2AggregateFunctionUpdateInfoHandle: size");
+_Static_assert(_Alignof(duckdb_v2_aggregate_function_update_info_handle) == 8, "duckdb-ffi ABI: DuckDBV2AggregateFunctionUpdateInfoHandle: alignment");
+_Static_assert(sizeof(struct _duckdb_v2_aggregate_function_update_info) == 8, "duckdb-ffi ABI: DuckDBV2AggregateFunctionUpdateInfoStruct: size");
+_Static_assert(_Alignof(struct _duckdb_v2_aggregate_function_update_info) == 8, "duckdb-ffi ABI: DuckDBV2AggregateFunctionUpdateInfoStruct: alignment");
+_Static_assert(sizeof(duckdb_v2_arena_handle) == 8, "duckdb-ffi ABI: DuckDBV2ArenaHandle: size");
+_Static_assert(_Alignof(duckdb_v2_arena_handle) == 8, "duckdb-ffi ABI: DuckDBV2ArenaHandle: alignment");
+_Static_assert(sizeof(struct _duckdb_v2_arena) == 8, "duckdb-ffi ABI: DuckDBV2ArenaStruct: size");
+_Static_assert(_Alignof(struct _duckdb_v2_arena) == 8, "duckdb-ffi ABI: DuckDBV2ArenaStruct: alignment");
+_Static_assert(sizeof(duckdb_v2_arrow_exporter_handle) == 8, "duckdb-ffi ABI: DuckDBV2ArrowExporterHandle: size");
+_Static_assert(_Alignof(duckdb_v2_arrow_exporter_handle) == 8, "duckdb-ffi ABI: DuckDBV2ArrowExporterHandle: alignment");
+_Static_assert(sizeof(struct _duckdb_v2_arrow_exporter) == 8, "duckdb-ffi ABI: DuckDBV2ArrowExporterStruct: size");
+_Static_assert(_Alignof(struct _duckdb_v2_arrow_exporter) == 8, "duckdb-ffi ABI: DuckDBV2ArrowExporterStruct: alignment");
+_Static_assert(sizeof(duckdb_v2_arrow_importer_handle) == 8, "duckdb-ffi ABI: DuckDBV2ArrowImporterHandle: size");
+_Static_assert(_Alignof(duckdb_v2_arrow_importer_handle) == 8, "duckdb-ffi ABI: DuckDBV2ArrowImporterHandle: alignment");
+_Static_assert(sizeof(struct _duckdb_v2_arrow_importer) == 8, "duckdb-ffi ABI: DuckDBV2ArrowImporterStruct: size");
+_Static_assert(_Alignof(struct _duckdb_v2_arrow_importer) == 8, "duckdb-ffi ABI: DuckDBV2ArrowImporterStruct: alignment");
+_Static_assert(sizeof(duckdb_v2_arrow_result_handle) == 8, "duckdb-ffi ABI: DuckDBV2ArrowResultHandle: size");
+_Static_assert(_Alignof(duckdb_v2_arrow_result_handle) == 8, "duckdb-ffi ABI: DuckDBV2ArrowResultHandle: alignment");
+_Static_assert(sizeof(struct _duckdb_v2_arrow_result) == 8, "duckdb-ffi ABI: DuckDBV2ArrowResultStruct: size");
+_Static_assert(_Alignof(struct _duckdb_v2_arrow_result) == 8, "duckdb-ffi ABI: DuckDBV2ArrowResultStruct: alignment");
+_Static_assert(sizeof(duckdb_v2_attach_options_handle) == 8, "duckdb-ffi ABI: DuckDBV2AttachOptionsHandle: size");
+_Static_assert(_Alignof(duckdb_v2_attach_options_handle) == 8, "duckdb-ffi ABI: DuckDBV2AttachOptionsHandle: alignment");
+_Static_assert(sizeof(struct _duckdb_v2_attach_options) == 8, "duckdb-ffi ABI: DuckDBV2AttachOptionsStruct: size");
+_Static_assert(_Alignof(struct _duckdb_v2_attach_options) == 8, "duckdb-ffi ABI: DuckDBV2AttachOptionsStruct: alignment");
+_Static_assert(sizeof(duckdb_v2_bignum_t) == 16, "duckdb-ffi ABI: DuckDBV2BignumT: size");
+_Static_assert(_Alignof(duckdb_v2_bignum_t) == 8, "duckdb-ffi ABI: DuckDBV2BignumT: alignment");
+_Static_assert(sizeof(duckdb_v2_bit_t) == 16, "duckdb-ffi ABI: DuckDBV2BitT: size");
+_Static_assert(_Alignof(duckdb_v2_bit_t) == 8, "duckdb-ffi ABI: DuckDBV2BitT: alignment");
+_Static_assert(sizeof(duckdb_v2_blob_t) == 16, "duckdb-ffi ABI: DuckDBV2BlobT: size");
+_Static_assert(_Alignof(duckdb_v2_blob_t) == 8, "duckdb-ffi ABI: DuckDBV2BlobT: alignment");
+_Static_assert(sizeof(duckdb_v2_bytes) == 16, "duckdb-ffi ABI: DuckDBV2Bytes: size");
+_Static_assert(_Alignof(duckdb_v2_bytes) == 8, "duckdb-ffi ABI: DuckDBV2Bytes: alignment");
+_Static_assert(sizeof(duckdb_v2_cast_function_exec_callback_fn) == 8, "duckdb-ffi ABI: DuckDBV2CastFunctionExecCallbackFn: size");
+_Static_assert(_Alignof(duckdb_v2_cast_function_exec_callback_fn) == 8, "duckdb-ffi ABI: DuckDBV2CastFunctionExecCallbackFn: alignment");
+_Static_assert(sizeof(duckdb_v2_cast_function_exec_info_handle) == 8, "duckdb-ffi ABI: DuckDBV2CastFunctionExecInfoHandle: size");
+_Static_assert(_Alignof(duckdb_v2_cast_function_exec_info_handle) == 8, "duckdb-ffi ABI: DuckDBV2CastFunctionExecInfoHandle: alignment");
+_Static_assert(sizeof(struct _duckdb_v2_cast_function_exec_info) == 8, "duckdb-ffi ABI: DuckDBV2CastFunctionExecInfoStruct: size");
+_Static_assert(_Alignof(struct _duckdb_v2_cast_function_exec_info) == 8, "duckdb-ffi ABI: DuckDBV2CastFunctionExecInfoStruct: alignment");
+_Static_assert(sizeof(duckdb_v2_cast_function_handle) == 8, "duckdb-ffi ABI: DuckDBV2CastFunctionHandle: size");
+_Static_assert(_Alignof(duckdb_v2_cast_function_handle) == 8, "duckdb-ffi ABI: DuckDBV2CastFunctionHandle: alignment");
+_Static_assert(sizeof(struct _duckdb_v2_cast_function) == 8, "duckdb-ffi ABI: DuckDBV2CastFunctionStruct: size");
+_Static_assert(_Alignof(struct _duckdb_v2_cast_function) == 8, "duckdb-ffi ABI: DuckDBV2CastFunctionStruct: alignment");
+_Static_assert(sizeof(DUCKDB_V2_CAST_MODE) == 4, "duckdb-ffi ABI: DuckDBV2CastMode: size");
+_Static_assert(_Alignof(DUCKDB_V2_CAST_MODE) == 4, "duckdb-ffi ABI: DuckDBV2CastMode: alignment");
+_Static_assert(sizeof(duckdb_v2_column_data_collection_append_state_handle) == 8, "duckdb-ffi ABI: DuckDBV2ColumnDataCollectionAppendStateHandle: size");
+_Static_assert(_Alignof(duckdb_v2_column_data_collection_append_state_handle) == 8, "duckdb-ffi ABI: DuckDBV2ColumnDataCollectionAppendStateHandle: alignment");
+_Static_assert(sizeof(struct _duckdb_v2_column_data_collection_append_state) == 8, "duckdb-ffi ABI: DuckDBV2ColumnDataCollectionAppendStateStruct: size");
+_Static_assert(_Alignof(struct _duckdb_v2_column_data_collection_append_state) == 8, "duckdb-ffi ABI: DuckDBV2ColumnDataCollectionAppendStateStruct: alignment");
+_Static_assert(sizeof(duckdb_v2_column_data_collection_handle) == 8, "duckdb-ffi ABI: DuckDBV2ColumnDataCollectionHandle: size");
+_Static_assert(_Alignof(duckdb_v2_column_data_collection_handle) == 8, "duckdb-ffi ABI: DuckDBV2ColumnDataCollectionHandle: alignment");
+_Static_assert(sizeof(duckdb_v2_column_data_collection_shared_scan_state_handle) == 8, "duckdb-ffi ABI: DuckDBV2ColumnDataCollectionSharedScanStateHandle: size");
+_Static_assert(_Alignof(duckdb_v2_column_data_collection_shared_scan_state_handle) == 8, "duckdb-ffi ABI: DuckDBV2ColumnDataCollectionSharedScanStateHandle: alignment");
+_Static_assert(sizeof(struct _duckdb_v2_column_data_collection_shared_scan_state) == 8, "duckdb-ffi ABI: DuckDBV2ColumnDataCollectionSharedScanStateStruct: size");
+_Static_assert(_Alignof(struct _duckdb_v2_column_data_collection_shared_scan_state) == 8, "duckdb-ffi ABI: DuckDBV2ColumnDataCollectionSharedScanStateStruct: alignment");
+_Static_assert(sizeof(struct _duckdb_v2_column_data_collection) == 8, "duckdb-ffi ABI: DuckDBV2ColumnDataCollectionStruct: size");
+_Static_assert(_Alignof(struct _duckdb_v2_column_data_collection) == 8, "duckdb-ffi ABI: DuckDBV2ColumnDataCollectionStruct: alignment");
+_Static_assert(sizeof(duckdb_v2_column_data_collection_worker_scan_state_handle) == 8, "duckdb-ffi ABI: DuckDBV2ColumnDataCollectionWorkerScanStateHandle: size");
+_Static_assert(_Alignof(duckdb_v2_column_data_collection_worker_scan_state_handle) == 8, "duckdb-ffi ABI: DuckDBV2ColumnDataCollectionWorkerScanStateHandle: alignment");
+_Static_assert(sizeof(struct _duckdb_v2_column_data_collection_worker_scan_state) == 8, "duckdb-ffi ABI: DuckDBV2ColumnDataCollectionWorkerScanStateStruct: size");
+_Static_assert(_Alignof(struct _duckdb_v2_column_data_collection_worker_scan_state) == 8, "duckdb-ffi ABI: DuckDBV2ColumnDataCollectionWorkerScanStateStruct: alignment");
+_Static_assert(sizeof(duckdb_v2_column_description_handle) == 8, "duckdb-ffi ABI: DuckDBV2ColumnDescriptionHandle: size");
+_Static_assert(_Alignof(duckdb_v2_column_description_handle) == 8, "duckdb-ffi ABI: DuckDBV2ColumnDescriptionHandle: alignment");
+_Static_assert(sizeof(struct _duckdb_v2_column_description) == 8, "duckdb-ffi ABI: DuckDBV2ColumnDescriptionStruct: size");
+_Static_assert(_Alignof(struct _duckdb_v2_column_description) == 8, "duckdb-ffi ABI: DuckDBV2ColumnDescriptionStruct: alignment");
+_Static_assert(sizeof(duckdb_v2_config_handle) == 8, "duckdb-ffi ABI: DuckDBV2ConfigHandle: size");
+_Static_assert(_Alignof(duckdb_v2_config_handle) == 8, "duckdb-ffi ABI: DuckDBV2ConfigHandle: alignment");
+_Static_assert(sizeof(struct _duckdb_v2_config) == 8, "duckdb-ffi ABI: DuckDBV2ConfigStruct: size");
+_Static_assert(_Alignof(struct _duckdb_v2_config) == 8, "duckdb-ffi ABI: DuckDBV2ConfigStruct: alignment");
+_Static_assert(sizeof(duckdb_v2_connection_handle) == 8, "duckdb-ffi ABI: DuckDBV2ConnectionHandle: size");
+_Static_assert(_Alignof(duckdb_v2_connection_handle) == 8, "duckdb-ffi ABI: DuckDBV2ConnectionHandle: alignment");
+_Static_assert(sizeof(struct _duckdb_v2_connection) == 8, "duckdb-ffi ABI: DuckDBV2ConnectionStruct: size");
+_Static_assert(_Alignof(struct _duckdb_v2_connection) == 8, "duckdb-ffi ABI: DuckDBV2ConnectionStruct: alignment");
+_Static_assert(sizeof(duckdb_v2_context_handle) == 8, "duckdb-ffi ABI: DuckDBV2ContextHandle: size");
+_Static_assert(_Alignof(duckdb_v2_context_handle) == 8, "duckdb-ffi ABI: DuckDBV2ContextHandle: alignment");
+_Static_assert(sizeof(struct _duckdb_v2_context) == 8, "duckdb-ffi ABI: DuckDBV2ContextStruct: size");
+_Static_assert(_Alignof(struct _duckdb_v2_context) == 8, "duckdb-ffi ABI: DuckDBV2ContextStruct: alignment");
+_Static_assert(sizeof(duckdb_v2_copy_from_bind_callback_fn) == 8, "duckdb-ffi ABI: DuckDBV2CopyFromBindCallbackFn: size");
+_Static_assert(_Alignof(duckdb_v2_copy_from_bind_callback_fn) == 8, "duckdb-ffi ABI: DuckDBV2CopyFromBindCallbackFn: alignment");
+_Static_assert(sizeof(duckdb_v2_copy_from_bind_info_handle) == 8, "duckdb-ffi ABI: DuckDBV2CopyFromBindInfoHandle: size");
+_Static_assert(_Alignof(duckdb_v2_copy_from_bind_info_handle) == 8, "duckdb-ffi ABI: DuckDBV2CopyFromBindInfoHandle: alignment");
+_Static_assert(sizeof(struct _duckdb_v2_copy_from_bind_info) == 8, "duckdb-ffi ABI: DuckDBV2CopyFromBindInfoStruct: size");
+_Static_assert(_Alignof(struct _duckdb_v2_copy_from_bind_info) == 8, "duckdb-ffi ABI: DuckDBV2CopyFromBindInfoStruct: alignment");
+_Static_assert(sizeof(duckdb_v2_copy_from_exec_callback_fn) == 8, "duckdb-ffi ABI: DuckDBV2CopyFromExecCallbackFn: size");
+_Static_assert(_Alignof(duckdb_v2_copy_from_exec_callback_fn) == 8, "duckdb-ffi ABI: DuckDBV2CopyFromExecCallbackFn: alignment");
+_Static_assert(sizeof(duckdb_v2_copy_from_exec_info_handle) == 8, "duckdb-ffi ABI: DuckDBV2CopyFromExecInfoHandle: size");
+_Static_assert(_Alignof(duckdb_v2_copy_from_exec_info_handle) == 8, "duckdb-ffi ABI: DuckDBV2CopyFromExecInfoHandle: alignment");
+_Static_assert(sizeof(struct _duckdb_v2_copy_from_exec_info) == 8, "duckdb-ffi ABI: DuckDBV2CopyFromExecInfoStruct: size");
+_Static_assert(_Alignof(struct _duckdb_v2_copy_from_exec_info) == 8, "duckdb-ffi ABI: DuckDBV2CopyFromExecInfoStruct: alignment");
+_Static_assert(sizeof(duckdb_v2_copy_from_init_global_callback_fn) == 8, "duckdb-ffi ABI: DuckDBV2CopyFromInitGlobalCallbackFn: size");
+_Static_assert(_Alignof(duckdb_v2_copy_from_init_global_callback_fn) == 8, "duckdb-ffi ABI: DuckDBV2CopyFromInitGlobalCallbackFn: alignment");
+_Static_assert(sizeof(duckdb_v2_copy_from_init_global_info_handle) == 8, "duckdb-ffi ABI: DuckDBV2CopyFromInitGlobalInfoHandle: size");
+_Static_assert(_Alignof(duckdb_v2_copy_from_init_global_info_handle) == 8, "duckdb-ffi ABI: DuckDBV2CopyFromInitGlobalInfoHandle: alignment");
+_Static_assert(sizeof(struct _duckdb_v2_copy_from_init_global_info) == 8, "duckdb-ffi ABI: DuckDBV2CopyFromInitGlobalInfoStruct: size");
+_Static_assert(_Alignof(struct _duckdb_v2_copy_from_init_global_info) == 8, "duckdb-ffi ABI: DuckDBV2CopyFromInitGlobalInfoStruct: alignment");
+_Static_assert(sizeof(duckdb_v2_copy_from_init_local_callback_fn) == 8, "duckdb-ffi ABI: DuckDBV2CopyFromInitLocalCallbackFn: size");
+_Static_assert(_Alignof(duckdb_v2_copy_from_init_local_callback_fn) == 8, "duckdb-ffi ABI: DuckDBV2CopyFromInitLocalCallbackFn: alignment");
+_Static_assert(sizeof(duckdb_v2_copy_from_init_local_info_handle) == 8, "duckdb-ffi ABI: DuckDBV2CopyFromInitLocalInfoHandle: size");
+_Static_assert(_Alignof(duckdb_v2_copy_from_init_local_info_handle) == 8, "duckdb-ffi ABI: DuckDBV2CopyFromInitLocalInfoHandle: alignment");
+_Static_assert(sizeof(struct _duckdb_v2_copy_from_init_local_info) == 8, "duckdb-ffi ABI: DuckDBV2CopyFromInitLocalInfoStruct: size");
+_Static_assert(_Alignof(struct _duckdb_v2_copy_from_init_local_info) == 8, "duckdb-ffi ABI: DuckDBV2CopyFromInitLocalInfoStruct: alignment");
+_Static_assert(sizeof(duckdb_v2_copy_from_progress_callback_fn) == 8, "duckdb-ffi ABI: DuckDBV2CopyFromProgressCallbackFn: size");
+_Static_assert(_Alignof(duckdb_v2_copy_from_progress_callback_fn) == 8, "duckdb-ffi ABI: DuckDBV2CopyFromProgressCallbackFn: alignment");
+_Static_assert(sizeof(duckdb_v2_copy_from_progress_info_handle) == 8, "duckdb-ffi ABI: DuckDBV2CopyFromProgressInfoHandle: size");
+_Static_assert(_Alignof(duckdb_v2_copy_from_progress_info_handle) == 8, "duckdb-ffi ABI: DuckDBV2CopyFromProgressInfoHandle: alignment");
+_Static_assert(sizeof(struct _duckdb_v2_copy_from_progress_info) == 8, "duckdb-ffi ABI: DuckDBV2CopyFromProgressInfoStruct: size");
+_Static_assert(_Alignof(struct _duckdb_v2_copy_from_progress_info) == 8, "duckdb-ffi ABI: DuckDBV2CopyFromProgressInfoStruct: alignment");
+_Static_assert(sizeof(duckdb_v2_copy_function_handle) == 8, "duckdb-ffi ABI: DuckDBV2CopyFunctionHandle: size");
+_Static_assert(_Alignof(duckdb_v2_copy_function_handle) == 8, "duckdb-ffi ABI: DuckDBV2CopyFunctionHandle: alignment");
+_Static_assert(sizeof(struct _duckdb_v2_copy_function) == 8, "duckdb-ffi ABI: DuckDBV2CopyFunctionStruct: size");
+_Static_assert(_Alignof(struct _duckdb_v2_copy_function) == 8, "duckdb-ffi ABI: DuckDBV2CopyFunctionStruct: alignment");
+_Static_assert(sizeof(duckdb_v2_copy_to_batch_callback_fn) == 8, "duckdb-ffi ABI: DuckDBV2CopyToBatchCallbackFn: size");
+_Static_assert(_Alignof(duckdb_v2_copy_to_batch_callback_fn) == 8, "duckdb-ffi ABI: DuckDBV2CopyToBatchCallbackFn: alignment");
+_Static_assert(sizeof(duckdb_v2_copy_to_batch_info_handle) == 8, "duckdb-ffi ABI: DuckDBV2CopyToBatchInfoHandle: size");
+_Static_assert(_Alignof(duckdb_v2_copy_to_batch_info_handle) == 8, "duckdb-ffi ABI: DuckDBV2CopyToBatchInfoHandle: alignment");
+_Static_assert(sizeof(struct _duckdb_v2_copy_to_batch_info) == 8, "duckdb-ffi ABI: DuckDBV2CopyToBatchInfoStruct: size");
+_Static_assert(_Alignof(struct _duckdb_v2_copy_to_batch_info) == 8, "duckdb-ffi ABI: DuckDBV2CopyToBatchInfoStruct: alignment");
+_Static_assert(sizeof(duckdb_v2_copy_to_batch_size_callback_fn) == 8, "duckdb-ffi ABI: DuckDBV2CopyToBatchSizeCallbackFn: size");
+_Static_assert(_Alignof(duckdb_v2_copy_to_batch_size_callback_fn) == 8, "duckdb-ffi ABI: DuckDBV2CopyToBatchSizeCallbackFn: alignment");
+_Static_assert(sizeof(duckdb_v2_copy_to_batch_size_info_handle) == 8, "duckdb-ffi ABI: DuckDBV2CopyToBatchSizeInfoHandle: size");
+_Static_assert(_Alignof(duckdb_v2_copy_to_batch_size_info_handle) == 8, "duckdb-ffi ABI: DuckDBV2CopyToBatchSizeInfoHandle: alignment");
+_Static_assert(sizeof(struct _duckdb_v2_copy_to_batch_size_info) == 8, "duckdb-ffi ABI: DuckDBV2CopyToBatchSizeInfoStruct: size");
+_Static_assert(_Alignof(struct _duckdb_v2_copy_to_batch_size_info) == 8, "duckdb-ffi ABI: DuckDBV2CopyToBatchSizeInfoStruct: alignment");
+_Static_assert(sizeof(duckdb_v2_copy_to_bind_callback_fn) == 8, "duckdb-ffi ABI: DuckDBV2CopyToBindCallbackFn: size");
+_Static_assert(_Alignof(duckdb_v2_copy_to_bind_callback_fn) == 8, "duckdb-ffi ABI: DuckDBV2CopyToBindCallbackFn: alignment");
+_Static_assert(sizeof(duckdb_v2_copy_to_bind_info_handle) == 8, "duckdb-ffi ABI: DuckDBV2CopyToBindInfoHandle: size");
+_Static_assert(_Alignof(duckdb_v2_copy_to_bind_info_handle) == 8, "duckdb-ffi ABI: DuckDBV2CopyToBindInfoHandle: alignment");
+_Static_assert(sizeof(struct _duckdb_v2_copy_to_bind_info) == 8, "duckdb-ffi ABI: DuckDBV2CopyToBindInfoStruct: size");
+_Static_assert(_Alignof(struct _duckdb_v2_copy_to_bind_info) == 8, "duckdb-ffi ABI: DuckDBV2CopyToBindInfoStruct: alignment");
+_Static_assert(sizeof(duckdb_v2_copy_to_finalize_callback_fn) == 8, "duckdb-ffi ABI: DuckDBV2CopyToFinalizeCallbackFn: size");
+_Static_assert(_Alignof(duckdb_v2_copy_to_finalize_callback_fn) == 8, "duckdb-ffi ABI: DuckDBV2CopyToFinalizeCallbackFn: alignment");
+_Static_assert(sizeof(duckdb_v2_copy_to_finalize_info_handle) == 8, "duckdb-ffi ABI: DuckDBV2CopyToFinalizeInfoHandle: size");
+_Static_assert(_Alignof(duckdb_v2_copy_to_finalize_info_handle) == 8, "duckdb-ffi ABI: DuckDBV2CopyToFinalizeInfoHandle: alignment");
+_Static_assert(sizeof(struct _duckdb_v2_copy_to_finalize_info) == 8, "duckdb-ffi ABI: DuckDBV2CopyToFinalizeInfoStruct: size");
+_Static_assert(_Alignof(struct _duckdb_v2_copy_to_finalize_info) == 8, "duckdb-ffi ABI: DuckDBV2CopyToFinalizeInfoStruct: alignment");
+_Static_assert(sizeof(duckdb_v2_copy_to_flush_callback_fn) == 8, "duckdb-ffi ABI: DuckDBV2CopyToFlushCallbackFn: size");
+_Static_assert(_Alignof(duckdb_v2_copy_to_flush_callback_fn) == 8, "duckdb-ffi ABI: DuckDBV2CopyToFlushCallbackFn: alignment");
+_Static_assert(sizeof(duckdb_v2_copy_to_flush_info_handle) == 8, "duckdb-ffi ABI: DuckDBV2CopyToFlushInfoHandle: size");
+_Static_assert(_Alignof(duckdb_v2_copy_to_flush_info_handle) == 8, "duckdb-ffi ABI: DuckDBV2CopyToFlushInfoHandle: alignment");
+_Static_assert(sizeof(struct _duckdb_v2_copy_to_flush_info) == 8, "duckdb-ffi ABI: DuckDBV2CopyToFlushInfoStruct: size");
+_Static_assert(_Alignof(struct _duckdb_v2_copy_to_flush_info) == 8, "duckdb-ffi ABI: DuckDBV2CopyToFlushInfoStruct: alignment");
+_Static_assert(sizeof(duckdb_v2_copy_to_init_callback_fn) == 8, "duckdb-ffi ABI: DuckDBV2CopyToInitCallbackFn: size");
+_Static_assert(_Alignof(duckdb_v2_copy_to_init_callback_fn) == 8, "duckdb-ffi ABI: DuckDBV2CopyToInitCallbackFn: alignment");
+_Static_assert(sizeof(duckdb_v2_copy_to_init_info_handle) == 8, "duckdb-ffi ABI: DuckDBV2CopyToInitInfoHandle: size");
+_Static_assert(_Alignof(duckdb_v2_copy_to_init_info_handle) == 8, "duckdb-ffi ABI: DuckDBV2CopyToInitInfoHandle: alignment");
+_Static_assert(sizeof(struct _duckdb_v2_copy_to_init_info) == 8, "duckdb-ffi ABI: DuckDBV2CopyToInitInfoStruct: size");
+_Static_assert(_Alignof(struct _duckdb_v2_copy_to_init_info) == 8, "duckdb-ffi ABI: DuckDBV2CopyToInitInfoStruct: alignment");
+_Static_assert(sizeof(duckdb_v2_copy_to_statistics_callback_fn) == 8, "duckdb-ffi ABI: DuckDBV2CopyToStatisticsCallbackFn: size");
+_Static_assert(_Alignof(duckdb_v2_copy_to_statistics_callback_fn) == 8, "duckdb-ffi ABI: DuckDBV2CopyToStatisticsCallbackFn: alignment");
+_Static_assert(sizeof(duckdb_v2_copy_to_statistics_info_handle) == 8, "duckdb-ffi ABI: DuckDBV2CopyToStatisticsInfoHandle: size");
+_Static_assert(_Alignof(duckdb_v2_copy_to_statistics_info_handle) == 8, "duckdb-ffi ABI: DuckDBV2CopyToStatisticsInfoHandle: alignment");
+_Static_assert(sizeof(struct _duckdb_v2_copy_to_statistics_info) == 8, "duckdb-ffi ABI: DuckDBV2CopyToStatisticsInfoStruct: size");
+_Static_assert(_Alignof(struct _duckdb_v2_copy_to_statistics_info) == 8, "duckdb-ffi ABI: DuckDBV2CopyToStatisticsInfoStruct: alignment");
+_Static_assert(sizeof(duckdb_v2_custom_option_handle) == 8, "duckdb-ffi ABI: DuckDBV2CustomOptionHandle: size");
+_Static_assert(_Alignof(duckdb_v2_custom_option_handle) == 8, "duckdb-ffi ABI: DuckDBV2CustomOptionHandle: alignment");
+_Static_assert(sizeof(struct _duckdb_v2_custom_option) == 8, "duckdb-ffi ABI: DuckDBV2CustomOptionStruct: size");
+_Static_assert(_Alignof(struct _duckdb_v2_custom_option) == 8, "duckdb-ffi ABI: DuckDBV2CustomOptionStruct: alignment");
+_Static_assert(sizeof(duckdb_v2_custom_option_update_callback_fn) == 8, "duckdb-ffi ABI: DuckDBV2CustomOptionUpdateCallbackFn: size");
+_Static_assert(_Alignof(duckdb_v2_custom_option_update_callback_fn) == 8, "duckdb-ffi ABI: DuckDBV2CustomOptionUpdateCallbackFn: alignment");
+_Static_assert(sizeof(duckdb_v2_custom_option_update_info_handle) == 8, "duckdb-ffi ABI: DuckDBV2CustomOptionUpdateInfoHandle: size");
+_Static_assert(_Alignof(duckdb_v2_custom_option_update_info_handle) == 8, "duckdb-ffi ABI: DuckDBV2CustomOptionUpdateInfoHandle: alignment");
+_Static_assert(sizeof(struct _duckdb_v2_custom_option_update_info) == 8, "duckdb-ffi ABI: DuckDBV2CustomOptionUpdateInfoStruct: size");
+_Static_assert(_Alignof(struct _duckdb_v2_custom_option_update_info) == 8, "duckdb-ffi ABI: DuckDBV2CustomOptionUpdateInfoStruct: alignment");
+_Static_assert(sizeof(duckdb_v2_custom_type_handle) == 8, "duckdb-ffi ABI: DuckDBV2CustomTypeHandle: size");
+_Static_assert(_Alignof(duckdb_v2_custom_type_handle) == 8, "duckdb-ffi ABI: DuckDBV2CustomTypeHandle: alignment");
+_Static_assert(sizeof(struct _duckdb_v2_custom_type) == 8, "duckdb-ffi ABI: DuckDBV2CustomTypeStruct: size");
+_Static_assert(_Alignof(struct _duckdb_v2_custom_type) == 8, "duckdb-ffi ABI: DuckDBV2CustomTypeStruct: alignment");
+_Static_assert(sizeof(duckdb_v2_data_chunk_handle) == 8, "duckdb-ffi ABI: DuckDBV2DataChunkHandle: size");
+_Static_assert(_Alignof(duckdb_v2_data_chunk_handle) == 8, "duckdb-ffi ABI: DuckDBV2DataChunkHandle: alignment");
+_Static_assert(sizeof(struct _duckdb_v2_data_chunk) == 8, "duckdb-ffi ABI: DuckDBV2DataChunkStruct: size");
+_Static_assert(_Alignof(struct _duckdb_v2_data_chunk) == 8, "duckdb-ffi ABI: DuckDBV2DataChunkStruct: alignment");
+_Static_assert(sizeof(duckdb_v2_environment_handle) == 8, "duckdb-ffi ABI: DuckDBV2EnvironmentHandle: size");
+_Static_assert(_Alignof(duckdb_v2_environment_handle) == 8, "duckdb-ffi ABI: DuckDBV2EnvironmentHandle: alignment");
+_Static_assert(sizeof(struct _duckdb_v2_environment) == 8, "duckdb-ffi ABI: DuckDBV2EnvironmentStruct: size");
+_Static_assert(_Alignof(struct _duckdb_v2_environment) == 8, "duckdb-ffi ABI: DuckDBV2EnvironmentStruct: alignment");
+_Static_assert(sizeof(DUCKDB_V2_ERROR) == 4, "duckdb-ffi ABI: DuckDBV2Error: size");
+_Static_assert(_Alignof(DUCKDB_V2_ERROR) == 4, "duckdb-ffi ABI: DuckDBV2Error: alignment");
+_Static_assert(sizeof(duckdb_v2_error_info_handle) == 8, "duckdb-ffi ABI: DuckDBV2ErrorInfoHandle: size");
+_Static_assert(_Alignof(duckdb_v2_error_info_handle) == 8, "duckdb-ffi ABI: DuckDBV2ErrorInfoHandle: alignment");
+_Static_assert(sizeof(struct _duckdb_v2_error_info) == 8, "duckdb-ffi ABI: DuckDBV2ErrorInfoStruct: size");
+_Static_assert(_Alignof(struct _duckdb_v2_error_info) == 8, "duckdb-ffi ABI: DuckDBV2ErrorInfoStruct: alignment");
+_Static_assert(sizeof(duckdb_v2_expression_handle) == 8, "duckdb-ffi ABI: DuckDBV2ExpressionHandle: size");
+_Static_assert(_Alignof(duckdb_v2_expression_handle) == 8, "duckdb-ffi ABI: DuckDBV2ExpressionHandle: alignment");
+_Static_assert(sizeof(struct _duckdb_v2_expression) == 8, "duckdb-ffi ABI: DuckDBV2ExpressionStruct: size");
+_Static_assert(_Alignof(struct _duckdb_v2_expression) == 8, "duckdb-ffi ABI: DuckDBV2ExpressionStruct: alignment");
+_Static_assert(sizeof(DUCKDB_V2_EXPRESSION_TYPE) == 4, "duckdb-ffi ABI: DuckDBV2ExpressionType: size");
+_Static_assert(_Alignof(DUCKDB_V2_EXPRESSION_TYPE) == 4, "duckdb-ffi ABI: DuckDBV2ExpressionType: alignment");
+_Static_assert(sizeof(duckdb_v2_extension_get_api_fn) == 8, "duckdb-ffi ABI: DuckDBV2ExtensionGetApiFn: size");
+_Static_assert(_Alignof(duckdb_v2_extension_get_api_fn) == 8, "duckdb-ffi ABI: DuckDBV2ExtensionGetApiFn: alignment");
+_Static_assert(sizeof(duckdb_v2_extension_handle) == 8, "duckdb-ffi ABI: DuckDBV2ExtensionHandle: size");
+_Static_assert(_Alignof(duckdb_v2_extension_handle) == 8, "duckdb-ffi ABI: DuckDBV2ExtensionHandle: alignment");
+_Static_assert(sizeof(duckdb_v2_extension_input) == 32, "duckdb-ffi ABI: DuckDBV2ExtensionInput: size");
+_Static_assert(_Alignof(duckdb_v2_extension_input) == 8, "duckdb-ffi ABI: DuckDBV2ExtensionInput: alignment");
+_Static_assert(sizeof(duckdb_v2_factory_handle) == 8, "duckdb-ffi ABI: DuckDBV2FactoryHandle: size");
+_Static_assert(_Alignof(duckdb_v2_factory_handle) == 8, "duckdb-ffi ABI: DuckDBV2FactoryHandle: alignment");
+_Static_assert(sizeof(struct _duckdb_v2_factory) == 8, "duckdb-ffi ABI: DuckDBV2FactoryStruct: size");
+_Static_assert(_Alignof(struct _duckdb_v2_factory) == 8, "duckdb-ffi ABI: DuckDBV2FactoryStruct: alignment");
+_Static_assert(sizeof(DUCKDB_V2_FILE_FLAG) == 4, "duckdb-ffi ABI: DuckDBV2FileFlag: size");
+_Static_assert(_Alignof(DUCKDB_V2_FILE_FLAG) == 4, "duckdb-ffi ABI: DuckDBV2FileFlag: alignment");
+_Static_assert(sizeof(duckdb_v2_file_handle) == 8, "duckdb-ffi ABI: DuckDBV2FileHandle: size");
+_Static_assert(_Alignof(duckdb_v2_file_handle) == 8, "duckdb-ffi ABI: DuckDBV2FileHandle: alignment");
+_Static_assert(sizeof(duckdb_v2_file_open_options_handle) == 8, "duckdb-ffi ABI: DuckDBV2FileOpenOptionsHandle: size");
+_Static_assert(_Alignof(duckdb_v2_file_open_options_handle) == 8, "duckdb-ffi ABI: DuckDBV2FileOpenOptionsHandle: alignment");
+_Static_assert(sizeof(struct _duckdb_v2_file_open_options) == 8, "duckdb-ffi ABI: DuckDBV2FileOpenOptionsStruct: size");
+_Static_assert(_Alignof(struct _duckdb_v2_file_open_options) == 8, "duckdb-ffi ABI: DuckDBV2FileOpenOptionsStruct: alignment");
+_Static_assert(sizeof(struct _duckdb_v2_file) == 8, "duckdb-ffi ABI: DuckDBV2FileStruct: size");
+_Static_assert(_Alignof(struct _duckdb_v2_file) == 8, "duckdb-ffi ABI: DuckDBV2FileStruct: alignment");
+_Static_assert(sizeof(duckdb_v2_file_system_handle) == 8, "duckdb-ffi ABI: DuckDBV2FileSystemHandle: size");
+_Static_assert(_Alignof(duckdb_v2_file_system_handle) == 8, "duckdb-ffi ABI: DuckDBV2FileSystemHandle: alignment");
+_Static_assert(sizeof(duckdb_v2_file_system_path_glob_callback_fn) == 8, "duckdb-ffi ABI: DuckDBV2FileSystemPathGlobCallbackFn: size");
+_Static_assert(_Alignof(duckdb_v2_file_system_path_glob_callback_fn) == 8, "duckdb-ffi ABI: DuckDBV2FileSystemPathGlobCallbackFn: alignment");
+_Static_assert(sizeof(struct _duckdb_v2_file_system) == 8, "duckdb-ffi ABI: DuckDBV2FileSystemStruct: size");
+_Static_assert(_Alignof(struct _duckdb_v2_file_system) == 8, "duckdb-ffi ABI: DuckDBV2FileSystemStruct: alignment");
+_Static_assert(sizeof(duckdb_v2_function_bind_info_handle) == 8, "duckdb-ffi ABI: DuckDBV2FunctionBindInfoHandle: size");
+_Static_assert(_Alignof(duckdb_v2_function_bind_info_handle) == 8, "duckdb-ffi ABI: DuckDBV2FunctionBindInfoHandle: alignment");
+_Static_assert(sizeof(struct _duckdb_v2_function_bind_info) == 8, "duckdb-ffi ABI: DuckDBV2FunctionBindInfoStruct: size");
+_Static_assert(_Alignof(struct _duckdb_v2_function_bind_info) == 8, "duckdb-ffi ABI: DuckDBV2FunctionBindInfoStruct: alignment");
+_Static_assert(sizeof(duckdb_v2_function_docs_handle) == 8, "duckdb-ffi ABI: DuckDBV2FunctionDocsHandle: size");
+_Static_assert(_Alignof(duckdb_v2_function_docs_handle) == 8, "duckdb-ffi ABI: DuckDBV2FunctionDocsHandle: alignment");
+_Static_assert(sizeof(struct _duckdb_v2_function_docs) == 8, "duckdb-ffi ABI: DuckDBV2FunctionDocsStruct: size");
+_Static_assert(_Alignof(struct _duckdb_v2_function_docs) == 8, "duckdb-ffi ABI: DuckDBV2FunctionDocsStruct: alignment");
+_Static_assert(sizeof(DUCKDB_V2_FUNCTION_PARAMETER_KIND) == 4, "duckdb-ffi ABI: DuckDBV2FunctionParameterKind: size");
+_Static_assert(_Alignof(DUCKDB_V2_FUNCTION_PARAMETER_KIND) == 4, "duckdb-ffi ABI: DuckDBV2FunctionParameterKind: alignment");
+_Static_assert(sizeof(DUCKDB_V2_FUNCTION_PROPERTY_KEY) == 4, "duckdb-ffi ABI: DuckDBV2FunctionPropertyKey: size");
+_Static_assert(_Alignof(DUCKDB_V2_FUNCTION_PROPERTY_KEY) == 4, "duckdb-ffi ABI: DuckDBV2FunctionPropertyKey: alignment");
+_Static_assert(sizeof(DUCKDB_V2_FUNCTION_PROPERTY_VALUE) == 4, "duckdb-ffi ABI: DuckDBV2FunctionPropertyValue: size");
+_Static_assert(_Alignof(DUCKDB_V2_FUNCTION_PROPERTY_VALUE) == 4, "duckdb-ffi ABI: DuckDBV2FunctionPropertyValue: alignment");
+_Static_assert(sizeof(duckdb_v2_function_signature_handle) == 8, "duckdb-ffi ABI: DuckDBV2FunctionSignatureHandle: size");
+_Static_assert(_Alignof(duckdb_v2_function_signature_handle) == 8, "duckdb-ffi ABI: DuckDBV2FunctionSignatureHandle: alignment");
+_Static_assert(sizeof(struct _duckdb_v2_function_signature) == 8, "duckdb-ffi ABI: DuckDBV2FunctionSignatureStruct: size");
+_Static_assert(_Alignof(struct _duckdb_v2_function_signature) == 8, "duckdb-ffi ABI: DuckDBV2FunctionSignatureStruct: alignment");
+_Static_assert(sizeof(duckdb_v2_hugeint_t) == 16, "duckdb-ffi ABI: DuckDBV2HugeintT: size");
+_Static_assert(_Alignof(duckdb_v2_hugeint_t) == 8, "duckdb-ffi ABI: DuckDBV2HugeintT: alignment");
+_Static_assert(sizeof(duckdb_v2_identifier_t) == 16, "duckdb-ffi ABI: DuckDBV2IdentifierT: size");
+_Static_assert(_Alignof(duckdb_v2_identifier_t) == 8, "duckdb-ffi ABI: DuckDBV2IdentifierT: alignment");
+_Static_assert(sizeof(duckdb_v2_instance_handle) == 8, "duckdb-ffi ABI: DuckDBV2InstanceHandle: size");
+_Static_assert(_Alignof(duckdb_v2_instance_handle) == 8, "duckdb-ffi ABI: DuckDBV2InstanceHandle: alignment");
+_Static_assert(sizeof(struct _duckdb_v2_instance) == 8, "duckdb-ffi ABI: DuckDBV2InstanceStruct: size");
+_Static_assert(_Alignof(struct _duckdb_v2_instance) == 8, "duckdb-ffi ABI: DuckDBV2InstanceStruct: alignment");
+_Static_assert(sizeof(duckdb_v2_interval_t) == 16, "duckdb-ffi ABI: DuckDBV2IntervalT: size");
+_Static_assert(_Alignof(duckdb_v2_interval_t) == 8, "duckdb-ffi ABI: DuckDBV2IntervalT: alignment");
+_Static_assert(sizeof(duckdb_v2_list_entry) == 16, "duckdb-ffi ABI: DuckDBV2ListEntry: size");
+_Static_assert(_Alignof(duckdb_v2_list_entry) == 8, "duckdb-ffi ABI: DuckDBV2ListEntry: alignment");
+_Static_assert(sizeof(DUCKDB_V2_LOG_LEVEL) == 4, "duckdb-ffi ABI: DuckDBV2LogLevel: size");
+_Static_assert(_Alignof(DUCKDB_V2_LOG_LEVEL) == 4, "duckdb-ffi ABI: DuckDBV2LogLevel: alignment");
+_Static_assert(sizeof(DUCKDB_V2_LOG_SCOPE) == 4, "duckdb-ffi ABI: DuckDBV2LogScope: size");
+_Static_assert(_Alignof(DUCKDB_V2_LOG_SCOPE) == 4, "duckdb-ffi ABI: DuckDBV2LogScope: alignment");
+_Static_assert(sizeof(duckdb_v2_log_sink_flush_callback_fn) == 8, "duckdb-ffi ABI: DuckDBV2LogSinkFlushCallbackFn: size");
+_Static_assert(_Alignof(duckdb_v2_log_sink_flush_callback_fn) == 8, "duckdb-ffi ABI: DuckDBV2LogSinkFlushCallbackFn: alignment");
+_Static_assert(sizeof(duckdb_v2_log_sink_flush_info_handle) == 8, "duckdb-ffi ABI: DuckDBV2LogSinkFlushInfoHandle: size");
+_Static_assert(_Alignof(duckdb_v2_log_sink_flush_info_handle) == 8, "duckdb-ffi ABI: DuckDBV2LogSinkFlushInfoHandle: alignment");
+_Static_assert(sizeof(struct _duckdb_v2_log_sink_flush_info) == 8, "duckdb-ffi ABI: DuckDBV2LogSinkFlushInfoStruct: size");
+_Static_assert(_Alignof(struct _duckdb_v2_log_sink_flush_info) == 8, "duckdb-ffi ABI: DuckDBV2LogSinkFlushInfoStruct: alignment");
+_Static_assert(sizeof(duckdb_v2_log_sink_handle) == 8, "duckdb-ffi ABI: DuckDBV2LogSinkHandle: size");
+_Static_assert(_Alignof(duckdb_v2_log_sink_handle) == 8, "duckdb-ffi ABI: DuckDBV2LogSinkHandle: alignment");
+_Static_assert(sizeof(struct _duckdb_v2_log_sink) == 8, "duckdb-ffi ABI: DuckDBV2LogSinkStruct: size");
+_Static_assert(_Alignof(struct _duckdb_v2_log_sink) == 8, "duckdb-ffi ABI: DuckDBV2LogSinkStruct: alignment");
+_Static_assert(sizeof(duckdb_v2_log_sink_write_callback_fn) == 8, "duckdb-ffi ABI: DuckDBV2LogSinkWriteCallbackFn: size");
+_Static_assert(_Alignof(duckdb_v2_log_sink_write_callback_fn) == 8, "duckdb-ffi ABI: DuckDBV2LogSinkWriteCallbackFn: alignment");
+_Static_assert(sizeof(duckdb_v2_log_sink_write_info_handle) == 8, "duckdb-ffi ABI: DuckDBV2LogSinkWriteInfoHandle: size");
+_Static_assert(_Alignof(duckdb_v2_log_sink_write_info_handle) == 8, "duckdb-ffi ABI: DuckDBV2LogSinkWriteInfoHandle: alignment");
+_Static_assert(sizeof(struct _duckdb_v2_log_sink_write_info) == 8, "duckdb-ffi ABI: DuckDBV2LogSinkWriteInfoStruct: size");
+_Static_assert(_Alignof(struct _duckdb_v2_log_sink_write_info) == 8, "duckdb-ffi ABI: DuckDBV2LogSinkWriteInfoStruct: alignment");
+_Static_assert(sizeof(duckdb_v2_logical_type_handle) == 8, "duckdb-ffi ABI: DuckDBV2LogicalTypeHandle: size");
+_Static_assert(_Alignof(duckdb_v2_logical_type_handle) == 8, "duckdb-ffi ABI: DuckDBV2LogicalTypeHandle: alignment");
+_Static_assert(sizeof(DUCKDB_V2_LOGICAL_TYPE_ID) == 4, "duckdb-ffi ABI: DuckDBV2LogicalTypeId: size");
+_Static_assert(_Alignof(DUCKDB_V2_LOGICAL_TYPE_ID) == 4, "duckdb-ffi ABI: DuckDBV2LogicalTypeId: alignment");
+_Static_assert(sizeof(struct _duckdb_v2_logical_type) == 8, "duckdb-ffi ABI: DuckDBV2LogicalTypeStruct: size");
+_Static_assert(_Alignof(struct _duckdb_v2_logical_type) == 8, "duckdb-ffi ABI: DuckDBV2LogicalTypeStruct: alignment");
+_Static_assert(sizeof(duckdb_v2_macro_function_handle) == 8, "duckdb-ffi ABI: DuckDBV2MacroFunctionHandle: size");
+_Static_assert(_Alignof(duckdb_v2_macro_function_handle) == 8, "duckdb-ffi ABI: DuckDBV2MacroFunctionHandle: alignment");
+_Static_assert(sizeof(struct _duckdb_v2_macro_function) == 8, "duckdb-ffi ABI: DuckDBV2MacroFunctionStruct: size");
+_Static_assert(_Alignof(struct _duckdb_v2_macro_function) == 8, "duckdb-ffi ABI: DuckDBV2MacroFunctionStruct: alignment");
+_Static_assert(sizeof(DUCKDB_V2_MACRO_FUNCTION_TYPE) == 4, "duckdb-ffi ABI: DuckDBV2MacroFunctionType: size");
+_Static_assert(_Alignof(DUCKDB_V2_MACRO_FUNCTION_TYPE) == 4, "duckdb-ffi ABI: DuckDBV2MacroFunctionType: alignment");
+_Static_assert(sizeof(duckdb_v2_multi_file_function_handle) == 8, "duckdb-ffi ABI: DuckDBV2MultiFileFunctionHandle: size");
+_Static_assert(_Alignof(duckdb_v2_multi_file_function_handle) == 8, "duckdb-ffi ABI: DuckDBV2MultiFileFunctionHandle: alignment");
+_Static_assert(sizeof(struct _duckdb_v2_multi_file_function) == 8, "duckdb-ffi ABI: DuckDBV2MultiFileFunctionStruct: size");
+_Static_assert(_Alignof(struct _duckdb_v2_multi_file_function) == 8, "duckdb-ffi ABI: DuckDBV2MultiFileFunctionStruct: alignment");
+_Static_assert(sizeof(duckdb_v2_opaque) == 24, "duckdb-ffi ABI: DuckDBV2Opaque: size");
+_Static_assert(_Alignof(duckdb_v2_opaque) == 8, "duckdb-ffi ABI: DuckDBV2Opaque: alignment");
+_Static_assert(sizeof(duckdb_v2_opaque_destroy_fn) == 8, "duckdb-ffi ABI: DuckDBV2OpaqueDestroyFn: size");
+_Static_assert(_Alignof(duckdb_v2_opaque_destroy_fn) == 8, "duckdb-ffi ABI: DuckDBV2OpaqueDestroyFn: alignment");
+_Static_assert(sizeof(duckdb_v2_opaque_equals_fn) == 8, "duckdb-ffi ABI: DuckDBV2OpaqueEqualsFn: size");
+_Static_assert(_Alignof(duckdb_v2_opaque_equals_fn) == 8, "duckdb-ffi ABI: DuckDBV2OpaqueEqualsFn: alignment");
+_Static_assert(sizeof(duckdb_v2_option_handle) == 8, "duckdb-ffi ABI: DuckDBV2OptionHandle: size");
+_Static_assert(_Alignof(duckdb_v2_option_handle) == 8, "duckdb-ffi ABI: DuckDBV2OptionHandle: alignment");
+_Static_assert(sizeof(struct _duckdb_v2_option) == 8, "duckdb-ffi ABI: DuckDBV2OptionStruct: size");
+_Static_assert(_Alignof(struct _duckdb_v2_option) == 8, "duckdb-ffi ABI: DuckDBV2OptionStruct: alignment");
+_Static_assert(sizeof(DUCKDB_V2_ORDER_PRESERVATION) == 4, "duckdb-ffi ABI: DuckDBV2OrderPreservation: size");
+_Static_assert(_Alignof(DUCKDB_V2_ORDER_PRESERVATION) == 4, "duckdb-ffi ABI: DuckDBV2OrderPreservation: alignment");
+_Static_assert(sizeof(duckdb_v2_pragma_function_exec_callback_fn) == 8, "duckdb-ffi ABI: DuckDBV2PragmaFunctionExecCallbackFn: size");
+_Static_assert(_Alignof(duckdb_v2_pragma_function_exec_callback_fn) == 8, "duckdb-ffi ABI: DuckDBV2PragmaFunctionExecCallbackFn: alignment");
+_Static_assert(sizeof(duckdb_v2_pragma_function_handle) == 8, "duckdb-ffi ABI: DuckDBV2PragmaFunctionHandle: size");
+_Static_assert(_Alignof(duckdb_v2_pragma_function_handle) == 8, "duckdb-ffi ABI: DuckDBV2PragmaFunctionHandle: alignment");
+_Static_assert(sizeof(duckdb_v2_pragma_function_query_callback_fn) == 8, "duckdb-ffi ABI: DuckDBV2PragmaFunctionQueryCallbackFn: size");
+_Static_assert(_Alignof(duckdb_v2_pragma_function_query_callback_fn) == 8, "duckdb-ffi ABI: DuckDBV2PragmaFunctionQueryCallbackFn: alignment");
+_Static_assert(sizeof(duckdb_v2_pragma_function_query_info_handle) == 8, "duckdb-ffi ABI: DuckDBV2PragmaFunctionQueryInfoHandle: size");
+_Static_assert(_Alignof(duckdb_v2_pragma_function_query_info_handle) == 8, "duckdb-ffi ABI: DuckDBV2PragmaFunctionQueryInfoHandle: alignment");
+_Static_assert(sizeof(struct _duckdb_v2_pragma_function_query_info) == 8, "duckdb-ffi ABI: DuckDBV2PragmaFunctionQueryInfoStruct: size");
+_Static_assert(_Alignof(struct _duckdb_v2_pragma_function_query_info) == 8, "duckdb-ffi ABI: DuckDBV2PragmaFunctionQueryInfoStruct: alignment");
+_Static_assert(sizeof(struct _duckdb_v2_pragma_function) == 8, "duckdb-ffi ABI: DuckDBV2PragmaFunctionStruct: size");
+_Static_assert(_Alignof(struct _duckdb_v2_pragma_function) == 8, "duckdb-ffi ABI: DuckDBV2PragmaFunctionStruct: alignment");
+_Static_assert(sizeof(duckdb_v2_prepared_statement_handle) == 8, "duckdb-ffi ABI: DuckDBV2PreparedStatementHandle: size");
+_Static_assert(_Alignof(duckdb_v2_prepared_statement_handle) == 8, "duckdb-ffi ABI: DuckDBV2PreparedStatementHandle: alignment");
+_Static_assert(sizeof(struct _duckdb_v2_prepared_statement) == 8, "duckdb-ffi ABI: DuckDBV2PreparedStatementStruct: size");
+_Static_assert(_Alignof(struct _duckdb_v2_prepared_statement) == 8, "duckdb-ffi ABI: DuckDBV2PreparedStatementStruct: alignment");
+_Static_assert(sizeof(duckdb_v2_qname_handle) == 8, "duckdb-ffi ABI: DuckDBV2QnameHandle: size");
+_Static_assert(_Alignof(duckdb_v2_qname_handle) == 8, "duckdb-ffi ABI: DuckDBV2QnameHandle: alignment");
+_Static_assert(sizeof(struct _duckdb_v2_qname) == 8, "duckdb-ffi ABI: DuckDBV2QnameStruct: size");
+_Static_assert(_Alignof(struct _duckdb_v2_qname) == 8, "duckdb-ffi ABI: DuckDBV2QnameStruct: alignment");
+_Static_assert(sizeof(duckdb_v2_query_metrics_handle) == 8, "duckdb-ffi ABI: DuckDBV2QueryMetricsHandle: size");
+_Static_assert(_Alignof(duckdb_v2_query_metrics_handle) == 8, "duckdb-ffi ABI: DuckDBV2QueryMetricsHandle: alignment");
+_Static_assert(sizeof(duckdb_v2_query_metrics_node_handle) == 8, "duckdb-ffi ABI: DuckDBV2QueryMetricsNodeHandle: size");
+_Static_assert(_Alignof(duckdb_v2_query_metrics_node_handle) == 8, "duckdb-ffi ABI: DuckDBV2QueryMetricsNodeHandle: alignment");
+_Static_assert(sizeof(struct _duckdb_v2_query_metrics_node) == 8, "duckdb-ffi ABI: DuckDBV2QueryMetricsNodeStruct: size");
+_Static_assert(_Alignof(struct _duckdb_v2_query_metrics_node) == 8, "duckdb-ffi ABI: DuckDBV2QueryMetricsNodeStruct: alignment");
+_Static_assert(sizeof(struct _duckdb_v2_query_metrics) == 8, "duckdb-ffi ABI: DuckDBV2QueryMetricsStruct: size");
+_Static_assert(_Alignof(struct _duckdb_v2_query_metrics) == 8, "duckdb-ffi ABI: DuckDBV2QueryMetricsStruct: alignment");
+_Static_assert(sizeof(duckdb_v2_replacement_scan_callback_fn) == 8, "duckdb-ffi ABI: DuckDBV2ReplacementScanCallbackFn: size");
+_Static_assert(_Alignof(duckdb_v2_replacement_scan_callback_fn) == 8, "duckdb-ffi ABI: DuckDBV2ReplacementScanCallbackFn: alignment");
+_Static_assert(sizeof(duckdb_v2_replacement_scan_handle) == 8, "duckdb-ffi ABI: DuckDBV2ReplacementScanHandle: size");
+_Static_assert(_Alignof(duckdb_v2_replacement_scan_handle) == 8, "duckdb-ffi ABI: DuckDBV2ReplacementScanHandle: alignment");
+_Static_assert(sizeof(duckdb_v2_replacement_scan_info_handle) == 8, "duckdb-ffi ABI: DuckDBV2ReplacementScanInfoHandle: size");
+_Static_assert(_Alignof(duckdb_v2_replacement_scan_info_handle) == 8, "duckdb-ffi ABI: DuckDBV2ReplacementScanInfoHandle: alignment");
+_Static_assert(sizeof(struct _duckdb_v2_replacement_scan_info) == 8, "duckdb-ffi ABI: DuckDBV2ReplacementScanInfoStruct: size");
+_Static_assert(_Alignof(struct _duckdb_v2_replacement_scan_info) == 8, "duckdb-ffi ABI: DuckDBV2ReplacementScanInfoStruct: alignment");
+_Static_assert(sizeof(struct _duckdb_v2_replacement_scan) == 8, "duckdb-ffi ABI: DuckDBV2ReplacementScanStruct: size");
+_Static_assert(_Alignof(struct _duckdb_v2_replacement_scan) == 8, "duckdb-ffi ABI: DuckDBV2ReplacementScanStruct: alignment");
+_Static_assert(sizeof(duckdb_v2_result_handle) == 8, "duckdb-ffi ABI: DuckDBV2ResultHandle: size");
+_Static_assert(_Alignof(duckdb_v2_result_handle) == 8, "duckdb-ffi ABI: DuckDBV2ResultHandle: alignment");
+_Static_assert(sizeof(DUCKDB_V2_RESULT_STEP_STATUS) == 4, "duckdb-ffi ABI: DuckDBV2ResultStepStatus: size");
+_Static_assert(_Alignof(DUCKDB_V2_RESULT_STEP_STATUS) == 4, "duckdb-ffi ABI: DuckDBV2ResultStepStatus: alignment");
+_Static_assert(sizeof(struct _duckdb_v2_result) == 8, "duckdb-ffi ABI: DuckDBV2ResultStruct: size");
+_Static_assert(_Alignof(struct _duckdb_v2_result) == 8, "duckdb-ffi ABI: DuckDBV2ResultStruct: alignment");
+_Static_assert(sizeof(DUCKDB_V2_RESULT_TYPE) == 4, "duckdb-ffi ABI: DuckDBV2ResultType: size");
+_Static_assert(_Alignof(DUCKDB_V2_RESULT_TYPE) == 4, "duckdb-ffi ABI: DuckDBV2ResultType: alignment");
+_Static_assert(sizeof(duckdb_v2_scalar_function_bind_callback_fn) == 8, "duckdb-ffi ABI: DuckDBV2ScalarFunctionBindCallbackFn: size");
+_Static_assert(_Alignof(duckdb_v2_scalar_function_bind_callback_fn) == 8, "duckdb-ffi ABI: DuckDBV2ScalarFunctionBindCallbackFn: alignment");
+_Static_assert(sizeof(duckdb_v2_scalar_function_bind_info_handle) == 8, "duckdb-ffi ABI: DuckDBV2ScalarFunctionBindInfoHandle: size");
+_Static_assert(_Alignof(duckdb_v2_scalar_function_bind_info_handle) == 8, "duckdb-ffi ABI: DuckDBV2ScalarFunctionBindInfoHandle: alignment");
+_Static_assert(sizeof(struct _duckdb_v2_scalar_function_bind_info) == 8, "duckdb-ffi ABI: DuckDBV2ScalarFunctionBindInfoStruct: size");
+_Static_assert(_Alignof(struct _duckdb_v2_scalar_function_bind_info) == 8, "duckdb-ffi ABI: DuckDBV2ScalarFunctionBindInfoStruct: alignment");
+_Static_assert(sizeof(duckdb_v2_scalar_function_exec_callback_fn) == 8, "duckdb-ffi ABI: DuckDBV2ScalarFunctionExecCallbackFn: size");
+_Static_assert(_Alignof(duckdb_v2_scalar_function_exec_callback_fn) == 8, "duckdb-ffi ABI: DuckDBV2ScalarFunctionExecCallbackFn: alignment");
+_Static_assert(sizeof(duckdb_v2_scalar_function_exec_info_handle) == 8, "duckdb-ffi ABI: DuckDBV2ScalarFunctionExecInfoHandle: size");
+_Static_assert(_Alignof(duckdb_v2_scalar_function_exec_info_handle) == 8, "duckdb-ffi ABI: DuckDBV2ScalarFunctionExecInfoHandle: alignment");
+_Static_assert(sizeof(struct _duckdb_v2_scalar_function_exec_info) == 8, "duckdb-ffi ABI: DuckDBV2ScalarFunctionExecInfoStruct: size");
+_Static_assert(_Alignof(struct _duckdb_v2_scalar_function_exec_info) == 8, "duckdb-ffi ABI: DuckDBV2ScalarFunctionExecInfoStruct: alignment");
+_Static_assert(sizeof(duckdb_v2_scalar_function_handle) == 8, "duckdb-ffi ABI: DuckDBV2ScalarFunctionHandle: size");
+_Static_assert(_Alignof(duckdb_v2_scalar_function_handle) == 8, "duckdb-ffi ABI: DuckDBV2ScalarFunctionHandle: alignment");
+_Static_assert(sizeof(duckdb_v2_scalar_function_init_callback_fn) == 8, "duckdb-ffi ABI: DuckDBV2ScalarFunctionInitCallbackFn: size");
+_Static_assert(_Alignof(duckdb_v2_scalar_function_init_callback_fn) == 8, "duckdb-ffi ABI: DuckDBV2ScalarFunctionInitCallbackFn: alignment");
+_Static_assert(sizeof(duckdb_v2_scalar_function_init_info_handle) == 8, "duckdb-ffi ABI: DuckDBV2ScalarFunctionInitInfoHandle: size");
+_Static_assert(_Alignof(duckdb_v2_scalar_function_init_info_handle) == 8, "duckdb-ffi ABI: DuckDBV2ScalarFunctionInitInfoHandle: alignment");
+_Static_assert(sizeof(struct _duckdb_v2_scalar_function_init_info) == 8, "duckdb-ffi ABI: DuckDBV2ScalarFunctionInitInfoStruct: size");
+_Static_assert(_Alignof(struct _duckdb_v2_scalar_function_init_info) == 8, "duckdb-ffi ABI: DuckDBV2ScalarFunctionInitInfoStruct: alignment");
+_Static_assert(sizeof(duckdb_v2_scalar_function_resolve_types_callback_fn) == 8, "duckdb-ffi ABI: DuckDBV2ScalarFunctionResolveTypesCallbackFn: size");
+_Static_assert(_Alignof(duckdb_v2_scalar_function_resolve_types_callback_fn) == 8, "duckdb-ffi ABI: DuckDBV2ScalarFunctionResolveTypesCallbackFn: alignment");
+_Static_assert(sizeof(duckdb_v2_scalar_function_resolve_types_info_handle) == 8, "duckdb-ffi ABI: DuckDBV2ScalarFunctionResolveTypesInfoHandle: size");
+_Static_assert(_Alignof(duckdb_v2_scalar_function_resolve_types_info_handle) == 8, "duckdb-ffi ABI: DuckDBV2ScalarFunctionResolveTypesInfoHandle: alignment");
+_Static_assert(sizeof(struct _duckdb_v2_scalar_function_resolve_types_info) == 8, "duckdb-ffi ABI: DuckDBV2ScalarFunctionResolveTypesInfoStruct: size");
+_Static_assert(_Alignof(struct _duckdb_v2_scalar_function_resolve_types_info) == 8, "duckdb-ffi ABI: DuckDBV2ScalarFunctionResolveTypesInfoStruct: alignment");
+_Static_assert(sizeof(struct _duckdb_v2_scalar_function) == 8, "duckdb-ffi ABI: DuckDBV2ScalarFunctionStruct: size");
+_Static_assert(_Alignof(struct _duckdb_v2_scalar_function) == 8, "duckdb-ffi ABI: DuckDBV2ScalarFunctionStruct: alignment");
+_Static_assert(sizeof(duckdb_v2_schema_handle) == 8, "duckdb-ffi ABI: DuckDBV2SchemaHandle: size");
+_Static_assert(_Alignof(duckdb_v2_schema_handle) == 8, "duckdb-ffi ABI: DuckDBV2SchemaHandle: alignment");
+_Static_assert(sizeof(struct _duckdb_v2_schema) == 8, "duckdb-ffi ABI: DuckDBV2SchemaStruct: size");
+_Static_assert(_Alignof(struct _duckdb_v2_schema) == 8, "duckdb-ffi ABI: DuckDBV2SchemaStruct: alignment");
+_Static_assert(sizeof(duckdb_v2_sel_t) == 4, "duckdb-ffi ABI: DuckDBV2SelT: size");
+_Static_assert(_Alignof(duckdb_v2_sel_t) == 4, "duckdb-ffi ABI: DuckDBV2SelT: alignment");
+_Static_assert(sizeof(DUCKDB_V2_SETTING_SCOPE) == 4, "duckdb-ffi ABI: DuckDBV2SettingScope: size");
+_Static_assert(_Alignof(DUCKDB_V2_SETTING_SCOPE) == 4, "duckdb-ffi ABI: DuckDBV2SettingScope: alignment");
+_Static_assert(sizeof(duckdb_v2_sql_statement_handle) == 8, "duckdb-ffi ABI: DuckDBV2SqlStatementHandle: size");
+_Static_assert(_Alignof(duckdb_v2_sql_statement_handle) == 8, "duckdb-ffi ABI: DuckDBV2SqlStatementHandle: alignment");
+_Static_assert(sizeof(struct _duckdb_v2_sql_statement) == 8, "duckdb-ffi ABI: DuckDBV2SqlStatementStruct: size");
+_Static_assert(_Alignof(struct _duckdb_v2_sql_statement) == 8, "duckdb-ffi ABI: DuckDBV2SqlStatementStruct: alignment");
+_Static_assert(sizeof(duckdb_v2_statement_iterator_handle) == 8, "duckdb-ffi ABI: DuckDBV2StatementIteratorHandle: size");
+_Static_assert(_Alignof(duckdb_v2_statement_iterator_handle) == 8, "duckdb-ffi ABI: DuckDBV2StatementIteratorHandle: alignment");
+_Static_assert(sizeof(struct _duckdb_v2_statement_iterator) == 8, "duckdb-ffi ABI: DuckDBV2StatementIteratorStruct: size");
+_Static_assert(_Alignof(struct _duckdb_v2_statement_iterator) == 8, "duckdb-ffi ABI: DuckDBV2StatementIteratorStruct: alignment");
+_Static_assert(sizeof(DUCKDB_V2_STATEMENT_TYPE) == 4, "duckdb-ffi ABI: DuckDBV2StatementType: size");
+_Static_assert(_Alignof(DUCKDB_V2_STATEMENT_TYPE) == 4, "duckdb-ffi ABI: DuckDBV2StatementType: alignment");
+_Static_assert(sizeof(duckdb_v2_str) == 16, "duckdb-ffi ABI: DuckDBV2Str: size");
+_Static_assert(_Alignof(duckdb_v2_str) == 8, "duckdb-ffi ABI: DuckDBV2Str: alignment");
+_Static_assert(sizeof(duckdb_v2_table_description_handle) == 8, "duckdb-ffi ABI: DuckDBV2TableDescriptionHandle: size");
+_Static_assert(_Alignof(duckdb_v2_table_description_handle) == 8, "duckdb-ffi ABI: DuckDBV2TableDescriptionHandle: alignment");
+_Static_assert(sizeof(struct _duckdb_v2_table_description) == 8, "duckdb-ffi ABI: DuckDBV2TableDescriptionStruct: size");
+_Static_assert(_Alignof(struct _duckdb_v2_table_description) == 8, "duckdb-ffi ABI: DuckDBV2TableDescriptionStruct: alignment");
+_Static_assert(sizeof(duckdb_v2_table_function_bind_callback_fn) == 8, "duckdb-ffi ABI: DuckDBV2TableFunctionBindCallbackFn: size");
+_Static_assert(_Alignof(duckdb_v2_table_function_bind_callback_fn) == 8, "duckdb-ffi ABI: DuckDBV2TableFunctionBindCallbackFn: alignment");
+_Static_assert(sizeof(duckdb_v2_table_function_bind_info_handle) == 8, "duckdb-ffi ABI: DuckDBV2TableFunctionBindInfoHandle: size");
+_Static_assert(_Alignof(duckdb_v2_table_function_bind_info_handle) == 8, "duckdb-ffi ABI: DuckDBV2TableFunctionBindInfoHandle: alignment");
+_Static_assert(sizeof(struct _duckdb_v2_table_function_bind_info) == 8, "duckdb-ffi ABI: DuckDBV2TableFunctionBindInfoStruct: size");
+_Static_assert(_Alignof(struct _duckdb_v2_table_function_bind_info) == 8, "duckdb-ffi ABI: DuckDBV2TableFunctionBindInfoStruct: alignment");
+_Static_assert(sizeof(duckdb_v2_table_function_claim_batch_callback_fn) == 8, "duckdb-ffi ABI: DuckDBV2TableFunctionClaimBatchCallbackFn: size");
+_Static_assert(_Alignof(duckdb_v2_table_function_claim_batch_callback_fn) == 8, "duckdb-ffi ABI: DuckDBV2TableFunctionClaimBatchCallbackFn: alignment");
+_Static_assert(sizeof(duckdb_v2_table_function_claim_batch_info_handle) == 8, "duckdb-ffi ABI: DuckDBV2TableFunctionClaimBatchInfoHandle: size");
+_Static_assert(_Alignof(duckdb_v2_table_function_claim_batch_info_handle) == 8, "duckdb-ffi ABI: DuckDBV2TableFunctionClaimBatchInfoHandle: alignment");
+_Static_assert(sizeof(struct _duckdb_v2_table_function_claim_batch_info) == 8, "duckdb-ffi ABI: DuckDBV2TableFunctionClaimBatchInfoStruct: size");
+_Static_assert(_Alignof(struct _duckdb_v2_table_function_claim_batch_info) == 8, "duckdb-ffi ABI: DuckDBV2TableFunctionClaimBatchInfoStruct: alignment");
+_Static_assert(sizeof(duckdb_v2_table_function_exec_callback_fn) == 8, "duckdb-ffi ABI: DuckDBV2TableFunctionExecCallbackFn: size");
+_Static_assert(_Alignof(duckdb_v2_table_function_exec_callback_fn) == 8, "duckdb-ffi ABI: DuckDBV2TableFunctionExecCallbackFn: alignment");
+_Static_assert(sizeof(duckdb_v2_table_function_exec_info_handle) == 8, "duckdb-ffi ABI: DuckDBV2TableFunctionExecInfoHandle: size");
+_Static_assert(_Alignof(duckdb_v2_table_function_exec_info_handle) == 8, "duckdb-ffi ABI: DuckDBV2TableFunctionExecInfoHandle: alignment");
+_Static_assert(sizeof(struct _duckdb_v2_table_function_exec_info) == 8, "duckdb-ffi ABI: DuckDBV2TableFunctionExecInfoStruct: size");
+_Static_assert(_Alignof(struct _duckdb_v2_table_function_exec_info) == 8, "duckdb-ffi ABI: DuckDBV2TableFunctionExecInfoStruct: alignment");
+_Static_assert(sizeof(duckdb_v2_table_function_filter_pushdown_callback_fn) == 8, "duckdb-ffi ABI: DuckDBV2TableFunctionFilterPushdownCallbackFn: size");
+_Static_assert(_Alignof(duckdb_v2_table_function_filter_pushdown_callback_fn) == 8, "duckdb-ffi ABI: DuckDBV2TableFunctionFilterPushdownCallbackFn: alignment");
+_Static_assert(sizeof(duckdb_v2_table_function_filter_pushdown_info_handle) == 8, "duckdb-ffi ABI: DuckDBV2TableFunctionFilterPushdownInfoHandle: size");
+_Static_assert(_Alignof(duckdb_v2_table_function_filter_pushdown_info_handle) == 8, "duckdb-ffi ABI: DuckDBV2TableFunctionFilterPushdownInfoHandle: alignment");
+_Static_assert(sizeof(struct _duckdb_v2_table_function_filter_pushdown_info) == 8, "duckdb-ffi ABI: DuckDBV2TableFunctionFilterPushdownInfoStruct: size");
+_Static_assert(_Alignof(struct _duckdb_v2_table_function_filter_pushdown_info) == 8, "duckdb-ffi ABI: DuckDBV2TableFunctionFilterPushdownInfoStruct: alignment");
+_Static_assert(sizeof(duckdb_v2_table_function_get_bind_info_callback_fn) == 8, "duckdb-ffi ABI: DuckDBV2TableFunctionGetBindInfoCallbackFn: size");
+_Static_assert(_Alignof(duckdb_v2_table_function_get_bind_info_callback_fn) == 8, "duckdb-ffi ABI: DuckDBV2TableFunctionGetBindInfoCallbackFn: alignment");
+_Static_assert(sizeof(duckdb_v2_table_function_get_bind_info_info_handle) == 8, "duckdb-ffi ABI: DuckDBV2TableFunctionGetBindInfoInfoHandle: size");
+_Static_assert(_Alignof(duckdb_v2_table_function_get_bind_info_info_handle) == 8, "duckdb-ffi ABI: DuckDBV2TableFunctionGetBindInfoInfoHandle: alignment");
+_Static_assert(sizeof(struct _duckdb_v2_table_function_get_bind_info_info) == 8, "duckdb-ffi ABI: DuckDBV2TableFunctionGetBindInfoInfoStruct: size");
+_Static_assert(_Alignof(struct _duckdb_v2_table_function_get_bind_info_info) == 8, "duckdb-ffi ABI: DuckDBV2TableFunctionGetBindInfoInfoStruct: alignment");
+_Static_assert(sizeof(duckdb_v2_table_function_handle) == 8, "duckdb-ffi ABI: DuckDBV2TableFunctionHandle: size");
+_Static_assert(_Alignof(duckdb_v2_table_function_handle) == 8, "duckdb-ffi ABI: DuckDBV2TableFunctionHandle: alignment");
+_Static_assert(sizeof(duckdb_v2_table_function_init_global_callback_fn) == 8, "duckdb-ffi ABI: DuckDBV2TableFunctionInitGlobalCallbackFn: size");
+_Static_assert(_Alignof(duckdb_v2_table_function_init_global_callback_fn) == 8, "duckdb-ffi ABI: DuckDBV2TableFunctionInitGlobalCallbackFn: alignment");
+_Static_assert(sizeof(duckdb_v2_table_function_init_global_info_handle) == 8, "duckdb-ffi ABI: DuckDBV2TableFunctionInitGlobalInfoHandle: size");
+_Static_assert(_Alignof(duckdb_v2_table_function_init_global_info_handle) == 8, "duckdb-ffi ABI: DuckDBV2TableFunctionInitGlobalInfoHandle: alignment");
+_Static_assert(sizeof(struct _duckdb_v2_table_function_init_global_info) == 8, "duckdb-ffi ABI: DuckDBV2TableFunctionInitGlobalInfoStruct: size");
+_Static_assert(_Alignof(struct _duckdb_v2_table_function_init_global_info) == 8, "duckdb-ffi ABI: DuckDBV2TableFunctionInitGlobalInfoStruct: alignment");
+_Static_assert(sizeof(duckdb_v2_table_function_init_local_callback_fn) == 8, "duckdb-ffi ABI: DuckDBV2TableFunctionInitLocalCallbackFn: size");
+_Static_assert(_Alignof(duckdb_v2_table_function_init_local_callback_fn) == 8, "duckdb-ffi ABI: DuckDBV2TableFunctionInitLocalCallbackFn: alignment");
+_Static_assert(sizeof(duckdb_v2_table_function_init_local_info_handle) == 8, "duckdb-ffi ABI: DuckDBV2TableFunctionInitLocalInfoHandle: size");
+_Static_assert(_Alignof(duckdb_v2_table_function_init_local_info_handle) == 8, "duckdb-ffi ABI: DuckDBV2TableFunctionInitLocalInfoHandle: alignment");
+_Static_assert(sizeof(struct _duckdb_v2_table_function_init_local_info) == 8, "duckdb-ffi ABI: DuckDBV2TableFunctionInitLocalInfoStruct: size");
+_Static_assert(_Alignof(struct _duckdb_v2_table_function_init_local_info) == 8, "duckdb-ffi ABI: DuckDBV2TableFunctionInitLocalInfoStruct: alignment");
+_Static_assert(sizeof(duckdb_v2_table_function_partition_data_callback_fn) == 8, "duckdb-ffi ABI: DuckDBV2TableFunctionPartitionDataCallbackFn: size");
+_Static_assert(_Alignof(duckdb_v2_table_function_partition_data_callback_fn) == 8, "duckdb-ffi ABI: DuckDBV2TableFunctionPartitionDataCallbackFn: alignment");
+_Static_assert(sizeof(duckdb_v2_table_function_partition_data_info_handle) == 8, "duckdb-ffi ABI: DuckDBV2TableFunctionPartitionDataInfoHandle: size");
+_Static_assert(_Alignof(duckdb_v2_table_function_partition_data_info_handle) == 8, "duckdb-ffi ABI: DuckDBV2TableFunctionPartitionDataInfoHandle: alignment");
+_Static_assert(sizeof(struct _duckdb_v2_table_function_partition_data_info) == 8, "duckdb-ffi ABI: DuckDBV2TableFunctionPartitionDataInfoStruct: size");
+_Static_assert(_Alignof(struct _duckdb_v2_table_function_partition_data_info) == 8, "duckdb-ffi ABI: DuckDBV2TableFunctionPartitionDataInfoStruct: alignment");
+_Static_assert(sizeof(duckdb_v2_table_function_partitioning_callback_fn) == 8, "duckdb-ffi ABI: DuckDBV2TableFunctionPartitioningCallbackFn: size");
+_Static_assert(_Alignof(duckdb_v2_table_function_partitioning_callback_fn) == 8, "duckdb-ffi ABI: DuckDBV2TableFunctionPartitioningCallbackFn: alignment");
+_Static_assert(sizeof(duckdb_v2_table_function_partitioning_info_handle) == 8, "duckdb-ffi ABI: DuckDBV2TableFunctionPartitioningInfoHandle: size");
+_Static_assert(_Alignof(duckdb_v2_table_function_partitioning_info_handle) == 8, "duckdb-ffi ABI: DuckDBV2TableFunctionPartitioningInfoHandle: alignment");
+_Static_assert(sizeof(struct _duckdb_v2_table_function_partitioning_info) == 8, "duckdb-ffi ABI: DuckDBV2TableFunctionPartitioningInfoStruct: size");
+_Static_assert(_Alignof(struct _duckdb_v2_table_function_partitioning_info) == 8, "duckdb-ffi ABI: DuckDBV2TableFunctionPartitioningInfoStruct: alignment");
+_Static_assert(sizeof(duckdb_v2_table_function_progress_callback_fn) == 8, "duckdb-ffi ABI: DuckDBV2TableFunctionProgressCallbackFn: size");
+_Static_assert(_Alignof(duckdb_v2_table_function_progress_callback_fn) == 8, "duckdb-ffi ABI: DuckDBV2TableFunctionProgressCallbackFn: alignment");
+_Static_assert(sizeof(duckdb_v2_table_function_progress_info_handle) == 8, "duckdb-ffi ABI: DuckDBV2TableFunctionProgressInfoHandle: size");
+_Static_assert(_Alignof(duckdb_v2_table_function_progress_info_handle) == 8, "duckdb-ffi ABI: DuckDBV2TableFunctionProgressInfoHandle: alignment");
+_Static_assert(sizeof(struct _duckdb_v2_table_function_progress_info) == 8, "duckdb-ffi ABI: DuckDBV2TableFunctionProgressInfoStruct: size");
+_Static_assert(_Alignof(struct _duckdb_v2_table_function_progress_info) == 8, "duckdb-ffi ABI: DuckDBV2TableFunctionProgressInfoStruct: alignment");
+_Static_assert(sizeof(struct _duckdb_v2_table_function) == 8, "duckdb-ffi ABI: DuckDBV2TableFunctionStruct: size");
+_Static_assert(_Alignof(struct _duckdb_v2_table_function) == 8, "duckdb-ffi ABI: DuckDBV2TableFunctionStruct: alignment");
+_Static_assert(sizeof(DUCKDB_V2_TABLE_PARTITION_INFO) == 4, "duckdb-ffi ABI: DuckDBV2TablePartitionInfo: size");
+_Static_assert(_Alignof(DUCKDB_V2_TABLE_PARTITION_INFO) == 4, "duckdb-ffi ABI: DuckDBV2TablePartitionInfo: alignment");
+_Static_assert(sizeof(duckdb_v2_text_sink_fn) == 8, "duckdb-ffi ABI: DuckDBV2TextSinkFn: size");
+_Static_assert(_Alignof(duckdb_v2_text_sink_fn) == 8, "duckdb-ffi ABI: DuckDBV2TextSinkFn: alignment");
+_Static_assert(sizeof(duckdb_v2_token_iterator_handle) == 8, "duckdb-ffi ABI: DuckDBV2TokenIteratorHandle: size");
+_Static_assert(_Alignof(duckdb_v2_token_iterator_handle) == 8, "duckdb-ffi ABI: DuckDBV2TokenIteratorHandle: alignment");
+_Static_assert(sizeof(struct _duckdb_v2_token_iterator) == 8, "duckdb-ffi ABI: DuckDBV2TokenIteratorStruct: size");
+_Static_assert(_Alignof(struct _duckdb_v2_token_iterator) == 8, "duckdb-ffi ABI: DuckDBV2TokenIteratorStruct: alignment");
+_Static_assert(sizeof(DUCKDB_V2_TOKEN_TYPE) == 4, "duckdb-ffi ABI: DuckDBV2TokenType: size");
+_Static_assert(_Alignof(DUCKDB_V2_TOKEN_TYPE) == 4, "duckdb-ffi ABI: DuckDBV2TokenType: alignment");
+_Static_assert(sizeof(duckdb_v2_uhugeint_t) == 16, "duckdb-ffi ABI: DuckDBV2UhugeintT: size");
+_Static_assert(_Alignof(duckdb_v2_uhugeint_t) == 8, "duckdb-ffi ABI: DuckDBV2UhugeintT: alignment");
+_Static_assert(sizeof(duckdb_v2_value_handle) == 8, "duckdb-ffi ABI: DuckDBV2ValueHandle: size");
+_Static_assert(_Alignof(duckdb_v2_value_handle) == 8, "duckdb-ffi ABI: DuckDBV2ValueHandle: alignment");
+_Static_assert(sizeof(struct _duckdb_v2_value) == 8, "duckdb-ffi ABI: DuckDBV2ValueStruct: size");
+_Static_assert(_Alignof(struct _duckdb_v2_value) == 8, "duckdb-ffi ABI: DuckDBV2ValueStruct: alignment");
+_Static_assert(sizeof(duckdb_v2_varchar_t) == 16, "duckdb-ffi ABI: DuckDBV2VarcharT: size");
+_Static_assert(_Alignof(duckdb_v2_varchar_t) == 8, "duckdb-ffi ABI: DuckDBV2VarcharT: alignment");
+_Static_assert(sizeof(duckdb_v2_vector_handle) == 8, "duckdb-ffi ABI: DuckDBV2VectorHandle: size");
+_Static_assert(_Alignof(duckdb_v2_vector_handle) == 8, "duckdb-ffi ABI: DuckDBV2VectorHandle: alignment");
+_Static_assert(sizeof(struct _duckdb_v2_vector) == 8, "duckdb-ffi ABI: DuckDBV2VectorStruct: size");
+_Static_assert(_Alignof(struct _duckdb_v2_vector) == 8, "duckdb-ffi ABI: DuckDBV2VectorStruct: alignment");
+_Static_assert(sizeof(DUCKDB_V2_VECTOR_TYPE) == 4, "duckdb-ffi ABI: DuckDBV2VectorType: size");
+_Static_assert(_Alignof(DUCKDB_V2_VECTOR_TYPE) == 4, "duckdb-ffi ABI: DuckDBV2VectorType: alignment");
+_Static_assert(sizeof(duckdb_v2_vector_view) == 32, "duckdb-ffi ABI: DuckDBV2VectorView: size");
+_Static_assert(_Alignof(duckdb_v2_vector_view) == 8, "duckdb-ffi ABI: DuckDBV2VectorView: alignment");
+_Static_assert(sizeof(__typeof__(((duckdb_v2_bytes *)0)->value)) == 16, "duckdb-ffi ABI: Duckdb_v2_bytes_value: size");
+_Static_assert(_Alignof(__typeof__(((duckdb_v2_bytes *)0)->value)) == 8, "duckdb-ffi ABI: Duckdb_v2_bytes_value: alignment");
+_Static_assert(sizeof(__typeof__(((__typeof__(((duckdb_v2_bytes *)0)->value) *)0)->inlined)) == 16, "duckdb-ffi ABI: Duckdb_v2_bytes_value_inlined: size");
+_Static_assert(_Alignof(__typeof__(((__typeof__(((duckdb_v2_bytes *)0)->value) *)0)->inlined)) == 4, "duckdb-ffi ABI: Duckdb_v2_bytes_value_inlined: alignment");
+_Static_assert(sizeof(__typeof__(((__typeof__(((duckdb_v2_bytes *)0)->value) *)0)->pointer)) == 16, "duckdb-ffi ABI: Duckdb_v2_bytes_value_pointer: size");
+_Static_assert(_Alignof(__typeof__(((__typeof__(((duckdb_v2_bytes *)0)->value) *)0)->pointer)) == 8, "duckdb-ffi ABI: Duckdb_v2_bytes_value_pointer: alignment");
+_Static_assert(__builtin_offsetof(struct ArrowSchema, format) == 0, "duckdb-ffi ABI: ArrowSchema.format: offset");
+_Static_assert(sizeof(((struct ArrowSchema *)0)->format) == 8, "duckdb-ffi ABI: ArrowSchema.format: size");
+_Static_assert(__builtin_offsetof(struct ArrowSchema, name) == 8, "duckdb-ffi ABI: ArrowSchema.name: offset");
+_Static_assert(sizeof(((struct ArrowSchema *)0)->name) == 8, "duckdb-ffi ABI: ArrowSchema.name: size");
+_Static_assert(__builtin_offsetof(struct ArrowSchema, metadata) == 16, "duckdb-ffi ABI: ArrowSchema.metadata: offset");
+_Static_assert(sizeof(((struct ArrowSchema *)0)->metadata) == 8, "duckdb-ffi ABI: ArrowSchema.metadata: size");
+_Static_assert(__builtin_offsetof(struct ArrowSchema, flags) == 24, "duckdb-ffi ABI: ArrowSchema.flags: offset");
+_Static_assert(sizeof(((struct ArrowSchema *)0)->flags) == 8, "duckdb-ffi ABI: ArrowSchema.flags: size");
+_Static_assert(__builtin_offsetof(struct ArrowSchema, n_children) == 32, "duckdb-ffi ABI: ArrowSchema.n_children: offset");
+_Static_assert(sizeof(((struct ArrowSchema *)0)->n_children) == 8, "duckdb-ffi ABI: ArrowSchema.n_children: size");
+_Static_assert(__builtin_offsetof(struct ArrowSchema, children) == 40, "duckdb-ffi ABI: ArrowSchema.children: offset");
+_Static_assert(sizeof(((struct ArrowSchema *)0)->children) == 8, "duckdb-ffi ABI: ArrowSchema.children: size");
+_Static_assert(__builtin_offsetof(struct ArrowSchema, dictionary) == 48, "duckdb-ffi ABI: ArrowSchema.dictionary: offset");
+_Static_assert(sizeof(((struct ArrowSchema *)0)->dictionary) == 8, "duckdb-ffi ABI: ArrowSchema.dictionary: size");
+_Static_assert(__builtin_offsetof(struct ArrowSchema, release) == 56, "duckdb-ffi ABI: ArrowSchema.release: offset");
+_Static_assert(sizeof(((struct ArrowSchema *)0)->release) == 8, "duckdb-ffi ABI: ArrowSchema.release: size");
+_Static_assert(__builtin_offsetof(struct ArrowSchema, private_data) == 64, "duckdb-ffi ABI: ArrowSchema.private_data: offset");
+_Static_assert(sizeof(((struct ArrowSchema *)0)->private_data) == 8, "duckdb-ffi ABI: ArrowSchema.private_data: size");
+_Static_assert(__builtin_offsetof(struct ArrowArray, length) == 0, "duckdb-ffi ABI: ArrowArray.length: offset");
+_Static_assert(sizeof(((struct ArrowArray *)0)->length) == 8, "duckdb-ffi ABI: ArrowArray.length: size");
+_Static_assert(__builtin_offsetof(struct ArrowArray, null_count) == 8, "duckdb-ffi ABI: ArrowArray.null_count: offset");
+_Static_assert(sizeof(((struct ArrowArray *)0)->null_count) == 8, "duckdb-ffi ABI: ArrowArray.null_count: size");
+_Static_assert(__builtin_offsetof(struct ArrowArray, offset) == 16, "duckdb-ffi ABI: ArrowArray.offset: offset");
+_Static_assert(sizeof(((struct ArrowArray *)0)->offset) == 8, "duckdb-ffi ABI: ArrowArray.offset: size");
+_Static_assert(__builtin_offsetof(struct ArrowArray, n_buffers) == 24, "duckdb-ffi ABI: ArrowArray.n_buffers: offset");
+_Static_assert(sizeof(((struct ArrowArray *)0)->n_buffers) == 8, "duckdb-ffi ABI: ArrowArray.n_buffers: size");
+_Static_assert(__builtin_offsetof(struct ArrowArray, n_children) == 32, "duckdb-ffi ABI: ArrowArray.n_children: offset");
+_Static_assert(sizeof(((struct ArrowArray *)0)->n_children) == 8, "duckdb-ffi ABI: ArrowArray.n_children: size");
+_Static_assert(__builtin_offsetof(struct ArrowArray, buffers) == 40, "duckdb-ffi ABI: ArrowArray.buffers: offset");
+_Static_assert(sizeof(((struct ArrowArray *)0)->buffers) == 8, "duckdb-ffi ABI: ArrowArray.buffers: size");
+_Static_assert(__builtin_offsetof(struct ArrowArray, children) == 48, "duckdb-ffi ABI: ArrowArray.children: offset");
+_Static_assert(sizeof(((struct ArrowArray *)0)->children) == 8, "duckdb-ffi ABI: ArrowArray.children: size");
+_Static_assert(__builtin_offsetof(struct ArrowArray, dictionary) == 56, "duckdb-ffi ABI: ArrowArray.dictionary: offset");
+_Static_assert(sizeof(((struct ArrowArray *)0)->dictionary) == 8, "duckdb-ffi ABI: ArrowArray.dictionary: size");
+_Static_assert(__builtin_offsetof(struct ArrowArray, release) == 64, "duckdb-ffi ABI: ArrowArray.release: offset");
+_Static_assert(sizeof(((struct ArrowArray *)0)->release) == 8, "duckdb-ffi ABI: ArrowArray.release: size");
+_Static_assert(__builtin_offsetof(struct ArrowArray, private_data) == 72, "duckdb-ffi ABI: ArrowArray.private_data: offset");
+_Static_assert(sizeof(((struct ArrowArray *)0)->private_data) == 8, "duckdb-ffi ABI: ArrowArray.private_data: size");
+_Static_assert(__builtin_offsetof(struct ArrowArrayStream, get_schema) == 0, "duckdb-ffi ABI: ArrowArrayStream.get_schema: offset");
+_Static_assert(sizeof(((struct ArrowArrayStream *)0)->get_schema) == 8, "duckdb-ffi ABI: ArrowArrayStream.get_schema: size");
+_Static_assert(__builtin_offsetof(struct ArrowArrayStream, get_next) == 8, "duckdb-ffi ABI: ArrowArrayStream.get_next: offset");
+_Static_assert(sizeof(((struct ArrowArrayStream *)0)->get_next) == 8, "duckdb-ffi ABI: ArrowArrayStream.get_next: size");
+_Static_assert(__builtin_offsetof(struct ArrowArrayStream, get_last_error) == 16, "duckdb-ffi ABI: ArrowArrayStream.get_last_error: offset");
+_Static_assert(sizeof(((struct ArrowArrayStream *)0)->get_last_error) == 8, "duckdb-ffi ABI: ArrowArrayStream.get_last_error: size");
+_Static_assert(__builtin_offsetof(struct ArrowArrayStream, release) == 24, "duckdb-ffi ABI: ArrowArrayStream.release: offset");
+_Static_assert(sizeof(((struct ArrowArrayStream *)0)->release) == 8, "duckdb-ffi ABI: ArrowArrayStream.release: size");
+_Static_assert(__builtin_offsetof(struct ArrowArrayStream, private_data) == 32, "duckdb-ffi ABI: ArrowArrayStream.private_data: offset");
+_Static_assert(sizeof(((struct ArrowArrayStream *)0)->private_data) == 8, "duckdb-ffi ABI: ArrowArrayStream.private_data: size");
+_Static_assert(__builtin_offsetof(duckdb_v2_str, ptr) == 0, "duckdb-ffi ABI: DuckDBV2Str.ptr: offset");
+_Static_assert(sizeof(((duckdb_v2_str *)0)->ptr) == 8, "duckdb-ffi ABI: DuckDBV2Str.ptr: size");
+_Static_assert(__builtin_offsetof(duckdb_v2_str, len) == 8, "duckdb-ffi ABI: DuckDBV2Str.len: offset");
+_Static_assert(sizeof(((duckdb_v2_str *)0)->len) == 8, "duckdb-ffi ABI: DuckDBV2Str.len: size");
+_Static_assert(__builtin_offsetof(__typeof__(((__typeof__(((duckdb_v2_bytes *)0)->value) *)0)->pointer), length) == 0, "duckdb-ffi ABI: Duckdb_v2_bytes_value_pointer.length: offset");
+_Static_assert(sizeof(((__typeof__(((__typeof__(((duckdb_v2_bytes *)0)->value) *)0)->pointer) *)0)->length) == 4, "duckdb-ffi ABI: Duckdb_v2_bytes_value_pointer.length: size");
+_Static_assert(__builtin_offsetof(__typeof__(((__typeof__(((duckdb_v2_bytes *)0)->value) *)0)->pointer), prefix) == 4, "duckdb-ffi ABI: Duckdb_v2_bytes_value_pointer.prefix: offset");
+_Static_assert(sizeof(((__typeof__(((__typeof__(((duckdb_v2_bytes *)0)->value) *)0)->pointer) *)0)->prefix) == 4, "duckdb-ffi ABI: Duckdb_v2_bytes_value_pointer.prefix: size");
+_Static_assert(__builtin_offsetof(__typeof__(((__typeof__(((duckdb_v2_bytes *)0)->value) *)0)->pointer), ptr) == 8, "duckdb-ffi ABI: Duckdb_v2_bytes_value_pointer.ptr: offset");
+_Static_assert(sizeof(((__typeof__(((__typeof__(((duckdb_v2_bytes *)0)->value) *)0)->pointer) *)0)->ptr) == 8, "duckdb-ffi ABI: Duckdb_v2_bytes_value_pointer.ptr: size");
+_Static_assert(__builtin_offsetof(__typeof__(((__typeof__(((duckdb_v2_bytes *)0)->value) *)0)->inlined), length) == 0, "duckdb-ffi ABI: Duckdb_v2_bytes_value_inlined.length: offset");
+_Static_assert(sizeof(((__typeof__(((__typeof__(((duckdb_v2_bytes *)0)->value) *)0)->inlined) *)0)->length) == 4, "duckdb-ffi ABI: Duckdb_v2_bytes_value_inlined.length: size");
+_Static_assert(__builtin_offsetof(__typeof__(((__typeof__(((duckdb_v2_bytes *)0)->value) *)0)->inlined), inlined) == 4, "duckdb-ffi ABI: Duckdb_v2_bytes_value_inlined.inlined: offset");
+_Static_assert(sizeof(((__typeof__(((__typeof__(((duckdb_v2_bytes *)0)->value) *)0)->inlined) *)0)->inlined) == 12, "duckdb-ffi ABI: Duckdb_v2_bytes_value_inlined.inlined: size");
+_Static_assert(__builtin_offsetof(__typeof__(((duckdb_v2_bytes *)0)->value), pointer) == 0, "duckdb-ffi ABI: Duckdb_v2_bytes_value.pointer: offset");
+_Static_assert(sizeof(((__typeof__(((duckdb_v2_bytes *)0)->value) *)0)->pointer) == 16, "duckdb-ffi ABI: Duckdb_v2_bytes_value.pointer: size");
+_Static_assert(__builtin_offsetof(__typeof__(((duckdb_v2_bytes *)0)->value), inlined) == 0, "duckdb-ffi ABI: Duckdb_v2_bytes_value.inlined: offset");
+_Static_assert(sizeof(((__typeof__(((duckdb_v2_bytes *)0)->value) *)0)->inlined) == 16, "duckdb-ffi ABI: Duckdb_v2_bytes_value.inlined: size");
+_Static_assert(__builtin_offsetof(duckdb_v2_bytes, value) == 0, "duckdb-ffi ABI: DuckDBV2Bytes.value: offset");
+_Static_assert(sizeof(((duckdb_v2_bytes *)0)->value) == 16, "duckdb-ffi ABI: DuckDBV2Bytes.value: size");
+_Static_assert(__builtin_offsetof(duckdb_v2_opaque, ptr) == 0, "duckdb-ffi ABI: DuckDBV2Opaque.ptr: offset");
+_Static_assert(sizeof(((duckdb_v2_opaque *)0)->ptr) == 8, "duckdb-ffi ABI: DuckDBV2Opaque.ptr: size");
+_Static_assert(__builtin_offsetof(duckdb_v2_opaque, destroy) == 8, "duckdb-ffi ABI: DuckDBV2Opaque.destroy: offset");
+_Static_assert(sizeof(((duckdb_v2_opaque *)0)->destroy) == 8, "duckdb-ffi ABI: DuckDBV2Opaque.destroy: size");
+_Static_assert(__builtin_offsetof(duckdb_v2_opaque, equals) == 16, "duckdb-ffi ABI: DuckDBV2Opaque.equals: offset");
+_Static_assert(sizeof(((duckdb_v2_opaque *)0)->equals) == 8, "duckdb-ffi ABI: DuckDBV2Opaque.equals: size");
+_Static_assert(__builtin_offsetof(duckdb_v2_extension_input, get_api) == 0, "duckdb-ffi ABI: DuckDBV2ExtensionInput.get_api: offset");
+_Static_assert(sizeof(((duckdb_v2_extension_input *)0)->get_api) == 8, "duckdb-ffi ABI: DuckDBV2ExtensionInput.get_api: size");
+_Static_assert(__builtin_offsetof(duckdb_v2_extension_input, extension) == 8, "duckdb-ffi ABI: DuckDBV2ExtensionInput.extension: offset");
+_Static_assert(sizeof(((duckdb_v2_extension_input *)0)->extension) == 8, "duckdb-ffi ABI: DuckDBV2ExtensionInput.extension: size");
+_Static_assert(__builtin_offsetof(duckdb_v2_extension_input, context) == 16, "duckdb-ffi ABI: DuckDBV2ExtensionInput.context: offset");
+_Static_assert(sizeof(((duckdb_v2_extension_input *)0)->context) == 8, "duckdb-ffi ABI: DuckDBV2ExtensionInput.context: size");
+_Static_assert(__builtin_offsetof(duckdb_v2_extension_input, err) == 24, "duckdb-ffi ABI: DuckDBV2ExtensionInput.err: offset");
+_Static_assert(sizeof(((duckdb_v2_extension_input *)0)->err) == 8, "duckdb-ffi ABI: DuckDBV2ExtensionInput.err: size");
+_Static_assert(__builtin_offsetof(duckdb_v2_vector_view, data) == 0, "duckdb-ffi ABI: DuckDBV2VectorView.data: offset");
+_Static_assert(sizeof(((duckdb_v2_vector_view *)0)->data) == 8, "duckdb-ffi ABI: DuckDBV2VectorView.data: size");
+_Static_assert(__builtin_offsetof(duckdb_v2_vector_view, validity) == 8, "duckdb-ffi ABI: DuckDBV2VectorView.validity: offset");
+_Static_assert(sizeof(((duckdb_v2_vector_view *)0)->validity) == 8, "duckdb-ffi ABI: DuckDBV2VectorView.validity: size");
+_Static_assert(__builtin_offsetof(duckdb_v2_vector_view, sel) == 16, "duckdb-ffi ABI: DuckDBV2VectorView.sel: offset");
+_Static_assert(sizeof(((duckdb_v2_vector_view *)0)->sel) == 8, "duckdb-ffi ABI: DuckDBV2VectorView.sel: size");
+_Static_assert(__builtin_offsetof(duckdb_v2_vector_view, count) == 24, "duckdb-ffi ABI: DuckDBV2VectorView.count: offset");
+_Static_assert(sizeof(((duckdb_v2_vector_view *)0)->count) == 8, "duckdb-ffi ABI: DuckDBV2VectorView.count: size");
+_Static_assert(__builtin_offsetof(duckdb_v2_list_entry, offset) == 0, "duckdb-ffi ABI: DuckDBV2ListEntry.offset: offset");
+_Static_assert(sizeof(((duckdb_v2_list_entry *)0)->offset) == 8, "duckdb-ffi ABI: DuckDBV2ListEntry.offset: size");
+_Static_assert(__builtin_offsetof(duckdb_v2_list_entry, length) == 8, "duckdb-ffi ABI: DuckDBV2ListEntry.length: offset");
+_Static_assert(sizeof(((duckdb_v2_list_entry *)0)->length) == 8, "duckdb-ffi ABI: DuckDBV2ListEntry.length: size");
+_Static_assert(__builtin_offsetof(duckdb_v2_hugeint_t, lower) == 0, "duckdb-ffi ABI: DuckDBV2HugeintT.lower: offset");
+_Static_assert(sizeof(((duckdb_v2_hugeint_t *)0)->lower) == 8, "duckdb-ffi ABI: DuckDBV2HugeintT.lower: size");
+_Static_assert(__builtin_offsetof(duckdb_v2_hugeint_t, upper) == 8, "duckdb-ffi ABI: DuckDBV2HugeintT.upper: offset");
+_Static_assert(sizeof(((duckdb_v2_hugeint_t *)0)->upper) == 8, "duckdb-ffi ABI: DuckDBV2HugeintT.upper: size");
+_Static_assert(__builtin_offsetof(duckdb_v2_uhugeint_t, lower) == 0, "duckdb-ffi ABI: DuckDBV2UhugeintT.lower: offset");
+_Static_assert(sizeof(((duckdb_v2_uhugeint_t *)0)->lower) == 8, "duckdb-ffi ABI: DuckDBV2UhugeintT.lower: size");
+_Static_assert(__builtin_offsetof(duckdb_v2_uhugeint_t, upper) == 8, "duckdb-ffi ABI: DuckDBV2UhugeintT.upper: offset");
+_Static_assert(sizeof(((duckdb_v2_uhugeint_t *)0)->upper) == 8, "duckdb-ffi ABI: DuckDBV2UhugeintT.upper: size");
+_Static_assert(__builtin_offsetof(duckdb_v2_interval_t, months) == 0, "duckdb-ffi ABI: DuckDBV2IntervalT.months: offset");
+_Static_assert(sizeof(((duckdb_v2_interval_t *)0)->months) == 4, "duckdb-ffi ABI: DuckDBV2IntervalT.months: size");
+_Static_assert(__builtin_offsetof(duckdb_v2_interval_t, days) == 4, "duckdb-ffi ABI: DuckDBV2IntervalT.days: offset");
+_Static_assert(sizeof(((duckdb_v2_interval_t *)0)->days) == 4, "duckdb-ffi ABI: DuckDBV2IntervalT.days: size");
+_Static_assert(__builtin_offsetof(duckdb_v2_interval_t, micros) == 8, "duckdb-ffi ABI: DuckDBV2IntervalT.micros: offset");
+_Static_assert(sizeof(((duckdb_v2_interval_t *)0)->micros) == 8, "duckdb-ffi ABI: DuckDBV2IntervalT.micros: size");
diff --git a/generated/abi-checks.c b/generated/abi-checks.c
new file mode 100644
--- /dev/null
+++ b/generated/abi-checks.c
@@ -0,0 +1,515 @@
+/* Generated by dev/bindings/generate-bindings.sh. Do not edit. */
+#define DUCKDB_V2_API_ALLOW_UNSTABLE 1
+#include "duckdb.h"
+#include "duckdb_arrow.h"
+#if !(defined(__linux__) || (defined(__APPLE__) && defined(__ENVIRONMENT_MAC_OS_X_VERSION_MIN_REQUIRED__))) || !(defined(__x86_64__) || defined(__aarch64__))
+#error "duckdb-ffi supports Linux and macOS on x86_64 and aarch64."
+#endif
+_Static_assert(sizeof(struct ArrowArray) == 80, "duckdb-ffi ABI: ArrowArray: size");
+_Static_assert(_Alignof(struct ArrowArray) == 8, "duckdb-ffi ABI: ArrowArray: alignment");
+_Static_assert(sizeof(struct ArrowArrayStream) == 40, "duckdb-ffi ABI: ArrowArrayStream: size");
+_Static_assert(_Alignof(struct ArrowArrayStream) == 8, "duckdb-ffi ABI: ArrowArrayStream: alignment");
+_Static_assert(sizeof(struct ArrowSchema) == 72, "duckdb-ffi ABI: ArrowSchema: size");
+_Static_assert(_Alignof(struct ArrowSchema) == 8, "duckdb-ffi ABI: ArrowSchema: alignment");
+_Static_assert(sizeof(duckdb_aggregate_combine_t) == 8, "duckdb-ffi ABI: DuckDBAggregateCombineFun: size");
+_Static_assert(_Alignof(duckdb_aggregate_combine_t) == 8, "duckdb-ffi ABI: DuckDBAggregateCombineFun: alignment");
+_Static_assert(sizeof(duckdb_aggregate_destroy_t) == 8, "duckdb-ffi ABI: DuckDBAggregateDestroyFun: size");
+_Static_assert(_Alignof(duckdb_aggregate_destroy_t) == 8, "duckdb-ffi ABI: DuckDBAggregateDestroyFun: alignment");
+_Static_assert(sizeof(duckdb_aggregate_finalize_t) == 8, "duckdb-ffi ABI: DuckDBAggregateFinalizeFun: size");
+_Static_assert(_Alignof(duckdb_aggregate_finalize_t) == 8, "duckdb-ffi ABI: DuckDBAggregateFinalizeFun: alignment");
+_Static_assert(sizeof(duckdb_aggregate_function) == 8, "duckdb-ffi ABI: DuckDBAggregateFunction: size");
+_Static_assert(_Alignof(duckdb_aggregate_function) == 8, "duckdb-ffi ABI: DuckDBAggregateFunction: alignment");
+_Static_assert(sizeof(duckdb_aggregate_function_set) == 8, "duckdb-ffi ABI: DuckDBAggregateFunctionSet: size");
+_Static_assert(_Alignof(duckdb_aggregate_function_set) == 8, "duckdb-ffi ABI: DuckDBAggregateFunctionSet: alignment");
+_Static_assert(sizeof(struct _duckdb_aggregate_function_set) == 8, "duckdb-ffi ABI: DuckDBAggregateFunctionSetStruct: size");
+_Static_assert(_Alignof(struct _duckdb_aggregate_function_set) == 8, "duckdb-ffi ABI: DuckDBAggregateFunctionSetStruct: alignment");
+_Static_assert(sizeof(struct _duckdb_aggregate_function) == 8, "duckdb-ffi ABI: DuckDBAggregateFunctionStruct: size");
+_Static_assert(_Alignof(struct _duckdb_aggregate_function) == 8, "duckdb-ffi ABI: DuckDBAggregateFunctionStruct: alignment");
+_Static_assert(sizeof(duckdb_aggregate_init_t) == 8, "duckdb-ffi ABI: DuckDBAggregateInitFun: size");
+_Static_assert(_Alignof(duckdb_aggregate_init_t) == 8, "duckdb-ffi ABI: DuckDBAggregateInitFun: alignment");
+_Static_assert(sizeof(duckdb_aggregate_state) == 8, "duckdb-ffi ABI: DuckDBAggregateState: size");
+_Static_assert(_Alignof(duckdb_aggregate_state) == 8, "duckdb-ffi ABI: DuckDBAggregateState: alignment");
+_Static_assert(sizeof(duckdb_aggregate_state_size) == 8, "duckdb-ffi ABI: DuckDBAggregateStateSizeFun: size");
+_Static_assert(_Alignof(duckdb_aggregate_state_size) == 8, "duckdb-ffi ABI: DuckDBAggregateStateSizeFun: alignment");
+_Static_assert(sizeof(struct _duckdb_aggregate_state) == 8, "duckdb-ffi ABI: DuckDBAggregateStateStruct: size");
+_Static_assert(_Alignof(struct _duckdb_aggregate_state) == 8, "duckdb-ffi ABI: DuckDBAggregateStateStruct: alignment");
+_Static_assert(sizeof(duckdb_aggregate_update_t) == 8, "duckdb-ffi ABI: DuckDBAggregateUpdateFun: size");
+_Static_assert(_Alignof(duckdb_aggregate_update_t) == 8, "duckdb-ffi ABI: DuckDBAggregateUpdateFun: alignment");
+_Static_assert(sizeof(duckdb_appender) == 8, "duckdb-ffi ABI: DuckDBAppender: size");
+_Static_assert(_Alignof(duckdb_appender) == 8, "duckdb-ffi ABI: DuckDBAppender: alignment");
+_Static_assert(sizeof(struct _duckdb_appender) == 8, "duckdb-ffi ABI: DuckDBAppenderStruct: size");
+_Static_assert(_Alignof(struct _duckdb_appender) == 8, "duckdb-ffi ABI: DuckDBAppenderStruct: alignment");
+_Static_assert(sizeof(duckdb_arrow) == 8, "duckdb-ffi ABI: DuckDBArrow: size");
+_Static_assert(_Alignof(duckdb_arrow) == 8, "duckdb-ffi ABI: DuckDBArrow: alignment");
+_Static_assert(sizeof(duckdb_arrow_array) == 8, "duckdb-ffi ABI: DuckDBArrowArray: size");
+_Static_assert(_Alignof(duckdb_arrow_array) == 8, "duckdb-ffi ABI: DuckDBArrowArray: alignment");
+_Static_assert(sizeof(struct _duckdb_arrow_array) == 8, "duckdb-ffi ABI: DuckDBArrowArrayStruct: size");
+_Static_assert(_Alignof(struct _duckdb_arrow_array) == 8, "duckdb-ffi ABI: DuckDBArrowArrayStruct: alignment");
+_Static_assert(sizeof(duckdb_arrow_converted_schema) == 8, "duckdb-ffi ABI: DuckDBArrowConvertedSchema: size");
+_Static_assert(_Alignof(duckdb_arrow_converted_schema) == 8, "duckdb-ffi ABI: DuckDBArrowConvertedSchema: alignment");
+_Static_assert(sizeof(struct _duckdb_arrow_converted_schema) == 8, "duckdb-ffi ABI: DuckDBArrowConvertedSchemaStruct: size");
+_Static_assert(_Alignof(struct _duckdb_arrow_converted_schema) == 8, "duckdb-ffi ABI: DuckDBArrowConvertedSchemaStruct: alignment");
+_Static_assert(sizeof(duckdb_arrow_options) == 8, "duckdb-ffi ABI: DuckDBArrowOptions: size");
+_Static_assert(_Alignof(duckdb_arrow_options) == 8, "duckdb-ffi ABI: DuckDBArrowOptions: alignment");
+_Static_assert(sizeof(struct _duckdb_arrow_options) == 8, "duckdb-ffi ABI: DuckDBArrowOptionsStruct: size");
+_Static_assert(_Alignof(struct _duckdb_arrow_options) == 8, "duckdb-ffi ABI: DuckDBArrowOptionsStruct: alignment");
+_Static_assert(sizeof(duckdb_arrow_schema) == 8, "duckdb-ffi ABI: DuckDBArrowSchema: size");
+_Static_assert(_Alignof(duckdb_arrow_schema) == 8, "duckdb-ffi ABI: DuckDBArrowSchema: alignment");
+_Static_assert(sizeof(struct _duckdb_arrow_schema) == 8, "duckdb-ffi ABI: DuckDBArrowSchemaStruct: size");
+_Static_assert(_Alignof(struct _duckdb_arrow_schema) == 8, "duckdb-ffi ABI: DuckDBArrowSchemaStruct: alignment");
+_Static_assert(sizeof(duckdb_arrow_stream) == 8, "duckdb-ffi ABI: DuckDBArrowStream: size");
+_Static_assert(_Alignof(duckdb_arrow_stream) == 8, "duckdb-ffi ABI: DuckDBArrowStream: alignment");
+_Static_assert(sizeof(struct _duckdb_arrow_stream) == 8, "duckdb-ffi ABI: DuckDBArrowStreamStruct: size");
+_Static_assert(_Alignof(struct _duckdb_arrow_stream) == 8, "duckdb-ffi ABI: DuckDBArrowStreamStruct: alignment");
+_Static_assert(sizeof(struct _duckdb_arrow) == 8, "duckdb-ffi ABI: DuckDBArrowStruct: size");
+_Static_assert(_Alignof(struct _duckdb_arrow) == 8, "duckdb-ffi ABI: DuckDBArrowStruct: alignment");
+_Static_assert(sizeof(duckdb_bignum) == 24, "duckdb-ffi ABI: DuckDBBignum: size");
+_Static_assert(_Alignof(duckdb_bignum) == 8, "duckdb-ffi ABI: DuckDBBignum: alignment");
+_Static_assert(sizeof(duckdb_bind_info) == 8, "duckdb-ffi ABI: DuckDBBindInfo: size");
+_Static_assert(_Alignof(duckdb_bind_info) == 8, "duckdb-ffi ABI: DuckDBBindInfo: alignment");
+_Static_assert(sizeof(struct _duckdb_bind_info) == 8, "duckdb-ffi ABI: DuckDBBindInfoStruct: size");
+_Static_assert(_Alignof(struct _duckdb_bind_info) == 8, "duckdb-ffi ABI: DuckDBBindInfoStruct: alignment");
+_Static_assert(sizeof(duckdb_bit) == 16, "duckdb-ffi ABI: DuckDBBit: size");
+_Static_assert(_Alignof(duckdb_bit) == 8, "duckdb-ffi ABI: DuckDBBit: alignment");
+_Static_assert(sizeof(duckdb_blob) == 16, "duckdb-ffi ABI: DuckDBBlob: size");
+_Static_assert(_Alignof(duckdb_blob) == 8, "duckdb-ffi ABI: DuckDBBlob: alignment");
+_Static_assert(sizeof(duckdb_cast_function) == 8, "duckdb-ffi ABI: DuckDBCastFunction: size");
+_Static_assert(_Alignof(duckdb_cast_function) == 8, "duckdb-ffi ABI: DuckDBCastFunction: alignment");
+_Static_assert(sizeof(duckdb_cast_function_t) == 8, "duckdb-ffi ABI: DuckDBCastFunctionFun: size");
+_Static_assert(_Alignof(duckdb_cast_function_t) == 8, "duckdb-ffi ABI: DuckDBCastFunctionFun: alignment");
+_Static_assert(sizeof(struct _duckdb_cast_function) == 8, "duckdb-ffi ABI: DuckDBCastFunctionStruct: size");
+_Static_assert(_Alignof(struct _duckdb_cast_function) == 8, "duckdb-ffi ABI: DuckDBCastFunctionStruct: alignment");
+_Static_assert(sizeof(duckdb_cast_mode) == 4, "duckdb-ffi ABI: DuckDBCastMode: size");
+_Static_assert(_Alignof(duckdb_cast_mode) == 4, "duckdb-ffi ABI: DuckDBCastMode: alignment");
+_Static_assert(sizeof(duckdb_catalog) == 8, "duckdb-ffi ABI: DuckDBCatalog: size");
+_Static_assert(_Alignof(duckdb_catalog) == 8, "duckdb-ffi ABI: DuckDBCatalog: alignment");
+_Static_assert(sizeof(duckdb_catalog_entry) == 8, "duckdb-ffi ABI: DuckDBCatalogEntry: size");
+_Static_assert(_Alignof(duckdb_catalog_entry) == 8, "duckdb-ffi ABI: DuckDBCatalogEntry: alignment");
+_Static_assert(sizeof(struct _duckdb_catalog_entry) == 8, "duckdb-ffi ABI: DuckDBCatalogEntryStruct: size");
+_Static_assert(_Alignof(struct _duckdb_catalog_entry) == 8, "duckdb-ffi ABI: DuckDBCatalogEntryStruct: alignment");
+_Static_assert(sizeof(duckdb_catalog_entry_type) == 4, "duckdb-ffi ABI: DuckDBCatalogEntryType: size");
+_Static_assert(_Alignof(duckdb_catalog_entry_type) == 4, "duckdb-ffi ABI: DuckDBCatalogEntryType: alignment");
+_Static_assert(sizeof(struct _duckdb_catalog) == 8, "duckdb-ffi ABI: DuckDBCatalogStruct: size");
+_Static_assert(_Alignof(struct _duckdb_catalog) == 8, "duckdb-ffi ABI: DuckDBCatalogStruct: alignment");
+_Static_assert(sizeof(duckdb_client_context) == 8, "duckdb-ffi ABI: DuckDBClientContext: size");
+_Static_assert(_Alignof(duckdb_client_context) == 8, "duckdb-ffi ABI: DuckDBClientContext: alignment");
+_Static_assert(sizeof(struct _duckdb_client_context) == 8, "duckdb-ffi ABI: DuckDBClientContextStruct: size");
+_Static_assert(_Alignof(struct _duckdb_client_context) == 8, "duckdb-ffi ABI: DuckDBClientContextStruct: alignment");
+_Static_assert(sizeof(duckdb_column) == 40, "duckdb-ffi ABI: DuckDBColumn: size");
+_Static_assert(_Alignof(duckdb_column) == 8, "duckdb-ffi ABI: DuckDBColumn: alignment");
+_Static_assert(sizeof(duckdb_config) == 8, "duckdb-ffi ABI: DuckDBConfig: size");
+_Static_assert(_Alignof(duckdb_config) == 8, "duckdb-ffi ABI: DuckDBConfig: alignment");
+_Static_assert(sizeof(duckdb_config_option) == 8, "duckdb-ffi ABI: DuckDBConfigOption: size");
+_Static_assert(_Alignof(duckdb_config_option) == 8, "duckdb-ffi ABI: DuckDBConfigOption: alignment");
+_Static_assert(sizeof(duckdb_config_option_scope) == 4, "duckdb-ffi ABI: DuckDBConfigOptionScope: size");
+_Static_assert(_Alignof(duckdb_config_option_scope) == 4, "duckdb-ffi ABI: DuckDBConfigOptionScope: alignment");
+_Static_assert(sizeof(struct _duckdb_config_option) == 8, "duckdb-ffi ABI: DuckDBConfigOptionStruct: size");
+_Static_assert(_Alignof(struct _duckdb_config_option) == 8, "duckdb-ffi ABI: DuckDBConfigOptionStruct: alignment");
+_Static_assert(sizeof(struct _duckdb_config) == 8, "duckdb-ffi ABI: DuckDBConfigStruct: size");
+_Static_assert(_Alignof(struct _duckdb_config) == 8, "duckdb-ffi ABI: DuckDBConfigStruct: alignment");
+_Static_assert(sizeof(duckdb_connection) == 8, "duckdb-ffi ABI: DuckDBConnection: size");
+_Static_assert(_Alignof(duckdb_connection) == 8, "duckdb-ffi ABI: DuckDBConnection: alignment");
+_Static_assert(sizeof(struct _duckdb_connection) == 8, "duckdb-ffi ABI: DuckDBConnectionStruct: size");
+_Static_assert(_Alignof(struct _duckdb_connection) == 8, "duckdb-ffi ABI: DuckDBConnectionStruct: alignment");
+_Static_assert(sizeof(duckdb_copy_callback_t) == 8, "duckdb-ffi ABI: DuckDBCopyCallback: size");
+_Static_assert(_Alignof(duckdb_copy_callback_t) == 8, "duckdb-ffi ABI: DuckDBCopyCallback: alignment");
+_Static_assert(sizeof(duckdb_copy_function) == 8, "duckdb-ffi ABI: DuckDBCopyFunction: size");
+_Static_assert(_Alignof(duckdb_copy_function) == 8, "duckdb-ffi ABI: DuckDBCopyFunction: alignment");
+_Static_assert(sizeof(duckdb_copy_function_bind_t) == 8, "duckdb-ffi ABI: DuckDBCopyFunctionBindFun: size");
+_Static_assert(_Alignof(duckdb_copy_function_bind_t) == 8, "duckdb-ffi ABI: DuckDBCopyFunctionBindFun: alignment");
+_Static_assert(sizeof(duckdb_copy_function_bind_info) == 8, "duckdb-ffi ABI: DuckDBCopyFunctionBindInfo: size");
+_Static_assert(_Alignof(duckdb_copy_function_bind_info) == 8, "duckdb-ffi ABI: DuckDBCopyFunctionBindInfo: alignment");
+_Static_assert(sizeof(struct _duckdb_copy_function_bind_info) == 8, "duckdb-ffi ABI: DuckDBCopyFunctionBindInfoStruct: size");
+_Static_assert(_Alignof(struct _duckdb_copy_function_bind_info) == 8, "duckdb-ffi ABI: DuckDBCopyFunctionBindInfoStruct: alignment");
+_Static_assert(sizeof(duckdb_copy_function_finalize_t) == 8, "duckdb-ffi ABI: DuckDBCopyFunctionFinalizeFun: size");
+_Static_assert(_Alignof(duckdb_copy_function_finalize_t) == 8, "duckdb-ffi ABI: DuckDBCopyFunctionFinalizeFun: alignment");
+_Static_assert(sizeof(duckdb_copy_function_finalize_info) == 8, "duckdb-ffi ABI: DuckDBCopyFunctionFinalizeInfo: size");
+_Static_assert(_Alignof(duckdb_copy_function_finalize_info) == 8, "duckdb-ffi ABI: DuckDBCopyFunctionFinalizeInfo: alignment");
+_Static_assert(sizeof(struct _duckdb_copy_function_finalize_info) == 8, "duckdb-ffi ABI: DuckDBCopyFunctionFinalizeInfoStruct: size");
+_Static_assert(_Alignof(struct _duckdb_copy_function_finalize_info) == 8, "duckdb-ffi ABI: DuckDBCopyFunctionFinalizeInfoStruct: alignment");
+_Static_assert(sizeof(duckdb_copy_function_global_init_t) == 8, "duckdb-ffi ABI: DuckDBCopyFunctionGlobalInitFun: size");
+_Static_assert(_Alignof(duckdb_copy_function_global_init_t) == 8, "duckdb-ffi ABI: DuckDBCopyFunctionGlobalInitFun: alignment");
+_Static_assert(sizeof(duckdb_copy_function_global_init_info) == 8, "duckdb-ffi ABI: DuckDBCopyFunctionGlobalInitInfo: size");
+_Static_assert(_Alignof(duckdb_copy_function_global_init_info) == 8, "duckdb-ffi ABI: DuckDBCopyFunctionGlobalInitInfo: alignment");
+_Static_assert(sizeof(struct _duckdb_copy_function_global_init_info) == 8, "duckdb-ffi ABI: DuckDBCopyFunctionGlobalInitInfoStruct: size");
+_Static_assert(_Alignof(struct _duckdb_copy_function_global_init_info) == 8, "duckdb-ffi ABI: DuckDBCopyFunctionGlobalInitInfoStruct: alignment");
+_Static_assert(sizeof(duckdb_copy_function_sink_t) == 8, "duckdb-ffi ABI: DuckDBCopyFunctionSinkFun: size");
+_Static_assert(_Alignof(duckdb_copy_function_sink_t) == 8, "duckdb-ffi ABI: DuckDBCopyFunctionSinkFun: alignment");
+_Static_assert(sizeof(duckdb_copy_function_sink_info) == 8, "duckdb-ffi ABI: DuckDBCopyFunctionSinkInfo: size");
+_Static_assert(_Alignof(duckdb_copy_function_sink_info) == 8, "duckdb-ffi ABI: DuckDBCopyFunctionSinkInfo: alignment");
+_Static_assert(sizeof(struct _duckdb_copy_function_sink_info) == 8, "duckdb-ffi ABI: DuckDBCopyFunctionSinkInfoStruct: size");
+_Static_assert(_Alignof(struct _duckdb_copy_function_sink_info) == 8, "duckdb-ffi ABI: DuckDBCopyFunctionSinkInfoStruct: alignment");
+_Static_assert(sizeof(struct _duckdb_copy_function) == 8, "duckdb-ffi ABI: DuckDBCopyFunctionStruct: size");
+_Static_assert(_Alignof(struct _duckdb_copy_function) == 8, "duckdb-ffi ABI: DuckDBCopyFunctionStruct: alignment");
+_Static_assert(sizeof(duckdb_create_type_info) == 8, "duckdb-ffi ABI: DuckDBCreateTypeInfo: size");
+_Static_assert(_Alignof(duckdb_create_type_info) == 8, "duckdb-ffi ABI: DuckDBCreateTypeInfo: alignment");
+_Static_assert(sizeof(struct _duckdb_create_type_info) == 8, "duckdb-ffi ABI: DuckDBCreateTypeInfoStruct: size");
+_Static_assert(_Alignof(struct _duckdb_create_type_info) == 8, "duckdb-ffi ABI: DuckDBCreateTypeInfoStruct: alignment");
+_Static_assert(sizeof(duckdb_data_chunk) == 8, "duckdb-ffi ABI: DuckDBDataChunk: size");
+_Static_assert(_Alignof(duckdb_data_chunk) == 8, "duckdb-ffi ABI: DuckDBDataChunk: alignment");
+_Static_assert(sizeof(struct _duckdb_data_chunk) == 8, "duckdb-ffi ABI: DuckDBDataChunkStruct: size");
+_Static_assert(_Alignof(struct _duckdb_data_chunk) == 8, "duckdb-ffi ABI: DuckDBDataChunkStruct: alignment");
+_Static_assert(sizeof(duckdb_database) == 8, "duckdb-ffi ABI: DuckDBDatabase: size");
+_Static_assert(_Alignof(duckdb_database) == 8, "duckdb-ffi ABI: DuckDBDatabase: alignment");
+_Static_assert(sizeof(struct _duckdb_database) == 8, "duckdb-ffi ABI: DuckDBDatabaseStruct: size");
+_Static_assert(_Alignof(struct _duckdb_database) == 8, "duckdb-ffi ABI: DuckDBDatabaseStruct: alignment");
+_Static_assert(sizeof(duckdb_date) == 4, "duckdb-ffi ABI: DuckDBDate: size");
+_Static_assert(_Alignof(duckdb_date) == 4, "duckdb-ffi ABI: DuckDBDate: alignment");
+_Static_assert(sizeof(duckdb_date_struct) == 8, "duckdb-ffi ABI: DuckDBDateStruct: size");
+_Static_assert(_Alignof(duckdb_date_struct) == 4, "duckdb-ffi ABI: DuckDBDateStruct: alignment");
+_Static_assert(sizeof(duckdb_decimal) == 24, "duckdb-ffi ABI: DuckDBDecimal: size");
+_Static_assert(_Alignof(duckdb_decimal) == 8, "duckdb-ffi ABI: DuckDBDecimal: alignment");
+_Static_assert(sizeof(duckdb_delete_callback_t) == 8, "duckdb-ffi ABI: DuckDBDeleteCallback: size");
+_Static_assert(_Alignof(duckdb_delete_callback_t) == 8, "duckdb-ffi ABI: DuckDBDeleteCallback: alignment");
+_Static_assert(sizeof(duckdb_error_data) == 8, "duckdb-ffi ABI: DuckDBErrorData: size");
+_Static_assert(_Alignof(duckdb_error_data) == 8, "duckdb-ffi ABI: DuckDBErrorData: alignment");
+_Static_assert(sizeof(struct _duckdb_error_data) == 8, "duckdb-ffi ABI: DuckDBErrorDataStruct: size");
+_Static_assert(_Alignof(struct _duckdb_error_data) == 8, "duckdb-ffi ABI: DuckDBErrorDataStruct: alignment");
+_Static_assert(sizeof(duckdb_error_type) == 4, "duckdb-ffi ABI: DuckDBErrorType: size");
+_Static_assert(_Alignof(duckdb_error_type) == 4, "duckdb-ffi ABI: DuckDBErrorType: alignment");
+_Static_assert(sizeof(duckdb_expression) == 8, "duckdb-ffi ABI: DuckDBExpression: size");
+_Static_assert(_Alignof(duckdb_expression) == 8, "duckdb-ffi ABI: DuckDBExpression: alignment");
+_Static_assert(sizeof(struct _duckdb_expression) == 8, "duckdb-ffi ABI: DuckDBExpressionStruct: size");
+_Static_assert(_Alignof(struct _duckdb_expression) == 8, "duckdb-ffi ABI: DuckDBExpressionStruct: alignment");
+_Static_assert(sizeof(struct duckdb_extension_access) == 24, "duckdb-ffi ABI: DuckDBExtensionAccess: size");
+_Static_assert(_Alignof(struct duckdb_extension_access) == 8, "duckdb-ffi ABI: DuckDBExtensionAccess: alignment");
+_Static_assert(sizeof(duckdb_extension_info) == 8, "duckdb-ffi ABI: DuckDBExtensionInfo: size");
+_Static_assert(_Alignof(duckdb_extension_info) == 8, "duckdb-ffi ABI: DuckDBExtensionInfo: alignment");
+_Static_assert(sizeof(struct _duckdb_extension_info) == 8, "duckdb-ffi ABI: DuckDBExtensionInfoStruct: size");
+_Static_assert(_Alignof(struct _duckdb_extension_info) == 8, "duckdb-ffi ABI: DuckDBExtensionInfoStruct: alignment");
+_Static_assert(sizeof(duckdb_extracted_statements) == 8, "duckdb-ffi ABI: DuckDBExtractedStatements: size");
+_Static_assert(_Alignof(duckdb_extracted_statements) == 8, "duckdb-ffi ABI: DuckDBExtractedStatements: alignment");
+_Static_assert(sizeof(struct _duckdb_extracted_statements) == 8, "duckdb-ffi ABI: DuckDBExtractedStatementsStruct: size");
+_Static_assert(_Alignof(struct _duckdb_extracted_statements) == 8, "duckdb-ffi ABI: DuckDBExtractedStatementsStruct: alignment");
+_Static_assert(sizeof(duckdb_file_flag) == 4, "duckdb-ffi ABI: DuckDBFileFlag: size");
+_Static_assert(_Alignof(duckdb_file_flag) == 4, "duckdb-ffi ABI: DuckDBFileFlag: alignment");
+_Static_assert(sizeof(duckdb_file_handle) == 8, "duckdb-ffi ABI: DuckDBFileHandle: size");
+_Static_assert(_Alignof(duckdb_file_handle) == 8, "duckdb-ffi ABI: DuckDBFileHandle: alignment");
+_Static_assert(sizeof(struct _duckdb_file_handle) == 8, "duckdb-ffi ABI: DuckDBFileHandleStruct: size");
+_Static_assert(_Alignof(struct _duckdb_file_handle) == 8, "duckdb-ffi ABI: DuckDBFileHandleStruct: alignment");
+_Static_assert(sizeof(duckdb_file_open_options) == 8, "duckdb-ffi ABI: DuckDBFileOpenOptions: size");
+_Static_assert(_Alignof(duckdb_file_open_options) == 8, "duckdb-ffi ABI: DuckDBFileOpenOptions: alignment");
+_Static_assert(sizeof(struct _duckdb_file_open_options) == 8, "duckdb-ffi ABI: DuckDBFileOpenOptionsStruct: size");
+_Static_assert(_Alignof(struct _duckdb_file_open_options) == 8, "duckdb-ffi ABI: DuckDBFileOpenOptionsStruct: alignment");
+_Static_assert(sizeof(duckdb_file_system) == 8, "duckdb-ffi ABI: DuckDBFileSystem: size");
+_Static_assert(_Alignof(duckdb_file_system) == 8, "duckdb-ffi ABI: DuckDBFileSystem: alignment");
+_Static_assert(sizeof(struct _duckdb_file_system) == 8, "duckdb-ffi ABI: DuckDBFileSystemStruct: size");
+_Static_assert(_Alignof(struct _duckdb_file_system) == 8, "duckdb-ffi ABI: DuckDBFileSystemStruct: alignment");
+_Static_assert(sizeof(duckdb_function_info) == 8, "duckdb-ffi ABI: DuckDBFunctionInfo: size");
+_Static_assert(_Alignof(duckdb_function_info) == 8, "duckdb-ffi ABI: DuckDBFunctionInfo: alignment");
+_Static_assert(sizeof(struct _duckdb_function_info) == 8, "duckdb-ffi ABI: DuckDBFunctionInfoStruct: size");
+_Static_assert(_Alignof(struct _duckdb_function_info) == 8, "duckdb-ffi ABI: DuckDBFunctionInfoStruct: alignment");
+_Static_assert(sizeof(duckdb_hugeint) == 16, "duckdb-ffi ABI: DuckDBHugeInt: size");
+_Static_assert(_Alignof(duckdb_hugeint) == 8, "duckdb-ffi ABI: DuckDBHugeInt: alignment");
+_Static_assert(sizeof(idx_t) == 8, "duckdb-ffi ABI: DuckDBIdx: size");
+_Static_assert(_Alignof(idx_t) == 8, "duckdb-ffi ABI: DuckDBIdx: alignment");
+_Static_assert(sizeof(duckdb_init_info) == 8, "duckdb-ffi ABI: DuckDBInitInfo: size");
+_Static_assert(_Alignof(duckdb_init_info) == 8, "duckdb-ffi ABI: DuckDBInitInfo: alignment");
+_Static_assert(sizeof(struct _duckdb_init_info) == 8, "duckdb-ffi ABI: DuckDBInitInfoStruct: size");
+_Static_assert(_Alignof(struct _duckdb_init_info) == 8, "duckdb-ffi ABI: DuckDBInitInfoStruct: alignment");
+_Static_assert(sizeof(duckdb_instance_cache) == 8, "duckdb-ffi ABI: DuckDBInstanceCache: size");
+_Static_assert(_Alignof(duckdb_instance_cache) == 8, "duckdb-ffi ABI: DuckDBInstanceCache: alignment");
+_Static_assert(sizeof(struct _duckdb_instance_cache) == 8, "duckdb-ffi ABI: DuckDBInstanceCacheStruct: size");
+_Static_assert(_Alignof(struct _duckdb_instance_cache) == 8, "duckdb-ffi ABI: DuckDBInstanceCacheStruct: alignment");
+_Static_assert(sizeof(duckdb_interval) == 16, "duckdb-ffi ABI: DuckDBInterval: size");
+_Static_assert(_Alignof(duckdb_interval) == 8, "duckdb-ffi ABI: DuckDBInterval: alignment");
+_Static_assert(sizeof(duckdb_list_entry) == 16, "duckdb-ffi ABI: DuckDBListEntry: size");
+_Static_assert(_Alignof(duckdb_list_entry) == 8, "duckdb-ffi ABI: DuckDBListEntry: alignment");
+_Static_assert(sizeof(duckdb_log_storage) == 8, "duckdb-ffi ABI: DuckDBLogStorage: size");
+_Static_assert(_Alignof(duckdb_log_storage) == 8, "duckdb-ffi ABI: DuckDBLogStorage: alignment");
+_Static_assert(sizeof(struct _duckdb_log_storage) == 8, "duckdb-ffi ABI: DuckDBLogStorageStruct: size");
+_Static_assert(_Alignof(struct _duckdb_log_storage) == 8, "duckdb-ffi ABI: DuckDBLogStorageStruct: alignment");
+_Static_assert(sizeof(duckdb_logger_write_log_entry_t) == 8, "duckdb-ffi ABI: DuckDBLoggerWriteLogEntryFun: size");
+_Static_assert(_Alignof(duckdb_logger_write_log_entry_t) == 8, "duckdb-ffi ABI: DuckDBLoggerWriteLogEntryFun: alignment");
+_Static_assert(sizeof(duckdb_logical_type) == 8, "duckdb-ffi ABI: DuckDBLogicalType: size");
+_Static_assert(_Alignof(duckdb_logical_type) == 8, "duckdb-ffi ABI: DuckDBLogicalType: alignment");
+_Static_assert(sizeof(struct _duckdb_logical_type) == 8, "duckdb-ffi ABI: DuckDBLogicalTypeStruct: size");
+_Static_assert(_Alignof(struct _duckdb_logical_type) == 8, "duckdb-ffi ABI: DuckDBLogicalTypeStruct: alignment");
+_Static_assert(sizeof(duckdb_pending_result) == 8, "duckdb-ffi ABI: DuckDBPendingResult: size");
+_Static_assert(_Alignof(duckdb_pending_result) == 8, "duckdb-ffi ABI: DuckDBPendingResult: alignment");
+_Static_assert(sizeof(struct _duckdb_pending_result) == 8, "duckdb-ffi ABI: DuckDBPendingResultStruct: size");
+_Static_assert(_Alignof(struct _duckdb_pending_result) == 8, "duckdb-ffi ABI: DuckDBPendingResultStruct: alignment");
+_Static_assert(sizeof(duckdb_pending_state) == 4, "duckdb-ffi ABI: DuckDBPendingState: size");
+_Static_assert(_Alignof(duckdb_pending_state) == 4, "duckdb-ffi ABI: DuckDBPendingState: alignment");
+_Static_assert(sizeof(duckdb_prepared_statement) == 8, "duckdb-ffi ABI: DuckDBPreparedStatement: size");
+_Static_assert(_Alignof(duckdb_prepared_statement) == 8, "duckdb-ffi ABI: DuckDBPreparedStatement: alignment");
+_Static_assert(sizeof(struct _duckdb_prepared_statement) == 8, "duckdb-ffi ABI: DuckDBPreparedStatementStruct: size");
+_Static_assert(_Alignof(struct _duckdb_prepared_statement) == 8, "duckdb-ffi ABI: DuckDBPreparedStatementStruct: alignment");
+_Static_assert(sizeof(duckdb_profiling_info) == 8, "duckdb-ffi ABI: DuckDBProfilingInfo: size");
+_Static_assert(_Alignof(duckdb_profiling_info) == 8, "duckdb-ffi ABI: DuckDBProfilingInfo: alignment");
+_Static_assert(sizeof(struct _duckdb_profiling_info) == 8, "duckdb-ffi ABI: DuckDBProfilingInfoStruct: size");
+_Static_assert(_Alignof(struct _duckdb_profiling_info) == 8, "duckdb-ffi ABI: DuckDBProfilingInfoStruct: alignment");
+_Static_assert(sizeof(duckdb_query_progress_type) == 24, "duckdb-ffi ABI: DuckDBQueryProgress: size");
+_Static_assert(_Alignof(duckdb_query_progress_type) == 8, "duckdb-ffi ABI: DuckDBQueryProgress: alignment");
+_Static_assert(sizeof(duckdb_replacement_callback_t) == 8, "duckdb-ffi ABI: DuckDBReplacementCallback: size");
+_Static_assert(_Alignof(duckdb_replacement_callback_t) == 8, "duckdb-ffi ABI: DuckDBReplacementCallback: alignment");
+_Static_assert(sizeof(duckdb_replacement_scan_info) == 8, "duckdb-ffi ABI: DuckDBReplacementScanInfo: size");
+_Static_assert(_Alignof(duckdb_replacement_scan_info) == 8, "duckdb-ffi ABI: DuckDBReplacementScanInfo: alignment");
+_Static_assert(sizeof(struct _duckdb_replacement_scan_info) == 8, "duckdb-ffi ABI: DuckDBReplacementScanInfoStruct: size");
+_Static_assert(_Alignof(struct _duckdb_replacement_scan_info) == 8, "duckdb-ffi ABI: DuckDBReplacementScanInfoStruct: alignment");
+_Static_assert(sizeof(duckdb_result) == 48, "duckdb-ffi ABI: DuckDBResult: size");
+_Static_assert(_Alignof(duckdb_result) == 8, "duckdb-ffi ABI: DuckDBResult: alignment");
+_Static_assert(sizeof(duckdb_result_type) == 4, "duckdb-ffi ABI: DuckDBResultType: size");
+_Static_assert(_Alignof(duckdb_result_type) == 4, "duckdb-ffi ABI: DuckDBResultType: alignment");
+_Static_assert(sizeof(duckdb_scalar_function) == 8, "duckdb-ffi ABI: DuckDBScalarFunction: size");
+_Static_assert(_Alignof(duckdb_scalar_function) == 8, "duckdb-ffi ABI: DuckDBScalarFunction: alignment");
+_Static_assert(sizeof(duckdb_scalar_function_bind_t) == 8, "duckdb-ffi ABI: DuckDBScalarFunctionBindFun: size");
+_Static_assert(_Alignof(duckdb_scalar_function_bind_t) == 8, "duckdb-ffi ABI: DuckDBScalarFunctionBindFun: alignment");
+_Static_assert(sizeof(duckdb_scalar_function_t) == 8, "duckdb-ffi ABI: DuckDBScalarFunctionFun: size");
+_Static_assert(_Alignof(duckdb_scalar_function_t) == 8, "duckdb-ffi ABI: DuckDBScalarFunctionFun: alignment");
+_Static_assert(sizeof(duckdb_scalar_function_init_t) == 8, "duckdb-ffi ABI: DuckDBScalarFunctionInitFun: size");
+_Static_assert(_Alignof(duckdb_scalar_function_init_t) == 8, "duckdb-ffi ABI: DuckDBScalarFunctionInitFun: alignment");
+_Static_assert(sizeof(duckdb_scalar_function_set) == 8, "duckdb-ffi ABI: DuckDBScalarFunctionSet: size");
+_Static_assert(_Alignof(duckdb_scalar_function_set) == 8, "duckdb-ffi ABI: DuckDBScalarFunctionSet: alignment");
+_Static_assert(sizeof(struct _duckdb_scalar_function_set) == 8, "duckdb-ffi ABI: DuckDBScalarFunctionSetStruct: size");
+_Static_assert(_Alignof(struct _duckdb_scalar_function_set) == 8, "duckdb-ffi ABI: DuckDBScalarFunctionSetStruct: alignment");
+_Static_assert(sizeof(struct _duckdb_scalar_function) == 8, "duckdb-ffi ABI: DuckDBScalarFunctionStruct: size");
+_Static_assert(_Alignof(struct _duckdb_scalar_function) == 8, "duckdb-ffi ABI: DuckDBScalarFunctionStruct: alignment");
+_Static_assert(sizeof(sel_t) == 4, "duckdb-ffi ABI: DuckDBSel: size");
+_Static_assert(_Alignof(sel_t) == 4, "duckdb-ffi ABI: DuckDBSel: alignment");
+_Static_assert(sizeof(duckdb_selection_vector) == 8, "duckdb-ffi ABI: DuckDBSelectionVector: size");
+_Static_assert(_Alignof(duckdb_selection_vector) == 8, "duckdb-ffi ABI: DuckDBSelectionVector: alignment");
+_Static_assert(sizeof(struct _duckdb_selection_vector) == 8, "duckdb-ffi ABI: DuckDBSelectionVectorStruct: size");
+_Static_assert(_Alignof(struct _duckdb_selection_vector) == 8, "duckdb-ffi ABI: DuckDBSelectionVectorStruct: alignment");
+_Static_assert(sizeof(duckdb_state) == 4, "duckdb-ffi ABI: DuckDBState: size");
+_Static_assert(_Alignof(duckdb_state) == 4, "duckdb-ffi ABI: DuckDBState: alignment");
+_Static_assert(sizeof(duckdb_statement_type) == 4, "duckdb-ffi ABI: DuckDBStatementType: size");
+_Static_assert(_Alignof(duckdb_statement_type) == 4, "duckdb-ffi ABI: DuckDBStatementType: alignment");
+_Static_assert(sizeof(duckdb_string) == 16, "duckdb-ffi ABI: DuckDBString: size");
+_Static_assert(_Alignof(duckdb_string) == 8, "duckdb-ffi ABI: DuckDBString: alignment");
+_Static_assert(sizeof(duckdb_string_t) == 16, "duckdb-ffi ABI: DuckDBStringT: size");
+_Static_assert(_Alignof(duckdb_string_t) == 8, "duckdb-ffi ABI: DuckDBStringT: alignment");
+_Static_assert(sizeof(duckdb_table_description) == 8, "duckdb-ffi ABI: DuckDBTableDescription: size");
+_Static_assert(_Alignof(duckdb_table_description) == 8, "duckdb-ffi ABI: DuckDBTableDescription: alignment");
+_Static_assert(sizeof(struct _duckdb_table_description) == 8, "duckdb-ffi ABI: DuckDBTableDescriptionStruct: size");
+_Static_assert(_Alignof(struct _duckdb_table_description) == 8, "duckdb-ffi ABI: DuckDBTableDescriptionStruct: alignment");
+_Static_assert(sizeof(duckdb_table_function) == 8, "duckdb-ffi ABI: DuckDBTableFunction: size");
+_Static_assert(_Alignof(duckdb_table_function) == 8, "duckdb-ffi ABI: DuckDBTableFunction: alignment");
+_Static_assert(sizeof(duckdb_table_function_bind_t) == 8, "duckdb-ffi ABI: DuckDBTableFunctionBindFun: size");
+_Static_assert(_Alignof(duckdb_table_function_bind_t) == 8, "duckdb-ffi ABI: DuckDBTableFunctionBindFun: alignment");
+_Static_assert(sizeof(duckdb_table_function_t) == 8, "duckdb-ffi ABI: DuckDBTableFunctionFun: size");
+_Static_assert(_Alignof(duckdb_table_function_t) == 8, "duckdb-ffi ABI: DuckDBTableFunctionFun: alignment");
+_Static_assert(sizeof(duckdb_table_function_init_t) == 8, "duckdb-ffi ABI: DuckDBTableFunctionInitFun: size");
+_Static_assert(_Alignof(duckdb_table_function_init_t) == 8, "duckdb-ffi ABI: DuckDBTableFunctionInitFun: alignment");
+_Static_assert(sizeof(struct _duckdb_table_function) == 8, "duckdb-ffi ABI: DuckDBTableFunctionStruct: size");
+_Static_assert(_Alignof(struct _duckdb_table_function) == 8, "duckdb-ffi ABI: DuckDBTableFunctionStruct: alignment");
+_Static_assert(sizeof(duckdb_task_state) == 8, "duckdb-ffi ABI: DuckDBTaskState: size");
+_Static_assert(_Alignof(duckdb_task_state) == 8, "duckdb-ffi ABI: DuckDBTaskState: alignment");
+_Static_assert(sizeof(duckdb_time) == 8, "duckdb-ffi ABI: DuckDBTime: size");
+_Static_assert(_Alignof(duckdb_time) == 8, "duckdb-ffi ABI: DuckDBTime: alignment");
+_Static_assert(sizeof(duckdb_time_ns) == 8, "duckdb-ffi ABI: DuckDBTimeNs: size");
+_Static_assert(_Alignof(duckdb_time_ns) == 8, "duckdb-ffi ABI: DuckDBTimeNs: alignment");
+_Static_assert(sizeof(duckdb_time_struct) == 8, "duckdb-ffi ABI: DuckDBTimeStruct: size");
+_Static_assert(_Alignof(duckdb_time_struct) == 4, "duckdb-ffi ABI: DuckDBTimeStruct: alignment");
+_Static_assert(sizeof(duckdb_time_tz) == 8, "duckdb-ffi ABI: DuckDBTimeTz: size");
+_Static_assert(_Alignof(duckdb_time_tz) == 8, "duckdb-ffi ABI: DuckDBTimeTz: alignment");
+_Static_assert(sizeof(duckdb_time_tz_struct) == 12, "duckdb-ffi ABI: DuckDBTimeTzStruct: size");
+_Static_assert(_Alignof(duckdb_time_tz_struct) == 4, "duckdb-ffi ABI: DuckDBTimeTzStruct: alignment");
+_Static_assert(sizeof(duckdb_timestamp) == 8, "duckdb-ffi ABI: DuckDBTimestamp: size");
+_Static_assert(_Alignof(duckdb_timestamp) == 8, "duckdb-ffi ABI: DuckDBTimestamp: alignment");
+_Static_assert(sizeof(duckdb_timestamp_ms) == 8, "duckdb-ffi ABI: DuckDBTimestampMs: size");
+_Static_assert(_Alignof(duckdb_timestamp_ms) == 8, "duckdb-ffi ABI: DuckDBTimestampMs: alignment");
+_Static_assert(sizeof(duckdb_timestamp_ns) == 8, "duckdb-ffi ABI: DuckDBTimestampNs: size");
+_Static_assert(_Alignof(duckdb_timestamp_ns) == 8, "duckdb-ffi ABI: DuckDBTimestampNs: alignment");
+_Static_assert(sizeof(duckdb_timestamp_s) == 8, "duckdb-ffi ABI: DuckDBTimestampS: size");
+_Static_assert(_Alignof(duckdb_timestamp_s) == 8, "duckdb-ffi ABI: DuckDBTimestampS: alignment");
+_Static_assert(sizeof(duckdb_timestamp_struct) == 16, "duckdb-ffi ABI: DuckDBTimestampStruct: size");
+_Static_assert(_Alignof(duckdb_timestamp_struct) == 4, "duckdb-ffi ABI: DuckDBTimestampStruct: alignment");
+_Static_assert(sizeof(DUCKDB_TYPE) == 4, "duckdb-ffi ABI: DuckDBType: size");
+_Static_assert(_Alignof(DUCKDB_TYPE) == 4, "duckdb-ffi ABI: DuckDBType: alignment");
+_Static_assert(sizeof(duckdb_type) == 4, "duckdb-ffi ABI: DuckDBTypeAlias: size");
+_Static_assert(_Alignof(duckdb_type) == 4, "duckdb-ffi ABI: DuckDBTypeAlias: alignment");
+_Static_assert(sizeof(duckdb_uhugeint) == 16, "duckdb-ffi ABI: DuckDBUHugeInt: size");
+_Static_assert(_Alignof(duckdb_uhugeint) == 8, "duckdb-ffi ABI: DuckDBUHugeInt: alignment");
+_Static_assert(sizeof(duckdb_value) == 8, "duckdb-ffi ABI: DuckDBValue: size");
+_Static_assert(_Alignof(duckdb_value) == 8, "duckdb-ffi ABI: DuckDBValue: alignment");
+_Static_assert(sizeof(struct _duckdb_value) == 8, "duckdb-ffi ABI: DuckDBValueStruct: size");
+_Static_assert(_Alignof(struct _duckdb_value) == 8, "duckdb-ffi ABI: DuckDBValueStruct: alignment");
+_Static_assert(sizeof(duckdb_vector) == 8, "duckdb-ffi ABI: DuckDBVector: size");
+_Static_assert(_Alignof(duckdb_vector) == 8, "duckdb-ffi ABI: DuckDBVector: alignment");
+_Static_assert(sizeof(struct _duckdb_vector) == 8, "duckdb-ffi ABI: DuckDBVectorStruct: size");
+_Static_assert(_Alignof(struct _duckdb_vector) == 8, "duckdb-ffi ABI: DuckDBVectorStruct: alignment");
+_Static_assert(sizeof(__typeof__(((duckdb_string_t *)0)->value)) == 16, "duckdb-ffi ABI: Duckdb_string_t_value: size");
+_Static_assert(_Alignof(__typeof__(((duckdb_string_t *)0)->value)) == 8, "duckdb-ffi ABI: Duckdb_string_t_value: alignment");
+_Static_assert(sizeof(__typeof__(((__typeof__(((duckdb_string_t *)0)->value) *)0)->inlined)) == 16, "duckdb-ffi ABI: Duckdb_string_t_value_inlined: size");
+_Static_assert(_Alignof(__typeof__(((__typeof__(((duckdb_string_t *)0)->value) *)0)->inlined)) == 4, "duckdb-ffi ABI: Duckdb_string_t_value_inlined: alignment");
+_Static_assert(sizeof(__typeof__(((__typeof__(((duckdb_string_t *)0)->value) *)0)->pointer)) == 16, "duckdb-ffi ABI: Duckdb_string_t_value_pointer: size");
+_Static_assert(_Alignof(__typeof__(((__typeof__(((duckdb_string_t *)0)->value) *)0)->pointer)) == 8, "duckdb-ffi ABI: Duckdb_string_t_value_pointer: alignment");
+_Static_assert(__builtin_offsetof(__typeof__(((__typeof__(((duckdb_string_t *)0)->value) *)0)->pointer), length) == 0, "duckdb-ffi ABI: Duckdb_string_t_value_pointer.length: offset");
+_Static_assert(sizeof(((__typeof__(((__typeof__(((duckdb_string_t *)0)->value) *)0)->pointer) *)0)->length) == 4, "duckdb-ffi ABI: Duckdb_string_t_value_pointer.length: size");
+_Static_assert(__builtin_offsetof(__typeof__(((__typeof__(((duckdb_string_t *)0)->value) *)0)->pointer), prefix) == 4, "duckdb-ffi ABI: Duckdb_string_t_value_pointer.prefix: offset");
+_Static_assert(sizeof(((__typeof__(((__typeof__(((duckdb_string_t *)0)->value) *)0)->pointer) *)0)->prefix) == 4, "duckdb-ffi ABI: Duckdb_string_t_value_pointer.prefix: size");
+_Static_assert(__builtin_offsetof(__typeof__(((__typeof__(((duckdb_string_t *)0)->value) *)0)->pointer), ptr) == 8, "duckdb-ffi ABI: Duckdb_string_t_value_pointer.ptr: offset");
+_Static_assert(sizeof(((__typeof__(((__typeof__(((duckdb_string_t *)0)->value) *)0)->pointer) *)0)->ptr) == 8, "duckdb-ffi ABI: Duckdb_string_t_value_pointer.ptr: size");
+_Static_assert(__builtin_offsetof(__typeof__(((__typeof__(((duckdb_string_t *)0)->value) *)0)->inlined), length) == 0, "duckdb-ffi ABI: Duckdb_string_t_value_inlined.length: offset");
+_Static_assert(sizeof(((__typeof__(((__typeof__(((duckdb_string_t *)0)->value) *)0)->inlined) *)0)->length) == 4, "duckdb-ffi ABI: Duckdb_string_t_value_inlined.length: size");
+_Static_assert(__builtin_offsetof(__typeof__(((__typeof__(((duckdb_string_t *)0)->value) *)0)->inlined), inlined) == 4, "duckdb-ffi ABI: Duckdb_string_t_value_inlined.inlined: offset");
+_Static_assert(sizeof(((__typeof__(((__typeof__(((duckdb_string_t *)0)->value) *)0)->inlined) *)0)->inlined) == 12, "duckdb-ffi ABI: Duckdb_string_t_value_inlined.inlined: size");
+_Static_assert(__builtin_offsetof(__typeof__(((duckdb_string_t *)0)->value), pointer) == 0, "duckdb-ffi ABI: Duckdb_string_t_value.pointer: offset");
+_Static_assert(sizeof(((__typeof__(((duckdb_string_t *)0)->value) *)0)->pointer) == 16, "duckdb-ffi ABI: Duckdb_string_t_value.pointer: size");
+_Static_assert(__builtin_offsetof(__typeof__(((duckdb_string_t *)0)->value), inlined) == 0, "duckdb-ffi ABI: Duckdb_string_t_value.inlined: offset");
+_Static_assert(sizeof(((__typeof__(((duckdb_string_t *)0)->value) *)0)->inlined) == 16, "duckdb-ffi ABI: Duckdb_string_t_value.inlined: size");
+_Static_assert(__builtin_offsetof(duckdb_string_t, value) == 0, "duckdb-ffi ABI: DuckDBStringT.value: offset");
+_Static_assert(sizeof(((duckdb_string_t *)0)->value) == 16, "duckdb-ffi ABI: DuckDBStringT.value: size");
+_Static_assert(__builtin_offsetof(duckdb_date, days) == 0, "duckdb-ffi ABI: DuckDBDate.days: offset");
+_Static_assert(sizeof(((duckdb_date *)0)->days) == 4, "duckdb-ffi ABI: DuckDBDate.days: size");
+_Static_assert(__builtin_offsetof(duckdb_date_struct, year) == 0, "duckdb-ffi ABI: DuckDBDateStruct.year: offset");
+_Static_assert(sizeof(((duckdb_date_struct *)0)->year) == 4, "duckdb-ffi ABI: DuckDBDateStruct.year: size");
+_Static_assert(__builtin_offsetof(duckdb_date_struct, month) == 4, "duckdb-ffi ABI: DuckDBDateStruct.month: offset");
+_Static_assert(sizeof(((duckdb_date_struct *)0)->month) == 1, "duckdb-ffi ABI: DuckDBDateStruct.month: size");
+_Static_assert(__builtin_offsetof(duckdb_date_struct, day) == 5, "duckdb-ffi ABI: DuckDBDateStruct.day: offset");
+_Static_assert(sizeof(((duckdb_date_struct *)0)->day) == 1, "duckdb-ffi ABI: DuckDBDateStruct.day: size");
+_Static_assert(__builtin_offsetof(duckdb_time, micros) == 0, "duckdb-ffi ABI: DuckDBTime.micros: offset");
+_Static_assert(sizeof(((duckdb_time *)0)->micros) == 8, "duckdb-ffi ABI: DuckDBTime.micros: size");
+_Static_assert(__builtin_offsetof(duckdb_time_struct, hour) == 0, "duckdb-ffi ABI: DuckDBTimeStruct.hour: offset");
+_Static_assert(sizeof(((duckdb_time_struct *)0)->hour) == 1, "duckdb-ffi ABI: DuckDBTimeStruct.hour: size");
+_Static_assert(__builtin_offsetof(duckdb_time_struct, min) == 1, "duckdb-ffi ABI: DuckDBTimeStruct.min: offset");
+_Static_assert(sizeof(((duckdb_time_struct *)0)->min) == 1, "duckdb-ffi ABI: DuckDBTimeStruct.min: size");
+_Static_assert(__builtin_offsetof(duckdb_time_struct, sec) == 2, "duckdb-ffi ABI: DuckDBTimeStruct.sec: offset");
+_Static_assert(sizeof(((duckdb_time_struct *)0)->sec) == 1, "duckdb-ffi ABI: DuckDBTimeStruct.sec: size");
+_Static_assert(__builtin_offsetof(duckdb_time_struct, micros) == 4, "duckdb-ffi ABI: DuckDBTimeStruct.micros: offset");
+_Static_assert(sizeof(((duckdb_time_struct *)0)->micros) == 4, "duckdb-ffi ABI: DuckDBTimeStruct.micros: size");
+_Static_assert(__builtin_offsetof(duckdb_time_ns, nanos) == 0, "duckdb-ffi ABI: DuckDBTimeNs.nanos: offset");
+_Static_assert(sizeof(((duckdb_time_ns *)0)->nanos) == 8, "duckdb-ffi ABI: DuckDBTimeNs.nanos: size");
+_Static_assert(__builtin_offsetof(duckdb_time_tz, bits) == 0, "duckdb-ffi ABI: DuckDBTimeTz.bits: offset");
+_Static_assert(sizeof(((duckdb_time_tz *)0)->bits) == 8, "duckdb-ffi ABI: DuckDBTimeTz.bits: size");
+_Static_assert(__builtin_offsetof(duckdb_time_tz_struct, time) == 0, "duckdb-ffi ABI: DuckDBTimeTzStruct.time: offset");
+_Static_assert(sizeof(((duckdb_time_tz_struct *)0)->time) == 8, "duckdb-ffi ABI: DuckDBTimeTzStruct.time: size");
+_Static_assert(__builtin_offsetof(duckdb_time_tz_struct, offset) == 8, "duckdb-ffi ABI: DuckDBTimeTzStruct.offset: offset");
+_Static_assert(sizeof(((duckdb_time_tz_struct *)0)->offset) == 4, "duckdb-ffi ABI: DuckDBTimeTzStruct.offset: size");
+_Static_assert(__builtin_offsetof(duckdb_timestamp, micros) == 0, "duckdb-ffi ABI: DuckDBTimestamp.micros: offset");
+_Static_assert(sizeof(((duckdb_timestamp *)0)->micros) == 8, "duckdb-ffi ABI: DuckDBTimestamp.micros: size");
+_Static_assert(__builtin_offsetof(duckdb_timestamp_struct, date) == 0, "duckdb-ffi ABI: DuckDBTimestampStruct.date: offset");
+_Static_assert(sizeof(((duckdb_timestamp_struct *)0)->date) == 8, "duckdb-ffi ABI: DuckDBTimestampStruct.date: size");
+_Static_assert(__builtin_offsetof(duckdb_timestamp_struct, time) == 8, "duckdb-ffi ABI: DuckDBTimestampStruct.time: offset");
+_Static_assert(sizeof(((duckdb_timestamp_struct *)0)->time) == 8, "duckdb-ffi ABI: DuckDBTimestampStruct.time: size");
+_Static_assert(__builtin_offsetof(duckdb_timestamp_s, seconds) == 0, "duckdb-ffi ABI: DuckDBTimestampS.seconds: offset");
+_Static_assert(sizeof(((duckdb_timestamp_s *)0)->seconds) == 8, "duckdb-ffi ABI: DuckDBTimestampS.seconds: size");
+_Static_assert(__builtin_offsetof(duckdb_timestamp_ms, millis) == 0, "duckdb-ffi ABI: DuckDBTimestampMs.millis: offset");
+_Static_assert(sizeof(((duckdb_timestamp_ms *)0)->millis) == 8, "duckdb-ffi ABI: DuckDBTimestampMs.millis: size");
+_Static_assert(__builtin_offsetof(duckdb_timestamp_ns, nanos) == 0, "duckdb-ffi ABI: DuckDBTimestampNs.nanos: offset");
+_Static_assert(sizeof(((duckdb_timestamp_ns *)0)->nanos) == 8, "duckdb-ffi ABI: DuckDBTimestampNs.nanos: size");
+_Static_assert(__builtin_offsetof(duckdb_interval, months) == 0, "duckdb-ffi ABI: DuckDBInterval.months: offset");
+_Static_assert(sizeof(((duckdb_interval *)0)->months) == 4, "duckdb-ffi ABI: DuckDBInterval.months: size");
+_Static_assert(__builtin_offsetof(duckdb_interval, days) == 4, "duckdb-ffi ABI: DuckDBInterval.days: offset");
+_Static_assert(sizeof(((duckdb_interval *)0)->days) == 4, "duckdb-ffi ABI: DuckDBInterval.days: size");
+_Static_assert(__builtin_offsetof(duckdb_interval, micros) == 8, "duckdb-ffi ABI: DuckDBInterval.micros: offset");
+_Static_assert(sizeof(((duckdb_interval *)0)->micros) == 8, "duckdb-ffi ABI: DuckDBInterval.micros: size");
+_Static_assert(__builtin_offsetof(duckdb_hugeint, lower) == 0, "duckdb-ffi ABI: DuckDBHugeInt.lower: offset");
+_Static_assert(sizeof(((duckdb_hugeint *)0)->lower) == 8, "duckdb-ffi ABI: DuckDBHugeInt.lower: size");
+_Static_assert(__builtin_offsetof(duckdb_hugeint, upper) == 8, "duckdb-ffi ABI: DuckDBHugeInt.upper: offset");
+_Static_assert(sizeof(((duckdb_hugeint *)0)->upper) == 8, "duckdb-ffi ABI: DuckDBHugeInt.upper: size");
+_Static_assert(__builtin_offsetof(duckdb_uhugeint, lower) == 0, "duckdb-ffi ABI: DuckDBUHugeInt.lower: offset");
+_Static_assert(sizeof(((duckdb_uhugeint *)0)->lower) == 8, "duckdb-ffi ABI: DuckDBUHugeInt.lower: size");
+_Static_assert(__builtin_offsetof(duckdb_uhugeint, upper) == 8, "duckdb-ffi ABI: DuckDBUHugeInt.upper: offset");
+_Static_assert(sizeof(((duckdb_uhugeint *)0)->upper) == 8, "duckdb-ffi ABI: DuckDBUHugeInt.upper: size");
+_Static_assert(__builtin_offsetof(duckdb_decimal, width) == 0, "duckdb-ffi ABI: DuckDBDecimal.width: offset");
+_Static_assert(sizeof(((duckdb_decimal *)0)->width) == 1, "duckdb-ffi ABI: DuckDBDecimal.width: size");
+_Static_assert(__builtin_offsetof(duckdb_decimal, scale) == 1, "duckdb-ffi ABI: DuckDBDecimal.scale: offset");
+_Static_assert(sizeof(((duckdb_decimal *)0)->scale) == 1, "duckdb-ffi ABI: DuckDBDecimal.scale: size");
+_Static_assert(__builtin_offsetof(duckdb_decimal, value) == 8, "duckdb-ffi ABI: DuckDBDecimal.value: offset");
+_Static_assert(sizeof(((duckdb_decimal *)0)->value) == 16, "duckdb-ffi ABI: DuckDBDecimal.value: size");
+_Static_assert(__builtin_offsetof(duckdb_query_progress_type, percentage) == 0, "duckdb-ffi ABI: DuckDBQueryProgress.percentage: offset");
+_Static_assert(sizeof(((duckdb_query_progress_type *)0)->percentage) == 8, "duckdb-ffi ABI: DuckDBQueryProgress.percentage: size");
+_Static_assert(__builtin_offsetof(duckdb_query_progress_type, rows_processed) == 8, "duckdb-ffi ABI: DuckDBQueryProgress.rows_processed: offset");
+_Static_assert(sizeof(((duckdb_query_progress_type *)0)->rows_processed) == 8, "duckdb-ffi ABI: DuckDBQueryProgress.rows_processed: size");
+_Static_assert(__builtin_offsetof(duckdb_query_progress_type, total_rows_to_process) == 16, "duckdb-ffi ABI: DuckDBQueryProgress.total_rows_to_process: offset");
+_Static_assert(sizeof(((duckdb_query_progress_type *)0)->total_rows_to_process) == 8, "duckdb-ffi ABI: DuckDBQueryProgress.total_rows_to_process: size");
+_Static_assert(__builtin_offsetof(duckdb_list_entry, offset) == 0, "duckdb-ffi ABI: DuckDBListEntry.offset: offset");
+_Static_assert(sizeof(((duckdb_list_entry *)0)->offset) == 8, "duckdb-ffi ABI: DuckDBListEntry.offset: size");
+_Static_assert(__builtin_offsetof(duckdb_list_entry, length) == 8, "duckdb-ffi ABI: DuckDBListEntry.length: offset");
+_Static_assert(sizeof(((duckdb_list_entry *)0)->length) == 8, "duckdb-ffi ABI: DuckDBListEntry.length: size");
+_Static_assert(__builtin_offsetof(duckdb_column, deprecated_data) == 0, "duckdb-ffi ABI: DuckDBColumn.deprecated_data: offset");
+_Static_assert(sizeof(((duckdb_column *)0)->deprecated_data) == 8, "duckdb-ffi ABI: DuckDBColumn.deprecated_data: size");
+_Static_assert(__builtin_offsetof(duckdb_column, deprecated_nullmask) == 8, "duckdb-ffi ABI: DuckDBColumn.deprecated_nullmask: offset");
+_Static_assert(sizeof(((duckdb_column *)0)->deprecated_nullmask) == 8, "duckdb-ffi ABI: DuckDBColumn.deprecated_nullmask: size");
+_Static_assert(__builtin_offsetof(duckdb_column, deprecated_type) == 16, "duckdb-ffi ABI: DuckDBColumn.deprecated_type: offset");
+_Static_assert(sizeof(((duckdb_column *)0)->deprecated_type) == 4, "duckdb-ffi ABI: DuckDBColumn.deprecated_type: size");
+_Static_assert(__builtin_offsetof(duckdb_column, deprecated_name) == 24, "duckdb-ffi ABI: DuckDBColumn.deprecated_name: offset");
+_Static_assert(sizeof(((duckdb_column *)0)->deprecated_name) == 8, "duckdb-ffi ABI: DuckDBColumn.deprecated_name: size");
+_Static_assert(__builtin_offsetof(duckdb_column, internal_data) == 32, "duckdb-ffi ABI: DuckDBColumn.internal_data: offset");
+_Static_assert(sizeof(((duckdb_column *)0)->internal_data) == 8, "duckdb-ffi ABI: DuckDBColumn.internal_data: size");
+_Static_assert(__builtin_offsetof(duckdb_string, data) == 0, "duckdb-ffi ABI: DuckDBString.data: offset");
+_Static_assert(sizeof(((duckdb_string *)0)->data) == 8, "duckdb-ffi ABI: DuckDBString.data: size");
+_Static_assert(__builtin_offsetof(duckdb_string, size) == 8, "duckdb-ffi ABI: DuckDBString.size: offset");
+_Static_assert(sizeof(((duckdb_string *)0)->size) == 8, "duckdb-ffi ABI: DuckDBString.size: size");
+_Static_assert(__builtin_offsetof(duckdb_blob, data) == 0, "duckdb-ffi ABI: DuckDBBlob.data: offset");
+_Static_assert(sizeof(((duckdb_blob *)0)->data) == 8, "duckdb-ffi ABI: DuckDBBlob.data: size");
+_Static_assert(__builtin_offsetof(duckdb_blob, size) == 8, "duckdb-ffi ABI: DuckDBBlob.size: offset");
+_Static_assert(sizeof(((duckdb_blob *)0)->size) == 8, "duckdb-ffi ABI: DuckDBBlob.size: size");
+_Static_assert(__builtin_offsetof(duckdb_bit, data) == 0, "duckdb-ffi ABI: DuckDBBit.data: offset");
+_Static_assert(sizeof(((duckdb_bit *)0)->data) == 8, "duckdb-ffi ABI: DuckDBBit.data: size");
+_Static_assert(__builtin_offsetof(duckdb_bit, size) == 8, "duckdb-ffi ABI: DuckDBBit.size: offset");
+_Static_assert(sizeof(((duckdb_bit *)0)->size) == 8, "duckdb-ffi ABI: DuckDBBit.size: size");
+_Static_assert(__builtin_offsetof(duckdb_bignum, data) == 0, "duckdb-ffi ABI: DuckDBBignum.data: offset");
+_Static_assert(sizeof(((duckdb_bignum *)0)->data) == 8, "duckdb-ffi ABI: DuckDBBignum.data: size");
+_Static_assert(__builtin_offsetof(duckdb_bignum, size) == 8, "duckdb-ffi ABI: DuckDBBignum.size: offset");
+_Static_assert(sizeof(((duckdb_bignum *)0)->size) == 8, "duckdb-ffi ABI: DuckDBBignum.size: size");
+_Static_assert(__builtin_offsetof(duckdb_bignum, is_negative) == 16, "duckdb-ffi ABI: DuckDBBignum.is_negative: offset");
+_Static_assert(sizeof(((duckdb_bignum *)0)->is_negative) == 1, "duckdb-ffi ABI: DuckDBBignum.is_negative: size");
+_Static_assert(__builtin_offsetof(duckdb_result, deprecated_column_count) == 0, "duckdb-ffi ABI: DuckDBResult.deprecated_column_count: offset");
+_Static_assert(sizeof(((duckdb_result *)0)->deprecated_column_count) == 8, "duckdb-ffi ABI: DuckDBResult.deprecated_column_count: size");
+_Static_assert(__builtin_offsetof(duckdb_result, deprecated_row_count) == 8, "duckdb-ffi ABI: DuckDBResult.deprecated_row_count: offset");
+_Static_assert(sizeof(((duckdb_result *)0)->deprecated_row_count) == 8, "duckdb-ffi ABI: DuckDBResult.deprecated_row_count: size");
+_Static_assert(__builtin_offsetof(duckdb_result, deprecated_rows_changed) == 16, "duckdb-ffi ABI: DuckDBResult.deprecated_rows_changed: offset");
+_Static_assert(sizeof(((duckdb_result *)0)->deprecated_rows_changed) == 8, "duckdb-ffi ABI: DuckDBResult.deprecated_rows_changed: size");
+_Static_assert(__builtin_offsetof(duckdb_result, deprecated_columns) == 24, "duckdb-ffi ABI: DuckDBResult.deprecated_columns: offset");
+_Static_assert(sizeof(((duckdb_result *)0)->deprecated_columns) == 8, "duckdb-ffi ABI: DuckDBResult.deprecated_columns: size");
+_Static_assert(__builtin_offsetof(duckdb_result, deprecated_error_message) == 32, "duckdb-ffi ABI: DuckDBResult.deprecated_error_message: offset");
+_Static_assert(sizeof(((duckdb_result *)0)->deprecated_error_message) == 8, "duckdb-ffi ABI: DuckDBResult.deprecated_error_message: size");
+_Static_assert(__builtin_offsetof(duckdb_result, internal_data) == 40, "duckdb-ffi ABI: DuckDBResult.internal_data: offset");
+_Static_assert(sizeof(((duckdb_result *)0)->internal_data) == 8, "duckdb-ffi ABI: DuckDBResult.internal_data: size");
+_Static_assert(__builtin_offsetof(struct duckdb_extension_access, set_error) == 0, "duckdb-ffi ABI: DuckDBExtensionAccess.set_error: offset");
+_Static_assert(sizeof(((struct duckdb_extension_access *)0)->set_error) == 8, "duckdb-ffi ABI: DuckDBExtensionAccess.set_error: size");
+_Static_assert(__builtin_offsetof(struct duckdb_extension_access, get_database) == 8, "duckdb-ffi ABI: DuckDBExtensionAccess.get_database: offset");
+_Static_assert(sizeof(((struct duckdb_extension_access *)0)->get_database) == 8, "duckdb-ffi ABI: DuckDBExtensionAccess.get_database: size");
+_Static_assert(__builtin_offsetof(struct duckdb_extension_access, get_api) == 16, "duckdb-ffi ABI: DuckDBExtensionAccess.get_api: offset");
+_Static_assert(sizeof(((struct duckdb_extension_access *)0)->get_api) == 8, "duckdb-ffi ABI: DuckDBExtensionAccess.get_api: size");
+_Static_assert(__builtin_offsetof(struct ArrowSchema, format) == 0, "duckdb-ffi ABI: ArrowSchema.format: offset");
+_Static_assert(sizeof(((struct ArrowSchema *)0)->format) == 8, "duckdb-ffi ABI: ArrowSchema.format: size");
+_Static_assert(__builtin_offsetof(struct ArrowSchema, name) == 8, "duckdb-ffi ABI: ArrowSchema.name: offset");
+_Static_assert(sizeof(((struct ArrowSchema *)0)->name) == 8, "duckdb-ffi ABI: ArrowSchema.name: size");
+_Static_assert(__builtin_offsetof(struct ArrowSchema, metadata) == 16, "duckdb-ffi ABI: ArrowSchema.metadata: offset");
+_Static_assert(sizeof(((struct ArrowSchema *)0)->metadata) == 8, "duckdb-ffi ABI: ArrowSchema.metadata: size");
+_Static_assert(__builtin_offsetof(struct ArrowSchema, flags) == 24, "duckdb-ffi ABI: ArrowSchema.flags: offset");
+_Static_assert(sizeof(((struct ArrowSchema *)0)->flags) == 8, "duckdb-ffi ABI: ArrowSchema.flags: size");
+_Static_assert(__builtin_offsetof(struct ArrowSchema, n_children) == 32, "duckdb-ffi ABI: ArrowSchema.n_children: offset");
+_Static_assert(sizeof(((struct ArrowSchema *)0)->n_children) == 8, "duckdb-ffi ABI: ArrowSchema.n_children: size");
+_Static_assert(__builtin_offsetof(struct ArrowSchema, children) == 40, "duckdb-ffi ABI: ArrowSchema.children: offset");
+_Static_assert(sizeof(((struct ArrowSchema *)0)->children) == 8, "duckdb-ffi ABI: ArrowSchema.children: size");
+_Static_assert(__builtin_offsetof(struct ArrowSchema, dictionary) == 48, "duckdb-ffi ABI: ArrowSchema.dictionary: offset");
+_Static_assert(sizeof(((struct ArrowSchema *)0)->dictionary) == 8, "duckdb-ffi ABI: ArrowSchema.dictionary: size");
+_Static_assert(__builtin_offsetof(struct ArrowSchema, release) == 56, "duckdb-ffi ABI: ArrowSchema.release: offset");
+_Static_assert(sizeof(((struct ArrowSchema *)0)->release) == 8, "duckdb-ffi ABI: ArrowSchema.release: size");
+_Static_assert(__builtin_offsetof(struct ArrowSchema, private_data) == 64, "duckdb-ffi ABI: ArrowSchema.private_data: offset");
+_Static_assert(sizeof(((struct ArrowSchema *)0)->private_data) == 8, "duckdb-ffi ABI: ArrowSchema.private_data: size");
+_Static_assert(__builtin_offsetof(struct ArrowArray, length) == 0, "duckdb-ffi ABI: ArrowArray.length: offset");
+_Static_assert(sizeof(((struct ArrowArray *)0)->length) == 8, "duckdb-ffi ABI: ArrowArray.length: size");
+_Static_assert(__builtin_offsetof(struct ArrowArray, null_count) == 8, "duckdb-ffi ABI: ArrowArray.null_count: offset");
+_Static_assert(sizeof(((struct ArrowArray *)0)->null_count) == 8, "duckdb-ffi ABI: ArrowArray.null_count: size");
+_Static_assert(__builtin_offsetof(struct ArrowArray, offset) == 16, "duckdb-ffi ABI: ArrowArray.offset: offset");
+_Static_assert(sizeof(((struct ArrowArray *)0)->offset) == 8, "duckdb-ffi ABI: ArrowArray.offset: size");
+_Static_assert(__builtin_offsetof(struct ArrowArray, n_buffers) == 24, "duckdb-ffi ABI: ArrowArray.n_buffers: offset");
+_Static_assert(sizeof(((struct ArrowArray *)0)->n_buffers) == 8, "duckdb-ffi ABI: ArrowArray.n_buffers: size");
+_Static_assert(__builtin_offsetof(struct ArrowArray, n_children) == 32, "duckdb-ffi ABI: ArrowArray.n_children: offset");
+_Static_assert(sizeof(((struct ArrowArray *)0)->n_children) == 8, "duckdb-ffi ABI: ArrowArray.n_children: size");
+_Static_assert(__builtin_offsetof(struct ArrowArray, buffers) == 40, "duckdb-ffi ABI: ArrowArray.buffers: offset");
+_Static_assert(sizeof(((struct ArrowArray *)0)->buffers) == 8, "duckdb-ffi ABI: ArrowArray.buffers: size");
+_Static_assert(__builtin_offsetof(struct ArrowArray, children) == 48, "duckdb-ffi ABI: ArrowArray.children: offset");
+_Static_assert(sizeof(((struct ArrowArray *)0)->children) == 8, "duckdb-ffi ABI: ArrowArray.children: size");
+_Static_assert(__builtin_offsetof(struct ArrowArray, dictionary) == 56, "duckdb-ffi ABI: ArrowArray.dictionary: offset");
+_Static_assert(sizeof(((struct ArrowArray *)0)->dictionary) == 8, "duckdb-ffi ABI: ArrowArray.dictionary: size");
+_Static_assert(__builtin_offsetof(struct ArrowArray, release) == 64, "duckdb-ffi ABI: ArrowArray.release: offset");
+_Static_assert(sizeof(((struct ArrowArray *)0)->release) == 8, "duckdb-ffi ABI: ArrowArray.release: size");
+_Static_assert(__builtin_offsetof(struct ArrowArray, private_data) == 72, "duckdb-ffi ABI: ArrowArray.private_data: offset");
+_Static_assert(sizeof(((struct ArrowArray *)0)->private_data) == 8, "duckdb-ffi ABI: ArrowArray.private_data: size");
+_Static_assert(__builtin_offsetof(struct ArrowArrayStream, get_schema) == 0, "duckdb-ffi ABI: ArrowArrayStream.get_schema: offset");
+_Static_assert(sizeof(((struct ArrowArrayStream *)0)->get_schema) == 8, "duckdb-ffi ABI: ArrowArrayStream.get_schema: size");
+_Static_assert(__builtin_offsetof(struct ArrowArrayStream, get_next) == 8, "duckdb-ffi ABI: ArrowArrayStream.get_next: offset");
+_Static_assert(sizeof(((struct ArrowArrayStream *)0)->get_next) == 8, "duckdb-ffi ABI: ArrowArrayStream.get_next: size");
+_Static_assert(__builtin_offsetof(struct ArrowArrayStream, get_last_error) == 16, "duckdb-ffi ABI: ArrowArrayStream.get_last_error: offset");
+_Static_assert(sizeof(((struct ArrowArrayStream *)0)->get_last_error) == 8, "duckdb-ffi ABI: ArrowArrayStream.get_last_error: size");
+_Static_assert(__builtin_offsetof(struct ArrowArrayStream, release) == 24, "duckdb-ffi ABI: ArrowArrayStream.release: offset");
+_Static_assert(sizeof(((struct ArrowArrayStream *)0)->release) == 8, "duckdb-ffi ABI: ArrowArrayStream.release: size");
+_Static_assert(__builtin_offsetof(struct ArrowArrayStream, private_data) == 32, "duckdb-ffi ABI: ArrowArrayStream.private_data: offset");
+_Static_assert(sizeof(((struct ArrowArrayStream *)0)->private_data) == 8, "duckdb-ffi ABI: ArrowArrayStream.private_data: size");
diff --git a/native.sha256 b/native.sha256
new file mode 100644
--- /dev/null
+++ b/native.sha256
@@ -0,0 +1,6 @@
+993ad89e7dfca66cd6da994c2cad090c2fc160ddf9f550498a098ab4bb13cfb1  v2.0.0/duckdb-shared-libs-linux-amd64.tar.gz
+c60eecf91143ca6bbac55c4f4d40dc22520488b0ac257c86e0fe9a2b451cf2b7  v2.0.0/duckdb-shared-libs-linux-arm64.tar.gz
+14cd63180614cfd961f7959146ecd9087527ff20b67311efdc3fa1c29c18204d  v2.0.0/duckdb-shared-libs-osx-universal.tar.gz
+c6507206baf7793c6013dbd82368469a45f20dc0e17a6f92f204602f652ed2bc  v2.0.0/duckdb-cli-linux-amd64.tar.gz
+859e1875d2a9515fbb4bf8871061437a14af82320da68c753f094c4b776348fe  v2.0.0/duckdb-cli-linux-arm64.tar.gz
+8a8f67e7c7f7d1392fa63ba3971948391392fe2a25fca63e7008e33c50beb4c2  v2.0.0/duckdb-cli-osx-universal.tar.gz
diff --git a/src/Database/DuckDB/FFI.hs b/src/Database/DuckDB/FFI.hs
deleted file mode 100644
--- a/src/Database/DuckDB/FFI.hs
+++ /dev/null
@@ -1,79 +0,0 @@
-{- |
-Module      : Database.DuckDB.FFI
-Description : Aggregated re-exports for the DuckDB C API bindings
-
-The individual modules under @Database.DuckDB.FFI.*@ group the raw FFI imports
-by the sections documented in @api.md@.  This module preserves the historic
-surface area by re-exporting all of those symbols.
--}
-module Database.DuckDB.FFI (
-    module Database.DuckDB.FFI.Types,
-    module Database.DuckDB.FFI.OpenConnect,
-    module Database.DuckDB.FFI.Configuration,
-    module Database.DuckDB.FFI.CopyFunctions,
-    module Database.DuckDB.FFI.ErrorData,
-    module Database.DuckDB.FFI.QueryExecution,
-    module Database.DuckDB.FFI.ResultFunctions,
-    module Database.DuckDB.FFI.Helpers,
-    module Database.DuckDB.FFI.PreparedStatements,
-    module Database.DuckDB.FFI.BindValues,
-    module Database.DuckDB.FFI.ExecutePrepared,
-    module Database.DuckDB.FFI.ExtractStatements,
-    module Database.DuckDB.FFI.PendingResult,
-    module Database.DuckDB.FFI.ValueInterface,
-    module Database.DuckDB.FFI.LogicalTypes,
-    module Database.DuckDB.FFI.DataChunk,
-    module Database.DuckDB.FFI.Vector,
-    module Database.DuckDB.FFI.Validity,
-    module Database.DuckDB.FFI.ScalarFunctions,
-    module Database.DuckDB.FFI.TableFunctions,
-    module Database.DuckDB.FFI.SelectionVector,
-    module Database.DuckDB.FFI.AggregateFunctions,
-    module Database.DuckDB.FFI.ReplacementScans,
-    module Database.DuckDB.FFI.ProfilingInfo,
-    module Database.DuckDB.FFI.Appender,
-    module Database.DuckDB.FFI.TableDescription,
-    module Database.DuckDB.FFI.Arrow,
-    module Database.DuckDB.FFI.Threading,
-    module Database.DuckDB.FFI.StreamingResult,
-    module Database.DuckDB.FFI.CastFunctions,
-    module Database.DuckDB.FFI.Expression,
-    module Database.DuckDB.FFI.FileSystem,
-    module Database.DuckDB.FFI.Catalog,
-    module Database.DuckDB.FFI.Logging,
-) where
-
-import Database.DuckDB.FFI.AggregateFunctions
-import Database.DuckDB.FFI.Appender
-import Database.DuckDB.FFI.Arrow
-import Database.DuckDB.FFI.BindValues
-import Database.DuckDB.FFI.CastFunctions
-import Database.DuckDB.FFI.Catalog
-import Database.DuckDB.FFI.Configuration
-import Database.DuckDB.FFI.CopyFunctions
-import Database.DuckDB.FFI.DataChunk
-import Database.DuckDB.FFI.ErrorData
-import Database.DuckDB.FFI.ExecutePrepared
-import Database.DuckDB.FFI.Expression
-import Database.DuckDB.FFI.ExtractStatements
-import Database.DuckDB.FFI.FileSystem
-import Database.DuckDB.FFI.Helpers
-import Database.DuckDB.FFI.Logging
-import Database.DuckDB.FFI.LogicalTypes
-import Database.DuckDB.FFI.OpenConnect
-import Database.DuckDB.FFI.PendingResult
-import Database.DuckDB.FFI.PreparedStatements
-import Database.DuckDB.FFI.ProfilingInfo
-import Database.DuckDB.FFI.QueryExecution
-import Database.DuckDB.FFI.ReplacementScans
-import Database.DuckDB.FFI.ResultFunctions
-import Database.DuckDB.FFI.ScalarFunctions
-import Database.DuckDB.FFI.SelectionVector
-import Database.DuckDB.FFI.StreamingResult
-import Database.DuckDB.FFI.TableDescription
-import Database.DuckDB.FFI.TableFunctions
-import Database.DuckDB.FFI.Threading
-import Database.DuckDB.FFI.Types
-import Database.DuckDB.FFI.Validity
-import Database.DuckDB.FFI.ValueInterface
-import Database.DuckDB.FFI.Vector
diff --git a/src/Database/DuckDB/FFI/AggregateFunctions.hs b/src/Database/DuckDB/FFI/AggregateFunctions.hs
deleted file mode 100644
--- a/src/Database/DuckDB/FFI/AggregateFunctions.hs
+++ /dev/null
@@ -1,182 +0,0 @@
-module Database.DuckDB.FFI.AggregateFunctions (
-    c_duckdb_create_aggregate_function,
-    c_duckdb_destroy_aggregate_function,
-    c_duckdb_aggregate_function_set_name,
-    c_duckdb_aggregate_function_add_parameter,
-    c_duckdb_aggregate_function_set_return_type,
-    c_duckdb_aggregate_function_set_functions,
-    c_duckdb_aggregate_function_set_destructor,
-    c_duckdb_register_aggregate_function,
-    c_duckdb_aggregate_function_set_special_handling,
-    c_duckdb_aggregate_function_set_extra_info,
-    c_duckdb_aggregate_function_get_extra_info,
-    c_duckdb_aggregate_function_set_error,
-    c_duckdb_create_aggregate_function_set,
-    c_duckdb_destroy_aggregate_function_set,
-    c_duckdb_add_aggregate_function_to_set,
-    c_duckdb_register_aggregate_function_set,
-) where
-
-import Database.DuckDB.FFI.Types
-import Foreign.C.String (CString)
-import Foreign.C.Types (CInt (..))
-import Foreign.Ptr (Ptr)
-
-{- | Creates a new empty aggregate function.
-
-The return value should be destroyed with @duckdb_destroy_aggregate_function@.
-
-Returns The aggregate function object.
--}
-foreign import ccall safe "duckdb_create_aggregate_function"
-    c_duckdb_create_aggregate_function :: IO DuckDBAggregateFunction
-
--- | Destroys the given aggregate function object.
-foreign import ccall safe "duckdb_destroy_aggregate_function"
-    c_duckdb_destroy_aggregate_function :: Ptr DuckDBAggregateFunction -> IO ()
-
-{- | Sets the name of the given aggregate function.
-
-Parameters:
-* @aggregate_function@: The aggregate function
-* @name@: The name of the aggregate function
--}
-foreign import ccall safe "duckdb_aggregate_function_set_name"
-    c_duckdb_aggregate_function_set_name :: DuckDBAggregateFunction -> CString -> IO ()
-
-{- | Adds a parameter to the aggregate function.
-
-Parameters:
-* @aggregate_function@: The aggregate function.
-* @type@: The parameter type. Cannot contain INVALID.
--}
-foreign import ccall safe "duckdb_aggregate_function_add_parameter"
-    c_duckdb_aggregate_function_add_parameter :: DuckDBAggregateFunction -> DuckDBLogicalType -> IO ()
-
-{- | Sets the return type of the aggregate function.
-
-Parameters:
-* @aggregate_function@: The aggregate function.
-* @type@: The return type. Cannot contain INVALID or ANY.
--}
-foreign import ccall safe "duckdb_aggregate_function_set_return_type"
-    c_duckdb_aggregate_function_set_return_type :: DuckDBAggregateFunction -> DuckDBLogicalType -> IO ()
-
-{- | Sets the main functions of the aggregate function.
-
-Parameters:
-* @aggregate_function@: The aggregate function
-* @state_size@: state size
-* @state_init@: state init function
-* @update@: update states
-* @combine@: combine states
-* @finalize@: finalize states
--}
-foreign import ccall safe "duckdb_aggregate_function_set_functions"
-    c_duckdb_aggregate_function_set_functions :: DuckDBAggregateFunction -> DuckDBAggregateStateSizeFun -> DuckDBAggregateInitFun -> DuckDBAggregateUpdateFun -> DuckDBAggregateCombineFun -> DuckDBAggregateFinalizeFun -> IO ()
-
-{- | Sets the state destructor callback of the aggregate function (optional)
-
-Parameters:
-* @aggregate_function@: The aggregate function
-* @destroy@: state destroy callback
--}
-foreign import ccall safe "duckdb_aggregate_function_set_destructor"
-    c_duckdb_aggregate_function_set_destructor :: DuckDBAggregateFunction -> DuckDBAggregateDestroyFun -> IO ()
-
-{- | Register the aggregate function object within the given connection.
-
-The function requires at least a name, functions and a return type.
-
-If the function is incomplete or a function with this name already exists
-DuckDBError is returned.
-
-Parameters:
-* @con@: The connection to register it in.
-
-Returns Whether or not the registration was successful.
--}
-foreign import ccall safe "duckdb_register_aggregate_function"
-    c_duckdb_register_aggregate_function :: DuckDBConnection -> DuckDBAggregateFunction -> IO DuckDBState
-
-{- | Sets the NULL handling of the aggregate function to SPECIAL_HANDLING.
-
-Parameters:
-* @aggregate_function@: The aggregate function
--}
-foreign import ccall safe "duckdb_aggregate_function_set_special_handling"
-    c_duckdb_aggregate_function_set_special_handling :: DuckDBAggregateFunction -> IO ()
-
-{- | Assigns extra information to the scalar function that can be fetched during
-binding, etc.
-
-Parameters:
-* @aggregate_function@: The aggregate function
-* @extra_info@: The extra information
-* @destroy@: The callback that will be called to destroy the extra information
-  (if any)
--}
-foreign import ccall safe "duckdb_aggregate_function_set_extra_info"
-    c_duckdb_aggregate_function_set_extra_info :: DuckDBAggregateFunction -> Ptr () -> DuckDBDeleteCallback -> IO ()
-
-{- | Retrieves the extra info of the function as set in
-@duckdb_aggregate_function_set_extra_info@.
-
-Parameters:
-* @info@: The info object
-
-Returns The extra info
--}
-foreign import ccall "duckdb_aggregate_function_get_extra_info"
-    c_duckdb_aggregate_function_get_extra_info :: DuckDBFunctionInfo -> IO (Ptr ())
-
-{- | Report that an error has occurred while executing the aggregate function.
-
-Parameters:
-* @info@: The info object
-* @error@: The error message
--}
-foreign import ccall "duckdb_aggregate_function_set_error"
-    c_duckdb_aggregate_function_set_error :: DuckDBFunctionInfo -> CString -> IO ()
-
-{- | Creates a new empty aggregate function set.
-
-The return value should be destroyed with
-@duckdb_destroy_aggregate_function_set@.
-
-Returns The aggregate function set object.
--}
-foreign import ccall safe "duckdb_create_aggregate_function_set"
-    c_duckdb_create_aggregate_function_set :: CString -> IO DuckDBAggregateFunctionSet
-
--- | Destroys the given aggregate function set object.
-foreign import ccall safe "duckdb_destroy_aggregate_function_set"
-    c_duckdb_destroy_aggregate_function_set :: Ptr DuckDBAggregateFunctionSet -> IO ()
-
-{- | Adds the aggregate function as a new overload to the aggregate function set.
-
-Returns DuckDBError if the function could not be added, for example if the
-overload already exists.
-
-Parameters:
-* @set@: The aggregate function set
-* @function@: The function to add
--}
-foreign import ccall safe "duckdb_add_aggregate_function_to_set"
-    c_duckdb_add_aggregate_function_to_set :: DuckDBAggregateFunctionSet -> DuckDBAggregateFunction -> IO DuckDBState
-
-{- | Register the aggregate function set within the given connection.
-
-The set requires at least a single valid overload.
-
-If the set is incomplete or a function with this name already exists
-DuckDBError is returned.
-
-Parameters:
-* @con@: The connection to register it in.
-* @set@: The function set to register
-
-Returns Whether or not the registration was successful.
--}
-foreign import ccall safe "duckdb_register_aggregate_function_set"
-    c_duckdb_register_aggregate_function_set :: DuckDBConnection -> DuckDBAggregateFunctionSet -> IO DuckDBState
diff --git a/src/Database/DuckDB/FFI/Appender.hs b/src/Database/DuckDB/FFI/Appender.hs
deleted file mode 100644
--- a/src/Database/DuckDB/FFI/Appender.hs
+++ /dev/null
@@ -1,372 +0,0 @@
-module Database.DuckDB.FFI.Appender (
-    c_duckdb_appender_create,
-    c_duckdb_appender_create_ext,
-    c_duckdb_appender_create_query,
-    c_duckdb_appender_column_count,
-    c_duckdb_appender_column_type,
-    c_duckdb_appender_error_data,
-    c_duckdb_appender_clear,
-    c_duckdb_appender_flush,
-    c_duckdb_appender_close,
-    c_duckdb_appender_destroy,
-    c_duckdb_appender_add_column,
-    c_duckdb_appender_clear_columns,
-    c_duckdb_appender_begin_row,
-    c_duckdb_appender_end_row,
-    c_duckdb_append_default,
-    c_duckdb_append_default_to_chunk,
-    c_duckdb_append_bool,
-    c_duckdb_append_int8,
-    c_duckdb_append_int16,
-    c_duckdb_append_int32,
-    c_duckdb_append_int64,
-    c_duckdb_append_hugeint,
-    c_duckdb_append_uint8,
-    c_duckdb_append_uint16,
-    c_duckdb_append_uint32,
-    c_duckdb_append_uint64,
-    c_duckdb_append_uhugeint,
-    c_duckdb_append_float,
-    c_duckdb_append_double,
-    c_duckdb_append_date,
-    c_duckdb_append_time,
-    c_duckdb_append_timestamp,
-    c_duckdb_append_interval,
-    c_duckdb_append_varchar,
-    c_duckdb_append_varchar_length,
-    c_duckdb_append_blob,
-    c_duckdb_append_null,
-    c_duckdb_append_value,
-    c_duckdb_append_data_chunk,
-) where
-
-import Data.Int (Int16, Int32, Int64, Int8)
-import Data.Word (Word16, Word32, Word64, Word8)
-import Database.DuckDB.FFI.Types
-import Foreign.C.String (CString)
-import Foreign.C.Types (CBool (..), CDouble (..), CFloat (..), CInt (..))
-import Foreign.Ptr (Ptr)
-
-{- | Creates an appender object.
-
-Note that the object must be destroyed with @duckdb_appender_destroy@.
-
-Parameters:
-* @connection@: The connection context to create the appender in.
-* @schema@: The schema of the table to append to, or @nullptr@ for the default
-  schema.
-* @table@: The table name to append to.
-* @out_appender@: The resulting appender object.
-
-Returns @DuckDBSuccess@ on success or @DuckDBError@ on failure.
--}
-foreign import ccall "duckdb_appender_create"
-    c_duckdb_appender_create :: DuckDBConnection -> CString -> CString -> Ptr DuckDBAppender -> IO DuckDBState
-
-{- | Creates an appender object.
-
-Note that the object must be destroyed with @duckdb_appender_destroy@.
-
-Parameters:
-* @connection@: The connection context to create the appender in.
-* @catalog@: The catalog of the table to append to, or @nullptr@ for the
-  default catalog.
-* @schema@: The schema of the table to append to, or @nullptr@ for the default
-  schema.
-* @table@: The table name to append to.
-* @out_appender@: The resulting appender object.
-
-Returns @DuckDBSuccess@ on success or @DuckDBError@ on failure.
--}
-foreign import ccall "duckdb_appender_create_ext"
-    c_duckdb_appender_create_ext :: DuckDBConnection -> CString -> CString -> CString -> Ptr DuckDBAppender -> IO DuckDBState
-
-{- | Creates an appender object that executes the given query with any data
-appended to it.
-
-Note that the object must be destroyed with @duckdb_appender_destroy@.
-
-Parameters:
-* @connection@: The connection context to create the appender in.
-* @query@: The query to execute, can be an INSERT, DELETE, UPDATE or MERGE
-  INTO statement.
-* @column_count@: The number of columns to append.
-* @types@: The types of the columns to append.
-* @table_name@: (optionally) the table name used to refer to the appended
-  data, defaults to "appended_data".
-* @column_names@: (optionally) the list of column names, defaults to "col1",
-  "col2", ...
-* @out_appender@: The resulting appender object.
-
-Returns @DuckDBSuccess@ on success or @DuckDBError@ on failure.
--}
-foreign import ccall "duckdb_appender_create_query"
-    c_duckdb_appender_create_query :: DuckDBConnection -> CString -> DuckDBIdx -> Ptr DuckDBLogicalType -> CString -> Ptr CString -> Ptr DuckDBAppender -> IO DuckDBState
-
-{- | Returns the number of columns that belong to the appender. If there is no
-active column list, then this equals the table's physical columns.
-
-Parameters:
-* @appender@: The appender to get the column count from.
-
-Returns The number of columns in the data chunks.
--}
-foreign import ccall "duckdb_appender_column_count"
-    c_duckdb_appender_column_count :: DuckDBAppender -> IO DuckDBIdx
-
-{- | Returns the type of the column at the specified index. This is either a type
-in the active column list, or the same type as a column in the receiving
-table.
-
-Note: The resulting type must be destroyed with @duckdb_destroy_logical_type@.
-
-Parameters:
-* @appender@: The appender to get the column type from.
-* @col_idx@: The index of the column to get the type of.
-
-Returns The @duckdb_logical_type@ of the column.
--}
-foreign import ccall "duckdb_appender_column_type"
-    c_duckdb_appender_column_type :: DuckDBAppender -> DuckDBIdx -> IO DuckDBLogicalType
-
-{- | Returns the error data associated with the appender. Must be destroyed with
-duckdb_destroy_error_data.
-
-Parameters:
-* @appender@: The appender to get the error data from.
-
-Returns The error data.
--}
-foreign import ccall "duckdb_appender_error_data"
-    c_duckdb_appender_error_data :: DuckDBAppender -> IO DuckDBErrorData
-
-{- | Clears the appender's buffered state without destroying it.
-
-Returns @DuckDBSuccess@ on success or @DuckDBError@ on failure.
--}
-foreign import ccall "duckdb_appender_clear"
-    c_duckdb_appender_clear :: DuckDBAppender -> IO DuckDBState
-
-{- | Flush the appender to the table, forcing the cache of the appender to be
-cleared. If flushing the data triggers a constraint violation or any other
-error, then all data is invalidated, and this function returns DuckDBError. It
-is not possible to append more values. Call duckdb_appender_error_data to
-obtain the error data followed by duckdb_appender_destroy to destroy the
-invalidated appender.
-
-Parameters:
-* @appender@: The appender to flush.
-
-Returns @DuckDBSuccess@ on success or @DuckDBError@ on failure.
--}
-foreign import ccall "duckdb_appender_flush"
-    c_duckdb_appender_flush :: DuckDBAppender -> IO DuckDBState
-
-{- | Closes the appender by flushing all intermediate states and closing it for
-further appends. If flushing the data triggers a constraint violation or any
-other error, then all data is invalidated, and this function returns
-DuckDBError. Call duckdb_appender_error_data to obtain the error data followed
-by duckdb_appender_destroy to destroy the invalidated appender.
-
-Parameters:
-* @appender@: The appender to flush and close.
-
-Returns @DuckDBSuccess@ on success or @DuckDBError@ on failure.
--}
-foreign import ccall "duckdb_appender_close"
-    c_duckdb_appender_close :: DuckDBAppender -> IO DuckDBState
-
-{- | Closes the appender by flushing all intermediate states to the table and
-destroying it. By destroying it, this function de-allocates all memory
-associated with the appender. If flushing the data triggers a constraint
-violation, then all data is invalidated, and this function returns
-DuckDBError. Due to the destruction of the appender, it is no longer possible
-to obtain the specific error message with duckdb_appender_error. Therefore,
-call duckdb_appender_close before destroying the appender, if you need
-insights into the specific error.
-
-Parameters:
-* @appender@: The appender to flush, close and destroy.
-
-Returns @DuckDBSuccess@ on success or @DuckDBError@ on failure.
--}
-foreign import ccall "duckdb_appender_destroy"
-    c_duckdb_appender_destroy :: Ptr DuckDBAppender -> IO DuckDBState
-
-{- | Appends a column to the active column list of the appender. Immediately
-flushes all previous data.
-
-The active column list specifies all columns that are expected when flushing
-the data. Any non-active columns are filled with their default values, or
-NULL.
-
-Parameters:
-* @appender@: The appender to add the column to.
-
-Returns @DuckDBSuccess@ on success or @DuckDBError@ on failure.
--}
-foreign import ccall "duckdb_appender_add_column"
-    c_duckdb_appender_add_column :: DuckDBAppender -> CString -> IO DuckDBState
-
-{- | Removes all columns from the active column list of the appender, resetting the
-appender to treat all columns as active. Immediately flushes all previous
-data.
-
-Parameters:
-* @appender@: The appender to clear the columns from.
-
-Returns @DuckDBSuccess@ on success or @DuckDBError@ on failure.
--}
-foreign import ccall "duckdb_appender_clear_columns"
-    c_duckdb_appender_clear_columns :: DuckDBAppender -> IO DuckDBState
-
-{- | A nop function, provided for backwards compatibility reasons. Does nothing.
-Only @duckdb_appender_end_row@ is required.
--}
-foreign import ccall "duckdb_appender_begin_row"
-    c_duckdb_appender_begin_row :: DuckDBAppender -> IO DuckDBState
-
-{- | Finish the current row of appends. After end_row is called, the next row can
-be appended.
-
-Parameters:
-* @appender@: The appender.
-
-Returns @DuckDBSuccess@ on success or @DuckDBError@ on failure.
--}
-foreign import ccall "duckdb_appender_end_row"
-    c_duckdb_appender_end_row :: DuckDBAppender -> IO DuckDBState
-
-{- | Append a DEFAULT value (NULL if DEFAULT not available for column) to the
-appender.
--}
-foreign import ccall "duckdb_append_default"
-    c_duckdb_append_default :: DuckDBAppender -> IO DuckDBState
-
-{- | Append a DEFAULT value, at the specified row and column, (NULL if DEFAULT not
-available for column) to the chunk created from the specified appender. The
-default value of the column must be a constant value. Non-deterministic
-expressions like nextval(@seq@) or random() are not supported.
-
-Parameters:
-* @appender@: The appender to get the default value from.
-* @chunk@: The data chunk to append the default value to.
-* @col@: The chunk column index to append the default value to.
-* @row@: The chunk row index to append the default value to.
-
-Returns @DuckDBSuccess@ on success or @DuckDBError@ on failure.
--}
-foreign import ccall "duckdb_append_default_to_chunk"
-    c_duckdb_append_default_to_chunk :: DuckDBAppender -> DuckDBDataChunk -> DuckDBIdx -> DuckDBIdx -> IO DuckDBState
-
--- | Append a bool value to the appender.
-foreign import ccall "duckdb_append_bool"
-    c_duckdb_append_bool :: DuckDBAppender -> CBool -> IO DuckDBState
-
--- | Append an int8_t value to the appender.
-foreign import ccall "duckdb_append_int8"
-    c_duckdb_append_int8 :: DuckDBAppender -> Int8 -> IO DuckDBState
-
--- | Append an int16_t value to the appender.
-foreign import ccall "duckdb_append_int16"
-    c_duckdb_append_int16 :: DuckDBAppender -> Int16 -> IO DuckDBState
-
--- | Append an int32_t value to the appender.
-foreign import ccall "duckdb_append_int32"
-    c_duckdb_append_int32 :: DuckDBAppender -> Int32 -> IO DuckDBState
-
--- | Append an int64_t value to the appender.
-foreign import ccall "duckdb_append_int64"
-    c_duckdb_append_int64 :: DuckDBAppender -> Int64 -> IO DuckDBState
-
-{- | Append a duckdb_hugeint value to the appender.
-
-These bindings call the wrapper symbol @wrapped_duckdb_append_hugeint@
-but mirror the DuckDB C API semantics of @duckdb_append_hugeint@.
--}
-foreign import ccall "wrapped_duckdb_append_hugeint"
-    c_duckdb_append_hugeint :: DuckDBAppender -> Ptr DuckDBHugeInt -> IO DuckDBState
-
--- | Append a uint8_t value to the appender.
-foreign import ccall "duckdb_append_uint8"
-    c_duckdb_append_uint8 :: DuckDBAppender -> Word8 -> IO DuckDBState
-
--- | Append a uint16_t value to the appender.
-foreign import ccall "duckdb_append_uint16"
-    c_duckdb_append_uint16 :: DuckDBAppender -> Word16 -> IO DuckDBState
-
--- | Append a uint32_t value to the appender.
-foreign import ccall "duckdb_append_uint32"
-    c_duckdb_append_uint32 :: DuckDBAppender -> Word32 -> IO DuckDBState
-
--- | Append a uint64_t value to the appender.
-foreign import ccall "duckdb_append_uint64"
-    c_duckdb_append_uint64 :: DuckDBAppender -> Word64 -> IO DuckDBState
-
-{- | Append a duckdb_uhugeint value to the appender.
-
-These bindings call the wrapper symbol @wrapped_duckdb_append_uhugeint@
-but mirror the DuckDB C API semantics of @duckdb_append_uhugeint@.
--}
-foreign import ccall "wrapped_duckdb_append_uhugeint"
-    c_duckdb_append_uhugeint :: DuckDBAppender -> Ptr DuckDBUHugeInt -> IO DuckDBState
-
--- | Append a float value to the appender.
-foreign import ccall "duckdb_append_float"
-    c_duckdb_append_float :: DuckDBAppender -> CFloat -> IO DuckDBState
-
--- | Append a double value to the appender.
-foreign import ccall "duckdb_append_double"
-    c_duckdb_append_double :: DuckDBAppender -> CDouble -> IO DuckDBState
-
--- | Append a duckdb_date value to the appender.
-foreign import ccall "wrapped_duckdb_append_date"
-    c_duckdb_append_date :: DuckDBAppender -> DuckDBDate -> IO DuckDBState
-
--- | Append a duckdb_time value to the appender.
-foreign import ccall "wrapped_duckdb_append_time"
-    c_duckdb_append_time :: DuckDBAppender -> DuckDBTime -> IO DuckDBState
-
--- | Append a duckdb_timestamp value to the appender.
-foreign import ccall "wrapped_duckdb_append_timestamp"
-    c_duckdb_append_timestamp :: DuckDBAppender -> DuckDBTimestamp -> IO DuckDBState
-
-{- | Append a duckdb_interval value to the appender.
-
-These bindings call the wrapper symbol @wrapped_duckdb_append_interval@
-but mirror the DuckDB C API semantics of @duckdb_append_interval@.
--}
-foreign import ccall "wrapped_duckdb_append_interval"
-    c_duckdb_append_interval :: DuckDBAppender -> Ptr DuckDBInterval -> IO DuckDBState
-
--- | Append a varchar value to the appender.
-foreign import ccall "duckdb_append_varchar"
-    c_duckdb_append_varchar :: DuckDBAppender -> CString -> IO DuckDBState
-
--- | Append a varchar value to the appender.
-foreign import ccall "duckdb_append_varchar_length"
-    c_duckdb_append_varchar_length :: DuckDBAppender -> CString -> DuckDBIdx -> IO DuckDBState
-
--- | Append a blob value to the appender.
-foreign import ccall "duckdb_append_blob"
-    c_duckdb_append_blob :: DuckDBAppender -> Ptr () -> DuckDBIdx -> IO DuckDBState
-
--- | Append a NULL value to the appender (of any type).
-foreign import ccall "duckdb_append_null"
-    c_duckdb_append_null :: DuckDBAppender -> IO DuckDBState
-
--- | Append a duckdb_value to the appender.
-foreign import ccall "duckdb_append_value"
-    c_duckdb_append_value :: DuckDBAppender -> DuckDBValue -> IO DuckDBState
-
-{- | Appends a pre-filled data chunk to the specified appender. Attempts casting,
-if the data chunk types do not match the active appender types.
-
-Parameters:
-* @appender@: The appender to append to.
-* @chunk@: The data chunk to append.
-
-Returns @DuckDBSuccess@ on success or @DuckDBError@ on failure.
--}
-foreign import ccall "duckdb_append_data_chunk"
-    c_duckdb_append_data_chunk :: DuckDBAppender -> DuckDBDataChunk -> IO DuckDBState
diff --git a/src/Database/DuckDB/FFI/Arrow.hs b/src/Database/DuckDB/FFI/Arrow.hs
deleted file mode 100644
--- a/src/Database/DuckDB/FFI/Arrow.hs
+++ /dev/null
@@ -1,185 +0,0 @@
-{- | Arrow C Data Interface conversion and callbacks.
-
-The @mkArrow...@ functions invoke existing callback pointers. The
-@wrapArrow...@ functions allocate callback pointers for Haskell functions.
-Keep each allocated pointer alive while native code can call it. Free it with
-@freeHaskellFunPtr@ after its last use. Catch all callback exceptions before
-they can return to C.
--}
-module Database.DuckDB.FFI.Arrow (
-    c_duckdb_to_arrow_schema,
-    c_duckdb_data_chunk_to_arrow,
-    c_duckdb_schema_from_arrow,
-    c_duckdb_data_chunk_from_arrow,
-    c_duckdb_destroy_arrow_converted_schema,
-    mkArrowSchemaRelease,
-    mkArrowArrayRelease,
-    mkArrowStreamGetSchema,
-    mkArrowStreamGetNext,
-    mkArrowStreamGetLastError,
-    mkArrowStreamRelease,
-    wrapArrowSchemaRelease,
-    wrapArrowArrayRelease,
-    wrapArrowStreamGetSchema,
-    wrapArrowStreamGetNext,
-    wrapArrowStreamGetLastError,
-    wrapArrowStreamRelease,
-    releaseArrowSchema,
-    releaseArrowArray,
-    releaseArrowStream,
-) where
-
-import Control.Exception (mask_)
-import Control.Monad (when)
-import Database.DuckDB.FFI.Types
-import Foreign.C.String (CString)
-import Foreign.C.Types (CInt (..))
-import Foreign.Ptr (FunPtr, Ptr, nullFunPtr)
-import Foreign.Storable (peek)
-
-{- | Transforms a DuckDB Schema into an Arrow Schema
-
-Parameters:
-* @arrow_options@: The Arrow settings used to produce arrow.
-* @types@: The DuckDB logical types for each column in the schema.
-* @names@: The names for each column in the schema.
-* @column_count@: The number of columns that exist in the schema.
-* @out_schema@: The resulting arrow schema. Must be destroyed with
-  @out_schema->release(out_schema)@.
-
-Returns The error data. Must be destroyed with @duckdb_destroy_error_data@.
--}
-foreign import ccall safe "duckdb_to_arrow_schema"
-    c_duckdb_to_arrow_schema :: DuckDBArrowOptions -> Ptr DuckDBLogicalType -> Ptr CString -> DuckDBIdx -> Ptr ArrowSchema -> IO DuckDBErrorData
-
-{- | Transforms a DuckDB data chunk into an Arrow array.
-
-Parameters:
-* @arrow_options@: The Arrow settings used to produce arrow.
-* @chunk@: The DuckDB data chunk to convert.
-* @out_arrow_array@: The output Arrow structure that will hold the converted
-  data. Must be released with @out_arrow_array->release(out_arrow_array)@
-
-Returns The error data. Must be destroyed with @duckdb_destroy_error_data@.
--}
-foreign import ccall safe "duckdb_data_chunk_to_arrow"
-    c_duckdb_data_chunk_to_arrow :: DuckDBArrowOptions -> DuckDBDataChunk -> Ptr ArrowArray -> IO DuckDBErrorData
-
-{- | Transforms an Arrow Schema into a DuckDB Schema.
-
-Parameters:
-* @connection@: The connection to get the transformation settings from.
-* @schema@: The input Arrow schema. Must be released with
-  @schema->release(schema)@.
-* @out_types@: The Arrow converted schema with extra information about the
-  arrow types. Must be destroyed with @duckdb_destroy_arrow_converted_schema@.
-
-Returns The error data. Must be destroyed with @duckdb_destroy_error_data@.
--}
-foreign import ccall safe "duckdb_schema_from_arrow"
-    c_duckdb_schema_from_arrow :: DuckDBConnection -> Ptr ArrowSchema -> Ptr DuckDBArrowConvertedSchema -> IO DuckDBErrorData
-
-{- | Transforms an Arrow array into a DuckDB data chunk. The data chunk will retain
-ownership of the underlying Arrow data.
-
-Parameters:
-* @connection@: The connection to get the transformation settings from.
-* @arrow_array@: The input Arrow array. Data ownership is passed on to
-  DuckDB's DataChunk, the underlying object does not need to be released and
-  won't have ownership of the data.
-* @converted_schema@: The Arrow converted schema with extra information about
-  the arrow types.
-* @out_chunk@: The resulting DuckDB data chunk. Must be destroyed by
-  duckdb_destroy_data_chunk.
-
-Returns The error data. Must be destroyed with @duckdb_destroy_error_data@.
--}
-foreign import ccall safe "duckdb_data_chunk_from_arrow"
-    c_duckdb_data_chunk_from_arrow :: DuckDBConnection -> Ptr ArrowArray -> DuckDBArrowConvertedSchema -> Ptr DuckDBDataChunk -> IO DuckDBErrorData
-
-{- | Destroys the arrow converted schema and de-allocates all memory allocated for
-that arrow converted schema.
-
-Parameters:
-* @arrow_converted_schema@: The arrow converted schema to destroy.
--}
-foreign import ccall safe "duckdb_destroy_arrow_converted_schema"
-    c_duckdb_destroy_arrow_converted_schema :: Ptr DuckDBArrowConvertedSchema -> IO ()
-
--- | Invoke a non-null Arrow schema release callback.
-foreign import ccall safe "dynamic"
-    mkArrowSchemaRelease :: FunPtr (Ptr ArrowSchema -> IO ()) -> Ptr ArrowSchema -> IO ()
-
--- | Invoke a non-null Arrow array release callback.
-foreign import ccall safe "dynamic"
-    mkArrowArrayRelease :: FunPtr (Ptr ArrowArray -> IO ()) -> Ptr ArrowArray -> IO ()
-
--- | Invoke the schema callback of an unreleased Arrow stream.
-foreign import ccall safe "dynamic"
-    mkArrowStreamGetSchema :: FunPtr (Ptr ArrowArrayStream -> Ptr ArrowSchema -> IO CInt) -> Ptr ArrowArrayStream -> Ptr ArrowSchema -> IO CInt
-
--- | Invoke the next-array callback of an unreleased Arrow stream.
-foreign import ccall safe "dynamic"
-    mkArrowStreamGetNext :: FunPtr (Ptr ArrowArrayStream -> Ptr ArrowArray -> IO CInt) -> Ptr ArrowArrayStream -> Ptr ArrowArray -> IO CInt
-
--- | Read a stream error after a failed callback. Copy it before the next callback.
-foreign import ccall safe "dynamic"
-    mkArrowStreamGetLastError :: FunPtr (Ptr ArrowArrayStream -> IO CString) -> Ptr ArrowArrayStream -> IO CString
-
--- | Invoke a non-null Arrow stream release callback.
-foreign import ccall safe "dynamic"
-    mkArrowStreamRelease :: FunPtr (Ptr ArrowArrayStream -> IO ()) -> Ptr ArrowArrayStream -> IO ()
-
--- | Allocate a C-callable Arrow schema release callback.
-foreign import ccall "wrapper"
-    wrapArrowSchemaRelease :: (Ptr ArrowSchema -> IO ()) -> IO (FunPtr (Ptr ArrowSchema -> IO ()))
-
--- | Allocate a C-callable Arrow array release callback.
-foreign import ccall "wrapper"
-    wrapArrowArrayRelease :: (Ptr ArrowArray -> IO ()) -> IO (FunPtr (Ptr ArrowArray -> IO ()))
-
--- | Allocate a C-callable Arrow stream schema callback.
-foreign import ccall "wrapper"
-    wrapArrowStreamGetSchema :: (Ptr ArrowArrayStream -> Ptr ArrowSchema -> IO CInt) -> IO (FunPtr (Ptr ArrowArrayStream -> Ptr ArrowSchema -> IO CInt))
-
--- | Allocate a C-callable Arrow stream next-array callback.
-foreign import ccall "wrapper"
-    wrapArrowStreamGetNext :: (Ptr ArrowArrayStream -> Ptr ArrowArray -> IO CInt) -> IO (FunPtr (Ptr ArrowArrayStream -> Ptr ArrowArray -> IO CInt))
-
--- | Allocate a C-callable Arrow stream last-error callback.
-foreign import ccall "wrapper"
-    wrapArrowStreamGetLastError :: (Ptr ArrowArrayStream -> IO CString) -> IO (FunPtr (Ptr ArrowArrayStream -> IO CString))
-
--- | Allocate a C-callable Arrow stream release callback.
-foreign import ccall "wrapper"
-    wrapArrowStreamRelease :: (Ptr ArrowArrayStream -> IO ()) -> IO (FunPtr (Ptr ArrowArrayStream -> IO ()))
-
-{- | Release an Arrow schema unless its release callback is null.
-The pointer must address an initialized structure. The structure itself stays
-allocated. Asynchronous exceptions are masked during release.
--}
-releaseArrowSchema :: Ptr ArrowSchema -> IO ()
-releaseArrowSchema ptr = mask_ $ do
-    schema <- peek ptr
-    when (arrowSchemaRelease schema /= nullFunPtr) $
-        mkArrowSchemaRelease (arrowSchemaRelease schema) ptr
-
-{- | Release an Arrow array unless its release callback is null.
-The pointer must address an initialized structure. The structure itself stays
-allocated. Asynchronous exceptions are masked during release.
--}
-releaseArrowArray :: Ptr ArrowArray -> IO ()
-releaseArrowArray ptr = mask_ $ do
-    array <- peek ptr
-    when (arrowArrayRelease array /= nullFunPtr) $
-        mkArrowArrayRelease (arrowArrayRelease array) ptr
-
-{- | Release an Arrow stream unless its release callback is null.
-The pointer must address an initialized structure. The structure itself stays
-allocated. Asynchronous exceptions are masked during release.
--}
-releaseArrowStream :: Ptr ArrowArrayStream -> IO ()
-releaseArrowStream ptr = mask_ $ do
-    stream <- peek ptr
-    when (arrowStreamRelease stream /= nullFunPtr) $
-        mkArrowStreamRelease (arrowStreamRelease stream) ptr
diff --git a/src/Database/DuckDB/FFI/BindValues.hs b/src/Database/DuckDB/FFI/BindValues.hs
deleted file mode 100644
--- a/src/Database/DuckDB/FFI/BindValues.hs
+++ /dev/null
@@ -1,160 +0,0 @@
-module Database.DuckDB.FFI.BindValues (
-    c_duckdb_bind_value,
-    c_duckdb_bind_parameter_index,
-    c_duckdb_bind_boolean,
-    c_duckdb_bind_int8,
-    c_duckdb_bind_int16,
-    c_duckdb_bind_int32,
-    c_duckdb_bind_int64,
-    c_duckdb_bind_hugeint,
-    c_duckdb_bind_uhugeint,
-    c_duckdb_bind_decimal,
-    c_duckdb_bind_uint8,
-    c_duckdb_bind_uint16,
-    c_duckdb_bind_uint32,
-    c_duckdb_bind_uint64,
-    c_duckdb_bind_float,
-    c_duckdb_bind_double,
-    c_duckdb_bind_date,
-    c_duckdb_bind_time,
-    c_duckdb_bind_timestamp,
-    c_duckdb_bind_timestamp_tz,
-    c_duckdb_bind_interval,
-    c_duckdb_bind_varchar,
-    c_duckdb_bind_varchar_length,
-    c_duckdb_bind_blob,
-    c_duckdb_bind_null,
-) where
-
-import Data.Int (Int16, Int32, Int64, Int8)
-import Data.Word (Word16, Word32, Word64, Word8)
-import Database.DuckDB.FFI.Types
-import Foreign.C.String (CString)
-import Foreign.C.Types (CBool (..), CDouble (..), CFloat (..), CInt (..))
-import Foreign.Ptr (Ptr)
-
--- | Binds a value to the prepared statement at the specified index.
-foreign import ccall safe "duckdb_bind_value"
-    c_duckdb_bind_value :: DuckDBPreparedStatement -> DuckDBIdx -> DuckDBValue -> IO DuckDBState
-
-{- | Retrieve the index of the parameter for the prepared statement, identified by
-name
--}
-foreign import ccall safe "duckdb_bind_parameter_index"
-    c_duckdb_bind_parameter_index :: DuckDBPreparedStatement -> Ptr DuckDBIdx -> CString -> IO DuckDBState
-
--- | Binds a bool value to the prepared statement at the specified index.
-foreign import ccall safe "duckdb_bind_boolean"
-    c_duckdb_bind_boolean :: DuckDBPreparedStatement -> DuckDBIdx -> CBool -> IO DuckDBState
-
--- | Binds an int8_t value to the prepared statement at the specified index.
-foreign import ccall safe "duckdb_bind_int8"
-    c_duckdb_bind_int8 :: DuckDBPreparedStatement -> DuckDBIdx -> Int8 -> IO DuckDBState
-
--- | Binds an int16_t value to the prepared statement at the specified index.
-foreign import ccall safe "duckdb_bind_int16"
-    c_duckdb_bind_int16 :: DuckDBPreparedStatement -> DuckDBIdx -> Int16 -> IO DuckDBState
-
--- | Binds an int32_t value to the prepared statement at the specified index.
-foreign import ccall safe "duckdb_bind_int32"
-    c_duckdb_bind_int32 :: DuckDBPreparedStatement -> DuckDBIdx -> Int32 -> IO DuckDBState
-
--- | Binds an int64_t value to the prepared statement at the specified index.
-foreign import ccall safe "duckdb_bind_int64"
-    c_duckdb_bind_int64 :: DuckDBPreparedStatement -> DuckDBIdx -> Int64 -> IO DuckDBState
-
-{- | Binds a duckdb_hugeint value to the prepared statement at the specified index.
-
-These bindings call the wrapper symbol @wrapped_duckdb_bind_hugeint@
-but mirror the DuckDB C API semantics of @duckdb_bind_hugeint@.
--}
-foreign import ccall safe "wrapped_duckdb_bind_hugeint"
-    c_duckdb_bind_hugeint :: DuckDBPreparedStatement -> DuckDBIdx -> Ptr DuckDBHugeInt -> IO DuckDBState
-
-{- | Binds a duckdb_uhugeint value to the prepared statement at the specified
-index.
-
-These bindings call the wrapper symbol @wrapped_duckdb_bind_uhugeint@
-but mirror the DuckDB C API semantics of @duckdb_bind_uhugeint@.
--}
-foreign import ccall safe "wrapped_duckdb_bind_uhugeint"
-    c_duckdb_bind_uhugeint :: DuckDBPreparedStatement -> DuckDBIdx -> Ptr DuckDBUHugeInt -> IO DuckDBState
-
-{- | Binds a duckdb_decimal value to the prepared statement at the specified index.
-
-These bindings call the wrapper symbol @wrapped_duckdb_bind_decimal@
-but mirror the DuckDB C API semantics of @duckdb_bind_decimal@.
--}
-foreign import ccall safe "wrapped_duckdb_bind_decimal"
-    c_duckdb_bind_decimal :: DuckDBPreparedStatement -> DuckDBIdx -> Ptr DuckDBDecimal -> IO DuckDBState
-
--- | Binds a uint8_t value to the prepared statement at the specified index.
-foreign import ccall safe "duckdb_bind_uint8"
-    c_duckdb_bind_uint8 :: DuckDBPreparedStatement -> DuckDBIdx -> Word8 -> IO DuckDBState
-
--- | Binds a uint16_t value to the prepared statement at the specified index.
-foreign import ccall safe "duckdb_bind_uint16"
-    c_duckdb_bind_uint16 :: DuckDBPreparedStatement -> DuckDBIdx -> Word16 -> IO DuckDBState
-
--- | Binds a uint32_t value to the prepared statement at the specified index.
-foreign import ccall safe "duckdb_bind_uint32"
-    c_duckdb_bind_uint32 :: DuckDBPreparedStatement -> DuckDBIdx -> Word32 -> IO DuckDBState
-
--- | Binds a uint64_t value to the prepared statement at the specified index.
-foreign import ccall safe "duckdb_bind_uint64"
-    c_duckdb_bind_uint64 :: DuckDBPreparedStatement -> DuckDBIdx -> Word64 -> IO DuckDBState
-
--- | Binds a float value to the prepared statement at the specified index.
-foreign import ccall safe "duckdb_bind_float"
-    c_duckdb_bind_float :: DuckDBPreparedStatement -> DuckDBIdx -> CFloat -> IO DuckDBState
-
--- | Binds a double value to the prepared statement at the specified index.
-foreign import ccall safe "duckdb_bind_double"
-    c_duckdb_bind_double :: DuckDBPreparedStatement -> DuckDBIdx -> CDouble -> IO DuckDBState
-
--- | Binds a duckdb_date value to the prepared statement at the specified index.
-foreign import ccall safe "wrapped_duckdb_bind_date"
-    c_duckdb_bind_date :: DuckDBPreparedStatement -> DuckDBIdx -> DuckDBDate -> IO DuckDBState
-
--- | Binds a duckdb_time value to the prepared statement at the specified index.
-foreign import ccall safe "wrapped_duckdb_bind_time"
-    c_duckdb_bind_time :: DuckDBPreparedStatement -> DuckDBIdx -> DuckDBTime -> IO DuckDBState
-
-{- | Binds a duckdb_timestamp value to the prepared statement at the specified
-index.
--}
-foreign import ccall safe "wrapped_duckdb_bind_timestamp"
-    c_duckdb_bind_timestamp :: DuckDBPreparedStatement -> DuckDBIdx -> DuckDBTimestamp -> IO DuckDBState
-
-{- | Binds a duckdb_timestamp value to the prepared statement at the specified
-index.
--}
-foreign import ccall safe "wrapped_duckdb_bind_timestamp_tz"
-    c_duckdb_bind_timestamp_tz :: DuckDBPreparedStatement -> DuckDBIdx -> DuckDBTimestamp -> IO DuckDBState
-
-{- | Binds a duckdb_interval value to the prepared statement at the specified
-index.
-
-These bindings call the wrapper symbol @wrapped_duckdb_bind_interval@
-but mirror the DuckDB C API semantics of @duckdb_bind_interval@.
--}
-foreign import ccall safe "wrapped_duckdb_bind_interval"
-    c_duckdb_bind_interval :: DuckDBPreparedStatement -> DuckDBIdx -> Ptr DuckDBInterval -> IO DuckDBState
-
-{- | Binds a null-terminated varchar value to the prepared statement at the
-specified index.
--}
-foreign import ccall safe "duckdb_bind_varchar"
-    c_duckdb_bind_varchar :: DuckDBPreparedStatement -> DuckDBIdx -> CString -> IO DuckDBState
-
--- | Binds a varchar value to the prepared statement at the specified index.
-foreign import ccall safe "duckdb_bind_varchar_length"
-    c_duckdb_bind_varchar_length :: DuckDBPreparedStatement -> DuckDBIdx -> CString -> DuckDBIdx -> IO DuckDBState
-
--- | Binds a blob value to the prepared statement at the specified index.
-foreign import ccall safe "duckdb_bind_blob"
-    c_duckdb_bind_blob :: DuckDBPreparedStatement -> DuckDBIdx -> Ptr () -> DuckDBIdx -> IO DuckDBState
-
--- | Binds a NULL value to the prepared statement at the specified index.
-foreign import ccall safe "duckdb_bind_null"
-    c_duckdb_bind_null :: DuckDBPreparedStatement -> DuckDBIdx -> IO DuckDBState
diff --git a/src/Database/DuckDB/FFI/CastFunctions.hs b/src/Database/DuckDB/FFI/CastFunctions.hs
deleted file mode 100644
--- a/src/Database/DuckDB/FFI/CastFunctions.hs
+++ /dev/null
@@ -1,136 +0,0 @@
-module Database.DuckDB.FFI.CastFunctions (
-    c_duckdb_create_cast_function,
-    c_duckdb_cast_function_set_source_type,
-    c_duckdb_cast_function_set_target_type,
-    c_duckdb_cast_function_set_implicit_cast_cost,
-    c_duckdb_cast_function_set_function,
-    c_duckdb_cast_function_set_extra_info,
-    c_duckdb_cast_function_get_extra_info,
-    c_duckdb_cast_function_get_cast_mode,
-    c_duckdb_cast_function_set_error,
-    c_duckdb_cast_function_set_row_error,
-    c_duckdb_register_cast_function,
-    c_duckdb_destroy_cast_function,
-) where
-
-import Data.Int (Int64)
-import Database.DuckDB.FFI.Types
-import Foreign.C.String (CString)
-import Foreign.C.Types (CInt (..))
-import Foreign.Ptr (Ptr)
-
-{- | Creates a new cast function object.
-
-Returns The cast function object.
--}
-foreign import ccall safe "duckdb_create_cast_function"
-    c_duckdb_create_cast_function :: IO DuckDBCastFunction
-
-{- | Sets the source type of the cast function.
-
-Parameters:
-* @cast_function@: The cast function object.
-* @source_type@: The source type to set.
--}
-foreign import ccall safe "duckdb_cast_function_set_source_type"
-    c_duckdb_cast_function_set_source_type :: DuckDBCastFunction -> DuckDBLogicalType -> IO ()
-
-{- | Sets the target type of the cast function.
-
-Parameters:
-* @cast_function@: The cast function object.
-* @target_type@: The target type to set.
--}
-foreign import ccall safe "duckdb_cast_function_set_target_type"
-    c_duckdb_cast_function_set_target_type :: DuckDBCastFunction -> DuckDBLogicalType -> IO ()
-
-{- | Sets the "cost" of implicitly casting the source type to the target type using
-this function.
-
-Parameters:
-* @cast_function@: The cast function object.
-* @cost@: The cost to set.
--}
-foreign import ccall safe "duckdb_cast_function_set_implicit_cast_cost"
-    c_duckdb_cast_function_set_implicit_cast_cost :: DuckDBCastFunction -> Int64 -> IO ()
-
-{- | Sets the actual cast function to use.
-
-Parameters:
-* @cast_function@: The cast function object.
-* @function@: The function to set.
--}
-foreign import ccall safe "duckdb_cast_function_set_function"
-    c_duckdb_cast_function_set_function :: DuckDBCastFunction -> DuckDBCastFunctionFun -> IO ()
-
-{- | Assigns extra information to the cast function that can be fetched during
-execution, etc.
-
-Parameters:
-* @extra_info@: The extra information
-* @destroy@: The callback that will be called to destroy the extra information
-  (if any)
--}
-foreign import ccall safe "duckdb_cast_function_set_extra_info"
-    c_duckdb_cast_function_set_extra_info :: DuckDBCastFunction -> Ptr () -> DuckDBDeleteCallback -> IO ()
-
-{- | Retrieves the extra info of the function as set in
-@duckdb_cast_function_set_extra_info@.
-
-Parameters:
-* @info@: The info object.
-
-Returns The extra info.
--}
-foreign import ccall safe "duckdb_cast_function_get_extra_info"
-    c_duckdb_cast_function_get_extra_info :: DuckDBFunctionInfo -> IO (Ptr ())
-
-{- | Get the cast execution mode from the given function info.
-
-Parameters:
-* @info@: The info object.
-
-Returns The cast mode.
--}
-foreign import ccall safe "duckdb_cast_function_get_cast_mode"
-    c_duckdb_cast_function_get_cast_mode :: DuckDBFunctionInfo -> IO DuckDBCastMode
-
-{- | Report that an error has occurred while executing the cast function.
-
-Parameters:
-* @info@: The info object.
-* @error@: The error message.
--}
-foreign import ccall safe "duckdb_cast_function_set_error"
-    c_duckdb_cast_function_set_error :: DuckDBFunctionInfo -> CString -> IO ()
-
-{- | Report that an error has occurred while executing the cast function, setting
-the corresponding output row to NULL.
-
-Parameters:
-* @info@: The info object.
-* @error@: The error message.
-* @row@: The index of the row within the output vector to set to NULL.
-* @output@: The output vector.
--}
-foreign import ccall safe "duckdb_cast_function_set_row_error"
-    c_duckdb_cast_function_set_row_error :: DuckDBFunctionInfo -> CString -> DuckDBIdx -> DuckDBVector -> IO ()
-
-{- | Registers a cast function within the given connection.
-
-Parameters:
-* @con@: The connection to use.
-* @cast_function@: The cast function to register.
-
-Returns Whether or not the registration was successful.
--}
-foreign import ccall safe "duckdb_register_cast_function"
-    c_duckdb_register_cast_function :: DuckDBConnection -> DuckDBCastFunction -> IO DuckDBState
-
-{- | Destroys the cast function object.
-
-Parameters:
-* @cast_function@: The cast function object.
--}
-foreign import ccall safe "duckdb_destroy_cast_function"
-    c_duckdb_destroy_cast_function :: Ptr DuckDBCastFunction -> IO ()
diff --git a/src/Database/DuckDB/FFI/Catalog.hs b/src/Database/DuckDB/FFI/Catalog.hs
deleted file mode 100644
--- a/src/Database/DuckDB/FFI/Catalog.hs
+++ /dev/null
@@ -1,46 +0,0 @@
-{- |
-Module      : Database.DuckDB.FFI.Catalog
-Description : Raw bindings for DuckDB's catalog inspection API.
--}
-module Database.DuckDB.FFI.Catalog (
-    c_duckdb_client_context_get_catalog,
-    c_duckdb_catalog_get_type_name,
-    c_duckdb_catalog_get_entry,
-    c_duckdb_destroy_catalog,
-    c_duckdb_catalog_entry_get_type,
-    c_duckdb_catalog_entry_get_name,
-    c_duckdb_destroy_catalog_entry,
-) where
-
-import Database.DuckDB.FFI.Types
-import Foreign.C.String (CString)
-import Foreign.C.Types (CInt (..))
-import Foreign.Ptr (Ptr)
-
--- | Look up a named catalog from a client context.
-foreign import ccall safe "duckdb_client_context_get_catalog"
-    c_duckdb_client_context_get_catalog :: DuckDBClientContext -> CString -> IO DuckDBCatalog
-
--- | Fetch the backend type name of a catalog.
-foreign import ccall safe "duckdb_catalog_get_type_name"
-    c_duckdb_catalog_get_type_name :: DuckDBCatalog -> IO CString
-
--- | Look up a catalog entry by schema, name, and entry kind.
-foreign import ccall safe "duckdb_catalog_get_entry"
-    c_duckdb_catalog_get_entry :: DuckDBCatalog -> DuckDBClientContext -> DuckDBCatalogEntryType -> CString -> CString -> IO DuckDBCatalogEntry
-
--- | Destroy a catalog handle obtained from DuckDB.
-foreign import ccall safe "duckdb_destroy_catalog"
-    c_duckdb_destroy_catalog :: Ptr DuckDBCatalog -> IO ()
-
--- | Read the entry kind of a catalog entry handle.
-foreign import ccall safe "duckdb_catalog_entry_get_type"
-    c_duckdb_catalog_entry_get_type :: DuckDBCatalogEntry -> IO DuckDBCatalogEntryType
-
--- | Read the name of a catalog entry handle.
-foreign import ccall safe "duckdb_catalog_entry_get_name"
-    c_duckdb_catalog_entry_get_name :: DuckDBCatalogEntry -> IO CString
-
--- | Destroy a catalog entry handle obtained from DuckDB.
-foreign import ccall safe "duckdb_destroy_catalog_entry"
-    c_duckdb_destroy_catalog_entry :: Ptr DuckDBCatalogEntry -> IO ()
diff --git a/src/Database/DuckDB/FFI/Configuration.hs b/src/Database/DuckDB/FFI/Configuration.hs
deleted file mode 100644
--- a/src/Database/DuckDB/FFI/Configuration.hs
+++ /dev/null
@@ -1,130 +0,0 @@
-module Database.DuckDB.FFI.Configuration (
-    c_duckdb_create_config,
-    c_duckdb_config_count,
-    c_duckdb_get_config_flag,
-    c_duckdb_set_config,
-    c_duckdb_destroy_config,
-    c_duckdb_create_config_option,
-    c_duckdb_destroy_config_option,
-    c_duckdb_config_option_set_name,
-    c_duckdb_config_option_set_type,
-    c_duckdb_config_option_set_default_value,
-    c_duckdb_config_option_set_default_scope,
-    c_duckdb_config_option_set_description,
-    c_duckdb_register_config_option,
-    c_duckdb_client_context_get_config_option,
-) where
-
-import Database.DuckDB.FFI.Types
-import Foreign.C.String (CString)
-import Foreign.C.Types (CInt (..), CSize (..))
-import Foreign.Ptr (Ptr)
-
-{- | Initializes an empty configuration object that can be used to provide start-up
-options for the DuckDB instance through @duckdb_open_ext@. The duckdb_config
-must be destroyed using @duckdb_destroy_config@
-
-This will always succeed unless there is a malloc failure.
-
-Note that @duckdb_destroy_config@ should always be called on the resulting
-config, even if the function returns @DuckDBError@.
-
-Parameters:
-* @out_config@: The result configuration object.
-
-Returns @DuckDBSuccess@ on success or @DuckDBError@ on failure.
--}
-foreign import ccall safe "duckdb_create_config"
-    c_duckdb_create_config :: Ptr DuckDBConfig -> IO DuckDBState
-
-{- | This returns the total amount of configuration options available for usage
-with @duckdb_get_config_flag@.
-
-This should not be called in a loop as it internally loops over all the
-options.
-
-Returns The amount of config options available.
--}
-foreign import ccall safe "duckdb_config_count"
-    c_duckdb_config_count :: IO CSize
-
-{- | Obtains a human-readable name and description of a specific configuration
-option. This can be used to e.g. display configuration options. This will
-succeed unless @index@ is out of range (i.e., @>= duckdb_config_count@).
-
-The result name or description MUST NOT be freed.
-
-Parameters:
-* @index@: The index of the configuration option (between 0 and
-  @duckdb_config_count@)
-* @out_name@: A name of the configuration flag.
-* @out_description@: A description of the configuration flag.
-
-Returns @DuckDBSuccess@ on success or @DuckDBError@ on failure.
--}
-foreign import ccall safe "duckdb_get_config_flag"
-    c_duckdb_get_config_flag :: CSize -> Ptr CString -> Ptr CString -> IO DuckDBState
-
-{- | Sets the specified option for the specified configuration. The configuration
-option is indicated by name. To obtain a list of config options, see
-@duckdb_get_config_flag@.
-
-In the source code, configuration options are defined in @config.cpp@.
-
-This can fail if either the name is invalid, or if the value provided for the
-option is invalid.
-
-Parameters:
-* @config@: The configuration object to set the option on.
-* @name@: The name of the configuration flag to set.
-* @option@: The value to set the configuration flag to.
-
-Returns @DuckDBSuccess@ on success or @DuckDBError@ on failure.
--}
-foreign import ccall safe "duckdb_set_config"
-    c_duckdb_set_config :: DuckDBConfig -> CString -> CString -> IO DuckDBState
-
-{- | Destroys the specified configuration object and de-allocates all memory
-allocated for the object.
-
-Parameters:
-* @config@: The configuration object to destroy.
--}
-foreign import ccall safe "duckdb_destroy_config"
-    c_duckdb_destroy_config :: Ptr DuckDBConfig -> IO ()
-
--- | Creates a configuration option descriptor.
-foreign import ccall safe "duckdb_create_config_option"
-    c_duckdb_create_config_option :: IO DuckDBConfigOption
-
--- | Destroys a configuration option descriptor.
-foreign import ccall safe "duckdb_destroy_config_option"
-    c_duckdb_destroy_config_option :: Ptr DuckDBConfigOption -> IO ()
-
--- | Sets the option name.
-foreign import ccall safe "duckdb_config_option_set_name"
-    c_duckdb_config_option_set_name :: DuckDBConfigOption -> CString -> IO ()
-
--- | Sets the logical type of the option.
-foreign import ccall safe "duckdb_config_option_set_type"
-    c_duckdb_config_option_set_type :: DuckDBConfigOption -> DuckDBLogicalType -> IO ()
-
--- | Sets the default value of the option.
-foreign import ccall safe "duckdb_config_option_set_default_value"
-    c_duckdb_config_option_set_default_value :: DuckDBConfigOption -> DuckDBValue -> IO ()
-
--- | Sets the default scope of the option.
-foreign import ccall safe "duckdb_config_option_set_default_scope"
-    c_duckdb_config_option_set_default_scope :: DuckDBConfigOption -> DuckDBConfigOptionScope -> IO ()
-
--- | Sets the option description.
-foreign import ccall safe "duckdb_config_option_set_description"
-    c_duckdb_config_option_set_description :: DuckDBConfigOption -> CString -> IO ()
-
--- | Registers a custom configuration option.
-foreign import ccall safe "duckdb_register_config_option"
-    c_duckdb_register_config_option :: DuckDBConnection -> DuckDBConfigOption -> IO DuckDBState
-
--- | Retrieves the current value and scope of a configuration option.
-foreign import ccall safe "duckdb_client_context_get_config_option"
-    c_duckdb_client_context_get_config_option :: DuckDBClientContext -> CString -> Ptr DuckDBConfigOptionScope -> IO DuckDBValue
diff --git a/src/Database/DuckDB/FFI/CopyFunctions.hs b/src/Database/DuckDB/FFI/CopyFunctions.hs
deleted file mode 100644
--- a/src/Database/DuckDB/FFI/CopyFunctions.hs
+++ /dev/null
@@ -1,176 +0,0 @@
-{- |
-Module      : Database.DuckDB.FFI.CopyFunctions
-Description : Raw bindings for DuckDB's custom COPY-function API.
--}
-module Database.DuckDB.FFI.CopyFunctions (
-    c_duckdb_create_copy_function,
-    c_duckdb_copy_function_set_name,
-    c_duckdb_copy_function_set_extra_info,
-    c_duckdb_register_copy_function,
-    c_duckdb_destroy_copy_function,
-    c_duckdb_copy_function_set_bind,
-    c_duckdb_copy_function_bind_set_error,
-    c_duckdb_copy_function_bind_get_extra_info,
-    c_duckdb_copy_function_bind_get_client_context,
-    c_duckdb_copy_function_bind_get_column_count,
-    c_duckdb_copy_function_bind_get_column_type,
-    c_duckdb_copy_function_bind_get_options,
-    c_duckdb_copy_function_bind_set_bind_data,
-    c_duckdb_copy_function_set_global_init,
-    c_duckdb_copy_function_global_init_set_error,
-    c_duckdb_copy_function_global_init_get_extra_info,
-    c_duckdb_copy_function_global_init_get_client_context,
-    c_duckdb_copy_function_global_init_get_bind_data,
-    c_duckdb_copy_function_global_init_get_file_path,
-    c_duckdb_copy_function_global_init_set_global_state,
-    c_duckdb_copy_function_set_sink,
-    c_duckdb_copy_function_sink_set_error,
-    c_duckdb_copy_function_sink_get_extra_info,
-    c_duckdb_copy_function_sink_get_client_context,
-    c_duckdb_copy_function_sink_get_bind_data,
-    c_duckdb_copy_function_sink_get_global_state,
-    c_duckdb_copy_function_set_finalize,
-    c_duckdb_copy_function_finalize_set_error,
-    c_duckdb_copy_function_finalize_get_extra_info,
-    c_duckdb_copy_function_finalize_get_client_context,
-    c_duckdb_copy_function_finalize_get_bind_data,
-    c_duckdb_copy_function_finalize_get_global_state,
-    c_duckdb_copy_function_set_copy_from_function,
-) where
-
-import Database.DuckDB.FFI.Types
-import Foreign.C.String (CString)
-import Foreign.C.Types (CInt (..))
-import Foreign.Ptr (Ptr)
-
--- | Allocate a new copy-function object.
-foreign import ccall safe "duckdb_create_copy_function"
-    c_duckdb_create_copy_function :: IO DuckDBCopyFunction
-
--- | Set the registration name of a copy function.
-foreign import ccall safe "duckdb_copy_function_set_name"
-    c_duckdb_copy_function_set_name :: DuckDBCopyFunction -> CString -> IO ()
-
--- | Attach user-managed extra data to a copy function.
-foreign import ccall safe "duckdb_copy_function_set_extra_info"
-    c_duckdb_copy_function_set_extra_info :: DuckDBCopyFunction -> Ptr () -> DuckDBDeleteCallback -> IO ()
-
--- | Register a copy function on a connection.
-foreign import ccall safe "duckdb_register_copy_function"
-    c_duckdb_register_copy_function :: DuckDBConnection -> DuckDBCopyFunction -> IO DuckDBState
-
--- | Destroy a copy-function object.
-foreign import ccall safe "duckdb_destroy_copy_function"
-    c_duckdb_destroy_copy_function :: Ptr DuckDBCopyFunction -> IO ()
-
--- | Set the bind callback for `COPY ... TO`.
-foreign import ccall safe "duckdb_copy_function_set_bind"
-    c_duckdb_copy_function_set_bind :: DuckDBCopyFunction -> DuckDBCopyFunctionBindFun -> IO ()
-
--- | Report a bind-phase error from a copy callback.
-foreign import ccall safe "duckdb_copy_function_bind_set_error"
-    c_duckdb_copy_function_bind_set_error :: DuckDBCopyFunctionBindInfo -> CString -> IO ()
-
--- | Fetch the copy function's extra info during bind.
-foreign import ccall safe "duckdb_copy_function_bind_get_extra_info"
-    c_duckdb_copy_function_bind_get_extra_info :: DuckDBCopyFunctionBindInfo -> IO (Ptr ())
-
--- | Fetch the current client context during bind.
-foreign import ccall safe "duckdb_copy_function_bind_get_client_context"
-    c_duckdb_copy_function_bind_get_client_context :: DuckDBCopyFunctionBindInfo -> IO DuckDBClientContext
-
--- | Fetch the number of columns supplied to `COPY ... TO`.
-foreign import ccall safe "duckdb_copy_function_bind_get_column_count"
-    c_duckdb_copy_function_bind_get_column_count :: DuckDBCopyFunctionBindInfo -> IO DuckDBIdx
-
--- | Fetch the logical type of a `COPY ... TO` output column.
-foreign import ccall safe "duckdb_copy_function_bind_get_column_type"
-    c_duckdb_copy_function_bind_get_column_type :: DuckDBCopyFunctionBindInfo -> DuckDBIdx -> IO DuckDBLogicalType
-
--- | Fetch the options struct supplied to `COPY ... TO`.
-foreign import ccall safe "duckdb_copy_function_bind_get_options"
-    c_duckdb_copy_function_bind_get_options :: DuckDBCopyFunctionBindInfo -> IO DuckDBValue
-
--- | Store bind-phase state for later copy callbacks.
-foreign import ccall safe "duckdb_copy_function_bind_set_bind_data"
-    c_duckdb_copy_function_bind_set_bind_data :: DuckDBCopyFunctionBindInfo -> Ptr () -> DuckDBDeleteCallback -> IO ()
-
--- | Set the global-init callback for `COPY ... TO`.
-foreign import ccall safe "duckdb_copy_function_set_global_init"
-    c_duckdb_copy_function_set_global_init :: DuckDBCopyFunction -> DuckDBCopyFunctionGlobalInitFun -> IO ()
-
--- | Report an init-phase error from a copy callback.
-foreign import ccall safe "duckdb_copy_function_global_init_set_error"
-    c_duckdb_copy_function_global_init_set_error :: DuckDBCopyFunctionGlobalInitInfo -> CString -> IO ()
-
--- | Fetch the copy function's extra info during global init.
-foreign import ccall safe "duckdb_copy_function_global_init_get_extra_info"
-    c_duckdb_copy_function_global_init_get_extra_info :: DuckDBCopyFunctionGlobalInitInfo -> IO (Ptr ())
-
--- | Fetch the current client context during global init.
-foreign import ccall safe "duckdb_copy_function_global_init_get_client_context"
-    c_duckdb_copy_function_global_init_get_client_context :: DuckDBCopyFunctionGlobalInitInfo -> IO DuckDBClientContext
-
--- | Fetch the bind-phase state during global init.
-foreign import ccall safe "duckdb_copy_function_global_init_get_bind_data"
-    c_duckdb_copy_function_global_init_get_bind_data :: DuckDBCopyFunctionGlobalInitInfo -> IO (Ptr ())
-
--- | Fetch the file path supplied to `COPY ... TO`.
-foreign import ccall safe "duckdb_copy_function_global_init_get_file_path"
-    c_duckdb_copy_function_global_init_get_file_path :: DuckDBCopyFunctionGlobalInitInfo -> IO CString
-
--- | Store global state for sink/finalize callbacks.
-foreign import ccall safe "duckdb_copy_function_global_init_set_global_state"
-    c_duckdb_copy_function_global_init_set_global_state :: DuckDBCopyFunctionGlobalInitInfo -> Ptr () -> DuckDBDeleteCallback -> IO ()
-
--- | Set the sink callback for `COPY ... TO`.
-foreign import ccall safe "duckdb_copy_function_set_sink"
-    c_duckdb_copy_function_set_sink :: DuckDBCopyFunction -> DuckDBCopyFunctionSinkFun -> IO ()
-
--- | Report a sink-phase error from a copy callback.
-foreign import ccall safe "duckdb_copy_function_sink_set_error"
-    c_duckdb_copy_function_sink_set_error :: DuckDBCopyFunctionSinkInfo -> CString -> IO ()
-
--- | Fetch the copy function's extra info during sink execution.
-foreign import ccall safe "duckdb_copy_function_sink_get_extra_info"
-    c_duckdb_copy_function_sink_get_extra_info :: DuckDBCopyFunctionSinkInfo -> IO (Ptr ())
-
--- | Fetch the current client context during sink execution.
-foreign import ccall safe "duckdb_copy_function_sink_get_client_context"
-    c_duckdb_copy_function_sink_get_client_context :: DuckDBCopyFunctionSinkInfo -> IO DuckDBClientContext
-
--- | Fetch bind-phase state during sink execution.
-foreign import ccall safe "duckdb_copy_function_sink_get_bind_data"
-    c_duckdb_copy_function_sink_get_bind_data :: DuckDBCopyFunctionSinkInfo -> IO (Ptr ())
-
--- | Fetch global-init state during sink execution.
-foreign import ccall safe "duckdb_copy_function_sink_get_global_state"
-    c_duckdb_copy_function_sink_get_global_state :: DuckDBCopyFunctionSinkInfo -> IO (Ptr ())
-
--- | Set the finalize callback for `COPY ... TO`.
-foreign import ccall safe "duckdb_copy_function_set_finalize"
-    c_duckdb_copy_function_set_finalize :: DuckDBCopyFunction -> DuckDBCopyFunctionFinalizeFun -> IO ()
-
--- | Report a finalize-phase error from a copy callback.
-foreign import ccall safe "duckdb_copy_function_finalize_set_error"
-    c_duckdb_copy_function_finalize_set_error :: DuckDBCopyFunctionFinalizeInfo -> CString -> IO ()
-
--- | Fetch the copy function's extra info during finalize.
-foreign import ccall safe "duckdb_copy_function_finalize_get_extra_info"
-    c_duckdb_copy_function_finalize_get_extra_info :: DuckDBCopyFunctionFinalizeInfo -> IO (Ptr ())
-
--- | Fetch the current client context during finalize.
-foreign import ccall safe "duckdb_copy_function_finalize_get_client_context"
-    c_duckdb_copy_function_finalize_get_client_context :: DuckDBCopyFunctionFinalizeInfo -> IO DuckDBClientContext
-
--- | Fetch bind-phase state during finalize.
-foreign import ccall safe "duckdb_copy_function_finalize_get_bind_data"
-    c_duckdb_copy_function_finalize_get_bind_data :: DuckDBCopyFunctionFinalizeInfo -> IO (Ptr ())
-
--- | Fetch global-init state during finalize.
-foreign import ccall safe "duckdb_copy_function_finalize_get_global_state"
-    c_duckdb_copy_function_finalize_get_global_state :: DuckDBCopyFunctionFinalizeInfo -> IO (Ptr ())
-
--- | Attach a table function used for `COPY ... FROM` with this format.
-foreign import ccall safe "duckdb_copy_function_set_copy_from_function"
-    c_duckdb_copy_function_set_copy_from_function :: DuckDBCopyFunction -> DuckDBTableFunction -> IO ()
diff --git a/src/Database/DuckDB/FFI/DataChunk.hs b/src/Database/DuckDB/FFI/DataChunk.hs
deleted file mode 100644
--- a/src/Database/DuckDB/FFI/DataChunk.hs
+++ /dev/null
@@ -1,86 +0,0 @@
-module Database.DuckDB.FFI.DataChunk (
-    c_duckdb_create_data_chunk,
-    c_duckdb_destroy_data_chunk,
-    c_duckdb_data_chunk_reset,
-    c_duckdb_data_chunk_get_column_count,
-    c_duckdb_data_chunk_get_vector,
-    c_duckdb_data_chunk_get_size,
-    c_duckdb_data_chunk_set_size,
-) where
-
-import Database.DuckDB.FFI.Types
-import Foreign.Ptr (Ptr)
-
-{- | Creates an empty data chunk with the specified column types. The result must
-be destroyed with @duckdb_destroy_data_chunk@.
-
-Parameters:
-* @types@: An array of column types. Column types can not contain ANY and
-  INVALID types.
-* @column_count@: The number of columns.
-
-Returns The data chunk.
--}
-foreign import ccall safe "duckdb_create_data_chunk"
-    c_duckdb_create_data_chunk :: Ptr DuckDBLogicalType -> DuckDBIdx -> IO DuckDBDataChunk
-
-{- | Destroys the data chunk and de-allocates all memory allocated for that chunk.
-
-Parameters:
-* @chunk@: The data chunk to destroy.
--}
-foreign import ccall safe "duckdb_destroy_data_chunk"
-    c_duckdb_destroy_data_chunk :: Ptr DuckDBDataChunk -> IO ()
-
-{- | Resets a data chunk, clearing the validity masks and setting the cardinality
-of the data chunk to 0. After calling this method, you must call
-@duckdb_vector_get_validity@ and @duckdb_vector_get_data@ to obtain current
-data and validity pointers
-
-Parameters:
-* @chunk@: The data chunk to reset.
--}
-foreign import ccall safe "duckdb_data_chunk_reset"
-    c_duckdb_data_chunk_reset :: DuckDBDataChunk -> IO ()
-
-{- | Retrieves the number of columns in a data chunk.
-
-Parameters:
-* @chunk@: The data chunk to get the data from
-
-Returns The number of columns in the data chunk
--}
-foreign import ccall safe "duckdb_data_chunk_get_column_count"
-    c_duckdb_data_chunk_get_column_count :: DuckDBDataChunk -> IO DuckDBIdx
-
-{- | Retrieves the vector at the specified column index in the data chunk.
-
-The pointer to the vector is valid for as long as the chunk is alive. It does
-NOT need to be destroyed.
-
-Parameters:
-* @chunk@: The data chunk to get the data from
-
-Returns The vector
--}
-foreign import ccall safe "duckdb_data_chunk_get_vector"
-    c_duckdb_data_chunk_get_vector :: DuckDBDataChunk -> DuckDBIdx -> IO DuckDBVector
-
-{- | Retrieves the current number of tuples in a data chunk.
-
-Parameters:
-* @chunk@: The data chunk to get the data from
-
-Returns The number of tuples in the data chunk
--}
-foreign import ccall safe "duckdb_data_chunk_get_size"
-    c_duckdb_data_chunk_get_size :: DuckDBDataChunk -> IO DuckDBIdx
-
-{- | Sets the current number of tuples in a data chunk.
-
-Parameters:
-* @chunk@: The data chunk to set the size in
-* @size@: The number of tuples in the data chunk
--}
-foreign import ccall safe "duckdb_data_chunk_set_size"
-    c_duckdb_data_chunk_set_size :: DuckDBDataChunk -> DuckDBIdx -> IO ()
diff --git a/src/Database/DuckDB/FFI/Deprecated.hs b/src/Database/DuckDB/FFI/Deprecated.hs
deleted file mode 100644
--- a/src/Database/DuckDB/FFI/Deprecated.hs
+++ /dev/null
@@ -1,30 +0,0 @@
-{-# OPTIONS_GHC -Wno-deprecations #-}
-
-{- |
-Module      : Database.DuckDB.FFI.Deprecated
-Description : Re-exports of deprecated DuckDB C API bindings.
-
-This module gathers bindings that DuckDB has marked with a deprecation notice
-so downstream code can opt-in to the legacy surface separately from the main
-@Database.DuckDB.FFI@ module.
--}
-module Database.DuckDB.FFI.Deprecated
-    {-# DEPRECATED "These DuckDB C APIs are deprecated upstream. Prefer Database.DuckDB.FFI and its nondeprecated modules." #-} (
-    module Database.DuckDB.FFI.Deprecated.Appender,
-    module Database.DuckDB.FFI.Deprecated.Arrow,
-    module Database.DuckDB.FFI.Deprecated.ExecutePrepared,
-    module Database.DuckDB.FFI.Deprecated.PendingResult,
-    module Database.DuckDB.FFI.Deprecated.QueryExecution,
-    module Database.DuckDB.FFI.Deprecated.ResultFunctions,
-    module Database.DuckDB.FFI.Deprecated.SafeFetch,
-    module Database.DuckDB.FFI.Deprecated.StreamingResult,
-) where
-
-import Database.DuckDB.FFI.Deprecated.Appender
-import Database.DuckDB.FFI.Deprecated.Arrow
-import Database.DuckDB.FFI.Deprecated.ExecutePrepared
-import Database.DuckDB.FFI.Deprecated.PendingResult
-import Database.DuckDB.FFI.Deprecated.QueryExecution
-import Database.DuckDB.FFI.Deprecated.ResultFunctions
-import Database.DuckDB.FFI.Deprecated.SafeFetch
-import Database.DuckDB.FFI.Deprecated.StreamingResult
diff --git a/src/Database/DuckDB/FFI/Deprecated/Appender.hs b/src/Database/DuckDB/FFI/Deprecated/Appender.hs
deleted file mode 100644
--- a/src/Database/DuckDB/FFI/Deprecated/Appender.hs
+++ /dev/null
@@ -1,24 +0,0 @@
-module Database.DuckDB.FFI.Deprecated.Appender
-    {-# DEPRECATED "These DuckDB C APIs are deprecated upstream. Prefer Database.DuckDB.FFI and its nondeprecated modules." #-} (
-    c_duckdb_appender_error,
-) where
-
-import Database.DuckDB.FFI.Types
-import Foreign.C.String (CString)
-
-{- | > Warning Deprecation notice. This method is scheduled for removal in a future
-release. Use duckdb_appender_error_data instead.
-
-Returns the error message associated with the appender. If the appender has no
-error message, this returns @nullptr@ instead.
-
-The error message should not be freed. It will be de-allocated when
-@duckdb_appender_destroy@ is called.
-
-Parameters:
-* @appender@: The appender to get the error from.
-
-Returns The error message, or @nullptr@ if there is none.
--}
-foreign import ccall "duckdb_appender_error"
-    c_duckdb_appender_error :: DuckDBAppender -> IO CString
diff --git a/src/Database/DuckDB/FFI/Deprecated/Arrow.hs b/src/Database/DuckDB/FFI/Deprecated/Arrow.hs
deleted file mode 100644
--- a/src/Database/DuckDB/FFI/Deprecated/Arrow.hs
+++ /dev/null
@@ -1,321 +0,0 @@
-module Database.DuckDB.FFI.Deprecated.Arrow
-    {-# DEPRECATED "These DuckDB C APIs are deprecated upstream. Prefer Database.DuckDB.FFI and its nondeprecated modules." #-} (
-    c_duckdb_query_arrow,
-    c_duckdb_query_arrow_schema,
-    c_duckdb_prepared_arrow_schema,
-    c_duckdb_result_arrow_array,
-    c_duckdb_query_arrow_array,
-    c_duckdb_arrow_column_count,
-    c_duckdb_arrow_row_count,
-    c_duckdb_arrow_rows_changed,
-    c_duckdb_query_arrow_error,
-    c_duckdb_destroy_arrow,
-    c_duckdb_destroy_arrow_stream,
-    c_duckdb_execute_prepared_arrow,
-    c_duckdb_arrow_scan,
-    c_duckdb_arrow_array_scan,
-    duckdbArrowSchemaInternal,
-    duckdbArrowSchemaClear,
-    duckdbArrowArrayInternal,
-    duckdbArrowArrayClear,
-    duckdbArrowStreamInternal,
-    duckdbArrowStreamClear,
-) where
-
-import Database.DuckDB.FFI.Types
-import Foreign.C.String (CString)
-import Foreign.C.Types (CInt (..))
-import Foreign.Ptr (Ptr, castPtr, nullPtr)
-
-{- | > Warning Deprecation notice. This method is scheduled for removal in a future
-release.
-
-Executes a SQL query within a connection and stores the full (materialized)
-result in an arrow structure. If the query fails to execute, DuckDBError is
-returned and the error message can be retrieved by calling
-@duckdb_query_arrow_error@.
-
-Note that after running @duckdb_query_arrow@, @duckdb_destroy_arrow@ must be
-called on the result object even if the query fails, otherwise the error
-stored within the result will not be freed correctly.
-
-Parameters:
-* @connection@: The connection to perform the query in.
-* @query@: The SQL query to run.
-* @out_result@: The query result.
-
-Returns @DuckDBSuccess@ on success or @DuckDBError@ on failure.
--}
-foreign import ccall safe "duckdb_query_arrow"
-    c_duckdb_query_arrow :: DuckDBConnection -> CString -> Ptr DuckDBArrow -> IO DuckDBState
-
-{- | > Warning Deprecation notice. This method is scheduled for removal in a future
-release.
-
-Fetch the internal arrow schema from the arrow result. Remember to call
-release on the respective ArrowSchema object.
-
-Parameters:
-* @result@: The result to fetch the schema from.
-* @out_schema@: The output schema.
-
-Returns @DuckDBSuccess@ on success or @DuckDBError@ on failure.
--}
-foreign import ccall safe "duckdb_query_arrow_schema"
-    c_duckdb_query_arrow_schema :: DuckDBArrow -> Ptr DuckDBArrowSchema -> IO DuckDBState
-
-{- | > Warning Deprecation notice. This method is scheduled for removal in a future
-release.
-
-Fetch the internal arrow schema from the prepared statement. Remember to call
-release on the respective ArrowSchema object.
-
-Parameters:
-* @prepared@: The prepared statement to fetch the schema from.
-* @out_schema@: The output schema.
-
-Returns @DuckDBSuccess@ on success or @DuckDBError@ on failure.
--}
-foreign import ccall safe "duckdb_prepared_arrow_schema"
-    c_duckdb_prepared_arrow_schema :: DuckDBPreparedStatement -> Ptr DuckDBArrowSchema -> IO DuckDBState
-
-{- | > Warning Deprecation notice. This method is scheduled for removal in a future
-release.
-
-Convert a data chunk into an arrow struct array. Remember to call release on
-the respective ArrowArray object.
-
-Parameters:
-* @result@: The result object the data chunk have been fetched from.
-* @chunk@: The data chunk to convert.
-* @out_array@: The output array.
-
-These bindings call the wrapper symbol
-@wrapped_duckdb_result_arrow_array@ but mirror the DuckDB C API semantics of
-@duckdb_result_arrow_array@.
--}
-foreign import ccall safe "wrapped_duckdb_result_arrow_array"
-    c_duckdb_result_arrow_array :: Ptr DuckDBResult -> DuckDBDataChunk -> Ptr DuckDBArrowArray -> IO ()
-
-{- | > Warning Deprecation notice. This method is scheduled for removal in a future
-release.
-
-Fetch an internal arrow struct array from the arrow result. Remember to call
-release on the respective ArrowArray object.
-
-This function can be called multiple time to get next chunks, which will free
-the previous out_array. So consume the out_array before calling this function
-again.
-
-Parameters:
-* @result@: The result to fetch the array from.
-* @out_array@: The output array.
-
-Returns @DuckDBSuccess@ on success or @DuckDBError@ on failure.
--}
-foreign import ccall safe "duckdb_query_arrow_array"
-    c_duckdb_query_arrow_array :: DuckDBArrow -> Ptr DuckDBArrowArray -> IO DuckDBState
-
-{- | > Warning Deprecation notice. This method is scheduled for removal in a future
-release.
-
-Returns the number of columns present in the arrow result object.
-
-Parameters:
-* @result@: The result object.
-
-Returns The number of columns present in the result object.
--}
-foreign import ccall safe "duckdb_arrow_column_count"
-    c_duckdb_arrow_column_count :: DuckDBArrow -> IO DuckDBIdx
-
-{- | > Warning Deprecation notice. This method is scheduled for removal in a future
-release.
-
-Returns the number of rows present in the arrow result object.
-
-Parameters:
-* @result@: The result object.
-
-Returns The number of rows present in the result object.
--}
-foreign import ccall safe "duckdb_arrow_row_count"
-    c_duckdb_arrow_row_count :: DuckDBArrow -> IO DuckDBIdx
-
-{- | > Warning Deprecation notice. This method is scheduled for removal in a future
-release.
-
-Returns the number of rows changed by the query stored in the arrow result.
-This is relevant only for INSERT/UPDATE/DELETE queries. For other queries the
-rows_changed will be 0.
-
-Parameters:
-* @result@: The result object.
-
-Returns The number of rows changed.
--}
-foreign import ccall safe "duckdb_arrow_rows_changed"
-    c_duckdb_arrow_rows_changed :: DuckDBArrow -> IO DuckDBIdx
-
-{- | > Warning Deprecation notice. This method is scheduled for removal in a future
-release.
-
-Returns the error message contained within the result. The error is only set
-if @duckdb_query_arrow@ returns @DuckDBError@.
-
-The error message should not be freed. It will be de-allocated when
-@duckdb_destroy_arrow@ is called.
-
-Parameters:
-* @result@: The result object to fetch the error from.
-
-Returns The error of the result.
--}
-foreign import ccall safe "duckdb_query_arrow_error"
-    c_duckdb_query_arrow_error :: DuckDBArrow -> IO CString
-
-{- | > Warning Deprecation notice. This method is scheduled for removal in a future
-release.
-
-Closes the result and de-allocates all memory allocated for the arrow result.
-
-Parameters:
-* @result@: The result to destroy.
--}
-foreign import ccall safe "duckdb_destroy_arrow"
-    c_duckdb_destroy_arrow :: Ptr DuckDBArrow -> IO ()
-
-{- | > Warning Deprecation notice. This method is scheduled for removal in a future
-release.
-
-Releases the arrow array stream and de-allocates its memory.
-
-Parameters:
-* @stream_p@: The arrow array stream to destroy.
--}
-foreign import ccall safe "duckdb_destroy_arrow_stream"
-    c_duckdb_destroy_arrow_stream :: Ptr DuckDBArrowStream -> IO ()
-
-{- | > Warning Deprecation notice. This method is scheduled for removal in a future
-release.
-
-Executes the prepared statement with the given bound parameters, and returns
-an arrow query result. Note that after running
-@duckdb_execute_prepared_arrow@, @duckdb_destroy_arrow@ must be called on the
-result object.
-
-Parameters:
-* @prepared_statement@: The prepared statement to execute.
-* @out_result@: The query result.
-
-Returns @DuckDBSuccess@ on success or @DuckDBError@ on failure.
--}
-foreign import ccall safe "duckdb_execute_prepared_arrow"
-    c_duckdb_execute_prepared_arrow :: DuckDBPreparedStatement -> Ptr DuckDBArrow -> IO DuckDBState
-
-{- | > Warning Deprecation notice. This method is scheduled for removal in a future
-release.
-
-Scans the Arrow stream and creates a view with the given name.
-
-Parameters:
-* @connection@: The connection on which to execute the scan.
-* @table_name@: Name of the temporary view to create.
-* @arrow@: Arrow stream wrapper.
-
-Returns @DuckDBSuccess@ on success or @DuckDBError@ on failure.
--}
-foreign import ccall safe "duckdb_arrow_scan"
-    c_duckdb_arrow_scan :: DuckDBConnection -> CString -> DuckDBArrowStream -> IO DuckDBState
-
-{- | > Warning Deprecation notice. This method is scheduled for removal in a future
-release.
-
-Scans the Arrow array and creates a view with the given name. Note that after
-running @duckdb_arrow_array_scan@, @duckdb_destroy_arrow_stream@ must be
-called on the out stream.
-
-Parameters:
-* @connection@: The connection on which to execute the scan.
-* @table_name@: Name of the temporary view to create.
-* @arrow_schema@: Arrow schema wrapper.
-* @arrow_array@: Arrow array wrapper.
-* @out_stream@: Output array stream that wraps around the passed schema, for
-  releasing/deleting once done.
-
-Returns @DuckDBSuccess@ on success or @DuckDBError@ on failure.
--}
-foreign import ccall safe "duckdb_arrow_array_scan"
-    c_duckdb_arrow_array_scan :: DuckDBConnection -> CString -> DuckDBArrowSchema -> DuckDBArrowArray -> Ptr DuckDBArrowStream -> IO DuckDBState
-
-foreign import ccall safe "wrapped_duckdb_arrow_schema_internal_ptr"
-    c_duckdb_arrow_schema_internal_ptr :: DuckDBArrowSchema -> IO (Ptr ())
-
-foreign import ccall safe "wrapped_duckdb_arrow_schema_clear_internal_ptr"
-    c_duckdb_arrow_schema_clear_internal_ptr :: DuckDBArrowSchema -> IO ()
-
-foreign import ccall safe "wrapped_duckdb_arrow_array_internal_ptr"
-    c_duckdb_arrow_array_internal_ptr :: DuckDBArrowArray -> IO (Ptr ())
-
-foreign import ccall safe "wrapped_duckdb_arrow_array_clear_internal_ptr"
-    c_duckdb_arrow_array_clear_internal_ptr :: DuckDBArrowArray -> IO ()
-
-foreign import ccall safe "wrapped_duckdb_arrow_stream_internal_ptr"
-    c_duckdb_arrow_stream_internal_ptr :: DuckDBArrowStream -> IO (Ptr ())
-
-foreign import ccall safe "wrapped_duckdb_arrow_stream_clear_internal_ptr"
-    c_duckdb_arrow_stream_clear_internal_ptr :: DuckDBArrowStream -> IO ()
-
-{- | Return the Arrow schema address for a deprecated DuckDB handle.
-Returns 'Nothing' when the handle is null or its release callback is null.
--}
-duckdbArrowSchemaInternal :: DuckDBArrowSchema -> IO (Maybe ArrowSchemaPtr)
-duckdbArrowSchemaInternal schema = do
-    raw <- c_duckdb_arrow_schema_internal_ptr schema
-    pure $
-        if raw == nullPtr
-            then Nothing
-            else Just (ArrowSchemaPtr (castPtr raw))
-
-{- | Set the Arrow schema release callback to null after a shallow copy.
-The destination owns the buffers and must call its release callback.
-This function does not release buffers or change other fields.
--}
-duckdbArrowSchemaClear :: DuckDBArrowSchema -> IO ()
-duckdbArrowSchemaClear = c_duckdb_arrow_schema_clear_internal_ptr
-
-{- | Return the Arrow array address for a deprecated DuckDB handle.
-Returns 'Nothing' when the handle is null or its release callback is null.
--}
-duckdbArrowArrayInternal :: DuckDBArrowArray -> IO (Maybe ArrowArrayPtr)
-duckdbArrowArrayInternal array = do
-    raw <- c_duckdb_arrow_array_internal_ptr array
-    pure $
-        if raw == nullPtr
-            then Nothing
-            else Just (ArrowArrayPtr (castPtr raw))
-
-{- | Set the Arrow array release callback to null after a shallow copy.
-The destination owns the buffers and must call its release callback.
-This function does not release buffers or change other fields.
--}
-duckdbArrowArrayClear :: DuckDBArrowArray -> IO ()
-duckdbArrowArrayClear = c_duckdb_arrow_array_clear_internal_ptr
-
-{- | Return the Arrow stream address for a deprecated DuckDB handle.
-Returns 'Nothing' when the handle is null or its release callback is null.
--}
-duckdbArrowStreamInternal :: DuckDBArrowStream -> IO (Maybe ArrowStreamPtr)
-duckdbArrowStreamInternal stream = do
-    raw <- c_duckdb_arrow_stream_internal_ptr stream
-    pure $
-        if raw == nullPtr
-            then Nothing
-            else Just (ArrowStreamPtr raw)
-
-{- | Set the Arrow stream release callback to null after a shallow copy.
-The destination owns the buffers and must call its release callback.
-This function does not release buffers or change other fields.
--}
-duckdbArrowStreamClear :: DuckDBArrowStream -> IO ()
-duckdbArrowStreamClear = c_duckdb_arrow_stream_clear_internal_ptr
diff --git a/src/Database/DuckDB/FFI/Deprecated/ExecutePrepared.hs b/src/Database/DuckDB/FFI/Deprecated/ExecutePrepared.hs
deleted file mode 100644
--- a/src/Database/DuckDB/FFI/Deprecated/ExecutePrepared.hs
+++ /dev/null
@@ -1,29 +0,0 @@
-module Database.DuckDB.FFI.Deprecated.ExecutePrepared
-    {-# DEPRECATED "These DuckDB C APIs are deprecated upstream. Prefer Database.DuckDB.FFI and its nondeprecated modules." #-} (
-    c_duckdb_execute_prepared_streaming,
-) where
-
-import Database.DuckDB.FFI.Types
-import Foreign.C.Types (CInt (..))
-import Foreign.Ptr (Ptr)
-
-{- | > Warning Deprecation notice. This method is scheduled for removal in a future
-release.
-
-Executes the prepared statement with the given bound parameters, and returns
-an optionally-streaming query result. To determine if the resulting query was
-in fact streamed, use @duckdb_result_is_streaming@
-
-This method can be called multiple times for each prepared statement, and the
-parameters can be modified between calls to this function.
-
-Note that the result must be freed with @duckdb_destroy_result@.
-
-Parameters:
-* @prepared_statement@: The prepared statement to execute.
-* @out_result@: The query result.
-
-Returns @DuckDBSuccess@ on success or @DuckDBError@ on failure.
--}
-foreign import ccall "duckdb_execute_prepared_streaming"
-    c_duckdb_execute_prepared_streaming :: DuckDBPreparedStatement -> Ptr DuckDBResult -> IO DuckDBState
diff --git a/src/Database/DuckDB/FFI/Deprecated/PendingResult.hs b/src/Database/DuckDB/FFI/Deprecated/PendingResult.hs
deleted file mode 100644
--- a/src/Database/DuckDB/FFI/Deprecated/PendingResult.hs
+++ /dev/null
@@ -1,29 +0,0 @@
-module Database.DuckDB.FFI.Deprecated.PendingResult
-    {-# DEPRECATED "These DuckDB C APIs are deprecated upstream. Prefer Database.DuckDB.FFI and its nondeprecated modules." #-} (
-    c_duckdb_pending_prepared_streaming,
-) where
-
-import Database.DuckDB.FFI.Types
-import Foreign.C.Types (CInt (..))
-import Foreign.Ptr (Ptr)
-
-{- | > Warning Deprecation notice. This method is scheduled for removal in a future
-release.
-
-Executes the prepared statement with the given bound parameters, and returns a
-pending result. This pending result will create a streaming duckdb_result when
-executed. The pending result represents an intermediate structure for a query
-that is not yet fully executed.
-
-Note that after calling @duckdb_pending_prepared_streaming@, the pending
-result should always be destroyed using @duckdb_destroy_pending@, even if this
-function returns DuckDBError.
-
-Parameters:
-* @prepared_statement@: The prepared statement to execute.
-* @out_result@: The pending query result.
-
-Returns @DuckDBSuccess@ on success or @DuckDBError@ on failure.
--}
-foreign import ccall "duckdb_pending_prepared_streaming"
-    c_duckdb_pending_prepared_streaming :: DuckDBPreparedStatement -> Ptr DuckDBPendingResult -> IO DuckDBState
diff --git a/src/Database/DuckDB/FFI/Deprecated/QueryExecution.hs b/src/Database/DuckDB/FFI/Deprecated/QueryExecution.hs
deleted file mode 100644
--- a/src/Database/DuckDB/FFI/Deprecated/QueryExecution.hs
+++ /dev/null
@@ -1,70 +0,0 @@
-module Database.DuckDB.FFI.Deprecated.QueryExecution
-    {-# DEPRECATED "These DuckDB C APIs are deprecated upstream. Prefer Database.DuckDB.FFI and its nondeprecated modules." #-} (
-    c_duckdb_column_data,
-    c_duckdb_nullmask_data,
-    c_duckdb_row_count,
-) where
-
-import Database.DuckDB.FFI.Types
-import Foreign.C.Types (CBool (..))
-import Foreign.Ptr (Ptr)
-
-{- | > Deprecated This method has been deprecated. Prefer using
-@duckdb_result_get_chunk@ instead.
-
-Returns the data of a specific column of a result in columnar format.
-
-The function returns a dense array which contains the result data. The exact
-type stored in the array depends on the corresponding duckdb_type (as provided
-by @duckdb_column_type@). For the exact type by which the data should be
-accessed, see the comments in [the types section](types) or the @DUCKDB_TYPE@
-enum.
-
-For example, for a column of type @DUCKDB_TYPE_INTEGER@, rows can be accessed
-in the following manner: ``@c int32_t *data = (int32_t *)
-duckdb_column_data(&result, 0); printf("Data for row %d: %d\n", row,
-data[row]); @``
-
-Parameters:
-* @result@: The result object to fetch the column data from.
-* @col@: The column index.
-
-Returns The column data of the specified column.
--}
-foreign import ccall safe "duckdb_column_data"
-    c_duckdb_column_data :: Ptr DuckDBResult -> DuckDBIdx -> IO (Ptr ())
-
-{- | > Deprecated This method has been deprecated. Prefer using
-@duckdb_result_get_chunk@ instead.
-
-Returns the nullmask of a specific column of a result in columnar format. The
-nullmask indicates for every row whether or not the corresponding row is
-@NULL@. If a row is @NULL@, the values present in the array provided by
-@duckdb_column_data@ are undefined.
-
-``@c int32_t *data = (int32_t *) duckdb_column_data(&result, 0); bool
-*nullmask = duckdb_nullmask_data(&result, 0); if (nullmask[row]) {
-printf("Data for row %d: NULL\n", row); } else { printf("Data for row %d:
-%d\n", row, data[row]); } @``
-
-Parameters:
-* @result@: The result object to fetch the nullmask from.
-* @col@: The column index.
-
-Returns The nullmask of the specified column.
--}
-foreign import ccall safe "duckdb_nullmask_data"
-    c_duckdb_nullmask_data :: Ptr DuckDBResult -> DuckDBIdx -> IO (Ptr CBool)
-
-{- | > Warning Deprecation notice. This method is scheduled for removal in a future
-release.
-
-Returns the number of rows present in the result object.
-
-Parameters:
-* @result@: The result object.
-
-Returns The number of rows present in the result object.
--}
-foreign import ccall safe "duckdb_row_count"
-    c_duckdb_row_count :: Ptr DuckDBResult -> IO DuckDBIdx
diff --git a/src/Database/DuckDB/FFI/Deprecated/ResultFunctions.hs b/src/Database/DuckDB/FFI/Deprecated/ResultFunctions.hs
deleted file mode 100644
--- a/src/Database/DuckDB/FFI/Deprecated/ResultFunctions.hs
+++ /dev/null
@@ -1,77 +0,0 @@
-module Database.DuckDB.FFI.Deprecated.ResultFunctions
-    {-# DEPRECATED "These DuckDB C APIs are deprecated upstream. Prefer Database.DuckDB.FFI and its nondeprecated modules." #-} (
-    c_duckdb_result_get_chunk,
-    c_duckdb_result_is_streaming,
-    c_duckdb_result_chunk_count,
-) where
-
-import Database.DuckDB.FFI.Types
-import Foreign.C.Types (CBool (..))
-import Foreign.Ptr (Ptr)
-
-{- | > Warning Deprecation notice. This method is scheduled for removal in a future
-release.
-
-Fetches a data chunk from the duckdb_result. This function should be called
-repeatedly until the result is exhausted.
-
-The result must be destroyed with @duckdb_destroy_data_chunk@.
-
-This function supersedes all @duckdb_value@ functions, as well as the
-@duckdb_column_data@ and @duckdb_nullmask_data@ functions. It results in
-significantly better performance, and should be preferred in newer code-bases.
-
-If this function is used, none of the other result functions can be used and
-vice versa (i.e., this function cannot be mixed with the legacy result
-functions).
-
-Use @duckdb_result_chunk_count@ to figure out how many chunks there are in the
-result.
-
-Parameters:
-* @result@: The result object to fetch the data chunk from.
-* @chunk_index@: The chunk index to fetch from.
-
-Returns The resulting data chunk. Returns @NULL@ if the chunk index is out of
-bounds.
-
-These bindings call the wrapper symbol
-@wrapped_duckdb_result_get_chunk@ but mirror the DuckDB C API semantics of
-@duckdb_result_get_chunk@.
--}
-foreign import ccall safe "wrapped_duckdb_result_get_chunk"
-    c_duckdb_result_get_chunk :: Ptr DuckDBResult -> DuckDBIdx -> IO DuckDBDataChunk
-
-{- | > Warning Deprecation notice. This method is scheduled for removal in a future
-release.
-
-Checks if the type of the internal result is StreamQueryResult.
-
-Parameters:
-* @result@: The result object to check.
-
-Returns Whether or not the result object is of the type StreamQueryResult
-
-These bindings call the wrapper symbol
-@wrapped_duckdb_result_is_streaming@ but mirror the DuckDB C API semantics of
-@duckdb_result_is_streaming@.
--}
-foreign import ccall safe "wrapped_duckdb_result_is_streaming"
-    c_duckdb_result_is_streaming :: Ptr DuckDBResult -> IO CBool
-
-{- | > Warning Deprecation notice. This method is scheduled for removal in a future
-release.
-
-Returns the number of data chunks present in the result.
-
-Parameters:
-* @result@: The result object
-
-Returns Number of data chunks present in the result.
-
-These bindings call the wrapper symbol
-@wrapped_duckdb_result_chunk_count@ but mirror the DuckDB C API semantics of
-@duckdb_result_chunk_count@.
--}
-foreign import ccall safe "wrapped_duckdb_result_chunk_count"
-    c_duckdb_result_chunk_count :: Ptr DuckDBResult -> IO DuckDBIdx
diff --git a/src/Database/DuckDB/FFI/Deprecated/SafeFetch.hs b/src/Database/DuckDB/FFI/Deprecated/SafeFetch.hs
deleted file mode 100644
--- a/src/Database/DuckDB/FFI/Deprecated/SafeFetch.hs
+++ /dev/null
@@ -1,281 +0,0 @@
-module Database.DuckDB.FFI.Deprecated.SafeFetch
-    {-# DEPRECATED "These DuckDB C APIs are deprecated upstream. Prefer Database.DuckDB.FFI and its nondeprecated modules." #-} (
-    c_duckdb_value_boolean,
-    c_duckdb_value_int8,
-    c_duckdb_value_int16,
-    c_duckdb_value_int32,
-    c_duckdb_value_int64,
-    c_duckdb_value_hugeint,
-    c_duckdb_value_uhugeint,
-    c_duckdb_value_decimal,
-    c_duckdb_value_uint8,
-    c_duckdb_value_uint16,
-    c_duckdb_value_uint32,
-    c_duckdb_value_uint64,
-    c_duckdb_value_float,
-    c_duckdb_value_double,
-    c_duckdb_value_date,
-    c_duckdb_value_time,
-    c_duckdb_value_timestamp,
-    c_duckdb_value_interval,
-    c_duckdb_value_string,
-    c_duckdb_value_blob,
-    c_duckdb_value_is_null,
-    c_duckdb_value_varchar,
-    c_duckdb_value_varchar_internal,
-    c_duckdb_value_string_internal,
-) where
-
-import Data.Int (Int16, Int32, Int64, Int8)
-import Data.Word (Word16, Word32, Word64, Word8)
-import Database.DuckDB.FFI.Types
-import Foreign.C.String (CString)
-import Foreign.C.Types (CBool (..), CDouble (..), CFloat (..))
-import Foreign.Ptr (Ptr)
-
-{- | > Warning Deprecation notice. This method is scheduled for removal in a future
-release.
-
-Returns The boolean value at the specified location, or false if the value
-cannot be converted.
--}
-foreign import ccall safe "duckdb_value_boolean"
-    c_duckdb_value_boolean :: Ptr DuckDBResult -> DuckDBIdx -> DuckDBIdx -> IO CBool
-
-{- | > Warning Deprecation notice. This method is scheduled for removal in a future
-release.
-
-Returns The int8_t value at the specified location, or 0 if the value cannot
-be converted.
--}
-foreign import ccall safe "duckdb_value_int8"
-    c_duckdb_value_int8 :: Ptr DuckDBResult -> DuckDBIdx -> DuckDBIdx -> IO Int8
-
-{- | > Warning Deprecation notice. This method is scheduled for removal in a future
-release.
-
-Returns The int16_t value at the specified location, or 0 if the value cannot
-be converted.
--}
-foreign import ccall safe "duckdb_value_int16"
-    c_duckdb_value_int16 :: Ptr DuckDBResult -> DuckDBIdx -> DuckDBIdx -> IO Int16
-
-{- | > Warning Deprecation notice. This method is scheduled for removal in a future
-release.
-
-Returns The int32_t value at the specified location, or 0 if the value cannot
-be converted.
--}
-foreign import ccall safe "duckdb_value_int32"
-    c_duckdb_value_int32 :: Ptr DuckDBResult -> DuckDBIdx -> DuckDBIdx -> IO Int32
-
-{- | > Warning Deprecation notice. This method is scheduled for removal in a future
-release.
-
-Returns The int64_t value at the specified location, or 0 if the value cannot
-be converted.
--}
-foreign import ccall safe "duckdb_value_int64"
-    c_duckdb_value_int64 :: Ptr DuckDBResult -> DuckDBIdx -> DuckDBIdx -> IO Int64
-
-{- | > Warning Deprecation notice. This method is scheduled for removal in a future
-release.
-
-Returns The duckdb_hugeint value at the specified location, or 0 if the value
-cannot be converted.
-
-These bindings call the wrapper symbol @wrapped_duckdb_value_hugeint@
-but mirror the DuckDB C API semantics of @duckdb_value_hugeint@.
--}
-foreign import ccall safe "wrapped_duckdb_value_hugeint"
-    c_duckdb_value_hugeint :: Ptr DuckDBResult -> DuckDBIdx -> DuckDBIdx -> Ptr DuckDBHugeInt -> IO ()
-
-{- | > Warning Deprecation notice. This method is scheduled for removal in a future
-release.
-
-Returns The duckdb_uhugeint value at the specified location, or 0 if the value
-cannot be converted.
-
-These bindings call the wrapper symbol @wrapped_duckdb_value_uhugeint@
-but mirror the DuckDB C API semantics of @duckdb_value_uhugeint@.
--}
-foreign import ccall safe "wrapped_duckdb_value_uhugeint"
-    c_duckdb_value_uhugeint :: Ptr DuckDBResult -> DuckDBIdx -> DuckDBIdx -> Ptr DuckDBUHugeInt -> IO ()
-
-{- | > Warning Deprecation notice. This method is scheduled for removal in a future
-release.
-
-Returns The duckdb_decimal value at the specified location, or 0 if the value
-cannot be converted.
-
-These bindings call the wrapper symbol @wrapped_duckdb_value_decimal@
-but mirror the DuckDB C API semantics of @duckdb_value_decimal@.
--}
-foreign import ccall safe "wrapped_duckdb_value_decimal"
-    c_duckdb_value_decimal :: Ptr DuckDBResult -> DuckDBIdx -> DuckDBIdx -> Ptr DuckDBDecimal -> IO ()
-
-{- | > Warning Deprecation notice. This method is scheduled for removal in a future
-release.
-
-Returns The uint8_t value at the specified location, or 0 if the value cannot
-be converted.
--}
-foreign import ccall safe "duckdb_value_uint8"
-    c_duckdb_value_uint8 :: Ptr DuckDBResult -> DuckDBIdx -> DuckDBIdx -> IO Word8
-
-{- | > Warning Deprecation notice. This method is scheduled for removal in a future
-release.
-
-Returns The uint16_t value at the specified location, or 0 if the value cannot
-be converted.
--}
-foreign import ccall safe "duckdb_value_uint16"
-    c_duckdb_value_uint16 :: Ptr DuckDBResult -> DuckDBIdx -> DuckDBIdx -> IO Word16
-
-{- | > Warning Deprecation notice. This method is scheduled for removal in a future
-release.
-
-Returns The uint32_t value at the specified location, or 0 if the value cannot
-be converted.
--}
-foreign import ccall safe "duckdb_value_uint32"
-    c_duckdb_value_uint32 :: Ptr DuckDBResult -> DuckDBIdx -> DuckDBIdx -> IO Word32
-
-{- | > Warning Deprecation notice. This method is scheduled for removal in a future
-release.
-
-Returns The uint64_t value at the specified location, or 0 if the value cannot
-be converted.
--}
-foreign import ccall safe "duckdb_value_uint64"
-    c_duckdb_value_uint64 :: Ptr DuckDBResult -> DuckDBIdx -> DuckDBIdx -> IO Word64
-
-{- | > Warning Deprecation notice. This method is scheduled for removal in a future
-release.
-
-Returns The float value at the specified location, or 0 if the value cannot be
-converted.
--}
-foreign import ccall safe "duckdb_value_float"
-    c_duckdb_value_float :: Ptr DuckDBResult -> DuckDBIdx -> DuckDBIdx -> IO CFloat
-
-{- | > Warning Deprecation notice. This method is scheduled for removal in a future
-release.
-
-Returns The double value at the specified location, or 0 if the value cannot
-be converted.
--}
-foreign import ccall safe "duckdb_value_double"
-    c_duckdb_value_double :: Ptr DuckDBResult -> DuckDBIdx -> DuckDBIdx -> IO CDouble
-
-{- | > Warning Deprecation notice. This method is scheduled for removal in a future
-release.
-
-Returns The duckdb_date value at the specified location, or 0 if the value
-cannot be converted.
--}
-foreign import ccall safe "wrapped_duckdb_value_date"
-    c_duckdb_value_date :: Ptr DuckDBResult -> DuckDBIdx -> DuckDBIdx -> IO DuckDBDate
-
-{- | > Warning Deprecation notice. This method is scheduled for removal in a future
-release.
-
-Returns The duckdb_time value at the specified location, or 0 if the value
-cannot be converted.
--}
-foreign import ccall safe "wrapped_duckdb_value_time"
-    c_duckdb_value_time :: Ptr DuckDBResult -> DuckDBIdx -> DuckDBIdx -> IO DuckDBTime
-
-{- | > Warning Deprecation notice. This method is scheduled for removal in a future
-release.
-
-Returns The duckdb_timestamp value at the specified location, or 0 if the
-value cannot be converted.
--}
-foreign import ccall safe "wrapped_duckdb_value_timestamp"
-    c_duckdb_value_timestamp :: Ptr DuckDBResult -> DuckDBIdx -> DuckDBIdx -> IO DuckDBTimestamp
-
-{- | > Warning Deprecation notice. This method is scheduled for removal in a future
-release.
-
-Returns The duckdb_interval value at the specified location, or 0 if the value
-cannot be converted.
-
-These bindings call the wrapper symbol @wrapped_duckdb_value_interval@
-but mirror the DuckDB C API semantics of @duckdb_value_interval@.
--}
-foreign import ccall safe "wrapped_duckdb_value_interval"
-    c_duckdb_value_interval :: Ptr DuckDBResult -> DuckDBIdx -> DuckDBIdx -> Ptr DuckDBInterval -> IO ()
-
-{- | > Warning Deprecation notice. This method is scheduled for removal in a future
-release.
-
-No support for nested types, and for other complex types. The resulting field
-"string.data" must be freed with @duckdb_free.@
-
-Returns The string value at the specified location. Attempts to cast the
-result value to string.
-
-These bindings call the wrapper symbol @wrapped_duckdb_value_string@
-but mirror the DuckDB C API semantics of @duckdb_value_string@.
--}
-foreign import ccall safe "wrapped_duckdb_value_string"
-    c_duckdb_value_string :: Ptr DuckDBResult -> DuckDBIdx -> DuckDBIdx -> Ptr DuckDBString -> IO ()
-
-{- | > Warning Deprecation notice. This method is scheduled for removal in a future
-release.
-
-Returns The duckdb_blob value at the specified location. Returns a blob with
-blob.data set to nullptr if the value cannot be converted. The resulting field
-"blob.data" must be freed with @duckdb_free.@
-
-These bindings call the wrapper symbol @wrapped_duckdb_value_blob@ but
-mirror the DuckDB C API semantics of @duckdb_value_blob@.
--}
-foreign import ccall safe "wrapped_duckdb_value_blob"
-    c_duckdb_value_blob :: Ptr DuckDBResult -> DuckDBIdx -> DuckDBIdx -> Ptr DuckDBBlob -> IO ()
-
-{- | > Warning Deprecation notice. This method is scheduled for removal in a future
-release.
-
-Returns Returns true if the value at the specified index is NULL, and false
-otherwise.
--}
-foreign import ccall safe "duckdb_value_is_null"
-    c_duckdb_value_is_null :: Ptr DuckDBResult -> DuckDBIdx -> DuckDBIdx -> IO CBool
-
-{- | > Deprecated This method has been deprecated. Use duckdb_value_string instead.
-This function does not work correctly if the string contains null bytes.
-
-Returns The text value at the specified location as a null-terminated string,
-or nullptr if the value cannot be converted. The result must be freed with
-@duckdb_free@.
--}
-foreign import ccall safe "duckdb_value_varchar"
-    c_duckdb_value_varchar :: Ptr DuckDBResult -> DuckDBIdx -> DuckDBIdx -> IO CString
-
-{- | > Deprecated This method has been deprecated. Use duckdb_value_string_internal
-instead. This function does not work correctly if the string contains null
-bytes.
-
-Returns The char* value at the specified location. ONLY works on VARCHAR
-columns and does not auto-cast. If the column is NOT a VARCHAR column this
-function will return NULL. The result must NOT be freed.
--}
-foreign import ccall safe "duckdb_value_varchar_internal"
-    c_duckdb_value_varchar_internal :: Ptr DuckDBResult -> DuckDBIdx -> DuckDBIdx -> IO CString
-
-{- | > Deprecated This method has been deprecated. Use duckdb_value_string_internal
-instead. This function does not work correctly if the string contains null
-bytes.
-
-Returns The char* value at the specified location. ONLY works on VARCHAR
-columns and does not auto-cast. If the column is NOT a VARCHAR column this
-function will return NULL. The result must NOT be freed.
-
-These bindings call the wrapper symbol
-@wrapped_duckdb_value_string_internal@ but mirror the DuckDB C API semantics of
-@duckdb_value_string_internal@.
--}
-foreign import ccall safe "wrapped_duckdb_value_string_internal"
-    c_duckdb_value_string_internal :: Ptr DuckDBResult -> DuckDBIdx -> DuckDBIdx -> Ptr DuckDBString -> IO ()
diff --git a/src/Database/DuckDB/FFI/Deprecated/StreamingResult.hs b/src/Database/DuckDB/FFI/Deprecated/StreamingResult.hs
deleted file mode 100644
--- a/src/Database/DuckDB/FFI/Deprecated/StreamingResult.hs
+++ /dev/null
@@ -1,36 +0,0 @@
-module Database.DuckDB.FFI.Deprecated.StreamingResult
-    {-# DEPRECATED "These DuckDB C APIs are deprecated upstream. Prefer Database.DuckDB.FFI and its nondeprecated modules." #-} (
-    c_duckdb_stream_fetch_chunk,
-) where
-
-import Database.DuckDB.FFI.Types
-import Foreign.Ptr (Ptr)
-
-{- | > Warning Deprecation notice. This method is scheduled for removal in a future
-release.
-
-Fetches a data chunk from the (streaming) duckdb_result. This function should
-be called repeatedly until the result is exhausted.
-
-The result must be destroyed with @duckdb_destroy_data_chunk@.
-
-This function can only be used on duckdb_results created with
-@duckdb_pending_prepared_streaming@
-
-If this function is used, none of the other result functions can be used and
-vice versa (i.e., this function cannot be mixed with the legacy result
-functions or the materialized result functions).
-
-It is not known beforehand how many chunks will be returned by this result.
-
-Parameters:
-* @result@: The result object to fetch the data chunk from.
-
-Returns The resulting data chunk. Returns @NULL@ if the result has an error.
-
-These bindings call the wrapper symbol
-@wrapped_duckdb_stream_fetch_chunk@ but mirror the DuckDB C API semantics of
-@duckdb_stream_fetch_chunk@.
--}
-foreign import ccall safe "wrapped_duckdb_stream_fetch_chunk"
-    c_duckdb_stream_fetch_chunk :: Ptr DuckDBResult -> IO DuckDBDataChunk
diff --git a/src/Database/DuckDB/FFI/ErrorData.hs b/src/Database/DuckDB/FFI/ErrorData.hs
deleted file mode 100644
--- a/src/Database/DuckDB/FFI/ErrorData.hs
+++ /dev/null
@@ -1,61 +0,0 @@
-module Database.DuckDB.FFI.ErrorData (
-    c_duckdb_create_error_data,
-    c_duckdb_destroy_error_data,
-    c_duckdb_error_data_error_type,
-    c_duckdb_error_data_message,
-    c_duckdb_error_data_has_error,
-) where
-
-import Database.DuckDB.FFI.Types
-import Foreign.C.String (CString)
-import Foreign.C.Types (CBool (..), CInt (..))
-import Foreign.Ptr (Ptr)
-
-{- | Creates duckdb_error_data. Must be destroyed with @duckdb_destroy_error_data@.
-
-Parameters:
-* @type@: The error type.
-* @message@: The error message.
-
-Returns The error data.
--}
-foreign import ccall safe "duckdb_create_error_data"
-    c_duckdb_create_error_data :: DuckDBErrorType -> CString -> IO DuckDBErrorData
-
-{- | Destroys the error data and deallocates its memory.
-
-Parameters:
-* @error_data@: The error data to destroy.
--}
-foreign import ccall safe "duckdb_destroy_error_data"
-    c_duckdb_destroy_error_data :: Ptr DuckDBErrorData -> IO ()
-
-{- | Returns the duckdb_error_type of the error data.
-
-Parameters:
-* @error_data@: The error data.
-
-Returns The error type.
--}
-foreign import ccall safe "duckdb_error_data_error_type"
-    c_duckdb_error_data_error_type :: DuckDBErrorData -> IO DuckDBErrorType
-
-{- | Returns the error message of the error data. Must not be freed.
-
-Parameters:
-* @error_data@: The error data.
-
-Returns The error message.
--}
-foreign import ccall safe "duckdb_error_data_message"
-    c_duckdb_error_data_message :: DuckDBErrorData -> IO CString
-
-{- | Returns whether the error data contains an error or not.
-
-Parameters:
-* @error_data@: The error data.
-
-Returns True, if the error data contains an exception, else false.
--}
-foreign import ccall safe "duckdb_error_data_has_error"
-    c_duckdb_error_data_has_error :: DuckDBErrorData -> IO CBool
diff --git a/src/Database/DuckDB/FFI/ExecutePrepared.hs b/src/Database/DuckDB/FFI/ExecutePrepared.hs
deleted file mode 100644
--- a/src/Database/DuckDB/FFI/ExecutePrepared.hs
+++ /dev/null
@@ -1,24 +0,0 @@
-module Database.DuckDB.FFI.ExecutePrepared (
-    c_duckdb_execute_prepared,
-) where
-
-import Database.DuckDB.FFI.Types
-import Foreign.C.Types (CInt (..))
-import Foreign.Ptr (Ptr)
-
-{- | Executes the prepared statement with the given bound parameters, and returns a
-materialized query result.
-
-This method can be called multiple times for each prepared statement, and the
-parameters can be modified between calls to this function.
-
-Note that the result must be freed with @duckdb_destroy_result@.
-
-Parameters:
-* @prepared_statement@: The prepared statement to execute.
-* @out_result@: The query result.
-
-Returns @DuckDBSuccess@ on success or @DuckDBError@ on failure.
--}
-foreign import ccall "duckdb_execute_prepared"
-    c_duckdb_execute_prepared :: DuckDBPreparedStatement -> Ptr DuckDBResult -> IO DuckDBState
diff --git a/src/Database/DuckDB/FFI/Expression.hs b/src/Database/DuckDB/FFI/Expression.hs
deleted file mode 100644
--- a/src/Database/DuckDB/FFI/Expression.hs
+++ /dev/null
@@ -1,51 +0,0 @@
-module Database.DuckDB.FFI.Expression (
-    c_duckdb_destroy_expression,
-    c_duckdb_expression_return_type,
-    c_duckdb_expression_is_foldable,
-    c_duckdb_expression_fold,
-) where
-
-import Database.DuckDB.FFI.Types
-import Foreign.C.Types (CBool (..))
-import Foreign.Ptr (Ptr)
-
-{- | Destroys the expression and de-allocates its memory.
-
-Parameters:
-* @expr@: A pointer to the expression.
--}
-foreign import ccall safe "duckdb_destroy_expression"
-    c_duckdb_destroy_expression :: Ptr DuckDBExpression -> IO ()
-
-{- | Returns the return type of an expression.
-
-Parameters:
-* @expr@: The expression.
-
-Returns The return type. Must be destroyed with @duckdb_destroy_logical_type@.
--}
-foreign import ccall safe "duckdb_expression_return_type"
-    c_duckdb_expression_return_type :: DuckDBExpression -> IO DuckDBLogicalType
-
-{- | Returns whether the expression is foldable into a value or not.
-
-Parameters:
-* @expr@: The expression.
-
-Returns True, if the expression is foldable, else false.
--}
-foreign import ccall safe "duckdb_expression_is_foldable"
-    c_duckdb_expression_is_foldable :: DuckDBExpression -> IO CBool
-
-{- | Folds an expression creating a folded value.
-
-Parameters:
-* @context@: The client context.
-* @expr@: The expression. Must be foldable.
-* @out_value@: The folded value, if folding was successful. Must be destroyed
-  with @duckdb_destroy_value@.
-
-Returns The error data. Must be destroyed with @duckdb_destroy_error_data@.
--}
-foreign import ccall "duckdb_expression_fold"
-    c_duckdb_expression_fold :: DuckDBClientContext -> DuckDBExpression -> Ptr DuckDBValue -> IO DuckDBErrorData
diff --git a/src/Database/DuckDB/FFI/ExtractStatements.hs b/src/Database/DuckDB/FFI/ExtractStatements.hs
deleted file mode 100644
--- a/src/Database/DuckDB/FFI/ExtractStatements.hs
+++ /dev/null
@@ -1,67 +0,0 @@
-module Database.DuckDB.FFI.ExtractStatements (
-    c_duckdb_extract_statements,
-    c_duckdb_prepare_extracted_statement,
-    c_duckdb_extract_statements_error,
-    c_duckdb_destroy_extracted,
-) where
-
-import Database.DuckDB.FFI.Types
-import Foreign.C.String (CString)
-import Foreign.C.Types (CInt (..))
-import Foreign.Ptr (Ptr)
-
-{- | Extract all statements from a query. Note that after calling
-@duckdb_extract_statements@, the extracted statements should always be
-destroyed using @duckdb_destroy_extracted@, even if no statements were
-extracted.
-
-If the extract fails, @duckdb_extract_statements_error@ can be called to
-obtain the reason why the extract failed.
-
-Parameters:
-* @connection@: The connection object
-* @query@: The SQL query to extract
-* @out_extracted_statements@: The resulting extracted statements object
-
-Returns The number of extracted statements or 0 on failure.
--}
-foreign import ccall "duckdb_extract_statements"
-    c_duckdb_extract_statements :: DuckDBConnection -> CString -> Ptr DuckDBExtractedStatements -> IO DuckDBIdx
-
-{- | Prepare an extracted statement. Note that after calling
-@duckdb_prepare_extracted_statement@, the prepared statement should always be
-destroyed using @duckdb_destroy_prepare@, even if the prepare fails.
-
-If the prepare fails, @duckdb_prepare_error@ can be called to obtain the
-reason why the prepare failed.
-
-Parameters:
-* @connection@: The connection object
-* @extracted_statements@: The extracted statements object
-* @index@: The index of the extracted statement to prepare
-* @out_prepared_statement@: The resulting prepared statement object
-
-Returns @DuckDBSuccess@ on success or @DuckDBError@ on failure.
--}
-foreign import ccall "duckdb_prepare_extracted_statement"
-    c_duckdb_prepare_extracted_statement :: DuckDBConnection -> DuckDBExtractedStatements -> DuckDBIdx -> Ptr DuckDBPreparedStatement -> IO DuckDBState
-
-{- | Returns the error message contained within the extracted statements. The
-result of this function must not be freed. It will be cleaned up when
-@duckdb_destroy_extracted@ is called.
-
-Parameters:
-* @extracted_statements@: The extracted statements to fetch the error from.
-
-Returns The error of the extracted statements.
--}
-foreign import ccall safe "duckdb_extract_statements_error"
-    c_duckdb_extract_statements_error :: DuckDBExtractedStatements -> IO CString
-
-{- | De-allocates all memory allocated for the extracted statements.
-
-Parameters:
-* @extracted_statements@: The extracted statements to destroy.
--}
-foreign import ccall safe "duckdb_destroy_extracted"
-    c_duckdb_destroy_extracted :: Ptr DuckDBExtractedStatements -> IO ()
diff --git a/src/Database/DuckDB/FFI/FileSystem.hs b/src/Database/DuckDB/FFI/FileSystem.hs
deleted file mode 100644
--- a/src/Database/DuckDB/FFI/FileSystem.hs
+++ /dev/null
@@ -1,92 +0,0 @@
-{- |
-Module      : Database.DuckDB.FFI.FileSystem
-Description : Raw bindings for DuckDB's VFS and file-handle APIs.
--}
-module Database.DuckDB.FFI.FileSystem (
-    c_duckdb_client_context_get_file_system,
-    c_duckdb_destroy_file_system,
-    c_duckdb_file_system_error_data,
-    c_duckdb_file_system_open,
-    c_duckdb_create_file_open_options,
-    c_duckdb_file_open_options_set_flag,
-    c_duckdb_destroy_file_open_options,
-    c_duckdb_destroy_file_handle,
-    c_duckdb_file_handle_error_data,
-    c_duckdb_file_handle_read,
-    c_duckdb_file_handle_write,
-    c_duckdb_file_handle_tell,
-    c_duckdb_file_handle_size,
-    c_duckdb_file_handle_seek,
-    c_duckdb_file_handle_sync,
-    c_duckdb_file_handle_close,
-) where
-
-import Data.Int (Int64)
-import Database.DuckDB.FFI.Types
-import Foreign.C.String (CString)
-import Foreign.C.Types (CBool (..), CInt (..))
-import Foreign.Ptr (Ptr)
-
--- | Fetch the file-system handle associated with a client context.
-foreign import ccall safe "duckdb_client_context_get_file_system"
-    c_duckdb_client_context_get_file_system :: DuckDBClientContext -> IO DuckDBFileSystem
-
--- | Destroy a file-system handle obtained from DuckDB.
-foreign import ccall safe "duckdb_destroy_file_system"
-    c_duckdb_destroy_file_system :: Ptr DuckDBFileSystem -> IO ()
-
--- | Fetch the last structured file-system error.
-foreign import ccall safe "duckdb_file_system_error_data"
-    c_duckdb_file_system_error_data :: DuckDBFileSystem -> IO DuckDBErrorData
-
--- | Open a file via DuckDB's file-system abstraction.
-foreign import ccall safe "duckdb_file_system_open"
-    c_duckdb_file_system_open :: DuckDBFileSystem -> CString -> DuckDBFileOpenOptions -> Ptr DuckDBFileHandle -> IO DuckDBState
-
--- | Allocate a mutable file-open options object.
-foreign import ccall safe "duckdb_create_file_open_options"
-    c_duckdb_create_file_open_options :: IO DuckDBFileOpenOptions
-
--- | Enable or disable a file-open flag on an options object.
-foreign import ccall safe "duckdb_file_open_options_set_flag"
-    c_duckdb_file_open_options_set_flag :: DuckDBFileOpenOptions -> DuckDBFileFlag -> CBool -> IO DuckDBState
-
--- | Destroy a file-open options object.
-foreign import ccall safe "duckdb_destroy_file_open_options"
-    c_duckdb_destroy_file_open_options :: Ptr DuckDBFileOpenOptions -> IO ()
-
--- | Destroy a file handle obtained from DuckDB.
-foreign import ccall safe "duckdb_destroy_file_handle"
-    c_duckdb_destroy_file_handle :: Ptr DuckDBFileHandle -> IO ()
-
--- | Fetch the last structured file-handle error.
-foreign import ccall safe "duckdb_file_handle_error_data"
-    c_duckdb_file_handle_error_data :: DuckDBFileHandle -> IO DuckDBErrorData
-
--- | Read bytes from a file handle into caller-provided memory.
-foreign import ccall safe "duckdb_file_handle_read"
-    c_duckdb_file_handle_read :: DuckDBFileHandle -> Ptr () -> Int64 -> IO Int64
-
--- | Write bytes to a file handle from caller-provided memory.
-foreign import ccall safe "duckdb_file_handle_write"
-    c_duckdb_file_handle_write :: DuckDBFileHandle -> Ptr () -> Int64 -> IO Int64
-
--- | Query the current file position.
-foreign import ccall safe "duckdb_file_handle_tell"
-    c_duckdb_file_handle_tell :: DuckDBFileHandle -> IO Int64
-
--- | Query the size of a file handle.
-foreign import ccall safe "duckdb_file_handle_size"
-    c_duckdb_file_handle_size :: DuckDBFileHandle -> IO Int64
-
--- | Seek a file handle to an absolute byte offset.
-foreign import ccall safe "duckdb_file_handle_seek"
-    c_duckdb_file_handle_seek :: DuckDBFileHandle -> Int64 -> IO DuckDBState
-
--- | Flush a file handle's buffered writes to stable storage.
-foreign import ccall safe "duckdb_file_handle_sync"
-    c_duckdb_file_handle_sync :: DuckDBFileHandle -> IO DuckDBState
-
--- | Close a file handle without destroying the surrounding handle object.
-foreign import ccall safe "duckdb_file_handle_close"
-    c_duckdb_file_handle_close :: DuckDBFileHandle -> IO DuckDBState
diff --git a/src/Database/DuckDB/FFI/Helpers.hs b/src/Database/DuckDB/FFI/Helpers.hs
deleted file mode 100644
--- a/src/Database/DuckDB/FFI/Helpers.hs
+++ /dev/null
@@ -1,360 +0,0 @@
-module Database.DuckDB.FFI.Helpers (
-    c_duckdb_malloc,
-    c_duckdb_free,
-    c_duckdb_vector_size,
-    c_duckdb_valid_utf8_check,
-    c_duckdb_string_is_inlined,
-    c_duckdb_string_t_length,
-    c_duckdb_string_t_data,
-    c_duckdb_from_date,
-    c_duckdb_to_date,
-    c_duckdb_is_finite_date,
-    c_duckdb_from_time,
-    c_duckdb_create_time_tz,
-    c_duckdb_from_time_tz,
-    c_duckdb_to_time,
-    c_duckdb_from_timestamp,
-    c_duckdb_to_timestamp,
-    c_duckdb_is_finite_timestamp,
-    c_duckdb_is_finite_timestamp_s,
-    c_duckdb_is_finite_timestamp_ms,
-    c_duckdb_is_finite_timestamp_ns,
-    c_duckdb_hugeint_to_double,
-    c_duckdb_double_to_hugeint,
-    c_duckdb_uhugeint_to_double,
-    c_duckdb_double_to_uhugeint,
-    c_duckdb_double_to_decimal,
-    c_duckdb_decimal_to_double,
-) where
-
-import Data.Int (Int32, Int64)
-import Data.Word (Word32, Word8)
-import Database.DuckDB.FFI.Types
-import Foreign.C.String (CString)
-import Foreign.C.Types (CBool (..), CDouble (..), CSize (..))
-import Foreign.Ptr (Ptr)
-
-{- | Allocate @size@ bytes of memory using the duckdb internal malloc function. Any
-memory allocated in this manner should be freed using @duckdb_free@.
-
-Parameters:
-* @size@: The number of bytes to allocate.
-
-Returns A pointer to the allocated memory region.
--}
-foreign import ccall safe "duckdb_malloc"
-    c_duckdb_malloc :: CSize -> IO (Ptr ())
-
-{- | Free a value returned from @duckdb_malloc@, @duckdb_value_varchar@,
-@duckdb_value_blob@, or @duckdb_value_string@.
-
-Parameters:
-* @ptr@: The memory region to de-allocate.
--}
-foreign import ccall safe "duckdb_free"
-    c_duckdb_free :: Ptr () -> IO ()
-
-{- | The internal vector size used by DuckDB. This is the amount of tuples that
-will fit into a data chunk created by @duckdb_create_data_chunk@.
-
-Returns The vector size.
--}
-foreign import ccall safe "duckdb_vector_size"
-    c_duckdb_vector_size :: IO DuckDBIdx
-
-{- | Validates that the provided byte sequence is valid UTF-8.
-
-Returns structured error data that must be destroyed with
-@duckdb_destroy_error_data@.
--}
-foreign import ccall safe "duckdb_valid_utf8_check"
-    c_duckdb_valid_utf8_check :: CString -> DuckDBIdx -> IO DuckDBErrorData
-
-{- | Whether or not the duckdb_string_t value is inlined. This means that the data
-of the string does not have a separate allocation.
-
-These bindings call the wrapper symbol
-@wrapped_duckdb_string_is_inlined@ but mirror the DuckDB C API semantics of
-@duckdb_string_is_inlined@.
--}
-foreign import ccall safe "wrapped_duckdb_string_is_inlined"
-    c_duckdb_string_is_inlined :: Ptr DuckDBStringT -> IO CBool
-
-{- | Get the string length of a string_t
-
-Parameters:
-* @string@: The string to get the length of.
-
-Returns The length.
-
-These bindings call the wrapper symbol @wrapped_duckdb_string_t_length@
-but mirror the DuckDB C API semantics of @duckdb_string_t_length@.
--}
-foreign import ccall safe "wrapped_duckdb_string_t_length"
-    c_duckdb_string_t_length :: Ptr DuckDBStringT -> IO Word32
-
-{- | Get a pointer to the string data of a string_t
-
-Parameters:
-* @string@: The string to get the pointer to.
-
-Returns The pointer.
--}
-foreign import ccall safe "duckdb_string_t_data"
-    c_duckdb_string_t_data :: Ptr DuckDBStringT -> IO CString
-
-{- | Decompose a @duckdb_date@ object into year, month and date (stored as
-@duckdb_date_struct@).
-
-Parameters:
-* @date@: The date object, as obtained from a @DUCKDB_TYPE_DATE@ column.
-
-Returns The @duckdb_date_struct@ with the decomposed elements.
-
-These bindings call the wrapper symbol @wrapped_duckdb_from_date@ but
-mirror the DuckDB C API semantics of @duckdb_from_date@.
--}
-foreign import ccall safe "wrapped_duckdb_from_date"
-    c_duckdb_from_date :: DuckDBDate -> Ptr DuckDBDateStruct -> IO ()
-
-{- | Re-compose a @duckdb_date@ from year, month and date (@duckdb_date_struct@).
-
-Parameters:
-* @date@: The year, month and date stored in a @duckdb_date_struct@.
-
-Returns The @duckdb_date@ element.
-
-These bindings call the wrapper symbol @wrapped_duckdb_to_date@ but
-mirror the DuckDB C API semantics of @duckdb_to_date@.
--}
-foreign import ccall safe "wrapped_duckdb_to_date"
-    c_duckdb_to_date :: Ptr DuckDBDateStruct -> IO DuckDBDate
-
-{- | Test a @duckdb_date@ to see if it is a finite value.
-
-Parameters:
-* @date@: The date object, as obtained from a @DUCKDB_TYPE_DATE@ column.
-
-Returns True if the date is finite, false if it is ±infinity.
--}
-foreign import ccall safe "wrapped_duckdb_is_finite_date"
-    c_duckdb_is_finite_date :: DuckDBDate -> IO CBool
-
-{- | Decompose a @duckdb_time@ object into hour, minute, second and microsecond
-(stored as @duckdb_time_struct@).
-
-Parameters:
-* @time@: The time object, as obtained from a @DUCKDB_TYPE_TIME@ column.
-
-Returns The @duckdb_time_struct@ with the decomposed elements.
-
-These bindings call the wrapper symbol @wrapped_duckdb_from_time@ but
-mirror the DuckDB C API semantics of @duckdb_from_time@.
--}
-foreign import ccall safe "wrapped_duckdb_from_time"
-    c_duckdb_from_time :: DuckDBTime -> Ptr DuckDBTimeStruct -> IO ()
-
-{- | Create a @duckdb_time_tz@ object from micros and a timezone offset.
-
-Parameters:
-* @micros@: The microsecond component of the time.
-* @offset@: The timezone offset component of the time.
-
-Returns The @duckdb_time_tz@ element.
--}
-foreign import ccall safe "wrapped_duckdb_create_time_tz"
-    c_duckdb_create_time_tz :: Int64 -> Int32 -> IO DuckDBTimeTz
-
-{- | Decompose a TIME_TZ objects into micros and a timezone offset.
-
-Use @duckdb_from_time@ to further decompose the micros into hour, minute,
-second and microsecond.
-
-Parameters:
-* @micros@: The time object, as obtained from a @DUCKDB_TYPE_TIME_TZ@ column.
-
-These bindings call the wrapper symbol @wrapped_duckdb_from_time_tz@
-but mirror the DuckDB C API semantics of @duckdb_from_time_tz@.
--}
-foreign import ccall safe "wrapped_duckdb_from_time_tz"
-    c_duckdb_from_time_tz :: DuckDBTimeTz -> Ptr DuckDBTimeTzStruct -> IO ()
-
-{- | Re-compose a @duckdb_time@ from hour, minute, second and microsecond
-(@duckdb_time_struct@).
-
-Parameters:
-* @time@: The hour, minute, second and microsecond in a @duckdb_time_struct@.
-
-Returns The @duckdb_time@ element.
-
-These bindings call the wrapper symbol @wrapped_duckdb_to_time@ but
-mirror the DuckDB C API semantics of @duckdb_to_time@.
--}
-foreign import ccall safe "wrapped_duckdb_to_time"
-    c_duckdb_to_time :: Ptr DuckDBTimeStruct -> IO DuckDBTime
-
-{- | Decompose a @duckdb_timestamp@ object into a @duckdb_timestamp_struct@.
-
-Parameters:
-* @ts@: The ts object, as obtained from a @DUCKDB_TYPE_TIMESTAMP@ column.
-
-Returns The @duckdb_timestamp_struct@ with the decomposed elements.
-
-These bindings call the wrapper symbol @wrapped_duckdb_from_timestamp@
-but mirror the DuckDB C API semantics of @duckdb_from_timestamp@.
--}
-foreign import ccall safe "wrapped_duckdb_from_timestamp"
-    c_duckdb_from_timestamp :: DuckDBTimestamp -> Ptr DuckDBTimestampStruct -> IO ()
-
-{- | Re-compose a @duckdb_timestamp@ from a duckdb_timestamp_struct.
-
-Parameters:
-* @ts@: The de-composed elements in a @duckdb_timestamp_struct@.
-
-Returns The @duckdb_timestamp@ element.
-
-These bindings call the wrapper symbol @wrapped_duckdb_to_timestamp@
-but mirror the DuckDB C API semantics of @duckdb_to_timestamp@.
--}
-foreign import ccall safe "wrapped_duckdb_to_timestamp"
-    c_duckdb_to_timestamp :: Ptr DuckDBTimestampStruct -> IO DuckDBTimestamp
-
-{- | Test a @duckdb_timestamp@ to see if it is a finite value.
-
-Parameters:
-* @ts@: The duckdb_timestamp object, as obtained from a
-  @DUCKDB_TYPE_TIMESTAMP@ column.
-
-Returns True if the timestamp is finite, false if it is ±infinity.
--}
-foreign import ccall safe "wrapped_duckdb_is_finite_timestamp"
-    c_duckdb_is_finite_timestamp :: DuckDBTimestamp -> IO CBool
-
-{- | Test a @duckdb_timestamp_s@ to see if it is a finite value.
-
-Parameters:
-* @ts@: The duckdb_timestamp_s object, as obtained from a
-  @DUCKDB_TYPE_TIMESTAMP_S@ column.
-
-Returns True if the timestamp is finite, false if it is ±infinity.
--}
-foreign import ccall safe "wrapped_duckdb_is_finite_timestamp_s"
-    c_duckdb_is_finite_timestamp_s :: DuckDBTimestampS -> IO CBool
-
-{- | Test a @duckdb_timestamp_ms@ to see if it is a finite value.
-
-Parameters:
-* @ts@: The duckdb_timestamp_ms object, as obtained from a
-  @DUCKDB_TYPE_TIMESTAMP_MS@ column.
-
-Returns True if the timestamp is finite, false if it is ±infinity.
--}
-foreign import ccall safe "wrapped_duckdb_is_finite_timestamp_ms"
-    c_duckdb_is_finite_timestamp_ms :: DuckDBTimestampMs -> IO CBool
-
-{- | Test a @duckdb_timestamp_ns@ to see if it is a finite value.
-
-Parameters:
-* @ts@: The duckdb_timestamp_ns object, as obtained from a
-  @DUCKDB_TYPE_TIMESTAMP_NS@ column.
-
-Returns True if the timestamp is finite, false if it is ±infinity.
--}
-foreign import ccall safe "wrapped_duckdb_is_finite_timestamp_ns"
-    c_duckdb_is_finite_timestamp_ns :: DuckDBTimestampNs -> IO CBool
-
-{- | Converts a duckdb_hugeint object (as obtained from a @DUCKDB_TYPE_HUGEINT@
-column) into a double.
-
-Parameters:
-* @val@: The hugeint value.
-
-Returns The converted @double@ element.
-
-These bindings call the wrapper symbol
-@wrapped_duckdb_hugeint_to_double@ but mirror the DuckDB C API semantics of
-@duckdb_hugeint_to_double@.
--}
-foreign import ccall safe "wrapped_duckdb_hugeint_to_double"
-    c_duckdb_hugeint_to_double :: Ptr DuckDBHugeInt -> IO CDouble
-
-{- | Converts a double value to a duckdb_hugeint object.
-
-If the conversion fails because the double value is too big the result will be
-0.
-
-Parameters:
-* @val@: The double value.
-
-Returns The converted @duckdb_hugeint@ element.
-
-These bindings call the wrapper symbol
-@wrapped_duckdb_double_to_hugeint@ but mirror the DuckDB C API semantics of
-@duckdb_double_to_hugeint@.
--}
-foreign import ccall safe "wrapped_duckdb_double_to_hugeint"
-    c_duckdb_double_to_hugeint :: CDouble -> Ptr DuckDBHugeInt -> IO ()
-
-{- | Converts a duckdb_uhugeint object (as obtained from a @DUCKDB_TYPE_UHUGEINT@
-column) into a double.
-
-Parameters:
-* @val@: The uhugeint value.
-
-Returns The converted @double@ element.
-
-These bindings call the wrapper symbol
-@wrapped_duckdb_uhugeint_to_double@ but mirror the DuckDB C API semantics of
-@duckdb_uhugeint_to_double@.
--}
-foreign import ccall safe "wrapped_duckdb_uhugeint_to_double"
-    c_duckdb_uhugeint_to_double :: Ptr DuckDBUHugeInt -> IO CDouble
-
-{- | Converts a double value to a duckdb_uhugeint object.
-
-If the conversion fails because the double value is too big the result will be
-0.
-
-Parameters:
-* @val@: The double value.
-
-Returns The converted @duckdb_uhugeint@ element.
-
-These bindings call the wrapper symbol
-@wrapped_duckdb_double_to_uhugeint@ but mirror the DuckDB C API semantics of
-@duckdb_double_to_uhugeint@.
--}
-foreign import ccall safe "wrapped_duckdb_double_to_uhugeint"
-    c_duckdb_double_to_uhugeint :: CDouble -> Ptr DuckDBUHugeInt -> IO ()
-
-{- | Converts a double value to a duckdb_decimal object.
-
-If the conversion fails because the double value is too big, or the
-width/scale are invalid the result will be 0.
-
-Parameters:
-* @val@: The double value.
-
-Returns The converted @duckdb_decimal@ element.
-
-These bindings call the wrapper symbol
-@wrapped_duckdb_double_to_decimal@ but mirror the DuckDB C API semantics of
-@duckdb_double_to_decimal@.
--}
-foreign import ccall safe "wrapped_duckdb_double_to_decimal"
-    c_duckdb_double_to_decimal :: CDouble -> Word8 -> Word8 -> Ptr DuckDBDecimal -> IO ()
-
-{- | Converts a duckdb_decimal object (as obtained from a @DUCKDB_TYPE_DECIMAL@
-column) into a double.
-
-Parameters:
-* @val@: The decimal value.
-
-Returns The converted @double@ element.
-
-These bindings call the wrapper symbol
-@wrapped_duckdb_decimal_to_double@ but mirror the DuckDB C API semantics of
-@duckdb_decimal_to_double@.
--}
-foreign import ccall safe "wrapped_duckdb_decimal_to_double"
-    c_duckdb_decimal_to_double :: Ptr DuckDBDecimal -> IO CDouble
diff --git a/src/Database/DuckDB/FFI/Logging.hs b/src/Database/DuckDB/FFI/Logging.hs
deleted file mode 100644
--- a/src/Database/DuckDB/FFI/Logging.hs
+++ /dev/null
@@ -1,41 +0,0 @@
-{- |
-Module      : Database.DuckDB.FFI.Logging
-Description : Raw bindings for DuckDB's custom log-storage API.
--}
-module Database.DuckDB.FFI.Logging (
-    c_duckdb_create_log_storage,
-    c_duckdb_destroy_log_storage,
-    c_duckdb_log_storage_set_write_log_entry,
-    c_duckdb_log_storage_set_extra_data,
-    c_duckdb_log_storage_set_name,
-    c_duckdb_register_log_storage,
-) where
-
-import Database.DuckDB.FFI.Types
-import Foreign.C.String (CString)
-import Foreign.C.Types (CInt (..))
-import Foreign.Ptr (Ptr)
-
--- | Allocate a new log storage object.
-foreign import ccall safe "duckdb_create_log_storage"
-    c_duckdb_create_log_storage :: IO DuckDBLogStorage
-
--- | Destroy a log storage object.
-foreign import ccall safe "duckdb_destroy_log_storage"
-    c_duckdb_destroy_log_storage :: Ptr DuckDBLogStorage -> IO ()
-
--- | Set the callback used when DuckDB writes a log entry.
-foreign import ccall safe "duckdb_log_storage_set_write_log_entry"
-    c_duckdb_log_storage_set_write_log_entry :: DuckDBLogStorage -> DuckDBLoggerWriteLogEntryFun -> IO ()
-
--- | Attach user-managed extra data to a log storage object.
-foreign import ccall safe "duckdb_log_storage_set_extra_data"
-    c_duckdb_log_storage_set_extra_data :: DuckDBLogStorage -> Ptr () -> DuckDBDeleteCallback -> IO ()
-
--- | Set the registration name of a log storage object.
-foreign import ccall safe "duckdb_log_storage_set_name"
-    c_duckdb_log_storage_set_name :: DuckDBLogStorage -> CString -> IO ()
-
--- | Register a custom log storage on a database handle.
-foreign import ccall safe "duckdb_register_log_storage"
-    c_duckdb_register_log_storage :: DuckDBDatabase -> DuckDBLogStorage -> IO DuckDBState
diff --git a/src/Database/DuckDB/FFI/LogicalTypes.hs b/src/Database/DuckDB/FFI/LogicalTypes.hs
deleted file mode 100644
--- a/src/Database/DuckDB/FFI/LogicalTypes.hs
+++ /dev/null
@@ -1,407 +0,0 @@
-module Database.DuckDB.FFI.LogicalTypes (
-    c_duckdb_create_logical_type,
-    c_duckdb_logical_type_get_alias,
-    c_duckdb_logical_type_set_alias,
-    c_duckdb_create_list_type,
-    c_duckdb_create_array_type,
-    c_duckdb_create_map_type,
-    c_duckdb_create_union_type,
-    c_duckdb_create_struct_type,
-    c_duckdb_create_enum_type,
-    c_duckdb_create_decimal_type,
-    c_duckdb_get_type_id,
-    c_duckdb_decimal_width,
-    c_duckdb_decimal_scale,
-    c_duckdb_decimal_internal_type,
-    c_duckdb_enum_internal_type,
-    c_duckdb_enum_dictionary_size,
-    c_duckdb_enum_dictionary_value,
-    c_duckdb_list_type_child_type,
-    c_duckdb_array_type_child_type,
-    c_duckdb_array_type_array_size,
-    c_duckdb_map_type_key_type,
-    c_duckdb_map_type_value_type,
-    c_duckdb_struct_type_child_count,
-    c_duckdb_struct_type_child_name,
-    c_duckdb_struct_type_child_type,
-    c_duckdb_union_type_member_count,
-    c_duckdb_union_type_member_name,
-    c_duckdb_union_type_member_type,
-    c_duckdb_geometry_type_get_crs,
-    c_duckdb_destroy_logical_type,
-    c_duckdb_register_logical_type,
-) where
-
-import Data.Word (Word32, Word8)
-import Database.DuckDB.FFI.Types
-import Foreign.C.String (CString)
-import Foreign.C.Types (CInt (..))
-import Foreign.Ptr (Ptr)
-
-{- | Creates a @duckdb_logical_type@ from a primitive type. The resulting logical
-type must be destroyed with @duckdb_destroy_logical_type@.
-
-Returns an invalid logical type, if type is: @DUCKDB_TYPE_INVALID@,
-@DUCKDB_TYPE_DECIMAL@, @DUCKDB_TYPE_ENUM@, @DUCKDB_TYPE_LIST@,
-@DUCKDB_TYPE_STRUCT@, @DUCKDB_TYPE_MAP@, @DUCKDB_TYPE_ARRAY@, or
-@DUCKDB_TYPE_UNION@.
-
-For @DUCKDB_TYPE_VARIANT@, DuckDB 1.5 returns an incomplete descriptor.
-Obtain a complete descriptor from a query result with
-@duckdb_column_logical_type@. Inspecting the incomplete descriptor's children
-can terminate the process.
-
-Parameters:
-* @type@: The primitive type to create.
-
-Returns The logical type.
--}
-foreign import ccall safe "duckdb_create_logical_type"
-    c_duckdb_create_logical_type :: DuckDBType -> IO DuckDBLogicalType
-
-{- | Returns the alias of a duckdb_logical_type, if set, else @nullptr@. The result
-must be destroyed with @duckdb_free@.
-
-Parameters:
-* @type@: The logical type
-
-Returns The alias or @nullptr@
--}
-foreign import ccall safe "duckdb_logical_type_get_alias"
-    c_duckdb_logical_type_get_alias :: DuckDBLogicalType -> IO CString
-
-{- | Sets the alias of a duckdb_logical_type.
-
-Parameters:
-* @type@: The logical type
-* @alias@: The alias to set
--}
-foreign import ccall safe "duckdb_logical_type_set_alias"
-    c_duckdb_logical_type_set_alias :: DuckDBLogicalType -> CString -> IO ()
-
-{- | Creates a LIST type from its child type. The return type must be destroyed
-with @duckdb_destroy_logical_type@.
-
-Parameters:
-* @type@: The child type of the list
-
-Returns The logical type.
--}
-foreign import ccall safe "duckdb_create_list_type"
-    c_duckdb_create_list_type :: DuckDBLogicalType -> IO DuckDBLogicalType
-
-{- | Creates an ARRAY type from its child type. The return type must be destroyed
-with @duckdb_destroy_logical_type@.
-
-Parameters:
-* @type@: The child type of the array.
-* @array_size@: The number of elements in the array.
-
-Returns The logical type.
--}
-foreign import ccall safe "duckdb_create_array_type"
-    c_duckdb_create_array_type :: DuckDBLogicalType -> DuckDBIdx -> IO DuckDBLogicalType
-
-{- | Creates a MAP type from its key type and value type. The return type must be
-destroyed with @duckdb_destroy_logical_type@.
-
-Parameters:
-* @key_type@: The map's key type.
-* @value_type@: The map's value type.
-
-Returns The logical type.
--}
-foreign import ccall safe "duckdb_create_map_type"
-    c_duckdb_create_map_type :: DuckDBLogicalType -> DuckDBLogicalType -> IO DuckDBLogicalType
-
-{- | Creates a UNION type from the passed arrays. The return type must be destroyed
-with @duckdb_destroy_logical_type@.
-
-Parameters:
-* @member_types@: The array of union member types.
-* @member_names@: The union member names.
-* @member_count@: The number of union members.
-
-Returns The logical type.
--}
-foreign import ccall safe "duckdb_create_union_type"
-    c_duckdb_create_union_type :: Ptr DuckDBLogicalType -> Ptr CString -> DuckDBIdx -> IO DuckDBLogicalType
-
-{- | Creates a STRUCT type based on the member types and names. The resulting type
-must be destroyed with @duckdb_destroy_logical_type@.
-
-Parameters:
-* @member_types@: The array of types of the struct members.
-* @member_names@: The array of names of the struct members.
-* @member_count@: The number of members of the struct.
-
-Returns The logical type.
--}
-foreign import ccall safe "duckdb_create_struct_type"
-    c_duckdb_create_struct_type :: Ptr DuckDBLogicalType -> Ptr CString -> DuckDBIdx -> IO DuckDBLogicalType
-
-{- | Creates an ENUM type from the passed member name array. The resulting type
-should be destroyed with @duckdb_destroy_logical_type@.
-
-Parameters:
-* @member_names@: The array of names that the enum should consist of.
-* @member_count@: The number of elements that were specified in the array.
-
-Returns The logical type.
--}
-foreign import ccall safe "duckdb_create_enum_type"
-    c_duckdb_create_enum_type :: Ptr CString -> DuckDBIdx -> IO DuckDBLogicalType
-
-{- | Creates a DECIMAL type with the specified width and scale. The resulting type
-should be destroyed with @duckdb_destroy_logical_type@.
-
-Parameters:
-* @width@: The width of the decimal type. Must be between 1 and 38.
-* @scale@: The scale of the decimal type. Must not exceed the width.
-
-Returns the logical type. If the width or scale is out of range, DuckDB 1.5.4
-and later return @nullptr@. Invalid input can terminate the process on DuckDB
-1.5.3. Validate the width and scale before calling this function on that version.
--}
-foreign import ccall safe "duckdb_create_decimal_type"
-    c_duckdb_create_decimal_type :: Word8 -> Word8 -> IO DuckDBLogicalType
-
-{- | Retrieves the enum @duckdb_type@ of a @duckdb_logical_type@.
-
-Parameters:
-* @type@: The logical type.
-
-Returns The @duckdb_type@ id.
--}
-foreign import ccall safe "duckdb_get_type_id"
-    c_duckdb_get_type_id :: DuckDBLogicalType -> IO DuckDBType
-
-{- | Retrieves the width of a decimal type.
-
-Parameters:
-* @type@: The logical type object
-
-Returns The width of the decimal type
--}
-foreign import ccall safe "duckdb_decimal_width"
-    c_duckdb_decimal_width :: DuckDBLogicalType -> IO Word8
-
-{- | Retrieves the scale of a decimal type.
-
-Parameters:
-* @type@: The logical type object
-
-Returns The scale of the decimal type
--}
-foreign import ccall safe "duckdb_decimal_scale"
-    c_duckdb_decimal_scale :: DuckDBLogicalType -> IO Word8
-
-{- | Retrieves the internal storage type of a decimal type.
-
-Parameters:
-* @type@: The logical type object
-
-Returns The internal type of the decimal type
--}
-foreign import ccall safe "duckdb_decimal_internal_type"
-    c_duckdb_decimal_internal_type :: DuckDBLogicalType -> IO DuckDBType
-
-{- | Retrieves the internal storage type of an enum type.
-
-Parameters:
-* @type@: The logical type object
-
-Returns The internal type of the enum type
--}
-foreign import ccall safe "duckdb_enum_internal_type"
-    c_duckdb_enum_internal_type :: DuckDBLogicalType -> IO DuckDBType
-
-{- | Retrieves the dictionary size of the enum type.
-
-Parameters:
-* @type@: The logical type object
-
-Returns The dictionary size of the enum type
--}
-foreign import ccall safe "duckdb_enum_dictionary_size"
-    c_duckdb_enum_dictionary_size :: DuckDBLogicalType -> IO Word32
-
-{- | Retrieves the dictionary value at the specified position from the enum.
-
-The result must be freed with @duckdb_free@.
-
-Parameters:
-* @type@: The logical type object
-* @index@: The index in the dictionary
-
-Returns The string value of the enum type. Must be freed with @duckdb_free@.
--}
-foreign import ccall safe "duckdb_enum_dictionary_value"
-    c_duckdb_enum_dictionary_value :: DuckDBLogicalType -> DuckDBIdx -> IO CString
-
-{- | Retrieves the child type of the given LIST type. Also accepts MAP types. The
-result must be freed with @duckdb_destroy_logical_type@.
-
-Parameters:
-* @type@: The logical type, either LIST or MAP.
-
-Returns The child type of the LIST or MAP type.
--}
-foreign import ccall safe "duckdb_list_type_child_type"
-    c_duckdb_list_type_child_type :: DuckDBLogicalType -> IO DuckDBLogicalType
-
-{- | Retrieves the child type of the given ARRAY type.
-
-The result must be freed with @duckdb_destroy_logical_type@.
-
-Parameters:
-* @type@: The logical type. Must be ARRAY.
-
-Returns The child type of the ARRAY type.
--}
-foreign import ccall safe "duckdb_array_type_child_type"
-    c_duckdb_array_type_child_type :: DuckDBLogicalType -> IO DuckDBLogicalType
-
-{- | Retrieves the array size of the given array type.
-
-Parameters:
-* @type@: The logical type object
-
-Returns The fixed number of elements the values of this array type can store.
--}
-foreign import ccall safe "duckdb_array_type_array_size"
-    c_duckdb_array_type_array_size :: DuckDBLogicalType -> IO DuckDBIdx
-
-{- | Retrieves the key type of the given map type.
-
-The result must be freed with @duckdb_destroy_logical_type@.
-
-Parameters:
-* @type@: The logical type object
-
-Returns The key type of the map type. Must be destroyed with
-@duckdb_destroy_logical_type@.
--}
-foreign import ccall safe "duckdb_map_type_key_type"
-    c_duckdb_map_type_key_type :: DuckDBLogicalType -> IO DuckDBLogicalType
-
-{- | Retrieves the value type of the given map type.
-
-The result must be freed with @duckdb_destroy_logical_type@.
-
-Parameters:
-* @type@: The logical type object
-
-Returns The value type of the map type. Must be destroyed with
-@duckdb_destroy_logical_type@.
--}
-foreign import ccall safe "duckdb_map_type_value_type"
-    c_duckdb_map_type_value_type :: DuckDBLogicalType -> IO DuckDBLogicalType
-
-{- | Returns the number of children of a struct type.
-
-Parameters:
-* @type@: The logical type object
-
-Returns The number of children of a struct type.
--}
-foreign import ccall safe "duckdb_struct_type_child_count"
-    c_duckdb_struct_type_child_count :: DuckDBLogicalType -> IO DuckDBIdx
-
-{- | Retrieves the name of the struct child.
-
-The result must be freed with @duckdb_free@.
-
-Parameters:
-* @type@: The logical type object
-* @index@: The child index
-
-Returns The name of the struct type. Must be freed with @duckdb_free@.
--}
-foreign import ccall safe "duckdb_struct_type_child_name"
-    c_duckdb_struct_type_child_name :: DuckDBLogicalType -> DuckDBIdx -> IO CString
-
-{- | Retrieves the child type of the given struct type at the specified index.
-
-The result must be freed with @duckdb_destroy_logical_type@.
-
-Parameters:
-* @type@: The logical type object
-* @index@: The child index
-
-Returns The child type of the struct type. Must be destroyed with
-@duckdb_destroy_logical_type@.
--}
-foreign import ccall safe "duckdb_struct_type_child_type"
-    c_duckdb_struct_type_child_type :: DuckDBLogicalType -> DuckDBIdx -> IO DuckDBLogicalType
-
-{- | Returns the number of members that the union type has.
-
-Parameters:
-* @type@: The logical type (union) object
-
-Returns The number of members of a union type.
--}
-foreign import ccall safe "duckdb_union_type_member_count"
-    c_duckdb_union_type_member_count :: DuckDBLogicalType -> IO DuckDBIdx
-
-{- | Retrieves the name of the union member.
-
-The result must be freed with @duckdb_free@.
-
-Parameters:
-* @type@: The logical type object
-* @index@: The child index
-
-Returns The name of the union member. Must be freed with @duckdb_free@.
--}
-foreign import ccall safe "duckdb_union_type_member_name"
-    c_duckdb_union_type_member_name :: DuckDBLogicalType -> DuckDBIdx -> IO CString
-
-{- | Retrieves the child type of the given union member at the specified index.
-
-The result must be freed with @duckdb_destroy_logical_type@.
-
-Parameters:
-* @type@: The logical type object
-* @index@: The child index
-
-Returns The child type of the union member. Must be destroyed with
-@duckdb_destroy_logical_type@.
--}
-foreign import ccall safe "duckdb_union_type_member_type"
-    c_duckdb_union_type_member_type :: DuckDBLogicalType -> DuckDBIdx -> IO DuckDBLogicalType
-
-{- | Return the CRS (Coordinate Reference System) of a GEOMETRY type.
-Free the result with @duckdb_free@.
-
-Parameters:
-* @type@: The GEOMETRY type.
-
-Returns the CRS, or @nullptr@ if the type is not GEOMETRY or has no CRS.
-The returned string remains valid after the logical type is destroyed.
-
-Available since DuckDB 1.5.2. The C API marks this function stable since 1.5.6.
--}
-foreign import ccall safe "duckdb_geometry_type_get_crs"
-    c_duckdb_geometry_type_get_crs :: DuckDBLogicalType -> IO CString
-
-{- | Destroys the logical type and de-allocates all memory allocated for that type.
-
-Parameters:
-* @type@: The logical type to destroy.
--}
-foreign import ccall safe "duckdb_destroy_logical_type"
-    c_duckdb_destroy_logical_type :: Ptr DuckDBLogicalType -> IO ()
-
-{- | Registers a custom type within the given connection. The type must have an
-alias
-
-Parameters:
-* @con@: The connection to use
-* @type@: The custom type to register
-
-Returns Whether or not the registration was successful.
--}
-foreign import ccall safe "duckdb_register_logical_type"
-    c_duckdb_register_logical_type :: DuckDBConnection -> DuckDBLogicalType -> DuckDBCreateTypeInfo -> IO DuckDBState
diff --git a/src/Database/DuckDB/FFI/OpenConnect.hs b/src/Database/DuckDB/FFI/OpenConnect.hs
deleted file mode 100644
--- a/src/Database/DuckDB/FFI/OpenConnect.hs
+++ /dev/null
@@ -1,215 +0,0 @@
-module Database.DuckDB.FFI.OpenConnect (
-    c_duckdb_create_instance_cache,
-    c_duckdb_get_or_create_from_cache,
-    c_duckdb_destroy_instance_cache,
-    c_duckdb_open,
-    c_duckdb_open_ext,
-    c_duckdb_close,
-    c_duckdb_connect,
-    c_duckdb_interrupt,
-    c_duckdb_query_progress,
-    c_duckdb_disconnect,
-    c_duckdb_connection_get_client_context,
-    c_duckdb_connection_get_arrow_options,
-    c_duckdb_client_context_get_connection_id,
-    c_duckdb_destroy_client_context,
-    c_duckdb_destroy_arrow_options,
-    c_duckdb_library_version,
-    c_duckdb_get_table_names,
-) where
-
-import Database.DuckDB.FFI.Types
-import Foreign.C.String (CString)
-import Foreign.C.Types (CBool (..), CInt (..))
-import Foreign.Ptr (Ptr)
-
-{- | Creates a new database instance cache. The instance cache is necessary if a
-client/program (re)opens multiple databases to the same file within the same
-process. Must be destroyed with @duckdb_destroy_instance_cache@.
-
-Returns The database instance cache.
--}
-foreign import ccall safe "duckdb_create_instance_cache"
-    c_duckdb_create_instance_cache :: IO DuckDBInstanceCache
-
-{- | Creates a new database instance in the instance cache, or retrieves an
-existing database instance. Must be closed with @duckdb_close@.
-
-Parameters:
-* @instance_cache@: The instance cache in which to create the database, or
-  from which to take the database.
-* @path@: Path to the database file on disk. Both @nullptr@ and @:memory:@
-  open or retrieve an in-memory database.
-* @out_database@: The resulting cached database.
-* @config@: (Optional) configuration used to create the database.
-* @out_error@: If set and the function returns @DuckDBError@, this contains
-  the error message. Note that the error message must be freed using
-  @duckdb_free@.
-
-Returns @DuckDBSuccess@ on success or @DuckDBError@ on failure.
--}
-foreign import ccall "duckdb_get_or_create_from_cache"
-    c_duckdb_get_or_create_from_cache :: DuckDBInstanceCache -> CString -> Ptr DuckDBDatabase -> DuckDBConfig -> Ptr CString -> IO DuckDBState
-
-{- | Destroys an existing database instance cache and de-allocates its memory.
-
-Parameters:
-* @instance_cache@: The instance cache to destroy.
--}
-foreign import ccall safe "duckdb_destroy_instance_cache"
-    c_duckdb_destroy_instance_cache :: Ptr DuckDBInstanceCache -> IO ()
-
-{- | Creates a new database or opens an existing database file stored at the given
-path. If no path is given a new in-memory database is created instead. The
-database must be closed with @duckdb_close@.
-
-Parameters:
-* @path@: Path to the database file on disk. Both @nullptr@ and @:memory:@
-  open an in-memory database.
-* @out_database@: The result database object.
-
-Returns @DuckDBSuccess@ on success or @DuckDBError@ on failure.
--}
-foreign import ccall "duckdb_open"
-    c_duckdb_open :: CString -> Ptr DuckDBDatabase -> IO DuckDBState
-
-{- | Extended version of duckdb_open. Creates a new database or opens an existing
-database file stored at the given path. The database must be closed with
-@duckdb_close@.
-
-Parameters:
-* @path@: Path to the database file on disk. Both @nullptr@ and @:memory:@
-  open an in-memory database.
-* @out_database@: The result database object.
-* @config@: (Optional) configuration used to start up the database.
-* @out_error@: If set and the function returns @DuckDBError@, this contains
-  the error message. Note that the error message must be freed using
-  @duckdb_free@.
-
-Returns @DuckDBSuccess@ on success or @DuckDBError@ on failure.
--}
-foreign import ccall "duckdb_open_ext"
-    c_duckdb_open_ext :: CString -> Ptr DuckDBDatabase -> DuckDBConfig -> Ptr CString -> IO DuckDBState
-
-{- | Closes the specified database and de-allocates all memory allocated for that
-database. This should be called after you are done with any database allocated
-through @duckdb_open@ or @duckdb_open_ext@. Note that failing to call
-@duckdb_close@ (in case of e.g., a program crash) will not cause data
-corruption. Still, it is recommended to always correctly close a database
-object after you are done with it.
-
-Parameters:
-* @database@: The database object to shut down.
--}
-foreign import ccall "duckdb_close"
-    c_duckdb_close :: Ptr DuckDBDatabase -> IO ()
-
-{- | Opens a connection to a database. Connections are required to query the
-database, and store transactional state associated with the connection. The
-instantiated connection should be closed using @duckdb_disconnect@.
-
-Parameters:
-* @database@: The database file to connect to.
-* @out_connection@: The result connection object.
-
-Returns @DuckDBSuccess@ on success or @DuckDBError@ on failure.
--}
-foreign import ccall "duckdb_connect"
-    c_duckdb_connect :: DuckDBDatabase -> Ptr DuckDBConnection -> IO DuckDBState
-
-{- | Interrupt running query
-
-Parameters:
-* @connection@: The connection to interrupt
--}
-foreign import ccall safe "duckdb_interrupt"
-    c_duckdb_interrupt :: DuckDBConnection -> IO ()
-
-{- | Get progress of the running query
-
-Parameters:
-* @connection@: The working connection
-
-Returns -1 if no progress or a percentage of the progress
-
-These bindings call the wrapper symbol @wrapped_duckdb_query_progress@
-but mirror the DuckDB C API semantics of @duckdb_query_progress@.
--}
-foreign import ccall safe "wrapped_duckdb_query_progress"
-    c_duckdb_query_progress :: DuckDBConnection -> Ptr DuckDBQueryProgress -> IO ()
-
-{- | Closes the specified connection and de-allocates all memory allocated for that
-connection.
-
-Parameters:
-* @connection@: The connection to close.
--}
-foreign import ccall "duckdb_disconnect"
-    c_duckdb_disconnect :: Ptr DuckDBConnection -> IO ()
-
-{- | Retrieves the client context of the connection.
-
-Parameters:
-* @connection@: The connection.
-* @out_context@: The client context of the connection. Must be destroyed with
-  @duckdb_destroy_client_context@.
--}
-foreign import ccall safe "duckdb_connection_get_client_context"
-    c_duckdb_connection_get_client_context :: DuckDBConnection -> Ptr DuckDBClientContext -> IO ()
-
-{- | Retrieves the arrow options of the connection.
-
-Parameters:
-* @connection@: The connection.
--}
-foreign import ccall safe "duckdb_connection_get_arrow_options"
-    c_duckdb_connection_get_arrow_options :: DuckDBConnection -> Ptr DuckDBArrowOptions -> IO ()
-
-{- | Returns the connection id of the client context.
-
-Parameters:
-* @context@: The client context.
-
-Returns The connection id of the client context.
--}
-foreign import ccall safe "duckdb_client_context_get_connection_id"
-    c_duckdb_client_context_get_connection_id :: DuckDBClientContext -> IO DuckDBIdx
-
-{- | Destroys the client context and deallocates its memory.
-
-Parameters:
-* @context@: The client context to destroy.
--}
-foreign import ccall safe "duckdb_destroy_client_context"
-    c_duckdb_destroy_client_context :: Ptr DuckDBClientContext -> IO ()
-
-{- | Destroys the arrow options and deallocates its memory.
-
-Parameters:
-* @arrow_options@: The arrow options to destroy.
--}
-foreign import ccall safe "duckdb_destroy_arrow_options"
-    c_duckdb_destroy_arrow_options :: Ptr DuckDBArrowOptions -> IO ()
-
-{- | Returns the version of the linked DuckDB, with a version postfix for dev
-versions
-
-Usually used for developing C extensions that must return this for a
-compatibility check.
--}
-foreign import ccall safe "duckdb_library_version"
-    c_duckdb_library_version :: IO CString
-
-{- | Get the list of (fully qualified) table names of the query.
-
-Parameters:
-* @connection@: The connection for which to get the table names.
-* @query@: The query for which to get the table names.
-* @qualified@: Returns fully qualified table names (catalog.schema.table), if
-  set to true, else only the (not escaped) table names.
-
-Returns A duckdb_value of type VARCHAR[] containing the (fully qualified)
-table names of the query. Must be destroyed with duckdb_destroy_value.
--}
-foreign import ccall "duckdb_get_table_names"
-    c_duckdb_get_table_names :: DuckDBConnection -> CString -> CBool -> IO DuckDBValue
diff --git a/src/Database/DuckDB/FFI/PendingResult.hs b/src/Database/DuckDB/FFI/PendingResult.hs
deleted file mode 100644
--- a/src/Database/DuckDB/FFI/PendingResult.hs
+++ /dev/null
@@ -1,121 +0,0 @@
-module Database.DuckDB.FFI.PendingResult (
-    c_duckdb_pending_prepared,
-    c_duckdb_destroy_pending,
-    c_duckdb_pending_error,
-    c_duckdb_pending_execute_task,
-    c_duckdb_pending_execute_check_state,
-    c_duckdb_execute_pending,
-    c_duckdb_pending_execution_is_finished,
-) where
-
-import Database.DuckDB.FFI.Types
-import Foreign.C.String (CString)
-import Foreign.C.Types (CBool (..), CInt (..))
-import Foreign.Ptr (Ptr)
-
-{- | Executes the prepared statement with the given bound parameters, and returns a
-pending result. The pending result represents an intermediate structure for a
-query that is not yet fully executed. The pending result can be used to
-incrementally execute a query, returning control to the client between tasks.
-
-Note that after calling @duckdb_pending_prepared@, the pending result should
-always be destroyed using @duckdb_destroy_pending@, even if this function
-returns DuckDBError.
-
-Parameters:
-* @prepared_statement@: The prepared statement to execute.
-* @out_result@: The pending query result.
-
-Returns @DuckDBSuccess@ on success or @DuckDBError@ on failure.
--}
-foreign import ccall "duckdb_pending_prepared"
-    c_duckdb_pending_prepared :: DuckDBPreparedStatement -> Ptr DuckDBPendingResult -> IO DuckDBState
-
-{- | Closes the pending result and de-allocates all memory allocated for the
-result.
-
-Parameters:
-* @pending_result@: The pending result to destroy.
--}
-foreign import ccall safe "duckdb_destroy_pending"
-    c_duckdb_destroy_pending :: Ptr DuckDBPendingResult -> IO ()
-
-{- | Returns the error message contained within the pending result.
-
-The result of this function must not be freed. It will be cleaned up when
-@duckdb_destroy_pending@ is called.
-
-Parameters:
-* @pending_result@: The pending result to fetch the error from.
-
-Returns The error of the pending result.
--}
-foreign import ccall safe "duckdb_pending_error"
-    c_duckdb_pending_error :: DuckDBPendingResult -> IO CString
-
-{- | Executes a single task within the query, returning whether or not the query is
-ready.
-
-If this returns DUCKDB_PENDING_RESULT_READY, the duckdb_execute_pending
-function can be called to obtain the result. If this returns
-DUCKDB_PENDING_RESULT_NOT_READY, the duckdb_pending_execute_task function
-should be called again. If this returns DUCKDB_PENDING_ERROR, an error
-occurred during execution.
-
-The error message can be obtained by calling duckdb_pending_error on the
-pending_result.
-
-Parameters:
-* @pending_result@: The pending result to execute a task within.
-
-Returns The state of the pending result after the execution.
--}
-foreign import ccall "duckdb_pending_execute_task"
-    c_duckdb_pending_execute_task :: DuckDBPendingResult -> IO DuckDBPendingState
-
-{- | If this returns DUCKDB_PENDING_RESULT_READY, the duckdb_execute_pending
-function can be called to obtain the result. If this returns
-DUCKDB_PENDING_RESULT_NOT_READY, the duckdb_pending_execute_check_state
-function should be called again. If this returns DUCKDB_PENDING_ERROR, an
-error occurred during execution.
-
-The error message can be obtained by calling duckdb_pending_error on the
-pending_result.
-
-Parameters:
-* @pending_result@: The pending result.
-
-Returns The state of the pending result.
--}
-foreign import ccall safe "duckdb_pending_execute_check_state"
-    c_duckdb_pending_execute_check_state :: DuckDBPendingResult -> IO DuckDBPendingState
-
-{- | Fully execute a pending query result, returning the final query result.
-
-If duckdb_pending_execute_task has been called until
-DUCKDB_PENDING_RESULT_READY was returned, this will return fast. Otherwise,
-all remaining tasks must be executed first.
-
-Note that the result must be freed with @duckdb_destroy_result@.
-
-Parameters:
-* @pending_result@: The pending result to execute.
-* @out_result@: The result object.
-
-Returns @DuckDBSuccess@ on success or @DuckDBError@ on failure.
--}
-foreign import ccall "duckdb_execute_pending"
-    c_duckdb_execute_pending :: DuckDBPendingResult -> Ptr DuckDBResult -> IO DuckDBState
-
-{- | Returns whether a duckdb_pending_state is finished executing. For example if
-@pending_state@ is DUCKDB_PENDING_RESULT_READY, this function will return
-true.
-
-Parameters:
-* @pending_state@: The pending state on which to decide whether to finish
-  execution.
-
-Returns Boolean indicating pending execution should be considered finished.
--}
-foreign import ccall safe "duckdb_pending_execution_is_finished"
-    c_duckdb_pending_execution_is_finished :: DuckDBPendingState -> IO CBool
diff --git a/src/Database/DuckDB/FFI/PreparedStatements.hs b/src/Database/DuckDB/FFI/PreparedStatements.hs
deleted file mode 100644
--- a/src/Database/DuckDB/FFI/PreparedStatements.hs
+++ /dev/null
@@ -1,184 +0,0 @@
-module Database.DuckDB.FFI.PreparedStatements (
-    c_duckdb_prepare,
-    c_duckdb_destroy_prepare,
-    c_duckdb_prepare_error,
-    c_duckdb_nparams,
-    c_duckdb_parameter_name,
-    c_duckdb_param_type,
-    c_duckdb_param_logical_type,
-    c_duckdb_clear_bindings,
-    c_duckdb_prepared_statement_type,
-    c_duckdb_prepared_statement_column_count,
-    c_duckdb_prepared_statement_column_name,
-    c_duckdb_prepared_statement_column_logical_type,
-    c_duckdb_prepared_statement_column_type,
-) where
-
-import Database.DuckDB.FFI.Types
-import Foreign.C.String (CString)
-import Foreign.C.Types (CInt (..))
-import Foreign.Ptr (Ptr)
-
-{- | Create a prepared statement object from a query.
-
-Note that after calling @duckdb_prepare@, the prepared statement should always
-be destroyed using @duckdb_destroy_prepare@, even if the prepare fails.
-
-If the prepare fails, @duckdb_prepare_error@ can be called to obtain the
-reason why the prepare failed.
-
-Parameters:
-* @connection@: The connection object
-* @query@: The SQL query to prepare
-* @out_prepared_statement@: The resulting prepared statement object
-
-Returns @DuckDBSuccess@ on success or @DuckDBError@ on failure.
--}
-foreign import ccall "duckdb_prepare"
-    c_duckdb_prepare :: DuckDBConnection -> CString -> Ptr DuckDBPreparedStatement -> IO DuckDBState
-
-{- | Closes the prepared statement and de-allocates all memory allocated for the
-statement.
-
-Parameters:
-* @prepared_statement@: The prepared statement to destroy.
--}
-foreign import ccall safe "duckdb_destroy_prepare"
-    c_duckdb_destroy_prepare :: Ptr DuckDBPreparedStatement -> IO ()
-
-{- | Returns the error message associated with the given prepared statement. If the
-prepared statement has no error message, this returns @nullptr@ instead.
-
-The error message should not be freed. It will be de-allocated when
-@duckdb_destroy_prepare@ is called.
-
-Parameters:
-* @prepared_statement@: The prepared statement to obtain the error from.
-
-Returns The error message, or @nullptr@ if there is none.
--}
-foreign import ccall safe "duckdb_prepare_error"
-    c_duckdb_prepare_error :: DuckDBPreparedStatement -> IO CString
-
-{- | Returns the number of parameters that can be provided to the given prepared
-statement.
-
-Returns 0 if the query was not successfully prepared.
-
-Parameters:
-* @prepared_statement@: The prepared statement to obtain the number of
-  parameters for.
--}
-foreign import ccall safe "duckdb_nparams"
-    c_duckdb_nparams :: DuckDBPreparedStatement -> IO DuckDBIdx
-
-{- | Returns the name used to identify the parameter The returned string should be
-freed using @duckdb_free@.
-
-Returns NULL if the index is out of range for the provided prepared statement.
-
-Parameters:
-* @prepared_statement@: The prepared statement for which to get the parameter
-  name from.
--}
-foreign import ccall safe "duckdb_parameter_name"
-    c_duckdb_parameter_name :: DuckDBPreparedStatement -> DuckDBIdx -> IO CString
-
-{- | Returns the parameter type for the parameter at the given index.
-
-Returns @DUCKDB_TYPE_INVALID@ if the parameter index is out of range or the
-statement was not successfully prepared.
-
-Parameters:
-* @prepared_statement@: The prepared statement.
-* @param_idx@: The parameter index.
-
-Returns The parameter type
--}
-foreign import ccall safe "duckdb_param_type"
-    c_duckdb_param_type :: DuckDBPreparedStatement -> DuckDBIdx -> IO DuckDBType
-
-{- | Returns the logical type for the parameter at the given index.
-
-Returns @nullptr@ if the parameter index is out of range or the statement was
-not successfully prepared.
-
-The return type of this call should be destroyed with
-@duckdb_destroy_logical_type@.
-
-Parameters:
-* @prepared_statement@: The prepared statement.
-* @param_idx@: The parameter index.
-
-Returns The logical type of the parameter
--}
-foreign import ccall safe "duckdb_param_logical_type"
-    c_duckdb_param_logical_type :: DuckDBPreparedStatement -> DuckDBIdx -> IO DuckDBLogicalType
-
--- | Clear the params bind to the prepared statement.
-foreign import ccall safe "duckdb_clear_bindings"
-    c_duckdb_clear_bindings :: DuckDBPreparedStatement -> IO DuckDBState
-
-{- | Returns the statement type of the statement to be executed
-
-Parameters:
-* @statement@: The prepared statement.
-
-Returns duckdb_statement_type value or DUCKDB_STATEMENT_TYPE_INVALID
--}
-foreign import ccall safe "duckdb_prepared_statement_type"
-    c_duckdb_prepared_statement_type :: DuckDBPreparedStatement -> IO DuckDBStatementType
-
-{- | Returns the number of columns present in a the result of the prepared
-statement. If any of the column types are invalid, the result will be 1.
-
-Parameters:
-* @prepared_statement@: The prepared statement.
-
-Returns The number of columns present in the result of the prepared statement.
--}
-foreign import ccall safe "duckdb_prepared_statement_column_count"
-    c_duckdb_prepared_statement_column_count :: DuckDBPreparedStatement -> IO DuckDBIdx
-
-{- | Returns the name of the specified column of the result of the
-prepared_statement. The returned string should be freed using @duckdb_free@.
-
-Returns @nullptr@ if the column is out of range.
-
-Parameters:
-* @prepared_statement@: The prepared statement.
-* @col_idx@: The column index.
-
-Returns The column name of the specified column.
--}
-foreign import ccall safe "duckdb_prepared_statement_column_name"
-    c_duckdb_prepared_statement_column_name :: DuckDBPreparedStatement -> DuckDBIdx -> IO CString
-
-{- | Returns the column type of the specified column of the result of the
-prepared_statement.
-
-Returns @DUCKDB_TYPE_INVALID@ if the column is out of range. The return type
-of this call should be destroyed with @duckdb_destroy_logical_type@.
-
-Parameters:
-* @prepared_statement@: The prepared statement to fetch the column type from.
-* @col_idx@: The column index.
-
-Returns The logical type of the specified column.
--}
-foreign import ccall safe "duckdb_prepared_statement_column_logical_type"
-    c_duckdb_prepared_statement_column_logical_type :: DuckDBPreparedStatement -> DuckDBIdx -> IO DuckDBLogicalType
-
-{- | Returns the column type of the specified column of the result of the
-prepared_statement.
-
-Returns @DUCKDB_TYPE_INVALID@ if the column is out of range.
-
-Parameters:
-* @prepared_statement@: The prepared statement to fetch the column type from.
-* @col_idx@: The column index.
-
-Returns The type of the specified column.
--}
-foreign import ccall safe "duckdb_prepared_statement_column_type"
-    c_duckdb_prepared_statement_column_type :: DuckDBPreparedStatement -> DuckDBIdx -> IO DuckDBType
diff --git a/src/Database/DuckDB/FFI/ProfilingInfo.hs b/src/Database/DuckDB/FFI/ProfilingInfo.hs
deleted file mode 100644
--- a/src/Database/DuckDB/FFI/ProfilingInfo.hs
+++ /dev/null
@@ -1,67 +0,0 @@
-module Database.DuckDB.FFI.ProfilingInfo (
-    c_duckdb_get_profiling_info,
-    c_duckdb_profiling_info_get_value,
-    c_duckdb_profiling_info_get_metrics,
-    c_duckdb_profiling_info_get_child_count,
-    c_duckdb_profiling_info_get_child,
-) where
-
-import Database.DuckDB.FFI.Types
-import Foreign.C.String (CString)
-
-{- | Returns the root node of the profiling information. Returns nullptr, if
-profiling is not enabled.
-
-Parameters:
-* @connection@: A connection object.
-
-Returns A profiling information object.
--}
-foreign import ccall safe "duckdb_get_profiling_info"
-    c_duckdb_get_profiling_info :: DuckDBConnection -> IO DuckDBProfilingInfo
-
-{- | Returns the value of the metric of the current profiling info node. Returns
-nullptr, if the metric does not exist or is not enabled. Currently, the value
-holds a string, and you can retrieve the string by calling the corresponding
-function: char *duckdb_get_varchar(duckdb_value value).
-
-Parameters:
-* @info@: A profiling information object.
-* @key@: The name of the requested metric.
-
-Returns The value of the metric. Must be freed with @duckdb_destroy_value@
--}
-foreign import ccall safe "duckdb_profiling_info_get_value"
-    c_duckdb_profiling_info_get_value :: DuckDBProfilingInfo -> CString -> IO DuckDBValue
-
-{- | Returns the key-value metric map of this profiling node as a MAP duckdb_value.
-The individual elements are accessible via the duckdb_value MAP functions.
-
-Parameters:
-* @info@: A profiling information object.
-
-Returns The key-value metric map as a MAP duckdb_value.
--}
-foreign import ccall safe "duckdb_profiling_info_get_metrics"
-    c_duckdb_profiling_info_get_metrics :: DuckDBProfilingInfo -> IO DuckDBValue
-
-{- | Returns the number of children in the current profiling info node.
-
-Parameters:
-* @info@: A profiling information object.
-
-Returns The number of children in the current node.
--}
-foreign import ccall safe "duckdb_profiling_info_get_child_count"
-    c_duckdb_profiling_info_get_child_count :: DuckDBProfilingInfo -> IO DuckDBIdx
-
-{- | Returns the child node at the specified index.
-
-Parameters:
-* @info@: A profiling information object.
-* @index@: The index of the child node.
-
-Returns The child node at the specified index.
--}
-foreign import ccall safe "duckdb_profiling_info_get_child"
-    c_duckdb_profiling_info_get_child :: DuckDBProfilingInfo -> DuckDBIdx -> IO DuckDBProfilingInfo
diff --git a/src/Database/DuckDB/FFI/QueryExecution.hs b/src/Database/DuckDB/FFI/QueryExecution.hs
deleted file mode 100644
--- a/src/Database/DuckDB/FFI/QueryExecution.hs
+++ /dev/null
@@ -1,166 +0,0 @@
-module Database.DuckDB.FFI.QueryExecution (
-    c_duckdb_query,
-    c_duckdb_destroy_result,
-    c_duckdb_column_name,
-    c_duckdb_column_type,
-    c_duckdb_result_statement_type,
-    c_duckdb_column_logical_type,
-    c_duckdb_result_get_arrow_options,
-    c_duckdb_column_count,
-    c_duckdb_rows_changed,
-    c_duckdb_result_error,
-    c_duckdb_result_error_type,
-) where
-
-import Database.DuckDB.FFI.Types
-import Foreign.C.String (CString)
-import Foreign.C.Types (CInt (..))
-import Foreign.Ptr (Ptr)
-
-{- | Executes a SQL query within a connection and stores the full (materialized)
-result in the out_result pointer. If the query fails to execute, DuckDBError
-is returned and the error message can be retrieved by calling
-@duckdb_result_error@.
-
-Note that after running @duckdb_query@, @duckdb_destroy_result@ must be called
-on the result object even if the query fails, otherwise the error stored
-within the result will not be freed correctly.
-
-Parameters:
-* @connection@: The connection to perform the query in.
-* @query@: The SQL query to run.
-* @out_result@: The query result.
-
-Returns @DuckDBSuccess@ on success or @DuckDBError@ on failure.
--}
-foreign import ccall "duckdb_query"
-    c_duckdb_query :: DuckDBConnection -> CString -> Ptr DuckDBResult -> IO DuckDBState
-
-{- | Closes the result and de-allocates all memory allocated for that result.
-
-Parameters:
-* @result@: The result to destroy.
--}
-foreign import ccall safe "duckdb_destroy_result"
-    c_duckdb_destroy_result :: Ptr DuckDBResult -> IO ()
-
-{- | Returns the column name of the specified column. The result should not need to
-be freed; the column names will automatically be destroyed when the result is
-destroyed.
-
-Returns @NULL@ if the column is out of range.
-
-Parameters:
-* @result@: The result object to fetch the column name from.
-* @col@: The column index.
-
-Returns The column name of the specified column.
--}
-foreign import ccall safe "duckdb_column_name"
-    c_duckdb_column_name :: Ptr DuckDBResult -> DuckDBIdx -> IO CString
-
-{- | Returns the column type of the specified column.
-
-Returns @DUCKDB_TYPE_INVALID@ if the column is out of range.
-
-Parameters:
-* @result@: The result object to fetch the column type from.
-* @col@: The column index.
-
-Returns The column type of the specified column.
--}
-foreign import ccall safe "duckdb_column_type"
-    c_duckdb_column_type :: Ptr DuckDBResult -> DuckDBIdx -> IO DuckDBType
-
-{- | Returns the statement type of the statement that was executed
-
-Parameters:
-* @result@: The result object to fetch the statement type from.
-
-Returns duckdb_statement_type value or DUCKDB_STATEMENT_TYPE_INVALID
-
-These bindings call the wrapper symbol
-@wrapped_duckdb_result_statement_type@ but mirror the DuckDB C API semantics of
-@duckdb_result_statement_type@.
--}
-foreign import ccall safe "wrapped_duckdb_result_statement_type"
-    c_duckdb_result_statement_type :: Ptr DuckDBResult -> IO DuckDBStatementType
-
-{- | Returns the logical column type of the specified column.
-
-The return type of this call should be destroyed with
-@duckdb_destroy_logical_type@.
-
-Returns @NULL@ if the column is out of range.
-
-Parameters:
-* @result@: The result object to fetch the column type from.
-* @col@: The column index.
-
-Returns The logical column type of the specified column.
--}
-foreign import ccall safe "duckdb_column_logical_type"
-    c_duckdb_column_logical_type :: Ptr DuckDBResult -> DuckDBIdx -> IO DuckDBLogicalType
-
-{- | Returns the arrow options associated with the given result. These options are
-definitions of how the arrow arrays/schema should be produced.
-
-Parameters:
-* @result@: The result object to fetch arrow options from.
-
-Returns The arrow options associated with the given result. This must be
-destroyed with @duckdb_destroy_arrow_options@.
-
-These bindings call the wrapper symbol
-@wrapped_duckdb_result_get_arrow_options@ but mirror the DuckDB C API semantics
-of @duckdb_result_get_arrow_options@.
--}
-foreign import ccall safe "wrapped_duckdb_result_get_arrow_options"
-    c_duckdb_result_get_arrow_options :: Ptr DuckDBResult -> IO DuckDBArrowOptions
-
-{- | Returns the number of columns present in a the result object.
-
-Parameters:
-* @result@: The result object.
-
-Returns The number of columns present in the result object.
--}
-foreign import ccall safe "duckdb_column_count"
-    c_duckdb_column_count :: Ptr DuckDBResult -> IO DuckDBIdx
-
-{- | Returns the number of rows changed by the query stored in the result. This is
-relevant only for INSERT/UPDATE/DELETE queries. For other queries the
-rows_changed will be 0.
-
-Parameters:
-* @result@: The result object.
-
-Returns The number of rows changed.
--}
-foreign import ccall safe "duckdb_rows_changed"
-    c_duckdb_rows_changed :: Ptr DuckDBResult -> IO DuckDBIdx
-
-{- | Returns the error message contained within the result. The error is only set
-if @duckdb_query@ returns @DuckDBError@.
-
-The result of this function must not be freed. It will be cleaned up when
-@duckdb_destroy_result@ is called.
-
-Parameters:
-* @result@: The result object to fetch the error from.
-
-Returns The error of the result.
--}
-foreign import ccall safe "duckdb_result_error"
-    c_duckdb_result_error :: Ptr DuckDBResult -> IO CString
-
-{- | Returns the result error type contained within the result. The error is only
-set if @duckdb_query@ returns @DuckDBError@.
-
-Parameters:
-* @result@: The result object to fetch the error from.
-
-Returns The error type of the result.
--}
-foreign import ccall safe "duckdb_result_error_type"
-    c_duckdb_result_error_type :: Ptr DuckDBResult -> IO DuckDBErrorType
diff --git a/src/Database/DuckDB/FFI/ReplacementScans.hs b/src/Database/DuckDB/FFI/ReplacementScans.hs
deleted file mode 100644
--- a/src/Database/DuckDB/FFI/ReplacementScans.hs
+++ /dev/null
@@ -1,50 +0,0 @@
-module Database.DuckDB.FFI.ReplacementScans (
-    c_duckdb_add_replacement_scan,
-    c_duckdb_replacement_scan_set_function_name,
-    c_duckdb_replacement_scan_add_parameter,
-    c_duckdb_replacement_scan_set_error,
-) where
-
-import Database.DuckDB.FFI.Types
-import Foreign.C.String (CString)
-import Foreign.Ptr (Ptr)
-
-{- | Add a replacement scan definition to the specified database.
-
-Parameters:
-* @db@: The database object to add the replacement scan to
-* @replacement@: The replacement scan callback
-* @extra_data@: Extra data that is passed back into the specified callback
-* @delete_callback@: The delete callback to call on the extra data, if any
--}
-foreign import ccall safe "duckdb_add_replacement_scan"
-    c_duckdb_add_replacement_scan :: DuckDBDatabase -> DuckDBReplacementCallback -> Ptr () -> DuckDBDeleteCallback -> IO ()
-
-{- | Sets the replacement function name. If this function is called in the
-replacement callback, the replacement scan is performed. If it is not called,
-the replacement callback is not performed.
-
-Parameters:
-* @info@: The info object
-* @function_name@: The function name to substitute.
--}
-foreign import ccall safe "duckdb_replacement_scan_set_function_name"
-    c_duckdb_replacement_scan_set_function_name :: DuckDBReplacementScanInfo -> CString -> IO ()
-
-{- | Adds a parameter to the replacement scan function.
-
-Parameters:
-* @info@: The info object
-* @parameter@: The parameter to add.
--}
-foreign import ccall safe "duckdb_replacement_scan_add_parameter"
-    c_duckdb_replacement_scan_add_parameter :: DuckDBReplacementScanInfo -> DuckDBValue -> IO ()
-
-{- | Report that an error has occurred while executing the replacement scan.
-
-Parameters:
-* @info@: The info object
-* @error@: The error message
--}
-foreign import ccall safe "duckdb_replacement_scan_set_error"
-    c_duckdb_replacement_scan_set_error :: DuckDBReplacementScanInfo -> CString -> IO ()
diff --git a/src/Database/DuckDB/FFI/ResultFunctions.hs b/src/Database/DuckDB/FFI/ResultFunctions.hs
deleted file mode 100644
--- a/src/Database/DuckDB/FFI/ResultFunctions.hs
+++ /dev/null
@@ -1,22 +0,0 @@
-module Database.DuckDB.FFI.ResultFunctions (
-    c_duckdb_result_return_type,
-) where
-
-import Database.DuckDB.FFI.Types
-import Foreign.C.Types (CInt (..))
-import Foreign.Ptr (Ptr)
-
-{- | Returns the return_type of the given result, or DUCKDB_RETURN_TYPE_INVALID on
-error
-
-Parameters:
-* @result@: The result object
-
-Returns The return_type
-
-These bindings call the wrapper symbol
-@wrapped_duckdb_result_return_type@ but mirror the DuckDB C API semantics of
-@duckdb_result_return_type@.
--}
-foreign import ccall safe "wrapped_duckdb_result_return_type"
-    c_duckdb_result_return_type :: Ptr DuckDBResult -> IO DuckDBResultType
diff --git a/src/Database/DuckDB/FFI/ScalarFunctions.hs b/src/Database/DuckDB/FFI/ScalarFunctions.hs
deleted file mode 100644
--- a/src/Database/DuckDB/FFI/ScalarFunctions.hs
+++ /dev/null
@@ -1,334 +0,0 @@
-module Database.DuckDB.FFI.ScalarFunctions (
-    c_duckdb_create_scalar_function,
-    c_duckdb_destroy_scalar_function,
-    c_duckdb_scalar_function_set_name,
-    c_duckdb_scalar_function_set_varargs,
-    c_duckdb_scalar_function_set_special_handling,
-    c_duckdb_scalar_function_set_volatile,
-    c_duckdb_scalar_function_add_parameter,
-    c_duckdb_scalar_function_set_return_type,
-    c_duckdb_scalar_function_set_extra_info,
-    c_duckdb_scalar_function_set_bind,
-    c_duckdb_scalar_function_set_bind_data,
-    c_duckdb_scalar_function_set_bind_data_copy,
-    c_duckdb_scalar_function_bind_set_error,
-    c_duckdb_scalar_function_set_function,
-    c_duckdb_scalar_function_set_init,
-    c_duckdb_register_scalar_function,
-    c_duckdb_scalar_function_get_extra_info,
-    c_duckdb_scalar_function_bind_get_extra_info,
-    c_duckdb_scalar_function_get_bind_data,
-    c_duckdb_scalar_function_get_state,
-    c_duckdb_scalar_function_get_client_context,
-    c_duckdb_scalar_function_set_error,
-    c_duckdb_scalar_function_init_set_error,
-    c_duckdb_scalar_function_init_set_state,
-    c_duckdb_scalar_function_init_get_client_context,
-    c_duckdb_scalar_function_init_get_bind_data,
-    c_duckdb_scalar_function_init_get_extra_info,
-    c_duckdb_create_scalar_function_set,
-    c_duckdb_destroy_scalar_function_set,
-    c_duckdb_add_scalar_function_to_set,
-    c_duckdb_register_scalar_function_set,
-    c_duckdb_scalar_function_bind_get_argument_count,
-    c_duckdb_scalar_function_bind_get_argument,
-) where
-
-import Database.DuckDB.FFI.Types
-import Foreign.C.String (CString)
-import Foreign.C.Types (CInt (..))
-import Foreign.Ptr (Ptr)
-
-{- | Creates a new empty scalar function.
-
-The return value must be destroyed with @duckdb_destroy_scalar_function@.
-
-Returns The scalar function object.
--}
-foreign import ccall safe "duckdb_create_scalar_function"
-    c_duckdb_create_scalar_function :: IO DuckDBScalarFunction
-
-{- | Destroys the given scalar function object.
-
-Parameters:
-* @scalar_function@: The scalar function to destroy
--}
-foreign import ccall safe "duckdb_destroy_scalar_function"
-    c_duckdb_destroy_scalar_function :: Ptr DuckDBScalarFunction -> IO ()
-
-{- | Sets the name of the given scalar function.
-
-Parameters:
-* @scalar_function@: The scalar function
-* @name@: The name of the scalar function
--}
-foreign import ccall safe "duckdb_scalar_function_set_name"
-    c_duckdb_scalar_function_set_name :: DuckDBScalarFunction -> CString -> IO ()
-
-{- | Sets the parameters of the given scalar function to varargs. Does not require
-adding parameters with duckdb_scalar_function_add_parameter.
-
-Parameters:
-* @scalar_function@: The scalar function.
-* @type@: The type of the arguments.
-
-Returns The parameter type. Cannot contain INVALID.
--}
-foreign import ccall safe "duckdb_scalar_function_set_varargs"
-    c_duckdb_scalar_function_set_varargs :: DuckDBScalarFunction -> DuckDBLogicalType -> IO ()
-
-{- | Sets the scalar function's null-handling behavior to special.
-
-Parameters:
-* @scalar_function@: The scalar function.
--}
-foreign import ccall safe "duckdb_scalar_function_set_special_handling"
-    c_duckdb_scalar_function_set_special_handling :: DuckDBScalarFunction -> IO ()
-
-{- | Sets the Function Stability of the scalar function to VOLATILE, indicating the
-function should be re-run for every row. This limits optimization that can be
-performed for the function.
-
-Parameters:
-* @scalar_function@: The scalar function.
--}
-foreign import ccall safe "duckdb_scalar_function_set_volatile"
-    c_duckdb_scalar_function_set_volatile :: DuckDBScalarFunction -> IO ()
-
-{- | Adds a parameter to the scalar function.
-
-Parameters:
-* @scalar_function@: The scalar function.
-* @type@: The parameter type. Cannot contain INVALID.
--}
-foreign import ccall safe "duckdb_scalar_function_add_parameter"
-    c_duckdb_scalar_function_add_parameter :: DuckDBScalarFunction -> DuckDBLogicalType -> IO ()
-
-{- | Sets the return type of the scalar function.
-
-Parameters:
-* @scalar_function@: The scalar function
-* @type@: Cannot contain INVALID or ANY.
--}
-foreign import ccall safe "duckdb_scalar_function_set_return_type"
-    c_duckdb_scalar_function_set_return_type :: DuckDBScalarFunction -> DuckDBLogicalType -> IO ()
-
-{- | Assigns extra information to the scalar function that can be fetched during
-binding, etc.
-
-Parameters:
-* @scalar_function@: The scalar function
-* @extra_info@: The extra information
-* @destroy@: The callback that will be called to destroy the extra information
-  (if any)
--}
-foreign import ccall safe "duckdb_scalar_function_set_extra_info"
-    c_duckdb_scalar_function_set_extra_info :: DuckDBScalarFunction -> Ptr () -> DuckDBDeleteCallback -> IO ()
-
-{- | Sets the (optional) bind function of the scalar function.
-
-Parameters:
-* @scalar_function@: The scalar function.
-* @bind@: The bind function.
--}
-foreign import ccall safe "duckdb_scalar_function_set_bind"
-    c_duckdb_scalar_function_set_bind :: DuckDBScalarFunction -> DuckDBScalarFunctionBindFun -> IO ()
-
-{- | Sets the user-provided bind data in the bind object of the scalar function.
-The bind data object can be retrieved again during execution. In most case,
-you also need to set the copy-callback of your bind data via
-duckdb_scalar_function_set_bind_data_copy.
-
-Parameters:
-* @info@: The bind info of the scalar function.
-* @bind_data@: The bind data object.
-* @destroy@: The callback to destroy the bind data (if any).
--}
-foreign import ccall safe "duckdb_scalar_function_set_bind_data"
-    c_duckdb_scalar_function_set_bind_data :: DuckDBBindInfo -> Ptr () -> DuckDBDeleteCallback -> IO ()
-
-{- | Sets the copy-callback for the user-provided bind data in the bind object of
-the scalar function.
-
-Parameters:
-* @info@: The bind info of the scalar function.
-* @copy@: The callback to copy the bind data (if any).
--}
-foreign import ccall safe "duckdb_scalar_function_set_bind_data_copy"
-    c_duckdb_scalar_function_set_bind_data_copy :: DuckDBBindInfo -> DuckDBCopyCallback -> IO ()
-
-{- | Report that an error has occurred while calling bind on a scalar function.
-
-Parameters:
-* @info@: The bind info object.
-* @error@: The error message.
--}
-foreign import ccall safe "duckdb_scalar_function_bind_set_error"
-    c_duckdb_scalar_function_bind_set_error :: DuckDBBindInfo -> CString -> IO ()
-
-{- | Sets the main function of the scalar function.
-
-Parameters:
-* @scalar_function@: The scalar function
-* @function@: The function
--}
-foreign import ccall safe "duckdb_scalar_function_set_function"
-    c_duckdb_scalar_function_set_function :: DuckDBScalarFunction -> DuckDBScalarFunctionFun -> IO ()
-
--- | Sets the thread-local init function of the scalar function.
-foreign import ccall safe "duckdb_scalar_function_set_init"
-    c_duckdb_scalar_function_set_init :: DuckDBScalarFunction -> DuckDBScalarFunctionInitFun -> IO ()
-
-{- | Register the scalar function object within the given connection.
-
-The function requires at least a name, a function and a return type.
-
-If the function is incomplete or a function with this name already exists
-DuckDBError is returned.
-
-Parameters:
-* @con@: The connection to register it in.
-* @scalar_function@: The function pointer
-
-Returns Whether or not the registration was successful.
--}
-foreign import ccall safe "duckdb_register_scalar_function"
-    c_duckdb_register_scalar_function :: DuckDBConnection -> DuckDBScalarFunction -> IO DuckDBState
-
-{- | Retrieves the extra info of the function as set in
-@duckdb_scalar_function_set_extra_info@.
-
-Parameters:
-* @info@: The info object.
-
-Returns The extra info.
--}
-foreign import ccall safe "duckdb_scalar_function_get_extra_info"
-    c_duckdb_scalar_function_get_extra_info :: DuckDBFunctionInfo -> IO (Ptr ())
-
-{- | Retrieves the extra info of the function as set in the bind info.
-
-Parameters:
-* @info@: The info object.
-
-Returns The extra info.
--}
-foreign import ccall safe "duckdb_scalar_function_bind_get_extra_info"
-    c_duckdb_scalar_function_bind_get_extra_info :: DuckDBBindInfo -> IO (Ptr ())
-
-{- | Gets the scalar function's bind data set by
-@duckdb_scalar_function_set_bind_data@. Note that the bind data is read-only.
-
-Parameters:
-* @info@: The function info.
-
-Returns The bind data object.
--}
-foreign import ccall safe "duckdb_scalar_function_get_bind_data"
-    c_duckdb_scalar_function_get_bind_data :: DuckDBFunctionInfo -> IO (Ptr ())
-
--- | Gets the scalar function's execution state set during init.
-foreign import ccall safe "duckdb_scalar_function_get_state"
-    c_duckdb_scalar_function_get_state :: DuckDBFunctionInfo -> IO (Ptr ())
-
-{- | Retrieves the client context of the bind info of a scalar function.
-
-Parameters:
-* @info@: The bind info object of the scalar function.
-* @out_context@: The client context of the bind info. Must be destroyed with
-  @duckdb_destroy_client_context@.
--}
-foreign import ccall safe "duckdb_scalar_function_get_client_context"
-    c_duckdb_scalar_function_get_client_context :: DuckDBBindInfo -> Ptr DuckDBClientContext -> IO ()
-
-{- | Report that an error has occurred while executing the scalar function.
-
-Parameters:
-* @info@: The info object.
-* @error@: The error message
--}
-foreign import ccall safe "duckdb_scalar_function_set_error"
-    c_duckdb_scalar_function_set_error :: DuckDBFunctionInfo -> CString -> IO ()
-
--- | Report that an error occurred while initializing the scalar function.
-foreign import ccall safe "duckdb_scalar_function_init_set_error"
-    c_duckdb_scalar_function_init_set_error :: DuckDBInitInfo -> CString -> IO ()
-
--- | Installs thread-local execution state for a scalar function.
-foreign import ccall safe "duckdb_scalar_function_init_set_state"
-    c_duckdb_scalar_function_init_set_state :: DuckDBInitInfo -> Ptr () -> DuckDBDeleteCallback -> IO ()
-
--- | Retrieves the client context during scalar-function initialization.
-foreign import ccall safe "duckdb_scalar_function_init_get_client_context"
-    c_duckdb_scalar_function_init_get_client_context :: DuckDBInitInfo -> Ptr DuckDBClientContext -> IO ()
-
--- | Retrieves bind data during scalar-function initialization.
-foreign import ccall safe "duckdb_scalar_function_init_get_bind_data"
-    c_duckdb_scalar_function_init_get_bind_data :: DuckDBInitInfo -> IO (Ptr ())
-
--- | Retrieves extra info during scalar-function initialization.
-foreign import ccall safe "duckdb_scalar_function_init_get_extra_info"
-    c_duckdb_scalar_function_init_get_extra_info :: DuckDBInitInfo -> IO (Ptr ())
-
-{- | Creates a new empty scalar function set.
-
-The return value must be destroyed with @duckdb_destroy_scalar_function_set@.
-
-Returns The scalar function set object.
--}
-foreign import ccall safe "duckdb_create_scalar_function_set"
-    c_duckdb_create_scalar_function_set :: CString -> IO DuckDBScalarFunctionSet
-
--- | Destroys the given scalar function set object.
-foreign import ccall safe "duckdb_destroy_scalar_function_set"
-    c_duckdb_destroy_scalar_function_set :: Ptr DuckDBScalarFunctionSet -> IO ()
-
-{- | Adds the scalar function as a new overload to the scalar function set.
-
-Returns DuckDBError if the function could not be added, for example if the
-overload already exists.
-
-Parameters:
-* @set@: The scalar function set
-* @function@: The function to add
--}
-foreign import ccall safe "duckdb_add_scalar_function_to_set"
-    c_duckdb_add_scalar_function_to_set :: DuckDBScalarFunctionSet -> DuckDBScalarFunction -> IO DuckDBState
-
-{- | Register the scalar function set within the given connection.
-
-The set requires at least a single valid overload.
-
-If the set is incomplete or a function with this name already exists
-DuckDBError is returned.
-
-Parameters:
-* @con@: The connection to register it in.
-* @set@: The function set to register
-
-Returns Whether or not the registration was successful.
--}
-foreign import ccall safe "duckdb_register_scalar_function_set"
-    c_duckdb_register_scalar_function_set :: DuckDBConnection -> DuckDBScalarFunctionSet -> IO DuckDBState
-
-{- | Returns the number of input arguments of the scalar function.
-
-Parameters:
-* @info@: The bind info.
-
-Returns The number of input arguments.
--}
-foreign import ccall safe "duckdb_scalar_function_bind_get_argument_count"
-    c_duckdb_scalar_function_bind_get_argument_count :: DuckDBBindInfo -> IO DuckDBIdx
-
-{- | Returns the input argument at index of the scalar function.
-
-Parameters:
-* @info@: The bind info.
-* @index@: The argument index.
-
-Returns The input argument at index. Must be destroyed with
-@duckdb_destroy_expression@.
--}
-foreign import ccall safe "duckdb_scalar_function_bind_get_argument"
-    c_duckdb_scalar_function_bind_get_argument :: DuckDBBindInfo -> DuckDBIdx -> IO DuckDBExpression
diff --git a/src/Database/DuckDB/FFI/SelectionVector.hs b/src/Database/DuckDB/FFI/SelectionVector.hs
deleted file mode 100644
--- a/src/Database/DuckDB/FFI/SelectionVector.hs
+++ /dev/null
@@ -1,37 +0,0 @@
-module Database.DuckDB.FFI.SelectionVector (
-    c_duckdb_create_selection_vector,
-    c_duckdb_destroy_selection_vector,
-    c_duckdb_selection_vector_get_data_ptr,
-) where
-
-import Database.DuckDB.FFI.Types
-import Foreign.Ptr (Ptr)
-
-{- | Creates a new selection vector of size @size@. Must be destroyed with
-@duckdb_destroy_selection_vector@.
-
-Parameters:
-* @size@: The size of the selection vector.
-
-Returns The selection vector.
--}
-foreign import ccall safe "duckdb_create_selection_vector"
-    c_duckdb_create_selection_vector :: DuckDBIdx -> IO DuckDBSelectionVector
-
-{- | Destroys the selection vector and de-allocates its memory.
-
-Parameters:
-* @sel@: The selection vector.
--}
-foreign import ccall safe "duckdb_destroy_selection_vector"
-    c_duckdb_destroy_selection_vector :: DuckDBSelectionVector -> IO ()
-
-{- | Access the data pointer of a selection vector.
-
-Parameters:
-* @sel@: The selection vector.
-
-Returns The data pointer.
--}
-foreign import ccall safe "duckdb_selection_vector_get_data_ptr"
-    c_duckdb_selection_vector_get_data_ptr :: DuckDBSelectionVector -> IO (Ptr DuckDBSel)
diff --git a/src/Database/DuckDB/FFI/StreamingResult.hs b/src/Database/DuckDB/FFI/StreamingResult.hs
deleted file mode 100644
--- a/src/Database/DuckDB/FFI/StreamingResult.hs
+++ /dev/null
@@ -1,24 +0,0 @@
-module Database.DuckDB.FFI.StreamingResult (
-    c_duckdb_fetch_chunk,
-) where
-
-import Database.DuckDB.FFI.Types
-import Foreign.Ptr (Ptr)
-
-{- | Fetches a data chunk from a duckdb_result. This function should be called
-repeatedly until the result is exhausted.
-
-The result must be destroyed with @duckdb_destroy_data_chunk@.
-
-It is not known beforehand how many chunks will be returned by this result.
-
-Parameters:
-* @result@: The result object to fetch the data chunk from.
-
-Returns The resulting data chunk. Returns @NULL@ if the result has an error.
-
-These bindings call the wrapper symbol @wrapped_duckdb_fetch_chunk@ but
-mirror the DuckDB C API semantics of @duckdb_fetch_chunk@.
--}
-foreign import ccall safe "wrapped_duckdb_fetch_chunk"
-    c_duckdb_fetch_chunk :: Ptr DuckDBResult -> IO DuckDBDataChunk
diff --git a/src/Database/DuckDB/FFI/TableDescription.hs b/src/Database/DuckDB/FFI/TableDescription.hs
deleted file mode 100644
--- a/src/Database/DuckDB/FFI/TableDescription.hs
+++ /dev/null
@@ -1,100 +0,0 @@
-module Database.DuckDB.FFI.TableDescription (
-    c_duckdb_table_description_create,
-    c_duckdb_table_description_create_ext,
-    c_duckdb_table_description_destroy,
-    c_duckdb_table_description_error,
-    c_duckdb_column_has_default,
-    c_duckdb_table_description_get_column_count,
-    c_duckdb_table_description_get_column_name,
-    c_duckdb_table_description_get_column_type,
-) where
-
-import Database.DuckDB.FFI.Types
-import Foreign.C.String (CString)
-import Foreign.C.Types (CBool (..), CInt (..))
-import Foreign.Ptr (Ptr)
-
-{- | Creates a table description object. Note that
-@duckdb_table_description_destroy@ should always be called on the resulting
-table_description, even if the function returns @DuckDBError@.
-
-Parameters:
-* @connection@: The connection context.
-* @schema@: The schema of the table, or @nullptr@ for the default schema.
-* @table@: The table name.
-* @out@: The resulting table description object.
-
-Returns @DuckDBSuccess@ on success or @DuckDBError@ on failure.
--}
-foreign import ccall "duckdb_table_description_create"
-    c_duckdb_table_description_create :: DuckDBConnection -> CString -> CString -> Ptr DuckDBTableDescription -> IO DuckDBState
-
-{- | Creates a table description object. Note that
-@duckdb_table_description_destroy@ must be called on the resulting
-table_description, even if the function returns @DuckDBError@.
-
-Parameters:
-* @connection@: The connection context.
-* @catalog@: The catalog (database) name of the table, or @nullptr@ for the
-  default catalog.
-* @schema@: The schema of the table, or @nullptr@ for the default schema.
-* @table@: The table name.
-* @out@: The resulting table description object.
-
-Returns @DuckDBSuccess@ on success or @DuckDBError@ on failure.
--}
-foreign import ccall "duckdb_table_description_create_ext"
-    c_duckdb_table_description_create_ext :: DuckDBConnection -> CString -> CString -> CString -> Ptr DuckDBTableDescription -> IO DuckDBState
-
-{- | Destroy the TableDescription object.
-
-Parameters:
-* @table_description@: The table_description to destroy.
--}
-foreign import ccall safe "duckdb_table_description_destroy"
-    c_duckdb_table_description_destroy :: Ptr DuckDBTableDescription -> IO ()
-
-{- | Returns the error message associated with the given table_description. If the
-table_description has no error message, this returns @nullptr@ instead. The
-error message should not be freed. It will be de-allocated when
-@duckdb_table_description_destroy@ is called.
-
-Parameters:
-* @table_description@: The table_description to get the error from.
-
-Returns The error message, or @nullptr@ if there is none.
--}
-foreign import ccall safe "duckdb_table_description_error"
-    c_duckdb_table_description_error :: DuckDBTableDescription -> IO CString
-
-{- | Check if the column at @index@ index of the table has a DEFAULT expression.
-
-Parameters:
-* @table_description@: The table_description to query.
-* @index@: The index of the column to query.
-* @out@: The out-parameter used to store the result.
-
-Returns @DuckDBSuccess@ on success or @DuckDBError@ on failure.
--}
-foreign import ccall safe "duckdb_column_has_default"
-    c_duckdb_column_has_default :: DuckDBTableDescription -> DuckDBIdx -> Ptr CBool -> IO DuckDBState
-
--- | Returns the number of columns in the described table.
-foreign import ccall safe "duckdb_table_description_get_column_count"
-    c_duckdb_table_description_get_column_count :: DuckDBTableDescription -> IO DuckDBIdx
-
-{- | Obtain the column name at @index@. The out result must be destroyed with
-@duckdb_free@.
-
-Parameters:
-* @table_description@: The table_description to query.
-* @index@: The index of the column to query.
-
-Returns The column name.
--}
-foreign import ccall safe "duckdb_table_description_get_column_name"
-    c_duckdb_table_description_get_column_name :: DuckDBTableDescription -> DuckDBIdx -> IO CString
-
--- | Obtain the logical type of the column at @index@.
-foreign import ccall safe "duckdb_table_description_get_column_type"
-    c_duckdb_table_description_get_column_type :: DuckDBTableDescription -> DuckDBIdx -> IO DuckDBLogicalType
diff --git a/src/Database/DuckDB/FFI/TableFunctions.hs b/src/Database/DuckDB/FFI/TableFunctions.hs
deleted file mode 100644
--- a/src/Database/DuckDB/FFI/TableFunctions.hs
+++ /dev/null
@@ -1,420 +0,0 @@
-module Database.DuckDB.FFI.TableFunctions (
-    -- Table function definition
-    c_duckdb_create_table_function,
-    c_duckdb_destroy_table_function,
-    c_duckdb_table_function_set_name,
-    c_duckdb_table_function_add_parameter,
-    c_duckdb_table_function_add_named_parameter,
-    c_duckdb_table_function_set_extra_info,
-    c_duckdb_table_function_set_bind,
-    c_duckdb_table_function_set_init,
-    c_duckdb_table_function_set_local_init,
-    c_duckdb_table_function_set_function,
-    c_duckdb_table_function_supports_projection_pushdown,
-    c_duckdb_register_table_function,
-    -- Bind helpers
-    c_duckdb_bind_get_extra_info,
-    c_duckdb_table_function_get_client_context,
-    c_duckdb_bind_add_result_column,
-    c_duckdb_bind_get_parameter_count,
-    c_duckdb_bind_get_parameter,
-    c_duckdb_bind_get_named_parameter,
-    c_duckdb_table_function_bind_get_result_column_count,
-    c_duckdb_table_function_bind_get_result_column_name,
-    c_duckdb_table_function_bind_get_result_column_type,
-    c_duckdb_bind_set_bind_data,
-    c_duckdb_bind_set_cardinality,
-    c_duckdb_bind_set_error,
-    -- Init helpers
-    c_duckdb_init_get_extra_info,
-    c_duckdb_init_get_bind_data,
-    c_duckdb_init_set_init_data,
-    c_duckdb_init_get_column_count,
-    c_duckdb_init_get_column_index,
-    c_duckdb_init_set_max_threads,
-    c_duckdb_init_set_error,
-    -- Execution helpers
-    c_duckdb_function_get_extra_info,
-    c_duckdb_function_get_bind_data,
-    c_duckdb_function_get_init_data,
-    c_duckdb_function_get_local_init_data,
-    c_duckdb_function_set_error,
-) where
-
-import Database.DuckDB.FFI.Types
-import Foreign.C.String (CString)
-import Foreign.C.Types (CBool (..), CInt (..))
-import Foreign.Ptr (Ptr)
-
-{- | Creates a new empty table function.
-
-The return value should be destroyed with @duckdb_destroy_table_function@.
-
-Returns The table function object.
--}
-foreign import ccall safe "duckdb_create_table_function"
-    c_duckdb_create_table_function :: IO DuckDBTableFunction
-
-{- | Destroys the given table function object.
-
-Parameters:
-* @table_function@: The table function to destroy
--}
-foreign import ccall safe "duckdb_destroy_table_function"
-    c_duckdb_destroy_table_function :: Ptr DuckDBTableFunction -> IO ()
-
-{- | Sets the name of the given table function.
-
-Parameters:
-* @table_function@: The table function
-* @name@: The name of the table function
--}
-foreign import ccall safe "duckdb_table_function_set_name"
-    c_duckdb_table_function_set_name :: DuckDBTableFunction -> CString -> IO ()
-
-{- | Adds a parameter to the table function.
-
-Parameters:
-* @table_function@: The table function.
-* @type@: The parameter type. Cannot contain INVALID.
--}
-foreign import ccall safe "duckdb_table_function_add_parameter"
-    c_duckdb_table_function_add_parameter :: DuckDBTableFunction -> DuckDBLogicalType -> IO ()
-
-{- | Adds a named parameter to the table function.
-
-Parameters:
-* @table_function@: The table function.
-* @name@: The parameter name.
-* @type@: The parameter type. Cannot contain INVALID.
--}
-foreign import ccall safe "duckdb_table_function_add_named_parameter"
-    c_duckdb_table_function_add_named_parameter :: DuckDBTableFunction -> CString -> DuckDBLogicalType -> IO ()
-
-{- | Assigns extra information to the table function that can be fetched during
-binding, etc.
-
-Parameters:
-* @table_function@: The table function
-* @extra_info@: The extra information
-* @destroy@: The callback that will be called to destroy the extra information
-  (if any)
--}
-foreign import ccall safe "duckdb_table_function_set_extra_info"
-    c_duckdb_table_function_set_extra_info :: DuckDBTableFunction -> Ptr () -> DuckDBDeleteCallback -> IO ()
-
-{- | Sets the bind function of the table function.
-
-Parameters:
-* @table_function@: The table function
-* @bind@: The bind function
--}
-foreign import ccall safe "duckdb_table_function_set_bind"
-    c_duckdb_table_function_set_bind :: DuckDBTableFunction -> DuckDBTableFunctionBindFun -> IO ()
-
-{- | Sets the init function of the table function.
-
-Parameters:
-* @table_function@: The table function
-* @init@: The init function
--}
-foreign import ccall safe "duckdb_table_function_set_init"
-    c_duckdb_table_function_set_init :: DuckDBTableFunction -> DuckDBTableFunctionInitFun -> IO ()
-
-{- | Sets the thread-local init function of the table function.
-
-Parameters:
-* @table_function@: The table function
-* @init@: The init function
--}
-foreign import ccall safe "duckdb_table_function_set_local_init"
-    c_duckdb_table_function_set_local_init :: DuckDBTableFunction -> DuckDBTableFunctionInitFun -> IO ()
-
-{- | Sets the main function of the table function.
-
-Parameters:
-* @table_function@: The table function
-* @function@: The function
--}
-foreign import ccall safe "duckdb_table_function_set_function"
-    c_duckdb_table_function_set_function :: DuckDBTableFunction -> DuckDBTableFunctionFun -> IO ()
-
-{- | Sets whether or not the given table function supports projection pushdown.
-
-If this is set to true, the system will provide a list of all required columns
-in the @init@ stage through the @duckdb_init_get_column_count@ and
-@duckdb_init_get_column_index@ functions. If this is set to false (the
-default), the system will expect all columns to be projected.
-
-Parameters:
-* @table_function@: The table function
-* @pushdown@: True if the table function supports projection pushdown, false
-  otherwise.
--}
-foreign import ccall safe "duckdb_table_function_supports_projection_pushdown"
-    c_duckdb_table_function_supports_projection_pushdown :: DuckDBTableFunction -> CBool -> IO ()
-
-{- | Register the table function object within the given connection.
-
-The function requires at least a name, a bind function, an init function and a
-main function.
-
-If the function is incomplete or a function with this name already exists
-DuckDBError is returned.
-
-Parameters:
-* @con@: The connection to register it in.
-* @function@: The function pointer
-
-Returns Whether or not the registration was successful.
--}
-foreign import ccall safe "duckdb_register_table_function"
-    c_duckdb_register_table_function :: DuckDBConnection -> DuckDBTableFunction -> IO DuckDBState
-
-{- | Retrieves the extra info of the function as set in
-@duckdb_table_function_set_extra_info@.
-
-Parameters:
-* @info@: The info object
-
-Returns The extra info
--}
-foreign import ccall safe "duckdb_bind_get_extra_info"
-    c_duckdb_bind_get_extra_info :: DuckDBBindInfo -> IO (Ptr ())
-
-{- | Retrieves the client context of the bind info of a table function.
-
-Parameters:
-* @info@: The bind info object of the table function.
-* @out_context@: The client context of the bind info. Must be destroyed with
-  @duckdb_destroy_client_context@.
--}
-foreign import ccall safe "duckdb_table_function_get_client_context"
-    c_duckdb_table_function_get_client_context :: DuckDBBindInfo -> Ptr DuckDBClientContext -> IO ()
-
-{- | Adds a result column to the output of the table function.
-
-Parameters:
-* @info@: The table function's bind info.
-* @name@: The column name.
-* @type@: The logical column type.
--}
-foreign import ccall safe "duckdb_bind_add_result_column"
-    c_duckdb_bind_add_result_column :: DuckDBBindInfo -> CString -> DuckDBLogicalType -> IO ()
-
-{- | Retrieves the number of regular (non-named) parameters to the function.
-
-Parameters:
-* @info@: The info object
-
-Returns The number of parameters
--}
-foreign import ccall safe "duckdb_bind_get_parameter_count"
-    c_duckdb_bind_get_parameter_count :: DuckDBBindInfo -> IO DuckDBIdx
-
-{- | Retrieves the parameter at the given index.
-
-The result must be destroyed with @duckdb_destroy_value@.
-
-Parameters:
-* @info@: The info object
-* @index@: The index of the parameter to get
-
-Returns The value of the parameter. Must be destroyed with
-@duckdb_destroy_value@.
--}
-foreign import ccall safe "duckdb_bind_get_parameter"
-    c_duckdb_bind_get_parameter :: DuckDBBindInfo -> DuckDBIdx -> IO DuckDBValue
-
-{- | Retrieves a named parameter with the given name.
-
-The result must be destroyed with @duckdb_destroy_value@.
-
-Parameters:
-* @info@: The info object
-* @name@: The name of the parameter
-
-Returns The value of the parameter. Must be destroyed with
-@duckdb_destroy_value@.
--}
-foreign import ccall safe "duckdb_bind_get_named_parameter"
-    c_duckdb_bind_get_named_parameter :: DuckDBBindInfo -> CString -> IO DuckDBValue
-
--- | Returns the number of result columns already defined on the table function.
-foreign import ccall safe "duckdb_table_function_bind_get_result_column_count"
-    c_duckdb_table_function_bind_get_result_column_count :: DuckDBBindInfo -> IO DuckDBIdx
-
--- | Returns the name of a previously defined result column.
-foreign import ccall safe "duckdb_table_function_bind_get_result_column_name"
-    c_duckdb_table_function_bind_get_result_column_name :: DuckDBBindInfo -> DuckDBIdx -> IO CString
-
--- | Returns the logical type of a previously defined result column.
-foreign import ccall safe "duckdb_table_function_bind_get_result_column_type"
-    c_duckdb_table_function_bind_get_result_column_type :: DuckDBBindInfo -> DuckDBIdx -> IO DuckDBLogicalType
-
-{- | Sets the user-provided bind data in the bind object of the table function.
-This object can be retrieved again during execution.
-
-Parameters:
-* @info@: The bind info of the table function.
-* @bind_data@: The bind data object.
-* @destroy@: The callback to destroy the bind data (if any).
--}
-foreign import ccall safe "duckdb_bind_set_bind_data"
-    c_duckdb_bind_set_bind_data :: DuckDBBindInfo -> Ptr () -> DuckDBDeleteCallback -> IO ()
-
-{- | Sets the cardinality estimate for the table function, used for optimization.
-
-Parameters:
-* @info@: The bind data object.
-* @is_exact@: Whether or not the cardinality estimate is exact, or an
-  approximation
--}
-foreign import ccall safe "duckdb_bind_set_cardinality"
-    c_duckdb_bind_set_cardinality :: DuckDBBindInfo -> DuckDBIdx -> CBool -> IO ()
-
-{- | Report that an error has occurred while calling bind on a table function.
-
-Parameters:
-* @info@: The info object
-* @error@: The error message
--}
-foreign import ccall safe "duckdb_bind_set_error"
-    c_duckdb_bind_set_error :: DuckDBBindInfo -> CString -> IO ()
-
-{- | Retrieves the extra info of the function as set in
-@duckdb_table_function_set_extra_info@.
-
-Parameters:
-* @info@: The info object
-
-Returns The extra info
--}
-foreign import ccall safe "duckdb_init_get_extra_info"
-    c_duckdb_init_get_extra_info :: DuckDBInitInfo -> IO (Ptr ())
-
-{- | Gets the bind data set by @duckdb_bind_set_bind_data@ during the bind.
-
-Note that the bind data should be considered as read-only. For tracking state,
-use the init data instead.
-
-Parameters:
-* @info@: The info object
-
-Returns The bind data object
--}
-foreign import ccall safe "duckdb_init_get_bind_data"
-    c_duckdb_init_get_bind_data :: DuckDBInitInfo -> IO (Ptr ())
-
-{- | Sets the user-provided init data in the init object. This object can be
-retrieved again during execution.
-
-Parameters:
-* @info@: The info object
-* @init_data@: The init data object.
-* @destroy@: The callback that will be called to destroy the init data (if
-  any)
--}
-foreign import ccall safe "duckdb_init_set_init_data"
-    c_duckdb_init_set_init_data :: DuckDBInitInfo -> Ptr () -> DuckDBDeleteCallback -> IO ()
-
-{- | Returns the number of projected columns.
-
-This function must be used if projection pushdown is enabled to figure out
-which columns to emit.
-
-Parameters:
-* @info@: The info object
-
-Returns The number of projected columns.
--}
-foreign import ccall safe "duckdb_init_get_column_count"
-    c_duckdb_init_get_column_count :: DuckDBInitInfo -> IO DuckDBIdx
-
-{- | Returns the column index of the projected column at the specified position.
-
-This function must be used if projection pushdown is enabled to figure out
-which columns to emit.
-
-Parameters:
-* @info@: The info object
-* @column_index@: The index at which to get the projected column index, from
-  0..duckdb_init_get_column_count(info)
-
-Returns The column index of the projected column.
--}
-foreign import ccall safe "duckdb_init_get_column_index"
-    c_duckdb_init_get_column_index :: DuckDBInitInfo -> DuckDBIdx -> IO DuckDBIdx
-
-{- | Sets how many threads can process this table function in parallel (default: 1)
-
-Parameters:
-* @info@: The info object
-* @max_threads@: The maximum amount of threads that can process this table
-  function
--}
-foreign import ccall safe "duckdb_init_set_max_threads"
-    c_duckdb_init_set_max_threads :: DuckDBInitInfo -> DuckDBIdx -> IO ()
-
-{- | Report that an error has occurred while calling init.
-
-Parameters:
-* @info@: The info object
-* @error@: The error message
--}
-foreign import ccall safe "duckdb_init_set_error"
-    c_duckdb_init_set_error :: DuckDBInitInfo -> CString -> IO ()
-
-{- | Retrieves the extra info of the function as set in
-@duckdb_table_function_set_extra_info@.
-
-Parameters:
-* @info@: The info object
-
-Returns The extra info
--}
-foreign import ccall safe "duckdb_function_get_extra_info"
-    c_duckdb_function_get_extra_info :: DuckDBFunctionInfo -> IO (Ptr ())
-
-{- | Gets the table function's bind data set by @duckdb_bind_set_bind_data@.
-
-Note that the bind data is read-only. For tracking state, use the init data
-instead.
-
-Parameters:
-* @info@: The function info object.
-
-Returns The bind data object.
--}
-foreign import ccall safe "duckdb_function_get_bind_data"
-    c_duckdb_function_get_bind_data :: DuckDBFunctionInfo -> IO (Ptr ())
-
-{- | Gets the init data set by @duckdb_init_set_init_data@ during the init.
-
-Parameters:
-* @info@: The info object
-
-Returns The init data object
--}
-foreign import ccall safe "duckdb_function_get_init_data"
-    c_duckdb_function_get_init_data :: DuckDBFunctionInfo -> IO (Ptr ())
-
-{- | Gets the thread-local init data set by @duckdb_init_set_init_data@ during the
-local_init.
-
-Parameters:
-* @info@: The info object
-
-Returns The init data object
--}
-foreign import ccall safe "duckdb_function_get_local_init_data"
-    c_duckdb_function_get_local_init_data :: DuckDBFunctionInfo -> IO (Ptr ())
-
-{- | Report that an error has occurred while executing the function.
-
-Parameters:
-* @info@: The info object
-* @error@: The error message
--}
-foreign import ccall safe "duckdb_function_set_error"
-    c_duckdb_function_set_error :: DuckDBFunctionInfo -> CString -> IO ()
diff --git a/src/Database/DuckDB/FFI/Threading.hs b/src/Database/DuckDB/FFI/Threading.hs
deleted file mode 100644
--- a/src/Database/DuckDB/FFI/Threading.hs
+++ /dev/null
@@ -1,104 +0,0 @@
-module Database.DuckDB.FFI.Threading (
-    c_duckdb_execute_tasks,
-    c_duckdb_create_task_state,
-    c_duckdb_execute_tasks_state,
-    c_duckdb_execute_n_tasks_state,
-    c_duckdb_finish_execution,
-    c_duckdb_task_state_is_finished,
-    c_duckdb_destroy_task_state,
-    c_duckdb_execution_is_finished,
-) where
-
-import Database.DuckDB.FFI.Types
-import Foreign.C.Types (CBool (..))
-
-{- | Execute DuckDB tasks on this thread.
-
-Will return after @max_tasks@ have been executed, or if there are no more
-tasks present.
-
-Parameters:
-* @database@: The database object to execute tasks for
-* @max_tasks@: The maximum amount of tasks to execute
--}
-foreign import ccall "duckdb_execute_tasks"
-    c_duckdb_execute_tasks :: DuckDBDatabase -> DuckDBIdx -> IO ()
-
-{- | Creates a task state that can be used with duckdb_execute_tasks_state to
-execute tasks until @duckdb_finish_execution@ is called on the state.
-
-@duckdb_destroy_state@ must be called on the result.
-
-Parameters:
-* @database@: The database object to create the task state for
-
-Returns The task state that can be used with duckdb_execute_tasks_state.
--}
-foreign import ccall safe "duckdb_create_task_state"
-    c_duckdb_create_task_state :: DuckDBDatabase -> IO DuckDBTaskState
-
-{- | Execute DuckDB tasks on this thread.
-
-The thread will keep on executing tasks forever, until duckdb_finish_execution
-is called on the state. Multiple threads can share the same duckdb_task_state.
-
-Parameters:
-* @state@: The task state of the executor
--}
-foreign import ccall "duckdb_execute_tasks_state"
-    c_duckdb_execute_tasks_state :: DuckDBTaskState -> IO ()
-
-{- | Execute DuckDB tasks on this thread.
-
-The thread will keep on executing tasks until either duckdb_finish_execution
-is called on the state, max_tasks tasks have been executed or there are no
-more tasks to be executed.
-
-Multiple threads can share the same duckdb_task_state.
-
-Parameters:
-* @state@: The task state of the executor
-* @max_tasks@: The maximum amount of tasks to execute
-
-Returns The amount of tasks that have actually been executed
--}
-foreign import ccall "duckdb_execute_n_tasks_state"
-    c_duckdb_execute_n_tasks_state :: DuckDBTaskState -> DuckDBIdx -> IO DuckDBIdx
-
-{- | Finish execution on a specific task.
-
-Parameters:
-* @state@: The task state to finish execution
--}
-foreign import ccall safe "duckdb_finish_execution"
-    c_duckdb_finish_execution :: DuckDBTaskState -> IO ()
-
-{- | Check if the provided duckdb_task_state has finished execution
-
-Parameters:
-* @state@: The task state to inspect
-
-Returns Whether or not duckdb_finish_execution has been called on the task
-state
--}
-foreign import ccall safe "duckdb_task_state_is_finished"
-    c_duckdb_task_state_is_finished :: DuckDBTaskState -> IO CBool
-
-{- | Destroys the task state returned from duckdb_create_task_state.
-
-Note that this should not be called while there is an active
-duckdb_execute_tasks_state running on the task state.
-
-Parameters:
-* @state@: The task state to clean up
--}
-foreign import ccall safe "duckdb_destroy_task_state"
-    c_duckdb_destroy_task_state :: DuckDBTaskState -> IO ()
-
-{- | Returns true if the execution of the current query is finished.
-
-Parameters:
-* @con@: The connection on which to check
--}
-foreign import ccall safe "duckdb_execution_is_finished"
-    c_duckdb_execution_is_finished :: DuckDBConnection -> IO CBool
diff --git a/src/Database/DuckDB/FFI/Types.hs b/src/Database/DuckDB/FFI/Types.hs
deleted file mode 100644
--- a/src/Database/DuckDB/FFI/Types.hs
+++ /dev/null
@@ -1,1841 +0,0 @@
-{-# LANGUAGE DuplicateRecordFields #-}
-{-# LANGUAGE GeneralizedNewtypeDeriving #-}
-{-# LANGUAGE PatternSynonyms #-}
-{-# LANGUAGE RecordWildCards #-}
-{-# LANGUAGE StrictData #-}
-
-module Database.DuckDB.FFI.Types (
-    -- * Enumerations
-    DuckDBState (..),
-    pattern DuckDBSuccess,
-    pattern DuckDBError,
-    DuckDBType (..),
-    pattern DuckDBTypeInvalid,
-    pattern DuckDBTypeBoolean,
-    pattern DuckDBTypeTinyInt,
-    pattern DuckDBTypeSmallInt,
-    pattern DuckDBTypeInteger,
-    pattern DuckDBTypeBigInt,
-    pattern DuckDBTypeUTinyInt,
-    pattern DuckDBTypeUSmallInt,
-    pattern DuckDBTypeUInteger,
-    pattern DuckDBTypeUBigInt,
-    pattern DuckDBTypeFloat,
-    pattern DuckDBTypeDouble,
-    pattern DuckDBTypeTimestamp,
-    pattern DuckDBTypeDate,
-    pattern DuckDBTypeTime,
-    pattern DuckDBTypeInterval,
-    pattern DuckDBTypeHugeInt,
-    pattern DuckDBTypeUHugeInt,
-    pattern DuckDBTypeVarchar,
-    pattern DuckDBTypeBlob,
-    pattern DuckDBTypeDecimal,
-    pattern DuckDBTypeTimestampS,
-    pattern DuckDBTypeTimestampMs,
-    pattern DuckDBTypeTimestampNs,
-    pattern DuckDBTypeEnum,
-    pattern DuckDBTypeList,
-    pattern DuckDBTypeStruct,
-    pattern DuckDBTypeMap,
-    pattern DuckDBTypeArray,
-    pattern DuckDBTypeUUID,
-    pattern DuckDBTypeUnion,
-    pattern DuckDBTypeBit,
-    pattern DuckDBTypeTimeTz,
-    pattern DuckDBTypeTimestampTz,
-    pattern DuckDBTypeAny,
-    pattern DuckDBTypeBigNum,
-    pattern DuckDBTypeSQLNull,
-    pattern DuckDBTypeStringLiteral,
-    pattern DuckDBTypeIntegerLiteral,
-    pattern DuckDBTypeTimeNs,
-    pattern DuckDBTypeGeometry,
-    pattern DuckDBTypeVariant,
-    DuckDBPendingState (..),
-    pattern DuckDBPendingResultReady,
-    pattern DuckDBPendingResultNotReady,
-    pattern DuckDBPendingError,
-    pattern DuckDBPendingNoTasksAvailable,
-    DuckDBResultType (..),
-    pattern DuckDBResultTypeInvalid,
-    pattern DuckDBResultTypeChangedRows,
-    pattern DuckDBResultTypeNothing,
-    pattern DuckDBResultTypeQueryResult,
-    DuckDBStatementType (..),
-    pattern DuckDBStatementTypeInvalid,
-    pattern DuckDBStatementTypeSelect,
-    pattern DuckDBStatementTypeInsert,
-    pattern DuckDBStatementTypeUpdate,
-    pattern DuckDBStatementTypeExplain,
-    pattern DuckDBStatementTypeDelete,
-    pattern DuckDBStatementTypePrepare,
-    pattern DuckDBStatementTypeCreate,
-    pattern DuckDBStatementTypeExecute,
-    pattern DuckDBStatementTypeAlter,
-    pattern DuckDBStatementTypeTransaction,
-    pattern DuckDBStatementTypeCopy,
-    pattern DuckDBStatementTypeAnalyze,
-    pattern DuckDBStatementTypeVariableSet,
-    pattern DuckDBStatementTypeCreateFunc,
-    pattern DuckDBStatementTypeDrop,
-    pattern DuckDBStatementTypeExport,
-    pattern DuckDBStatementTypePragma,
-    pattern DuckDBStatementTypeVacuum,
-    pattern DuckDBStatementTypeCall,
-    pattern DuckDBStatementTypeSet,
-    pattern DuckDBStatementTypeLoad,
-    pattern DuckDBStatementTypeRelation,
-    pattern DuckDBStatementTypeExtension,
-    pattern DuckDBStatementTypeLogicalPlan,
-    pattern DuckDBStatementTypeAttach,
-    pattern DuckDBStatementTypeDetach,
-    pattern DuckDBStatementTypeMulti,
-    pattern DuckDBStatementTypeCopyDatabase,
-    pattern DuckDBStatementTypeUpdateExtensions,
-    pattern DuckDBStatementTypeMergeInto,
-    DuckDBErrorType (..),
-    pattern DuckDBErrorInvalid,
-    pattern DuckDBErrorOutOfRange,
-    pattern DuckDBErrorConversion,
-    pattern DuckDBErrorUnknownType,
-    pattern DuckDBErrorDecimal,
-    pattern DuckDBErrorMismatchType,
-    pattern DuckDBErrorDivideByZero,
-    pattern DuckDBErrorObjectSize,
-    pattern DuckDBErrorInvalidType,
-    pattern DuckDBErrorSerialization,
-    pattern DuckDBErrorTransaction,
-    pattern DuckDBErrorNotImplemented,
-    pattern DuckDBErrorExpression,
-    pattern DuckDBErrorCatalog,
-    pattern DuckDBErrorParser,
-    pattern DuckDBErrorPlanner,
-    pattern DuckDBErrorScheduler,
-    pattern DuckDBErrorExecutor,
-    pattern DuckDBErrorConstraint,
-    pattern DuckDBErrorIndex,
-    pattern DuckDBErrorStat,
-    pattern DuckDBErrorConnection,
-    pattern DuckDBErrorSyntax,
-    pattern DuckDBErrorSettings,
-    pattern DuckDBErrorBinder,
-    pattern DuckDBErrorNetwork,
-    pattern DuckDBErrorOptimizer,
-    pattern DuckDBErrorNullPointer,
-    pattern DuckDBErrorIO,
-    pattern DuckDBErrorInterrupt,
-    pattern DuckDBErrorFatal,
-    pattern DuckDBErrorInternal,
-    pattern DuckDBErrorInvalidInput,
-    pattern DuckDBErrorOutOfMemory,
-    pattern DuckDBErrorPermission,
-    pattern DuckDBErrorParameterNotResolved,
-    pattern DuckDBErrorParameterNotAllowed,
-    pattern DuckDBErrorDependency,
-    pattern DuckDBErrorHTTP,
-    pattern DuckDBErrorMissingExtension,
-    pattern DuckDBErrorAutoload,
-    pattern DuckDBErrorSequence,
-    pattern DuckDBInvalidConfiguration,
-    pattern DuckDBErrorInvalidConfiguration,
-    DuckDBCastMode (..),
-    pattern DuckDBCastNormal,
-    pattern DuckDBCastTry,
-    DuckDBFileFlag (..),
-    pattern DuckDBFileFlagInvalid,
-    pattern DuckDBFileFlagRead,
-    pattern DuckDBFileFlagWrite,
-    pattern DuckDBFileFlagCreate,
-    pattern DuckDBFileFlagCreateNew,
-    pattern DuckDBFileFlagAppend,
-    DuckDBConfigOptionScope (..),
-    pattern DuckDBConfigOptionScopeInvalid,
-    pattern DuckDBConfigOptionScopeLocal,
-    pattern DuckDBConfigOptionScopeSession,
-    pattern DuckDBConfigOptionScopeGlobal,
-    DuckDBCatalogEntryType (..),
-    pattern DuckDBCatalogEntryTypeInvalid,
-    pattern DuckDBCatalogEntryTypeTable,
-    pattern DuckDBCatalogEntryTypeSchema,
-    pattern DuckDBCatalogEntryTypeView,
-    pattern DuckDBCatalogEntryTypeIndex,
-    pattern DuckDBCatalogEntryTypePreparedStatement,
-    pattern DuckDBCatalogEntryTypeSequence,
-    pattern DuckDBCatalogEntryTypeCollation,
-    pattern DuckDBCatalogEntryTypeType,
-    pattern DuckDBCatalogEntryTypeDatabase,
-
-    -- * Scalar Types
-    DuckDBIdx,
-    DuckDBSel,
-    DuckDBDate (..),
-    DuckDBDateStruct (..),
-    DuckDBTime (..),
-    DuckDBTimeStruct (..),
-    DuckDBTimeNs (..),
-    DuckDBTimeTz (..),
-    DuckDBTimeTzStruct (..),
-    DuckDBTimestamp (..),
-    DuckDBTimestampStruct (..),
-    DuckDBTimestampS (..),
-    DuckDBTimestampMs (..),
-    DuckDBTimestampNs (..),
-    DuckDBInterval (..),
-    DuckDBHugeInt (..),
-    DuckDBUHugeInt (..),
-    DuckDBDecimal (..),
-    DuckDBBlob (..),
-    DuckDBString (..),
-    DuckDBStringT,
-    DuckDBBit (..),
-    DuckDBBignum (..),
-    DuckDBQueryProgress (..),
-    DuckDBListEntry (..),
-
-    -- * Result Structures
-    DuckDBResult (..),
-    DuckDBColumn,
-
-    -- * Opaque Pointer Types
-    DuckDBDatabase,
-    DuckDBConnection,
-    DuckDBConfig,
-    DuckDBConfigOption,
-    DuckDBInstanceCache,
-    DuckDBArrowOptions,
-    DuckDBArrow,
-    DuckDBArrowSchema,
-    DuckDBArrowArray,
-    ArrowSchemaPtr (..),
-    ArrowArrayPtr (..),
-    ArrowStreamPtr (..),
-    DuckDBArrowConvertedSchema,
-    DuckDBArrowStream,
-    DuckDBPreparedStatement,
-    DuckDBPendingResult,
-    DuckDBExtractedStatements,
-    DuckDBLogicalType,
-    DuckDBCreateTypeInfo,
-    DuckDBVector,
-    DuckDBDataChunk,
-    DuckDBSelectionVector,
-    DuckDBFunctionInfo,
-    DuckDBBindInfo,
-    DuckDBInitInfo,
-    DuckDBScalarFunction,
-    DuckDBScalarFunctionSet,
-    DuckDBCopyFunction,
-    DuckDBCopyFunctionBindInfo,
-    DuckDBCopyFunctionGlobalInitInfo,
-    DuckDBCopyFunctionSinkInfo,
-    DuckDBCopyFunctionFinalizeInfo,
-    DuckDBAggregateFunction,
-    DuckDBAggregateFunctionSet,
-    DuckDBAggregateState,
-    DuckDBCastFunction,
-    DuckDBExpression,
-    DuckDBClientContext,
-    DuckDBTableFunction,
-    DuckDBFileOpenOptions,
-    DuckDBFileSystem,
-    DuckDBFileHandle,
-    DuckDBCatalog,
-    DuckDBCatalogEntry,
-    DuckDBLogStorage,
-    DuckDBValue,
-    DuckDBErrorData,
-    DuckDBAppender,
-    DuckDBTableDescription,
-    DuckDBProfilingInfo,
-    DuckDBReplacementScanInfo,
-    DuckDBTaskState,
-    ArrowArray (..),
-    ArrowSchema (..),
-    ArrowArrayStream (..),
-
-    -- * Opaque Struct Tags
-    DuckDBDatabaseStruct,
-    DuckDBConnectionStruct,
-    DuckDBConfigStruct,
-    DuckDBConfigOptionStruct,
-    DuckDBInstanceCacheStruct,
-    DuckDBExtractedStatementsStruct,
-    DuckDBFunctionInfoStruct,
-    DuckDBBindInfoStruct,
-    DuckDBScalarFunctionStruct,
-    DuckDBScalarFunctionSetStruct,
-    DuckDBCopyFunctionStruct,
-    DuckDBCopyFunctionBindInfoStruct,
-    DuckDBCopyFunctionGlobalInitInfoStruct,
-    DuckDBCopyFunctionSinkInfoStruct,
-    DuckDBCopyFunctionFinalizeInfoStruct,
-    DuckDBAggregateFunctionStruct,
-    DuckDBAggregateFunctionSetStruct,
-    DuckDBVectorStruct,
-    DuckDBDataChunkStruct,
-    DuckDBSelectionVectorStruct,
-    DuckDBArrowOptionsStruct,
-    DuckDBArrowStruct,
-    DuckDBArrowSchemaStruct,
-    DuckDBArrowArrayStruct,
-    DuckDBArrowConvertedSchemaStruct,
-    DuckDBArrowStreamStruct,
-    DuckDBExpressionStruct,
-    DuckDBClientContextStruct,
-    DuckDBFileOpenOptionsStruct,
-    DuckDBFileSystemStruct,
-    DuckDBFileHandleStruct,
-    DuckDBCatalogStruct,
-    DuckDBCatalogEntryStruct,
-    DuckDBLogStorageStruct,
-    DuckDBPreparedStatementStruct,
-    DuckDBValueStruct,
-    DuckDBPendingResultStruct,
-    DuckDBLogicalTypeStruct,
-    DuckDBCreateTypeInfoStruct,
-    DuckDBErrorDataStruct,
-    DuckDBInitInfoStruct,
-    DuckDBCastFunctionStruct,
-    DuckDBTableFunctionStruct,
-    DuckDBAppenderStruct,
-    DuckDBTableDescriptionStruct,
-    DuckDBProfilingInfoStruct,
-    DuckDBReplacementScanInfoStruct,
-    DuckDBAggregateStateStruct,
-
-    -- * Function Pointer Types
-    DuckDBScalarFunctionFun,
-    DuckDBScalarFunctionBindFun,
-    DuckDBScalarFunctionInitFun,
-    DuckDBDeleteCallback,
-    DuckDBCopyCallback,
-    DuckDBCopyFunctionBindFun,
-    DuckDBCopyFunctionGlobalInitFun,
-    DuckDBCopyFunctionSinkFun,
-    DuckDBCopyFunctionFinalizeFun,
-    DuckDBCastFunctionFun,
-    DuckDBAggregateStateSizeFun,
-    DuckDBAggregateInitFun,
-    DuckDBAggregateDestroyFun,
-    DuckDBAggregateUpdateFun,
-    DuckDBAggregateCombineFun,
-    DuckDBAggregateFinalizeFun,
-    DuckDBTableFunctionBindFun,
-    DuckDBTableFunctionInitFun,
-    DuckDBTableFunctionFun,
-    DuckDBLoggerWriteLogEntryFun,
-    DuckDBReplacementCallback,
-) where
-
-import Data.Int (Int32, Int64, Int8)
-import Data.Word (Word32, Word64, Word8)
-import Foreign.C.String (CString)
-import Foreign.C.Types
-import Foreign.Ptr (FunPtr, Ptr, nullPtr)
-import Foreign.Storable (Storable (..), peekByteOff, pokeByteOff)
-
--- | Unsigned index type used by DuckDB (mirrors @idx_t@).
-type DuckDBIdx = Word64
-
--- | Selection vector entry type (mirrors @sel_t@).
-type DuckDBSel = Word32
-
--- | Result state returned by most DuckDB C API calls.
-newtype DuckDBState = DuckDBState {unDuckDBState :: CInt}
-    deriving (Eq, Ord, Show, Storable)
-
--- | Pattern synonyms for @duckdb_state@ constants.
-pattern DuckDBSuccess, DuckDBError :: DuckDBState
-pattern DuckDBSuccess = DuckDBState 0
-pattern DuckDBError = DuckDBState 1
-
-{-# COMPLETE DuckDBSuccess, DuckDBError #-}
-
--- | DuckDB primitive physical type identifiers (mirrors @duckdb_type@).
-newtype DuckDBType = DuckDBType {unDuckDBType :: CInt}
-    deriving (Eq, Ord, Show, Storable)
-
--- | Pattern synonyms for DuckDB's physical value type tags.
-pattern
-    DuckDBTypeInvalid
-    , DuckDBTypeBoolean
-    , DuckDBTypeTinyInt
-    , DuckDBTypeSmallInt
-    , DuckDBTypeInteger
-    , DuckDBTypeBigInt
-    , DuckDBTypeUTinyInt
-    , DuckDBTypeUSmallInt
-    , DuckDBTypeUInteger
-    , DuckDBTypeUBigInt
-    , DuckDBTypeFloat
-    , DuckDBTypeDouble
-    , DuckDBTypeTimestamp
-    , DuckDBTypeDate
-    , DuckDBTypeTime
-    , DuckDBTypeInterval
-    , DuckDBTypeHugeInt
-    , DuckDBTypeUHugeInt
-    , DuckDBTypeVarchar
-    , DuckDBTypeBlob
-    , DuckDBTypeDecimal
-    , DuckDBTypeTimestampS
-    , DuckDBTypeTimestampMs
-    , DuckDBTypeTimestampNs
-    , DuckDBTypeEnum
-    , DuckDBTypeList
-    , DuckDBTypeStruct
-    , DuckDBTypeMap
-    , DuckDBTypeArray
-    , DuckDBTypeUUID
-    , DuckDBTypeUnion
-    , DuckDBTypeBit
-    , DuckDBTypeTimeTz
-    , DuckDBTypeTimestampTz
-    , DuckDBTypeAny
-    , DuckDBTypeBigNum
-    , DuckDBTypeSQLNull
-    , DuckDBTypeStringLiteral
-    , DuckDBTypeIntegerLiteral
-    , DuckDBTypeTimeNs
-    , DuckDBTypeGeometry
-    , DuckDBTypeVariant ::
-        DuckDBType
-pattern DuckDBTypeInvalid = DuckDBType 0
-pattern DuckDBTypeBoolean = DuckDBType 1
-pattern DuckDBTypeTinyInt = DuckDBType 2
-pattern DuckDBTypeSmallInt = DuckDBType 3
-pattern DuckDBTypeInteger = DuckDBType 4
-pattern DuckDBTypeBigInt = DuckDBType 5
-pattern DuckDBTypeUTinyInt = DuckDBType 6
-pattern DuckDBTypeUSmallInt = DuckDBType 7
-pattern DuckDBTypeUInteger = DuckDBType 8
-pattern DuckDBTypeUBigInt = DuckDBType 9
-pattern DuckDBTypeFloat = DuckDBType 10
-pattern DuckDBTypeDouble = DuckDBType 11
-pattern DuckDBTypeTimestamp = DuckDBType 12
-pattern DuckDBTypeDate = DuckDBType 13
-pattern DuckDBTypeTime = DuckDBType 14
-pattern DuckDBTypeInterval = DuckDBType 15
-pattern DuckDBTypeHugeInt = DuckDBType 16
-pattern DuckDBTypeUHugeInt = DuckDBType 32
-pattern DuckDBTypeVarchar = DuckDBType 17
-pattern DuckDBTypeBlob = DuckDBType 18
-pattern DuckDBTypeDecimal = DuckDBType 19
-pattern DuckDBTypeTimestampS = DuckDBType 20
-pattern DuckDBTypeTimestampMs = DuckDBType 21
-pattern DuckDBTypeTimestampNs = DuckDBType 22
-pattern DuckDBTypeEnum = DuckDBType 23
-pattern DuckDBTypeList = DuckDBType 24
-pattern DuckDBTypeStruct = DuckDBType 25
-pattern DuckDBTypeMap = DuckDBType 26
-pattern DuckDBTypeArray = DuckDBType 33
-pattern DuckDBTypeUUID = DuckDBType 27
-pattern DuckDBTypeUnion = DuckDBType 28
-pattern DuckDBTypeBit = DuckDBType 29
-pattern DuckDBTypeTimeTz = DuckDBType 30
-pattern DuckDBTypeTimestampTz = DuckDBType 31
-pattern DuckDBTypeAny = DuckDBType 34
-pattern DuckDBTypeBigNum = DuckDBType 35
-pattern DuckDBTypeSQLNull = DuckDBType 36
-pattern DuckDBTypeStringLiteral = DuckDBType 37
-pattern DuckDBTypeIntegerLiteral = DuckDBType 38
-pattern DuckDBTypeTimeNs = DuckDBType 39
-pattern DuckDBTypeGeometry = DuckDBType 40
-pattern DuckDBTypeVariant = DuckDBType 41
-
--- | Pending result state returned from @duckdb_pending_*@ APIs.
-newtype DuckDBPendingState = DuckDBPendingState {unDuckDBPendingState :: CInt}
-    deriving (Eq, Ord, Show, Storable)
-
--- | Pattern synonyms for @duckdb_pending_state@ constants.
-pattern
-    DuckDBPendingResultReady
-    , DuckDBPendingResultNotReady
-    , DuckDBPendingError
-    , DuckDBPendingNoTasksAvailable ::
-        DuckDBPendingState
-pattern DuckDBPendingResultReady = DuckDBPendingState 0
-pattern DuckDBPendingResultNotReady = DuckDBPendingState 1
-pattern DuckDBPendingError = DuckDBPendingState 2
-pattern DuckDBPendingNoTasksAvailable = DuckDBPendingState 3
-
-{-# COMPLETE
-    DuckDBPendingResultReady
-    , DuckDBPendingResultNotReady
-    , DuckDBPendingError
-    , DuckDBPendingNoTasksAvailable
-    #-}
-
--- | Result payload type returned by DuckDB queries (@duckdb_result_type@).
-newtype DuckDBResultType = DuckDBResultType {unDuckDBResultType :: CInt}
-    deriving (Eq, Ord, Show, Storable)
-
--- | Pattern synonyms for @duckdb_result_type@ constants.
-pattern
-    DuckDBResultTypeInvalid
-    , DuckDBResultTypeChangedRows
-    , DuckDBResultTypeNothing
-    , DuckDBResultTypeQueryResult ::
-        DuckDBResultType
-pattern DuckDBResultTypeInvalid = DuckDBResultType 0
-pattern DuckDBResultTypeChangedRows = DuckDBResultType 1
-pattern DuckDBResultTypeNothing = DuckDBResultType 2
-pattern DuckDBResultTypeQueryResult = DuckDBResultType 3
-
-{-# COMPLETE
-    DuckDBResultTypeInvalid
-    , DuckDBResultTypeChangedRows
-    , DuckDBResultTypeNothing
-    , DuckDBResultTypeQueryResult
-    #-}
-
--- | Classifies the SQL statement executed (@duckdb_statement_type@).
-newtype DuckDBStatementType = DuckDBStatementType {unDuckDBStatementType :: CInt}
-    deriving (Eq, Ord, Show, Storable)
-
--- | Pattern synonyms for @duckdb_statement_type@ constants.
-pattern
-    DuckDBStatementTypeInvalid
-    , DuckDBStatementTypeSelect
-    , DuckDBStatementTypeInsert
-    , DuckDBStatementTypeUpdate
-    , DuckDBStatementTypeExplain
-    , DuckDBStatementTypeDelete
-    , DuckDBStatementTypePrepare
-    , DuckDBStatementTypeCreate
-    , DuckDBStatementTypeExecute
-    , DuckDBStatementTypeAlter
-    , DuckDBStatementTypeTransaction
-    , DuckDBStatementTypeCopy
-    , DuckDBStatementTypeAnalyze
-    , DuckDBStatementTypeVariableSet
-    , DuckDBStatementTypeCreateFunc
-    , DuckDBStatementTypeDrop
-    , DuckDBStatementTypeExport
-    , DuckDBStatementTypePragma
-    , DuckDBStatementTypeVacuum
-    , DuckDBStatementTypeCall
-    , DuckDBStatementTypeSet
-    , DuckDBStatementTypeLoad
-    , DuckDBStatementTypeRelation
-    , DuckDBStatementTypeExtension
-    , DuckDBStatementTypeLogicalPlan
-    , DuckDBStatementTypeAttach
-    , DuckDBStatementTypeDetach
-    , DuckDBStatementTypeMulti
-    , DuckDBStatementTypeCopyDatabase
-    , DuckDBStatementTypeUpdateExtensions
-    , DuckDBStatementTypeMergeInto ::
-        DuckDBStatementType
-pattern DuckDBStatementTypeInvalid = DuckDBStatementType 0
-pattern DuckDBStatementTypeSelect = DuckDBStatementType 1
-pattern DuckDBStatementTypeInsert = DuckDBStatementType 2
-pattern DuckDBStatementTypeUpdate = DuckDBStatementType 3
-pattern DuckDBStatementTypeExplain = DuckDBStatementType 4
-pattern DuckDBStatementTypeDelete = DuckDBStatementType 5
-pattern DuckDBStatementTypePrepare = DuckDBStatementType 6
-pattern DuckDBStatementTypeCreate = DuckDBStatementType 7
-pattern DuckDBStatementTypeExecute = DuckDBStatementType 8
-pattern DuckDBStatementTypeAlter = DuckDBStatementType 9
-pattern DuckDBStatementTypeTransaction = DuckDBStatementType 10
-pattern DuckDBStatementTypeCopy = DuckDBStatementType 11
-pattern DuckDBStatementTypeAnalyze = DuckDBStatementType 12
-pattern DuckDBStatementTypeVariableSet = DuckDBStatementType 13
-pattern DuckDBStatementTypeCreateFunc = DuckDBStatementType 14
-pattern DuckDBStatementTypeDrop = DuckDBStatementType 15
-pattern DuckDBStatementTypeExport = DuckDBStatementType 16
-pattern DuckDBStatementTypePragma = DuckDBStatementType 17
-pattern DuckDBStatementTypeVacuum = DuckDBStatementType 18
-pattern DuckDBStatementTypeCall = DuckDBStatementType 19
-pattern DuckDBStatementTypeSet = DuckDBStatementType 20
-pattern DuckDBStatementTypeLoad = DuckDBStatementType 21
-pattern DuckDBStatementTypeRelation = DuckDBStatementType 22
-pattern DuckDBStatementTypeExtension = DuckDBStatementType 23
-pattern DuckDBStatementTypeLogicalPlan = DuckDBStatementType 24
-pattern DuckDBStatementTypeAttach = DuckDBStatementType 25
-pattern DuckDBStatementTypeDetach = DuckDBStatementType 26
-pattern DuckDBStatementTypeMulti = DuckDBStatementType 27
-pattern DuckDBStatementTypeCopyDatabase = DuckDBStatementType 28
-pattern DuckDBStatementTypeUpdateExtensions = DuckDBStatementType 29
-pattern DuckDBStatementTypeMergeInto = DuckDBStatementType 30
-
-{-# COMPLETE
-    DuckDBStatementTypeInvalid
-    , DuckDBStatementTypeSelect
-    , DuckDBStatementTypeInsert
-    , DuckDBStatementTypeUpdate
-    , DuckDBStatementTypeExplain
-    , DuckDBStatementTypeDelete
-    , DuckDBStatementTypePrepare
-    , DuckDBStatementTypeCreate
-    , DuckDBStatementTypeExecute
-    , DuckDBStatementTypeAlter
-    , DuckDBStatementTypeTransaction
-    , DuckDBStatementTypeCopy
-    , DuckDBStatementTypeAnalyze
-    , DuckDBStatementTypeVariableSet
-    , DuckDBStatementTypeCreateFunc
-    , DuckDBStatementTypeDrop
-    , DuckDBStatementTypeExport
-    , DuckDBStatementTypePragma
-    , DuckDBStatementTypeVacuum
-    , DuckDBStatementTypeCall
-    , DuckDBStatementTypeSet
-    , DuckDBStatementTypeLoad
-    , DuckDBStatementTypeRelation
-    , DuckDBStatementTypeExtension
-    , DuckDBStatementTypeLogicalPlan
-    , DuckDBStatementTypeAttach
-    , DuckDBStatementTypeDetach
-    , DuckDBStatementTypeMulti
-    , DuckDBStatementTypeCopyDatabase
-    , DuckDBStatementTypeUpdateExtensions
-    , DuckDBStatementTypeMergeInto
-    #-}
-
--- | DuckDB error classification codes.
-newtype DuckDBErrorType = DuckDBErrorType {unDuckDBErrorType :: CInt}
-    deriving (Eq, Ord, Show, Storable)
-
--- | Pattern synonyms mirroring @duckdb_error_type@ values.
-pattern
-    DuckDBErrorInvalid
-    , DuckDBErrorOutOfRange
-    , DuckDBErrorConversion
-    , DuckDBErrorUnknownType
-    , DuckDBErrorDecimal
-    , DuckDBErrorMismatchType
-    , DuckDBErrorDivideByZero
-    , DuckDBErrorObjectSize
-    , DuckDBErrorInvalidType
-    , DuckDBErrorSerialization
-    , DuckDBErrorTransaction
-    , DuckDBErrorNotImplemented
-    , DuckDBErrorExpression
-    , DuckDBErrorCatalog
-    , DuckDBErrorParser
-    , DuckDBErrorPlanner
-    , DuckDBErrorScheduler
-    , DuckDBErrorExecutor
-    , DuckDBErrorConstraint
-    , DuckDBErrorIndex
-    , DuckDBErrorStat
-    , DuckDBErrorConnection
-    , DuckDBErrorSyntax
-    , DuckDBErrorSettings
-    , DuckDBErrorBinder
-    , DuckDBErrorNetwork
-    , DuckDBErrorOptimizer
-    , DuckDBErrorNullPointer
-    , DuckDBErrorIO
-    , DuckDBErrorInterrupt
-    , DuckDBErrorFatal
-    , DuckDBErrorInternal
-    , DuckDBErrorInvalidInput
-    , DuckDBErrorOutOfMemory
-    , DuckDBErrorPermission
-    , DuckDBErrorParameterNotResolved
-    , DuckDBErrorParameterNotAllowed
-    , DuckDBErrorDependency
-    , DuckDBErrorHTTP
-    , DuckDBErrorMissingExtension
-    , DuckDBErrorAutoload
-    , DuckDBErrorSequence
-    , DuckDBInvalidConfiguration ::
-        DuckDBErrorType
-pattern DuckDBErrorInvalid = DuckDBErrorType 0
-pattern DuckDBErrorOutOfRange = DuckDBErrorType 1
-pattern DuckDBErrorConversion = DuckDBErrorType 2
-pattern DuckDBErrorUnknownType = DuckDBErrorType 3
-pattern DuckDBErrorDecimal = DuckDBErrorType 4
-pattern DuckDBErrorMismatchType = DuckDBErrorType 5
-pattern DuckDBErrorDivideByZero = DuckDBErrorType 6
-pattern DuckDBErrorObjectSize = DuckDBErrorType 7
-pattern DuckDBErrorInvalidType = DuckDBErrorType 8
-pattern DuckDBErrorSerialization = DuckDBErrorType 9
-pattern DuckDBErrorTransaction = DuckDBErrorType 10
-pattern DuckDBErrorNotImplemented = DuckDBErrorType 11
-pattern DuckDBErrorExpression = DuckDBErrorType 12
-pattern DuckDBErrorCatalog = DuckDBErrorType 13
-pattern DuckDBErrorParser = DuckDBErrorType 14
-pattern DuckDBErrorPlanner = DuckDBErrorType 15
-pattern DuckDBErrorScheduler = DuckDBErrorType 16
-pattern DuckDBErrorExecutor = DuckDBErrorType 17
-pattern DuckDBErrorConstraint = DuckDBErrorType 18
-pattern DuckDBErrorIndex = DuckDBErrorType 19
-pattern DuckDBErrorStat = DuckDBErrorType 20
-pattern DuckDBErrorConnection = DuckDBErrorType 21
-pattern DuckDBErrorSyntax = DuckDBErrorType 22
-pattern DuckDBErrorSettings = DuckDBErrorType 23
-pattern DuckDBErrorBinder = DuckDBErrorType 24
-pattern DuckDBErrorNetwork = DuckDBErrorType 25
-pattern DuckDBErrorOptimizer = DuckDBErrorType 26
-pattern DuckDBErrorNullPointer = DuckDBErrorType 27
-pattern DuckDBErrorIO = DuckDBErrorType 28
-pattern DuckDBErrorInterrupt = DuckDBErrorType 29
-pattern DuckDBErrorFatal = DuckDBErrorType 30
-pattern DuckDBErrorInternal = DuckDBErrorType 31
-pattern DuckDBErrorInvalidInput = DuckDBErrorType 32
-pattern DuckDBErrorOutOfMemory = DuckDBErrorType 33
-pattern DuckDBErrorPermission = DuckDBErrorType 34
-pattern DuckDBErrorParameterNotResolved = DuckDBErrorType 35
-pattern DuckDBErrorParameterNotAllowed = DuckDBErrorType 36
-pattern DuckDBErrorDependency = DuckDBErrorType 37
-pattern DuckDBErrorHTTP = DuckDBErrorType 38
-pattern DuckDBErrorMissingExtension = DuckDBErrorType 39
-pattern DuckDBErrorAutoload = DuckDBErrorType 40
-pattern DuckDBErrorSequence = DuckDBErrorType 41
-pattern DuckDBInvalidConfiguration = DuckDBErrorType 42
-
--- | Backwards-compatible alias for 'DuckDBInvalidConfiguration'.
-{-# DEPRECATED DuckDBErrorInvalidConfiguration "Use DuckDBInvalidConfiguration (matches upstream duckdb.h)" #-}
-pattern DuckDBErrorInvalidConfiguration :: DuckDBErrorType
-pattern DuckDBErrorInvalidConfiguration = DuckDBInvalidConfiguration
-
-{-# COMPLETE
-    DuckDBErrorInvalid
-    , DuckDBErrorOutOfRange
-    , DuckDBErrorConversion
-    , DuckDBErrorUnknownType
-    , DuckDBErrorDecimal
-    , DuckDBErrorMismatchType
-    , DuckDBErrorDivideByZero
-    , DuckDBErrorObjectSize
-    , DuckDBErrorInvalidType
-    , DuckDBErrorSerialization
-    , DuckDBErrorTransaction
-    , DuckDBErrorNotImplemented
-    , DuckDBErrorExpression
-    , DuckDBErrorCatalog
-    , DuckDBErrorParser
-    , DuckDBErrorPlanner
-    , DuckDBErrorScheduler
-    , DuckDBErrorExecutor
-    , DuckDBErrorConstraint
-    , DuckDBErrorIndex
-    , DuckDBErrorStat
-    , DuckDBErrorConnection
-    , DuckDBErrorSyntax
-    , DuckDBErrorSettings
-    , DuckDBErrorBinder
-    , DuckDBErrorNetwork
-    , DuckDBErrorOptimizer
-    , DuckDBErrorNullPointer
-    , DuckDBErrorIO
-    , DuckDBErrorInterrupt
-    , DuckDBErrorFatal
-    , DuckDBErrorInternal
-    , DuckDBErrorInvalidInput
-    , DuckDBErrorOutOfMemory
-    , DuckDBErrorPermission
-    , DuckDBErrorParameterNotResolved
-    , DuckDBErrorParameterNotAllowed
-    , DuckDBErrorDependency
-    , DuckDBErrorHTTP
-    , DuckDBErrorMissingExtension
-    , DuckDBErrorAutoload
-    , DuckDBErrorSequence
-    , DuckDBInvalidConfiguration
-    #-}
-
--- | Behaviour of DuckDB's casting functions (@duckdb_cast_mode@).
-newtype DuckDBCastMode = DuckDBCastMode {unDuckDBCastMode :: CInt}
-    deriving (Eq, Ord, Show, Storable)
-
--- | Pattern synonyms for @duckdb_cast_mode@ values.
-pattern DuckDBCastNormal, DuckDBCastTry :: DuckDBCastMode
-pattern DuckDBCastNormal = DuckDBCastMode 0
-pattern DuckDBCastTry = DuckDBCastMode 1
-
-{-# COMPLETE DuckDBCastNormal, DuckDBCastTry #-}
-
--- | File access flags used by DuckDB's VFS layer.
-newtype DuckDBFileFlag = DuckDBFileFlag {unDuckDBFileFlag :: CInt}
-    deriving (Eq, Ord, Show, Storable)
-
--- | Invalid or unspecified file access mode.
-pattern DuckDBFileFlagInvalid :: DuckDBFileFlag
-pattern DuckDBFileFlagInvalid = DuckDBFileFlag 0
-
--- | Open the file for reading.
-pattern DuckDBFileFlagRead :: DuckDBFileFlag
-pattern DuckDBFileFlagRead = DuckDBFileFlag 1
-
--- | Open the file for writing.
-pattern DuckDBFileFlagWrite :: DuckDBFileFlag
-pattern DuckDBFileFlagWrite = DuckDBFileFlag 2
-
--- | Create the file if it does not already exist.
-pattern DuckDBFileFlagCreate :: DuckDBFileFlag
-pattern DuckDBFileFlagCreate = DuckDBFileFlag 3
-
--- | Create a new file and fail if it already exists.
-pattern DuckDBFileFlagCreateNew :: DuckDBFileFlag
-pattern DuckDBFileFlagCreateNew = DuckDBFileFlag 4
-
--- | Append all writes to the end of the file.
-pattern DuckDBFileFlagAppend :: DuckDBFileFlag
-pattern DuckDBFileFlagAppend = DuckDBFileFlag 5
-
-{-# COMPLETE
-    DuckDBFileFlagInvalid
-    , DuckDBFileFlagRead
-    , DuckDBFileFlagWrite
-    , DuckDBFileFlagCreate
-    , DuckDBFileFlagCreateNew
-    , DuckDBFileFlagAppend
-    #-}
-
--- | Scope for configuration options.
-newtype DuckDBConfigOptionScope = DuckDBConfigOptionScope {unDuckDBConfigOptionScope :: CInt}
-    deriving (Eq, Ord, Show, Storable)
-
--- | Invalid or unknown configuration scope.
-pattern DuckDBConfigOptionScopeInvalid :: DuckDBConfigOptionScope
-pattern DuckDBConfigOptionScopeInvalid = DuckDBConfigOptionScope 0
-
--- | Scope limited to the current transaction. DuckDB does not implement this scope.
-pattern DuckDBConfigOptionScopeLocal :: DuckDBConfigOptionScope
-pattern DuckDBConfigOptionScopeLocal = DuckDBConfigOptionScope 1
-
--- | Scope lasting for the current client session.
-pattern DuckDBConfigOptionScopeSession :: DuckDBConfigOptionScope
-pattern DuckDBConfigOptionScopeSession = DuckDBConfigOptionScope 2
-
--- | Scope affecting the full database or process-global setting.
-pattern DuckDBConfigOptionScopeGlobal :: DuckDBConfigOptionScope
-pattern DuckDBConfigOptionScopeGlobal = DuckDBConfigOptionScope 3
-
-{-# COMPLETE
-    DuckDBConfigOptionScopeInvalid
-    , DuckDBConfigOptionScopeLocal
-    , DuckDBConfigOptionScopeSession
-    , DuckDBConfigOptionScopeGlobal
-    #-}
-
--- | Catalog entry kinds surfaced through the catalog API.
-newtype DuckDBCatalogEntryType = DuckDBCatalogEntryType {unDuckDBCatalogEntryType :: CInt}
-    deriving (Eq, Ord, Show, Storable)
-
--- | Invalid catalog entry type.
-pattern DuckDBCatalogEntryTypeInvalid :: DuckDBCatalogEntryType
-pattern DuckDBCatalogEntryTypeInvalid = DuckDBCatalogEntryType 0
-
--- | Table catalog entry.
-pattern DuckDBCatalogEntryTypeTable :: DuckDBCatalogEntryType
-pattern DuckDBCatalogEntryTypeTable = DuckDBCatalogEntryType 1
-
--- | Schema catalog entry.
-pattern DuckDBCatalogEntryTypeSchema :: DuckDBCatalogEntryType
-pattern DuckDBCatalogEntryTypeSchema = DuckDBCatalogEntryType 2
-
--- | View catalog entry.
-pattern DuckDBCatalogEntryTypeView :: DuckDBCatalogEntryType
-pattern DuckDBCatalogEntryTypeView = DuckDBCatalogEntryType 3
-
--- | Index catalog entry.
-pattern DuckDBCatalogEntryTypeIndex :: DuckDBCatalogEntryType
-pattern DuckDBCatalogEntryTypeIndex = DuckDBCatalogEntryType 4
-
--- | Prepared statement catalog entry.
-pattern DuckDBCatalogEntryTypePreparedStatement :: DuckDBCatalogEntryType
-pattern DuckDBCatalogEntryTypePreparedStatement = DuckDBCatalogEntryType 5
-
--- | Sequence catalog entry.
-pattern DuckDBCatalogEntryTypeSequence :: DuckDBCatalogEntryType
-pattern DuckDBCatalogEntryTypeSequence = DuckDBCatalogEntryType 6
-
--- | Collation catalog entry.
-pattern DuckDBCatalogEntryTypeCollation :: DuckDBCatalogEntryType
-pattern DuckDBCatalogEntryTypeCollation = DuckDBCatalogEntryType 7
-
--- | User-defined type catalog entry.
-pattern DuckDBCatalogEntryTypeType :: DuckDBCatalogEntryType
-pattern DuckDBCatalogEntryTypeType = DuckDBCatalogEntryType 8
-
--- | Attached database catalog entry.
-pattern DuckDBCatalogEntryTypeDatabase :: DuckDBCatalogEntryType
-pattern DuckDBCatalogEntryTypeDatabase = DuckDBCatalogEntryType 9
-
-{-# COMPLETE
-    DuckDBCatalogEntryTypeInvalid
-    , DuckDBCatalogEntryTypeTable
-    , DuckDBCatalogEntryTypeSchema
-    , DuckDBCatalogEntryTypeView
-    , DuckDBCatalogEntryTypeIndex
-    , DuckDBCatalogEntryTypePreparedStatement
-    , DuckDBCatalogEntryTypeSequence
-    , DuckDBCatalogEntryTypeCollation
-    , DuckDBCatalogEntryTypeType
-    , DuckDBCatalogEntryTypeDatabase
-    #-}
-
--- | DuckDB DATE as a signed count of days since 1970-01-01.
-newtype DuckDBDate = DuckDBDate {unDuckDBDate :: Int32}
-    deriving (Eq, Ord, Show, Storable)
-
--- | Decomposed representation of a @duckdb_date@.
-data DuckDBDateStruct = DuckDBDateStruct
-    { duckDBDateStructYear :: !Int32
-    , duckDBDateStructMonth :: !Int8
-    , duckDBDateStructDay :: !Int8
-    }
-    deriving (Eq, Show)
-
-instance Storable DuckDBDateStruct where
-    sizeOf _ = alignedSize
-      where
-        rawSize = sizeOf (undefined :: Int32) + 2 * sizeOf (undefined :: Int8)
-        align = alignment (undefined :: Int32)
-        alignedSize = ((rawSize + align - 1) `div` align) * align
-    alignment _ = alignment (undefined :: Int32)
-    peek ptr = do
-        year <- peekByteOff ptr 0
-        month <- peekByteOff ptr (sizeOf (undefined :: Int32))
-        day <- peekByteOff ptr (sizeOf (undefined :: Int32) + sizeOf (undefined :: Int8))
-        pure (DuckDBDateStruct year month day)
-    poke ptr DuckDBDateStruct{duckDBDateStructYear = year, duckDBDateStructMonth = month, duckDBDateStructDay = day} = do
-        pokeByteOff ptr 0 year
-        pokeByteOff ptr (sizeOf (undefined :: Int32)) month
-        pokeByteOff ptr (sizeOf (undefined :: Int32) + sizeOf (undefined :: Int8)) day
-
--- | Represents DuckDB's @duckdb_time@.
-newtype DuckDBTime = DuckDBTime {unDuckDBTime :: Int64}
-    deriving (Eq, Ord, Show, Storable)
-
--- | Decomposed representation of a @duckdb_time@.
-data DuckDBTimeStruct = DuckDBTimeStruct
-    { duckDBTimeStructHour :: !Int8
-    , duckDBTimeStructMinute :: !Int8
-    , duckDBTimeStructSecond :: !Int8
-    , duckDBTimeStructMicros :: !Int32
-    }
-    deriving (Eq, Show)
-
-instance Storable DuckDBTimeStruct where
-    sizeOf _ = 2 * alignment (undefined :: Int32)
-    alignment _ = alignment (undefined :: Int32)
-    peek ptr = do
-        hour <- peekByteOff ptr 0
-        minute <- peekByteOff ptr 1
-        second <- peekByteOff ptr 2
-        micros <- peekByteOff ptr 4
-        pure (DuckDBTimeStruct hour minute second micros)
-    poke ptr DuckDBTimeStruct{duckDBTimeStructHour = hour, duckDBTimeStructMinute = minute, duckDBTimeStructSecond = second, duckDBTimeStructMicros = micros} = do
-        pokeByteOff ptr 0 hour
-        pokeByteOff ptr 1 minute
-        pokeByteOff ptr 2 second
-        pokeByteOff ptr 4 micros
-
--- | Represents DuckDB's @duckdb_time_ns@.
-newtype DuckDBTimeNs = DuckDBTimeNs {unDuckDBTimeNs :: Int64}
-    deriving (Eq, Ord, Show, Storable)
-
--- | Represents DuckDB's @duckdb_time_tz@.
-newtype DuckDBTimeTz = DuckDBTimeTz {unDuckDBTimeTz :: Word64}
-    deriving (Eq, Ord, Show, Storable)
-
--- | Decomposed representation of a @duckdb_time_tz@.
-data DuckDBTimeTzStruct = DuckDBTimeTzStruct
-    { duckDBTimeTzStructTime :: !DuckDBTimeStruct
-    , duckDBTimeTzStructOffset :: !Int32
-    }
-    deriving (Eq, Show)
-
-instance Storable DuckDBTimeTzStruct where
-    sizeOf _ = sizeOf (undefined :: DuckDBTimeStruct) + sizeOf (undefined :: Int32)
-    alignment _ = alignment (undefined :: Int32)
-    peek ptr = do
-        time <- peekByteOff ptr 0
-        offset <- peekByteOff ptr (sizeOf (undefined :: DuckDBTimeStruct))
-        pure (DuckDBTimeTzStruct time offset)
-    poke ptr DuckDBTimeTzStruct{duckDBTimeTzStructTime = time, duckDBTimeTzStructOffset = offset} = do
-        pokeByteOff ptr 0 time
-        pokeByteOff ptr (sizeOf (undefined :: DuckDBTimeStruct)) offset
-
--- | Represents DuckDB's @duckdb_timestamp@.
-newtype DuckDBTimestamp = DuckDBTimestamp {unDuckDBTimestamp :: Int64}
-    deriving (Eq, Ord, Show, Storable)
-
--- | Decomposed representation of a @duckdb_timestamp@.
-data DuckDBTimestampStruct = DuckDBTimestampStruct
-    { duckDBTimestampStructDate :: !DuckDBDateStruct
-    , duckDBTimestampStructTime :: !DuckDBTimeStruct
-    }
-    deriving (Eq, Show)
-
-instance Storable DuckDBTimestampStruct where
-    sizeOf _ = sizeOf (undefined :: DuckDBDateStruct) + sizeOf (undefined :: DuckDBTimeStruct)
-    alignment _ = alignment (undefined :: DuckDBTimeStruct)
-    peek ptr = do
-        date <- peekByteOff ptr 0
-        time <- peekByteOff ptr (sizeOf (undefined :: DuckDBDateStruct))
-        pure (DuckDBTimestampStruct date time)
-    poke ptr DuckDBTimestampStruct{duckDBTimestampStructDate = date, duckDBTimestampStructTime = time} = do
-        pokeByteOff ptr 0 date
-        pokeByteOff ptr (sizeOf (undefined :: DuckDBDateStruct)) time
-
--- | Represents DuckDB's @duckdb_timestamp_s@.
-newtype DuckDBTimestampS = DuckDBTimestampS {unDuckDBTimestampS :: Int64}
-    deriving (Eq, Ord, Show, Storable)
-
--- | Represents DuckDB's @duckdb_timestamp_ms@.
-newtype DuckDBTimestampMs = DuckDBTimestampMs {unDuckDBTimestampMs :: Int64}
-    deriving (Eq, Ord, Show, Storable)
-
--- | Represents DuckDB's @duckdb_timestamp_ns@.
-newtype DuckDBTimestampNs = DuckDBTimestampNs {unDuckDBTimestampNs :: Int64}
-    deriving (Eq, Ord, Show, Storable)
-
--- | Represents DuckDB's @duckdb_interval@.
-data DuckDBInterval = DuckDBInterval
-    { duckDBIntervalMonths :: !Int32
-    , duckDBIntervalDays :: !Int32
-    , duckDBIntervalMicros :: !Int64
-    }
-    deriving (Eq, Show)
-
-instance Storable DuckDBInterval where
-    sizeOf _ = 2 * sizeOf (undefined :: Int32) + sizeOf (undefined :: Int64)
-    alignment _ = alignment (undefined :: Int64)
-    peek ptr = do
-        months <- peekByteOff ptr 0
-        days <- peekByteOff ptr (sizeOf (undefined :: Int32))
-        micros <- peekByteOff ptr (2 * sizeOf (undefined :: Int32))
-        pure (DuckDBInterval months days micros)
-    poke ptr (DuckDBInterval months days micros) = do
-        pokeByteOff ptr 0 months
-        pokeByteOff ptr (sizeOf (undefined :: Int32)) days
-        pokeByteOff ptr (2 * sizeOf (undefined :: Int32)) micros
-
--- | Represents DuckDB's @duckdb_hugeint@.
-data DuckDBHugeInt = DuckDBHugeInt
-    { duckDBHugeIntLower :: !Word64
-    , duckDBHugeIntUpper :: !Int64
-    }
-    deriving (Eq, Show)
-
-instance Storable DuckDBHugeInt where
-    sizeOf _ = sizeOf (undefined :: Word64) + sizeOf (undefined :: Int64)
-    alignment _ = alignment (undefined :: Word64)
-    peek ptr = do
-        lower <- peekByteOff ptr 0
-        upper <- peekByteOff ptr (sizeOf (undefined :: Word64))
-        pure (DuckDBHugeInt lower upper)
-    poke ptr (DuckDBHugeInt lower upper) = do
-        pokeByteOff ptr 0 lower
-        pokeByteOff ptr (sizeOf (undefined :: Word64)) upper
-
--- | Represents DuckDB's @duckdb_uhugeint@.
-data DuckDBUHugeInt = DuckDBUHugeInt
-    { duckDBUHugeIntLower :: !Word64
-    , duckDBUHugeIntUpper :: !Word64
-    }
-    deriving (Eq, Show)
-
-instance Storable DuckDBUHugeInt where
-    sizeOf _ = 2 * sizeOf (undefined :: Word64)
-    alignment _ = alignment (undefined :: Word64)
-    peek ptr = do
-        lower <- peekByteOff ptr 0
-        upper <- peekByteOff ptr (sizeOf (undefined :: Word64))
-        pure (DuckDBUHugeInt lower upper)
-    poke ptr (DuckDBUHugeInt lower upper) = do
-        pokeByteOff ptr 0 lower
-        pokeByteOff ptr (sizeOf (undefined :: Word64)) upper
-
--- | Represents DuckDB's @duckdb_decimal@.
-data DuckDBDecimal = DuckDBDecimal
-    { duckDBDecimalWidth :: !Word8
-    , duckDBDecimalScale :: !Word8
-    , duckDBDecimalValue :: !DuckDBHugeInt
-    }
-    deriving (Eq, Show)
-
-instance Storable DuckDBDecimal where
-    sizeOf _ = valueOffset + sizeOf (undefined :: DuckDBHugeInt)
-      where
-        alignHuge = alignment (undefined :: DuckDBHugeInt)
-        valueOffset = ((2 + alignHuge - 1) `div` alignHuge) * alignHuge
-    alignment _ = alignment (undefined :: DuckDBHugeInt)
-    peek ptr = do
-        width <- peekByteOff ptr 0
-        scale <- peekByteOff ptr 1
-        let alignHuge = alignment (undefined :: DuckDBHugeInt)
-            valueOffset = ((2 + alignHuge - 1) `div` alignHuge) * alignHuge
-        value <- peekByteOff ptr valueOffset
-        pure (DuckDBDecimal width scale value)
-    poke ptr (DuckDBDecimal width scale value) = do
-        pokeByteOff ptr 0 width
-        pokeByteOff ptr 1 scale
-        let alignHuge = alignment (undefined :: DuckDBHugeInt)
-            valueOffset = ((2 + alignHuge - 1) `div` alignHuge) * alignHuge
-        pokeByteOff ptr valueOffset value
-
--- | Represents DuckDB's @duckdb_blob@.
-data DuckDBBlob = DuckDBBlob
-    { duckDBBlobData :: !(Ptr ())
-    , duckDBBlobSize :: !DuckDBIdx
-    }
-    deriving (Eq, Show)
-
-instance Storable DuckDBBlob where
-    sizeOf _ = sizeOf (undefined :: Ptr ()) + sizeOf (undefined :: DuckDBIdx)
-    alignment _ = alignment (undefined :: Ptr ())
-    peek ptr = do
-        dat <- peekByteOff ptr 0
-        len <- peekByteOff ptr (sizeOf (undefined :: Ptr ()))
-        pure (DuckDBBlob dat len)
-    poke ptr (DuckDBBlob dat len) = do
-        pokeByteOff ptr 0 dat
-        pokeByteOff ptr (sizeOf (undefined :: Ptr ())) len
-
--- | Represents DuckDB's @duckdb_string@.
-data DuckDBString = DuckDBString
-    { duckDBStringData :: !(Ptr CChar)
-    , duckDBStringSize :: !DuckDBIdx
-    }
-    deriving (Eq, Show)
-
-instance Storable DuckDBString where
-    sizeOf _ = sizeOf (undefined :: Ptr CChar) + sizeOf (undefined :: DuckDBIdx)
-    alignment _ = alignment (undefined :: Ptr CChar)
-    peek ptr = do
-        dat <- peekByteOff ptr 0
-        len <- peekByteOff ptr (sizeOf (undefined :: Ptr CChar))
-        pure (DuckDBString dat len)
-    poke ptr (DuckDBString dat len) = do
-        pokeByteOff ptr 0 dat
-        pokeByteOff ptr (sizeOf (undefined :: Ptr CChar)) len
-
--- | Represents DuckDB's @duckdb_string_t@.
-data DuckDBStringT
-
--- | Represents DuckDB's @duckdb_bit@.
-data DuckDBBit = DuckDBBit
-    { duckDBBitData :: !(Ptr Word8)
-    , duckDBBitSize :: !DuckDBIdx
-    }
-    deriving (Eq, Show)
-
-instance Storable DuckDBBit where
-    sizeOf _ = sizeOf (undefined :: Ptr Word8) + sizeOf (undefined :: DuckDBIdx)
-    alignment _ = alignment (undefined :: Ptr Word8)
-    peek ptr = do
-        dat <- peekByteOff ptr 0
-        len <- peekByteOff ptr (sizeOf (undefined :: Ptr Word8))
-        pure (DuckDBBit dat len)
-    poke ptr (DuckDBBit dat len) = do
-        pokeByteOff ptr 0 dat
-        pokeByteOff ptr (sizeOf (undefined :: Ptr Word8)) len
-
-{- | Represents DuckDB's @duckdb_bignum@.
-
-@duckDBBignumData@ holds the absolute value of the number in big-endian byte
-order. Free it with @duckdb_free@. The DuckDB header said little-endian until
-DuckDB 1.5.4 corrected it. The byte order itself did not change.
--}
-data DuckDBBignum = DuckDBBignum
-    { duckDBBignumData :: !(Ptr Word8)
-    , duckDBBignumSize :: !DuckDBIdx
-    , duckDBBignumIsNegative :: !CBool
-    }
-    deriving (Eq, Show)
-
-instance Storable DuckDBBignum where
-    sizeOf _ = alignedSize
-      where
-        baseSize = sizeOf (undefined :: Ptr Word8) + sizeOf (undefined :: DuckDBIdx) + sizeOf (undefined :: CBool)
-        align = alignment (undefined :: Ptr Word8)
-        alignedSize = ((baseSize + align - 1) `div` align) * align
-    alignment _ = alignment (undefined :: Ptr Word8)
-    peek ptr = do
-        dat <- peekByteOff ptr 0
-        len <- peekByteOff ptr (sizeOf (undefined :: Ptr Word8))
-        isNeg <- peekByteOff ptr (sizeOf (undefined :: Ptr Word8) + sizeOf (undefined :: DuckDBIdx))
-        pure (DuckDBBignum dat len isNeg)
-    poke ptr (DuckDBBignum dat len isNeg) = do
-        pokeByteOff ptr 0 dat
-        pokeByteOff ptr (sizeOf (undefined :: Ptr Word8)) len
-        pokeByteOff ptr (sizeOf (undefined :: Ptr Word8) + sizeOf (undefined :: DuckDBIdx)) isNeg
-
--- | Represents DuckDB's @duckdb_query_progress_type@.
-data DuckDBQueryProgress = DuckDBQueryProgress
-    { duckDBQueryProgressPercentage :: !Double
-    , duckDBQueryProgressRowsProcessed :: !Word64
-    , duckDBQueryProgressTotalRows :: !Word64
-    }
-    deriving (Eq, Show)
-
-instance Storable DuckDBQueryProgress where
-    sizeOf _ = sizeOf (undefined :: CDouble) + 2 * sizeOf (undefined :: Word64)
-    alignment _ = alignment (undefined :: CDouble)
-    peek ptr = do
-        percentage <- realToFrac <$> (peekByteOff ptr 0 :: IO CDouble)
-        let offset1 = sizeOf (undefined :: CDouble)
-            offset2 = offset1 + sizeOf (undefined :: Word64)
-        processed <- peekByteOff ptr offset1
-        total <- peekByteOff ptr offset2
-        pure (DuckDBQueryProgress percentage processed total)
-    poke ptr (DuckDBQueryProgress percentage processed total) = do
-        pokeByteOff ptr 0 (realToFrac percentage :: CDouble)
-        let offset1 = sizeOf (undefined :: CDouble)
-            offset2 = offset1 + sizeOf (undefined :: Word64)
-        pokeByteOff ptr offset1 processed
-        pokeByteOff ptr offset2 total
-
--- | Offset and length of a row in a DuckDB list vector.
-data DuckDBListEntry = DuckDBListEntry
-    { duckDBListEntryOffset :: !Word64
-    , duckDBListEntryLength :: !Word64
-    }
-    deriving (Eq, Show)
-
-instance Storable DuckDBListEntry where
-    sizeOf _ = 2 * sizeOf (undefined :: Word64)
-    alignment _ = alignment (undefined :: Word64)
-    peek ptr = DuckDBListEntry <$> peekByteOff ptr 0 <*> peekByteOff ptr (sizeOf (undefined :: Word64))
-    poke ptr (DuckDBListEntry offset len) = do
-        pokeByteOff ptr 0 offset
-        pokeByteOff ptr (sizeOf (undefined :: Word64)) len
-
--- | Opaque DuckDB column handle.
-data DuckDBColumn
-
--- | DuckDB result structure (opaque to callers, but required for FFI marshalling).
-data DuckDBResult = DuckDBResult
-    { duckDBResultDeprecatedColumnCount :: !DuckDBIdx
-    , duckDBResultDeprecatedRowCount :: !DuckDBIdx
-    , duckDBResultDeprecatedRowsChanged :: !DuckDBIdx
-    , duckDBResultDeprecatedColumns :: !(Ptr DuckDBColumn)
-    , duckDBResultDeprecatedErrorMessage :: !CString
-    , duckDBResultInternalData :: !(Ptr ())
-    }
-
-instance Storable DuckDBResult where
-    sizeOf _ = 3 * sizeOf (undefined :: DuckDBIdx) + 3 * sizeOf (undefined :: Ptr ())
-    alignment _ = alignment (undefined :: DuckDBIdx)
-    peek ptr = do
-        colCount <- peekByteOff ptr 0
-        rowCount <- peekByteOff ptr (sizeOf (undefined :: DuckDBIdx))
-        rowsChanged <- peekByteOff ptr (2 * sizeOf (undefined :: DuckDBIdx))
-        let basePtr = 3 * sizeOf (undefined :: DuckDBIdx)
-        columns <- peekByteOff ptr basePtr
-        errMsg <- peekByteOff ptr (basePtr + sizeOf (undefined :: Ptr ()))
-        internal <- peekByteOff ptr (basePtr + 2 * sizeOf (undefined :: Ptr ()))
-        pure
-            DuckDBResult
-                { duckDBResultDeprecatedColumnCount = colCount
-                , duckDBResultDeprecatedRowCount = rowCount
-                , duckDBResultDeprecatedRowsChanged = rowsChanged
-                , duckDBResultDeprecatedColumns = columns
-                , duckDBResultDeprecatedErrorMessage = errMsg
-                , duckDBResultInternalData = internal
-                }
-    poke ptr result = do
-        let columnCount = duckDBResultDeprecatedColumnCount result
-            rowCount = duckDBResultDeprecatedRowCount result
-            rowsChanged = duckDBResultDeprecatedRowsChanged result
-            columns = duckDBResultDeprecatedColumns result
-            errorMessage = duckDBResultDeprecatedErrorMessage result
-            internalData = duckDBResultInternalData result
-            basePtr = 3 * sizeOf (undefined :: DuckDBIdx)
-        pokeByteOff ptr 0 columnCount
-        pokeByteOff ptr (sizeOf (undefined :: DuckDBIdx)) rowCount
-        pokeByteOff ptr (2 * sizeOf (undefined :: DuckDBIdx)) rowsChanged
-        pokeByteOff ptr basePtr columns
-        pokeByteOff ptr (basePtr + sizeOf (undefined :: Ptr ())) errorMessage
-        pokeByteOff ptr (basePtr + 2 * sizeOf (undefined :: Ptr ())) internalData
-
--- | Tag type backing @duckdb_database@ pointers.
-data DuckDBDatabaseStruct
-
--- | Handle to a DuckDB database instance.
-type DuckDBDatabase = Ptr DuckDBDatabaseStruct
-
--- | Tag type backing @duckdb_connection@ pointers.
-data DuckDBConnectionStruct
-
--- | Handle to a DuckDB connection.
-type DuckDBConnection = Ptr DuckDBConnectionStruct
-
--- | Tag type backing @duckdb_config@ pointers.
-data DuckDBConfigStruct
-
--- | Handle to a DuckDB configuration object.
-type DuckDBConfig = Ptr DuckDBConfigStruct
-
--- | Tag type backing @duckdb_config_option@ pointers.
-data DuckDBConfigOptionStruct
-
--- | Handle to a registerable configuration option.
-type DuckDBConfigOption = Ptr DuckDBConfigOptionStruct
-
--- | Tag type backing @duckdb_instance_cache@ pointers.
-data DuckDBInstanceCacheStruct
-
--- | Handle to a DuckDB instance cache.
-type DuckDBInstanceCache = Ptr DuckDBInstanceCacheStruct
-
--- | Tag type backing @duckdb_extracted_statements@ pointers.
-data DuckDBExtractedStatementsStruct
-
--- | Handle to extracted SQL statements.
-type DuckDBExtractedStatements = Ptr DuckDBExtractedStatementsStruct
-
--- | Tag type backing @duckdb_function_info@ pointers.
-data DuckDBFunctionInfoStruct
-
--- | Handle to function execution context.
-type DuckDBFunctionInfo = Ptr DuckDBFunctionInfoStruct
-
--- | Tag type backing @duckdb_bind_info@ pointers.
-data DuckDBBindInfoStruct
-
--- | Handle to scalar function bind context.
-type DuckDBBindInfo = Ptr DuckDBBindInfoStruct
-
--- | Tag type backing @duckdb_scalar_function@ pointers.
-data DuckDBScalarFunctionStruct
-
--- | Handle to a scalar function definition.
-type DuckDBScalarFunction = Ptr DuckDBScalarFunctionStruct
-
--- | Tag type backing @duckdb_scalar_function_set@ pointers.
-data DuckDBScalarFunctionSetStruct
-
--- | Handle to a set of scalar function overloads.
-type DuckDBScalarFunctionSet = Ptr DuckDBScalarFunctionSetStruct
-
--- | Tag type backing @duckdb_copy_function@ pointers.
-data DuckDBCopyFunctionStruct
-
--- | Handle to a COPY function definition.
-type DuckDBCopyFunction = Ptr DuckDBCopyFunctionStruct
-
--- | Tag type backing @duckdb_copy_function_bind_info@ pointers.
-data DuckDBCopyFunctionBindInfoStruct
-
--- | Handle to COPY bind state.
-type DuckDBCopyFunctionBindInfo = Ptr DuckDBCopyFunctionBindInfoStruct
-
--- | Tag type backing @duckdb_copy_function_global_init_info@ pointers.
-data DuckDBCopyFunctionGlobalInitInfoStruct
-
--- | Handle to COPY global-init state.
-type DuckDBCopyFunctionGlobalInitInfo = Ptr DuckDBCopyFunctionGlobalInitInfoStruct
-
--- | Tag type backing @duckdb_copy_function_sink_info@ pointers.
-data DuckDBCopyFunctionSinkInfoStruct
-
--- | Handle to COPY sink state.
-type DuckDBCopyFunctionSinkInfo = Ptr DuckDBCopyFunctionSinkInfoStruct
-
--- | Tag type backing @duckdb_copy_function_finalize_info@ pointers.
-data DuckDBCopyFunctionFinalizeInfoStruct
-
--- | Handle to COPY finalize state.
-type DuckDBCopyFunctionFinalizeInfo = Ptr DuckDBCopyFunctionFinalizeInfoStruct
-
--- | Tag type backing @duckdb_aggregate_function@ pointers.
-data DuckDBAggregateFunctionStruct
-
--- | Handle to an aggregate function definition.
-type DuckDBAggregateFunction = Ptr DuckDBAggregateFunctionStruct
-
--- | Tag type backing @duckdb_aggregate_function_set@ pointers.
-data DuckDBAggregateFunctionSetStruct
-
--- | Handle to an aggregate function set.
-type DuckDBAggregateFunctionSet = Ptr DuckDBAggregateFunctionSetStruct
-
--- | Tag type backing @duckdb_vector@ pointers.
-data DuckDBVectorStruct
-
--- | Handle to a DuckDB vector.
-type DuckDBVector = Ptr DuckDBVectorStruct
-
--- | Tag type backing @duckdb_data_chunk@ pointers.
-data DuckDBDataChunkStruct
-
--- | Handle to a DuckDB data chunk.
-type DuckDBDataChunk = Ptr DuckDBDataChunkStruct
-
--- | Tag type backing @duckdb_selection_vector@ pointers.
-data DuckDBSelectionVectorStruct
-
--- | Handle to a DuckDB selection vector.
-type DuckDBSelectionVector = Ptr DuckDBSelectionVectorStruct
-
--- | Tag type backing @duckdb_arrow_options@ pointers.
-data DuckDBArrowOptionsStruct
-
--- | Handle to DuckDB Arrow options.
-type DuckDBArrowOptions = Ptr DuckDBArrowOptionsStruct
-
--- | Tag type backing @duckdb_arrow@ pointers.
-newtype DuckDBArrowStruct = DuckDBArrowStruct
-    { duckdbArrowInternalPtr :: Ptr ()
-    }
-
--- | Handle to an Arrow query result.
-type DuckDBArrow = Ptr DuckDBArrowStruct
-
--- | Tag type backing @duckdb_arrow_schema@ pointers.
-newtype DuckDBArrowSchemaStruct = DuckDBArrowSchemaStruct
-    { duckdbArrowSchemaInternalPtr :: Ptr ()
-    }
-
--- | Handle to an Arrow schema.
-type DuckDBArrowSchema = Ptr DuckDBArrowSchemaStruct
-
--- | Tag type backing @duckdb_arrow_array@ pointers.
-newtype DuckDBArrowArrayStruct = DuckDBArrowArrayStruct
-    { duckdbArrowArrayInternalPtr :: Ptr ()
-    }
-
--- | Handle to an Arrow array.
-type DuckDBArrowArray = Ptr DuckDBArrowArrayStruct
-
-instance Storable DuckDBArrowStruct where
-    sizeOf _ = pointerSize
-    alignment _ = alignment (nullPtr :: Ptr ())
-    peek ptr =
-        DuckDBArrowStruct
-            <$> peekByteOff ptr 0
-    poke ptr DuckDBArrowStruct{..} =
-        pokeByteOff ptr 0 duckdbArrowInternalPtr
-
-instance Storable DuckDBArrowSchemaStruct where
-    sizeOf _ = pointerSize
-    alignment _ = alignment (nullPtr :: Ptr ())
-    peek ptr =
-        DuckDBArrowSchemaStruct
-            <$> peekByteOff ptr 0
-    poke ptr DuckDBArrowSchemaStruct{..} =
-        pokeByteOff ptr 0 duckdbArrowSchemaInternalPtr
-
-instance Storable DuckDBArrowArrayStruct where
-    sizeOf _ = pointerSize
-    alignment _ = alignment (nullPtr :: Ptr ())
-    peek ptr =
-        DuckDBArrowArrayStruct
-            <$> peekByteOff ptr 0
-    poke ptr DuckDBArrowArrayStruct{..} =
-        pokeByteOff ptr 0 duckdbArrowArrayInternalPtr
-
--- | Tag type backing @duckdb_arrow_converted_schema@ pointers.
-data DuckDBArrowConvertedSchemaStruct
-
--- | Handle to a converted Arrow schema.
-type DuckDBArrowConvertedSchema = Ptr DuckDBArrowConvertedSchemaStruct
-
--- | Tag type backing @duckdb_arrow_stream@ pointers.
-newtype DuckDBArrowStreamStruct = DuckDBArrowStreamStruct
-    { duckdbArrowStreamInternalPtr :: Ptr ()
-    }
-
--- | Handle to an Arrow stream.
-type DuckDBArrowStream = Ptr DuckDBArrowStreamStruct
-
-instance Storable DuckDBArrowStreamStruct where
-    sizeOf _ = pointerSize
-    alignment _ = alignment (nullPtr :: Ptr ())
-    peek ptr =
-        DuckDBArrowStreamStruct
-            <$> peekByteOff ptr 0
-    poke ptr DuckDBArrowStreamStruct{..} =
-        pokeByteOff ptr 0 duckdbArrowStreamInternalPtr
-
--- | Tag type backing @duckdb_expression@ pointers.
-data DuckDBExpressionStruct
-
--- | Handle to a DuckDB expression.
-type DuckDBExpression = Ptr DuckDBExpressionStruct
-
--- | Tag type backing @duckdb_client_context@ pointers.
-data DuckDBClientContextStruct
-
--- | Handle to a DuckDB client context.
-type DuckDBClientContext = Ptr DuckDBClientContextStruct
-
--- | Tag type backing @duckdb_file_open_options@ pointers.
-data DuckDBFileOpenOptionsStruct
-
--- | Handle to file-open options.
-type DuckDBFileOpenOptions = Ptr DuckDBFileOpenOptionsStruct
-
--- | Tag type backing @duckdb_file_system@ pointers.
-data DuckDBFileSystemStruct
-
--- | Handle to a DuckDB file system.
-type DuckDBFileSystem = Ptr DuckDBFileSystemStruct
-
--- | Tag type backing @duckdb_file_handle@ pointers.
-data DuckDBFileHandleStruct
-
--- | Handle to an open DuckDB file.
-type DuckDBFileHandle = Ptr DuckDBFileHandleStruct
-
--- | Tag type backing @duckdb_catalog@ pointers.
-data DuckDBCatalogStruct
-
--- | Handle to a DuckDB catalog.
-type DuckDBCatalog = Ptr DuckDBCatalogStruct
-
--- | Tag type backing @duckdb_catalog_entry@ pointers.
-data DuckDBCatalogEntryStruct
-
--- | Handle to a DuckDB catalog entry.
-type DuckDBCatalogEntry = Ptr DuckDBCatalogEntryStruct
-
--- | Tag type backing @duckdb_log_storage@ pointers.
-data DuckDBLogStorageStruct
-
--- | Handle to DuckDB log storage.
-type DuckDBLogStorage = Ptr DuckDBLogStorageStruct
-
--- | Tag type backing @duckdb_prepared_statement@ pointers.
-data DuckDBPreparedStatementStruct
-
--- | Handle to a prepared statement.
-type DuckDBPreparedStatement = Ptr DuckDBPreparedStatementStruct
-
--- | Tag type backing @duckdb_value@ pointers.
-data DuckDBValueStruct
-
--- | Handle to a scalar DuckDB value.
-type DuckDBValue = Ptr DuckDBValueStruct
-
--- | Tag type backing @duckdb_pending_result@ pointers.
-data DuckDBPendingResultStruct
-
--- | Handle to a pending (incremental) query result.
-type DuckDBPendingResult = Ptr DuckDBPendingResultStruct
-
--- | Tag type backing @duckdb_logical_type@ pointers.
-data DuckDBLogicalTypeStruct
-
--- | Handle to a DuckDB logical type value.
-type DuckDBLogicalType = Ptr DuckDBLogicalTypeStruct
-
--- | Tag type backing @duckdb_create_type_info@ pointers.
-data DuckDBCreateTypeInfoStruct
-
--- | Handle to logical type registration details.
-type DuckDBCreateTypeInfo = Ptr DuckDBCreateTypeInfoStruct
-
--- | Tag type backing @duckdb_error_data@ pointers.
-data DuckDBErrorDataStruct
-
--- | Handle to DuckDB error data.
-type DuckDBErrorData = Ptr DuckDBErrorDataStruct
-
--- | Tag type backing @duckdb_init_info@ pointers.
-data DuckDBInitInfoStruct
-
--- | Handle to table function initialization state.
-type DuckDBInitInfo = Ptr DuckDBInitInfoStruct
-
--- | Tag type backing @duckdb_cast_function@ pointers.
-data DuckDBCastFunctionStruct
-
--- | Handle to a cast function definition.
-type DuckDBCastFunction = Ptr DuckDBCastFunctionStruct
-
--- | Tag type backing @duckdb_table_function@ pointers.
-data DuckDBTableFunctionStruct
-
--- | Handle to a table function definition.
-type DuckDBTableFunction = Ptr DuckDBTableFunctionStruct
-
--- | Tag type backing @duckdb_appender@ pointers.
-data DuckDBAppenderStruct
-
--- | Handle to an appender.
-type DuckDBAppender = Ptr DuckDBAppenderStruct
-
--- | Tag type backing @duckdb_table_description@ pointers.
-data DuckDBTableDescriptionStruct
-
--- | Handle to a table description.
-type DuckDBTableDescription = Ptr DuckDBTableDescriptionStruct
-
--- | Tag type backing @duckdb_profiling_info@ pointers.
-data DuckDBProfilingInfoStruct
-
--- | Handle to profiling information.
-type DuckDBProfilingInfo = Ptr DuckDBProfilingInfoStruct
-
--- | Tag type backing @duckdb_replacement_scan_info@ pointers.
-data DuckDBReplacementScanInfoStruct
-
--- | Handle to replacement scan context.
-type DuckDBReplacementScanInfo = Ptr DuckDBReplacementScanInfoStruct
-
--- | Handle to a DuckDB aggregate state.
-data DuckDBAggregateStateStruct
-
--- | Opaque pointer to the aggregate-function state handed to user callbacks.
-type DuckDBAggregateState = Ptr DuckDBAggregateStateStruct
-
--- | Handle to a DuckDB task state.
-type DuckDBTaskState = Ptr ()
-
--- | Function pointer used to represent scalar function execution callbacks.
-type DuckDBScalarFunctionFun = FunPtr (DuckDBFunctionInfo -> DuckDBDataChunk -> DuckDBVector -> IO ())
-
--- | Function pointer used to represent scalar function bind callbacks.
-type DuckDBScalarFunctionBindFun = FunPtr (DuckDBBindInfo -> IO ())
-
--- | Function pointer used to represent scalar function init callbacks.
-type DuckDBScalarFunctionInitFun = FunPtr (DuckDBInitInfo -> IO ())
-
--- | Function pointer used to destroy user-provided data blobs.
-type DuckDBDeleteCallback = FunPtr (Ptr () -> IO ())
-
--- | Function pointer used to copy user-provided data blobs.
-type DuckDBCopyCallback = FunPtr (Ptr () -> IO (Ptr ()))
-
--- | Function pointer for COPY bind callbacks.
-type DuckDBCopyFunctionBindFun = FunPtr (DuckDBCopyFunctionBindInfo -> IO ())
-
--- | Function pointer for COPY global-init callbacks.
-type DuckDBCopyFunctionGlobalInitFun = FunPtr (DuckDBCopyFunctionGlobalInitInfo -> IO ())
-
--- | Function pointer for COPY sink callbacks.
-type DuckDBCopyFunctionSinkFun = FunPtr (DuckDBCopyFunctionSinkInfo -> DuckDBDataChunk -> IO ())
-
--- | Function pointer for COPY finalize callbacks.
-type DuckDBCopyFunctionFinalizeFun = FunPtr (DuckDBCopyFunctionFinalizeInfo -> IO ())
-
--- | Function pointer implementing cast functions.
-type DuckDBCastFunctionFun =
-    FunPtr (DuckDBFunctionInfo -> DuckDBIdx -> DuckDBVector -> DuckDBVector -> IO CBool)
-
--- | Function pointer returning aggregate state size.
-type DuckDBAggregateStateSizeFun = FunPtr (DuckDBFunctionInfo -> IO DuckDBIdx)
-
--- | Function pointer initializing aggregate state.
-type DuckDBAggregateInitFun = FunPtr (DuckDBFunctionInfo -> DuckDBAggregateState -> IO ())
-
--- | Function pointer destroying aggregate state batches.
-type DuckDBAggregateDestroyFun = FunPtr (Ptr DuckDBAggregateState -> DuckDBIdx -> IO ())
-
--- | Function pointer updating aggregate states.
-type DuckDBAggregateUpdateFun =
-    FunPtr (DuckDBFunctionInfo -> DuckDBDataChunk -> Ptr DuckDBAggregateState -> IO ())
-
--- | Function pointer combining aggregate states.
-type DuckDBAggregateCombineFun =
-    FunPtr
-        ( DuckDBFunctionInfo ->
-          Ptr DuckDBAggregateState ->
-          Ptr DuckDBAggregateState ->
-          DuckDBIdx ->
-          IO ()
-        )
-
--- | Function pointer finalising aggregate states.
-type DuckDBAggregateFinalizeFun =
-    FunPtr
-        ( DuckDBFunctionInfo ->
-          Ptr DuckDBAggregateState ->
-          DuckDBVector ->
-          DuckDBIdx ->
-          DuckDBIdx ->
-          IO ()
-        )
-
--- | Function pointer for table function bind callbacks.
-type DuckDBTableFunctionBindFun = FunPtr (DuckDBBindInfo -> IO ())
-
--- | Function pointer for table function init callbacks.
-type DuckDBTableFunctionInitFun = FunPtr (DuckDBInitInfo -> IO ())
-
--- | Function pointer for table function execution callbacks.
-type DuckDBTableFunctionFun = FunPtr (DuckDBFunctionInfo -> DuckDBDataChunk -> IO ())
-
--- | Function pointer for log-storage write callbacks.
-type DuckDBLoggerWriteLogEntryFun =
-    FunPtr (Ptr () -> Ptr DuckDBTimestamp -> CString -> CString -> CString -> IO ())
-
--- | Function pointer for replacement scan callbacks.
-type DuckDBReplacementCallback =
-    FunPtr (DuckDBReplacementScanInfo -> CString -> Ptr () -> IO ())
-
--- These structures follow the Arrow C Data Interface and C Stream Interface.
--- See https://arrow.apache.org/docs/format/CDataInterface.html for the full
--- specification.
--- #ifndef ARROW_C_DATA_INTERFACE
--- #define ARROW_C_DATA_INTERFACE
-
--- #define ARROW_FLAG_DICTIONARY_ORDERED 1
--- #define ARROW_FLAG_NULLABLE 2
--- #define ARROW_FLAG_MAP_KEYS_SORTED 4
-
--- struct ArrowSchema {
---   // Array type description
---   const char* format;
---   const char* name;
---   const char* metadata;
---   int64_t flags;
---   int64_t n_children;
---   struct ArrowSchema** children;
---   struct ArrowSchema* dictionary;
-
---   // Release callback
---   void (*release)(struct ArrowSchema*);
---   // Opaque producer-specific data
---   void* private_data;
--- };
-
--- struct ArrowArray {
---   // Array data description
---   int64_t length;
---   int64_t null_count;
---   int64_t offset;
---   int64_t n_buffers;
---   int64_t n_children;
---   const void** buffers;
---   struct ArrowArray** children;
---   struct ArrowArray* dictionary;
-
---   // Release callback
---   void (*release)(struct ArrowArray*);
---   // Opaque producer-specific data
---   void* private_data;
--- };
-
--- #endif  // ARROW_C_DATA_INTERFACE
-
--- | Arrow schema structure from the Arrow C Data Interface.
-data ArrowSchema = ArrowSchema
-    { arrowSchemaFormat :: CString
-    , arrowSchemaName :: CString
-    , arrowSchemaMetadata :: CString
-    , arrowSchemaFlags :: Int64
-    , arrowSchemaChildCount :: Int64
-    , arrowSchemaChildren :: Ptr (Ptr ArrowSchema)
-    , arrowSchemaDictionary :: Ptr ArrowSchema
-    , arrowSchemaRelease :: FunPtr (Ptr ArrowSchema -> IO ())
-    , arrowSchemaPrivateData :: Ptr ()
-    }
-
-instance Storable ArrowSchema where
-    sizeOf _ = pointerSize * 9
-    alignment _ = alignment (nullPtr :: Ptr ())
-    peek ptr =
-        ArrowSchema
-            <$> peekByteOff ptr 0
-            <*> peekByteOff ptr pointerSize
-            <*> peekByteOff ptr (pointerSize * 2)
-            <*> peekByteOff ptr (pointerSize * 3)
-            <*> peekByteOff ptr (pointerSize * 4)
-            <*> peekByteOff ptr (pointerSize * 5)
-            <*> peekByteOff ptr (pointerSize * 6)
-            <*> peekByteOff ptr (pointerSize * 7)
-            <*> peekByteOff ptr (pointerSize * 8)
-    poke ptr ArrowSchema{..} = do
-        pokeByteOff ptr 0 arrowSchemaFormat
-        pokeByteOff ptr pointerSize arrowSchemaName
-        pokeByteOff ptr (pointerSize * 2) arrowSchemaMetadata
-        pokeByteOff ptr (pointerSize * 3) arrowSchemaFlags
-        pokeByteOff ptr (pointerSize * 4) arrowSchemaChildCount
-        pokeByteOff ptr (pointerSize * 5) arrowSchemaChildren
-        pokeByteOff ptr (pointerSize * 6) arrowSchemaDictionary
-        pokeByteOff ptr (pointerSize * 7) arrowSchemaRelease
-        pokeByteOff ptr (pointerSize * 8) arrowSchemaPrivateData
-
--- | Arrow array structure from the Arrow C Data Interface.
-data ArrowArray = ArrowArray
-    { arrowArrayLength :: Int64
-    , arrowArrayNullCount :: Int64
-    , arrowArrayOffset :: Int64
-    , arrowArrayBufferCount :: Int64
-    , arrowArrayChildCount :: Int64
-    , arrowArrayBuffers :: Ptr (Ptr ())
-    , arrowArrayChildren :: Ptr (Ptr ArrowArray)
-    , arrowArrayDictionary :: Ptr ArrowArray
-    , arrowArrayRelease :: FunPtr (Ptr ArrowArray -> IO ())
-    , arrowArrayPrivateData :: Ptr ()
-    }
-
-instance Storable ArrowArray where
-    sizeOf _ = pointerSize * 5 + intFieldSize * 5
-    alignment _ = alignment (nullPtr :: Ptr ())
-    peek ptr =
-        ArrowArray
-            <$> peekByteOff ptr 0
-            <*> peekByteOff ptr intFieldSize
-            <*> peekByteOff ptr (intFieldSize * 2)
-            <*> peekByteOff ptr (intFieldSize * 3)
-            <*> peekByteOff ptr (intFieldSize * 4)
-            <*> peekByteOff ptr (intFieldSize * 5)
-            <*> peekByteOff ptr (intFieldSize * 5 + pointerSize)
-            <*> peekByteOff ptr (intFieldSize * 5 + pointerSize * 2)
-            <*> peekByteOff ptr (intFieldSize * 5 + pointerSize * 3)
-            <*> peekByteOff ptr (intFieldSize * 5 + pointerSize * 4)
-    poke ptr ArrowArray{..} = do
-        pokeByteOff ptr 0 arrowArrayLength
-        pokeByteOff ptr intFieldSize arrowArrayNullCount
-        pokeByteOff ptr (intFieldSize * 2) arrowArrayOffset
-        pokeByteOff ptr (intFieldSize * 3) arrowArrayBufferCount
-        pokeByteOff ptr (intFieldSize * 4) arrowArrayChildCount
-        pokeByteOff ptr (intFieldSize * 5) arrowArrayBuffers
-        pokeByteOff ptr (intFieldSize * 5 + pointerSize) arrowArrayChildren
-        pokeByteOff ptr (intFieldSize * 5 + pointerSize * 2) arrowArrayDictionary
-        pokeByteOff ptr (intFieldSize * 5 + pointerSize * 3) arrowArrayRelease
-        pokeByteOff ptr (intFieldSize * 5 + pointerSize * 4) arrowArrayPrivateData
-
--- | Arrow stream structure from the Arrow C Stream Interface.
-data ArrowArrayStream = ArrowArrayStream
-    { arrowStreamGetSchema :: FunPtr (Ptr ArrowArrayStream -> Ptr ArrowSchema -> IO CInt)
-    , arrowStreamGetNext :: FunPtr (Ptr ArrowArrayStream -> Ptr ArrowArray -> IO CInt)
-    , arrowStreamGetLastError :: FunPtr (Ptr ArrowArrayStream -> IO CString)
-    , arrowStreamRelease :: FunPtr (Ptr ArrowArrayStream -> IO ())
-    , arrowStreamPrivateData :: Ptr ()
-    }
-
-instance Storable ArrowArrayStream where
-    sizeOf _ = pointerSize * 5
-    alignment _ = alignment (nullPtr :: Ptr ())
-    peek ptr =
-        ArrowArrayStream
-            <$> peekByteOff ptr 0
-            <*> peekByteOff ptr pointerSize
-            <*> peekByteOff ptr (pointerSize * 2)
-            <*> peekByteOff ptr (pointerSize * 3)
-            <*> peekByteOff ptr (pointerSize * 4)
-    poke ptr ArrowArrayStream{..} = do
-        pokeByteOff ptr 0 arrowStreamGetSchema
-        pokeByteOff ptr pointerSize arrowStreamGetNext
-        pokeByteOff ptr (pointerSize * 2) arrowStreamGetLastError
-        pokeByteOff ptr (pointerSize * 3) arrowStreamRelease
-        pokeByteOff ptr (pointerSize * 4) arrowStreamPrivateData
-
-{- | Pointer to an Arrow schema used by the deprecated DuckDB API.
-Release the schema through its release callback. The caller owns its storage.
--}
-newtype ArrowSchemaPtr = ArrowSchemaPtr {unArrowSchemaPtr :: Ptr ArrowSchema}
-    deriving (Eq)
-
-{- | Pointer to an Arrow array used by the deprecated DuckDB API.
-Release the array through its release callback. The caller owns its storage.
--}
-newtype ArrowArrayPtr = ArrowArrayPtr {unArrowArrayPtr :: Ptr ArrowArray}
-    deriving (Eq)
-
-{- | Pointer wrapper for the deprecated Arrow stream handle returned by DuckDB.
-DuckDB owns the referenced stream; call @c_duckdb_destroy_arrow_stream@ after
-invoking @duckdb_arrow_scan@.
--}
-newtype ArrowStreamPtr = ArrowStreamPtr {unArrowStreamPtr :: Ptr ()}
-    deriving (Eq)
-
-pointerSize :: Int
-pointerSize = sizeOf (nullPtr :: Ptr ())
-
-intFieldSize :: Int
-intFieldSize = sizeOf (0 :: Int64)
diff --git a/src/Database/DuckDB/FFI/Validity.hs b/src/Database/DuckDB/FFI/Validity.hs
deleted file mode 100644
--- a/src/Database/DuckDB/FFI/Validity.hs
+++ /dev/null
@@ -1,61 +0,0 @@
-module Database.DuckDB.FFI.Validity (
-    c_duckdb_validity_row_is_valid,
-    c_duckdb_validity_set_row_validity,
-    c_duckdb_validity_set_row_invalid,
-    c_duckdb_validity_set_row_valid,
-) where
-
-import Data.Word (Word64)
-import Database.DuckDB.FFI.Types
-import Foreign.C.Types (CBool (..))
-import Foreign.Ptr (Ptr)
-
-{- | Returns whether or not a row is valid (i.e., not NULL) in the given validity
-mask.
-
-Parameters:
-* @validity@: The validity mask, as obtained through
-  @duckdb_vector_get_validity@
-* @row@: The row index
-
-Returns true if the row is valid, false otherwise
--}
-foreign import ccall safe "duckdb_validity_row_is_valid"
-    c_duckdb_validity_row_is_valid :: Ptr Word64 -> DuckDBIdx -> IO CBool
-
-{- | In a validity mask, sets a specific row to either valid or invalid.
-
-Note that @duckdb_vector_ensure_validity_writable@ should be called before
-calling @duckdb_vector_get_validity@, to ensure that there is a validity mask
-to write to.
-
-Parameters:
-* @validity@: The validity mask, as obtained through
-  @duckdb_vector_get_validity@.
-* @row@: The row index
-* @valid@: Whether or not to set the row to valid, or invalid
--}
-foreign import ccall safe "duckdb_validity_set_row_validity"
-    c_duckdb_validity_set_row_validity :: Ptr Word64 -> DuckDBIdx -> CBool -> IO ()
-
-{- | In a validity mask, sets a specific row to invalid.
-
-Equivalent to @duckdb_validity_set_row_validity@ with valid set to false.
-
-Parameters:
-* @validity@: The validity mask
-* @row@: The row index
--}
-foreign import ccall safe "duckdb_validity_set_row_invalid"
-    c_duckdb_validity_set_row_invalid :: Ptr Word64 -> DuckDBIdx -> IO ()
-
-{- | In a validity mask, sets a specific row to valid.
-
-Equivalent to @duckdb_validity_set_row_validity@ with valid set to true.
-
-Parameters:
-* @validity@: The validity mask
-* @row@: The row index
--}
-foreign import ccall safe "duckdb_validity_set_row_valid"
-    c_duckdb_validity_set_row_valid :: Ptr Word64 -> DuckDBIdx -> IO ()
diff --git a/src/Database/DuckDB/FFI/ValueInterface.hs b/src/Database/DuckDB/FFI/ValueInterface.hs
deleted file mode 100644
--- a/src/Database/DuckDB/FFI/ValueInterface.hs
+++ /dev/null
@@ -1,928 +0,0 @@
-module Database.DuckDB.FFI.ValueInterface (
-    c_duckdb_destroy_value,
-    c_duckdb_create_varchar,
-    c_duckdb_create_varchar_length,
-    c_duckdb_create_bool,
-    c_duckdb_create_int8,
-    c_duckdb_create_uint8,
-    c_duckdb_create_int16,
-    c_duckdb_create_uint16,
-    c_duckdb_create_int32,
-    c_duckdb_create_uint32,
-    c_duckdb_create_uint64,
-    c_duckdb_create_int64,
-    c_duckdb_create_hugeint,
-    c_duckdb_create_uhugeint,
-    c_duckdb_create_bignum,
-    c_duckdb_create_decimal,
-    c_duckdb_create_float,
-    c_duckdb_create_double,
-    c_duckdb_create_date,
-    c_duckdb_create_time,
-    c_duckdb_create_time_ns,
-    c_duckdb_create_time_tz_value,
-    c_duckdb_create_timestamp,
-    c_duckdb_create_timestamp_tz,
-    c_duckdb_create_timestamp_s,
-    c_duckdb_create_timestamp_ms,
-    c_duckdb_create_timestamp_ns,
-    c_duckdb_create_interval,
-    c_duckdb_create_blob,
-    c_duckdb_create_bit,
-    c_duckdb_create_uuid,
-    c_duckdb_get_bool,
-    c_duckdb_get_int8,
-    c_duckdb_get_uint8,
-    c_duckdb_get_int16,
-    c_duckdb_get_uint16,
-    c_duckdb_get_int32,
-    c_duckdb_get_uint32,
-    c_duckdb_get_int64,
-    c_duckdb_get_uint64,
-    c_duckdb_get_hugeint,
-    c_duckdb_get_uhugeint,
-    c_duckdb_get_bignum,
-    c_duckdb_get_decimal,
-    c_duckdb_get_float,
-    c_duckdb_get_double,
-    c_duckdb_get_date,
-    c_duckdb_get_time,
-    c_duckdb_get_time_ns,
-    c_duckdb_get_time_tz,
-    c_duckdb_get_timestamp,
-    c_duckdb_get_timestamp_tz,
-    c_duckdb_get_timestamp_s,
-    c_duckdb_get_timestamp_ms,
-    c_duckdb_get_timestamp_ns,
-    c_duckdb_get_interval,
-    c_duckdb_get_value_type,
-    c_duckdb_get_blob,
-    c_duckdb_get_bit,
-    c_duckdb_get_uuid,
-    c_duckdb_get_varchar,
-    c_duckdb_create_struct_value,
-    c_duckdb_create_list_value,
-    c_duckdb_create_array_value,
-    c_duckdb_create_map_value,
-    c_duckdb_create_union_value,
-    c_duckdb_get_map_size,
-    c_duckdb_get_map_key,
-    c_duckdb_get_map_value,
-    c_duckdb_is_null_value,
-    c_duckdb_create_null_value,
-    c_duckdb_get_list_size,
-    c_duckdb_get_list_child,
-    c_duckdb_create_enum_value,
-    c_duckdb_get_enum_value,
-    c_duckdb_get_struct_child,
-    c_duckdb_value_to_string,
-) where
-
-import Data.Int (Int16, Int32, Int64, Int8)
-import Data.Word (Word16, Word32, Word64, Word8)
-import Database.DuckDB.FFI.Types
-import Foreign.C.String (CString)
-import Foreign.C.Types (CBool (..), CDouble (..), CFloat (..))
-import Foreign.Ptr (Ptr)
-
-{- | Destroys the value and de-allocates all memory allocated for that type.
-
-Parameters:
-* @value@: The value to destroy.
--}
-foreign import ccall safe "duckdb_destroy_value"
-    c_duckdb_destroy_value :: Ptr DuckDBValue -> IO ()
-
-{- | Creates a value from a null-terminated string
-
-Parameters:
-* @text@: The null-terminated string
-
-Returns The value. This must be destroyed with @duckdb_destroy_value@.
--}
-foreign import ccall safe "duckdb_create_varchar"
-    c_duckdb_create_varchar :: CString -> IO DuckDBValue
-
-{- | Creates a value from a string
-
-Parameters:
-* @text@: The text
-* @length@: The length of the text
-
-Returns The value. This must be destroyed with @duckdb_destroy_value@.
--}
-foreign import ccall safe "duckdb_create_varchar_length"
-    c_duckdb_create_varchar_length :: CString -> DuckDBIdx -> IO DuckDBValue
-
-{- | Creates a value from a boolean
-
-Parameters:
-* @input@: The boolean value
-
-Returns The value. This must be destroyed with @duckdb_destroy_value@.
--}
-foreign import ccall safe "duckdb_create_bool"
-    c_duckdb_create_bool :: CBool -> IO DuckDBValue
-
-{- | Creates a value from an int8_t (a tinyint)
-
-Parameters:
-* @input@: The tinyint value
-
-Returns The value. This must be destroyed with @duckdb_destroy_value@.
--}
-foreign import ccall safe "duckdb_create_int8"
-    c_duckdb_create_int8 :: Int8 -> IO DuckDBValue
-
-{- | Creates a value from a uint8_t (a utinyint)
-
-Parameters:
-* @input@: The utinyint value
-
-Returns The value. This must be destroyed with @duckdb_destroy_value@.
--}
-foreign import ccall safe "duckdb_create_uint8"
-    c_duckdb_create_uint8 :: Word8 -> IO DuckDBValue
-
-{- | Creates a value from an int16_t (a smallint)
-
-Parameters:
-* @input@: The smallint value
-
-Returns The value. This must be destroyed with @duckdb_destroy_value@.
--}
-foreign import ccall safe "duckdb_create_int16"
-    c_duckdb_create_int16 :: Int16 -> IO DuckDBValue
-
-{- | Creates a value from a uint16_t (a usmallint)
-
-Parameters:
-* @input@: The usmallint value
-
-Returns The value. This must be destroyed with @duckdb_destroy_value@.
--}
-foreign import ccall safe "duckdb_create_uint16"
-    c_duckdb_create_uint16 :: Word16 -> IO DuckDBValue
-
-{- | Creates a value from an int32_t (an integer)
-
-Parameters:
-* @input@: The integer value
-
-Returns The value. This must be destroyed with @duckdb_destroy_value@.
--}
-foreign import ccall safe "duckdb_create_int32"
-    c_duckdb_create_int32 :: Int32 -> IO DuckDBValue
-
-{- | Creates a value from a uint32_t (a uinteger)
-
-Parameters:
-* @input@: The uinteger value
-
-Returns The value. This must be destroyed with @duckdb_destroy_value@.
--}
-foreign import ccall safe "duckdb_create_uint32"
-    c_duckdb_create_uint32 :: Word32 -> IO DuckDBValue
-
-{- | Creates a value from a uint64_t (a ubigint)
-
-Parameters:
-* @input@: The ubigint value
-
-Returns The value. This must be destroyed with @duckdb_destroy_value@.
--}
-foreign import ccall safe "duckdb_create_uint64"
-    c_duckdb_create_uint64 :: Word64 -> IO DuckDBValue
-
-{- | Creates a value from an int64
-
-Returns The value. This must be destroyed with @duckdb_destroy_value@.
--}
-foreign import ccall safe "duckdb_create_int64"
-    c_duckdb_create_int64 :: Int64 -> IO DuckDBValue
-
-{- | Creates a value from a hugeint
-
-Parameters:
-* @input@: The hugeint value
-
-Returns The value. This must be destroyed with @duckdb_destroy_value@.
-
-These bindings call the wrapper symbol @wrapped_duckdb_create_hugeint@
-but mirror the DuckDB C API semantics of @duckdb_create_hugeint@.
--}
-foreign import ccall safe "wrapped_duckdb_create_hugeint"
-    c_duckdb_create_hugeint :: Ptr DuckDBHugeInt -> IO DuckDBValue
-
-{- | Creates a value from a uhugeint
-
-Parameters:
-* @input@: The uhugeint value
-
-Returns The value. This must be destroyed with @duckdb_destroy_value@.
-
-These bindings call the wrapper symbol @wrapped_duckdb_create_uhugeint@
-but mirror the DuckDB C API semantics of @duckdb_create_uhugeint@.
--}
-foreign import ccall safe "wrapped_duckdb_create_uhugeint"
-    c_duckdb_create_uhugeint :: Ptr DuckDBUHugeInt -> IO DuckDBValue
-
-{- | Creates a BIGNUM value from a duckdb_bignum
-
-Parameters:
-* @input@: The duckdb_bignum value
-
-Returns The value. This must be destroyed with @duckdb_destroy_value@.
-
-These bindings call the wrapper symbol @wrapped_duckdb_create_bignum@
-but mirror the DuckDB C API semantics of @duckdb_create_bignum@.
--}
-foreign import ccall safe "wrapped_duckdb_create_bignum"
-    c_duckdb_create_bignum :: Ptr DuckDBBignum -> IO DuckDBValue
-
-{- | Creates a DECIMAL value from a duckdb_decimal
-
-Parameters:
-* @input@: The duckdb_decimal value
-
-Returns The value. This must be destroyed with @duckdb_destroy_value@.
-
-These bindings call the wrapper symbol @wrapped_duckdb_create_decimal@
-but mirror the DuckDB C API semantics of @duckdb_create_decimal@.
--}
-foreign import ccall safe "wrapped_duckdb_create_decimal"
-    c_duckdb_create_decimal :: Ptr DuckDBDecimal -> IO DuckDBValue
-
-{- | Creates a value from a float
-
-Parameters:
-* @input@: The float value
-
-Returns The value. This must be destroyed with @duckdb_destroy_value@.
--}
-foreign import ccall safe "duckdb_create_float"
-    c_duckdb_create_float :: CFloat -> IO DuckDBValue
-
-{- | Creates a value from a double
-
-Parameters:
-* @input@: The double value
-
-Returns The value. This must be destroyed with @duckdb_destroy_value@.
--}
-foreign import ccall safe "duckdb_create_double"
-    c_duckdb_create_double :: CDouble -> IO DuckDBValue
-
-{- | Creates a value from a date
-
-Parameters:
-* @input@: The date value
-
-Returns The value. This must be destroyed with @duckdb_destroy_value@.
--}
-foreign import ccall safe "wrapped_duckdb_create_date"
-    c_duckdb_create_date :: DuckDBDate -> IO DuckDBValue
-
-{- | Creates a value from a time
-
-Parameters:
-* @input@: The time value
-
-Returns The value. This must be destroyed with @duckdb_destroy_value@.
--}
-foreign import ccall safe "wrapped_duckdb_create_time"
-    c_duckdb_create_time :: DuckDBTime -> IO DuckDBValue
-
-{- | Creates a value from a time_ns
-
-Parameters:
-* @input@: The time value
-
-Returns The value. This must be destroyed with @duckdb_destroy_value@.
--}
-foreign import ccall safe "wrapped_duckdb_create_time_ns"
-    c_duckdb_create_time_ns :: DuckDBTimeNs -> IO DuckDBValue
-
-{- | Creates a value from a time_tz. Not to be confused with
-@duckdb_create_time_tz@, which creates a duckdb_time_tz_t.
-
-Parameters:
-* @value@: The time_tz value
-
-Returns The value. This must be destroyed with @duckdb_destroy_value@.
--}
-foreign import ccall safe "wrapped_duckdb_create_time_tz_value"
-    c_duckdb_create_time_tz_value :: DuckDBTimeTz -> IO DuckDBValue
-
-{- | Creates a TIMESTAMP value from a duckdb_timestamp
-
-Parameters:
-* @input@: The duckdb_timestamp value
-
-Returns The value. This must be destroyed with @duckdb_destroy_value@.
--}
-foreign import ccall safe "wrapped_duckdb_create_timestamp"
-    c_duckdb_create_timestamp :: DuckDBTimestamp -> IO DuckDBValue
-
-{- | Creates a TIMESTAMP_TZ value from a duckdb_timestamp
-
-Parameters:
-* @input@: The duckdb_timestamp value
-
-Returns The value. This must be destroyed with @duckdb_destroy_value@.
--}
-foreign import ccall safe "wrapped_duckdb_create_timestamp_tz"
-    c_duckdb_create_timestamp_tz :: DuckDBTimestamp -> IO DuckDBValue
-
-{- | Creates a TIMESTAMP_S value from a duckdb_timestamp_s
-
-Parameters:
-* @input@: The duckdb_timestamp_s value
-
-Returns The value. This must be destroyed with @duckdb_destroy_value@.
--}
-foreign import ccall safe "wrapped_duckdb_create_timestamp_s"
-    c_duckdb_create_timestamp_s :: DuckDBTimestampS -> IO DuckDBValue
-
-{- | Creates a TIMESTAMP_MS value from a duckdb_timestamp_ms
-
-Parameters:
-* @input@: The duckdb_timestamp_ms value
-
-Returns The value. This must be destroyed with @duckdb_destroy_value@.
--}
-foreign import ccall safe "wrapped_duckdb_create_timestamp_ms"
-    c_duckdb_create_timestamp_ms :: DuckDBTimestampMs -> IO DuckDBValue
-
-{- | Creates a TIMESTAMP_NS value from a duckdb_timestamp_ns
-
-Parameters:
-* @input@: The duckdb_timestamp_ns value
-
-Returns The value. This must be destroyed with @duckdb_destroy_value@.
--}
-foreign import ccall safe "wrapped_duckdb_create_timestamp_ns"
-    c_duckdb_create_timestamp_ns :: DuckDBTimestampNs -> IO DuckDBValue
-
-{- | Creates a value from an interval
-
-Parameters:
-* @input@: The interval value
-
-Returns The value. This must be destroyed with @duckdb_destroy_value@.
-
-These bindings call the wrapper symbol @wrapped_duckdb_create_interval@
-but mirror the DuckDB C API semantics of @duckdb_create_interval@.
--}
-foreign import ccall safe "wrapped_duckdb_create_interval"
-    c_duckdb_create_interval :: Ptr DuckDBInterval -> IO DuckDBValue
-
-{- | Creates a value from a blob
-
-Parameters:
-* @data@: The blob data
-* @length@: The length of the blob data
-
-Returns The value. This must be destroyed with @duckdb_destroy_value@.
--}
-foreign import ccall safe "duckdb_create_blob"
-    c_duckdb_create_blob :: Ptr Word8 -> DuckDBIdx -> IO DuckDBValue
-
-{- | Creates a BIT value from a duckdb_bit
-
-Parameters:
-* @input@: The duckdb_bit value
-
-Returns The value. This must be destroyed with @duckdb_destroy_value@.
-
-These bindings call the wrapper symbol @wrapped_duckdb_create_bit@ but
-mirror the DuckDB C API semantics of @duckdb_create_bit@.
--}
-foreign import ccall safe "wrapped_duckdb_create_bit"
-    c_duckdb_create_bit :: Ptr DuckDBBit -> IO DuckDBValue
-
-{- | Creates a UUID value from a uhugeint
-
-Parameters:
-* @input@: The duckdb_uhugeint containing the UUID
-
-Returns The value. This must be destroyed with @duckdb_destroy_value@.
-
-These bindings call the wrapper symbol @wrapped_duckdb_create_uuid@ but
-mirror the DuckDB C API semantics of @duckdb_create_uuid@.
--}
-foreign import ccall safe "wrapped_duckdb_create_uuid"
-    c_duckdb_create_uuid :: Ptr DuckDBUHugeInt -> IO DuckDBValue
-
-{- | Returns the boolean value of the given value.
-
-Parameters:
-* @val@: A duckdb_value containing a boolean
-
-Returns A boolean, or false if the value cannot be converted
--}
-foreign import ccall safe "duckdb_get_bool"
-    c_duckdb_get_bool :: DuckDBValue -> IO CBool
-
-{- | Returns the int8_t value of the given value.
-
-Parameters:
-* @val@: A duckdb_value containing a tinyint
-
-Returns A int8_t, or MinValue if the value cannot be converted
--}
-foreign import ccall safe "duckdb_get_int8"
-    c_duckdb_get_int8 :: DuckDBValue -> IO Int8
-
-{- | Returns the uint8_t value of the given value.
-
-Parameters:
-* @val@: A duckdb_value containing a utinyint
-
-Returns A uint8_t, or MinValue if the value cannot be converted
--}
-foreign import ccall safe "duckdb_get_uint8"
-    c_duckdb_get_uint8 :: DuckDBValue -> IO Word8
-
-{- | Returns the int16_t value of the given value.
-
-Parameters:
-* @val@: A duckdb_value containing a smallint
-
-Returns A int16_t, or MinValue if the value cannot be converted
--}
-foreign import ccall safe "duckdb_get_int16"
-    c_duckdb_get_int16 :: DuckDBValue -> IO Int16
-
-{- | Returns the uint16_t value of the given value.
-
-Parameters:
-* @val@: A duckdb_value containing a usmallint
-
-Returns A uint16_t, or MinValue if the value cannot be converted
--}
-foreign import ccall safe "duckdb_get_uint16"
-    c_duckdb_get_uint16 :: DuckDBValue -> IO Word16
-
-{- | Returns the int32_t value of the given value.
-
-Parameters:
-* @val@: A duckdb_value containing an integer
-
-Returns A int32_t, or MinValue if the value cannot be converted
--}
-foreign import ccall safe "duckdb_get_int32"
-    c_duckdb_get_int32 :: DuckDBValue -> IO Int32
-
-{- | Returns the uint32_t value of the given value.
-
-Parameters:
-* @val@: A duckdb_value containing a uinteger
-
-Returns A uint32_t, or MinValue if the value cannot be converted
--}
-foreign import ccall safe "duckdb_get_uint32"
-    c_duckdb_get_uint32 :: DuckDBValue -> IO Word32
-
-{- | Returns the int64_t value of the given value.
-
-Parameters:
-* @val@: A duckdb_value containing a bigint
-
-Returns A int64_t, or MinValue if the value cannot be converted
--}
-foreign import ccall safe "duckdb_get_int64"
-    c_duckdb_get_int64 :: DuckDBValue -> IO Int64
-
-{- | Returns the uint64_t value of the given value.
-
-Parameters:
-* @val@: A duckdb_value containing a ubigint
-
-Returns A uint64_t, or MinValue if the value cannot be converted
--}
-foreign import ccall safe "duckdb_get_uint64"
-    c_duckdb_get_uint64 :: DuckDBValue -> IO Word64
-
-{- | Returns the hugeint value of the given value.
-
-Parameters:
-* @val@: A duckdb_value containing a hugeint
-
-Returns A duckdb_hugeint, or MinValue if the value cannot be converted
-
-These bindings call the wrapper symbol @wrapped_duckdb_get_hugeint@ but
-mirror the DuckDB C API semantics of @duckdb_get_hugeint@.
--}
-foreign import ccall safe "wrapped_duckdb_get_hugeint"
-    c_duckdb_get_hugeint :: DuckDBValue -> Ptr DuckDBHugeInt -> IO ()
-
-{- | Returns the uhugeint value of the given value.
-
-Parameters:
-* @val@: A duckdb_value containing a uhugeint
-
-Returns A duckdb_uhugeint, or MinValue if the value cannot be converted
-
-These bindings call the wrapper symbol @wrapped_duckdb_get_uhugeint@
-but mirror the DuckDB C API semantics of @duckdb_get_uhugeint@.
--}
-foreign import ccall safe "wrapped_duckdb_get_uhugeint"
-    c_duckdb_get_uhugeint :: DuckDBValue -> Ptr DuckDBUHugeInt -> IO ()
-
-{- | Returns the duckdb_bignum value of the given value. The @data@ field must be
-destroyed with @duckdb_free@.
-
-Parameters:
-* @val@: A duckdb_value containing a BIGNUM
-
-Returns A duckdb_bignum. The @data@ field must be destroyed with
-@duckdb_free@.
-
-These bindings call the wrapper symbol @wrapped_duckdb_get_bignum@ but
-mirror the DuckDB C API semantics of @duckdb_get_bignum@.
--}
-foreign import ccall safe "wrapped_duckdb_get_bignum"
-    c_duckdb_get_bignum :: DuckDBValue -> Ptr DuckDBBignum -> IO ()
-
-{- | Returns the duckdb_decimal value of the given value.
-
-Parameters:
-* @val@: A duckdb_value containing a DECIMAL
-
-Returns A duckdb_decimal, or MinValue if the value cannot be converted
-
-These bindings call the wrapper symbol @wrapped_duckdb_get_decimal@ but
-mirror the DuckDB C API semantics of @duckdb_get_decimal@.
--}
-foreign import ccall safe "wrapped_duckdb_get_decimal"
-    c_duckdb_get_decimal :: DuckDBValue -> Ptr DuckDBDecimal -> IO ()
-
-{- | Returns the float value of the given value.
-
-Parameters:
-* @val@: A duckdb_value containing a float
-
-Returns A float, or NAN if the value cannot be converted
--}
-foreign import ccall safe "duckdb_get_float"
-    c_duckdb_get_float :: DuckDBValue -> IO CFloat
-
-{- | Returns the double value of the given value.
-
-Parameters:
-* @val@: A duckdb_value containing a double
-
-Returns A double, or NAN if the value cannot be converted
--}
-foreign import ccall safe "duckdb_get_double"
-    c_duckdb_get_double :: DuckDBValue -> IO CDouble
-
-{- | Returns the date value of the given value.
-
-Parameters:
-* @val@: A duckdb_value containing a date
-
-Returns A duckdb_date, or MinValue if the value cannot be converted
--}
-foreign import ccall safe "wrapped_duckdb_get_date"
-    c_duckdb_get_date :: DuckDBValue -> IO DuckDBDate
-
-{- | Returns the time value of the given value.
-
-Parameters:
-* @val@: A duckdb_value containing a time
-
-Returns A duckdb_time, or MinValue if the value cannot be converted
--}
-foreign import ccall safe "wrapped_duckdb_get_time"
-    c_duckdb_get_time :: DuckDBValue -> IO DuckDBTime
-
-{- | Returns the time_ns value of the given value.
-
-Parameters:
-* @val@: A duckdb_value containing a time_ns
-
-Returns A duckdb_time_ns, or MinValue if the value cannot be converted
--}
-foreign import ccall safe "wrapped_duckdb_get_time_ns"
-    c_duckdb_get_time_ns :: DuckDBValue -> IO DuckDBTimeNs
-
-{- | Returns the time_tz value of the given value.
-
-Parameters:
-* @val@: A duckdb_value containing a time_tz
-
-Returns A duckdb_time_tz, or MinValue if the value cannot be converted
--}
-foreign import ccall safe "wrapped_duckdb_get_time_tz"
-    c_duckdb_get_time_tz :: DuckDBValue -> IO DuckDBTimeTz
-
-{- | Returns the TIMESTAMP value of the given value.
-
-Parameters:
-* @val@: A duckdb_value containing a TIMESTAMP
-
-Returns A duckdb_timestamp, or MinValue if the value cannot be converted
--}
-foreign import ccall safe "wrapped_duckdb_get_timestamp"
-    c_duckdb_get_timestamp :: DuckDBValue -> IO DuckDBTimestamp
-
-{- | Returns the TIMESTAMP_TZ value of the given value.
-
-Parameters:
-* @val@: A duckdb_value containing a TIMESTAMP_TZ
-
-Returns A duckdb_timestamp, or MinValue if the value cannot be converted
--}
-foreign import ccall safe "wrapped_duckdb_get_timestamp_tz"
-    c_duckdb_get_timestamp_tz :: DuckDBValue -> IO DuckDBTimestamp
-
-{- | Returns the duckdb_timestamp_s value of the given value.
-
-Parameters:
-* @val@: A duckdb_value containing a TIMESTAMP_S
-
-Returns A duckdb_timestamp_s, or MinValue if the value cannot be converted
--}
-foreign import ccall safe "wrapped_duckdb_get_timestamp_s"
-    c_duckdb_get_timestamp_s :: DuckDBValue -> IO DuckDBTimestampS
-
-{- | Returns the duckdb_timestamp_ms value of the given value.
-
-Parameters:
-* @val@: A duckdb_value containing a TIMESTAMP_MS
-
-Returns A duckdb_timestamp_ms, or MinValue if the value cannot be converted
--}
-foreign import ccall safe "wrapped_duckdb_get_timestamp_ms"
-    c_duckdb_get_timestamp_ms :: DuckDBValue -> IO DuckDBTimestampMs
-
-{- | Returns the duckdb_timestamp_ns value of the given value.
-
-Parameters:
-* @val@: A duckdb_value containing a TIMESTAMP_NS
-
-Returns A duckdb_timestamp_ns, or MinValue if the value cannot be converted
--}
-foreign import ccall safe "wrapped_duckdb_get_timestamp_ns"
-    c_duckdb_get_timestamp_ns :: DuckDBValue -> IO DuckDBTimestampNs
-
-{- | Returns the interval value of the given value.
-
-Parameters:
-* @val@: A duckdb_value containing a interval
-
-Returns A duckdb_interval, or MinValue if the value cannot be converted
-
-These bindings call the wrapper symbol @wrapped_duckdb_get_interval@
-but mirror the DuckDB C API semantics of @duckdb_get_interval@.
--}
-foreign import ccall safe "wrapped_duckdb_get_interval"
-    c_duckdb_get_interval :: DuckDBValue -> Ptr DuckDBInterval -> IO ()
-
-{- | Returns the type of the given value. The type is valid as long as the value is
-not destroyed. The type itself must not be destroyed.
-
-Parameters:
-* @val@: A duckdb_value
-
-Returns A duckdb_logical_type.
--}
-foreign import ccall safe "duckdb_get_value_type"
-    c_duckdb_get_value_type :: DuckDBValue -> IO DuckDBLogicalType
-
-{- | Returns the blob value of the given value.
-
-Parameters:
-* @val@: A duckdb_value containing a blob
-
-Returns A duckdb_blob
-
-These bindings call the wrapper symbol @wrapped_duckdb_get_blob@ but
-mirror the DuckDB C API semantics of @duckdb_get_blob@.
--}
-foreign import ccall safe "wrapped_duckdb_get_blob"
-    c_duckdb_get_blob :: DuckDBValue -> Ptr DuckDBBlob -> IO ()
-
-{- | Returns the duckdb_bit value of the given value. The @data@ field must be
-destroyed with @duckdb_free@.
-
-Parameters:
-* @val@: A duckdb_value containing a BIT
-
-Returns A duckdb_bit
-
-These bindings call the wrapper symbol @wrapped_duckdb_get_bit@ but
-mirror the DuckDB C API semantics of @duckdb_get_bit@.
--}
-foreign import ccall safe "wrapped_duckdb_get_bit"
-    c_duckdb_get_bit :: DuckDBValue -> Ptr DuckDBBit -> IO ()
-
-{- | Returns a duckdb_uhugeint representing the UUID value of the given value.
-
-Parameters:
-* @val@: A duckdb_value containing a UUID
-
-Returns A duckdb_uhugeint representing the UUID value
-
-These bindings call the wrapper symbol @wrapped_duckdb_get_uuid@ but
-mirror the DuckDB C API semantics of @duckdb_get_uuid@.
--}
-foreign import ccall safe "wrapped_duckdb_get_uuid"
-    c_duckdb_get_uuid :: DuckDBValue -> Ptr DuckDBUHugeInt -> IO ()
-
-{- | Obtains a string representation of the given value. The result must be
-destroyed with @duckdb_free@.
-
-Parameters:
-* @value@: The value
-
-Returns The string value. This must be destroyed with @duckdb_free@.
--}
-foreign import ccall safe "duckdb_get_varchar"
-    c_duckdb_get_varchar :: DuckDBValue -> IO CString
-
-{- | Creates a struct value from a type and an array of values. Must be destroyed
-with @duckdb_destroy_value@.
-
-Parameters:
-* @type@: The type of the struct
-* @values@: The values for the struct fields
-
-Returns The struct value, or nullptr, if any child type is @DUCKDB_TYPE_ANY@
-or @DUCKDB_TYPE_INVALID@.
--}
-foreign import ccall safe "duckdb_create_struct_value"
-    c_duckdb_create_struct_value :: DuckDBLogicalType -> Ptr DuckDBValue -> IO DuckDBValue
-
-{- | Creates a list value from a child (element) type and an array of values of
-length @value_count@. Must be destroyed with @duckdb_destroy_value@.
-
-Parameters:
-* @type@: The type of the list
-* @values@: The values for the list
-* @value_count@: The number of values in the list
-
-Returns The list value, or nullptr, if the child type is @DUCKDB_TYPE_ANY@ or
-@DUCKDB_TYPE_INVALID@.
--}
-foreign import ccall safe "duckdb_create_list_value"
-    c_duckdb_create_list_value :: DuckDBLogicalType -> Ptr DuckDBValue -> DuckDBIdx -> IO DuckDBValue
-
-{- | Creates an array value from a child (element) type and an array of values of
-length @value_count@. Must be destroyed with @duckdb_destroy_value@.
-
-Parameters:
-* @type@: The type of the array
-* @values@: The values for the array
-* @value_count@: The number of values in the array
-
-Returns The array value, or nullptr, if the child type is @DUCKDB_TYPE_ANY@ or
-@DUCKDB_TYPE_INVALID@.
--}
-foreign import ccall safe "duckdb_create_array_value"
-    c_duckdb_create_array_value :: DuckDBLogicalType -> Ptr DuckDBValue -> DuckDBIdx -> IO DuckDBValue
-
-{- | Creates a map value from a map type and two arrays, one for the keys and one
-for the values, each of length @entry_count@. Must be destroyed with
-@duckdb_destroy_value@.
-
-Parameters:
-* @map_type@: The map type
-* @keys@: The keys of the map
-* @values@: The values of the map
-* @entry_count@: The number of entrys (key-value pairs) in the map
-
-Returns The map value, or nullptr, if the parameters are invalid.
--}
-foreign import ccall safe "duckdb_create_map_value"
-    c_duckdb_create_map_value :: DuckDBLogicalType -> Ptr DuckDBValue -> Ptr DuckDBValue -> DuckDBIdx -> IO DuckDBValue
-
-{- | Creates a union value from a union type, a tag index, and a value. Must be
-destroyed with @duckdb_destroy_value@.
-
-Parameters:
-* @union_type@: The union type
-* @tag_index@: The index of the tag of the union
-* @value@: The value of the union for that tag
-
-Returns The union value, or nullptr, if the parameters are invalid.
--}
-foreign import ccall safe "duckdb_create_union_value"
-    c_duckdb_create_union_value :: DuckDBLogicalType -> DuckDBIdx -> DuckDBValue -> IO DuckDBValue
-
-{- | Returns the number of elements in a MAP value.
-
-Parameters:
-* @value@: The MAP value.
-
-Returns The number of elements in the map.
--}
-foreign import ccall safe "duckdb_get_map_size"
-    c_duckdb_get_map_size :: DuckDBValue -> IO DuckDBIdx
-
-{- | Returns the MAP key at index as a duckdb_value.
-
-Parameters:
-* @value@: The MAP value.
-* @index@: The index of the key.
-
-Returns The key as a duckdb_value.
--}
-foreign import ccall safe "duckdb_get_map_key"
-    c_duckdb_get_map_key :: DuckDBValue -> DuckDBIdx -> IO DuckDBValue
-
-{- | Returns the MAP value at index as a duckdb_value.
-
-Parameters:
-* @value@: The MAP value.
-* @index@: The index of the value.
-
-Returns The value as a duckdb_value.
--}
-foreign import ccall safe "duckdb_get_map_value"
-    c_duckdb_get_map_value :: DuckDBValue -> DuckDBIdx -> IO DuckDBValue
-
-{- | Returns whether the value's type is SQLNULL or not.
-
-Parameters:
-* @value@: The value to check.
-
-Returns True, if the value's type is SQLNULL, otherwise false.
--}
-foreign import ccall safe "duckdb_is_null_value"
-    c_duckdb_is_null_value :: DuckDBValue -> IO CBool
-
-{- | Creates a value of type SQLNULL.
-
-Returns The duckdb_value representing SQLNULL. This must be destroyed with
-@duckdb_destroy_value@.
--}
-foreign import ccall safe "duckdb_create_null_value"
-    c_duckdb_create_null_value :: IO DuckDBValue
-
-{- | Returns the number of elements in a LIST value.
-
-Parameters:
-* @value@: The LIST value.
-
-Returns The number of elements in the list.
--}
-foreign import ccall safe "duckdb_get_list_size"
-    c_duckdb_get_list_size :: DuckDBValue -> IO DuckDBIdx
-
-{- | Returns the LIST child at index as a duckdb_value.
-
-Parameters:
-* @value@: The LIST value.
-* @index@: The index of the child.
-
-Returns The child as a duckdb_value.
--}
-foreign import ccall safe "duckdb_get_list_child"
-    c_duckdb_get_list_child :: DuckDBValue -> DuckDBIdx -> IO DuckDBValue
-
-{- | Creates an enum value from a type and a value. Must be destroyed with
-@duckdb_destroy_value@.
-
-Parameters:
-* @type@: The type of the enum
-* @value@: The value for the enum
-
-Returns The enum value, or nullptr.
--}
-foreign import ccall safe "duckdb_create_enum_value"
-    c_duckdb_create_enum_value :: DuckDBLogicalType -> Word64 -> IO DuckDBValue
-
-{- | Returns the enum value of the given value.
-
-Parameters:
-* @value@: A duckdb_value containing an enum
-
-Returns A uint64_t, or MinValue if the value cannot be converted
--}
-foreign import ccall safe "duckdb_get_enum_value"
-    c_duckdb_get_enum_value :: DuckDBValue -> IO Word64
-
-{- | Returns the STRUCT child at index as a duckdb_value.
-
-Parameters:
-* @value@: The STRUCT value.
-* @index@: The index of the child.
-
-Returns The child as a duckdb_value.
--}
-foreign import ccall safe "duckdb_get_struct_child"
-    c_duckdb_get_struct_child :: DuckDBValue -> DuckDBIdx -> IO DuckDBValue
-
-{- | Returns the SQL string representation of the given value.
-
-Parameters:
-* @value@: A duckdb_value.
-
-Returns The SQL string representation as a null-terminated string. The result
-must be freed with @duckdb_free@.
--}
-foreign import ccall safe "duckdb_value_to_string"
-    c_duckdb_value_to_string :: DuckDBValue -> IO CString
diff --git a/src/Database/DuckDB/FFI/Vector.hs b/src/Database/DuckDB/FFI/Vector.hs
deleted file mode 100644
--- a/src/Database/DuckDB/FFI/Vector.hs
+++ /dev/null
@@ -1,256 +0,0 @@
-module Database.DuckDB.FFI.Vector (
-    c_duckdb_create_vector,
-    c_duckdb_destroy_vector,
-    c_duckdb_vector_get_column_type,
-    c_duckdb_vector_get_data,
-    c_duckdb_vector_get_validity,
-    c_duckdb_vector_ensure_validity_writable,
-    c_duckdb_vector_assign_string_element,
-    c_duckdb_vector_assign_string_element_len,
-    c_duckdb_unsafe_vector_assign_string_element_len,
-    c_duckdb_list_vector_get_child,
-    c_duckdb_list_vector_get_size,
-    c_duckdb_list_vector_set_size,
-    c_duckdb_list_vector_reserve,
-    c_duckdb_struct_vector_get_child,
-    c_duckdb_array_vector_get_child,
-    c_duckdb_slice_vector,
-    c_duckdb_vector_copy_sel,
-    c_duckdb_vector_reference_value,
-    c_duckdb_vector_reference_vector,
-) where
-
-import Data.Word (Word64)
-import Database.DuckDB.FFI.Types
-import Foreign.C.String (CString)
-import Foreign.C.Types (CInt (..))
-import Foreign.Ptr (Ptr)
-
-{- | Creates a flat vector. Must be destroyed with @duckdb_destroy_vector@.
-
-Parameters:
-* @type@: The logical type of the vector.
-* @capacity@: The capacity of the vector.
-
-Returns The vector.
--}
-foreign import ccall safe "duckdb_create_vector"
-    c_duckdb_create_vector :: DuckDBLogicalType -> DuckDBIdx -> IO DuckDBVector
-
-{- | Destroys the vector and de-allocates its memory.
-
-Parameters:
-* @vector@: A pointer to the vector.
--}
-foreign import ccall safe "duckdb_destroy_vector"
-    c_duckdb_destroy_vector :: Ptr DuckDBVector -> IO ()
-
-{- | Retrieves the column type of the specified vector.
-
-The result must be destroyed with @duckdb_destroy_logical_type@.
-
-Parameters:
-* @vector@: The vector get the data from
-
-Returns The type of the vector
--}
-foreign import ccall safe "duckdb_vector_get_column_type"
-    c_duckdb_vector_get_column_type :: DuckDBVector -> IO DuckDBLogicalType
-
-{- | Retrieves the data pointer of the vector.
-
-The data pointer can be used to read or write values from the vector. How to
-read or write values depends on the type of the vector.
-
-Parameters:
-* @vector@: The vector to get the data from
-
-Returns The data pointer
--}
-foreign import ccall safe "duckdb_vector_get_data"
-    c_duckdb_vector_get_data :: DuckDBVector -> IO (Ptr ())
-
-{- | Retrieves the validity mask pointer of the specified vector.
-
-If all values are valid, this function MIGHT return NULL!
-
-The validity mask is a bitset that signifies null-ness within the data chunk.
-It is a series of uint64_t values, where each uint64_t value contains validity
-for 64 tuples. The bit is set to 1 if the value is valid (i.e., not NULL) or 0
-if the value is invalid (i.e., NULL).
-
-Validity of a specific value can be obtained like this:
-
-idx_t entry_idx = row_idx / 64; idx_t idx_in_entry = row_idx % 64; bool
-is_valid = validity_mask[entry_idx] & (1 << idx_in_entry);
-
-Alternatively, the (slower) duckdb_validity_row_is_valid function can be used.
-
-Parameters:
-* @vector@: The vector to get the data from
-
-Returns The pointer to the validity mask, or NULL if no validity mask is
-present
--}
-foreign import ccall safe "duckdb_vector_get_validity"
-    c_duckdb_vector_get_validity :: DuckDBVector -> IO (Ptr Word64)
-
-{- | Ensures the validity mask is writable by allocating it.
-
-After this function is called, @duckdb_vector_get_validity@ will ALWAYS return
-non-NULL. This allows NULL values to be written to the vector, regardless of
-whether a validity mask was present before.
-
-Parameters:
-* @vector@: The vector to alter
--}
-foreign import ccall safe "duckdb_vector_ensure_validity_writable"
-    c_duckdb_vector_ensure_validity_writable :: DuckDBVector -> IO ()
-
-{- | Assigns a string element in the vector at the specified location.
-
-Parameters:
-* @vector@: The vector to alter
-* @index@: The row position in the vector to assign the string to
-* @str@: The null-terminated string
--}
-foreign import ccall safe "duckdb_vector_assign_string_element"
-    c_duckdb_vector_assign_string_element :: DuckDBVector -> DuckDBIdx -> CString -> IO ()
-
-{- | Assigns a string element in the vector at the specified location. You may also
-use this function to assign BLOBs.
-
-Parameters:
-* @vector@: The vector to alter
-* @index@: The row position in the vector to assign the string to
-* @str@: The string
-* @str_len@: The length of the string (in bytes)
--}
-foreign import ccall safe "duckdb_vector_assign_string_element_len"
-    c_duckdb_vector_assign_string_element_len :: DuckDBVector -> DuckDBIdx -> CString -> DuckDBIdx -> IO ()
-
-{- | Assigns string bytes without validating UTF-8 first.
-
-Use @duckdb_valid_utf8_check@ if validation is required before calling this.
--}
-foreign import ccall safe "duckdb_unsafe_vector_assign_string_element_len"
-    c_duckdb_unsafe_vector_assign_string_element_len :: DuckDBVector -> DuckDBIdx -> CString -> DuckDBIdx -> IO ()
-
-{- | Retrieves the child vector of a list vector.
-
-The resulting vector is valid as long as the parent vector is valid.
-
-Parameters:
-* @vector@: The vector
-
-Returns The child vector
--}
-foreign import ccall safe "duckdb_list_vector_get_child"
-    c_duckdb_list_vector_get_child :: DuckDBVector -> IO DuckDBVector
-
-{- | Returns the size of the child vector of the list.
-
-Parameters:
-* @vector@: The vector
-
-Returns The size of the child list
--}
-foreign import ccall safe "duckdb_list_vector_get_size"
-    c_duckdb_list_vector_get_size :: DuckDBVector -> IO DuckDBIdx
-
-{- | Sets the total size of the underlying child-vector of a list vector.
-
-Parameters:
-* @vector@: The list vector.
-* @size@: The size of the child list.
-
-Returns The duckdb state. Returns DuckDBError if the vector is nullptr.
--}
-foreign import ccall safe "duckdb_list_vector_set_size"
-    c_duckdb_list_vector_set_size :: DuckDBVector -> DuckDBIdx -> IO DuckDBState
-
-{- | Sets the total capacity of the underlying child-vector of a list.
-
-After calling this method, you must call @duckdb_vector_get_validity@ and
-@duckdb_vector_get_data@ to obtain current data and validity pointers
-
-Parameters:
-* @vector@: The list vector.
-* @required_capacity@: the total capacity to reserve.
-
-Returns The duckdb state. Returns DuckDBError if the vector is nullptr.
--}
-foreign import ccall safe "duckdb_list_vector_reserve"
-    c_duckdb_list_vector_reserve :: DuckDBVector -> DuckDBIdx -> IO DuckDBState
-
-{- | Retrieves the child vector of a struct vector. The resulting vector is valid
-as long as the parent vector is valid.
-
-Parameters:
-* @vector@: The vector
-* @index@: The child index
-
-Returns The child vector
--}
-foreign import ccall safe "duckdb_struct_vector_get_child"
-    c_duckdb_struct_vector_get_child :: DuckDBVector -> DuckDBIdx -> IO DuckDBVector
-
-{- | Retrieves the child vector of an array vector. The resulting vector is valid
-as long as the parent vector is valid. The resulting vector has the size of
-the parent vector multiplied by the array size.
-
-Parameters:
-* @vector@: The vector
-
-Returns The child vector
--}
-foreign import ccall safe "duckdb_array_vector_get_child"
-    c_duckdb_array_vector_get_child :: DuckDBVector -> IO DuckDBVector
-
-{- | Slice a vector with a selection vector. The length of the selection vector
-must be less than or equal to the length of the vector. Turns the vector into
-a dictionary vector.
-
-Parameters:
-* @vector@: The vector to slice.
-* @sel@: The selection vector.
-* @len@: The length of the selection vector.
--}
-foreign import ccall safe "duckdb_slice_vector"
-    c_duckdb_slice_vector :: DuckDBVector -> DuckDBSelectionVector -> DuckDBIdx -> IO ()
-
-{- | Copy the src vector to the dst with a selection vector that identifies which
-indices to copy.
-
-Parameters:
-* @src@: The vector to copy from.
-* @dst@: The vector to copy to.
-* @sel@: The selection vector. The length of the selection vector should not
-  be more than the length of the src vector
-* @src_count@: The number of entries from selection vector to copy. Think of
-  this as the effective length of the selection vector starting from index 0
-* @src_offset@: The offset in the selection vector to copy from (important:
-  actual number of items copied = src_count - src_offset).
-* @dst_offset@: The offset in the dst vector to start copying to.
--}
-foreign import ccall safe "duckdb_vector_copy_sel"
-    c_duckdb_vector_copy_sel :: DuckDBVector -> DuckDBVector -> DuckDBSelectionVector -> DuckDBIdx -> DuckDBIdx -> DuckDBIdx -> IO ()
-
-{- | Copies the value from @value@ to @vector@.
-
-Parameters:
-* @vector@: The receiving vector.
-* @value@: The value to copy into the vector.
--}
-foreign import ccall safe "duckdb_vector_reference_value"
-    c_duckdb_vector_reference_value :: DuckDBVector -> DuckDBValue -> IO ()
-
-{- | Changes @to_vector@ to reference `from_vector. After, the vectors share
-ownership of the data.
-
-Parameters:
-* @to_vector@: The receiving vector.
-* @from_vector@: The vector to reference.
--}
-foreign import ccall safe "duckdb_vector_reference_vector"
-    c_duckdb_vector_reference_vector :: DuckDBVector -> DuckDBVector -> IO ()
diff --git a/test/AggregateFunctionsTest.hs b/test/AggregateFunctionsTest.hs
--- a/test/AggregateFunctionsTest.hs
+++ b/test/AggregateFunctionsTest.hs
@@ -1,5 +1,5 @@
 {-# LANGUAGE BlockArguments #-}
-{-# LANGUAGE ForeignFunctionInterface #-}
+{-# LANGUAGE TypeApplications #-}
 {-# OPTIONS_GHC -Wno-deprecations #-}
 
 module AggregateFunctionsTest (tests) where
@@ -7,171 +7,176 @@
 import Control.Concurrent (runInBoundThread)
 import Control.Exception (bracket)
 import Control.Monad (forM_, when)
+import Data.Coerce (coerce)
 import Data.Int (Int32)
 import Data.List (isInfixOf)
+import Data.Proxy (Proxy (..))
+import Data.Void (Void)
 import Data.Word (Word64)
 import Database.DuckDB.FFI
-import Database.DuckDB.FFI.Deprecated
-import Foreign.C.String (CString, peekCString, withCString)
-import Foreign.C.Types (CBool (..))
+import Foreign.C.ConstPtr (ConstPtr (..))
+import Foreign.C.String (peekCString)
+import Foreign.C.Types (CBool (..), CChar)
 import Foreign.Marshal.Alloc (alloca, free, mallocBytes)
-import Foreign.Ptr (Ptr, castPtr, freeHaskellFunPtr, nullFunPtr, nullPtr)
-import Foreign.Storable (peek, peekElemOff, poke, pokeElemOff, sizeOf)
+import Foreign.Ptr (Ptr, freeHaskellFunPtr, nullFunPtr, nullPtr)
+import Foreign.Storable (peek, peekElemOff, poke, pokeElemOff)
+import HsBindgen.Runtime.Marshal (staticSizeOf)
+import HsBindgen.Runtime.Support.FunPtr (toFunPtr)
 import Test.Tasty (TestTree, testGroup)
 import Test.Tasty.HUnit (assertBool, testCase, (@?=))
-import Utils (withConnection, withDatabase, withLogicalType, withResultCString)
+import Utils (withConnection, withConstCString, withDatabase, withLogicalType, withResultCString)
 
 tests :: TestTree
 tests =
-    testGroup
-        "Aggregate Functions"
-        [ sumAggregate
-        , extraInfoAggregate
-        , aggregateFunctionSet
-        , aggregateErrorPropagation
-        , specialHandlingNulls
-        ]
+  testGroup
+    "Aggregate Functions"
+    [ sumAggregate
+    , extraInfoAggregate
+    , aggregateFunctionSet
+    , aggregateErrorPropagation
+    , specialHandlingNulls
+    ]
 
 -- Test cases ----------------------------------------------------------------
 
 sumAggregate :: TestTree
 sumAggregate =
-    testCase "register custom aggregate and execute" $
-        runInBoundThread do
-            withDatabase \db ->
-                withConnection db \conn ->
-                    withLogicalType (c_duckdb_create_logical_type DuckDBTypeInteger) \intType ->
-                        withAggregateFunction \aggFun ->
-                            withCallbacks \cbs -> do
-                                setupAggregateFunction aggFun cbs intType "haskell_sum"
-                                c_duckdb_register_aggregate_function conn aggFun >>= (@?= DuckDBSuccess)
-                                withCString "SELECT haskell_sum(v) FROM (VALUES (1), (2), (3)) t(v)" \sql ->
-                                    withResultCString conn sql \resPtr ->
-                                        c_duckdb_value_int32 resPtr 0 0 >>= (@?= 6)
+  testCase "register custom aggregate and execute" $
+    runInBoundThread do
+      withDatabase \db ->
+        withConnection db \conn ->
+          withLogicalType (c_duckdb_create_logical_type (DuckDBTypeAlias DuckDBTypeInteger)) \intType ->
+            withAggregateFunction \aggFun ->
+              withCallbacks \cbs -> do
+                setupAggregateFunction aggFun cbs intType "haskell_sum"
+                c_duckdb_register_aggregate_function conn aggFun >>= (@?= DuckDBSuccess)
+                withConstCString "SELECT haskell_sum(v) FROM (VALUES (1), (2), (3)) t(v)" \sql ->
+                  withResultCString conn sql \resPtr ->
+                    c_duckdb_value_int32 resPtr 0 0 >>= (@?= 6)
 
 extraInfoAggregate :: TestTree
 extraInfoAggregate =
-    testCase "extra info is visible inside callbacks" $
-        runInBoundThread do
-            let config = defaultAggregateConfig{cfgBonus = 2}
-            withDatabase \db ->
-                withConnection db \conn ->
-                    withLogicalType (c_duckdb_create_logical_type DuckDBTypeInteger) \intType ->
-                        withAggregateConfig config \configPtr ->
-                            withAggregateFunction \aggFun ->
-                                withCallbacks \cbs -> do
-                                    setupAggregateFunction aggFun cbs intType "haskell_bonus_sum"
-                                    c_duckdb_aggregate_function_set_extra_info aggFun configPtr nullFunPtr
+  testCase "extra info is visible inside callbacks" $
+    runInBoundThread do
+      let config = defaultAggregateConfig{cfgBonus = 2}
+      withDatabase \db ->
+        withConnection db \conn ->
+          withLogicalType (c_duckdb_create_logical_type (DuckDBTypeAlias DuckDBTypeInteger)) \intType ->
+            withAggregateConfig config \configPtr ->
+              withAggregateFunction \aggFun ->
+                withCallbacks \cbs -> do
+                  setupAggregateFunction aggFun cbs intType "haskell_bonus_sum"
+                  c_duckdb_aggregate_function_set_extra_info aggFun configPtr (coerce nullFunPtr)
 
-                                    c_duckdb_register_aggregate_function conn aggFun >>= (@?= DuckDBSuccess)
+                  c_duckdb_register_aggregate_function conn aggFun >>= (@?= DuckDBSuccess)
 
-                                    withCString "SELECT haskell_bonus_sum(v) FROM (VALUES (1), (2), (3)) t(v)" \sql ->
-                                        withResultCString conn sql \resPtr ->
-                                            c_duckdb_value_int32 resPtr 0 0 >>= (@?= 12)
+                  withConstCString "SELECT haskell_bonus_sum(v) FROM (VALUES (1), (2), (3)) t(v)" \sql ->
+                    withResultCString conn sql \resPtr ->
+                      c_duckdb_value_int32 resPtr 0 0 >>= (@?= 12)
 
 aggregateFunctionSet :: TestTree
 aggregateFunctionSet =
-    testCase "aggregate function set registers overload" $
-        runInBoundThread do
-            withDatabase \db ->
-                withConnection db \conn ->
-                    withLogicalType (c_duckdb_create_logical_type DuckDBTypeInteger) \intType ->
-                        withAggregateFunction \aggFun ->
-                            withCallbacks \cbs -> do
-                                setupAggregateFunction aggFun cbs intType "haskell_sum_set"
-                                withCString "haskell_sum_set" \setName ->
-                                    withAggregateFunctionSet setName \set -> do
-                                        c_duckdb_add_aggregate_function_to_set set aggFun >>= (@?= DuckDBSuccess)
-                                        c_duckdb_register_aggregate_function_set conn set >>= (@?= DuckDBSuccess)
+  testCase "aggregate function set registers overload" $
+    runInBoundThread do
+      withDatabase \db ->
+        withConnection db \conn ->
+          withLogicalType (c_duckdb_create_logical_type (DuckDBTypeAlias DuckDBTypeInteger)) \intType ->
+            withAggregateFunction \aggFun ->
+              withCallbacks \cbs -> do
+                setupAggregateFunction aggFun cbs intType "haskell_sum_set"
+                withConstCString "haskell_sum_set" \setName ->
+                  withAggregateFunctionSet setName \set -> do
+                    c_duckdb_add_aggregate_function_to_set set aggFun >>= (@?= DuckDBSuccess)
+                    c_duckdb_register_aggregate_function_set conn set >>= (@?= DuckDBSuccess)
 
-                                        withCString "SELECT haskell_sum_set(v) FROM (VALUES (4), (5), (6)) t(v)" \sql ->
-                                            withResultCString conn sql \resPtr ->
-                                                c_duckdb_value_int32 resPtr 0 0 >>= (@?= 15)
+                    withConstCString "SELECT haskell_sum_set(v) FROM (VALUES (4), (5), (6)) t(v)" \sql ->
+                      withResultCString conn sql \resPtr ->
+                        c_duckdb_value_int32 resPtr 0 0 >>= (@?= 15)
 
 aggregateErrorPropagation :: TestTree
 aggregateErrorPropagation =
-    testCase "callbacks can signal errors" $
-        runInBoundThread do
-            let config = defaultAggregateConfig{cfgFailOnNegative = 1}
-            withDatabase \db ->
-                withConnection db \conn ->
-                    withLogicalType (c_duckdb_create_logical_type DuckDBTypeInteger) \intType ->
-                        withAggregateConfig config \configPtr ->
-                            withAggregateFunction \aggFun ->
-                                withCallbacks \cbs -> do
-                                    setupAggregateFunction aggFun cbs intType "no_negatives"
-                                    c_duckdb_aggregate_function_set_extra_info aggFun configPtr nullFunPtr
-                                    c_duckdb_register_aggregate_function conn aggFun >>= (@?= DuckDBSuccess)
+  testCase "callbacks can signal errors" $
+    runInBoundThread do
+      let config = defaultAggregateConfig{cfgFailOnNegative = 1}
+      withDatabase \db ->
+        withConnection db \conn ->
+          withLogicalType (c_duckdb_create_logical_type (DuckDBTypeAlias DuckDBTypeInteger)) \intType ->
+            withAggregateConfig config \configPtr ->
+              withAggregateFunction \aggFun ->
+                withCallbacks \cbs -> do
+                  setupAggregateFunction aggFun cbs intType "no_negatives"
+                  c_duckdb_aggregate_function_set_extra_info aggFun configPtr (coerce nullFunPtr)
+                  c_duckdb_register_aggregate_function conn aggFun >>= (@?= DuckDBSuccess)
 
-                                    withCString "SELECT no_negatives(v) FROM (VALUES (1), (-5)) t(v)" \sql ->
-                                        alloca \resPtr -> do
-                                            errState <- c_duckdb_query conn sql resPtr
-                                            errState @?= DuckDBError
+                  withConstCString "SELECT no_negatives(v) FROM (VALUES (1), (-5)) t(v)" \sql ->
+                    alloca \resPtr -> do
+                      errState <- c_duckdb_query conn sql resPtr
+                      errState @?= DuckDBError
 
-                                            msgPtr <- c_duckdb_result_error resPtr
-                                            errMsg <- peekCString msgPtr
-                                            assertBool "expected negative error message" ("negatives not allowed" `isInfixOf` errMsg)
+                      msgPtr <- c_duckdb_result_error resPtr
+                      errMsg <- peekCString (coerce msgPtr)
+                      assertBool "expected negative error message" ("negatives not allowed" `isInfixOf` errMsg)
 
-                                            c_duckdb_destroy_result resPtr
+                      c_duckdb_destroy_result resPtr
 
 specialHandlingNulls :: TestTree
 specialHandlingNulls =
-    testCase "special handling allows returning NULL when all inputs are NULL" $
-        runInBoundThread do
-            let config = defaultAggregateConfig{cfgNullIfAllInvalid = 1}
-            withDatabase \db ->
-                withConnection db \conn ->
-                    withLogicalType (c_duckdb_create_logical_type DuckDBTypeInteger) \intType ->
-                        withAggregateConfig config \configPtr ->
-                            withAggregateFunction \aggFun ->
-                                withCallbacks \cbs -> do
-                                    setupAggregateFunction aggFun cbs intType "nullable_sum"
-                                    c_duckdb_aggregate_function_set_extra_info aggFun configPtr nullFunPtr
-                                    c_duckdb_aggregate_function_set_special_handling aggFun
-                                    c_duckdb_register_aggregate_function conn aggFun >>= (@?= DuckDBSuccess)
+  testCase "special handling allows returning NULL when all inputs are NULL" $
+    runInBoundThread do
+      let config = defaultAggregateConfig{cfgNullIfAllInvalid = 1}
+      withDatabase \db ->
+        withConnection db \conn ->
+          withLogicalType (c_duckdb_create_logical_type (DuckDBTypeAlias DuckDBTypeInteger)) \intType ->
+            withAggregateConfig config \configPtr ->
+              withAggregateFunction \aggFun ->
+                withCallbacks \cbs -> do
+                  setupAggregateFunction aggFun cbs intType "nullable_sum"
+                  c_duckdb_aggregate_function_set_extra_info aggFun configPtr (coerce nullFunPtr)
+                  c_duckdb_aggregate_function_set_special_handling aggFun
+                  c_duckdb_register_aggregate_function conn aggFun >>= (@?= DuckDBSuccess)
 
-                                    withCString "SELECT nullable_sum(v) FROM (VALUES (CAST(NULL AS INTEGER))) t(v)" \sql ->
-                                        withResultCString conn sql \resPtr -> do
-                                            isNull <- c_duckdb_value_is_null resPtr 0 0
-                                            cbToBool isNull @?= True
+                  withConstCString "SELECT nullable_sum(v) FROM (VALUES (CAST(NULL AS INTEGER))) t(v)" \sql ->
+                    withResultCString conn sql \resPtr -> do
+                      isNull <- c_duckdb_value_is_null resPtr 0 0
+                      cbToBool isNull @?= True
 
 -- Aggregate state -----------------------------------------------------------
 
 data SumState = SumState
-    { ssTotal :: Int32
-    , ssSeen :: Int32
-    , ssNulls :: Int32
-    }
+  { ssTotal :: Int32
+  , ssSeen :: Int32
+  , ssNulls :: Int32
+  }
 
 initialSumState :: SumState
 initialSumState = SumState 0 0 0
 
 sumStateSize :: Int
-sumStateSize = 3 * sizeOf (undefined :: Int32)
+sumStateSize = 3 * staticSizeOf (Proxy @Int32)
 
 type SumStatePtr = Ptr Int32
 
 readSumState :: SumStatePtr -> IO SumState
 readSumState ptr = do
-    total <- peekElemOff ptr 0
-    seen <- peekElemOff ptr 1
-    nulls <- peekElemOff ptr 2
-    pure SumState{ssTotal = total, ssSeen = seen, ssNulls = nulls}
+  total <- peekElemOff ptr 0
+  seen <- peekElemOff ptr 1
+  nulls <- peekElemOff ptr 2
+  pure SumState{ssTotal = total, ssSeen = seen, ssNulls = nulls}
 
 writeSumState :: SumStatePtr -> SumState -> IO ()
 writeSumState ptr SumState{ssTotal = total, ssSeen = seen, ssNulls = nulls} = do
-    pokeElemOff ptr 0 total
-    pokeElemOff ptr 1 seen
-    pokeElemOff ptr 2 nulls
+  pokeElemOff ptr 0 total
+  pokeElemOff ptr 1 seen
+  pokeElemOff ptr 2 nulls
 
 -- Aggregate configuration ---------------------------------------------------
 
 data AggregateConfig = AggregateConfig
-    { cfgBonus :: Int32
-    , cfgFailOnNegative :: Int32
-    , cfgReturnNullCount :: Int32
-    , cfgNullIfAllInvalid :: Int32
-    }
+  { cfgBonus :: Int32
+  , cfgFailOnNegative :: Int32
+  , cfgReturnNullCount :: Int32
+  , cfgNullIfAllInvalid :: Int32
+  }
 
 defaultAggregateConfig :: AggregateConfig
 defaultAggregateConfig = AggregateConfig 0 0 0 0
@@ -179,44 +184,44 @@
 type AggregateConfigPtr = Ptr Int32
 
 aggregateConfigSize :: Int
-aggregateConfigSize = 4 * sizeOf (undefined :: Int32)
+aggregateConfigSize = 4 * staticSizeOf (Proxy @Int32)
 
 writeAggregateConfig :: AggregateConfigPtr -> AggregateConfig -> IO ()
 writeAggregateConfig ptr AggregateConfig{cfgBonus = bonus, cfgFailOnNegative = failNeg, cfgReturnNullCount = returnNulls, cfgNullIfAllInvalid = nullAll} = do
-    pokeElemOff ptr 0 bonus
-    pokeElemOff ptr 1 failNeg
-    pokeElemOff ptr 2 returnNulls
-    pokeElemOff ptr 3 nullAll
+  pokeElemOff ptr 0 bonus
+  pokeElemOff ptr 1 failNeg
+  pokeElemOff ptr 2 returnNulls
+  pokeElemOff ptr 3 nullAll
 
 peekAggregateConfig :: AggregateConfigPtr -> IO AggregateConfig
 peekAggregateConfig ptr = do
-    bonus <- peekElemOff ptr 0
-    failNeg <- peekElemOff ptr 1
-    returnNulls <- peekElemOff ptr 2
-    nullAll <- peekElemOff ptr 3
-    pure
-        AggregateConfig
-            { cfgBonus = bonus
-            , cfgFailOnNegative = failNeg
-            , cfgReturnNullCount = returnNulls
-            , cfgNullIfAllInvalid = nullAll
-            }
+  bonus <- peekElemOff ptr 0
+  failNeg <- peekElemOff ptr 1
+  returnNulls <- peekElemOff ptr 2
+  nullAll <- peekElemOff ptr 3
+  pure
+    AggregateConfig
+      { cfgBonus = bonus
+      , cfgFailOnNegative = failNeg
+      , cfgReturnNullCount = returnNulls
+      , cfgNullIfAllInvalid = nullAll
+      }
 
 configFromInfo :: DuckDBFunctionInfo -> IO AggregateConfig
 configFromInfo info = do
-    raw <- c_duckdb_aggregate_function_get_extra_info info
-    if raw == nullPtr
-        then pure defaultAggregateConfig
-        else peekAggregateConfig (castPtr raw)
+  raw <- c_duckdb_aggregate_function_get_extra_info info
+  if raw == nullPtr
+    then pure defaultAggregateConfig
+    else peekAggregateConfig (coerce raw)
 
-withAggregateConfig :: AggregateConfig -> (Ptr () -> IO a) -> IO a
+withAggregateConfig :: AggregateConfig -> (Ptr Void -> IO a) -> IO a
 withAggregateConfig cfg action =
-    bracket acquire freeConfig (action . castPtr)
+  bracket acquire freeConfig (action . coerce)
   where
     acquire = do
-        ptr <- mallocBytes aggregateConfigSize :: IO AggregateConfigPtr
-        writeAggregateConfig ptr cfg
-        pure ptr
+      ptr <- mallocBytes aggregateConfigSize :: IO AggregateConfigPtr
+      writeAggregateConfig ptr cfg
+      pure ptr
     freeConfig = free
 
 shouldFailOnNegative :: AggregateConfig -> Bool
@@ -231,173 +236,194 @@
 -- Callback implementations --------------------------------------------------
 
 data Callbacks = Callbacks
-    { cbStateSize :: DuckDBAggregateStateSizeFun
-    , cbInit :: DuckDBAggregateInitFun
-    , cbUpdate :: DuckDBAggregateUpdateFun
-    , cbCombine :: DuckDBAggregateCombineFun
-    , cbFinalize :: DuckDBAggregateFinalizeFun
-    , cbDestroy :: DuckDBAggregateDestroyFun
-    }
+  { cbStateSize :: DuckDBAggregateStateSizeFun
+  , cbInit :: DuckDBAggregateInitFun
+  , cbUpdate :: DuckDBAggregateUpdateFun
+  , cbCombine :: DuckDBAggregateCombineFun
+  , cbFinalize :: DuckDBAggregateFinalizeFun
+  , cbDestroy :: DuckDBAggregateDestroyFun
+  }
 
 withCallbacks :: (Callbacks -> IO a) -> IO a
 withCallbacks = bracket acquire release
   where
     acquire = do
-        sizeFun <- mkStateSizeFun stateSizeFun
-        initFun <- mkInitFun initCallback
-        updateFun <- mkUpdateFun updateCallback
-        combineFun <- mkCombineFun combineCallback
-        finalizeFun <- mkFinalizeFun finalizeCallback
-        destroyFun <- mkDestroyFun destroyCallback
-        pure
-            Callbacks
-                { cbStateSize = sizeFun
-                , cbInit = initFun
-                , cbUpdate = updateFun
-                , cbCombine = combineFun
-                , cbFinalize = finalizeFun
-                , cbDestroy = destroyFun
-                }
-    release Callbacks{cbStateSize = sizeFun, cbInit = initFun, cbUpdate = updateFun, cbCombine = combineFun, cbFinalize = finalizeFun, cbDestroy = destroyFun} = do
-        freeHaskellFunPtr sizeFun
-        freeHaskellFunPtr initFun
-        freeHaskellFunPtr updateFun
-        freeHaskellFunPtr combineFun
-        freeHaskellFunPtr finalizeFun
-        freeHaskellFunPtr destroyFun
+      sizeFun <- mkStateSizeFun stateSizeFun
+      initFun <- mkInitFun initCallback
+      updateFun <- mkUpdateFun updateCallback
+      combineFun <- mkCombineFun combineCallback
+      finalizeFun <- mkFinalizeFun finalizeCallback
+      destroyFun <- mkDestroyFun destroyCallback
+      pure
+        Callbacks
+          { cbStateSize = sizeFun
+          , cbInit = initFun
+          , cbUpdate = updateFun
+          , cbCombine = combineFun
+          , cbFinalize = finalizeFun
+          , cbDestroy = destroyFun
+          }
+    release
+      Callbacks
+        { cbStateSize = sizeFun
+        , cbInit = initFun
+        , cbUpdate = updateFun
+        , cbCombine = combineFun
+        , cbFinalize = finalizeFun
+        , cbDestroy = destroyFun
+        } = do
+        freeHaskellFunPtr (coerce sizeFun)
+        freeHaskellFunPtr (coerce initFun)
+        freeHaskellFunPtr (coerce updateFun)
+        freeHaskellFunPtr (coerce combineFun)
+        freeHaskellFunPtr (coerce finalizeFun)
+        freeHaskellFunPtr (coerce destroyFun)
 
 setupAggregateFunction :: DuckDBAggregateFunction -> Callbacks -> DuckDBLogicalType -> String -> IO ()
-setupAggregateFunction aggFun Callbacks{cbStateSize = sizeFun, cbInit = initFun, cbUpdate = updateFun, cbCombine = combineFun, cbFinalize = finalizeFun, cbDestroy = destroyFun} intType name = do
-    withCString name $ \cname -> c_duckdb_aggregate_function_set_name aggFun cname
+setupAggregateFunction
+  aggFun
+  Callbacks
+    { cbStateSize = sizeFun
+    , cbInit = initFun
+    , cbUpdate = updateFun
+    , cbCombine = combineFun
+    , cbFinalize = finalizeFun
+    , cbDestroy = destroyFun
+    }
+  intType
+  name = do
+    withConstCString name $ \cname -> c_duckdb_aggregate_function_set_name aggFun cname
     c_duckdb_aggregate_function_add_parameter aggFun intType
     c_duckdb_aggregate_function_set_return_type aggFun intType
     c_duckdb_aggregate_function_set_functions aggFun sizeFun initFun updateFun combineFun finalizeFun
     c_duckdb_aggregate_function_set_destructor aggFun destroyFun
 
 stateSizeFun :: DuckDBFunctionInfo -> IO DuckDBIdx
-stateSizeFun _ = pure (fromIntegral (sizeOf (nullPtr :: Ptr ())))
+stateSizeFun _ = pure (fromIntegral (staticSizeOf (Proxy @(Ptr ()))))
 
 initCallback :: DuckDBFunctionInfo -> DuckDBAggregateState -> IO ()
 initCallback _ state = do
-    raw <- c_duckdb_malloc (fromIntegral sumStateSize)
-    let storage = castPtr raw :: SumStatePtr
-    writeSumState storage initialSumState
-    writeStateValuePtr state storage
+  raw <- c_duckdb_malloc (fromIntegral sumStateSize)
+  let storage = coerce raw :: SumStatePtr
+  writeSumState storage initialSumState
+  writeStateValuePtr state storage
 
 updateCallback :: DuckDBFunctionInfo -> DuckDBDataChunk -> Ptr DuckDBAggregateState -> IO ()
 updateCallback info chunk stateArrayPtr = do
-    rowCount <- c_duckdb_data_chunk_get_size chunk
-    vec <- c_duckdb_data_chunk_get_vector chunk 0
-    dataPtr <- vectorDataPtr vec
-    validity <- c_duckdb_vector_get_validity vec
-    config <- configFromInfo info
+  rowCount <- c_duckdb_data_chunk_get_size chunk
+  vec <- c_duckdb_data_chunk_get_vector chunk 0
+  dataPtr <- vectorDataPtr vec
+  validity <- c_duckdb_vector_get_validity vec
+  config <- configFromInfo info
 
-    let rowCountInt = fromIntegral rowCount
-    forM_ [0 .. rowCountInt - 1] \i -> do
-        statePtr <- peekElemOff stateArrayPtr i
-        storage <- readStateValuePtr statePtr
-        current <- readSumState storage
-        let seen' = ssSeen current + 1
-            idx = fromIntegral i
+  let rowCountInt = fromIntegral rowCount
+  forM_ [0 .. rowCountInt - 1] \i -> do
+    statePtr <- peekElemOff stateArrayPtr i
+    storage <- readStateValuePtr statePtr
+    current <- readSumState storage
+    let seen' = ssSeen current + 1
+        idx = fromIntegral i
 
-        isValid <- rowIsValid validity idx
-        if not isValid
-            then writeSumState storage current{ssSeen = seen', ssNulls = ssNulls current + 1}
-            else do
-                value <- peekElemOff dataPtr i
-                if shouldFailOnNegative config && value < 0
-                    then do
-                        withCString "negatives not allowed" $ \errMsg ->
-                            c_duckdb_aggregate_function_set_error info errMsg
-                        writeSumState storage current{ssSeen = seen'}
-                    else
-                        let total' = ssTotal current + value + cfgBonus config
-                         in writeSumState storage SumState{ssTotal = total', ssSeen = seen', ssNulls = ssNulls current}
+    isValid <- rowIsValid validity idx
+    if not isValid
+      then writeSumState storage current{ssSeen = seen', ssNulls = ssNulls current + 1}
+      else do
+        value <- peekElemOff dataPtr i
+        if shouldFailOnNegative config && value < 0
+          then do
+            withConstCString "negatives not allowed" $ \errMsg ->
+              c_duckdb_aggregate_function_set_error info errMsg
+            writeSumState storage current{ssSeen = seen'}
+          else
+            let total' = ssTotal current + value + cfgBonus config
+            in  writeSumState storage SumState{ssTotal = total', ssSeen = seen', ssNulls = ssNulls current}
 
 combineCallback :: DuckDBFunctionInfo -> Ptr DuckDBAggregateState -> Ptr DuckDBAggregateState -> DuckDBIdx -> IO ()
 combineCallback _ sourceStates targetStates count =
-    forM_ [0 .. fromIntegral count - 1] \i -> do
-        sourceState <- peekElemOff sourceStates i
-        targetState <- peekElemOff targetStates i
-        sourcePtr <- readStateValuePtr sourceState
-        targetPtr <- readStateValuePtr targetState
-        source <- readSumState sourcePtr
-        target <- readSumState targetPtr
+  forM_ [0 .. fromIntegral count - 1] \i -> do
+    sourceState <- peekElemOff sourceStates i
+    targetState <- peekElemOff targetStates i
+    sourcePtr <- readStateValuePtr sourceState
+    targetPtr <- readStateValuePtr targetState
+    source <- readSumState sourcePtr
+    target <- readSumState targetPtr
 
-        let combined =
-                SumState
-                    { ssTotal = ssTotal source + ssTotal target
-                    , ssSeen = ssSeen source + ssSeen target
-                    , ssNulls = ssNulls source + ssNulls target
-                    }
-        writeSumState targetPtr combined
+    let combined =
+          SumState
+            { ssTotal = ssTotal source + ssTotal target
+            , ssSeen = ssSeen source + ssSeen target
+            , ssNulls = ssNulls source + ssNulls target
+            }
+    writeSumState targetPtr combined
 
 finalizeCallback :: DuckDBFunctionInfo -> Ptr DuckDBAggregateState -> DuckDBVector -> DuckDBIdx -> DuckDBIdx -> IO ()
 finalizeCallback info stateArrayPtr outVec _ offset = do
-    state <- peekElemOff stateArrayPtr (fromIntegral offset)
-    storage <- readStateValuePtr state
-    SumState{ssTotal = total, ssSeen = seen, ssNulls = nulls} <- readSumState storage
-    config <- configFromInfo info
+  state <- peekElemOff stateArrayPtr (fromIntegral offset)
+  storage <- readStateValuePtr state
+  SumState{ssTotal = total, ssSeen = seen, ssNulls = nulls} <- readSumState storage
+  config <- configFromInfo info
 
-    outPtr <- vectorDataPtr outVec
-    let resultValue = if shouldReturnNullCount config then nulls else total
-    pokeElemOff outPtr (fromIntegral offset) resultValue
+  outPtr <- vectorDataPtr outVec
+  let resultValue = if shouldReturnNullCount config then nulls else total
+  pokeElemOff outPtr (fromIntegral offset) resultValue
 
-    let allInvalid = seen > 0 && seen == nulls
-    when (shouldMarkNullWhenAllInvalid config && allInvalid) do
-        c_duckdb_vector_ensure_validity_writable outVec
-        validity <- c_duckdb_vector_get_validity outVec
-        c_duckdb_validity_set_row_invalid validity offset
+  let allInvalid = seen > 0 && seen == nulls
+  when (shouldMarkNullWhenAllInvalid config && allInvalid) do
+    c_duckdb_vector_ensure_validity_writable outVec
+    validity <- c_duckdb_vector_get_validity outVec
+    c_duckdb_validity_set_row_invalid validity offset
 
 destroyCallback :: Ptr DuckDBAggregateState -> DuckDBIdx -> IO ()
 destroyCallback states count =
-    forM_ [0 .. fromIntegral count - 1] \i -> do
-        state <- peekElemOff states i
-        storage <- readStateValuePtr state
-        when (storage /= nullPtr) $
-            c_duckdb_free (castPtr storage)
+  forM_ [0 .. fromIntegral count - 1] \i -> do
+    state <- peekElemOff states i
+    storage <- readStateValuePtr state
+    when (storage /= nullPtr) $
+      c_duckdb_free (coerce storage)
 
 -- Helper pointer accessors --------------------------------------------------
 
 writeStateValuePtr :: DuckDBAggregateState -> SumStatePtr -> IO ()
 writeStateValuePtr state ptr =
-    poke (castPtr state :: Ptr (Ptr ())) (castPtr ptr)
+  poke (coerce state :: Ptr (Ptr Void)) (coerce ptr)
 
 readStateValuePtr :: DuckDBAggregateState -> IO SumStatePtr
 readStateValuePtr state = do
-    raw <- peek (castPtr state :: Ptr (Ptr ()))
-    pure (castPtr raw)
+  raw <- peek (coerce state :: Ptr (Ptr Void))
+  pure (coerce raw)
 
 vectorDataPtr :: DuckDBVector -> IO (Ptr Int32)
-vectorDataPtr vec = castPtr <$> c_duckdb_vector_get_data vec
+vectorDataPtr vec = coerce <$> c_duckdb_vector_get_data vec
 
 rowIsValid :: Ptr Word64 -> DuckDBIdx -> IO Bool
 rowIsValid validity idx
-    | validity == nullPtr = pure True
-    | otherwise = cbToBool <$> c_duckdb_validity_row_is_valid validity idx
+  | validity == nullPtr = pure True
+  | otherwise = cbToBool <$> c_duckdb_validity_row_is_valid validity idx
 
 cbToBool :: CBool -> Bool
 cbToBool (CBool v) = v /= 0
 
 -- Wrapper builders ----------------------------------------------------------
 
-foreign import ccall "wrapper"
-    mkStateSizeFun :: (DuckDBFunctionInfo -> IO DuckDBIdx) -> IO DuckDBAggregateStateSizeFun
+mkStateSizeFun :: (DuckDBFunctionInfo -> IO DuckDBIdx) -> IO DuckDBAggregateStateSizeFun
+mkStateSizeFun = fmap DuckDBAggregateStateSizeFun . toFunPtr . DuckDBAggregateStateSizeFun_Aux
 
-foreign import ccall "wrapper"
-    mkInitFun :: (DuckDBFunctionInfo -> DuckDBAggregateState -> IO ()) -> IO DuckDBAggregateInitFun
+mkInitFun :: (DuckDBFunctionInfo -> DuckDBAggregateState -> IO ()) -> IO DuckDBAggregateInitFun
+mkInitFun = fmap DuckDBAggregateInitFun . toFunPtr . DuckDBAggregateInitFun_Aux
 
-foreign import ccall "wrapper"
-    mkUpdateFun :: (DuckDBFunctionInfo -> DuckDBDataChunk -> Ptr DuckDBAggregateState -> IO ()) -> IO DuckDBAggregateUpdateFun
+mkUpdateFun :: (DuckDBFunctionInfo -> DuckDBDataChunk -> Ptr DuckDBAggregateState -> IO ()) -> IO DuckDBAggregateUpdateFun
+mkUpdateFun = fmap DuckDBAggregateUpdateFun . toFunPtr . DuckDBAggregateUpdateFun_Aux
 
-foreign import ccall "wrapper"
-    mkCombineFun :: (DuckDBFunctionInfo -> Ptr DuckDBAggregateState -> Ptr DuckDBAggregateState -> DuckDBIdx -> IO ()) -> IO DuckDBAggregateCombineFun
+mkCombineFun
+  :: (DuckDBFunctionInfo -> Ptr DuckDBAggregateState -> Ptr DuckDBAggregateState -> DuckDBIdx -> IO ()) -> IO DuckDBAggregateCombineFun
+mkCombineFun = fmap DuckDBAggregateCombineFun . toFunPtr . DuckDBAggregateCombineFun_Aux
 
-foreign import ccall "wrapper"
-    mkFinalizeFun :: (DuckDBFunctionInfo -> Ptr DuckDBAggregateState -> DuckDBVector -> DuckDBIdx -> DuckDBIdx -> IO ()) -> IO DuckDBAggregateFinalizeFun
+mkFinalizeFun
+  :: (DuckDBFunctionInfo -> Ptr DuckDBAggregateState -> DuckDBVector -> DuckDBIdx -> DuckDBIdx -> IO ()) -> IO DuckDBAggregateFinalizeFun
+mkFinalizeFun = fmap DuckDBAggregateFinalizeFun . toFunPtr . DuckDBAggregateFinalizeFun_Aux
 
-foreign import ccall "wrapper"
-    mkDestroyFun :: (Ptr DuckDBAggregateState -> DuckDBIdx -> IO ()) -> IO DuckDBAggregateDestroyFun
+mkDestroyFun :: (Ptr DuckDBAggregateState -> DuckDBIdx -> IO ()) -> IO DuckDBAggregateDestroyFun
+mkDestroyFun = fmap DuckDBAggregateDestroyFun . toFunPtr . DuckDBAggregateDestroyFun_Aux
 
 -- Resource helpers ----------------------------------------------------------
 
@@ -406,7 +432,7 @@
   where
     destroy fun = alloca \ptr -> poke ptr fun >> c_duckdb_destroy_aggregate_function ptr
 
-withAggregateFunctionSet :: CString -> (DuckDBAggregateFunctionSet -> IO a) -> IO a
+withAggregateFunctionSet :: ConstPtr CChar -> (DuckDBAggregateFunctionSet -> IO a) -> IO a
 withAggregateFunctionSet name = bracket acquire release
   where
     acquire = c_duckdb_create_aggregate_function_set name
diff --git a/test/AppenderTest.hs b/test/AppenderTest.hs
--- a/test/AppenderTest.hs
+++ b/test/AppenderTest.hs
@@ -1,4 +1,6 @@
 {-# LANGUAGE BlockArguments #-}
+{-# LANGUAGE DataKinds #-}
+{-# LANGUAGE DuplicateRecordFields #-}
 {-# LANGUAGE TypeApplications #-}
 {-# OPTIONS_GHC -Wno-deprecations #-}
 
@@ -6,508 +8,510 @@
 
 import Control.Exception (bracket, finally)
 import Control.Monad (forM_, when, (>=>))
+import Data.Coerce (coerce)
 import Data.Int (Int16, Int32, Int64, Int8)
 import Data.List (isInfixOf)
 import Data.Word (Word16, Word32, Word64, Word8)
 import Database.DuckDB.FFI
-import Database.DuckDB.FFI.Deprecated
-import Foreign.C.String (peekCString, withCString, withCStringLen)
+import Foreign.C.ConstPtr (ConstPtr (..))
+import Foreign.C.String (peekCString, withCStringLen)
 import Foreign.C.Types (CBool (..))
 import Foreign.Marshal.Alloc (alloca)
 import Foreign.Marshal.Array (peekArray, withArray)
-import Foreign.Marshal.Utils (with)
-import Foreign.Ptr (Ptr, castPtr, nullPtr)
+import Foreign.Ptr (Ptr, nullPtr)
 import Foreign.Storable (peek, poke, pokeElemOff)
+import GHC.Records (getField)
 import Test.Tasty (TestTree, testGroup)
 import Test.Tasty.HUnit (assertBool, assertFailure, testCase, (@?=))
 import Utils (
-    destroyErrorData,
-    withConnection,
-    withDatabase,
-    withDuckValue,
-    withLogicalType,
-    withResultCString,
+  destroyErrorData,
+  withConnection,
+  withConstCString,
+  withDatabase,
+  withDuckValue,
+  withLogicalType,
+  withResultCString,
  )
 
 tests :: TestTree
 tests =
-    testGroup
-        "Appender"
-        [ appenderRowwiseLifecycle
-        , appenderColumnSubset
-        , appenderDataChunkInsert
-        , appenderQueryAppender
-        , appenderNumericAndFloatScalars
-        , appenderTemporalTypes
-        , appenderStringAndBlob
-        , appenderChunkDefaults
-        , appenderErrorDataInspection
-        ]
+  testGroup
+    "Appender"
+    [ appenderRowwiseLifecycle
+    , appenderColumnSubset
+    , appenderDataChunkInsert
+    , appenderQueryAppender
+    , appenderNumericAndFloatScalars
+    , appenderTemporalTypes
+    , appenderStringAndBlob
+    , appenderChunkDefaults
+    , appenderErrorDataInspection
+    ]
 
 appenderRowwiseLifecycle :: TestTree
 appenderRowwiseLifecycle =
-    testCase "append rows using scalar APIs and inspect results" $
-        withDatabase \db ->
-            withConnection db \conn -> do
-                runStatement conn "CREATE TABLE appender_demo(id INTEGER, name VARCHAR, active BOOLEAN DEFAULT TRUE)"
+  testCase "append rows using scalar APIs and inspect results" $
+    withDatabase \db ->
+      withConnection db \conn -> do
+        runStatement conn "CREATE TABLE appender_demo(id INTEGER, name VARCHAR, active BOOLEAN DEFAULT TRUE)"
 
-                withTableAppender conn "appender_demo" \app -> do
-                    c_duckdb_appender_column_count app >>= (@?= 3)
-                    checkColumnType app 0 DuckDBTypeInteger
-                    checkColumnType app 1 DuckDBTypeVarchar
-                    checkColumnType app 2 DuckDBTypeBoolean
+        withTableAppender conn "appender_demo" \app -> do
+          c_duckdb_appender_column_count app >>= (@?= 3)
+          checkColumnType app 0 DuckDBTypeInteger
+          checkColumnType app 1 DuckDBTypeVarchar
+          checkColumnType app 2 DuckDBTypeBoolean
 
-                    c_duckdb_appender_begin_row app >>= (@?= DuckDBSuccess)
-                    c_duckdb_append_int32 app 1 >>= (@?= DuckDBSuccess)
-                    withCString "alice" (c_duckdb_append_varchar app >=> (@?= DuckDBSuccess))
-                    c_duckdb_append_bool app (CBool 1) >>= (@?= DuckDBSuccess)
-                    c_duckdb_appender_end_row app >>= (@?= DuckDBSuccess)
+          c_duckdb_appender_begin_row app >>= (@?= DuckDBSuccess)
+          c_duckdb_append_int32 app 1 >>= (@?= DuckDBSuccess)
+          withConstCString "alice" (c_duckdb_append_varchar app >=> (@?= DuckDBSuccess))
+          c_duckdb_append_bool app (CBool 1) >>= (@?= DuckDBSuccess)
+          c_duckdb_appender_end_row app >>= (@?= DuckDBSuccess)
 
-                    c_duckdb_appender_begin_row app >>= (@?= DuckDBSuccess)
-                    c_duckdb_append_int32 app 2 >>= (@?= DuckDBSuccess)
-                    c_duckdb_append_null app >>= (@?= DuckDBSuccess)
-                    c_duckdb_append_bool app (CBool 0) >>= (@?= DuckDBSuccess)
-                    c_duckdb_appender_end_row app >>= (@?= DuckDBSuccess)
+          c_duckdb_appender_begin_row app >>= (@?= DuckDBSuccess)
+          c_duckdb_append_int32 app 2 >>= (@?= DuckDBSuccess)
+          c_duckdb_append_null app >>= (@?= DuckDBSuccess)
+          c_duckdb_append_bool app (CBool 0) >>= (@?= DuckDBSuccess)
+          c_duckdb_appender_end_row app >>= (@?= DuckDBSuccess)
 
-                    c_duckdb_appender_begin_row app >>= (@?= DuckDBSuccess)
-                    c_duckdb_append_int32 app 3 >>= (@?= DuckDBSuccess)
-                    withDuckValue (withCString "via_value" c_duckdb_create_varchar) (c_duckdb_append_value app >=> (@?= DuckDBSuccess))
-                    c_duckdb_append_default app >>= (@?= DuckDBSuccess)
-                    c_duckdb_appender_end_row app >>= (@?= DuckDBSuccess)
+          c_duckdb_appender_begin_row app >>= (@?= DuckDBSuccess)
+          c_duckdb_append_int32 app 3 >>= (@?= DuckDBSuccess)
+          withDuckValue (withConstCString "via_value" c_duckdb_create_varchar) (c_duckdb_append_value app >=> (@?= DuckDBSuccess))
+          c_duckdb_append_default app >>= (@?= DuckDBSuccess)
+          c_duckdb_appender_end_row app >>= (@?= DuckDBSuccess)
 
-                    errPtr0 <- c_duckdb_appender_error app
-                    when (errPtr0 /= nullPtr) $ do
-                        msg <- peekCString errPtr0
-                        msg @?= ""
+          errPtr0 <- c_duckdb_appender_error app
+          when (errPtr0 /= coerce nullPtr) $ do
+            msg <- peekCString (coerce errPtr0)
+            msg @?= ""
 
-                    c_duckdb_appender_flush app >>= (@?= DuckDBSuccess)
-                    c_duckdb_appender_close app >>= (@?= DuckDBSuccess)
+          c_duckdb_appender_flush app >>= (@?= DuckDBSuccess)
+          c_duckdb_appender_close app >>= (@?= DuckDBSuccess)
 
-                    withCString "SELECT id, name, active FROM appender_demo ORDER BY id" \sql ->
-                        withResultCString conn sql \resPtr -> do
-                            c_duckdb_row_count resPtr >>= (@?= 3)
+          withConstCString "SELECT id, name, active FROM appender_demo ORDER BY id" \sql ->
+            withResultCString conn sql \resPtr -> do
+              c_duckdb_row_count resPtr >>= (@?= 3)
 
-                            c_duckdb_value_int32 resPtr 0 0 >>= (@?= 1)
-                            fetchString resPtr 1 0 >>= (@?= "alice")
-                            fetchBool resPtr 2 0 >>= (@?= True)
+              c_duckdb_value_int32 resPtr 0 0 >>= (@?= 1)
+              fetchString resPtr 1 0 >>= (@?= "alice")
+              fetchBool resPtr 2 0 >>= (@?= True)
 
-                            c_duckdb_value_int32 resPtr 0 1 >>= (@?= 2)
-                            c_duckdb_value_is_null resPtr 1 1 >>= (@?= CBool 1)
-                            fetchBool resPtr 2 1 >>= (@?= False)
+              c_duckdb_value_int32 resPtr 0 1 >>= (@?= 2)
+              c_duckdb_value_is_null resPtr 1 1 >>= (@?= CBool 1)
+              fetchBool resPtr 2 1 >>= (@?= False)
 
-                            c_duckdb_value_int32 resPtr 0 2 >>= (@?= 3)
-                            fetchString resPtr 1 2 >>= (@?= "via_value")
-                            fetchBool resPtr 2 2 >>= (@?= True)
+              c_duckdb_value_int32 resPtr 0 2 >>= (@?= 3)
+              fetchString resPtr 1 2 >>= (@?= "via_value")
+              fetchBool resPtr 2 2 >>= (@?= True)
 
 appenderColumnSubset :: TestTree
 appenderColumnSubset =
-    testCase "restrict active columns and rely on table defaults" $
-        withDatabase \db ->
-            withConnection db \conn -> do
-                runStatement
-                    conn
-                    "CREATE TABLE subset_demo(id INTEGER DEFAULT 100, name VARCHAR, note VARCHAR, active BOOLEAN DEFAULT FALSE)"
+  testCase "restrict active columns and rely on table defaults" $
+    withDatabase \db ->
+      withConnection db \conn -> do
+        runStatement
+          conn
+          "CREATE TABLE subset_demo(id INTEGER DEFAULT 100, name VARCHAR, note VARCHAR, active BOOLEAN DEFAULT FALSE)"
 
-                withTableAppender conn "subset_demo" \app -> do
-                    c_duckdb_appender_clear_columns app >>= (@?= DuckDBSuccess)
-                    withCString "name" (c_duckdb_appender_add_column app >=> (@?= DuckDBSuccess))
-                    withCString "note" (c_duckdb_appender_add_column app >=> (@?= DuckDBSuccess))
+        withTableAppender conn "subset_demo" \app -> do
+          c_duckdb_appender_clear_columns app >>= (@?= DuckDBSuccess)
+          withConstCString "name" (c_duckdb_appender_add_column app >=> (@?= DuckDBSuccess))
+          withConstCString "note" (c_duckdb_appender_add_column app >=> (@?= DuckDBSuccess))
 
-                    c_duckdb_appender_column_count app >>= (@?= 2)
+          c_duckdb_appender_column_count app >>= (@?= 2)
 
-                    c_duckdb_appender_begin_row app >>= (@?= DuckDBSuccess)
-                    withCString "subset-one" (c_duckdb_append_varchar app >=> (@?= DuckDBSuccess))
-                    withCString "note one" (c_duckdb_append_varchar app >=> (@?= DuckDBSuccess))
-                    c_duckdb_appender_end_row app >>= (@?= DuckDBSuccess)
+          c_duckdb_appender_begin_row app >>= (@?= DuckDBSuccess)
+          withConstCString "subset-one" (c_duckdb_append_varchar app >=> (@?= DuckDBSuccess))
+          withConstCString "note one" (c_duckdb_append_varchar app >=> (@?= DuckDBSuccess))
+          c_duckdb_appender_end_row app >>= (@?= DuckDBSuccess)
 
-                    c_duckdb_appender_begin_row app >>= (@?= DuckDBSuccess)
-                    withCString "subset-two" (c_duckdb_append_varchar app >=> (@?= DuckDBSuccess))
-                    c_duckdb_append_null app >>= (@?= DuckDBSuccess)
-                    c_duckdb_appender_end_row app >>= (@?= DuckDBSuccess)
+          c_duckdb_appender_begin_row app >>= (@?= DuckDBSuccess)
+          withConstCString "subset-two" (c_duckdb_append_varchar app >=> (@?= DuckDBSuccess))
+          c_duckdb_append_null app >>= (@?= DuckDBSuccess)
+          c_duckdb_appender_end_row app >>= (@?= DuckDBSuccess)
 
-                    c_duckdb_appender_flush app >>= (@?= DuckDBSuccess)
-                    c_duckdb_appender_close app >>= (@?= DuckDBSuccess)
+          c_duckdb_appender_flush app >>= (@?= DuckDBSuccess)
+          c_duckdb_appender_close app >>= (@?= DuckDBSuccess)
 
-                    withCString "SELECT id, name, note, active FROM subset_demo ORDER BY rowid" \sql ->
-                        withResultCString conn sql \resPtr -> do
-                            c_duckdb_row_count resPtr >>= (@?= 2)
+          withConstCString "SELECT id, name, note, active FROM subset_demo ORDER BY rowid" \sql ->
+            withResultCString conn sql \resPtr -> do
+              c_duckdb_row_count resPtr >>= (@?= 2)
 
-                            c_duckdb_value_int32 resPtr 0 0 >>= (@?= 100)
-                            fetchString resPtr 1 0 >>= (@?= "subset-one")
-                            fetchString resPtr 2 0 >>= (@?= "note one")
-                            fetchBool resPtr 3 0 >>= (@?= False)
+              c_duckdb_value_int32 resPtr 0 0 >>= (@?= 100)
+              fetchString resPtr 1 0 >>= (@?= "subset-one")
+              fetchString resPtr 2 0 >>= (@?= "note one")
+              fetchBool resPtr 3 0 >>= (@?= False)
 
-                            c_duckdb_value_int32 resPtr 0 1 >>= (@?= 100)
-                            fetchString resPtr 1 1 >>= (@?= "subset-two")
-                            c_duckdb_value_is_null resPtr 2 1 >>= (@?= CBool 1)
-                            fetchBool resPtr 3 1 >>= (@?= False)
+              c_duckdb_value_int32 resPtr 0 1 >>= (@?= 100)
+              fetchString resPtr 1 1 >>= (@?= "subset-two")
+              c_duckdb_value_is_null resPtr 2 1 >>= (@?= CBool 1)
+              fetchBool resPtr 3 1 >>= (@?= False)
 
 appenderDataChunkInsert :: TestTree
 appenderDataChunkInsert =
-    testCase "append via data chunk using extended constructor" $
-        withDatabase \db ->
-            withConnection db \conn -> do
-                runStatement conn "CREATE TABLE chunk_demo(id INTEGER, label VARCHAR)"
+  testCase "append via data chunk using extended constructor" $
+    withDatabase \db ->
+      withConnection db \conn -> do
+        runStatement conn "CREATE TABLE chunk_demo(id INTEGER, label VARCHAR)"
 
-                withTableAppenderExt conn "chunk_demo" \app -> do
-                    c_duckdb_appender_column_count app >>= (@?= 2)
+        withTableAppenderExt conn "chunk_demo" \app -> do
+          c_duckdb_appender_column_count app >>= (@?= 2)
 
-                    withLogicalType (c_duckdb_create_logical_type DuckDBTypeInteger) \intType ->
-                        withLogicalType (c_duckdb_create_logical_type DuckDBTypeVarchar) \textType ->
-                            withArray [intType, textType] \typeArray ->
-                                withDataChunk (c_duckdb_create_data_chunk typeArray 2) \chunk -> do
-                                    intVec <- c_duckdb_data_chunk_get_vector chunk 0
-                                    fillIntVector intVec [10, 11]
+          withLogicalType (c_duckdb_create_logical_type (DuckDBTypeAlias DuckDBTypeInteger)) \intType ->
+            withLogicalType (c_duckdb_create_logical_type (DuckDBTypeAlias DuckDBTypeVarchar)) \textType ->
+              withArray [intType, textType] \typeArray ->
+                withDataChunk (c_duckdb_create_data_chunk typeArray 2) \chunk -> do
+                  intVec <- c_duckdb_data_chunk_get_vector chunk 0
+                  fillIntVector intVec [10, 11]
 
-                                    textVec <- c_duckdb_data_chunk_get_vector chunk 1
-                                    assignStrings textVec ["ten", "eleven"]
+                  textVec <- c_duckdb_data_chunk_get_vector chunk 1
+                  assignStrings textVec ["ten", "eleven"]
 
-                                    c_duckdb_data_chunk_set_size chunk 2
-                                    c_duckdb_append_data_chunk app chunk >>= (@?= DuckDBSuccess)
+                  c_duckdb_data_chunk_set_size chunk 2
+                  c_duckdb_append_data_chunk app chunk >>= (@?= DuckDBSuccess)
 
-                    c_duckdb_appender_flush app >>= (@?= DuckDBSuccess)
-                    c_duckdb_appender_close app >>= (@?= DuckDBSuccess)
+          c_duckdb_appender_flush app >>= (@?= DuckDBSuccess)
+          c_duckdb_appender_close app >>= (@?= DuckDBSuccess)
 
-                    withCString "SELECT id, label FROM chunk_demo ORDER BY id" \sql ->
-                        withResultCString conn sql \resPtr -> do
-                            c_duckdb_row_count resPtr >>= (@?= 2)
-                            c_duckdb_value_int32 resPtr 0 0 >>= (@?= 10)
-                            fetchString resPtr 1 0 >>= (@?= "ten")
-                            c_duckdb_value_int32 resPtr 0 1 >>= (@?= 11)
-                            fetchString resPtr 1 1 >>= (@?= "eleven")
+          withConstCString "SELECT id, label FROM chunk_demo ORDER BY id" \sql ->
+            withResultCString conn sql \resPtr -> do
+              c_duckdb_row_count resPtr >>= (@?= 2)
+              c_duckdb_value_int32 resPtr 0 0 >>= (@?= 10)
+              fetchString resPtr 1 0 >>= (@?= "ten")
+              c_duckdb_value_int32 resPtr 0 1 >>= (@?= 11)
+              fetchString resPtr 1 1 >>= (@?= "eleven")
 
 appenderQueryAppender :: TestTree
 appenderQueryAppender =
-    testCase "append rows through query-based appender" $
-        withDatabase \db ->
-            withConnection db \conn -> do
-                runStatement conn "CREATE TABLE query_target(id INTEGER, label VARCHAR)"
+  testCase "append rows through query-based appender" $
+    withDatabase \db ->
+      withConnection db \conn -> do
+        runStatement conn "CREATE TABLE query_target(id INTEGER, label VARCHAR)"
 
-                withLogicalType (c_duckdb_create_logical_type DuckDBTypeInteger) \intType ->
-                    withLogicalType (c_duckdb_create_logical_type DuckDBTypeVarchar) \textType -> do
-                        let types = [intType, textType]
-                        withQueryAppender conn "INSERT INTO query_target SELECT * FROM appended_data" types \app -> do
-                            c_duckdb_appender_column_count app >>= (@?= 2)
+        withLogicalType (c_duckdb_create_logical_type (DuckDBTypeAlias DuckDBTypeInteger)) \intType ->
+          withLogicalType (c_duckdb_create_logical_type (DuckDBTypeAlias DuckDBTypeVarchar)) \textType -> do
+            let types = [intType, textType]
+            withQueryAppender conn "INSERT INTO query_target SELECT * FROM appended_data" types \app -> do
+              c_duckdb_appender_column_count app >>= (@?= 2)
 
-                            c_duckdb_appender_begin_row app >>= (@?= DuckDBSuccess)
-                            c_duckdb_append_int32 app 21 >>= (@?= DuckDBSuccess)
-                            withCString "twenty-one" (c_duckdb_append_varchar app >=> (@?= DuckDBSuccess))
-                            c_duckdb_appender_end_row app >>= (@?= DuckDBSuccess)
+              c_duckdb_appender_begin_row app >>= (@?= DuckDBSuccess)
+              c_duckdb_append_int32 app 21 >>= (@?= DuckDBSuccess)
+              withConstCString "twenty-one" (c_duckdb_append_varchar app >=> (@?= DuckDBSuccess))
+              c_duckdb_appender_end_row app >>= (@?= DuckDBSuccess)
 
-                            c_duckdb_appender_begin_row app >>= (@?= DuckDBSuccess)
-                            c_duckdb_append_int32 app 22 >>= (@?= DuckDBSuccess)
-                            withCString "twenty-two" (c_duckdb_append_varchar app >=> (@?= DuckDBSuccess))
-                            c_duckdb_appender_end_row app >>= (@?= DuckDBSuccess)
+              c_duckdb_appender_begin_row app >>= (@?= DuckDBSuccess)
+              c_duckdb_append_int32 app 22 >>= (@?= DuckDBSuccess)
+              withConstCString "twenty-two" (c_duckdb_append_varchar app >=> (@?= DuckDBSuccess))
+              c_duckdb_appender_end_row app >>= (@?= DuckDBSuccess)
 
-                            c_duckdb_appender_flush app >>= (@?= DuckDBSuccess)
-                            c_duckdb_appender_close app >>= (@?= DuckDBSuccess)
+              c_duckdb_appender_flush app >>= (@?= DuckDBSuccess)
+              c_duckdb_appender_close app >>= (@?= DuckDBSuccess)
 
-                        withCString "SELECT id, label FROM query_target ORDER BY id" \sql ->
-                            withResultCString conn sql \resPtr -> do
-                                c_duckdb_row_count resPtr >>= (@?= 2)
-                                c_duckdb_value_int32 resPtr 0 0 >>= (@?= 21)
-                                fetchString resPtr 1 0 >>= (@?= "twenty-one")
-                                c_duckdb_value_int32 resPtr 0 1 >>= (@?= 22)
-                                fetchString resPtr 1 1 >>= (@?= "twenty-two")
+            withConstCString "SELECT id, label FROM query_target ORDER BY id" \sql ->
+              withResultCString conn sql \resPtr -> do
+                c_duckdb_row_count resPtr >>= (@?= 2)
+                c_duckdb_value_int32 resPtr 0 0 >>= (@?= 21)
+                fetchString resPtr 1 0 >>= (@?= "twenty-one")
+                c_duckdb_value_int32 resPtr 0 1 >>= (@?= 22)
+                fetchString resPtr 1 1 >>= (@?= "twenty-two")
 
 appenderNumericAndFloatScalars :: TestTree
 appenderNumericAndFloatScalars =
-    testCase "append numeric scalar types" $
-        withDatabase \db ->
-            withConnection db \conn -> do
-                runStatement
-                    conn
-                    ( unlines
-                        [ "CREATE TABLE numeric_scalars_demo("
-                        , "  signed8 TINYINT,"
-                        , "  signed16 SMALLINT,"
-                        , "  signed64 BIGINT,"
-                        , "  signed128 HUGEINT,"
-                        , "  unsigned8 UTINYINT,"
-                        , "  unsigned16 USMALLINT,"
-                        , "  unsigned32 UINTEGER,"
-                        , "  unsigned64 UBIGINT,"
-                        , "  unsigned128 UHUGEINT,"
-                        , "  real32 FLOAT,"
-                        , "  real64 DOUBLE"
-                        , ")"
-                        ]
-                    )
+  testCase "append numeric scalar types" $
+    withDatabase \db ->
+      withConnection db \conn -> do
+        runStatement
+          conn
+          ( unlines
+              [ "CREATE TABLE numeric_scalars_demo("
+              , "  signed8 TINYINT,"
+              , "  signed16 SMALLINT,"
+              , "  signed64 BIGINT,"
+              , "  signed128 HUGEINT,"
+              , "  unsigned8 UTINYINT,"
+              , "  unsigned16 USMALLINT,"
+              , "  unsigned32 UINTEGER,"
+              , "  unsigned64 UBIGINT,"
+              , "  unsigned128 UHUGEINT,"
+              , "  real32 FLOAT,"
+              , "  real64 DOUBLE"
+              , ")"
+              ]
+          )
 
-                let int8Val = (-12) :: Int8
-                    int16Val = (-32000) :: Int16
-                    int64Val = (-9876543210) :: Int64
-                    hugeVal = DuckDBHugeInt 0xFEDCBA9876543210 0
-                    uint8Val = 200 :: Word8
-                    uint16Val = 60000 :: Word16
-                    uint32Val = 4000000000 :: Word32
-                    uint64Val = 12345678901234567890 :: Word64
-                    uhugeVal = DuckDBUHugeInt 0x0123456789ABCDEF 0x0011223344556677
-                    floatVal = (-12.5) :: Float
-                    doubleVal = 1234.5678 :: Double
+        let int8Val = (-12) :: Int8
+            int16Val = (-32000) :: Int16
+            int64Val = (-9876543210) :: Int64
+            hugeVal = DuckDBHugeInt 0xFEDCBA9876543210 0
+            uint8Val = 200 :: Word8
+            uint16Val = 60000 :: Word16
+            uint32Val = 4000000000 :: Word32
+            uint64Val = 12345678901234567890 :: Word64
+            uhugeVal = DuckDBUHugeInt 0x0123456789ABCDEF 0x0011223344556677
+            floatVal = (-12.5) :: Float
+            doubleVal = 1234.5678 :: Double
 
-                withTableAppender conn "numeric_scalars_demo" \app -> do
-                    c_duckdb_appender_begin_row app >>= (@?= DuckDBSuccess)
-                    c_duckdb_append_int8 app int8Val >>= (@?= DuckDBSuccess)
-                    c_duckdb_append_int16 app int16Val >>= (@?= DuckDBSuccess)
-                    c_duckdb_append_int64 app int64Val >>= (@?= DuckDBSuccess)
-                    with hugeVal (c_duckdb_append_hugeint app >=> (@?= DuckDBSuccess))
-                    c_duckdb_append_uint8 app uint8Val >>= (@?= DuckDBSuccess)
-                    c_duckdb_append_uint16 app uint16Val >>= (@?= DuckDBSuccess)
-                    c_duckdb_append_uint32 app uint32Val >>= (@?= DuckDBSuccess)
-                    c_duckdb_append_uint64 app uint64Val >>= (@?= DuckDBSuccess)
-                    with uhugeVal (c_duckdb_append_uhugeint app >=> (@?= DuckDBSuccess))
-                    c_duckdb_append_float app (realToFrac floatVal) >>= (@?= DuckDBSuccess)
-                    c_duckdb_append_double app (realToFrac doubleVal) >>= (@?= DuckDBSuccess)
-                    c_duckdb_appender_end_row app >>= (@?= DuckDBSuccess)
+        withTableAppender conn "numeric_scalars_demo" \app -> do
+          c_duckdb_appender_begin_row app >>= (@?= DuckDBSuccess)
+          c_duckdb_append_int8 app int8Val >>= (@?= DuckDBSuccess)
+          c_duckdb_append_int16 app int16Val >>= (@?= DuckDBSuccess)
+          c_duckdb_append_int64 app int64Val >>= (@?= DuckDBSuccess)
+          c_duckdb_append_hugeint app hugeVal >>= (@?= DuckDBSuccess)
+          c_duckdb_append_uint8 app uint8Val >>= (@?= DuckDBSuccess)
+          c_duckdb_append_uint16 app uint16Val >>= (@?= DuckDBSuccess)
+          c_duckdb_append_uint32 app uint32Val >>= (@?= DuckDBSuccess)
+          c_duckdb_append_uint64 app uint64Val >>= (@?= DuckDBSuccess)
+          c_duckdb_append_uhugeint app uhugeVal >>= (@?= DuckDBSuccess)
+          c_duckdb_append_float app (realToFrac floatVal) >>= (@?= DuckDBSuccess)
+          c_duckdb_append_double app (realToFrac doubleVal) >>= (@?= DuckDBSuccess)
+          c_duckdb_appender_end_row app >>= (@?= DuckDBSuccess)
 
-                    c_duckdb_appender_flush app >>= (@?= DuckDBSuccess)
-                    c_duckdb_appender_close app >>= (@?= DuckDBSuccess)
+          c_duckdb_appender_flush app >>= (@?= DuckDBSuccess)
+          c_duckdb_appender_close app >>= (@?= DuckDBSuccess)
 
-                let query =
-                        unlines
-                            [ "SELECT"
-                            , "  signed8,"
-                            , "  signed16,"
-                            , "  signed64,"
-                            , "  signed128,"
-                            , "  unsigned8,"
-                            , "  unsigned16,"
-                            , "  unsigned32,"
-                            , "  unsigned64,"
-                            , "  unsigned128,"
-                            , "  real32,"
-                            , "  real64"
-                            , "FROM numeric_scalars_demo"
-                            ]
+        let query =
+              unlines
+                [ "SELECT"
+                , "  signed8,"
+                , "  signed16,"
+                , "  signed64,"
+                , "  signed128,"
+                , "  unsigned8,"
+                , "  unsigned16,"
+                , "  unsigned32,"
+                , "  unsigned64,"
+                , "  unsigned128,"
+                , "  real32,"
+                , "  real64"
+                , "FROM numeric_scalars_demo"
+                ]
 
-                withCString query \sql ->
-                    withResultCString conn sql \resPtr -> do
-                        c_duckdb_row_count resPtr >>= (@?= 1)
-                        c_duckdb_value_int8 resPtr 0 0 >>= (@?= int8Val)
-                        c_duckdb_value_int16 resPtr 1 0 >>= (@?= int16Val)
-                        c_duckdb_value_int64 resPtr 2 0 >>= (@?= int64Val)
-                        alloca \ptr -> do
-                            c_duckdb_value_hugeint resPtr 3 0 ptr
-                            peek ptr >>= (@?= hugeVal)
-                        c_duckdb_value_uint8 resPtr 4 0 >>= (@?= uint8Val)
-                        c_duckdb_value_uint16 resPtr 5 0 >>= (@?= uint16Val)
-                        c_duckdb_value_uint32 resPtr 6 0 >>= (@?= uint32Val)
-                        c_duckdb_value_uint64 resPtr 7 0 >>= (@?= uint64Val)
-                        alloca \ptr -> do
-                            c_duckdb_value_uhugeint resPtr 8 0 ptr
-                            peek ptr >>= (@?= uhugeVal)
-                        fv <- c_duckdb_value_float resPtr 9 0
-                        realToFrac fv @?= floatVal
-                        dv <- c_duckdb_value_double resPtr 10 0
-                        realToFrac dv @?= doubleVal
+        withConstCString query \sql ->
+          withResultCString conn sql \resPtr -> do
+            c_duckdb_row_count resPtr >>= (@?= 1)
+            c_duckdb_value_int8 resPtr 0 0 >>= (@?= int8Val)
+            c_duckdb_value_int16 resPtr 1 0 >>= (@?= int16Val)
+            c_duckdb_value_int64 resPtr 2 0 >>= (@?= int64Val)
+            alloca \ptr -> do
+              c_duckdb_value_hugeint resPtr 3 0 >>= poke ptr
+              peek ptr >>= (@?= hugeVal)
+            c_duckdb_value_uint8 resPtr 4 0 >>= (@?= uint8Val)
+            c_duckdb_value_uint16 resPtr 5 0 >>= (@?= uint16Val)
+            c_duckdb_value_uint32 resPtr 6 0 >>= (@?= uint32Val)
+            c_duckdb_value_uint64 resPtr 7 0 >>= (@?= uint64Val)
+            alloca \ptr -> do
+              c_duckdb_value_uhugeint resPtr 8 0 >>= poke ptr
+              peek ptr >>= (@?= uhugeVal)
+            fv <- c_duckdb_value_float resPtr 9 0
+            realToFrac fv @?= floatVal
+            dv <- c_duckdb_value_double resPtr 10 0
+            realToFrac dv @?= doubleVal
 
 appenderTemporalTypes :: TestTree
 appenderTemporalTypes =
-    testCase "append temporal values" $
-        withDatabase \db ->
-            withConnection db \conn -> do
-                runStatement
-                    conn
-                    "CREATE TABLE temporal_demo(d DATE, t TIME, ts TIMESTAMP, iv INTERVAL)"
+  testCase "append temporal values" $
+    withDatabase \db ->
+      withConnection db \conn -> do
+        runStatement
+          conn
+          "CREATE TABLE temporal_demo(d DATE, t TIME, ts TIMESTAMP, iv INTERVAL)"
 
-                let dateStruct = DuckDBDateStruct 2024 3 31
-                dateVal <- with dateStruct c_duckdb_to_date
+        let dateStruct = DuckDBDateStruct 2024 3 31
+        dateVal <- c_duckdb_to_date dateStruct
 
-                let timeStruct = DuckDBTimeStruct 12 34 56 987654
-                timeVal <- with timeStruct c_duckdb_to_time
+        let timeStruct = DuckDBTimeStruct 12 34 56 987654
+        timeVal <- c_duckdb_to_time timeStruct
 
-                let timestampStruct = DuckDBTimestampStruct dateStruct timeStruct
-                timestampVal <- with timestampStruct c_duckdb_to_timestamp
+        let timestampStruct = DuckDBTimestampStruct dateStruct timeStruct
+        timestampVal <- c_duckdb_to_timestamp timestampStruct
 
-                let intervalVal = DuckDBInterval 5 12 3456789
+        let intervalVal = DuckDBInterval 5 12 3456789
 
-                withTableAppender conn "temporal_demo" \app -> do
-                    c_duckdb_appender_begin_row app >>= (@?= DuckDBSuccess)
-                    c_duckdb_append_date app dateVal >>= (@?= DuckDBSuccess)
-                    c_duckdb_append_time app timeVal >>= (@?= DuckDBSuccess)
-                    c_duckdb_append_timestamp app timestampVal >>= (@?= DuckDBSuccess)
-                    with intervalVal (c_duckdb_append_interval app >=> (@?= DuckDBSuccess))
-                    c_duckdb_appender_end_row app >>= (@?= DuckDBSuccess)
+        withTableAppender conn "temporal_demo" \app -> do
+          c_duckdb_appender_begin_row app >>= (@?= DuckDBSuccess)
+          c_duckdb_append_date app dateVal >>= (@?= DuckDBSuccess)
+          c_duckdb_append_time app timeVal >>= (@?= DuckDBSuccess)
+          c_duckdb_append_timestamp app timestampVal >>= (@?= DuckDBSuccess)
+          c_duckdb_append_interval app intervalVal >>= (@?= DuckDBSuccess)
+          c_duckdb_appender_end_row app >>= (@?= DuckDBSuccess)
 
-                    c_duckdb_appender_flush app >>= (@?= DuckDBSuccess)
-                    c_duckdb_appender_close app >>= (@?= DuckDBSuccess)
+          c_duckdb_appender_flush app >>= (@?= DuckDBSuccess)
+          c_duckdb_appender_close app >>= (@?= DuckDBSuccess)
 
-                withCString "SELECT d, t, ts, iv FROM temporal_demo" \sql ->
-                    withResultCString conn sql \resPtr -> do
-                        c_duckdb_row_count resPtr >>= (@?= 1)
+        withConstCString "SELECT d, t, ts, iv FROM temporal_demo" \sql ->
+          withResultCString conn sql \resPtr -> do
+            c_duckdb_row_count resPtr >>= (@?= 1)
 
-                        fetchedDate <- c_duckdb_value_date resPtr 0 0
-                        alloca \structPtr -> do
-                            c_duckdb_from_date fetchedDate structPtr
-                            peek structPtr >>= (@?= dateStruct)
+            fetchedDate <- c_duckdb_value_date resPtr 0 0
+            alloca \structPtr -> do
+              c_duckdb_from_date fetchedDate >>= poke structPtr
+              peek structPtr >>= (@?= dateStruct)
 
-                        fetchedTime <- c_duckdb_value_time resPtr 1 0
-                        alloca \structPtr -> do
-                            c_duckdb_from_time fetchedTime structPtr
-                            peek structPtr >>= (@?= timeStruct)
+            fetchedTime <- c_duckdb_value_time resPtr 1 0
+            alloca \structPtr -> do
+              c_duckdb_from_time fetchedTime >>= poke structPtr
+              peek structPtr >>= (@?= timeStruct)
 
-                        fetchedTimestamp <- c_duckdb_value_timestamp resPtr 2 0
-                        alloca \structPtr -> do
-                            c_duckdb_from_timestamp fetchedTimestamp structPtr
-                            peek structPtr >>= (@?= timestampStruct)
+            fetchedTimestamp <- c_duckdb_value_timestamp resPtr 2 0
+            alloca \structPtr -> do
+              c_duckdb_from_timestamp fetchedTimestamp >>= poke structPtr
+              peek structPtr >>= (@?= timestampStruct)
 
-                        alloca \intervalPtr -> do
-                            c_duckdb_value_interval resPtr 3 0 intervalPtr
-                            peek intervalPtr >>= (@?= intervalVal)
+            alloca \intervalPtr -> do
+              c_duckdb_value_interval resPtr 3 0 >>= poke intervalPtr
+              peek intervalPtr >>= (@?= intervalVal)
 
 appenderStringAndBlob :: TestTree
 appenderStringAndBlob =
-    testCase "append bounded varchar and blob values" $
-        withDatabase \db ->
-            withConnection db \conn -> do
-                runStatement
-                    conn
-                    "CREATE TABLE string_blob_demo(text_fragment VARCHAR, payload BLOB)"
+  testCase "append bounded varchar and blob values" $
+    withDatabase \db ->
+      withConnection db \conn -> do
+        runStatement
+          conn
+          "CREATE TABLE string_blob_demo(text_fragment VARCHAR, payload BLOB)"
 
-                let blobBytes = [0xde, 0xad, 0xbe, 0xef] :: [Word8]
+        let blobBytes = [0xde, 0xad, 0xbe, 0xef] :: [Word8]
 
-                withTableAppender conn "string_blob_demo" \app -> do
-                    c_duckdb_appender_begin_row app >>= (@?= DuckDBSuccess)
-                    withCStringLen "hello world" \(ptr, _len) -> do
-                        c_duckdb_append_varchar_length app ptr (fromIntegral @Integer 5) >>= (@?= DuckDBSuccess)
-                    withArray blobBytes \ptr -> do
-                        c_duckdb_append_blob app (castPtr ptr) (fromIntegral (length blobBytes)) >>= (@?= DuckDBSuccess)
-                    c_duckdb_appender_end_row app >>= (@?= DuckDBSuccess)
+        withTableAppender conn "string_blob_demo" \app -> do
+          c_duckdb_appender_begin_row app >>= (@?= DuckDBSuccess)
+          withCStringLen "hello world" \(ptr, _len) -> do
+            c_duckdb_append_varchar_length app (coerce ptr) (fromIntegral @Integer 5) >>= (@?= DuckDBSuccess)
+          withArray blobBytes \ptr -> do
+            c_duckdb_append_blob app (coerce ptr) (fromIntegral (length blobBytes)) >>= (@?= DuckDBSuccess)
+          c_duckdb_appender_end_row app >>= (@?= DuckDBSuccess)
 
-                    c_duckdb_appender_flush app >>= (@?= DuckDBSuccess)
-                    c_duckdb_appender_close app >>= (@?= DuckDBSuccess)
+          c_duckdb_appender_flush app >>= (@?= DuckDBSuccess)
+          c_duckdb_appender_close app >>= (@?= DuckDBSuccess)
 
-                withCString "SELECT text_fragment, payload FROM string_blob_demo" \sql ->
-                    withResultCString conn sql \resPtr -> do
-                        c_duckdb_row_count resPtr >>= (@?= 1)
-                        fetchString resPtr 0 0 >>= (@?= "hello")
-                        fetchBlob resPtr 1 0 >>= (@?= blobBytes)
+        withConstCString "SELECT text_fragment, payload FROM string_blob_demo" \sql ->
+          withResultCString conn sql \resPtr -> do
+            c_duckdb_row_count resPtr >>= (@?= 1)
+            fetchString resPtr 0 0 >>= (@?= "hello")
+            fetchBlob resPtr 1 0 >>= (@?= blobBytes)
 
 appenderChunkDefaults :: TestTree
 appenderChunkDefaults =
-    testCase "populate chunk entries using column defaults" $
-        withDatabase \db ->
-            withConnection db \conn -> do
-                runStatement
-                    conn
-                    "CREATE TABLE chunk_defaults_demo(val INTEGER DEFAULT 99, note VARCHAR DEFAULT 'fallback')"
+  testCase "populate chunk entries using column defaults" $
+    withDatabase \db ->
+      withConnection db \conn -> do
+        runStatement
+          conn
+          "CREATE TABLE chunk_defaults_demo(val INTEGER DEFAULT 99, note VARCHAR DEFAULT 'fallback')"
 
-                withTableAppender conn "chunk_defaults_demo" \app -> do
-                    c_duckdb_appender_column_count app >>= (@?= 2)
+        withTableAppender conn "chunk_defaults_demo" \app -> do
+          c_duckdb_appender_column_count app >>= (@?= 2)
 
-                    withLogicalType (c_duckdb_create_logical_type DuckDBTypeInteger) \intType ->
-                        withLogicalType (c_duckdb_create_logical_type DuckDBTypeVarchar) \textType ->
-                            withArray [intType, textType] \typeArray ->
-                                withDataChunk (c_duckdb_create_data_chunk typeArray 2) \chunk -> do
-                                    intVec <- c_duckdb_data_chunk_get_vector chunk 0
-                                    fillIntVector intVec [10]
+          withLogicalType (c_duckdb_create_logical_type (DuckDBTypeAlias DuckDBTypeInteger)) \intType ->
+            withLogicalType (c_duckdb_create_logical_type (DuckDBTypeAlias DuckDBTypeVarchar)) \textType ->
+              withArray [intType, textType] \typeArray ->
+                withDataChunk (c_duckdb_create_data_chunk typeArray 2) \chunk -> do
+                  intVec <- c_duckdb_data_chunk_get_vector chunk 0
+                  fillIntVector intVec [10]
 
-                                    textVec <- c_duckdb_data_chunk_get_vector chunk 1
-                                    assignStrings textVec ["explicit"]
+                  textVec <- c_duckdb_data_chunk_get_vector chunk 1
+                  assignStrings textVec ["explicit"]
 
-                                    c_duckdb_append_default_to_chunk app chunk 0 1 >>= (@?= DuckDBSuccess)
-                                    c_duckdb_append_default_to_chunk app chunk 1 1 >>= (@?= DuckDBSuccess)
+                  c_duckdb_append_default_to_chunk app chunk 0 1 >>= (@?= DuckDBSuccess)
+                  c_duckdb_append_default_to_chunk app chunk 1 1 >>= (@?= DuckDBSuccess)
 
-                                    c_duckdb_data_chunk_set_size chunk 2
-                                    c_duckdb_append_data_chunk app chunk >>= (@?= DuckDBSuccess)
+                  c_duckdb_data_chunk_set_size chunk 2
+                  c_duckdb_append_data_chunk app chunk >>= (@?= DuckDBSuccess)
 
-                    c_duckdb_appender_flush app >>= (@?= DuckDBSuccess)
-                    c_duckdb_appender_close app >>= (@?= DuckDBSuccess)
+          c_duckdb_appender_flush app >>= (@?= DuckDBSuccess)
+          c_duckdb_appender_close app >>= (@?= DuckDBSuccess)
 
-                withCString "SELECT val, note FROM chunk_defaults_demo ORDER BY rowid" \sql ->
-                    withResultCString conn sql \resPtr -> do
-                        c_duckdb_row_count resPtr >>= (@?= 2)
-                        c_duckdb_value_int32 resPtr 0 0 >>= (@?= 10)
-                        fetchString resPtr 1 0 >>= (@?= "explicit")
-                        c_duckdb_value_int32 resPtr 0 1 >>= (@?= 99)
-                        fetchString resPtr 1 1 >>= (@?= "fallback")
+        withConstCString "SELECT val, note FROM chunk_defaults_demo ORDER BY rowid" \sql ->
+          withResultCString conn sql \resPtr -> do
+            c_duckdb_row_count resPtr >>= (@?= 2)
+            c_duckdb_value_int32 resPtr 0 0 >>= (@?= 10)
+            fetchString resPtr 1 0 >>= (@?= "explicit")
+            c_duckdb_value_int32 resPtr 0 1 >>= (@?= 99)
+            fetchString resPtr 1 1 >>= (@?= "fallback")
 
 appenderErrorDataInspection :: TestTree
 appenderErrorDataInspection =
-    testCase "retrieve appender error payloads" $
-        withDatabase \db ->
-            withConnection db \conn -> do
-                runStatement
-                    conn
-                    "CREATE TABLE error_demo(val INTEGER CHECK (val > 0))"
+  testCase "retrieve appender error payloads" $
+    withDatabase \db ->
+      withConnection db \conn -> do
+        runStatement
+          conn
+          "CREATE TABLE error_demo(val INTEGER CHECK (val > 0))"
 
-                withTableAppender conn "error_demo" \app -> do
-                    c_duckdb_appender_begin_row app >>= (@?= DuckDBSuccess)
-                    c_duckdb_append_int32 app (-1) >>= (@?= DuckDBSuccess)
-                    c_duckdb_appender_end_row app >>= (@?= DuckDBSuccess)
+        withTableAppender conn "error_demo" \app -> do
+          c_duckdb_appender_begin_row app >>= (@?= DuckDBSuccess)
+          c_duckdb_append_int32 app (-1) >>= (@?= DuckDBSuccess)
+          c_duckdb_appender_end_row app >>= (@?= DuckDBSuccess)
 
-                    flushState <- c_duckdb_appender_flush app
-                    flushState @?= DuckDBError
+          flushState <- c_duckdb_appender_flush app
+          flushState @?= DuckDBError
 
-                    errData <- c_duckdb_appender_error_data app
-                    CBool hasError <- c_duckdb_error_data_has_error errData
-                    assertBool "error data indicates failure" (hasError /= 0)
+          errData <- c_duckdb_appender_error_data app
+          CBool hasError <- c_duckdb_error_data_has_error errData
+          assertBool "error data indicates failure" (hasError /= 0)
 
-                    errType <- c_duckdb_error_data_error_type errData
-                    errType @?= DuckDBErrorConstraint
+          errType <- c_duckdb_error_data_error_type errData
+          errType @?= DuckDBErrorConstraint
 
-                    errMsgPtr <- c_duckdb_error_data_message errData
-                    errMsg <- peekCString errMsgPtr
-                    assertBool "constraint violation message mentions CHECK" ("CHECK" `isInfixOf` errMsg)
+          errMsgPtr <- c_duckdb_error_data_message errData
+          errMsg <- peekCString (coerce errMsgPtr)
+          assertBool "constraint violation message mentions CHECK" ("CHECK" `isInfixOf` errMsg)
 
-                    destroyErrorData errData
+          destroyErrorData errData
 
-                withCString "SELECT COUNT(*) FROM error_demo" \sql ->
-                    withResultCString conn sql \resPtr -> do
-                        c_duckdb_row_count resPtr >>= (@?= 1)
-                        c_duckdb_value_int64 resPtr 0 0 >>= (@?= 0)
+        withConstCString "SELECT COUNT(*) FROM error_demo" \sql ->
+          withResultCString conn sql \resPtr -> do
+            c_duckdb_row_count resPtr >>= (@?= 1)
+            c_duckdb_value_int64 resPtr 0 0 >>= (@?= 0)
 
 -- Helpers -------------------------------------------------------------------
 
 runStatement :: DuckDBConnection -> String -> IO ()
 runStatement conn sql =
-    withCString sql \sqlPtr ->
-        alloca \resPtr -> do
-            state <- c_duckdb_query conn sqlPtr resPtr
-            if state == DuckDBSuccess
-                then c_duckdb_destroy_result resPtr
-                else do
-                    errPtr <- c_duckdb_result_error resPtr
-                    errMsg <-
-                        if errPtr == nullPtr
-                            then pure "unknown error"
-                            else peekCString errPtr
-                    c_duckdb_destroy_result resPtr
-                    assertFailure ("duckdb_query failed: " <> errMsg)
+  withConstCString sql \sqlPtr ->
+    alloca \resPtr -> do
+      state <- c_duckdb_query conn sqlPtr resPtr
+      if state == DuckDBSuccess
+        then c_duckdb_destroy_result resPtr
+        else do
+          errPtr <- c_duckdb_result_error resPtr
+          errMsg <-
+            if errPtr == coerce nullPtr
+              then pure "unknown error"
+              else peekCString (coerce errPtr)
+          c_duckdb_destroy_result resPtr
+          assertFailure ("duckdb_query failed: " <> errMsg)
 
 withTableAppender :: DuckDBConnection -> String -> (DuckDBAppender -> IO a) -> IO a
 withTableAppender conn tableName action =
-    withCString tableName \tablePtr ->
-        withAppenderAcquire
-            (c_duckdb_appender_create conn nullPtr tablePtr)
-            action
+  withConstCString tableName \tablePtr ->
+    withAppenderAcquire
+      (c_duckdb_appender_create conn (coerce nullPtr) tablePtr)
+      action
 
 withTableAppenderExt :: DuckDBConnection -> String -> (DuckDBAppender -> IO a) -> IO a
 withTableAppenderExt conn tableName action =
-    withCString tableName \tablePtr ->
-        withAppenderAcquire
-            (c_duckdb_appender_create_ext conn nullPtr nullPtr tablePtr)
-            action
+  withConstCString tableName \tablePtr ->
+    withAppenderAcquire
+      (c_duckdb_appender_create_ext conn (coerce nullPtr) (coerce nullPtr) tablePtr)
+      action
 
 withQueryAppender :: DuckDBConnection -> String -> [DuckDBLogicalType] -> (DuckDBAppender -> IO a) -> IO a
 withQueryAppender conn query types action =
-    withCString query \queryPtr ->
-        withArray types \typeArray ->
-            withAppenderAcquire
-                (c_duckdb_appender_create_query conn queryPtr (fromIntegral (length types)) typeArray nullPtr nullPtr)
-                action
+  withConstCString query \queryPtr ->
+    withArray types \typeArray ->
+      withAppenderAcquire
+        (c_duckdb_appender_create_query conn queryPtr (fromIntegral (length types)) typeArray (coerce nullPtr) nullPtr)
+        action
 
 withAppenderAcquire :: (Ptr DuckDBAppender -> IO DuckDBState) -> (DuckDBAppender -> IO a) -> IO a
 withAppenderAcquire acquire action =
-    alloca \appPtr -> do
-        state <- acquire appPtr
-        state @?= DuckDBSuccess
-        app <- peek appPtr
-        let release = do
-                destroyState <- c_duckdb_appender_destroy appPtr
-                assertBool "destroy returns success or error" (destroyState == DuckDBSuccess || destroyState == DuckDBError)
-        action app `finally` release
+  alloca \appPtr -> do
+    state <- acquire appPtr
+    state @?= DuckDBSuccess
+    app <- peek appPtr
+    let release = do
+          destroyState <- c_duckdb_appender_destroy appPtr
+          assertBool "destroy returns success or error" (destroyState == DuckDBSuccess || destroyState == DuckDBError)
+    action app `finally` release
 
 withDataChunk :: IO DuckDBDataChunk -> (DuckDBDataChunk -> IO a) -> IO a
 withDataChunk acquire = bracket acquire destroyChunk
@@ -516,40 +520,40 @@
 
 fillIntVector :: DuckDBVector -> [Int32] -> IO ()
 fillIntVector vec values = do
-    dataPtrRaw <- c_duckdb_vector_get_data vec
-    let dataPtr = castPtr dataPtrRaw :: Ptr Int32
-    forM_ (zip [0 ..] values) (uncurry (pokeElemOff dataPtr))
+  dataPtrRaw <- c_duckdb_vector_get_data vec
+  let dataPtr = coerce dataPtrRaw :: Ptr Int32
+  forM_ (zip [0 ..] values) (uncurry (pokeElemOff dataPtr))
 
 assignStrings :: DuckDBVector -> [String] -> IO ()
 assignStrings vec values =
-    forM_ (zip [0 ..] values) \(idx, val) ->
-        withCString val $ \str ->
-            c_duckdb_vector_assign_string_element vec (fromIntegral @Integer idx) str
+  forM_ (zip [0 ..] values) \(idx, val) ->
+    withConstCString val $ \str ->
+      c_duckdb_vector_assign_string_element vec (fromIntegral @Integer idx) str
 
 checkColumnType :: DuckDBAppender -> DuckDBIdx -> DuckDBType -> IO ()
 checkColumnType app idx expected =
-    do
-        logicalType <- c_duckdb_appender_column_type app idx
-        withLogicalType (pure logicalType) (c_duckdb_get_type_id >=> (@?= expected))
+  do
+    logicalType <- c_duckdb_appender_column_type app idx
+    withLogicalType (pure logicalType) ((fmap (getField @"unwrap") . c_duckdb_get_type_id) >=> (@?= expected))
 
 fetchString :: Ptr DuckDBResult -> DuckDBIdx -> DuckDBIdx -> IO String
 fetchString resPtr col row = do
-    strPtr <- c_duckdb_value_varchar resPtr col row
-    text <- peekCString strPtr
-    c_duckdb_free (castPtr strPtr)
-    pure text
+  strPtr <- c_duckdb_value_varchar resPtr col row
+  text <- peekCString (coerce strPtr)
+  c_duckdb_free (coerce strPtr)
+  pure text
 
 fetchBlob :: Ptr DuckDBResult -> DuckDBIdx -> DuckDBIdx -> IO [Word8]
 fetchBlob resPtr col row =
-    alloca \blobPtr -> do
-        c_duckdb_value_blob resPtr col row blobPtr
-        DuckDBBlob dat len <- peek blobPtr
-        let dataPtr = castPtr dat :: Ptr Word8
-        bytes <- peekArray (fromIntegral len) dataPtr
-        c_duckdb_free dat
-        pure bytes
+  alloca \blobPtr -> do
+    c_duckdb_value_blob resPtr col row >>= poke blobPtr
+    DuckDBBlob dat len <- peek blobPtr
+    let dataPtr = coerce dat :: Ptr Word8
+    bytes <- peekArray (fromIntegral len) dataPtr
+    c_duckdb_free dat
+    pure bytes
 
 fetchBool :: Ptr DuckDBResult -> DuckDBIdx -> DuckDBIdx -> IO Bool
 fetchBool resPtr col row = do
-    CBool val <- c_duckdb_value_boolean resPtr col row
-    pure (val /= 0)
+  CBool val <- c_duckdb_value_boolean resPtr col row
+  pure (val /= 0)
diff --git a/test/ArrowInterfaceDeprecatedTests.hs b/test/ArrowInterfaceDeprecatedTests.hs
--- a/test/ArrowInterfaceDeprecatedTests.hs
+++ b/test/ArrowInterfaceDeprecatedTests.hs
@@ -1,61 +1,67 @@
 {-# LANGUAGE BlockArguments #-}
-{-# LANGUAGE ForeignFunctionInterface #-}
+{-# LANGUAGE DataKinds #-}
+{-# LANGUAGE DuplicateRecordFields #-}
+{-# LANGUAGE TypeApplications #-}
 {-# OPTIONS_GHC -Wno-deprecations #-}
 
 module ArrowInterfaceDeprecatedTests (tests) where
 
 import Control.Exception (bracket, finally)
 import Control.Monad (unless, when, (>=>))
+import Data.Coerce (coerce)
 import Data.Int (Int32, Int64)
 import Data.List (isInfixOf)
-import Data.Maybe (isNothing)
+import Data.Proxy (Proxy (..))
 import Database.DuckDB.FFI
-import Database.DuckDB.FFI.Deprecated
-import Foreign.C.String (peekCString, peekCStringLen, withCString)
+import Foreign.C.ConstPtr (ConstPtr (..))
+import Foreign.C.String (peekCString, peekCStringLen)
 import Foreign.C.Types (CChar)
 import Foreign.Marshal.Alloc (alloca)
-import Foreign.Ptr (Ptr, castPtr, nullFunPtr, nullPtr, plusPtr)
+import Foreign.Ptr (Ptr, nullFunPtr, nullPtr, plusPtr)
 import Foreign.Storable (peek, peekElemOff, poke)
+import GHC.Records (getField)
+import HsBindgen.Runtime.HasCField (fromPtr)
+import HsBindgen.Runtime.Support.FunPtr (fromFunPtr)
 import Test.Tasty (TestTree, testGroup)
 import Test.Tasty.HUnit (assertBool, assertFailure, testCase, (@?=))
-import Utils (withConnection, withDatabase, withResult)
+import Utils (releaseArrowArray, releaseArrowSchema, withConnection, withConstCString, withDatabase, withResult)
 
 tests :: TestTree
 tests =
-    testGroup
-        "Deprecated Arrow Interface"
-        [ queryArrowExposesSchemaAndArrays
-        , queryArrowReportsErrors
-        , preparedArrowSchemaMatchesStatement
-        , executePreparedArrowProducesRows
-        , resultArrowArrayMirrorsChunk
-        , arrowRowsChangedReflectsMutations
-        , arrowArrayScanRegistersView
-        , arrowStreamScanRegistersView
-        , arrowPointerHelpersClearInternalState
-        ]
+  testGroup
+    "Deprecated Arrow Interface"
+    [ queryArrowExposesSchemaAndArrays
+    , queryArrowReportsErrors
+    , preparedArrowSchemaMatchesStatement
+    , executePreparedArrowProducesRows
+    , resultArrowArrayMirrorsChunk
+    , arrowRowsChangedReflectsMutations
+    , arrowArrayScanRegistersView
+    , arrowStreamScanRegistersView
+    , arrowStructMovesPreserveOwnership
+    ]
 
 -- basic query ---------------------------------------------------------------
 
 queryArrowExposesSchemaAndArrays :: TestTree
 queryArrowExposesSchemaAndArrays =
-    testCase "query_arrow exposes schema metadata and arrays" $
-        withDatabase \db ->
-            withConnection db \conn ->
-                withSuccessfulArrow conn "SELECT 1::INTEGER AS id, 'duck'::VARCHAR AS label" \arrow -> do
-                    columnCount <- c_duckdb_arrow_column_count arrow
-                    columnCount @?= 2
+  testCase "query_arrow exposes schema metadata and arrays" $
+    withDatabase \db ->
+      withConnection db \conn ->
+        withSuccessfulArrow conn "SELECT 1::INTEGER AS id, 'duck'::VARCHAR AS label" \arrow -> do
+          columnCount <- c_duckdb_arrow_column_count arrow
+          columnCount @?= 2
 
-                    rowCount <- c_duckdb_arrow_row_count arrow
-                    rowCount @?= 1
+          rowCount <- c_duckdb_arrow_row_count arrow
+          rowCount @?= 1
 
-                    rowsChanged <- c_duckdb_arrow_rows_changed arrow
-                    rowsChanged @?= 0
+          rowsChanged <- c_duckdb_arrow_rows_changed arrow
+          rowsChanged @?= 0
 
-                    errPtr <- c_duckdb_query_arrow_error arrow
-                    when (errPtr /= nullPtr) $ do
-                        errMsg <- peekCString errPtr
-                        errMsg @?= ""
+          errPtr <- c_duckdb_query_arrow_error arrow
+          when (errPtr /= coerce nullPtr) $ do
+            errMsg <- peekCString (coerce errPtr)
+            errMsg @?= ""
 
 -- schema/array access validated in dedicated scan test
 
@@ -63,456 +69,434 @@
 
 queryArrowReportsErrors :: TestTree
 queryArrowReportsErrors =
-    testCase "query_arrow surfaces execution errors" $
-        withDatabase \db ->
-            withConnection db \conn ->
-                withCString "SELECT * FROM missing_table" \querySql ->
-                    alloca \arrowPtr -> do
-                        poke arrowPtr nullPtr
-                        state <- c_duckdb_query_arrow conn querySql arrowPtr
-                        state @?= DuckDBError
+  testCase "query_arrow surfaces execution errors" $
+    withDatabase \db ->
+      withConnection db \conn ->
+        withConstCString "SELECT * FROM missing_table" \querySql ->
+          alloca \arrowPtr -> do
+            poke arrowPtr (coerce nullPtr)
+            state <- c_duckdb_query_arrow conn querySql arrowPtr
+            state @?= DuckDBError
 
-                        arrow <- peek arrowPtr
-                        assertBool "arrow result should still be allocated on error" (arrow /= nullPtr)
+            arrow <- peek arrowPtr
+            assertBool "arrow result should still be allocated on error" (arrow /= coerce nullPtr)
 
-                        errPtr <- c_duckdb_query_arrow_error arrow
-                        assertBool "error message should be present" (errPtr /= nullPtr)
-                        errMsg <- peekCString errPtr
-                        assertBool "error message should mention missing_table" ("missing_table" `isInfixOf` errMsg)
+            errPtr <- c_duckdb_query_arrow_error arrow
+            assertBool "error message should be present" (errPtr /= coerce nullPtr)
+            errMsg <- peekCString (coerce errPtr)
+            assertBool "error message should mention missing_table" ("missing_table" `isInfixOf` errMsg)
 
-                        c_duckdb_destroy_arrow arrowPtr
+            c_duckdb_destroy_arrow arrowPtr
 
 -- prepared statements -------------------------------------------------------
 
 preparedArrowSchemaMatchesStatement :: TestTree
 preparedArrowSchemaMatchesStatement =
-    testCase "prepared_arrow_schema describes statement parameters" $
-        withDatabase \db ->
-            withConnection db \conn ->
-                withPrepared conn "SELECT ?::INTEGER, ?::VARCHAR" \stmt ->
-                    alloca \schemaStorage -> do
-                        poke schemaStorage zeroArrowSchema
-                        alloca \schemaOut -> do
-                            poke schemaOut (castPtr schemaStorage)
-                            c_duckdb_prepared_arrow_schema stmt schemaOut >>= (@?= DuckDBSuccess)
-                            schema <- peek schemaStorage
-                            arrowSchemaChildCount schema @?= 2
-                            children <- mapM (peekElemOff (arrowSchemaChildren schema) >=> peek) [0, 1]
-                            mapM (peekCString . arrowSchemaName) children >>= (@?= ["0", "1"])
-                            mapM (peekCString . arrowSchemaFormat) children >>= (@?= ["n", "n"])
-                            releaseArrowSchema schemaStorage
+  testCase "prepared_arrow_schema describes statement parameters" $
+    withDatabase \db ->
+      withConnection db \conn ->
+        withPrepared conn "SELECT ?::INTEGER, ?::VARCHAR" \stmt ->
+          alloca \schemaStorage -> do
+            poke schemaStorage zeroArrowSchema
+            alloca \schemaOut -> do
+              poke schemaOut (coerce schemaStorage)
+              c_duckdb_prepared_arrow_schema stmt schemaOut >>= (@?= DuckDBSuccess)
+              schema <- peek schemaStorage
+              (getField @"n_children") schema @?= 2
+              children <- mapM (peekElemOff ((getField @"children") schema) >=> peek) [0, 1]
+              mapM ((peekCString . coerce) . (getField @"name")) children >>= (@?= ["0", "1"])
+              mapM ((peekCString . coerce) . (getField @"format")) children >>= (@?= ["n", "n"])
+              releaseArrowSchema schemaStorage
 
 executePreparedArrowProducesRows :: TestTree
 executePreparedArrowProducesRows =
-    testCase "execute_prepared_arrow materialises a result set" $
-        withDatabase \db ->
-            withConnection db \conn ->
-                withPrepared conn "SELECT ?::INTEGER + 5 AS computed" \stmt -> do
-                    c_duckdb_bind_int32 stmt 1 (5 :: Int32) >>= (@?= DuckDBSuccess)
+  testCase "execute_prepared_arrow materialises a result set" $
+    withDatabase \db ->
+      withConnection db \conn ->
+        withPrepared conn "SELECT ?::INTEGER + 5 AS computed" \stmt -> do
+          c_duckdb_bind_int32 stmt 1 (5 :: Int32) >>= (@?= DuckDBSuccess)
 
-                    withPreparedArrow stmt \arrow -> do
-                        rowCount <- c_duckdb_arrow_row_count arrow
-                        rowCount @?= 1
+          withPreparedArrow stmt \arrow -> do
+            rowCount <- c_duckdb_arrow_row_count arrow
+            rowCount @?= 1
 
-                        colCount <- c_duckdb_arrow_column_count arrow
-                        colCount @?= 1
+            colCount <- c_duckdb_arrow_column_count arrow
+            colCount @?= 1
 
 -- result conversion ---------------------------------------------------------
 
 resultArrowArrayMirrorsChunk :: TestTree
 resultArrowArrayMirrorsChunk =
-    -- NOTE: duckdb_result_arrow_array writes release callbacks into the
-    -- provided ArrowArray storage. Always zero-initialise the struct
-    -- (see zeroArrowArray) and honour the release function before the
-    -- stack memory goes out of scope.
-    testCase "result_arrow_array converts materialised chunks to Arrow arrays" $
-        withDatabase \db ->
-            withConnection db \conn -> do
-                execStatement conn "CREATE TABLE arrow_chunks(id BIGINT, label VARCHAR);"
-                execStatement conn "INSERT INTO arrow_chunks VALUES (10, 'ten'), (11, 'eleven');"
+  -- NOTE: duckdb_result_arrow_array writes release callbacks into the
+  -- provided ArrowArray storage. Always zero-initialise the struct
+  -- (see zeroArrowArray) and honour the release function before the
+  -- stack memory goes out of scope.
+  testCase "result_arrow_array converts materialised chunks to Arrow arrays" $
+    withDatabase \db ->
+      withConnection db \conn -> do
+        execStatement conn "CREATE TABLE arrow_chunks(id BIGINT, label VARCHAR);"
+        execStatement conn "INSERT INTO arrow_chunks VALUES (10, 'ten'), (11, 'eleven');"
 
-                withResult conn "SELECT id, label FROM arrow_chunks ORDER BY id" \resPtr -> do
-                    chunk <- c_duckdb_result_get_chunk resPtr 0
-                    assertBool "fetch_chunk returned a null chunk" (chunk /= nullPtr)
-                    chunkSize <- c_duckdb_data_chunk_get_size chunk
-                    chunkCols <- c_duckdb_data_chunk_get_column_count chunk
+        withResult conn "SELECT id, label FROM arrow_chunks ORDER BY id" \resPtr -> do
+          chunk <- peek resPtr >>= \rawValue -> c_duckdb_result_get_chunk rawValue 0
+          assertBool "fetch_chunk returned a null chunk" (chunk /= coerce nullPtr)
+          chunkSize <- c_duckdb_data_chunk_get_size chunk
+          chunkCols <- c_duckdb_data_chunk_get_column_count chunk
 
-                    alloca \arrowArrayPtr -> do
-                        poke arrowArrayPtr zeroArrowArray
-                        let duckArray :: DuckDBArrowArray
-                            duckArray = castPtr arrowArrayPtr
+          alloca \arrowArrayPtr -> do
+            poke arrowArrayPtr zeroArrowArray
+            let duckArray :: DuckDBArrowArray
+                duckArray = coerce arrowArrayPtr
 
-                        alloca \arrayOut -> do
-                            poke arrayOut duckArray
-                            c_duckdb_result_arrow_array resPtr chunk arrayOut
+            alloca \arrayOut -> do
+              poke arrayOut duckArray
+              peek resPtr >>= \rawValue -> c_duckdb_result_arrow_array rawValue chunk arrayOut
 
-                            array <- peek arrowArrayPtr
+              array <- peek arrowArrayPtr
 
-                            arrowArrayLength array @?= fromIntegral chunkSize
-                            arrowArrayChildCount array @?= fromIntegral chunkCols
+              (getField @"length") array @?= fromIntegral chunkSize
+              (getField @"n_children") array @?= fromIntegral chunkCols
 
-                            validateChunkChildren array
+              validateChunkChildren array
 
-                            releaseArrowArray arrowArrayPtr
+              releaseArrowArray arrowArrayPtr
 
-                    destroyChunk chunk
+          destroyChunk chunk
 
 -- rows changed --------------------------------------------------------------
 
 arrowRowsChangedReflectsMutations :: TestTree
 arrowRowsChangedReflectsMutations =
-    testCase "arrow_rows_changed reports mutation counts" $
-        withDatabase \db ->
-            withConnection db \conn -> do
-                execStatement conn "CREATE TABLE arrow_changes(val INTEGER);"
+  testCase "arrow_rows_changed reports mutation counts" $
+    withDatabase \db ->
+      withConnection db \conn -> do
+        execStatement conn "CREATE TABLE arrow_changes(val INTEGER);"
 
-                withSuccessfulArrow conn "INSERT INTO arrow_changes VALUES (1), (2), (3)" \arrow -> do
-                    rowCount <- c_duckdb_arrow_row_count arrow
-                    assertBool "modification result should not report negative rows" (rowCount >= 0)
+        withSuccessfulArrow conn "INSERT INTO arrow_changes VALUES (1), (2), (3)" \arrow -> do
+          rowCount <- c_duckdb_arrow_row_count arrow
+          assertBool "modification result should not report negative rows" (rowCount >= 0)
 
-                    changed <- c_duckdb_arrow_rows_changed arrow
-                    assertBool "rows_changed should report positive count" (changed > 0)
+          changed <- c_duckdb_arrow_rows_changed arrow
+          assertBool "rows_changed should report positive count" (changed > 0)
 
 -- arrow scans ----------------------------------------------------------------
 
 arrowArrayScanRegistersView :: TestTree
 arrowArrayScanRegistersView =
-    -- NOTE: Both the schema and array buffers must be initialised to
-    -- zeroed Arrow structures before calling the query helpers. DuckDB
-    -- fills in release callbacks and expects us to invoke
-    -- duckdb_destroy_arrow_stream on the out stream.
-    testCase "arrow_array_scan registers a view and yields a release stream" $
-        withDatabase \db ->
-            withConnection db \conn -> do
-                execStatement conn "CREATE TABLE arrow_scan_source(i BIGINT, label VARCHAR);"
-                execStatement conn "INSERT INTO arrow_scan_source VALUES (5, 'five'), (6, 'six');"
+  -- NOTE: Both the schema and array buffers must be initialised to
+  -- zeroed Arrow structures before calling the query helpers. DuckDB
+  -- fills in release callbacks and expects us to invoke
+  -- duckdb_destroy_arrow_stream on the out stream.
+  testCase "arrow_array_scan registers a view and yields a release stream" $
+    withDatabase \db ->
+      withConnection db \conn -> do
+        execStatement conn "CREATE TABLE arrow_scan_source(i BIGINT, label VARCHAR);"
+        execStatement conn "INSERT INTO arrow_scan_source VALUES (5, 'five'), (6, 'six');"
 
-                withSuccessfulArrow conn "SELECT i, label FROM arrow_scan_source ORDER BY i" \arrow -> do
-                    alloca \schemaStorage -> do
-                        poke schemaStorage zeroArrowSchema
-                        let schemaHandle = castPtr schemaStorage :: DuckDBArrowSchema
-                        alloca \schemaOut -> do
-                            poke schemaOut schemaHandle
-                            schemaState <- c_duckdb_query_arrow_schema arrow schemaOut
-                            schemaState @?= DuckDBSuccess
+        withSuccessfulArrow conn "SELECT i, label FROM arrow_scan_source ORDER BY i" \arrow -> do
+          alloca \schemaStorage -> do
+            poke schemaStorage zeroArrowSchema
+            let schemaHandle = coerce schemaStorage :: DuckDBArrowSchema
+            alloca \schemaOut -> do
+              poke schemaOut schemaHandle
+              schemaState <- c_duckdb_query_arrow_schema arrow schemaOut
+              schemaState @?= DuckDBSuccess
 
-                            alloca \arrayStorage -> do
-                                poke arrayStorage zeroArrowArray
-                                let arrayHandle = castPtr arrayStorage :: DuckDBArrowArray
-                                alloca \arrayOut -> do
-                                    poke arrayOut arrayHandle
-                                    arrayState <- c_duckdb_query_arrow_array arrow arrayOut
-                                    arrayState @?= DuckDBSuccess
+              alloca \arrayStorage -> do
+                poke arrayStorage zeroArrowArray
+                let arrayHandle = coerce arrayStorage :: DuckDBArrowArray
+                alloca \arrayOut -> do
+                  poke arrayOut arrayHandle
+                  arrayState <- c_duckdb_query_arrow_array arrow arrayOut
+                  arrayState @?= DuckDBSuccess
 
-                                    withCString "arrow_array_view" \viewName ->
-                                        alloca \streamOut -> do
-                                            poke streamOut nullPtr
-                                            scanState <- c_duckdb_arrow_array_scan conn viewName schemaHandle arrayHandle streamOut
-                                            scanState @?= DuckDBSuccess
+                  withConstCString "arrow_array_view" \viewName ->
+                    alloca \streamOut -> do
+                      poke streamOut (coerce nullPtr)
+                      scanState <- c_duckdb_arrow_array_scan conn viewName schemaHandle arrayHandle streamOut
+                      scanState @?= DuckDBSuccess
 
-                                            streamWrapper <- peek streamOut
-                                            assertBool "arrow_array_scan returned a null stream handle" (streamWrapper /= nullPtr)
+                      streamWrapper <- peek streamOut
+                      assertBool "arrow_array_scan returned a null stream handle" (streamWrapper /= coerce nullPtr)
 
-                                            withResult conn "SELECT COUNT(*) FROM arrow_array_view" \resPtr -> do
-                                                count <- c_duckdb_value_int64 resPtr 0 0
-                                                count @?= 2
+                      withResult conn "SELECT COUNT(*) FROM arrow_array_view" \resPtr -> do
+                        count <- c_duckdb_value_int64 resPtr 0 0
+                        count @?= 2
 
-                                            c_duckdb_destroy_arrow_stream streamOut
-                                    releaseArrowArray arrayStorage
-                        releaseArrowSchema schemaStorage
+                      c_duckdb_destroy_arrow_stream streamOut
+                  releaseArrowArray arrayStorage
+            releaseArrowSchema schemaStorage
 
 arrowStreamScanRegistersView :: TestTree
 arrowStreamScanRegistersView =
-    -- NOTE: duckdb_arrow_array_scan returns DuckDBError if the target
-    -- view name already exists (even if it is a table). Use a fresh
-    -- view name that will be dropped implicitly when the connection
-    -- closes.
-    testCase "arrow_scan registers a view from an Arrow stream" $
-        withDatabase \db ->
-            withConnection db \conn -> do
-                execStatement conn "CREATE TABLE arrow_stream_source(i BIGINT, label VARCHAR);"
-                execStatement conn "INSERT INTO arrow_stream_source VALUES (7, 'seven'), (8, 'eight');"
+  -- NOTE: duckdb_arrow_array_scan returns DuckDBError if the target
+  -- view name already exists (even if it is a table). Use a fresh
+  -- view name that will be dropped implicitly when the connection
+  -- closes.
+  testCase "arrow_scan registers a view from an Arrow stream" $
+    withDatabase \db ->
+      withConnection db \conn -> do
+        execStatement conn "CREATE TABLE arrow_stream_source(i BIGINT, label VARCHAR);"
+        execStatement conn "INSERT INTO arrow_stream_source VALUES (7, 'seven'), (8, 'eight');"
 
-                withSuccessfulArrow conn "SELECT i, label FROM arrow_stream_source ORDER BY i" \arrow -> do
-                    alloca \schemaStorage ->
-                        finally
-                            ( do
-                                poke schemaStorage zeroArrowSchema
-                                let schemaHandle = castPtr schemaStorage :: DuckDBArrowSchema
-                                alloca \schemaOut -> do
-                                    poke schemaOut schemaHandle
-                                    schemaState <- c_duckdb_query_arrow_schema arrow schemaOut
-                                    schemaState @?= DuckDBSuccess
+        withSuccessfulArrow conn "SELECT i, label FROM arrow_stream_source ORDER BY i" \arrow -> do
+          alloca \schemaStorage ->
+            finally
+              ( do
+                  poke schemaStorage zeroArrowSchema
+                  let schemaHandle = coerce schemaStorage :: DuckDBArrowSchema
+                  alloca \schemaOut -> do
+                    poke schemaOut schemaHandle
+                    schemaState <- c_duckdb_query_arrow_schema arrow schemaOut
+                    schemaState @?= DuckDBSuccess
 
-                                    alloca \arrayStorage ->
-                                        finally
-                                            ( do
-                                                poke arrayStorage zeroArrowArray
-                                                let arrayHandle = castPtr arrayStorage :: DuckDBArrowArray
-                                                alloca \arrayOut -> do
-                                                    poke arrayOut arrayHandle
-                                                    arrayState <- c_duckdb_query_arrow_array arrow arrayOut
-                                                    arrayState @?= DuckDBSuccess
+                    alloca \arrayStorage ->
+                      finally
+                        ( do
+                            poke arrayStorage zeroArrowArray
+                            let arrayHandle = coerce arrayStorage :: DuckDBArrowArray
+                            alloca \arrayOut -> do
+                              poke arrayOut arrayHandle
+                              arrayState <- c_duckdb_query_arrow_array arrow arrayOut
+                              arrayState @?= DuckDBSuccess
 
-                                                    withCString "arrow_stream_array_view" \sourceView ->
-                                                        alloca \streamOut -> do
-                                                            poke streamOut nullPtr
-                                                            arrayScanState <- c_duckdb_arrow_array_scan conn sourceView schemaHandle arrayHandle streamOut
-                                                            arrayScanState @?= DuckDBSuccess
+                              withConstCString "arrow_stream_array_view" \sourceView ->
+                                alloca \streamOut -> do
+                                  poke streamOut (coerce nullPtr)
+                                  arrayScanState <- c_duckdb_arrow_array_scan conn sourceView schemaHandle arrayHandle streamOut
+                                  arrayScanState @?= DuckDBSuccess
 
-                                                            streamHandle <- peek streamOut
-                                                            assertBool "arrow_array_scan returned a null stream" (streamHandle /= nullPtr)
+                                  streamHandle <- peek streamOut
+                                  assertBool "arrow_array_scan returned a null stream" (streamHandle /= coerce nullPtr)
 
-                                                            withCString "arrow_stream_view" \streamView -> do
-                                                                streamScanState <- c_duckdb_arrow_scan conn streamView streamHandle
-                                                                streamScanState @?= DuckDBSuccess
+                                  withConstCString "arrow_stream_view" \streamView -> do
+                                    streamScanState <- c_duckdb_arrow_scan conn streamView streamHandle
+                                    streamScanState @?= DuckDBSuccess
 
-                                                            withResult conn "SELECT COUNT(*) FROM arrow_stream_view" \resPtr -> do
-                                                                count <- c_duckdb_value_int64 resPtr 0 0
-                                                                count @?= 2
+                                  withResult conn "SELECT COUNT(*) FROM arrow_stream_view" \resPtr -> do
+                                    count <- c_duckdb_value_int64 resPtr 0 0
+                                    count @?= 2
 
-                                                            c_duckdb_destroy_arrow_stream streamOut
-                                            )
-                                            (releaseArrowArray arrayStorage)
-                            )
-                            (releaseArrowSchema schemaStorage)
+                                  c_duckdb_destroy_arrow_stream streamOut
+                        )
+                        (releaseArrowArray arrayStorage)
+              )
+              (releaseArrowSchema schemaStorage)
 
-arrowPointerHelpersClearInternalState :: TestTree
-arrowPointerHelpersClearInternalState =
-    testCase "Arrow helpers move real DuckDB structures without releasing buffers" $ do
-        withDatabase \db ->
-            withConnection db \conn ->
-                withSuccessfulArrow conn "SELECT 42::BIGINT AS id, 'duck' AS label" \arrow ->
-                    alloca \schemaStorage -> do
-                        poke schemaStorage zeroArrowSchema
-                        let schemaHandle = castPtr schemaStorage :: DuckDBArrowSchema
-                        alloca \schemaOut -> do
-                            poke schemaOut schemaHandle
-                            c_duckdb_query_arrow_schema arrow schemaOut >>= (@?= DuckDBSuccess)
-                        schemaPtr <- duckdbArrowSchemaInternal schemaHandle
-                        fmap unArrowSchemaPtr schemaPtr @?= Just schemaStorage
+arrowStructMovesPreserveOwnership :: TestTree
+arrowStructMovesPreserveOwnership =
+  testCase "Arrow structs move real DuckDB buffers without releasing them" $ do
+    withDatabase \db ->
+      withConnection db \conn ->
+        withSuccessfulArrow conn "SELECT 42::BIGINT AS id, 'duck' AS label" \arrow ->
+          alloca \schemaStorage -> do
+            poke schemaStorage zeroArrowSchema
+            let schemaHandle = coerce schemaStorage :: DuckDBArrowSchema
+            alloca \schemaOut -> do
+              poke schemaOut schemaHandle
+              c_duckdb_query_arrow_schema arrow schemaOut >>= (@?= DuckDBSuccess)
 
-                        alloca \arrayStorage -> do
-                            poke arrayStorage zeroArrowArray
-                            let arrayHandle = castPtr arrayStorage :: DuckDBArrowArray
-                            alloca \arrayOut -> do
-                                poke arrayOut arrayHandle
-                                c_duckdb_query_arrow_array arrow arrayOut >>= (@?= DuckDBSuccess)
-                            arrayPtr <- duckdbArrowArrayInternal arrayHandle
-                            fmap unArrowArrayPtr arrayPtr @?= Just arrayStorage
+            alloca \arrayStorage -> do
+              poke arrayStorage zeroArrowArray
+              let arrayHandle = coerce arrayStorage :: DuckDBArrowArray
+              alloca \arrayOut -> do
+                poke arrayOut arrayHandle
+                c_duckdb_query_arrow_array arrow arrayOut >>= (@?= DuckDBSuccess)
 
-                            withCString "arrow_helper_view" \viewName ->
-                                alloca \streamOut -> do
-                                    poke streamOut nullPtr
-                                    c_duckdb_arrow_array_scan conn viewName schemaHandle arrayHandle streamOut >>= (@?= DuckDBSuccess)
-                                    stream <- peek streamOut
-                                    streamPtr <- duckdbArrowStreamInternal stream
-                                    fmap unArrowStreamPtr streamPtr @?= Just (castPtr stream)
-                                    original <- peek (castPtr stream :: Ptr ArrowArrayStream)
-                                    alloca \movedStream -> do
-                                        poke movedStream original
-                                        duckdbArrowStreamClear stream
-                                        source <- peek (castPtr stream :: Ptr ArrowArrayStream)
-                                        arrowStreamRelease source @?= nullFunPtr
-                                        arrowStreamGetSchema source @?= arrowStreamGetSchema original
-                                        duckdbArrowStreamInternal stream >>= assertBool "detached stream" . isNothing
-                                        alloca \movedSchema -> do
-                                            poke movedSchema zeroArrowSchema
-                                            mkArrowStreamGetSchema (arrowStreamGetSchema original) movedStream movedSchema >>= (@?= 0)
-                                            schema <- peek movedSchema
-                                            peekCString (arrowSchemaFormat schema) >>= (@?= "+s")
-                                            releaseArrowSchema movedSchema
-                                        alloca \movedArray -> do
-                                            poke movedArray zeroArrowArray
-                                            mkArrowStreamGetNext (arrowStreamGetNext original) movedStream movedArray >>= (@?= 0)
-                                            batch <- peek movedArray
-                                            arrowArrayLength batch @?= 1
-                                            releaseArrowArray movedArray
-                                            mkArrowStreamGetNext (arrowStreamGetNext original) movedStream movedArray >>= (@?= 0)
-                                            exhausted <- peek movedArray
-                                            arrowArrayRelease exhausted @?= nullFunPtr
-                                        mkArrowStreamRelease (arrowStreamRelease original) movedStream
-                                        moved <- peek movedStream
-                                        arrowStreamRelease moved @?= nullFunPtr
-                                    c_duckdb_destroy_arrow_stream streamOut
-                                    peek streamOut >>= (@?= nullPtr)
+              withConstCString "arrow_helper_view" \viewName ->
+                alloca \streamOut -> do
+                  poke streamOut (coerce nullPtr)
+                  c_duckdb_arrow_array_scan conn viewName schemaHandle arrayHandle streamOut >>= (@?= DuckDBSuccess)
+                  stream <- peek streamOut
 
-                            originalArray <- peek arrayStorage
-                            alloca \movedArray -> do
-                                poke movedArray originalArray
-                                duckdbArrowArrayClear arrayHandle
-                                source <- peek arrayStorage
-                                arrowArrayLength source @?= arrowArrayLength originalArray
-                                arrowArrayBuffers source @?= arrowArrayBuffers originalArray
-                                arrowArrayRelease source @?= nullFunPtr
-                                duckdbArrowArrayInternal arrayHandle >>= assertBool "detached array" . isNothing
-                                moved <- peek movedArray
-                                arrowArrayLength moved @?= 1
-                                child <- peekElemOff (arrowArrayChildren moved) 0 >>= peek
-                                buffer <- peekElemOff (arrowArrayBuffers child) 1
-                                peek (castPtr buffer :: Ptr Int64) >>= (@?= 42)
-                                releaseArrowArray movedArray
-                                duckdbArrowArrayClear arrayHandle
+                  original <- peek (coerce stream :: Ptr ArrowArrayStream)
+                  alloca \movedStream -> do
+                    poke movedStream original
+                    poke (fromPtr (Proxy @"release") ((coerce stream :: Ptr ArrowArrayStream) :: Ptr ArrowArrayStream)) nullFunPtr
+                    alloca \movedSchema -> do
+                      poke movedSchema zeroArrowSchema
+                      fromFunPtr ((getField @"get_schema") original) movedStream movedSchema >>= (@?= 0)
+                      schema <- peek movedSchema
+                      (peekCString . coerce) ((getField @"format") schema) >>= (@?= "+s")
+                      releaseArrowSchema movedSchema
+                    alloca \movedArray -> do
+                      poke movedArray zeroArrowArray
+                      fromFunPtr ((getField @"get_next") original) movedStream movedArray >>= (@?= 0)
+                      batch <- peek movedArray
+                      (getField @"length") batch @?= 1
+                      releaseArrowArray movedArray
+                      fromFunPtr ((getField @"get_next") original) movedStream movedArray >>= (@?= 0)
+                      exhausted <- peek movedArray
+                      (getField @"release") exhausted @?= nullFunPtr
+                    fromFunPtr ((getField @"release") original) movedStream
+                    moved <- peek movedStream
+                    (getField @"release") moved @?= nullFunPtr
+                  c_duckdb_destroy_arrow_stream streamOut
+                  peek streamOut >>= (@?= coerce nullPtr)
 
-                        originalSchema <- peek schemaStorage
-                        alloca \movedSchema -> do
-                            poke movedSchema originalSchema
-                            duckdbArrowSchemaClear schemaHandle
-                            source <- peek schemaStorage
-                            arrowSchemaFormat source @?= arrowSchemaFormat originalSchema
-                            arrowSchemaRelease source @?= nullFunPtr
-                            duckdbArrowSchemaInternal schemaHandle >>= assertBool "detached schema" . isNothing
-                            moved <- peek movedSchema
-                            peekCString (arrowSchemaFormat moved) >>= (@?= "+s")
-                            child <- peekElemOff (arrowSchemaChildren moved) 0 >>= peek
-                            peekCString (arrowSchemaName child) >>= (@?= "id")
-                            releaseArrowSchema movedSchema
-                            duckdbArrowSchemaClear schemaHandle
+              originalArray <- peek arrayStorage
+              alloca \movedArray -> do
+                poke movedArray originalArray
+                poke (fromPtr (Proxy @"release") (arrayStorage :: Ptr ArrowArray)) nullFunPtr
+                moved <- peek movedArray
+                (getField @"length") moved @?= 1
+                child <- peekElemOff ((getField @"children") moved) 0 >>= peek
+                buffer <- peekElemOff ((getField @"buffers") child) 1
+                peek (coerce buffer :: Ptr Int64) >>= (@?= 42)
+                releaseArrowArray movedArray
+                poke (fromPtr (Proxy @"release") (arrayStorage :: Ptr ArrowArray)) nullFunPtr
 
-        duckdbArrowSchemaInternal nullPtr >>= assertBool "null schema" . isNothing
-        duckdbArrowArrayInternal nullPtr >>= assertBool "null array" . isNothing
-        duckdbArrowStreamInternal nullPtr >>= assertBool "null stream" . isNothing
+            originalSchema <- peek schemaStorage
+            alloca \movedSchema -> do
+              poke movedSchema originalSchema
+              poke (fromPtr (Proxy @"release") (schemaStorage :: Ptr ArrowSchema)) nullFunPtr
+              moved <- peek movedSchema
+              (peekCString . coerce) ((getField @"format") moved) >>= (@?= "+s")
+              child <- peekElemOff ((getField @"children") moved) 0 >>= peek
+              (peekCString . coerce) ((getField @"name") child) >>= (@?= "id")
+              releaseArrowSchema movedSchema
+              poke (fromPtr (Proxy @"release") (schemaStorage :: Ptr ArrowSchema)) nullFunPtr
 
 zeroArrowArray :: ArrowArray
 zeroArrowArray =
-    ArrowArray
-        { arrowArrayLength = 0
-        , arrowArrayNullCount = 0
-        , arrowArrayOffset = 0
-        , arrowArrayBufferCount = 0
-        , arrowArrayChildCount = 0
-        , arrowArrayBuffers = nullPtr
-        , arrowArrayChildren = nullPtr
-        , arrowArrayDictionary = nullPtr
-        , arrowArrayRelease = nullFunPtr
-        , arrowArrayPrivateData = nullPtr
-        }
+  ArrowArray
+    { length = 0
+    , null_count = 0
+    , offset = 0
+    , n_buffers = 0
+    , n_children = 0
+    , buffers = nullPtr
+    , children = nullPtr
+    , dictionary = nullPtr
+    , release = nullFunPtr
+    , private_data = nullPtr
+    }
 
 zeroArrowSchema :: ArrowSchema
 zeroArrowSchema =
-    ArrowSchema
-        { arrowSchemaFormat = nullPtr
-        , arrowSchemaName = nullPtr
-        , arrowSchemaMetadata = nullPtr
-        , arrowSchemaFlags = 0
-        , arrowSchemaChildCount = 0
-        , arrowSchemaChildren = nullPtr
-        , arrowSchemaDictionary = nullPtr
-        , arrowSchemaRelease = nullFunPtr
-        , arrowSchemaPrivateData = nullPtr
-        }
+  ArrowSchema
+    { format = coerce nullPtr
+    , name = coerce nullPtr
+    , metadata = coerce nullPtr
+    , flags = 0
+    , n_children = 0
+    , children = nullPtr
+    , dictionary = nullPtr
+    , release = nullFunPtr
+    , private_data = nullPtr
+    }
 
 validateChunkChildren :: ArrowArray -> IO ()
 validateChunkChildren array = do
-    let expectedIds = [10, 11] :: [Int64]
-        expectedLabels = ["ten", "eleven"]
-        childCount = fromIntegral (arrowArrayChildCount array) :: Int
-        rowCount = fromIntegral (arrowArrayLength array) :: Int
-    childCount @?= 2
-    rowCount @?= length expectedIds
+  let expectedIds = [10, 11] :: [Int64]
+      expectedLabels = ["ten", "eleven"]
+      childCount = fromIntegral ((getField @"n_children") array) :: Int
+      rowCount = fromIntegral ((getField @"length") array) :: Int
+  childCount @?= 2
+  rowCount @?= length expectedIds
 
-    let childrenPtr = arrowArrayChildren array
-    assertBool "Arrow array did not expose child arrays" (childrenPtr /= nullPtr)
+  let childrenPtr = (getField @"children") array
+  assertBool "Arrow array did not expose child arrays" (childrenPtr /= nullPtr)
 
-    let ensurePtr name ptrPred =
-            unless ptrPred $
-                assertFailure ("Arrow array " ++ name ++ " pointer is null")
+  let ensurePtr name ptrPred =
+        unless ptrPred $
+          assertFailure ("Arrow array " ++ name ++ " pointer is null")
 
-    intChildPtr <- peekElemOff childrenPtr 0
-    ensurePtr "integer child" (intChildPtr /= nullPtr)
-    intChild <- peek intChildPtr
-    arrowArrayNullCount intChild @?= 0
-    let intBufferCount = fromIntegral (arrowArrayBufferCount intChild) :: Int
-    assertBool "Integer child did not expose the expected buffers" (intBufferCount >= 2)
+  intChildPtr <- peekElemOff childrenPtr 0
+  ensurePtr "integer child" (intChildPtr /= nullPtr)
+  intChild <- peek intChildPtr
+  (getField @"null_count") intChild @?= 0
+  let intBufferCount = fromIntegral ((getField @"n_buffers") intChild) :: Int
+  assertBool "Integer child did not expose the expected buffers" (intBufferCount >= 2)
 
-    let intBuffers = arrowArrayBuffers intChild
-    ensurePtr "integer buffers" (intBuffers /= nullPtr)
-    valueBufferRaw <- peekElemOff intBuffers 1
-    ensurePtr "integer value buffer" (valueBufferRaw /= nullPtr)
-    let valueBuffer = castPtr valueBufferRaw :: Ptr Int64
-    values <- mapM (peekElemOff valueBuffer) [0 .. rowCount - 1]
-    values @?= expectedIds
+  let intBuffers = (getField @"buffers") intChild
+  ensurePtr "integer buffers" (intBuffers /= nullPtr)
+  valueBufferRaw <- peekElemOff intBuffers 1
+  ensurePtr "integer value buffer" (valueBufferRaw /= coerce nullPtr)
+  let valueBuffer = coerce valueBufferRaw :: Ptr Int64
+  values <- mapM (peekElemOff valueBuffer) [0 .. rowCount - 1]
+  values @?= expectedIds
 
-    strChildPtr <- peekElemOff childrenPtr 1
-    ensurePtr "varchar child" (strChildPtr /= nullPtr)
-    strChild <- peek strChildPtr
-    arrowArrayNullCount strChild @?= 0
-    let strBufferCount = fromIntegral (arrowArrayBufferCount strChild) :: Int
-    assertBool "Varchar child did not expose the expected buffers" (strBufferCount >= 3)
+  strChildPtr <- peekElemOff childrenPtr 1
+  ensurePtr "varchar child" (strChildPtr /= nullPtr)
+  strChild <- peek strChildPtr
+  (getField @"null_count") strChild @?= 0
+  let strBufferCount = fromIntegral ((getField @"n_buffers") strChild) :: Int
+  assertBool "Varchar child did not expose the expected buffers" (strBufferCount >= 3)
 
-    let strBuffers = arrowArrayBuffers strChild
-    ensurePtr "varchar buffers" (strBuffers /= nullPtr)
-    offsetsRaw <- peekElemOff strBuffers 1
-    dataRaw <- peekElemOff strBuffers 2
-    ensurePtr "varchar offsets buffer" (offsetsRaw /= nullPtr)
-    ensurePtr "varchar data buffer" (dataRaw /= nullPtr)
+  let strBuffers = (getField @"buffers") strChild
+  ensurePtr "varchar buffers" (strBuffers /= nullPtr)
+  offsetsRaw <- peekElemOff strBuffers 1
+  dataRaw <- peekElemOff strBuffers 2
+  ensurePtr "varchar offsets buffer" (offsetsRaw /= coerce nullPtr)
+  ensurePtr "varchar data buffer" (dataRaw /= coerce nullPtr)
 
-    let offsetsPtr = castPtr offsetsRaw :: Ptr Int32
-        dataPtr = castPtr dataRaw :: Ptr CChar
-    labels <-
-        mapM
-            ( \idx -> do
-                start <- fromIntegral <$> peekElemOff offsetsPtr idx
-                end <- fromIntegral <$> peekElemOff offsetsPtr (idx + 1)
-                peekCStringLen (dataPtr `plusPtr` start, end - start)
-            )
-            [0 .. rowCount - 1]
-    labels @?= expectedLabels
+  let offsetsPtr = coerce offsetsRaw :: Ptr Int32
+      dataPtr = coerce dataRaw :: Ptr CChar
+  labels <-
+    mapM
+      ( \idx -> do
+          start <- fromIntegral <$> peekElemOff offsetsPtr idx
+          end <- fromIntegral <$> peekElemOff offsetsPtr (idx + 1)
+          peekCStringLen (dataPtr `plusPtr` start, end - start)
+      )
+      [0 .. rowCount - 1]
+  labels @?= expectedLabels
 
 withSuccessfulArrow :: DuckDBConnection -> String -> (DuckDBArrow -> IO a) -> IO a
 withSuccessfulArrow conn sql action =
-    withCString sql \sqlPtr ->
-        alloca \arrowPtr ->
-            bracket
-                ( do
-                    poke arrowPtr nullPtr
-                    state <- c_duckdb_query_arrow conn sqlPtr arrowPtr
-                    state @?= DuckDBSuccess
-                    arrow <- peek arrowPtr
-                    assertBool "duckdb_query_arrow returned null result" (arrow /= nullPtr)
-                    pure arrow
-                )
-                (\_ -> c_duckdb_destroy_arrow arrowPtr)
-                action
+  withConstCString sql \sqlPtr ->
+    alloca \arrowPtr ->
+      bracket
+        ( do
+            poke arrowPtr (coerce nullPtr)
+            state <- c_duckdb_query_arrow conn sqlPtr arrowPtr
+            state @?= DuckDBSuccess
+            arrow <- peek arrowPtr
+            assertBool "duckdb_query_arrow returned null result" (arrow /= coerce nullPtr)
+            pure arrow
+        )
+        (\_ -> c_duckdb_destroy_arrow arrowPtr)
+        action
 
 withPrepared :: DuckDBConnection -> String -> (DuckDBPreparedStatement -> IO a) -> IO a
 withPrepared conn sql action =
-    withCString sql \sqlPtr ->
-        alloca \stmtPtr ->
-            bracket
-                ( do
-                    state <- c_duckdb_prepare conn sqlPtr stmtPtr
-                    state @?= DuckDBSuccess
-                    stmt <- peek stmtPtr
-                    assertBool "prepare should produce a statement" (stmt /= nullPtr)
-                    pure stmt
-                )
-                (\_ -> c_duckdb_destroy_prepare stmtPtr)
-                action
+  withConstCString sql \sqlPtr ->
+    alloca \stmtPtr ->
+      bracket
+        ( do
+            state <- c_duckdb_prepare conn sqlPtr stmtPtr
+            state @?= DuckDBSuccess
+            stmt <- peek stmtPtr
+            assertBool "prepare should produce a statement" (stmt /= coerce nullPtr)
+            pure stmt
+        )
+        (\_ -> c_duckdb_destroy_prepare stmtPtr)
+        action
 
 withPreparedArrow :: DuckDBPreparedStatement -> (DuckDBArrow -> IO a) -> IO a
 withPreparedArrow stmt action =
-    alloca \arrowPtr ->
-        bracket
-            ( do
-                poke arrowPtr nullPtr
-                state <- c_duckdb_execute_prepared_arrow stmt arrowPtr
-                state @?= DuckDBSuccess
-                arrow <- peek arrowPtr
-                assertBool "execute_prepared_arrow returned null result" (arrow /= nullPtr)
-                pure arrow
-            )
-            (\_ -> c_duckdb_destroy_arrow arrowPtr)
-            action
+  alloca \arrowPtr ->
+    bracket
+      ( do
+          poke arrowPtr (coerce nullPtr)
+          state <- c_duckdb_execute_prepared_arrow stmt arrowPtr
+          state @?= DuckDBSuccess
+          arrow <- peek arrowPtr
+          assertBool "execute_prepared_arrow returned null result" (arrow /= coerce nullPtr)
+          pure arrow
+      )
+      (\_ -> c_duckdb_destroy_arrow arrowPtr)
+      action
 
 destroyChunk :: DuckDBDataChunk -> IO ()
 destroyChunk chunk =
-    alloca \ptr -> poke ptr chunk >> c_duckdb_destroy_data_chunk ptr
+  alloca \ptr -> poke ptr chunk >> c_duckdb_destroy_data_chunk ptr
 
 execStatement :: DuckDBConnection -> String -> IO ()
 execStatement conn sql =
-    withCString sql \sqlPtr ->
-        alloca \resPtr -> do
-            st <- c_duckdb_query conn sqlPtr resPtr
-            st @?= DuckDBSuccess
-            c_duckdb_destroy_result resPtr
+  withConstCString sql \sqlPtr ->
+    alloca \resPtr -> do
+      st <- c_duckdb_query conn sqlPtr resPtr
+      st @?= DuckDBSuccess
+      c_duckdb_destroy_result resPtr
diff --git a/test/ArrowInterfaceTest.hs b/test/ArrowInterfaceTest.hs
--- a/test/ArrowInterfaceTest.hs
+++ b/test/ArrowInterfaceTest.hs
@@ -1,257 +1,266 @@
 {-# LANGUAGE BlockArguments #-}
+{-# LANGUAGE DataKinds #-}
+{-# LANGUAGE DuplicateRecordFields #-}
+{-# LANGUAGE TypeApplications #-}
 
 module ArrowInterfaceTest (tests) where
 
 import Control.Exception (bracket, finally)
 import Control.Monad (when)
 import Data.Bits (testBit)
+import Data.Coerce (coerce)
 import Data.Int (Int32)
+import Data.Proxy (Proxy (..))
 import Database.DuckDB.FFI
-import Foreign.C.String (CString, peekCString, withCString)
+import Foreign.C.ConstPtr (ConstPtr (..))
+import Foreign.C.String (peekCString)
+import Foreign.C.Types (CChar)
 import Foreign.Marshal.Alloc (alloca)
 import Foreign.Marshal.Array (peekArray, withArray)
 import Foreign.Marshal.Utils (withMany)
-import Foreign.Ptr (Ptr, castPtr, freeHaskellFunPtr, nullFunPtr, nullPtr)
+import Foreign.Ptr (Ptr, freeHaskellFunPtr, nullFunPtr, nullPtr)
 import Foreign.Storable (Storable (..), peek, peekElemOff, poke, pokeElemOff)
+import GHC.Records (getField)
+import HsBindgen.Runtime.HasCField (fromPtr)
+import HsBindgen.Runtime.Support.FunPtr (fromFunPtr, toFunPtr)
 import Test.Tasty (TestTree, testGroup)
 import Test.Tasty.HUnit (assertBool, assertFailure, testCase, (@?=))
-import Utils (withConnection, withDatabase)
+import Utils (releaseArrowArray, releaseArrowSchema, releaseArrowStream, withConnection, withConstCString, withDatabase)
 
 tests :: TestTree
 tests =
-    testGroup
-        "Arrow Interface"
-        [ arrowSchemaRoundtrip
-        , arrowChunkRoundtrip
-        , arrowStreamErrorCallbacks
-        ]
+  testGroup
+    "Arrow Interface"
+    [ arrowSchemaRoundtrip
+    , arrowChunkRoundtrip
+    , arrowStreamErrorCallbacks
+    ]
 
 -- | Invoke a producer's error callback after its next-array callback fails.
 arrowStreamErrorCallbacks :: TestTree
 arrowStreamErrorCallbacks =
-    testCase "stream callbacks report a producer error" $
-        withCString "Arrow producer failed" \message ->
-            bracket (wrapArrowStreamGetNext (\_ _ -> pure 5)) freeHaskellFunPtr \next ->
-                bracket (wrapArrowStreamGetLastError (const (pure message))) freeHaskellFunPtr \lastError ->
-                    bracket
-                        ( wrapArrowStreamRelease \stream -> do
-                            value <- peek stream
-                            poke stream value{arrowStreamRelease = nullFunPtr}
-                        )
-                        freeHaskellFunPtr
-                        \release ->
-                            alloca \stream -> do
-                                poke stream (ArrowArrayStream nullFunPtr next lastError release nullPtr)
-                                alloca \array -> do
-                                    poke array zeroArrowArray
-                                    mkArrowStreamGetNext next stream array >>= (@?= 5)
-                                    mkArrowStreamGetLastError lastError stream >>= peekCString >>= (@?= "Arrow producer failed")
-                                releaseArrowStream stream
-                                value <- peek stream
-                                arrowStreamRelease value @?= nullFunPtr
-                                releaseArrowStream stream
+  testCase "stream callbacks report a producer error" $
+    withConstCString "Arrow producer failed" \message ->
+      bracket (toFunPtr (\_ _ -> pure 5)) (freeHaskellFunPtr . coerce) \next ->
+        bracket (toFunPtr (const (pure message))) (freeHaskellFunPtr . coerce) \lastError ->
+          bracket
+            ( toFunPtr \stream -> do
+                poke (fromPtr (Proxy @"release") (stream :: Ptr ArrowArrayStream)) nullFunPtr
+            )
+            (freeHaskellFunPtr . coerce)
+            \release ->
+              alloca \stream -> do
+                poke stream (ArrowArrayStream nullFunPtr next lastError release nullPtr)
+                alloca \array -> do
+                  poke array zeroArrowArray
+                  fromFunPtr next stream array >>= (@?= 5)
+                  fromFunPtr lastError stream >>= (peekCString . coerce) >>= (@?= "Arrow producer failed")
+                releaseArrowStream stream
+                value <- peek stream
+                (getField @"release") value @?= nullFunPtr
+                releaseArrowStream stream
 
 arrowSchemaRoundtrip :: TestTree
 arrowSchemaRoundtrip =
-    testCase "to_arrow_schema exposes children and converts back" $
-        withDatabase \db ->
-            withConnection db \conn ->
-                withArrowOptions conn \arrowOpts ->
-                    withLogicalTypes [DuckDBTypeInteger, DuckDBTypeVarchar] \logicalTypes ->
-                        withArray logicalTypes \logicalArray ->
-                            withColumnNames ["id", "label"] \nameArray ->
-                                withArrowSchema \schemaPtr -> do
-                                    errData <- c_duckdb_to_arrow_schema arrowOpts logicalArray nameArray (fromIntegral (length logicalTypes)) (castPtr schemaPtr)
-                                    assertNoError errData
+  testCase "to_arrow_schema exposes children and converts back" $
+    withDatabase \db ->
+      withConnection db \conn ->
+        withArrowOptions conn \arrowOpts ->
+          withLogicalTypes [DuckDBTypeInteger, DuckDBTypeVarchar] \logicalTypes ->
+            withArray logicalTypes \logicalArray ->
+              withColumnNames ["id", "label"] \nameArray ->
+                withArrowSchema \schemaPtr -> do
+                  errData <- c_duckdb_to_arrow_schema arrowOpts logicalArray nameArray (fromIntegral (length logicalTypes)) (coerce schemaPtr)
+                  assertNoError errData
 
-                                    schema <- peek schemaPtr
-                                    formatStr <- peekCString (arrowSchemaFormat schema)
-                                    formatStr @?= "+s"
-                                    arrowSchemaChildCount schema @?= fromIntegral (length logicalTypes)
+                  schema <- peek schemaPtr
+                  formatStr <- (peekCString . coerce) ((getField @"format") schema)
+                  formatStr @?= "+s"
+                  (getField @"n_children") schema @?= fromIntegral (length logicalTypes)
 
-                                    let childCount = fromIntegral (arrowSchemaChildCount schema)
-                                    let childArrayPtr = arrowSchemaChildren schema
-                                    assertBool "children pointer should not be null" (childArrayPtr /= nullPtr)
-                                    [fc, sc] <- peekArray childCount childArrayPtr >>= mapM peek
-                                    peekCString (arrowSchemaName fc) >>= (@?= "id")
-                                    peekCString (arrowSchemaName sc) >>= (@?= "label")
-                                    assertBool "schema release pointer should be set" (arrowSchemaRelease schema /= nullFunPtr)
+                  let childCount = fromIntegral ((getField @"n_children") schema)
+                  let childArrayPtr = (getField @"children") schema
+                  assertBool "children pointer should not be null" (childArrayPtr /= nullPtr)
+                  [fc, sc] <- peekArray childCount childArrayPtr >>= mapM peek
+                  (peekCString . coerce) ((getField @"name") fc) >>= (@?= "id")
+                  (peekCString . coerce) ((getField @"name") sc) >>= (@?= "label")
+                  assertBool "schema release pointer should be set" ((getField @"release") schema /= nullFunPtr)
 
-                                    withConvertedSchema conn schemaPtr (const (pure ()))
+                  withConvertedSchema conn schemaPtr (const (pure ()))
 
 arrowChunkRoundtrip :: TestTree
 arrowChunkRoundtrip =
-    testCase "data_chunk_to_arrow and from_arrow preserve values and nulls" $
-        withDatabase \db ->
-            withConnection db \conn ->
-                withArrowOptions conn \arrowOpts ->
-                    withLogicalTypes [DuckDBTypeInteger] \logicalTypes ->
-                        withArray logicalTypes \logicalArray ->
-                            withColumnNames ["val"] \nameArray ->
-                                withArrowSchema \schemaPtr -> do
-                                    errSchema <- c_duckdb_to_arrow_schema arrowOpts logicalArray nameArray 1 (castPtr schemaPtr)
-                                    assertNoError errSchema
+  testCase "data_chunk_to_arrow and from_arrow preserve values and nulls" $
+    withDatabase \db ->
+      withConnection db \conn ->
+        withArrowOptions conn \arrowOpts ->
+          withLogicalTypes [DuckDBTypeInteger] \logicalTypes ->
+            withArray logicalTypes \logicalArray ->
+              withColumnNames ["val"] \nameArray ->
+                withArrowSchema \schemaPtr -> do
+                  errSchema <- c_duckdb_to_arrow_schema arrowOpts logicalArray nameArray 1 (coerce schemaPtr)
+                  assertNoError errSchema
 
-                                    withConvertedSchema conn schemaPtr \convertedSchema ->
-                                        do
-                                            chunk <- c_duckdb_create_data_chunk logicalArray 1
-                                            assertBool "create_data_chunk should return chunk" (chunk /= nullPtr)
+                  withConvertedSchema conn schemaPtr \convertedSchema ->
+                    do
+                      chunk <- c_duckdb_create_data_chunk logicalArray 1
+                      assertBool "create_data_chunk should return chunk" (chunk /= coerce nullPtr)
 
-                                            withOwnedChunk chunk \ownedChunk -> do
-                                                c_duckdb_data_chunk_set_size ownedChunk 2
-                                                vector <- c_duckdb_data_chunk_get_vector ownedChunk 0
-                                                dataPtr <- c_duckdb_vector_get_data vector
-                                                let intPtr = castPtr dataPtr :: Ptr Int32
-                                                pokeElemOff intPtr 0 42
-                                                pokeElemOff intPtr 1 0
+                      withOwnedChunk chunk \ownedChunk -> do
+                        c_duckdb_data_chunk_set_size ownedChunk 2
+                        vector <- c_duckdb_data_chunk_get_vector ownedChunk 0
+                        dataPtr <- c_duckdb_vector_get_data vector
+                        let intPtr = coerce dataPtr :: Ptr Int32
+                        pokeElemOff intPtr 0 42
+                        pokeElemOff intPtr 1 0
 
-                                                c_duckdb_vector_ensure_validity_writable vector
-                                                maskPtr <- c_duckdb_vector_get_validity vector
-                                                assertBool "validity mask pointer should not be null" (maskPtr /= nullPtr)
-                                                c_duckdb_validity_set_row_valid maskPtr 0
-                                                c_duckdb_validity_set_row_invalid maskPtr 1
+                        c_duckdb_vector_ensure_validity_writable vector
+                        maskPtr <- c_duckdb_vector_get_validity vector
+                        assertBool "validity mask pointer should not be null" (maskPtr /= nullPtr)
+                        c_duckdb_validity_set_row_valid maskPtr 0
+                        c_duckdb_validity_set_row_invalid maskPtr 1
 
-                                                withArrowArray \arrayPtr ->
-                                                    do
-                                                        errArray <- c_duckdb_data_chunk_to_arrow arrowOpts ownedChunk (castPtr arrayPtr)
-                                                        assertNoError errArray
+                        withArrowArray \arrayPtr ->
+                          do
+                            errArray <- c_duckdb_data_chunk_to_arrow arrowOpts ownedChunk (coerce arrayPtr)
+                            assertNoError errArray
 
-                                                        array <- peek arrayPtr
-                                                        arrowArrayLength array @?= 2
-                                                        assertBool "release pointer should not be null before transfer" (arrowArrayRelease array /= nullFunPtr)
+                            array <- peek arrayPtr
+                            (getField @"length") array @?= 2
+                            assertBool "release pointer should not be null before transfer" ((getField @"release") array /= nullFunPtr)
 
-                                                        alloca \outChunkPtr -> do
-                                                            poke outChunkPtr nullPtr
-                                                            errFromArrow <- c_duckdb_data_chunk_from_arrow conn (castPtr arrayPtr) convertedSchema outChunkPtr
-                                                            assertNoError errFromArrow
-                                                            restoredChunk <- peek outChunkPtr
-                                                            assertBool "restored chunk should not be null" (restoredChunk /= nullPtr)
+                            alloca \outChunkPtr -> do
+                              poke outChunkPtr (coerce nullPtr)
+                              errFromArrow <- c_duckdb_data_chunk_from_arrow conn (coerce arrayPtr) convertedSchema outChunkPtr
+                              assertNoError errFromArrow
+                              restoredChunk <- peek outChunkPtr
+                              assertBool "restored chunk should not be null" (restoredChunk /= coerce nullPtr)
 
-                                                            withOwnedChunk restoredChunk $ \restored -> do
-                                                                restoredSize <- c_duckdb_data_chunk_get_size restored
-                                                                restoredSize @?= 2
+                              withOwnedChunk restoredChunk $ \restored -> do
+                                restoredSize <- c_duckdb_data_chunk_get_size restored
+                                restoredSize @?= 2
 
-                                                                restoredVector <- c_duckdb_data_chunk_get_vector restored 0
-                                                                restoredDataPtr <- c_duckdb_vector_get_data restoredVector
-                                                                let restoredIntPtr = castPtr restoredDataPtr :: Ptr Int32
-                                                                restoredVal <- peekElemOff restoredIntPtr 0
-                                                                restoredVal @?= 42
+                                restoredVector <- c_duckdb_data_chunk_get_vector restored 0
+                                restoredDataPtr <- c_duckdb_vector_get_data restoredVector
+                                let restoredIntPtr = coerce restoredDataPtr :: Ptr Int32
+                                restoredVal <- peekElemOff restoredIntPtr 0
+                                restoredVal @?= 42
 
-                                                                restoredMaskPtr <- c_duckdb_vector_get_validity restoredVector
-                                                                assertBool "restored validity mask pointer should not be null" (restoredMaskPtr /= nullPtr)
-                                                                restoredMaskWord <- peek restoredMaskPtr
-                                                                assertBool "first row should be valid" (testBit restoredMaskWord 0)
-                                                                assertBool "second row should be null" (not (testBit restoredMaskWord 1))
+                                restoredMaskPtr <- c_duckdb_vector_get_validity restoredVector
+                                assertBool "restored validity mask pointer should not be null" (restoredMaskPtr /= nullPtr)
+                                restoredMaskWord <- peek restoredMaskPtr
+                                assertBool "first row should be valid" (testBit restoredMaskWord 0)
+                                assertBool "second row should be null" (not (testBit restoredMaskWord 1))
 
-                                                            arrayAfter <- peek arrayPtr
-                                                            arrowArrayRelease arrayAfter @?= nullFunPtr
+                              arrayAfter <- peek arrayPtr
+                              (getField @"release") arrayAfter @?= nullFunPtr
 
 withArrowOptions :: DuckDBConnection -> (DuckDBArrowOptions -> IO a) -> IO a
 withArrowOptions conn action =
-    alloca \optsPtr -> do
-        let acquire = do
-                poke optsPtr nullPtr
-                c_duckdb_connection_get_arrow_options conn optsPtr
-                opts <- peek optsPtr
-                when (opts == nullPtr) $ assertFailure "duckdb_connection_get_arrow_options returned null"
-                pure opts
-            release _ = c_duckdb_destroy_arrow_options optsPtr
-        bracket acquire release action
+  alloca \optsPtr -> do
+    let acquire = do
+          poke optsPtr (coerce nullPtr)
+          c_duckdb_connection_get_arrow_options conn optsPtr
+          opts <- peek optsPtr
+          when (opts == coerce nullPtr) $ assertFailure "duckdb_connection_get_arrow_options returned null"
+          pure opts
+        release _ = c_duckdb_destroy_arrow_options optsPtr
+    bracket acquire release action
 
 withLogicalTypes :: [DuckDBType] -> ([DuckDBLogicalType] -> IO a) -> IO a
 withLogicalTypes [] action = action []
 withLogicalTypes (t : ts) action =
-    bracket (c_duckdb_create_logical_type t) destroyLogicalType \lt ->
-        withLogicalTypes ts \rest -> action (lt : rest)
+  bracket (c_duckdb_create_logical_type (DuckDBTypeAlias t)) destroyLogicalType \lt ->
+    withLogicalTypes ts \rest -> action (lt : rest)
 
-withColumnNames :: [String] -> (Ptr CString -> IO a) -> IO a
+withColumnNames :: [String] -> (Ptr (ConstPtr CChar) -> IO a) -> IO a
 withColumnNames names action =
-    withMany withCString names $ \cNames -> withArray cNames action
+  withMany withConstCString names $ \cNames -> withArray cNames action
 
 withArrowSchema :: (Ptr ArrowSchema -> IO a) -> IO a
 withArrowSchema action =
-    withStruct zeroArrowSchema \ptr -> action ptr `finally` releaseArrowSchema ptr
+  withStruct zeroArrowSchema \ptr -> action ptr `finally` releaseArrowSchema ptr
 
 withArrowArray :: (Ptr ArrowArray -> IO a) -> IO a
 withArrowArray action =
-    withStruct zeroArrowArray \ptr -> action ptr `finally` releaseArrowArray ptr
+  withStruct zeroArrowArray \ptr -> action ptr `finally` releaseArrowArray ptr
 
 withStruct :: (Storable a) => a -> (Ptr a -> IO b) -> IO b
 withStruct initial action =
-    alloca \ptr -> do
-        poke ptr initial
-        action ptr
+  alloca \ptr -> do
+    poke ptr initial
+    action ptr
 
 withOwnedChunk :: DuckDBDataChunk -> (DuckDBDataChunk -> IO a) -> IO a
 withOwnedChunk chunk = bracket (pure chunk) destroyChunk
 
 withConvertedSchema :: DuckDBConnection -> Ptr ArrowSchema -> (DuckDBArrowConvertedSchema -> IO a) -> IO a
 withConvertedSchema conn schemaPtr action =
-    alloca \convertedPtr -> do
-        poke convertedPtr nullPtr
-        err <- c_duckdb_schema_from_arrow conn (castPtr schemaPtr) convertedPtr
-        assertNoError err
-        converted <- peek convertedPtr
-        assertBool "converted schema pointer should not be null" (converted /= nullPtr)
-        bracket (pure converted) destroyArrowConvertedSchema action
+  alloca \convertedPtr -> do
+    poke convertedPtr (coerce nullPtr)
+    err <- c_duckdb_schema_from_arrow conn (coerce schemaPtr) convertedPtr
+    assertNoError err
+    converted <- peek convertedPtr
+    assertBool "converted schema pointer should not be null" (converted /= coerce nullPtr)
+    bracket (pure converted) destroyArrowConvertedSchema action
 
 destroyLogicalType :: DuckDBLogicalType -> IO ()
 destroyLogicalType lt =
-    alloca \ptr -> do
-        poke ptr lt
-        c_duckdb_destroy_logical_type ptr
+  alloca \ptr -> do
+    poke ptr lt
+    c_duckdb_destroy_logical_type ptr
 
 destroyChunk :: DuckDBDataChunk -> IO ()
 destroyChunk chunk =
-    alloca \ptr -> do
-        poke ptr chunk
-        c_duckdb_destroy_data_chunk ptr
+  alloca \ptr -> do
+    poke ptr chunk
+    c_duckdb_destroy_data_chunk ptr
 
 destroyArrowConvertedSchema :: DuckDBArrowConvertedSchema -> IO ()
 destroyArrowConvertedSchema schema =
-    alloca \ptr -> do
-        poke ptr schema
-        c_duckdb_destroy_arrow_converted_schema ptr
+  alloca \ptr -> do
+    poke ptr schema
+    c_duckdb_destroy_arrow_converted_schema ptr
 
 destroyErrorData :: DuckDBErrorData -> IO ()
 destroyErrorData err =
-    alloca \ptr -> do
-        poke ptr err
-        c_duckdb_destroy_error_data ptr
+  alloca \ptr -> do
+    poke ptr err
+    c_duckdb_destroy_error_data ptr
 
 assertNoError :: DuckDBErrorData -> IO ()
 assertNoError err =
-    when (err /= nullPtr) $ do
-        msgPtr <- c_duckdb_error_data_message err
-        msg <- peekCString msgPtr
-        destroyErrorData err
-        assertFailure ("DuckDB reported error: " <> msg)
+  when (err /= coerce nullPtr) $ do
+    msgPtr <- c_duckdb_error_data_message err
+    msg <- peekCString (coerce msgPtr)
+    destroyErrorData err
+    assertFailure ("DuckDB reported error: " <> msg)
 
 zeroArrowSchema :: ArrowSchema
 zeroArrowSchema =
-    ArrowSchema
-        { arrowSchemaFormat = nullPtr
-        , arrowSchemaName = nullPtr
-        , arrowSchemaMetadata = nullPtr
-        , arrowSchemaFlags = 0
-        , arrowSchemaChildCount = 0
-        , arrowSchemaChildren = nullPtr
-        , arrowSchemaDictionary = nullPtr
-        , arrowSchemaRelease = nullFunPtr
-        , arrowSchemaPrivateData = nullPtr
-        }
+  ArrowSchema
+    { format = coerce nullPtr
+    , name = coerce nullPtr
+    , metadata = coerce nullPtr
+    , flags = 0
+    , n_children = 0
+    , children = nullPtr
+    , dictionary = nullPtr
+    , release = nullFunPtr
+    , private_data = nullPtr
+    }
 
 zeroArrowArray :: ArrowArray
 zeroArrowArray =
-    ArrowArray
-        { arrowArrayLength = 0
-        , arrowArrayNullCount = 0
-        , arrowArrayOffset = 0
-        , arrowArrayBufferCount = 0
-        , arrowArrayChildCount = 0
-        , arrowArrayBuffers = nullPtr
-        , arrowArrayChildren = nullPtr
-        , arrowArrayDictionary = nullPtr
-        , arrowArrayRelease = nullFunPtr
-        , arrowArrayPrivateData = nullPtr
-        }
+  ArrowArray
+    { length = 0
+    , null_count = 0
+    , offset = 0
+    , n_buffers = 0
+    , n_children = 0
+    , buffers = nullPtr
+    , children = nullPtr
+    , dictionary = nullPtr
+    , release = nullFunPtr
+    , private_data = nullPtr
+    }
diff --git a/test/BindValuesTest.hs b/test/BindValuesTest.hs
--- a/test/BindValuesTest.hs
+++ b/test/BindValuesTest.hs
@@ -1,289 +1,290 @@
 {-# LANGUAGE BlockArguments #-}
+{-# LANGUAGE DuplicateRecordFields #-}
 {-# OPTIONS_GHC -Wno-deprecations #-}
 
 module BindValuesTest (tests) where
 
 import Control.Monad (when)
+import Data.Coerce (coerce)
 import Data.Int (Int16, Int32, Int64, Int8)
 import Data.List (intercalate)
 import Data.Time.Calendar (diffDays, fromGregorian)
 import Data.Word (Word16, Word32, Word64, Word8)
 import Database.DuckDB.FFI
-import Database.DuckDB.FFI.Deprecated
-import Foreign.C.String (peekCString, peekCStringLen, withCString)
+import Foreign.C.ConstPtr (ConstPtr (..))
+import Foreign.C.String (peekCString, peekCStringLen)
 import Foreign.C.Types (CBool (..), CDouble (..), CFloat (..))
 import Foreign.Marshal.Alloc (alloca)
 import Foreign.Marshal.Array (peekArray, withArray)
-import Foreign.Ptr (Ptr, castPtr, nullPtr)
+import Foreign.Ptr (Ptr, nullPtr)
 import Foreign.Storable (peek, poke)
 import Test.Tasty (TestTree, testGroup)
 import Test.Tasty.HUnit (assertBool, assertFailure, testCase, (@?=))
-import Utils (withConnection, withDatabase)
+import Utils (withConnection, withConstCString, withDatabase)
 
 tests :: TestTree
 tests =
-    testGroup
-        "Bind Values"
-        [bindValuesRoundtrip, bindTimestampTzAcrossSessions]
+  testGroup
+    "Bind Values"
+    [bindValuesRoundtrip, bindTimestampTzAcrossSessions]
 
-{- | Pin the session timezone so the tstz readback offset below is stable
-regardless of the host OS timezone (see issue #8).
--}
+-- | Pin the session timezone so the tstz readback offset below is stable
+-- regardless of the host OS timezone (see issue #8).
 setSessionTimeZoneSQL :: String
 setSessionTimeZoneSQL = "SET TimeZone='UTC+02:00'"
 
 bindValuesRoundtrip :: TestTree
 bindValuesRoundtrip =
-    testCase "bind every supported value type" $
-        withDatabase \db ->
-            withConnection db \conn -> do
-                withCString setSessionTimeZoneSQL \tzSQL ->
-                    alloca \resPtr -> do
-                        st <- c_duckdb_query conn tzSQL resPtr
-                        st @?= DuckDBSuccess
-                        c_duckdb_destroy_result resPtr
+  testCase "bind every supported value type" $
+    withDatabase \db ->
+      withConnection db \conn -> do
+        withConstCString setSessionTimeZoneSQL \tzSQL ->
+          alloca \resPtr -> do
+            st <- c_duckdb_query conn tzSQL resPtr
+            st @?= DuckDBSuccess
+            c_duckdb_destroy_result resPtr
 
-                withCString createSQL \ddl ->
-                    alloca \resPtr -> do
-                        st <- c_duckdb_query conn ddl resPtr
-                        st @?= DuckDBSuccess
-                        c_duckdb_destroy_result resPtr
+        withConstCString createSQL \ddl ->
+          alloca \resPtr -> do
+            st <- c_duckdb_query conn ddl resPtr
+            st @?= DuckDBSuccess
+            c_duckdb_destroy_result resPtr
 
-                -- values used for binding and verification
-                let boolValue = CBool 1
-                    tinyValue = (-5 :: Int8)
-                    smallValue = (-300 :: Int16)
-                    intValue = (-4000000 :: Int32)
-                    bigValue = (-5000000000000 :: Int64)
-                    u8Value = 200 :: Word8
-                    u16Value = 60000 :: Word16
-                    u32Value = 4000000000 :: Word32
-                    u64Value = maxBound :: Word64
-                    floatValue = CFloat 1.5
-                    doubleValue = CDouble 2.5
-                    dateDay = fromGregorian 2021 7 20
-                    epoch = fromGregorian 1970 1 1
-                    dateValue = DuckDBDate (fromIntegral (diffDays dateDay epoch))
-                    timeMicros :: Integer
-                    timeMicros = ((12 * 60 + 34) * 60 + 56) * 1000000
-                    timeValue = DuckDBTime (fromIntegral timeMicros)
-                    timestampValue = DuckDBTimestamp (fromIntegral (duckDBDateDays dateValue) * 86400000000 + fromIntegral timeMicros)
-                    intervalValue = DuckDBInterval{duckDBIntervalMonths = 0, duckDBIntervalDays = 1, duckDBIntervalMicros = 7200000000}
-                    decimalValue = DuckDBDecimal{duckDBDecimalWidth = 18, duckDBDecimalScale = 2, duckDBDecimalValue = DuckDBHugeInt{duckDBHugeIntLower = 1234567, duckDBHugeIntUpper = 0}}
-                    hugeValue = DuckDBHugeInt{duckDBHugeIntLower = 9223372036854775809, duckDBHugeIntUpper = 0}
-                    uhugeValue = DuckDBUHugeInt{duckDBUHugeIntLower = 123456789, duckDBUHugeIntUpper = 1}
-                    varcharValue = "varchar binding"
-                    varcharLenValue = "varchar length binding"
-                    blobBytes :: [Word8]
-                    blobBytes = map (fromIntegral . fromEnum) "abc"
+        -- values used for binding and verification
+        let boolValue = CBool 1
+            tinyValue = (-5 :: Int8)
+            smallValue = (-300 :: Int16)
+            intValue = (-4000000 :: Int32)
+            bigValue = (-5000000000000 :: Int64)
+            u8Value = 200 :: Word8
+            u16Value = 60000 :: Word16
+            u32Value = 4000000000 :: Word32
+            u64Value = maxBound :: Word64
+            floatValue = CFloat 1.5
+            doubleValue = CDouble 2.5
+            dateDay = fromGregorian 2021 7 20
+            epoch = fromGregorian 1970 1 1
+            dateValue = DuckDBDate (fromIntegral (diffDays dateDay epoch))
+            timeMicros :: Integer
+            timeMicros = ((12 * 60 + 34) * 60 + 56) * 1000000
+            timeValue = DuckDBTime (fromIntegral timeMicros)
+            timestampValue = DuckDBTimestamp (fromIntegral (duckDBDateDays dateValue) * 86400000000 + fromIntegral timeMicros)
+            intervalValue = DuckDBInterval{months = 0, days = 1, micros = 7200000000}
+            decimalValue = DuckDBDecimal{width = 18, scale = 2, value = DuckDBHugeInt{lower = 1234567, upper = 0}}
+            hugeValue = DuckDBHugeInt{lower = 9223372036854775809, upper = 0}
+            uhugeValue = DuckDBUHugeInt{lower = 123456789, upper = 1}
+            varcharValue = "varchar binding"
+            varcharLenValue = "varchar length binding"
+            blobBytes :: [Word8]
+            blobBytes = map (fromIntegral . fromEnum) "abc"
 
-                withCString insertSQL \cInsert ->
-                    alloca \stmtPtr -> do
-                        st <- c_duckdb_prepare conn cInsert stmtPtr
-                        stmt <- peek stmtPtr
-                        when (st /= DuckDBSuccess) $ do
-                            msg <- if stmt == nullPtr then pure "prepare failed" else c_duckdb_prepare_error stmt >>= peekCString
-                            assertFailure msg
-                        st @?= DuckDBSuccess
-                        assertBool "prepared statement should not be null" (stmt /= nullPtr)
+        withConstCString insertSQL \cInsert ->
+          alloca \stmtPtr -> do
+            st <- c_duckdb_prepare conn cInsert stmtPtr
+            stmt <- peek stmtPtr
+            when (st /= DuckDBSuccess) $ do
+              msg <- if stmt == coerce nullPtr then pure "prepare failed" else c_duckdb_prepare_error stmt >>= (peekCString . coerce)
+              assertFailure msg
+            st @?= DuckDBSuccess
+            assertBool "prepared statement should not be null" (stmt /= coerce nullPtr)
 
-                        withCString varcharValue \varcharPtr ->
-                            withCString varcharLenValue \varcharLenPtr ->
-                                withArray blobBytes \blobPtr ->
-                                    alloca \hugePtr ->
-                                        alloca \uhugePtr ->
-                                            alloca \decimalPtr ->
-                                                alloca \intervalPtr ->
-                                                    alloca \valuePtr -> do
-                                                        poke hugePtr hugeValue
-                                                        poke uhugePtr uhugeValue
-                                                        poke decimalPtr decimalValue
-                                                        poke intervalPtr intervalValue
+            withConstCString varcharValue \varcharPtr ->
+              withConstCString varcharLenValue \varcharLenPtr ->
+                withArray blobBytes \blobPtr ->
+                  alloca \hugePtr ->
+                    alloca \uhugePtr ->
+                      alloca \decimalPtr ->
+                        alloca \intervalPtr ->
+                          alloca \valuePtr -> do
+                            poke hugePtr hugeValue
+                            poke uhugePtr uhugeValue
+                            poke decimalPtr decimalValue
+                            poke intervalPtr intervalValue
 
-                                                        duckValue <- c_duckdb_create_bool boolValue
-                                                        poke valuePtr duckValue
-                                                        c_duckdb_bind_value stmt 1 duckValue >>= (@?= DuckDBSuccess)
-                                                        c_duckdb_destroy_value valuePtr
+                            duckValue <- c_duckdb_create_bool boolValue
+                            poke valuePtr duckValue
+                            c_duckdb_bind_value stmt 1 duckValue >>= (@?= DuckDBSuccess)
+                            c_duckdb_destroy_value valuePtr
 
-                                                        c_duckdb_bind_boolean stmt 2 boolValue >>= (@?= DuckDBSuccess)
-                                                        c_duckdb_bind_int8 stmt 3 tinyValue >>= (@?= DuckDBSuccess)
-                                                        c_duckdb_bind_int16 stmt 4 smallValue >>= (@?= DuckDBSuccess)
-                                                        c_duckdb_bind_int32 stmt 5 intValue >>= (@?= DuckDBSuccess)
-                                                        c_duckdb_bind_int64 stmt 6 bigValue >>= (@?= DuckDBSuccess)
-                                                        c_duckdb_bind_hugeint stmt 7 hugePtr >>= (@?= DuckDBSuccess)
-                                                        c_duckdb_bind_uint8 stmt 8 u8Value >>= (@?= DuckDBSuccess)
-                                                        c_duckdb_bind_uint16 stmt 9 u16Value >>= (@?= DuckDBSuccess)
-                                                        c_duckdb_bind_uint32 stmt 10 u32Value >>= (@?= DuckDBSuccess)
-                                                        c_duckdb_bind_uint64 stmt 11 u64Value >>= (@?= DuckDBSuccess)
-                                                        c_duckdb_bind_uhugeint stmt 12 uhugePtr >>= (@?= DuckDBSuccess)
-                                                        c_duckdb_bind_float stmt 13 floatValue >>= (@?= DuckDBSuccess)
-                                                        c_duckdb_bind_double stmt 14 doubleValue >>= (@?= DuckDBSuccess)
-                                                        c_duckdb_bind_date stmt 15 dateValue >>= (@?= DuckDBSuccess)
-                                                        c_duckdb_bind_time stmt 16 timeValue >>= (@?= DuckDBSuccess)
-                                                        c_duckdb_bind_timestamp stmt 17 timestampValue >>= (@?= DuckDBSuccess)
-                                                        c_duckdb_bind_timestamp_tz stmt 18 timestampValue >>= (@?= DuckDBSuccess)
-                                                        c_duckdb_bind_interval stmt 19 intervalPtr >>= (@?= DuckDBSuccess)
-                                                        c_duckdb_bind_decimal stmt 20 decimalPtr >>= (@?= DuckDBSuccess)
-                                                        c_duckdb_bind_varchar stmt 21 varcharPtr >>= (@?= DuckDBSuccess)
-                                                        c_duckdb_bind_varchar_length stmt 22 varcharLenPtr (fromIntegral (length varcharLenValue) :: DuckDBIdx) >>= (@?= DuckDBSuccess)
-                                                        c_duckdb_bind_blob stmt 23 (castPtr blobPtr) (fromIntegral (length blobBytes) :: DuckDBIdx) >>= (@?= DuckDBSuccess)
-                                                        c_duckdb_bind_null stmt 24 >>= (@?= DuckDBSuccess)
+                            c_duckdb_bind_boolean stmt 2 boolValue >>= (@?= DuckDBSuccess)
+                            c_duckdb_bind_int8 stmt 3 tinyValue >>= (@?= DuckDBSuccess)
+                            c_duckdb_bind_int16 stmt 4 smallValue >>= (@?= DuckDBSuccess)
+                            c_duckdb_bind_int32 stmt 5 intValue >>= (@?= DuckDBSuccess)
+                            c_duckdb_bind_int64 stmt 6 bigValue >>= (@?= DuckDBSuccess)
+                            (peek hugePtr >>= \rawValue -> c_duckdb_bind_hugeint stmt 7 rawValue) >>= (@?= DuckDBSuccess)
+                            c_duckdb_bind_uint8 stmt 8 u8Value >>= (@?= DuckDBSuccess)
+                            c_duckdb_bind_uint16 stmt 9 u16Value >>= (@?= DuckDBSuccess)
+                            c_duckdb_bind_uint32 stmt 10 u32Value >>= (@?= DuckDBSuccess)
+                            c_duckdb_bind_uint64 stmt 11 u64Value >>= (@?= DuckDBSuccess)
+                            (peek uhugePtr >>= \rawValue -> c_duckdb_bind_uhugeint stmt 12 rawValue) >>= (@?= DuckDBSuccess)
+                            c_duckdb_bind_float stmt 13 floatValue >>= (@?= DuckDBSuccess)
+                            c_duckdb_bind_double stmt 14 doubleValue >>= (@?= DuckDBSuccess)
+                            c_duckdb_bind_date stmt 15 dateValue >>= (@?= DuckDBSuccess)
+                            c_duckdb_bind_time stmt 16 timeValue >>= (@?= DuckDBSuccess)
+                            c_duckdb_bind_timestamp stmt 17 timestampValue >>= (@?= DuckDBSuccess)
+                            c_duckdb_bind_timestamp_tz stmt 18 timestampValue >>= (@?= DuckDBSuccess)
+                            (peek intervalPtr >>= \rawValue -> c_duckdb_bind_interval stmt 19 rawValue) >>= (@?= DuckDBSuccess)
+                            (peek decimalPtr >>= \rawValue -> c_duckdb_bind_decimal stmt 20 rawValue) >>= (@?= DuckDBSuccess)
+                            c_duckdb_bind_varchar stmt 21 varcharPtr >>= (@?= DuckDBSuccess)
+                            c_duckdb_bind_varchar_length stmt 22 varcharLenPtr (fromIntegral (length varcharLenValue) :: DuckDBIdx) >>= (@?= DuckDBSuccess)
+                            c_duckdb_bind_blob stmt 23 (coerce blobPtr) (fromIntegral (length blobBytes) :: DuckDBIdx) >>= (@?= DuckDBSuccess)
+                            c_duckdb_bind_null stmt 24 >>= (@?= DuckDBSuccess)
 
-                                                        alloca \execResPtr -> do
-                                                            stExec <- c_duckdb_execute_prepared stmt execResPtr
-                                                            stExec @?= DuckDBSuccess
-                                                            c_duckdb_destroy_result execResPtr
+                            alloca \execResPtr -> do
+                              stExec <- c_duckdb_execute_prepared stmt execResPtr
+                              stExec @?= DuckDBSuccess
+                              c_duckdb_destroy_result execResPtr
 
-                                                        c_duckdb_destroy_prepare stmtPtr
+                            c_duckdb_destroy_prepare stmtPtr
 
-                -- Validate inserted row
-                withCString selectSQL \cSelect ->
-                    alloca \resPtr -> do
-                        st <- c_duckdb_query conn cSelect resPtr
-                        st @?= DuckDBSuccess
+        -- Validate inserted row
+        withConstCString selectSQL \cSelect ->
+          alloca \resPtr -> do
+            st <- c_duckdb_query conn cSelect resPtr
+            st @?= DuckDBSuccess
 
-                        rowCount <- c_duckdb_row_count resPtr
-                        rowCount @?= 1
+            rowCount <- c_duckdb_row_count resPtr
+            rowCount @?= 1
 
-                        c_duckdb_value_boolean resPtr 0 0 >>= (@?= CBool 1)
-                        c_duckdb_value_boolean resPtr 1 0 >>= (@?= CBool 1)
-                        c_duckdb_value_int8 resPtr 2 0 >>= (@?= (-5 :: Int8))
-                        c_duckdb_value_int16 resPtr 3 0 >>= (@?= (-300 :: Int16))
-                        c_duckdb_value_int32 resPtr 4 0 >>= (@?= (-4000000 :: Int32))
-                        c_duckdb_value_int64 resPtr 5 0 >>= (@?= (-5000000000000 :: Int64))
+            c_duckdb_value_boolean resPtr 0 0 >>= (@?= CBool 1)
+            c_duckdb_value_boolean resPtr 1 0 >>= (@?= CBool 1)
+            c_duckdb_value_int8 resPtr 2 0 >>= (@?= (-5 :: Int8))
+            c_duckdb_value_int16 resPtr 3 0 >>= (@?= (-300 :: Int16))
+            c_duckdb_value_int32 resPtr 4 0 >>= (@?= (-4000000 :: Int32))
+            c_duckdb_value_int64 resPtr 5 0 >>= (@?= (-5000000000000 :: Int64))
 
-                        alloca \hugePtr -> do
-                            c_duckdb_value_hugeint resPtr 6 0 hugePtr
-                            peek hugePtr >>= (@?= DuckDBHugeInt{duckDBHugeIntLower = 9223372036854775809, duckDBHugeIntUpper = 0})
+            alloca \hugePtr -> do
+              c_duckdb_value_hugeint resPtr 6 0 >>= poke hugePtr
+              peek hugePtr >>= (@?= DuckDBHugeInt{lower = 9223372036854775809, upper = 0})
 
-                        c_duckdb_value_uint8 resPtr 7 0 >>= (@?= (200 :: Word8))
-                        c_duckdb_value_uint16 resPtr 8 0 >>= (@?= (60000 :: Word16))
-                        c_duckdb_value_uint32 resPtr 9 0 >>= (@?= (4000000000 :: Word32))
-                        c_duckdb_value_uint64 resPtr 10 0 >>= (@?= maxBound)
+            c_duckdb_value_uint8 resPtr 7 0 >>= (@?= (200 :: Word8))
+            c_duckdb_value_uint16 resPtr 8 0 >>= (@?= (60000 :: Word16))
+            c_duckdb_value_uint32 resPtr 9 0 >>= (@?= (4000000000 :: Word32))
+            c_duckdb_value_uint64 resPtr 10 0 >>= (@?= maxBound)
 
-                        alloca \uhugePtr -> do
-                            c_duckdb_value_uhugeint resPtr 11 0 uhugePtr
-                            peek uhugePtr >>= (@?= DuckDBUHugeInt{duckDBUHugeIntLower = 123456789, duckDBUHugeIntUpper = 1})
+            alloca \uhugePtr -> do
+              c_duckdb_value_uhugeint resPtr 11 0 >>= poke uhugePtr
+              peek uhugePtr >>= (@?= DuckDBUHugeInt{lower = 123456789, upper = 1})
 
-                        valFloat <- c_duckdb_value_float resPtr 12 0
-                        realToFrac valFloat @?= (1.5 :: Double)
-                        valDouble <- c_duckdb_value_double resPtr 13 0
-                        realToFrac valDouble @?= (2.5 :: Double)
+            valFloat <- c_duckdb_value_float resPtr 12 0
+            realToFrac valFloat @?= (1.5 :: Double)
+            valDouble <- c_duckdb_value_double resPtr 13 0
+            realToFrac valDouble @?= (2.5 :: Double)
 
-                        DuckDBDate fetchedDate <- c_duckdb_value_date resPtr 14 0
-                        fetchedDate @?= duckDBDateDays dateValue
+            DuckDBDate fetchedDate <- c_duckdb_value_date resPtr 14 0
+            fetchedDate @?= duckDBDateDays dateValue
 
-                        DuckDBTime fetchedTime <- c_duckdb_value_time resPtr 15 0
-                        fetchedTime @?= duckDBTimeMicros timeValue
+            DuckDBTime fetchedTime <- c_duckdb_value_time resPtr 15 0
+            fetchedTime @?= duckDBTimeMicros timeValue
 
-                        DuckDBTimestamp fetchedTs <- c_duckdb_value_timestamp resPtr 16 0
-                        fetchedTs @?= duckDBTimestampMicros timestampValue
+            DuckDBTimestamp fetchedTs <- c_duckdb_value_timestamp resPtr 16 0
+            fetchedTs @?= duckDBTimestampMicros timestampValue
 
-                        DuckDBTimestamp fetchedTsTz <- c_duckdb_value_timestamp resPtr 17 0
-                        let tzDifference = fetchedTsTz - duckDBTimestampMicros timestampValue
-                        tzDifference @?= 7200000000
+            DuckDBTimestamp fetchedTsTz <- c_duckdb_value_timestamp resPtr 17 0
+            let tzDifference = fetchedTsTz - duckDBTimestampMicros timestampValue
+            tzDifference @?= 7200000000
 
-                        alloca \intervalPtr -> do
-                            c_duckdb_value_interval resPtr 18 0 intervalPtr
-                            peek intervalPtr >>= (@?= intervalValue)
+            alloca \intervalPtr -> do
+              c_duckdb_value_interval resPtr 18 0 >>= poke intervalPtr
+              peek intervalPtr >>= (@?= intervalValue)
 
-                        alloca \decimalPtr -> do
-                            c_duckdb_value_decimal resPtr 19 0 decimalPtr
-                            DuckDBDecimal{duckDBDecimalWidth = width, duckDBDecimalScale = scale} <- peek decimalPtr
-                            (width, scale) @?= (18, 2)
+            alloca \decimalPtr -> do
+              c_duckdb_value_decimal resPtr 19 0 >>= poke decimalPtr
+              DuckDBDecimal{width = width, scale = scale} <- peek decimalPtr
+              (width, scale) @?= (18, 2)
 
-                        varchar <- c_duckdb_value_varchar resPtr 20 0
-                        peekCString varchar >>= (@?= varcharValue)
-                        c_duckdb_free (castPtr varchar)
+            varchar <- c_duckdb_value_varchar resPtr 20 0
+            peekCString (coerce varchar) >>= (@?= varcharValue)
+            c_duckdb_free (coerce varchar)
 
-                        alloca \stringPtr -> do
-                            c_duckdb_value_string resPtr 21 0 stringPtr
-                            DuckDBString{duckDBStringData = datPtr, duckDBStringSize = datSize} <- peek stringPtr
-                            peekCStringLen (datPtr, fromIntegral datSize) >>= (@?= varcharLenValue)
-                            when (datPtr /= nullPtr) $ c_duckdb_free (castPtr datPtr)
+            alloca \stringPtr -> do
+              c_duckdb_value_string resPtr 21 0 >>= poke stringPtr
+              DuckDBString{data' = datPtr, size = datSize} <- peek stringPtr
+              peekCStringLen (coerce datPtr, fromIntegral datSize) >>= (@?= varcharLenValue)
+              when (datPtr /= nullPtr) $ c_duckdb_free (coerce datPtr)
 
-                        alloca \blobPtr -> do
-                            c_duckdb_value_blob resPtr 22 0 blobPtr
-                            DuckDBBlob{duckDBBlobData = blobDataPtr, duckDBBlobSize = blobSize} <- peek blobPtr
-                            peekArray (fromIntegral blobSize) (castPtr blobDataPtr :: Ptr Word8) >>= (@?= blobBytes)
-                            c_duckdb_free (castPtr blobDataPtr)
+            alloca \blobPtr -> do
+              c_duckdb_value_blob resPtr 22 0 >>= poke blobPtr
+              DuckDBBlob{data' = blobDataPtr, size = blobSize} <- peek blobPtr
+              peekArray (fromIntegral blobSize) (coerce blobDataPtr :: Ptr Word8) >>= (@?= blobBytes)
+              c_duckdb_free (coerce blobDataPtr)
 
-                        c_duckdb_value_is_null resPtr 23 0 >>= (@?= CBool 1)
+            c_duckdb_value_is_null resPtr 23 0 >>= (@?= CBool 1)
 
-                        c_duckdb_destroy_result resPtr
+            c_duckdb_destroy_result resPtr
 
-                -- Named parameter index lookup (separate statement)
-                withCString "SELECT $named_param" \namedSQL ->
-                    alloca \stmtPtr -> do
-                        st <- c_duckdb_prepare conn namedSQL stmtPtr
-                        stmt <- peek stmtPtr
-                        when (st /= DuckDBSuccess) $ do
-                            errPtr <- c_duckdb_prepare_error stmt
-                            msg <- if errPtr == nullPtr then pure "prepare failed" else peekCString errPtr
-                            assertFailure msg
-                        st @?= DuckDBSuccess
-                        assertBool "named statement" (stmt /= nullPtr)
+        -- Named parameter index lookup (separate statement)
+        withConstCString "SELECT $named_param" \namedSQL ->
+          alloca \stmtPtr -> do
+            st <- c_duckdb_prepare conn namedSQL stmtPtr
+            stmt <- peek stmtPtr
+            when (st /= DuckDBSuccess) $ do
+              errPtr <- c_duckdb_prepare_error stmt
+              msg <- if errPtr == coerce nullPtr then pure "prepare failed" else peekCString (coerce errPtr)
+              assertFailure msg
+            st @?= DuckDBSuccess
+            assertBool "named statement" (stmt /= coerce nullPtr)
 
-                        alloca \idxPtr -> do
-                            stIdx <- withCString "named_param" $ \name -> c_duckdb_bind_parameter_index stmt idxPtr name
-                            when (stIdx /= DuckDBSuccess) $ do
-                                errPtr <- c_duckdb_prepare_error stmt
-                                msg <- if errPtr == nullPtr then pure "bind_parameter_index failed" else peekCString errPtr
-                                assertFailure msg
-                            stIdx @?= DuckDBSuccess
-                            idx <- peek idxPtr
-                            idx @?= 1
-                            bindState <- c_duckdb_bind_int32 stmt idx 42
-                            when (bindState /= DuckDBSuccess) $ do
-                                errPtr <- c_duckdb_prepare_error stmt
-                                msg <- if errPtr == nullPtr then pure "bind failed" else peekCString errPtr
-                                assertFailure msg
-                            bindState @?= DuckDBSuccess
+            alloca \idxPtr -> do
+              stIdx <- withConstCString "named_param" $ \name -> c_duckdb_bind_parameter_index stmt idxPtr name
+              when (stIdx /= DuckDBSuccess) $ do
+                errPtr <- c_duckdb_prepare_error stmt
+                msg <- if errPtr == coerce nullPtr then pure "bind_parameter_index failed" else peekCString (coerce errPtr)
+                assertFailure msg
+              stIdx @?= DuckDBSuccess
+              idx <- peek idxPtr
+              idx @?= 1
+              bindState <- c_duckdb_bind_int32 stmt idx 42
+              when (bindState /= DuckDBSuccess) $ do
+                errPtr <- c_duckdb_prepare_error stmt
+                msg <- if errPtr == coerce nullPtr then pure "bind failed" else peekCString (coerce errPtr)
+                assertFailure msg
+              bindState @?= DuckDBSuccess
 
-                        alloca \execResPtr -> do
-                            stExec <- c_duckdb_execute_prepared stmt execResPtr
-                            stExec @?= DuckDBSuccess
-                            c_duckdb_row_count execResPtr >>= (@?= 1)
-                            c_duckdb_value_int32 execResPtr 0 0 >>= (@?= 42)
-                            c_duckdb_destroy_result execResPtr
+            alloca \execResPtr -> do
+              stExec <- c_duckdb_execute_prepared stmt execResPtr
+              stExec @?= DuckDBSuccess
+              c_duckdb_row_count execResPtr >>= (@?= 1)
+              c_duckdb_value_int32 execResPtr 0 0 >>= (@?= 42)
+              c_duckdb_destroy_result execResPtr
 
-                        c_duckdb_destroy_prepare stmtPtr
+            c_duckdb_destroy_prepare stmtPtr
   where
     createSQL =
-        "CREATE TABLE bind_values ("
-            <> "via_value BOOLEAN,"
-            <> "bool_col BOOLEAN,"
-            <> "tiny_col TINYINT,"
-            <> "small_col SMALLINT,"
-            <> "int_col INTEGER,"
-            <> "big_col BIGINT,"
-            <> "huge_col HUGEINT,"
-            <> "uint8_col UTINYINT,"
-            <> "uint16_col USMALLINT,"
-            <> "uint32_col UINTEGER,"
-            <> "uint64_col UBIGINT,"
-            <> "uhuge_col HUGEINT,"
-            <> "float_col FLOAT,"
-            <> "double_col DOUBLE,"
-            <> "date_col DATE,"
-            <> "time_col TIME,"
-            <> "ts_col TIMESTAMP,"
-            <> "tstz_col TIMESTAMPTZ,"
-            <> "interval_col INTERVAL,"
-            <> "decimal_col DECIMAL(18,2),"
-            <> "varchar_col VARCHAR,"
-            <> "varchar_len_col VARCHAR,"
-            <> "blob_col BLOB,"
-            <> "named_null INTEGER"
-            <> ")"
+      "CREATE TABLE bind_values ("
+        <> "via_value BOOLEAN,"
+        <> "bool_col BOOLEAN,"
+        <> "tiny_col TINYINT,"
+        <> "small_col SMALLINT,"
+        <> "int_col INTEGER,"
+        <> "big_col BIGINT,"
+        <> "huge_col HUGEINT,"
+        <> "uint8_col UTINYINT,"
+        <> "uint16_col USMALLINT,"
+        <> "uint32_col UINTEGER,"
+        <> "uint64_col UBIGINT,"
+        <> "uhuge_col HUGEINT,"
+        <> "float_col FLOAT,"
+        <> "double_col DOUBLE,"
+        <> "date_col DATE,"
+        <> "time_col TIME,"
+        <> "ts_col TIMESTAMP,"
+        <> "tstz_col TIMESTAMPTZ,"
+        <> "interval_col INTERVAL,"
+        <> "decimal_col DECIMAL(18,2),"
+        <> "varchar_col VARCHAR,"
+        <> "varchar_len_col VARCHAR,"
+        <> "blob_col BLOB,"
+        <> "named_null INTEGER"
+        <> ")"
 
     insertSQL =
-        "INSERT INTO bind_values VALUES ("
-            <> intercalate ", " (replicate 24 "?")
-            <> ")"
+      "INSERT INTO bind_values VALUES ("
+        <> intercalate ", " (replicate 24 "?")
+        <> ")"
 
     -- Cast tstz_col back to TIMESTAMP so the deprecated safe-fetch
-    -- 'c_duckdb_value_timestamp' can read it; the cast uses the pinned
+    -- 'duckdb_value_timestamp' can read it; the cast uses the pinned
     -- session TimeZone above, yielding bound + 02:00.
     selectSQL = "SELECT * REPLACE (tstz_col::TIMESTAMP AS tstz_col) FROM bind_values"
 
@@ -291,64 +292,63 @@
     duckDBTimeMicros (DuckDBTime t) = t
     duckDBTimestampMicros (DuckDBTimestamp t) = t
 
-{- | Regression test for issue #8: reading a TIMESTAMPTZ column via
-'c_duckdb_value_timestamp' converts to the session's TimeZone, so the
-offset between the bound UTC instant and the readback must track the
-session's TimeZone setting — not the host OS timezone.
--}
+-- | Regression test for issue #8: reading a TIMESTAMPTZ column via
+-- 'duckdb_value_timestamp' converts to the session's TimeZone, so the
+-- offset between the bound UTC instant and the readback must track the
+-- session's TimeZone setting — not the host OS timezone.
 bindTimestampTzAcrossSessions :: TestTree
 bindTimestampTzAcrossSessions =
-    testCase "bind_timestamp_tz readback tracks session TimeZone" $
-        withDatabase \db ->
-            withConnection db \conn -> do
-                withCString "CREATE TABLE tstz_only (ts TIMESTAMPTZ)" \ddl ->
-                    alloca \resPtr -> do
-                        c_duckdb_query conn ddl resPtr >>= (@?= DuckDBSuccess)
-                        c_duckdb_destroy_result resPtr
+  testCase "bind_timestamp_tz readback tracks session TimeZone" $
+    withDatabase \db ->
+      withConnection db \conn -> do
+        withConstCString "CREATE TABLE tstz_only (ts TIMESTAMPTZ)" \ddl ->
+          alloca \resPtr -> do
+            c_duckdb_query conn ddl resPtr >>= (@?= DuckDBSuccess)
+            c_duckdb_destroy_result resPtr
 
-                -- A fixed UTC instant: 2021-07-20 12:34:56 UTC
-                let boundMicros :: Int64
-                    boundMicros =
-                        fromIntegral (diffDays (fromGregorian 2021 7 20) (fromGregorian 1970 1 1))
-                            * 86400000000
-                            + ((12 * 60 + 34) * 60 + 56) * 1000000
-                    bound = DuckDBTimestamp boundMicros
+        -- A fixed UTC instant: 2021-07-20 12:34:56 UTC
+        let boundMicros :: Int64
+            boundMicros =
+              fromIntegral (diffDays (fromGregorian 2021 7 20) (fromGregorian 1970 1 1))
+                * 86400000000
+                + ((12 * 60 + 34) * 60 + 56) * 1000000
+            bound = DuckDBTimestamp boundMicros
 
-                withCString "INSERT INTO tstz_only VALUES (?)" \cInsert ->
-                    alloca \stmtPtr -> do
-                        c_duckdb_prepare conn cInsert stmtPtr >>= (@?= DuckDBSuccess)
-                        stmt <- peek stmtPtr
-                        c_duckdb_bind_timestamp_tz stmt 1 bound >>= (@?= DuckDBSuccess)
-                        alloca \execResPtr -> do
-                            c_duckdb_execute_prepared stmt execResPtr >>= (@?= DuckDBSuccess)
-                            c_duckdb_destroy_result execResPtr
-                        c_duckdb_destroy_prepare stmtPtr
+        withConstCString "INSERT INTO tstz_only VALUES (?)" \cInsert ->
+          alloca \stmtPtr -> do
+            c_duckdb_prepare conn cInsert stmtPtr >>= (@?= DuckDBSuccess)
+            stmt <- peek stmtPtr
+            c_duckdb_bind_timestamp_tz stmt 1 bound >>= (@?= DuckDBSuccess)
+            alloca \execResPtr -> do
+              c_duckdb_execute_prepared stmt execResPtr >>= (@?= DuckDBSuccess)
+              c_duckdb_destroy_result execResPtr
+            c_duckdb_destroy_prepare stmtPtr
 
-                -- For each session TimeZone, the readback wall-clock should be
-                -- bound + offset, independent of the host OS TZ.
-                let cases :: [(String, Int64)]
-                    cases =
-                        [ ("UTC", 0)
-                        , ("UTC+02:00", 2 * 3600 * 1000000)
-                        , ("UTC-05:00", (-5) * 3600 * 1000000)
-                        , ("Etc/GMT-2", 2 * 3600 * 1000000)
-                        ]
+        -- For each session TimeZone, the readback wall-clock should be
+        -- bound + offset, independent of the host OS TZ.
+        let cases :: [(String, Int64)]
+            cases =
+              [ ("UTC", 0)
+              , ("UTC+02:00", 2 * 3600 * 1000000)
+              , ("UTC-05:00", (-5) * 3600 * 1000000)
+              , ("Etc/GMT-2", 2 * 3600 * 1000000)
+              ]
 
-                mapM_ (assertTimeZoneOffset conn boundMicros) cases
+        mapM_ (assertTimeZoneOffset conn boundMicros) cases
   where
     assertTimeZoneOffset conn boundMicros (tz, expected) = do
-        withCString ("SET TimeZone='" <> tz <> "'") \setTzSQL ->
-            alloca \resPtr -> do
-                c_duckdb_query conn setTzSQL resPtr >>= (@?= DuckDBSuccess)
-                c_duckdb_destroy_result resPtr
+      withConstCString ("SET TimeZone='" <> tz <> "'") \setTzSQL ->
+        alloca \resPtr -> do
+          c_duckdb_query conn setTzSQL resPtr >>= (@?= DuckDBSuccess)
+          c_duckdb_destroy_result resPtr
 
-        -- Cast TIMESTAMPTZ → TIMESTAMP in-query; the cast uses the
-        -- session TimeZone just set, so the wall-clock readback carries
-        -- the expected offset.
-        withCString "SELECT ts::TIMESTAMP FROM tstz_only" \cSelect ->
-            alloca \resPtr -> do
-                c_duckdb_query conn cSelect resPtr >>= (@?= DuckDBSuccess)
-                DuckDBTimestamp fetched <- c_duckdb_value_timestamp resPtr 0 0
-                let msg = "TimeZone=" <> tz <> ": expected offset " <> show expected
-                assertBool msg (fetched - boundMicros == expected)
-                c_duckdb_destroy_result resPtr
+      -- Cast TIMESTAMPTZ → TIMESTAMP in-query; the cast uses the
+      -- session TimeZone just set, so the wall-clock readback carries
+      -- the expected offset.
+      withConstCString "SELECT ts::TIMESTAMP FROM tstz_only" \cSelect ->
+        alloca \resPtr -> do
+          c_duckdb_query conn cSelect resPtr >>= (@?= DuckDBSuccess)
+          DuckDBTimestamp fetched <- c_duckdb_value_timestamp resPtr 0 0
+          let msg = "TimeZone=" <> tz <> ": expected offset " <> show expected
+          assertBool msg (fetched - boundMicros == expected)
+          c_duckdb_destroy_result resPtr
diff --git a/test/CastFunctionsTest.hs b/test/CastFunctionsTest.hs
--- a/test/CastFunctionsTest.hs
+++ b/test/CastFunctionsTest.hs
@@ -1,146 +1,157 @@
 {-# LANGUAGE BlockArguments #-}
-{-# LANGUAGE ForeignFunctionInterface #-}
 {-# LANGUAGE NamedFieldPuns #-}
 {-# OPTIONS_GHC -Wno-deprecations #-}
 
 module CastFunctionsTest (tests) where
 
 import Control.Exception (bracket)
-import Control.Monad (when)
+import Control.Monad (forM_, when)
+import Data.Coerce (coerce)
 import Data.IORef (IORef, newIORef, readIORef, writeIORef)
 import Data.Int (Int32)
 import Data.List (isInfixOf)
 import Database.DuckDB.FFI
-import Database.DuckDB.FFI.Deprecated
-import Foreign.C.String (peekCString, withCString, withCStringLen)
+import Foreign.C.ConstPtr (ConstPtr (..))
+import Foreign.C.String (peekCString, withCStringLen)
 import Foreign.C.Types (CBool (..))
 import Foreign.Marshal.Alloc (alloca)
-import Foreign.Ptr (Ptr, castPtr, freeHaskellFunPtr, nullFunPtr, nullPtr)
+import Foreign.Ptr (Ptr, freeHaskellFunPtr, nullFunPtr, nullPtr)
 import Foreign.StablePtr (StablePtr, castPtrToStablePtr, castStablePtrToPtr, deRefStablePtr, freeStablePtr, newStablePtr)
 import Foreign.Storable (peekElemOff, poke)
+import HsBindgen.Runtime.Support.FunPtr (toFunPtr)
 import Test.Tasty (TestTree, testGroup)
 import Test.Tasty.HUnit (assertBool, testCase, (@?=))
-import Utils (withConnection, withDatabase, withLogicalType, withResult)
+import Utils (withConnection, withConstCString, withDatabase, withLogicalType, withResult)
 
 data CastHarness = CastHarness
-    { chLastMode :: IO DuckDBCastMode
-    , chExtraSeen :: IO Bool
-    }
+  { chLastMode :: IO DuckDBCastMode
+  , chExtraSeen :: IO Bool
+  }
 
 tests :: TestTree
 tests =
-    testGroup
-        "Cast Functions"
-        [ castFunctionOverridesBuiltin
-        , castFunctionReportsErrors
-        , castFunctionTryMode
-        ]
+  testGroup
+    "Cast Functions"
+    [ castFunctionOverridesBuiltin
+    , castFunctionReportsErrors
+    , castFunctionTryMode
+    ]
 
 castFunctionOverridesBuiltin :: TestTree
 castFunctionOverridesBuiltin =
-    testCase "custom cast overrides builtin conversion" $
-        withDatabase \db ->
-            withConnection db \conn ->
-                withTestCast conn \_ -> do
-                    withResult conn "SELECT CAST(v AS VARCHAR) FROM (VALUES (1), (5)) AS t(v)" \resPtr -> do
-                        fetchString resPtr 0 0 >>= (@?= "value: 1")
-                        fetchString resPtr 0 1 >>= (@?= "value: 5")
-                        errPtr <- c_duckdb_result_error resPtr
-                        errPtr @?= nullPtr
+  testCase "custom cast overrides builtin conversion" $
+    withDatabase \db ->
+      withConnection db \conn ->
+        withTestCast conn Nothing \_ -> do
+          withResult conn "SELECT CAST(v AS VARCHAR) FROM (VALUES (1), (5)) AS t(v)" \resPtr -> do
+            fetchString resPtr 0 0 >>= (@?= "value: 1")
+            fetchString resPtr 0 1 >>= (@?= "value: 5")
+            errPtr <- c_duckdb_result_error resPtr
+            errPtr @?= coerce nullPtr
 
+-- In DuckDB 2.0.0, a failing cast between types that DuckDB plans as infallible, for example INTEGER to VARCHAR,
+-- gives an INTERNAL error and invalidates the database. The V1 API cannot choose the error type, so the target is a custom type.
 castFunctionReportsErrors :: TestTree
 castFunctionReportsErrors =
-    testCase "cast failure surfaces error message" $
-        withDatabase \db ->
-            withConnection db \conn ->
-                withTestCast conn \_ ->
-                    withCString "SELECT CAST(v AS VARCHAR) FROM (VALUES (-7)) AS t(v)" \sql ->
-                        alloca \resPtr -> do
-                            state <- c_duckdb_query conn sql resPtr
-                            state @?= DuckDBError
-                            errPtr <- c_duckdb_result_error resPtr
-                            assertBool "expected error pointer" (errPtr /= nullPtr)
-                            errMsg <- peekCString errPtr
-                            assertBool "error message should mention negative" ("negative" `isInfixOf` errMsg)
-                            c_duckdb_destroy_result resPtr
+  testCase "a cast failure to a custom type reports the message" $
+    withDatabase \db ->
+      withConnection db \conn ->
+        withTestCast conn (Just "checked_text") \_ ->
+          withConstCString "SELECT CAST(v AS checked_text) FROM (VALUES (-7)) AS t(v)" \sql ->
+            alloca \resPtr -> do
+              state <- c_duckdb_query conn sql resPtr
+              state @?= DuckDBError
+              errPtr <- c_duckdb_result_error resPtr
+              assertBool "expected error pointer" (errPtr /= coerce nullPtr)
+              errMsg <- peekCString (coerce errPtr)
+              assertBool "error message should mention negative" ("negative" `isInfixOf` errMsg)
+              c_duckdb_destroy_result resPtr
+              -- The connection runs the next statement.
+              withResult conn "SELECT 42" \_ -> pure ()
 
 castFunctionTryMode :: TestTree
 castFunctionTryMode =
-    testCase "try_cast produces null rows and reports try mode" $
-        withDatabase \db ->
-            withConnection db \conn ->
-                withTestCast conn \CastHarness{chLastMode, chExtraSeen} -> do
-                    withResult conn "SELECT TRY_CAST(v AS VARCHAR) FROM (VALUES (2), (-3)) AS t(v)" \resPtr -> do
-                        fetchString resPtr 0 0 >>= (@?= "value: 2")
-                        c_duckdb_value_is_null resPtr 0 1 >>= (@?= CBool 1)
-                        errPtr <- c_duckdb_result_error resPtr
-                        errPtr @?= nullPtr
-                    chLastMode >>= (@?= DuckDBCastTry)
-                    chExtraSeen >>= (@?= True)
+  testCase "try_cast produces null rows and reports try mode" $
+    withDatabase \db ->
+      withConnection db \conn ->
+        withTestCast conn Nothing \CastHarness{chLastMode, chExtraSeen} -> do
+          withResult conn "SELECT TRY_CAST(v AS VARCHAR) FROM (VALUES (2), (-3)) AS t(v)" \resPtr -> do
+            fetchString resPtr 0 0 >>= (@?= "value: 2")
+            c_duckdb_value_is_null resPtr 0 1 >>= (@?= CBool 1)
+            errPtr <- c_duckdb_result_error resPtr
+            errPtr @?= coerce nullPtr
+          chLastMode >>= (@?= DuckDBCastTry)
+          chExtraSeen >>= (@?= True)
 
 -- Harness ------------------------------------------------------------------
 
-withTestCast :: DuckDBConnection -> (CastHarness -> IO a) -> IO a
-withTestCast conn action = do
-    modeRef <- newIORef DuckDBCastNormal
-    extraSeenRef <- newIORef False
-    prefixStable <- newStablePtr ("value: " :: String)
-    castFunPtr <- mkCastFun (castCallback modeRef extraSeenRef prefixStable)
-    result <-
-        withCastFunction \castFun ->
-            withLogicalType (c_duckdb_create_logical_type DuckDBTypeInteger) \sourceType ->
-                withLogicalType (c_duckdb_create_logical_type DuckDBTypeVarchar) \targetType -> do
-                    c_duckdb_cast_function_set_source_type castFun sourceType
-                    c_duckdb_cast_function_set_target_type castFun targetType
-                    c_duckdb_cast_function_set_implicit_cast_cost castFun 0
-                    c_duckdb_cast_function_set_extra_info castFun (castStablePtrToPtr prefixStable) nullFunPtr
-                    c_duckdb_cast_function_set_function castFun castFunPtr
-                    c_duckdb_register_cast_function conn castFun >>= (@?= DuckDBSuccess)
-                    action
-                        CastHarness
-                            { chLastMode = readIORef modeRef
-                            , chExtraSeen = readIORef extraSeenRef
-                            }
-    freeHaskellFunPtr castFunPtr
-    freeStablePtr prefixStable
-    pure result
+-- | Register a cast from INTEGER to VARCHAR, or to a custom type with the given
+-- name and the base type VARCHAR.
+withTestCast :: DuckDBConnection -> Maybe String -> (CastHarness -> IO a) -> IO a
+withTestCast conn targetAlias action = do
+  modeRef <- newIORef DuckDBCastNormal
+  extraSeenRef <- newIORef False
+  prefixStable <- newStablePtr ("value: " :: String)
+  castFunPtr <- mkCastFun (castCallback modeRef extraSeenRef prefixStable)
+  result <-
+    withCastFunction \castFun ->
+      withLogicalType (c_duckdb_create_logical_type (DuckDBTypeAlias DuckDBTypeInteger)) \sourceType ->
+        withLogicalType (c_duckdb_create_logical_type (DuckDBTypeAlias DuckDBTypeVarchar)) \targetType -> do
+          forM_ targetAlias \alias -> do
+            withConstCString alias (c_duckdb_logical_type_set_alias targetType)
+            c_duckdb_register_logical_type conn targetType (coerce nullPtr) >>= (@?= DuckDBSuccess)
+          c_duckdb_cast_function_set_source_type castFun sourceType
+          c_duckdb_cast_function_set_target_type castFun targetType
+          c_duckdb_cast_function_set_implicit_cast_cost castFun 0
+          c_duckdb_cast_function_set_extra_info castFun ((coerce . castStablePtrToPtr) prefixStable) (coerce nullFunPtr)
+          c_duckdb_cast_function_set_function castFun castFunPtr
+          c_duckdb_register_cast_function conn castFun >>= (@?= DuckDBSuccess)
+          action
+            CastHarness
+              { chLastMode = readIORef modeRef
+              , chExtraSeen = readIORef extraSeenRef
+              }
+  freeHaskellFunPtr (coerce castFunPtr)
+  freeStablePtr prefixStable
+  pure result
 
-castCallback :: IORef DuckDBCastMode -> IORef Bool -> StablePtr String -> DuckDBFunctionInfo -> DuckDBIdx -> DuckDBVector -> DuckDBVector -> IO CBool
+castCallback
+  :: IORef DuckDBCastMode -> IORef Bool -> StablePtr String -> DuckDBFunctionInfo -> DuckDBIdx -> DuckDBVector -> DuckDBVector -> IO CBool
 castCallback modeRef extraSeenRef prefixStable info count inputVec outputVec = do
-    actualPtr <- c_duckdb_cast_function_get_extra_info info
-    when (actualPtr == castStablePtrToPtr prefixStable) $ writeIORef extraSeenRef True
-    prefix <-
-        if actualPtr == nullPtr
-            then pure "value: "
-            else deRefStablePtr (castPtrToStablePtr actualPtr)
-    mode <- c_duckdb_cast_function_get_cast_mode info
-    writeIORef modeRef mode
-    inputData <- c_duckdb_vector_get_data inputVec
-    c_duckdb_vector_ensure_validity_writable outputVec
-    let inPtr = castPtr inputData :: Ptr Int32
-        rowCount = fromIntegral count :: Int
-    success <- processRows prefix mode inPtr outputVec 0 rowCount
-    pure (if success then CBool 1 else CBool 0)
+  actualPtr <- c_duckdb_cast_function_get_extra_info info
+  when (actualPtr == (coerce . castStablePtrToPtr) prefixStable) $ writeIORef extraSeenRef True
+  prefix <-
+    if actualPtr == nullPtr
+      then pure "value: "
+      else deRefStablePtr ((castPtrToStablePtr . coerce) actualPtr)
+  mode <- c_duckdb_cast_function_get_cast_mode info
+  writeIORef modeRef mode
+  inputData <- c_duckdb_vector_get_data inputVec
+  c_duckdb_vector_ensure_validity_writable outputVec
+  let inPtr = coerce inputData :: Ptr Int32
+      rowCount = fromIntegral count :: Int
+  success <- processRows prefix mode inPtr outputVec 0 rowCount
+  pure (if success then CBool 1 else CBool 0)
   where
     processRows :: String -> DuckDBCastMode -> Ptr Int32 -> DuckDBVector -> Int -> Int -> IO Bool
     processRows prefix mode inPtr outVec idx total
-        | idx >= total = pure True
-        | otherwise = do
-            val <- peekElemOff inPtr idx
-            if val < 0
-                then withCString "negative values not allowed" \errMsg ->
-                    if mode == DuckDBCastTry
-                        then do
-                            c_duckdb_cast_function_set_row_error info errMsg (fromIntegral idx) outVec
-                            processRows prefix mode inPtr outVec (idx + 1) total
-                        else do
-                            c_duckdb_cast_function_set_error info errMsg
-                            pure False
+      | idx >= total = pure True
+      | otherwise = do
+          val <- peekElemOff inPtr idx
+          if val < 0
+            then withConstCString "negative values not allowed" \errMsg ->
+              if mode == DuckDBCastTry
+                then do
+                  c_duckdb_cast_function_set_row_error info errMsg (fromIntegral idx) outVec
+                  processRows prefix mode inPtr outVec (idx + 1) total
                 else do
-                    let rendered = prefix ++ show val
-                    withCStringLen rendered \(cStr, len) ->
-                        c_duckdb_vector_assign_string_element_len outVec (fromIntegral idx) cStr (fromIntegral len)
-                    processRows prefix mode inPtr outVec (idx + 1) total
+                  c_duckdb_cast_function_set_error info errMsg
+                  pure False
+            else do
+              let rendered = prefix ++ show val
+              withCStringLen rendered \(cStr, len) ->
+                c_duckdb_vector_assign_string_element_len outVec (fromIntegral idx) (coerce cStr) (fromIntegral len)
+              processRows prefix mode inPtr outVec (idx + 1) total
 
 -- Helpers ------------------------------------------------------------------
 
@@ -151,12 +162,12 @@
 
 fetchString :: Ptr DuckDBResult -> DuckDBIdx -> DuckDBIdx -> IO String
 fetchString resPtr col row = do
-    cStr <- c_duckdb_value_varchar resPtr col row
-    value <- peekCString cStr
-    c_duckdb_free (castPtr cStr)
-    pure value
+  cStr <- c_duckdb_value_varchar resPtr col row
+  value <- peekCString (coerce cStr)
+  c_duckdb_free (coerce cStr)
+  pure value
 
 -- Wrapper constructors ------------------------------------------------------
 
-foreign import ccall "wrapper"
-    mkCastFun :: (DuckDBFunctionInfo -> DuckDBIdx -> DuckDBVector -> DuckDBVector -> IO CBool) -> IO DuckDBCastFunctionFun
+mkCastFun :: (DuckDBFunctionInfo -> DuckDBIdx -> DuckDBVector -> DuckDBVector -> IO CBool) -> IO DuckDBCastFunctionFun
+mkCastFun = fmap DuckDBCastFunctionFun . toFunPtr . DuckDBCastFunctionFun_Aux
diff --git a/test/ConfigurationTest.hs b/test/ConfigurationTest.hs
--- a/test/ConfigurationTest.hs
+++ b/test/ConfigurationTest.hs
@@ -2,45 +2,48 @@
 
 module ConfigurationTest (tests) where
 
+import Data.Coerce (coerce)
 import Database.DuckDB.FFI
-import Foreign.C.String (peekCString, withCString)
+import Foreign.C.ConstPtr (ConstPtr (..))
+import Foreign.C.String (peekCString)
 import Foreign.Marshal.Alloc (alloca)
 import Foreign.Ptr (nullPtr)
 import Foreign.Storable (peek)
 import Test.Tasty (TestTree, testGroup)
 import Test.Tasty.HUnit (assertBool, testCase, (@?=))
+import Utils (withConstCString)
 
 tests :: TestTree
 tests =
-    testGroup
-        "Configuration"
-        [configurationLifecycle]
+  testGroup
+    "Configuration"
+    [configurationLifecycle]
 
 configurationLifecycle :: TestTree
 configurationLifecycle =
-    testCase "create, inspect, mutate, and destroy configuration" $
-        alloca \configPtr -> do
-            state <- c_duckdb_create_config configPtr
-            state @?= DuckDBSuccess
+  testCase "create, inspect, mutate, and destroy configuration" $
+    alloca \configPtr -> do
+      state <- c_duckdb_create_config configPtr
+      state @?= DuckDBSuccess
 
-            config <- peek configPtr
-            assertBool "config pointer should not be null" (config /= nullPtr)
+      config <- peek configPtr
+      assertBool "config pointer should not be null" (config /= coerce nullPtr)
 
-            count <- c_duckdb_config_count
-            assertBool "config flag count should be > 0" (count > 0)
+      count <- c_duckdb_config_count
+      assertBool "config flag count should be > 0" (count > 0)
 
-            alloca \namePtr -> alloca \descPtr -> do
-                flagState <- c_duckdb_get_config_flag 0 namePtr descPtr
-                flagState @?= DuckDBSuccess
-                flagName <- peek namePtr >>= peekCString
-                flagDesc <- peek descPtr >>= peekCString
-                assertBool "flag name should not be empty" (not (null flagName))
-                assertBool "flag description should not be empty" (not (null flagDesc))
+      alloca \namePtr -> alloca \descPtr -> do
+        flagState <- c_duckdb_get_config_flag 0 namePtr descPtr
+        flagState @?= DuckDBSuccess
+        flagName <- peek namePtr >>= (peekCString . coerce)
+        flagDesc <- peek descPtr >>= (peekCString . coerce)
+        assertBool "flag name should not be empty" (not (null flagName))
+        assertBool "flag description should not be empty" (not (null flagDesc))
 
-            setState <-
-                withCString "access_mode" \flag ->
-                    withCString "READ_WRITE" $ \value ->
-                        c_duckdb_set_config config flag value
-            setState @?= DuckDBSuccess
+      setState <-
+        withConstCString "access_mode" \flag ->
+          withConstCString "READ_WRITE" $ \value ->
+            c_duckdb_set_config config flag value
+      setState @?= DuckDBSuccess
 
-            c_duckdb_destroy_config configPtr
+      c_duckdb_destroy_config configPtr
diff --git a/test/DataChunkTest.hs b/test/DataChunkTest.hs
--- a/test/DataChunkTest.hs
+++ b/test/DataChunkTest.hs
@@ -1,15 +1,20 @@
 {-# LANGUAGE BlockArguments #-}
+{-# LANGUAGE DataKinds #-}
+{-# LANGUAGE DuplicateRecordFields #-}
+{-# LANGUAGE TypeApplications #-}
 
 module DataChunkTest (tests) where
 
 import Control.Exception (bracket)
 import Control.Monad (forM_, void, when, (>=>))
+import Data.Coerce (coerce)
 import Data.Int (Int32)
 import Database.DuckDB.FFI
 import Foreign.Marshal.Alloc (alloca)
-import Foreign.Marshal.Array (withArray)
-import Foreign.Ptr (Ptr, castPtr, nullPtr, plusPtr)
-import Foreign.Storable (peek, poke, sizeOf)
+import Foreign.Marshal.Array (advancePtr, withArray)
+import Foreign.Ptr (Ptr, nullPtr)
+import Foreign.Storable (peek, poke)
+import GHC.Records (getField)
 import Test.Tasty (TestTree, testGroup)
 import Test.Tasty.HUnit (testCase, (@?=))
 import Utils (setAllValid, withLogicalType)
@@ -17,49 +22,49 @@
 -- | Entry point for the Data Chunk focused tests.
 tests :: TestTree
 tests =
-    testGroup
-        "Data Chunk Interface"
-        [ dataChunkLifecycle
-        , dataChunkReset
-        ]
+  testGroup
+    "Data Chunk Interface"
+    [ dataChunkLifecycle
+    , dataChunkReset
+    ]
 
 -- | Populate an integer chunk and verify the stored sequence.
 dataChunkLifecycle :: TestTree
 dataChunkLifecycle =
-    testCase "create chunk, fill via vector, and read back" $ do
-        withIntegerLogicalType \intType ->
-            withArray [intType] \typeArray ->
-                withDataChunk (c_duckdb_create_data_chunk typeArray 1) \chunk -> do
-                    c_duckdb_data_chunk_get_column_count chunk >>= (@?= 1)
+  testCase "create chunk, fill via vector, and read back" $ do
+    withIntegerLogicalType \intType ->
+      withArray [intType] \typeArray ->
+        withDataChunk (c_duckdb_create_data_chunk typeArray 1) \chunk -> do
+          c_duckdb_data_chunk_get_column_count chunk >>= (@?= 1)
 
-                    vec <- c_duckdb_data_chunk_get_vector chunk 0
-                    fillVectorWithSequence vec [1 .. 4]
-                    c_duckdb_data_chunk_set_size chunk 4
+          vec <- c_duckdb_data_chunk_get_vector chunk 0
+          fillVectorWithSequence vec [1 .. 4]
+          c_duckdb_data_chunk_set_size chunk 4
 
-                    verifyChunkContents chunk [1 .. 4]
+          verifyChunkContents chunk [1 .. 4]
 
 -- | Resetting should zero the size yet keep buffers reusable.
 dataChunkReset :: TestTree
 dataChunkReset =
-    testCase "reset clears size and keeps vectors reusable" $ do
-        withIntegerLogicalType \intType ->
-            withArray [intType] \typeArray ->
-                withDataChunk (c_duckdb_create_data_chunk typeArray 1) \chunk -> do
-                    vec <- c_duckdb_data_chunk_get_vector chunk 0
-                    fillVectorWithSequence vec [10, 20, 30]
-                    c_duckdb_data_chunk_set_size chunk 3
+  testCase "reset clears size and keeps vectors reusable" $ do
+    withIntegerLogicalType \intType ->
+      withArray [intType] \typeArray ->
+        withDataChunk (c_duckdb_create_data_chunk typeArray 1) \chunk -> do
+          vec <- c_duckdb_data_chunk_get_vector chunk 0
+          fillVectorWithSequence vec [10, 20, 30]
+          c_duckdb_data_chunk_set_size chunk 3
 
-                    c_duckdb_data_chunk_reset chunk
-                    c_duckdb_data_chunk_get_size chunk >>= (@?= 0)
+          c_duckdb_data_chunk_reset chunk
+          c_duckdb_data_chunk_get_size chunk >>= (@?= 0)
 
-                    fillVectorWithSequence vec [7, 8]
-                    c_duckdb_data_chunk_set_size chunk 2
-                    verifyChunkContents chunk [7, 8]
+          fillVectorWithSequence vec [7, 8]
+          c_duckdb_data_chunk_set_size chunk 2
+          verifyChunkContents chunk [7, 8]
 
 -- Helpers -------------------------------------------------------------------
 
 withIntegerLogicalType :: (DuckDBLogicalType -> IO a) -> IO a
-withIntegerLogicalType = withLogicalType (c_duckdb_create_logical_type DuckDBTypeInteger)
+withIntegerLogicalType = withLogicalType (c_duckdb_create_logical_type (DuckDBTypeAlias DuckDBTypeInteger))
 
 withDataChunk :: IO DuckDBDataChunk -> (DuckDBDataChunk -> IO a) -> IO a
 withDataChunk acquire = bracket acquire destroyChunk
@@ -68,23 +73,23 @@
 
 fillVectorWithSequence :: DuckDBVector -> [Int32] -> IO ()
 fillVectorWithSequence vec values = do
-    colType <- c_duckdb_vector_get_column_type vec
-    withLogicalType (pure colType) (c_duckdb_get_type_id >=> (@?= DuckDBTypeInteger))
-    void (c_duckdb_vector_ensure_validity_writable vec)
-    dataPtrRaw <- c_duckdb_vector_get_data vec
-    let dataPtr = castPtr dataPtrRaw :: Ptr Int32
-    validity <- c_duckdb_vector_get_validity vec
-    when (validity /= nullPtr) $ setAllValid validity (length values)
-    forM_ (zip [0 ..] values) (uncurry (pokeElem dataPtr))
+  colType <- c_duckdb_vector_get_column_type vec
+  withLogicalType (pure colType) ((fmap (getField @"unwrap") . c_duckdb_get_type_id) >=> (@?= DuckDBTypeInteger))
+  void (c_duckdb_vector_ensure_validity_writable vec)
+  dataPtrRaw <- c_duckdb_vector_get_data vec
+  let dataPtr = coerce dataPtrRaw :: Ptr Int32
+  validity <- c_duckdb_vector_get_validity vec
+  when (validity /= nullPtr) $ setAllValid validity (length values)
+  forM_ (zip [0 ..] values) (uncurry (pokeElem dataPtr))
 
 verifyChunkContents :: DuckDBDataChunk -> [Int32] -> IO ()
 verifyChunkContents chunk expected = do
-    sz <- c_duckdb_data_chunk_get_size chunk
-    sz @?= fromIntegral (length expected)
-    vec <- c_duckdb_data_chunk_get_vector chunk 0
-    dataPtrRaw <- c_duckdb_vector_get_data vec
-    let dataPtr = castPtr dataPtrRaw :: Ptr Int32
-    forM_ (zip [0 ..] expected) \(idx, val) -> peekElem dataPtr idx >>= (@?= val)
+  sz <- c_duckdb_data_chunk_get_size chunk
+  sz @?= fromIntegral (length expected)
+  vec <- c_duckdb_data_chunk_get_vector chunk 0
+  dataPtrRaw <- c_duckdb_vector_get_data vec
+  let dataPtr = coerce dataPtrRaw :: Ptr Int32
+  forM_ (zip [0 ..] expected) \(idx, val) -> peekElem dataPtr idx >>= (@?= val)
 
 -- validity helpers ----------------------------------------------------------
 
@@ -96,5 +101,5 @@
 peekElem :: Ptr Int32 -> Int -> IO Int32
 peekElem base idx = peek (base `plusElem` idx)
 
-plusElem :: Ptr a -> Int -> Ptr a
-plusElem base idx = base `plusPtr` (idx * sizeOf (undefined :: Int32))
+plusElem :: Ptr Int32 -> Int -> Ptr Int32
+plusElem = advancePtr
diff --git a/test/ErrorDataTest.hs b/test/ErrorDataTest.hs
--- a/test/ErrorDataTest.hs
+++ b/test/ErrorDataTest.hs
@@ -2,38 +2,49 @@
 
 module ErrorDataTest (tests) where
 
+import Data.Coerce (coerce)
 import Database.DuckDB.FFI
-import Foreign.C.String (peekCString, withCString)
+import Foreign.C.ConstPtr (ConstPtr (..))
+import Foreign.C.String (peekCString)
 import Foreign.C.Types (CBool (..))
 import Foreign.Marshal.Alloc (alloca)
 import Foreign.Ptr (nullPtr)
 import Foreign.Storable (poke)
 import Test.Tasty (TestTree, testGroup)
 import Test.Tasty.HUnit (assertBool, testCase, (@?=))
+import Utils (withConstCString)
 
 tests :: TestTree
 tests =
-    testGroup
-        "Error Data"
-        [createInspectDestroy]
+  testGroup
+    "Error Data"
+    [createInspectDestroy]
 
 createInspectDestroy :: TestTree
 createInspectDestroy =
-    testCase "create error data, inspect properties, destroy" $
-        withCString "synthetic failure" \message -> do
-            errData <- c_duckdb_create_error_data DuckDBErrorInvalid message
-            assertBool "error data pointer should not be null" (errData /= nullPtr)
+  testCase "create error data, inspect properties, destroy" $
+    withConstCString "synthetic failure" \message -> do
+      errData <- c_duckdb_create_error_data DuckDBErrorInvalid message
+      assertBool "error data pointer should not be null" (errData /= coerce nullPtr)
 
-            errType <- c_duckdb_error_data_error_type errData
-            errType @?= DuckDBErrorInvalid
+      errType <- c_duckdb_error_data_error_type errData
+      errType @?= DuckDBErrorInvalid
 
-            retrievedMessagePtr <- c_duckdb_error_data_message errData
-            retrievedMessage <- peekCString retrievedMessagePtr
-            retrievedMessage @?= "synthetic failure"
+      retrievedMessagePtr <- c_duckdb_error_data_message errData
+      retrievedMessage <- peekCString (coerce retrievedMessagePtr)
+      retrievedMessage @?= "synthetic failure"
 
-            hasErr <- c_duckdb_error_data_has_error errData
-            hasErr @?= CBool 1
+      hasErr <- c_duckdb_error_data_has_error errData
+      hasErr @?= CBool 1
 
-            alloca \ptr -> do
-                poke ptr errData
-                c_duckdb_destroy_error_data ptr
+      alloca \ptr -> do
+        poke ptr errData
+        c_duckdb_destroy_error_data ptr
+
+      corruption <- c_duckdb_create_error_data DuckDBErrorDataCorruption message
+      assertBool "data corruption error pointer should not be null" (corruption /= coerce nullPtr)
+      c_duckdb_error_data_error_type corruption >>= (@?= DuckDBErrorDataCorruption)
+      c_duckdb_error_data_has_error corruption >>= (@?= CBool 1)
+      alloca \ptr -> do
+        poke ptr corruption
+        c_duckdb_destroy_error_data ptr
diff --git a/test/ExecutePreparedStatementsTest.hs b/test/ExecutePreparedStatementsTest.hs
--- a/test/ExecutePreparedStatementsTest.hs
+++ b/test/ExecutePreparedStatementsTest.hs
@@ -4,103 +4,103 @@
 module ExecutePreparedStatementsTest (tests) where
 
 import Control.Monad (forM_)
+import Data.Coerce (coerce)
 import Database.DuckDB.FFI
-import Database.DuckDB.FFI.Deprecated
-import Foreign.C.String (peekCString, withCString)
+import Foreign.C.String (peekCString)
 import Foreign.C.Types (CBool (..))
 import Foreign.Marshal.Alloc (alloca)
-import Foreign.Ptr (castPtr, nullPtr)
+import Foreign.Ptr (nullPtr)
 import Foreign.Storable (peek, poke)
 import Test.Tasty (TestTree, testGroup)
 import Test.Tasty.HUnit (assertBool, testCase, (@?=))
-import Utils (withConnection, withDatabase)
+import Utils (withConnection, withConstCString, withDatabase)
 
 tests :: TestTree
 tests =
-    testGroup
-        "Execute Prepared Statements"
-        [ executePreparedProducesResult
-        , executePreparedStreamingProducesChunks
-        ]
+  testGroup
+    "Execute Prepared Statements"
+    [ executePreparedProducesResult
+    , executePreparedStreamingProducesChunks
+    ]
 
 setupTable :: DuckDBConnection -> IO ()
 setupTable conn = do
-    let statements =
-            [ "CREATE TABLE exec_prepared (id INTEGER, name VARCHAR);"
-            , "INSERT INTO exec_prepared VALUES (1, 'alpha'), (2, 'beta');"
-            ]
-    forM_ statements \sql ->
-        withCString sql \cSql ->
-            alloca \resPtr -> do
-                st <- c_duckdb_query conn cSql resPtr
-                st @?= DuckDBSuccess
-                c_duckdb_destroy_result resPtr
+  let statements =
+        [ "CREATE TABLE exec_prepared (id INTEGER, name VARCHAR);"
+        , "INSERT INTO exec_prepared VALUES (1, 'alpha'), (2, 'beta');"
+        ]
+  forM_ statements \sql ->
+    withConstCString sql \cSql ->
+      alloca \resPtr -> do
+        st <- c_duckdb_query conn cSql resPtr
+        st @?= DuckDBSuccess
+        c_duckdb_destroy_result resPtr
 
 executePreparedProducesResult :: TestTree
 executePreparedProducesResult =
-    testCase "execute_prepared returns regular result" $
-        withDatabase \db ->
-            withConnection db \conn -> do
-                setupTable conn
+  testCase "execute_prepared returns regular result" $
+    withDatabase \db ->
+      withConnection db \conn -> do
+        setupTable conn
 
-                withCString "SELECT name FROM exec_prepared WHERE id = ?" \querySql ->
-                    alloca \stmtPtr -> do
-                        st <- c_duckdb_prepare conn querySql stmtPtr
-                        st @?= DuckDBSuccess
-                        stmt <- peek stmtPtr
-                        assertBool "prepared statement should not be null" (stmt /= nullPtr)
+        withConstCString "SELECT name FROM exec_prepared WHERE id = ?" \querySql ->
+          alloca \stmtPtr -> do
+            st <- c_duckdb_prepare conn querySql stmtPtr
+            st @?= DuckDBSuccess
+            stmt <- peek stmtPtr
+            assertBool "prepared statement should not be null" (stmt /= coerce nullPtr)
 
-                        c_duckdb_bind_int32 stmt 1 2 >>= (@?= DuckDBSuccess)
+            c_duckdb_bind_int32 stmt 1 2 >>= (@?= DuckDBSuccess)
 
-                        alloca \resPtr -> do
-                            execState <- c_duckdb_execute_prepared stmt resPtr
-                            execState @?= DuckDBSuccess
+            alloca \resPtr -> do
+              execState <- c_duckdb_execute_prepared stmt resPtr
+              execState @?= DuckDBSuccess
 
-                            streamingFlag <- c_duckdb_result_is_streaming resPtr
-                            streamingFlag @?= CBool 0
+              streamingFlag <- peek resPtr >>= \rawValue -> c_duckdb_result_is_streaming rawValue
+              streamingFlag @?= CBool 0
 
-                            rowCount <- c_duckdb_row_count resPtr
-                            rowCount @?= 1
+              rowCount <- c_duckdb_row_count resPtr
+              rowCount @?= 1
 
-                            varcharPtr <- c_duckdb_value_varchar resPtr 0 0
-                            peekCString varcharPtr >>= (@?= "beta")
-                            c_duckdb_free (castPtr varcharPtr)
+              varcharPtr <- c_duckdb_value_varchar resPtr 0 0
+              peekCString (coerce varcharPtr) >>= (@?= "beta")
+              c_duckdb_free (coerce varcharPtr)
 
-                            c_duckdb_destroy_result resPtr
+              c_duckdb_destroy_result resPtr
 
-                        c_duckdb_destroy_prepare stmtPtr
+            c_duckdb_destroy_prepare stmtPtr
 
 executePreparedStreamingProducesChunks :: TestTree
 executePreparedStreamingProducesChunks =
-    testCase "execute_prepared_streaming produces streaming result" $
-        withDatabase \db ->
-            withConnection db \conn -> do
-                setupTable conn
+  testCase "execute_prepared_streaming produces streaming result" $
+    withDatabase \db ->
+      withConnection db \conn -> do
+        setupTable conn
 
-                withCString "SELECT id, name FROM exec_prepared ORDER BY id" \querySql ->
-                    alloca \stmtPtr -> do
-                        st <- c_duckdb_prepare conn querySql stmtPtr
-                        st @?= DuckDBSuccess
-                        stmt <- peek stmtPtr
-                        assertBool "streaming prepared statement should not be null" (stmt /= nullPtr)
+        withConstCString "SELECT id, name FROM exec_prepared ORDER BY id" \querySql ->
+          alloca \stmtPtr -> do
+            st <- c_duckdb_prepare conn querySql stmtPtr
+            st @?= DuckDBSuccess
+            stmt <- peek stmtPtr
+            assertBool "streaming prepared statement should not be null" (stmt /= coerce nullPtr)
 
-                        alloca \resPtr -> do
-                            execState <- c_duckdb_execute_prepared_streaming stmt resPtr
-                            execState @?= DuckDBSuccess
+            alloca \resPtr -> do
+              execState <- c_duckdb_execute_prepared_streaming stmt resPtr
+              execState @?= DuckDBSuccess
 
-                            streamingFlag <- c_duckdb_result_is_streaming resPtr
-                            streamingFlag @?= CBool 1
+              streamingFlag <- peek resPtr >>= \rawValue -> c_duckdb_result_is_streaming rawValue
+              streamingFlag @?= CBool 1
 
-                            chunk <- c_duckdb_stream_fetch_chunk resPtr
-                            assertBool "streaming fetch chunk returns data" (chunk /= nullPtr)
+              chunk <- peek resPtr >>= \rawValue -> c_duckdb_stream_fetch_chunk rawValue
+              assertBool "streaming fetch chunk returns data" (chunk /= coerce nullPtr)
 
-                            chunkSize <- c_duckdb_data_chunk_get_size chunk
-                            assertBool "streamed chunk should contain rows" (chunkSize > 0)
+              chunkSize <- c_duckdb_data_chunk_get_size chunk
+              assertBool "streamed chunk should contain rows" (chunkSize > 0)
 
-                            alloca \chunkPtr -> do
-                                poke chunkPtr chunk
-                                c_duckdb_destroy_data_chunk chunkPtr
+              alloca \chunkPtr -> do
+                poke chunkPtr chunk
+                c_duckdb_destroy_data_chunk chunkPtr
 
-                            c_duckdb_destroy_result resPtr
+              c_duckdb_destroy_result resPtr
 
-                        c_duckdb_destroy_prepare stmtPtr
+            c_duckdb_destroy_prepare stmtPtr
diff --git a/test/ExpressionTest.hs b/test/ExpressionTest.hs
--- a/test/ExpressionTest.hs
+++ b/test/ExpressionTest.hs
@@ -1,168 +1,175 @@
 {-# LANGUAGE BlockArguments #-}
-{-# LANGUAGE ForeignFunctionInterface #-}
+{-# LANGUAGE DataKinds #-}
+{-# LANGUAGE DuplicateRecordFields #-}
 {-# LANGUAGE NamedFieldPuns #-}
+{-# LANGUAGE TypeApplications #-}
 
 module ExpressionTest (tests) where
 
 import Control.Exception (finally)
 import Data.Char (toLower)
+import Data.Coerce (coerce)
 import Data.IORef (IORef, newIORef, readIORef, writeIORef)
 import Data.List (isInfixOf)
 import Database.DuckDB.FFI
-import Foreign.C.String (peekCString, withCString)
+import Foreign.C.ConstPtr (ConstPtr (..))
+import Foreign.C.String (peekCString)
 import Foreign.Marshal.Alloc (alloca)
-import Foreign.Ptr (castPtr, freeHaskellFunPtr, nullFunPtr, nullPtr)
+import Foreign.Ptr (freeHaskellFunPtr, nullFunPtr, nullPtr)
 import Foreign.Storable (peek, poke)
+import GHC.Records (getField)
+import HsBindgen.Runtime.Support.FunPtr (toFunPtr)
 import Test.Tasty (TestTree, testGroup)
 import Test.Tasty.HUnit (assertBool, testCase, (@?=))
 import Utils (
-    destroyDuckValue,
-    destroyErrorData,
-    destroyLogicalType,
-    withConnection,
-    withDatabase,
-    withLogicalType,
-    withResult,
-    withScalarFunction,
+  destroyDuckValue,
+  destroyErrorData,
+  destroyLogicalType,
+  withConnection,
+  withConstCString,
+  withDatabase,
+  withLogicalType,
+  withResult,
+  withScalarFunction,
  )
 
 data ExpressionHarness = ExpressionHarness
-    { ehFoldable :: IO (Maybe Bool)
-    , ehReturnType :: IO (Maybe DuckDBType)
-    , ehFoldedValue :: IO (Maybe String)
-    , ehFoldError :: IO (Maybe String)
-    }
+  { ehFoldable :: IO (Maybe Bool)
+  , ehReturnType :: IO (Maybe DuckDBType)
+  , ehFoldedValue :: IO (Maybe String)
+  , ehFoldError :: IO (Maybe String)
+  }
 
 data ExpressionState = ExpressionState
-    { esFoldable :: IORef (Maybe Bool)
-    , esReturnType :: IORef (Maybe DuckDBType)
-    , esFoldValue :: IORef (Maybe String)
-    , esFoldError :: IORef (Maybe String)
-    }
+  { esFoldable :: IORef (Maybe Bool)
+  , esReturnType :: IORef (Maybe DuckDBType)
+  , esFoldValue :: IORef (Maybe String)
+  , esFoldError :: IORef (Maybe String)
+  }
 
 tests :: TestTree
 tests =
-    testGroup
-        "Expression Interface"
-        [ expressionFoldLiteral
-        , expressionNonFoldable
-        ]
+  testGroup
+    "Expression Interface"
+    [ expressionFoldLiteral
+    , expressionNonFoldable
+    ]
 
 expressionFoldLiteral :: TestTree
 expressionFoldLiteral =
-    testCase "folds literal expressions to constant values" $
-        withDatabase \db ->
-            withConnection db \conn ->
-                withExpressionFunction conn "expr_literal" \ExpressionHarness{ehFoldable, ehReturnType, ehFoldedValue, ehFoldError} -> do
-                    withResult conn "SELECT expr_literal(42)" \_ -> pure ()
-                    ehFoldable >>= (@?= Just True)
-                    ehReturnType >>= (@?= Just DuckDBTypeInteger)
-                    ehFoldedValue >>= (@?= Just "42")
-                    ehFoldError >>= (@?= Nothing)
+  testCase "folds literal expressions to constant values" $
+    withDatabase \db ->
+      withConnection db \conn ->
+        withExpressionFunction conn "expr_literal" \ExpressionHarness{ehFoldable, ehReturnType, ehFoldedValue, ehFoldError} -> do
+          withResult conn "SELECT expr_literal(42)" \_ -> pure ()
+          ehFoldable >>= (@?= Just True)
+          ehReturnType >>= (@?= Just DuckDBTypeInteger)
+          ehFoldedValue >>= (@?= Just "42")
+          ehFoldError >>= (@?= Nothing)
 
 expressionNonFoldable :: TestTree
 expressionNonFoldable =
-    testCase "detects non-foldable column references" $
-        withDatabase \db ->
-            withConnection db \conn ->
-                withExpressionFunction conn "expr_non_foldable" \ExpressionHarness{ehFoldable, ehReturnType, ehFoldedValue, ehFoldError} -> do
-                    withResult conn "SELECT expr_non_foldable(v) FROM (VALUES (7)) t(v)" \_ -> pure ()
-                    ehFoldable >>= (@?= Just False)
-                    ehReturnType >>= (@?= Just DuckDBTypeInteger)
-                    ehFoldedValue >>= (@?= Nothing)
-                    errMsg <- ehFoldError
-                    assertBool "expected fold error message" $
-                        maybe False (isInfixOf "fold" . map toLower) errMsg
+  testCase "detects non-foldable column references" $
+    withDatabase \db ->
+      withConnection db \conn ->
+        withExpressionFunction conn "expr_non_foldable" \ExpressionHarness{ehFoldable, ehReturnType, ehFoldedValue, ehFoldError} -> do
+          withResult conn "SELECT expr_non_foldable(v) FROM (VALUES (7)) t(v)" \_ -> pure ()
+          ehFoldable >>= (@?= Just False)
+          ehReturnType >>= (@?= Just DuckDBTypeInteger)
+          ehFoldedValue >>= (@?= Nothing)
+          errMsg <- ehFoldError
+          assertBool "expected fold error message" $
+            maybe False (isInfixOf "fold" . map toLower) errMsg
 
 withExpressionFunction :: DuckDBConnection -> String -> (ExpressionHarness -> IO a) -> IO a
 withExpressionFunction conn funcName action = do
-    foldRef <- newIORef Nothing
-    typeRef <- newIORef Nothing
-    valueRef <- newIORef Nothing
-    errorRef <- newIORef Nothing
-    let state = ExpressionState foldRef typeRef valueRef errorRef
-    bindPtr <- mkScalarBindFun (expressionBind state)
-    execPtr <- mkScalarExecFun expressionExec
-    result <-
-        withScalarFunction $ \scalarFun -> do
-            withCString funcName $ \name -> c_duckdb_scalar_function_set_name scalarFun name
-            withLogicalType (c_duckdb_create_logical_type DuckDBTypeInteger) $ \intType -> do
-                c_duckdb_scalar_function_add_parameter scalarFun intType
-                c_duckdb_scalar_function_set_return_type scalarFun intType
-                c_duckdb_scalar_function_set_bind scalarFun bindPtr
-                c_duckdb_scalar_function_set_function scalarFun execPtr
-                c_duckdb_scalar_function_set_extra_info scalarFun nullPtr nullFunPtr
-                c_duckdb_register_scalar_function conn scalarFun >>= (@?= DuckDBSuccess)
-                action
-                    ExpressionHarness
-                        { ehFoldable = readIORef foldRef
-                        , ehReturnType = readIORef typeRef
-                        , ehFoldedValue = readIORef valueRef
-                        , ehFoldError = readIORef errorRef
-                        }
-    freeHaskellFunPtr bindPtr
-    freeHaskellFunPtr execPtr
-    pure result
+  foldRef <- newIORef Nothing
+  typeRef <- newIORef Nothing
+  valueRef <- newIORef Nothing
+  errorRef <- newIORef Nothing
+  let state = ExpressionState foldRef typeRef valueRef errorRef
+  bindPtr <- mkScalarBindFun (expressionBind state)
+  execPtr <- mkScalarExecFun expressionExec
+  result <-
+    withScalarFunction $ \scalarFun -> do
+      withConstCString funcName $ \name -> c_duckdb_scalar_function_set_name scalarFun name
+      withLogicalType (c_duckdb_create_logical_type (DuckDBTypeAlias DuckDBTypeInteger)) $ \intType -> do
+        c_duckdb_scalar_function_add_parameter scalarFun intType
+        c_duckdb_scalar_function_set_return_type scalarFun intType
+        c_duckdb_scalar_function_set_bind scalarFun bindPtr
+        c_duckdb_scalar_function_set_function scalarFun execPtr
+        c_duckdb_scalar_function_set_extra_info scalarFun nullPtr (coerce nullFunPtr)
+        c_duckdb_register_scalar_function conn scalarFun >>= (@?= DuckDBSuccess)
+        action
+          ExpressionHarness
+            { ehFoldable = readIORef foldRef
+            , ehReturnType = readIORef typeRef
+            , ehFoldedValue = readIORef valueRef
+            , ehFoldError = readIORef errorRef
+            }
+  freeHaskellFunPtr (coerce bindPtr)
+  freeHaskellFunPtr (coerce execPtr)
+  pure result
 
 expressionBind :: ExpressionState -> DuckDBBindInfo -> IO ()
 expressionBind ExpressionState{esFoldable, esReturnType, esFoldValue, esFoldError} info = do
-    argCount <- c_duckdb_scalar_function_bind_get_argument_count info
-    argCount @?= 1
-    exprHandle <- c_duckdb_scalar_function_bind_get_argument info 0
-    finally
-        ( do
-            foldableFlag <- c_duckdb_expression_is_foldable exprHandle
-            let isFoldable = foldableFlag /= 0
-            writeIORef esFoldable (Just isFoldable)
-            retType <- c_duckdb_expression_return_type exprHandle
-            typeId <- c_duckdb_get_type_id retType
-            destroyLogicalType retType
-            writeIORef esReturnType (Just typeId)
-            alloca \ctxPtr -> do
-                c_duckdb_scalar_function_get_client_context info ctxPtr
-                ctx <- peek ctxPtr
-                alloca \valuePtr -> do
-                    poke valuePtr nullPtr
-                    errData <- c_duckdb_expression_fold ctx exprHandle valuePtr
-                    if errData == nullPtr
-                        then do
-                            valueHandle <- peek valuePtr
-                            if valueHandle == nullPtr
-                                then do
-                                    writeIORef esFoldValue Nothing
-                                    writeIORef esFoldError (Just "fold produced null value")
-                                else do
-                                    rendered <- duckValueToString valueHandle
-                                    writeIORef esFoldValue (Just rendered)
-                                    writeIORef esFoldError Nothing
-                                    destroyDuckValue valueHandle
-                        else do
-                            msgPtr <- c_duckdb_error_data_message errData
-                            msg <- peekCString msgPtr
-                            writeIORef esFoldValue Nothing
-                            writeIORef esFoldError (Just msg)
-                            destroyErrorData errData
-        )
-        (alloca \exprPtr -> poke exprPtr exprHandle >> c_duckdb_destroy_expression exprPtr)
+  argCount <- c_duckdb_scalar_function_bind_get_argument_count info
+  argCount @?= 1
+  exprHandle <- c_duckdb_scalar_function_bind_get_argument info 0
+  finally
+    ( do
+        foldableFlag <- c_duckdb_expression_is_foldable exprHandle
+        let isFoldable = foldableFlag /= 0
+        writeIORef esFoldable (Just isFoldable)
+        retType <- c_duckdb_expression_return_type exprHandle
+        typeId <- (fmap (getField @"unwrap") . c_duckdb_get_type_id) retType
+        destroyLogicalType retType
+        writeIORef esReturnType (Just typeId)
+        alloca \ctxPtr -> do
+          c_duckdb_scalar_function_get_client_context info ctxPtr
+          ctx <- peek ctxPtr
+          alloca \valuePtr -> do
+            poke valuePtr (coerce nullPtr)
+            errData <- c_duckdb_expression_fold ctx exprHandle valuePtr
+            if errData == coerce nullPtr
+              then do
+                valueHandle <- peek valuePtr
+                if valueHandle == coerce nullPtr
+                  then do
+                    writeIORef esFoldValue Nothing
+                    writeIORef esFoldError (Just "fold produced null value")
+                  else do
+                    rendered <- duckValueToString valueHandle
+                    writeIORef esFoldValue (Just rendered)
+                    writeIORef esFoldError Nothing
+                    destroyDuckValue valueHandle
+              else do
+                msgPtr <- c_duckdb_error_data_message errData
+                msg <- peekCString (coerce msgPtr)
+                writeIORef esFoldValue Nothing
+                writeIORef esFoldError (Just msg)
+                destroyErrorData errData
+    )
+    (alloca \exprPtr -> poke exprPtr exprHandle >> c_duckdb_destroy_expression exprPtr)
 
 expressionExec :: DuckDBFunctionInfo -> DuckDBDataChunk -> DuckDBVector -> IO ()
 expressionExec _ chunk outVec = do
-    inVec <- c_duckdb_data_chunk_get_vector chunk 0
-    c_duckdb_vector_reference_vector outVec inVec
+  inVec <- c_duckdb_data_chunk_get_vector chunk 0
+  c_duckdb_vector_reference_vector outVec inVec
 
 -- Helpers ------------------------------------------------------------------
 
 duckValueToString :: DuckDBValue -> IO String
 duckValueToString value = do
-    strPtr <- c_duckdb_value_to_string value
-    text <- peekCString strPtr
-    c_duckdb_free (castPtr strPtr)
-    pure text
+  strPtr <- c_duckdb_value_to_string value
+  text <- peekCString (coerce strPtr)
+  c_duckdb_free (coerce strPtr)
+  pure text
 
 -- Wrapper constructors -----------------------------------------------------
 
-foreign import ccall "wrapper"
-    mkScalarBindFun :: (DuckDBBindInfo -> IO ()) -> IO DuckDBScalarFunctionBindFun
+mkScalarBindFun :: (DuckDBBindInfo -> IO ()) -> IO DuckDBScalarFunctionBindFun
+mkScalarBindFun = fmap DuckDBScalarFunctionBindFun . toFunPtr . DuckDBScalarFunctionBindFun_Aux
 
-foreign import ccall "wrapper"
-    mkScalarExecFun :: (DuckDBFunctionInfo -> DuckDBDataChunk -> DuckDBVector -> IO ()) -> IO DuckDBScalarFunctionFun
+mkScalarExecFun :: (DuckDBFunctionInfo -> DuckDBDataChunk -> DuckDBVector -> IO ()) -> IO DuckDBScalarFunctionFun
+mkScalarExecFun = fmap DuckDBScalarFunctionFun . toFunPtr . DuckDBScalarFunctionFun_Aux
diff --git a/test/ExtractStatementsTest.hs b/test/ExtractStatementsTest.hs
--- a/test/ExtractStatementsTest.hs
+++ b/test/ExtractStatementsTest.hs
@@ -4,102 +4,103 @@
 module ExtractStatementsTest (tests) where
 
 import Control.Monad (forM_, when)
+import Data.Coerce (coerce)
 import Data.Int (Int64)
 import Database.DuckDB.FFI
-import Database.DuckDB.FFI.Deprecated
-import Foreign.C.String (peekCString, withCString)
+import Foreign.C.ConstPtr (ConstPtr (..))
+import Foreign.C.String (peekCString)
 import Foreign.Marshal.Alloc (alloca)
 import Foreign.Ptr (nullPtr)
 import Foreign.Storable (peek)
 import Test.Tasty (TestTree, testGroup)
 import Test.Tasty.HUnit (assertBool, assertFailure, testCase, (@?=))
-import Utils (withConnection, withDatabase)
+import Utils (withConnection, withConstCString, withDatabase)
 
 tests :: TestTree
 tests =
-    testGroup
-        "Extract Statements"
-        [ extractPrepareAndExecuteSequence
-        , extractFailureYieldsErrorMessage
-        ]
+  testGroup
+    "Extract Statements"
+    [ extractPrepareAndExecuteSequence
+    , extractFailureYieldsErrorMessage
+    ]
 
 extractPrepareAndExecuteSequence :: TestTree
 extractPrepareAndExecuteSequence =
-    testCase "extract, prepare, and execute a multi-statement script" $
-        withDatabase \db ->
-            withConnection db \conn -> do
-                let script =
-                        "CREATE TABLE extracted_values(val INTEGER);"
-                            <> "INSERT INTO extracted_values VALUES (1), (2);"
-                            <> "SELECT SUM(val) FROM extracted_values;"
+  testCase "extract, prepare, and execute a multi-statement script" $
+    withDatabase \db ->
+      withConnection db \conn -> do
+        let script =
+              "CREATE TABLE extracted_values(val INTEGER);"
+                <> "INSERT INTO extracted_values VALUES (1), (2);"
+                <> "SELECT SUM(val) FROM extracted_values;"
 
-                withCString script \scriptPtr ->
-                    alloca \exPtr -> do
-                        stmtCount <- c_duckdb_extract_statements conn scriptPtr exPtr
-                        stmtCount @?= 3
+        withConstCString script \scriptPtr ->
+          alloca \exPtr -> do
+            stmtCount <- c_duckdb_extract_statements conn scriptPtr exPtr
+            stmtCount @?= 3
 
-                        extracted <- peek exPtr
-                        assertBool "extracted handle should not be null" (extracted /= nullPtr)
+            extracted <- peek exPtr
+            assertBool "extracted handle should not be null" (extracted /= coerce nullPtr)
 
-                        let indices = [0 :: Integer .. fromIntegral stmtCount - 1]
-                        forM_ indices \idx ->
-                            alloca \stmtPtr -> do
-                                let duckIdx = fromIntegral idx
-                                prepState <- c_duckdb_prepare_extracted_statement conn extracted duckIdx stmtPtr
-                                prepState @?= DuckDBSuccess
+            let indices = [0 :: Integer .. fromIntegral stmtCount - 1]
+            forM_ indices \idx ->
+              alloca \stmtPtr -> do
+                let duckIdx = fromIntegral idx
+                prepState <- c_duckdb_prepare_extracted_statement conn extracted duckIdx stmtPtr
+                prepState @?= DuckDBSuccess
 
-                                stmt <- peek stmtPtr
-                                assertBool "prepared statement should not be null" (stmt /= nullPtr)
+                stmt <- peek stmtPtr
+                assertBool "prepared statement should not be null" (stmt /= coerce nullPtr)
 
-                                alloca \resPtr -> do
-                                    execState <- c_duckdb_execute_prepared stmt resPtr
-                                    execState @?= DuckDBSuccess
+                alloca \resPtr -> do
+                  execState <- c_duckdb_execute_prepared stmt resPtr
+                  execState @?= DuckDBSuccess
 
-                                    case idx of
-                                        0 -> do
-                                            resultType <- c_duckdb_result_return_type resPtr
-                                            resultType @?= DuckDBResultTypeNothing
-                                        1 -> do
-                                            resultType <- c_duckdb_result_return_type resPtr
-                                            resultType @?= DuckDBResultTypeChangedRows
-                                        2 -> do
-                                            rowCount <- c_duckdb_row_count resPtr
-                                            rowCount @?= 1
-                                            total <- c_duckdb_value_int64 resPtr 0 0
-                                            (total :: Int64) @?= 3
-                                        _ -> pure ()
+                  case idx of
+                    0 -> do
+                      resultType <- peek resPtr >>= \rawValue -> c_duckdb_result_return_type rawValue
+                      resultType @?= DuckDBResultTypeNothing
+                    1 -> do
+                      resultType <- peek resPtr >>= \rawValue -> c_duckdb_result_return_type rawValue
+                      resultType @?= DuckDBResultTypeChangedRows
+                    2 -> do
+                      rowCount <- c_duckdb_row_count resPtr
+                      rowCount @?= 1
+                      total <- c_duckdb_value_int64 resPtr 0 0
+                      (total :: Int64) @?= 3
+                    _ -> pure ()
 
-                                    c_duckdb_destroy_result resPtr
+                  c_duckdb_destroy_result resPtr
 
-                                c_duckdb_destroy_prepare stmtPtr
+                c_duckdb_destroy_prepare stmtPtr
 
-                        -- Preparing out-of-range should fail with an informative error
-                        alloca \stmtPtr -> do
-                            let invalidIdx = stmtCount
-                            stInvalid <- c_duckdb_prepare_extracted_statement conn extracted invalidIdx stmtPtr
-                            stInvalid @?= DuckDBError
-                            stmt <- peek stmtPtr
-                            assertBool "invalid index should not yield a statement handle" (stmt == nullPtr)
+            -- Preparing out-of-range should fail with an informative error
+            alloca \stmtPtr -> do
+              let invalidIdx = stmtCount
+              stInvalid <- c_duckdb_prepare_extracted_statement conn extracted invalidIdx stmtPtr
+              stInvalid @?= DuckDBError
+              stmt <- peek stmtPtr
+              assertBool "invalid index should not yield a statement handle" (stmt == coerce nullPtr)
 
-                        c_duckdb_destroy_extracted exPtr
+            c_duckdb_destroy_extracted exPtr
 
 extractFailureYieldsErrorMessage :: TestTree
 extractFailureYieldsErrorMessage =
-    testCase "failed extract surfaces parser error" $
-        withDatabase \db ->
-            withConnection db \conn -> do
-                withCString "SELECT * FROM invalid_table WHERE" \badSql ->
-                    alloca \exPtr -> do
-                        stmtCount <- c_duckdb_extract_statements conn badSql exPtr
-                        stmtCount @?= 0
+  testCase "failed extract surfaces parser error" $
+    withDatabase \db ->
+      withConnection db \conn -> do
+        withConstCString "SELECT * FROM invalid_table WHERE" \badSql ->
+          alloca \exPtr -> do
+            stmtCount <- c_duckdb_extract_statements conn badSql exPtr
+            stmtCount @?= 0
 
-                        extracted <- peek exPtr
-                        assertBool "extracted handle should be available for errors" (extracted /= nullPtr)
+            extracted <- peek exPtr
+            assertBool "extracted handle should be available for errors" (extracted /= coerce nullPtr)
 
-                        errPtr <- c_duckdb_extract_statements_error extracted
-                        when (errPtr == nullPtr) $
-                            assertFailure "expected error message pointer from failed extract"
-                        errMsg <- peekCString errPtr
-                        assertBool "error message should not be empty" (not (null errMsg))
+            errPtr <- c_duckdb_extract_statements_error extracted
+            when (errPtr == coerce nullPtr) $
+              assertFailure "expected error message pointer from failed extract"
+            errMsg <- peekCString (coerce errPtr)
+            assertBool "error message should not be empty" (not (null errMsg))
 
-                        c_duckdb_destroy_extracted exPtr
+            c_duckdb_destroy_extracted exPtr
diff --git a/test/HelpersTest.hs b/test/HelpersTest.hs
--- a/test/HelpersTest.hs
+++ b/test/HelpersTest.hs
@@ -1,161 +1,167 @@
 {-# LANGUAGE BlockArguments #-}
+{-# LANGUAGE DuplicateRecordFields #-}
 {-# LANGUAGE TypeApplications #-}
 
 module HelpersTest (tests) where
 
 import Control.Exception (bracket)
+import Data.Coerce (coerce)
 import Data.Int (Int64)
 import Data.Time.Calendar (diffDays, fromGregorian)
 import Database.DuckDB.FFI
-import Foreign.C.String (peekCStringLen, withCString)
+import Foreign.C.ConstPtr (ConstPtr (..))
+import Foreign.C.String (peekCStringLen)
 import Foreign.C.Types (CBool (..), CDouble (..), CSize (..))
 import Foreign.Marshal.Alloc (alloca)
 import Foreign.Marshal.Array (allocaArray)
-import Foreign.Ptr (Ptr, castPtr, nullPtr)
+import Foreign.Ptr (Ptr, nullPtr)
 import Foreign.Storable (peek, poke, pokeElemOff)
 import Test.Tasty (TestTree, testGroup)
 import Test.Tasty.HUnit (assertBool, testCase, (@?=))
-import Utils (withLogicalType)
+import Utils (withConstCString, withLogicalType)
 
 tests :: TestTree
 tests =
-    testGroup
-        "Helpers"
-        [ testMallocFree
-        , testVectorSize
-        , testDateTimeHelpers
-        , testStringHelpers
-        , testHugeIntHelpers
-        , testDecimalHelpers
-        ]
+  testGroup
+    "Helpers"
+    [ testMallocFree
+    , testVectorSize
+    , testDateTimeHelpers
+    , testStringHelpers
+    , testHugeIntHelpers
+    , testDecimalHelpers
+    ]
 
 testMallocFree :: TestTree
 testMallocFree =
-    testCase "duckdb_malloc/duckdb_free allocate and release memory" $ do
-        ptr <- c_duckdb_malloc (CSize 128)
-        assertBool "allocation should succeed" (ptr /= nullPtr)
-        c_duckdb_free ptr
+  testCase "duckdb_malloc/duckdb_free allocate and release memory" $ do
+    ptr <- c_duckdb_malloc (CSize 128)
+    assertBool "allocation should succeed" (ptr /= nullPtr)
+    c_duckdb_free ptr
 
 testVectorSize :: TestTree
 testVectorSize =
-    testCase "duckdb_vector_size returns positive number" $ do
-        size <- c_duckdb_vector_size
-        assertBool "vector size should be positive" (size > 0)
+  testCase "duckdb_vector_size returns positive number" $ do
+    size <- c_duckdb_vector_size
+    assertBool "vector size should be positive" (size > 0)
 
 testDateTimeHelpers :: TestTree
 testDateTimeHelpers =
-    testCase "date/time/timestamp helper round-trips" $ do
-        let day = fromGregorian 2023 6 1
-            epoch = fromGregorian 1970 1 1
-            days = diffDays day epoch
-            duckDay = DuckDBDate (fromIntegral days)
+  testCase "date/time/timestamp helper round-trips" $ do
+    let day = fromGregorian 2023 6 1
+        epoch = fromGregorian 1970 1 1
+        days = diffDays day epoch
+        duckDay = DuckDBDate (fromIntegral days)
 
-        alloca \dateStructPtr -> do
-            c_duckdb_from_date duckDay dateStructPtr
-            DuckDBDateStruct{duckDBDateStructYear = y, duckDBDateStructMonth = m, duckDBDateStructDay = d} <- peek dateStructPtr
-            (y, m, d) @?= (2023, 6, 1)
-            roundTrippedDay <- c_duckdb_to_date dateStructPtr
-            roundTrippedDay @?= duckDay
+    alloca \dateStructPtr -> do
+      c_duckdb_from_date duckDay >>= poke dateStructPtr
+      DuckDBDateStruct{year = y, month = m, day = d} <- peek dateStructPtr
+      (y, m, d) @?= (2023, 6, 1)
+      roundTrippedDay <- peek dateStructPtr >>= \rawValue -> c_duckdb_to_date rawValue
+      roundTrippedDay @?= duckDay
 
-        c_duckdb_is_finite_date duckDay >>= (@?= CBool 1)
+    c_duckdb_is_finite_date duckDay >>= (@?= CBool 1)
 
-        let microsPerSecond = 1000000
-            timeMicros = ((12 * 60 + 34) * 60 + 56) * microsPerSecond
-            duckTime = DuckDBTime (fromIntegral timeMicros)
+    let microsPerSecond = 1000000
+        timeMicros = ((12 * 60 + 34) * 60 + 56) * microsPerSecond
+        duckTime = DuckDBTime (fromIntegral timeMicros)
 
-        alloca \timeStructPtr -> do
-            c_duckdb_from_time duckTime timeStructPtr
-            DuckDBTimeStruct{duckDBTimeStructHour = h, duckDBTimeStructMinute = mi, duckDBTimeStructSecond = s, duckDBTimeStructMicros = mu} <- peek timeStructPtr
-            (h, mi, s, mu) @?= (12, 34, 56, 0)
-            roundTrippedTime <- c_duckdb_to_time timeStructPtr
-            roundTrippedTime @?= duckTime
+    alloca \timeStructPtr -> do
+      c_duckdb_from_time duckTime >>= poke timeStructPtr
+      DuckDBTimeStruct{hour = h, min = mi, sec = s, micros = mu} <- peek timeStructPtr
+      (h, mi, s, mu) @?= (12, 34, 56, 0)
+      roundTrippedTime <- peek timeStructPtr >>= \rawValue -> c_duckdb_to_time rawValue
+      roundTrippedTime @?= duckTime
 
-        DuckDBTimeTz tz <- c_duckdb_create_time_tz (fromIntegral @Integer timeMicros) 60
-        alloca \timeTzPtr -> do
-            c_duckdb_from_time_tz (DuckDBTimeTz tz) timeTzPtr
-            DuckDBTimeTzStruct{duckDBTimeTzStructTime = DuckDBTimeStruct{duckDBTimeStructHour = h', duckDBTimeStructMinute = mi', duckDBTimeStructSecond = s'}, duckDBTimeTzStructOffset = offset} <- peek timeTzPtr
-            (h', mi', s', offset) @?= (12, 34, 56, 60)
+    DuckDBTimeTz tz <- c_duckdb_create_time_tz (fromIntegral @Integer timeMicros) 60
+    alloca \timeTzPtr -> do
+      c_duckdb_from_time_tz (DuckDBTimeTz tz) >>= poke timeTzPtr
+      DuckDBTimeTzStruct{time = DuckDBTimeStruct{hour = h', min = mi', sec = s'}, offset = offset} <- peek timeTzPtr
+      (h', mi', s', offset) @?= (12, 34, 56, 60)
 
-        let tsMicros :: Int64
-            tsMicros = fromIntegral days * 86400000000 + fromIntegral timeMicros
-            duckTimestamp = DuckDBTimestamp tsMicros
+    let tsMicros :: Int64
+        tsMicros = fromIntegral days * 86400000000 + fromIntegral timeMicros
+        duckTimestamp = DuckDBTimestamp tsMicros
 
-        alloca \tsStructPtr -> do
-            c_duckdb_from_timestamp duckTimestamp tsStructPtr
-            DuckDBTimestampStruct{duckDBTimestampStructDate = DuckDBDateStruct{duckDBDateStructYear = y', duckDBDateStructMonth = m', duckDBDateStructDay = d'}, duckDBTimestampStructTime = DuckDBTimeStruct{duckDBTimeStructHour = hour', duckDBTimeStructMinute = minute', duckDBTimeStructSecond = sec', duckDBTimeStructMicros = micro'}} <-
-                peek tsStructPtr
-            (y', m', d', hour', minute', sec', micro') @?= (2023, 6, 1, 12, 34, 56, 0)
-            roundTrippedTs <- c_duckdb_to_timestamp tsStructPtr
-            roundTrippedTs @?= duckTimestamp
+    alloca \tsStructPtr -> do
+      c_duckdb_from_timestamp duckTimestamp >>= poke tsStructPtr
+      DuckDBTimestampStruct
+        { date = DuckDBDateStruct{year = y', month = m', day = d'}
+        , time = DuckDBTimeStruct{hour = hour', min = minute', sec = sec', micros = micro'}
+        } <-
+        peek tsStructPtr
+      (y', m', d', hour', minute', sec', micro') @?= (2023, 6, 1, 12, 34, 56, 0)
+      roundTrippedTs <- peek tsStructPtr >>= \rawValue -> c_duckdb_to_timestamp rawValue
+      roundTrippedTs @?= duckTimestamp
 
-        c_duckdb_is_finite_timestamp duckTimestamp >>= (@?= CBool 1)
-        c_duckdb_is_finite_timestamp_s (DuckDBTimestampS (tsMicros `div` 1000000)) >>= (@?= CBool 1)
-        c_duckdb_is_finite_timestamp_ms (DuckDBTimestampMs (tsMicros `div` 1000)) >>= (@?= CBool 1)
-        c_duckdb_is_finite_timestamp_ns (DuckDBTimestampNs (tsMicros * 1000)) >>= (@?= CBool 1)
+    c_duckdb_is_finite_timestamp duckTimestamp >>= (@?= CBool 1)
+    c_duckdb_is_finite_timestamp_s (DuckDBTimestampS (tsMicros `div` 1000000)) >>= (@?= CBool 1)
+    c_duckdb_is_finite_timestamp_ms (DuckDBTimestampMs (tsMicros `div` 1000)) >>= (@?= CBool 1)
+    c_duckdb_is_finite_timestamp_ns (DuckDBTimestampNs (tsMicros * 1000)) >>= (@?= CBool 1)
 
 testStringHelpers :: TestTree
 testStringHelpers =
-    testCase "string_t helpers inspect inline and heap strings" $ do
-        inspectString "short" True
-        inspectString (replicate 32 'x') False
+  testCase "string_t helpers inspect inline and heap strings" $ do
+    inspectString "short" True
+    inspectString (replicate 32 'x') False
   where
     inspectString text expectInline =
-        withLogicalType (c_duckdb_create_logical_type DuckDBTypeVarchar) \varcharType ->
-            allocaArray 1 \typesPtr -> do
-                pokeElemOff typesPtr 0 varcharType
-                bracket
-                    (c_duckdb_create_data_chunk typesPtr 1)
-                    destroyDataChunk
-                    \chunk -> do
-                        vec <- c_duckdb_data_chunk_get_vector chunk 0
-                        withCString text $ \cStr ->
-                            c_duckdb_vector_assign_string_element vec 0 cStr
-                        c_duckdb_data_chunk_set_size chunk 1
-                        dataPtr <- c_duckdb_vector_get_data vec
-                        let stringPtr = castPtr dataPtr :: Ptr DuckDBStringT
-                        inlineFlag <- c_duckdb_string_is_inlined stringPtr
-                        inlineFlag @?= if expectInline then CBool 1 else CBool 0
-                        len <- c_duckdb_string_t_length stringPtr
-                        len @?= fromIntegral (length text)
-                        textPtr <- c_duckdb_string_t_data stringPtr
-                        peekCStringLen (textPtr, fromIntegral len) >>= (@?= text)
+      withLogicalType (c_duckdb_create_logical_type (DuckDBTypeAlias DuckDBTypeVarchar)) \varcharType ->
+        allocaArray 1 \typesPtr -> do
+          pokeElemOff typesPtr 0 varcharType
+          bracket
+            (c_duckdb_create_data_chunk typesPtr 1)
+            destroyDataChunk
+            \chunk -> do
+              vec <- c_duckdb_data_chunk_get_vector chunk 0
+              withConstCString text $ \cStr ->
+                c_duckdb_vector_assign_string_element vec 0 cStr
+              c_duckdb_data_chunk_set_size chunk 1
+              dataPtr <- c_duckdb_vector_get_data vec
+              let stringPtr = coerce dataPtr :: Ptr DuckDBStringT
+              inlineFlag <- peek stringPtr >>= \rawValue -> c_duckdb_string_is_inlined rawValue
+              inlineFlag @?= if expectInline then CBool 1 else CBool 0
+              len <- peek stringPtr >>= \rawValue -> c_duckdb_string_t_length rawValue
+              len @?= fromIntegral (length text)
+              textPtr <- c_duckdb_string_t_data stringPtr
+              peekCStringLen (coerce textPtr, fromIntegral len) >>= (@?= text)
 
 testHugeIntHelpers :: TestTree
 testHugeIntHelpers =
-    testCase "hugeint/u-hugeint helpers convert values" $ do
-        alloca \hugePtr -> do
-            let hugeVal = DuckDBHugeInt{duckDBHugeIntLower = 123456789, duckDBHugeIntUpper = 0}
-            poke hugePtr hugeVal
-            CDouble dbl <- c_duckdb_hugeint_to_double hugePtr
-            dbl @?= 123456789
-            c_duckdb_double_to_hugeint (CDouble 987654321) hugePtr
-            DuckDBHugeInt{duckDBHugeIntLower = lower, duckDBHugeIntUpper = upper} <- peek hugePtr
-            (upper, lower) @?= (0, 987654321)
+  testCase "hugeint/u-hugeint helpers convert values" $ do
+    alloca \hugePtr -> do
+      let hugeVal = DuckDBHugeInt{lower = 123456789, upper = 0}
+      poke hugePtr hugeVal
+      CDouble dbl <- peek hugePtr >>= \rawValue -> c_duckdb_hugeint_to_double rawValue
+      dbl @?= 123456789
+      c_duckdb_double_to_hugeint (CDouble 987654321) >>= poke hugePtr
+      DuckDBHugeInt{lower = lower, upper = upper} <- peek hugePtr
+      (upper, lower) @?= (0, 987654321)
 
-        alloca \uhugePtr -> do
-            let uhugeVal = DuckDBUHugeInt{duckDBUHugeIntLower = 987654321, duckDBUHugeIntUpper = 1}
-            poke uhugePtr uhugeVal
-            CDouble dbl <- c_duckdb_uhugeint_to_double uhugePtr
-            dbl @?= fromIntegral @Integer (987654321 + 2 ^ (64 :: Int))
-            c_duckdb_double_to_uhugeint (CDouble 123456789) uhugePtr
-            DuckDBUHugeInt{duckDBUHugeIntLower = lower, duckDBUHugeIntUpper = upper} <- peek uhugePtr
-            (upper, lower) @?= (0, 123456789)
+    alloca \uhugePtr -> do
+      let uhugeVal = DuckDBUHugeInt{lower = 987654321, upper = 1}
+      poke uhugePtr uhugeVal
+      CDouble dbl <- peek uhugePtr >>= \rawValue -> c_duckdb_uhugeint_to_double rawValue
+      dbl @?= fromIntegral @Integer (987654321 + 2 ^ (64 :: Int))
+      c_duckdb_double_to_uhugeint (CDouble 123456789) >>= poke uhugePtr
+      DuckDBUHugeInt{lower = lower, upper = upper} <- peek uhugePtr
+      (upper, lower) @?= (0, 123456789)
 
 testDecimalHelpers :: TestTree
 testDecimalHelpers =
-    testCase "decimal helper round-trip" $ do
-        let input = CDouble 12345.67
-        alloca \decimalPtr -> do
-            c_duckdb_double_to_decimal input 18 2 decimalPtr
-            DuckDBDecimal{duckDBDecimalWidth = width, duckDBDecimalScale = scale} <- peek decimalPtr
-            (width, scale) @?= (18, 2)
-            result <- c_duckdb_decimal_to_double decimalPtr
-            result @?= input
+  testCase "decimal helper round-trip" $ do
+    let input = CDouble 12345.67
+    alloca \decimalPtr -> do
+      c_duckdb_double_to_decimal input 18 2 >>= poke decimalPtr
+      DuckDBDecimal{width = width, scale = scale} <- peek decimalPtr
+      (width, scale) @?= (18, 2)
+      result <- peek decimalPtr >>= \rawValue -> c_duckdb_decimal_to_double rawValue
+      result @?= input
 
 -- Utilities ----------------------------------------------------------------
 
 destroyDataChunk :: DuckDBDataChunk -> IO ()
 destroyDataChunk chunk =
-    alloca \ptr -> do
-        poke ptr chunk
-        c_duckdb_destroy_data_chunk ptr
+  alloca \ptr -> do
+    poke ptr chunk
+    c_duckdb_destroy_data_chunk ptr
diff --git a/test/LogicalTypesTest.hs b/test/LogicalTypesTest.hs
--- a/test/LogicalTypesTest.hs
+++ b/test/LogicalTypesTest.hs
@@ -1,84 +1,92 @@
 {-# LANGUAGE BlockArguments #-}
+{-# LANGUAGE DataKinds #-}
+{-# LANGUAGE DuplicateRecordFields #-}
+{-# LANGUAGE TypeApplications #-}
 {-# OPTIONS_GHC -Wno-deprecations #-}
 
 module LogicalTypesTest (tests) where
 
 import Control.Exception (bracket)
 import Control.Monad (forM_, when, (>=>))
+import Data.Coerce (coerce)
 import Data.List (stripPrefix)
 import Data.Word (Word32, Word8)
 import Database.DuckDB.FFI
-import Database.DuckDB.FFI.Deprecated
-import Foreign.C.String (peekCString, withCString)
+import Foreign.C.ConstPtr (ConstPtr (..))
+import Foreign.C.String (peekCString)
 import Foreign.Marshal.Array (withArray)
 import Foreign.Marshal.Utils (withMany)
-import Foreign.Ptr (castPtr, nullPtr)
+import Foreign.Ptr (nullPtr)
+import GHC.Records (getField)
 import Test.Tasty (TestTree, testGroup)
 import Test.Tasty.HUnit (assertBool, assertFailure, testCase, (@?=))
 import Text.Read (readMaybe)
-import Utils (withConnection, withDatabase, withLogicalType, withResult)
+import Utils (withConnection, withConstCString, withDatabase, withLogicalType, withResult)
 
 tests :: TestTree
 tests =
-    testGroup
-        "Logical Type Interface"
-        [ primitiveLogicalTypes
-        , decimalLogicalType
-        , invalidDecimalLogicalType
-        , variantLogicalType
-        , enumLogicalType
-        , compositeLogicalTypes
-        , aliasRoundtrip
-        , registerLogicalType
-        , geometryTypeCrs
-        , geometryTypeCrsOwnership
-        ]
+  testGroup
+    "Logical Type Interface"
+    [ primitiveLogicalTypes
+    , decimalLogicalType
+    , invalidDecimalLogicalType
+    , variantLogicalType
+    , enumLogicalType
+    , compositeLogicalTypes
+    , aliasRoundtrip
+    , registerLogicalType
+    , geometryTypeCrs
+    , geometryTypeCrsOwnership
+    ]
 
 primitiveLogicalTypes :: TestTree
 primitiveLogicalTypes =
-    testCase "primitive logical types report their ids" $
-        forM_ primitives \(duckType, expected) ->
-            withLogicalType (c_duckdb_create_logical_type duckType) \lt -> do
-                typeId <- c_duckdb_get_type_id lt
-                typeId @?= expected
+  testCase "primitive logical types report their ids" $
+    forM_ primitives \(duckType, expected) ->
+      withLogicalType (c_duckdb_create_logical_type (DuckDBTypeAlias duckType)) \lt -> do
+        typeId <- (fmap (getField @"unwrap") . c_duckdb_get_type_id) lt
+        typeId @?= expected
   where
     primitives =
-        [ (DuckDBTypeBoolean, DuckDBTypeBoolean)
-        , (DuckDBTypeInteger, DuckDBTypeInteger)
-        , (DuckDBTypeVarchar, DuckDBTypeVarchar)
-        , (DuckDBTypeBlob, DuckDBTypeBlob)
-        ]
+      [ (DuckDBTypeBoolean, DuckDBTypeBoolean)
+      , (DuckDBTypeInteger, DuckDBTypeInteger)
+      , (DuckDBTypeVarchar, DuckDBTypeVarchar)
+      , (DuckDBTypeBlob, DuckDBTypeBlob)
+      ]
 
 -- | VARIANT needs the complete descriptor from an executed query.
 variantLogicalType :: TestTree
 variantLogicalType =
-    testCase "query-derived VARIANT exposes its physical children" $
-        withDatabase \db ->
-            withConnection db \conn ->
-                withResult conn "SELECT NULL::VARIANT" \result ->
-                    withLogicalType (c_duckdb_column_logical_type result 0) \logical -> do
-                        c_duckdb_get_type_id logical >>= (@?= DuckDBTypeVariant)
-                        c_duckdb_struct_type_child_count logical >>= (@?= 4)
+  testCase "query-derived VARIANT exposes its physical children" $
+    withDatabase \db ->
+      withConnection db \conn ->
+        withResult conn "SELECT NULL::VARIANT" \result ->
+          withLogicalType (c_duckdb_column_logical_type result 0) \logical -> do
+            c_duckdb_get_type_id logical
+              >>= (@?= DuckDBTypeVariant) . (getField @"unwrap")
+            c_duckdb_struct_type_child_count logical >>= (@?= 4)
 
 -- | Invalid decimal metadata became safe to pass to the C API in 1.5.4.
 invalidDecimalLogicalType :: TestTree
 invalidDecimalLogicalType =
-    testCase "invalid decimal types return NULL on DuckDB 1.5.4 and later" $ do
-        version <- c_duckdb_library_version >>= peekCString
-        case stripPrefix "v1.5." version >>= readMaybe of
-            Just patch | patch >= (4 :: Int) ->
-                forM_ [(0, 0), (39, 0), (2, 3), (255, 0)] \(width, scale) ->
-                    withLogicalType (c_duckdb_create_decimal_type width scale) (@?= nullPtr)
-            _ -> pure ()
+  testCase "invalid decimal types return NULL on DuckDB 1.5.4 and later" $ do
+    version <- c_duckdb_library_version >>= (peekCString . coerce)
+    case stripPrefix "v1.5." version >>= readMaybe of
+      Just patch | patch >= (4 :: Int) ->
+        forM_ [(0, 0), (39, 0), (2, 3), (255, 0)] \(width, scale) ->
+          withLogicalType (c_duckdb_create_decimal_type width scale) (@?= coerce nullPtr)
+      _ -> pure ()
 
 decimalLogicalType :: TestTree
 decimalLogicalType =
-    testCase "decimal logical type exposes width/scale/internal type" $
-        withLogicalType (c_duckdb_create_decimal_type width scale) \lt -> do
-            c_duckdb_get_type_id lt >>= (@?= DuckDBTypeDecimal)
-            c_duckdb_decimal_width lt >>= (@?= width)
-            c_duckdb_decimal_scale lt >>= (@?= scale)
-            c_duckdb_decimal_internal_type lt >>= (@?= DuckDBTypeBigInt)
+  testCase "decimal logical type exposes width/scale/internal type" $
+    withLogicalType (c_duckdb_create_decimal_type width scale) \lt -> do
+      c_duckdb_get_type_id lt
+        >>= (@?= DuckDBTypeDecimal) . (getField @"unwrap")
+      c_duckdb_decimal_width lt >>= (@?= width)
+      c_duckdb_decimal_scale lt >>= (@?= scale)
+      c_duckdb_decimal_internal_type lt
+        >>= (@?= DuckDBTypeBigInt) . (getField @"unwrap")
   where
     width, scale :: Word8
     width = 18
@@ -86,146 +94,154 @@
 
 enumLogicalType :: TestTree
 enumLogicalType =
-    testCase "enum logical type exposes dictionary" $ do
-        enumType <-
-            withMany withCString ["Small", "Medium", "Large"] \namePtrs ->
-                withArray namePtrs (`c_duckdb_create_enum_type` 3)
-        withLogicalType (pure enumType) \lt -> do
-            c_duckdb_get_type_id lt >>= (@?= DuckDBTypeEnum)
-            c_duckdb_enum_internal_type lt >>= (@?= DuckDBTypeUTinyInt)
-            c_duckdb_enum_dictionary_size lt >>= (@?= (3 :: Word32))
-            valuePtr <- c_duckdb_enum_dictionary_value lt 1
-            peekCString valuePtr >>= (@?= "Medium")
-            c_duckdb_free (castPtr valuePtr)
+  testCase "enum logical type exposes dictionary" $ do
+    enumType <-
+      withMany withConstCString ["Small", "Medium", "Large"] \namePtrs ->
+        withArray namePtrs (`c_duckdb_create_enum_type` 3)
+    withLogicalType (pure enumType) \lt -> do
+      c_duckdb_get_type_id lt
+        >>= (@?= DuckDBTypeEnum) . (getField @"unwrap")
+      c_duckdb_enum_internal_type lt
+        >>= (@?= DuckDBTypeUTinyInt) . (getField @"unwrap")
+      c_duckdb_enum_dictionary_size lt >>= (@?= (3 :: Word32))
+      valuePtr <- c_duckdb_enum_dictionary_value lt 1
+      peekCString (coerce valuePtr) >>= (@?= "Medium")
+      c_duckdb_free (coerce valuePtr)
 
 compositeLogicalTypes :: TestTree
 compositeLogicalTypes =
-    testCase "composite logical types expose nesting metadata" $ do
-        -- List type
-        withLogicalType (c_duckdb_create_logical_type DuckDBTypeInteger) \child -> do
-            listType <- c_duckdb_create_list_type child
-            withLogicalType (pure listType) \lt -> do
-                c_duckdb_get_type_id lt >>= (@?= DuckDBTypeList)
-                listChild <- c_duckdb_list_type_child_type lt
-                withLogicalType (pure listChild) (c_duckdb_get_type_id >=> (@?= DuckDBTypeInteger))
+  testCase "composite logical types expose nesting metadata" $ do
+    -- List type
+    withLogicalType (c_duckdb_create_logical_type (DuckDBTypeAlias DuckDBTypeInteger)) \child -> do
+      listType <- c_duckdb_create_list_type child
+      withLogicalType (pure listType) \lt -> do
+        c_duckdb_get_type_id lt
+          >>= (@?= DuckDBTypeList) . (getField @"unwrap")
+        listChild <- c_duckdb_list_type_child_type lt
+        withLogicalType (pure listChild) ((fmap (getField @"unwrap") . c_duckdb_get_type_id) >=> (@?= DuckDBTypeInteger))
 
-        -- Array type
-        withLogicalType (c_duckdb_create_logical_type DuckDBTypeInteger) \arrayChild -> do
-            arrayType <- c_duckdb_create_array_type arrayChild 5
-            withLogicalType (pure arrayType) \lt -> do
-                c_duckdb_get_type_id lt >>= (@?= DuckDBTypeArray)
-                arrayChildType <- c_duckdb_array_type_child_type lt
-                withLogicalType (pure arrayChildType) (c_duckdb_get_type_id >=> (@?= DuckDBTypeInteger))
-                c_duckdb_array_type_array_size lt >>= (@?= 5)
+    -- Array type
+    withLogicalType (c_duckdb_create_logical_type (DuckDBTypeAlias DuckDBTypeInteger)) \arrayChild -> do
+      arrayType <- c_duckdb_create_array_type arrayChild 5
+      withLogicalType (pure arrayType) \lt -> do
+        c_duckdb_get_type_id lt
+          >>= (@?= DuckDBTypeArray) . (getField @"unwrap")
+        arrayChildType <- c_duckdb_array_type_child_type lt
+        withLogicalType (pure arrayChildType) ((fmap (getField @"unwrap") . c_duckdb_get_type_id) >=> (@?= DuckDBTypeInteger))
+        c_duckdb_array_type_array_size lt >>= (@?= 5)
 
-        -- Map type
-        withLogicalType (c_duckdb_create_logical_type DuckDBTypeVarchar) \keyType ->
-            withLogicalType (c_duckdb_create_logical_type DuckDBTypeInteger) \valType -> do
-                mapType <- c_duckdb_create_map_type keyType valType
-                withLogicalType (pure mapType) \lt -> do
-                    c_duckdb_get_type_id lt >>= (@?= DuckDBTypeMap)
-                    mapKey <- c_duckdb_map_type_key_type lt
-                    withLogicalType (pure mapKey) (c_duckdb_get_type_id >=> (@?= DuckDBTypeVarchar))
-                    mapVal <- c_duckdb_map_type_value_type lt
-                    withLogicalType (pure mapVal) (c_duckdb_get_type_id >=> (@?= DuckDBTypeInteger))
+    -- Map type
+    withLogicalType (c_duckdb_create_logical_type (DuckDBTypeAlias DuckDBTypeVarchar)) \keyType ->
+      withLogicalType (c_duckdb_create_logical_type (DuckDBTypeAlias DuckDBTypeInteger)) \valType -> do
+        mapType <- c_duckdb_create_map_type keyType valType
+        withLogicalType (pure mapType) \lt -> do
+          c_duckdb_get_type_id lt
+            >>= (@?= DuckDBTypeMap) . (getField @"unwrap")
+          mapKey <- c_duckdb_map_type_key_type lt
+          withLogicalType (pure mapKey) ((fmap (getField @"unwrap") . c_duckdb_get_type_id) >=> (@?= DuckDBTypeVarchar))
+          mapVal <- c_duckdb_map_type_value_type lt
+          withLogicalType (pure mapVal) ((fmap (getField @"unwrap") . c_duckdb_get_type_id) >=> (@?= DuckDBTypeInteger))
 
-        -- Struct type
-        withMany withCString ["id", "name"] \fieldNames -> withLogicalType (c_duckdb_create_logical_type DuckDBTypeInteger) \idType ->
-            withLogicalType (c_duckdb_create_logical_type DuckDBTypeVarchar) \nameType ->
-                withArray [idType, nameType] \childArray ->
-                    withArray fieldNames \namesArray -> do
-                        structType <- c_duckdb_create_struct_type childArray namesArray 2
-                        withLogicalType (pure structType) \lt -> do
-                            c_duckdb_get_type_id lt >>= (@?= DuckDBTypeStruct)
-                            childCount <- c_duckdb_struct_type_child_count lt
-                            childCount @?= 2
-                            childName0 <- c_duckdb_struct_type_child_name lt 0
-                            peekCString childName0 >>= (@?= "id")
-                            c_duckdb_free (castPtr childName0)
-                            structChild1 <- c_duckdb_struct_type_child_type lt 1
-                            withLogicalType (pure structChild1) (c_duckdb_get_type_id >=> (@?= DuckDBTypeVarchar))
+    -- Struct type
+    withMany withConstCString ["id", "name"] \fieldNames -> withLogicalType (c_duckdb_create_logical_type (DuckDBTypeAlias DuckDBTypeInteger)) \idType ->
+      withLogicalType (c_duckdb_create_logical_type (DuckDBTypeAlias DuckDBTypeVarchar)) \nameType ->
+        withArray [idType, nameType] \childArray ->
+          withArray fieldNames \namesArray -> do
+            structType <- c_duckdb_create_struct_type childArray namesArray 2
+            withLogicalType (pure structType) \lt -> do
+              c_duckdb_get_type_id lt
+                >>= (@?= DuckDBTypeStruct) . (getField @"unwrap")
+              childCount <- c_duckdb_struct_type_child_count lt
+              childCount @?= 2
+              childName0 <- c_duckdb_struct_type_child_name lt 0
+              peekCString (coerce childName0) >>= (@?= "id")
+              c_duckdb_free (coerce childName0)
+              structChild1 <- c_duckdb_struct_type_child_type lt 1
+              withLogicalType (pure structChild1) ((fmap (getField @"unwrap") . c_duckdb_get_type_id) >=> (@?= DuckDBTypeVarchar))
 
-        -- Union type
-        withMany withCString ["int_member", "text_member"] \memberNames -> withLogicalType (c_duckdb_create_logical_type DuckDBTypeInteger) \intMember ->
-            withLogicalType (c_duckdb_create_logical_type DuckDBTypeVarchar) \textMember ->
-                withArray [intMember, textMember] \memberArray ->
-                    withArray memberNames \nameArray -> do
-                        unionType <- c_duckdb_create_union_type memberArray nameArray 2
-                        withLogicalType (pure unionType) \lt -> do
-                            c_duckdb_get_type_id lt >>= (@?= DuckDBTypeUnion)
-                            memberCount <- c_duckdb_union_type_member_count lt
-                            memberCount @?= 2
-                            memberName0 <- c_duckdb_union_type_member_name lt 0
-                            peekCString memberName0 >>= (@?= "int_member")
-                            c_duckdb_free (castPtr memberName0)
-                            memberChild <- c_duckdb_union_type_member_type lt 1
-                            withLogicalType (pure memberChild) (c_duckdb_get_type_id >=> (@?= DuckDBTypeVarchar))
+    -- Union type
+    withMany withConstCString ["int_member", "text_member"] \memberNames -> withLogicalType (c_duckdb_create_logical_type (DuckDBTypeAlias DuckDBTypeInteger)) \intMember ->
+      withLogicalType (c_duckdb_create_logical_type (DuckDBTypeAlias DuckDBTypeVarchar)) \textMember ->
+        withArray [intMember, textMember] \memberArray ->
+          withArray memberNames \nameArray -> do
+            unionType <- c_duckdb_create_union_type memberArray nameArray 2
+            withLogicalType (pure unionType) \lt -> do
+              c_duckdb_get_type_id lt
+                >>= (@?= DuckDBTypeUnion) . (getField @"unwrap")
+              memberCount <- c_duckdb_union_type_member_count lt
+              memberCount @?= 2
+              memberName0 <- c_duckdb_union_type_member_name lt 0
+              peekCString (coerce memberName0) >>= (@?= "int_member")
+              c_duckdb_free (coerce memberName0)
+              memberChild <- c_duckdb_union_type_member_type lt 1
+              withLogicalType (pure memberChild) ((fmap (getField @"unwrap") . c_duckdb_get_type_id) >=> (@?= DuckDBTypeVarchar))
 
 aliasRoundtrip :: TestTree
 aliasRoundtrip =
-    testCase "logical type aliases can be set and retrieved" $
-        withLogicalType (c_duckdb_create_logical_type DuckDBTypeInteger) \lt -> do
-            aliasBefore <- c_duckdb_logical_type_get_alias lt
-            aliasBefore @?= nullPtr
-            withCString "custom_alias" $ \alias -> c_duckdb_logical_type_set_alias lt alias
-            aliasAfter <- c_duckdb_logical_type_get_alias lt
-            assertBool "alias pointer should not be null" (aliasAfter /= nullPtr)
-            when (aliasAfter == nullPtr) $
-                assertFailure "expected alias pointer"
-            peekCString aliasAfter >>= (@?= "custom_alias")
-            c_duckdb_free (castPtr aliasAfter)
+  testCase "logical type aliases can be set and retrieved" $
+    withLogicalType (c_duckdb_create_logical_type (DuckDBTypeAlias DuckDBTypeInteger)) \lt -> do
+      aliasBefore <- c_duckdb_logical_type_get_alias lt
+      aliasBefore @?= nullPtr
+      withConstCString "custom_alias" $ \alias -> c_duckdb_logical_type_set_alias lt alias
+      aliasAfter <- c_duckdb_logical_type_get_alias lt
+      assertBool "alias pointer should not be null" (aliasAfter /= nullPtr)
+      when (aliasAfter == nullPtr) $
+        assertFailure "expected alias pointer"
+      peekCString (coerce aliasAfter) >>= (@?= "custom_alias")
+      c_duckdb_free (coerce aliasAfter)
 
 registerLogicalType :: TestTree
 registerLogicalType =
-    testCase "registered logical type alias is accepted in SQL" $
-        withDatabase \db ->
-            withConnection db \conn ->
-                withLogicalType (c_duckdb_create_logical_type DuckDBTypeInteger) \lt -> do
-                    let aliasName = "custom_int_alias"
-                    withCString aliasName $ \aliasPtr ->
-                        c_duckdb_logical_type_set_alias lt aliasPtr
-                    c_duckdb_register_logical_type conn lt nullPtr >>= (@?= DuckDBSuccess)
+  testCase "registered logical type alias is accepted in SQL" $
+    withDatabase \db ->
+      withConnection db \conn ->
+        withLogicalType (c_duckdb_create_logical_type (DuckDBTypeAlias DuckDBTypeInteger)) \lt -> do
+          let aliasName = "custom_int_alias"
+          withConstCString aliasName $ \aliasPtr ->
+            c_duckdb_logical_type_set_alias lt aliasPtr
+          c_duckdb_register_logical_type conn lt (coerce nullPtr) >>= (@?= DuckDBSuccess)
 
-                    let createSql = "CREATE TABLE logical_type_demo (val " ++ aliasName ++ ")"
-                    withResult conn createSql \_ -> pure ()
+          let createSql = "CREATE TABLE logical_type_demo (val " ++ aliasName ++ ")"
+          withResult conn createSql \_ -> pure ()
 
-                    withResult conn "PRAGMA table_info('logical_type_demo')" \resPtr -> do
-                        c_duckdb_row_count resPtr >>= (@?= 1)
-                        typePtr <- c_duckdb_value_varchar resPtr 2 0
-                        typeName <- peekCString typePtr
-                        c_duckdb_free (castPtr typePtr)
-                        typeName @?= aliasName
+          withResult conn "PRAGMA table_info('logical_type_demo')" \resPtr -> do
+            c_duckdb_row_count resPtr >>= (@?= 1)
+            typePtr <- c_duckdb_value_varchar resPtr 2 0
+            typeName <- peekCString (coerce typePtr)
+            c_duckdb_free (coerce typePtr)
+            typeName @?= aliasName
 
 geometryTypeCrs :: TestTree
 geometryTypeCrs =
-    testCase "geometry CRS is null without a coordinate reference system" $
-        withDatabase \db ->
-            withConnection db \conn -> do
-                -- A GEOMETRY column reports the GEOMETRY type id, and carries no
-                -- CRS unless the data supplies one.
-                withResult conn "SELECT 'POINT(1 2)'::GEOMETRY" \resPtr -> do
-                    columnType <- c_duckdb_column_logical_type resPtr 0
-                    withLogicalType (pure columnType) \lt -> do
-                        c_duckdb_get_type_id lt >>= (@?= DuckDBTypeGeometry)
-                        crs <- c_duckdb_geometry_type_get_crs lt
-                        assertBool "plain GEOMETRY has no CRS" (crs == nullPtr)
+  testCase "geometry CRS is null without a coordinate reference system" $
+    withDatabase \db ->
+      withConnection db \conn -> do
+        -- A GEOMETRY column reports the GEOMETRY type id, and carries no
+        -- CRS unless the data supplies one.
+        withResult conn "SELECT 'POINT(1 2)'::GEOMETRY" \resPtr -> do
+          columnType <- c_duckdb_column_logical_type resPtr 0
+          withLogicalType (pure columnType) \lt -> do
+            c_duckdb_get_type_id lt
+              >>= (@?= DuckDBTypeGeometry) . (getField @"unwrap")
+            crs <- c_duckdb_geometry_type_get_crs lt
+            assertBool "plain GEOMETRY has no CRS" (crs == nullPtr)
 
-                -- Types other than GEOMETRY never have a CRS.
-                withLogicalType (c_duckdb_create_logical_type DuckDBTypeInteger) \lt -> do
-                    crs <- c_duckdb_geometry_type_get_crs lt
-                    assertBool "INTEGER has no CRS" (crs == nullPtr)
+        -- Types other than GEOMETRY never have a CRS.
+        withLogicalType (c_duckdb_create_logical_type (DuckDBTypeAlias DuckDBTypeInteger)) \lt -> do
+          crs <- c_duckdb_geometry_type_get_crs lt
+          assertBool "INTEGER has no CRS" (crs == nullPtr)
 
 -- | The caller owns the returned CRS independently of the type and result.
 geometryTypeCrsOwnership :: TestTree
 geometryTypeCrsOwnership =
-    testCase "geometry CRS outlives its type and result" $
-        bracket
-            ( withDatabase \db ->
-                withConnection db \conn ->
-                    withResult conn "SELECT ST_SetCRS('POINT(1 2)'::GEOMETRY, 'duckdb-haskell-test-crs')" \result ->
-                        withLogicalType (c_duckdb_column_logical_type result 0) c_duckdb_geometry_type_get_crs
-            )
-            (c_duckdb_free . castPtr)
-            \crs -> do
-                assertBool "expected an owned CRS string" (crs /= nullPtr)
-                peekCString crs >>= (@?= "duckdb-haskell-test-crs")
+  testCase "geometry CRS outlives its type and result" $
+    bracket
+      ( withDatabase \db ->
+          withConnection db \conn ->
+            withResult conn "SELECT ST_SetCRS('POINT(1 2)'::GEOMETRY, 'duckdb-haskell-test-crs')" \result ->
+              withLogicalType (c_duckdb_column_logical_type result 0) c_duckdb_geometry_type_get_crs
+      )
+      (c_duckdb_free . coerce)
+      \crs -> do
+        assertBool "expected an owned CRS string" (crs /= nullPtr)
+        peekCString (coerce crs) >>= (@?= "duckdb-haskell-test-crs")
diff --git a/test/Main.hs b/test/Main.hs
--- a/test/Main.hs
+++ b/test/Main.hs
@@ -35,38 +35,38 @@
 
 main :: IO ()
 main =
-    defaultMain $
-        testGroup
-            "DuckDB FFI"
-            [ OpenConnectTest.tests
-            , ErrorDataTest.tests
-            , ConfigurationTest.tests
-            , PreparedStatementsTest.tests
-            , BindValuesTest.tests
-            , ExecutePreparedStatementsTest.tests
-            , ExtractStatementsTest.tests
-            , LogicalTypesTest.tests
-            , DataChunkTest.tests
-            , VectorTest.tests
-            , ValidityMaskTest.tests
-            , ScalarFunctionsTest.tests
-            , AggregateFunctionsTest.tests
-            , TableFunctionsTest.tests
-            , ProfilingInfoTest.tests
-            , SelectionVectorTest.tests
-            , PendingResultTest.tests
-            , ValueInterfaceTest.tests
-            , QueryExecutionTest.tests
-            , ResultFunctionsTest.tests
-            , SafeFetchTest.tests
-            , HelpersTest.tests
-            , TableDescriptionTest.tests
-            , AppenderTest.tests
-            , CastFunctionsTest.tests
-            , ExpressionTest.tests
-            , ReplacementScansTest.tests
-            , ArrowInterfaceDeprecatedTests.tests
-            , ArrowInterfaceTest.tests
-            , StreamingResultTest.tests
-            , ThreadingTest.tests
-            ]
+  defaultMain $
+    testGroup
+      "DuckDB FFI"
+      [ OpenConnectTest.tests
+      , ErrorDataTest.tests
+      , ConfigurationTest.tests
+      , PreparedStatementsTest.tests
+      , BindValuesTest.tests
+      , ExecutePreparedStatementsTest.tests
+      , ExtractStatementsTest.tests
+      , LogicalTypesTest.tests
+      , DataChunkTest.tests
+      , VectorTest.tests
+      , ValidityMaskTest.tests
+      , ScalarFunctionsTest.tests
+      , AggregateFunctionsTest.tests
+      , TableFunctionsTest.tests
+      , ProfilingInfoTest.tests
+      , SelectionVectorTest.tests
+      , PendingResultTest.tests
+      , ValueInterfaceTest.tests
+      , QueryExecutionTest.tests
+      , ResultFunctionsTest.tests
+      , SafeFetchTest.tests
+      , HelpersTest.tests
+      , TableDescriptionTest.tests
+      , AppenderTest.tests
+      , CastFunctionsTest.tests
+      , ExpressionTest.tests
+      , ReplacementScansTest.tests
+      , ArrowInterfaceDeprecatedTests.tests
+      , ArrowInterfaceTest.tests
+      , StreamingResultTest.tests
+      , ThreadingTest.tests
+      ]
diff --git a/test/OpenConnectTest.hs b/test/OpenConnectTest.hs
--- a/test/OpenConnectTest.hs
+++ b/test/OpenConnectTest.hs
@@ -1,145 +1,153 @@
 {-# LANGUAGE BlockArguments #-}
-{-# LANGUAGE RecordWildCards #-}
+{-# LANGUAGE DataKinds #-}
+{-# LANGUAGE DuplicateRecordFields #-}
+{-# LANGUAGE TypeApplications #-}
 
 module OpenConnectTest (tests) where
 
 import Control.Monad (forM_, when)
+import Data.Coerce (coerce)
 import Data.Version (Version (..), parseVersion)
 import Database.DuckDB.FFI
-import Foreign.C.String (peekCString, withCString)
+import Foreign.C.ConstPtr (ConstPtr (..))
+import Foreign.C.String (peekCString)
 import Foreign.C.Types (CBool (..))
 import Foreign.Marshal.Alloc (alloca)
-import Foreign.Ptr (castPtr, nullPtr)
+import Foreign.Ptr (nullPtr)
 import Foreign.Storable (peek, poke)
+import GHC.Records (getField)
 import System.Environment (lookupEnv)
 import Test.Tasty (TestTree, testGroup)
 import Test.Tasty.HUnit (assertBool, assertFailure, testCase, (@?=))
 import Text.ParserCombinators.ReadP (char, eof, readP_to_S)
+import Utils (withConstCString)
 
 tests :: TestTree
 tests =
-    testGroup
-        "Open Connect"
-        [ testLibraryVersion
-        , testOpenAndConnect
-        , testOpenExtWithConfig
-        , testInstanceCache
-        ]
+  testGroup
+    "Open Connect"
+    [ testLibraryVersion
+    , testOpenAndConnect
+    , testOpenExtWithConfig
+    , testInstanceCache
+    ]
 
 testLibraryVersion :: TestTree
 testLibraryVersion =
-    testCase "loads a supported DuckDB runtime" $ do
-        versionPtr <- c_duckdb_library_version
-        version <- peekCString versionPtr
-        let unsupported = "Expected DuckDB >= 1.5.3 and < 1.6; loaded " <> version
-        case readP_to_S (char 'v' *> parseVersion <* eof) version of
-            [(Version [1, 5, patch] [], "")] -> assertBool unsupported (patch >= 3)
-            _ -> assertFailure unsupported
-        expected <- lookupEnv "DUCKDB_TEST_VERSION"
-        forM_ expected $ \wanted -> version @?= ('v' : wanted)
+  testCase "loads a supported DuckDB runtime" $ do
+    versionPtr <- c_duckdb_library_version
+    version <- peekCString (coerce versionPtr)
+    let unsupported = "Expected a DuckDB 2.0 release; loaded " <> version
+    case readP_to_S (char 'v' *> parseVersion <* eof) version of
+      [(Version [2, 0, _] [], "")] -> pure ()
+      _ -> assertFailure unsupported
+    expected <- lookupEnv "DUCKDB_TEST_VERSION"
+    forM_ expected $ \wanted -> version @?= ('v' : wanted)
 
 testOpenAndConnect :: TestTree
 testOpenAndConnect =
-    testCase "open, connect, and gather connection details" $
-        withCString ":memory:" $ \path ->
-            alloca $ \dbPtr -> do
-                state <- c_duckdb_open path dbPtr
-                state @?= DuckDBSuccess
-                db <- peek dbPtr
+  testCase "open, connect, and gather connection details" $
+    withConstCString ":memory:" $ \path ->
+      alloca $ \dbPtr -> do
+        state <- c_duckdb_open path dbPtr
+        state @?= DuckDBSuccess
+        db <- peek dbPtr
 
-                alloca $ \connPtr -> do
-                    connState <- c_duckdb_connect db connPtr
-                    connState @?= DuckDBSuccess
-                    conn <- peek connPtr
+        alloca $ \connPtr -> do
+          connState <- c_duckdb_connect db connPtr
+          connState @?= DuckDBSuccess
+          conn <- peek connPtr
 
-                    -- Query progress information (should succeed even without a running query)
-                    alloca $ \progressPtr -> do
-                        poke progressPtr (DuckDBQueryProgress 0 0 0)
-                        c_duckdb_query_progress conn progressPtr
-                        DuckDBQueryProgress{..} <- peek progressPtr
-                        assertBool "rows processed should be non-negative" (duckDBQueryProgressRowsProcessed >= 0 && duckDBQueryProgressTotalRows >= 0)
+          -- Query progress information (should succeed even without a running query)
+          alloca $ \progressPtr -> do
+            poke progressPtr (DuckDBQueryProgress 0 0 0)
+            c_duckdb_query_progress conn >>= poke progressPtr
+            progress <- peek progressPtr
+            assertBool
+              "rows processed should be non-negative"
+              (getField @"rows_processed" progress >= 0 && getField @"total_rows_to_process" progress >= 0)
 
-                    -- Interrupt is a no-op but should succeed
-                    c_duckdb_interrupt conn
+          -- Interrupt is a no-op but should succeed
+          c_duckdb_interrupt conn
 
-                    -- Retrieve client context and confirm it points back to the same connection
-                    alloca $ \ctxPtr -> do
-                        poke ctxPtr nullPtr
-                        c_duckdb_connection_get_client_context conn ctxPtr
-                        ctx <- peek ctxPtr
-                        assertBool "client context should not be null" (ctx /= nullPtr)
-                        cid <- c_duckdb_client_context_get_connection_id ctx
-                        assertBool "connection id should be non-negative" (cid >= 0)
-                        c_duckdb_destroy_client_context ctxPtr
+          -- Retrieve client context and confirm it points back to the same connection
+          alloca $ \ctxPtr -> do
+            poke ctxPtr (coerce nullPtr)
+            c_duckdb_connection_get_client_context conn ctxPtr
+            ctx <- peek ctxPtr
+            assertBool "client context should not be null" (ctx /= coerce nullPtr)
+            cid <- c_duckdb_client_context_get_connection_id ctx
+            assertBool "connection id should be non-negative" (cid >= 0)
+            c_duckdb_destroy_client_context ctxPtr
 
-                    -- Retrieve arrow options object
-                    alloca $ \arrowPtr -> do
-                        poke arrowPtr nullPtr
-                        c_duckdb_connection_get_arrow_options conn arrowPtr
-                        arrowOpts <- peek arrowPtr
-                        assertBool "arrow options should not be null" (arrowOpts /= nullPtr)
-                        c_duckdb_destroy_arrow_options arrowPtr
+          -- Retrieve arrow options object
+          alloca $ \arrowPtr -> do
+            poke arrowPtr (coerce nullPtr)
+            c_duckdb_connection_get_arrow_options conn arrowPtr
+            arrowOpts <- peek arrowPtr
+            assertBool "arrow options should not be null" (arrowOpts /= coerce nullPtr)
+            c_duckdb_destroy_arrow_options arrowPtr
 
-                    -- Fetch table names (there should be none, but the call should succeed)
-                    alloca $ \valuePtr -> do
-                        tablesValue <- withCString "%" $ \filterStr -> c_duckdb_get_table_names conn filterStr (CBool 0)
-                        poke valuePtr tablesValue
-                        c_duckdb_destroy_value valuePtr
+          -- Fetch table names (there should be none, but the call should succeed)
+          alloca $ \valuePtr -> do
+            tablesValue <- withConstCString "%" $ \filterStr -> c_duckdb_get_table_names conn filterStr (CBool 0)
+            poke valuePtr tablesValue
+            c_duckdb_destroy_value valuePtr
 
-                    -- Disconnect and close database
-                    c_duckdb_disconnect connPtr
+          -- Disconnect and close database
+          c_duckdb_disconnect connPtr
 
-                c_duckdb_close dbPtr
+        c_duckdb_close dbPtr
 
 testOpenExtWithConfig :: TestTree
 testOpenExtWithConfig =
-    testCase "open_ext with configuration" $
-        withCString ":memory:" $ \path ->
-            alloca $ \configPtr -> do
-                cfgState <- c_duckdb_create_config configPtr
-                cfgState @?= DuckDBSuccess
-                config <- peek configPtr
+  testCase "open_ext with configuration" $
+    withConstCString ":memory:" $ \path ->
+      alloca $ \configPtr -> do
+        cfgState <- c_duckdb_create_config configPtr
+        cfgState @?= DuckDBSuccess
+        config <- peek configPtr
 
-                alloca $ \errorPtr -> do
-                    poke errorPtr nullPtr
-                    alloca $ \dbPtr -> do
-                        state <- c_duckdb_open_ext path dbPtr config errorPtr
-                        state @?= DuckDBSuccess
+        alloca $ \errorPtr -> do
+          poke errorPtr (coerce nullPtr)
+          alloca $ \dbPtr -> do
+            state <- c_duckdb_open_ext path dbPtr config errorPtr
+            state @?= DuckDBSuccess
 
-                        errMsgPtr <- peek errorPtr
-                        when (errMsgPtr /= nullPtr) $
-                            c_duckdb_free (castPtr errMsgPtr)
+            errMsgPtr <- peek errorPtr
+            when (errMsgPtr /= nullPtr) $
+              c_duckdb_free (coerce errMsgPtr)
 
-                        c_duckdb_close dbPtr
+            c_duckdb_close dbPtr
 
-                c_duckdb_destroy_config configPtr
+        c_duckdb_destroy_config configPtr
 
 testInstanceCache :: TestTree
 testInstanceCache =
-    testCase "create instance cache and reuse database handle" $
-        withCString ":memory:" $ \path ->
-            alloca $ \configPtr -> do
-                cfgState <- c_duckdb_create_config configPtr
-                cfgState @?= DuckDBSuccess
-                config <- peek configPtr
+  testCase "create instance cache and reuse database handle" $
+    withConstCString ":memory:" $ \path ->
+      alloca $ \configPtr -> do
+        cfgState <- c_duckdb_create_config configPtr
+        cfgState @?= DuckDBSuccess
+        config <- peek configPtr
 
-                cache <- c_duckdb_create_instance_cache
-                assertBool "instance cache should not be null" (cache /= nullPtr)
+        cache <- c_duckdb_create_instance_cache
+        assertBool "instance cache should not be null" (cache /= coerce nullPtr)
 
-                alloca $ \dbPtr -> do
-                    alloca $ \errorPtr -> do
-                        poke errorPtr nullPtr
-                        state <- c_duckdb_get_or_create_from_cache cache path dbPtr config errorPtr
-                        state @?= DuckDBSuccess
-                        err <- peek errorPtr
-                        when (err /= nullPtr) $
-                            c_duckdb_free (castPtr err)
+        alloca $ \dbPtr -> do
+          alloca $ \errorPtr -> do
+            poke errorPtr (coerce nullPtr)
+            state <- c_duckdb_get_or_create_from_cache cache path dbPtr config errorPtr
+            state @?= DuckDBSuccess
+            err <- peek errorPtr
+            when (err /= nullPtr) $
+              c_duckdb_free (coerce err)
 
-                        -- the database returned from the cache should be usable (we close it immediately)
-                        c_duckdb_close dbPtr
+            -- the database returned from the cache should be usable (we close it immediately)
+            c_duckdb_close dbPtr
 
-                alloca $ \cachePtr -> do
-                    poke cachePtr cache
-                    c_duckdb_destroy_instance_cache cachePtr
+        alloca $ \cachePtr -> do
+          poke cachePtr cache
+          c_duckdb_destroy_instance_cache cachePtr
 
-                c_duckdb_destroy_config configPtr
+        c_duckdb_destroy_config configPtr
diff --git a/test/PendingResultTest.hs b/test/PendingResultTest.hs
--- a/test/PendingResultTest.hs
+++ b/test/PendingResultTest.hs
@@ -4,211 +4,212 @@
 module PendingResultTest (tests) where
 
 import Control.Monad (forM_, when)
+import Data.Coerce (coerce)
 import Data.Int (Int32, Int64)
 import Data.Maybe (isNothing)
 import Database.DuckDB.FFI
-import Database.DuckDB.FFI.Deprecated
-import Foreign.C.String (peekCString, withCString)
+import Foreign.C.ConstPtr (ConstPtr (..))
+import Foreign.C.String (peekCString)
 import Foreign.C.Types (CBool (..))
 import Foreign.Marshal.Alloc (alloca)
 import Foreign.Ptr (Ptr, nullPtr)
 import Foreign.Storable (peek, poke)
 import Test.Tasty (TestTree, testGroup)
 import Test.Tasty.HUnit (assertBool, assertFailure, testCase, (@?=))
-import Utils (withConnection, withDatabase)
+import Utils (withConnection, withConstCString, withDatabase)
 
 tests :: TestTree
 tests =
-    testGroup
-        "Pending Result Interface"
-        [ pendingPreparedRoundtrip
-        , pendingPreparedStreamingRoundtrip
-        , pendingPreparedReportsError
-        ]
+  testGroup
+    "Pending Result Interface"
+    [ pendingPreparedRoundtrip
+    , pendingPreparedStreamingRoundtrip
+    , pendingPreparedReportsError
+    ]
 
 withChunk :: DuckDBDataChunk -> (Ptr DuckDBDataChunk -> IO ()) -> IO ()
 withChunk chunk action =
-    alloca \chunkPtr -> do
-        poke chunkPtr chunk
-        action chunkPtr
+  alloca \chunkPtr -> do
+    poke chunkPtr chunk
+    action chunkPtr
 
 pendingErrorMessage :: DuckDBPendingResult -> IO (Maybe String)
 pendingErrorMessage pending = do
-    errPtr <- c_duckdb_pending_error pending
-    if errPtr == nullPtr
-        then pure Nothing
-        else Just <$> peekCString errPtr
+  errPtr <- c_duckdb_pending_error pending
+  if errPtr == coerce nullPtr
+    then pure Nothing
+    else Just <$> peekCString (coerce errPtr)
 
 assertPendingState :: DuckDBPendingState -> IO ()
 assertPendingState state =
-    let valid =
-            state == DuckDBPendingResultReady
-                || state == DuckDBPendingResultNotReady
-                || state == DuckDBPendingError
-                || state == DuckDBPendingNoTasksAvailable
-     in assertBool "unexpected pending state" valid
+  let valid =
+        state == DuckDBPendingResultReady
+          || state == DuckDBPendingResultNotReady
+          || state == DuckDBPendingError
+          || state == DuckDBPendingNoTasksAvailable
+  in  assertBool "unexpected pending state" valid
 
 pendingPreparedRoundtrip :: TestTree
 pendingPreparedRoundtrip =
-    testCase "pending_prepared executes query to completion" $
-        withDatabase \db ->
-            withConnection db \conn -> do
-                forM_
-                    [ "CREATE TABLE pending_numbers(val INTEGER);"
-                    , "INSERT INTO pending_numbers VALUES (1), (2), (3);"
-                    ]
-                    \sql ->
-                        withCString sql \cSql ->
-                            alloca \resPtr -> do
-                                st <- c_duckdb_query conn cSql resPtr
-                                st @?= DuckDBSuccess
-                                c_duckdb_destroy_result resPtr
+  testCase "pending_prepared executes query to completion" $
+    withDatabase \db ->
+      withConnection db \conn -> do
+        forM_
+          [ "CREATE TABLE pending_numbers(val INTEGER);"
+          , "INSERT INTO pending_numbers VALUES (1), (2), (3);"
+          ]
+          \sql ->
+            withConstCString sql \cSql ->
+              alloca \resPtr -> do
+                st <- c_duckdb_query conn cSql resPtr
+                st @?= DuckDBSuccess
+                c_duckdb_destroy_result resPtr
 
-                withCString "SELECT SUM(val) FROM pending_numbers;" \querySql ->
-                    alloca \stmtPtr -> do
-                        st <- c_duckdb_prepare conn querySql stmtPtr
-                        st @?= DuckDBSuccess
-                        stmt <- peek stmtPtr
-                        assertBool "prepared statement should not be null" (stmt /= nullPtr)
+        withConstCString "SELECT SUM(val) FROM pending_numbers;" \querySql ->
+          alloca \stmtPtr -> do
+            st <- c_duckdb_prepare conn querySql stmtPtr
+            st @?= DuckDBSuccess
+            stmt <- peek stmtPtr
+            assertBool "prepared statement should not be null" (stmt /= coerce nullPtr)
 
-                        alloca \pendingPtr -> do
-                            stPending <- c_duckdb_pending_prepared stmt pendingPtr
-                            stPending @?= DuckDBSuccess
-                            pending <- peek pendingPtr
-                            assertBool "pending result should not be null" (pending /= nullPtr)
+            alloca \pendingPtr -> do
+              stPending <- c_duckdb_pending_prepared stmt pendingPtr
+              stPending @?= DuckDBSuccess
+              pending <- peek pendingPtr
+              assertBool "pending result should not be null" (pending /= coerce nullPtr)
 
-                            stateBefore <- c_duckdb_pending_execute_check_state pending
-                            assertPendingState stateBefore
-                            _ <- c_duckdb_pending_execution_is_finished stateBefore
+              stateBefore <- c_duckdb_pending_execute_check_state pending
+              assertPendingState stateBefore
+              _ <- c_duckdb_pending_execution_is_finished stateBefore
 
-                            taskState <- c_duckdb_pending_execute_task pending
-                            assertPendingState taskState
-                            _ <- c_duckdb_pending_execution_is_finished taskState
+              taskState <- c_duckdb_pending_execute_task pending
+              assertPendingState taskState
+              _ <- c_duckdb_pending_execution_is_finished taskState
 
-                            alloca \resPtr -> do
-                                execState <- c_duckdb_execute_pending pending resPtr
-                                execState @?= DuckDBSuccess
+              alloca \resPtr -> do
+                execState <- c_duckdb_execute_pending pending resPtr
+                execState @?= DuckDBSuccess
 
-                                resultFinished <- c_duckdb_pending_execute_check_state pending
-                                assertPendingState resultFinished
+                resultFinished <- c_duckdb_pending_execute_check_state pending
+                assertPendingState resultFinished
 
-                                rowCount <- c_duckdb_row_count resPtr
-                                rowCount @?= 1
-                                total <- c_duckdb_value_int64 resPtr 0 0
-                                (total :: Int64) @?= 6
+                rowCount <- c_duckdb_row_count resPtr
+                rowCount @?= 1
+                total <- c_duckdb_value_int64 resPtr 0 0
+                (total :: Int64) @?= 6
 
-                                c_duckdb_destroy_result resPtr
+                c_duckdb_destroy_result resPtr
 
-                            errMsg <- pendingErrorMessage pending
-                            assertBool "no error expected for successful pending execution" (isNothing errMsg)
+              errMsg <- pendingErrorMessage pending
+              assertBool "no error expected for successful pending execution" (isNothing errMsg)
 
-                            c_duckdb_destroy_pending pendingPtr
+              c_duckdb_destroy_pending pendingPtr
 
-                        c_duckdb_destroy_prepare stmtPtr
+            c_duckdb_destroy_prepare stmtPtr
 
 pendingPreparedStreamingRoundtrip :: TestTree
 pendingPreparedStreamingRoundtrip =
-    testCase "pending_prepared_streaming yields streaming duckdb_result" $
-        withDatabase \db ->
-            withConnection db \conn -> do
-                forM_
-                    [ "CREATE TABLE pending_stream(id INTEGER);"
-                    , "INSERT INTO pending_stream VALUES (1), (2), (3), (4);"
-                    ]
-                    \sql ->
-                        withCString sql \cSql ->
-                            alloca \resPtr -> do
-                                st <- c_duckdb_query conn cSql resPtr
-                                st @?= DuckDBSuccess
-                                c_duckdb_destroy_result resPtr
+  testCase "pending_prepared_streaming yields streaming duckdb_result" $
+    withDatabase \db ->
+      withConnection db \conn -> do
+        forM_
+          [ "CREATE TABLE pending_stream(id INTEGER);"
+          , "INSERT INTO pending_stream VALUES (1), (2), (3), (4);"
+          ]
+          \sql ->
+            withConstCString sql \cSql ->
+              alloca \resPtr -> do
+                st <- c_duckdb_query conn cSql resPtr
+                st @?= DuckDBSuccess
+                c_duckdb_destroy_result resPtr
 
-                withCString "SELECT * FROM pending_stream ORDER BY id;" \querySql ->
-                    alloca \stmtPtr -> do
-                        st <- c_duckdb_prepare conn querySql stmtPtr
-                        st @?= DuckDBSuccess
-                        stmt <- peek stmtPtr
-                        assertBool "prepared statement should not be null" (stmt /= nullPtr)
+        withConstCString "SELECT * FROM pending_stream ORDER BY id;" \querySql ->
+          alloca \stmtPtr -> do
+            st <- c_duckdb_prepare conn querySql stmtPtr
+            st @?= DuckDBSuccess
+            stmt <- peek stmtPtr
+            assertBool "prepared statement should not be null" (stmt /= coerce nullPtr)
 
-                        alloca \pendingPtr -> do
-                            stPending <- c_duckdb_pending_prepared_streaming stmt pendingPtr
-                            stPending @?= DuckDBSuccess
-                            pending <- peek pendingPtr
-                            assertBool "pending result should not be null" (pending /= nullPtr)
+            alloca \pendingPtr -> do
+              stPending <- c_duckdb_pending_prepared_streaming stmt pendingPtr
+              stPending @?= DuckDBSuccess
+              pending <- peek pendingPtr
+              assertBool "pending result should not be null" (pending /= coerce nullPtr)
 
-                            stateBefore <- c_duckdb_pending_execute_check_state pending
-                            assertPendingState stateBefore
-                            _ <- c_duckdb_pending_execution_is_finished stateBefore
+              stateBefore <- c_duckdb_pending_execute_check_state pending
+              assertPendingState stateBefore
+              _ <- c_duckdb_pending_execution_is_finished stateBefore
 
-                            taskState <- c_duckdb_pending_execute_task pending
-                            assertPendingState taskState
-                            _ <- c_duckdb_pending_execution_is_finished taskState
+              taskState <- c_duckdb_pending_execute_task pending
+              assertPendingState taskState
+              _ <- c_duckdb_pending_execution_is_finished taskState
 
-                            alloca \resPtr -> do
-                                execState <- c_duckdb_execute_pending pending resPtr
-                                execState @?= DuckDBSuccess
+              alloca \resPtr -> do
+                execState <- c_duckdb_execute_pending pending resPtr
+                execState @?= DuckDBSuccess
 
-                                streamingFlag <- c_duckdb_result_is_streaming resPtr
-                                streamingFlag @?= CBool 1
+                streamingFlag <- peek resPtr >>= \rawValue -> c_duckdb_result_is_streaming rawValue
+                streamingFlag @?= CBool 1
 
-                                chunk <- c_duckdb_stream_fetch_chunk resPtr
-                                assertBool "streaming fetch should yield a chunk" (chunk /= nullPtr)
+                chunk <- peek resPtr >>= \rawValue -> c_duckdb_stream_fetch_chunk rawValue
+                assertBool "streaming fetch should yield a chunk" (chunk /= coerce nullPtr)
 
-                                chunkSize <- c_duckdb_data_chunk_get_size chunk
-                                assertBool "streamed chunk should have rows" (chunkSize > 0)
+                chunkSize <- c_duckdb_data_chunk_get_size chunk
+                assertBool "streamed chunk should have rows" (chunkSize > 0)
 
-                                withChunk chunk c_duckdb_destroy_data_chunk
-                                c_duckdb_destroy_result resPtr
+                withChunk chunk c_duckdb_destroy_data_chunk
+                c_duckdb_destroy_result resPtr
 
-                            errMsg <- pendingErrorMessage pending
-                            assertBool "no error expected for successful streaming execution" (isNothing errMsg)
+              errMsg <- pendingErrorMessage pending
+              assertBool "no error expected for successful streaming execution" (isNothing errMsg)
 
-                            c_duckdb_destroy_pending pendingPtr
+              c_duckdb_destroy_pending pendingPtr
 
-                        c_duckdb_destroy_prepare stmtPtr
+            c_duckdb_destroy_prepare stmtPtr
 
 pendingPreparedReportsError :: TestTree
 pendingPreparedReportsError =
-    testCase "pending execution surfaces failure details" $
-        withDatabase \db ->
-            withConnection db \conn -> do
-                forM_
-                    [ "CREATE TABLE pending_unique(val INTEGER PRIMARY KEY);"
-                    , "INSERT INTO pending_unique VALUES (1);"
-                    ]
-                    \sql ->
-                        withCString sql \cSql ->
-                            alloca \resPtr -> do
-                                st <- c_duckdb_query conn cSql resPtr
-                                st @?= DuckDBSuccess
-                                c_duckdb_destroy_result resPtr
+  testCase "pending execution surfaces failure details" $
+    withDatabase \db ->
+      withConnection db \conn -> do
+        forM_
+          [ "CREATE TABLE pending_unique(val INTEGER PRIMARY KEY);"
+          , "INSERT INTO pending_unique VALUES (1);"
+          ]
+          \sql ->
+            withConstCString sql \cSql ->
+              alloca \resPtr -> do
+                st <- c_duckdb_query conn cSql resPtr
+                st @?= DuckDBSuccess
+                c_duckdb_destroy_result resPtr
 
-                withCString "INSERT INTO pending_unique VALUES (?);" \insertSql ->
-                    alloca \stmtPtr -> do
-                        st <- c_duckdb_prepare conn insertSql stmtPtr
-                        st @?= DuckDBSuccess
-                        stmt <- peek stmtPtr
-                        assertBool "prepared insert statement should not be null" (stmt /= nullPtr)
+        withConstCString "INSERT INTO pending_unique VALUES (?);" \insertSql ->
+          alloca \stmtPtr -> do
+            st <- c_duckdb_prepare conn insertSql stmtPtr
+            st @?= DuckDBSuccess
+            stmt <- peek stmtPtr
+            assertBool "prepared insert statement should not be null" (stmt /= coerce nullPtr)
 
-                        c_duckdb_bind_int32 stmt 1 (1 :: Int32) >>= (@?= DuckDBSuccess)
+            c_duckdb_bind_int32 stmt 1 (1 :: Int32) >>= (@?= DuckDBSuccess)
 
-                        alloca \pendingPtr -> do
-                            stPending <- c_duckdb_pending_prepared stmt pendingPtr
-                            stPending @?= DuckDBSuccess
-                            pending <- peek pendingPtr
-                            assertBool "pending result should not be null" (pending /= nullPtr)
+            alloca \pendingPtr -> do
+              stPending <- c_duckdb_pending_prepared stmt pendingPtr
+              stPending @?= DuckDBSuccess
+              pending <- peek pendingPtr
+              assertBool "pending result should not be null" (pending /= coerce nullPtr)
 
-                            _ <- c_duckdb_pending_execute_check_state pending
-                            taskState <- c_duckdb_pending_execute_task pending
-                            assertPendingState taskState
+              _ <- c_duckdb_pending_execute_check_state pending
+              taskState <- c_duckdb_pending_execute_task pending
+              assertPendingState taskState
 
-                            alloca \resPtr -> do
-                                execState <- c_duckdb_execute_pending pending resPtr
-                                execState @?= DuckDBError
+              alloca \resPtr -> do
+                execState <- c_duckdb_execute_pending pending resPtr
+                execState @?= DuckDBError
 
-                            errMsg <- pendingErrorMessage pending
-                            when (maybe False null errMsg) $
-                                assertFailure "pending error message should not be empty when present"
+              errMsg <- pendingErrorMessage pending
+              when (maybe False null errMsg) $
+                assertFailure "pending error message should not be empty when present"
 
-                            c_duckdb_destroy_pending pendingPtr
+              c_duckdb_destroy_pending pendingPtr
 
-                        c_duckdb_destroy_prepare stmtPtr
+            c_duckdb_destroy_prepare stmtPtr
diff --git a/test/PreparedStatementsTest.hs b/test/PreparedStatementsTest.hs
--- a/test/PreparedStatementsTest.hs
+++ b/test/PreparedStatementsTest.hs
@@ -1,112 +1,118 @@
 {-# LANGUAGE BlockArguments #-}
+{-# LANGUAGE DataKinds #-}
+{-# LANGUAGE DuplicateRecordFields #-}
+{-# LANGUAGE TypeApplications #-}
 
 module PreparedStatementsTest (tests) where
 
 import Control.Monad (when)
+import Data.Coerce (coerce)
 import Database.DuckDB.FFI
-import Foreign.C.String (peekCString, withCString)
+import Foreign.C.ConstPtr (ConstPtr (..))
+import Foreign.C.String (peekCString)
 import Foreign.Marshal.Alloc (alloca)
 import Foreign.Ptr (nullPtr)
 import Foreign.Storable (peek, poke)
+import GHC.Records (getField)
 import Test.Tasty (TestTree, testGroup)
 import Test.Tasty.HUnit (assertBool, assertFailure, testCase, (@?=))
-import Utils (withConnection, withDatabase)
+import Utils (withConnection, withConstCString, withDatabase)
 
 tests :: TestTree
 tests =
-    testGroup
-        "Prepared Statements"
-        [ preparedStatementMetadata
-        , preparedStatementError
-        ]
+  testGroup
+    "Prepared Statements"
+    [ preparedStatementMetadata
+    , preparedStatementError
+    ]
 
 preparedStatementMetadata :: TestTree
 preparedStatementMetadata =
-    testCase "inspect prepared statement metadata" $
-        withDatabase \db ->
-            withConnection db \conn -> do
-                -- Seed table for column metadata checks
-                withCString "CREATE TABLE numbers(value INTEGER)" \ddl -> do
-                    alloca \resPtr -> do
-                        st <- c_duckdb_query conn ddl resPtr
-                        st @?= DuckDBSuccess
-                        c_duckdb_destroy_result resPtr
+  testCase "inspect prepared statement metadata" $
+    withDatabase \db ->
+      withConnection db \conn -> do
+        -- Seed table for column metadata checks
+        withConstCString "CREATE TABLE numbers(value INTEGER)" \ddl -> do
+          alloca \resPtr -> do
+            st <- c_duckdb_query conn ddl resPtr
+            st @?= DuckDBSuccess
+            c_duckdb_destroy_result resPtr
 
-                let sql = "SELECT value FROM numbers WHERE value = ?"
-                withCString sql \cSql ->
-                    alloca \stmtPtr -> do
-                        st <- c_duckdb_prepare conn cSql stmtPtr
-                        st @?= DuckDBSuccess
-                        stmt <- peek stmtPtr
-                        assertBool "statement pointer should not be null" (stmt /= nullPtr)
+        let sql = "SELECT value FROM numbers WHERE value = ?"
+        withConstCString sql \cSql ->
+          alloca \stmtPtr -> do
+            st <- c_duckdb_prepare conn cSql stmtPtr
+            st @?= DuckDBSuccess
+            stmt <- peek stmtPtr
+            assertBool "statement pointer should not be null" (stmt /= coerce nullPtr)
 
-                        -- Parameter metadata
-                        paramCount <- c_duckdb_nparams stmt
-                        paramCount @?= 1
+            -- Parameter metadata
+            paramCount <- c_duckdb_nparams stmt
+            paramCount @?= 1
 
-                        paramType <- c_duckdb_param_type stmt 0
-                        -- Physical type defaults to invalid until bound; logical type carries information.
-                        paramType @?= DuckDBTypeInvalid
+            paramType <- getField @"unwrap" <$> c_duckdb_param_type stmt 0
+            -- Physical type defaults to invalid until bound; logical type carries information.
+            paramType @?= DuckDBTypeInvalid
 
-                        logicalTypePtr <- c_duckdb_param_logical_type stmt 0
-                        when (logicalTypePtr /= nullPtr) $ do
-                            alloca \typePtr -> do
-                                poke typePtr logicalTypePtr
-                                c_duckdb_destroy_logical_type typePtr
+            logicalTypePtr <- c_duckdb_param_logical_type stmt 0
+            when (logicalTypePtr /= coerce nullPtr) $ do
+              alloca \typePtr -> do
+                poke typePtr logicalTypePtr
+                c_duckdb_destroy_logical_type typePtr
 
-                        namePtr <- c_duckdb_parameter_name stmt 0
-                        when (namePtr /= nullPtr) $ do
-                            name <- peekCString namePtr
-                            name @?= ""
+            namePtr <- c_duckdb_parameter_name stmt 0
+            when (namePtr /= coerce nullPtr) $ do
+              name <- peekCString (coerce namePtr)
+              name @?= ""
 
-                        -- Statement type
-                        stmtType <- c_duckdb_prepared_statement_type stmt
-                        stmtType @?= DuckDBStatementTypeSelect
+            -- Statement type
+            stmtType <- c_duckdb_prepared_statement_type stmt
+            stmtType @?= DuckDBStatementTypeSelect
 
-                        -- Column metadata
-                        colCount <- c_duckdb_prepared_statement_column_count stmt
-                        colCount @?= 1
+            -- Column metadata
+            colCount <- c_duckdb_prepared_statement_column_count stmt
+            colCount @?= 1
 
-                        colNamePtr <- c_duckdb_prepared_statement_column_name stmt 0
-                        colName <- peekCString colNamePtr
-                        colName @?= "value"
+            colNamePtr <- c_duckdb_prepared_statement_column_name stmt 0
+            colName <- peekCString (coerce colNamePtr)
+            colName @?= "value"
 
-                        colType <- c_duckdb_prepared_statement_column_type stmt 0
-                        colType @?= DuckDBTypeInteger
+            colType <- c_duckdb_prepared_statement_column_type stmt 0
+            colType @?= DuckDBTypeAlias DuckDBTypeInteger
 
-                        colLogicalType <- c_duckdb_prepared_statement_column_logical_type stmt 0
-                        assertBool "column logical type should not be null" (colLogicalType /= nullPtr)
-                        alloca \colTypePtr -> do
-                            poke colTypePtr colLogicalType
-                            c_duckdb_destroy_logical_type colTypePtr
+            colLogicalType <- c_duckdb_prepared_statement_column_logical_type stmt 0
+            assertBool "column logical type should not be null" (colLogicalType /= coerce nullPtr)
+            alloca \colTypePtr -> do
+              poke colTypePtr colLogicalType
+              c_duckdb_destroy_logical_type colTypePtr
 
-                        -- Clear bindings succeeds even before binding values
-                        c_duckdb_clear_bindings stmt >>= (@?= DuckDBSuccess)
+            -- Clear bindings succeeds even before binding values
+            c_duckdb_clear_bindings stmt >>= (@?= DuckDBSuccess)
 
-                        -- No preparation error
-                        errPtr <- c_duckdb_prepare_error stmt
-                        when (errPtr /= nullPtr) $ do
-                            msg <- peekCString errPtr
-                            msg @?= ""
+            -- No preparation error
+            errPtr <- c_duckdb_prepare_error stmt
+            when (errPtr /= coerce nullPtr) $ do
+              msg <- peekCString (coerce errPtr)
+              msg @?= ""
 
-                        c_duckdb_destroy_prepare stmtPtr
+            c_duckdb_destroy_prepare stmtPtr
 
 preparedStatementError :: TestTree
 preparedStatementError =
-    testCase "prepare error surfaces message" $
-        withDatabase \db ->
-            withConnection db \conn -> do
-                let badSql = "SELECT * FROM non_existing_table WHERE value = ?"
-                withCString badSql \cSql ->
-                    alloca \stmtPtr -> do
-                        st <- c_duckdb_prepare conn cSql stmtPtr
-                        st @?= DuckDBError
-                        stmt <- peek stmtPtr
-                        if stmt == nullPtr
-                            then assertFailure "expected prepared statement handle after failure"
-                            else do
-                                errMsgPtr <- c_duckdb_prepare_error stmt
-                                when (errMsgPtr == nullPtr) $ assertFailure "expected error message for failed prepare"
-                                msg <- peekCString errMsgPtr
-                                assertBool "error message should mention table" (not (null msg))
-                                c_duckdb_destroy_prepare stmtPtr
+  testCase "prepare error surfaces message" $
+    withDatabase \db ->
+      withConnection db \conn -> do
+        let badSql = "SELECT * FROM non_existing_table WHERE value = ?"
+        withConstCString badSql \cSql ->
+          alloca \stmtPtr -> do
+            st <- c_duckdb_prepare conn cSql stmtPtr
+            st @?= DuckDBError
+            stmt <- peek stmtPtr
+            if stmt == coerce nullPtr
+              then assertFailure "expected prepared statement handle after failure"
+              else do
+                errMsgPtr <- c_duckdb_prepare_error stmt
+                when (errMsgPtr == coerce nullPtr) $ assertFailure "expected error message for failed prepare"
+                msg <- peekCString (coerce errMsgPtr)
+                assertBool "error message should mention table" (not (null msg))
+                c_duckdb_destroy_prepare stmtPtr
diff --git a/test/ProfilingInfoTest.hs b/test/ProfilingInfoTest.hs
--- a/test/ProfilingInfoTest.hs
+++ b/test/ProfilingInfoTest.hs
@@ -3,113 +3,114 @@
 module ProfilingInfoTest (tests) where
 
 import Control.Monad (forM)
+import Data.Coerce (coerce)
 import Database.DuckDB.FFI
-import Foreign.C.String (peekCString, withCString)
+import Foreign.C.ConstPtr (ConstPtr (..))
+import Foreign.C.String (peekCString)
 import Foreign.Marshal.Alloc (alloca)
-import Foreign.Ptr (castPtr, nullPtr)
+import Foreign.Ptr (nullPtr)
 import Test.Tasty (TestTree, testGroup)
 import Test.Tasty.HUnit (assertBool, assertFailure, testCase, (@?=))
-import Utils (destroyDuckValue, withConnection, withDatabase)
+import Utils (destroyDuckValue, withConnection, withConstCString, withDatabase)
 
 tests :: TestTree
 tests =
-    testGroup
-        "Profiling Info"
-        [ profilingDisabledByDefault
-        , profilingMetricsRoundtrip
-        ]
+  testGroup
+    "Profiling Info"
+    [ profilingDisabledByDefault
+    , profilingMetricsRoundtrip
+    ]
 
 profilingDisabledByDefault :: TestTree
 profilingDisabledByDefault =
-    testCase "profiling info requires enabling profiling" $
-        withDatabase \db ->
-            withConnection db \conn -> do
-                infoPtr <- c_duckdb_get_profiling_info conn
-                infoPtr @?= nullPtr
+  testCase "profiling info requires enabling profiling" $
+    withDatabase \db ->
+      withConnection db \conn -> do
+        infoPtr <- c_duckdb_get_profiling_info conn
+        infoPtr @?= coerce nullPtr
 
 profilingMetricsRoundtrip :: TestTree
 profilingMetricsRoundtrip =
-    testCase "collect metrics and traverse profiling tree" $
-        withDatabase \db ->
-            withConnection db \conn -> do
-                runStatement conn "PRAGMA enable_profiling='no_output'"
-                runStatement conn "CREATE TABLE profiling_numbers(value INTEGER)"
-                runStatement conn "INSERT INTO profiling_numbers VALUES (1), (2), (3)"
-                runStatement conn "SELECT sum(value) FROM profiling_numbers"
+  testCase "collect metrics and traverse profiling tree" $
+    withDatabase \db ->
+      withConnection db \conn -> do
+        runStatement conn "PRAGMA enable_profiling='no_output'"
+        runStatement conn "SET tracked_metrics = ['query.cpu_time', 'operator.extra_info']"
+        runStatement conn "CREATE TABLE profiling_numbers(value INTEGER)"
+        runStatement conn "INSERT INTO profiling_numbers VALUES (1), (2), (3)"
+        runStatement conn "SELECT sum(value) FROM profiling_numbers"
 
-                infoPtr <- c_duckdb_get_profiling_info conn
-                assertBool "profiling info pointer should be non-null" (infoPtr /= nullPtr)
+        rootPtr <- c_duckdb_get_profiling_info conn
+        assertBool "profiling info pointer should be non-null" (rootPtr /= coerce nullPtr)
+        rootMetrics <- c_duckdb_profiling_info_get_metrics rootPtr
+        c_duckdb_get_map_size rootMetrics >>= (@?= 0)
+        destroyDuckValue rootMetrics
+        infoPtr <- c_duckdb_profiling_info_get_child rootPtr 0
+        assertBool "operator node should be non-null" (infoPtr /= coerce nullPtr)
 
-                metricsVal <- c_duckdb_profiling_info_get_metrics infoPtr
-                entryCountIdx <- c_duckdb_get_map_size metricsVal
-                assertBool "expected at least one metric entry" (entryCountIdx > 0)
-                entries <- collectMetrics metricsVal entryCountIdx
-                destroyDuckValue metricsVal
+        metricsVal <- c_duckdb_profiling_info_get_metrics infoPtr
+        entryCountIdx <- c_duckdb_get_map_size metricsVal
+        assertBool "expected at least one metric entry" (entryCountIdx > 0)
+        entries <- collectMetrics metricsVal entryCountIdx
+        destroyDuckValue metricsVal
 
-                assertBool "metrics map should contain entries" (not (null entries))
-                let (firstKey, firstValue) = case entries of
-                        (e : _) -> e
-                        [] -> error "unreachable: entries is non-empty"
+        assertBool "metrics map should contain entries" (not (null entries))
+        let (firstKey, firstValue) = case entries of
+              (e : _) -> e
+              [] -> error "unreachable: entries is non-empty"
 
-                withCString firstKey \keyPtr -> do
-                    valueHandle <- c_duckdb_profiling_info_get_value infoPtr keyPtr
-                    assertBool ("metric " <> firstKey <> " should be present") (valueHandle /= nullPtr)
-                    fetchedValue <- duckValueToString valueHandle
-                    destroyDuckValue valueHandle
-                    fetchedValue @?= firstValue
+        withConstCString firstKey \keyPtr -> do
+          valueHandle <- c_duckdb_profiling_info_get_value infoPtr keyPtr
+          assertBool ("metric " <> firstKey <> " should be present") (valueHandle /= coerce nullPtr)
+          fetchedValue <- duckValueToText valueHandle
+          destroyDuckValue valueHandle
+          fetchedValue @?= firstValue
 
-                childCount <- c_duckdb_profiling_info_get_child_count infoPtr
-                assertBool "expected at least one child node" (childCount > 0)
-                let firstChildIdx = 0
-                childPtr <- c_duckdb_profiling_info_get_child infoPtr firstChildIdx
-                assertBool "child pointer should be non-null" (childPtr /= nullPtr)
+        childCount <- c_duckdb_profiling_info_get_child_count infoPtr
+        assertBool "expected at least one child node" (childCount > 0)
+        let firstChildIdx = 0
+        childPtr <- c_duckdb_profiling_info_get_child infoPtr firstChildIdx
+        assertBool "child pointer should be non-null" (childPtr /= coerce nullPtr)
 
-                childMetrics <- c_duckdb_profiling_info_get_metrics childPtr
-                childCountIdx <- c_duckdb_get_map_size childMetrics
-                assertBool "child node should expose metrics" (childCountIdx > 0)
-                destroyDuckValue childMetrics
+        childMetrics <- c_duckdb_profiling_info_get_metrics childPtr
+        childCountIdx <- c_duckdb_get_map_size childMetrics
+        assertBool "child node should expose metrics" (childCountIdx > 0)
+        destroyDuckValue childMetrics
 
 runStatement :: DuckDBConnection -> String -> IO ()
 runStatement conn sql =
-    withCString sql \sqlPtr ->
-        alloca \resPtr -> do
-            state <- c_duckdb_query conn sqlPtr resPtr
-            if state == DuckDBSuccess
-                then c_duckdb_destroy_result resPtr
-                else do
-                    errPtr <- c_duckdb_result_error resPtr
-                    errMsg <-
-                        if errPtr == nullPtr
-                            then pure "unknown error"
-                            else peekCString errPtr
-                    c_duckdb_destroy_result resPtr
-                    assertFailure ("duckdb_query failed: " <> errMsg)
+  withConstCString sql \sqlPtr ->
+    alloca \resPtr -> do
+      state <- c_duckdb_query conn sqlPtr resPtr
+      if state == DuckDBSuccess
+        then c_duckdb_destroy_result resPtr
+        else do
+          errPtr <- c_duckdb_result_error resPtr
+          errMsg <-
+            if errPtr == coerce nullPtr
+              then pure "unknown error"
+              else peekCString (coerce errPtr)
+          c_duckdb_destroy_result resPtr
+          assertFailure ("duckdb_query failed: " <> errMsg)
 
 collectMetrics :: DuckDBValue -> DuckDBIdx -> IO [(String, String)]
 collectMetrics metricsVal entryCountIdx = do
-    let entryCount = fromIntegral entryCountIdx :: Int
-    forM [0 .. entryCount - 1] \i -> do
-        let idx = fromIntegral i :: DuckDBIdx
-        keyHandle <- c_duckdb_get_map_key metricsVal idx
-        keyName <- duckValueToText keyHandle
-        destroyDuckValue keyHandle
+  let entryCount = fromIntegral entryCountIdx :: Int
+  forM [0 .. entryCount - 1] \i -> do
+    let idx = fromIntegral i :: DuckDBIdx
+    keyHandle <- c_duckdb_get_map_key metricsVal idx
+    keyName <- duckValueToText keyHandle
+    destroyDuckValue keyHandle
 
-        valHandle <- c_duckdb_get_map_value metricsVal idx
-        valText <- duckValueToString valHandle
-        destroyDuckValue valHandle
+    valHandle <- c_duckdb_get_map_value metricsVal idx
+    valText <- duckValueToText valHandle
+    destroyDuckValue valHandle
 
-        pure (keyName, valText)
+    pure (keyName, valText)
 
 duckValueToText :: DuckDBValue -> IO String
 duckValueToText valHandle = do
-    strPtr <- c_duckdb_get_varchar valHandle
-    text <- peekCString strPtr
-    c_duckdb_free (castPtr strPtr)
-    pure text
-
-duckValueToString :: DuckDBValue -> IO String
-duckValueToString valHandle = do
-    strPtr <- c_duckdb_value_to_string valHandle
-    text <- peekCString strPtr
-    c_duckdb_free (castPtr strPtr)
-    pure text
+  strPtr <- c_duckdb_get_varchar valHandle
+  text <- peekCString (coerce strPtr)
+  c_duckdb_free (coerce strPtr)
+  pure text
diff --git a/test/QueryExecutionTest.hs b/test/QueryExecutionTest.hs
--- a/test/QueryExecutionTest.hs
+++ b/test/QueryExecutionTest.hs
@@ -1,94 +1,99 @@
 {-# LANGUAGE BlockArguments #-}
+{-# LANGUAGE DataKinds #-}
+{-# LANGUAGE DuplicateRecordFields #-}
+{-# LANGUAGE TypeApplications #-}
 {-# OPTIONS_GHC -Wno-deprecations #-}
 
 module QueryExecutionTest (tests) where
 
 import Control.Monad (forM_, when)
+import Data.Coerce (coerce)
 import Database.DuckDB.FFI
-import Database.DuckDB.FFI.Deprecated
-import Foreign.C.String (peekCString, withCString)
+import Foreign.C.ConstPtr (ConstPtr (..))
+import Foreign.C.String (peekCString)
 import Foreign.Marshal.Alloc (alloca)
 import Foreign.Ptr (nullPtr)
-import Foreign.Storable (poke)
+import Foreign.Storable (peek, poke)
+import GHC.Records (getField)
 import Test.Tasty (TestTree, testGroup)
 import Test.Tasty.HUnit (assertBool, testCase, (@?=))
-import Utils (withConnection, withDatabase)
+import Utils (withConnection, withConstCString, withDatabase)
 
 tests :: TestTree
 tests =
-    testGroup
-        "Query Execution"
-        [ queryLifecycle
-        ]
+  testGroup
+    "Query Execution"
+    [ queryLifecycle
+    ]
 
 queryLifecycle :: TestTree
 queryLifecycle =
-    testCase "run a query and inspect metadata" $
-        withDatabase \db ->
-            withConnection db \conn -> do
-                -- Seed table
-                let createSQL = "CREATE TABLE items(id INTEGER, name VARCHAR)"
-                    insertSQL = "INSERT INTO items VALUES (1, 'apple'), (2, 'banana')"
-                forM_ [createSQL, insertSQL] \sql ->
-                    withCString sql \cSql ->
-                        alloca \resPtr -> do
-                            st <- c_duckdb_query conn cSql resPtr
-                            st @?= DuckDBSuccess
-                            c_duckdb_destroy_result resPtr
+  testCase "run a query and inspect metadata" $
+    withDatabase \db ->
+      withConnection db \conn -> do
+        -- Seed table
+        let createSQL = "CREATE TABLE items(id INTEGER, name VARCHAR)"
+            insertSQL = "INSERT INTO items VALUES (1, 'apple'), (2, 'banana')"
+        forM_ [createSQL, insertSQL] \sql ->
+          withConstCString sql \cSql ->
+            alloca \resPtr -> do
+              st <- c_duckdb_query conn cSql resPtr
+              st @?= DuckDBSuccess
+              c_duckdb_destroy_result resPtr
 
-                -- Query data
-                withCString "SELECT id, name FROM items ORDER BY id" \selectSql ->
-                    alloca \resPtr -> do
-                        st <- c_duckdb_query conn selectSql resPtr
-                        st @?= DuckDBSuccess
+        -- Query data
+        withConstCString "SELECT id, name FROM items ORDER BY id" \selectSql ->
+          alloca \resPtr -> do
+            st <- c_duckdb_query conn selectSql resPtr
+            st @?= DuckDBSuccess
 
-                        -- Column metadata
-                        columnCount <- c_duckdb_column_count resPtr
-                        columnCount @?= 2
+            -- Column metadata
+            columnCount <- c_duckdb_column_count resPtr
+            columnCount @?= 2
 
-                        rowCount <- c_duckdb_row_count resPtr
-                        rowCount @?= 2
+            rowCount <- c_duckdb_row_count resPtr
+            rowCount @?= 2
 
-                        rowsChanged <- c_duckdb_rows_changed resPtr
-                        rowsChanged @?= 0
+            rowsChanged <- c_duckdb_rows_changed resPtr
+            rowsChanged @?= 0
 
-                        stmtType <- c_duckdb_result_statement_type resPtr
-                        stmtType @?= DuckDBStatementTypeSelect
+            stmtType <- peek resPtr >>= \rawValue -> c_duckdb_result_statement_type rawValue
+            stmtType @?= DuckDBStatementTypeSelect
 
-                        arrowOpts <- c_duckdb_result_get_arrow_options resPtr
-                        assertBool "arrow options should not be null" (arrowOpts /= nullPtr)
-                        alloca \arrowPtr -> do
-                            poke arrowPtr arrowOpts
-                            c_duckdb_destroy_arrow_options arrowPtr
+            arrowOpts <- c_duckdb_result_get_arrow_options resPtr
+            assertBool "arrow options should not be null" (arrowOpts /= coerce nullPtr)
+            alloca \arrowPtr -> do
+              poke arrowPtr arrowOpts
+              c_duckdb_destroy_arrow_options arrowPtr
 
-                        forM_ [0 .. columnCount - 1] \idx -> do
-                            namePtr <- c_duckdb_column_name resPtr idx
-                            colName <- peekCString namePtr
-                            let expected = if idx == 0 then "id" else "name"
-                            colName @?= expected
+            forM_ [0 .. columnCount - 1] \idx -> do
+              namePtr <- c_duckdb_column_name resPtr idx
+              colName <- peekCString (coerce namePtr)
+              let expected = if idx == 0 then "id" else "name"
+              colName @?= expected
 
-                            colType <- c_duckdb_column_type resPtr idx
-                            let expectedType = if idx == 0 then DuckDBTypeInteger else DuckDBTypeVarchar
-                            colType @?= expectedType
+              colType <- getField @"unwrap" <$> c_duckdb_column_type resPtr idx
+              let expectedType = if idx == 0 then DuckDBTypeInteger else DuckDBTypeVarchar
+              colType @?= expectedType
 
-                            logicalType <- c_duckdb_column_logical_type resPtr idx
-                            assertBool "logical type pointer should not be null" (logicalType /= nullPtr)
-                            alloca \typePtr -> do
-                                poke typePtr logicalType
-                                c_duckdb_destroy_logical_type typePtr
+              logicalType <- c_duckdb_column_logical_type resPtr idx
+              assertBool "logical type pointer should not be null" (logicalType /= coerce nullPtr)
+              alloca \typePtr -> do
+                poke typePtr logicalType
+                c_duckdb_destroy_logical_type typePtr
 
-                            dataPtr <- c_duckdb_column_data resPtr idx
-                            assertBool "column data pointer should not be null" (dataPtr /= nullPtr)
+              dataPtr <- c_duckdb_column_data resPtr idx
+              assertBool "column data pointer should not be null" (dataPtr /= nullPtr)
 
-                            nullmaskPtr <- c_duckdb_nullmask_data resPtr idx
-                            assertBool "nullmask pointer should not be null" (nullmaskPtr /= nullPtr)
+              nullmaskPtr <- c_duckdb_nullmask_data resPtr idx
+              assertBool "nullmask pointer should not be null" (nullmaskPtr /= nullPtr)
 
-                        errPtr <- c_duckdb_result_error resPtr
-                        when (errPtr /= nullPtr) $ do
-                            errMsg <- peekCString errPtr
-                            assertBool ("unexpected error: " <> errMsg) False
+            errPtr <- c_duckdb_result_error resPtr
+            when (errPtr /= coerce nullPtr) $ do
+              errMsg <- peekCString (coerce errPtr)
+              assertBool ("unexpected error: " <> errMsg) False
 
-                        errType <- c_duckdb_result_error_type resPtr
-                        errType @?= DuckDBErrorInvalid
+            errType <- c_duckdb_result_error_type resPtr
+            errType @?= DuckDBErrorInvalid
 
-                        c_duckdb_destroy_result resPtr
+            c_duckdb_destroy_result resPtr
diff --git a/test/ReplacementScansTest.hs b/test/ReplacementScansTest.hs
--- a/test/ReplacementScansTest.hs
+++ b/test/ReplacementScansTest.hs
@@ -6,104 +6,108 @@
 import Control.Concurrent (runInBoundThread)
 import Control.Exception (bracket)
 import Control.Monad (forM_)
+import Data.Coerce (coerce)
 import Data.IORef (IORef, modifyIORef', newIORef, readIORef)
 import Data.Int (Int64)
 import Data.List (isInfixOf)
+import Data.Void (Void)
 import Database.DuckDB.FFI
-import Database.DuckDB.FFI.Deprecated
-import Foreign.C.String (CString, peekCString, withCString)
+import Foreign.C.ConstPtr (ConstPtr (..))
+import Foreign.C.String (peekCString)
+import Foreign.C.Types (CChar)
 import Foreign.Marshal.Alloc (alloca)
 import Foreign.Ptr (Ptr, freeHaskellFunPtr, nullFunPtr, nullPtr)
+import HsBindgen.Runtime.Support.FunPtr (toFunPtr)
 import Test.Tasty (TestTree, testGroup)
 import Test.Tasty.HUnit (assertBool, testCase, (@?=))
-import Utils (withConnection, withDatabase, withResult, withValue)
+import Utils (withConnection, withConstCString, withDatabase, withResult, withValue)
 
 tests :: TestTree
 tests =
-    testGroup
-        "Replacement Scans"
-        [ replacementScanRewritesAndErrors
-        ]
+  testGroup
+    "Replacement Scans"
+    [ replacementScanRewritesAndErrors
+    ]
 
 replacementScanRewritesAndErrors :: TestTree
 replacementScanRewritesAndErrors =
-    testCase "replacement scan rewrites table name and can report errors" $
-        runInBoundThread do
-            seenTablesRef <- newIORef []
+  testCase "replacement scan rewrites table name and can report errors" $
+    runInBoundThread do
+      seenTablesRef <- newIORef []
 
-            let startValue = 5
-                countValue = 4
-                endValue = startValue + countValue
+      let startValue = 5
+          countValue = 4
+          endValue = startValue + countValue
 
-            withReplacementCallback seenTablesRef startValue endValue \callback -> do
-                withDatabase \db -> do
-                    c_duckdb_add_replacement_scan db callback nullPtr nullFunPtr
-                    withConnection db \conn -> do
-                        assertReplacementQuery conn startValue countValue
-                        assertReplacementError conn
+      withReplacementCallback seenTablesRef startValue endValue \callback -> do
+        withDatabase \db -> do
+          c_duckdb_add_replacement_scan db callback nullPtr (coerce nullFunPtr)
+          withConnection db \conn -> do
+            assertReplacementQuery conn startValue countValue
+            assertReplacementError conn
 
-            seenTables <- readIORef seenTablesRef
-            assertBool "replacement callback should run for rewrite target" ("haskell_magic" `elem` seenTables)
-            assertBool "replacement callback should run for error target" ("failing_magic" `elem` seenTables)
+      seenTables <- readIORef seenTablesRef
+      assertBool "replacement callback should run for rewrite target" ("haskell_magic" `elem` seenTables)
+      assertBool "replacement callback should run for error target" ("failing_magic" `elem` seenTables)
 
-withReplacementCallback ::
-    IORef [String] ->
-    Int64 ->
-    Int64 ->
-    (DuckDBReplacementCallback -> IO a) ->
-    IO a
+withReplacementCallback
+  :: IORef [String]
+  -> Int64
+  -> Int64
+  -> (DuckDBReplacementCallback -> IO a)
+  -> IO a
 withReplacementCallback seenTablesRef startValue endValue =
-    bracket acquire freeHaskellFunPtr
+  bracket acquire (freeHaskellFunPtr . coerce)
   where
     acquire =
-        mkReplacementCallback (replacementCallback seenTablesRef startValue endValue)
+      mkReplacementCallback (replacementCallback seenTablesRef startValue endValue)
 
-replacementCallback ::
-    IORef [String] ->
-    Int64 ->
-    Int64 ->
-    DuckDBReplacementScanInfo ->
-    CString ->
-    Ptr () ->
-    IO ()
+replacementCallback
+  :: IORef [String]
+  -> Int64
+  -> Int64
+  -> DuckDBReplacementScanInfo
+  -> ConstPtr CChar
+  -> Ptr Void
+  -> IO ()
 replacementCallback seenTablesRef startValue endValue info tableName _extra = do
-    name <- peekCString tableName
-    modifyIORef' seenTablesRef (name :)
-    case name of
-        "haskell_magic" -> do
-            withCString "range" $ \fn ->
-                c_duckdb_replacement_scan_set_function_name info fn
-            withValue (c_duckdb_create_int64 startValue) $ \startVal ->
-                c_duckdb_replacement_scan_add_parameter info startVal
-            withValue (c_duckdb_create_int64 endValue) $ \endVal ->
-                c_duckdb_replacement_scan_add_parameter info endVal
-        "failing_magic" ->
-            withCString "replacement rejected by test callback" $ \msg ->
-                c_duckdb_replacement_scan_set_error info msg
-        _ ->
-            pure ()
+  name <- peekCString (coerce tableName)
+  modifyIORef' seenTablesRef (name :)
+  case name of
+    "haskell_magic" -> do
+      withConstCString "range" $ \fn ->
+        c_duckdb_replacement_scan_set_function_name info fn
+      withValue (c_duckdb_create_int64 startValue) $ \startVal ->
+        c_duckdb_replacement_scan_add_parameter info startVal
+      withValue (c_duckdb_create_int64 endValue) $ \endVal ->
+        c_duckdb_replacement_scan_add_parameter info endVal
+    "failing_magic" ->
+      withConstCString "replacement rejected by test callback" $ \msg ->
+        c_duckdb_replacement_scan_set_error info msg
+    _ ->
+      pure ()
 
 assertReplacementQuery :: DuckDBConnection -> Int64 -> Int64 -> IO ()
 assertReplacementQuery conn startValue countValue =
-    withResult conn "SELECT range FROM haskell_magic ORDER BY range" \resPtr -> do
-        rowCount <- c_duckdb_row_count resPtr
-        rowCount @?= fromIntegral countValue
-        forM_ [0 .. countValue - 1] \idx -> do
-            value <- c_duckdb_value_int64 resPtr 0 (fromIntegral idx)
-            value @?= startValue + idx
+  withResult conn "SELECT range FROM haskell_magic ORDER BY range" \resPtr -> do
+    rowCount <- c_duckdb_row_count resPtr
+    rowCount @?= fromIntegral countValue
+    forM_ [0 .. countValue - 1] \idx -> do
+      value <- c_duckdb_value_int64 resPtr 0 (fromIntegral idx)
+      value @?= startValue + idx
 
 assertReplacementError :: DuckDBConnection -> IO ()
 assertReplacementError conn =
-    withCString "SELECT * FROM failing_magic" \sql ->
-        alloca \resPtr -> do
-            state <- c_duckdb_query conn sql resPtr
-            state @?= DuckDBError
-            errPtr <- c_duckdb_result_error resPtr
-            errMsg <- peekCString errPtr
-            assertBool "replacement error message should surface" ("rejected" `isInfixOf` errMsg)
-            c_duckdb_destroy_result resPtr
+  withConstCString "SELECT * FROM failing_magic" \sql ->
+    alloca \resPtr -> do
+      state <- c_duckdb_query conn sql resPtr
+      state @?= DuckDBError
+      errPtr <- c_duckdb_result_error resPtr
+      errMsg <- peekCString (coerce errPtr)
+      assertBool "replacement error message should surface" ("rejected" `isInfixOf` errMsg)
+      c_duckdb_destroy_result resPtr
 
-foreign import ccall "wrapper"
-    mkReplacementCallback ::
-        (DuckDBReplacementScanInfo -> CString -> Ptr () -> IO ()) ->
-        IO DuckDBReplacementCallback
+mkReplacementCallback
+  :: (DuckDBReplacementScanInfo -> ConstPtr CChar -> Ptr Void -> IO ())
+  -> IO DuckDBReplacementCallback
+mkReplacementCallback = fmap DuckDBReplacementCallback . toFunPtr . DuckDBReplacementCallback_Aux
diff --git a/test/ResultFunctionsTest.hs b/test/ResultFunctionsTest.hs
--- a/test/ResultFunctionsTest.hs
+++ b/test/ResultFunctionsTest.hs
@@ -4,58 +4,58 @@
 module ResultFunctionsTest (tests) where
 
 import Control.Monad (forM_, when)
+import Data.Coerce (coerce)
 import Database.DuckDB.FFI
-import Database.DuckDB.FFI.Deprecated
-import Foreign.C.String (withCString)
 import Foreign.C.Types (CBool (..))
 import Foreign.Marshal.Alloc (alloca)
 import Foreign.Ptr (nullPtr)
+import Foreign.Storable (peek)
 import Test.Tasty (TestTree, testGroup)
 import Test.Tasty.HUnit (assertBool, testCase, (@?=))
-import Utils (withConnection, withDatabase)
+import Utils (withConnection, withConstCString, withDatabase)
 
 tests :: TestTree
 tests =
-    testGroup
-        "Result Functions"
-        [ chunkIntrospection
-        ]
+  testGroup
+    "Result Functions"
+    [ chunkIntrospection
+    ]
 
 chunkIntrospection :: TestTree
 chunkIntrospection =
-    testCase "result chunk information and streaming state" $
-        withDatabase \db ->
-            withConnection db \conn -> do
-                let createSQL = "CREATE TABLE items(id INTEGER);"
-                    insertSQL =
-                        "INSERT INTO items VALUES (1), (2), (3), (4), (5);"
-                forM_ [createSQL, insertSQL] \sql ->
-                    withCString sql \cSql ->
-                        alloca \resPtr -> do
-                            st <- c_duckdb_query conn cSql resPtr
-                            st @?= DuckDBSuccess
-                            c_duckdb_destroy_result resPtr
+  testCase "result chunk information and streaming state" $
+    withDatabase \db ->
+      withConnection db \conn -> do
+        let createSQL = "CREATE TABLE items(id INTEGER);"
+            insertSQL =
+              "INSERT INTO items VALUES (1), (2), (3), (4), (5);"
+        forM_ [createSQL, insertSQL] \sql ->
+          withConstCString sql \cSql ->
+            alloca \resPtr -> do
+              st <- c_duckdb_query conn cSql resPtr
+              st @?= DuckDBSuccess
+              c_duckdb_destroy_result resPtr
 
-                withCString "SELECT * FROM items" \selectSQL ->
-                    alloca \resPtr -> do
-                        st <- c_duckdb_query conn selectSQL resPtr
-                        st @?= DuckDBSuccess
+        withConstCString "SELECT * FROM items" \selectSQL ->
+          alloca \resPtr -> do
+            st <- c_duckdb_query conn selectSQL resPtr
+            st @?= DuckDBSuccess
 
-                        chunkCount <- c_duckdb_result_chunk_count resPtr
-                        assertBool "chunk count should be positive" (chunkCount > 0)
+            chunkCount <- peek resPtr >>= \rawValue -> c_duckdb_result_chunk_count rawValue
+            assertBool "chunk count should be positive" (chunkCount > 0)
 
-                        returnType <- c_duckdb_result_return_type resPtr
-                        returnType @?= DuckDBResultTypeQueryResult
+            returnType <- peek resPtr >>= \rawValue -> c_duckdb_result_return_type rawValue
+            returnType @?= DuckDBResultTypeQueryResult
 
-                        streamingFlag <- c_duckdb_result_is_streaming resPtr
-                        streamingFlag @?= CBool 0
+            streamingFlag <- peek resPtr >>= \rawValue -> c_duckdb_result_is_streaming rawValue
+            streamingFlag @?= CBool 0
 
-                        -- Retrieve first chunk if available
-                        when (chunkCount > 0) $ do
-                            chunk0 <- c_duckdb_result_get_chunk resPtr 0
-                            assertBool "first chunk should not be null" (chunk0 /= nullPtr)
-                            -- Requesting beyond the available chunk count should return null
-                            chunkInvalid <- c_duckdb_result_get_chunk resPtr chunkCount
-                            assertBool "out-of-range chunk should be null" (chunkInvalid == nullPtr)
+            -- Retrieve first chunk if available
+            when (chunkCount > 0) $ do
+              chunk0 <- peek resPtr >>= \rawValue -> c_duckdb_result_get_chunk rawValue 0
+              assertBool "first chunk should not be null" (chunk0 /= coerce nullPtr)
+              -- Requesting beyond the available chunk count should return null
+              chunkInvalid <- peek resPtr >>= \rawValue -> c_duckdb_result_get_chunk rawValue chunkCount
+              assertBool "out-of-range chunk should be null" (chunkInvalid == coerce nullPtr)
 
-                        c_duckdb_destroy_result resPtr
+            c_duckdb_destroy_result resPtr
diff --git a/test/SafeFetchTest.hs b/test/SafeFetchTest.hs
--- a/test/SafeFetchTest.hs
+++ b/test/SafeFetchTest.hs
@@ -1,172 +1,174 @@
 {-# LANGUAGE BlockArguments #-}
+{-# LANGUAGE DuplicateRecordFields #-}
 {-# OPTIONS_GHC -Wno-deprecations #-}
 
 module SafeFetchTest (tests) where
 
 import Control.Monad (when)
+import Data.Coerce (coerce)
 import Data.Int (Int16, Int32, Int64, Int8)
 import Data.Time.Calendar (diffDays, fromGregorian)
 import Data.Word (Word16, Word32, Word64, Word8)
 import Database.DuckDB.FFI
-import Database.DuckDB.FFI.Deprecated
-import Foreign.C.String (peekCString, peekCStringLen, withCString)
+import Foreign.C.ConstPtr (ConstPtr (..))
+import Foreign.C.String (peekCString, peekCStringLen)
 import Foreign.C.Types (CBool (..))
 import Foreign.Marshal.Alloc (alloca)
 import Foreign.Marshal.Array (peekArray)
-import Foreign.Ptr (Ptr, castPtr, nullPtr)
-import Foreign.Storable (peek)
+import Foreign.Ptr (Ptr, nullPtr)
+import Foreign.Storable (peek, poke)
 import Test.Tasty (TestTree, testGroup)
 import Test.Tasty.HUnit (assertFailure, testCase, (@?=))
-import Utils (withConnection, withDatabase)
+import Utils (withConnection, withConstCString, withDatabase)
 
 tests :: TestTree
 tests =
-    testGroup
-        "Safe Fetch Functions"
-        [safeFetchRoundtrip]
+  testGroup
+    "Safe Fetch Functions"
+    [safeFetchRoundtrip]
 
 safeFetchRoundtrip :: TestTree
 safeFetchRoundtrip =
-    testCase "retrieve various types via safe fetch accessors" $
-        withDatabase \db ->
-            withConnection db \conn -> do
-                let query =
-                        "SELECT "
-                            <> "TRUE AS b," -- 0
-                            <> "(-5)::TINYINT AS i8," -- 1
-                            <> "(-300)::SMALLINT AS i16," -- 2
-                            <> "(-4000000)::INTEGER AS i32," -- 3
-                            <> "(-5000000000000)::BIGINT AS i64," -- 4
-                            <> "('9223372036854775809')::HUGEINT AS huge," -- 5
-                            <> "200::UTINYINT AS u8," -- 6
-                            <> "60000::USMALLINT AS u16," -- 7
-                            <> "4000000000::UINTEGER AS u32," -- 8
-                            <> "('18446744073709551615')::UBIGINT AS u64," -- 9
-                            <> "('18446744073709551616')::HUGEINT AS uhuge," -- 10
-                            <> "1.5::REAL AS f32," -- 11
-                            <> "2.5::DOUBLE AS f64," -- 12
-                            <> "DATE '2021-07-20' AS d," -- 13
-                            <> "TIME '12:34:56' AS t," -- 14
-                            <> "TIMESTAMP '2021-07-20 12:34:56' AS ts," -- 15
-                            <> "INTERVAL '1 day 2 hours' AS iv," -- 16
-                            <> "('12345.67')::DECIMAL(18,2) AS dec," -- 17
-                            <> "'this string is definitely longer than inline storage'::VARCHAR AS txt," -- 18
-                            <> "CAST('abc' AS BLOB) AS blob_col," -- 19
-                            <> "NULL::INTEGER AS null_col" -- 20
-                withCString query \cQuery ->
-                    alloca \resPtr -> do
-                        state <- c_duckdb_query conn cQuery resPtr
-                        when (state /= DuckDBSuccess) $ do
-                            errPtr <- c_duckdb_result_error resPtr
-                            errMsg <- if errPtr == nullPtr then pure "<no error>" else peekCString errPtr
-                            assertFailure ("duckdb_query failed: " <> errMsg)
-                        state @?= DuckDBSuccess
+  testCase "retrieve various types via safe fetch accessors" $
+    withDatabase \db ->
+      withConnection db \conn -> do
+        let query =
+              "SELECT "
+                <> "TRUE AS b," -- 0
+                <> "(-5)::TINYINT AS i8," -- 1
+                <> "(-300)::SMALLINT AS i16," -- 2
+                <> "(-4000000)::INTEGER AS i32," -- 3
+                <> "(-5000000000000)::BIGINT AS i64," -- 4
+                <> "('9223372036854775809')::HUGEINT AS huge," -- 5
+                <> "200::UTINYINT AS u8," -- 6
+                <> "60000::USMALLINT AS u16," -- 7
+                <> "4000000000::UINTEGER AS u32," -- 8
+                <> "('18446744073709551615')::UBIGINT AS u64," -- 9
+                <> "('18446744073709551616')::HUGEINT AS uhuge," -- 10
+                <> "1.5::REAL AS f32," -- 11
+                <> "2.5::DOUBLE AS f64," -- 12
+                <> "DATE '2021-07-20' AS d," -- 13
+                <> "TIME '12:34:56' AS t," -- 14
+                <> "TIMESTAMP '2021-07-20 12:34:56' AS ts," -- 15
+                <> "INTERVAL '1 day 2 hours' AS iv," -- 16
+                <> "('12345.67')::DECIMAL(18,2) AS dec," -- 17
+                <> "'this string is definitely longer than inline storage'::VARCHAR AS txt," -- 18
+                <> "CAST('abc' AS BLOB) AS blob_col," -- 19
+                <> "NULL::INTEGER AS null_col" -- 20
+        withConstCString query \cQuery ->
+          alloca \resPtr -> do
+            state <- c_duckdb_query conn cQuery resPtr
+            when (state /= DuckDBSuccess) $ do
+              errPtr <- c_duckdb_result_error resPtr
+              errMsg <- if errPtr == coerce nullPtr then pure "<no error>" else peekCString (coerce errPtr)
+              assertFailure ("duckdb_query failed: " <> errMsg)
+            state @?= DuckDBSuccess
 
-                        -- Boolean
-                        c_duckdb_value_is_null resPtr 0 0 >>= (@?= CBool 0)
-                        c_duckdb_value_boolean resPtr 0 0 >>= (@?= CBool 1)
+            -- Boolean
+            c_duckdb_value_is_null resPtr 0 0 >>= (@?= CBool 0)
+            c_duckdb_value_boolean resPtr 0 0 >>= (@?= CBool 1)
 
-                        -- Signed integers
-                        c_duckdb_value_int8 resPtr 1 0 >>= (@?= (-5 :: Int8))
-                        c_duckdb_value_int16 resPtr 2 0 >>= (@?= (-300 :: Int16))
-                        c_duckdb_value_int32 resPtr 3 0 >>= (@?= (-4000000 :: Int32))
-                        c_duckdb_value_int64 resPtr 4 0 >>= (@?= (-5000000000000 :: Int64))
+            -- Signed integers
+            c_duckdb_value_int8 resPtr 1 0 >>= (@?= (-5 :: Int8))
+            c_duckdb_value_int16 resPtr 2 0 >>= (@?= (-300 :: Int16))
+            c_duckdb_value_int32 resPtr 3 0 >>= (@?= (-4000000 :: Int32))
+            c_duckdb_value_int64 resPtr 4 0 >>= (@?= (-5000000000000 :: Int64))
 
-                        -- HugeInt
-                        alloca \hugePtr -> do
-                            c_duckdb_value_hugeint resPtr 5 0 hugePtr
-                            DuckDBHugeInt{duckDBHugeIntLower = lowerHuge, duckDBHugeIntUpper = upperHuge} <- peek hugePtr
-                            lowerHuge @?= 9223372036854775809
-                            upperHuge @?= 0
+            -- HugeInt
+            alloca \hugePtr -> do
+              c_duckdb_value_hugeint resPtr 5 0 >>= poke hugePtr
+              DuckDBHugeInt{lower = lowerHuge, upper = upperHuge} <- peek hugePtr
+              lowerHuge @?= 9223372036854775809
+              upperHuge @?= 0
 
-                        -- Unsigned integers
-                        c_duckdb_value_uint8 resPtr 6 0 >>= (@?= (200 :: Word8))
-                        c_duckdb_value_uint16 resPtr 7 0 >>= (@?= (60000 :: Word16))
-                        c_duckdb_value_uint32 resPtr 8 0 >>= (@?= (4000000000 :: Word32))
-                        c_duckdb_value_uint64 resPtr 9 0 >>= (@?= (maxBound :: Word64))
+            -- Unsigned integers
+            c_duckdb_value_uint8 resPtr 6 0 >>= (@?= (200 :: Word8))
+            c_duckdb_value_uint16 resPtr 7 0 >>= (@?= (60000 :: Word16))
+            c_duckdb_value_uint32 resPtr 8 0 >>= (@?= (4000000000 :: Word32))
+            c_duckdb_value_uint64 resPtr 9 0 >>= (@?= (maxBound :: Word64))
 
-                        alloca \uhugePtr -> do
-                            c_duckdb_value_uhugeint resPtr 10 0 uhugePtr
-                            DuckDBUHugeInt{duckDBUHugeIntLower = lowerUHuge, duckDBUHugeIntUpper = upperUHuge} <- peek uhugePtr
-                            lowerUHuge @?= 0
-                            upperUHuge @?= 1
+            alloca \uhugePtr -> do
+              c_duckdb_value_uhugeint resPtr 10 0 >>= poke uhugePtr
+              DuckDBUHugeInt{lower = lowerUHuge, upper = upperUHuge} <- peek uhugePtr
+              lowerUHuge @?= 0
+              upperUHuge @?= 1
 
-                        -- Floating point
-                        valFloat <- c_duckdb_value_float resPtr 11 0
-                        realToFrac valFloat @?= (1.5 :: Double)
-                        valDouble <- c_duckdb_value_double resPtr 12 0
-                        realToFrac valDouble @?= (2.5 :: Double)
+            -- Floating point
+            valFloat <- c_duckdb_value_float resPtr 11 0
+            realToFrac valFloat @?= (1.5 :: Double)
+            valDouble <- c_duckdb_value_double resPtr 12 0
+            realToFrac valDouble @?= (2.5 :: Double)
 
-                        -- Date/time/timestamp
-                        DuckDBDate dateVal <- c_duckdb_value_date resPtr 13 0
-                        let expectedDaysInteger = diffDays targetDay epochDay
-                            expectedDays = fromIntegral expectedDaysInteger :: Int32
-                        dateVal @?= expectedDays
+            -- Date/time/timestamp
+            DuckDBDate dateVal <- c_duckdb_value_date resPtr 13 0
+            let expectedDaysInteger = diffDays targetDay epochDay
+                expectedDays = fromIntegral expectedDaysInteger :: Int32
+            dateVal @?= expectedDays
 
-                        DuckDBTime timeVal <- c_duckdb_value_time resPtr 14 0
-                        let expectedTimeMicros :: Int64
-                            expectedTimeMicros = ((12 * 60 + 34) * 60 + 56) * 1000000
-                        timeVal @?= expectedTimeMicros
+            DuckDBTime timeVal <- c_duckdb_value_time resPtr 14 0
+            let expectedTimeMicros :: Int64
+                expectedTimeMicros = ((12 * 60 + 34) * 60 + 56) * 1000000
+            timeVal @?= expectedTimeMicros
 
-                        DuckDBTimestamp tsVal <- c_duckdb_value_timestamp resPtr 15 0
-                        let expectedTimestampMicros :: Int64
-                            expectedTimestampMicros =
-                                fromIntegral expectedDaysInteger * 86400000000 + expectedTimeMicros
-                        tsVal @?= expectedTimestampMicros
+            DuckDBTimestamp tsVal <- c_duckdb_value_timestamp resPtr 15 0
+            let expectedTimestampMicros :: Int64
+                expectedTimestampMicros =
+                  fromIntegral expectedDaysInteger * 86400000000 + expectedTimeMicros
+            tsVal @?= expectedTimestampMicros
 
-                        -- Interval
-                        alloca \intervalPtr -> do
-                            c_duckdb_value_interval resPtr 16 0 intervalPtr
-                            DuckDBInterval{duckDBIntervalMonths = months, duckDBIntervalDays = days, duckDBIntervalMicros = micros} <- peek intervalPtr
-                            months @?= 0
-                            days @?= 1
-                            micros @?= 7200000000
+            -- Interval
+            alloca \intervalPtr -> do
+              c_duckdb_value_interval resPtr 16 0 >>= poke intervalPtr
+              DuckDBInterval{months = months, days = days, micros = micros} <- peek intervalPtr
+              months @?= 0
+              days @?= 1
+              micros @?= 7200000000
 
-                        -- Decimal
-                        alloca \decimalPtr -> do
-                            c_duckdb_value_decimal resPtr 17 0 decimalPtr
-                            DuckDBDecimal{duckDBDecimalWidth = width, duckDBDecimalScale = scale, duckDBDecimalValue = decValue} <- peek decimalPtr
-                            width @?= 18
-                            scale @?= 2
-                            DuckDBHugeInt{duckDBHugeIntLower = decimalLower, duckDBHugeIntUpper = decimalUpper} <- pure decValue
-                            decimalLower @?= 1234567
-                            decimalUpper @?= 0
+            -- Decimal
+            alloca \decimalPtr -> do
+              c_duckdb_value_decimal resPtr 17 0 >>= poke decimalPtr
+              DuckDBDecimal{width = width, scale = scale, value = decValue} <- peek decimalPtr
+              width @?= 18
+              scale @?= 2
+              DuckDBHugeInt{lower = decimalLower, upper = decimalUpper} <- pure decValue
+              decimalLower @?= 1234567
+              decimalUpper @?= 0
 
-                        -- Strings
-                        strVarchar <- c_duckdb_value_varchar resPtr 18 0
-                        varcharText <- peekCString strVarchar
-                        varcharText @?= stringLiteral
-                        c_duckdb_free (castPtr strVarchar)
+            -- Strings
+            strVarchar <- c_duckdb_value_varchar resPtr 18 0
+            varcharText <- peekCString (coerce strVarchar)
+            varcharText @?= stringLiteral
+            c_duckdb_free (coerce strVarchar)
 
-                        alloca \stringPtr -> do
-                            c_duckdb_value_string resPtr 18 0 stringPtr
-                            DuckDBString{duckDBStringData = datPtr, duckDBStringSize = datSize} <- peek stringPtr
-                            bytes <- peekCStringLen (datPtr, fromIntegral datSize)
-                            bytes @?= stringLiteral
-                            when (datPtr /= nullPtr) $ c_duckdb_free (castPtr datPtr)
+            alloca \stringPtr -> do
+              c_duckdb_value_string resPtr 18 0 >>= poke stringPtr
+              DuckDBString{data' = datPtr, size = datSize} <- peek stringPtr
+              bytes <- peekCStringLen (coerce datPtr, fromIntegral datSize)
+              bytes @?= stringLiteral
+              when (datPtr /= nullPtr) $ c_duckdb_free (coerce datPtr)
 
-                        alloca \stringInternalPtr -> do
-                            c_duckdb_value_string_internal resPtr 18 0 stringInternalPtr
-                            DuckDBString{duckDBStringData = datPtr, duckDBStringSize = datSize} <- peek stringInternalPtr
-                            bytes <- peekCStringLen (datPtr, fromIntegral datSize)
-                            bytes @?= stringLiteral
+            alloca \stringInternalPtr -> do
+              c_duckdb_value_string_internal resPtr 18 0 >>= poke stringInternalPtr
+              DuckDBString{data' = datPtr, size = datSize} <- peek stringInternalPtr
+              bytes <- peekCStringLen (coerce datPtr, fromIntegral datSize)
+              bytes @?= stringLiteral
 
-                        varcharInternal <- c_duckdb_value_varchar_internal resPtr 18 0
-                        peekCString varcharInternal >>= (@?= stringLiteral)
+            varcharInternal <- c_duckdb_value_varchar_internal resPtr 18 0
+            peekCString (coerce varcharInternal) >>= (@?= stringLiteral)
 
-                        -- Blob
-                        alloca \blobPtr -> do
-                            c_duckdb_value_blob resPtr 19 0 blobPtr
-                            DuckDBBlob{duckDBBlobData = blobData, duckDBBlobSize = blobSize} <- peek blobPtr
-                            let expectedBlob :: [Word8]
-                                expectedBlob = map (fromIntegral . fromEnum) ("abc" :: String)
-                            peekArray (fromIntegral blobSize) (castPtr blobData :: Ptr Word8) >>= (@?= expectedBlob)
-                            c_duckdb_free (castPtr blobData)
+            -- Blob
+            alloca \blobPtr -> do
+              c_duckdb_value_blob resPtr 19 0 >>= poke blobPtr
+              DuckDBBlob{data' = blobData, size = blobSize} <- peek blobPtr
+              let expectedBlob :: [Word8]
+                  expectedBlob = map (fromIntegral . fromEnum) ("abc" :: String)
+              peekArray (fromIntegral blobSize) (coerce blobData :: Ptr Word8) >>= (@?= expectedBlob)
+              c_duckdb_free (coerce blobData)
 
-                        -- Null handling
-                        c_duckdb_value_is_null resPtr 20 0 >>= (@?= CBool 1)
+            -- Null handling
+            c_duckdb_value_is_null resPtr 20 0 >>= (@?= CBool 1)
 
-                        c_duckdb_destroy_result resPtr
+            c_duckdb_destroy_result resPtr
   where
     stringLiteral :: String
     stringLiteral = "this string is definitely longer than inline storage"
diff --git a/test/ScalarFunctionsTest.hs b/test/ScalarFunctionsTest.hs
--- a/test/ScalarFunctionsTest.hs
+++ b/test/ScalarFunctionsTest.hs
@@ -1,5 +1,5 @@
 {-# LANGUAGE BlockArguments #-}
-{-# LANGUAGE ForeignFunctionInterface #-}
+{-# LANGUAGE TypeApplications #-}
 {-# OPTIONS_GHC -Wno-deprecations #-}
 
 module ScalarFunctionsTest (tests) where
@@ -7,189 +7,195 @@
 import Control.Exception (bracket)
 import Control.Monad (forM_, unless, when)
 import Data.Char (toLower)
+import Data.Coerce (coerce)
 import Data.Int (Int32)
 import Data.List (isInfixOf)
+import Data.Proxy (Proxy (..))
+import Data.Void (Void)
 import Database.DuckDB.FFI
-import Database.DuckDB.FFI.Deprecated
-import Foreign.C.String (peekCString, withCString)
+import Foreign.C.ConstPtr (ConstPtr (..))
+import Foreign.C.String (peekCString)
 import Foreign.Marshal.Alloc (alloca, free, mallocBytes)
-import Foreign.Ptr (Ptr, castPtr, nullPtr)
-import Foreign.Storable (peek, peekElemOff, poke, pokeElemOff, sizeOf)
+import Foreign.Ptr (Ptr, nullPtr)
+import Foreign.Storable (peek, peekElemOff, poke, pokeElemOff)
+import HsBindgen.Runtime.Marshal (staticSizeOf)
+import HsBindgen.Runtime.Support.FunPtr (toFunPtr)
 import Test.Tasty (TestTree, testGroup)
 import Test.Tasty.HUnit (assertBool, testCase, (@?=))
-import Utils (withConnection, withDatabase, withResultCString)
+import Utils (withConnection, withConstCString, withDatabase, withResultCString)
 
 -- | Coverage of scalar function registration and bind/exec helpers.
 tests :: TestTree
 tests =
-    testGroup
-        "Scalar Functions"
-        [ scalarFunctionRoundtrip
-        , scalarFunctionSetFeatures
-        ]
+  testGroup
+    "Scalar Functions"
+    [ scalarFunctionRoundtrip
+    , scalarFunctionSetFeatures
+    ]
 
 scalarFunctionRoundtrip :: TestTree
 scalarFunctionRoundtrip =
-    testCase "register custom scalar function and execute" $ do
-        withDatabase \db ->
-            withConnection db \conn -> do
-                withLogicalType (c_duckdb_create_logical_type DuckDBTypeInteger) \intType -> do
-                    funPtr <- mkScalarFun negateCallback
-                    withScalarFunction \fun -> do
-                        withCString "negate_int" $ \name -> c_duckdb_scalar_function_set_name fun name
-                        c_duckdb_scalar_function_add_parameter fun intType
-                        c_duckdb_scalar_function_set_return_type fun intType
-                        c_duckdb_scalar_function_set_function fun funPtr
+  testCase "register custom scalar function and execute" $ do
+    withDatabase \db ->
+      withConnection db \conn -> do
+        withLogicalType (c_duckdb_create_logical_type (DuckDBTypeAlias DuckDBTypeInteger)) \intType -> do
+          funPtr <- mkScalarFun negateCallback
+          withScalarFunction \fun -> do
+            withConstCString "negate_int" $ \name -> c_duckdb_scalar_function_set_name fun name
+            c_duckdb_scalar_function_add_parameter fun intType
+            c_duckdb_scalar_function_set_return_type fun intType
+            c_duckdb_scalar_function_set_function fun funPtr
 
-                        c_duckdb_register_scalar_function conn fun >>= (@?= DuckDBSuccess)
+            c_duckdb_register_scalar_function conn fun >>= (@?= DuckDBSuccess)
 
-                        withCString "SELECT negate_int(5)" $ \sql ->
-                            withResultCString conn sql $ \resPtr ->
-                                c_duckdb_value_int32 resPtr 0 0 >>= (@?= (-5))
+            withConstCString "SELECT negate_int(5)" $ \sql ->
+              withResultCString conn sql $ \resPtr ->
+                c_duckdb_value_int32 resPtr 0 0 >>= (@?= (-5))
 
 -- Callback ------------------------------------------------------------------
 
 negateCallback :: DuckDBFunctionInfo -> DuckDBDataChunk -> DuckDBVector -> IO ()
 negateCallback _ chunk outVec = do
-    rows <- c_duckdb_data_chunk_get_size chunk
-    inVec <- c_duckdb_data_chunk_get_vector chunk 0
-    inPtr <- castToInt32Ptr <$> c_duckdb_vector_get_data inVec
-    outPtr <- castToInt32Ptr <$> c_duckdb_vector_get_data outVec
+  rows <- c_duckdb_data_chunk_get_size chunk
+  inVec <- c_duckdb_data_chunk_get_vector chunk 0
+  inPtr <- castToInt32Ptr <$> c_duckdb_vector_get_data inVec
+  outPtr <- castToInt32Ptr <$> c_duckdb_vector_get_data outVec
 
-    forM_ [0 .. fromIntegral rows - 1] \idx -> do
-        val <- peekElemOff inPtr idx
-        pokeElemOff outPtr idx (negate val)
+  forM_ [0 .. fromIntegral rows - 1] \idx -> do
+    val <- peekElemOff inPtr idx
+    pokeElemOff outPtr idx (negate val)
 
-    c_duckdb_data_chunk_set_size chunk rows
+  c_duckdb_data_chunk_set_size chunk rows
 
-varargBind :: Ptr () -> DuckDBDeleteCallback -> DuckDBCopyCallback -> Int -> DuckDBBindInfo -> IO ()
+varargBind :: Ptr Void -> DuckDBDeleteCallback -> DuckDBCopyCallback -> Int -> DuckDBBindInfo -> IO ()
 varargBind extraPtr deleteBindCb copyCb bindDataSize info = do
-    extra <- c_duckdb_scalar_function_bind_get_extra_info info
-    assertBool "extra info propagated to bind phase" (extra == extraPtr)
+  extra <- c_duckdb_scalar_function_bind_get_extra_info info
+  assertBool "extra info propagated to bind phase" (extra == extraPtr)
 
-    argCount <- c_duckdb_scalar_function_bind_get_argument_count info
+  argCount <- c_duckdb_scalar_function_bind_get_argument_count info
 
-    alloca \ctxPtr -> do
-        c_duckdb_scalar_function_get_client_context info ctxPtr
-        ctx <- peek ctxPtr
-        unless (ctx == nullPtr) $
-            c_duckdb_destroy_client_context ctxPtr
+  alloca \ctxPtr -> do
+    c_duckdb_scalar_function_get_client_context info ctxPtr
+    ctx <- peek ctxPtr
+    unless (ctx == coerce nullPtr) $
+      c_duckdb_destroy_client_context ctxPtr
 
-    if argCount == 0
-        then withCString "at least one argument required" $ \msg ->
-            c_duckdb_scalar_function_bind_set_error info msg
-        else do
-            expr <- c_duckdb_scalar_function_bind_get_argument info 0
-            alloca \exprPtr -> poke exprPtr expr >> c_duckdb_destroy_expression exprPtr
+  if argCount == 0
+    then withConstCString "at least one argument required" $ \msg ->
+      c_duckdb_scalar_function_bind_set_error info msg
+    else do
+      expr <- c_duckdb_scalar_function_bind_get_argument info 0
+      alloca \exprPtr -> poke exprPtr expr >> c_duckdb_destroy_expression exprPtr
 
-            bindStorage <- mallocBytes bindDataSize
-            poke (castPtr bindStorage :: Ptr Int32) (fromIntegral argCount)
+      bindStorage <- mallocBytes bindDataSize
+      poke (coerce bindStorage :: Ptr Int32) (fromIntegral argCount)
 
-            c_duckdb_scalar_function_set_bind_data info bindStorage deleteBindCb
-            c_duckdb_scalar_function_set_bind_data_copy info copyCb
+      c_duckdb_scalar_function_set_bind_data info bindStorage deleteBindCb
+      c_duckdb_scalar_function_set_bind_data_copy info copyCb
 
-varargExec :: Ptr () -> Int -> DuckDBFunctionInfo -> DuckDBDataChunk -> DuckDBVector -> IO ()
+varargExec :: Ptr Void -> Int -> DuckDBFunctionInfo -> DuckDBDataChunk -> DuckDBVector -> IO ()
 varargExec extraPtr _ info chunk outVec = do
-    bindData <- c_duckdb_scalar_function_get_bind_data info
-    argCount <-
-        if bindData == nullPtr
-            then pure (0 :: Integer)
-            else fromIntegral <$> peek (castPtr bindData :: Ptr Int32)
+  bindData <- c_duckdb_scalar_function_get_bind_data info
+  argCount <-
+    if bindData == nullPtr
+      then pure (0 :: Integer)
+      else fromIntegral <$> peek (coerce bindData :: Ptr Int32)
 
-    extra <- c_duckdb_scalar_function_get_extra_info info
-    assertBool "extra info visible during execution" (extra == extraPtr)
+  extra <- c_duckdb_scalar_function_get_extra_info info
+  assertBool "extra info visible during execution" (extra == extraPtr)
 
-    rowCount <- fromIntegral <$> c_duckdb_data_chunk_get_size chunk
-    vectors <- mapM (c_duckdb_data_chunk_get_vector chunk . fromIntegral) [0 .. argCount - 1]
-    dataPtrs <- mapM (fmap castToInt32Ptr . c_duckdb_vector_get_data) vectors
-    outPtr <- castToInt32Ptr <$> c_duckdb_vector_get_data outVec
+  rowCount <- fromIntegral <$> c_duckdb_data_chunk_get_size chunk
+  vectors <- mapM (c_duckdb_data_chunk_get_vector chunk . fromIntegral) [0 .. argCount - 1]
+  dataPtrs <- mapM (fmap castToInt32Ptr . c_duckdb_vector_get_data) vectors
+  outPtr <- castToInt32Ptr <$> c_duckdb_vector_get_data outVec
 
-    let loop idx
-            | idx >= rowCount = pure False
-            | otherwise = do
-                values <- mapM (`peekElemOff` idx) dataPtrs
-                let total = sum values
-                if total < 0
-                    then do
-                        withCString "negative sum not allowed" $ \msg ->
-                            c_duckdb_scalar_function_set_error info msg
-                        c_duckdb_data_chunk_set_size chunk 0
-                        pure True
-                    else do
-                        pokeElemOff outPtr idx total
-                        loop (idx + 1)
+  let loop idx
+        | idx >= rowCount = pure False
+        | otherwise = do
+            values <- mapM (`peekElemOff` idx) dataPtrs
+            let total = sum values
+            if total < 0
+              then do
+                withConstCString "negative sum not allowed" $ \msg ->
+                  c_duckdb_scalar_function_set_error info msg
+                c_duckdb_data_chunk_set_size chunk 0
+                pure True
+              else do
+                pokeElemOff outPtr idx total
+                loop (idx + 1)
 
-    errored <- loop 0
-    unless errored $
-        c_duckdb_data_chunk_set_size chunk (fromIntegral rowCount)
+  errored <- loop 0
+  unless errored $
+    c_duckdb_data_chunk_set_size chunk (fromIntegral rowCount)
 
 scalarFunctionSetFeatures :: TestTree
 scalarFunctionSetFeatures =
-    testCase "scalar function bind helpers and function sets" $
-        withDatabase \db ->
-            withConnection db \conn ->
-                withLogicalType (c_duckdb_create_logical_type DuckDBTypeInteger) \intType -> do
-                    let bindDataSize = sizeOf (undefined :: Int32)
+  testCase "scalar function bind helpers and function sets" $
+    withDatabase \db ->
+      withConnection db \conn ->
+        withLogicalType (c_duckdb_create_logical_type (DuckDBTypeAlias DuckDBTypeInteger)) \intType -> do
+          let bindDataSize = staticSizeOf (Proxy @Int32)
 
-                    extraStorage <- mallocBytes bindDataSize
-                    poke (castPtr extraStorage) (123 :: Int32)
-                    deleteExtraCb <- mkDeleteCallback \ptr ->
-                        when (ptr /= nullPtr) (free ptr)
+          extraStorage <- mallocBytes bindDataSize
+          poke (coerce extraStorage) (123 :: Int32)
+          deleteExtraCb <- mkDeleteCallback \ptr ->
+            when (ptr /= nullPtr) (free ptr)
 
-                    deleteBindCb <- mkDeleteCallback \ptr ->
-                        when (ptr /= nullPtr) (free ptr)
+          deleteBindCb <- mkDeleteCallback \ptr ->
+            when (ptr /= nullPtr) (free ptr)
 
-                    let copyBindData src
-                            | src == nullPtr = pure nullPtr
-                            | otherwise = do
-                                newPtr <- mallocBytes bindDataSize
-                                value <- peek (castPtr src :: Ptr Int32)
-                                poke (castPtr newPtr) value
-                                pure newPtr
-                    copyCb <- mkCopyCallback copyBindData
+          let copyBindData :: Ptr Void -> IO (Ptr Void)
+              copyBindData src
+                | src == nullPtr = pure nullPtr
+                | otherwise = do
+                    newPtr <- mallocBytes bindDataSize
+                    value <- peek (coerce src :: Ptr Int32)
+                    poke (coerce newPtr) value
+                    pure newPtr
+          copyCb <- mkCopyCallback copyBindData
 
-                    bindFun <- mkScalarBindFun (varargBind (castPtr extraStorage) deleteBindCb copyCb bindDataSize)
-                    execFun <- mkScalarFun (varargExec (castPtr extraStorage) bindDataSize)
+          bindFun <- mkScalarBindFun (varargBind (coerce extraStorage) deleteBindCb copyCb bindDataSize)
+          execFun <- mkScalarFun (varargExec (coerce extraStorage) bindDataSize)
 
-                    let functionName = "haskell_vararg"
+          let functionName = "haskell_vararg"
 
-                    withScalarFunction \fun -> do
-                        withCString functionName $ \cName ->
-                            c_duckdb_scalar_function_set_name fun cName
-                        c_duckdb_scalar_function_set_return_type fun intType
-                        c_duckdb_scalar_function_set_varargs fun intType
-                        c_duckdb_scalar_function_set_special_handling fun
-                        c_duckdb_scalar_function_set_volatile fun
-                        c_duckdb_scalar_function_set_extra_info fun (castPtr extraStorage) deleteExtraCb
-                        c_duckdb_scalar_function_set_bind fun bindFun
-                        c_duckdb_scalar_function_set_function fun execFun
+          withScalarFunction \fun -> do
+            withConstCString functionName $ \cName ->
+              c_duckdb_scalar_function_set_name fun cName
+            c_duckdb_scalar_function_set_return_type fun intType
+            c_duckdb_scalar_function_set_varargs fun intType
+            c_duckdb_scalar_function_set_special_handling fun
+            c_duckdb_scalar_function_set_volatile fun
+            c_duckdb_scalar_function_set_extra_info fun (coerce extraStorage) deleteExtraCb
+            c_duckdb_scalar_function_set_bind fun bindFun
+            c_duckdb_scalar_function_set_function fun execFun
 
-                        withScalarFunctionSet functionName \funSet -> do
-                            c_duckdb_add_scalar_function_to_set funSet fun >>= (@?= DuckDBSuccess)
-                            c_duckdb_register_scalar_function_set conn funSet >>= (@?= DuckDBSuccess)
+            withScalarFunctionSet functionName \funSet -> do
+              c_duckdb_add_scalar_function_to_set funSet fun >>= (@?= DuckDBSuccess)
+              c_duckdb_register_scalar_function_set conn funSet >>= (@?= DuckDBSuccess)
 
-                            withCString "SELECT haskell_vararg(1, 2, 3)" \sql ->
-                                withResultCString conn sql \resPtr ->
-                                    c_duckdb_value_int32 resPtr 0 0 >>= (@?= 6)
+              withConstCString "SELECT haskell_vararg(1, 2, 3)" \sql ->
+                withResultCString conn sql \resPtr ->
+                  c_duckdb_value_int32 resPtr 0 0 >>= (@?= 6)
 
-                            expectQueryError conn "SELECT haskell_vararg()" "at least one argument"
-                            expectQueryError conn "SELECT haskell_vararg(-5, 2)" "negative sum"
+              expectQueryError conn "SELECT haskell_vararg()" "at least one argument"
+              expectQueryError conn "SELECT haskell_vararg(-5, 2)" "negative sum"
 
-                    pure ()
+          pure ()
 
 -- Wrapper builder -----------------------------------------------------------
 
-foreign import ccall "wrapper"
-    mkScalarFun :: (DuckDBFunctionInfo -> DuckDBDataChunk -> DuckDBVector -> IO ()) -> IO DuckDBScalarFunctionFun
+mkScalarFun :: (DuckDBFunctionInfo -> DuckDBDataChunk -> DuckDBVector -> IO ()) -> IO DuckDBScalarFunctionFun
+mkScalarFun = fmap DuckDBScalarFunctionFun . toFunPtr . DuckDBScalarFunctionFun_Aux
 
-foreign import ccall "wrapper"
-    mkScalarBindFun :: (DuckDBBindInfo -> IO ()) -> IO DuckDBScalarFunctionBindFun
+mkScalarBindFun :: (DuckDBBindInfo -> IO ()) -> IO DuckDBScalarFunctionBindFun
+mkScalarBindFun = fmap DuckDBScalarFunctionBindFun . toFunPtr . DuckDBScalarFunctionBindFun_Aux
 
-foreign import ccall "wrapper"
-    mkDeleteCallback :: (Ptr () -> IO ()) -> IO DuckDBDeleteCallback
+mkDeleteCallback :: (Ptr Void -> IO ()) -> IO DuckDBDeleteCallback
+mkDeleteCallback = fmap DuckDBDeleteCallback . toFunPtr . DuckDBDeleteCallback_Aux
 
-foreign import ccall "wrapper"
-    mkCopyCallback :: (Ptr () -> IO (Ptr ())) -> IO DuckDBCopyCallback
+mkCopyCallback :: (Ptr Void -> IO (Ptr Void)) -> IO DuckDBCopyCallback
+mkCopyCallback = fmap DuckDBCopyCallback . toFunPtr . DuckDBCopyCallback_Aux
 
 -- Resource helpers ----------------------------------------------------------
 
@@ -206,25 +212,25 @@
 
 withScalarFunctionSet :: String -> (DuckDBScalarFunctionSet -> IO a) -> IO a
 withScalarFunctionSet name action =
-    withCString name \cName ->
-        bracket (c_duckdb_create_scalar_function_set cName) destroy action
+  withConstCString name \cName ->
+    bracket (c_duckdb_create_scalar_function_set cName) destroy action
   where
     destroy set = alloca \ptr -> poke ptr set >> c_duckdb_destroy_scalar_function_set ptr
 
 expectQueryError :: DuckDBConnection -> String -> String -> IO ()
 expectQueryError conn sql expectedFragment =
-    withCString sql \sqlPtr ->
-        alloca \resPtr -> do
-            state <- c_duckdb_query conn sqlPtr resPtr
-            state @?= DuckDBError
-            errPtr <- c_duckdb_result_error resPtr
-            errMsg <- peekCString errPtr
-            let needle = map toLower expectedFragment
-                haystack = map toLower errMsg
-            assertBool
-                ("expected fragment \"" ++ expectedFragment ++ "\" in error message:\n" ++ errMsg)
-                (needle `isInfixOf` haystack)
-            c_duckdb_destroy_result resPtr
+  withConstCString sql \sqlPtr ->
+    alloca \resPtr -> do
+      state <- c_duckdb_query conn sqlPtr resPtr
+      state @?= DuckDBError
+      errPtr <- c_duckdb_result_error resPtr
+      errMsg <- peekCString (coerce errPtr)
+      let needle = map toLower expectedFragment
+          haystack = map toLower errMsg
+      assertBool
+        ("expected fragment \"" ++ expectedFragment ++ "\" in error message:\n" ++ errMsg)
+        (needle `isInfixOf` haystack)
+      c_duckdb_destroy_result resPtr
 
-castToInt32Ptr :: Ptr () -> Ptr Int32
-castToInt32Ptr = castPtr
+castToInt32Ptr :: Ptr Void -> Ptr Int32
+castToInt32Ptr = coerce
diff --git a/test/SelectionVectorTest.hs b/test/SelectionVectorTest.hs
--- a/test/SelectionVectorTest.hs
+++ b/test/SelectionVectorTest.hs
@@ -3,10 +3,10 @@
 module SelectionVectorTest (tests) where
 
 import Control.Monad (forM_)
+import Data.Coerce (coerce)
 import Data.Int (Int32)
-import Data.Word (Word32)
 import Database.DuckDB.FFI
-import Foreign.Ptr (Ptr, castPtr, nullPtr)
+import Foreign.Ptr (Ptr, nullPtr)
 import Foreign.Storable (peekElemOff, pokeElemOff)
 import Test.Tasty (TestTree, testGroup)
 import Test.Tasty.HUnit (assertBool, testCase, (@?=))
@@ -14,46 +14,46 @@
 
 tests :: TestTree
 tests =
-    testGroup
-        "Selection Vector Interface"
-        [ selectionVectorPointerWritable
-        , selectionVectorCopySelection
-        ]
+  testGroup
+    "Selection Vector Interface"
+    [ selectionVectorPointerWritable
+    , selectionVectorCopySelection
+    ]
 
 selectionVectorPointerWritable :: TestTree
 selectionVectorPointerWritable =
-    testCase "selection vector exposes writable data pointer" $ do
-        withSelectionVector 4 \selVec -> do
-            dataPtr <- c_duckdb_selection_vector_get_data_ptr selVec
-            assertBool "data pointer should be non-null" (dataPtr /= nullPtr)
-            forM_ (zip [0 ..] [0, 2, 4, 6 :: Word32]) (uncurry (pokeElemOff dataPtr))
-            fetched <- mapM (peekElemOff dataPtr) [0 .. 3]
-            fetched @?= [0, 2, 4, 6]
+  testCase "selection vector exposes writable data pointer" $ do
+    withSelectionVector 4 \selVec -> do
+      dataPtr <- c_duckdb_selection_vector_get_data_ptr selVec
+      assertBool "data pointer should be non-null" (dataPtr /= nullPtr)
+      forM_ (zip [0 ..] [0, 2, 4, 6 :: DuckDBSel]) (uncurry (pokeElemOff dataPtr))
+      fetched <- mapM (peekElemOff dataPtr) [0 .. 3]
+      fetched @?= [0, 2, 4, 6]
 
 selectionVectorCopySelection :: TestTree
 selectionVectorCopySelection =
-    testCase "vector_copy_sel copies selected rows" $ do
-        withLogicalType (c_duckdb_create_logical_type DuckDBTypeInteger) \intType -> do
-            withVector (c_duckdb_create_vector intType 4) \srcVec -> do
-                srcPtr <- vectorDataPtr srcVec
-                forM_ (zip [0 ..] [10, 20, 30, 40 :: Int32]) (uncurry (pokeElemOff srcPtr))
+  testCase "vector_copy_sel copies selected rows" $ do
+    withLogicalType (c_duckdb_create_logical_type (DuckDBTypeAlias DuckDBTypeInteger)) \intType -> do
+      withVector (c_duckdb_create_vector intType 4) \srcVec -> do
+        srcPtr <- vectorDataPtr srcVec
+        forM_ (zip [0 ..] [10, 20, 30, 40 :: Int32]) (uncurry (pokeElemOff srcPtr))
 
-                withSelectionVector 2 \selVec -> do
-                    selPtr <- c_duckdb_selection_vector_get_data_ptr selVec
-                    pokeElemOff selPtr 0 1
-                    pokeElemOff selPtr 1 3
+        withSelectionVector 2 \selVec -> do
+          selPtr <- c_duckdb_selection_vector_get_data_ptr selVec
+          pokeElemOff selPtr 0 1
+          pokeElemOff selPtr 1 3
 
-                    withVector (c_duckdb_create_vector intType 2) \dstVec -> do
-                        c_duckdb_vector_copy_sel srcVec dstVec selVec 2 0 0
-                        dstPtr <- vectorDataPtr dstVec
-                        val0 <- peekElemOff dstPtr 0
-                        val1 <- peekElemOff dstPtr 1
-                        val0 @?= 20
-                        val1 @?= 40
+          withVector (c_duckdb_create_vector intType 2) \dstVec -> do
+            c_duckdb_vector_copy_sel srcVec dstVec selVec 2 0 0
+            dstPtr <- vectorDataPtr dstVec
+            val0 <- peekElemOff dstPtr 0
+            val1 <- peekElemOff dstPtr 1
+            val0 @?= 20
+            val1 @?= 40
 
 -- Helpers -------------------------------------------------------------------
 
 vectorDataPtr :: DuckDBVector -> IO (Ptr Int32)
 vectorDataPtr vec = do
-    raw <- c_duckdb_vector_get_data vec
-    pure (castPtr raw)
+  raw <- c_duckdb_vector_get_data vec
+  pure (coerce raw)
diff --git a/test/StreamingResultTest.hs b/test/StreamingResultTest.hs
--- a/test/StreamingResultTest.hs
+++ b/test/StreamingResultTest.hs
@@ -4,115 +4,115 @@
 module StreamingResultTest (tests) where
 
 import Control.Monad (void)
+import Data.Coerce (coerce)
 import Data.Int (Int64)
 import Data.List (intercalate)
 import Database.DuckDB.FFI
-import Database.DuckDB.FFI.Deprecated
-import Foreign.C.String (CString, withCString)
-import Foreign.C.Types (CBool (..))
+import Foreign.C.ConstPtr (ConstPtr (..))
+import Foreign.C.Types (CBool (..), CChar)
 import Foreign.Marshal.Alloc (alloca)
 import Foreign.Ptr (Ptr, nullPtr)
 import Foreign.Storable (peek, poke)
 import Test.Tasty (TestTree, testGroup)
 import Test.Tasty.HUnit (assertBool, testCase, (@?=))
-import Utils (withConnection, withDatabase, withResult)
+import Utils (withConnection, withConstCString, withDatabase, withResult)
 
 tests :: TestTree
 tests =
-    testGroup
-        "Streaming Result Interface"
-        [ streamingFetchConsumesAllChunks
-        , materializedFetchChunkExhaustsResult
-        ]
+  testGroup
+    "Streaming Result Interface"
+    [ streamingFetchConsumesAllChunks
+    , materializedFetchChunkExhaustsResult
+    ]
 
 streamingFetchConsumesAllChunks :: TestTree
 streamingFetchConsumesAllChunks =
-    testCase "stream_fetch_chunk yields data until exhaustion" $
-        withDatabase \db ->
-            withConnection db \conn -> do
-                setupTable conn "streaming_table" 6
+  testCase "stream_fetch_chunk yields data until exhaustion" $
+    withDatabase \db ->
+      withConnection db \conn -> do
+        setupTable conn "streaming_table" 6
 
-                withCString "SELECT id FROM streaming_table ORDER BY id" \querySql ->
-                    alloca \stmtPtr -> do
-                        prepareOk <- c_duckdb_prepare conn querySql stmtPtr
-                        prepareOk @?= DuckDBSuccess
-                        stmt <- peek stmtPtr
-                        assertBool "prepared statement should not be null" (stmt /= nullPtr)
+        withConstCString "SELECT id FROM streaming_table ORDER BY id" \querySql ->
+          alloca \stmtPtr -> do
+            prepareOk <- c_duckdb_prepare conn querySql stmtPtr
+            prepareOk @?= DuckDBSuccess
+            stmt <- peek stmtPtr
+            assertBool "prepared statement should not be null" (stmt /= coerce nullPtr)
 
-                        alloca \pendingPtr -> do
-                            stPending <- c_duckdb_pending_prepared_streaming stmt pendingPtr
-                            stPending @?= DuckDBSuccess
-                            pending <- peek pendingPtr
-                            assertBool "pending result should not be null" (pending /= nullPtr)
+            alloca \pendingPtr -> do
+              stPending <- c_duckdb_pending_prepared_streaming stmt pendingPtr
+              stPending @?= DuckDBSuccess
+              pending <- peek pendingPtr
+              assertBool "pending result should not be null" (pending /= coerce nullPtr)
 
-                            void (c_duckdb_pending_execute_task pending)
+              void (c_duckdb_pending_execute_task pending)
 
-                            alloca \resPtr -> do
-                                execState <- c_duckdb_execute_pending pending resPtr
-                                execState @?= DuckDBSuccess
+              alloca \resPtr -> do
+                execState <- c_duckdb_execute_pending pending resPtr
+                execState @?= DuckDBSuccess
 
-                                streamingFlag <- c_duckdb_result_is_streaming resPtr
-                                streamingFlag @?= CBool 1
+                streamingFlag <- peek resPtr >>= \rawValue -> c_duckdb_result_is_streaming rawValue
+                streamingFlag @?= CBool 1
 
-                                totalRows <- consumeStreamingChunks resPtr 0
-                                totalRows @?= 6
+                totalRows <- consumeStreamingChunks resPtr 0
+                totalRows @?= 6
 
-                                c_duckdb_destroy_result resPtr
+                c_duckdb_destroy_result resPtr
 
-                            c_duckdb_destroy_pending pendingPtr
+              c_duckdb_destroy_pending pendingPtr
 
-                        c_duckdb_destroy_prepare stmtPtr
+            c_duckdb_destroy_prepare stmtPtr
 
 materializedFetchChunkExhaustsResult :: TestTree
 materializedFetchChunkExhaustsResult =
-    testCase "fetch_chunk provides chunk and then null for materialized result" $
-        withDatabase \db ->
-            withConnection db \conn -> do
-                setupTable conn "materialized_table" 4
+  testCase "fetch_chunk provides chunk and then null for materialized result" $
+    withDatabase \db ->
+      withConnection db \conn -> do
+        setupTable conn "materialized_table" 4
 
-                withResult conn "SELECT id FROM materialized_table ORDER BY id" \resPtr -> do
-                    chunk <- c_duckdb_fetch_chunk resPtr
-                    assertBool "first fetch_chunk should yield a chunk" (chunk /= nullPtr)
+        withResult conn "SELECT id FROM materialized_table ORDER BY id" \resPtr -> do
+          chunk <- peek resPtr >>= \rawValue -> c_duckdb_fetch_chunk rawValue
+          assertBool "first fetch_chunk should yield a chunk" (chunk /= coerce nullPtr)
 
-                    chunkSize <- c_duckdb_data_chunk_get_size chunk
-                    assertBool "materialized chunk should have rows" (chunkSize > 0)
+          chunkSize <- c_duckdb_data_chunk_get_size chunk
+          assertBool "materialized chunk should have rows" (chunkSize > 0)
 
-                    destroyChunk chunk
+          destroyChunk chunk
 
-                    chunkNext <- c_duckdb_fetch_chunk resPtr
-                    chunkNext @?= nullPtr
+          chunkNext <- peek resPtr >>= \rawValue -> c_duckdb_fetch_chunk rawValue
+          chunkNext @?= coerce nullPtr
 
 -- helpers ------------------------------------------------------------------
 
 consumeStreamingChunks :: Ptr DuckDBResult -> Int64 -> IO Int64
 consumeStreamingChunks resPtr acc = do
-    chunk <- c_duckdb_stream_fetch_chunk resPtr
-    if chunk == nullPtr
-        then pure acc
-        else do
-            chunkSize <- c_duckdb_data_chunk_get_size chunk
-            assertBool "streaming chunk should not be empty" (chunkSize > 0)
-            destroyChunk chunk
-            consumeStreamingChunks resPtr (acc + fromIntegral chunkSize)
+  chunk <- peek resPtr >>= \rawValue -> c_duckdb_stream_fetch_chunk rawValue
+  if chunk == coerce nullPtr
+    then pure acc
+    else do
+      chunkSize <- c_duckdb_data_chunk_get_size chunk
+      assertBool "streaming chunk should not be empty" (chunkSize > 0)
+      destroyChunk chunk
+      consumeStreamingChunks resPtr (acc + fromIntegral chunkSize)
 
 setupTable :: DuckDBConnection -> String -> Int -> IO ()
 setupTable conn tableName totalRows = do
-    withCString ("CREATE TABLE " <> tableName <> " (id INTEGER);") $ \createSql ->
-        execStatement conn createSql
-    let values = intercalate ", " ["(" <> show i <> ")" | i <- [1 .. totalRows]]
-        insertSql = "INSERT INTO " <> tableName <> " VALUES " <> values <> ";"
-    withCString insertSql $ \insertCStr ->
-        execStatement conn insertCStr
+  withConstCString ("CREATE TABLE " <> tableName <> " (id INTEGER);") $ \createSql ->
+    execStatement conn createSql
+  let values = intercalate ", " ["(" <> show i <> ")" | i <- [1 .. totalRows]]
+      insertSql = "INSERT INTO " <> tableName <> " VALUES " <> values <> ";"
+  withConstCString insertSql $ \insertCStr ->
+    execStatement conn insertCStr
 
-execStatement :: DuckDBConnection -> CString -> IO ()
+execStatement :: DuckDBConnection -> ConstPtr CChar -> IO ()
 execStatement conn sql =
-    alloca \resPtr -> do
-        st <- c_duckdb_query conn sql resPtr
-        st @?= DuckDBSuccess
-        c_duckdb_destroy_result resPtr
+  alloca \resPtr -> do
+    st <- c_duckdb_query conn sql resPtr
+    st @?= DuckDBSuccess
+    c_duckdb_destroy_result resPtr
 
 destroyChunk :: DuckDBDataChunk -> IO ()
 destroyChunk chunk =
-    alloca \ptr -> do
-        poke ptr chunk
-        c_duckdb_destroy_data_chunk ptr
+  alloca \ptr -> do
+    poke ptr chunk
+    c_duckdb_destroy_data_chunk ptr
diff --git a/test/TableDescriptionTest.hs b/test/TableDescriptionTest.hs
--- a/test/TableDescriptionTest.hs
+++ b/test/TableDescriptionTest.hs
@@ -4,139 +4,141 @@
 
 import Control.Exception (finally)
 import Control.Monad (when)
+import Data.Coerce (coerce)
 import Database.DuckDB.FFI
-import Foreign.C.String (CString, peekCString, withCString)
-import Foreign.C.Types (CBool (..))
+import Foreign.C.ConstPtr (ConstPtr (..))
+import Foreign.C.String (peekCString)
+import Foreign.C.Types (CBool (..), CChar)
 import Foreign.Marshal.Alloc (alloca)
-import Foreign.Ptr (Ptr, castPtr, nullPtr)
+import Foreign.Ptr (Ptr, nullPtr)
 import Foreign.Storable (peek)
 import Test.Tasty (TestTree, testGroup)
 import Test.Tasty.HUnit (assertBool, assertFailure, testCase, (@?=))
-import Utils (withConnection, withDatabase)
+import Utils (withConnection, withConstCString, withDatabase)
 
 tests :: TestTree
 tests =
-    testGroup
-        "Table Description"
-        [ tableDescriptionLifecycle
-        , tableDescriptionExtended
-        , tableDescriptionErrorHandling
-        ]
+  testGroup
+    "Table Description"
+    [ tableDescriptionLifecycle
+    , tableDescriptionExtended
+    , tableDescriptionErrorHandling
+    ]
 
 tableDescriptionLifecycle :: TestTree
 tableDescriptionLifecycle =
-    testCase "inspect column names and defaults for main schema tables" $
-        withDatabase \db ->
-            withConnection db \conn -> do
-                runStatement
-                    conn
-                    "CREATE TABLE description_demo(id INTEGER, name VARCHAR DEFAULT 'guest', active BOOLEAN DEFAULT TRUE)"
+  testCase "inspect column names and defaults for main schema tables" $
+    withDatabase \db ->
+      withConnection db \conn -> do
+        runStatement
+          conn
+          "CREATE TABLE description_demo(id INTEGER, name VARCHAR DEFAULT 'guest', active BOOLEAN DEFAULT TRUE)"
 
-                withTableDescription conn Nothing "description_demo" \desc -> do
-                    checkColumn desc 0 "id" False
-                    checkColumn desc 1 "name" True
-                    checkColumn desc 2 "active" True
-                    c_duckdb_table_description_error desc >>= (@?= nullPtr)
+        withTableDescription conn Nothing "description_demo" \desc -> do
+          checkColumn desc 0 "id" False
+          checkColumn desc 1 "name" True
+          checkColumn desc 2 "active" True
+          c_duckdb_table_description_error desc >>= (@?= coerce nullPtr)
 
 tableDescriptionExtended :: TestTree
 tableDescriptionExtended =
-    testCase "describe table in custom schema via extended constructor" $
-        withDatabase \db ->
-            withConnection db \conn -> do
-                runStatement conn "CREATE SCHEMA custom_schema"
-                runStatement conn "CREATE TABLE custom_schema.ext_demo(id INTEGER DEFAULT 7, note VARCHAR)"
+  testCase "describe table in custom schema via extended constructor" $
+    withDatabase \db ->
+      withConnection db \conn -> do
+        runStatement conn "CREATE SCHEMA custom_schema"
+        runStatement conn "CREATE TABLE custom_schema.ext_demo(id INTEGER DEFAULT 7, note VARCHAR)"
 
-                withTableDescriptionExt conn Nothing (Just "custom_schema") "ext_demo" \desc -> do
-                    checkColumn desc 0 "id" True
-                    checkColumn desc 1 "note" False
-                    c_duckdb_table_description_error desc >>= (@?= nullPtr)
+        withTableDescriptionExt conn Nothing (Just "custom_schema") "ext_demo" \desc -> do
+          checkColumn desc 0 "id" True
+          checkColumn desc 1 "note" False
+          c_duckdb_table_description_error desc >>= (@?= coerce nullPtr)
 
 tableDescriptionErrorHandling :: TestTree
 tableDescriptionErrorHandling =
-    testCase "surface error information when describing missing tables" $
-        withDatabase \db ->
-            withConnection db \conn ->
-                withCString "missing_table" \tablePtr ->
-                    alloca \descPtr -> do
-                        state <- c_duckdb_table_description_create conn nullPtr tablePtr descPtr
-                        state @?= DuckDBError
-                        desc <- peek descPtr
-                        let cleanup = c_duckdb_table_description_destroy descPtr
-                        let action =
-                                if desc == nullPtr
-                                    then assertFailure "table description handle should be populated on error"
-                                    else do
-                                        errPtr <- c_duckdb_table_description_error desc
-                                        assertBool "error pointer should not be null" (errPtr /= nullPtr)
-                                        errMsg <- peekCString errPtr
-                                        assertBool "error message should not be empty" (not (null errMsg))
-                        action `finally` cleanup
+  testCase "surface error information when describing missing tables" $
+    withDatabase \db ->
+      withConnection db \conn ->
+        withConstCString "missing_table" \tablePtr ->
+          alloca \descPtr -> do
+            state <- c_duckdb_table_description_create conn (coerce nullPtr) tablePtr descPtr
+            state @?= DuckDBError
+            desc <- peek descPtr
+            let cleanup = c_duckdb_table_description_destroy descPtr
+            let action =
+                  if desc == coerce nullPtr
+                    then assertFailure "table description handle should be populated on error"
+                    else do
+                      errPtr <- c_duckdb_table_description_error desc
+                      assertBool "error pointer should not be null" (errPtr /= coerce nullPtr)
+                      errMsg <- peekCString (coerce errPtr)
+                      assertBool "error message should not be empty" (not (null errMsg))
+            action `finally` cleanup
 
 -- Helpers -------------------------------------------------------------------
 
 runStatement :: DuckDBConnection -> String -> IO ()
 runStatement conn sql =
-    withCString sql \sqlPtr ->
-        alloca \resPtr -> do
-            state <- c_duckdb_query conn sqlPtr resPtr
-            if state == DuckDBSuccess
-                then c_duckdb_destroy_result resPtr
-                else do
-                    errPtr <- c_duckdb_result_error resPtr
-                    errMsg <-
-                        if errPtr == nullPtr
-                            then pure "unknown error"
-                            else peekCString errPtr
-                    c_duckdb_destroy_result resPtr
-                    assertFailure ("duckdb_query failed: " <> errMsg)
+  withConstCString sql \sqlPtr ->
+    alloca \resPtr -> do
+      state <- c_duckdb_query conn sqlPtr resPtr
+      if state == DuckDBSuccess
+        then c_duckdb_destroy_result resPtr
+        else do
+          errPtr <- c_duckdb_result_error resPtr
+          errMsg <-
+            if errPtr == coerce nullPtr
+              then pure "unknown error"
+              else peekCString (coerce errPtr)
+          c_duckdb_destroy_result resPtr
+          assertFailure ("duckdb_query failed: " <> errMsg)
 
 withTableDescription :: DuckDBConnection -> Maybe String -> String -> (DuckDBTableDescription -> IO a) -> IO a
 withTableDescription conn schema table action =
-    withMaybeCString schema \schemaPtr ->
-        withCString table \tablePtr ->
-            withDescriptionHandle (c_duckdb_table_description_create conn schemaPtr tablePtr) action
+  withMaybeCString schema \schemaPtr ->
+    withConstCString table \tablePtr ->
+      withDescriptionHandle (c_duckdb_table_description_create conn schemaPtr tablePtr) action
 
 withTableDescriptionExt :: DuckDBConnection -> Maybe String -> Maybe String -> String -> (DuckDBTableDescription -> IO a) -> IO a
 withTableDescriptionExt conn catalog schema table action =
-    withMaybeCString catalog \catalogPtr ->
-        withMaybeCString schema \schemaPtr ->
-            withCString table \tablePtr ->
-                withDescriptionHandle (c_duckdb_table_description_create_ext conn catalogPtr schemaPtr tablePtr) action
+  withMaybeCString catalog \catalogPtr ->
+    withMaybeCString schema \schemaPtr ->
+      withConstCString table \tablePtr ->
+        withDescriptionHandle (c_duckdb_table_description_create_ext conn catalogPtr schemaPtr tablePtr) action
 
 withDescriptionHandle :: (Ptr DuckDBTableDescription -> IO DuckDBState) -> (DuckDBTableDescription -> IO a) -> IO a
 withDescriptionHandle acquire action =
-    alloca \descPtr -> do
-        state <- acquire descPtr
-        state @?= DuckDBSuccess
-        desc <- peek descPtr
-        when (desc == nullPtr) $
-            assertFailure "table description handle should not be null"
-        let cleanup = c_duckdb_table_description_destroy descPtr
-        action desc `finally` cleanup
+  alloca \descPtr -> do
+    state <- acquire descPtr
+    state @?= DuckDBSuccess
+    desc <- peek descPtr
+    when (desc == coerce nullPtr) $
+      assertFailure "table description handle should not be null"
+    let cleanup = c_duckdb_table_description_destroy descPtr
+    action desc `finally` cleanup
 
-withMaybeCString :: Maybe String -> (CString -> IO a) -> IO a
-withMaybeCString Nothing action = action nullPtr
-withMaybeCString (Just txt) action = withCString txt action
+withMaybeCString :: Maybe String -> (ConstPtr CChar -> IO a) -> IO a
+withMaybeCString Nothing action = action (coerce nullPtr)
+withMaybeCString (Just txt) action = withConstCString txt action
 
 checkColumn :: DuckDBTableDescription -> DuckDBIdx -> String -> Bool -> IO ()
 checkColumn desc idx expectedName expectedDefault = do
-    hasDef <- columnHasDefault desc idx
-    hasDef @?= expectedDefault
-    name <- getColumnName desc idx
-    name @?= expectedName
+  hasDef <- columnHasDefault desc idx
+  hasDef @?= expectedDefault
+  name <- getColumnName desc idx
+  name @?= expectedName
 
 getColumnName :: DuckDBTableDescription -> DuckDBIdx -> IO String
 getColumnName desc idx = do
-    namePtr <- c_duckdb_table_description_get_column_name desc idx
-    assertBool "column name pointer should not be null" (namePtr /= nullPtr)
-    name <- peekCString namePtr
-    c_duckdb_free (castPtr namePtr)
-    pure name
+  namePtr <- c_duckdb_table_description_get_column_name desc idx
+  assertBool "column name pointer should not be null" (namePtr /= nullPtr)
+  name <- peekCString (coerce namePtr)
+  c_duckdb_free (coerce namePtr)
+  pure name
 
 columnHasDefault :: DuckDBTableDescription -> DuckDBIdx -> IO Bool
 columnHasDefault desc idx =
-    alloca \outPtr -> do
-        state <- c_duckdb_column_has_default desc idx outPtr
-        state @?= DuckDBSuccess
-        CBool val <- peek outPtr
-        pure (val /= 0)
+  alloca \outPtr -> do
+    state <- c_duckdb_column_has_default desc idx outPtr
+    state @?= DuckDBSuccess
+    CBool val <- peek outPtr
+    pure (val /= 0)
diff --git a/test/TableFunctionsTest.hs b/test/TableFunctionsTest.hs
--- a/test/TableFunctionsTest.hs
+++ b/test/TableFunctionsTest.hs
@@ -1,6 +1,6 @@
 {-# LANGUAGE BlockArguments #-}
-{-# LANGUAGE ForeignFunctionInterface #-}
 {-# LANGUAGE RecordWildCards #-}
+{-# LANGUAGE TypeApplications #-}
 {-# OPTIONS_GHC -Wno-deprecations #-}
 
 module TableFunctionsTest (tests) where
@@ -9,451 +9,458 @@
 import Control.Exception (bracket)
 import Control.Monad (forM_, when)
 import Data.Char (isAsciiUpper)
+import Data.Coerce (coerce)
 import Data.IORef (IORef, modifyIORef', newIORef, readIORef, writeIORef)
 import Data.Int (Int64)
 import Data.List (isInfixOf)
 import Data.Maybe (fromMaybe)
+import Data.Proxy (Proxy (..))
+import Data.Void (Void)
 import Database.DuckDB.FFI
-import Database.DuckDB.FFI.Deprecated
-import Foreign.C.String (CString, peekCString, withCString)
-import Foreign.C.Types (CBool (..))
+import Foreign.C.ConstPtr (ConstPtr (..))
+import Foreign.C.String (peekCString)
+import Foreign.C.Types (CBool (..), CChar)
 import Foreign.Marshal.Alloc (alloca, free, mallocBytes)
-import Foreign.Ptr (Ptr, castPtr, freeHaskellFunPtr, nullPtr)
-import Foreign.Storable (peek, peekElemOff, poke, pokeElemOff, sizeOf)
+import Foreign.Ptr (Ptr, freeHaskellFunPtr, nullPtr)
+import Foreign.Storable (peek, peekElemOff, poke, pokeElemOff)
+import HsBindgen.Runtime.Marshal (staticSizeOf)
+import HsBindgen.Runtime.Support.FunPtr (toFunPtr)
 import Test.Tasty (TestTree, testGroup)
 import Test.Tasty.HUnit (assertBool, assertFailure, testCase, (@?=))
-import Utils (withConnection, withDatabase, withLogicalType, withResultCString, withValue)
+import Utils (withConnection, withConstCString, withDatabase, withLogicalType, withResultCString, withValue)
 
 tests :: TestTree
 tests =
-    testGroup
-        "Table Functions"
-        [tableFunctionLifecycle]
+  testGroup
+    "Table Functions"
+    [tableFunctionLifecycle]
 
 tableFunctionLifecycle :: TestTree
 tableFunctionLifecycle =
-    testCase "table function lifecycle covers core callbacks" $
-        runInBoundThread do
-            withDatabase \db ->
-                withLogicalType (c_duckdb_create_logical_type DuckDBTypeBigInt) \bigint ->
-                    withHarness bigint \harness@TableHarness{} -> do
-                        (bindError, execError, initError) <-
-                            withConnection db \conn ->
-                                withTableFunction \tableFun -> do
-                                    configureTableFunction tableFun harness
-                                    c_duckdb_register_table_function conn tableFun >>= (@?= DuckDBSuccess)
+  testCase "table function lifecycle covers core callbacks" $
+    runInBoundThread do
+      withDatabase \db ->
+        withLogicalType (c_duckdb_create_logical_type (DuckDBTypeAlias DuckDBTypeBigInt)) \bigint ->
+          withHarness bigint \harness@TableHarness{} -> do
+            (bindError, execError, initError) <-
+              withConnection db \conn ->
+                withTableFunction \tableFun -> do
+                  configureTableFunction tableFun harness
+                  c_duckdb_register_table_function conn tableFun >>= (@?= DuckDBSuccess)
 
-                                    withCString "SELECT value, double_value FROM haskell_numbers(5, start => 2)" \sql ->
-                                        withResultCString conn sql \resPtr -> do
-                                            c_duckdb_column_count resPtr >>= (@?= 2)
-                                            c_duckdb_row_count resPtr >>= (@?= 5)
-                                            forM_ [0 .. 4] \idx -> do
-                                                c_duckdb_value_int64 resPtr 0 idx >>= (@?= 2 + fromIntegral idx)
-                                                c_duckdb_value_int64 resPtr 1 idx >>= (@?= 2 * (2 + fromIntegral idx))
+                  withConstCString "SELECT value, double_value FROM haskell_numbers(5, start => 2)" \sql ->
+                    withResultCString conn sql \resPtr -> do
+                      c_duckdb_column_count resPtr >>= (@?= 2)
+                      c_duckdb_row_count resPtr >>= (@?= 5)
+                      forM_ [0 .. 4] \idx -> do
+                        c_duckdb_value_int64 resPtr 0 idx >>= (@?= 2 + fromIntegral idx)
+                        c_duckdb_value_int64 resPtr 1 idx >>= (@?= 2 * (2 + fromIntegral idx))
 
-                                    withCString "SELECT value FROM haskell_numbers(3)" \sql ->
-                                        withResultCString conn sql \resPtr -> do
-                                            c_duckdb_column_count resPtr >>= (@?= 1)
-                                            forM_ (zip [0 ..] [0 .. 2]) \(idx, expected) ->
-                                                c_duckdb_value_int64 resPtr 0 idx >>= (@?= expected)
+                  withConstCString "SELECT value FROM haskell_numbers(3)" \sql ->
+                    withResultCString conn sql \resPtr -> do
+                      c_duckdb_column_count resPtr >>= (@?= 1)
+                      forM_ (zip [0 ..] [0 .. 2]) \(idx, expected) ->
+                        c_duckdb_value_int64 resPtr 0 idx >>= (@?= expected)
 
-                                    bindError <-
-                                        withCString "SELECT * FROM haskell_numbers(0)" \sql ->
-                                            alloca \resPtr -> do
-                                                state <- c_duckdb_query conn sql resPtr
-                                                errPtr <- c_duckdb_result_error resPtr
-                                                msg <- peekCStringMaybe errPtr
-                                                c_duckdb_destroy_result resPtr
-                                                pure (state, msg)
+                  bindError <-
+                    withConstCString "SELECT * FROM haskell_numbers(0)" \sql ->
+                      alloca \resPtr -> do
+                        state <- c_duckdb_query conn sql resPtr
+                        errPtr <- c_duckdb_result_error resPtr
+                        msg <- peekCStringMaybe errPtr
+                        c_duckdb_destroy_result resPtr
+                        pure (state, msg)
 
-                                    execError <-
-                                        withCString "SELECT * FROM haskell_numbers(5, fail_at => 3)" \sql ->
-                                            alloca \resPtr -> do
-                                                state <- c_duckdb_query conn sql resPtr
-                                                errPtr <- c_duckdb_result_error resPtr
-                                                msg <- peekCStringMaybe errPtr
-                                                c_duckdb_destroy_result resPtr
-                                                pure (state, msg)
+                  execError <-
+                    withConstCString "SELECT * FROM haskell_numbers(5, fail_at => 3)" \sql ->
+                      alloca \resPtr -> do
+                        state <- c_duckdb_query conn sql resPtr
+                        errPtr <- c_duckdb_result_error resPtr
+                        msg <- peekCStringMaybe errPtr
+                        c_duckdb_destroy_result resPtr
+                        pure (state, msg)
 
-                                    initError <-
-                                        withCString "SELECT * FROM haskell_numbers(2, force_init_error => 1)" \sql ->
-                                            alloca \resPtr -> do
-                                                state <- c_duckdb_query conn sql resPtr
-                                                errPtr <- c_duckdb_result_error resPtr
-                                                msg <- peekCStringMaybe errPtr
-                                                c_duckdb_destroy_result resPtr
-                                                pure (state, msg)
+                  initError <-
+                    withConstCString "SELECT * FROM haskell_numbers(2, force_init_error => 1)" \sql ->
+                      alloca \resPtr -> do
+                        state <- c_duckdb_query conn sql resPtr
+                        errPtr <- c_duckdb_result_error resPtr
+                        msg <- peekCStringMaybe errPtr
+                        c_duckdb_destroy_result resPtr
+                        pure (state, msg)
 
-                                    pure (bindError, execError, initError)
+                  pure (bindError, execError, initError)
 
-                        stats <- snapshotStats harness
-                        hsBindFreed stats @?= 3
-                        hsInitFreed stats @?= 3
-                        hsLocalFreed stats @?= 3
-                        assertBool "client context seen" (hsClientContextSeen stats)
-                        hsCounts stats @?= [5, 3, 0, 5, 2]
-                        hsProjectionHistory stats
-                            @?= [ ProjectionSnapshot 2 [0, 1]
-                                , ProjectionSnapshot 1 [0]
-                                , ProjectionSnapshot 2 [0, 1]
-                                ]
-                        fst bindError @?= DuckDBError
-                        assertBool "bind error mentions positivity" ("positive" `contains` snd bindError)
-                        fst execError @?= DuckDBError
-                        assertBool "execution error mentions table function" ("execution" `contains` snd execError)
-                        fst initError @?= DuckDBError
-                        assertBool "init error mentions initialization" ("init" `contains` snd initError)
+            stats <- snapshotStats harness
+            hsBindFreed stats @?= 3
+            hsInitFreed stats @?= 3
+            hsLocalFreed stats @?= 3
+            assertBool "client context seen" (hsClientContextSeen stats)
+            hsCounts stats @?= [5, 3, 0, 5, 2]
+            hsProjectionHistory stats
+              @?= [ ProjectionSnapshot 2 [0, 1]
+                  , ProjectionSnapshot 1 [0]
+                  , ProjectionSnapshot 2 [0, 1]
+                  ]
+            fst bindError @?= DuckDBError
+            assertBool "bind error mentions positivity" ("positive" `contains` snd bindError)
+            fst execError @?= DuckDBError
+            assertBool "execution error mentions table function" ("execution" `contains` snd execError)
+            fst initError @?= DuckDBError
+            assertBool "init error mentions initialization" ("init" `contains` snd initError)
 
 -- Harness --------------------------------------------------------------------
 
 data ProjectionSnapshot = ProjectionSnapshot
-    { psCount :: !Int
-    , psIndices :: ![Int]
-    }
-    deriving (Eq, Show)
+  { psCount :: !Int
+  , psIndices :: ![Int]
+  }
+  deriving (Eq, Show)
 
 data ExecutionMode
-    = ModeUnset
-    | ModeNormal
-    | ModeInitError
-    | ModeRejected
-    deriving (Eq, Show)
+  = ModeUnset
+  | ModeNormal
+  | ModeInitError
+  | ModeRejected
+  deriving (Eq, Show)
 
 data TableHarness = TableHarness
-    { thColumnType :: !DuckDBLogicalType
-    , thExtraBuffer :: !(Ptr ())
-    , thExtraCount :: !(IORef Int)
-    , thBindCount :: !(IORef Int)
-    , thInitCount :: !(IORef Int)
-    , thLocalCount :: !(IORef Int)
-    , thBindPtr :: !(IORef (Maybe (Ptr ())))
-    , thInitPtr :: !(IORef (Maybe (Ptr ())))
-    , thLocalPtr :: !(IORef (Maybe (Ptr ())))
-    , thProjectionCurrent :: !(IORef (Maybe ProjectionSnapshot))
-    , thProjectionHistory :: !(IORef [ProjectionSnapshot])
-    , thClientContextSeen :: !(IORef Bool)
-    , thModeRef :: !(IORef ExecutionMode)
-    , thCountHistory :: !(IORef [Int64])
-    , thCallbacks :: !TableCallbacks
-    , thDeletes :: !DeleteCallbacks
-    }
+  { thColumnType :: !DuckDBLogicalType
+  , thExtraBuffer :: !(Ptr Void)
+  , thExtraCount :: !(IORef Int)
+  , thBindCount :: !(IORef Int)
+  , thInitCount :: !(IORef Int)
+  , thLocalCount :: !(IORef Int)
+  , thBindPtr :: !(IORef (Maybe (Ptr Void)))
+  , thInitPtr :: !(IORef (Maybe (Ptr Void)))
+  , thLocalPtr :: !(IORef (Maybe (Ptr Void)))
+  , thProjectionCurrent :: !(IORef (Maybe ProjectionSnapshot))
+  , thProjectionHistory :: !(IORef [ProjectionSnapshot])
+  , thClientContextSeen :: !(IORef Bool)
+  , thModeRef :: !(IORef ExecutionMode)
+  , thCountHistory :: !(IORef [Int64])
+  , thCallbacks :: !TableCallbacks
+  , thDeletes :: !DeleteCallbacks
+  }
 
 data TableCallbacks = TableCallbacks
-    { tcBind :: !DuckDBTableFunctionBindFun
-    , tcInit :: !DuckDBTableFunctionInitFun
-    , tcLocalInit :: !DuckDBTableFunctionInitFun
-    , tcExecute :: !DuckDBTableFunctionFun
-    }
+  { tcBind :: !DuckDBTableFunctionBindFun
+  , tcInit :: !DuckDBTableFunctionInitFun
+  , tcLocalInit :: !DuckDBTableFunctionInitFun
+  , tcExecute :: !DuckDBTableFunctionFun
+  }
 
 data DeleteCallbacks = DeleteCallbacks
-    { dcExtra :: !DuckDBDeleteCallback
-    , dcBind :: !DuckDBDeleteCallback
-    , dcInit :: !DuckDBDeleteCallback
-    , dcLocal :: !DuckDBDeleteCallback
-    }
+  { dcExtra :: !DuckDBDeleteCallback
+  , dcBind :: !DuckDBDeleteCallback
+  , dcInit :: !DuckDBDeleteCallback
+  , dcLocal :: !DuckDBDeleteCallback
+  }
 
 data HarnessStats = HarnessStats
-    { hsExtraFreed :: !Int
-    , hsBindFreed :: !Int
-    , hsInitFreed :: !Int
-    , hsLocalFreed :: !Int
-    , hsClientContextSeen :: !Bool
-    , hsProjectionHistory :: ![ProjectionSnapshot]
-    , hsCounts :: ![Int64]
-    }
-    deriving (Eq, Show)
+  { hsExtraFreed :: !Int
+  , hsBindFreed :: !Int
+  , hsInitFreed :: !Int
+  , hsLocalFreed :: !Int
+  , hsClientContextSeen :: !Bool
+  , hsProjectionHistory :: ![ProjectionSnapshot]
+  , hsCounts :: ![Int64]
+  }
+  deriving (Eq, Show)
 
 withHarness :: DuckDBLogicalType -> (TableHarness -> IO a) -> IO a
 withHarness columnType action = do
-    rawExtraBuffer <- mallocBytes sizeOfInt64
-    let extraBuffer = castPtr rawExtraBuffer :: Ptr ()
-    poke (castPtr extraBuffer :: Ptr Int64) extraInfoSentinel
-    extraCount <- newIORef 0
-    bindCount <- newIORef 0
-    initCount <- newIORef 0
-    localCount <- newIORef 0
-    bindPtrRef <- newIORef Nothing
-    initPtrRef <- newIORef Nothing
-    localPtrRef <- newIORef Nothing
-    projectionCurrent <- newIORef Nothing
-    projectionHistory <- newIORef []
-    clientContextSeen <- newIORef False
-    modeRef <- newIORef ModeUnset
-    countHistory <- newIORef []
+  rawExtraBuffer <- mallocBytes sizeOfInt64
+  let extraBuffer = coerce rawExtraBuffer :: Ptr Void
+  poke (coerce extraBuffer :: Ptr Int64) extraInfoSentinel
+  extraCount <- newIORef 0
+  bindCount <- newIORef 0
+  initCount <- newIORef 0
+  localCount <- newIORef 0
+  bindPtrRef <- newIORef Nothing
+  initPtrRef <- newIORef Nothing
+  localPtrRef <- newIORef Nothing
+  projectionCurrent <- newIORef Nothing
+  projectionHistory <- newIORef []
+  clientContextSeen <- newIORef False
+  modeRef <- newIORef ModeUnset
+  countHistory <- newIORef []
 
-    let takeInt64 ptr = peekElemOff (castPtr ptr :: Ptr Int64)
-        putInt64 ptr = pokeElemOff (castPtr ptr :: Ptr Int64)
+  let takeInt64 :: Ptr Void -> Int -> IO Int64
+      takeInt64 ptr = peekElemOff (coerce ptr :: Ptr Int64)
+      putInt64 :: Ptr Void -> Int -> Int64 -> IO ()
+      putInt64 ptr = pokeElemOff (coerce ptr :: Ptr Int64)
 
-    extraDelete <-
-        mkDeleteCallback \ptr -> do
-            modifyIORef' extraCount (+ 1)
-            when (ptr /= nullPtr) (free ptr)
+  extraDelete <-
+    mkDeleteCallback \ptr -> do
+      modifyIORef' extraCount (+ 1)
+      when (ptr /= nullPtr) (free ptr)
 
-    bindDelete <-
-        mkDeleteCallback \ptr -> do
-            modifyIORef' bindCount (+ 1)
-            writeIORef bindPtrRef Nothing
-            when (ptr /= nullPtr) (free ptr)
+  bindDelete <-
+    mkDeleteCallback \ptr -> do
+      modifyIORef' bindCount (+ 1)
+      writeIORef bindPtrRef Nothing
+      when (ptr /= nullPtr) (free ptr)
 
-    initDelete <-
-        mkDeleteCallback \ptr -> do
-            modifyIORef' initCount (+ 1)
-            writeIORef initPtrRef Nothing
-            when (ptr /= nullPtr) (free ptr)
+  initDelete <-
+    mkDeleteCallback \ptr -> do
+      modifyIORef' initCount (+ 1)
+      writeIORef initPtrRef Nothing
+      when (ptr /= nullPtr) (free ptr)
 
-    localDelete <-
-        mkDeleteCallback \ptr -> do
-            modifyIORef' localCount (+ 1)
-            writeIORef localPtrRef Nothing
-            when (ptr /= nullPtr) (free ptr)
+  localDelete <-
+    mkDeleteCallback \ptr -> do
+      modifyIORef' localCount (+ 1)
+      writeIORef localPtrRef Nothing
+      when (ptr /= nullPtr) (free ptr)
 
-    let resetLifecycle = do
-            writeIORef projectionCurrent Nothing
-            writeIORef modeRef ModeUnset
-            writeIORef bindPtrRef Nothing
-            writeIORef initPtrRef Nothing
-            writeIORef localPtrRef Nothing
+  let resetLifecycle = do
+        writeIORef projectionCurrent Nothing
+        writeIORef modeRef ModeUnset
+        writeIORef bindPtrRef Nothing
+        writeIORef initPtrRef Nothing
+        writeIORef localPtrRef Nothing
 
-        recordProjection snapshot = do
-            writeIORef projectionCurrent (Just snapshot)
-            modifyIORef' projectionHistory (<> [snapshot])
+      recordProjection snapshot = do
+        writeIORef projectionCurrent (Just snapshot)
+        modifyIORef' projectionHistory (<> [snapshot])
 
-        bindCallback info = do
-            resetLifecycle
-            writeIORef modeRef ModeRejected
-            extraPtr <- c_duckdb_bind_get_extra_info info
-            extraPtr @?= extraBuffer
-            sentinel <- peek (castPtr extraPtr :: Ptr Int64)
-            sentinel @?= extraInfoSentinel
+      bindCallback info = do
+        resetLifecycle
+        writeIORef modeRef ModeRejected
+        extraPtr <- c_duckdb_bind_get_extra_info info
+        extraPtr @?= extraBuffer
+        sentinel <- peek (coerce extraPtr :: Ptr Int64)
+        sentinel @?= extraInfoSentinel
 
-            alloca \ctxPtr -> do
-                poke ctxPtr nullPtr
-                c_duckdb_table_function_get_client_context info ctxPtr
-                ctx <- peek ctxPtr
-                assertBool "client context should not be null" (ctx /= nullPtr)
-                cid <- c_duckdb_client_context_get_connection_id ctx
-                assertBool "connection id should be non-negative" (cid >= 0)
-                c_duckdb_destroy_client_context ctxPtr
-                writeIORef clientContextSeen True
+        alloca \ctxPtr -> do
+          poke ctxPtr (coerce nullPtr)
+          c_duckdb_table_function_get_client_context info ctxPtr
+          ctx <- peek ctxPtr
+          assertBool "client context should not be null" (ctx /= coerce nullPtr)
+          cid <- c_duckdb_client_context_get_connection_id ctx
+          assertBool "connection id should be non-negative" (cid >= 0)
+          c_duckdb_destroy_client_context ctxPtr
+          writeIORef clientContextSeen True
 
-            paramCount <- c_duckdb_bind_get_parameter_count info
-            paramCount @?= 1
+        paramCount <- c_duckdb_bind_get_parameter_count info
+        paramCount @?= 1
 
-            withValue (c_duckdb_bind_get_parameter info 0) \value -> do
-                countValue <- c_duckdb_get_int64 value
-                modifyIORef' countHistory (<> [countValue])
-                if countValue <= 0
-                    then withCString "count must be positive" $ \msg -> c_duckdb_bind_set_error info msg
-                    else do
-                        startValue <-
-                            withCString "start" \name ->
-                                fmap (fromMaybe 0) (withOptionalValue (c_duckdb_bind_get_named_parameter info name) c_duckdb_get_int64)
-                        failAtValue <-
-                            withCString "fail_at" \name ->
-                                fmap (fromMaybe (-1)) (withOptionalValue (c_duckdb_bind_get_named_parameter info name) c_duckdb_get_int64)
-                        initErrValue <-
-                            withCString "force_init_error" \name ->
-                                fmap (fromMaybe 0) (withOptionalValue (c_duckdb_bind_get_named_parameter info name) c_duckdb_get_int64)
-                        absentValue <-
-                            withCString "missing" \name ->
-                                withOptionalValue (c_duckdb_bind_get_named_parameter info name) c_duckdb_get_int64
-                        absentValue @?= Nothing
+        withValue (c_duckdb_bind_get_parameter info 0) \value -> do
+          countValue <- c_duckdb_get_int64 value
+          modifyIORef' countHistory (<> [countValue])
+          if countValue <= 0
+            then withConstCString "count must be positive" $ \msg -> c_duckdb_bind_set_error info msg
+            else do
+              startValue <-
+                withConstCString "start" \name ->
+                  fmap (fromMaybe 0) (withOptionalValue (c_duckdb_bind_get_named_parameter info name) c_duckdb_get_int64)
+              failAtValue <-
+                withConstCString "fail_at" \name ->
+                  fmap (fromMaybe (-1)) (withOptionalValue (c_duckdb_bind_get_named_parameter info name) c_duckdb_get_int64)
+              initErrValue <-
+                withConstCString "force_init_error" \name ->
+                  fmap (fromMaybe 0) (withOptionalValue (c_duckdb_bind_get_named_parameter info name) c_duckdb_get_int64)
+              absentValue <-
+                withConstCString "missing" \name ->
+                  withOptionalValue (c_duckdb_bind_get_named_parameter info name) c_duckdb_get_int64
+              absentValue @?= Nothing
 
-                        withCString "value" \col -> c_duckdb_bind_add_result_column info col columnType
-                        withCString "double_value" \col -> c_duckdb_bind_add_result_column info col columnType
-                        c_duckdb_bind_set_cardinality info (fromIntegral countValue) (toCBool True)
+              withConstCString "value" \col -> c_duckdb_bind_add_result_column info col columnType
+              withConstCString "double_value" \col -> c_duckdb_bind_add_result_column info col columnType
+              c_duckdb_bind_set_cardinality info (fromIntegral countValue) (toCBool True)
 
-                        if initErrValue /= 0
-                            then do
-                                writeIORef modeRef ModeInitError
-                                writeIORef bindPtrRef Nothing
-                            else do
-                                cfgPtr <- mallocBytes (3 * sizeOfInt64)
-                                putInt64 cfgPtr 0 startValue
-                                putInt64 cfgPtr 1 countValue
-                                putInt64 cfgPtr 2 failAtValue
-                                c_duckdb_bind_set_bind_data info (castPtr cfgPtr) bindDelete
-                                writeIORef bindPtrRef (Just (castPtr cfgPtr))
-                                writeIORef modeRef ModeNormal
+              if initErrValue /= 0
+                then do
+                  writeIORef modeRef ModeInitError
+                  writeIORef bindPtrRef Nothing
+                else do
+                  cfgPtr <- mallocBytes (3 * sizeOfInt64)
+                  putInt64 cfgPtr 0 startValue
+                  putInt64 cfgPtr 1 countValue
+                  putInt64 cfgPtr 2 failAtValue
+                  c_duckdb_bind_set_bind_data info (coerce cfgPtr) bindDelete
+                  writeIORef bindPtrRef (Just (coerce cfgPtr))
+                  writeIORef modeRef ModeNormal
 
-        initCallback info = do
-            extraPtr <- c_duckdb_init_get_extra_info info
-            extraPtr @?= extraBuffer
-            mode <- readIORef modeRef
-            case mode of
-                ModeInitError -> do
-                    bindRaw <- c_duckdb_init_get_bind_data info
-                    bindRaw @?= nullPtr
-                    withCString "init rejected missing bind data" $ \msg -> c_duckdb_init_set_error info msg
-                ModeNormal -> do
-                    bindRaw <- c_duckdb_init_get_bind_data info
-                    stored <- readIORef bindPtrRef
-                    case stored of
-                        Nothing -> assertFailure "bind data expected during init"
-                        Just expected -> bindRaw @?= expected
+      initCallback info = do
+        extraPtr <- c_duckdb_init_get_extra_info info
+        extraPtr @?= extraBuffer
+        mode <- readIORef modeRef
+        case mode of
+          ModeInitError -> do
+            bindRaw <- c_duckdb_init_get_bind_data info
+            bindRaw @?= nullPtr
+            withConstCString "init rejected missing bind data" $ \msg -> c_duckdb_init_set_error info msg
+          ModeNormal -> do
+            bindRaw <- c_duckdb_init_get_bind_data info
+            stored <- readIORef bindPtrRef
+            case stored of
+              Nothing -> assertFailure "bind data expected during init"
+              Just expected -> bindRaw @?= expected
 
-                    startValue <- takeInt64 bindRaw 0
-                    countValue <- takeInt64 bindRaw 1
-                    failAtValue <- takeInt64 bindRaw 2
+            startValue <- takeInt64 bindRaw 0
+            countValue <- takeInt64 bindRaw 1
+            failAtValue <- takeInt64 bindRaw 2
 
-                    columnCount <- fromIntegral <$> c_duckdb_init_get_column_count info
-                    indices <-
-                        mapM
-                            (fmap (fromIntegral :: DuckDBIdx -> Int) . c_duckdb_init_get_column_index info . fromIntegral)
-                            [0 .. columnCount - 1]
-                    recordProjection ProjectionSnapshot{psCount = columnCount, psIndices = indices}
+            columnCount <- fromIntegral <$> c_duckdb_init_get_column_count info
+            indices <-
+              mapM
+                (fmap (fromIntegral :: DuckDBIdx -> Int) . c_duckdb_init_get_column_index info . fromIntegral)
+                [0 .. columnCount - 1]
+            recordProjection ProjectionSnapshot{psCount = columnCount, psIndices = indices}
 
-                    statePtr <- mallocBytes (3 * sizeOfInt64)
-                    putInt64 statePtr 0 startValue
-                    putInt64 statePtr 1 (startValue + countValue)
-                    putInt64 statePtr 2 failAtValue
-                    c_duckdb_init_set_init_data info (castPtr statePtr) initDelete
-                    writeIORef initPtrRef (Just (castPtr statePtr))
-                    c_duckdb_init_set_max_threads info 1
-                _ -> pure ()
+            statePtr <- mallocBytes (3 * sizeOfInt64)
+            putInt64 statePtr 0 startValue
+            putInt64 statePtr 1 (startValue + countValue)
+            putInt64 statePtr 2 failAtValue
+            c_duckdb_init_set_init_data info (coerce statePtr) initDelete
+            writeIORef initPtrRef (Just (coerce statePtr))
+            c_duckdb_init_set_max_threads info 1
+          _ -> pure ()
 
-        localInitCallback info = do
-            extraPtr <- c_duckdb_init_get_extra_info info
-            extraPtr @?= extraBuffer
-            mode <- readIORef modeRef
-            case mode of
-                ModeNormal -> do
-                    bindRaw <- c_duckdb_init_get_bind_data info
-                    stored <- readIORef bindPtrRef
-                    case stored of
-                        Nothing -> assertFailure "bind data should be present during local init"
-                        Just expected -> bindRaw @?= expected
-                    localPtr <- mallocBytes sizeOfInt64
-                    poke (castPtr localPtr :: Ptr Int64) localInitSentinel
-                    c_duckdb_init_set_init_data info (castPtr localPtr) localDelete
-                    writeIORef localPtrRef (Just (castPtr localPtr))
-                ModeInitError -> withCString "local init skipped after init error" $ \msg -> c_duckdb_init_set_error info msg
-                _ -> pure ()
+      localInitCallback info = do
+        extraPtr <- c_duckdb_init_get_extra_info info
+        extraPtr @?= extraBuffer
+        mode <- readIORef modeRef
+        case mode of
+          ModeNormal -> do
+            bindRaw <- c_duckdb_init_get_bind_data info
+            stored <- readIORef bindPtrRef
+            case stored of
+              Nothing -> assertFailure "bind data should be present during local init"
+              Just expected -> bindRaw @?= expected
+            localPtr <- mallocBytes sizeOfInt64
+            poke (coerce localPtr :: Ptr Int64) localInitSentinel
+            c_duckdb_init_set_init_data info (coerce localPtr) localDelete
+            writeIORef localPtrRef (Just (coerce localPtr))
+          ModeInitError -> withConstCString "local init skipped after init error" $ \msg -> c_duckdb_init_set_error info msg
+          _ -> pure ()
 
-        executeCallback info chunk = do
-            extraPtr <- c_duckdb_function_get_extra_info info
-            extraPtr @?= extraBuffer
+      executeCallback info chunk = do
+        extraPtr <- c_duckdb_function_get_extra_info info
+        extraPtr @?= extraBuffer
 
-            mode <- readIORef modeRef
-            case mode of
-                ModeNormal -> do
-                    bindRaw <- c_duckdb_function_get_bind_data info
-                    storedBind <- readIORef bindPtrRef
-                    case storedBind of
-                        Nothing -> assertFailure "bind data should be recorded before execution"
-                        Just expected -> bindRaw @?= expected
+        mode <- readIORef modeRef
+        case mode of
+          ModeNormal -> do
+            bindRaw <- c_duckdb_function_get_bind_data info
+            storedBind <- readIORef bindPtrRef
+            case storedBind of
+              Nothing -> assertFailure "bind data should be recorded before execution"
+              Just expected -> bindRaw @?= expected
 
-                    initRaw <- c_duckdb_function_get_init_data info
-                    storedInit <- readIORef initPtrRef
-                    case storedInit of
-                        Nothing -> assertFailure "init data should exist during execution"
-                        Just expected -> initRaw @?= expected
+            initRaw <- c_duckdb_function_get_init_data info
+            storedInit <- readIORef initPtrRef
+            case storedInit of
+              Nothing -> assertFailure "init data should exist during execution"
+              Just expected -> initRaw @?= expected
 
-                    localRaw <- c_duckdb_function_get_local_init_data info
-                    storedLocal <- readIORef localPtrRef
-                    case storedLocal of
-                        Nothing -> assertFailure "local init data should exist during execution"
-                        Just expected -> localRaw @?= expected
-                    sentinel <- peek (castPtr localRaw :: Ptr Int64)
-                    sentinel @?= localInitSentinel
+            localRaw <- c_duckdb_function_get_local_init_data info
+            storedLocal <- readIORef localPtrRef
+            case storedLocal of
+              Nothing -> assertFailure "local init data should exist during execution"
+              Just expected -> localRaw @?= expected
+            sentinel <- peek (coerce localRaw :: Ptr Int64)
+            sentinel @?= localInitSentinel
 
-                    snapshot <- readIORef projectionCurrent
-                    ProjectionSnapshot{..} <-
-                        case snapshot of
-                            Nothing -> do
-                                _ <- assertFailure "projection snapshot missing during execution"
-                                pure (ProjectionSnapshot 0 [])
-                            Just snap -> pure snap
-                    assertBool "projection slots match indices" (length psIndices == psCount)
+            snapshot <- readIORef projectionCurrent
+            ProjectionSnapshot{..} <-
+              case snapshot of
+                Nothing -> do
+                  _ <- assertFailure "projection snapshot missing during execution"
+                  pure (ProjectionSnapshot 0 [])
+                Just snap -> pure snap
+            assertBool "projection slots match indices" (length psIndices == psCount)
 
-                    nextVal <- takeInt64 initRaw 0
-                    endVal <- takeInt64 initRaw 1
-                    failAtValue <- takeInt64 initRaw 2
-                    if nextVal >= endVal
-                        then c_duckdb_data_chunk_set_size chunk 0
-                        else do
-                            let remaining = endVal - nextVal
-                                batch = min remaining 1024
-                                chunkEnd = nextVal + batch
-                            if failAtValue >= nextVal && failAtValue < chunkEnd && failAtValue >= 0
-                                then do
-                                    withCString "execution aborted by table function" $ \msg -> c_duckdb_function_set_error info msg
-                                    c_duckdb_data_chunk_set_size chunk 0
-                                    putInt64 initRaw 0 chunkEnd
-                                else do
-                                    forM_ (zip [0 :: Integer ..] psIndices) \(slot, schemaIdx) -> do
-                                        vec <- c_duckdb_data_chunk_get_vector chunk (fromIntegral slot)
-                                        dataPtr <- vectorDataPtr vec
-                                        forM_ [0 :: Integer .. fromIntegral batch - 1] \offset -> do
-                                            let base = nextVal + fromIntegral offset
-                                                val =
-                                                    case schemaIdx of
-                                                        0 -> base
-                                                        1 -> 2 * base
-                                                        _ -> 0
-                                            pokeElemOff dataPtr (fromIntegral offset) val
-                                    c_duckdb_data_chunk_set_size chunk (fromIntegral batch)
-                                    putInt64 initRaw 0 chunkEnd
-                ModeInitError -> do
-                    withCString "execution blocked by init error" $ \msg -> c_duckdb_function_set_error info msg
-                    c_duckdb_data_chunk_set_size chunk 0
-                ModeRejected -> do
-                    withCString "execution not expected after bind error" $ \msg -> c_duckdb_function_set_error info msg
-                    c_duckdb_data_chunk_set_size chunk 0
-                ModeUnset -> do
-                    withCString "execution invoked without prior bind" $ \msg -> c_duckdb_function_set_error info msg
+            nextVal <- takeInt64 initRaw 0
+            endVal <- takeInt64 initRaw 1
+            failAtValue <- takeInt64 initRaw 2
+            if nextVal >= endVal
+              then c_duckdb_data_chunk_set_size chunk 0
+              else do
+                let remaining = endVal - nextVal
+                    batch = min remaining 1024
+                    chunkEnd = nextVal + batch
+                if failAtValue >= nextVal && failAtValue < chunkEnd && failAtValue >= 0
+                  then do
+                    withConstCString "execution aborted by table function" $ \msg -> c_duckdb_function_set_error info msg
                     c_duckdb_data_chunk_set_size chunk 0
+                    putInt64 initRaw 0 chunkEnd
+                  else do
+                    forM_ (zip [0 :: Integer ..] psIndices) \(slot, schemaIdx) -> do
+                      vec <- c_duckdb_data_chunk_get_vector chunk (fromIntegral slot)
+                      dataPtr <- vectorDataPtr vec
+                      forM_ [0 :: Integer .. fromIntegral batch - 1] \offset -> do
+                        let base = nextVal + fromIntegral offset
+                            val =
+                              case schemaIdx of
+                                0 -> base
+                                1 -> 2 * base
+                                _ -> 0
+                        pokeElemOff dataPtr (fromIntegral offset) val
+                    c_duckdb_data_chunk_set_size chunk (fromIntegral batch)
+                    putInt64 initRaw 0 chunkEnd
+          ModeInitError -> do
+            withConstCString "execution blocked by init error" $ \msg -> c_duckdb_function_set_error info msg
+            c_duckdb_data_chunk_set_size chunk 0
+          ModeRejected -> do
+            withConstCString "execution not expected after bind error" $ \msg -> c_duckdb_function_set_error info msg
+            c_duckdb_data_chunk_set_size chunk 0
+          ModeUnset -> do
+            withConstCString "execution invoked without prior bind" $ \msg -> c_duckdb_function_set_error info msg
+            c_duckdb_data_chunk_set_size chunk 0
 
-    bindFun <- mkBindFun bindCallback
-    initFun <- mkInitFun initCallback
-    localInitFun <- mkInitFun localInitCallback
-    execFun <- mkFunctionFun executeCallback
+  bindFun <- mkBindFun bindCallback
+  initFun <- mkInitFun initCallback
+  localInitFun <- mkInitFun localInitCallback
+  execFun <- mkFunctionFun executeCallback
 
-    let callbacks =
-            TableCallbacks
-                { tcBind = bindFun
-                , tcInit = initFun
-                , tcLocalInit = localInitFun
-                , tcExecute = execFun
-                }
-        deletes =
-            DeleteCallbacks
-                { dcExtra = extraDelete
-                , dcBind = bindDelete
-                , dcInit = initDelete
-                , dcLocal = localDelete
-                }
+  let callbacks =
+        TableCallbacks
+          { tcBind = bindFun
+          , tcInit = initFun
+          , tcLocalInit = localInitFun
+          , tcExecute = execFun
+          }
+      deletes =
+        DeleteCallbacks
+          { dcExtra = extraDelete
+          , dcBind = bindDelete
+          , dcInit = initDelete
+          , dcLocal = localDelete
+          }
 
-    let harness =
-            TableHarness
-                { thColumnType = columnType
-                , thExtraBuffer = extraBuffer
-                , thExtraCount = extraCount
-                , thBindCount = bindCount
-                , thInitCount = initCount
-                , thLocalCount = localCount
-                , thBindPtr = bindPtrRef
-                , thInitPtr = initPtrRef
-                , thLocalPtr = localPtrRef
-                , thProjectionCurrent = projectionCurrent
-                , thProjectionHistory = projectionHistory
-                , thClientContextSeen = clientContextSeen
-                , thModeRef = modeRef
-                , thCountHistory = countHistory
-                , thCallbacks = callbacks
-                , thDeletes = deletes
-                }
+  let harness =
+        TableHarness
+          { thColumnType = columnType
+          , thExtraBuffer = extraBuffer
+          , thExtraCount = extraCount
+          , thBindCount = bindCount
+          , thInitCount = initCount
+          , thLocalCount = localCount
+          , thBindPtr = bindPtrRef
+          , thInitPtr = initPtrRef
+          , thLocalPtr = localPtrRef
+          , thProjectionCurrent = projectionCurrent
+          , thProjectionHistory = projectionHistory
+          , thClientContextSeen = clientContextSeen
+          , thModeRef = modeRef
+          , thCountHistory = countHistory
+          , thCallbacks = callbacks
+          , thDeletes = deletes
+          }
 
-    result <- action harness
+  result <- action harness
 
-    freeHaskellFunPtr bindFun
-    freeHaskellFunPtr initFun
-    freeHaskellFunPtr localInitFun
-    freeHaskellFunPtr execFun
-    -- DuckDB may still invoke delete callbacks while the table function tears down.
-    -- Rely on process teardown to reclaim them to avoid racing with finalizers.
+  freeHaskellFunPtr (coerce bindFun)
+  freeHaskellFunPtr (coerce initFun)
+  freeHaskellFunPtr (coerce localInitFun)
+  freeHaskellFunPtr (coerce execFun)
+  -- DuckDB may still invoke delete callbacks while the table function tears down.
+  -- Rely on process teardown to reclaim them to avoid racing with finalizers.
 
-    pure result
+  pure result
 
 withTableFunction :: (DuckDBTableFunction -> IO a) -> IO a
 withTableFunction = bracket c_duckdb_create_table_function destroy
@@ -462,34 +469,34 @@
 
 configureTableFunction :: DuckDBTableFunction -> TableHarness -> IO ()
 configureTableFunction fun TableHarness{..} = do
-    withCString "haskell_numbers" $ \name -> c_duckdb_table_function_set_name fun name
-    c_duckdb_table_function_add_parameter fun thColumnType
-    withCString "start" \n -> c_duckdb_table_function_add_named_parameter fun n thColumnType
-    withCString "fail_at" \n -> c_duckdb_table_function_add_named_parameter fun n thColumnType
-    withCString "force_init_error" \n -> c_duckdb_table_function_add_named_parameter fun n thColumnType
-    -- NOTE: DuckDB expects the extra-info pointer to be populated alongside the other callbacks;
-    -- leaving it unset would skip the destructor and break the lifetime assertions below.
-    c_duckdb_table_function_set_extra_info fun thExtraBuffer (dcExtra thDeletes)
-    c_duckdb_table_function_set_bind fun (tcBind thCallbacks)
-    c_duckdb_table_function_set_init fun (tcInit thCallbacks)
-    c_duckdb_table_function_set_local_init fun (tcLocalInit thCallbacks)
-    c_duckdb_table_function_set_function fun (tcExecute thCallbacks)
-    c_duckdb_table_function_supports_projection_pushdown fun (toCBool True)
+  withConstCString "haskell_numbers" $ \name -> c_duckdb_table_function_set_name fun name
+  c_duckdb_table_function_add_parameter fun thColumnType
+  withConstCString "start" \n -> c_duckdb_table_function_add_named_parameter fun n thColumnType
+  withConstCString "fail_at" \n -> c_duckdb_table_function_add_named_parameter fun n thColumnType
+  withConstCString "force_init_error" \n -> c_duckdb_table_function_add_named_parameter fun n thColumnType
+  -- NOTE: DuckDB expects the extra-info pointer to be populated alongside the other callbacks;
+  -- leaving it unset would skip the destructor and break the lifetime assertions below.
+  c_duckdb_table_function_set_extra_info fun thExtraBuffer (dcExtra thDeletes)
+  c_duckdb_table_function_set_bind fun (tcBind thCallbacks)
+  c_duckdb_table_function_set_init fun (tcInit thCallbacks)
+  c_duckdb_table_function_set_local_init fun (tcLocalInit thCallbacks)
+  c_duckdb_table_function_set_function fun (tcExecute thCallbacks)
+  c_duckdb_table_function_supports_projection_pushdown fun (toCBool True)
 
 snapshotStats :: TableHarness -> IO HarnessStats
 snapshotStats TableHarness{..} = do
-    hsExtraFreed <- readIORef thExtraCount
-    hsBindFreed <- readIORef thBindCount
-    hsInitFreed <- readIORef thInitCount
-    hsLocalFreed <- readIORef thLocalCount
-    hsClientContextSeen <- readIORef thClientContextSeen
-    history <- readIORef thProjectionHistory
-    hsCounts <- readIORef thCountHistory
-    pure
-        HarnessStats
-            { hsProjectionHistory = history
-            , ..
-            }
+  hsExtraFreed <- readIORef thExtraCount
+  hsBindFreed <- readIORef thBindCount
+  hsInitFreed <- readIORef thInitCount
+  hsLocalFreed <- readIORef thLocalCount
+  hsClientContextSeen <- readIORef thClientContextSeen
+  history <- readIORef thProjectionHistory
+  hsCounts <- readIORef thCountHistory
+  pure
+    HarnessStats
+      { hsProjectionHistory = history
+      , ..
+      }
 
 -- Helpers --------------------------------------------------------------------
 
@@ -500,50 +507,50 @@
 localInitSentinel = 0x105105105
 
 sizeOfInt64 :: Int
-sizeOfInt64 = sizeOf (undefined :: Int64)
+sizeOfInt64 = staticSizeOf (Proxy @Int64)
 
 withOptionalValue :: IO DuckDBValue -> (DuckDBValue -> IO a) -> IO (Maybe a)
 withOptionalValue acquire action = do
-    value <- acquire
-    if value == nullPtr
-        then pure Nothing
-        else do
-            result <- action value
-            destroy value
-            pure (Just result)
+  value <- acquire
+  if value == coerce nullPtr
+    then pure Nothing
+    else do
+      result <- action value
+      destroy value
+      pure (Just result)
   where
     destroy val = alloca \ptr -> poke ptr val >> c_duckdb_destroy_value ptr
 
 vectorDataPtr :: DuckDBVector -> IO (Ptr Int64)
-vectorDataPtr vec = castPtr <$> c_duckdb_vector_get_data vec
+vectorDataPtr vec = coerce <$> c_duckdb_vector_get_data vec
 
 contains :: String -> String -> Bool
 contains needle haystack = mapLower needle `isInfixOf` mapLower haystack
   where
     mapLower = map toLowerAscii
     toLowerAscii c
-        | isAsciiUpper c = toEnum (fromEnum c + 32)
-        | otherwise = c
+      | isAsciiUpper c = toEnum (fromEnum c + 32)
+      | otherwise = c
 
 toCBool :: Bool -> CBool
 toCBool False = CBool 0
 toCBool True = CBool 1
 
-peekCStringMaybe :: CString -> IO String
+peekCStringMaybe :: ConstPtr CChar -> IO String
 peekCStringMaybe ptr
-    | ptr == nullPtr = pure ""
-    | otherwise = peekCString ptr
+  | ptr == coerce nullPtr = pure ""
+  | otherwise = peekCString (coerce ptr)
 
 -- Wrappers -------------------------------------------------------------------
 
-foreign import ccall "wrapper"
-    mkBindFun :: (DuckDBBindInfo -> IO ()) -> IO DuckDBTableFunctionBindFun
+mkBindFun :: (DuckDBBindInfo -> IO ()) -> IO DuckDBTableFunctionBindFun
+mkBindFun = fmap DuckDBTableFunctionBindFun . toFunPtr . DuckDBTableFunctionBindFun_Aux
 
-foreign import ccall "wrapper"
-    mkInitFun :: (DuckDBInitInfo -> IO ()) -> IO DuckDBTableFunctionInitFun
+mkInitFun :: (DuckDBInitInfo -> IO ()) -> IO DuckDBTableFunctionInitFun
+mkInitFun = fmap DuckDBTableFunctionInitFun . toFunPtr . DuckDBTableFunctionInitFun_Aux
 
-foreign import ccall "wrapper"
-    mkFunctionFun :: (DuckDBFunctionInfo -> DuckDBDataChunk -> IO ()) -> IO DuckDBTableFunctionFun
+mkFunctionFun :: (DuckDBFunctionInfo -> DuckDBDataChunk -> IO ()) -> IO DuckDBTableFunctionFun
+mkFunctionFun = fmap DuckDBTableFunctionFun . toFunPtr . DuckDBTableFunctionFun_Aux
 
-foreign import ccall "wrapper"
-    mkDeleteCallback :: (Ptr () -> IO ()) -> IO DuckDBDeleteCallback
+mkDeleteCallback :: (Ptr Void -> IO ()) -> IO DuckDBDeleteCallback
+mkDeleteCallback = fmap DuckDBDeleteCallback . toFunPtr . DuckDBDeleteCallback_Aux
diff --git a/test/ThreadingTest.hs b/test/ThreadingTest.hs
--- a/test/ThreadingTest.hs
+++ b/test/ThreadingTest.hs
@@ -4,138 +4,140 @@
 module ThreadingTest (tests) where
 
 import Control.Concurrent (forkFinally, newEmptyMVar, putMVar, takeMVar)
+import Data.Coerce (coerce)
 import Data.Int (Int64)
 import Database.DuckDB.FFI
-import Database.DuckDB.FFI.Deprecated
-import Foreign.C.String (CString, withCString)
-import Foreign.C.Types (CBool (..))
+import Foreign.C.ConstPtr (ConstPtr (..))
+import Foreign.C.Types (CBool (..), CChar)
 import Foreign.Marshal.Alloc (alloca)
 import Foreign.Ptr (nullPtr)
 import Foreign.Storable (peek)
 import Test.Tasty (TestTree, testGroup)
 import Test.Tasty.HUnit (assertBool, assertFailure, testCase, (@?=))
-import Utils (withConnection)
+import Utils (withConnection, withConstCString)
 
 tests :: TestTree
 tests =
-    testGroup
-        "Threading Information"
-        [ executeTasksCompletesPendingQuery
-        , taskStateControlsExecutionLifecycle
-        ]
+  testGroup
+    "Threading Information"
+    [ executeTasksCompletesPendingQuery
+    , taskStateControlsExecutionLifecycle
+    ]
 
-{- | Open a database that has no worker threads. Without this, the
-worker threads of DuckDB start a pending query immediately, and the
-test races them. With one thread, only 'c_duckdb_execute_tasks' can
-make progress, so the checks are deterministic.
--}
+-- | Open a database that has no worker threads. Without this, the
+-- worker threads of DuckDB start a pending query immediately, and the
+-- test races them. With one thread, only 'duckdb_execute_tasks' can
+-- make progress, so the checks are deterministic.
 withSingleThreadedDatabase :: (DuckDBDatabase -> IO a) -> IO a
 withSingleThreadedDatabase action =
-    withCString ":memory:" \path ->
-        alloca \configPtr -> do
-            c_duckdb_create_config configPtr >>= (@?= DuckDBSuccess)
-            config <- peek configPtr
-            withCString "threads" \flag ->
-                withCString "1" \value ->
-                    c_duckdb_set_config config flag value >>= (@?= DuckDBSuccess)
-            alloca \dbPtr -> do
-                st <- c_duckdb_open_ext path dbPtr config nullPtr
-                c_duckdb_destroy_config configPtr
-                st @?= DuckDBSuccess
-                db <- peek dbPtr
-                result <- action db
-                c_duckdb_close dbPtr
-                pure result
+  withConstCString ":memory:" \path ->
+    alloca \configPtr -> do
+      c_duckdb_create_config configPtr >>= (@?= DuckDBSuccess)
+      config <- peek configPtr
+      withConstCString "threads" \flag ->
+        withConstCString "1" \value ->
+          c_duckdb_set_config config flag value >>= (@?= DuckDBSuccess)
+      alloca \dbPtr -> do
+        st <- c_duckdb_open_ext path dbPtr config nullPtr
+        c_duckdb_destroy_config configPtr
+        st @?= DuckDBSuccess
+        db <- peek dbPtr
+        result <- action db
+        c_duckdb_close dbPtr
+        pure result
 
 executeTasksCompletesPendingQuery :: TestTree
 executeTasksCompletesPendingQuery =
-    testCase "execute_tasks drives pending query to completion" $
-        withSingleThreadedDatabase \db ->
-            withConnection db \conn -> do
-                setupAggTable conn
+  testCase "execute_tasks drives pending query to completion" $
+    withSingleThreadedDatabase \db ->
+      withConnection db \conn -> do
+        setupAggTable conn
 
-                withCString "SELECT SUM(val) FROM threading_numbers;" \querySql ->
-                    alloca \stmtPtr -> do
-                        stPrepare <- c_duckdb_prepare conn querySql stmtPtr
-                        stPrepare @?= DuckDBSuccess
-                        stmt <- peek stmtPtr
-                        assertBool "prepared statement should not be null" (stmt /= nullPtr)
+        -- INSERT retains its result before execution. A SELECT result
+        -- can wait for its consumer after the scheduler runs its tasks.
+        withConstCString "INSERT INTO threading_numbers SELECT SUM(val) FROM threading_numbers;" \querySql ->
+          alloca \stmtPtr -> do
+            stPrepare <- c_duckdb_prepare conn querySql stmtPtr
+            stPrepare @?= DuckDBSuccess
+            stmt <- peek stmtPtr
+            assertBool "prepared statement should not be null" (stmt /= coerce nullPtr)
 
-                        alloca \pendingPtr -> do
-                            stPending <- c_duckdb_pending_prepared stmt pendingPtr
-                            stPending @?= DuckDBSuccess
-                            pending <- peek pendingPtr
-                            assertBool "pending result should not be null" (pending /= nullPtr)
+            alloca \pendingPtr -> do
+              stPending <- c_duckdb_pending_prepared stmt pendingPtr
+              stPending @?= DuckDBSuccess
+              pending <- peek pendingPtr
+              assertBool "pending result should not be null" (pending /= coerce nullPtr)
 
-                            finishedBefore <- c_duckdb_execution_is_finished conn
-                            finishedBefore @?= CBool 0
+              finishedBefore <- c_duckdb_execution_is_finished conn
+              finishedBefore @?= CBool 0
 
-                            driveTasks db conn
+              driveTasks db conn
 
-                            finishedAfter <- c_duckdb_execution_is_finished conn
-                            finishedAfter @?= CBool 1
+              alloca \resPtr -> do
+                stExec <- c_duckdb_execute_pending pending resPtr
+                stExec @?= DuckDBSuccess
+                c_duckdb_rows_changed resPtr >>= (@?= 1)
+                c_duckdb_destroy_result resPtr
 
-                            alloca \resPtr -> do
-                                stExec <- c_duckdb_execute_pending pending resPtr
-                                stExec @?= DuckDBSuccess
-                                sumVal <- c_duckdb_value_int64 resPtr 0 0
-                                (sumVal :: Int64) @?= 15
-                                c_duckdb_destroy_result resPtr
+              c_duckdb_destroy_pending pendingPtr
 
-                            c_duckdb_destroy_pending pendingPtr
+            c_duckdb_destroy_prepare stmtPtr
 
-                        c_duckdb_destroy_prepare stmtPtr
+        withConstCString "SELECT SUM(val) FROM threading_numbers;" \querySql ->
+          alloca \resPtr -> do
+            c_duckdb_query conn querySql resPtr >>= (@?= DuckDBSuccess)
+            sumVal <- c_duckdb_value_int64 resPtr 0 0
+            (sumVal :: Int64) @?= 30
+            c_duckdb_destroy_result resPtr
 
 taskStateControlsExecutionLifecycle :: TestTree
 taskStateControlsExecutionLifecycle =
-    testCase "task state executes batches and finishes on request" $
-        withSingleThreadedDatabase \db ->
-            withConnection db \conn -> do
-                setupAggTable conn
+  testCase "task state executes batches and finishes on request" $
+    withSingleThreadedDatabase \db ->
+      withConnection db \conn -> do
+        setupAggTable conn
 
-                taskState <- c_duckdb_create_task_state db
-                assertBool "task state should not be null" (taskState /= nullPtr)
+        taskState <- c_duckdb_create_task_state db
+        assertBool "task state should not be null" (taskState /= coerce nullPtr)
 
-                doneVar <- newEmptyMVar
-                _ <- forkFinally (c_duckdb_execute_tasks_state taskState) (const (putMVar doneVar ()))
+        doneVar <- newEmptyMVar
+        _ <- forkFinally (c_duckdb_execute_tasks_state taskState) (const (putMVar doneVar ()))
 
-                executed <- c_duckdb_execute_n_tasks_state taskState 0
-                assertBool "execute_n_tasks_state should not report negative work" (executed >= 0)
+        executed <- c_duckdb_execute_n_tasks_state taskState 0
+        assertBool "execute_n_tasks_state should not report negative work" (executed >= 0)
 
-                isFinishedBefore <- c_duckdb_task_state_is_finished taskState
-                isFinishedBefore @?= CBool 0
+        isFinishedBefore <- c_duckdb_task_state_is_finished taskState
+        isFinishedBefore @?= CBool 0
 
-                c_duckdb_finish_execution taskState
+        c_duckdb_finish_execution taskState
 
-                isFinishedAfter <- c_duckdb_task_state_is_finished taskState
-                isFinishedAfter @?= CBool 1
+        isFinishedAfter <- c_duckdb_task_state_is_finished taskState
+        isFinishedAfter @?= CBool 1
 
-                takeMVar doneVar
-                c_duckdb_destroy_task_state taskState
+        takeMVar doneVar
+        c_duckdb_destroy_task_state taskState
 
 setupAggTable :: DuckDBConnection -> IO ()
 setupAggTable conn = do
-    withCString "CREATE TABLE threading_numbers(val INTEGER);" $ \createSql ->
-        execStatement conn createSql
-    withCString "INSERT INTO threading_numbers VALUES (1), (2), (3), (4), (5);" $ \insertSql ->
-        execStatement conn insertSql
+  withConstCString "CREATE TABLE threading_numbers(val INTEGER);" $ \createSql ->
+    execStatement conn createSql
+  withConstCString "INSERT INTO threading_numbers VALUES (1), (2), (3), (4), (5);" $ \insertSql ->
+    execStatement conn insertSql
 
+-- | Run scheduler tasks until the pending query finishes, with a bounded retry.
 driveTasks :: DuckDBDatabase -> DuckDBConnection -> IO ()
-driveTasks db conn = go 0
+driveTasks db conn = go (0 :: Int)
   where
-    go :: Int -> IO ()
     go attempts
-        | attempts > 10 = assertFailure "execute_tasks did not finish query within expected iterations"
-        | otherwise = do
-            c_duckdb_execute_tasks db 1000
-            finished <- c_duckdb_execution_is_finished conn
-            if finished == CBool 1
-                then pure ()
-                else go (attempts + 1)
+      | attempts > 10 = assertFailure "execute_tasks did not finish the query within 10 rounds"
+      | otherwise = do
+          c_duckdb_execute_tasks db 1000
+          finished <- c_duckdb_execution_is_finished conn
+          if finished == CBool 1 then pure () else go (attempts + 1)
 
-execStatement :: DuckDBConnection -> CString -> IO ()
+execStatement :: DuckDBConnection -> ConstPtr CChar -> IO ()
 execStatement conn sql =
-    alloca \resPtr -> do
-        st <- c_duckdb_query conn sql resPtr
-        st @?= DuckDBSuccess
-        c_duckdb_destroy_result resPtr
+  alloca \resPtr -> do
+    st <- c_duckdb_query conn sql resPtr
+    st @?= DuckDBSuccess
+    c_duckdb_destroy_result resPtr
diff --git a/test/Utils.hs b/test/Utils.hs
--- a/test/Utils.hs
+++ b/test/Utils.hs
@@ -1,69 +1,83 @@
 {-# LANGUAGE BlockArguments #-}
+{-# LANGUAGE ImportQualifiedPost #-}
+{-# LANGUAGE OverloadedRecordDot #-}
 
 module Utils (
-    withDatabase,
-    withConnection,
-    withResult,
-    withResultCString,
-    withValue,
-    withDuckValue,
-    destroyDuckValue,
-    withLogicalType,
-    destroyLogicalType,
-    withSelectionVector,
-    withScalarFunction,
-    withVector,
-    withVectorOfType,
-    setAllValid,
-    clearValidityBit,
-    plusWord,
-    destroyErrorData,
+  withDatabase,
+  withConnection,
+  withResult,
+  withResultCString,
+  withValue,
+  withDuckValue,
+  destroyDuckValue,
+  withLogicalType,
+  destroyLogicalType,
+  withSelectionVector,
+  withScalarFunction,
+  withVector,
+  withVectorOfType,
+  setAllValid,
+  clearValidityBit,
+  plusWord,
+  destroyErrorData,
+  withConstCString,
+  releaseArrowSchema,
+  releaseArrowArray,
+  releaseArrowStream,
 ) where
 
-import Control.Exception (bracket)
-import Control.Monad (forM_)
+import Control.Exception (bracket, bracket_, mask_)
+import Control.Monad (forM_, when)
 import Data.Bits (clearBit, setBit)
 import Data.Word (Word64)
 import Database.DuckDB.FFI
-import Foreign.C.String (CString, withCString)
+import Foreign.C.ConstPtr (ConstPtr (..))
+import Foreign.C.String (withCString)
+import Foreign.C.Types (CChar)
 import Foreign.Marshal.Alloc (alloca)
-import Foreign.Ptr (Ptr, plusPtr)
-import Foreign.Storable (peek, poke, sizeOf)
+import Foreign.Marshal.Array (advancePtr)
+import Foreign.Ptr (Ptr, nullFunPtr, nullPtr)
+import Foreign.Storable (peek, poke)
+import HsBindgen.Runtime.Struct qualified as Struct
+import HsBindgen.Runtime.Support.FunPtr (fromFunPtr)
 import Test.Tasty.HUnit ((@?=))
 
+-- | Supply a constant C string for one native call.
+withConstCString :: String -> (ConstPtr CChar -> IO a) -> IO a
+withConstCString text action = withCString text (action . ConstPtr)
+
 withDatabase :: (DuckDBDatabase -> IO a) -> IO a
 withDatabase action =
-    withCString ":memory:" \path ->
-        alloca \dbPtr -> do
-            c_duckdb_open path dbPtr >>= (@?= DuckDBSuccess)
-            db <- peek dbPtr
-            result <- action db
-            c_duckdb_close dbPtr
-            pure result
+  alloca \dbPtr -> do
+    poke dbPtr (DuckDBDatabase nullPtr)
+    bracket_ (pure ()) (c_duckdb_close dbPtr) $
+      withConstCString ":memory:" \path -> do
+        c_duckdb_open path dbPtr >>= (@?= DuckDBSuccess)
+        peek dbPtr >>= action
 
 withConnection :: DuckDBDatabase -> (DuckDBConnection -> IO a) -> IO a
 withConnection db = bracket acquire release
   where
     acquire =
-        alloca \connPtr -> do
-            c_duckdb_connect db connPtr >>= (@?= DuckDBSuccess)
-            peek connPtr
+      alloca \connPtr -> do
+        c_duckdb_connect db connPtr >>= (@?= DuckDBSuccess)
+        peek connPtr
     release conn =
-        alloca \connPtr -> do
-            poke connPtr conn
-            c_duckdb_disconnect connPtr
+      alloca \connPtr -> do
+        poke connPtr conn
+        c_duckdb_disconnect connPtr
 
 withResult :: DuckDBConnection -> String -> (Ptr DuckDBResult -> IO a) -> IO a
 withResult conn sql action =
-    withCString sql \sqlPtr -> withResultCString conn sqlPtr action
+  withConstCString sql \sqlPtr -> withResultCString conn sqlPtr action
 
-withResultCString :: DuckDBConnection -> CString -> (Ptr DuckDBResult -> IO a) -> IO a
+withResultCString :: DuckDBConnection -> ConstPtr CChar -> (Ptr DuckDBResult -> IO a) -> IO a
 withResultCString conn sql action =
-    alloca \resPtr -> do
-        c_duckdb_query conn sql resPtr >>= (@?= DuckDBSuccess)
-        result <- action resPtr
-        c_duckdb_destroy_result resPtr
-        pure result
+  alloca \resPtr -> do
+    poke resPtr Struct.zero
+    bracket_ (pure ()) (c_duckdb_destroy_result resPtr) $ do
+      c_duckdb_query conn sql resPtr >>= (@?= DuckDBSuccess)
+      action resPtr
 
 withValue :: IO DuckDBValue -> (DuckDBValue -> IO a) -> IO a
 withValue acquire = bracket acquire destroyDuckValue
@@ -73,14 +87,14 @@
 
 destroyDuckValue :: DuckDBValue -> IO ()
 destroyDuckValue value =
-    alloca \ptr -> poke ptr value >> c_duckdb_destroy_value ptr
+  alloca \ptr -> poke ptr value >> c_duckdb_destroy_value ptr
 
 withLogicalType :: IO DuckDBLogicalType -> (DuckDBLogicalType -> IO a) -> IO a
 withLogicalType acquire = bracket acquire destroyLogicalType
 
 destroyLogicalType :: DuckDBLogicalType -> IO ()
 destroyLogicalType lt =
-    alloca \ptr -> poke ptr lt >> c_duckdb_destroy_logical_type ptr
+  alloca \ptr -> poke ptr lt >> c_duckdb_destroy_logical_type ptr
 
 withSelectionVector :: DuckDBIdx -> (DuckDBSelectionVector -> IO a) -> IO a
 withSelectionVector n = bracket (c_duckdb_create_selection_vector n) c_duckdb_destroy_selection_vector
@@ -89,37 +103,55 @@
 withScalarFunction = bracket c_duckdb_create_scalar_function destroy
   where
     destroy fun =
-        alloca \ptr -> poke ptr fun >> c_duckdb_destroy_scalar_function ptr
+      alloca \ptr -> poke ptr fun >> c_duckdb_destroy_scalar_function ptr
 
 withVector :: IO DuckDBVector -> (DuckDBVector -> IO a) -> IO a
 withVector acquire = bracket acquire destroyVector
   where
     destroyVector vec =
-        alloca \ptr -> poke ptr vec >> c_duckdb_destroy_vector ptr
+      alloca \ptr -> poke ptr vec >> c_duckdb_destroy_vector ptr
 
 withVectorOfType :: DuckDBLogicalType -> DuckDBIdx -> (DuckDBVector -> IO a) -> IO a
 withVectorOfType lt capacity = withVector (c_duckdb_create_vector lt capacity)
 
 setAllValid :: Ptr Word64 -> Int -> IO ()
 setAllValid mask count =
-    let totalWords = max 1 ((count + 63) `div` 64)
-     in forM_ [0 .. totalWords - 1] \wordIdx -> do
-            let start = wordIdx * 64
-                end = min count (start + 64)
-                bits = foldl setBit 0 [0 .. end - start - 1]
-            poke (mask `plusWord` wordIdx) bits
+  let totalWords = max 1 ((count + 63) `div` 64)
+  in  forM_ [0 .. totalWords - 1] \wordIdx -> do
+        let start = wordIdx * 64
+            end = min count (start + 64)
+            bits = foldl setBit 0 [0 .. end - start - 1]
+        poke (mask `plusWord` wordIdx) bits
 
 clearValidityBit :: Ptr Word64 -> Int -> IO ()
 clearValidityBit mask idx = do
-    let wordIdx = idx `div` 64
-        bitIdx = idx `mod` 64
-        entryPtr = mask `plusWord` wordIdx
-    current <- peek entryPtr
-    poke entryPtr (clearBit current bitIdx)
+  let wordIdx = idx `div` 64
+      bitIdx = idx `mod` 64
+      entryPtr = mask `plusWord` wordIdx
+  current <- peek entryPtr
+  poke entryPtr (clearBit current bitIdx)
 
 plusWord :: Ptr Word64 -> Int -> Ptr Word64
-plusWord base idx = base `plusPtr` (idx * sizeOf (undefined :: Word64))
+plusWord = advancePtr
 
 destroyErrorData :: DuckDBErrorData -> IO ()
 destroyErrorData errData =
-    alloca \ptr -> poke ptr errData >> c_duckdb_destroy_error_data ptr
+  alloca \ptr -> poke ptr errData >> c_duckdb_destroy_error_data ptr
+
+-- | Release the buffers of an initialized Arrow schema.
+releaseArrowSchema :: Ptr ArrowSchema -> IO ()
+releaseArrowSchema ptr = mask_ do
+  value <- peek ptr
+  when (value.release /= nullFunPtr) (fromFunPtr value.release ptr)
+
+-- | Release the buffers of an initialized Arrow array.
+releaseArrowArray :: Ptr ArrowArray -> IO ()
+releaseArrowArray ptr = mask_ do
+  value <- peek ptr
+  when (value.release /= nullFunPtr) (fromFunPtr value.release ptr)
+
+-- | Release the state of an initialized Arrow stream.
+releaseArrowStream :: Ptr ArrowArrayStream -> IO ()
+releaseArrowStream ptr = mask_ do
+  value <- peek ptr
+  when (value.release /= nullFunPtr) (fromFunPtr value.release ptr)
diff --git a/test/V2AggregateTest.hs b/test/V2AggregateTest.hs
new file mode 100644
--- /dev/null
+++ b/test/V2AggregateTest.hs
@@ -0,0 +1,402 @@
+{-# LANGUAGE DataKinds #-}
+{-# LANGUAGE TypeApplications #-}
+
+module V2AggregateTest (tests) where
+
+import Control.Exception (bracket)
+import Control.Monad (forM_, unless, when)
+import Data.Coerce (coerce)
+import Data.IORef (atomicModifyIORef', newIORef, readIORef)
+import Data.Int (Int64)
+import Data.Proxy (Proxy (..))
+import Data.Void (Void)
+import Database.DuckDB.FFI.V2
+import Foreign.C.ConstPtr (ConstPtr (..))
+import Foreign.Marshal.Alloc (alloca, allocaBytes, free, malloc)
+import Foreign.Marshal.Utils (with)
+import Foreign.Ptr (Ptr, castPtr, freeHaskellFunPtr, nullFunPtr, nullPtr)
+import Foreign.Storable (Storable (..))
+import GHC.Records (getField)
+import HsBindgen.Runtime.Prelude (staticSizeOf, toFunPtr)
+import Test.Tasty (TestTree, testGroup)
+import Test.Tasty.HUnit (assertBool, testCase, (@?=))
+import V2Test (
+  argCounts,
+  borrowedOpaque,
+  callbackGuard,
+  checked,
+  countCall,
+  eachPartRequired,
+  expectCallbackFailure,
+  failOnPurpose,
+  fillDocs,
+  output,
+  readArgument,
+  readIntegers,
+  withConnection,
+  withFactory,
+  withHandle,
+  withInstance,
+  withResult,
+  withType,
+  withView,
+ )
+
+tests :: TestTree
+tests =
+  testGroup
+    "DuckDB V2 aggregate functions"
+    [ testCase "each aggregate callback reads the user data and the bind data, and the catalog shows the documentation" testAggregateCallbacks
+    , testCase "an aggregate bind, update or finalize callback fails its statement and DuckDB still destroys the states" testAggregateFailures
+    , testCase "registration rejects an aggregate function without a required part" testAggregateRegistration
+    ]
+
+-- | A state holds a tag at index 0 and a total at index 1.
+-- The init callback sets the tag to 'initialized', the finalize callback sets it to 'finalized',
+-- and the destroy callback sets it to 'destroyed'.
+initialized, finalized, destroyed :: Int64
+initialized = 1
+finalized = 2
+destroyed = 3
+
+-- | Get the state at an index of a state array.
+stateAt :: Ptr (Ptr Void) -> Int -> IO (Ptr Int64)
+stateAt states i = castPtr <$> peekElemOff states i
+
+-- | Add a value to the total of a state.
+addTo :: Ptr Int64 -> Int64 -> IO ()
+addTo state value = peekElemOff state 1 >>= pokeElemOff state 1 . (+ value)
+
+testAggregateCallbacks :: IO ()
+testAggregateCallbacks = do
+  failures <- newIORef []
+  invoked <- newIORef []
+  destroyedStates <- newIORef 0
+  -- The user data and the bind data point to two different cells, so an accessor that returns the other one fails.
+  allocaBytes 1 $ \user -> allocaBytes 1 $ \bound -> do
+    let note name = atomicModifyIORef' invoked (\names -> (name : names, ()))
+        expectData name getUser getBind = do
+          note name
+          output getUser >>= (@?= user)
+          output getBind >>= (@?= bound)
+        -- The query calls v2_total(i, i, i): one standard argument and two *args.
+        bind info result context err = callbackGuard failures err $ do
+          note "bind"
+          output (c_duckdb_v2_function_bind_get_user_data info) >>= (@?= user)
+          argCounts (c_duckdb_v2_function_bind_get_arg_count info) >>= (@?= (1, 2, 0, 0))
+          with (borrowedOpaque bound) $ \opaque -> checked (c_duckdb_v2_function_bind_set_bind_data info opaque)
+          factory <- output (c_duckdb_v2_context_get_factory context)
+          withType factory "BIGINT" $ \ty -> checked (c_duckdb_v2_aggregate_function_bind_set_return_type result ty)
+        size info err = callbackGuard failures err $ do
+          expectData "size" (c_duckdb_v2_aggregate_function_size_get_user_data info) (c_duckdb_v2_aggregate_function_size_get_bind_data info)
+          checked (c_duckdb_v2_aggregate_function_size_set_state_size info (fromIntegral (2 * staticSizeOf (Proxy @Int64))))
+        initialize info err = callbackGuard failures err $ do
+          expectData "init" (c_duckdb_v2_aggregate_function_init_get_user_data info) (c_duckdb_v2_aggregate_function_init_get_bind_data info)
+          states <- output (c_duckdb_v2_aggregate_function_init_get_states info)
+          count <- output (c_duckdb_v2_aggregate_function_init_get_state_count info)
+          forM_ [0 .. fromIntegral count - 1] $ \i -> do
+            state <- stateAt states i
+            pokeElemOff state 0 initialized
+            pokeElemOff state 1 0
+        update info err = callbackGuard failures err $ do
+          expectData "update" (c_duckdb_v2_aggregate_function_update_get_user_data info) (c_duckdb_v2_aggregate_function_update_get_bind_data info)
+          argCounts (c_duckdb_v2_aggregate_function_update_get_arg_count info) >>= (@?= (1, 2, 0, 0))
+          checked (c_duckdb_v2_aggregate_function_update_get_arg_count info nullPtr nullPtr nullPtr nullPtr)
+          states <- output (c_duckdb_v2_aggregate_function_update_get_states info)
+          count <- output (c_duckdb_v2_aggregate_function_update_get_row_count info)
+          vector <- output (c_duckdb_v2_aggregate_function_update_get_arg info 0)
+          checked (c_duckdb_v2_vector_flatten vector)
+          view <- output (c_duckdb_v2_vector_get_view vector)
+          forM_ [0 .. fromIntegral count - 1] $ \i -> do
+            index <-
+              if getField @"sel" view == coerce nullPtr
+                then pure i
+                else fromIntegral <$> peekElemOff (coerce (getField @"sel" view) :: Ptr DuckDBV2SelT) i
+            value <- peekElemOff (coerce (getField @"data'" view)) index
+            state <- stateAt states i
+            addTo state value
+        combine info err = callbackGuard failures err $ do
+          expectData "combine" (c_duckdb_v2_aggregate_function_combine_get_user_data info) (c_duckdb_v2_aggregate_function_combine_get_bind_data info)
+          sources <- output (c_duckdb_v2_aggregate_function_combine_get_sources info)
+          targets <- output (c_duckdb_v2_aggregate_function_combine_get_targets info)
+          count <- output (c_duckdb_v2_aggregate_function_combine_get_state_count info)
+          forM_ [0 .. fromIntegral count - 1] $ \i -> do
+            total <- stateAt sources i >>= \source -> peekElemOff source 1
+            stateAt targets i >>= \target -> addTo target total
+        finalize info err = callbackGuard failures err $ do
+          expectData
+            "finalize"
+            (c_duckdb_v2_aggregate_function_finalize_get_user_data info)
+            (c_duckdb_v2_aggregate_function_finalize_get_bind_data info)
+          states <- output (c_duckdb_v2_aggregate_function_finalize_get_states info)
+          count <- output (c_duckdb_v2_aggregate_function_finalize_get_state_count info)
+          offset <- output (c_duckdb_v2_aggregate_function_finalize_get_result_offset info)
+          vector <- output (c_duckdb_v2_aggregate_function_finalize_get_result info)
+          raw <- output (c_duckdb_v2_vector_get_data_mutable vector)
+          forM_ [0 .. fromIntegral count - 1] $ \i -> do
+            state <- stateAt states i
+            peekElemOff state 1 >>= pokeElemOff (coerce raw) (fromIntegral offset + i)
+            pokeElemOff state 0 finalized
+        -- The engine ignores an error from the destroy callback. The test reads the failures after the query.
+        destroy info err = callbackGuard failures err $ do
+          expectData "destroy" (c_duckdb_v2_aggregate_function_destroy_get_user_data info) (c_duckdb_v2_aggregate_function_destroy_get_bind_data info)
+          states <- output (c_duckdb_v2_aggregate_function_destroy_get_states info)
+          count <- output (c_duckdb_v2_aggregate_function_destroy_get_state_count info)
+          forM_ [0 .. fromIntegral count - 1] $ \i -> do
+            state <- stateAt states i
+            tag <- peekElemOff state 0
+            assertBool ("each state to destroy is live, but a tag is " <> show tag) (tag == initialized || tag == finalized)
+            pokeElemOff state 0 destroyed
+          atomicModifyIORef' destroyedStates (\total -> (total + count, ()))
+    bracket
+      (DuckDBV2AggregateFunctionBindCallbackFn <$> toFunPtr (DuckDBV2AggregateFunctionBindCallbackFn_Aux bind))
+      (freeHaskellFunPtr . getField @"unwrap")
+      $ \bindPtr ->
+        bracket
+          (DuckDBV2AggregateFunctionSizeCallbackFn <$> toFunPtr (DuckDBV2AggregateFunctionSizeCallbackFn_Aux size))
+          (freeHaskellFunPtr . getField @"unwrap")
+          $ \sizePtr ->
+            bracket
+              (DuckDBV2AggregateFunctionInitCallbackFn <$> toFunPtr (DuckDBV2AggregateFunctionInitCallbackFn_Aux initialize))
+              (freeHaskellFunPtr . getField @"unwrap")
+              $ \initializePtr ->
+                bracket
+                  (DuckDBV2AggregateFunctionUpdateCallbackFn <$> toFunPtr (DuckDBV2AggregateFunctionUpdateCallbackFn_Aux update))
+                  (freeHaskellFunPtr . getField @"unwrap")
+                  $ \updatePtr ->
+                    bracket
+                      (DuckDBV2AggregateFunctionCombineCallbackFn <$> toFunPtr (DuckDBV2AggregateFunctionCombineCallbackFn_Aux combine))
+                      (freeHaskellFunPtr . getField @"unwrap")
+                      $ \combinePtr ->
+                        bracket
+                          (DuckDBV2AggregateFunctionFinalizeCallbackFn <$> toFunPtr (DuckDBV2AggregateFunctionFinalizeCallbackFn_Aux finalize))
+                          (freeHaskellFunPtr . getField @"unwrap")
+                          $ \finalizePtr ->
+                            bracket
+                              (DuckDBV2AggregateFunctionDestroyCallbackFn <$> toFunPtr (DuckDBV2AggregateFunctionDestroyCallbackFn_Aux destroy))
+                              (freeHaskellFunPtr . getField @"unwrap")
+                              $ \destroyPtr ->
+                                withConnection $ \conn -> withFactory conn $ \factory -> do
+                                  withType factory "BIGINT" $ \ty ->
+                                    withHandle
+                                      (c_duckdb_v2_factory_create_type_from_id factory DuckDBV2LogicalTypeIdAny (coerce nullPtr) (coerce nullPtr) 0)
+                                      c_duckdb_v2_logical_type_destroy
+                                      $ \anyType ->
+                                        withHandle (c_duckdb_v2_aggregate_function_create factory) c_duckdb_v2_aggregate_function_destroy $ \function -> do
+                                          withView "v2_total" $ \name -> checked (c_duckdb_v2_aggregate_function_set_name function (coerce name))
+                                          signature <- output (c_duckdb_v2_aggregate_function_get_signature function)
+                                          withView "x" $ \name -> checked (c_duckdb_v2_function_signature_add_parameter signature (coerce name) ty (coerce nullPtr) DuckDBV2FunctionParameterKindStandard)
+                                          withView "rest" $ \name ->
+                                            checked
+                                              (c_duckdb_v2_function_signature_add_parameter signature (coerce name) ty (coerce nullPtr) DuckDBV2FunctionParameterKindPositionalVariadic)
+                                          -- The bind callback sets the concrete return type.
+                                          checked (c_duckdb_v2_function_signature_set_return_type signature anyType)
+                                          with (borrowedOpaque user) $ \opaque -> checked (c_duckdb_v2_aggregate_function_set_user_data function opaque)
+                                          checked (c_duckdb_v2_aggregate_function_set_bind_callback function bindPtr)
+                                          checked (c_duckdb_v2_aggregate_function_set_size_callback function sizePtr)
+                                          checked (c_duckdb_v2_aggregate_function_set_init_callback function initializePtr)
+                                          checked (c_duckdb_v2_aggregate_function_set_update_callback function updatePtr)
+                                          checked (c_duckdb_v2_aggregate_function_set_combine_callback function combinePtr)
+                                          checked (c_duckdb_v2_aggregate_function_set_finalize_callback function finalizePtr)
+                                          checked (c_duckdb_v2_aggregate_function_set_destroy_callback function destroyPtr)
+                                          output (c_duckdb_v2_aggregate_function_get_docs function) >>= fillDocs
+                                          checked (c_duckdb_v2_connection_register_aggregate_function conn function)
+                                  withResult conn "SELECT v2_total(i, i, i) FROM range(12) t(i) GROUP BY i % 3 ORDER BY i % 3" $ \result -> do
+                                    withHandle (c_duckdb_v2_result_get_schema result) c_duckdb_v2_schema_destroy $ \schema -> alloca $ \name -> do
+                                      ty <- output (c_duckdb_v2_schema_get_field schema 0 name)
+                                      output (c_duckdb_v2_logical_type_get_id ty) >>= (@?= DuckDBV2LogicalTypeIdBigInt)
+                                    readIntegers result >>= (@?= [Just 18, Just 22, Just 26])
+                                  -- A window over all rows combines the states of a segment tree.
+                                  withResult conn "SELECT v2_total(i, i, i) OVER () FROM range(4096) t(i) LIMIT 1" $ \result ->
+                                    readIntegers result >>= (@?= [Just 8386560])
+                                  withResult
+                                    conn
+                                    "SELECT count(*)::BIGINT FROM duckdb_functions() WHERE function_name = 'v2_total' AND description = 'Replaces the description.' AND examples = ['SELECT v2_plus_one(1)', 'SELECT v2_plus_one(2)'] AND categories = ['numeric']"
+                                    $ \result ->
+                                      readIntegers result >>= (@?= [Just 1])
+  readIORef failures >>= (@?= [])
+  names <- readIORef invoked
+  forM_ ["bind", "size", "init", "update", "combine", "finalize", "destroy"] $ \name ->
+    assertBool ("the " <> name <> " callback was invoked") (name `elem` names)
+  readIORef destroyedStates >>= assertBool "the destroy callback received states" . (> 0)
+
+-- | The aggregate v2_fail_sum(stage, x) sums x. The constant stage selects the callback that fails on purpose:
+-- 1 fails the bind, 2 fails the update for the input 5, and 3 fails the finalize. The bind data holds the stage.
+testAggregateFailures :: IO ()
+testAggregateFailures = do
+  failures <- newIORef []
+  binds <- newIORef 0
+  released <- newIORef 0
+  initializedStates <- newIORef 0
+  destroyedStates <- newIORef 0
+  let release ptr = free ptr >> countCall released
+      add ref count = atomicModifyIORef' ref (\total -> (total + count, ()))
+  bracket (DuckDBV2OpaqueDestroyFn <$> toFunPtr (DuckDBV2OpaqueDestroyFn_Aux release)) (freeHaskellFunPtr . getField @"unwrap") $ \releasePtr -> do
+    let bind info _result _context err = callbackGuard failures err $ do
+          countCall binds
+          stage <- withHandle (c_duckdb_v2_function_bind_get_arg_value info 0) c_duckdb_v2_value_destroy (output . c_duckdb_v2_value_get_bigint)
+          -- The bind sets the bind data first, so DuckDB must release it also when the bind fails.
+          state <- malloc
+          poke state (stage :: Int64)
+          with (DuckDBV2Opaque (coerce state) releasePtr (DuckDBV2OpaqueEqualsFn nullFunPtr)) $ \opaque ->
+            checked (c_duckdb_v2_function_bind_set_bind_data info opaque)
+          when (stage == 1) (failOnPurpose "bind")
+        size info err =
+          callbackGuard failures err $
+            checked (c_duckdb_v2_aggregate_function_size_set_state_size info (fromIntegral (staticSizeOf (Proxy @Int64))))
+        initialize info err = callbackGuard failures err $ do
+          states <- output (c_duckdb_v2_aggregate_function_init_get_states info)
+          count <- output (c_duckdb_v2_aggregate_function_init_get_state_count info)
+          forM_ [0 .. fromIntegral count - 1] $ \i -> stateAt states i >>= \state -> poke state 0
+          add initializedStates count
+        update info err = callbackGuard failures err $ do
+          stage <- output (c_duckdb_v2_aggregate_function_update_get_bind_data info) >>= peek . castPtr
+          states <- output (c_duckdb_v2_aggregate_function_update_get_states info)
+          count <- output (c_duckdb_v2_aggregate_function_update_get_row_count info)
+          values <- output (c_duckdb_v2_aggregate_function_update_get_arg info 1) >>= readArgument count
+          alloca $ \vector ->
+            c_duckdb_v2_aggregate_function_update_get_arg info 2 vector nullPtr
+              >>= assertBool "an index after the last argument fails" . (/= DuckDBV2ErrorNone)
+          when (stage == (2 :: Int64) && 5 `elem` values) (failOnPurpose "update")
+          forM_ (zip [0 ..] values) $ \(i, value) -> stateAt states i >>= \state -> peek state >>= poke state . (+ value)
+        combine info err = callbackGuard failures err $ do
+          sources <- output (c_duckdb_v2_aggregate_function_combine_get_sources info)
+          targets <- output (c_duckdb_v2_aggregate_function_combine_get_targets info)
+          count <- output (c_duckdb_v2_aggregate_function_combine_get_state_count info)
+          forM_ [0 .. fromIntegral count - 1] $ \i -> do
+            total <- stateAt sources i >>= peek
+            stateAt targets i >>= \target -> peek target >>= poke target . (+ total)
+        finalize info err = callbackGuard failures err $ do
+          stage <- output (c_duckdb_v2_aggregate_function_finalize_get_bind_data info) >>= peek . castPtr
+          when (stage == (3 :: Int64)) (failOnPurpose "finalize")
+          states <- output (c_duckdb_v2_aggregate_function_finalize_get_states info)
+          count <- output (c_duckdb_v2_aggregate_function_finalize_get_state_count info)
+          offset <- output (c_duckdb_v2_aggregate_function_finalize_get_result_offset info)
+          raw <- output (c_duckdb_v2_aggregate_function_finalize_get_result info) >>= output . c_duckdb_v2_vector_get_data_mutable
+          forM_ [0 .. fromIntegral count - 1] $ \i -> stateAt states i >>= peek >>= pokeElemOff (castPtr raw) (fromIntegral offset + i)
+        destroy info err =
+          callbackGuard failures err $
+            output (c_duckdb_v2_aggregate_function_destroy_get_state_count info) >>= add destroyedStates
+    bracket
+      (DuckDBV2AggregateFunctionBindCallbackFn <$> toFunPtr (DuckDBV2AggregateFunctionBindCallbackFn_Aux bind))
+      (freeHaskellFunPtr . getField @"unwrap")
+      $ \bindPtr ->
+        bracket
+          (DuckDBV2AggregateFunctionSizeCallbackFn <$> toFunPtr (DuckDBV2AggregateFunctionSizeCallbackFn_Aux size))
+          (freeHaskellFunPtr . getField @"unwrap")
+          $ \sizePtr ->
+            bracket
+              (DuckDBV2AggregateFunctionInitCallbackFn <$> toFunPtr (DuckDBV2AggregateFunctionInitCallbackFn_Aux initialize))
+              (freeHaskellFunPtr . getField @"unwrap")
+              $ \initializePtr ->
+                bracket
+                  (DuckDBV2AggregateFunctionUpdateCallbackFn <$> toFunPtr (DuckDBV2AggregateFunctionUpdateCallbackFn_Aux update))
+                  (freeHaskellFunPtr . getField @"unwrap")
+                  $ \updatePtr ->
+                    bracket
+                      (DuckDBV2AggregateFunctionCombineCallbackFn <$> toFunPtr (DuckDBV2AggregateFunctionCombineCallbackFn_Aux combine))
+                      (freeHaskellFunPtr . getField @"unwrap")
+                      $ \combinePtr ->
+                        bracket
+                          (DuckDBV2AggregateFunctionFinalizeCallbackFn <$> toFunPtr (DuckDBV2AggregateFunctionFinalizeCallbackFn_Aux finalize))
+                          (freeHaskellFunPtr . getField @"unwrap")
+                          $ \finalizePtr ->
+                            bracket
+                              (DuckDBV2AggregateFunctionDestroyCallbackFn <$> toFunPtr (DuckDBV2AggregateFunctionDestroyCallbackFn_Aux destroy))
+                              (freeHaskellFunPtr . getField @"unwrap")
+                              $ \destroyPtr ->
+                                withConnection $ \conn -> withFactory conn $ \factory -> do
+                                  withType factory "BIGINT" $ \ty ->
+                                    withHandle (c_duckdb_v2_aggregate_function_create factory) c_duckdb_v2_aggregate_function_destroy $ \function -> do
+                                      withView "v2_fail_sum" $ \name -> checked (c_duckdb_v2_aggregate_function_set_name function (coerce name))
+                                      signature <- output (c_duckdb_v2_aggregate_function_get_signature function)
+                                      forM_ ["stage", "x"] $ \name -> withView name $ \view ->
+                                        checked (c_duckdb_v2_function_signature_add_parameter signature (coerce view) ty (coerce nullPtr) DuckDBV2FunctionParameterKindStandard)
+                                      checked (c_duckdb_v2_function_signature_set_return_type signature ty)
+                                      checked (c_duckdb_v2_aggregate_function_set_bind_callback function bindPtr)
+                                      checked (c_duckdb_v2_aggregate_function_set_size_callback function sizePtr)
+                                      checked (c_duckdb_v2_aggregate_function_set_init_callback function initializePtr)
+                                      checked (c_duckdb_v2_aggregate_function_set_update_callback function updatePtr)
+                                      checked (c_duckdb_v2_aggregate_function_set_combine_callback function combinePtr)
+                                      checked (c_duckdb_v2_aggregate_function_set_finalize_callback function finalizePtr)
+                                      checked (c_duckdb_v2_aggregate_function_set_destroy_callback function destroyPtr)
+                                      checked (c_duckdb_v2_connection_register_aggregate_function conn function)
+                                  let passes = withResult conn "SELECT v2_fail_sum(0, i) FROM range(4) t(i)" $ \result -> readIntegers result >>= (@?= [Just 6])
+                                  passes
+                                  expectCallbackFailure failures conn "SELECT v2_fail_sum(1, i) FROM range(4) t(i)" "bind"
+                                  passes
+                                  withResult conn "SELECT v2_fail_sum(2, i) FROM range(5) t(i)" $ \result -> readIntegers result >>= (@?= [Just 10])
+                                  expectCallbackFailure failures conn "SELECT v2_fail_sum(2, i) FROM range(6) t(i)" "update"
+                                  passes
+                                  expectCallbackFailure failures conn "SELECT v2_fail_sum(3, i) FROM range(4) t(i)" "finalize"
+                                  passes
+  readIORef failures >>= (@?= [])
+  bound <- readIORef binds
+  assertBool "the bind callback was invoked" (bound > 0)
+  readIORef released >>= (@?= bound)
+  initializedCount <- readIORef initializedStates
+  assertBool "the init callback received states" (initializedCount > 0)
+  readIORef destroyedStates >>= (@?= initializedCount)
+
+-- | Each registration leaves out one part that the header requires. The part "concrete type" sets an ANY return type
+-- without a bind callback. The last registration has every part. The test never calls the function.
+testAggregateRegistration :: IO ()
+testAggregateRegistration = do
+  let size _info _err = pure ()
+      initialize _info _err = pure ()
+      update _info _err = pure ()
+      combine _info _err = pure ()
+      finalize _info _err = pure ()
+  bracket
+    (DuckDBV2AggregateFunctionSizeCallbackFn <$> toFunPtr (DuckDBV2AggregateFunctionSizeCallbackFn_Aux size))
+    (freeHaskellFunPtr . getField @"unwrap")
+    $ \sizePtr ->
+      bracket
+        (DuckDBV2AggregateFunctionInitCallbackFn <$> toFunPtr (DuckDBV2AggregateFunctionInitCallbackFn_Aux initialize))
+        (freeHaskellFunPtr . getField @"unwrap")
+        $ \initializePtr ->
+          bracket
+            (DuckDBV2AggregateFunctionUpdateCallbackFn <$> toFunPtr (DuckDBV2AggregateFunctionUpdateCallbackFn_Aux update))
+            (freeHaskellFunPtr . getField @"unwrap")
+            $ \updatePtr ->
+              bracket
+                (DuckDBV2AggregateFunctionCombineCallbackFn <$> toFunPtr (DuckDBV2AggregateFunctionCombineCallbackFn_Aux combine))
+                (freeHaskellFunPtr . getField @"unwrap")
+                $ \combinePtr ->
+                  bracket
+                    (DuckDBV2AggregateFunctionFinalizeCallbackFn <$> toFunPtr (DuckDBV2AggregateFunctionFinalizeCallbackFn_Aux finalize))
+                    (freeHaskellFunPtr . getField @"unwrap")
+                    $ \finalizePtr ->
+                      withInstance $ \other -> withConnection $ \conn -> withFactory conn $ \factory -> withType factory "BIGINT" $ \ty ->
+                        withHandle
+                          (c_duckdb_v2_factory_create_type_from_id factory DuckDBV2LogicalTypeIdAny (coerce nullPtr) (coerce nullPtr) 0)
+                          c_duckdb_v2_logical_type_destroy
+                          $ \anyType -> do
+                            -- The part "own factory" creates the function through the factory of another instance.
+                            otherFactory <- output (c_duckdb_v2_instance_get_factory other)
+                            eachPartRequired
+                              [ "name"
+                              , "size callback"
+                              , "init callback"
+                              , "update callback"
+                              , "combine callback"
+                              , "finalize callback"
+                              , "return type"
+                              , "concrete type"
+                              , "own factory"
+                              ]
+                              $ \omitted ->
+                                withHandle
+                                  (c_duckdb_v2_aggregate_function_create (if omitted == "own factory" then otherFactory else factory))
+                                  c_duckdb_v2_aggregate_function_destroy
+                                  $ \function -> do
+                                    let unlessOmitted part = unless (omitted == part) . checked
+                                    unless (omitted == "name") $ withView "v2_registered_sum" $ \name -> checked (c_duckdb_v2_aggregate_function_set_name function (coerce name))
+                                    unlessOmitted "size callback" (c_duckdb_v2_aggregate_function_set_size_callback function sizePtr)
+                                    unlessOmitted "init callback" (c_duckdb_v2_aggregate_function_set_init_callback function initializePtr)
+                                    unlessOmitted "update callback" (c_duckdb_v2_aggregate_function_set_update_callback function updatePtr)
+                                    unlessOmitted "combine callback" (c_duckdb_v2_aggregate_function_set_combine_callback function combinePtr)
+                                    unlessOmitted "finalize callback" (c_duckdb_v2_aggregate_function_set_finalize_callback function finalizePtr)
+                                    signature <- output (c_duckdb_v2_aggregate_function_get_signature function)
+                                    unlessOmitted "return type" (c_duckdb_v2_function_signature_set_return_type signature (if omitted == "concrete type" then anyType else ty))
+                                    c_duckdb_v2_connection_register_aggregate_function conn function nullPtr
diff --git a/test/V2ArrowTest.hs b/test/V2ArrowTest.hs
new file mode 100644
--- /dev/null
+++ b/test/V2ArrowTest.hs
@@ -0,0 +1,421 @@
+{-# LANGUAGE DataKinds #-}
+{-# LANGUAGE TypeApplications #-}
+
+module V2ArrowTest (tests) where
+
+import Control.Exception (bracket, finally)
+import Control.Monad (forM, forM_, unless, when)
+import Data.Coerce (coerce)
+import Data.IORef (newIORef, readIORef)
+import Data.Int (Int64)
+import Data.Proxy (Proxy (..))
+import Database.DuckDB.FFI.V2
+import Foreign.C.ConstPtr (ConstPtr (..))
+import Foreign.C.String (peekCString)
+import Foreign.C.Types (CBool (..))
+import Foreign.Marshal.Alloc (alloca)
+import Foreign.Marshal.Array (withArray)
+import Foreign.Marshal.Utils (fillBytes, with)
+import Foreign.Ptr (Ptr, freeHaskellFunPtr, nullFunPtr, nullPtr)
+import Foreign.Storable (Storable (..))
+import GHC.Records (getField)
+import HsBindgen.Runtime.HasCField (fromPtr)
+import HsBindgen.Runtime.Prelude (fromFunPtr, staticSizeOf, toFunPtr)
+import Test.Tasty (TestTree, testGroup)
+import Test.Tasty.HUnit (assertBool, assertEqual, assertFailure, testCase, (@?=))
+import V2Test (
+  callbackGuard,
+  checked,
+  consume,
+  countCall,
+  output,
+  readIntegers,
+  readView,
+  withConnection,
+  withFactory,
+  withHandle,
+  withResult,
+  withStatement,
+  withType,
+  withView,
+ )
+
+tests :: TestTree
+tests =
+  testGroup
+    "DuckDB V2 Arrow"
+    [ testCase "rows exported to Arrow in batches and imported again keep their values, and a wrong shape is rejected" testRoundTrip
+    , testCase "results step to the end with waits, and Arrow results report their shape, changed rows, cancellation and errors" testResults
+    ]
+
+-- | The rows of the round trip: a BIGINT and a VARCHAR column, each with a NULL.
+sourceRows :: [(Maybe Int64, Maybe String)]
+sourceRows =
+  [ (Just 1, Just "a")
+  , (Nothing, Just "long enough to be stored outside the inline buffer")
+  , (Just 3, Nothing)
+  , (Just 4, Just "")
+  , (Just 5, Just "e")
+  ]
+
+-- | Read one row of a vector, or Nothing for NULL.
+cell :: (DuckDBV2ValueHandle -> IO a) -> DuckDBV2VectorHandle -> Int -> IO (Maybe a)
+cell get vector row = withHandle (c_duckdb_v2_vector_get_value vector (fromIntegral row)) c_duckdb_v2_value_destroy $ \value -> do
+  isNull <- output (c_duckdb_v2_value_is_null value)
+  if isNull == CBool 0 then Just <$> get value else pure Nothing
+
+bigint :: DuckDBV2ValueHandle -> IO Int64
+bigint value = output (c_duckdb_v2_value_get_bigint value)
+
+varchar :: DuckDBV2ValueHandle -> IO String
+varchar value = output (c_duckdb_v2_value_get_varchar value) >>= readView
+
+-- | Read the BIGINT column and the VARCHAR column of each row of a chunk.
+readRows :: DuckDBV2DataChunkHandle -> IO [(Maybe Int64, Maybe String)]
+readRows chunk = do
+  size <- output (c_duckdb_v2_data_chunk_get_size chunk)
+  amounts <- output (c_duckdb_v2_data_chunk_get_vector chunk 0)
+  labels <- output (c_duckdb_v2_data_chunk_get_vector chunk 1)
+  forM [0 .. fromIntegral size - 1] $ \row -> (,) <$> cell bigint amounts row <*> cell varchar labels row
+
+-- | Run an action with a zeroed Arrow array. At the end, release the array if it still has a release callback.
+withArrowArray :: (Ptr ArrowArray -> IO a) -> IO a
+withArrowArray action = alloca $ \ptr -> do
+  fillBytes ptr 0 (staticSizeOf (Proxy @ArrowArray))
+  action ptr `finally` (peek ptr >>= \array -> unless (getField @"release" array == nullFunPtr) (fromFunPtr (getField @"release" array) ptr))
+
+-- | Run an action with a zeroed Arrow schema. At the end, release the schema if it still has a release callback.
+withArrowSchema :: (Ptr ArrowSchema -> IO a) -> IO a
+withArrowSchema action = alloca $ \ptr -> do
+  fillBytes ptr 0 (staticSizeOf (Proxy @ArrowSchema))
+  action ptr
+    `finally` (peek ptr >>= \schema -> unless (getField @"release" schema == nullFunPtr) (fromFunPtr (getField @"release" schema) ptr))
+
+-- | Set a field to a value for the duration of the action, and restore the field after.
+patched :: (Storable a) => Ptr a -> a -> IO b -> IO b
+patched field value action = do
+  original <- peek field
+  poke field value
+  action `finally` poke field original
+
+-- | Tell if an Arrow array has no release callback, that is, if it holds no data of the caller.
+released :: Ptr ArrowArray -> IO Bool
+released ptr = (== nullFunPtr) . getField @"release" <$> peek ptr
+
+-- | Read the name and the format of each column of an Arrow schema. The schema itself is a struct.
+arrowColumns :: Ptr ArrowSchema -> IO [(String, String)]
+arrowColumns ptr = do
+  schema <- peek ptr
+  peekCString (coerce (getField @"format" schema)) >>= (@?= "+s")
+  forM [0 .. fromIntegral (getField @"n_children" schema) - 1] $ \i -> do
+    column <- peekElemOff (getField @"children" schema) i >>= peek
+    (,) <$> peekCString (coerce (getField @"name" column)) <*> peekCString (coerce (getField @"format" column))
+
+-- | Read the name and the type id of each field of a schema.
+schemaFields :: DuckDBV2SchemaHandle -> IO [(String, DuckDBV2LogicalTypeId)]
+schemaFields schema = do
+  count <- output (c_duckdb_v2_schema_get_count schema)
+  forM [0 .. fromIntegral count - 1 :: Int] $ \i -> alloca $ \name -> do
+    ty <- output (c_duckdb_v2_schema_get_field schema (fromIntegral i) name)
+    (,) <$> (peek name >>= readView . coerce) <*> output (c_duckdb_v2_logical_type_get_id ty)
+
+-- | Write the source rows into a new chunk and give the chunk to the exporter, which destroys it.
+exportRows :: DuckDBV2FactoryHandle -> Ptr DuckDBV2LogicalTypeHandle -> DuckDBV2ArrowExporterHandle -> IO ()
+exportRows factory types exporter = alloca $ \slot -> do
+  poke slot (coerce nullPtr)
+  flip finally (c_duckdb_v2_data_chunk_destroy slot) $ do
+    checked (c_duckdb_v2_data_chunk_create factory (ConstPtr types) 2 slot)
+    chunk <- peek slot
+    amounts <- output (c_duckdb_v2_data_chunk_get_vector chunk 0)
+    labels <- output (c_duckdb_v2_data_chunk_get_vector chunk 1)
+    checked (c_duckdb_v2_vector_set_size amounts (fromIntegral (length sourceRows)))
+    checked (c_duckdb_v2_vector_set_size labels (fromIntegral (length sourceRows)))
+    forM_ (zip [0 ..] sourceRows) $ \(row, (amount, label)) -> do
+      case amount of
+        Just number -> withHandle (c_duckdb_v2_value_create_bigint factory number) c_duckdb_v2_value_destroy $ \value ->
+          checked (c_duckdb_v2_vector_set_value amounts row value)
+        Nothing -> checked (c_duckdb_v2_vector_set_null amounts row)
+      case label of
+        Just text -> withView text $ \view -> withHandle (c_duckdb_v2_value_create_varchar factory view) c_duckdb_v2_value_destroy $ \value ->
+          checked (c_duckdb_v2_vector_set_value labels row value)
+        Nothing -> checked (c_duckdb_v2_vector_set_null labels row)
+    checked (c_duckdb_v2_arrow_exporter_append exporter slot (CBool 1) (CBool 0))
+    peek slot >>= (@?= coerce nullPtr)
+
+-- | Take the next array of the exporter into the slot and return its row count.
+nextArray :: DuckDBV2ArrowExporterHandle -> Ptr ArrowArray -> IO Int64
+nextArray exporter ptr = do
+  checked (c_duckdb_v2_arrow_exporter_next_array exporter ptr)
+  released ptr >>= assertBool "the exporter has an array ready" . not
+  getField @"length" <$> peek ptr
+
+-- | Take every chunk that the importer has ready, and read the rows of each chunk.
+drain :: DuckDBV2ArrowImporterHandle -> IO [[(Maybe Int64, Maybe String)]]
+drain importer = alloca $ \slot -> do
+  poke slot (coerce nullPtr)
+  checked (c_duckdb_v2_arrow_importer_next_chunk importer slot)
+  chunk <- peek slot
+  if chunk == coerce nullPtr
+    then pure []
+    else do
+      rows <- readRows chunk `finally` c_duckdb_v2_data_chunk_destroy slot
+      (rows :) <$> drain importer
+
+-- | Move the arrays of the exporter into a new importer, and return the rows of each imported chunk.
+-- The exporter makes arrays of 3 rows and the importer makes chunks of 2 rows.
+transfer :: DuckDBV2ContextHandle -> Ptr ArrowSchema -> DuckDBV2ArrowExporterHandle -> IO [[(Maybe Int64, Maybe String)]]
+transfer context schema exporter =
+  withArrowArray $ \first -> withArrowArray $ \second -> withArrowArray $ \none -> alloca $ \kept -> do
+    poke kept (coerce nullPtr)
+    flip finally (c_duckdb_v2_data_chunk_destroy kept) $ do
+      -- The 5 rows fill one array. The last 2 rows wait for more rows or a flush.
+      nextArray exporter first >>= (@?= 3)
+      checked (c_duckdb_v2_arrow_exporter_next_array exporter none)
+      released none >>= assertBool "no second array before the flush"
+      checked (c_duckdb_v2_arrow_exporter_append exporter nullPtr (CBool 0) (CBool 1))
+      nextArray exporter second >>= (@?= 2)
+      checked (c_duckdb_v2_arrow_exporter_next_array exporter none)
+      released none >>= assertBool "no array after the flushed array"
+      -- The importer reads the schema and does not consume it.
+      rest <- withHandle (c_duckdb_v2_arrow_importer_create context schema 2) c_duckdb_v2_arrow_importer_destroy $ \importer -> do
+        withHandle (c_duckdb_v2_arrow_importer_get_schema importer) c_duckdb_v2_schema_destroy $ \resolved ->
+          schemaFields resolved >>= (@?= [("amount", DuckDBV2LogicalTypeIdBigInt), ("label", DuckDBV2LogicalTypeIdVarchar)])
+        drain importer >>= (@?= [])
+        -- The importer rejects an array whose shape differs from the schema, before it reads the array. Each
+        -- patch changes one field of the first array, and ends before the next append.
+        array <- peek first
+        child <- peekElemOff (getField @"children" array) 0
+        childLength <- peek (fromPtr (Proxy @"length") child)
+        forM_
+          [ ("a different child count", patched (fromPtr (Proxy @"n_children") first) 1)
+          , ("a null child", patched (getField @"children" array) nullPtr)
+          , ("a child of another length", patched (fromPtr (Proxy @"length") child) (childLength + 1))
+          , ("a released child", patched (fromPtr (Proxy @"release") child) nullFunPtr)
+          ]
+          $ \(what, patch) -> do
+            patch (c_duckdb_v2_arrow_importer_append importer first (CBool 1) (CBool 0) nullPtr)
+              >>= assertEqual (what <> " is rejected") DuckDBV2ErrorInputInvalid
+            released first >>= assertBool (what <> " leaves the array with the caller") . not
+        -- With consume, the importer takes the array and clears its release callback.
+        checked (c_duckdb_v2_arrow_importer_append importer first (CBool 1) (CBool 0))
+        released first >>= assertBool "the consumed array has no release callback"
+        -- The importer did not read the first array yet, so it refuses another array.
+        c_duckdb_v2_arrow_importer_append importer second (CBool 0) (CBool 0) nullPtr >>= (@?= DuckDBV2ErrorInputInvalid)
+        -- The first chunk references the buffers of the consumed array. The test reads it after the importer is destroyed.
+        checked (c_duckdb_v2_arrow_importer_next_chunk importer kept)
+        peek kept >>= assertBool "the consumed array gives a chunk" . (/= coerce nullPtr)
+        -- The third row does not fill a chunk of 2, so the importer holds it back.
+        drain importer >>= (@?= [])
+        -- Without consume, the caller keeps the array and releases it.
+        checked (c_duckdb_v2_arrow_importer_append importer second (CBool 0) (CBool 1))
+        released second >>= assertBool "the kept array has its release callback" . not
+        drain importer
+      firstRows <- peek kept >>= readRows
+      pure (firstRows : rest)
+
+testRoundTrip :: IO ()
+testRoundTrip = do
+  failures <- newIORef []
+  binds <- newIORef 0
+  -- The exporter and the importer need a context with an active transaction, so the bind callback runs the round trip.
+  let bind _info _result context err = callbackGuard failures err $ do
+        countCall binds
+        factory <- output (c_duckdb_v2_context_get_factory context)
+        withType factory "BIGINT" $ \integer -> withType factory "VARCHAR" $ \text -> withArray [integer, text] $ \types ->
+          withView "amount" $ \amount -> withView "label" $ \label -> do
+            names <- mapM (peek . coerce) [amount, label]
+            withArray names $ \columns ->
+              withHandle (c_duckdb_v2_arrow_exporter_create context (ConstPtr types) (ConstPtr columns) 2 3) c_duckdb_v2_arrow_exporter_destroy $ \exporter ->
+                withArrowSchema $ \schema -> do
+                  checked (c_duckdb_v2_arrow_exporter_get_schema exporter schema)
+                  columnFormats <- arrowColumns schema
+                  map fst columnFormats @?= ["amount", "label"]
+                  lookup "amount" columnFormats @?= Just "l"
+                  -- An empty chunk with the column types of the exporter adds no rows. The exporter rejects an
+                  -- empty chunk with other column types, and leaves it to the caller.
+                  withArray [text, integer] $ \swapped -> forM_ [(types, DuckDBV2ErrorNone), (swapped, DuckDBV2ErrorInputInvalid)] $ \(chunkTypes, expected) ->
+                    alloca $ \slot -> do
+                      poke slot (coerce nullPtr)
+                      flip finally (c_duckdb_v2_data_chunk_destroy slot) $ do
+                        checked (c_duckdb_v2_data_chunk_create factory (ConstPtr chunkTypes) 2 slot)
+                        c_duckdb_v2_arrow_exporter_append exporter slot (CBool 1) (CBool 0) nullPtr >>= (@?= expected)
+                  exportRows factory types exporter
+                  transfer context schema exporter >>= (@?= [take 2 sourceRows, take 2 (drop 2 sourceRows), drop 4 sourceRows])
+      execute info _context err = callbackGuard failures err $ do
+        rows <- output (c_duckdb_v2_scalar_function_exec_get_row_count info)
+        vector <- output (c_duckdb_v2_scalar_function_exec_get_result info)
+        raw <- output (c_duckdb_v2_vector_get_data_mutable vector)
+        forM_ [0 .. fromIntegral rows - 1] $ \i -> pokeElemOff (coerce raw) i (1 :: Int64)
+  bracket
+    (DuckDBV2ScalarFunctionBindCallbackFn <$> toFunPtr (DuckDBV2ScalarFunctionBindCallbackFn_Aux bind))
+    (freeHaskellFunPtr . getField @"unwrap")
+    $ \bindPtr ->
+      bracket
+        (DuckDBV2ScalarFunctionExecCallbackFn <$> toFunPtr (DuckDBV2ScalarFunctionExecCallbackFn_Aux execute))
+        (freeHaskellFunPtr . getField @"unwrap")
+        $ \executePtr ->
+          withConnection $ \conn -> withFactory conn $ \factory -> do
+            withType factory "BIGINT" $ \ty ->
+              withHandle (c_duckdb_v2_scalar_function_create factory) c_duckdb_v2_scalar_function_destroy $ \function -> do
+                withView "v2_arrow_round_trip" $ \name -> checked (c_duckdb_v2_scalar_function_set_name function (coerce name))
+                signature <- output (c_duckdb_v2_scalar_function_get_signature function)
+                checked (c_duckdb_v2_function_signature_set_return_type signature ty)
+                checked (c_duckdb_v2_scalar_function_set_bind_callback function bindPtr)
+                checked (c_duckdb_v2_scalar_function_set_exec_callback function executePtr)
+                checked (c_duckdb_v2_connection_register_scalar_function conn function)
+            withResult conn "SELECT v2_arrow_round_trip()" $ \result -> readIntegers result >>= (@?= [Just 1])
+  readIORef failures >>= (@?= [])
+  readIORef binds >>= assertBool "the bind callback was invoked" . (> 0)
+
+-- | Step a result to the end and read its BIGINT rows. Wait after each WAITING status, as the header advises.
+-- A wait after a chunk could block, so the loop does not wait there.
+stepRows :: DuckDBV2ResultHandle -> IO [Maybe Int64]
+stepRows result = do
+  (status, rows) <- alloca $ \slot -> alloca $ \statusSlot -> do
+    poke slot (coerce nullPtr)
+    checked (c_duckdb_v2_result_step result slot statusSlot)
+    stepped <- peek statusSlot
+    chunk <- peek slot
+    if stepped == DuckDBV2ResultStepStatusChunk
+      then do
+        rows <- flip finally (c_duckdb_v2_data_chunk_destroy slot) $ do
+          size <- output (c_duckdb_v2_data_chunk_get_size chunk)
+          vector <- output (c_duckdb_v2_data_chunk_get_vector chunk 0)
+          forM [0 .. fromIntegral size - 1] (cell bigint vector)
+        pure (stepped, rows)
+      else do
+        chunk @?= coerce nullPtr
+        pure (stepped, [])
+  if status == DuckDBV2ResultStepStatusChunk
+    then (rows <>) <$> stepRows result
+    else
+      if status == DuckDBV2ResultStepStatusWaiting
+        then checked (c_duckdb_v2_result_wait result) >> stepRows result
+        else [] <$ (status @?= DuckDBV2ResultStepStatusFinished)
+
+-- | Read the values of the first column of an Arrow array. The column is a BIGINT column without NULL.
+arrayValues :: Ptr ArrowArray -> IO [Int64]
+arrayValues ptr = do
+  array <- peek ptr
+  column <- peekElemOff (getField @"children" array) 0 >>= peek
+  buffer <- peekElemOff (getField @"buffers" column) 1
+  forM [0 .. fromIntegral (getField @"length" column) - 1] $ \i ->
+    peekElemOff (coerce buffer :: Ptr Int64) (fromIntegral (getField @"offset" column) + i)
+
+-- | Step an Arrow result to the end and read the values of each array. Wait after each WAITING status.
+stepArrays :: DuckDBV2ArrowResultHandle -> IO [[Int64]]
+stepArrays result = do
+  (status, values) <- withArrowArray $ \array -> alloca $ \statusSlot -> do
+    checked (c_duckdb_v2_arrow_result_step result array statusSlot)
+    stepped <- peek statusSlot
+    if stepped == DuckDBV2ResultStepStatusChunk
+      then (,) stepped <$> arrayValues array
+      else do
+        released array >>= assertBool "only the status CHUNK gives an array"
+        pure (stepped, [])
+  if status == DuckDBV2ResultStepStatusChunk
+    then (values :) <$> stepArrays result
+    else
+      if status == DuckDBV2ResultStepStatusWaiting
+        then checked (c_duckdb_v2_arrow_result_wait result) >> stepArrays result
+        else [] <$ (status @?= DuckDBV2ResultStepStatusFinished)
+
+-- | Execute a statement as an Arrow result, with a maximum number of rows for each array.
+withArrowResult :: DuckDBV2ConnectionHandle -> String -> DuckDBIdx -> (DuckDBV2ArrowResultHandle -> IO a) -> IO a
+withArrowResult conn sql batchSize action = withStatement conn sql $ \statement ->
+  withHandle
+    (c_duckdb_v2_statement_execute_arrow conn statement (coerce nullPtr) (coerce nullPtr) 0 batchSize)
+    c_duckdb_v2_arrow_result_destroy
+    action
+
+testResults :: IO ()
+testResults = withConnection $ \conn -> do
+  withResult conn "SELECT i::BIGINT FROM range(5) t(i)" $ \result -> do
+    stepRows result >>= (@?= map Just [0 .. 4])
+    -- A wait on a finished result returns at once, and the status FINISHED stays.
+    checked (c_duckdb_v2_result_wait result)
+    stepRows result >>= (@?= [])
+  withArrowResult conn "SELECT i::BIGINT AS amount FROM range(5) t(i)" 2 $ \result -> do
+    output (c_duckdb_v2_arrow_result_get_result_type result) >>= (@?= DuckDBV2ResultTypeQueryResult)
+    output (c_duckdb_v2_arrow_result_get_statement_type result) >>= (@?= DuckDBV2StatementTypeSelect)
+    arrays <- stepArrays result
+    concat arrays @?= [0 .. 4]
+    assertBool ("no array has more rows than the batch size: " <> show arrays) (all ((<= 2) . length) arrays)
+    checked (c_duckdb_v2_arrow_result_wait result)
+    stepArrays result >>= (@?= [])
+  withResult conn "CREATE TABLE v2_amounts (amount BIGINT)" consume
+  withArrowResult conn "INSERT INTO v2_amounts SELECT i FROM range(3) t(i)" 0 $ \result -> do
+    output (c_duckdb_v2_arrow_result_get_result_type result) >>= (@?= DuckDBV2ResultTypeChangedRows)
+    output (c_duckdb_v2_arrow_result_get_statement_type result) >>= (@?= DuckDBV2StatementTypeInsert)
+    output (c_duckdb_v2_arrow_result_drain result) >>= (@?= 3)
+    -- The first drain read the count, so a second drain reports 0.
+    output (c_duckdb_v2_arrow_result_drain result) >>= (@?= 0)
+  withResult conn "SELECT count(*)::BIGINT FROM v2_amounts" $ \result -> readIntegers result >>= (@?= [Just 3])
+  -- A dynamic PIVOT expands into several statements. The result type is known only after a step binds the
+  -- statement that returns rows. The statement does not accept parameter values.
+  withArrowResult conn "PIVOT v2_amounts ON amount" 0 $ \result -> do
+    alloca $ \kind -> c_duckdb_v2_arrow_result_get_result_type result kind nullPtr >>= (@?= DuckDBV2ErrorInputMetadataDeferred)
+    concat <$> stepArrays result >>= (@?= [1])
+    output (c_duckdb_v2_arrow_result_get_result_type result) >>= (@?= DuckDBV2ResultTypeQueryResult)
+  withFactory conn $ \factory -> withHandle (c_duckdb_v2_value_create_bigint factory 7) c_duckdb_v2_value_destroy $ \value -> withArray [value, value] $ \values -> do
+    -- Execute the statement with the first count values and their names. The execution must fail with INPUT_INVALID.
+    let refused sql names count = withStatement conn sql $ \statement -> alloca $ \slot -> do
+          poke slot (coerce nullPtr)
+          c_duckdb_v2_statement_execute_arrow conn statement names (ConstPtr values) count 0 slot nullPtr
+            >>= assertEqual sql DuckDBV2ErrorInputInvalid
+          peek slot >>= (@?= coerce nullPtr)
+        -- Execute the statement with the first value and its name, and read the value back.
+        accepted sql names = withStatement conn sql $ \statement ->
+          withHandle (c_duckdb_v2_statement_execute_arrow conn statement names (ConstPtr values) 1 0) c_duckdb_v2_arrow_result_destroy $ \result ->
+            stepArrays result >>= (@?= [[7]])
+        positional = DuckDBV2IdentifierT (DuckDBV2Str (ConstPtr nullPtr) 0)
+    refused "PIVOT v2_amounts ON amount" (coerce nullPtr) 1
+    -- A name for a positional parameter is rejected, and so is a positional value for a named parameter. A {NULL, 0}
+    -- name keeps the value positional. Named and positional keys cannot be mixed.
+    withView "amount" $ \amount -> do
+      refused "SELECT $1::BIGINT" (coerce amount) 1
+      accepted "SELECT $amount::BIGINT" (coerce amount)
+      named <- peek (coerce amount)
+      withArray [DuckDBV2IdentifierT named, positional] $ \names -> refused "SELECT $amount::BIGINT" (ConstPtr names) 2
+    refused "SELECT $amount::BIGINT" (coerce nullPtr) 1
+    with positional $ \name -> accepted "SELECT $1::BIGINT" (ConstPtr name)
+  -- A statement that fails to bind gives no result.
+  withStatement conn "SELECT absent_column" $ \statement -> alloca $ \slot -> do
+    poke slot (coerce nullPtr)
+    code <- c_duckdb_v2_statement_execute_arrow conn statement (coerce nullPtr) (coerce nullPtr) 0 0 slot nullPtr
+    assertBool ("a statement that fails to bind fails: " <> show code) (code /= DuckDBV2ErrorNone)
+    peek slot >>= (@?= coerce nullPtr)
+  -- One statement runs on a connection at a time. An interrupt cancels the running result: a step reports
+  -- CANCELLED, a wait returns at once, and a drain reports the interrupt.
+  withArrowResult conn "SELECT i::BIGINT FROM range(100000) t(i)" 0 $ \running -> do
+    withStatement conn "SELECT 9::BIGINT" $ \statement -> alloca $ \slot -> do
+      poke slot (coerce nullPtr)
+      c_duckdb_v2_statement_execute_arrow conn statement (coerce nullPtr) (coerce nullPtr) 0 0 slot nullPtr >>= (@?= DuckDBV2ErrorResourceInUse)
+      peek slot >>= (@?= coerce nullPtr)
+    checked (c_duckdb_v2_connection_interrupt conn)
+    withArrowArray $ \array -> alloca $ \status -> do
+      checked (c_duckdb_v2_arrow_result_step running array status)
+      peek status >>= (@?= DuckDBV2ResultStepStatusCancelled)
+      released array >>= assertBool "a cancelled step gives no array"
+    checked (c_duckdb_v2_arrow_result_wait running)
+    alloca $ \rows -> c_duckdb_v2_arrow_result_drain running rows nullPtr >>= (@?= DuckDBV2ErrorRuntimeInterrupt)
+  withArrowResult conn "SELECT 9::BIGINT" 0 $ \result -> stepArrays result >>= (@?= [[9]])
+  -- An error during the execution comes back from a step. Later steps and a drain report the same code, and a wait
+  -- returns at once.
+  withArrowResult conn "SELECT CASE WHEN i = 3 THEN error('v2 execution failure') ELSE i END::BIGINT FROM range(5) t(i)" 0 $ \result -> do
+    let stepToError = do
+          (code, status) <- withArrowArray $ \array -> alloca $ \statusSlot -> do
+            code <- c_duckdb_v2_arrow_result_step result array statusSlot nullPtr
+            when (code /= DuckDBV2ErrorNone) $ released array >>= assertBool "a failed step gives no array"
+            (,) code <$> peek statusSlot
+          if code /= DuckDBV2ErrorNone
+            then pure code
+            else
+              if status == DuckDBV2ResultStepStatusFinished
+                then assertFailure "the result finishes without an error"
+                else when (status == DuckDBV2ResultStepStatusWaiting) (checked (c_duckdb_v2_arrow_result_wait result)) >> stepToError
+    failed <- stepToError
+    stepToError >>= (@?= failed)
+    checked (c_duckdb_v2_arrow_result_wait result)
+    alloca $ \rows -> c_duckdb_v2_arrow_result_drain result rows nullPtr >>= (@?= failed)
+  withArrowResult conn "SELECT 9::BIGINT" 0 $ \result -> stepArrays result >>= (@?= [[9]])
diff --git a/test/V2AttachTest.hs b/test/V2AttachTest.hs
new file mode 100644
--- /dev/null
+++ b/test/V2AttachTest.hs
@@ -0,0 +1,97 @@
+module V2AttachTest (tests) where
+
+import Control.Exception (bracket)
+import Control.Monad (void)
+import Data.Coerce (coerce)
+import Database.DuckDB.FFI.V2
+import Foreign.C.String (withCString)
+import Foreign.C.Types (CBool (..))
+import Foreign.Ptr (nullPtr)
+import System.IO (hClose, openBinaryTempFile)
+import Test.Tasty (TestTree, testGroup)
+import Test.Tasty.HUnit (assertBool, testCase, (@?=))
+import V2Test (checked, readIntegers, removeTestFile, withHandle, withInstance, withResult, withView)
+
+tests :: TestTree
+tests =
+  testGroup
+    "DuckDB V2 attach options"
+    [ testCase "attach options pass READ_ONLY to the attach, and an unknown option fails it" testAttachOptions
+    , testCase "an attach fails for an attached path or name, and a detach fails for a name that is not attached" testAttachConflicts
+    ]
+
+-- | Set one attach option from text.
+setOption :: DuckDBV2AttachOptionsHandle -> String -> String -> IO ()
+setOption options key setting = withView key $ \name -> withView setting $ \value ->
+  checked (c_duckdb_v2_attach_options_set options (coerce name) value)
+
+testAttachOptions :: IO ()
+testAttachOptions =
+  bracket
+    ( do
+        (path, handle) <- openBinaryTempFile "." "duckdb-v2-attach"
+        hClose handle
+        -- The first attach creates the database file.
+        withCString path $ \name -> removeTestFile name >>= (@?= 0)
+        pure path
+    )
+    (\path -> withCString path (void . removeTestFile))
+    ( \path -> withInstance $ \instanceHandle ->
+        withHandle (c_duckdb_v2_connection_create instanceHandle) c_duckdb_v2_connection_destroy $ \conn -> withView path $ \file -> do
+          let attach name options = withView name $ \view ->
+                checked (c_duckdb_v2_instance_attach instanceHandle (coerce view) file options (CBool 0))
+              detach name = withView name $ \view -> checked (c_duckdb_v2_instance_detach instanceHandle (coerce view))
+              readOnly name = withResult conn ("SELECT readonly::BIGINT FROM duckdb_databases() WHERE database_name = '" <> name <> "'") readIntegers
+          attach "v2_created" (coerce nullPtr)
+          readOnly "v2_created" >>= (@?= [Just 0])
+          detach "v2_created"
+          withHandle (c_duckdb_v2_attach_options_create instanceHandle) c_duckdb_v2_attach_options_destroy $ \options -> do
+            -- The key is case-insensitive, and the second value for the key replaces the first.
+            setOption options "read_only" "false"
+            setOption options "READ_ONLY" "true"
+            attach "v2_read_only" options
+            readOnly "v2_read_only" >>= (@?= [Just 1])
+            detach "v2_read_only"
+          withHandle (c_duckdb_v2_attach_options_create instanceHandle) c_duckdb_v2_attach_options_destroy $ \options -> do
+            setOption options "v2_no_such_option" "1"
+            withView "v2_unknown" $ \name -> do
+              code <- c_duckdb_v2_instance_attach instanceHandle (coerce name) file options (CBool 0) nullPtr
+              assertBool "an unknown option fails the attach" (code /= DuckDBV2ErrorNone)
+            readOnly "v2_unknown" >>= (@?= [])
+          -- READ_ONLY takes a boolean. The text "maybe" does not cast to one.
+          withHandle (c_duckdb_v2_attach_options_create instanceHandle) c_duckdb_v2_attach_options_destroy $ \options -> do
+            setOption options "READ_ONLY" "maybe"
+            withView "v2_ill_typed" $ \name -> do
+              code <- c_duckdb_v2_instance_attach instanceHandle (coerce name) file options (CBool 0) nullPtr
+              assertBool "an ill-typed option fails the attach" (code /= DuckDBV2ErrorNone)
+            readOnly "v2_ill_typed" >>= (@?= [])
+    )
+
+testAttachConflicts :: IO ()
+testAttachConflicts =
+  bracket
+    ( do
+        (path, handle) <- openBinaryTempFile "." "duckdb-v2-conflict"
+        hClose handle
+        withCString path $ \name -> removeTestFile name >>= (@?= 0)
+        pure path
+    )
+    (\path -> withCString path (void . removeTestFile))
+    ( \path -> withInstance $ \instanceHandle -> withView path $ \file -> withView ":memory:" $ \memory -> do
+        let attach name target = withView name $ \view -> c_duckdb_v2_instance_attach instanceHandle (coerce view) target (coerce nullPtr) (CBool 0) nullPtr
+            detach name = withView name $ \view -> c_duckdb_v2_instance_detach instanceHandle (coerce view) nullPtr
+        attach "v2_first" file >>= (@?= DuckDBV2ErrorNone)
+        attach "v2_second" file >>= (@?= DuckDBV2ErrorResourceInUse)
+        attach "v2_second" memory >>= (@?= DuckDBV2ErrorNone)
+        attach "v2_first" memory >>= \code -> assertBool ("an attached name fails the attach: " <> show code) (code /= DuckDBV2ErrorNone)
+        detach "v2_second" >>= (@?= DuckDBV2ErrorNone)
+        detach "v2_first" >>= (@?= DuckDBV2ErrorNone)
+        detach "v2_first" >>= (@?= DuckDBV2ErrorInputInvalid)
+        -- Attach options belong to the instance that created them.
+        withInstance $ \other -> do
+          let attachWith owner = withHandle (c_duckdb_v2_attach_options_create owner) c_duckdb_v2_attach_options_destroy $ \options ->
+                withView "v2_owned" $ \name -> c_duckdb_v2_instance_attach instanceHandle (coerce name) memory options (CBool 0) nullPtr
+          attachWith other >>= \code -> assertBool ("options of another instance fail the attach: " <> show code) (code /= DuckDBV2ErrorNone)
+          attachWith instanceHandle >>= (@?= DuckDBV2ErrorNone)
+          detach "v2_owned" >>= (@?= DuckDBV2ErrorNone)
+    )
diff --git a/test/V2CallbackTest.hs b/test/V2CallbackTest.hs
new file mode 100644
--- /dev/null
+++ b/test/V2CallbackTest.hs
@@ -0,0 +1,560 @@
+{-# LANGUAGE DataKinds #-}
+{-# LANGUAGE TypeApplications #-}
+
+module V2CallbackTest (tests) where
+
+import Control.Exception (bracket, finally)
+import Control.Monad (forM_, unless, when, zipWithM_)
+import Data.Bits (clearBit)
+import Data.Coerce (coerce)
+import Data.IORef (atomicModifyIORef', newIORef, readIORef)
+import Data.Int (Int64)
+import Database.DuckDB.FFI.V2
+import Foreign.C.ConstPtr (ConstPtr (..))
+import Foreign.C.Types (CBool (..))
+import Foreign.Marshal.Alloc (alloca, allocaBytes, free, malloc)
+import Foreign.Marshal.Utils (with)
+import Foreign.Ptr (Ptr, freeHaskellFunPtr, nullFunPtr, nullPtr)
+import Foreign.Storable (Storable (..))
+import GHC.Records (getField)
+import HsBindgen.Runtime.Prelude (toFunPtr)
+import System.Environment (getExecutablePath)
+import Test.Tasty (TestTree, testGroup)
+import Test.Tasty.HUnit (assertBool, testCase, (@?=))
+import V2Test (
+  argCounts,
+  borrowedOpaque,
+  callbackGuard,
+  checked,
+  consume,
+  countCall,
+  eachPartRequired,
+  expectCallbackFailure,
+  failOnPurpose,
+  output,
+  readArgument,
+  readIntegers,
+  readView,
+  withConnection,
+  withFactory,
+  withHandle,
+  withInstance,
+  withResult,
+  withStatement,
+  withType,
+  withView,
+ )
+
+tests :: TestTree
+tests =
+  testGroup
+    "DuckDB V2 callbacks"
+    [ testCase "scalar callbacks read the user data, the bind data and the arguments of the call" testScalarCallbacks
+    , testCase "only a cast with a non-negative cost applies implicitly, and the cast reads its user data" testCastCallbacks
+    , testCase "custom option updates report the scope and the reset, and can replace the value" testCustomOption
+    , testCase "a scalar bind, init or exec callback fails its statement and leaves the connection usable" testScalarFailures
+    , testCase "a failing cast callback fails CAST, and TRY_CAST keeps the output of the callback" testCastFailure
+    , testCase "a failing option update callback fails the SET and keeps the old value" testCustomOptionFailure
+    , testCase "registration rejects a scalar function, a cast, a custom type or a custom option without a required part" testRegistrationFailures
+    , testCase "config writes reject an unknown option, an unsupported scope and a startup option" testConfigFailures
+    ]
+
+-- | Read the name of an argument.
+argName :: DuckDBV2FunctionBindInfoHandle -> DuckDBIdx -> IO String
+argName info index = alloca $ \name -> do
+  checked (c_duckdb_v2_function_bind_get_arg_name info index name)
+  peek name >>= readView . coerce
+
+-- | Look up an argument by name. The index starts as 99, so a lookup that does not find the name returns 99.
+argIndex :: DuckDBV2FunctionBindInfoHandle -> String -> IO (CBool, DuckDBIdx)
+argIndex info text = withView text $ \name -> alloca $ \index -> alloca $ \found -> do
+  poke index 99
+  checked (c_duckdb_v2_function_bind_get_arg_index info (coerce name) index found)
+  (,) <$> peek found <*> peek index
+
+-- | Read an option as text, with the scope that the value comes from.
+readOption :: DuckDBV2ConfigHandle -> String -> IO (String, DuckDBV2SettingScope)
+readOption config text = withView text $ \name -> alloca $ \scope ->
+  withHandle (\value -> c_duckdb_v2_config_get_option_value config (coerce name) value scope) c_duckdb_v2_value_destroy $ \value -> do
+    setting <- output (c_duckdb_v2_value_get_varchar value) >>= readView
+    (,) setting <$> peek scope
+
+-- | Ask a file system whether a file exists at a path.
+pathExists :: DuckDBV2FileSystemHandle -> String -> IO CBool
+pathExists fileSystem path = withView path $ \view -> output (c_duckdb_v2_file_system_path_exists fileSystem view)
+
+testScalarCallbacks :: IO ()
+testScalarCallbacks = do
+  executable <- getExecutablePath
+  failures <- newIORef []
+  binds <- newIORef 0
+  inits <- newIORef 0
+  executions <- newIORef 0
+  orders <- newIORef []
+  -- The user data and the bind data point to two different cells, so an accessor that returns the other one fails.
+  allocaBytes 1 $ \user -> allocaBytes 1 $ \bound -> do
+    let bind info result context err = callbackGuard failures err $ do
+          countCall binds
+          output (c_duckdb_v2_function_bind_get_user_data info) >>= (@?= user)
+          -- The query calls v2_probe(i, 1, 2, 3, extra := 5, p := 6): one positional-only, one standard, two *args,
+          -- one omitted named-only and two **kwargs arguments. The name p goes to **kwargs, because p is positional-only.
+          argCounts (c_duckdb_v2_function_bind_get_arg_count info) >>= (@?= (2, 2, 1, 2))
+          checked (c_duckdb_v2_function_bind_get_arg_count info nullPtr nullPtr nullPtr nullPtr)
+          mapM (argName info) [0 .. 6] >>= (@?= ["p", "x", "", "", "n", "extra", "p"])
+          alloca $ \name -> do
+            code <- c_duckdb_v2_function_bind_get_arg_name info 7 name nullPtr
+            assertBool "an index after the last argument fails" (code /= DuckDBV2ErrorNone)
+          argIndex info "X" >>= (@?= (CBool 1, 1))
+          argIndex info "N" >>= (@?= (CBool 1, 4))
+          argIndex info "Extra" >>= (@?= (CBool 1, 5))
+          argIndex info "P" >>= (@?= (CBool 1, 6))
+          argIndex info "args" >>= (@?= (CBool 0, 99))
+          argIndex info "absent" >>= (@?= (CBool 0, 99))
+          with (borrowedOpaque bound) $ \opaque -> checked (c_duckdb_v2_scalar_function_bind_set_bind_data result opaque)
+          config <- output (c_duckdb_v2_context_get_config context)
+          readOption config "default_order" >>= \order -> atomicModifyIORef' orders (\seen -> (order : seen, ()))
+          fileSystem <- output (c_duckdb_v2_context_get_file_system context)
+          pathExists fileSystem executable >>= (@?= CBool 1)
+          pathExists fileSystem (executable <> ".absent") >>= (@?= CBool 0)
+        initialize info _context err = callbackGuard failures err $ do
+          countCall inits
+          output (c_duckdb_v2_scalar_function_init_get_user_data info) >>= (@?= user)
+          output (c_duckdb_v2_scalar_function_init_get_bind_data info) >>= (@?= bound)
+        execute info _context err = callbackGuard failures err $ do
+          countCall executions
+          output (c_duckdb_v2_scalar_function_exec_get_user_data info) >>= (@?= user)
+          rows <- output (c_duckdb_v2_scalar_function_exec_get_row_count info)
+          vector <- output (c_duckdb_v2_scalar_function_exec_get_result info)
+          raw <- output (c_duckdb_v2_vector_get_data_mutable vector)
+          forM_ [0 .. fromIntegral rows - 1] $ \i -> pokeElemOff (coerce raw) i (42 :: Int64)
+    bracket
+      (DuckDBV2ScalarFunctionBindCallbackFn <$> toFunPtr (DuckDBV2ScalarFunctionBindCallbackFn_Aux bind))
+      (freeHaskellFunPtr . getField @"unwrap")
+      $ \bindPtr ->
+        bracket
+          (DuckDBV2ScalarFunctionInitCallbackFn <$> toFunPtr (DuckDBV2ScalarFunctionInitCallbackFn_Aux initialize))
+          (freeHaskellFunPtr . getField @"unwrap")
+          $ \initializePtr ->
+            bracket
+              (DuckDBV2ScalarFunctionExecCallbackFn <$> toFunPtr (DuckDBV2ScalarFunctionExecCallbackFn_Aux execute))
+              (freeHaskellFunPtr . getField @"unwrap")
+              $ \executePtr ->
+                withConnection $ \conn -> withFactory conn $ \factory -> do
+                  withType factory "BIGINT" $ \ty ->
+                    withHandle (c_duckdb_v2_scalar_function_create factory) c_duckdb_v2_scalar_function_destroy $ \function -> do
+                      withView "v2_probe" $ \name -> checked (c_duckdb_v2_scalar_function_set_name function (coerce name))
+                      signature <- output (c_duckdb_v2_scalar_function_get_signature function)
+                      let parameter name value kind = withView name $ \view ->
+                            checked (c_duckdb_v2_function_signature_add_parameter signature (coerce view) ty value kind)
+                      parameter "p" (coerce nullPtr) DuckDBV2FunctionParameterKindPositionalOnly
+                      parameter "x" (coerce nullPtr) DuckDBV2FunctionParameterKindStandard
+                      parameter "args" (coerce nullPtr) DuckDBV2FunctionParameterKindPositionalVariadic
+                      withHandle (c_duckdb_v2_value_create_bigint factory 10) c_duckdb_v2_value_destroy $ \value ->
+                        parameter "n" value DuckDBV2FunctionParameterKindNamedOnly
+                      parameter "kwargs" (coerce nullPtr) DuckDBV2FunctionParameterKindNamedVariadic
+                      checked (c_duckdb_v2_function_signature_set_return_type signature ty)
+                      with (borrowedOpaque user) $ \opaque -> checked (c_duckdb_v2_scalar_function_set_user_data function opaque)
+                      checked (c_duckdb_v2_scalar_function_set_bind_callback function bindPtr)
+                      checked (c_duckdb_v2_scalar_function_set_init_callback function initializePtr)
+                      checked (c_duckdb_v2_scalar_function_set_exec_callback function executePtr)
+                      checked (c_duckdb_v2_connection_register_scalar_function conn function)
+                  -- The context gives the config of its connection, so the callback sees the session value.
+                  config <- output (c_duckdb_v2_connection_get_config conn)
+                  withView "default_order" $ \name -> withView "desc" $ \setting ->
+                    checked (c_duckdb_v2_config_set_option_text config (coerce name) setting DuckDBV2SettingScopeSession)
+                  -- The argument i is a column, so the engine cannot fold the call into a constant.
+                  withResult conn "SELECT v2_probe(i, 1, 2, 3, extra := 5, p := 6) FROM range(3) t(i)" $ \result ->
+                    readIntegers result >>= (@?= replicate 3 (Just 42))
+                  session <- readOption config "default_order"
+                  snd session @?= DuckDBV2SettingScopeSession
+                  readIORef orders >>= \seen -> assertBool ("the context config gives the session value: " <> show seen) (not (null seen) && all (== session) seen)
+  readIORef failures >>= (@?= [])
+  readIORef binds >>= assertBool "the bind callback was invoked" . (> 0)
+  readIORef inits >>= assertBool "the init callback was invoked" . (> 0)
+  readIORef executions >>= assertBool "the exec callback was invoked" . (> 0)
+
+-- | Write each BIGINT of the input vector, plus an offset, to the output vector.
+shiftBigints :: DuckDBIdx -> DuckDBV2VectorHandle -> DuckDBV2VectorHandle -> Int64 -> IO ()
+shiftBigints count input result offset = do
+  checked (c_duckdb_v2_vector_flatten input)
+  view <- output (c_duckdb_v2_vector_get_view input)
+  raw <- output (c_duckdb_v2_vector_get_data_mutable result)
+  forM_ [0 .. fromIntegral count - 1] $ \i -> do
+    index <-
+      if getField @"sel" view == coerce nullPtr
+        then pure i
+        else fromIntegral <$> peekElemOff (coerce (getField @"sel" view) :: Ptr DuckDBV2SelT) i
+    value <- peekElemOff (coerce (getField @"data'" view)) index
+    pokeElemOff (coerce raw) i (value + offset :: Int64)
+
+testCastCallbacks :: IO ()
+testCastCallbacks = do
+  failures <- newIORef []
+  casts <- newIORef 0
+  allocaBytes 1 $ \user -> do
+    let cast info _context err = callbackGuard failures err $ do
+          countCall casts
+          output (c_duckdb_v2_cast_function_exec_get_user_data info) >>= (@?= user)
+          count <- output (c_duckdb_v2_cast_function_exec_get_row_count info)
+          input <- output (c_duckdb_v2_cast_function_exec_get_input info)
+          result <- output (c_duckdb_v2_cast_function_exec_get_output info)
+          shiftBigints count input result 100
+        unwrap info _context err = callbackGuard failures err $ do
+          count <- output (c_duckdb_v2_scalar_function_exec_get_row_count info)
+          input <- output (c_duckdb_v2_scalar_function_exec_get_arg info 0)
+          result <- output (c_duckdb_v2_scalar_function_exec_get_result info)
+          shiftBigints count input result 0
+    bracket
+      (DuckDBV2CastFunctionExecCallbackFn <$> toFunPtr (DuckDBV2CastFunctionExecCallbackFn_Aux cast))
+      (freeHaskellFunPtr . getField @"unwrap")
+      $ \castPtr ->
+        bracket
+          (DuckDBV2ScalarFunctionExecCallbackFn <$> toFunPtr (DuckDBV2ScalarFunctionExecCallbackFn_Aux unwrap))
+          (freeHaskellFunPtr . getField @"unwrap")
+          $ \unwrapPtr ->
+            withConnection $ \conn -> withFactory conn $ \factory -> withType factory "BIGINT" $ \ty -> do
+              -- Register an alias of BIGINT, a function that takes the alias, and a cast from BIGINT to the alias.
+              let register typeName functionName cost = withView typeName $ \name -> do
+                    withHandle (c_duckdb_v2_custom_type_create factory) c_duckdb_v2_custom_type_destroy $ \custom -> do
+                      checked (c_duckdb_v2_custom_type_set_name custom (coerce name))
+                      checked (c_duckdb_v2_custom_type_set_base_type custom ty)
+                      checked (c_duckdb_v2_connection_register_custom_type conn custom)
+                    withHandle (c_duckdb_v2_factory_create_type_with_alias factory ty (coerce name)) c_duckdb_v2_logical_type_destroy $ \alias -> do
+                      withHandle (c_duckdb_v2_scalar_function_create factory) c_duckdb_v2_scalar_function_destroy $ \function -> do
+                        withView functionName $ \view -> checked (c_duckdb_v2_scalar_function_set_name function (coerce view))
+                        signature <- output (c_duckdb_v2_scalar_function_get_signature function)
+                        withView "v" $ \view ->
+                          checked (c_duckdb_v2_function_signature_add_parameter signature (coerce view) alias (coerce nullPtr) DuckDBV2FunctionParameterKindStandard)
+                        checked (c_duckdb_v2_function_signature_set_return_type signature ty)
+                        checked (c_duckdb_v2_scalar_function_set_exec_callback function unwrapPtr)
+                        checked (c_duckdb_v2_connection_register_scalar_function conn function)
+                      withHandle (c_duckdb_v2_cast_function_create factory) c_duckdb_v2_cast_function_destroy $ \function -> do
+                        checked (c_duckdb_v2_cast_function_set_source_type function ty)
+                        checked (c_duckdb_v2_cast_function_set_target_type function alias)
+                        checked (c_duckdb_v2_cast_function_set_exec_callback function castPtr)
+                        with (borrowedOpaque user) $ \opaque -> checked (c_duckdb_v2_cast_function_set_user_data function opaque)
+                        checked (c_duckdb_v2_cast_function_set_implicit_cast_cost function cost)
+                        checked (c_duckdb_v2_connection_register_cast_function conn function)
+              register "v2_loose" "v2_take_loose" 0
+              register "v2_strict" "v2_take_strict" (-1)
+              withResult conn "SELECT v2_take_loose(i) FROM range(3) t(i)" $ \result ->
+                readIntegers result >>= (@?= [Just 100, Just 101, Just 102])
+              withStatement conn "SELECT v2_take_strict(i) FROM range(3) t(i)" $ \statement -> alloca $ \slot -> do
+                poke slot (coerce nullPtr)
+                flip finally (c_duckdb_v2_result_destroy slot) $ do
+                  code <- c_duckdb_v2_statement_execute conn statement (coerce nullPtr) (coerce nullPtr) 0 slot nullPtr
+                  assertBool "a negative cost does not apply the cast implicitly" (code /= DuckDBV2ErrorNone)
+              withResult conn "SELECT v2_take_strict(CAST(i AS v2_strict)) FROM range(3) t(i)" $ \result ->
+                readIntegers result >>= (@?= [Just 100, Just 101, Just 102])
+  readIORef failures >>= (@?= [])
+  readIORef casts >>= assertBool "the cast callback was invoked" . (> 0)
+
+testCustomOption :: IO ()
+testCustomOption = do
+  failures <- newIORef []
+  updates <- newIORef []
+  allocaBytes 1 $ \user -> do
+    let update info context err = callbackGuard failures err $ do
+          output (c_duckdb_v2_custom_option_update_get_user_data info) >>= (@?= user)
+          scope <- output (c_duckdb_v2_custom_option_update_get_scope info)
+          reset <- output (c_duckdb_v2_custom_option_update_is_reset info)
+          value <- withHandle (c_duckdb_v2_custom_option_update_get_value info) c_duckdb_v2_value_destroy (output . c_duckdb_v2_value_get_bigint)
+          atomicModifyIORef' updates (\seen -> ((scope, reset, value) : seen, ()))
+          -- The callback stores ten times the value. A reset keeps the default value.
+          unless (reset == CBool 1) $ do
+            factory <- output (c_duckdb_v2_context_get_factory context)
+            withHandle (c_duckdb_v2_value_create_bigint factory (value * 10)) c_duckdb_v2_value_destroy $ \replaced ->
+              checked (c_duckdb_v2_custom_option_update_set_value info replaced)
+    bracket
+      (DuckDBV2CustomOptionUpdateCallbackFn <$> toFunPtr (DuckDBV2CustomOptionUpdateCallbackFn_Aux update))
+      (freeHaskellFunPtr . getField @"unwrap")
+      $ \updatePtr ->
+        withConnection $ \conn -> withFactory conn $ \factory -> withView "v2_probe_option" $ \name -> do
+          withHandle (c_duckdb_v2_custom_option_create factory) c_duckdb_v2_custom_option_destroy $ \option -> do
+            checked (c_duckdb_v2_custom_option_set_name option (coerce name))
+            withHandle (c_duckdb_v2_value_create_bigint factory 1) c_duckdb_v2_value_destroy $ \value ->
+              checked (c_duckdb_v2_custom_option_set_default_value option value)
+            with (borrowedOpaque user) $ \opaque -> checked (c_duckdb_v2_custom_option_set_user_data option opaque)
+            checked (c_duckdb_v2_custom_option_set_update_callback option updatePtr)
+            checked (c_duckdb_v2_connection_register_custom_option conn option)
+          -- Compare the latest update and the stored value.
+          let expect latest stored = do
+                readIORef updates >>= \seen -> take 1 seen @?= [latest]
+                withResult conn "SELECT current_setting('v2_probe_option')::BIGINT" $ \result -> readIntegers result >>= (@?= [Just stored])
+          withResult conn "SET GLOBAL v2_probe_option = 3" consume
+          expect (DuckDBV2SettingScopeGlobal, CBool 0, 3) 30
+          -- A write at the default scope goes to SESSION, the default scope of the option.
+          withResult conn "SET v2_probe_option = 2" consume
+          expect (DuckDBV2SettingScopeSession, CBool 0, 2) 20
+          withResult conn "RESET v2_probe_option" consume
+          expect (DuckDBV2SettingScopeSession, CBool 1, 1) 1
+          config <- output (c_duckdb_v2_connection_get_config conn)
+          withHandle (c_duckdb_v2_value_create_bigint factory 4) c_duckdb_v2_value_destroy $ \value ->
+            checked (c_duckdb_v2_config_set_option_value config (coerce name) value DuckDBV2SettingScopeDefault)
+          expect (DuckDBV2SettingScopeSession, CBool 0, 4) 40
+  readIORef failures >>= (@?= [])
+
+-- | The function v2_fail(stage, x) returns x. The constant stage selects the callback that fails on purpose:
+-- 1 fails the bind, 2 fails the init, and 3 fails the exec for the input 2. The bind data holds the stage.
+testScalarFailures :: IO ()
+testScalarFailures = do
+  failures <- newIORef []
+  binds <- newIORef 0
+  released <- newIORef 0
+  let release ptr = free ptr >> countCall released
+  bracket (DuckDBV2OpaqueDestroyFn <$> toFunPtr (DuckDBV2OpaqueDestroyFn_Aux release)) (freeHaskellFunPtr . getField @"unwrap") $ \releasePtr -> do
+    let bind info result _context err = callbackGuard failures err $ do
+          countCall binds
+          stage <- withHandle (c_duckdb_v2_function_bind_get_arg_value info 0) c_duckdb_v2_value_destroy (output . c_duckdb_v2_value_get_bigint)
+          -- The argument x is a column, so it does not fold to a constant.
+          alloca $ \value -> do
+            poke value (coerce nullPtr)
+            code <- c_duckdb_v2_function_bind_get_arg_value info 1 value nullPtr
+            c_duckdb_v2_value_destroy value >>= (@?= DuckDBV2ErrorNone)
+            assertBool "a column argument does not fold to a constant" (code /= DuckDBV2ErrorNone)
+            outside <- c_duckdb_v2_function_bind_get_arg_value info 2 value nullPtr
+            c_duckdb_v2_value_destroy value >>= (@?= DuckDBV2ErrorNone)
+            assertBool "an index after the last argument fails" (outside /= DuckDBV2ErrorNone)
+          -- The bind sets the bind data first, so DuckDB must release it also when the bind fails.
+          state <- malloc
+          poke state (stage :: Int64)
+          -- A scalar function sets its bind data through its own setter only.
+          with (borrowedOpaque nullPtr) $ \opaque ->
+            c_duckdb_v2_function_bind_set_bind_data info opaque nullPtr
+              >>= assertBool "the generic bind data setter fails for a scalar function" . (/= DuckDBV2ErrorNone)
+          with (DuckDBV2Opaque (coerce state) releasePtr (DuckDBV2OpaqueEqualsFn nullFunPtr)) $ \opaque ->
+            checked (c_duckdb_v2_scalar_function_bind_set_bind_data result opaque)
+          when (stage == 1) (failOnPurpose "bind")
+        initialize info _context err = callbackGuard failures err $ do
+          stage <- output (c_duckdb_v2_scalar_function_init_get_bind_data info) >>= peek . coerce
+          when (stage == (2 :: Int64)) (failOnPurpose "init")
+        execute info _context err = callbackGuard failures err $ do
+          stage <- output (c_duckdb_v2_scalar_function_exec_get_bind_data info) >>= peek . coerce
+          count <- output (c_duckdb_v2_scalar_function_exec_get_row_count info)
+          values <- output (c_duckdb_v2_scalar_function_exec_get_arg info 1) >>= readArgument count
+          alloca $ \vector ->
+            c_duckdb_v2_scalar_function_exec_get_arg info 2 vector nullPtr
+              >>= assertBool "an index after the last argument fails" . (/= DuckDBV2ErrorNone)
+          when (stage == (3 :: Int64) && 2 `elem` values) (failOnPurpose "exec")
+          result <- output (c_duckdb_v2_scalar_function_exec_get_result info)
+          raw <- output (c_duckdb_v2_vector_get_data_mutable result)
+          zipWithM_ (pokeElemOff (coerce raw)) [0 ..] values
+    bracket
+      (DuckDBV2ScalarFunctionBindCallbackFn <$> toFunPtr (DuckDBV2ScalarFunctionBindCallbackFn_Aux bind))
+      (freeHaskellFunPtr . getField @"unwrap")
+      $ \bindPtr ->
+        bracket
+          (DuckDBV2ScalarFunctionInitCallbackFn <$> toFunPtr (DuckDBV2ScalarFunctionInitCallbackFn_Aux initialize))
+          (freeHaskellFunPtr . getField @"unwrap")
+          $ \initializePtr ->
+            bracket
+              (DuckDBV2ScalarFunctionExecCallbackFn <$> toFunPtr (DuckDBV2ScalarFunctionExecCallbackFn_Aux execute))
+              (freeHaskellFunPtr . getField @"unwrap")
+              $ \executePtr ->
+                withConnection $ \conn -> withFactory conn $ \factory -> do
+                  withType factory "BIGINT" $ \ty ->
+                    withHandle (c_duckdb_v2_scalar_function_create factory) c_duckdb_v2_scalar_function_destroy $ \function -> do
+                      withView "v2_fail" $ \name -> checked (c_duckdb_v2_scalar_function_set_name function (coerce name))
+                      signature <- output (c_duckdb_v2_scalar_function_get_signature function)
+                      forM_ ["stage", "x"] $ \name -> withView name $ \view ->
+                        checked (c_duckdb_v2_function_signature_add_parameter signature (coerce view) ty (coerce nullPtr) DuckDBV2FunctionParameterKindStandard)
+                      checked (c_duckdb_v2_function_signature_set_return_type signature ty)
+                      checked (c_duckdb_v2_scalar_function_set_bind_callback function bindPtr)
+                      checked (c_duckdb_v2_scalar_function_set_init_callback function initializePtr)
+                      checked (c_duckdb_v2_scalar_function_set_exec_callback function executePtr)
+                      checked (c_duckdb_v2_connection_register_scalar_function conn function)
+                  let passes = withResult conn "SELECT v2_fail(0, i) FROM range(3) t(i)" $ \result -> readIntegers result >>= (@?= [Just 0, Just 1, Just 2])
+                  passes
+                  expectCallbackFailure failures conn "SELECT v2_fail(1, i) FROM range(3) t(i)" "bind"
+                  passes
+                  expectCallbackFailure failures conn "SELECT v2_fail(2, i) FROM range(3) t(i)" "init"
+                  passes
+                  withResult conn "SELECT v2_fail(3, i) FROM range(2) t(i)" $ \result -> readIntegers result >>= (@?= [Just 0, Just 1])
+                  expectCallbackFailure failures conn "SELECT v2_fail(3, i) FROM range(3) t(i)" "exec"
+                  passes
+  readIORef failures >>= (@?= [])
+  bound <- readIORef binds
+  assertBool "the bind callback was invoked" (bound > 0)
+  readIORef released >>= (@?= bound)
+
+-- | A cast from BIGINT to the alias v2_guarded fails on purpose when the input holds 2.
+-- The callback writes NULL for the input 2 before it fails.
+testCastFailure :: IO ()
+testCastFailure = do
+  failures <- newIORef []
+  let cast info _context err = callbackGuard failures err $ do
+        count <- output (c_duckdb_v2_cast_function_exec_get_row_count info)
+        values <- output (c_duckdb_v2_cast_function_exec_get_input info) >>= readArgument count
+        result <- output (c_duckdb_v2_cast_function_exec_get_output info)
+        raw <- output (c_duckdb_v2_vector_get_data_mutable result)
+        zipWithM_ (pokeElemOff (coerce raw)) [0 ..] values
+        validity <- output (c_duckdb_v2_vector_flat_get_validity_mutable result)
+        forM_ (zip [0 ..] values) $ \(row, value) ->
+          when (value == 2) (peekElemOff validity (row `div` 64) >>= pokeElemOff validity (row `div` 64) . (`clearBit` (row `mod` 64)))
+        when (2 `elem` values) (failOnPurpose "cast")
+  bracket
+    (DuckDBV2CastFunctionExecCallbackFn <$> toFunPtr (DuckDBV2CastFunctionExecCallbackFn_Aux cast))
+    (freeHaskellFunPtr . getField @"unwrap")
+    $ \castPtr ->
+      withConnection $ \conn -> withFactory conn $ \factory -> withType factory "BIGINT" $ \ty -> withView "v2_guarded" $ \name -> do
+        withHandle (c_duckdb_v2_custom_type_create factory) c_duckdb_v2_custom_type_destroy $ \custom -> do
+          checked (c_duckdb_v2_custom_type_set_name custom (coerce name))
+          checked (c_duckdb_v2_custom_type_set_base_type custom ty)
+          checked (c_duckdb_v2_connection_register_custom_type conn custom)
+        withHandle (c_duckdb_v2_factory_create_type_with_alias factory ty (coerce name)) c_duckdb_v2_logical_type_destroy $ \alias ->
+          withHandle (c_duckdb_v2_cast_function_create factory) c_duckdb_v2_cast_function_destroy $ \function -> do
+            checked (c_duckdb_v2_cast_function_set_source_type function ty)
+            checked (c_duckdb_v2_cast_function_set_target_type function alias)
+            checked (c_duckdb_v2_cast_function_set_exec_callback function castPtr)
+            checked (c_duckdb_v2_connection_register_cast_function conn function)
+        let casts sql = withResult conn sql readIntegers
+        casts "SELECT CAST(i AS v2_guarded)::BIGINT FROM range(2) t(i)" >>= (@?= [Just 0, Just 1])
+        expectCallbackFailure failures conn "SELECT CAST(i AS v2_guarded)::BIGINT FROM range(3) t(i)" "cast"
+        casts "SELECT CAST(i AS v2_guarded)::BIGINT FROM range(2) t(i)" >>= (@?= [Just 0, Just 1])
+        -- TRY_CAST ignores the error of the callback.
+        casts "SELECT TRY_CAST(i AS v2_guarded)::BIGINT FROM range(3) t(i)" >>= (@?= [Just 0, Just 1, Nothing])
+        atomicModifyIORef' failures (\seen -> ([], seen)) >>= (@?= [show (userError "v2 deliberate cast failure")])
+  readIORef failures >>= (@?= [])
+
+-- | The update callback of the option v2_guarded_option refuses the value 13.
+-- Each update also replaces the value with its own text, after a replacement that does not cast to BIGINT fails.
+testCustomOptionFailure :: IO ()
+testCustomOptionFailure = do
+  failures <- newIORef []
+  let update info context err = callbackGuard failures err $ do
+        value <- withHandle (c_duckdb_v2_custom_option_update_get_value info) c_duckdb_v2_value_destroy (output . c_duckdb_v2_value_get_bigint)
+        factory <- output (c_duckdb_v2_context_get_factory context)
+        let replace text = withView text $ \view -> withHandle (c_duckdb_v2_value_create_varchar factory view) c_duckdb_v2_value_destroy $ \replacement ->
+              c_duckdb_v2_custom_option_update_set_value info replacement nullPtr
+        replace "not a number" >>= assertBool "a replacement that does not cast to BIGINT fails" . (/= DuckDBV2ErrorNone)
+        replace (show value) >>= (@?= DuckDBV2ErrorNone)
+        when (value == 13) (failOnPurpose "update")
+  bracket
+    (DuckDBV2CustomOptionUpdateCallbackFn <$> toFunPtr (DuckDBV2CustomOptionUpdateCallbackFn_Aux update))
+    (freeHaskellFunPtr . getField @"unwrap")
+    $ \updatePtr ->
+      withConnection $ \conn -> withFactory conn $ \factory -> do
+        withHandle (c_duckdb_v2_custom_option_create factory) c_duckdb_v2_custom_option_destroy $ \option -> do
+          withView "v2_guarded_option" $ \name -> checked (c_duckdb_v2_custom_option_set_name option (coerce name))
+          withHandle (c_duckdb_v2_value_create_bigint factory 1) c_duckdb_v2_value_destroy $ \value ->
+            checked (c_duckdb_v2_custom_option_set_default_value option value)
+          checked (c_duckdb_v2_custom_option_set_update_callback option updatePtr)
+          checked (c_duckdb_v2_connection_register_custom_option conn option)
+        let current = withResult conn "SELECT current_setting('v2_guarded_option')::BIGINT" readIntegers
+        withResult conn "SET v2_guarded_option = 12" consume
+        current >>= (@?= [Just 12])
+        expectCallbackFailure failures conn "SET v2_guarded_option = 13" "update"
+        current >>= (@?= [Just 12])
+  readIORef failures >>= (@?= [])
+
+-- | The signature rules that a registration checks. 'parametersWithout' breaks one rule for each of them.
+signatureRules :: [String]
+signatureRules = ["unique parameter names", "single *args", "single **kwargs", "defaults last", "*args without default", "**kwargs without default"]
+
+-- | The parameters of the scalar function in the registration test: a name, a kind, and whether the parameter has a default.
+parametersWithout :: String -> [(String, DuckDBV2FunctionParameterKind, Bool)]
+parametersWithout omitted = case omitted of
+  "unique parameter names" -> [("x", standard, False), ("x", standard, False)]
+  "single *args" -> [("x", standard, False), ("rest", variadic, False), ("more", variadic, False)]
+  "defaults last" -> [("x", standard, True), ("y", standard, False)]
+  "single **kwargs" -> [("x", standard, False), ("options", named, False), ("more", named, False)]
+  "*args without default" -> [("rest", variadic, True)]
+  "**kwargs without default" -> [("options", named, True)]
+  _ -> [("x", standard, False), ("y", standard, True), ("rest", variadic, False)]
+  where
+    standard = DuckDBV2FunctionParameterKindStandard
+    variadic = DuckDBV2FunctionParameterKindPositionalVariadic
+    named = DuckDBV2FunctionParameterKindNamedVariadic
+
+-- | Each registration leaves out one part that the header requires, or uses ANY where the header requires a concrete
+-- type. The last registration of each kind has every part. The test never calls the functions.
+testRegistrationFailures :: IO ()
+testRegistrationFailures = do
+  let execute _info _context _err = pure ()
+      cast _info _context _err = pure ()
+  bracket
+    (DuckDBV2ScalarFunctionExecCallbackFn <$> toFunPtr (DuckDBV2ScalarFunctionExecCallbackFn_Aux execute))
+    (freeHaskellFunPtr . getField @"unwrap")
+    $ \executePtr ->
+      bracket
+        (DuckDBV2CastFunctionExecCallbackFn <$> toFunPtr (DuckDBV2CastFunctionExecCallbackFn_Aux cast))
+        (freeHaskellFunPtr . getField @"unwrap")
+        $ \castPtr ->
+          withInstance $ \other -> withConnection $ \conn -> withFactory conn $ \factory -> withType factory "BIGINT" $ \ty ->
+            withHandle
+              (c_duckdb_v2_factory_create_type_from_id factory DuckDBV2LogicalTypeIdAny (coerce nullPtr) (coerce nullPtr) 0)
+              c_duckdb_v2_logical_type_destroy
+              $ \anyType -> do
+                -- The part "concrete type" replaces BIGINT with ANY. The part "own factory" creates the object through
+                -- the factory of another instance.
+                otherFactory <- output (c_duckdb_v2_instance_get_factory other)
+                let concrete omitted = if omitted == "concrete type" then anyType else ty
+                    creator omitted = if omitted == "own factory" then otherFactory else factory
+                eachPartRequired (["name", "exec callback", "return type", "concrete type", "own factory"] <> signatureRules) $ \omitted ->
+                  withHandle (c_duckdb_v2_value_create_bigint factory 1) c_duckdb_v2_value_destroy $ \one ->
+                    withHandle (c_duckdb_v2_scalar_function_create (creator omitted)) c_duckdb_v2_scalar_function_destroy $ \function -> do
+                      unless (omitted == "name") $ withView "v2_registered" $ \name -> checked (c_duckdb_v2_scalar_function_set_name function (coerce name))
+                      unless (omitted == "exec callback") $ checked (c_duckdb_v2_scalar_function_set_exec_callback function executePtr)
+                      signature <- output (c_duckdb_v2_scalar_function_get_signature function)
+                      unless (omitted == "return type") $ checked (c_duckdb_v2_function_signature_set_return_type signature (concrete omitted))
+                      forM_ (parametersWithout omitted) $ \(name, kind, defaulted) -> withView name $ \view ->
+                        checked (c_duckdb_v2_function_signature_add_parameter signature (coerce view) ty (if defaulted then one else coerce nullPtr) kind)
+                      c_duckdb_v2_connection_register_scalar_function conn function nullPtr
+                withView "v2_registered_type" $ \name -> do
+                  withHandle (c_duckdb_v2_factory_create_type_with_alias factory ty (coerce name)) c_duckdb_v2_logical_type_destroy $ \alias ->
+                    eachPartRequired ["source type", "target type", "exec callback", "concrete type", "own factory"] $ \omitted ->
+                      withHandle (c_duckdb_v2_cast_function_create (creator omitted)) c_duckdb_v2_cast_function_destroy $ \function -> do
+                        unless (omitted == "source type") $ checked (c_duckdb_v2_cast_function_set_source_type function (concrete omitted))
+                        unless (omitted == "target type") $ checked (c_duckdb_v2_cast_function_set_target_type function alias)
+                        unless (omitted == "exec callback") $ checked (c_duckdb_v2_cast_function_set_exec_callback function castPtr)
+                        c_duckdb_v2_connection_register_cast_function conn function nullPtr
+                  eachPartRequired ["name", "base type", "concrete type", "own factory"] $ \omitted ->
+                    withHandle (c_duckdb_v2_custom_type_create (creator omitted)) c_duckdb_v2_custom_type_destroy $ \custom -> do
+                      unless (omitted == "name") $ checked (c_duckdb_v2_custom_type_set_name custom (coerce name))
+                      unless (omitted == "base type") $ checked (c_duckdb_v2_custom_type_set_base_type custom (concrete omitted))
+                      c_duckdb_v2_connection_register_custom_type conn custom nullPtr
+                -- Registration casts the text of the default value to BIGINT. The part "default value that casts" gives a text that does not cast.
+                let option omitted = withHandle (c_duckdb_v2_custom_option_create (creator omitted)) c_duckdb_v2_custom_option_destroy $ \custom -> do
+                      unless (omitted == "name") $ withView "v2_registered_option" $ \name -> checked (c_duckdb_v2_custom_option_set_name custom (coerce name))
+                      unless (omitted == "type or default value") $ do
+                        checked (c_duckdb_v2_custom_option_set_type custom ty)
+                        withView (if omitted == "default value that casts" then "five" else "5") $ \text ->
+                          withHandle (c_duckdb_v2_value_create_varchar factory text) c_duckdb_v2_value_destroy $ \value ->
+                            checked (c_duckdb_v2_custom_option_set_default_value custom value)
+                      c_duckdb_v2_connection_register_custom_option conn custom nullPtr
+                eachPartRequired ["name", "type or default value", "default value that casts", "own factory"] option
+                option "" >>= assertBool "a second option with the same name fails" . (/= DuckDBV2ErrorNone)
+                withResult conn "SELECT current_setting('v2_registered_option')::BIGINT" $ \result -> readIntegers result >>= (@?= [Just 5])
+
+-- | A connection config rejects an unknown option, a SESSION write of the GLOBAL option threads and a write of the
+-- startup option allow_unsigned_extensions. An instance config has no SESSION scope.
+testConfigFailures :: IO ()
+testConfigFailures = withInstance $ \instanceHandle ->
+  withHandle (c_duckdb_v2_connection_create instanceHandle) c_duckdb_v2_connection_destroy $ \conn -> do
+    instanceConfig <- output (c_duckdb_v2_instance_get_config instanceHandle)
+    config <- output (c_duckdb_v2_connection_get_config conn)
+    let write target name setting scope = withView name $ \view -> withView setting $ \text ->
+          c_duckdb_v2_config_set_option_text target (coerce view) text scope nullPtr
+        rejected code = assertBool ("the write fails: " <> show code) (code /= DuckDBV2ErrorNone)
+    write config "threads" "2" DuckDBV2SettingScopeGlobal >>= (@?= DuckDBV2ErrorNone)
+    -- The header names ERROR_INPUT_INVALID for a scope that the option does not support. DuckDB reports a catalog
+    -- error, so the test checks only that the write fails.
+    write config "threads" "2" DuckDBV2SettingScopeSession >>= rejected
+    write instanceConfig "TimeZone" "UTC" DuckDBV2SettingScopeGlobal >>= (@?= DuckDBV2ErrorNone)
+    write instanceConfig "TimeZone" "UTC" DuckDBV2SettingScopeSession >>= (@?= DuckDBV2ErrorInputInvalid)
+    write config "v2_no_such_option" "2" DuckDBV2SettingScopeGlobal >>= rejected
+    write config "preserve_insertion_order" "true" DuckDBV2SettingScopeGlobal >>= (@?= DuckDBV2ErrorNone)
+    write config "allow_unsigned_extensions" "true" DuckDBV2SettingScopeGlobal >>= rejected
+    -- The write casts the value to the type of the option.
+    factory <- output (c_duckdb_v2_connection_get_factory conn)
+    let writeValue setting = withView "threads" $ \name -> withView setting $ \text ->
+          withHandle (c_duckdb_v2_value_create_varchar factory text) c_duckdb_v2_value_destroy $ \value ->
+            c_duckdb_v2_config_set_option_value config (coerce name) value DuckDBV2SettingScopeGlobal nullPtr
+    writeValue "3" >>= (@?= DuckDBV2ErrorNone)
+    writeValue "three" >>= rejected
+    readOption config "TimeZone" >>= (@?= ("UTC", DuckDBV2SettingScopeGlobal))
+    withView "v2_no_such_option" $ \name -> alloca $ \value -> alloca $ \scope -> do
+      poke value (coerce nullPtr)
+      code <- c_duckdb_v2_config_get_option_value config (coerce name) value scope nullPtr
+      c_duckdb_v2_value_destroy value >>= (@?= DuckDBV2ErrorNone)
+      code @?= DuckDBV2ErrorInputInvalid
diff --git a/test/V2ChunkTest.hs b/test/V2ChunkTest.hs
new file mode 100644
--- /dev/null
+++ b/test/V2ChunkTest.hs
@@ -0,0 +1,248 @@
+module V2ChunkTest (tests) where
+
+import Control.Exception (finally)
+import Control.Monad (forM, forM_, unless, void, zipWithM_)
+import Data.Coerce (coerce)
+import Data.Int (Int64)
+import Database.DuckDB.FFI.V2
+import Foreign.C.ConstPtr (ConstPtr (..))
+import Foreign.C.Types (CBool (..))
+import Foreign.Marshal.Alloc (alloca)
+import Foreign.Marshal.Array (withArray)
+import Foreign.Ptr (nullPtr)
+import Foreign.Storable (Storable (..))
+import Test.Tasty (TestTree, testGroup)
+import Test.Tasty.HUnit (assertBool, testCase, (@?=))
+import V2Test (checked, output, readView, withConnection, withFactory, withHandle, withType, withView)
+
+tests :: TestTree
+tests =
+  testGroup
+    "DuckDB V2 chunks and vectors"
+    [ testCase "chunk copies are flat and outlive their source" testChunkCopy
+    , testCase "cleared chunks are empty, flat and writable again" testChunkClear
+    , testCase "vectors report their representation and constant validity" testVectorType
+    , testCase "nested vectors report their child count" testChildCount
+    , testCase "referenced vectors alias the data of their source" testReference
+    , testCase "column data collections combine, reset and clear their rows" testCollection
+    , testCase "chunks, vectors and collections reject a bad index, a bad type and a bad representation" testChunkRejection
+    ]
+
+withChunk :: DuckDBV2FactoryHandle -> [DuckDBV2LogicalTypeHandle] -> (DuckDBV2DataChunkHandle -> IO a) -> IO a
+withChunk factory types action = withArray types $ \array ->
+  withHandle (c_duckdb_v2_data_chunk_create factory (ConstPtr array) (fromIntegral (length types))) c_duckdb_v2_data_chunk_destroy action
+
+vectorAt :: DuckDBV2DataChunkHandle -> Int -> IO DuckDBV2VectorHandle
+vectorAt chunk index = output (c_duckdb_v2_data_chunk_get_vector chunk (fromIntegral index))
+
+-- | Write the rows into a FLAT BIGINT vector and set its size.
+writeBigints :: DuckDBV2VectorHandle -> [Int64] -> IO ()
+writeBigints vector rows = do
+  raw <- output (c_duckdb_v2_vector_get_data_mutable vector)
+  zipWithM_ (pokeElemOff (coerce raw)) [0 ..] rows
+  checked (c_duckdb_v2_vector_set_size vector (fromIntegral (length rows)))
+
+-- | Read every row of a BIGINT vector of any representation.
+readBigints :: DuckDBV2VectorHandle -> IO [Int64]
+readBigints vector = do
+  size <- output (c_duckdb_v2_vector_get_size vector)
+  forM [0 .. fromIntegral size - 1 :: Int] $ \row ->
+    withHandle (c_duckdb_v2_vector_get_value vector (fromIntegral row)) c_duckdb_v2_value_destroy $ \value ->
+      output (c_duckdb_v2_value_get_bigint value)
+
+vectorType :: DuckDBV2VectorHandle -> IO DuckDBV2VectorType
+vectorType vector = output (c_duckdb_v2_vector_get_vector_type vector)
+
+testChunkCopy :: IO ()
+testChunkCopy = withConnection $ \conn -> withFactory conn $ \factory ->
+  withType factory "BIGINT" $ \integer -> withType factory "VARCHAR" $ \text -> alloca $ \copySlot -> do
+    poke copySlot (coerce nullPtr)
+    flip finally (c_duckdb_v2_data_chunk_destroy copySlot >>= (@?= DuckDBV2ErrorNone)) $ do
+      withChunk factory [integer, text] $ \source -> do
+        capacity <- output (c_duckdb_v2_data_chunk_get_capacity source)
+        assertBool "the chunk holds the rows that the test writes" (capacity >= 3)
+        constant <- vectorAt source 0
+        withHandle (c_duckdb_v2_value_create_bigint factory 7) c_duckdb_v2_value_destroy $ \value ->
+          checked (c_duckdb_v2_vector_make_constant constant value 3)
+        strings <- vectorAt source 1
+        checked (c_duckdb_v2_vector_set_size strings 3)
+        forM_ (zip [0 ..] ["a", "long enough to be stored outside the inline buffer", "c"]) $ \(row, string) ->
+          withView string $ \view -> withHandle (c_duckdb_v2_value_create_varchar factory view) c_duckdb_v2_value_destroy $ \value ->
+            checked (c_duckdb_v2_vector_set_value strings row value)
+        checked (c_duckdb_v2_data_chunk_copy factory source copySlot)
+        vectorType constant >>= (@?= DuckDBV2VectorTypeConstant)
+      -- The source chunk is destroyed now. The copy owns all of its data.
+      copy <- peek copySlot
+      output (c_duckdb_v2_data_chunk_get_size copy) >>= (@?= 3)
+      integers <- vectorAt copy 0
+      vectorType integers >>= (@?= DuckDBV2VectorTypeFlat)
+      readBigints integers >>= (@?= [7, 7, 7])
+      strings <- vectorAt copy 1
+      forM
+        [0 .. 2]
+        ( \row ->
+            withHandle
+              (c_duckdb_v2_vector_get_value strings row)
+              c_duckdb_v2_value_destroy
+              (\value -> output (c_duckdb_v2_value_get_varchar value) >>= readView)
+        )
+        >>= (@?= ["a", "long enough to be stored outside the inline buffer", "c"])
+
+testChunkClear :: IO ()
+testChunkClear = withConnection $ \conn -> withFactory conn $ \factory ->
+  withType factory "BIGINT" $ \integer -> withChunk factory [integer] $ \chunk -> do
+    vector <- vectorAt chunk 0
+    checked (c_duckdb_v2_vector_make_sequence vector 1 1 5)
+    output (c_duckdb_v2_data_chunk_get_size chunk) >>= (@?= 5)
+    checked (c_duckdb_v2_data_chunk_clear chunk)
+    output (c_duckdb_v2_data_chunk_get_size chunk) >>= (@?= 0)
+    vectorType vector >>= (@?= DuckDBV2VectorTypeFlat)
+    writeBigints vector [4, 5]
+    output (c_duckdb_v2_data_chunk_get_size chunk) >>= (@?= 2)
+    readBigints vector >>= (@?= [4, 5])
+
+testVectorType :: IO ()
+testVectorType = withConnection $ \conn -> withFactory conn $ \factory ->
+  withType factory "BIGINT" $ \integer -> withChunk factory [integer] $ \chunk -> do
+    vector <- vectorAt chunk 0
+    vectorType vector >>= (@?= DuckDBV2VectorTypeFlat)
+    checked (c_duckdb_v2_vector_make_sequence vector 10 2 3)
+    vectorType vector >>= (@?= DuckDBV2VectorTypeOther)
+    checked (c_duckdb_v2_vector_flatten vector)
+    vectorType vector >>= (@?= DuckDBV2VectorTypeFlat)
+    withHandle (c_duckdb_v2_value_create_bigint factory 7) c_duckdb_v2_value_destroy $ \value ->
+      checked (c_duckdb_v2_vector_make_constant vector value 3)
+    vectorType vector >>= (@?= DuckDBV2VectorTypeConstant)
+    let rowIsNull row = withHandle (c_duckdb_v2_vector_get_value vector row) c_duckdb_v2_value_destroy $ \value ->
+          (/= 0) <$> output (c_duckdb_v2_value_is_null value)
+    checked (c_duckdb_v2_vector_constant_set_valid vector (CBool 0))
+    forM [0 .. 2] rowIsNull >>= (@?= [True, True, True])
+    checked (c_duckdb_v2_vector_constant_set_valid vector (CBool 1))
+    readBigints vector >>= (@?= [7, 7, 7])
+
+testChildCount :: IO ()
+testChildCount = withConnection $ \conn -> withFactory conn $ \factory -> do
+  let kinds =
+        [ ("BIGINT", 0)
+        , ("VARCHAR", 0)
+        , ("INTEGER[]", 1)
+        , ("MAP(VARCHAR, INTEGER)", 1)
+        , ("INTEGER[3]", 1)
+        , ("STRUCT(a INTEGER, b VARCHAR, c DOUBLE)", 3)
+        , ("UNION(i INTEGER, s VARCHAR)", 3)
+        ]
+  forM_ kinds $ \(text, count) -> withType factory text $ \ty -> withChunk factory [ty] $ \chunk -> do
+    vector <- vectorAt chunk 0
+    output (c_duckdb_v2_vector_get_child_count vector) >>= (@?= count)
+
+testReference :: IO ()
+testReference = withConnection $ \conn -> withFactory conn $ \factory ->
+  withType factory "BIGINT" $ \integer -> withType factory "VARCHAR" $ \text ->
+    withChunk factory [integer, integer, text] $ \chunk -> do
+      target <- vectorAt chunk 0
+      source <- vectorAt chunk 1
+      writeBigints source [5, 6, 7]
+      checked (c_duckdb_v2_vector_reference target source)
+      readBigints target >>= (@?= [5, 6, 7])
+      -- No data moves, so a write through the source shows through the target.
+      raw <- output (c_duckdb_v2_vector_get_data_mutable source)
+      pokeElemOff (coerce raw) 1 (60 :: Int64)
+      readBigints target >>= (@?= [5, 60, 7])
+      strings <- vectorAt chunk 2
+      c_duckdb_v2_vector_reference target strings nullPtr >>= (@?= DuckDBV2ErrorInputInvalid)
+
+testCollection :: IO ()
+testCollection = withConnection $ \conn -> withFactory conn $ \factory -> withType factory "BIGINT" $ \integer -> withArray [integer] $ \types -> do
+  let create = c_duckdb_v2_column_data_collection_create factory (ConstPtr types) 1
+      rowCount collection = output (c_duckdb_v2_column_data_collection_row_count collection)
+      append collection rows = withChunk factory [integer] $ \chunk -> do
+        vectorAt chunk 0 >>= \vector -> writeBigints vector rows
+        withHandle (c_duckdb_v2_column_data_collection_append_state_create collection) c_duckdb_v2_column_data_collection_append_state_destroy $ \state ->
+          checked (c_duckdb_v2_column_data_collection_append collection state chunk)
+  withHandle create c_duckdb_v2_column_data_collection_destroy $ \target -> do
+    append target [1, 2, 3]
+    -- Combine consumes the source and sets its slot to null.
+    alloca $ \sourceSlot -> do
+      poke sourceSlot (coerce nullPtr)
+      checked (create sourceSlot)
+      let destroyLeft = peek sourceSlot >>= \left -> unless (left == coerce nullPtr) (void (c_duckdb_v2_column_data_collection_destroy sourceSlot))
+      flip finally destroyLeft $ do
+        source <- peek sourceSlot
+        append source [4, 5]
+        checked (c_duckdb_v2_column_data_collection_combine target sourceSlot)
+        peek sourceSlot >>= (@?= coerce nullPtr)
+    rowCount target >>= (@?= 5)
+    checked (c_duckdb_v2_column_data_collection_reset target)
+    rowCount target >>= (@?= 0)
+    append target [6, 7, 8]
+    rowCount target >>= (@?= 3)
+    checked (c_duckdb_v2_column_data_collection_clear target)
+    rowCount target >>= (@?= 0)
+    append target [9]
+    rowCount target >>= (@?= 1)
+
+-- | Check that a call fails. The header names no error code for it.
+failed :: DuckDBV2Error -> IO ()
+failed code = assertBool ("the call fails: " <> show code) (code /= DuckDBV2ErrorNone)
+
+testChunkRejection :: IO ()
+testChunkRejection = withConnection $ \conn -> withFactory conn $ \factory ->
+  withType factory "BIGINT" $ \integer -> withType factory "VARCHAR" $ \text -> do
+    withHandle
+      (c_duckdb_v2_factory_create_type_from_id factory DuckDBV2LogicalTypeIdAny (coerce nullPtr) (coerce nullPtr) 0)
+      c_duckdb_v2_logical_type_destroy
+      $ \anyType ->
+        withArray [anyType] $ \types -> alloca $ \out -> do
+          poke out (coerce nullPtr)
+          code <- c_duckdb_v2_data_chunk_create factory (ConstPtr types) 1 out nullPtr
+          c_duckdb_v2_data_chunk_destroy out >>= (@?= DuckDBV2ErrorNone)
+          failed code
+    withChunk factory [integer] $ \chunk -> do
+      vector <- vectorAt chunk 0
+      alloca $ \out -> c_duckdb_v2_data_chunk_get_vector chunk 1 out nullPtr >>= (@?= DuckDBV2ErrorInputInvalid)
+      -- A SEQUENCE vector has no data pointer until it is flat.
+      checked (c_duckdb_v2_vector_make_sequence vector 1 1 3)
+      alloca $ \out -> c_duckdb_v2_vector_get_data_mutable vector out nullPtr >>= (@?= DuckDBV2ErrorInputInvalid)
+      checked (c_duckdb_v2_vector_flatten vector)
+      _ <- output (c_duckdb_v2_vector_get_data_mutable vector)
+      -- The row index of a read and of a write is checked against the size 3.
+      withHandle (c_duckdb_v2_vector_get_value vector 2) c_duckdb_v2_value_destroy $ \value -> output (c_duckdb_v2_value_get_bigint value) >>= (@?= 3)
+      alloca $ \out -> do
+        poke out (coerce nullPtr)
+        code <- c_duckdb_v2_vector_get_value vector 3 out nullPtr
+        c_duckdb_v2_value_destroy out >>= (@?= DuckDBV2ErrorNone)
+        failed code
+      let write row setting = withView setting $ \view -> withHandle (c_duckdb_v2_value_create_varchar factory view) c_duckdb_v2_value_destroy $ \value ->
+            c_duckdb_v2_vector_set_value vector row value nullPtr
+      write 2 "30" >>= (@?= DuckDBV2ErrorNone)
+      write 3 "30" >>= failed
+      write 2 "thirty" >>= failed
+      readBigints vector >>= (@?= [1, 2, 30])
+      -- A constant vector takes a value of its own type only, and it is not row-addressable.
+      withHandle (c_duckdb_v2_value_create_bigint factory 7) c_duckdb_v2_value_destroy $ \value ->
+        checked (c_duckdb_v2_vector_make_constant vector value 3)
+      withView "7" $ \view -> withHandle (c_duckdb_v2_value_create_varchar factory view) c_duckdb_v2_value_destroy $ \value ->
+        c_duckdb_v2_vector_make_constant vector value 3 nullPtr >>= (@?= DuckDBV2ErrorInputInvalid)
+      write 0 "30" >>= failed
+      readBigints vector >>= (@?= [7, 7, 7])
+    withArray [integer] $ \types -> do
+      let create count = alloca $ \out -> do
+            poke out (coerce nullPtr)
+            code <- c_duckdb_v2_column_data_collection_create factory (ConstPtr types) count out nullPtr
+            c_duckdb_v2_column_data_collection_destroy out >>= (@?= DuckDBV2ErrorNone)
+            pure code
+      create 1 >>= (@?= DuckDBV2ErrorNone)
+      create 0 >>= (@?= DuckDBV2ErrorInputInvalid)
+      withHandle (c_duckdb_v2_column_data_collection_create factory (ConstPtr types) 1) c_duckdb_v2_column_data_collection_destroy $ \collection ->
+        withHandle (c_duckdb_v2_column_data_collection_append_state_create collection) c_duckdb_v2_column_data_collection_append_state_destroy $ \state -> do
+          let append ty = withChunk factory [ty] $ \chunk -> do
+                c_duckdb_v2_column_data_collection_append collection state chunk nullPtr
+          append integer >>= (@?= DuckDBV2ErrorNone)
+          append text >>= (@?= DuckDBV2ErrorInputInvalid)
+          -- Combine refuses a source with other column types and leaves the source alive.
+          withArray [text] $ \textTypes -> alloca $ \sourceSlot -> do
+            poke sourceSlot (coerce nullPtr)
+            flip finally (c_duckdb_v2_column_data_collection_destroy sourceSlot) $ do
+              checked (c_duckdb_v2_column_data_collection_create factory (ConstPtr textTypes) 1 sourceSlot)
+              c_duckdb_v2_column_data_collection_combine collection sourceSlot nullPtr >>= failed
+              peek sourceSlot >>= \source -> assertBool "the refused source stays alive" (source /= coerce nullPtr)
diff --git a/test/V2CopyTest.hs b/test/V2CopyTest.hs
new file mode 100644
--- /dev/null
+++ b/test/V2CopyTest.hs
@@ -0,0 +1,489 @@
+{-# LANGUAGE DataKinds #-}
+{-# LANGUAGE TypeApplications #-}
+
+module V2CopyTest (tests) where
+
+import Control.Exception (bracket, finally, onException)
+import Control.Monad (forM, forM_, unless, void, when)
+import Data.Char (toLower)
+import Data.Coerce (coerce)
+import Data.IORef (atomicModifyIORef', newIORef, readIORef, writeIORef)
+import Data.Int (Int32, Int64)
+import Data.List (elemIndex, isInfixOf, isSuffixOf, sort)
+import Data.Maybe (fromMaybe)
+import Database.DuckDB.FFI.V2
+import Foreign.C.String (withCString)
+import Foreign.C.Types (CBool (..))
+import Foreign.Marshal.Alloc (alloca, allocaBytes, free)
+import Foreign.Marshal.Array (mallocArray, pokeArray)
+import Foreign.Marshal.Utils (with)
+import Foreign.Ptr (Ptr, castPtr, freeHaskellFunPtr, nullFunPtr, nullPtr)
+import Foreign.Storable (Storable (..))
+import GHC.Records (getField)
+import HsBindgen.Runtime.Prelude (toFunPtr)
+import System.IO (hClose, openBinaryTempFile)
+import Test.Tasty (TestTree, testGroup)
+import Test.Tasty.HUnit (assertBool, assertEqual, assertFailure, testCase, (@?=))
+import V2Test (
+  borrowedOpaque,
+  callbackGuard,
+  checked,
+  consume,
+  failOnPurpose,
+  output,
+  readIntegers,
+  readView,
+  record,
+  removeTestFile,
+  statementError,
+  statementFails,
+  withConnection,
+  withFactory,
+  withHandle,
+  withResult,
+  withView,
+ )
+
+tests :: TestTree
+tests =
+  testGroup
+    "DuckDB V2 COPY functions"
+    [ testCase "COPY TO callbacks read the user data, the bind data, the init data and the statement" testCopyTo
+    , testCase "COPY FROM callbacks read the user data, the bind data, the global state and the statement" testCopyFrom
+    , testCase "a COPY callback that reports an error fails the statement, and registration refuses an incomplete function" testFailingCopy
+    ]
+
+-- | Read the name that a getter writes at an index.
+readName :: (DuckDBIdx -> Ptr DuckDBV2IdentifierT -> Ptr DuckDBV2ErrorInfoHandle -> IO DuckDBV2Error) -> DuckDBIdx -> IO String
+readName getName index = alloca $ \name -> do
+  checked (getName index name)
+  peek name >>= readView . coerce
+
+-- | Call a function that must fail. The function gets no error slot.
+expectFailure :: String -> (Ptr DuckDBV2ErrorInfoHandle -> IO DuckDBV2Error) -> IO ()
+expectFailure what call = do
+  code <- call nullPtr
+  assertBool (what <> " fails") (code /= DuckDBV2ErrorNone)
+
+-- | Check the columns of a COPY bind: amount BIGINT, then part INTEGER.
+expectColumns
+  :: (Ptr DuckDBIdx -> Ptr DuckDBV2ErrorInfoHandle -> IO DuckDBV2Error)
+  -> (DuckDBIdx -> Ptr DuckDBV2IdentifierT -> Ptr DuckDBV2ErrorInfoHandle -> IO DuckDBV2Error)
+  -> (DuckDBIdx -> Ptr DuckDBV2LogicalTypeHandle -> Ptr DuckDBV2ErrorInfoHandle -> IO DuckDBV2Error)
+  -> IO ()
+expectColumns getCount getName getType = do
+  output getCount >>= (@?= 2)
+  mapM (readName getName) [0, 1] >>= (@?= ["amount", "part"])
+  forM [0, 1] (\i -> withHandle (getType i) c_duckdb_v2_logical_type_destroy (output . c_duckdb_v2_logical_type_get_id))
+    >>= (@?= [DuckDBV2LogicalTypeIdBigInt, DuckDBV2LogicalTypeIdInteger])
+  alloca $ \name -> expectFailure "a column name after the last column" (getName 2 name)
+  alloca $ \slot -> do
+    poke slot (coerce nullPtr)
+    expectFailure "a column type after the last column" (getType 2 slot) `finally` c_duckdb_v2_logical_type_destroy slot
+
+-- | Check the options of a COPY bind. The statement gives tag 'x', pair (1, 'two') and flag, and the getters
+-- return them ordered by name. The function does not get the FORMAT option and the options of the engine.
+expectOptions
+  :: (Ptr DuckDBIdx -> Ptr DuckDBV2ErrorInfoHandle -> IO DuckDBV2Error)
+  -> (DuckDBIdx -> Ptr DuckDBV2IdentifierT -> Ptr DuckDBV2ErrorInfoHandle -> IO DuckDBV2Error)
+  -> (DuckDBIdx -> Ptr DuckDBV2ValueHandle -> Ptr DuckDBV2ErrorInfoHandle -> IO DuckDBV2Error)
+  -> IO ()
+expectOptions getCount getName getValue = do
+  output getCount >>= (@?= 3)
+  -- Option names are identifiers that match without case, so the test compares them in lower case.
+  mapM (fmap (map toLower) . readName getName) [0, 1, 2] >>= (@?= ["flag", "pair", "tag"])
+  let value index = withHandle (getValue index) c_duckdb_v2_value_destroy
+      text handle = output (c_duckdb_v2_value_get_varchar handle) >>= readView
+      childFails handle index = alloca $ \slot -> do
+        poke slot (coerce nullPtr)
+        (c_duckdb_v2_value_get_child handle index slot nullPtr >>= (@?= DuckDBV2ErrorInputInvalid)) `finally` c_duckdb_v2_value_destroy slot
+  -- A bare option is the BOOLEAN true.
+  value 0 (output . c_duckdb_v2_value_get_bool) >>= (@?= CBool 1)
+  -- A list is a tuple with one child for each element, in order. An index after the last child is rejected.
+  value 1 $ \pair -> do
+    output (c_duckdb_v2_value_get_child_count pair) >>= (@?= 2)
+    withHandle (c_duckdb_v2_value_get_child pair 0) c_duckdb_v2_value_destroy (output . c_duckdb_v2_value_get_bigint) >>= (@?= 1)
+    withHandle (c_duckdb_v2_value_get_child pair 1) c_duckdb_v2_value_destroy text >>= (@?= "two")
+    childFails pair 2
+  -- A VARCHAR has no children, so the index 0 is rejected.
+  value 2 $ \tag -> text tag >>= (@?= "x") >> childFails tag 0
+  alloca $ \name -> expectFailure "an option name after the last option" (getName 3 name)
+  alloca $ \slot -> do
+    poke slot (coerce nullPtr)
+    expectFailure "an option value after the last option" (getValue 3 slot) `finally` c_duckdb_v2_value_destroy slot
+
+-- | Get a path that does not exist yet: the name of a new temporary file, which the function removes.
+freshPath :: String -> IO String
+freshPath template = do
+  (path, handle) <- openBinaryTempFile "." template
+  hClose handle
+  withCString path $ \name -> removeTestFile name >>= (@?= 0)
+  pure path
+
+-- | Read the percentage of the query that runs on a connection.
+queryProgress :: DuckDBV2ConnectionHandle -> IO Double
+queryProgress conn = alloca $ \percentage -> alloca $ \processed -> alloca $ \total -> do
+  checked (c_duckdb_v2_connection_progress_get conn percentage processed total)
+  realToFrac <$> peek percentage
+
+testCopyTo :: IO ()
+testCopyTo = do
+  path <- freshPath "duckdb-v2-copy-to"
+  directory <- freshPath "duckdb-v2-copy-dir"
+  failures <- newIORef []
+  invoked <- newIORef []
+  boundPaths <- newIORef []
+  filePaths <- newIORef []
+  batchRows <- newIORef []
+  -- The user data, the bind data and the init data point to three different cells, so an accessor that returns
+  -- another one fails.
+  allocaBytes 1 $ \user -> allocaBytes 1 $ \bound -> allocaBytes 1 $ \file -> do
+    let note name = record invoked name
+        expectData getUser getBind = do
+          output getUser >>= (@?= user)
+          output getBind >>= (@?= bound)
+        expectFileData getUser getBind getInit = do
+          expectData getUser getBind
+          output getInit >>= (@?= file)
+        bind info _context err = callbackGuard failures err $ do
+          note "bind"
+          output (c_duckdb_v2_copy_to_bind_get_user_data info) >>= (@?= user)
+          output (c_duckdb_v2_copy_to_bind_get_file_path info) >>= readView >>= record boundPaths
+          expectColumns
+            (c_duckdb_v2_copy_to_bind_get_column_count info)
+            (c_duckdb_v2_copy_to_bind_get_column_name info)
+            (c_duckdb_v2_copy_to_bind_get_column_type info)
+          expectOptions
+            (c_duckdb_v2_copy_to_bind_get_option_count info)
+            (c_duckdb_v2_copy_to_bind_get_option_name info)
+            (c_duckdb_v2_copy_to_bind_get_option_value info)
+          with (borrowedOpaque bound) $ \opaque -> checked (c_duckdb_v2_copy_to_bind_set_bind_data info opaque)
+        batchSize info _context err = callbackGuard failures err $ do
+          -- The engine invokes this callback because the statements do not set BATCH_SIZE.
+          note "batch size"
+          expectData (c_duckdb_v2_copy_to_batch_size_get_user_data info) (c_duckdb_v2_copy_to_batch_size_get_bind_data info)
+          -- The target is larger than the input, so each file gets one batch.
+          checked (c_duckdb_v2_copy_to_batch_size_set_target info 100000)
+        initialize info _context err = callbackGuard failures err $ do
+          note "init"
+          expectData (c_duckdb_v2_copy_to_init_get_user_data info) (c_duckdb_v2_copy_to_init_get_bind_data info)
+          output (c_duckdb_v2_copy_to_init_get_file_path info) >>= readView >>= record filePaths
+          with (borrowedOpaque file) $ \opaque -> checked (c_duckdb_v2_copy_to_init_set_init_data info opaque)
+        batch info _context err = callbackGuard failures err $ do
+          note "batch"
+          expectFileData
+            (c_duckdb_v2_copy_to_batch_get_user_data info)
+            (c_duckdb_v2_copy_to_batch_get_bind_data info)
+            (c_duckdb_v2_copy_to_batch_get_init_data info)
+          withHandle (c_duckdb_v2_copy_to_batch_take_input info) c_duckdb_v2_column_data_collection_destroy $ \input ->
+            output (c_duckdb_v2_column_data_collection_row_count input) >>= record batchRows
+        flush info _context err = callbackGuard failures err $ do
+          note "flush"
+          expectFileData
+            (c_duckdb_v2_copy_to_flush_get_user_data info)
+            (c_duckdb_v2_copy_to_flush_get_bind_data info)
+            (c_duckdb_v2_copy_to_flush_get_init_data info)
+        finalize info _context err = callbackGuard failures err $ do
+          note "finalize"
+          expectFileData
+            (c_duckdb_v2_copy_to_finalize_get_user_data info)
+            (c_duckdb_v2_copy_to_finalize_get_bind_data info)
+            (c_duckdb_v2_copy_to_finalize_get_init_data info)
+        statistics info _context err = callbackGuard failures err $ do
+          note "statistics"
+          expectFileData
+            (c_duckdb_v2_copy_to_statistics_get_user_data info)
+            (c_duckdb_v2_copy_to_statistics_get_bind_data info)
+            (c_duckdb_v2_copy_to_statistics_get_init_data info)
+    bracket (DuckDBV2CopyToBindCallbackFn <$> toFunPtr (DuckDBV2CopyToBindCallbackFn_Aux bind)) (freeHaskellFunPtr . getField @"unwrap") $ \bindPtr ->
+      bracket
+        (DuckDBV2CopyToBatchSizeCallbackFn <$> toFunPtr (DuckDBV2CopyToBatchSizeCallbackFn_Aux batchSize))
+        (freeHaskellFunPtr . getField @"unwrap")
+        $ \batchSizePtr ->
+          bracket (DuckDBV2CopyToInitCallbackFn <$> toFunPtr (DuckDBV2CopyToInitCallbackFn_Aux initialize)) (freeHaskellFunPtr . getField @"unwrap") $ \initializePtr ->
+            bracket (DuckDBV2CopyToBatchCallbackFn <$> toFunPtr (DuckDBV2CopyToBatchCallbackFn_Aux batch)) (freeHaskellFunPtr . getField @"unwrap") $ \batchPtr ->
+              bracket (DuckDBV2CopyToFlushCallbackFn <$> toFunPtr (DuckDBV2CopyToFlushCallbackFn_Aux flush)) (freeHaskellFunPtr . getField @"unwrap") $ \flushPtr ->
+                bracket
+                  (DuckDBV2CopyToFinalizeCallbackFn <$> toFunPtr (DuckDBV2CopyToFinalizeCallbackFn_Aux finalize))
+                  (freeHaskellFunPtr . getField @"unwrap")
+                  $ \finalizePtr ->
+                    bracket
+                      (DuckDBV2CopyToStatisticsCallbackFn <$> toFunPtr (DuckDBV2CopyToStatisticsCallbackFn_Aux statistics))
+                      (freeHaskellFunPtr . getField @"unwrap")
+                      $ \statisticsPtr ->
+                        withConnection $ \conn -> withFactory conn $ \factory -> do
+                          withHandle (c_duckdb_v2_copy_function_create factory) c_duckdb_v2_copy_function_destroy $ \function -> do
+                            withView "v2_writer" $ \name -> checked (c_duckdb_v2_copy_function_set_name function (coerce name))
+                            -- The second extension replaces the first, and an extension with a leading dot is rejected.
+                            withView "first" $ \extension -> checked (c_duckdb_v2_copy_function_set_file_extension function extension)
+                            withView "v2out" $ \extension -> checked (c_duckdb_v2_copy_function_set_file_extension function extension)
+                            withView ".dotted" $ \extension -> expectFailure "an extension with a leading dot" (c_duckdb_v2_copy_function_set_file_extension function extension)
+                            with (borrowedOpaque user) $ \opaque -> checked (c_duckdb_v2_copy_function_set_user_data function opaque)
+                            checked (c_duckdb_v2_copy_to_set_bind_callback function bindPtr)
+                            checked (c_duckdb_v2_copy_to_set_batch_size_callback function batchSizePtr)
+                            checked (c_duckdb_v2_copy_to_set_init_callback function initializePtr)
+                            checked (c_duckdb_v2_copy_to_set_batch_callback function batchPtr)
+                            checked (c_duckdb_v2_copy_to_set_flush_callback function flushPtr)
+                            checked (c_duckdb_v2_copy_to_set_finalize_callback function finalizePtr)
+                            checked (c_duckdb_v2_copy_to_set_statistics_callback function statisticsPtr)
+                            checked (c_duckdb_v2_connection_register_copy_function conn function)
+                          -- One thread writes, so each statement writes one file, and the order of the callbacks is fixed.
+                          withResult conn "SET threads = 1" consume
+                          let source = "COPY (SELECT i::BIGINT AS amount, i::INTEGER AS part FROM range(5000) t(i)) TO '"
+                              options = "' (FORMAT v2_writer, tag 'x', pair (1, 'two'), flag, "
+                              -- Run a statement and give the callbacks that it invoked, in order.
+                              run sql = do
+                                writeIORef invoked []
+                                withResult conn sql consume
+                                reverse <$> readIORef invoked
+                          -- RETURN_STATS invokes the statistics callback after the finalize callback.
+                          run (source <> path <> options <> "USE_TMP_FILE FALSE, RETURN_STATS)")
+                            >>= (@?= ["bind", "batch size", "init", "batch", "flush", "finalize", "statistics"])
+                          -- DuckDB names the files of PER_THREAD_OUTPUT itself, with the extension of the function.
+                          -- The statement does not ask for statistics.
+                          writeIORef filePaths []
+                          flip finally (withCString directory (void . removeTestFile)) $
+                            run (source <> directory <> options <> "PER_THREAD_OUTPUT)")
+                              >>= (@?= ["bind", "batch size", "init", "batch", "flush", "finalize"])
+                          readIORef filePaths >>= \paths ->
+                            assertBool ("each file name has the extension of the function: " <> show paths) (not (null paths) && all (".v2out" `isSuffixOf`) paths)
+                          -- The function has no COPY FROM side, so a COPY FROM statement fails.
+                          withResult conn "CREATE TABLE v2_sink (amount BIGINT, part INTEGER)" consume
+                          statementFails conn "COPY v2_sink FROM 'v2-absent.probe' (FORMAT v2_writer)"
+  readIORef failures >>= (@?= [])
+  reverse <$> readIORef boundPaths >>= (@?= [path, directory])
+  readIORef batchRows >>= (@?= [5000, 5000])
+
+testCopyFrom :: IO ()
+testCopyFrom = do
+  failures <- newIORef []
+  invoked <- newIORef []
+  boundPaths <- newIORef []
+  rows <- newIORef (0 :: Int64)
+  -- The progress callback records how many rows the read has given at each call.
+  progressAt <- newIORef []
+  -- The exec callback records the progress of the query on the connection, which the test opens later.
+  connection <- newIORef Nothing
+  percentages <- newIORef []
+  -- The user data, the bind data and the global state point to three different cells, so an accessor that
+  -- returns another one fails.
+  allocaBytes 1 $ \user -> allocaBytes 1 $ \bound -> allocaBytes 1 $ \global -> do
+    let note name = record invoked name
+        expectData getUser getBind = do
+          output getUser >>= (@?= user)
+          output getBind >>= (@?= bound)
+        bind info _context err = callbackGuard failures err $ do
+          note "bind"
+          output (c_duckdb_v2_copy_from_bind_get_user_data info) >>= (@?= user)
+          output (c_duckdb_v2_copy_from_bind_get_file_path info) >>= readView >>= record boundPaths
+          expectColumns
+            (c_duckdb_v2_copy_from_bind_get_column_count info)
+            (c_duckdb_v2_copy_from_bind_get_column_name info)
+            (c_duckdb_v2_copy_from_bind_get_column_type info)
+          expectOptions
+            (c_duckdb_v2_copy_from_bind_get_option_count info)
+            (c_duckdb_v2_copy_from_bind_get_option_name info)
+            (c_duckdb_v2_copy_from_bind_get_option_value info)
+          with (borrowedOpaque bound) $ \opaque -> checked (c_duckdb_v2_copy_from_bind_set_bind_data info opaque)
+        initGlobal info _context err = callbackGuard failures err $ do
+          note "init global"
+          expectData (c_duckdb_v2_copy_from_init_global_get_user_data info) (c_duckdb_v2_copy_from_init_global_get_bind_data info)
+          with (borrowedOpaque global) $ \opaque -> checked (c_duckdb_v2_copy_from_init_global_set_global_state info opaque)
+        initLocal info _context err = callbackGuard failures err $ do
+          note "init local"
+          expectData (c_duckdb_v2_copy_from_init_local_get_user_data info) (c_duckdb_v2_copy_from_init_local_get_bind_data info)
+          output (c_duckdb_v2_copy_from_init_local_get_global_state info) >>= (@?= global)
+        progress info _context err = callbackGuard failures err $ do
+          given <- readIORef rows
+          record progressAt given
+          expectData (c_duckdb_v2_copy_from_progress_get_user_data info) (c_duckdb_v2_copy_from_progress_get_bind_data info)
+          output (c_duckdb_v2_copy_from_progress_get_global_state info) >>= (@?= global)
+          -- The callback reports progress only after the read has given a row. Before that, the read has no progress.
+          when (given > 0) $ checked (c_duckdb_v2_copy_from_progress_set_progress info 0.5)
+        -- The read gives one row for each call until the progress callback runs after the first row. Then the read ends.
+        execute info _context err = callbackGuard failures err $ do
+          note "exec"
+          expectData (c_duckdb_v2_copy_from_exec_get_user_data info) (c_duckdb_v2_copy_from_exec_get_bind_data info)
+          readIORef connection >>= mapM_ (\conn -> queryProgress conn >>= record percentages)
+          reported <- any (> 0) <$> readIORef progressAt
+          given <- readIORef rows
+          when (given >= 1000) $ assertFailure "the progress callback did not run during 1000 rows of the read"
+          unless reported $ do
+            chunk <- output (c_duckdb_v2_copy_from_exec_get_output_chunk info)
+            amounts <- output (c_duckdb_v2_data_chunk_get_vector chunk 0)
+            parts <- output (c_duckdb_v2_data_chunk_get_vector chunk 1)
+            output (c_duckdb_v2_vector_get_data_mutable amounts) >>= \raw -> poke (coerce raw) given
+            output (c_duckdb_v2_vector_get_data_mutable parts) >>= \raw -> poke (coerce raw) (fromIntegral given :: Int32)
+            checked (c_duckdb_v2_vector_set_size amounts 1)
+            writeIORef rows (given + 1)
+    bracket (DuckDBV2CopyFromBindCallbackFn <$> toFunPtr (DuckDBV2CopyFromBindCallbackFn_Aux bind)) (freeHaskellFunPtr . getField @"unwrap") $ \bindPtr ->
+      bracket
+        (DuckDBV2CopyFromInitGlobalCallbackFn <$> toFunPtr (DuckDBV2CopyFromInitGlobalCallbackFn_Aux initGlobal))
+        (freeHaskellFunPtr . getField @"unwrap")
+        $ \initGlobalPtr ->
+          bracket
+            (DuckDBV2CopyFromInitLocalCallbackFn <$> toFunPtr (DuckDBV2CopyFromInitLocalCallbackFn_Aux initLocal))
+            (freeHaskellFunPtr . getField @"unwrap")
+            $ \initLocalPtr ->
+              bracket (DuckDBV2CopyFromExecCallbackFn <$> toFunPtr (DuckDBV2CopyFromExecCallbackFn_Aux execute)) (freeHaskellFunPtr . getField @"unwrap") $ \executePtr ->
+                bracket
+                  (DuckDBV2CopyFromProgressCallbackFn <$> toFunPtr (DuckDBV2CopyFromProgressCallbackFn_Aux progress))
+                  (freeHaskellFunPtr . getField @"unwrap")
+                  $ \progressPtr ->
+                    withConnection $ \conn -> withFactory conn $ \factory -> do
+                      withHandle (c_duckdb_v2_copy_function_create factory) c_duckdb_v2_copy_function_destroy $ \function -> do
+                        withView "v2_reader" $ \name -> checked (c_duckdb_v2_copy_function_set_name function (coerce name))
+                        with (borrowedOpaque user) $ \opaque -> checked (c_duckdb_v2_copy_function_set_user_data function opaque)
+                        checked (c_duckdb_v2_copy_from_set_bind_callback function bindPtr)
+                        checked (c_duckdb_v2_copy_from_set_init_global_callback function initGlobalPtr)
+                        checked (c_duckdb_v2_copy_from_set_init_local_callback function initLocalPtr)
+                        checked (c_duckdb_v2_copy_from_set_exec_callback function executePtr)
+                        checked (c_duckdb_v2_copy_from_set_progress_callback function progressPtr)
+                        checked (c_duckdb_v2_connection_register_copy_function conn function)
+                      writeIORef connection (Just conn)
+                      withResult conn "CREATE TABLE v2_target (amount BIGINT, part INTEGER)" consume
+                      -- The engine asks for progress only with the progress bar on. The thread that steps the result asks
+                      -- after each partial execution of a task. With one thread, that thread also runs the read, so it
+                      -- asks while the read runs.
+                      withResult conn "SET threads = 1" consume
+                      withResult conn "SET enable_progress_bar = true" consume
+                      withResult conn "SET enable_progress_bar_print = false" consume
+                      -- The engine does not expand the glob and does not look for the file.
+                      withResult conn "COPY v2_target FROM 'v2-absent/*.probe' (FORMAT v2_reader, tag 'x', pair (1, 'two'), flag)" $ \result -> do
+                        inserted <- readIntegers result
+                        readIORef rows >>= \given -> inserted @?= [Just given]
+                      -- The function has no COPY TO side, so a COPY TO statement fails.
+                      path <- freshPath "duckdb-v2-copy-from-only"
+                      statementFails conn ("COPY v2_target TO '" <> path <> "' (FORMAT v2_reader)")
+  readIORef failures >>= (@?= [])
+  readIORef boundPaths >>= (@?= ["v2-absent/*.probe"])
+  given <- readIORef rows
+  -- One thread reads, so the exec callback runs once for each row and once more for the empty batch at the end.
+  reverse <$> readIORef invoked >>= (@?= ["bind", "init global", "init local"] <> replicate (fromIntegral given + 1) "exec")
+  readIORef progressAt >>= \seen -> assertBool ("the progress callback ran after the read gave rows: " <> show seen) (any (> 0) seen)
+  -- The query shows no progress before the read reports progress, and shows progress after the read reports 0.5.
+  reverse <$> readIORef percentages >>= \seen ->
+    assertBool
+      ("the query progress follows the reported progress: " <> show seen)
+      (not (null seen) && all (<= 0) (take 1 seen) && all (> 0) (take 1 (reverse seen)))
+
+-- | The phases of v2_failing_copy, in the order of the index that its states hold.
+copyPhases :: [String]
+copyPhases = ["none", "bind", "target", "batch", "flush", "exec"]
+
+-- | The option fail of a statement names the callback of v2_failing_copy that reports an error: bind (the bind
+-- callback of either side), batch, flush or exec. With target, the batch size callback sets the target 0. With none, no
+-- callback fails. The bind data and the batch data hold their kind (1 or 2) and the index of the phase. Their destructor
+-- records the kind, so the test sees which states DuckDB destroyed.
+testFailingCopy :: IO ()
+testFailingCopy = do
+  path <- freshPath "duckdb-v2-copy-failing"
+  failures <- newIORef []
+  destroyed <- newIORef []
+  let destroy ptr = peek (castPtr ptr :: Ptr Int64) >>= record destroyed >> free ptr
+  bracket (DuckDBV2OpaqueDestroyFn <$> toFunPtr (DuckDBV2OpaqueDestroyFn_Aux destroy)) (freeHaskellFunPtr . getField @"unwrap") $ \destroyPtr -> do
+    let -- Give DuckDB cells that hold the kind and the phase index, with the destructor that records the kind.
+        own kind phase setter = do
+          cells <- mallocArray 2
+          pokeArray cells [kind, fromIntegral (fromMaybe (-1) (elemIndex phase copyPhases)) :: Int64]
+          with (DuckDBV2Opaque (castPtr cells) destroyPtr (DuckDBV2OpaqueEqualsFn nullFunPtr)) (checked . setter) `onException` free cells
+        phaseOf state = (copyPhases !!) . fromIntegral <$> peekElemOff (castPtr state :: Ptr Int64) 1
+        failIn phase name = when (phase == name) $ failOnPurpose name
+        -- Read the phase from the option fail and set it as the bind data. The bind data exists before the
+        -- callback fails, so DuckDB owns the bind data and must destroy it.
+        bindPhase getName getValue setBindData = do
+          readName getName 0 >>= (@?= "fail")
+          phase <- withHandle (getValue 0) c_duckdb_v2_value_destroy (\value -> output (c_duckdb_v2_value_get_varchar value) >>= readView)
+          own 1 phase setBindData
+          failIn phase "bind"
+        toBind info _context err =
+          callbackGuard failures err $
+            bindPhase
+              (c_duckdb_v2_copy_to_bind_get_option_name info)
+              (c_duckdb_v2_copy_to_bind_get_option_value info)
+              (c_duckdb_v2_copy_to_bind_set_bind_data info)
+        batchSize info _context err = callbackGuard failures err $ do
+          phase <- output (c_duckdb_v2_copy_to_batch_size_get_bind_data info) >>= phaseOf
+          when (phase == "target") $ checked (c_duckdb_v2_copy_to_batch_size_set_target info 0)
+        batch info _context err = callbackGuard failures err $ do
+          phase <- output (c_duckdb_v2_copy_to_batch_get_bind_data info) >>= phaseOf
+          own 2 phase (c_duckdb_v2_copy_to_batch_set_batch_data info)
+          failIn phase "batch"
+        flush info _context err =
+          callbackGuard failures err $
+            output (c_duckdb_v2_copy_to_flush_get_bind_data info) >>= phaseOf >>= (`failIn` "flush")
+        fromBind info _context err =
+          callbackGuard failures err $
+            bindPhase
+              (c_duckdb_v2_copy_from_bind_get_option_name info)
+              (c_duckdb_v2_copy_from_bind_get_option_value info)
+              (c_duckdb_v2_copy_from_bind_set_bind_data info)
+        -- The output chunk stays empty, so the read ends after the first call.
+        execute info _context err =
+          callbackGuard failures err $
+            output (c_duckdb_v2_copy_from_exec_get_bind_data info) >>= phaseOf >>= (`failIn` "exec")
+    bracket (DuckDBV2CopyToBindCallbackFn <$> toFunPtr (DuckDBV2CopyToBindCallbackFn_Aux toBind)) (freeHaskellFunPtr . getField @"unwrap") $ \toBindPtr ->
+      bracket
+        (DuckDBV2CopyToBatchSizeCallbackFn <$> toFunPtr (DuckDBV2CopyToBatchSizeCallbackFn_Aux batchSize))
+        (freeHaskellFunPtr . getField @"unwrap")
+        $ \batchSizePtr ->
+          bracket (DuckDBV2CopyToBatchCallbackFn <$> toFunPtr (DuckDBV2CopyToBatchCallbackFn_Aux batch)) (freeHaskellFunPtr . getField @"unwrap") $ \batchPtr ->
+            bracket (DuckDBV2CopyToFlushCallbackFn <$> toFunPtr (DuckDBV2CopyToFlushCallbackFn_Aux flush)) (freeHaskellFunPtr . getField @"unwrap") $ \flushPtr ->
+              bracket (DuckDBV2CopyFromBindCallbackFn <$> toFunPtr (DuckDBV2CopyFromBindCallbackFn_Aux fromBind)) (freeHaskellFunPtr . getField @"unwrap") $ \fromBindPtr ->
+                bracket (DuckDBV2CopyFromExecCallbackFn <$> toFunPtr (DuckDBV2CopyFromExecCallbackFn_Aux execute)) (freeHaskellFunPtr . getField @"unwrap") $ \executePtr ->
+                  withConnection $ \conn -> withConnection $ \other -> do
+                    -- Register the function with both sides, with the change applied.
+                    let register change = withFactory (if change == "another database" then other else conn) $ \factory ->
+                          withHandle (c_duckdb_v2_copy_function_create factory) c_duckdb_v2_copy_function_destroy $ \function -> do
+                            unless (change == "no name") $ withView "v2_failing_copy" $ \name -> checked (c_duckdb_v2_copy_function_set_name function (coerce name))
+                            unless (change == "no side") $ do
+                              checked (c_duckdb_v2_copy_to_set_bind_callback function toBindPtr)
+                              checked (c_duckdb_v2_copy_to_set_batch_size_callback function batchSizePtr)
+                              unless (change == "no batch callback") $ checked (c_duckdb_v2_copy_to_set_batch_callback function batchPtr)
+                              unless (change == "no flush callback") $ checked (c_duckdb_v2_copy_to_set_flush_callback function flushPtr)
+                              unless (change == "no bind callback") $ checked (c_duckdb_v2_copy_from_set_bind_callback function fromBindPtr)
+                              unless (change == "no exec callback") $ checked (c_duckdb_v2_copy_from_set_exec_callback function executePtr)
+                            c_duckdb_v2_connection_register_copy_function conn function nullPtr
+                    forM_ ["no name", "no side", "no batch callback", "no flush callback", "no bind callback", "no exec callback", "another database"] $ \change ->
+                      register change >>= \code -> assertBool ("registration refuses a copy function with " <> change <> ": " <> show code) (code /= DuckDBV2ErrorNone)
+                    register "" >>= (@?= DuckDBV2ErrorNone)
+                    -- One thread writes and reads, so each callback runs once for each statement.
+                    withResult conn "SET threads = 1" consume
+                    withResult conn "CREATE TABLE v2_target (amount BIGINT)" consume
+                    let copyTo phase options =
+                          "COPY (SELECT i::BIGINT AS amount FROM range(3) t(i)) TO '"
+                            <> path
+                            <> "' (FORMAT v2_failing_copy, USE_TMP_FILE FALSE, fail '"
+                            <> phase
+                            <> "'"
+                            <> options
+                            <> ")"
+                        copyFrom phase = "COPY v2_target FROM 'v2-absent/*.probe' (FORMAT v2_failing_copy, fail '" <> phase <> "')"
+                        -- Return the kinds of the states that DuckDB destroyed since the last call.
+                        takeDestroyed = sort <$> atomicModifyIORef' destroyed (\kinds -> ([], kinds))
+                        succeeds = do
+                          withResult conn (copyTo "none" "") readIntegers >>= (@?= [Just 3])
+                          takeDestroyed >>= (@?= [1, 2])
+                          withResult conn (copyFrom "none") readIntegers >>= (@?= [Just 0])
+                          takeDestroyed >>= (@?= [1])
+                        -- The statement fails with the text of each recorded failure, and DuckDB destroyed the states of the
+                        -- given kinds. Then the statements without a failure succeed on the same connection.
+                        -- The header names no code for these failures, so the test checks only that the statement fails.
+                        fails sql recorded kinds = do
+                          (code, text) <- statementError conn sql
+                          assertBool (sql <> " fails") (code /= DuckDBV2ErrorNone)
+                          forM_ recorded $ \failure -> assertBool ("the error contains the text of the callback: " <> text) (failure `isInfixOf` text)
+                          atomicModifyIORef' failures (\seen -> ([], seen)) >>= (@?= map (\failure -> "user error (" <> failure <> ")") recorded)
+                          takeDestroyed >>= assertEqual ("the destroyed states after " <> sql) kinds
+                          succeeds
+                    succeeds
+                    fails (copyTo "bind" "") ["v2 deliberate bind failure"] [1]
+                    fails (copyTo "target" "") [] [1]
+                    fails (copyTo "batch" "") ["v2 deliberate batch failure"] [1, 2]
+                    fails (copyTo "flush" "") ["v2 deliberate flush failure"] [1, 2]
+                    fails (copyFrom "bind") ["v2 deliberate bind failure"] [1]
+                    fails (copyFrom "exec") ["v2 deliberate exec failure"] [1]
+                    -- The function has no statistics callback, so it rejects RETURN_STATS. DuckDB rejects the option
+                    -- before it calls the bind callback, so no state exists.
+                    fails (copyTo "none" ", RETURN_STATS") [] []
+  readIORef failures >>= (@?= [])
diff --git a/test/V2FileSystemTest.hs b/test/V2FileSystemTest.hs
new file mode 100644
--- /dev/null
+++ b/test/V2FileSystemTest.hs
@@ -0,0 +1,98 @@
+module V2FileSystemTest (tests) where
+
+import Control.Exception (bracket, finally)
+import Control.Monad (forM_)
+import Data.Coerce (coerce)
+import Database.DuckDB.FFI.V2
+import Foreign.C.String (peekCStringLen, withCString)
+import Foreign.Marshal.Alloc (alloca, allocaBytes)
+import Foreign.Ptr (nullPtr)
+import Foreign.Storable (poke)
+import System.IO (hClose, hPutStr, openBinaryTempFile)
+import Test.Tasty (TestTree, testGroup)
+import Test.Tasty.HUnit (assertBool, testCase, (@?=))
+import V2Test (checked, output, removeTestFile, withHandle, withInstance, withView)
+
+tests :: TestTree
+tests =
+  testGroup
+    "DuckDB V2 file system"
+    [ testCase "the instance file system opens files with options that carry values" testInstanceFileSystem
+    , testCase "a file does not open without flags, when it is missing or when exclusive create finds it, and a short read fails" testFileFailures
+    ]
+
+testInstanceFileSystem :: IO ()
+testInstanceFileSystem =
+  bracket
+    ( do
+        (path, handle) <- openBinaryTempFile "." "duckdb-v2-instance"
+        hPutStr handle contents
+        hClose handle
+        pure path
+    )
+    (\path -> withCString path $ \name -> removeTestFile name >>= (@?= 0))
+    ( \path -> withInstance $ \instanceHandle -> do
+        fileSystem <- output (c_duckdb_v2_instance_get_file_system instanceHandle)
+        assertBool "the file system is non-null" (fileSystem /= coerce nullPtr)
+        factory <- output (c_duckdb_v2_instance_get_factory instanceHandle)
+        withHandle (c_duckdb_v2_file_open_options_create fileSystem) c_duckdb_v2_file_open_options_destroy $ \options -> do
+          checked (c_duckdb_v2_file_open_options_set_flag options DuckDBV2FileFlagRead)
+          -- The options copy each value, so the test destroys the value at once. The test sets the same name twice.
+          forM_ [1, 2] $ \hint -> withView "v2_unknown_hint" $ \name ->
+            withHandle (c_duckdb_v2_value_create_bigint factory hint) c_duckdb_v2_value_destroy $ \value ->
+              checked (c_duckdb_v2_file_open_options_set_value options name value)
+          -- A file system ignores a value that it does not recognise.
+          withView path $ \name ->
+            withHandle (c_duckdb_v2_file_system_open fileSystem name options) c_duckdb_v2_file_destroy $ \file -> do
+              output (c_duckdb_v2_file_size file) >>= (@?= fromIntegral (length contents))
+              allocaBytes (length contents) $ \buffer -> do
+                checked (c_duckdb_v2_file_read_at file buffer (fromIntegral (length contents)) 0)
+                peekCStringLen (coerce buffer, length contents) >>= (@?= contents)
+    )
+  where
+    contents = "read through the instance"
+
+-- | Check that a call fails. The header names no error code for it.
+failed :: DuckDBV2Error -> IO ()
+failed code = assertBool ("the call fails: " <> show code) (code /= DuckDBV2ErrorNone)
+
+testFileFailures :: IO ()
+testFileFailures =
+  bracket
+    ( do
+        (path, handle) <- openBinaryTempFile "." "duckdb-v2-failures"
+        hPutStr handle contents
+        hClose handle
+        pure path
+    )
+    (\path -> withCString path $ \name -> removeTestFile name >>= (@?= 0))
+    ( \path -> withInstance $ \instanceHandle -> do
+        fileSystem <- output (c_duckdb_v2_instance_get_file_system instanceHandle)
+        let withOptions flags action = withHandle (c_duckdb_v2_file_open_options_create fileSystem) c_duckdb_v2_file_open_options_destroy $ \options -> do
+              forM_ flags $ \flag -> checked (c_duckdb_v2_file_open_options_set_flag options flag)
+              action options
+            open name options = withView name $ \view -> alloca $ \out -> do
+              poke out (coerce nullPtr)
+              code <- c_duckdb_v2_file_system_open fileSystem view options out nullPtr
+              c_duckdb_v2_file_destroy out >>= (@?= DuckDBV2ErrorNone)
+              pure code
+        withOptions [] $ \options -> do
+          c_duckdb_v2_file_open_options_set_flag options DuckDBV2FileFlagInvalid nullPtr >>= failed
+          c_duckdb_v2_file_open_options_set_flag options (DuckDBV2FileFlag 99) nullPtr >>= failed
+          -- The options refused both values, so they still carry no flag.
+          open path options >>= failed
+          checked (c_duckdb_v2_file_open_options_set_flag options DuckDBV2FileFlagRead)
+          open path options >>= (@?= DuckDBV2ErrorNone)
+          open (path <> ".absent") options >>= failed
+        withOptions [DuckDBV2FileFlagWrite, DuckDBV2FileFlagCreate, DuckDBV2FileFlagExclusiveCreate] $ \options -> do
+          open path options >>= failed
+          let created = path <> ".created"
+          (open created options >>= (@?= DuckDBV2ErrorNone)) `finally` withCString created removeTestFile
+        withOptions [DuckDBV2FileFlagRead] $ \options -> withView path $ \name ->
+          withHandle (c_duckdb_v2_file_system_open fileSystem name options) c_duckdb_v2_file_destroy $ \file ->
+            allocaBytes (length contents + 1) $ \buffer -> do
+              checked (c_duckdb_v2_file_read_at file buffer (fromIntegral (length contents)) 0)
+              c_duckdb_v2_file_read_at file buffer (fromIntegral (length contents + 1)) 0 nullPtr >>= failed
+    )
+  where
+    contents = "a short file"
diff --git a/test/V2FunctionDocsTest.hs b/test/V2FunctionDocsTest.hs
new file mode 100644
--- /dev/null
+++ b/test/V2FunctionDocsTest.hs
@@ -0,0 +1,25 @@
+module V2FunctionDocsTest (tests) where
+
+import Database.DuckDB.FFI.V2
+import Test.Tasty (TestTree, testGroup)
+import Test.Tasty.HUnit (testCase)
+import V2Test (fillDocs, output, withConnection, withFactory, withHandle)
+
+tests :: TestTree
+tests =
+  testGroup
+    "DuckDB V2 function documentation"
+    [ testCase "aggregate, table and macro functions lend documentation to fill in" testDocs
+    ]
+
+-- | Only an extension can register a macro, and a registered table function needs callbacks.
+-- Thus this test does not read the documentation back from the catalog.
+-- V2AggregateTest reads the documentation of a registered aggregate function back from the catalog.
+testDocs :: IO ()
+testDocs = withConnection $ \conn -> withFactory conn $ \factory -> do
+  withHandle (c_duckdb_v2_aggregate_function_create factory) c_duckdb_v2_aggregate_function_destroy $ \function ->
+    output (c_duckdb_v2_aggregate_function_get_docs function) >>= fillDocs
+  withHandle (c_duckdb_v2_table_function_create factory) c_duckdb_v2_table_function_destroy $ \function ->
+    output (c_duckdb_v2_table_function_get_docs function) >>= fillDocs
+  withHandle (c_duckdb_v2_macro_function_create factory DuckDBV2MacroFunctionTypeScalar) c_duckdb_v2_macro_function_destroy $ \function ->
+    output (c_duckdb_v2_macro_function_get_docs function) >>= fillDocs
diff --git a/test/V2MacroTest.hs b/test/V2MacroTest.hs
new file mode 100644
--- /dev/null
+++ b/test/V2MacroTest.hs
@@ -0,0 +1,44 @@
+module V2MacroTest (tests) where
+
+import Control.Exception (finally)
+import Control.Monad (forM_)
+import Data.Coerce (coerce)
+import Database.DuckDB.FFI.V2
+import Foreign.C.ConstPtr (ConstPtr (..))
+import Foreign.Marshal.Alloc (alloca)
+import Foreign.Ptr (nullPtr)
+import Foreign.Storable (Storable (..))
+import Test.Tasty (TestTree, testGroup)
+import Test.Tasty.HUnit (assertBool, testCase, (@?=))
+import V2Test (checked, output, withInstance, withType, withView)
+
+tests :: TestTree
+tests =
+  testGroup
+    "DuckDB V2 macro functions"
+    [ testCase "scalar and table macros take a name, a body and parameters, and destruction clears the handle" testMacroObjects
+    ]
+
+-- | Only an extension can register a macro. Thus this test cannot read the name, the body or the parameters back
+-- from the catalog.
+testMacroObjects :: IO ()
+testMacroObjects = withInstance $ \instanceHandle -> do
+  factory <- output (c_duckdb_v2_instance_get_factory instanceHandle)
+  forM_ [(DuckDBV2MacroFunctionTypeScalar, "x + 1"), (DuckDBV2MacroFunctionTypeTable, "SELECT x AS y")] $ \(kind, body) -> alloca $ \slot -> do
+    poke slot (coerce nullPtr)
+    flip finally (c_duckdb_v2_macro_function_destroy slot >>= (@?= DuckDBV2ErrorNone)) $ do
+      checked (c_duckdb_v2_macro_function_create factory kind slot)
+      function <- peek slot
+      assertBool "the macro function is non-null" (function /= coerce nullPtr)
+      -- A second call replaces the name and the body.
+      forM_ ["v2_first_name", "v2_macro"] $ \name -> withView name $ \view ->
+        checked (c_duckdb_v2_macro_function_set_name function (coerce view))
+      forM_ ["NULL", body] $ \text -> withView text $ \view -> checked (c_duckdb_v2_macro_function_set_body function view)
+      signature <- output (c_duckdb_v2_macro_function_get_signature function)
+      assertBool "the signature is non-null" (signature /= coerce nullPtr)
+      withType factory "BIGINT" $ \ty -> withView "x" $ \name ->
+        checked (c_duckdb_v2_function_signature_add_parameter signature (coerce name) ty (coerce nullPtr) DuckDBV2FunctionParameterKindStandard)
+    peek slot >>= (@?= coerce nullPtr)
+    -- A second destruction and the destruction of a null pointer do nothing.
+    c_duckdb_v2_macro_function_destroy slot >>= (@?= DuckDBV2ErrorNone)
+    c_duckdb_v2_macro_function_destroy nullPtr >>= (@?= DuckDBV2ErrorNone)
diff --git a/test/V2Main.hs b/test/V2Main.hs
new file mode 100644
--- /dev/null
+++ b/test/V2Main.hs
@@ -0,0 +1,40 @@
+module Main (main) where
+
+import Test.Tasty (defaultMain, testGroup)
+import qualified V2AggregateTest
+import qualified V2ArrowTest
+import qualified V2AttachTest
+import qualified V2CallbackTest
+import qualified V2ChunkTest
+import qualified V2CopyTest
+import qualified V2FileSystemTest
+import qualified V2FunctionDocsTest
+import qualified V2MacroTest
+import qualified V2ReplacementScanTest
+import qualified V2StatementTest
+import qualified V2TableFunctionTest
+import qualified V2Test
+import qualified V2TypeTest
+import qualified V2ValueTest
+
+main :: IO ()
+main =
+  defaultMain $
+    testGroup
+      "DuckDB V2 C API"
+      [ V2Test.tests
+      , V2ValueTest.tests
+      , V2TypeTest.tests
+      , V2ChunkTest.tests
+      , V2StatementTest.tests
+      , V2FileSystemTest.tests
+      , V2FunctionDocsTest.tests
+      , V2CallbackTest.tests
+      , V2AggregateTest.tests
+      , V2MacroTest.tests
+      , V2AttachTest.tests
+      , V2TableFunctionTest.tests
+      , V2ArrowTest.tests
+      , V2ReplacementScanTest.tests
+      , V2CopyTest.tests
+      ]
diff --git a/test/V2ReplacementScanTest.hs b/test/V2ReplacementScanTest.hs
new file mode 100644
--- /dev/null
+++ b/test/V2ReplacementScanTest.hs
@@ -0,0 +1,178 @@
+{-# LANGUAGE DataKinds #-}
+{-# LANGUAGE TypeApplications #-}
+
+module V2ReplacementScanTest (tests) where
+
+import Control.Exception (bracket)
+import Control.Monad (forM_, when)
+import Data.Coerce (coerce)
+import Data.IORef (atomicModifyIORef', newIORef, readIORef, writeIORef)
+import Data.Int (Int64)
+import Data.List (isInfixOf)
+import Database.DuckDB.FFI.V2
+import Foreign.C.ConstPtr (ConstPtr (..))
+import Foreign.Marshal.Alloc (alloca, allocaBytes)
+import Foreign.Marshal.Array (withArray)
+import Foreign.Marshal.Utils (with)
+import Foreign.Ptr (freeHaskellFunPtr, nullPtr)
+import Foreign.Storable (Storable (..))
+import GHC.Records (getField)
+import HsBindgen.Runtime.Prelude (toFunPtr)
+import Test.Tasty (TestTree, testGroup)
+import Test.Tasty.HUnit (assertBool, testCase, (@?=))
+import V2Test (
+  borrowedOpaque,
+  callbackGuard,
+  checked,
+  failOnPurpose,
+  output,
+  readIntegers,
+  readView,
+  statementError,
+  statementFails,
+  withConnection,
+  withFactory,
+  withHandle,
+  withResult,
+  withType,
+  withView,
+ )
+
+tests :: TestTree
+tests =
+  testGroup
+    "DuckDB V2 replacement scans"
+    [ testCase
+        "replacement scans claim names as table function calls and as column data collections, and refuse a wrong claim"
+        testReplacementScan
+    ]
+
+-- | Read the last part of a qualified name, which is the object name.
+objectName :: DuckDBV2QnameHandle -> IO String
+objectName name = do
+  count <- output (c_duckdb_v2_qname_get_part_count name)
+  alloca $ \part -> do
+    checked (c_duckdb_v2_qname_get_part name (count - 1) part)
+    peek part >>= readView . coerce
+
+-- | Claim the reference as a call of the table function with this name.
+setFunction :: DuckDBV2ReplacementScanInfoHandle -> String -> IO ()
+setFunction info text = withView text $ \view ->
+  withHandle (c_duckdb_v2_qname_parse view) c_duckdb_v2_qname_destroy $ \name ->
+    checked (c_duckdb_v2_replacement_scan_set_function_name info name)
+
+-- | Add a positional BIGINT argument to the claimed function call.
+addArgument :: DuckDBV2FactoryHandle -> DuckDBV2ReplacementScanInfoHandle -> Int64 -> IO ()
+addArgument factory info number = withHandle (c_duckdb_v2_value_create_bigint factory number) c_duckdb_v2_value_destroy $ \value ->
+  checked (c_duckdb_v2_replacement_scan_add_argument info value)
+
+-- | The first scan claims the names v2_range, v2_repeat, v2_named, v2_default and v2_unknown, and fails on purpose
+-- for v2_failing. It declines all other names. The second scan has no user data and claims v2_plain.
+testReplacementScan :: IO ()
+testReplacementScan = do
+  failures <- newIORef []
+  claimed <- newIORef []
+  -- The connection creates the collection after the callback exists, so the callback reads it from a cell.
+  collectionCell <- newIORef (coerce nullPtr)
+  allocaBytes 1 $ \user -> do
+    let claim info context err = callbackGuard failures err $ do
+          output (c_duckdb_v2_replacement_scan_get_user_data info) >>= (@?= user)
+          name <- withHandle (c_duckdb_v2_replacement_scan_get_name info) c_duckdb_v2_qname_destroy objectName
+          factory <- output (c_duckdb_v2_context_get_factory context)
+          collection <- readIORef collectionCell
+          -- A call that must fail gets no error slot, so its failure does not fail the callback.
+          let refused what call = call nullPtr >>= assertBool (what <> " fails") . (/= DuckDBV2ErrorNone)
+          case name of
+            "v2_range" -> do
+              withHandle (c_duckdb_v2_value_create_bigint factory 2) c_duckdb_v2_value_destroy $ \value ->
+                refused "an argument before the function name" (c_duckdb_v2_replacement_scan_add_argument info value)
+              -- A second function name replaces the first one and keeps the arguments.
+              setFunction info "v2_absent_function"
+              mapM_ (addArgument factory info) [2, 11, 3]
+              setFunction info "range"
+              -- A claim through a different form fails, and the function claim stays.
+              refused "a collection after a function name" (c_duckdb_v2_replacement_scan_set_collection info collection (coerce nullPtr) 0)
+              withView "v2_alias" $ \alias -> checked (c_duckdb_v2_replacement_scan_set_alias info (coerce alias))
+            "v2_repeat" -> do
+              let addRows call = withView "num_rows" $ \parameter -> withHandle (c_duckdb_v2_value_create_bigint factory 3) c_duckdb_v2_value_destroy $ \value ->
+                    call (c_duckdb_v2_replacement_scan_add_named_argument info (coerce parameter) value)
+              addRows (refused "a named argument before the function name")
+              setFunction info "repeat_row"
+              addArgument factory info 7
+              addRows checked
+            "v2_named" -> do
+              -- With column names, the name count must equal the column count, and no name may be empty.
+              withView "amount" $ \amount -> withView "extra" $ \extra -> do
+                names <- mapM (fmap DuckDBV2IdentifierT . peek . coerce) [amount, extra]
+                withArray names $ \columns ->
+                  refused "two names for one column" (c_duckdb_v2_replacement_scan_set_collection info collection (ConstPtr columns) 2)
+              withView "" $ \column -> refused "an empty column name" (c_duckdb_v2_replacement_scan_set_collection info collection (coerce column) 1)
+              withView "amount" $ \column -> checked (c_duckdb_v2_replacement_scan_set_collection info collection (coerce column) 1)
+            "v2_default" -> do
+              checked (c_duckdb_v2_replacement_scan_set_collection info collection (coerce nullPtr) 0)
+              withView "range" $ \text -> withHandle (c_duckdb_v2_qname_parse text) c_duckdb_v2_qname_destroy $ \function ->
+                refused "a function name after a collection" (c_duckdb_v2_replacement_scan_set_function_name info function)
+            -- The scan does not resolve the name, so the claim succeeds and the statement fails later.
+            "v2_unknown" -> setFunction info "v2_absent_function"
+            "v2_failing" -> failOnPurpose "replacement scan"
+            _ -> pure ()
+          atomicModifyIORef' claimed (\names -> (name : names, ()))
+        plain info context err = callbackGuard failures err $ do
+          -- The second scan has no user data, so the user data is null.
+          output (c_duckdb_v2_replacement_scan_get_user_data info) >>= (@?= nullPtr)
+          name <- withHandle (c_duckdb_v2_replacement_scan_get_name info) c_duckdb_v2_qname_destroy objectName
+          factory <- output (c_duckdb_v2_context_get_factory context)
+          when (name == "v2_plain") $ setFunction info "range" >> addArgument factory info 2
+    bracket
+      (DuckDBV2ReplacementScanCallbackFn <$> toFunPtr (DuckDBV2ReplacementScanCallbackFn_Aux claim))
+      (freeHaskellFunPtr . getField @"unwrap")
+      $ \claimPtr ->
+        bracket
+          (DuckDBV2ReplacementScanCallbackFn <$> toFunPtr (DuckDBV2ReplacementScanCallbackFn_Aux plain))
+          (freeHaskellFunPtr . getField @"unwrap")
+          $ \plainPtr ->
+            withConnection $ \conn -> withFactory conn $ \factory -> withType factory "BIGINT" $ \ty -> withArray [ty] $ \types ->
+              withHandle (c_duckdb_v2_column_data_collection_create factory (ConstPtr types) 1) c_duckdb_v2_column_data_collection_destroy $ \collection -> do
+                writeIORef collectionCell collection
+                -- Append count rows start, start + 10, ... to the collection.
+                let append start count = withHandle (c_duckdb_v2_data_chunk_create factory (ConstPtr types) 1) c_duckdb_v2_data_chunk_destroy $ \chunk -> do
+                      vector <- output (c_duckdb_v2_data_chunk_get_vector chunk 0)
+                      checked (c_duckdb_v2_vector_make_sequence vector start 10 count)
+                      withHandle (c_duckdb_v2_column_data_collection_append_state_create collection) c_duckdb_v2_column_data_collection_append_state_destroy $ \state ->
+                        checked (c_duckdb_v2_column_data_collection_append collection state chunk)
+                append 10 3
+                withHandle (c_duckdb_v2_replacement_scan_create factory) c_duckdb_v2_replacement_scan_destroy $ \scan -> do
+                  checked (c_duckdb_v2_replacement_scan_set_callback scan claimPtr)
+                  with (borrowedOpaque user) $ \opaque -> checked (c_duckdb_v2_replacement_scan_set_user_data scan opaque)
+                  checked (c_duckdb_v2_connection_register_replacement_scan conn scan)
+                let refused what code = assertBool (what <> " is refused: " <> show code) (code /= DuckDBV2ErrorNone)
+                -- Registration requires a callback, and a scan registers only once.
+                withHandle (c_duckdb_v2_replacement_scan_create factory) c_duckdb_v2_replacement_scan_destroy $ \scan -> do
+                  c_duckdb_v2_connection_register_replacement_scan conn scan nullPtr >>= refused "a scan without a callback"
+                  checked (c_duckdb_v2_replacement_scan_set_callback scan plainPtr)
+                  checked (c_duckdb_v2_connection_register_replacement_scan conn scan)
+                  c_duckdb_v2_connection_register_replacement_scan conn scan nullPtr >>= refused "a second registration of a scan"
+                withConnection $ \other -> withFactory other $ \otherFactory ->
+                  withHandle (c_duckdb_v2_replacement_scan_create otherFactory) c_duckdb_v2_replacement_scan_destroy $ \scan -> do
+                    checked (c_duckdb_v2_replacement_scan_set_callback scan plainPtr)
+                    c_duckdb_v2_connection_register_replacement_scan conn scan nullPtr >>= refused "a scan of another database"
+                -- The query names the alias, so it binds only if the scan sets the alias.
+                withResult conn "SELECT v2_alias.* FROM v2_range" $ \result -> readIntegers result >>= (@?= [Just 2, Just 5, Just 8])
+                withResult conn "SELECT * FROM v2_repeat" $ \result -> readIntegers result >>= (@?= replicate 3 (Just 7))
+                withResult conn "SELECT amount FROM v2_named" $ \result -> readIntegers result >>= (@?= [Just 10, Just 20, Just 30])
+                -- The scan borrows the collection, so a later query reads the rows appended since.
+                append 40 1
+                withResult conn "SELECT col1 FROM v2_default" $ \result -> readIntegers result >>= (@?= [Just 10, Just 20, Just 30, Just 40])
+                withResult conn "SELECT * FROM v2_plain" $ \result -> readIntegers result >>= (@?= [Just 0, Just 1])
+                statementFails conn "SELECT * FROM v2_unknown"
+                -- The statement fails with the text of the callback, and the next statement on the connection works.
+                -- The header names no code for this failure.
+                (code, text) <- statementError conn "SELECT * FROM v2_failing"
+                assertBool "the statement of the failing scan fails" (code /= DuckDBV2ErrorNone)
+                assertBool ("the error contains the text of the callback: " <> text) ("v2 deliberate replacement scan failure" `isInfixOf` text)
+                atomicModifyIORef' failures (\seen -> ([], seen)) >>= (@?= ["user error (v2 deliberate replacement scan failure)"])
+                withResult conn "SELECT * FROM v2_repeat" $ \result -> readIntegers result >>= (@?= replicate 3 (Just 7))
+  readIORef failures >>= (@?= [])
+  names <- readIORef claimed
+  forM_ ["v2_range", "v2_repeat", "v2_named", "v2_default"] $ \name ->
+    assertBool ("the callback saw " <> name <> ": " <> show names) (name `elem` names)
diff --git a/test/V2StatementTest.hs b/test/V2StatementTest.hs
new file mode 100644
--- /dev/null
+++ b/test/V2StatementTest.hs
@@ -0,0 +1,157 @@
+module V2StatementTest (tests) where
+
+import Control.Exception (finally)
+import Control.Monad (forM_)
+import Data.Coerce (coerce)
+import Data.Int (Int64)
+import Data.List (isInfixOf, isSuffixOf)
+import Database.DuckDB.FFI.V2
+import Foreign.C.ConstPtr (ConstPtr (..))
+import Foreign.C.Types (CBool (..))
+import Foreign.Marshal.Alloc (alloca)
+import Foreign.Marshal.Array (withArray)
+import Foreign.Ptr (nullPtr)
+import Foreign.Storable (Storable (..))
+import Test.Tasty (TestTree, testGroup)
+import Test.Tasty.HUnit (assertBool, testCase, (@?=))
+import V2Test (
+  checked,
+  consume,
+  output,
+  readIntegers,
+  readView,
+  withConnection,
+  withFactory,
+  withHandle,
+  withResult,
+  withStatement,
+  withView,
+ )
+
+tests :: TestTree
+tests =
+  testGroup
+    "DuckDB V2 statements and results"
+    [ testCase "statements and results report their statement types" testStatementType
+    , testCase "raw error text is the error text without its category prefix" testRawText
+    , testCase "query metrics are found by name" testMetric
+    , testCase "execution rejects parameters that do not match the statement" testParameterRejection
+    ]
+
+testStatementType :: IO ()
+testStatementType = withConnection $ \conn -> do
+  let types sql = withStatement conn sql $ \statement -> do
+        parsed <- output (c_duckdb_v2_sql_statement_get_type statement)
+        executed <-
+          withHandle (c_duckdb_v2_statement_execute conn statement (coerce nullPtr) (coerce nullPtr) 0) c_duckdb_v2_result_destroy $ \result -> do
+            statementType <- output (c_duckdb_v2_result_get_statement_type result)
+            consume result
+            pure statementType
+        pure (parsed, executed)
+  types "CREATE TABLE v2_items (id INTEGER)" >>= (@?= (DuckDBV2StatementTypeCreate, DuckDBV2StatementTypeCreate))
+  types "INSERT INTO v2_items VALUES (1)" >>= (@?= (DuckDBV2StatementTypeInsert, DuckDBV2StatementTypeInsert))
+  types "SELECT id FROM v2_items" >>= (@?= (DuckDBV2StatementTypeSelect, DuckDBV2StatementTypeSelect))
+  -- The parser reports PRAGMA. The result reports the statement that execution rewrites the PRAGMA into.
+  (parsed, executed) <- types "PRAGMA table_info('v2_items')"
+  parsed @?= DuckDBV2StatementTypePragma
+  assertBool
+    ("the PRAGMA executes as a SELECT or a CALL, not as " <> show executed)
+    (executed `elem` [DuckDBV2StatementTypeSelect, DuckDBV2StatementTypeCall])
+
+testRawText :: IO ()
+testRawText = withConnection $ \conn -> withStatement conn "SELECT absent_column" $ \statement -> alloca $ \result -> alloca $ \err -> do
+  poke result (coerce nullPtr)
+  poke err (coerce nullPtr)
+  code <- c_duckdb_v2_statement_execute conn statement (coerce nullPtr) (coerce nullPtr) 0 result err
+  flip finally (c_duckdb_v2_error_info_destroy err >>= (@?= DuckDBV2ErrorNone)) $ do
+    code @?= DuckDBV2ErrorQueryBinder
+    info <- peek err
+    assertBool "failure has an owned error handle" (info /= coerce nullPtr)
+    let readText getter = alloca $ \out -> do
+          getter info out >>= (@?= DuckDBV2ErrorNone)
+          peek out >>= readView
+    text <- readText c_duckdb_v2_error_info_get_text
+    raw <- readText c_duckdb_v2_error_info_get_raw_text
+    assertBool "the raw text keeps the diagnostic" ("absent_column" `isInfixOf` raw)
+    assertBool ("the text ends with the raw text: " <> text) (raw `isSuffixOf` text)
+    let prefix = take (length text - length raw) text
+    assertBool ("the prefix has the form <Type> Error: " <> prefix) (length prefix > length " Error: " && " Error: " `isSuffixOf` prefix)
+    -- An empty text set through the API leaves an error without text, and without a raw body.
+    withView "" $ \empty -> c_duckdb_v2_error_info_set_text info empty >>= (@?= DuckDBV2ErrorNone)
+    readText c_duckdb_v2_error_info_get_text >>= (@?= "")
+    alloca $ \out -> do
+      c_duckdb_v2_error_info_get_raw_text info out >>= (@?= DuckDBV2ErrorNone)
+      DuckDBV2Str ptr len <- peek out
+      (ptr, len) @?= (ConstPtr nullPtr, 0)
+
+testMetric :: IO ()
+testMetric = withConnection $ \conn -> do
+  config <- output (c_duckdb_v2_connection_get_config conn)
+  withView "enable_profiling" $ \name -> withView "no_output" $ \setting ->
+    checked (c_duckdb_v2_config_set_option_text config (coerce name) setting DuckDBV2SettingScopeDefault)
+  checked (c_duckdb_v2_connection_enable_profiling conn (CBool 1))
+  -- A live result is a running query, so the connection has no snapshot to give.
+  withResult conn "SELECT sum(i) FROM range(1000) t(i)" $ \_ -> alloca $ \out -> do
+    poke out (coerce nullPtr)
+    code <- c_duckdb_v2_connection_get_query_metrics conn out nullPtr
+    c_duckdb_v2_query_metrics_destroy out >>= (@?= DuckDBV2ErrorNone)
+    code @?= DuckDBV2ErrorResourceInUse
+  withResult conn "SELECT sum(i) FROM range(1000) t(i)" consume
+  withHandle (c_duckdb_v2_connection_get_query_metrics conn) c_duckdb_v2_query_metrics_destroy $ \metrics -> do
+    root <- output (c_duckdb_v2_query_metrics_get_root metrics)
+    count <- output (c_duckdb_v2_query_metrics_node_get_metric_count root)
+    assertBool "profiling gives the root node metrics" (count > 0)
+    let asDouble value = output (c_duckdb_v2_value_get_double value)
+    forM_ [0 .. count - 1] $ \index -> do
+      name <- output (c_duckdb_v2_query_metrics_node_get_metric_name root index) >>= readView
+      byIndex <- withHandle (c_duckdb_v2_query_metrics_node_get_metric_value root index) c_duckdb_v2_value_destroy asDouble
+      withView name $ \view -> alloca $ \present ->
+        withHandle (\value -> c_duckdb_v2_query_metrics_node_get_metric root view value present) c_duckdb_v2_value_destroy $ \value -> do
+          peek present >>= (@?= CBool 1)
+          asDouble value >>= (@?= byIndex)
+    alloca $ \name -> c_duckdb_v2_query_metrics_node_get_metric_name root count name nullPtr >>= (@?= DuckDBV2ErrorInputOutOfRange)
+    alloca $ \value -> do
+      poke value (coerce nullPtr)
+      code <- c_duckdb_v2_query_metrics_node_get_metric_value root count value nullPtr
+      c_duckdb_v2_value_destroy value >>= (@?= DuckDBV2ErrorNone)
+      code @?= DuckDBV2ErrorInputOutOfRange
+    withView "v2.no_such_metric" $ \view -> alloca $ \present -> alloca $ \value -> do
+      poke value (coerce nullPtr)
+      checked (c_duckdb_v2_query_metrics_node_get_metric root view value present)
+      peek present >>= (@?= CBool 0)
+      peek value >>= (@?= coerce nullPtr)
+
+-- | Execute a statement with the value 7 for one parameter, by name or by position, and read the result.
+-- A failing execution gives its error code and no rows.
+executeWith :: DuckDBV2ConnectionHandle -> DuckDBV2FactoryHandle -> String -> Maybe String -> Int -> IO (DuckDBV2Error, [Maybe Int64])
+executeWith conn factory sql name count = withStatement conn sql $ \statement ->
+  withHandle (c_duckdb_v2_value_create_bigint factory 7) c_duckdb_v2_value_destroy $ \value -> withArray [value] $ \values -> alloca $ \result -> do
+    poke result (coerce nullPtr)
+    flip finally (c_duckdb_v2_result_destroy result) $ do
+      let execute keys = c_duckdb_v2_statement_execute conn statement keys (ConstPtr values) (fromIntegral count) result nullPtr
+      code <- maybe (execute (coerce nullPtr)) (\text -> withView text (execute . coerce)) name
+      rows <- if code == DuckDBV2ErrorNone then peek result >>= readIntegers else pure []
+      pure (code, rows)
+
+testParameterRejection :: IO ()
+testParameterRejection = withConnection $ \conn -> withFactory conn $ \factory -> do
+  let execute = executeWith conn factory
+  execute "SELECT $1::BIGINT" Nothing 1 >>= (@?= (DuckDBV2ErrorNone, [Just 7]))
+  execute "SELECT $1::BIGINT" (Just "amount") 1 >>= (@?= (DuckDBV2ErrorInputInvalid, []))
+  execute "SELECT $amount::BIGINT" (Just "amount") 1 >>= (@?= (DuckDBV2ErrorNone, [Just 7]))
+  execute "SELECT $amount::BIGINT" Nothing 1 >>= (@?= (DuckDBV2ErrorInputInvalid, []))
+  -- A PIVOT without an IN list expands into a group of statements. A value for a statement without parameters is a
+  -- binder error, so the code of the PIVOT comes from the expansion.
+  let pivot = "PIVOT (SELECT 1::BIGINT AS k, 2::BIGINT AS v) ON k USING max(v)"
+  execute "SELECT 2::BIGINT" Nothing 1 >>= (@?= (DuckDBV2ErrorQueryBinder, []))
+  execute pivot Nothing 1 >>= (@?= (DuckDBV2ErrorInputInvalid, []))
+  withResult conn pivot $ \result -> do
+    alloca $ \schema -> do
+      poke schema (coerce nullPtr)
+      c_duckdb_v2_result_get_schema result schema nullPtr >>= (@?= DuckDBV2ErrorInputMetadataDeferred)
+      peek schema >>= (@?= coerce nullPtr)
+    readIntegers result >>= (@?= [Just 2])
+    withHandle (c_duckdb_v2_result_get_schema result) c_duckdb_v2_schema_destroy $ \schema -> alloca $ \name -> do
+      output (c_duckdb_v2_schema_get_count schema) >>= (@?= 1)
+      _ <- output (c_duckdb_v2_schema_get_field schema 0 name)
+      alloca $ \ty -> c_duckdb_v2_schema_get_field schema 1 name ty nullPtr >>= (@?= DuckDBV2ErrorInputInvalid)
diff --git a/test/V2TableFunctionTest.hs b/test/V2TableFunctionTest.hs
new file mode 100644
--- /dev/null
+++ b/test/V2TableFunctionTest.hs
@@ -0,0 +1,1032 @@
+module V2TableFunctionTest (tests) where
+
+import Control.Exception (bracket, onException)
+import Control.Monad (forM, forM_, unless, when)
+import Data.Coerce (coerce)
+import Data.IORef (IORef, atomicModifyIORef', newIORef, readIORef, writeIORef)
+import Data.Int (Int64)
+import Data.List (elemIndex, isInfixOf, nub, sort)
+import Data.Maybe (fromMaybe)
+import Data.Void (Void)
+import Database.DuckDB.FFI.V2
+import Foreign.C.ConstPtr (ConstPtr (..))
+import Foreign.C.String (withCString)
+import Foreign.C.Types (CBool (..))
+import Foreign.Marshal.Alloc (alloca, calloc, finalizerFree, free)
+import Foreign.Marshal.Array (mallocArray, pokeArray)
+import Foreign.Marshal.Utils (with)
+import Foreign.Ptr (FunPtr, Ptr, castFunPtr, castPtr, freeHaskellFunPtr, nullFunPtr, nullPtr)
+import Foreign.Storable (Storable, peek, peekElemOff, poke, pokeElemOff)
+import HsBindgen.Runtime.Prelude (ToFunPtr, toFunPtr)
+import System.IO (hClose, openBinaryTempFile)
+import Test.Tasty (TestTree, testGroup)
+import Test.Tasty.HUnit (assertBool, assertEqual, testCase, (@?=))
+import V2Test (
+  borrowedOpaque,
+  callbackGuard,
+  checked,
+  consume,
+  failOnPurpose,
+  output,
+  readIntegers,
+  readView,
+  record,
+  removeTestFile,
+  statementError,
+  statementFails,
+  withConnection,
+  withFactory,
+  withHandle,
+  withResult,
+  withType,
+  withView,
+ )
+
+tests :: TestTree
+tests =
+  testGroup
+    "DuckDB V2 table function callbacks"
+    [ testCase "init and exec callbacks read the data of their call and the declared column of each scanned column" testColumns
+    , testCase "claim batch callbacks hand out batches until a claim fails" testClaimBatch
+    , testCase "order preservation and batch indexes decide whether a scan runs in parallel" testParallelScan
+    , testCase "partitioning callbacks let a grouped aggregate take its groups from partition values" testPartitioning
+    , testCase "progress callbacks give the progress of the running query" testProgress
+    , testCase "a multi-file function asks the function it wraps for the bind info of each file" testBindInfo
+    , testCase "filter pushdown callbacks read the predicates of the query, and an accepted predicate leaves the query" testFilterPushdown
+    , testCase "a callback that reports an error fails the statement, and DuckDB destroys the states set before" testFailingCallbacks
+    , testCase "registration refuses an incomplete table or multi-file function and a function of another database" testRegistration
+    ]
+
+-- | Create a function pointer for the duration of the action.
+withFunPtr :: (ToFunPtr a) => a -> (FunPtr a -> IO b) -> IO b
+withFunPtr callback = bracket (toFunPtr callback) freeHaskellFunPtr
+
+-- | Create a table function, configure it, and register it on the connection.
+registerTable :: DuckDBV2ConnectionHandle -> String -> (DuckDBV2TableFunctionHandle -> IO ()) -> IO ()
+registerTable conn name configure = withFactory conn $ \factory ->
+  withHandle (c_duckdb_v2_table_function_create factory) c_duckdb_v2_table_function_destroy $ \function -> do
+    withView name $ \view -> checked (c_duckdb_v2_table_function_set_name function (coerce view))
+    configure function
+    checked (c_duckdb_v2_connection_register_table_function conn function)
+
+-- | Declare BIGINT result columns with the given names.
+addColumns :: DuckDBV2TableFunctionBindInfoHandle -> DuckDBV2ContextHandle -> [String] -> IO ()
+addColumns result context names = do
+  factory <- output (c_duckdb_v2_context_get_factory context)
+  withType factory "BIGINT" $ \ty -> forM_ names $ \name ->
+    withView name $ \view -> checked (c_duckdb_v2_table_function_bind_add_result_column result (coerce view) ty)
+
+-- | Pass a pointer as an opaque handle without a destructor. The caller keeps the memory.
+lend :: Ptr a -> (Ptr DuckDBV2Opaque -> IO b) -> IO b
+lend cells = with (borrowedOpaque (castPtr cells))
+
+-- | Allocate cells with the given values and give them to DuckDB through the setter.
+-- The opaque handle frees the cells with the C @free@ when DuckDB destroys it.
+give :: [Int64] -> (Ptr DuckDBV2Opaque -> Ptr DuckDBV2ErrorInfoHandle -> IO DuckDBV2Error) -> IO (Ptr Void)
+give values setter = do
+  cells <- mallocArray (length values)
+  pokeArray cells values
+  let opaque = DuckDBV2Opaque (castPtr cells) (DuckDBV2OpaqueDestroyFn (castFunPtr finalizerFree)) (DuckDBV2OpaqueEqualsFn nullFunPtr)
+  with opaque (checked . setter) `onException` free cells
+  pure (castPtr cells)
+
+-- | Assert that a callback reads a value that an earlier callback recorded.
+expectRecorded :: (Eq a) => String -> a -> IORef [a] -> IO ()
+expectRecorded what value ref = readIORef ref >>= assertBool what . elem value
+
+-- | Write the values into the vector at the given position of the chunk.
+writeColumn :: DuckDBV2DataChunkHandle -> DuckDBIdx -> [Int64] -> IO ()
+writeColumn chunk position values = do
+  vector <- output (c_duckdb_v2_data_chunk_get_vector chunk position)
+  raw <- output (c_duckdb_v2_vector_get_data_mutable vector)
+  forM_ (zip [0 ..] values) $ \(row, value) -> pokeElemOff (coerce raw) row value
+
+-- | Declare the number of rows of the chunk on its first vector.
+setRows :: DuckDBV2DataChunkHandle -> Int -> IO ()
+setRows chunk count = do
+  first <- output (c_duckdb_v2_data_chunk_get_vector chunk 0)
+  checked (c_duckdb_v2_vector_set_size first (fromIntegral count))
+
+-- | Read the declared column for each index below the count that the count getter gives.
+-- The index getter must reject the index that equals the count.
+declaredColumns
+  :: String
+  -> (Ptr DuckDBIdx -> Ptr DuckDBV2ErrorInfoHandle -> IO DuckDBV2Error)
+  -> (DuckDBIdx -> Ptr DuckDBIdx -> Ptr DuckDBV2ErrorInfoHandle -> IO DuckDBV2Error)
+  -> IO [DuckDBIdx]
+declaredColumns phase getCount getIndex = do
+  count <- output getCount
+  indexes <- forM (take (fromIntegral count) [0 ..]) (output . getIndex)
+  code <- alloca $ \slot -> getIndex count slot nullPtr
+  assertBool (phase <> " rejects the index that equals the column count") (code /= DuckDBV2ErrorNone)
+  pure indexes
+
+-- | Two functions declare the columns a, b and c, one with projection pushdown and one without.
+-- The exec callback writes 100 * (declared column) + (row) into each scanned column.
+testColumns :: IO ()
+testColumns = do
+  failures <- newIORef []
+  binds <- newIORef [] -- (user data, bind data) of each bound call
+  globals <- newIORef [] -- (bind data, global state) of each scan
+  locals <- newIORef [] -- (global state, local state) of each thread
+  columns <- newIORef [] -- (phase, user data, declared column of each scanned column)
+  let bind info result context err = callbackGuard failures err $ do
+        user <- output (c_duckdb_v2_function_bind_get_user_data info)
+        -- A result column carries data, so the type ANY is rejected. The next call adds the column as a BIGINT.
+        factory <- output (c_duckdb_v2_context_get_factory context)
+        withHandle
+          (c_duckdb_v2_factory_create_type_from_id factory DuckDBV2LogicalTypeIdAny (coerce nullPtr) (coerce nullPtr) 0)
+          c_duckdb_v2_logical_type_destroy
+          $ \ty ->
+            withView "a" $ \name ->
+              c_duckdb_v2_table_function_bind_add_result_column result (coerce name) ty nullPtr
+                >>= assertBool "a result column of type ANY is rejected" . (/= DuckDBV2ErrorNone)
+        addColumns result context ["a", "b", "c"]
+        bound <- give [0] (c_duckdb_v2_function_bind_set_bind_data info)
+        record binds (user, bound)
+      initGlobal info _context err = callbackGuard failures err $ do
+        user <- output (c_duckdb_v2_table_function_init_global_get_user_data info)
+        bound <- output (c_duckdb_v2_table_function_init_global_get_bind_data info)
+        expectRecorded "global init reads the user data and the bind data of its call" (user, bound) binds
+        indexes <-
+          declaredColumns
+            "global init"
+            (c_duckdb_v2_table_function_init_global_get_column_count info)
+            (c_duckdb_v2_table_function_init_global_get_column_index info)
+        record columns ("global init", user, indexes)
+        global <- give [0] (c_duckdb_v2_table_function_init_global_set_global_state info)
+        record globals (bound, global)
+      initLocal info _context err = callbackGuard failures err $ do
+        user <- output (c_duckdb_v2_table_function_init_local_get_user_data info)
+        bound <- output (c_duckdb_v2_table_function_init_local_get_bind_data info)
+        global <- output (c_duckdb_v2_table_function_init_local_get_global_state info)
+        expectRecorded "local init reads the user data and the bind data of its call" (user, bound) binds
+        expectRecorded "local init reads the global state of its scan" (bound, global) globals
+        indexes <-
+          declaredColumns
+            "local init"
+            (c_duckdb_v2_table_function_init_local_get_column_count info)
+            (c_duckdb_v2_table_function_init_local_get_column_index info)
+        record columns ("local init", user, indexes)
+        local <- give [0] (c_duckdb_v2_table_function_init_local_set_local_state info)
+        record locals (global, local)
+      execute info _context err = callbackGuard failures err $ do
+        user <- output (c_duckdb_v2_table_function_exec_get_user_data info)
+        bound <- output (c_duckdb_v2_table_function_exec_get_bind_data info)
+        global <- output (c_duckdb_v2_table_function_exec_get_global_state info)
+        local <- output (c_duckdb_v2_table_function_exec_get_local_state info)
+        expectRecorded "exec reads the user data and the bind data of its call" (user, bound) binds
+        expectRecorded "exec reads the global state of its scan" (bound, global) globals
+        expectRecorded "exec reads the local state of its thread" (global, local) locals
+        indexes <-
+          declaredColumns "exec" (c_duckdb_v2_table_function_exec_get_column_count info) (c_duckdb_v2_table_function_exec_get_column_index info)
+        record columns ("exec", user, indexes)
+        chunk <- output (c_duckdb_v2_table_function_exec_get_output_chunk info)
+        emitted <- peek (castPtr local :: Ptr Int64)
+        if emitted == 0
+          then do
+            forM_ (zip [0 ..] indexes) $ \(position, declared) ->
+              writeColumn chunk position [100 * fromIntegral declared + row | row <- [0 .. 2]]
+            setRows chunk 3
+            poke (castPtr local) (1 :: Int64)
+          else setRows chunk 0
+  with (1 :: Int64) $ \projectedUser -> with (2 :: Int64) $ \unprojectedUser ->
+    withFunPtr (DuckDBV2TableFunctionBindCallbackFn_Aux bind) $ \bindPtr ->
+      withFunPtr (DuckDBV2TableFunctionInitGlobalCallbackFn_Aux initGlobal) $ \initGlobalPtr ->
+        withFunPtr (DuckDBV2TableFunctionInitLocalCallbackFn_Aux initLocal) $ \initLocalPtr ->
+          withFunPtr (DuckDBV2TableFunctionExecCallbackFn_Aux execute) $ \executePtr -> withConnection $ \conn -> do
+            let register name user pushdown document = registerTable conn name $ \function -> do
+                  lend user (checked . c_duckdb_v2_table_function_set_user_data function)
+                  checked (c_duckdb_v2_table_function_set_bind_callback function (DuckDBV2TableFunctionBindCallbackFn bindPtr))
+                  checked (c_duckdb_v2_table_function_set_init_global_callback function (DuckDBV2TableFunctionInitGlobalCallbackFn initGlobalPtr))
+                  checked (c_duckdb_v2_table_function_set_init_local_callback function (DuckDBV2TableFunctionInitLocalCallbackFn initLocalPtr))
+                  checked (c_duckdb_v2_table_function_set_exec_callback function (DuckDBV2TableFunctionExecCallbackFn executePtr))
+                  checked (c_duckdb_v2_table_function_set_projection_pushdown function (CBool pushdown))
+                  output (c_duckdb_v2_table_function_get_docs function) >>= document
+                describe docs = do
+                  withView "Returns three columns." $ \description -> checked (c_duckdb_v2_function_docs_set_description docs description)
+                  forM_ ["SELECT a FROM v2_projected()", "SELECT c FROM v2_projected()"] $ \example ->
+                    withView "example" $ \title -> withView example $ \text -> checked (c_duckdb_v2_function_docs_add_example docs title text)
+                  withView "table" $ \category -> checked (c_duckdb_v2_function_docs_add_category docs category)
+            register "v2_projected" projectedUser 1 describe
+            register "v2_unprojected" unprojectedUser 0 (\_ -> pure ())
+            withResult conn "SELECT c - a FROM v2_projected()" $ \result -> readIntegers result >>= (@?= replicate 3 (Just 200))
+            withResult conn "SELECT c - a FROM v2_unprojected()" $ \result -> readIntegers result >>= (@?= replicate 3 (Just 200))
+            let documented =
+                  "SELECT count(*)::BIGINT FROM duckdb_functions() WHERE function_name = 'v2_projected' AND description = 'Returns three columns.'"
+                    <> " AND examples = ['SELECT a FROM v2_projected()', 'SELECT c FROM v2_projected()'] AND categories = ['table']"
+            withResult conn documented $ \result -> readIntegers result >>= (@?= [Just 1])
+            readIORef failures >>= (@?= [])
+            recorded <- readIORef columns
+            let phasesOf user = [(phase, indexes) | (phase, owner, indexes) <- recorded, owner == castPtr user]
+            forM_ [projectedUser, unprojectedUser] $ \user ->
+              nub (sort (map fst (phasesOf user))) @?= ["exec", "global init", "local init"]
+            -- The engine chooses the order of the scanned columns. All phases of one scan must report the same order.
+            let projected = nub (map snd (phasesOf projectedUser))
+            length projected @?= 1
+            map sort projected @?= [[0, 2]]
+            nub (map snd (phasesOf unprojectedUser)) @?= [[0, 1, 2]]
+
+-- | One thread scans three batches of two rows each. The log records each claim and each exec call.
+-- The header describes the sequence for a thread: a claim before the first exec, a claim after each empty chunk,
+-- and the end of the scan after a failed claim.
+testClaimBatch :: IO ()
+testClaimBatch = do
+  failures <- newIORef []
+  events <- newIORef []
+  binds <- newIORef [] -- (user data, bind data) of each bound call
+  globals <- newIORef [] -- (bind data, global state) of each scan
+  locals <- newIORef [] -- (global state, local state) of each thread
+  let bind info result context err = callbackGuard failures err $ do
+        user <- output (c_duckdb_v2_function_bind_get_user_data info)
+        addColumns result context ["value"]
+        bound <- give [0] (c_duckdb_v2_function_bind_set_bind_data info)
+        record binds (user, bound)
+      -- The global state holds the number of the next batch. Only one thread claims batches, so it needs no lock.
+      initGlobal info _context err = callbackGuard failures err $ do
+        bound <- output (c_duckdb_v2_table_function_init_global_get_bind_data info)
+        global <- give [0] (c_duckdb_v2_table_function_init_global_set_global_state info)
+        record globals (bound, global)
+      -- The local state holds the claimed batch, or -1, and whether exec wrote the rows of the batch.
+      initLocal info _context err = callbackGuard failures err $ do
+        global <- output (c_duckdb_v2_table_function_init_local_get_global_state info)
+        local <- give [-1, 0] (c_duckdb_v2_table_function_init_local_set_local_state info)
+        record locals (global, local)
+      claim info _context err = callbackGuard failures err $ do
+        user <- output (c_duckdb_v2_table_function_claim_batch_get_user_data info)
+        bound <- output (c_duckdb_v2_table_function_claim_batch_get_bind_data info)
+        global <- output (c_duckdb_v2_table_function_claim_batch_get_global_state info)
+        local <- output (c_duckdb_v2_table_function_claim_batch_get_local_state info)
+        expectRecorded "claim batch reads the user data and the bind data of its call" (user, bound) binds
+        expectRecorded "claim batch reads the global state of its scan" (bound, global) globals
+        expectRecorded "claim batch reads the local state of its thread" (global, local) locals
+        next <- peek (castPtr global :: Ptr Int64)
+        if next < 3
+          then do
+            poke (castPtr global) (next + 1)
+            pokeArray (castPtr local) [next, 0 :: Int64]
+            checked (c_duckdb_v2_table_function_claim_batch_set_claimed info (CBool 1))
+            record events ("claim " <> show next)
+          else do
+            -- A callback that does not call set_claimed claims nothing.
+            pokeArray (castPtr local) [-1, 0 :: Int64]
+            record events "claim none"
+      execute info _context err = callbackGuard failures err $ do
+        local <- castPtr <$> output (c_duckdb_v2_table_function_exec_get_local_state info)
+        batch <- peekElemOff local 0
+        written <- peekElemOff local 1
+        chunk <- output (c_duckdb_v2_table_function_exec_get_output_chunk info)
+        if batch >= 0 && written == 0
+          then do
+            writeColumn chunk 0 [10 * batch, 10 * batch + 1 :: Int64]
+            setRows chunk 2
+            pokeElemOff local 1 (1 :: Int64)
+            record events ("rows " <> show batch)
+          else do
+            setRows chunk 0
+            record events ("empty " <> show batch)
+  with (7 :: Int64) $ \user ->
+    withFunPtr (DuckDBV2TableFunctionBindCallbackFn_Aux bind) $ \bindPtr ->
+      withFunPtr (DuckDBV2TableFunctionInitGlobalCallbackFn_Aux initGlobal) $ \initGlobalPtr ->
+        withFunPtr (DuckDBV2TableFunctionInitLocalCallbackFn_Aux initLocal) $ \initLocalPtr ->
+          withFunPtr (DuckDBV2TableFunctionClaimBatchCallbackFn_Aux claim) $ \claimPtr ->
+            withFunPtr (DuckDBV2TableFunctionExecCallbackFn_Aux execute) $ \executePtr -> withConnection $ \conn -> do
+              registerTable conn "v2_batches" $ \function -> do
+                lend user (checked . c_duckdb_v2_table_function_set_user_data function)
+                checked (c_duckdb_v2_table_function_set_bind_callback function (DuckDBV2TableFunctionBindCallbackFn bindPtr))
+                checked (c_duckdb_v2_table_function_set_init_global_callback function (DuckDBV2TableFunctionInitGlobalCallbackFn initGlobalPtr))
+                checked (c_duckdb_v2_table_function_set_init_local_callback function (DuckDBV2TableFunctionInitLocalCallbackFn initLocalPtr))
+                checked (c_duckdb_v2_table_function_set_claim_batch_callback function (DuckDBV2TableFunctionClaimBatchCallbackFn claimPtr))
+                checked (c_duckdb_v2_table_function_set_exec_callback function (DuckDBV2TableFunctionExecCallbackFn executePtr))
+              withResult conn "SELECT value FROM v2_batches()" $ \result ->
+                readIntegers result >>= (@?= map Just [0, 1, 10, 11, 20, 21])
+  readIORef failures >>= (@?= [])
+  -- The default maximum of one thread gives one local state.
+  length <$> readIORef locals >>= (@?= 1)
+  reverse <$> readIORef events
+    >>= (@?= ["claim 0", "rows 0", "empty 0", "claim 1", "rows 1", "empty 1", "claim 2", "rows 2", "empty 2", "claim none"])
+
+-- | Each exec call takes the next of eight batches of three rows from a shared counter, with at most two threads.
+-- The functions take the order preservation as their argument: 0 is NO_ORDER and 1 is INSERTION_ORDER.
+-- The test instance has two threads, so the engine starts two scan tasks when the scan can run in parallel.
+testParallelScan :: IO ()
+testParallelScan = do
+  failures <- newIORef []
+  next <- newIORef (0 :: Int64)
+  binds <- newIORef [] -- (user data, bind data) of each bound call
+  globals <- newIORef [] -- (bind data, global state) of each scan
+  locals <- newIORef [] -- (global state, local state) of each thread
+  requests <- newIORef [] -- (batch index, partition columns, partition column count) that each partition data call requires
+  let bind info result context err = callbackGuard failures err $ do
+        user <- output (c_duckdb_v2_function_bind_get_user_data info)
+        order <- withHandle (c_duckdb_v2_function_bind_get_arg_value info 0) c_duckdb_v2_value_destroy (output . c_duckdb_v2_value_get_bigint)
+        c_duckdb_v2_table_function_bind_set_order_preservation result (DuckDBV2OrderPreservation 99) nullPtr >>= (@?= DuckDBV2ErrorInputInvalid)
+        checked (c_duckdb_v2_table_function_bind_set_order_preservation result (DuckDBV2OrderPreservation (fromIntegral order)))
+        addColumns result context ["value"]
+        bound <- give [0] (c_duckdb_v2_function_bind_set_bind_data info)
+        record binds (user, bound)
+      initGlobal info _context err = callbackGuard failures err $ do
+        bound <- output (c_duckdb_v2_table_function_init_global_get_bind_data info)
+        global <- give [0] (c_duckdb_v2_table_function_init_global_set_global_state info)
+        record globals (bound, global)
+        -- The maximum number of threads must be at least 1.
+        c_duckdb_v2_table_function_init_global_set_max_threads info 0 nullPtr
+          >>= assertBool "a maximum of 0 threads is rejected" . (/= DuckDBV2ErrorNone)
+        checked (c_duckdb_v2_table_function_init_global_set_max_threads info 2)
+      -- The local state holds the batch of the last chunk that the thread wrote.
+      initLocal info _context err = callbackGuard failures err $ do
+        global <- output (c_duckdb_v2_table_function_init_local_get_global_state info)
+        local <- give [-1] (c_duckdb_v2_table_function_init_local_set_local_state info)
+        record locals (global, local)
+      execute info _context err = callbackGuard failures err $ do
+        local <- output (c_duckdb_v2_table_function_exec_get_local_state info)
+        batch <- atomicModifyIORef' next $ \value -> (value + 1, value)
+        chunk <- output (c_duckdb_v2_table_function_exec_get_output_chunk info)
+        if batch < 8
+          then do
+            writeColumn chunk 0 [10 * batch + row | row <- [0 .. 2]]
+            setRows chunk 3
+            poke (castPtr local) batch
+          else setRows chunk 0
+      partitionData info _context err = callbackGuard failures err $ do
+        user <- output (c_duckdb_v2_table_function_partition_data_get_user_data info)
+        bound <- output (c_duckdb_v2_table_function_partition_data_get_bind_data info)
+        global <- output (c_duckdb_v2_table_function_partition_data_get_global_state info)
+        local <- output (c_duckdb_v2_table_function_partition_data_get_local_state info)
+        expectRecorded "partition data reads the user data and the bind data of its call" (user, bound) binds
+        expectRecorded "partition data reads the global state of its scan" (bound, global) globals
+        expectRecorded "partition data reads the local state of the thread that wrote the chunk" (global, local) locals
+        batchIndex <- output (c_duckdb_v2_table_function_partition_data_requires_batch_index info)
+        partitionColumns <- output (c_duckdb_v2_table_function_partition_data_requires_partition_columns info)
+        count <- output (c_duckdb_v2_table_function_partition_data_get_partition_column_count info)
+        record requests (batchIndex, partitionColumns, count)
+        code <- alloca $ \slot -> c_duckdb_v2_table_function_partition_data_get_partition_column_index info count slot nullPtr
+        assertBool "partition data rejects the index that equals the partition column count" (code /= DuckDBV2ErrorNone)
+        c_duckdb_v2_table_function_partition_data_set_batch_index info (10 ^ (14 :: Int)) nullPtr >>= (@?= DuckDBV2ErrorInputInvalid)
+        batch <- peek (castPtr local :: Ptr Int64)
+        checked (c_duckdb_v2_table_function_partition_data_set_batch_index info (fromIntegral batch))
+  with (3 :: Int64) $ \user ->
+    withFunPtr (DuckDBV2TableFunctionBindCallbackFn_Aux bind) $ \bindPtr ->
+      withFunPtr (DuckDBV2TableFunctionInitGlobalCallbackFn_Aux initGlobal) $ \initGlobalPtr ->
+        withFunPtr (DuckDBV2TableFunctionInitLocalCallbackFn_Aux initLocal) $ \initLocalPtr ->
+          withFunPtr (DuckDBV2TableFunctionExecCallbackFn_Aux execute) $ \executePtr ->
+            withFunPtr (DuckDBV2TableFunctionPartitionDataCallbackFn_Aux partitionData) $ \partitionDataPtr -> withConnection $ \conn -> do
+              let register name configure = registerTable conn name $ \function -> do
+                    lend user (checked . c_duckdb_v2_table_function_set_user_data function)
+                    withFactory conn $ \factory -> withType factory "BIGINT" $ \ty -> withView "order" $ \parameter -> do
+                      signature <- output (c_duckdb_v2_table_function_get_signature function)
+                      checked
+                        (c_duckdb_v2_function_signature_add_parameter signature (coerce parameter) ty (coerce nullPtr) DuckDBV2FunctionParameterKindStandard)
+                    checked (c_duckdb_v2_table_function_set_bind_callback function (DuckDBV2TableFunctionBindCallbackFn bindPtr))
+                    checked (c_duckdb_v2_table_function_set_init_global_callback function (DuckDBV2TableFunctionInitGlobalCallbackFn initGlobalPtr))
+                    checked (c_duckdb_v2_table_function_set_init_local_callback function (DuckDBV2TableFunctionInitLocalCallbackFn initLocalPtr))
+                    checked (c_duckdb_v2_table_function_set_exec_callback function (DuckDBV2TableFunctionExecCallbackFn executePtr))
+                    configure function
+                  -- Return the rows of the query and the number of local states that the scan created.
+                  scan sql = do
+                    writeIORef next 0
+                    before <- length <$> readIORef locals
+                    rows <- withResult conn sql readIntegers
+                    after <- length <$> readIORef locals
+                    pure (rows, after - before)
+                  expected = map Just [10 * batch + row | batch <- [0 .. 7], row <- [0 .. 2]]
+              register "v2_scan" (\_ -> pure ())
+              register "v2_batched" $ \function ->
+                checked (c_duckdb_v2_table_function_set_partition_data_callback function (DuckDBV2TableFunctionPartitionDataCallbackFn partitionDataPtr))
+              (unordered, unorderedThreads) <- scan "SELECT value FROM v2_scan(0)"
+              sort unordered @?= expected
+              assertBool "NO_ORDER lets the scan run on more than one thread" (unorderedThreads > 1)
+              (ordered, orderedThreads) <- scan "SELECT value FROM v2_scan(1)"
+              ordered @?= expected
+              orderedThreads @?= 1
+              (batched, batchedThreads) <- scan "SELECT value FROM v2_batched(1)"
+              batched @?= expected
+              assertBool "batch indexes let an ordered scan run on more than one thread" (batchedThreads > 1)
+  readIORef failures >>= (@?= [])
+  seen <- readIORef requests
+  assertBool "the partition data callback was invoked" (not (null seen))
+  nub seen @?= [(CBool 1, CBool 0, 0)]
+
+-- | The function declares the columns pad, v and k, with projection pushdown. Batch b holds b + 1 rows with k = b.
+-- The query does not read pad, so the scan position of k is not its declared column 2.
+-- In DuckDB 2.0.0 only an aggregate with a cluster update, such as count(v), can use the partitioned aggregate.
+-- Four functions share the callbacks. Their user data holds the mode of the partition data callback.
+testPartitioning :: IO ()
+testPartitioning = do
+  failures <- newIORef []
+  next <- newIORef (0 :: Int64)
+  binds <- newIORef [] -- (user data, bind data) of each bound call
+  globals <- newIORef [] -- (bind data, global state) of each scan
+  locals <- newIORef [] -- (global state, local state) of each thread
+  candidates <- newIORef [] -- the declared columns of each candidate GROUP BY column set
+  requests <- newIORef [] -- (partition columns required, declared partition columns) of each partition data call
+  let bind info result context err = callbackGuard failures err $ do
+        user <- output (c_duckdb_v2_function_bind_get_user_data info)
+        addColumns result context ["pad", "v", "k"]
+        bound <- give [0] (c_duckdb_v2_function_bind_set_bind_data info)
+        record binds (user, bound)
+      initGlobal info _context err = callbackGuard failures err $ do
+        bound <- output (c_duckdb_v2_table_function_init_global_get_bind_data info)
+        global <- give [0] (c_duckdb_v2_table_function_init_global_set_global_state info)
+        record globals (bound, global)
+      -- The local state holds the batch of the last chunk that the thread wrote.
+      initLocal info _context err = callbackGuard failures err $ do
+        global <- output (c_duckdb_v2_table_function_init_local_get_global_state info)
+        local <- give [-1] (c_duckdb_v2_table_function_init_local_set_local_state info)
+        record locals (global, local)
+      execute info _context err = callbackGuard failures err $ do
+        local <- output (c_duckdb_v2_table_function_exec_get_local_state info)
+        indexes <-
+          declaredColumns "exec" (c_duckdb_v2_table_function_exec_get_column_count info) (c_duckdb_v2_table_function_exec_get_column_index info)
+        batch <- atomicModifyIORef' next $ \value -> (value + 1, value)
+        chunk <- output (c_duckdb_v2_table_function_exec_get_output_chunk info)
+        let value declared row = case declared of
+              1 -> 10 * batch + row
+              2 -> batch
+              _ -> -1
+        if batch < 3
+          then do
+            forM_ (zip [0 ..] indexes) $ \(position, declared) -> writeColumn chunk position [value declared row | row <- [0 .. batch]]
+            setRows chunk (fromIntegral batch + 1)
+            poke (castPtr local) batch
+          else setRows chunk 0
+      partitioning info _context err = callbackGuard failures err $ do
+        user <- output (c_duckdb_v2_table_function_partitioning_get_user_data info)
+        bound <- output (c_duckdb_v2_table_function_partitioning_get_bind_data info)
+        expectRecorded "partitioning reads the user data and the bind data of its call" (user, bound) binds
+        indexes <-
+          declaredColumns
+            "partitioning"
+            (c_duckdb_v2_table_function_partitioning_get_partition_column_count info)
+            (c_duckdb_v2_table_function_partitioning_get_partition_column_index info)
+        record candidates indexes
+        c_duckdb_v2_table_function_partitioning_set_partition_info info (DuckDBV2TablePartitionInfo 99) nullPtr >>= (@?= DuckDBV2ErrorInputInvalid)
+        checked . c_duckdb_v2_table_function_partitioning_set_partition_info info $
+          if indexes == [2] then DuckDBV2TablePartitionInfoSingleValuePartitions else DuckDBV2TablePartitionInfoNotPartitioned
+      partitionData info context err = callbackGuard failures err $ do
+        user <- output (c_duckdb_v2_table_function_partition_data_get_user_data info)
+        bound <- output (c_duckdb_v2_table_function_partition_data_get_bind_data info)
+        global <- output (c_duckdb_v2_table_function_partition_data_get_global_state info)
+        local <- output (c_duckdb_v2_table_function_partition_data_get_local_state info)
+        expectRecorded "partition data reads the user data and the bind data of its call" (user, bound) binds
+        expectRecorded "partition data reads the global state of its scan" (bound, global) globals
+        expectRecorded "partition data reads the local state of the thread that wrote the chunk" (global, local) locals
+        required <- output (c_duckdb_v2_table_function_partition_data_requires_partition_columns info)
+        indexes <-
+          declaredColumns
+            "partition data"
+            (c_duckdb_v2_table_function_partition_data_get_partition_column_count info)
+            (c_duckdb_v2_table_function_partition_data_get_partition_column_index info)
+        record requests (required, indexes)
+        batch <- peek (castPtr local :: Ptr Int64)
+        -- The user data holds the mode of the function. Mode 0 obeys the rules of the batch index. Mode 1 sets no
+        -- batch index, mode 2 sets a decreasing batch index, and mode 3 keeps the batch index while the partition
+        -- value changes.
+        mode <- peek (castPtr user :: Ptr Int64)
+        case mode of
+          1 -> pure ()
+          2 -> checked (c_duckdb_v2_table_function_partition_data_set_batch_index info (fromIntegral (10 - batch)))
+          3 -> checked (c_duckdb_v2_table_function_partition_data_set_batch_index info 0)
+          _ -> checked (c_duckdb_v2_table_function_partition_data_set_batch_index info (fromIntegral batch))
+        factory <- output (c_duckdb_v2_context_get_factory context)
+        withView "text" $ \text -> withHandle (c_duckdb_v2_value_create_varchar factory text) c_duckdb_v2_value_destroy $ \wrong ->
+          c_duckdb_v2_table_function_partition_data_set_partition_value info 0 wrong nullPtr >>= (@?= DuckDBV2ErrorInputInvalid)
+        withHandle (c_duckdb_v2_value_create_bigint factory batch) c_duckdb_v2_value_destroy $ \partition -> do
+          c_duckdb_v2_table_function_partition_data_set_partition_value info (fromIntegral (length indexes)) partition nullPtr
+            >>= (@?= DuckDBV2ErrorInputInvalid)
+          checked (c_duckdb_v2_table_function_partition_data_set_partition_value info 0 partition)
+  with (0 :: Int64) $ \valid -> with (1 :: Int64) $ \unindexed -> with (2 :: Int64) $ \decreasing -> with (3 :: Int64) $ \unchanged ->
+    withFunPtr (DuckDBV2TableFunctionBindCallbackFn_Aux bind) $ \bindPtr ->
+      withFunPtr (DuckDBV2TableFunctionInitGlobalCallbackFn_Aux initGlobal) $ \initGlobalPtr ->
+        withFunPtr (DuckDBV2TableFunctionInitLocalCallbackFn_Aux initLocal) $ \initLocalPtr ->
+          withFunPtr (DuckDBV2TableFunctionExecCallbackFn_Aux execute) $ \executePtr ->
+            withFunPtr (DuckDBV2TableFunctionPartitioningCallbackFn_Aux partitioning) $ \partitioningPtr ->
+              withFunPtr (DuckDBV2TableFunctionPartitionDataCallbackFn_Aux partitionData) $ \partitionDataPtr -> withConnection $ \conn -> do
+                let register name user = registerTable conn name $ \function -> do
+                      lend user (checked . c_duckdb_v2_table_function_set_user_data function)
+                      checked (c_duckdb_v2_table_function_set_bind_callback function (DuckDBV2TableFunctionBindCallbackFn bindPtr))
+                      checked (c_duckdb_v2_table_function_set_init_global_callback function (DuckDBV2TableFunctionInitGlobalCallbackFn initGlobalPtr))
+                      checked (c_duckdb_v2_table_function_set_init_local_callback function (DuckDBV2TableFunctionInitLocalCallbackFn initLocalPtr))
+                      checked (c_duckdb_v2_table_function_set_exec_callback function (DuckDBV2TableFunctionExecCallbackFn executePtr))
+                      checked (c_duckdb_v2_table_function_set_partitioning_callback function (DuckDBV2TableFunctionPartitioningCallbackFn partitioningPtr))
+                      checked (c_duckdb_v2_table_function_set_partition_data_callback function (DuckDBV2TableFunctionPartitionDataCallbackFn partitionDataPtr))
+                      checked (c_duckdb_v2_table_function_set_projection_pushdown function (CBool 1))
+                    query name = "SELECT k * 100 + count(v) FROM " <> name <> "() GROUP BY k ORDER BY k"
+                forM_
+                  [("v2_partitioned", valid), ("v2_unindexed", unindexed), ("v2_decreasing", decreasing), ("v2_unchanged", unchanged)]
+                  (uncurry register)
+                withResult conn (query "v2_partitioned") $ \result -> readIntegers result >>= (@?= map Just [1, 102, 203])
+                -- Each other function breaks one rule of the batch index, so the query fails after its partition
+                -- data callback returns.
+                forM_ ["v2_unindexed", "v2_decreasing", "v2_unchanged"] $ \name -> do
+                  writeIORef next 0
+                  statementFails conn (query name)
+  readIORef failures >>= (@?= [])
+  asked <- readIORef candidates
+  assertBool "the partitioning callback was invoked" (not (null asked))
+  nub asked @?= [[2]]
+  seen <- readIORef requests
+  assertBool "the partition data callback was invoked" (not (null seen))
+  nub seen @?= [(CBool 1, [2])]
+
+-- | The function takes a percentage and reports it as the progress of its scan. The scan writes one row in each of
+-- 20 chunks. The test reads the progress of the connection after the first chunk of each result.
+-- The connection publishes progress only when the enable_progress_bar option is set.
+testProgress :: IO ()
+testProgress = do
+  failures <- newIORef []
+  calls <- newIORef (0 :: Int)
+  binds <- newIORef [] -- (user data, bind data) of each bound call
+  globals <- newIORef [] -- (bind data, global state) of each scan
+  let bind info result context err = callbackGuard failures err $ do
+        user <- output (c_duckdb_v2_function_bind_get_user_data info)
+        percent <- withHandle (c_duckdb_v2_function_bind_get_arg_value info 0) c_duckdb_v2_value_destroy (output . c_duckdb_v2_value_get_bigint)
+        addColumns result context ["value"]
+        bound <- give [percent] (c_duckdb_v2_function_bind_set_bind_data info)
+        record binds (user, bound)
+      -- The global state holds the number of rows written. Only one thread writes rows.
+      initGlobal info _context err = callbackGuard failures err $ do
+        bound <- output (c_duckdb_v2_table_function_init_global_get_bind_data info)
+        global <- give [0] (c_duckdb_v2_table_function_init_global_set_global_state info)
+        record globals (bound, global)
+      execute info _context err = callbackGuard failures err $ do
+        global <- castPtr <$> output (c_duckdb_v2_table_function_exec_get_global_state info)
+        written <- peek global
+        chunk <- output (c_duckdb_v2_table_function_exec_get_output_chunk info)
+        if written < (20 :: Int64)
+          then writeColumn chunk 0 [written] >> setRows chunk 1 >> poke global (written + 1)
+          else setRows chunk 0
+      progress info _context err = callbackGuard failures err $ do
+        atomicModifyIORef' calls $ \count -> (count + 1, ())
+        user <- output (c_duckdb_v2_table_function_progress_get_user_data info)
+        bound <- output (c_duckdb_v2_table_function_progress_get_bind_data info)
+        global <- output (c_duckdb_v2_table_function_progress_get_global_state info)
+        expectRecorded "progress reads the user data and the bind data of its call" (user, bound) binds
+        expectRecorded "progress reads the global state of its scan" (bound, global) globals
+        percent <- peek (castPtr bound :: Ptr Int64)
+        checked (c_duckdb_v2_table_function_progress_set_progress info (fromIntegral percent / 100))
+  with (5 :: Int64) $ \user ->
+    withFunPtr (DuckDBV2TableFunctionBindCallbackFn_Aux bind) $ \bindPtr ->
+      withFunPtr (DuckDBV2TableFunctionInitGlobalCallbackFn_Aux initGlobal) $ \initGlobalPtr ->
+        withFunPtr (DuckDBV2TableFunctionExecCallbackFn_Aux execute) $ \executePtr ->
+          withFunPtr (DuckDBV2TableFunctionProgressCallbackFn_Aux progress) $ \progressPtr -> withConnection $ \conn -> do
+            registerTable conn "v2_progress" $ \function -> do
+              lend user (checked . c_duckdb_v2_table_function_set_user_data function)
+              withFactory conn $ \factory -> withType factory "BIGINT" $ \ty -> withView "percent" $ \parameter -> do
+                signature <- output (c_duckdb_v2_table_function_get_signature function)
+                checked
+                  (c_duckdb_v2_function_signature_add_parameter signature (coerce parameter) ty (coerce nullPtr) DuckDBV2FunctionParameterKindStandard)
+              checked (c_duckdb_v2_table_function_set_bind_callback function (DuckDBV2TableFunctionBindCallbackFn bindPtr))
+              checked (c_duckdb_v2_table_function_set_init_global_callback function (DuckDBV2TableFunctionInitGlobalCallbackFn initGlobalPtr))
+              checked (c_duckdb_v2_table_function_set_exec_callback function (DuckDBV2TableFunctionExecCallbackFn executePtr))
+              checked (c_duckdb_v2_table_function_set_progress_callback function (DuckDBV2TableFunctionProgressCallbackFn progressPtr))
+            let current = alloca $ \percentage -> alloca $ \processed -> alloca $ \total -> do
+                  checked (c_duckdb_v2_connection_progress_get conn percentage processed total)
+                  (,,) <$> peek percentage <*> peek processed <*> peek total
+                -- Read the progress after the first chunk, while the query is active.
+                during percent = withResult conn ("SELECT value FROM v2_progress(" <> show (percent :: Int) <> ")") $ \result -> do
+                  alloca $ \chunk -> do
+                    poke chunk (coerce nullPtr)
+                    checked (c_duckdb_v2_result_fetch_chunk result chunk)
+                    peek chunk >>= assertBool "the query returns a first chunk" . (/= coerce nullPtr)
+                    c_duckdb_v2_data_chunk_destroy chunk >>= (@?= DuckDBV2ErrorNone)
+                  sample <- current
+                  consume result
+                  pure sample
+                checkRows (value, processed, total) = do
+                  assertBool ("rows processed " <> show processed <> " exceed the total " <> show total) (processed <= total)
+                  pure value
+            current >>= (@?= (-1, 0, 0))
+            during 25 >>= (@?= (-1, 0, 0))
+            withResult conn "SET enable_progress_bar_print = false" consume
+            withResult conn "SET enable_progress_bar = true" consume
+            -- Executor::GetPipelinesProgress adds the progress of all pipelines of the query. Thus the test
+            -- does not expect the percentage of the scan, only a higher query progress for a higher scan progress.
+            none <- during 0 >>= checkRows
+            quarter <- during 25 >>= checkRows
+            full <- during 100 >>= checkRows
+            assertBool
+              ("the query progress grows with the scan progress: " <> show [none, quarter, full])
+              (0 <= none && none < quarter && quarter < full && full <= 100)
+            -- The engine clamps a fraction outside [0, 1].
+            during 400 >>= checkRows >>= (@?= full)
+            during (-300) >>= checkRows >>= (@?= none)
+            current >>= (@?= (-1, 0, 0))
+  readIORef failures >>= (@?= [])
+  readIORef calls >>= assertBool "the progress callback was invoked" . (> 0)
+
+-- | A multi-file function wraps a function that reads one file. The wrapped function writes one row for each file.
+testBindInfo :: IO ()
+testBindInfo =
+  bracket
+    ( do
+        (path, handle) <- openBinaryTempFile "." "duckdb-v2-table"
+        hClose handle
+        pure path
+    )
+    (\path -> withCString path $ \name -> removeTestFile name >>= (@?= 0))
+    $ \path -> do
+      failures <- newIORef []
+      users <- newIORef [] -- the user data that each get bind info call read
+      let bind _info result context err = callbackGuard failures err (addColumns result context ["value"])
+          -- The global state of the scan of a file holds whether exec wrote the row of the file.
+          initGlobal info _context err = callbackGuard failures err (() <$ give [0] (c_duckdb_v2_table_function_init_global_set_global_state info))
+          execute info _context err = callbackGuard failures err $ do
+            global <- castPtr <$> output (c_duckdb_v2_table_function_exec_get_global_state info)
+            written <- peek global
+            chunk <- output (c_duckdb_v2_table_function_exec_get_output_chunk info)
+            if written == (0 :: Int64)
+              then writeColumn chunk 0 [42] >> setRows chunk 1 >> poke global 1
+              else setRows chunk 0
+          getBindInfo info _context err =
+            callbackGuard failures err $
+              output (c_duckdb_v2_table_function_get_bind_info_get_user_data info) >>= record users
+      with (6 :: Int64) $ \user ->
+        withFunPtr (DuckDBV2TableFunctionBindCallbackFn_Aux bind) $ \bindPtr ->
+          withFunPtr (DuckDBV2TableFunctionInitGlobalCallbackFn_Aux initGlobal) $ \initGlobalPtr ->
+            withFunPtr (DuckDBV2TableFunctionExecCallbackFn_Aux execute) $ \executePtr ->
+              withFunPtr (DuckDBV2TableFunctionGetBindInfoCallbackFn_Aux getBindInfo) $ \getBindInfoPtr -> do
+                withConnection $ \conn -> do
+                  registerTable conn "v2_file" $ \function -> do
+                    lend user (checked . c_duckdb_v2_table_function_set_user_data function)
+                    withFactory conn $ \factory -> withType factory "VARCHAR" $ \ty -> withView "path" $ \parameter -> do
+                      signature <- output (c_duckdb_v2_table_function_get_signature function)
+                      checked
+                        (c_duckdb_v2_function_signature_add_parameter signature (coerce parameter) ty (coerce nullPtr) DuckDBV2FunctionParameterKindStandard)
+                    checked (c_duckdb_v2_table_function_set_bind_callback function (DuckDBV2TableFunctionBindCallbackFn bindPtr))
+                    checked (c_duckdb_v2_table_function_set_init_global_callback function (DuckDBV2TableFunctionInitGlobalCallbackFn initGlobalPtr))
+                    checked (c_duckdb_v2_table_function_set_exec_callback function (DuckDBV2TableFunctionExecCallbackFn executePtr))
+                    checked (c_duckdb_v2_table_function_set_get_bind_info_callback function (DuckDBV2TableFunctionGetBindInfoCallbackFn getBindInfoPtr))
+                  withFactory conn $ \factory ->
+                    withHandle (c_duckdb_v2_multi_file_function_create factory) c_duckdb_v2_multi_file_function_destroy $ \files -> do
+                      withView "v2_files" $ \name -> checked (c_duckdb_v2_multi_file_function_set_name files (coerce name))
+                      withView "v2_file" $ \name -> checked (c_duckdb_v2_multi_file_function_set_single_file_function files (coerce name))
+                      checked (c_duckdb_v2_connection_register_multi_file_function conn files)
+                  withResult conn ("SELECT value FROM v2_files('" <> path <> "')") $ \result -> readIntegers result >>= (@?= [Just 42])
+                readIORef failures >>= (@?= [])
+                seen <- readIORef users
+                assertBool "the get bind info callback was invoked" (not (null seen))
+                nub seen @?= [castPtr user]
+
+-- | A node of a filter predicate, as the expression functions report it.
+data Node = Node DuckDBV2ExpressionType DuckDBV2LogicalTypeId Detail [Node]
+  deriving (Eq, Ord, Show)
+
+-- | What the accessor of the node type reads: the declared column of a column reference, the value of a constant,
+-- the qualified name of a function call, or the mode of a cast.
+data Detail = Column DuckDBIdx | Constant (Maybe Int64) | Function [String] | Cast DuckDBV2CastMode | Other
+  deriving (Eq, Ord, Show)
+
+-- | Assert that a call with an output slot fails. The slot starts as zero bytes, thus as a null handle.
+rejected :: (Storable a) => String -> (Ptr a -> Ptr DuckDBV2ErrorInfoHandle -> IO DuckDBV2Error) -> IO ()
+rejected what call = bracket calloc free $ \slot -> call slot nullPtr >>= assertBool what . (/= DuckDBV2ErrorNone)
+
+-- | Return the declared columns that the column references of a predicate point at.
+columnsOf :: Node -> [DuckDBIdx]
+columnsOf (Node _ _ detail children) = [column | Column column <- [detail]] <> concatMap columnsOf children
+
+-- | Read the qualified name of the function that a node calls, and check that its last part is the name of the function.
+-- The test reads the borrowed name after it destroys the qualified name, so that Valgrind checks the lifetime of the name.
+functionName :: DuckDBV2ExpressionHandle -> IO [String]
+functionName node = do
+  name <- output (c_duckdb_v2_expression_function_get_name node)
+  parts <- withHandle (c_duckdb_v2_expression_function_get_qname node) c_duckdb_v2_qname_destroy $ \qname -> do
+    count <- output (c_duckdb_v2_qname_get_part_count qname)
+    forM (take (fromIntegral count) [0 ..]) $ \index -> output (c_duckdb_v2_qname_get_part qname index) >>= readView . coerce
+  text <- readView (coerce name)
+  assertBool ("the qualified name " <> show parts <> " ends with the name " <> text) (drop (length parts - 1) parts == [text])
+  pure parts
+
+-- | Read a predicate node and its children through the expression functions.
+-- The walk also checks that each accessor rejects a node of a type that it does not apply to.
+readNode :: DuckDBV2TableFunctionFilterPushdownInfoHandle -> DuckDBV2ExpressionHandle -> IO Node
+readNode info node = do
+  kind <- output (c_duckdb_v2_expression_get_type node)
+  returned <-
+    withHandle (c_duckdb_v2_expression_get_return_type node) c_duckdb_v2_logical_type_destroy (output . c_duckdb_v2_logical_type_get_id)
+  count <- output (c_duckdb_v2_expression_get_child_count node)
+  children <- forM (take (fromIntegral count) [0 ..]) $ \index -> output (c_duckdb_v2_expression_get_child node index) >>= readNode info
+  rejected "get_child rejects the index that equals the child count" (c_duckdb_v2_expression_get_child node count)
+  let comparisons =
+        [ DuckDBV2ExpressionTypeCompareEqual
+        , DuckDBV2ExpressionTypeCompareNotequal
+        , DuckDBV2ExpressionTypeCompareLessthan
+        , DuckDBV2ExpressionTypeCompareGreaterthan
+        , DuckDBV2ExpressionTypeCompareLessthanorequalto
+        , DuckDBV2ExpressionTypeCompareGreaterthanorequalto
+        , DuckDBV2ExpressionTypeCompareDistinctFrom
+        , DuckDBV2ExpressionTypeCompareNotDistinctFrom
+        ]
+      calls = DuckDBV2ExpressionTypeBoundFunction : DuckDBV2ExpressionTypeCompareBetween : DuckDBV2ExpressionTypeOperatorCast : comparisons
+  unless (kind == DuckDBV2ExpressionTypeBoundColumnRef) $
+    rejected "column_ref_get_index rejects a node that is not a column reference" (c_duckdb_v2_expression_column_ref_get_index node)
+  -- The call destroys a value that constant_get_value creates all the same.
+  unless (kind == DuckDBV2ExpressionTypeValueConstant) $
+    rejected
+      "constant_get_value rejects a node that is not a constant"
+      (\slot err -> c_duckdb_v2_expression_constant_get_value node slot err <* c_duckdb_v2_value_destroy slot)
+  unless (kind == DuckDBV2ExpressionTypeOperatorCast) $
+    rejected "cast_get_mode rejects a node that is not a cast" (c_duckdb_v2_expression_cast_get_mode node)
+  -- The header does not tell if IN is a comparison. Thus the walk does not examine the name functions on IN.
+  unless (kind `elem` calls || kind == DuckDBV2ExpressionTypeCompareIn) $ do
+    rejected "function_get_name rejects a node that is not a function call" (c_duckdb_v2_expression_function_get_name node)
+    rejected
+      "function_get_qname rejects a node that is not a function call"
+      (\slot err -> c_duckdb_v2_expression_function_get_qname node slot err <* c_duckdb_v2_qname_destroy slot)
+  name <- if kind `elem` calls then functionName node else pure []
+  detail <- case kind of
+    DuckDBV2ExpressionTypeBoundColumnRef -> do
+      index <- output (c_duckdb_v2_expression_column_ref_get_index node)
+      Column <$> output (c_duckdb_v2_table_function_filter_pushdown_get_column_index info index)
+    DuckDBV2ExpressionTypeValueConstant ->
+      withHandle (c_duckdb_v2_expression_constant_get_value node) c_duckdb_v2_value_destroy $ \value -> do
+        isNull <- output (c_duckdb_v2_value_is_null value)
+        if isNull /= 0 then pure (Constant Nothing) else Constant . Just <$> output (c_duckdb_v2_value_get_bigint value)
+    DuckDBV2ExpressionTypeOperatorCast -> Cast <$> output (c_duckdb_v2_expression_cast_get_mode node)
+    -- The name of BETWEEN is internal.
+    _
+      | kind `elem` calls && kind /= DuckDBV2ExpressionTypeCompareBetween -> pure (Function name)
+      | otherwise -> pure Other
+  pure (Node kind returned detail children)
+
+-- | Two functions declare the columns a, b and c, with projection pushdown. The exec callback writes
+-- 100 * (declared column) + (row) into each scanned column, for five rows, and applies no filter.
+-- The user data holds the declared column whose predicates the filter pushdown callback accepts:
+-- -1 for v2_declining and 2 for v2_accepting.
+testFilterPushdown :: IO ()
+testFilterPushdown = do
+  failures <- newIORef []
+  binds <- newIORef [] -- (user data, bind data) of each bound call
+  offers <- newIORef [] -- (declared columns, predicates) of each filter pushdown call
+  scans <- newIORef [] -- the number of filter pushdown calls that each scan reads from its bind data
+  let bind info result context err = callbackGuard failures err $ do
+        user <- output (c_duckdb_v2_function_bind_get_user_data info)
+        addColumns result context ["a", "b", "c"]
+        bound <- give [0] (c_duckdb_v2_function_bind_set_bind_data info)
+        record binds (user, bound)
+      -- The global state holds whether exec wrote the rows. Only one thread writes rows.
+      initGlobal info _context err = callbackGuard failures err $ do
+        bound <- output (c_duckdb_v2_table_function_init_global_get_bind_data info)
+        peek (castPtr bound :: Ptr Int64) >>= record scans
+        () <$ give [0] (c_duckdb_v2_table_function_init_global_set_global_state info)
+      execute info _context err = callbackGuard failures err $ do
+        global <- castPtr <$> output (c_duckdb_v2_table_function_exec_get_global_state info)
+        written <- peek global
+        indexes <-
+          declaredColumns "exec" (c_duckdb_v2_table_function_exec_get_column_count info) (c_duckdb_v2_table_function_exec_get_column_index info)
+        chunk <- output (c_duckdb_v2_table_function_exec_get_output_chunk info)
+        if written == (0 :: Int64)
+          then do
+            forM_ (zip [0 ..] indexes) $ \(position, declared) -> writeColumn chunk position [100 * fromIntegral declared + row | row <- [0 .. 4]]
+            setRows chunk 5
+            poke global 1
+          else setRows chunk 0
+      pushdown info _context err = callbackGuard failures err $ do
+        user <- output (c_duckdb_v2_table_function_filter_pushdown_get_user_data info)
+        bound <- output (c_duckdb_v2_table_function_filter_pushdown_get_bind_data info)
+        expectRecorded "filter pushdown reads the user data and the bind data of its call" (user, bound) binds
+        -- Count the call in the bind data. The init callback reads the count from its own bind data.
+        peek (castPtr bound) >>= poke (castPtr bound) . (+ (1 :: Int64))
+        columns <-
+          declaredColumns
+            "filter pushdown"
+            (c_duckdb_v2_table_function_filter_pushdown_get_column_count info)
+            (c_duckdb_v2_table_function_filter_pushdown_get_column_index info)
+        count <- output (c_duckdb_v2_table_function_filter_pushdown_get_filter_count info)
+        rejected "get_filter rejects the index that equals the filter count" (c_duckdb_v2_table_function_filter_pushdown_get_filter info count)
+        c_duckdb_v2_table_function_filter_pushdown_accept info count nullPtr
+          >>= assertBool "accept rejects the index that equals the filter count" . (/= DuckDBV2ErrorNone)
+        predicates <- forM (take (fromIntegral count) [0 ..]) $ \index ->
+          output (c_duckdb_v2_table_function_filter_pushdown_get_filter info index) >>= readNode info
+        accepted <- peek (castPtr user :: Ptr Int64)
+        forM_ (zip [0 ..] predicates) $ \(index, predicate) ->
+          when (accepted `elem` map fromIntegral (columnsOf predicate)) $ checked (c_duckdb_v2_table_function_filter_pushdown_accept info index)
+        record offers (sort columns, sort predicates)
+  with (-1 :: Int64) $ \declining -> with (2 :: Int64) $ \accepting ->
+    withFunPtr (DuckDBV2TableFunctionBindCallbackFn_Aux bind) $ \bindPtr ->
+      withFunPtr (DuckDBV2TableFunctionInitGlobalCallbackFn_Aux initGlobal) $ \initGlobalPtr ->
+        withFunPtr (DuckDBV2TableFunctionExecCallbackFn_Aux execute) $ \executePtr ->
+          withFunPtr (DuckDBV2TableFunctionFilterPushdownCallbackFn_Aux pushdown) $ \pushdownPtr -> withConnection $ \conn -> do
+            let register name user = registerTable conn name $ \function -> do
+                  lend user (checked . c_duckdb_v2_table_function_set_user_data function)
+                  checked (c_duckdb_v2_table_function_set_bind_callback function (DuckDBV2TableFunctionBindCallbackFn bindPtr))
+                  checked (c_duckdb_v2_table_function_set_init_global_callback function (DuckDBV2TableFunctionInitGlobalCallbackFn initGlobalPtr))
+                  checked (c_duckdb_v2_table_function_set_exec_callback function (DuckDBV2TableFunctionExecCallbackFn executePtr))
+                  checked (c_duckdb_v2_table_function_set_filter_pushdown_callback function (DuckDBV2TableFunctionFilterPushdownCallbackFn pushdownPtr))
+                  checked (c_duckdb_v2_table_function_set_projection_pushdown function (CBool 1))
+                -- Return the values of a and the different (declared columns, predicates) of the filter pushdown calls.
+                query name condition = do
+                  writeIORef offers []
+                  writeIORef scans []
+                  rows <- withResult conn ("SELECT a FROM " <> name <> "()" <> condition) readIntegers
+                  seen <- readIORef offers
+                  readIORef scans >>= (@?= [fromIntegral (length seen)])
+                  pure (rows, nub seen)
+                -- The engine applies each predicate that the callback does not accept.
+                declined condition rows columns predicates =
+                  query "v2_declining" (" WHERE " <> condition) >>= (@?= (map Just rows, [(columns, sort predicates)]))
+                -- The engine does not apply an accepted predicate, and the scan does not apply it either.
+                accepted condition rows columns predicates = do
+                  (result, seen) <- query "v2_accepting" (" WHERE " <> condition)
+                  result @?= map Just rows
+                  assertBool ("the filter pushdown callback reads the predicates of " <> condition) ((columns, sort predicates) `elem` seen)
+                column declared = Node DuckDBV2ExpressionTypeBoundColumnRef DuckDBV2LogicalTypeIdBigInt (Column declared) []
+                constant ty value = Node DuckDBV2ExpressionTypeValueConstant ty (Constant value) []
+                bigint value = constant DuckDBV2LogicalTypeIdBigInt (Just value)
+                boolean kind = Node kind DuckDBV2LogicalTypeIdBoolean
+                comparison kind name left right = boolean kind (Function [name]) [left, right]
+                equal = comparison DuckDBV2ExpressionTypeCompareEqual "="
+                less = comparison DuckDBV2ExpressionTypeCompareLessthan "<"
+                greater = comparison DuckDBV2ExpressionTypeCompareGreaterthan ">"
+                call name = Node DuckDBV2ExpressionTypeBoundFunction DuckDBV2LogicalTypeIdBigInt (Function ["system", "main", name])
+                cast ty mode child = Node DuckDBV2ExpressionTypeOperatorCast ty (Cast mode) [child]
+            register "v2_declining" declining
+            register "v2_accepting" accepting
+            -- The engine does not call the callback for a query without a predicate.
+            query "v2_declining" "" >>= (@?= (map Just [0 .. 4], []))
+            declined "c > 202" [3, 4] [0, 2] [greater (column 2) (bigint 202)]
+            -- The engine splits a conjunction at the top into separate predicates.
+            declined "c > 201 AND a < 4" [2, 3] [0, 2] [greater (column 2) (bigint 201), less (column 0) (bigint 4)]
+            declined
+              "greatest_common_divisor(b - 100, 4) = 2"
+              [2]
+              [0, 1]
+              [equal (call "greatest_common_divisor" [call "-" [column 1, bigint 100], bigint 4]) (bigint 2)]
+            declined
+              "CAST(c AS INTEGER) = 203"
+              [3]
+              [0, 2]
+              [equal (cast DuckDBV2LogicalTypeIdInteger DuckDBV2CastModeNormal (column 2)) (constant DuckDBV2LogicalTypeIdInteger (Just 203))]
+            declined
+              "TRY_CAST(c AS VARCHAR) = '203'"
+              [3]
+              [0, 2]
+              [equal (cast DuckDBV2LogicalTypeIdVarchar DuckDBV2CastModeTry (column 2)) (constant DuckDBV2LogicalTypeIdVarchar (Just 203))]
+            declined
+              "(a = 1 AND c = 201) OR b = 103"
+              [1, 3]
+              [0, 1, 2]
+              [ boolean
+                  DuckDBV2ExpressionTypeConjunctionOr
+                  Other
+                  [ boolean DuckDBV2ExpressionTypeConjunctionAnd Other [equal (column 0) (bigint 1), equal (column 2) (bigint 201)]
+                  , equal (column 1) (bigint 103)
+                  ]
+              ]
+            declined "c BETWEEN 201 AND 203" [1, 2, 3] [0, 2] [boolean DuckDBV2ExpressionTypeCompareBetween Other [column 2, bigint 201, bigint 203]]
+            declined "c IN (201, 203)" [1, 3] [0, 2] [boolean DuckDBV2ExpressionTypeCompareIn Other [column 2, bigint 201, bigint 203]]
+            declined
+              "CASE WHEN a = 1 THEN NULL ELSE c END IS NULL"
+              [1]
+              [0, 2]
+              [ boolean
+                  DuckDBV2ExpressionTypeOperatorIsNull
+                  Other
+                  [ Node
+                      DuckDBV2ExpressionTypeCaseExpr
+                      DuckDBV2LogicalTypeIdBigInt
+                      Other
+                      [equal (column 0) (bigint 1), constant DuckDBV2LogicalTypeIdBigInt Nothing, column 2]
+                  ]
+              ]
+            accepted "c > 202" [0 .. 4] [0, 2] [greater (column 2) (bigint 202)]
+            accepted "c > 201 AND a < 4" [0 .. 3] [0, 2] [greater (column 2) (bigint 201), less (column 0) (bigint 4)]
+            accepted "a < 4 AND c > 201" [0 .. 3] [0, 2] [less (column 0) (bigint 4), greater (column 2) (bigint 201)]
+  readIORef failures >>= (@?= [])
+
+-- | The phases of v2_failing, in the order of the index that its states hold.
+failingPhases :: [String]
+failingPhases = ["none", "bind", "columns", "pushdown", "init", "exec"]
+
+-- | The argument of v2_failing names the callback that reports an error: bind, pushdown (the filter pushdown
+-- callback), init (the global init callback) or exec. With columns, the bind callback declares no result column. With
+-- none, no callback fails and the query returns the rows 2 and 3.
+-- The bind data and the global state hold their kind (1 or 2) and the index of the phase. Their destructor records the
+-- kind, so the test sees which states DuckDB destroyed.
+testFailingCallbacks :: IO ()
+testFailingCallbacks = do
+  failures <- newIORef []
+  destroyed <- newIORef []
+  let destroy ptr = peek (castPtr ptr :: Ptr Int64) >>= record destroyed >> free ptr
+  withFunPtr (DuckDBV2OpaqueDestroyFn_Aux destroy) $ \destroyPtr -> do
+    let -- Give DuckDB cells that hold the kind, the phase index and a flag, with the destructor that records the kind.
+        own kind phase setter = do
+          cells <- mallocArray 3
+          pokeArray cells [kind, fromIntegral (fromMaybe (-1) (elemIndex phase failingPhases)), 0 :: Int64]
+          let opaque = DuckDBV2Opaque (castPtr cells) (DuckDBV2OpaqueDestroyFn destroyPtr) (DuckDBV2OpaqueEqualsFn nullFunPtr)
+          with opaque (checked . setter) `onException` free cells
+        phaseOf state = (failingPhases !!) . fromIntegral <$> peekElemOff (castPtr state :: Ptr Int64) 1
+        failIn phase name = when (phase == name) $ failOnPurpose name
+        bind info result context err = callbackGuard failures err $ do
+          phase <-
+            withHandle
+              (c_duckdb_v2_function_bind_get_arg_value info 0)
+              c_duckdb_v2_value_destroy
+              (\value -> output (c_duckdb_v2_value_get_varchar value) >>= readView)
+          -- The function has one parameter, so the index 1 is out of bounds.
+          rejected
+            "get_arg_value rejects the index that equals the argument count"
+            (\slot slotErr -> c_duckdb_v2_function_bind_get_arg_value info 1 slot slotErr <* c_duckdb_v2_value_destroy slot)
+          -- The callback sets the bind data before it fails, so DuckDB owns the bind data and must destroy it.
+          own 1 phase (c_duckdb_v2_function_bind_set_bind_data info)
+          failIn phase "bind"
+          unless (phase == "columns") $ addColumns result context ["value"]
+        pushdown info _context err =
+          callbackGuard failures err $
+            output (c_duckdb_v2_table_function_filter_pushdown_get_bind_data info) >>= phaseOf >>= (`failIn` "pushdown")
+        initGlobal info _context err = callbackGuard failures err $ do
+          phase <- output (c_duckdb_v2_table_function_init_global_get_bind_data info) >>= phaseOf
+          own 2 phase (c_duckdb_v2_table_function_init_global_set_global_state info)
+          failIn phase "init"
+        execute info _context err = callbackGuard failures err $ do
+          output (c_duckdb_v2_table_function_exec_get_bind_data info) >>= phaseOf >>= (`failIn` "exec")
+          global <- castPtr <$> output (c_duckdb_v2_table_function_exec_get_global_state info)
+          written <- peekElemOff global 2
+          chunk <- output (c_duckdb_v2_table_function_exec_get_output_chunk info)
+          if written == (0 :: Int64)
+            then writeColumn chunk 0 [1, 2, 3] >> setRows chunk 3 >> pokeElemOff global 2 1
+            else setRows chunk 0
+    withFunPtr (DuckDBV2TableFunctionBindCallbackFn_Aux bind) $ \bindPtr ->
+      withFunPtr (DuckDBV2TableFunctionFilterPushdownCallbackFn_Aux pushdown) $ \pushdownPtr ->
+        withFunPtr (DuckDBV2TableFunctionInitGlobalCallbackFn_Aux initGlobal) $ \initGlobalPtr ->
+          withFunPtr (DuckDBV2TableFunctionExecCallbackFn_Aux execute) $ \executePtr -> withConnection $ \conn -> do
+            registerTable conn "v2_failing" $ \function -> do
+              withFactory conn $ \factory -> withType factory "VARCHAR" $ \ty -> withView "phase" $ \parameter -> do
+                signature <- output (c_duckdb_v2_table_function_get_signature function)
+                checked
+                  (c_duckdb_v2_function_signature_add_parameter signature (coerce parameter) ty (coerce nullPtr) DuckDBV2FunctionParameterKindStandard)
+              checked (c_duckdb_v2_table_function_set_bind_callback function (DuckDBV2TableFunctionBindCallbackFn bindPtr))
+              checked (c_duckdb_v2_table_function_set_filter_pushdown_callback function (DuckDBV2TableFunctionFilterPushdownCallbackFn pushdownPtr))
+              checked (c_duckdb_v2_table_function_set_init_global_callback function (DuckDBV2TableFunctionInitGlobalCallbackFn initGlobalPtr))
+              checked (c_duckdb_v2_table_function_set_exec_callback function (DuckDBV2TableFunctionExecCallbackFn executePtr))
+            let query phase = "SELECT value FROM v2_failing('" <> phase <> "') WHERE value > 1"
+                -- Return the kinds of the states that DuckDB destroyed since the last call.
+                takeDestroyed = sort <$> atomicModifyIORef' destroyed (\kinds -> ([], kinds))
+                succeeds = do
+                  withResult conn (query "none") readIntegers >>= (@?= [Just 2, Just 3])
+                  takeDestroyed >>= (@?= [1, 2])
+                -- The statement fails with the text of each recorded failure, and DuckDB destroyed the states of the given kinds.
+                -- Then the same statement without a failure succeeds on the same connection.
+                -- The header names no code for these failures, so the test checks only that the statement fails.
+                fails phase recorded kinds = do
+                  (code, text) <- statementError conn (query phase)
+                  assertBool (query phase <> " fails") (code /= DuckDBV2ErrorNone)
+                  forM_ recorded $ \failure -> assertBool ("the error contains the text of the callback: " <> text) (failure `isInfixOf` text)
+                  atomicModifyIORef' failures (\seen -> ([], seen)) >>= (@?= map (\failure -> "user error (" <> failure <> ")") recorded)
+                  takeDestroyed >>= assertEqual ("the destroyed states after " <> query phase) kinds
+                  succeeds
+            succeeds
+            fails "bind" ["v2 deliberate bind failure"] [1]
+            fails "columns" [] [1]
+            fails "pushdown" ["v2 deliberate pushdown failure"] [1]
+            fails "init" ["v2 deliberate init failure"] [1, 2]
+            fails "exec" ["v2 deliberate exec failure"] [1, 2]
+  readIORef failures >>= (@?= [])
+
+-- | Each change makes a table function incomplete: no name, no bind callback, no exec callback, a partitioning
+-- callback without a partition data callback, a return type, or the factory of another database. Each change makes a
+-- multi-file function incomplete: no name, no single-file function, or the factory of another database. A multi-file
+-- function also needs a single-file function that is registered and takes a path. The function without a change
+-- registers.
+testRegistration :: IO ()
+testRegistration =
+  withFunPtr (DuckDBV2TableFunctionBindCallbackFn_Aux (\_ _ _ _ -> pure ())) $ \bindPtr ->
+    withFunPtr (DuckDBV2TableFunctionExecCallbackFn_Aux (\_ _ _ -> pure ())) $ \executePtr ->
+      withFunPtr (DuckDBV2TableFunctionPartitioningCallbackFn_Aux (\_ _ _ -> pure ())) $ \partitioningPtr ->
+        withFunPtr (DuckDBV2TableFunctionPartitionDataCallbackFn_Aux (\_ _ _ -> pure ())) $ \partitionDataPtr ->
+          withConnection $ \conn -> withConnection $ \other -> do
+            let factoryFor change = if change == "another database" then other else conn
+                -- Register a table function with one parameter of the given type, with the change applied.
+                registerFunction name parameter change = withFactory (factoryFor change) $ \factory ->
+                  withHandle (c_duckdb_v2_table_function_create factory) c_duckdb_v2_table_function_destroy $ \function -> do
+                    unless (change == "no name") $ withView name $ \view -> checked (c_duckdb_v2_table_function_set_name function (coerce view))
+                    signature <- output (c_duckdb_v2_table_function_get_signature function)
+                    withType factory parameter $ \ty -> withView "input" $ \view ->
+                      checked (c_duckdb_v2_function_signature_add_parameter signature (coerce view) ty (coerce nullPtr) DuckDBV2FunctionParameterKindStandard)
+                    when (change == "a return type") $ withType factory "BIGINT" (checked . c_duckdb_v2_function_signature_set_return_type signature)
+                    unless (change == "no bind callback") $
+                      checked (c_duckdb_v2_table_function_set_bind_callback function (DuckDBV2TableFunctionBindCallbackFn bindPtr))
+                    unless (change == "no exec callback") $
+                      checked (c_duckdb_v2_table_function_set_exec_callback function (DuckDBV2TableFunctionExecCallbackFn executePtr))
+                    checked (c_duckdb_v2_table_function_set_partitioning_callback function (DuckDBV2TableFunctionPartitioningCallbackFn partitioningPtr))
+                    unless (change == "no partition data callback") $
+                      checked (c_duckdb_v2_table_function_set_partition_data_callback function (DuckDBV2TableFunctionPartitionDataCallbackFn partitionDataPtr))
+                    c_duckdb_v2_connection_register_table_function conn function nullPtr
+                -- Register a multi-file function that wraps the single-file function, with the change applied.
+                registerFiles single change = withFactory (factoryFor change) $ \factory ->
+                  withHandle (c_duckdb_v2_multi_file_function_create factory) c_duckdb_v2_multi_file_function_destroy $ \files -> do
+                    unless (change == "no name") $ withView "v2_files" $ \view -> checked (c_duckdb_v2_multi_file_function_set_name files (coerce view))
+                    unless (change == "no single-file function") $
+                      withView single $
+                        \view -> checked (c_duckdb_v2_multi_file_function_set_single_file_function files (coerce view))
+                    c_duckdb_v2_connection_register_multi_file_function conn files nullPtr
+                refused what code = assertBool (what <> " is refused: " <> show code) (code /= DuckDBV2ErrorNone)
+            forM_ ["no name", "no bind callback", "no exec callback", "no partition data callback", "a return type", "another database"] $ \change ->
+              registerFunction "v2_refused" "VARCHAR" change >>= refused ("a table function with " <> change)
+            registerFunction "v2_path" "VARCHAR" "" >>= (@?= DuckDBV2ErrorNone)
+            registerFunction "v2_number" "BIGINT" "" >>= (@?= DuckDBV2ErrorNone)
+            forM_
+              [("v2_path", "no name"), ("v2_path", "no single-file function"), ("v2_absent", ""), ("v2_number", ""), ("v2_path", "another database")]
+              $ \(single, change) ->
+                registerFiles single change >>= refused ("a multi-file function over " <> single <> " with " <> show change)
+            registerFiles "v2_path" "" >>= (@?= DuckDBV2ErrorNone)
diff --git a/test/V2Test.hs b/test/V2Test.hs
new file mode 100644
--- /dev/null
+++ b/test/V2Test.hs
@@ -0,0 +1,934 @@
+{-# LANGUAGE DataKinds #-}
+{-# LANGUAGE FlexibleContexts #-}
+{-# LANGUAGE ForeignFunctionInterface #-}
+{-# LANGUAGE ScopedTypeVariables #-}
+{-# LANGUAGE TypeApplications #-}
+
+module V2Test (
+  argCounts,
+  borrowedOpaque,
+  callbackGuard,
+  checked,
+  consume,
+  countCall,
+  eachPartRequired,
+  expectCallbackFailure,
+  failOnPurpose,
+  fillDocs,
+  output,
+  readArgument,
+  readIntegers,
+  readView,
+  record,
+  removeTestFile,
+  statementError,
+  statementFails,
+  tests,
+  withBytes,
+  withConnection,
+  withFactory,
+  withHandle,
+  withInstance,
+  withResult,
+  withStatement,
+  withType,
+  withView,
+) where
+
+import Control.Exception (SomeException, bracket, catch, finally, throwIO)
+import Control.Monad (forM, forM_, unless, void)
+import Data.Bits (testBit)
+import Data.Coerce (Coercible, coerce)
+import Data.IORef (IORef, atomicModifyIORef', modifyIORef', newIORef, readIORef)
+import Data.Int (Int64)
+import Data.List (isInfixOf)
+import Data.Proxy (Proxy (..))
+import Data.Void (Void)
+import Data.Word (Word64, Word8)
+import Database.DuckDB.FFI.V2
+import Foreign.C.ConstPtr (ConstPtr (..))
+import Foreign.C.String (CString, peekCStringLen, withCString, withCStringLen)
+import Foreign.C.Types (CBool (..), CInt (..))
+import Foreign.Marshal.Alloc (alloca, allocaBytes, free, malloc)
+import Foreign.Marshal.Array (withArray, withArrayLen)
+import Foreign.Marshal.Utils (fillBytes, with)
+import Foreign.Ptr (Ptr, castPtr, freeHaskellFunPtr, nullFunPtr, nullPtr)
+import Foreign.Storable (Storable (..))
+import GHC.Records (getField)
+import GHC.Stack (HasCallStack)
+import HsBindgen.Runtime.Prelude (fromFunPtr, staticSizeOf, toFunPtr)
+import HsBindgen.Runtime.PtrConst (PtrConst)
+import System.IO (hClose, openBinaryTempFile)
+import Test.Tasty (TestTree, testGroup)
+import Test.Tasty.HUnit (assertBool, assertFailure, testCase, (@?=))
+
+tests :: TestTree
+tests =
+  testGroup
+    "DuckDB V2"
+    [ testCase "environment refuses destruction while an instance is alive" testEnvironment
+    , testCase "streamed query exposes schema, selection and validity" testQuery
+    , testCase "statement binding exposes output and parameter schemas" testBind
+    , testCase "live results reject another execution and cancellation releases the cursor" testCancellation
+    , testCase "prepared execution binds named values repeatedly" testPrepared
+    , testCase "length-delimited strings retain interior null bytes" testStrings
+    , testCase "numeric structures round-trip through values" testNumericStructures
+    , testCase "result errors own their diagnostic text" testError
+    , testCase "scalar callbacks write result vectors" testScalar
+    , testCase "table callbacks own scan state after the builder is destroyed" testTable
+    , testCase "aggregate callbacks traverse grouped state arrays" testAggregate
+    , testCase "custom catalog types invoke registered cast callbacks" testCast
+    , testCase "writable vectors expose constants, sequences, nulls and string storage" testVectorMutation
+    , testCase "connection options distinguish session and global settings" testOptions
+    , testCase "COPY callbacks consume input and release their owned state" testCopy
+    , testCase "native file I/O preserves positions and closes owned handles" testFileSystem
+    , testCase "callback logging respects the connection log configuration" testLogging
+    , testCase "native C text sink receives the rendered result" testTextSink
+    , testCase "Arrow stream transfers result ownership and yields rows" testArrow
+    ]
+
+checked :: (HasCallStack) => (Ptr DuckDBV2ErrorInfoHandle -> IO DuckDBV2Error) -> IO ()
+checked action = alloca $ \err -> do
+  poke err (coerce nullPtr)
+  code <- action err
+  info <- peek err
+  message <-
+    if info == coerce nullPtr
+      then pure ""
+      else alloca $ \text -> do
+        textCode <- c_duckdb_v2_error_info_get_text info text
+        if textCode == DuckDBV2ErrorNone
+          then peek text >>= readView
+          else pure ("diagnostic failed: " <> show textCode)
+  void (c_duckdb_v2_error_info_destroy err)
+  unless (code == DuckDBV2ErrorNone) $ assertFailure (show code <> ": " <> message)
+
+withHandle
+  :: (HasCallStack, Storable a, Eq a, Coercible (Ptr Void) a)
+  => (Ptr a -> Ptr DuckDBV2ErrorInfoHandle -> IO DuckDBV2Error) -> (Ptr a -> IO DuckDBV2Error) -> (a -> IO b) -> IO b
+withHandle create destroy action = alloca $ \slot -> do
+  poke slot (coerce nullPtr)
+  checked (create slot)
+  handle <- peek slot
+  assertBool "created handle is non-null" (handle /= coerce nullPtr)
+  action handle `finally` (destroy slot >>= (@?= DuckDBV2ErrorNone))
+
+-- | Open an instance with two threads and an attached in-memory database.
+withInstance :: (DuckDBV2InstanceHandle -> IO a) -> IO a
+withInstance action =
+  withHandle c_duckdb_v2_environment_create c_duckdb_v2_environment_destroy $ \env ->
+    withHandle (c_duckdb_v2_instance_create env) c_duckdb_v2_instance_destroy $ \instanceHandle -> do
+      config <- output (c_duckdb_v2_instance_get_config instanceHandle)
+      withView "threads" $ \name -> withView "2" $ \setting ->
+        checked (c_duckdb_v2_config_set_option_text config (coerce name) setting DuckDBV2SettingScopeDefault)
+      withView ":memory:" $ \path ->
+        checked (c_duckdb_v2_instance_attach instanceHandle (coerce nullPtr) path (coerce nullPtr) (CBool 1))
+      action instanceHandle
+
+withConnection :: (DuckDBV2ConnectionHandle -> IO a) -> IO a
+withConnection action = withInstance $ \instanceHandle ->
+  withHandle (c_duckdb_v2_connection_create instanceHandle) c_duckdb_v2_connection_destroy action
+
+-- | Borrow a factory for the lifetime of its connection.
+withFactory :: DuckDBV2ConnectionHandle -> (DuckDBV2FactoryHandle -> IO a) -> IO a
+withFactory conn action = output (c_duckdb_v2_connection_get_factory conn) >>= action
+
+-- | Create a logical type from its SQL text.
+withType :: DuckDBV2FactoryHandle -> String -> (DuckDBV2LogicalTypeHandle -> IO a) -> IO a
+withType factory text action = withView text $ \view ->
+  withHandle (c_duckdb_v2_factory_create_type_from_text factory view) c_duckdb_v2_logical_type_destroy action
+
+withView :: String -> (PtrConst DuckDBV2Str -> IO a) -> IO a
+withView text action = withCStringLen text $ \(ptr, len) -> with (DuckDBV2Str (ConstPtr ptr) (fromIntegral len)) (action . ConstPtr)
+
+-- | Pass raw bytes as a view, without a text encoding.
+withBytes :: [Word8] -> (PtrConst DuckDBV2Str -> IO a) -> IO a
+withBytes bytes action = withArrayLen bytes $ \len ptr -> with (DuckDBV2Str (ConstPtr (castPtr ptr)) (fromIntegral len)) (action . ConstPtr)
+
+readView :: DuckDBV2Str -> IO String
+readView (DuckDBV2Str ptr len)
+  | len == 0 = pure ""
+  | otherwise = peekCStringLen (coerce ptr, fromIntegral len)
+
+withStatement :: DuckDBV2ConnectionHandle -> String -> (DuckDBV2SqlStatementHandle -> IO a) -> IO a
+withStatement conn sql action = withCString sql $ \text ->
+  withHandle (c_duckdb_v2_parse_sql conn (ConstPtr text)) c_duckdb_v2_statement_iterator_destroy $ \iterator ->
+    withHandle (c_duckdb_v2_statement_iterator_next iterator) c_duckdb_v2_sql_statement_destroy action
+
+withResult :: DuckDBV2ConnectionHandle -> String -> (DuckDBV2ResultHandle -> IO a) -> IO a
+withResult conn sql action = withStatement conn sql $ \statement ->
+  withHandle (c_duckdb_v2_statement_execute conn statement (coerce nullPtr) (coerce nullPtr) 0) c_duckdb_v2_result_destroy action
+
+output :: (HasCallStack, Storable a) => (Ptr a -> Ptr DuckDBV2ErrorInfoHandle -> IO DuckDBV2Error) -> IO a
+output action = alloca $ \slot -> checked (action slot) >> peek slot
+
+readIntegers :: DuckDBV2ResultHandle -> IO [Maybe Int64]
+readIntegers result = alloca $ \chunkSlot -> do
+  poke chunkSlot (coerce nullPtr)
+  checked (c_duckdb_v2_result_fetch_chunk result chunkSlot)
+  chunk <- peek chunkSlot
+  if chunk == coerce nullPtr
+    then pure []
+    else do
+      rows <-
+        ( do
+            vector <- output (c_duckdb_v2_data_chunk_get_vector chunk 0)
+            view <- output (c_duckdb_v2_vector_get_view vector)
+            forM [0 .. fromIntegral (getField @"count" view) - 1] $ \i -> do
+              index <-
+                if getField @"sel" view == coerce nullPtr
+                  then pure i
+                  else fromIntegral <$> peekElemOff (coerce (getField @"sel" view) :: Ptr DuckDBV2SelT) i
+              valid <-
+                if getField @"validity" view == coerce nullPtr
+                  then pure True
+                  else do
+                    word <- peekElemOff (coerce (getField @"validity" view) :: Ptr Word64) (index `div` 64)
+                    pure (testBit word (index `mod` 64))
+              if valid
+                then Just <$> peekElemOff (coerce (getField @"data'" view)) index
+                else pure Nothing
+        )
+          `finally` (c_duckdb_v2_data_chunk_destroy chunkSlot >>= (@?= DuckDBV2ErrorNone))
+      rest <- readIntegers result
+      pure (rows <> rest)
+
+-- | Read every BIGINT of a vector. The function flattens the vector first.
+readArgument :: DuckDBIdx -> DuckDBV2VectorHandle -> IO [Int64]
+readArgument count vector = do
+  checked (c_duckdb_v2_vector_flatten vector)
+  view <- output (c_duckdb_v2_vector_get_view vector)
+  forM [0 .. fromIntegral count - 1] $ \i -> do
+    index <-
+      if getField @"sel" view == coerce nullPtr
+        then pure i
+        else fromIntegral <$> peekElemOff (coerce (getField @"sel" view) :: Ptr DuckDBV2SelT) i
+    peekElemOff (coerce (getField @"data'" view)) index
+
+-- | Fetch and destroy every chunk of the result.
+consume :: DuckDBV2ResultHandle -> IO ()
+consume result = alloca $ \chunk -> do
+  poke chunk (coerce nullPtr)
+  checked (c_duckdb_v2_result_fetch_chunk result chunk)
+  next <- peek chunk
+  unless (next == coerce nullPtr) $ do
+    c_duckdb_v2_data_chunk_destroy chunk >>= (@?= DuckDBV2ErrorNone)
+    consume result
+
+-- | Run a statement and return the code and the text of its error.
+-- Execution is lazy, so the error can come from the execution or from a later fetch.
+-- A statement that does not fail gives 'DuckDBV2ErrorNone' and an empty text.
+statementError :: DuckDBV2ConnectionHandle -> String -> IO (DuckDBV2Error, String)
+statementError conn sql = withStatement conn sql $ \statement -> alloca $ \result -> alloca $ \err -> do
+  poke result (coerce nullPtr)
+  poke err (coerce nullPtr)
+  let fetch = alloca $ \chunk -> do
+        poke chunk (coerce nullPtr)
+        code <- peek result >>= \live -> c_duckdb_v2_result_fetch_chunk live chunk err
+        next <- peek chunk
+        if code /= DuckDBV2ErrorNone || next == coerce nullPtr
+          then pure code
+          else c_duckdb_v2_data_chunk_destroy chunk >>= (@?= DuckDBV2ErrorNone) >> fetch
+      cleanUp = do
+        c_duckdb_v2_result_destroy result >>= (@?= DuckDBV2ErrorNone)
+        c_duckdb_v2_error_info_destroy err >>= (@?= DuckDBV2ErrorNone)
+  flip finally cleanUp $ do
+    executed <- c_duckdb_v2_statement_execute conn statement (coerce nullPtr) (coerce nullPtr) 0 result err
+    code <- if executed == DuckDBV2ErrorNone then fetch else pure executed
+    info <- peek err
+    message <-
+      if code == DuckDBV2ErrorNone || info == coerce nullPtr
+        then pure ""
+        else alloca $ \text -> do
+          c_duckdb_v2_error_info_get_text info text >>= (@?= DuckDBV2ErrorNone)
+          peek text >>= readView
+    pure (code, message)
+
+testEnvironment :: IO ()
+testEnvironment = alloca $ \envSlot -> do
+  poke envSlot (coerce nullPtr)
+  checked (c_duckdb_v2_environment_create envSlot)
+  env <- peek envSlot
+  withHandle (c_duckdb_v2_instance_create env) c_duckdb_v2_instance_destroy $ \_ -> do
+    output (c_duckdb_v2_environment_get_instance_count env) >>= (@?= 1)
+    c_duckdb_v2_environment_destroy envSlot >>= (@?= DuckDBV2ErrorResourceInUse)
+    peek envSlot >>= (@?= env)
+  output (c_duckdb_v2_environment_get_instance_count env) >>= (@?= 0)
+  c_duckdb_v2_environment_destroy envSlot >>= (@?= DuckDBV2ErrorNone)
+  peek envSlot >>= (@?= coerce nullPtr)
+
+testQuery :: IO ()
+testQuery = withConnection $ \conn ->
+  withResult conn "SELECT CASE WHEN i % 3 = 0 THEN NULL ELSE i END::BIGINT AS amount FROM range(10) t(i) WHERE i % 2 = 0 ORDER BY i" $ \result -> do
+    withHandle (c_duckdb_v2_result_get_schema result) c_duckdb_v2_schema_destroy $ \schema -> do
+      output (c_duckdb_v2_schema_get_count schema) >>= (@?= 1)
+      alloca $ \name -> do
+        ty <- output (c_duckdb_v2_schema_get_field schema 0 name)
+        peek name >>= (readView . coerce) >>= (@?= "amount")
+        output (c_duckdb_v2_logical_type_get_id ty) >>= (@?= DuckDBV2LogicalTypeIdBigInt)
+    readIntegers result >>= (@?= [Nothing, Just 2, Just 4, Nothing, Just 8])
+    readIntegers result >>= (@?= [])
+
+testBind :: IO ()
+testBind = withConnection $ \conn -> withStatement conn "SELECT $amount::BIGINT AS total" $ \statement ->
+  alloca $ \parameters -> do
+    poke parameters (coerce nullPtr)
+    withHandle (\schema err -> c_duckdb_v2_statement_bind conn statement schema parameters err) c_duckdb_v2_schema_destroy $ \schema -> do
+      output (c_duckdb_v2_schema_get_count schema) >>= (@?= 1)
+      params <- peek parameters
+      assertBool "parameter schema is non-null" (params /= coerce nullPtr)
+      (output (c_duckdb_v2_schema_get_count params) >>= (@?= 1))
+        `finally` void (c_duckdb_v2_schema_destroy parameters)
+
+testCancellation :: IO ()
+testCancellation = withConnection $ \conn -> withResult conn "SELECT i::BIGINT FROM range(100000) t(i)" $ \result -> do
+  withStatement conn "SELECT 9::BIGINT" $ \statement -> alloca $ \slot -> do
+    poke slot (coerce nullPtr)
+    code <- c_duckdb_v2_statement_execute conn statement (coerce nullPtr) (coerce nullPtr) 0 slot (coerce nullPtr)
+    code @?= DuckDBV2ErrorResourceInUse
+    peek slot >>= (@?= coerce nullPtr)
+  checked (c_duckdb_v2_connection_interrupt conn)
+  alloca $ \chunk -> alloca $ \status -> do
+    poke chunk (coerce nullPtr)
+    checked (c_duckdb_v2_result_step result chunk status)
+    peek status >>= (@?= DuckDBV2ResultStepStatusCancelled)
+    peek chunk >>= (@?= coerce nullPtr)
+  withResult conn "SELECT 9::BIGINT" $ \second -> readIntegers second >>= (@?= [Just 9])
+
+testPrepared :: IO ()
+testPrepared = withConnection $ \conn -> withFactory conn $ \factory ->
+  withStatement conn "SELECT $amount::BIGINT + 1 AS answer" $ \statement ->
+    withHandle (c_duckdb_v2_prepared_statement_create conn statement (CBool 1)) c_duckdb_v2_prepared_statement_destroy $ \prepared -> do
+      output (c_duckdb_v2_prepared_statement_reuses_plan prepared) >>= (@?= CBool 1)
+      forM_ [40, 41] $ \amount ->
+        withHandle (c_duckdb_v2_value_create_bigint factory amount) c_duckdb_v2_value_destroy $ \value ->
+          withView "amount" $ \name -> withArray [value] $ \values ->
+            withHandle (c_duckdb_v2_prepared_statement_execute prepared (coerce name) (ConstPtr values) 1) c_duckdb_v2_result_destroy $ \result ->
+              readIntegers result >>= (@?= [Just (amount + 1)])
+
+testStrings :: IO ()
+testStrings = withConnection $ \conn -> withFactory conn $ \factory -> withView "alpha\0omega" $ \input ->
+  withHandle (c_duckdb_v2_value_create_varchar factory input) c_duckdb_v2_value_destroy $ \value -> do
+    output (c_duckdb_v2_value_get_varchar value) >>= readView >>= (@?= "alpha\0omega")
+    withStatement conn "SELECT length($text)::BIGINT" $ \statement ->
+      withView "text" $ \name -> withArray [value] $ \values ->
+        withHandle (c_duckdb_v2_statement_execute conn statement (coerce name) (ConstPtr values) 1) c_duckdb_v2_result_destroy $ \result ->
+          readIntegers result >>= (@?= [Just 11])
+
+testNumericStructures :: IO ()
+testNumericStructures = withConnection $ \conn -> withFactory conn $ \factory -> do
+  let huge = DuckDBV2HugeintT 0xffffffffffffffff (-7)
+      unsigned = DuckDBV2UhugeintT 0xfffffffffffffffd 13
+      interval = DuckDBV2IntervalT 3 (-2) 1234567
+  with huge $ \ptr ->
+    withHandle (c_duckdb_v2_value_create_hugeint factory (ConstPtr ptr)) c_duckdb_v2_value_destroy $ \value ->
+      output (c_duckdb_v2_value_get_hugeint value) >>= (@?= huge)
+  with unsigned $ \ptr ->
+    withHandle (c_duckdb_v2_value_create_uhugeint factory (ConstPtr ptr)) c_duckdb_v2_value_destroy $ \value ->
+      output (c_duckdb_v2_value_get_uhugeint value) >>= (@?= unsigned)
+  with interval $ \ptr ->
+    withHandle (c_duckdb_v2_value_create_interval factory (ConstPtr ptr)) c_duckdb_v2_value_destroy $ \value ->
+      output (c_duckdb_v2_value_get_interval value) >>= (@?= interval)
+
+testError :: IO ()
+testError = withConnection $ \conn -> withStatement conn "SELECT absent_column" $ \statement -> alloca $ \result -> alloca $ \err -> do
+  poke result (coerce nullPtr)
+  poke err (coerce nullPtr)
+  code <- c_duckdb_v2_statement_execute conn statement (coerce nullPtr) (coerce nullPtr) 0 result err
+  code @?= DuckDBV2ErrorQueryBinder
+  peek result >>= (@?= coerce nullPtr)
+  info <- peek err
+  assertBool "failure has an owned error handle" (info /= coerce nullPtr)
+  alloca $ \stored -> do
+    c_duckdb_v2_error_info_get_code info stored >>= (@?= DuckDBV2ErrorNone)
+    peek stored >>= (@?= code)
+  alloca $ \text -> do
+    c_duckdb_v2_error_info_get_text info text >>= (@?= DuckDBV2ErrorNone)
+    message <- peek text >>= readView
+    assertBool "error identifies the missing column" ("absent_column" `isInfixOf` message)
+  c_duckdb_v2_error_info_destroy err >>= (@?= DuckDBV2ErrorNone)
+  peek err >>= (@?= coerce nullPtr)
+
+-- | Read the sizes of the four parts of an argument list through one getter.
+argCounts
+  :: (Ptr DuckDBIdx -> Ptr DuckDBIdx -> Ptr DuckDBIdx -> Ptr DuckDBIdx -> Ptr DuckDBV2ErrorInfoHandle -> IO DuckDBV2Error)
+  -> IO (DuckDBIdx, DuckDBIdx, DuckDBIdx, DuckDBIdx)
+argCounts getter = alloca $ \fixed -> alloca $ \variadic -> alloca $ \named -> alloca $ \kwargs -> do
+  checked (getter fixed variadic named kwargs)
+  (,,,) <$> peek fixed <*> peek variadic <*> peek named <*> peek kwargs
+
+-- | Fill in borrowed documentation with a description, two examples and a category.
+-- The second description replaces the first, and the second example has no title.
+fillDocs :: DuckDBV2FunctionDocsHandle -> IO ()
+fillDocs docs = do
+  assertBool "the documentation is non-null" (docs /= coerce nullPtr)
+  withView "Adds one." $ \description -> checked (c_duckdb_v2_function_docs_set_description docs description)
+  withView "Replaces the description." $ \description -> checked (c_duckdb_v2_function_docs_set_description docs description)
+  withView "basic" $ \title -> withView "SELECT v2_plus_one(1)" $ \example ->
+    checked (c_duckdb_v2_function_docs_add_example docs title example)
+  withView "SELECT v2_plus_one(2)" $ \example -> checked (c_duckdb_v2_function_docs_add_example docs (ConstPtr nullPtr) example)
+  withView "numeric" $ \category -> checked (c_duckdb_v2_function_docs_add_category docs category)
+
+-- | Wrap a pointer that the test owns. The engine does not destroy it.
+borrowedOpaque :: Ptr Void -> DuckDBV2Opaque
+borrowedOpaque ptr = DuckDBV2Opaque ptr (DuckDBV2OpaqueDestroyFn nullFunPtr) (DuckDBV2OpaqueEqualsFn nullFunPtr)
+
+-- | Count one invocation of a callback. Callbacks can run on more than one thread.
+countCall :: IORef Int -> IO ()
+countCall calls = atomicModifyIORef' calls (\count -> (count + 1, ()))
+
+-- | Add a value to the front of a list. Callbacks can run on more than one thread.
+record :: IORef [a] -> a -> IO ()
+record ref value = atomicModifyIORef' ref (\values -> (value : values, ()))
+
+callbackGuard :: IORef [String] -> Ptr DuckDBV2ErrorInfoHandle -> IO () -> IO ()
+callbackGuard failures err action =
+  action `catch` \(failure :: SomeException) -> do
+    modifyIORef' failures (show failure :)
+    info <- peek err
+    void (c_duckdb_v2_error_info_set_code info DuckDBV2ErrorApi)
+    withView (show failure) $ \message -> void (c_duckdb_v2_error_info_set_text info message)
+
+-- | Run a statement that must fail. Use it where the header names no code for the failure.
+statementFails :: (HasCallStack) => DuckDBV2ConnectionHandle -> String -> IO ()
+statementFails conn sql = statementError conn sql >>= \(code, _) -> assertBool (sql <> " fails") (code /= DuckDBV2ErrorNone)
+
+-- | Fail a callback on purpose at a stage. 'callbackGuard' records the failure and reports it to DuckDB.
+failOnPurpose :: String -> IO ()
+failOnPurpose stage = throwIO (userError ("v2 deliberate " <> stage <> " failure"))
+
+-- | Run a statement that a callback fails on purpose at a stage.
+-- The statement must fail with the text of the callback, and the failure list must hold only that failure.
+-- The function clears the failure list.
+expectCallbackFailure :: (HasCallStack) => IORef [String] -> DuckDBV2ConnectionHandle -> String -> String -> IO ()
+expectCallbackFailure failures conn sql stage = do
+  (code, message) <- statementError conn sql
+  let expected = show (userError ("v2 deliberate " <> stage <> " failure"))
+  assertBool (sql <> " fails") (code /= DuckDBV2ErrorNone)
+  assertBool ("the error has the text of the callback: " <> message) (expected `isInfixOf` message)
+  atomicModifyIORef' failures (\seen -> ([], seen)) >>= (@?= [expected])
+
+-- | Register a builder once without each required part, and then once with every part.
+-- The register function receives the name of the part to leave out, or an empty name for none.
+-- Each registration without a part must fail, and the last registration must succeed.
+eachPartRequired :: (HasCallStack) => [String] -> (String -> IO DuckDBV2Error) -> IO ()
+eachPartRequired parts register = do
+  forM_ parts $ \part -> register part >>= \code -> assertBool ("a registration without the " <> part <> " fails") (code /= DuckDBV2ErrorNone)
+  register "" >>= (@?= DuckDBV2ErrorNone)
+
+testScalar :: IO ()
+testScalar = do
+  failures <- newIORef []
+  calls <- newIORef (0 :: Int)
+  let callback info _context err = callbackGuard failures err $ do
+        modifyIORef' calls (+ 1)
+        rows <- output (c_duckdb_v2_scalar_function_exec_get_row_count info)
+        vector <- output (c_duckdb_v2_scalar_function_exec_get_result info)
+        dataPtr <- output (c_duckdb_v2_vector_get_data_mutable vector)
+        forM_ [0 .. fromIntegral rows - 1] $ \i -> pokeElemOff (coerce dataPtr) i (42 :: Int64)
+  bracket
+    (DuckDBV2ScalarFunctionExecCallbackFn <$> toFunPtr (DuckDBV2ScalarFunctionExecCallbackFn_Aux callback))
+    (freeHaskellFunPtr . getField @"unwrap")
+    $ \callbackPtr ->
+      withConnection $ \conn -> withFactory conn $ \factory ->
+        withHandle
+          (c_duckdb_v2_factory_create_type_from_id factory DuckDBV2LogicalTypeIdBigInt (coerce nullPtr) (coerce nullPtr) 0)
+          c_duckdb_v2_logical_type_destroy
+          $ \ty ->
+            withHandle (c_duckdb_v2_scalar_function_create factory) c_duckdb_v2_scalar_function_destroy $ \function -> do
+              withView "v2_answer" $ \name -> checked (c_duckdb_v2_scalar_function_set_name function (coerce name))
+              signature <- output (c_duckdb_v2_scalar_function_get_signature function)
+              checked (c_duckdb_v2_function_signature_set_return_type signature ty)
+              checked (c_duckdb_v2_scalar_function_set_exec_callback function callbackPtr)
+              checked (c_duckdb_v2_connection_register_scalar_function conn function)
+              withResult conn "SELECT v2_answer() FROM range(3)" $ \result -> readIntegers result >>= (@?= replicate 3 (Just 42))
+  readIORef failures >>= (@?= [])
+  readIORef calls >>= assertBool "scalar callback was invoked" . (> 0)
+
+testTable :: IO ()
+testTable = do
+  failures <- newIORef []
+  destroyed <- newIORef (0 :: Int)
+  let destroyState ptr = free ptr >> modifyIORef' destroyed (+ 1)
+      bind info result context err = callbackGuard failures err $ do
+        contextFactory <- output (c_duckdb_v2_context_get_factory context)
+        withHandle (c_duckdb_v2_function_bind_get_arg_value info 0) c_duckdb_v2_value_destroy $ \value ->
+          output (c_duckdb_v2_value_get_bigint value) >>= (@?= 3)
+        withHandle
+          (c_duckdb_v2_factory_create_type_from_id contextFactory DuckDBV2LogicalTypeIdBigInt (coerce nullPtr) (coerce nullPtr) 0)
+          c_duckdb_v2_logical_type_destroy
+          $ \ty ->
+            withView "amount" $ \name -> checked (c_duckdb_v2_table_function_bind_add_result_column result (coerce name) ty)
+        checked (c_duckdb_v2_table_function_bind_set_cardinality result 3 (CBool 1))
+      execute info _context err = callbackGuard failures err $ do
+        state <- output (c_duckdb_v2_table_function_exec_get_global_state info)
+        emitted <- peek (coerce state :: Ptr Int64)
+        chunk <- output (c_duckdb_v2_table_function_exec_get_output_chunk info)
+        vector <- output (c_duckdb_v2_data_chunk_get_vector chunk 0)
+        if emitted == 0
+          then do
+            raw <- output (c_duckdb_v2_vector_get_data_mutable vector)
+            forM_ [0 .. 2] $ \i -> pokeElemOff (coerce raw) i (42 + fromIntegral i :: Int64)
+            checked (c_duckdb_v2_vector_set_size vector 3)
+            poke (coerce state) (1 :: Int64)
+          else checked (c_duckdb_v2_vector_set_size vector 0)
+  bracket (DuckDBV2OpaqueDestroyFn <$> toFunPtr (DuckDBV2OpaqueDestroyFn_Aux destroyState)) (freeHaskellFunPtr . getField @"unwrap") $ \destroyPtr -> do
+    let initialize info _context err = callbackGuard failures err $ do
+          state <- malloc
+          poke state (0 :: Int64)
+          with (DuckDBV2Opaque (coerce state) destroyPtr (DuckDBV2OpaqueEqualsFn nullFunPtr)) $ \opaque ->
+            checked (c_duckdb_v2_table_function_init_global_set_global_state info opaque)
+          checked (c_duckdb_v2_table_function_init_global_set_max_threads info 1)
+    bracket
+      (DuckDBV2TableFunctionBindCallbackFn <$> toFunPtr (DuckDBV2TableFunctionBindCallbackFn_Aux bind))
+      (freeHaskellFunPtr . getField @"unwrap")
+      $ \bindPtr ->
+        bracket
+          (DuckDBV2TableFunctionInitGlobalCallbackFn <$> toFunPtr (DuckDBV2TableFunctionInitGlobalCallbackFn_Aux initialize))
+          (freeHaskellFunPtr . getField @"unwrap")
+          $ \initializePtr ->
+            bracket
+              (DuckDBV2TableFunctionExecCallbackFn <$> toFunPtr (DuckDBV2TableFunctionExecCallbackFn_Aux execute))
+              (freeHaskellFunPtr . getField @"unwrap")
+              $ \executePtr ->
+                withConnection $ \conn -> withFactory conn $ \factory -> do
+                  withHandle
+                    (c_duckdb_v2_factory_create_type_from_id factory DuckDBV2LogicalTypeIdBigInt (coerce nullPtr) (coerce nullPtr) 0)
+                    c_duckdb_v2_logical_type_destroy
+                    $ \ty ->
+                      withHandle (c_duckdb_v2_table_function_create factory) c_duckdb_v2_table_function_destroy $ \function -> do
+                        withView "v2_scan" $ \name -> checked (c_duckdb_v2_table_function_set_name function (coerce name))
+                        signature <- output (c_duckdb_v2_table_function_get_signature function)
+                        withView "count" $ \name -> checked (c_duckdb_v2_function_signature_add_parameter signature (coerce name) ty (coerce nullPtr) DuckDBV2FunctionParameterKindStandard)
+                        checked (c_duckdb_v2_table_function_set_bind_callback function bindPtr)
+                        checked (c_duckdb_v2_table_function_set_init_global_callback function initializePtr)
+                        checked (c_duckdb_v2_table_function_set_exec_callback function executePtr)
+                        checked (c_duckdb_v2_connection_register_table_function conn function)
+                  withResult conn "SELECT amount FROM v2_scan(3)" $ \result -> readIntegers result >>= (@?= [Just 42, Just 43, Just 44])
+  readIORef failures >>= (@?= [])
+  readIORef destroyed >>= (@?= 1)
+
+testAggregate :: IO ()
+testAggregate = do
+  failures <- newIORef []
+  combinations <- newIORef (0 :: Int)
+  let stateSize info err =
+        callbackGuard failures err $
+          checked (c_duckdb_v2_aggregate_function_size_set_state_size info (fromIntegral (staticSizeOf (Proxy @Int64))))
+      initialize info err = callbackGuard failures err $ do
+        states <- output (c_duckdb_v2_aggregate_function_init_get_states info)
+        count <- output (c_duckdb_v2_aggregate_function_init_get_state_count info)
+        forM_ [0 .. fromIntegral count - 1] $ \i -> peekElemOff states i >>= \state -> poke (coerce state) (0 :: Int64)
+      update info err = callbackGuard failures err $ do
+        states <- output (c_duckdb_v2_aggregate_function_update_get_states info)
+        count <- output (c_duckdb_v2_aggregate_function_update_get_row_count info)
+        vector <- output (c_duckdb_v2_aggregate_function_update_get_arg info 0)
+        checked (c_duckdb_v2_vector_flatten vector)
+        view <- output (c_duckdb_v2_vector_get_view vector)
+        forM_ [0 .. fromIntegral count - 1] $ \i -> do
+          index <-
+            if getField @"sel" view == coerce nullPtr
+              then pure i
+              else fromIntegral <$> peekElemOff (coerce (getField @"sel" view) :: Ptr DuckDBV2SelT) i
+          value <- peekElemOff (coerce (getField @"data'" view)) index
+          state <- coerce <$> peekElemOff states i
+          total <- peek state
+          poke state (total + value :: Int64)
+      combine info err = callbackGuard failures err $ do
+        modifyIORef' combinations (+ 1)
+        sources <- output (c_duckdb_v2_aggregate_function_combine_get_sources info)
+        targets <- output (c_duckdb_v2_aggregate_function_combine_get_targets info)
+        count <- output (c_duckdb_v2_aggregate_function_combine_get_state_count info)
+        forM_ [0 .. fromIntegral count - 1] $ \i -> do
+          source <- peekElemOff sources i >>= peek . coerce
+          target <- coerce <$> peekElemOff targets i
+          total <- peek target
+          poke target (total + source :: Int64)
+      finalize info err = callbackGuard failures err $ do
+        states <- output (c_duckdb_v2_aggregate_function_finalize_get_states info)
+        count <- output (c_duckdb_v2_aggregate_function_finalize_get_state_count info)
+        offset <- output (c_duckdb_v2_aggregate_function_finalize_get_result_offset info)
+        vector <- output (c_duckdb_v2_aggregate_function_finalize_get_result info)
+        raw <- output (c_duckdb_v2_vector_get_data_mutable vector)
+        forM_ [0 .. fromIntegral count - 1] $ \i -> do
+          total <- peekElemOff states i >>= peek . coerce
+          pokeElemOff (coerce raw) (fromIntegral offset + i) (total :: Int64)
+  bracket
+    (DuckDBV2AggregateFunctionSizeCallbackFn <$> toFunPtr (DuckDBV2AggregateFunctionSizeCallbackFn_Aux stateSize))
+    (freeHaskellFunPtr . getField @"unwrap")
+    $ \sizePtr ->
+      bracket
+        (DuckDBV2AggregateFunctionInitCallbackFn <$> toFunPtr (DuckDBV2AggregateFunctionInitCallbackFn_Aux initialize))
+        (freeHaskellFunPtr . getField @"unwrap")
+        $ \initializePtr ->
+          bracket
+            (DuckDBV2AggregateFunctionUpdateCallbackFn <$> toFunPtr (DuckDBV2AggregateFunctionUpdateCallbackFn_Aux update))
+            (freeHaskellFunPtr . getField @"unwrap")
+            $ \updatePtr ->
+              bracket
+                (DuckDBV2AggregateFunctionCombineCallbackFn <$> toFunPtr (DuckDBV2AggregateFunctionCombineCallbackFn_Aux combine))
+                (freeHaskellFunPtr . getField @"unwrap")
+                $ \combinePtr ->
+                  bracket
+                    (DuckDBV2AggregateFunctionFinalizeCallbackFn <$> toFunPtr (DuckDBV2AggregateFunctionFinalizeCallbackFn_Aux finalize))
+                    (freeHaskellFunPtr . getField @"unwrap")
+                    $ \finalizePtr ->
+                      withConnection $ \conn -> withFactory conn $ \factory -> do
+                        withHandle
+                          (c_duckdb_v2_factory_create_type_from_id factory DuckDBV2LogicalTypeIdBigInt (coerce nullPtr) (coerce nullPtr) 0)
+                          c_duckdb_v2_logical_type_destroy
+                          $ \ty ->
+                            withHandle (c_duckdb_v2_aggregate_function_create factory) c_duckdb_v2_aggregate_function_destroy $ \function -> do
+                              withView "v2_sum" $ \name -> checked (c_duckdb_v2_aggregate_function_set_name function (coerce name))
+                              signature <- output (c_duckdb_v2_aggregate_function_get_signature function)
+                              withView "value" $ \name -> checked (c_duckdb_v2_function_signature_add_parameter signature (coerce name) ty (coerce nullPtr) DuckDBV2FunctionParameterKindStandard)
+                              checked (c_duckdb_v2_function_signature_set_return_type signature ty)
+                              checked (c_duckdb_v2_aggregate_function_set_size_callback function sizePtr)
+                              checked (c_duckdb_v2_aggregate_function_set_init_callback function initializePtr)
+                              checked (c_duckdb_v2_aggregate_function_set_update_callback function updatePtr)
+                              checked (c_duckdb_v2_aggregate_function_set_combine_callback function combinePtr)
+                              checked (c_duckdb_v2_aggregate_function_set_finalize_callback function finalizePtr)
+                              checked (c_duckdb_v2_connection_register_aggregate_function conn function)
+                        withResult conn "SELECT v2_sum(i::BIGINT) FROM range(12) t(i) GROUP BY i % 3 ORDER BY i % 3" $ \result ->
+                          readIntegers result >>= (@?= [Just 18, Just 22, Just 26])
+                        withResult conn "SELECT v2_sum(i::BIGINT) OVER () FROM range(4096) t(i) LIMIT 1" $ \result ->
+                          readIntegers result >>= (@?= [Just 8386560])
+  readIORef failures >>= (@?= [])
+  readIORef combinations >>= assertBool "window execution combines aggregate states" . (> 0)
+
+testCast :: IO ()
+testCast = do
+  failures <- newIORef []
+  modes <- newIORef []
+  let execute info context err = callbackGuard failures err $ do
+        assertBool "cast context is borrowed and non-null" (context /= coerce nullPtr)
+        mode <- output (c_duckdb_v2_cast_function_exec_get_mode info)
+        modifyIORef' modes (mode :)
+        count <- output (c_duckdb_v2_cast_function_exec_get_row_count info)
+        input <- output (c_duckdb_v2_cast_function_exec_get_input info)
+        checked (c_duckdb_v2_vector_flatten input)
+        view <- output (c_duckdb_v2_vector_get_view input)
+        result <- output (c_duckdb_v2_cast_function_exec_get_output info)
+        raw <- output (c_duckdb_v2_vector_get_data_mutable result)
+        forM_ [0 .. fromIntegral count - 1] $ \i -> do
+          index <-
+            if getField @"sel" view == coerce nullPtr
+              then pure i
+              else fromIntegral <$> peekElemOff (coerce (getField @"sel" view) :: Ptr DuckDBV2SelT) i
+          value <- peekElemOff (coerce (getField @"data'" view)) index
+          pokeElemOff (coerce raw) i (value + 100 :: Int64)
+  bracket
+    (DuckDBV2CastFunctionExecCallbackFn <$> toFunPtr (DuckDBV2CastFunctionExecCallbackFn_Aux execute))
+    (freeHaskellFunPtr . getField @"unwrap")
+    $ \executePtr ->
+      withConnection $ \conn -> withFactory conn $ \factory ->
+        withHandle
+          (c_duckdb_v2_factory_create_type_from_id factory DuckDBV2LogicalTypeIdBigInt (coerce nullPtr) (coerce nullPtr) 0)
+          c_duckdb_v2_logical_type_destroy
+          $ \ty ->
+            withView "v2_shifted" $ \name -> do
+              withHandle (c_duckdb_v2_custom_type_create factory) c_duckdb_v2_custom_type_destroy $ \custom -> do
+                checked (c_duckdb_v2_custom_type_set_name custom (coerce name))
+                checked (c_duckdb_v2_custom_type_set_base_type custom ty)
+                checked (c_duckdb_v2_connection_register_custom_type conn custom)
+              withHandle (c_duckdb_v2_factory_create_type_with_alias factory ty (coerce name)) c_duckdb_v2_logical_type_destroy $ \alias ->
+                withHandle (c_duckdb_v2_cast_function_create factory) c_duckdb_v2_cast_function_destroy $ \function -> do
+                  checked (c_duckdb_v2_cast_function_set_source_type function ty)
+                  checked (c_duckdb_v2_cast_function_set_target_type function alias)
+                  checked (c_duckdb_v2_cast_function_set_exec_callback function executePtr)
+                  checked (c_duckdb_v2_connection_register_cast_function conn function)
+              withResult conn "SELECT CAST(i::BIGINT AS v2_shifted)::BIGINT FROM range(3) t(i)" $ \result -> readIntegers result >>= (@?= [Just 100, Just 101, Just 102])
+              withResult conn "SELECT TRY_CAST(i::BIGINT AS v2_shifted)::BIGINT FROM range(3) t(i)" $ \result -> readIntegers result >>= (@?= [Just 100, Just 101, Just 102])
+  readIORef failures >>= (@?= [])
+  readIORef modes >>= \seen -> assertBool "normal and try cast modes reach the callback" (DuckDBV2CastModeNormal `elem` seen && DuckDBV2CastModeTry `elem` seen)
+
+testVectorMutation :: IO ()
+testVectorMutation = withConnection $ \conn -> withFactory conn $ \factory ->
+  withHandle
+    (c_duckdb_v2_factory_create_type_from_id factory DuckDBV2LogicalTypeIdBigInt (coerce nullPtr) (coerce nullPtr) 0)
+    c_duckdb_v2_logical_type_destroy
+    $ \integer ->
+      withHandle
+        (c_duckdb_v2_factory_create_type_from_id factory DuckDBV2LogicalTypeIdVarchar (coerce nullPtr) (coerce nullPtr) 0)
+        c_duckdb_v2_logical_type_destroy
+        $ \text ->
+          withArray [integer, text] $ \types ->
+            withHandle (c_duckdb_v2_data_chunk_create factory (ConstPtr types) 2) c_duckdb_v2_data_chunk_destroy $ \chunk -> do
+              vector <- output (c_duckdb_v2_data_chunk_get_vector chunk 0)
+              withHandle (c_duckdb_v2_value_create_bigint factory 7) c_duckdb_v2_value_destroy $ \value ->
+                checked (c_duckdb_v2_vector_make_constant vector value 4)
+              constant <- output (c_duckdb_v2_vector_get_view vector)
+              getField @"count" constant @?= 4
+              forM_ [0 .. 3] $ \i -> peekElemOff (coerce (getField @"sel" constant) :: Ptr DuckDBV2SelT) i >>= (@?= 0)
+              peek (coerce (getField @"data'" constant)) >>= (@?= (7 :: Int64))
+              checked (c_duckdb_v2_vector_make_sequence vector 10 3 4)
+              alloca $ \view -> do
+                c_duckdb_v2_vector_get_view vector view nullPtr >>= (@?= DuckDBV2ErrorInputInvalid)
+                invalid <- peek view
+                getField @"data'" invalid @?= coerce nullPtr
+                getField @"count" invalid @?= 0
+              checked (c_duckdb_v2_vector_flatten vector)
+              flat <- output (c_duckdb_v2_vector_get_view vector)
+              forM [0 .. 3] (peekElemOff (coerce (getField @"data'" flat))) >>= (@?= ([10, 13, 16, 19] :: [Int64]))
+              checked (c_duckdb_v2_vector_set_null vector 1)
+              validity <- output (c_duckdb_v2_vector_flat_get_validity_mutable vector)
+              peek validity >>= \word -> assertBool "only the chosen row is null" (testBit word 0 && not (testBit word 1) && testBit word 2)
+              checked (c_duckdb_v2_vector_set_size vector 2)
+              strings <- output (c_duckdb_v2_data_chunk_get_vector chunk 1)
+              let values = ["", "a\0b", replicate 12 'x', replicate 13 'y', replicate 100 'z']
+              checked (c_duckdb_v2_vector_set_size strings (fromIntegral (length values)))
+              forM_ (zip [0 ..] values) $ \(i, value) -> withView value $ \input ->
+                withHandle (c_duckdb_v2_value_create_varchar factory input) c_duckdb_v2_value_destroy $ \owned ->
+                  checked (c_duckdb_v2_vector_set_value strings i owned)
+              stringView <- output (c_duckdb_v2_vector_get_view strings)
+              forM
+                (zip [0 ..] values)
+                ( \(i, value) -> do
+                    storage <- peekElemOff (coerce (getField @"data'" stringView) :: Ptr DuckDBV2Bytes) i
+                    let payload = getField @"value" storage
+                        len = getField @"length" (getField @"inlined" payload)
+                    len @?= fromIntegral (length value)
+                    with storage $ \ptr -> do
+                      let bytes =
+                            if len <= fromIntegral dUCKDB_V2_BYTES_INLINE_LENGTH
+                              then coerce (getField @"inlined" (getField @"inlined" (getField @"value" ptr)))
+                              else getField @"ptr" (getField @"pointer" payload)
+                      peekCStringLen (bytes, fromIntegral len)
+                )
+                >>= (@?= values)
+              arena <- output (c_duckdb_v2_vector_get_arena strings)
+              allocated <- output (c_duckdb_v2_arena_allocate arena 100)
+              fillBytes allocated 120 100
+              peekCStringLen (coerce allocated, 100) >>= (@?= replicate 100 'x')
+
+testOptions :: IO ()
+testOptions =
+  withHandle c_duckdb_v2_environment_create c_duckdb_v2_environment_destroy $ \env ->
+    withHandle (c_duckdb_v2_instance_create env) c_duckdb_v2_instance_destroy $ \instanceHandle -> do
+      config <- output (c_duckdb_v2_instance_get_config instanceHandle)
+      withView "threads" $ \name -> withView "2" $ \setting ->
+        checked (c_duckdb_v2_config_set_option_text config (coerce name) setting DuckDBV2SettingScopeDefault)
+      withView ":memory:" $ \path -> checked (c_duckdb_v2_instance_attach instanceHandle (coerce nullPtr) path (coerce nullPtr) (CBool 1))
+      withHandle (c_duckdb_v2_connection_create instanceHandle) c_duckdb_v2_connection_destroy $ \first ->
+        withHandle (c_duckdb_v2_connection_create instanceHandle) c_duckdb_v2_connection_destroy $ \second -> do
+          firstConfig <- output (c_duckdb_v2_connection_get_config first)
+          secondConfig <- output (c_duckdb_v2_connection_get_config second)
+          withView "TimeZone" $ \name -> do
+            withView "Europe/Berlin" $ \setting -> checked (c_duckdb_v2_config_set_option_text firstConfig (coerce name) setting DuckDBV2SettingScopeGlobal)
+            withView "UTC" $ \setting -> checked (c_duckdb_v2_config_set_option_text firstConfig (coerce name) setting DuckDBV2SettingScopeSession)
+            alloca $ \scope -> do
+              withHandle (\value -> c_duckdb_v2_config_get_option_value firstConfig (coerce name) value scope) c_duckdb_v2_value_destroy $ \value ->
+                output (c_duckdb_v2_value_get_varchar value) >>= readView >>= (@?= "UTC")
+              peek scope >>= (@?= DuckDBV2SettingScopeSession)
+            alloca $ \scope -> do
+              withHandle (\value -> c_duckdb_v2_config_get_option_value secondConfig (coerce name) value scope) c_duckdb_v2_value_destroy $ \value ->
+                output (c_duckdb_v2_value_get_varchar value) >>= readView >>= (@?= "Europe/Berlin")
+              peek scope >>= (@?= DuckDBV2SettingScopeGlobal)
+            withResult first "SELECT EXTRACT(hour FROM TIMESTAMPTZ '2000-01-01 00:00:00+00')::BIGINT" $ \result -> readIntegers result >>= (@?= [Just 0])
+            withResult second "SELECT EXTRACT(hour FROM TIMESTAMPTZ '2000-01-01 00:00:00+00')::BIGINT" $ \result -> readIntegers result >>= (@?= [Just 1])
+
+testCopy :: IO ()
+testCopy = do
+  (path, handle) <- openBinaryTempFile "." "duckdb-v2-copy"
+  hClose handle
+  withCString path $ \name -> removeTestFile name >>= (@?= 0)
+  failures <- newIORef []
+  destroyed <- newIORef (0 :: Int, 0 :: Int, 0 :: Int)
+  prepared <- newIORef (0 :: Int)
+  flushed <- newIORef (0 :: Int64)
+  finalized <- newIORef (0 :: Int)
+  let destroyState ptr = do
+        marker <- peek (coerce ptr :: Ptr Int64)
+        atomicModifyIORef' destroyed $ \(bound, initialized, batches) ->
+          ( if marker == -1
+              then (bound + 1, initialized, batches)
+              else if marker == -2 then (bound, initialized + 1, batches) else (bound, initialized, batches + 1)
+          , ()
+          )
+        free ptr
+  bracket (DuckDBV2OpaqueDestroyFn <$> toFunPtr (DuckDBV2OpaqueDestroyFn_Aux destroyState)) (freeHaskellFunPtr . getField @"unwrap") $ \destroyPtr -> do
+    let setState setter marker = do
+          state <- malloc
+          poke state (marker :: Int64)
+          with (DuckDBV2Opaque (coerce state) destroyPtr (DuckDBV2OpaqueEqualsFn nullFunPtr)) $ \opaque -> checked (setter opaque)
+        bind info _context err = callbackGuard failures err $ do
+          output (c_duckdb_v2_copy_to_bind_get_column_count info) >>= (@?= 1)
+          withHandle (c_duckdb_v2_copy_to_bind_get_column_type info 0) c_duckdb_v2_logical_type_destroy $ \ty ->
+            output (c_duckdb_v2_logical_type_get_id ty) >>= (@?= DuckDBV2LogicalTypeIdBigInt)
+          setState (c_duckdb_v2_copy_to_bind_set_bind_data info) (-1)
+        initialize info _context err = callbackGuard failures err $ do
+          bound <- output (c_duckdb_v2_copy_to_init_get_bind_data info)
+          peek (coerce bound) >>= (@?= (-1 :: Int64))
+          setState (c_duckdb_v2_copy_to_init_set_init_data info) (-2)
+        batch info _context err = callbackGuard failures err $
+          withHandle (c_duckdb_v2_copy_to_batch_take_input info) c_duckdb_v2_column_data_collection_destroy $ \input -> do
+            atomicModifyIORef' prepared $ \count -> (count + 1, ())
+            count <- output (c_duckdb_v2_column_data_collection_row_count input)
+            alloca $ \second -> do
+              poke second (coerce nullPtr)
+              c_duckdb_v2_copy_to_batch_take_input info second (coerce nullPtr) >>= (@?= DuckDBV2ErrorInputInvalid)
+              peek second >>= (@?= coerce nullPtr)
+            setState (c_duckdb_v2_copy_to_batch_set_batch_data info) (fromIntegral count)
+        flush info _context err = callbackGuard failures err $ do
+          initialized <- output (c_duckdb_v2_copy_to_flush_get_init_data info)
+          peek (coerce initialized) >>= (@?= (-2 :: Int64))
+          state <- output (c_duckdb_v2_copy_to_flush_get_batch_data info)
+          count <- peek (coerce state)
+          atomicModifyIORef' flushed $ \total -> (total + count, ())
+        finalize info _context err = callbackGuard failures err $ do
+          initialized <- output (c_duckdb_v2_copy_to_finalize_get_init_data info)
+          peek (coerce initialized) >>= (@?= (-2 :: Int64))
+          readIORef flushed >>= (@?= 5)
+          modifyIORef' finalized (+ 1)
+    bracket (DuckDBV2CopyToBindCallbackFn <$> toFunPtr (DuckDBV2CopyToBindCallbackFn_Aux bind)) (freeHaskellFunPtr . getField @"unwrap") $ \bindPtr ->
+      bracket (DuckDBV2CopyToInitCallbackFn <$> toFunPtr (DuckDBV2CopyToInitCallbackFn_Aux initialize)) (freeHaskellFunPtr . getField @"unwrap") $ \initializePtr ->
+        bracket (DuckDBV2CopyToBatchCallbackFn <$> toFunPtr (DuckDBV2CopyToBatchCallbackFn_Aux batch)) (freeHaskellFunPtr . getField @"unwrap") $ \batchPtr ->
+          bracket (DuckDBV2CopyToFlushCallbackFn <$> toFunPtr (DuckDBV2CopyToFlushCallbackFn_Aux flush)) (freeHaskellFunPtr . getField @"unwrap") $ \flushPtr ->
+            bracket
+              (DuckDBV2CopyToFinalizeCallbackFn <$> toFunPtr (DuckDBV2CopyToFinalizeCallbackFn_Aux finalize))
+              (freeHaskellFunPtr . getField @"unwrap")
+              $ \finalizePtr ->
+                withConnection $ \conn -> withFactory conn $ \factory -> do
+                  withHandle (c_duckdb_v2_copy_function_create factory) c_duckdb_v2_copy_function_destroy $ \function -> do
+                    withView "v2_count" $ \name -> checked (c_duckdb_v2_copy_function_set_name function (coerce name))
+                    checked (c_duckdb_v2_copy_to_set_bind_callback function bindPtr)
+                    checked (c_duckdb_v2_copy_to_set_init_callback function initializePtr)
+                    checked (c_duckdb_v2_copy_to_set_batch_callback function batchPtr)
+                    checked (c_duckdb_v2_copy_to_set_flush_callback function flushPtr)
+                    checked (c_duckdb_v2_copy_to_set_finalize_callback function finalizePtr)
+                    checked (c_duckdb_v2_connection_register_copy_function conn function)
+                  withResult conn ("COPY (SELECT i::BIGINT FROM range(5) t(i)) TO '" <> path <> "' (FORMAT v2_count, USE_TMP_FILE FALSE)") $ \result ->
+                    readIntegers result >>= (@?= [Just 5])
+  readIORef failures >>= (@?= [])
+  batches <- readIORef prepared
+  assertBool "COPY prepared a batch" (batches > 0)
+  readIORef destroyed >>= (@?= (1, 1, batches))
+  readIORef finalized >>= (@?= 1)
+
+-- | Remove the temporary file through the C standard library.
+foreign import ccall unsafe "remove"
+  removeTestFile :: CString -> IO CInt
+
+testFileSystem :: IO ()
+testFileSystem =
+  bracket
+    ( do
+        (path, handle) <- openBinaryTempFile "." "duckdb-v2-file"
+        hClose handle
+        pure path
+    )
+    (\path -> withCString path $ \name -> removeTestFile name >>= (@?= 0))
+    ( \path -> withConnection $ \conn -> do
+        fileSystem <- output (c_duckdb_v2_connection_get_file_system conn)
+        withHandle (c_duckdb_v2_file_open_options_create fileSystem) c_duckdb_v2_file_open_options_destroy $ \options -> do
+          checked (c_duckdb_v2_file_open_options_set_flag options DuckDBV2FileFlagRead)
+          checked (c_duckdb_v2_file_open_options_set_flag options DuckDBV2FileFlagWrite)
+          withView path $ \name ->
+            withHandle (c_duckdb_v2_file_system_open fileSystem name options) c_duckdb_v2_file_destroy $ \file ->
+              withCStringLen "alpha\0omega" $ \(bytes, len) -> allocaBytes (len + 1) $ \buffer -> do
+                checked (c_duckdb_v2_file_write_at file (coerce bytes) (fromIntegral len) 0)
+                output (c_duckdb_v2_file_tell file) >>= (@?= 0)
+                output (c_duckdb_v2_file_size file) >>= (@?= fromIntegral len)
+                checked (c_duckdb_v2_file_read_at file buffer (fromIntegral len) 0)
+                peekCStringLen (coerce buffer, len) >>= (@?= "alpha\0omega")
+                output (c_duckdb_v2_file_tell file) >>= (@?= 0)
+                output (c_duckdb_v2_file_read file buffer (fromIntegral len)) >>= (@?= fromIntegral len)
+                withCString "!" $ \suffix -> output (c_duckdb_v2_file_write file (coerce suffix) 1) >>= (@?= 1)
+                output (c_duckdb_v2_file_tell file) >>= (@?= fromIntegral (len + 1))
+                checked (c_duckdb_v2_file_sync file)
+                checked (c_duckdb_v2_file_seek file 0)
+                output (c_duckdb_v2_file_read file buffer (fromIntegral (len + 1))) >>= (@?= fromIntegral (len + 1))
+                peekCStringLen (coerce buffer, len + 1) >>= (@?= "alpha\0omega!")
+                output (c_duckdb_v2_file_read file buffer 1) >>= (@?= 0)
+                checked (c_duckdb_v2_file_close file)
+    )
+
+testLogging :: IO ()
+testLogging = do
+  failures <- newIORef []
+  let execute info context err = callbackGuard failures err $ do
+        withView "" $ \logType -> withView "v2 callback message" $ \message ->
+          checked (c_duckdb_v2_context_log context DuckDBV2LogLevelInfo logType message)
+        vector <- output (c_duckdb_v2_scalar_function_exec_get_result info)
+        raw <- output (c_duckdb_v2_vector_get_data_mutable vector)
+        poke (coerce raw) (1 :: Int64)
+  bracket
+    (DuckDBV2ScalarFunctionExecCallbackFn <$> toFunPtr (DuckDBV2ScalarFunctionExecCallbackFn_Aux execute))
+    (freeHaskellFunPtr . getField @"unwrap")
+    $ \executePtr ->
+      withConnection $ \conn -> withFactory conn $ \factory -> do
+        withHandle
+          (c_duckdb_v2_factory_create_type_from_id factory DuckDBV2LogicalTypeIdBigInt (coerce nullPtr) (coerce nullPtr) 0)
+          c_duckdb_v2_logical_type_destroy
+          $ \ty ->
+            withHandle (c_duckdb_v2_scalar_function_create factory) c_duckdb_v2_scalar_function_destroy $ \function -> do
+              withView "v2_log" $ \name -> checked (c_duckdb_v2_scalar_function_set_name function (coerce name))
+              signature <- output (c_duckdb_v2_scalar_function_get_signature function)
+              checked (c_duckdb_v2_function_signature_set_return_type signature ty)
+              checked (c_duckdb_v2_scalar_function_set_exec_callback function executePtr)
+              checked (c_duckdb_v2_connection_register_scalar_function conn function)
+        withResult conn "CALL enable_logging()" consume
+        withResult conn "SET logging_level='info'" consume
+        withResult conn "SELECT v2_log()" $ \result -> readIntegers result >>= (@?= [Just 1])
+        withResult conn "SELECT count(*)::BIGINT FROM duckdb_logs WHERE message='v2 callback message'" $ \result -> readIntegers result >>= (@?= [Just 1])
+        withResult conn "CALL disable_logging()" consume
+        withResult conn "SELECT v2_log()" $ \result -> readIntegers result >>= (@?= [Just 1])
+        withResult conn "SELECT count(*)::BIGINT FROM duckdb_logs WHERE message='v2 callback message'" $ \result -> readIntegers result >>= (@?= [Just 1])
+  readIORef failures >>= (@?= [])
+
+testTextSink :: IO ()
+testTextSink = do
+  received <- newIORef []
+  failures <- newIORef []
+  let callback text _user err = callbackGuard failures err $ do
+        rendered <- peek (coerce text) >>= readView
+        modifyIORef' received (rendered :)
+  bracket (DuckDBV2TextSinkFn <$> toFunPtr (DuckDBV2TextSinkFn_Aux callback)) (freeHaskellFunPtr . getField @"unwrap") $ \sink -> withConnection $ \conn ->
+    withStatement conn "SELECT 42::BIGINT AS answer" $ \statement -> alloca $ \result -> do
+      poke result (coerce nullPtr)
+      checked (c_duckdb_v2_statement_execute conn statement (coerce nullPtr) (coerce nullPtr) 0 result)
+      original <- peek result
+      assertBool "execution returns a live result" (original /= coerce nullPtr)
+      flip finally (c_duckdb_v2_result_destroy result >>= (@?= DuckDBV2ErrorNone)) $
+        withView "" $ \nullText -> do
+          alloca $ \err -> do
+            poke err (coerce nullPtr)
+            flip finally (c_duckdb_v2_error_info_destroy err >>= (@?= DuckDBV2ErrorNone)) $ do
+              code <- c_duckdb_v2_result_render_box result 0 80 20 nullText 2 0 sink (coerce nullPtr) err
+              code @?= DuckDBV2ErrorInputInvalid
+              peek result >>= (@?= original)
+              readIORef received >>= (@?= [])
+          checked (c_duckdb_v2_result_render_box result 0 80 20 nullText 0 0 sink (coerce nullPtr))
+          peek result >>= (@?= coerce nullPtr)
+  readIORef failures >>= (@?= [])
+  rendered <- readIORef received
+  length rendered @?= 1
+  assertBool "rendered box contains its column and value" (all (\text -> "answer" `isInfixOf` text && "42" `isInfixOf` text) rendered)
+
+testArrow :: IO ()
+testArrow = withConnection $ \conn -> withStatement conn "SELECT i::BIGINT AS amount FROM range(5) t(i)" $ \statement -> alloca $ \result -> alloca $ \streamPtr -> do
+  poke result (coerce nullPtr)
+  checked (c_duckdb_v2_statement_execute_arrow conn statement (coerce nullPtr) (coerce nullPtr) 0 0 result)
+  fillBytes streamPtr 0 (staticSizeOf (Proxy @ArrowArrayStream))
+  checked (c_duckdb_v2_arrow_result_to_arrow_c_stream result streamPtr)
+  peek result >>= (@?= coerce nullPtr)
+  stream <- peek streamPtr
+  assertBool "Arrow stream owns a release callback" (getField @"release" stream /= nullFunPtr)
+  flip finally (fromFunPtr (getField @"release" stream) streamPtr) $ do
+    alloca $ \schemaPtr -> do
+      fillBytes schemaPtr 0 (staticSizeOf (Proxy @ArrowSchema))
+      fromFunPtr (getField @"get_schema" stream) streamPtr schemaPtr >>= (@?= 0)
+      schema <- peek schemaPtr
+      getField @"n_children" schema @?= 1
+      fromFunPtr (getField @"release" schema) schemaPtr
+    let fetch total = alloca $ \arrayPtr -> do
+          fillBytes arrayPtr 0 (staticSizeOf (Proxy @ArrowArray))
+          fromFunPtr (getField @"get_next" stream) streamPtr arrayPtr >>= (@?= 0)
+          array <- peek arrayPtr
+          if getField @"release" array == nullFunPtr
+            then pure total
+            else do
+              let count = getField @"length" array
+              fromFunPtr (getField @"release" array) arrayPtr
+              fetch (total + count)
+    fetch 0 >>= (@?= 5)
diff --git a/test/V2TypeTest.hs b/test/V2TypeTest.hs
new file mode 100644
--- /dev/null
+++ b/test/V2TypeTest.hs
@@ -0,0 +1,290 @@
+module V2TypeTest (tests) where
+
+import Control.Monad (forM_)
+import Data.Coerce (coerce)
+import Data.Word (Word64)
+import Database.DuckDB.FFI.V2
+import Foreign.C.ConstPtr (ConstPtr (..))
+import Foreign.C.String (peekCStringLen, withCStringLen)
+import Foreign.C.Types (CChar)
+import Foreign.Marshal.Alloc (alloca, allocaBytes)
+import Foreign.Marshal.Array (peekArray, withArray)
+import Foreign.Marshal.Utils (fillBytes, with)
+import Foreign.Ptr (Ptr, nullPtr)
+import Foreign.Storable (Storable (..))
+import HsBindgen.Runtime.PtrConst (PtrConst)
+import Test.Tasty (TestTree, testGroup)
+import Test.Tasty.HUnit (assertBool, testCase, (@?=))
+import V2Test (
+  checked,
+  consume,
+  output,
+  readView,
+  withBytes,
+  withConnection,
+  withFactory,
+  withHandle,
+  withInstance,
+  withResult,
+  withType,
+  withView,
+ )
+
+tests :: TestTree
+tests =
+  testGroup
+    "DuckDB V2 types and names"
+    [ testCase "logical types render as text that parses back to an equal type" testTypeText
+    , testCase "type names and parameters resolve back to equal types" testTypeName
+    , testCase "common types follow the implicit cast rules" testCommonType
+    , testCase "qualified names compare and hash without regard to case" testQualifiedName
+    , testCase "identifiers are quoted only where SQL requires it" testIdentifier
+    , testCase "UTF-8 validation checks every byte of the view" testUtf8
+    , testCase "type ids that need parameters or exist only at bind time do not construct" testTypeIdRejection
+    , testCase "an instance factory resolves only unqualified built-in type names" testInstanceTypeName
+    ]
+
+isEqual :: DuckDBV2LogicalTypeHandle -> DuckDBV2LogicalTypeHandle -> IO Bool
+isEqual left right = (/= 0) <$> output (c_duckdb_v2_logical_type_is_equal left right)
+
+-- | Pass the strings as an array of identifier views.
+withParts :: [String] -> (PtrConst DuckDBV2IdentifierT -> IO a) -> IO a
+withParts parts action = go parts []
+  where
+    go [] views = withArray (reverse views) (action . ConstPtr)
+    go (part : rest) views = withCStringLen part $ \(ptr, len) ->
+      go rest (DuckDBV2IdentifierT (DuckDBV2Str (ConstPtr ptr) (fromIntegral len)) : views)
+
+withQName :: [String] -> (DuckDBV2QnameHandle -> IO a) -> IO a
+withQName parts action = withParts parts $ \views ->
+  withHandle (c_duckdb_v2_qname_create views (fromIntegral (length parts))) c_duckdb_v2_qname_destroy action
+
+-- | Render text through the buffer protocol of the header.
+-- The call sizes the text first. It then checks that a buffer without room for the terminator is refused and stays unchanged.
+render :: (Ptr CChar -> DuckDBIdx -> Ptr DuckDBIdx -> Ptr DuckDBV2ErrorInfoHandle -> IO DuckDBV2Error) -> IO String
+render renderer = alloca $ \lengthSlot -> do
+  checked (renderer nullPtr 0 lengthSlot)
+  len <- fromIntegral <$> peek lengthSlot
+  allocaBytes (len + 1) $ \buffer -> do
+    fillBytes buffer 0x55 (len + 1)
+    poke lengthSlot 0
+    renderer buffer (fromIntegral len) lengthSlot nullPtr >>= (@?= DuckDBV2ErrorInputObjectSize)
+    peek lengthSlot >>= (@?= fromIntegral len)
+    peekArray (len + 1) buffer >>= (@?= replicate (len + 1) 0x55)
+    checked (renderer buffer (fromIntegral (len + 1)) lengthSlot)
+    peek lengthSlot >>= (@?= fromIntegral len)
+    peekElemOff buffer len >>= (@?= 0)
+    peekCStringLen (buffer, len)
+
+testTypeText :: IO ()
+testTypeText = withConnection $ \conn -> withFactory conn $ \factory -> do
+  let texts =
+        [ "INTEGER"
+        , "TIMESTAMP WITH TIME ZONE"
+        , "DECIMAL(18,3)"
+        , "INTEGER[]"
+        , "INTEGER[3]"
+        , "STRUCT(a INTEGER, \"b c\" VARCHAR)"
+        , "MAP(VARCHAR, INTEGER)"
+        , "UNION(i INTEGER, s VARCHAR)"
+        , "ENUM('a', 'b''c')"
+        ]
+  forM_ texts $ \text -> withType factory text $ \ty -> do
+    rendered <- render (c_duckdb_v2_logical_type_to_text ty)
+    withType factory rendered $ \parsed -> isEqual ty parsed >>= assertBool (text <> " parses back from " <> rendered)
+  withType factory "DECIMAL(10, 2)" $ \decimal -> do
+    withType factory "DECIMAL(10, 2)" $ \same -> isEqual decimal same >>= (@?= True)
+    withType factory "DECIMAL(10, 3)" $ \scale -> isEqual decimal scale >>= (@?= False)
+    withType factory "FLOAT" $ \float -> isEqual decimal float >>= (@?= False)
+  withType factory "STRUCT(a INTEGER, b VARCHAR)" $ \struct -> do
+    withType factory "STRUCT(b VARCHAR, a INTEGER)" $ \reordered -> isEqual struct reordered >>= (@?= False)
+    withType factory "STRUCT(a INTEGER, c VARCHAR)" $ \renamed -> isEqual struct renamed >>= (@?= False)
+  withHandle
+    (c_duckdb_v2_factory_create_type_from_id factory DuckDBV2LogicalTypeIdAny (coerce nullPtr) (coerce nullPtr) 0)
+    c_duckdb_v2_logical_type_destroy
+    $ \ty ->
+      render (c_duckdb_v2_logical_type_to_text ty) >>= (@?= "ANY")
+
+testTypeName :: IO ()
+testTypeName = withConnection $ \conn -> withFactory conn $ \factory -> do
+  let fromName name values action = withArray values $ \params ->
+        withHandle
+          (c_duckdb_v2_factory_create_type_from_name factory name (coerce nullPtr) (ConstPtr params) (fromIntegral (length values)))
+          c_duckdb_v2_logical_type_destroy
+          action
+      nameOf ty = output (c_duckdb_v2_logical_type_get_name ty) >>= readView . coerce
+  forM_ ["INTEGER", "TIMESTAMP WITH TIME ZONE", "VARCHAR", "UUID", "INTERVAL"] $ \text -> withType factory text $ \ty -> do
+    name <- nameOf ty
+    assertBool "the name is never empty" (not (null name))
+    withQName [name] $ \qname -> fromName qname [] $ \resolved -> isEqual ty resolved >>= assertBool (text <> " resolves from its name " <> name)
+  -- The parameters of a parameterized kind cross as values, child types as TYPE values.
+  withType factory "DECIMAL(18,3)" $ \decimal -> do
+    name <- nameOf decimal
+    withHandle (c_duckdb_v2_value_create_utinyint factory 18) c_duckdb_v2_value_destroy $ \width ->
+      withHandle (c_duckdb_v2_value_create_utinyint factory 3) c_duckdb_v2_value_destroy $ \scale ->
+        withQName [name] $ \qname -> fromName qname [width, scale] $ \resolved -> isEqual decimal resolved >>= (@?= True)
+  withType factory "INTEGER[]" $ \list -> withType factory "INTEGER" $ \element -> do
+    name <- nameOf list
+    withHandle (c_duckdb_v2_value_create_type factory element) c_duckdb_v2_value_destroy $ \child ->
+      withQName [name] $ \qname -> fromName qname [child] $ \resolved -> isEqual list resolved >>= (@?= True)
+  withType factory "INTEGER" $ \base -> withView "v2_alias" $ \alias ->
+    withHandle (c_duckdb_v2_factory_create_type_with_alias factory base (coerce alias)) c_duckdb_v2_logical_type_destroy $ \aliased ->
+      nameOf aliased >>= (@?= "v2_alias")
+  withType factory "INTEGER" $ \base -> withView "" $ \alias -> alloca $ \out -> do
+    poke out (coerce nullPtr)
+    code <- c_duckdb_v2_factory_create_type_with_alias factory base (coerce alias) out nullPtr
+    c_duckdb_v2_logical_type_destroy out >>= (@?= DuckDBV2ErrorNone)
+    code @?= DuckDBV2ErrorInputInvalid
+  -- A qualified name resolves in the schema that it names.
+  withResult conn "CREATE TYPE v2_mood AS ENUM ('sad', 'ok')" consume
+  withType factory "v2_mood" $ \mood ->
+    withQName ["main", "v2_mood"] $ \qname -> fromName qname [] $ \resolved -> isEqual mood resolved >>= (@?= True)
+  let rejected parts values = withQName parts $ \qname -> withArray values $ \params -> alloca $ \out -> do
+        poke out (coerce nullPtr)
+        code <-
+          c_duckdb_v2_factory_create_type_from_name factory qname (coerce nullPtr) (ConstPtr params) (fromIntegral (length values)) out nullPtr
+        c_duckdb_v2_logical_type_destroy out >>= (@?= DuckDBV2ErrorNone)
+        assertBool (show parts <> " does not resolve") (code /= DuckDBV2ErrorNone)
+  rejected ["v2_no_such_schema", "integer"] []
+  rejected ["v2_no_such_type"] []
+  withHandle (c_duckdb_v2_value_create_utinyint factory 1) c_duckdb_v2_value_destroy $ \value -> rejected ["integer"] [value]
+  -- DECIMAL takes a width and a scale, as the resolution of DECIMAL(18,3) above shows.
+  withHandle (c_duckdb_v2_value_create_utinyint factory 18) c_duckdb_v2_value_destroy $ \width ->
+    withHandle (c_duckdb_v2_value_create_utinyint factory 3) c_duckdb_v2_value_destroy $ \scale -> do
+      rejected ["decimal"] [width, scale, scale]
+      withView "wide" $ \text -> withHandle (c_duckdb_v2_value_create_varchar factory text) c_duckdb_v2_value_destroy $ \word ->
+        rejected ["decimal"] [word, scale]
+
+testCommonType :: IO ()
+testCommonType = withConnection $ \conn -> withFactory conn $ \factory -> do
+  let common types = withArray types $ \array -> alloca $ \out -> do
+        poke out (coerce nullPtr)
+        code <- c_duckdb_v2_factory_create_common_type factory (ConstPtr array) (fromIntegral (length types)) out nullPtr
+        c_duckdb_v2_logical_type_destroy out >>= (@?= DuckDBV2ErrorNone)
+        pure code
+      resolvesTo inputs expected = withTypes inputs $ \types -> withArray types $ \array -> withType factory expected $ \wanted ->
+        withHandle (c_duckdb_v2_factory_create_common_type factory (ConstPtr array) (fromIntegral (length types))) c_duckdb_v2_logical_type_destroy $ \resolved ->
+          isEqual wanted resolved >>= assertBool (show inputs <> " resolve to " <> expected)
+      withTypes [] action = action []
+      withTypes (text : rest) action = withType factory text $ \ty -> withTypes rest (action . (ty :))
+  resolvesTo ["INTEGER", "BIGINT"] "BIGINT"
+  resolvesTo ["DECIMAL(4,1)", "DECIMAL(5,4)"] "DECIMAL(7,4)"
+  resolvesTo ["VARCHAR"] "VARCHAR"
+  common [] >>= (@?= DuckDBV2ErrorInputInvalid)
+  withType factory "INTEGER" $ \integer -> do
+    common [integer, coerce nullPtr] >>= (@?= DuckDBV2ErrorInputInvalid)
+    withHandle
+      (c_duckdb_v2_factory_create_type_from_id factory DuckDBV2LogicalTypeIdAny (coerce nullPtr) (coerce nullPtr) 0)
+      c_duckdb_v2_logical_type_destroy
+      $ \anyType ->
+        common [integer, anyType] >>= (@?= DuckDBV2ErrorInputInvalid)
+  withTypes ["STRUCT(a INTEGER)", "INTEGER[]"] $ \types -> common types >>= (@?= DuckDBV2ErrorQueryNotImplemented)
+
+testQualifiedName :: IO ()
+testQualifiedName = do
+  let equals left right = (/= 0) <$> output (c_duckdb_v2_qname_equals left right)
+      hash name = output (c_duckdb_v2_qname_hash name) :: IO Word64
+  withQName ["Main", "Users"] $ \mixed -> withQName ["main", "USERS"] $ \upper -> do
+    equals mixed upper >>= (@?= True)
+    (==) <$> hash mixed <*> hash upper >>= assertBool "equal names hash equal"
+    withQName ["users"] $ \short -> equals mixed short >>= (@?= False)
+    withQName ["main", "orders"] $ \other -> equals mixed other >>= (@?= False)
+  withQName ["main", "users"] $ \plain -> render (c_duckdb_v2_qname_render plain) >>= (@?= "main.users")
+  -- Parts with a dot, a keyword and a quote need quoting. The rendered text parses back to an equal name.
+  withQName ["my.catalog", "select", "a\"b"] $ \name -> do
+    text <- render (c_duckdb_v2_qname_render name)
+    withView text $ \view -> withHandle (c_duckdb_v2_qname_parse view) c_duckdb_v2_qname_destroy $ \parsed ->
+      equals name parsed >>= assertBool ("the name parses back from " <> text)
+  let rejected parts = withParts parts $ \views -> alloca $ \out -> do
+        poke out (coerce nullPtr)
+        code <- c_duckdb_v2_qname_create views (fromIntegral (length parts)) out nullPtr
+        c_duckdb_v2_qname_destroy out >>= (@?= DuckDBV2ErrorNone)
+        code @?= DuckDBV2ErrorInputInvalid
+  rejected []
+  rejected ["a", "b", "c", "d"]
+  rejected ["main", ""]
+  let parse bytes = withBytes bytes $ \view -> alloca $ \out -> do
+        poke out (coerce nullPtr)
+        code <- c_duckdb_v2_qname_parse view out nullPtr
+        c_duckdb_v2_qname_destroy out >>= (@?= DuckDBV2ErrorNone)
+        pure code
+      text = map (fromIntegral . fromEnum)
+      failed code = assertBool ("the parse fails: " <> show code) (code /= DuckDBV2ErrorNone)
+  parse (text "a.b.c") >>= (@?= DuckDBV2ErrorNone)
+  -- The parser reports more than three parts and an unterminated quote with its own error code.
+  parse (text "a.b.c.d") >>= failed
+  parse (text "\"a\"") >>= (@?= DuckDBV2ErrorNone)
+  parse (text "\"a") >>= failed
+  parse (text "a") >>= (@?= DuckDBV2ErrorNone)
+  parse [0xff] >>= (@?= DuckDBV2ErrorInputInvalid)
+  parse [] >>= (@?= DuckDBV2ErrorInputInvalid)
+
+testIdentifier :: IO ()
+testIdentifier = do
+  let quoted name = withView name $ \view -> render (c_duckdb_v2_identifier_render_quoted (coerce view))
+  quoted "users" >>= (@?= "users")
+  quoted "select" >>= (@?= "\"select\"")
+  quoted "a \"b\"" >>= (@?= "\"a \"\"b\"\"\"")
+  -- The rendered identifier parses back to a name with the same single part.
+  forM_ ["users", "select", "a \"b\"", "x.y"] $ \name -> do
+    text <- quoted name
+    withView text $ \view -> withHandle (c_duckdb_v2_qname_parse view) c_duckdb_v2_qname_destroy $ \parsed -> do
+      output (c_duckdb_v2_qname_get_part_count parsed) >>= (@?= 1)
+      output (c_duckdb_v2_qname_get_part parsed 0) >>= readView . coerce >>= (@?= name)
+      alloca $ \part -> c_duckdb_v2_qname_get_part parsed 1 part nullPtr >>= (@?= DuckDBV2ErrorInputOutOfRange)
+
+testUtf8 :: IO ()
+testUtf8 = do
+  let validates bytes = withBytes bytes $ \view -> c_duckdb_v2_validate_utf8 view nullPtr
+  validates [] >>= (@?= DuckDBV2ErrorNone)
+  validates [0x68, 0xc3, 0xa9, 0x00, 0xe2, 0x82, 0xac] >>= (@?= DuckDBV2ErrorNone)
+  validates [0x61, 0x00, 0xff] >>= (@?= DuckDBV2ErrorInputInvalid)
+  validates [0x61, 0xc3] >>= (@?= DuckDBV2ErrorInputInvalid)
+  validates [0xc0, 0xaf] >>= (@?= DuckDBV2ErrorInputInvalid)
+  with (DuckDBV2Str (ConstPtr nullPtr) 0) $ \view -> c_duckdb_v2_validate_utf8 (ConstPtr view) nullPtr >>= (@?= DuckDBV2ErrorNone)
+  with (DuckDBV2Str (ConstPtr nullPtr) 1) $ \view -> c_duckdb_v2_validate_utf8 (ConstPtr view) nullPtr >>= (@?= DuckDBV2ErrorInputInvalid)
+  c_duckdb_v2_validate_utf8 (ConstPtr nullPtr) nullPtr >>= (@?= DuckDBV2ErrorInputInvalid)
+
+testTypeIdRejection :: IO ()
+testTypeIdRejection = withConnection $ \conn -> withFactory conn $ \factory -> do
+  let fromId typeId = alloca $ \out -> do
+        poke out (coerce nullPtr)
+        code <- c_duckdb_v2_factory_create_type_from_id factory typeId (coerce nullPtr) (coerce nullPtr) 0 out nullPtr
+        c_duckdb_v2_logical_type_destroy out >>= (@?= DuckDBV2ErrorNone)
+        pure code
+  forM_ [DuckDBV2LogicalTypeIdBigInt, DuckDBV2LogicalTypeIdAny] $ \typeId -> fromId typeId >>= (@?= DuckDBV2ErrorNone)
+  forM_
+    [ DuckDBV2LogicalTypeIdDecimal
+    , DuckDBV2LogicalTypeIdList
+    , DuckDBV2LogicalTypeIdStruct
+    , DuckDBV2LogicalTypeIdEnum
+    , DuckDBV2LogicalTypeIdMap
+    , DuckDBV2LogicalTypeIdArray
+    , DuckDBV2LogicalTypeIdUnion
+    , DuckDBV2LogicalTypeIdTuple
+    , DuckDBV2LogicalTypeIdVariant
+    , DuckDBV2LogicalTypeIdGeometry
+    , DuckDBV2LogicalTypeIdSQLNull
+    , DuckDBV2LogicalTypeIdUnknown
+    , DuckDBV2LogicalTypeIdType
+    , DuckDBV2LogicalTypeIdInvalid
+    ]
+    $ \typeId -> fromId typeId >>= \code -> assertBool (show typeId <> " does not construct without parameters") (code == DuckDBV2ErrorInputInvalid)
+
+-- | The instance factory has no catalog. The connection factory of the same instance resolves the catalog type
+-- v2_weather.
+testInstanceTypeName :: IO ()
+testInstanceTypeName = withInstance $ \instanceHandle ->
+  withHandle (c_duckdb_v2_connection_create instanceHandle) c_duckdb_v2_connection_destroy $ \conn -> do
+    withResult conn "CREATE TYPE v2_weather AS ENUM ('rain', 'sun')" consume
+    instanceFactory <- output (c_duckdb_v2_instance_get_factory instanceHandle)
+    connectionFactory <- output (c_duckdb_v2_connection_get_factory conn)
+    let fromName factory parts = withQName parts $ \qname -> alloca $ \out -> do
+          poke out (coerce nullPtr)
+          code <- c_duckdb_v2_factory_create_type_from_name factory qname (coerce nullPtr) (ConstPtr nullPtr) 0 out nullPtr
+          c_duckdb_v2_logical_type_destroy out >>= (@?= DuckDBV2ErrorNone)
+          pure code
+    fromName instanceFactory ["integer"] >>= (@?= DuckDBV2ErrorNone)
+    fromName instanceFactory ["main", "integer"] >>= (@?= DuckDBV2ErrorInputInvalid)
+    fromName connectionFactory ["v2_weather"] >>= (@?= DuckDBV2ErrorNone)
+    fromName instanceFactory ["v2_weather"] >>= (@?= DuckDBV2ErrorInputInvalid)
diff --git a/test/V2ValueTest.hs b/test/V2ValueTest.hs
new file mode 100644
--- /dev/null
+++ b/test/V2ValueTest.hs
@@ -0,0 +1,208 @@
+module V2ValueTest (tests) where
+
+import Control.Monad (forM_)
+import Data.Bits (shiftL, (.|.))
+import Data.Coerce (coerce)
+import Data.Int (Int16, Int32, Int64, Int8)
+import Data.Word (Word16, Word32, Word64, Word8)
+import Database.DuckDB.FFI.V2
+import Foreign.C.ConstPtr (ConstPtr (..))
+import Foreign.C.Types (CBool (..), CDouble, CFloat)
+import Foreign.Marshal.Alloc (alloca)
+import Foreign.Marshal.Array (peekArray)
+import Foreign.Marshal.Utils (with)
+import Foreign.Ptr (Ptr, castPtr, nullPtr)
+import Foreign.Storable (Storable (..))
+import Test.Tasty (TestTree, testGroup)
+import Test.Tasty.HUnit (assertBool, testCase, (@?=))
+import V2Test (output, readView, withBytes, withConnection, withFactory, withHandle, withView)
+
+tests :: TestTree
+tests =
+  testGroup
+    "DuckDB V2 values"
+    [ testCase "typed getters return the payload of their own type" testRoundTrip
+    , testCase "converting getters cast a copy and leave the value unchanged" testConversion
+    , testCase "getters reject NULL values and unsupported conversions" testRejection
+    , testCase "creation rejects a DECIMAL width, scale or value out of range, and a NULL of type ANY" testCreationRejection
+    ]
+
+type Create a = DuckDBV2FactoryHandle -> a -> Ptr DuckDBV2ValueHandle -> Ptr DuckDBV2ErrorInfoHandle -> IO DuckDBV2Error
+
+type Get a = DuckDBV2ValueHandle -> Ptr a -> Ptr DuckDBV2ErrorInfoHandle -> IO DuckDBV2Error
+
+-- | Create a value from a payload and read the payload back with the getter of the same type.
+roundTrip :: (Storable a, Eq a, Show a) => DuckDBV2FactoryHandle -> Create a -> Get a -> a -> IO ()
+roundTrip factory create get payload =
+  withHandle (create factory payload) c_duckdb_v2_value_destroy $ \value ->
+    output (get value) >>= (@?= payload)
+
+-- | Check that the getter rejects the value with ERROR_INPUT_INVALID.
+rejects :: (Storable a) => Get a -> DuckDBV2ValueHandle -> IO ()
+rejects get value = alloca $ \out -> get value out nullPtr >>= (@?= DuckDBV2ErrorInputInvalid)
+
+-- | Read the backing integer, the width and the scale of a DECIMAL value.
+readDecimal :: DuckDBV2ValueHandle -> IO (DuckDBV2HugeintT, Word8, Word8)
+readDecimal value = alloca $ \width -> alloca $ \scale -> do
+  integer <- output (\out -> c_duckdb_v2_value_get_decimal value out width scale)
+  (,,) integer <$> peek width <*> peek scale
+
+-- | Widen a signed integer to the two's complement 128-bit form.
+hugeint :: Int64 -> DuckDBV2HugeintT
+hugeint n = DuckDBV2HugeintT (fromIntegral n) (if n < 0 then -1 else 0)
+
+testRoundTrip :: IO ()
+testRoundTrip = withConnection $ \conn -> withFactory conn $ \factory -> do
+  roundTrip factory c_duckdb_v2_value_create_bool c_duckdb_v2_value_get_bool (CBool 1)
+  roundTrip factory c_duckdb_v2_value_create_bool c_duckdb_v2_value_get_bool (CBool 0)
+  roundTrip factory c_duckdb_v2_value_create_tinyint c_duckdb_v2_value_get_tinyint (minBound :: Int8)
+  roundTrip factory c_duckdb_v2_value_create_smallint c_duckdb_v2_value_get_smallint (minBound :: Int16)
+  roundTrip factory c_duckdb_v2_value_create_int c_duckdb_v2_value_get_int (minBound :: Int32)
+  roundTrip factory c_duckdb_v2_value_create_usmallint c_duckdb_v2_value_get_usmallint (maxBound :: Word16)
+  roundTrip factory c_duckdb_v2_value_create_uint c_duckdb_v2_value_get_uint (maxBound :: Word32)
+  roundTrip factory c_duckdb_v2_value_create_ubigint c_duckdb_v2_value_get_ubigint (maxBound :: Word64)
+  roundTrip factory c_duckdb_v2_value_create_float c_duckdb_v2_value_get_float (-1.5 :: CFloat)
+  roundTrip factory c_duckdb_v2_value_create_double c_duckdb_v2_value_get_double (2.25e300 :: CDouble)
+  -- Each temporal payload is a raw count in the unit that the header documents.
+  roundTrip factory c_duckdb_v2_value_create_date c_duckdb_v2_value_get_date (-719528 :: Int32)
+  roundTrip factory c_duckdb_v2_value_create_time c_duckdb_v2_value_get_time (86399999999 :: Int64)
+  roundTrip factory c_duckdb_v2_value_create_time_ns c_duckdb_v2_value_get_time_ns (86399999999999 :: Int64)
+  -- 01:00:00 at UTC+01:00. The low 24 bits hold the offset, biased by 57599 seconds.
+  roundTrip factory c_duckdb_v2_value_create_time_tz c_duckdb_v2_value_get_time_tz ((3600000000 `shiftL` 24) .|. (57599 - 3600) :: Word64)
+  roundTrip factory c_duckdb_v2_value_create_timestamp c_duckdb_v2_value_get_timestamp (-1 :: Int64)
+  roundTrip factory c_duckdb_v2_value_create_timestamp_sec c_duckdb_v2_value_get_timestamp_sec (-86401 :: Int64)
+  roundTrip factory c_duckdb_v2_value_create_timestamp_ms c_duckdb_v2_value_get_timestamp_ms (1700000000123 :: Int64)
+  roundTrip factory c_duckdb_v2_value_create_timestamp_ns c_duckdb_v2_value_get_timestamp_ns (1700000000123456789 :: Int64)
+  roundTrip factory c_duckdb_v2_value_create_timestamp_tz c_duckdb_v2_value_get_timestamp_tz (-1700000000123456 :: Int64)
+  roundTrip factory c_duckdb_v2_value_create_timestamp_tz_ns c_duckdb_v2_value_get_timestamp_tz_ns (1700000000123456789 :: Int64)
+  let uuid = DuckDBV2HugeintT 0x0123456789abcdef (-0x1032547698badcff)
+  with uuid $ \ptr ->
+    withHandle (c_duckdb_v2_value_create_uuid factory (ConstPtr ptr)) c_duckdb_v2_value_destroy $ \value ->
+      output (c_duckdb_v2_value_get_uuid value) >>= (@?= uuid)
+  -- A width of 4 selects 16-bit storage. The getter widens it to 128 bits with the sign.
+  let decimals = [(hugeint (-1234), 4, 1), (DuckDBV2HugeintT 0xfedcba9876543210 0x7fffffffffff, 38, 10)]
+  mapM_
+    ( \(integer, width, scale) -> with integer $ \ptr ->
+        withHandle (c_duckdb_v2_value_create_decimal factory (ConstPtr ptr) width scale) c_duckdb_v2_value_destroy $ \value ->
+          readDecimal value >>= (@?= (integer, width, scale))
+    )
+    decimals
+  let bytes = [0, 255, 1, 128, 0]
+  withBytes bytes $ \input ->
+    withHandle (c_duckdb_v2_value_create_blob factory input) c_duckdb_v2_value_destroy $ \value -> do
+      DuckDBV2Str ptr len <- output (c_duckdb_v2_value_get_blob value)
+      peekArray (fromIntegral len) (castPtr (unConstPtr ptr) :: Ptr Word8) >>= (@?= bytes)
+
+testConversion :: IO ()
+testConversion = withConnection $ \conn -> withFactory conn $ \factory -> do
+  withView "-300" $ \text -> withHandle (c_duckdb_v2_value_create_varchar factory text) c_duckdb_v2_value_destroy $ \value -> do
+    output (c_duckdb_v2_value_get_smallint value) >>= (@?= (-300))
+    output (c_duckdb_v2_value_get_int value) >>= (@?= (-300))
+    output (c_duckdb_v2_value_get_double value) >>= (@?= (-300))
+    output (c_duckdb_v2_value_get_float value) >>= (@?= (-300))
+    alloca $ \out -> c_duckdb_v2_value_get_tinyint value out nullPtr >>= assertBool "-300 does not fit a TINYINT" . (/= DuckDBV2ErrorNone)
+    alloca $ \out -> c_duckdb_v2_value_get_usmallint value out nullPtr >>= assertBool "-300 does not fit a USMALLINT" . (/= DuckDBV2ErrorNone)
+    -- The VARCHAR getter does not convert, so it succeeds only while the value is still a VARCHAR.
+    output (c_duckdb_v2_value_get_varchar value) >>= readView >>= (@?= "-300")
+  withHandle (c_duckdb_v2_value_create_ubigint factory 70000) c_duckdb_v2_value_destroy $ \value -> do
+    output (c_duckdb_v2_value_get_uint value) >>= (@?= 70000)
+    output (c_duckdb_v2_value_get_bool value) >>= (@?= CBool 1)
+    output (c_duckdb_v2_value_get_ubigint value) >>= (@?= 70000)
+  -- 1970-01-02 00:00:05 in microseconds since the epoch.
+  withHandle (c_duckdb_v2_value_create_timestamp factory 86405000000) c_duckdb_v2_value_destroy $ \value -> do
+    output (c_duckdb_v2_value_get_date value) >>= (@?= 1)
+    output (c_duckdb_v2_value_get_time value) >>= (@?= 5000000)
+    output (c_duckdb_v2_value_get_timestamp_sec value) >>= (@?= 86405)
+    output (c_duckdb_v2_value_get_timestamp_ms value) >>= (@?= 86405000)
+    output (c_duckdb_v2_value_get_timestamp_ns value) >>= (@?= 86405000000000)
+    output (c_duckdb_v2_value_get_timestamp value) >>= (@?= 86405000000)
+
+testRejection :: IO ()
+testRejection = withConnection $ \conn -> withFactory conn $ \factory -> do
+  withHandle
+    (c_duckdb_v2_factory_create_type_from_id factory DuckDBV2LogicalTypeIdBigInt (coerce nullPtr) (coerce nullPtr) 0)
+    c_duckdb_v2_logical_type_destroy
+    $ \ty ->
+      withHandle (c_duckdb_v2_value_create_null factory ty) c_duckdb_v2_value_destroy $ \value -> do
+        mapM_
+          ($ value)
+          [ rejects c_duckdb_v2_value_get_bool
+          , rejects c_duckdb_v2_value_get_tinyint
+          , rejects c_duckdb_v2_value_get_smallint
+          , rejects c_duckdb_v2_value_get_int
+          , rejects c_duckdb_v2_value_get_usmallint
+          , rejects c_duckdb_v2_value_get_uint
+          , rejects c_duckdb_v2_value_get_ubigint
+          , rejects c_duckdb_v2_value_get_float
+          , rejects c_duckdb_v2_value_get_double
+          , rejects c_duckdb_v2_value_get_date
+          , rejects c_duckdb_v2_value_get_time
+          , rejects c_duckdb_v2_value_get_time_ns
+          , rejects c_duckdb_v2_value_get_time_tz
+          , rejects c_duckdb_v2_value_get_timestamp
+          , rejects c_duckdb_v2_value_get_timestamp_sec
+          , rejects c_duckdb_v2_value_get_timestamp_ms
+          , rejects c_duckdb_v2_value_get_timestamp_ns
+          , rejects c_duckdb_v2_value_get_timestamp_tz
+          , rejects c_duckdb_v2_value_get_timestamp_tz_ns
+          , rejects c_duckdb_v2_value_get_blob
+          , rejects c_duckdb_v2_value_get_uuid
+          , rejects c_duckdb_v2_value_get_bigint
+          , rejects c_duckdb_v2_value_get_varchar
+          ]
+        alloca $ \width -> alloca $ \scale -> alloca $ \out ->
+          c_duckdb_v2_value_get_decimal value out width scale nullPtr >>= (@?= DuckDBV2ErrorInputInvalid)
+  withView "7" $ \text -> withHandle (c_duckdb_v2_value_create_varchar factory text) c_duckdb_v2_value_destroy $ \value ->
+    output (c_duckdb_v2_value_get_varchar value) >>= readView >>= (@?= "7")
+  -- BLOB, UUID and DECIMAL getters do not convert, so another type id is invalid.
+  withHandle (c_duckdb_v2_value_create_bigint factory 7) c_duckdb_v2_value_destroy $ \value -> do
+    output (c_duckdb_v2_value_get_bigint value) >>= (@?= 7)
+    rejects c_duckdb_v2_value_get_varchar value
+    rejects c_duckdb_v2_value_get_blob value
+    rejects c_duckdb_v2_value_get_uuid value
+    alloca $ \width -> alloca $ \scale -> alloca $ \out ->
+      c_duckdb_v2_value_get_decimal value out width scale nullPtr >>= (@?= DuckDBV2ErrorInputInvalid)
+  -- The default cast set has no cast from BLOB to a number, a time or a timestamp.
+  withBytes [1, 2] $ \input -> withHandle (c_duckdb_v2_value_create_blob factory input) c_duckdb_v2_value_destroy $ \value ->
+    mapM_
+      ($ value)
+      [ rejects c_duckdb_v2_value_get_int
+      , rejects c_duckdb_v2_value_get_double
+      , rejects c_duckdb_v2_value_get_date
+      , rejects c_duckdb_v2_value_get_timestamp
+      ]
+
+testCreationRejection :: IO ()
+testCreationRejection = withConnection $ \conn -> withFactory conn $ \factory -> do
+  let decimal integer width scale = with (hugeint integer) $ \ptr -> alloca $ \out -> do
+        poke out (coerce nullPtr)
+        code <- c_duckdb_v2_value_create_decimal factory (ConstPtr ptr) width scale out nullPtr
+        c_duckdb_v2_value_destroy out >>= (@?= DuckDBV2ErrorNone)
+        pure code
+  decimal 1 1 0 >>= (@?= DuckDBV2ErrorNone)
+  decimal 1 0 0 >>= (@?= DuckDBV2ErrorInputInvalid)
+  decimal 1 38 0 >>= (@?= DuckDBV2ErrorNone)
+  decimal 1 39 0 >>= (@?= DuckDBV2ErrorInputInvalid)
+  decimal 1 4 4 >>= (@?= DuckDBV2ErrorNone)
+  decimal 1 4 5 >>= (@?= DuckDBV2ErrorInputInvalid)
+  -- A width of 18 selects 64-bit storage, and a width of 4 selects 16-bit storage.
+  decimal maxBound 18 0 >>= (@?= DuckDBV2ErrorNone)
+  with (DuckDBV2HugeintT 0x8000000000000000 0) $ \ptr -> alloca $ \out -> do
+    poke out (coerce nullPtr)
+    code <- c_duckdb_v2_value_create_decimal factory (ConstPtr ptr) 18 0 out nullPtr
+    c_duckdb_v2_value_destroy out >>= (@?= DuckDBV2ErrorNone)
+    code @?= DuckDBV2ErrorInputInvalid
+  -- The header names ERROR_INPUT_INVALID for a value too wide for the storage tier. For the 16-bit and the 32-bit tier
+  -- DuckDB reports an internal error, so the test checks only that the call fails.
+  decimal 32767 4 0 >>= (@?= DuckDBV2ErrorNone)
+  decimal 32768 4 0 >>= \code -> assertBool ("a value too wide for 16 bits fails: " <> show code) (code /= DuckDBV2ErrorNone)
+  -- A NULL value and a TYPE value carry a type, and ANY has no physical layout.
+  let valueOf create typeId = withHandle (c_duckdb_v2_factory_create_type_from_id factory typeId (coerce nullPtr) (coerce nullPtr) 0) c_duckdb_v2_logical_type_destroy $ \ty ->
+        alloca $ \out -> do
+          poke out (coerce nullPtr)
+          code <- create factory ty out nullPtr
+          c_duckdb_v2_value_destroy out >>= (@?= DuckDBV2ErrorNone)
+          pure code
+  forM_ [c_duckdb_v2_value_create_null, c_duckdb_v2_value_create_type] $ \create -> do
+    valueOf create DuckDBV2LogicalTypeIdBigInt >>= (@?= DuckDBV2ErrorNone)
+    valueOf create DuckDBV2LogicalTypeIdAny >>= assertBool "a value of type ANY is rejected" . (/= DuckDBV2ErrorNone)
diff --git a/test/ValidityMaskTest.hs b/test/ValidityMaskTest.hs
--- a/test/ValidityMaskTest.hs
+++ b/test/ValidityMaskTest.hs
@@ -13,49 +13,49 @@
 -- | Entry point for validity-mask focused tests.
 tests :: TestTree
 tests =
-    testGroup
-        "Validity Mask Functions"
-        [ validityRowHelpers
-        , validitySetOperations
-        ]
+  testGroup
+    "Validity Mask Functions"
+    [ validityRowHelpers
+    , validitySetOperations
+    ]
 
 validityRowHelpers :: TestTree
 validityRowHelpers =
-    testCase "row validity helpers reflect changes" $ do
-        withIntegerVector 4 \vec -> do
-            void (c_duckdb_vector_ensure_validity_writable vec)
-            mask <- c_duckdb_vector_get_validity vec
-            assertBool "validity pointer should not be null" (mask /= nullPtr)
-            setAllValid mask 4
+  testCase "row validity helpers reflect changes" $ do
+    withIntegerVector 4 \vec -> do
+      void (c_duckdb_vector_ensure_validity_writable vec)
+      mask <- c_duckdb_vector_get_validity vec
+      assertBool "validity pointer should not be null" (mask /= nullPtr)
+      setAllValid mask 4
 
-            toBool (c_duckdb_validity_row_is_valid mask 2) >>= (@?= True)
-            c_duckdb_validity_set_row_invalid mask 2
-            toBool (c_duckdb_validity_row_is_valid mask 2) >>= (@?= False)
-            c_duckdb_validity_set_row_valid mask 2
-            toBool (c_duckdb_validity_row_is_valid mask 2) >>= (@?= True)
+      toBool (c_duckdb_validity_row_is_valid mask 2) >>= (@?= True)
+      c_duckdb_validity_set_row_invalid mask 2
+      toBool (c_duckdb_validity_row_is_valid mask 2) >>= (@?= False)
+      c_duckdb_validity_set_row_valid mask 2
+      toBool (c_duckdb_validity_row_is_valid mask 2) >>= (@?= True)
 
 validitySetOperations :: TestTree
 validitySetOperations =
-    testCase "set_row_validity toggles state based on CBool" $ do
-        withIntegerVector 3 \vec -> do
-            void (c_duckdb_vector_ensure_validity_writable vec)
-            mask <- c_duckdb_vector_get_validity vec
-            setAllValid mask 3
+  testCase "set_row_validity toggles state based on CBool" $ do
+    withIntegerVector 3 \vec -> do
+      void (c_duckdb_vector_ensure_validity_writable vec)
+      mask <- c_duckdb_vector_get_validity vec
+      setAllValid mask 3
 
-            c_duckdb_validity_set_row_validity mask 1 (CBool 0)
-            toBool (c_duckdb_validity_row_is_valid mask 1) >>= (@?= False)
+      c_duckdb_validity_set_row_validity mask 1 (CBool 0)
+      toBool (c_duckdb_validity_row_is_valid mask 1) >>= (@?= False)
 
-            c_duckdb_validity_set_row_validity mask 1 (CBool 1)
-            toBool (c_duckdb_validity_row_is_valid mask 1) >>= (@?= True)
+      c_duckdb_validity_set_row_validity mask 1 (CBool 1)
+      toBool (c_duckdb_validity_row_is_valid mask 1) >>= (@?= True)
 
 -- Helpers -------------------------------------------------------------------
 
 withIntegerVector :: DuckDBIdx -> (DuckDBVector -> IO a) -> IO a
 withIntegerVector capacity action =
-    withLogicalType (c_duckdb_create_logical_type DuckDBTypeInteger) \intType ->
-        withVector (c_duckdb_create_vector intType capacity) action
+  withLogicalType (c_duckdb_create_logical_type (DuckDBTypeAlias DuckDBTypeInteger)) \intType ->
+    withVector (c_duckdb_create_vector intType capacity) action
 
 toBool :: IO CBool -> IO Bool
 toBool action = do
-    CBool v <- action
-    pure (v /= 0)
+  CBool v <- action
+  pure (v /= 0)
diff --git a/test/ValueInterfaceTest.hs b/test/ValueInterfaceTest.hs
--- a/test/ValueInterfaceTest.hs
+++ b/test/ValueInterfaceTest.hs
@@ -1,321 +1,359 @@
 {-# LANGUAGE BlockArguments #-}
+{-# LANGUAGE DataKinds #-}
+{-# LANGUAGE DuplicateRecordFields #-}
+{-# LANGUAGE TypeApplications #-}
 
 module ValueInterfaceTest (tests) where
 
-import Control.Monad (when, (>=>))
+import Control.Monad (forM_, when, (>=>))
+import Data.Coerce (coerce)
 import Data.Int (Int16, Int32, Int64, Int8)
 import Data.Word (Word16, Word32, Word64, Word8)
 import Database.DuckDB.FFI
-import Foreign.C.String (peekCString, peekCStringLen, withCString)
+import Foreign.C.ConstPtr (ConstPtr (..))
+import Foreign.C.String (peekCString, peekCStringLen)
 import Foreign.C.Types (CBool (..), CDouble (..), CFloat (..))
 import Foreign.Marshal.Alloc (alloca)
 import Foreign.Marshal.Array (peekArray, withArray)
 import Foreign.Marshal.Utils (with, withMany)
 import Foreign.Ptr (Ptr, castPtr, nullPtr)
 import Foreign.Storable (peek, poke)
+import GHC.Records (getField)
 import Test.Tasty (TestTree, testGroup)
 import Test.Tasty.HUnit (testCase, (@?=))
-import Utils (destroyDuckValue, destroyLogicalType, withDuckValue)
+import Utils (destroyDuckValue, destroyLogicalType, withConnection, withConstCString, withDatabase, withDuckValue)
 
 tests :: TestTree
 tests =
-    testGroup
-        "Value Interface"
-        [ scalarCreatesRoundTrip
-        , valueTypeReportsLogicalType
-        , collectionValuesRoundTrip
-        ]
+  testGroup
+    "Value Interface"
+    [ scalarCreatesRoundTrip
+    , valueTypeReportsLogicalType
+    , collectionValuesRoundTrip
+    , timestampTzNsRoundTrip
+    ]
 
+timestampTzNsRoundTrip :: TestTree
+timestampTzNsRoundTrip =
+  testCase "TIMESTAMP_TZ_NS values retain nanoseconds through SQL" $
+    withDatabase \db ->
+      withConnection db \conn ->
+        withConstCString "SELECT ?" \sql ->
+          alloca \statementPtr -> do
+            c_duckdb_prepare conn sql statementPtr >>= (@?= DuckDBSuccess)
+            statement <- peek statementPtr
+            forM_ [0, 1234567890123456789, -1234567890123456789, maxBound - 1, maxBound, negate maxBound] \nanos ->
+              withDuckValue (c_duckdb_create_timestamp_tz_ns (DuckDBTimestampNs nanos)) \value -> do
+                c_duckdb_get_timestamp_tz_ns value >>= (@?= DuckDBTimestampNs nanos)
+                logical <- c_duckdb_get_value_type value
+                c_duckdb_get_type_id logical >>= (@?= DuckDBTypeAlias DuckDBTypeTimestampTzNs)
+                c_duckdb_bind_value statement 1 value >>= (@?= DuckDBSuccess)
+                alloca \resultPtr -> do
+                  c_duckdb_execute_prepared statement resultPtr >>= (@?= DuckDBSuccess)
+                  c_duckdb_column_type resultPtr 0 >>= (@?= DuckDBTypeAlias DuckDBTypeTimestampTzNs)
+                  chunk <- peek resultPtr >>= c_duckdb_fetch_chunk
+                  vector <- c_duckdb_data_chunk_get_vector chunk 0
+                  dataPtr <- c_duckdb_vector_get_data vector
+                  peek (castPtr dataPtr :: Ptr Int64) >>= (@?= nanos)
+                  alloca \chunkPtr -> do
+                    poke chunkPtr chunk
+                    c_duckdb_destroy_data_chunk chunkPtr
+                  c_duckdb_destroy_result resultPtr
+            c_duckdb_destroy_prepare statementPtr
+
 scalarCreatesRoundTrip :: TestTree
 scalarCreatesRoundTrip =
-    testCase "scalar value constructors and accessors" $ do
-        withDuckValue (c_duckdb_create_bool (CBool 1)) (c_duckdb_get_bool >=> (@?= CBool 1))
+  testCase "scalar value constructors and accessors" $ do
+    withDuckValue (c_duckdb_create_bool (CBool 1)) (c_duckdb_get_bool >=> (@?= CBool 1))
 
-        withDuckValue (c_duckdb_create_int8 (-8)) (c_duckdb_get_int8 >=> (@?= (-8 :: Int8)))
+    withDuckValue (c_duckdb_create_int8 (-8)) (c_duckdb_get_int8 >=> (@?= (-8 :: Int8)))
 
-        withDuckValue (c_duckdb_create_uint8 250) (c_duckdb_get_uint8 >=> (@?= (250 :: Word8)))
+    withDuckValue (c_duckdb_create_uint8 250) (c_duckdb_get_uint8 >=> (@?= (250 :: Word8)))
 
-        withDuckValue (c_duckdb_create_int16 (-32000)) (c_duckdb_get_int16 >=> (@?= (-32000 :: Int16)))
+    withDuckValue (c_duckdb_create_int16 (-32000)) (c_duckdb_get_int16 >=> (@?= (-32000 :: Int16)))
 
-        withDuckValue (c_duckdb_create_uint16 65000) (c_duckdb_get_uint16 >=> (@?= (65000 :: Word16)))
+    withDuckValue (c_duckdb_create_uint16 65000) (c_duckdb_get_uint16 >=> (@?= (65000 :: Word16)))
 
-        withDuckValue
-            (c_duckdb_create_int32 (-2000000000))
-            ( c_duckdb_get_int32
-                >=> (@?= (-2000000000 :: Int32))
-            )
+    withDuckValue
+      (c_duckdb_create_int32 (-2000000000))
+      ( c_duckdb_get_int32
+          >=> (@?= (-2000000000 :: Int32))
+      )
 
-        withDuckValue
-            (c_duckdb_create_uint32 4000000000)
-            ( c_duckdb_get_uint32
-                >=> (@?= (4000000000 :: Word32))
-            )
+    withDuckValue
+      (c_duckdb_create_uint32 4000000000)
+      ( c_duckdb_get_uint32
+          >=> (@?= (4000000000 :: Word32))
+      )
 
-        withDuckValue
-            (c_duckdb_create_int64 (-9000000000000000000))
-            ( c_duckdb_get_int64
-                >=> (@?= (-9000000000000000000 :: Int64))
-            )
+    withDuckValue
+      (c_duckdb_create_int64 (-9000000000000000000))
+      ( c_duckdb_get_int64
+          >=> (@?= (-9000000000000000000 :: Int64))
+      )
 
-        withDuckValue
-            (c_duckdb_create_uint64 10000000000000000000)
-            ( c_duckdb_get_uint64
-                >=> (@?= (10000000000000000000 :: Word64))
-            )
+    withDuckValue
+      (c_duckdb_create_uint64 10000000000000000000)
+      ( c_duckdb_get_uint64
+          >=> (@?= (10000000000000000000 :: Word64))
+      )
 
-        alloca \hugePtr -> do
-            poke hugePtr DuckDBHugeInt{duckDBHugeIntLower = 123, duckDBHugeIntUpper = -1}
-            withDuckValue (c_duckdb_create_hugeint hugePtr) \val ->
-                alloca \out -> do
-                    c_duckdb_get_hugeint val out
-                    peek out >>= (@?= DuckDBHugeInt 123 (-1))
+    alloca \hugePtr -> do
+      poke hugePtr DuckDBHugeInt{lower = 123, upper = -1}
+      withDuckValue (peek hugePtr >>= \rawValue -> c_duckdb_create_hugeint rawValue) \val ->
+        alloca \out -> do
+          c_duckdb_get_hugeint val >>= poke out
+          peek out >>= (@?= DuckDBHugeInt 123 (-1))
 
-        alloca \uhugePtr -> do
-            poke uhugePtr DuckDBUHugeInt{duckDBUHugeIntLower = 321, duckDBUHugeIntUpper = 2}
-            withDuckValue (c_duckdb_create_uhugeint uhugePtr) \val ->
-                alloca \out -> do
-                    c_duckdb_get_uhugeint val out
-                    peek out >>= (@?= DuckDBUHugeInt 321 2)
+    alloca \uhugePtr -> do
+      poke uhugePtr DuckDBUHugeInt{lower = 321, upper = 2}
+      withDuckValue (peek uhugePtr >>= \rawValue -> c_duckdb_create_uhugeint rawValue) \val ->
+        alloca \out -> do
+          c_duckdb_get_uhugeint val >>= poke out
+          peek out >>= (@?= DuckDBUHugeInt 321 2)
 
-        withArray (map (fromIntegral . fromEnum) "1234") \digitsPtr -> do
-            let bignum = DuckDBBignum digitsPtr 4 (CBool 0)
-            with bignum \bignumPtr ->
-                withDuckValue (c_duckdb_create_bignum bignumPtr) \val ->
-                    alloca \outPtr -> do
-                        c_duckdb_get_bignum val outPtr
-                        DuckDBBignum outData outLen outNeg <- peek outPtr
-                        outLen @?= 4
-                        outNeg @?= CBool 0
-                        peekArray (fromIntegral outLen) outData >>= (@?= map (fromIntegral . fromEnum) "1234")
-                        when (outData /= nullPtr) $ c_duckdb_free (castPtr outData)
+    withArray (map (fromIntegral . fromEnum) "1234") \digitsPtr -> do
+      let bignum = DuckDBBignum digitsPtr 4 (CBool 0)
+      with bignum \bignumPtr ->
+        withDuckValue (peek bignumPtr >>= \rawValue -> c_duckdb_create_bignum rawValue) \val ->
+          alloca \outPtr -> do
+            c_duckdb_get_bignum val >>= poke outPtr
+            DuckDBBignum outData outLen outNeg <- peek outPtr
+            outLen @?= 4
+            outNeg @?= CBool 0
+            peekArray (fromIntegral outLen) outData >>= (@?= map (fromIntegral . fromEnum) "1234")
+            when (outData /= nullPtr) $ c_duckdb_free (coerce outData)
 
-        let hugeValue = DuckDBHugeInt{duckDBHugeIntLower = 42, duckDBHugeIntUpper = 0}
-            decimalValue = DuckDBDecimal{duckDBDecimalWidth = 10, duckDBDecimalScale = 2, duckDBDecimalValue = hugeValue}
-        with decimalValue \decimalPtr ->
-            withDuckValue (c_duckdb_create_decimal decimalPtr) \val ->
-                alloca \out -> do
-                    c_duckdb_get_decimal val out
-                    DuckDBDecimal{duckDBDecimalWidth = w, duckDBDecimalScale = s, duckDBDecimalValue = v} <- peek out
-                    (w, s, v) @?= (10, 2, hugeValue)
+    let hugeValue = DuckDBHugeInt{lower = 42, upper = 0}
+        decimalValue = DuckDBDecimal{width = 10, scale = 2, value = hugeValue}
+    with decimalValue \decimalPtr ->
+      withDuckValue (peek decimalPtr >>= \rawValue -> c_duckdb_create_decimal rawValue) \val ->
+        alloca \out -> do
+          c_duckdb_get_decimal val >>= poke out
+          DuckDBDecimal{width = w, scale = s, value = v} <- peek out
+          (w, s, v) @?= (10, 2, hugeValue)
 
-        withDuckValue (c_duckdb_create_float (CFloat 1.25)) (c_duckdb_get_float >=> (@?= CFloat 1.25))
+    withDuckValue (c_duckdb_create_float (CFloat 1.25)) (c_duckdb_get_float >=> (@?= CFloat 1.25))
 
-        withDuckValue (c_duckdb_create_double (CDouble 2.75)) (c_duckdb_get_double >=> (@?= CDouble 2.75))
+    withDuckValue (c_duckdb_create_double (CDouble 2.75)) (c_duckdb_get_double >=> (@?= CDouble 2.75))
 
-        let sampleDate = DuckDBDate 12345
-        withDuckValue (c_duckdb_create_date sampleDate) (c_duckdb_get_date >=> (@?= sampleDate))
+    let sampleDate = DuckDBDate 12345
+    withDuckValue (c_duckdb_create_date sampleDate) (c_duckdb_get_date >=> (@?= sampleDate))
 
-        let sampleTime = DuckDBTime 987654321
-        withDuckValue (c_duckdb_create_time sampleTime) (c_duckdb_get_time >=> (@?= sampleTime))
+    let sampleTime = DuckDBTime 987654321
+    withDuckValue (c_duckdb_create_time sampleTime) (c_duckdb_get_time >=> (@?= sampleTime))
 
-        let sampleTimeNs = DuckDBTimeNs 876543210
-        withDuckValue (c_duckdb_create_time_ns sampleTimeNs) (c_duckdb_get_time_ns >=> (@?= sampleTimeNs))
+    let sampleTimeNs = DuckDBTimeNs 876543210
+    withDuckValue (c_duckdb_create_time_ns sampleTimeNs) (c_duckdb_get_time_ns >=> (@?= sampleTimeNs))
 
-        let sampleTimeTz = DuckDBTimeTz 5555
-        withDuckValue (c_duckdb_create_time_tz_value sampleTimeTz) (c_duckdb_get_time_tz >=> (@?= sampleTimeTz))
+    let sampleTimeTz = DuckDBTimeTz 5555
+    withDuckValue (c_duckdb_create_time_tz_value sampleTimeTz) (c_duckdb_get_time_tz >=> (@?= sampleTimeTz))
 
-        let sampleTimestamp = DuckDBTimestamp 444444
-        withDuckValue (c_duckdb_create_timestamp sampleTimestamp) (c_duckdb_get_timestamp >=> (@?= sampleTimestamp))
+    let sampleTimestamp = DuckDBTimestamp 444444
+    withDuckValue (c_duckdb_create_timestamp sampleTimestamp) (c_duckdb_get_timestamp >=> (@?= sampleTimestamp))
 
-        withDuckValue (c_duckdb_create_timestamp_tz sampleTimestamp) (c_duckdb_get_timestamp_tz >=> (@?= sampleTimestamp))
+    withDuckValue (c_duckdb_create_timestamp_tz sampleTimestamp) (c_duckdb_get_timestamp_tz >=> (@?= sampleTimestamp))
 
-        let tsSeconds = DuckDBTimestampS 12
-        withDuckValue (c_duckdb_create_timestamp_s tsSeconds) (c_duckdb_get_timestamp_s >=> (@?= tsSeconds))
+    let tsSeconds = DuckDBTimestampS 12
+    withDuckValue (c_duckdb_create_timestamp_s tsSeconds) (c_duckdb_get_timestamp_s >=> (@?= tsSeconds))
 
-        let tsMillis = DuckDBTimestampMs 12000
-        withDuckValue (c_duckdb_create_timestamp_ms tsMillis) (c_duckdb_get_timestamp_ms >=> (@?= tsMillis))
+    let tsMillis = DuckDBTimestampMs 12000
+    withDuckValue (c_duckdb_create_timestamp_ms tsMillis) (c_duckdb_get_timestamp_ms >=> (@?= tsMillis))
 
-        let tsNanos = DuckDBTimestampNs 12000000
-        withDuckValue (c_duckdb_create_timestamp_ns tsNanos) (c_duckdb_get_timestamp_ns >=> (@?= tsNanos))
+    let tsNanos = DuckDBTimestampNs 12000000
+    withDuckValue (c_duckdb_create_timestamp_ns tsNanos) (c_duckdb_get_timestamp_ns >=> (@?= tsNanos))
 
-        let intervalVal = DuckDBInterval{duckDBIntervalMonths = 1, duckDBIntervalDays = 2, duckDBIntervalMicros = 3000}
-        with intervalVal \intervalPtr ->
-            withDuckValue (c_duckdb_create_interval intervalPtr) \val ->
-                alloca \out -> do
-                    c_duckdb_get_interval val out
-                    peek out >>= (@?= intervalVal)
+    let intervalVal = DuckDBInterval{months = 1, days = 2, micros = 3000}
+    with intervalVal \intervalPtr ->
+      withDuckValue (peek intervalPtr >>= \rawValue -> c_duckdb_create_interval rawValue) \val ->
+        alloca \out -> do
+          c_duckdb_get_interval val >>= poke out
+          peek out >>= (@?= intervalVal)
 
-        let blobBytes = map (fromIntegral . fromEnum) "duckdb-blob"
-        withArray blobBytes \blobPtr ->
-            withDuckValue (c_duckdb_create_blob blobPtr (fromIntegral (length blobBytes))) \val ->
-                alloca \blobOut -> do
-                    c_duckdb_get_blob val blobOut
-                    DuckDBBlob{duckDBBlobData = datPtr, duckDBBlobSize = size} <- peek blobOut
-                    size @?= fromIntegral (length blobBytes)
-                    peekArray (fromIntegral size) (castPtr datPtr :: Ptr Word8) >>= (@?= blobBytes)
-                    when (datPtr /= nullPtr) $ c_duckdb_free (castPtr datPtr)
+    let blobBytes = map (fromIntegral . fromEnum) "duckdb-blob"
+    withArray blobBytes \blobPtr ->
+      withDuckValue (c_duckdb_create_blob (coerce blobPtr) (fromIntegral (length blobBytes))) \val ->
+        alloca \blobOut -> do
+          c_duckdb_get_blob val >>= poke blobOut
+          DuckDBBlob{data' = datPtr, size = size} <- peek blobOut
+          size @?= fromIntegral (length blobBytes)
+          peekArray (fromIntegral size) (coerce datPtr :: Ptr Word8) >>= (@?= blobBytes)
+          when (datPtr /= nullPtr) $ c_duckdb_free (coerce datPtr)
 
-        let bitBytes = [0xAA :: Word8]
-        withArray bitBytes \bitDataPtr -> do
-            let bitVal = DuckDBBit{duckDBBitData = bitDataPtr, duckDBBitSize = 8}
-            with bitVal \bitPtr ->
-                withDuckValue (c_duckdb_create_bit bitPtr) \val ->
-                    alloca \bitOut -> do
-                        c_duckdb_get_bit val bitOut
-                        DuckDBBit{duckDBBitData = datPtr, duckDBBitSize = size} <- peek bitOut
-                        size @?= 8
-                        peekArray (fromIntegral ((size + 7) `div` 8)) datPtr >>= (@?= bitBytes)
-                        when (datPtr /= nullPtr) $ c_duckdb_free (castPtr datPtr)
+    let bitBytes = [0, 0xAA :: Word8]
+    withArray bitBytes \bitDataPtr -> do
+      let bitVal = DuckDBBit{data' = bitDataPtr, size = fromIntegral (length bitBytes)}
+      with bitVal \bitPtr ->
+        withDuckValue (peek bitPtr >>= \rawValue -> c_duckdb_create_bit rawValue) \val ->
+          alloca \bitOut -> do
+            c_duckdb_get_bit val >>= poke bitOut
+            DuckDBBit{data' = datPtr, size = size} <- peek bitOut
+            size @?= fromIntegral (length bitBytes)
+            peekArray (fromIntegral size) datPtr >>= (@?= bitBytes)
+            when (datPtr /= nullPtr) $ c_duckdb_free (coerce datPtr)
 
-        let uuidValue = DuckDBUHugeInt{duckDBUHugeIntLower = 0x0011223344556677, duckDBUHugeIntUpper = 0x8899aabbccddeeff}
-        with uuidValue \uuidPtr ->
-            withDuckValue (c_duckdb_create_uuid uuidPtr) \val ->
-                alloca \out -> do
-                    c_duckdb_get_uuid val out
-                    peek out >>= (@?= uuidValue)
+    let uuidValue = DuckDBUHugeInt{lower = 0x0011223344556677, upper = 0x8899aabbccddeeff}
+    with uuidValue \uuidPtr ->
+      withDuckValue (peek uuidPtr >>= \rawValue -> c_duckdb_create_uuid rawValue) \val ->
+        alloca \out -> do
+          c_duckdb_get_uuid val >>= poke out
+          peek out >>= (@?= uuidValue)
 
-        withCString "varchar literal" \str ->
-            withDuckValue (c_duckdb_create_varchar str) \val -> do
-                cPtr <- c_duckdb_get_varchar val
-                peekCString cPtr >>= (@?= "varchar literal")
-                c_duckdb_free (castPtr cPtr)
+    withConstCString "varchar literal" \str ->
+      withDuckValue (c_duckdb_create_varchar str) \val -> do
+        cPtr <- c_duckdb_get_varchar val
+        peekCString (coerce cPtr) >>= (@?= "varchar literal")
+        c_duckdb_free (coerce cPtr)
 
-        let lenString = "hello\0world"
-        withCString lenString \cStr -> do
-            let byteLen = fromIntegral (length lenString)
-            withDuckValue (c_duckdb_create_varchar_length cStr byteLen) \val -> do
-                cPtr <- c_duckdb_get_varchar val
-                peekCStringLen (cPtr, length "hello") >>= (@?= "hello")
-                c_duckdb_free (castPtr cPtr)
+    let lenString = "hello\0world"
+    withConstCString lenString \cStr -> do
+      let byteLen = fromIntegral (length lenString)
+      withDuckValue (c_duckdb_create_varchar_length cStr byteLen) \val -> do
+        cPtr <- c_duckdb_get_varchar val
+        peekCStringLen (coerce cPtr, length "hello") >>= (@?= "hello")
+        c_duckdb_free (coerce cPtr)
 
-        withDuckValue c_duckdb_create_null_value \val -> do
-            c_duckdb_is_null_value val >>= (@?= CBool 1)
-            strPtr <- c_duckdb_value_to_string val
-            peekCString strPtr >>= (@?= "NULL")
-            c_duckdb_free (castPtr strPtr)
+    withDuckValue c_duckdb_create_null_value \val -> do
+      c_duckdb_is_null_value val >>= (@?= CBool 1)
+      strPtr <- c_duckdb_value_to_string val
+      peekCString (coerce strPtr) >>= (@?= "NULL")
+      c_duckdb_free (coerce strPtr)
 
 valueTypeReportsLogicalType :: TestTree
 valueTypeReportsLogicalType =
-    testCase "value type identifiers track constructors" $ do
-        withDuckValue (c_duckdb_create_int32 42) \intVal -> do
-            intType <- c_duckdb_get_value_type intVal
-            c_duckdb_get_type_id intType >>= (@?= DuckDBTypeInteger)
+  testCase "value type identifiers track constructors" $ do
+    withDuckValue (c_duckdb_create_int32 42) \intVal -> do
+      intType <- c_duckdb_get_value_type intVal
+      c_duckdb_get_type_id intType
+        >>= (@?= DuckDBTypeInteger) . (getField @"unwrap")
 
-        withDuckValue (withCString "duckdb" c_duckdb_create_varchar) \strVal -> do
-            strType <- c_duckdb_get_value_type strVal
-            c_duckdb_get_type_id strType >>= (@?= DuckDBTypeVarchar)
+    withDuckValue (withConstCString "duckdb" c_duckdb_create_varchar) \strVal -> do
+      strType <- c_duckdb_get_value_type strVal
+      c_duckdb_get_type_id strType
+        >>= (@?= DuckDBTypeVarchar) . (getField @"unwrap")
 
-        listChild <- c_duckdb_create_logical_type DuckDBTypeInteger
-        listLogical <- c_duckdb_create_list_type listChild
-        elemVal <- c_duckdb_create_int32 7
-        withArray [elemVal] \valuesArray -> do
-            let count = fromIntegral (1 :: Int)
-            withDuckValue (c_duckdb_create_list_value listChild valuesArray count) \listVal -> do
-                listType <- c_duckdb_get_value_type listVal
-                c_duckdb_get_type_id listType >>= (@?= DuckDBTypeList)
-        destroyDuckValue elemVal
-        destroyLogicalType listLogical
-        destroyLogicalType listChild
+    listChild <- c_duckdb_create_logical_type (DuckDBTypeAlias DuckDBTypeInteger)
+    listLogical <- c_duckdb_create_list_type listChild
+    elemVal <- c_duckdb_create_int32 7
+    withArray [elemVal] \valuesArray -> do
+      let count = fromIntegral (1 :: Int)
+      withDuckValue (c_duckdb_create_list_value listChild valuesArray count) \listVal -> do
+        listType <- c_duckdb_get_value_type listVal
+        c_duckdb_get_type_id listType
+          >>= (@?= DuckDBTypeList) . (getField @"unwrap")
+    destroyDuckValue elemVal
+    destroyLogicalType listLogical
+    destroyLogicalType listChild
 
 collectionValuesRoundTrip :: TestTree
 collectionValuesRoundTrip =
-    testCase "list/array/map/struct/enum/union constructors" $ do
-        -- List value
-        listChild <- c_duckdb_create_logical_type DuckDBTypeInteger
-        listLogical <- c_duckdb_create_list_type listChild
-        listVal1 <- c_duckdb_create_int32 1
-        listVal2 <- c_duckdb_create_int32 2
-        withArray [listVal1, listVal2] \listArray -> do
-            let entryCount = fromIntegral (2 :: Int) :: DuckDBIdx
-            withDuckValue (c_duckdb_create_list_value listChild listArray entryCount) \listVal -> do
-                _ <- c_duckdb_get_list_size listVal
-                child0 <- c_duckdb_get_list_child listVal 0
-                c_duckdb_get_int32 child0 >>= (@?= 1)
-                destroyDuckValue child0
-                child1 <- c_duckdb_get_list_child listVal 1
-                c_duckdb_get_int32 child1 >>= (@?= 2)
-                destroyDuckValue child1
-                listStr <- c_duckdb_value_to_string listVal
-                peekCString listStr >>= (@?= "[1, 2]")
-                c_duckdb_free (castPtr listStr)
-        destroyDuckValue listVal1
-        destroyDuckValue listVal2
-        destroyLogicalType listLogical
-        destroyLogicalType listChild
+  testCase "list/array/map/struct/enum/union constructors" $ do
+    -- List value
+    listChild <- c_duckdb_create_logical_type (DuckDBTypeAlias DuckDBTypeInteger)
+    listLogical <- c_duckdb_create_list_type listChild
+    listVal1 <- c_duckdb_create_int32 1
+    listVal2 <- c_duckdb_create_int32 2
+    withArray [listVal1, listVal2] \listArray -> do
+      let entryCount = fromIntegral (2 :: Int) :: DuckDBIdx
+      withDuckValue (c_duckdb_create_list_value listChild listArray entryCount) \listVal -> do
+        _ <- c_duckdb_get_list_size listVal
+        child0 <- c_duckdb_get_list_child listVal 0
+        c_duckdb_get_int32 child0 >>= (@?= 1)
+        destroyDuckValue child0
+        child1 <- c_duckdb_get_list_child listVal 1
+        c_duckdb_get_int32 child1 >>= (@?= 2)
+        destroyDuckValue child1
+        listStr <- c_duckdb_value_to_string listVal
+        peekCString (coerce listStr) >>= (@?= "[1, 2]")
+        c_duckdb_free (coerce listStr)
+    destroyDuckValue listVal1
+    destroyDuckValue listVal2
+    destroyLogicalType listLogical
+    destroyLogicalType listChild
 
-        -- Array value
-        arrayChild <- c_duckdb_create_logical_type DuckDBTypeInteger
-        arrayLogical <- c_duckdb_create_array_type arrayChild 2
-        arrVal1 <- c_duckdb_create_int32 7
-        arrVal2 <- c_duckdb_create_int32 8
-        withArray [arrVal1, arrVal2] \arrArray -> do
-            let entryCount = fromIntegral (2 :: Int) :: DuckDBIdx
-            withDuckValue (c_duckdb_create_array_value arrayChild arrArray entryCount) \arrVal -> do
-                _ <- c_duckdb_get_list_size arrVal
-                arrStr <- c_duckdb_value_to_string arrVal
-                peekCString arrStr >>= (@?= "[7, 8]")
-                c_duckdb_free (castPtr arrStr)
-        destroyDuckValue arrVal1
-        destroyDuckValue arrVal2
-        destroyLogicalType arrayLogical
-        destroyLogicalType arrayChild
+    -- Array value
+    arrayChild <- c_duckdb_create_logical_type (DuckDBTypeAlias DuckDBTypeInteger)
+    arrayLogical <- c_duckdb_create_array_type arrayChild 2
+    arrVal1 <- c_duckdb_create_int32 7
+    arrVal2 <- c_duckdb_create_int32 8
+    withArray [arrVal1, arrVal2] \arrArray -> do
+      let entryCount = fromIntegral (2 :: Int) :: DuckDBIdx
+      withDuckValue (c_duckdb_create_array_value arrayChild arrArray entryCount) \arrVal -> do
+        _ <- c_duckdb_get_list_size arrVal
+        arrStr <- c_duckdb_value_to_string arrVal
+        peekCString (coerce arrStr) >>= (@?= "[7, 8]")
+        c_duckdb_free (coerce arrStr)
+    destroyDuckValue arrVal1
+    destroyDuckValue arrVal2
+    destroyLogicalType arrayLogical
+    destroyLogicalType arrayChild
 
-        -- Map value
-        keyType <- c_duckdb_create_logical_type DuckDBTypeVarchar
-        valType <- c_duckdb_create_logical_type DuckDBTypeInteger
-        mapLogical <- c_duckdb_create_map_type keyType valType
-        keyValue <- withCString "key" c_duckdb_create_varchar
-        valValue <- c_duckdb_create_int32 99
-        withArray [keyValue] \keyArray ->
-            withArray [valValue] \valArray -> do
-                let entryCount = fromIntegral (1 :: Int) :: DuckDBIdx
-                withDuckValue (c_duckdb_create_map_value mapLogical keyArray valArray entryCount) \mapVal -> do
-                    c_duckdb_get_map_size mapVal >>= (@?= 1)
-                    keyHandle <- c_duckdb_get_map_key mapVal 0
-                    keyStrPtr <- c_duckdb_get_varchar keyHandle
-                    peekCString keyStrPtr >>= (@?= "key")
-                    c_duckdb_free (castPtr keyStrPtr)
-                    destroyDuckValue keyHandle
-                    valHandle <- c_duckdb_get_map_value mapVal 0
-                    c_duckdb_get_int32 valHandle >>= (@?= 99)
-                    destroyDuckValue valHandle
-        destroyDuckValue keyValue
-        destroyDuckValue valValue
-        destroyLogicalType mapLogical
-        destroyLogicalType keyType
-        destroyLogicalType valType
+    -- Map value
+    keyType <- c_duckdb_create_logical_type (DuckDBTypeAlias DuckDBTypeVarchar)
+    valType <- c_duckdb_create_logical_type (DuckDBTypeAlias DuckDBTypeInteger)
+    mapLogical <- c_duckdb_create_map_type keyType valType
+    keyValue <- withConstCString "key" c_duckdb_create_varchar
+    valValue <- c_duckdb_create_int32 99
+    withArray [keyValue] \keyArray ->
+      withArray [valValue] \valArray -> do
+        let entryCount = fromIntegral (1 :: Int) :: DuckDBIdx
+        withDuckValue (c_duckdb_create_map_value mapLogical keyArray valArray entryCount) \mapVal -> do
+          c_duckdb_get_map_size mapVal >>= (@?= 1)
+          keyHandle <- c_duckdb_get_map_key mapVal 0
+          keyStrPtr <- c_duckdb_get_varchar keyHandle
+          peekCString (coerce keyStrPtr) >>= (@?= "key")
+          c_duckdb_free (coerce keyStrPtr)
+          destroyDuckValue keyHandle
+          valHandle <- c_duckdb_get_map_value mapVal 0
+          c_duckdb_get_int32 valHandle >>= (@?= 99)
+          destroyDuckValue valHandle
+    destroyDuckValue keyValue
+    destroyDuckValue valValue
+    destroyLogicalType mapLogical
+    destroyLogicalType keyType
+    destroyLogicalType valType
 
-        -- Struct value
-        structInt <- c_duckdb_create_logical_type DuckDBTypeInteger
-        structText <- c_duckdb_create_logical_type DuckDBTypeVarchar
-        structLogical <-
-            withMany withCString ["id", "name"] \namePtrs ->
-                withArray [structInt, structText] \typeArray ->
-                    withArray namePtrs \nameArray ->
-                        c_duckdb_create_struct_type typeArray nameArray 2
-        withDuckValue (c_duckdb_create_int32 1) \idVal ->
-            withDuckValue (withCString "Alice" c_duckdb_create_varchar) \nameVal ->
-                withArray [idVal, nameVal] \structValues ->
-                    withDuckValue (c_duckdb_create_struct_value structLogical structValues) \structVal -> do
-                        child <- c_duckdb_get_struct_child structVal 1
-                        namePtr <- c_duckdb_get_varchar child
-                        peekCString namePtr >>= (@?= "Alice")
-                        c_duckdb_free (castPtr namePtr)
-                        destroyDuckValue child
-        destroyLogicalType structLogical
-        destroyLogicalType structInt
-        destroyLogicalType structText
+    -- Struct value
+    structInt <- c_duckdb_create_logical_type (DuckDBTypeAlias DuckDBTypeInteger)
+    structText <- c_duckdb_create_logical_type (DuckDBTypeAlias DuckDBTypeVarchar)
+    structLogical <-
+      withMany withConstCString ["id", "name"] \namePtrs ->
+        withArray [structInt, structText] \typeArray ->
+          withArray namePtrs \nameArray ->
+            c_duckdb_create_struct_type typeArray nameArray 2
+    withDuckValue (c_duckdb_create_int32 1) \idVal ->
+      withDuckValue (withConstCString "Alice" c_duckdb_create_varchar) \nameVal ->
+        withArray [idVal, nameVal] \structValues ->
+          withDuckValue (c_duckdb_create_struct_value structLogical structValues) \structVal -> do
+            child <- c_duckdb_get_struct_child structVal 1
+            namePtr <- c_duckdb_get_varchar child
+            peekCString (coerce namePtr) >>= (@?= "Alice")
+            c_duckdb_free (coerce namePtr)
+            destroyDuckValue child
+    destroyLogicalType structLogical
+    destroyLogicalType structInt
+    destroyLogicalType structText
 
-        -- Enum value
-        enumLogical <-
-            withMany withCString ["Red", "Green", "Blue"] \namePtrs ->
-                withArray namePtrs (`c_duckdb_create_enum_type` 3)
-        withDuckValue (c_duckdb_create_enum_value enumLogical 1) (c_duckdb_get_enum_value >=> (@?= 1))
-        destroyLogicalType enumLogical
+    -- Enum value
+    enumLogical <-
+      withMany withConstCString ["Red", "Green", "Blue"] \namePtrs ->
+        withArray namePtrs (`c_duckdb_create_enum_type` 3)
+    withDuckValue (c_duckdb_create_enum_value enumLogical 1) (c_duckdb_get_enum_value >=> (@?= 1))
+    destroyLogicalType enumLogical
 
-        -- Union value
-        unionInt <- c_duckdb_create_logical_type DuckDBTypeInteger
-        unionText <- c_duckdb_create_logical_type DuckDBTypeVarchar
-        unionLogical <-
-            withMany withCString ["int_member", "text_member"] \namePtrs ->
-                withArray [unionInt, unionText] \typeArray ->
-                    withArray namePtrs \nameArray ->
-                        c_duckdb_create_union_type typeArray nameArray 2
-        withDuckValue (c_duckdb_create_int32 42) \unionPayload ->
-            withDuckValue (c_duckdb_create_union_value unionLogical 0 unionPayload) \unionVal -> do
-                strPtr <- c_duckdb_value_to_string unionVal
-                peekCString strPtr >>= (@?= "union_value(int_member := 42)")
-                c_duckdb_free (castPtr strPtr)
-        destroyLogicalType unionLogical
-        destroyLogicalType unionInt
-        destroyLogicalType unionText
+    -- Union value
+    unionInt <- c_duckdb_create_logical_type (DuckDBTypeAlias DuckDBTypeInteger)
+    unionText <- c_duckdb_create_logical_type (DuckDBTypeAlias DuckDBTypeVarchar)
+    unionLogical <-
+      withMany withConstCString ["int_member", "text_member"] \namePtrs ->
+        withArray [unionInt, unionText] \typeArray ->
+          withArray namePtrs \nameArray ->
+            c_duckdb_create_union_type typeArray nameArray 2
+    withDuckValue (c_duckdb_create_int32 42) \unionPayload ->
+      withDuckValue (c_duckdb_create_union_value unionLogical 0 unionPayload) \unionVal -> do
+        strPtr <- c_duckdb_value_to_string unionVal
+        peekCString (coerce strPtr) >>= (@?= "union_value(int_member := 42)::UNION(int_member INTEGER, text_member VARCHAR)")
+        c_duckdb_free (coerce strPtr)
+    destroyLogicalType unionLogical
+    destroyLogicalType unionInt
+    destroyLogicalType unionText
diff --git a/test/VectorTest.hs b/test/VectorTest.hs
--- a/test/VectorTest.hs
+++ b/test/VectorTest.hs
@@ -1,188 +1,192 @@
 {-# LANGUAGE BlockArguments #-}
+{-# LANGUAGE DataKinds #-}
+{-# LANGUAGE DuplicateRecordFields #-}
+{-# LANGUAGE TypeApplications #-}
 
 module VectorTest (tests) where
 
 import Control.Monad (forM_, void, (>=>))
 import Data.Bits (setBit)
+import Data.Coerce (coerce)
 import Data.Int (Int32)
 import Data.Word (Word64)
 import Database.DuckDB.FFI
-import Foreign.C.String (withCString)
-import Foreign.Marshal.Array (allocaArray, withArray)
-import Foreign.Ptr (Ptr, castPtr, nullPtr, plusPtr)
-import Foreign.Storable (peek, peekElemOff, poke, pokeElemOff, sizeOf)
+import Foreign.Marshal.Array (advancePtr, allocaArray, withArray)
+import Foreign.Ptr (Ptr, nullPtr)
+import Foreign.Storable (peek, peekElemOff, poke, pokeElemOff)
+import GHC.Records (getField)
 import Test.Tasty (TestTree, testGroup)
 import Test.Tasty.HUnit (assertBool, testCase, (@?=))
-import Utils (clearValidityBit, setAllValid, withLogicalType, withSelectionVector, withValue, withVectorOfType)
+import Utils (clearValidityBit, setAllValid, withConstCString, withLogicalType, withSelectionVector, withValue, withVectorOfType)
 
 -- | Entry point for vector-centric tests.
 tests :: TestTree
 tests =
-    testGroup
-        "Vector Interface"
-        [ vectorDataAccess
-        , vectorValidityMask
-        , listVectorChildManagement
-        , arrayVectorChildAccess
-        , vectorSliceWithSelection
-        , structVectorChildAccess
-        , vectorReferenceValue
-        ]
+  testGroup
+    "Vector Interface"
+    [ vectorDataAccess
+    , vectorValidityMask
+    , listVectorChildManagement
+    , arrayVectorChildAccess
+    , vectorSliceWithSelection
+    , structVectorChildAccess
+    , vectorReferenceValue
+    ]
 
 -- | Create a numeric vector, write elements, and observe the stored values.
 vectorDataAccess :: TestTree
 vectorDataAccess =
-    testCase "write and read integer vector data" $ do
-        withLogicalType (c_duckdb_create_logical_type DuckDBTypeInteger) \intType ->
-            withVectorOfType intType 4 \vec -> do
-                colType <- c_duckdb_vector_get_column_type vec
-                withLogicalType (pure colType) (c_duckdb_get_type_id >=> (@?= DuckDBTypeInteger))
+  testCase "write and read integer vector data" $ do
+    withLogicalType (c_duckdb_create_logical_type (DuckDBTypeAlias DuckDBTypeInteger)) \intType ->
+      withVectorOfType intType 4 \vec -> do
+        colType <- c_duckdb_vector_get_column_type vec
+        withLogicalType (pure colType) ((fmap (getField @"unwrap") . c_duckdb_get_type_id) >=> (@?= DuckDBTypeInteger))
 
-                rawPtr <- c_duckdb_vector_get_data vec
-                let dataPtr = castPtr rawPtr :: Ptr Int32
-                forM_ (zip [0 ..] [10, 20, 30, 40]) \(idx, val) -> poke (dataPtr `plusElem` idx) val
+        rawPtr <- c_duckdb_vector_get_data vec
+        let dataPtr = coerce rawPtr :: Ptr Int32
+        forM_ (zip [0 ..] [10, 20, 30, 40]) \(idx, val) -> poke (dataPtr `plusElem` idx) val
 
-                forM_ (zip [0 ..] [10, 20, 30, 40]) \(idx, val) -> peek (dataPtr `plusElem` idx) >>= (@?= val)
+        forM_ (zip [0 ..] [10, 20, 30, 40]) \(idx, val) -> peek (dataPtr `plusElem` idx) >>= (@?= val)
 
 -- | Ensure validity mask allocation and manipulate individual bits.
 vectorValidityMask :: TestTree
 vectorValidityMask =
-    testCase "ensure validity mask and clear single entry" $ do
-        withLogicalType (c_duckdb_create_logical_type DuckDBTypeInteger) \intType ->
-            withVectorOfType intType 4 \vec -> do
-                void (c_duckdb_vector_ensure_validity_writable vec)
-                validity <- c_duckdb_vector_get_validity vec
-                assertBool "validity mask should exist" (validity /= nullPtr)
+  testCase "ensure validity mask and clear single entry" $ do
+    withLogicalType (c_duckdb_create_logical_type (DuckDBTypeAlias DuckDBTypeInteger)) \intType ->
+      withVectorOfType intType 4 \vec -> do
+        void (c_duckdb_vector_ensure_validity_writable vec)
+        validity <- c_duckdb_vector_get_validity vec
+        assertBool "validity mask should exist" (validity /= nullPtr)
 
-                setAllValid validity 4
-                clearValidityBit validity 2
+        setAllValid validity 4
+        clearValidityBit validity 2
 
-                current <- peek validity
-                let expected = foldl setBit (0 :: Word64) [0, 1, 3]
-                current @?= expected
+        current <- peek validity
+        let expected = foldl setBit (0 :: Word64) [0, 1, 3]
+        current @?= expected
 
 -- | Exercise list vector child management APIs.
 listVectorChildManagement :: TestTree
 listVectorChildManagement =
-    testCase "list vector reserves space and reports size" $ do
-        withLogicalType (c_duckdb_create_logical_type DuckDBTypeInteger) \intType ->
-            withLogicalType (c_duckdb_create_list_type intType) \listType ->
-                withVectorOfType listType 2 \listVec -> do
-                    childVec0 <- c_duckdb_list_vector_get_child listVec
-                    assertBool "list child vector should be non-null" (childVec0 /= nullPtr)
-                    initialSize <- c_duckdb_list_vector_get_size listVec
-                    initialSize @?= 0
+  testCase "list vector reserves space and reports size" $ do
+    withLogicalType (c_duckdb_create_logical_type (DuckDBTypeAlias DuckDBTypeInteger)) \intType ->
+      withLogicalType (c_duckdb_create_list_type intType) \listType ->
+        withVectorOfType listType 2 \listVec -> do
+          childVec0 <- c_duckdb_list_vector_get_child listVec
+          assertBool "list child vector should be non-null" (childVec0 /= coerce nullPtr)
+          initialSize <- c_duckdb_list_vector_get_size listVec
+          initialSize @?= 0
 
-                    reserveState <- c_duckdb_list_vector_reserve listVec 5
-                    reserveState @?= DuckDBSuccess
-                    sizeState <- c_duckdb_list_vector_set_size listVec 5
-                    sizeState @?= DuckDBSuccess
-                    c_duckdb_list_vector_get_size listVec >>= (@?= 5)
+          reserveState <- c_duckdb_list_vector_reserve listVec 5
+          reserveState @?= DuckDBSuccess
+          sizeState <- c_duckdb_list_vector_set_size listVec 5
+          sizeState @?= DuckDBSuccess
+          c_duckdb_list_vector_get_size listVec >>= (@?= 5)
 
-                    childVec <- c_duckdb_list_vector_get_child listVec
-                    metaRaw <- c_duckdb_vector_get_data listVec
-                    let metaEntries = castPtr metaRaw :: Ptr DuckDBListEntry
-                    -- row 0 -> offset 0 length 3, row 1 -> offset 3 length 2
-                    pokeElemOff metaEntries 0 (DuckDBListEntry 0 3)
-                    pokeElemOff metaEntries 1 (DuckDBListEntry 3 2)
+          childVec <- c_duckdb_list_vector_get_child listVec
+          metaRaw <- c_duckdb_vector_get_data listVec
+          let metaEntries = coerce metaRaw :: Ptr DuckDBListEntry
+          -- row 0 -> offset 0 length 3, row 1 -> offset 3 length 2
+          pokeElemOff metaEntries 0 (DuckDBListEntry 0 3)
+          pokeElemOff metaEntries 1 (DuckDBListEntry 3 2)
 
-                    childRaw <- c_duckdb_vector_get_data childVec
-                    let childInts = castPtr childRaw :: Ptr Int32
-                        payload = [11, 12, 13, 21, 22 :: Int32]
-                    forM_ (zip [0 ..] payload) (uncurry (pokeElemOff childInts))
-                    fetched <- mapM (peekElemOff childInts) [0 .. length payload - 1]
-                    fetched @?= payload
+          childRaw <- c_duckdb_vector_get_data childVec
+          let childInts = coerce childRaw :: Ptr Int32
+              payload = [11, 12, 13, 21, 22 :: Int32]
+          forM_ (zip [0 ..] payload) (uncurry (pokeElemOff childInts))
+          fetched <- mapM (peekElemOff childInts) [0 .. length payload - 1]
+          fetched @?= payload
 
-                    peekElemOff metaEntries 0 >>= (@?= DuckDBListEntry 0 3)
-                    peekElemOff metaEntries 1 >>= (@?= DuckDBListEntry 3 2)
+          peekElemOff metaEntries 0 >>= (@?= DuckDBListEntry 0 3)
+          peekElemOff metaEntries 1 >>= (@?= DuckDBListEntry 3 2)
 
 -- | Verify array child vector exposes a flat buffer sized by row * array length.
 arrayVectorChildAccess :: TestTree
 arrayVectorChildAccess =
-    testCase "array vector child flattens elements" $ do
-        withLogicalType (c_duckdb_create_logical_type DuckDBTypeInteger) \intType ->
-            withLogicalType (c_duckdb_create_array_type intType 3) \arrayType ->
-                withVectorOfType arrayType 2 \arrayVec -> do
-                    childVec <- c_duckdb_array_vector_get_child arrayVec
-                    childType <- c_duckdb_vector_get_column_type childVec
-                    withLogicalType (pure childType) (c_duckdb_get_type_id >=> (@?= DuckDBTypeInteger))
+  testCase "array vector child flattens elements" $ do
+    withLogicalType (c_duckdb_create_logical_type (DuckDBTypeAlias DuckDBTypeInteger)) \intType ->
+      withLogicalType (c_duckdb_create_array_type intType 3) \arrayType ->
+        withVectorOfType arrayType 2 \arrayVec -> do
+          childVec <- c_duckdb_array_vector_get_child arrayVec
+          childType <- c_duckdb_vector_get_column_type childVec
+          withLogicalType (pure childType) ((fmap (getField @"unwrap") . c_duckdb_get_type_id) >=> (@?= DuckDBTypeInteger))
 
-                    childRaw <- c_duckdb_vector_get_data childVec
-                    let childInts = castPtr childRaw :: Ptr Int32
-                        payload = [1, 2, 3, 4, 5, 6 :: Int32]
-                    forM_ (zip [0 ..] payload) (uncurry (pokeElemOff childInts))
-                    mapM (peekElemOff childInts) [0 .. length payload - 1] >>= (@?= payload)
+          childRaw <- c_duckdb_vector_get_data childVec
+          let childInts = coerce childRaw :: Ptr Int32
+              payload = [1, 2, 3, 4, 5, 6 :: Int32]
+          forM_ (zip [0 ..] payload) (uncurry (pokeElemOff childInts))
+          mapM (peekElemOff childInts) [0 .. length payload - 1] >>= (@?= payload)
 
 -- | Slice a vector with a selection vector and materialize the dictionary.
 vectorSliceWithSelection :: TestTree
 vectorSliceWithSelection =
-    testCase "slice vector materializes dictionary order" $ do
-        withLogicalType (c_duckdb_create_logical_type DuckDBTypeInteger) \intType ->
-            withVectorOfType intType 4 \vec -> do
-                dataRaw <- c_duckdb_vector_get_data vec
-                let vecData = castPtr dataRaw :: Ptr Int32
-                forM_ (zip [0 ..] [10, 20, 30, 40 :: Int32]) (uncurry (pokeElemOff vecData))
+  testCase "slice vector materializes dictionary order" $ do
+    withLogicalType (c_duckdb_create_logical_type (DuckDBTypeAlias DuckDBTypeInteger)) \intType ->
+      withVectorOfType intType 4 \vec -> do
+        dataRaw <- c_duckdb_vector_get_data vec
+        let vecData = coerce dataRaw :: Ptr Int32
+        forM_ (zip [0 ..] [10, 20, 30, 40 :: Int32]) (uncurry (pokeElemOff vecData))
 
-                withSelectionVector 2 \sel -> do
-                    selPtr <- c_duckdb_selection_vector_get_data_ptr sel
-                    pokeElemOff selPtr 0 (fromIntegral (3 :: Int))
-                    pokeElemOff selPtr 1 (fromIntegral (1 :: Int))
-                    c_duckdb_slice_vector vec sel 2
+        withSelectionVector 2 \sel -> do
+          selPtr <- c_duckdb_selection_vector_get_data_ptr sel
+          pokeElemOff selPtr 0 (fromIntegral (3 :: Int))
+          pokeElemOff selPtr 1 (fromIntegral (1 :: Int))
+          c_duckdb_slice_vector vec sel 2
 
-                    withVectorOfType intType 2 \materialized ->
-                        withSelectionVector 2 \copySel -> do
-                            copyPtr <- c_duckdb_selection_vector_get_data_ptr copySel
-                            pokeElemOff copyPtr 0 0
-                            pokeElemOff copyPtr 1 1
-                            c_duckdb_vector_copy_sel vec materialized copySel 2 0 0
-                            matRaw <- c_duckdb_vector_get_data materialized
-                            let matPtr = castPtr matRaw :: Ptr Int32
-                            mapM (peekElemOff matPtr) [0, 1] >>= (@?= [40, 20])
+          withVectorOfType intType 2 \materialized ->
+            withSelectionVector 2 \copySel -> do
+              copyPtr <- c_duckdb_selection_vector_get_data_ptr copySel
+              pokeElemOff copyPtr 0 0
+              pokeElemOff copyPtr 1 1
+              c_duckdb_vector_copy_sel vec materialized copySel 2 0 0
+              matRaw <- c_duckdb_vector_get_data materialized
+              let matPtr = coerce matRaw :: Ptr Int32
+              mapM (peekElemOff matPtr) [0, 1] >>= (@?= [40, 20])
 
 -- | Ensure struct vectors expose individual child vectors with matching types.
 structVectorChildAccess :: TestTree
 structVectorChildAccess =
-    testCase "struct vector exposes typed child vectors" $ do
-        withLogicalType (c_duckdb_create_logical_type DuckDBTypeInteger) \intType ->
-            withLogicalType (c_duckdb_create_logical_type DuckDBTypeDouble) \doubleType ->
-                allocaArray 2 \typesPtr -> do
-                    pokeElemOff typesPtr 0 intType
-                    pokeElemOff typesPtr 1 doubleType
-                    withCString "ints" \name0 ->
-                        withCString "doubles" \name1 ->
-                            withArray [name0, name1] \namesPtr ->
-                                withLogicalType (c_duckdb_create_struct_type typesPtr namesPtr 2) \structType ->
-                                    withVectorOfType structType 1 \structVec -> do
-                                        intChild <- c_duckdb_struct_vector_get_child structVec 0
-                                        dblChild <- c_duckdb_struct_vector_get_child structVec 1
+  testCase "struct vector exposes typed child vectors" $ do
+    withLogicalType (c_duckdb_create_logical_type (DuckDBTypeAlias DuckDBTypeInteger)) \intType ->
+      withLogicalType (c_duckdb_create_logical_type (DuckDBTypeAlias DuckDBTypeDouble)) \doubleType ->
+        allocaArray 2 \typesPtr -> do
+          pokeElemOff typesPtr 0 intType
+          pokeElemOff typesPtr 1 doubleType
+          withConstCString "ints" \name0 ->
+            withConstCString "doubles" \name1 ->
+              withArray [name0, name1] \namesPtr ->
+                withLogicalType (c_duckdb_create_struct_type typesPtr namesPtr 2) \structType ->
+                  withVectorOfType structType 1 \structVec -> do
+                    intChild <- c_duckdb_struct_vector_get_child structVec 0
+                    dblChild <- c_duckdb_struct_vector_get_child structVec 1
 
-                                        intChildType <- c_duckdb_vector_get_column_type intChild
-                                        withLogicalType (pure intChildType) (c_duckdb_get_type_id >=> (@?= DuckDBTypeInteger))
-                                        dblChildType <- c_duckdb_vector_get_column_type dblChild
-                                        withLogicalType (pure dblChildType) (c_duckdb_get_type_id >=> (@?= DuckDBTypeDouble))
+                    intChildType <- c_duckdb_vector_get_column_type intChild
+                    withLogicalType (pure intChildType) ((fmap (getField @"unwrap") . c_duckdb_get_type_id) >=> (@?= DuckDBTypeInteger))
+                    dblChildType <- c_duckdb_vector_get_column_type dblChild
+                    withLogicalType (pure dblChildType) ((fmap (getField @"unwrap") . c_duckdb_get_type_id) >=> (@?= DuckDBTypeDouble))
 
-                                        intRaw <- c_duckdb_vector_get_data intChild
-                                        dblRaw <- c_duckdb_vector_get_data dblChild
-                                        let intPtr = castPtr intRaw :: Ptr Int32
-                                            dblPtr = castPtr dblRaw :: Ptr Double
-                                        pokeElemOff intPtr 0 7
-                                        pokeElemOff dblPtr 0 3.5
-                                        peekElemOff intPtr 0 >>= (@?= 7)
-                                        peekElemOff dblPtr 0 >>= (@?= 3.5)
+                    intRaw <- c_duckdb_vector_get_data intChild
+                    dblRaw <- c_duckdb_vector_get_data dblChild
+                    let intPtr = coerce intRaw :: Ptr Int32
+                        dblPtr = coerce dblRaw :: Ptr Double
+                    pokeElemOff intPtr 0 7
+                    pokeElemOff dblPtr 0 3.5
+                    peekElemOff intPtr 0 >>= (@?= 7)
+                    peekElemOff dblPtr 0 >>= (@?= 3.5)
 
 -- | Copy a scalar duckdb_value into a vector without materializing a chunk.
 vectorReferenceValue :: TestTree
 vectorReferenceValue =
-    testCase "vector_reference_value writes scalar contents" $ do
-        withLogicalType (c_duckdb_create_logical_type DuckDBTypeInteger) \intType ->
-            withVectorOfType intType 1 \vec ->
-                withValue (c_duckdb_create_int32 123) \value -> do
-                    c_duckdb_vector_reference_value vec value
-                    raw <- c_duckdb_vector_get_data vec
-                    let dataPtr = castPtr raw :: Ptr Int32
-                    peekElemOff dataPtr 0 >>= (@?= 123)
+  testCase "vector_reference_value writes scalar contents" $ do
+    withLogicalType (c_duckdb_create_logical_type (DuckDBTypeAlias DuckDBTypeInteger)) \intType ->
+      withVectorOfType intType 1 \vec ->
+        withValue (c_duckdb_create_int32 123) \value -> do
+          c_duckdb_vector_reference_value vec value
+          raw <- c_duckdb_vector_get_data vec
+          let dataPtr = coerce raw :: Ptr Int32
+          peekElemOff dataPtr 0 >>= (@?= 123)
 
 -- helpers -------------------------------------------------------------------
 
 plusElem :: Ptr Int32 -> Int -> Ptr Int32
-plusElem base idx = base `plusPtr` (idx * sizeOf (undefined :: Int32))
+plusElem = advancePtr
diff --git a/vendor/duckdb-api.json b/vendor/duckdb-api.json
new file mode 100644
--- /dev/null
+++ b/vendor/duckdb-api.json
@@ -0,0 +1,9 @@
+{
+  "commit": "d54cbbe3df17e8e5ce68312f483b4155836112aa",
+  "ref": "v2.0.0",
+  "repository": "https://github.com/duckdb/duckdb",
+  "source_archive": {
+    "sha256": "93e3d1f9c84b6ec3493237d21565c01c2c19b9862e54e5552d3d7999ccc3bbb4",
+    "url": "https://codeload.github.com/duckdb/duckdb/tar.gz/d54cbbe3df17e8e5ce68312f483b4155836112aa"
+  }
+}
diff --git a/vendor/upstream.sha256 b/vendor/upstream.sha256
new file mode 100644
--- /dev/null
+++ b/vendor/upstream.sha256
@@ -0,0 +1,4 @@
+8dbc9c71a10f0a75fcacc1a3f4f7c76093a84d232fc152222ee5b6e512ab4560  cbits/duckdb.h
+73026a28e5b55952afb6e2e9ce80fd4f76614afedce329da895ccaf85a4a8be6  cbits/duckdb_v2.h
+fa0871d3f5b8e5da9a686c019fcaf8210349440831d5e9228720cbba31ccaa51  cbits/duckdb_extension_v2.h
+075c33400ffcb0c586dd106a029d3e733e9da3693f8fcb9cebfc651c8a2f14e3  cbits/duckdb-LICENSE
