Installs into .claude/skills of the current project.
Sponsors
SSkills DirectorySkills Directory
Know which skills are safe — weekly.
SSkills DirectorySkills Directory
Is that skill safe to install?
Are you the author of Duckdb Knowledge Patch?
Add the live security badge to your README. It updates with every re-scan.
[](https://www.skillsdirectory.com/skills/nevaberry-duckdb-knowledge-patch)
---
name: duckdb-knowledge-patch
description: DuckDB
version: "2.0.1"
license: MIT
metadata:
author: Nevaberry
---
# DuckDB compatibility guidance
Load this skill when migrating DuckDB applications or working with its SQL,
CLI, database files, extensions, spatial data, and external catalogs.
Use the quick reference below for migration decisions and the topic files
for complete guidance and examples.
## Reference index
| Reference | Topics |
| --- | --- |
| [Compatibility and migrations](references/compatibility-and-migrations.md) | Data correctness fixes, lambdas, SQL behavior, file compatibility, ICU, support dates |
| [CLI and platforms](references/cli-and-platforms.md) | Installation, interactive results, CLI modes, parsers, extension APIs, builds, GPU execution |
| [Lakehouses and connectors](references/lakehouses-and-connectors.md) | Iceberg, DuckLake, Delta, Glue, PostgreSQL, ODBC, Azure, Vortex |
| [Spatial and geometry](references/spatial-and-geometry.md) | Core geometry, CRS-aware columns, spatial axis order |
| [SQL and types](references/sql-and-types.md) | VARIANT, struct fields, nested schemas, triggers, CTEs, joins, grouping, JSON mutation |
| [Storage, security, and remote files](references/storage-security-and-remote-files.md) | Storage versions, attachment, encryption, compression, caches, secrets, repository trust, Quack |
## Data correctness and migration priorities
Use 2.0.1 when querying databases written by 1.x. DuckDB 2.0.0 could omit
rows with `NULL` values during filtering; 2.0.1 also fixes compatibility
issues with stored views and macros.
DuckDB 2.0.1 changes its bundled allocator to prevent silent data loss on
affected Linux kernels. If you need to stay on an earlier version that uses
the bundled allocator, apply the same setting when launching DuckDB:
```sh
DUCKDB_JE_MALLOC_CONF=muzzy_decay_ms:0 duckdb
```
When a target row matches multiple source rows in `MERGE` or
`UPDATE ... FROM`, 2.0.1 updates it once per match. This restores the 1.x
behavior after the change in 2.0.0.
## Deprecations and changed defaults
The 2.0 default disables single-arrow lambdas. The old syntax and its
opt-in setting are scheduled for removal in 2.1. In 1.5.0, arrow lambdas
under the default `lambda_syntax` setting emit a deprecation warning;
`SET lambda_syntax = 'ENABLE_SINGLE_ARROW';` suppresses that warning.
The single-header, single-source amalgamation build is deprecated in 2.0.
DuckDB and core extensions support `osx_amd64` in 2.0; community builds
are available on a best-effort basis. DuckDB 2.1 will drop this platform.
The `wasm_mvp` target was discontinued. Use `wasm_eh` for slim deployments
or `wasm_threads` for threads and SIMD.
Replace the removed `undecided` value of `allow_extension_repositories`.
The new default is `hosts`; the repository modes are described below.
## SQL behavior to check during migration
- From 1.2, the optional one-based `list_reduce` index refers to the
right-hand input to the lambda.
- A fixed seed produces different `random()` values in 1.2 than earlier
releases. Regenerate test outputs that assert specific values.
- In 1.5.0, `date_trunc` on a `DATE` returns a `TIMESTAMP`. Cast back to
`DATE` when a caller expects the old type.
- From 1.3, serialized list strings are quoted and escaped. For an old
unquoted representation, use `printf('[%s]', array_to_string(values_list, ', '))`.
- In 1.3, quote `"AT"` and `"LAMBDA"` as identifiers; `GRANT` is no longer reserved.
- DuckDB 1.4 materializes common table expressions by default.
The CSV reader defaults to `strict_mode = true` in 1.2, so mixed newline
styles can fail dialect detection. Use `strict_mode = false` for the
mixed-newline example in the migration reference.
Run `SET parquet_can_have_nan = true;` when reading Parquet files whose
statistics omit `NaN` values.
## Database files, compression, and local time
Files created by 2.0 require a 2.0 or later reader. DuckDB 2.0 can read
and write existing files while preserving their readability by older versions.
`ATTACH ... (STORAGE_VERSION ...)` sets the minimum DuckDB version able to
open the written file. Inspect `storage_version` in `duckdb_databases().tags`
and copy into a new file to target an older format.
`ATTACH OR REPLACE` switches the file behind an existing alias, including
the alias selected by `USE`.
Open or create an encrypted database with
`ATTACH 'encrypted.db' AS enc (ENCRYPTION_KEY 'example-key');`.
Default AES-256-GCM encryption covers the database, its write-ahead log,
and temporary files.
Checkpoint an in-memory database to reclaim space from deleted rows.
Use `ATTACH ':memory:' AS mem (COMPRESS);` and create tables in `mem`
to opt in to compression for in-memory tables.
In 1.2, `current_time`, `current_date`, `get_current_time()`, and `today()`
use the local time zone and require ICU to be loaded. The `icu` extension
now implements time zones, calendars, and collations itself and bundles
IANA time-zone data, removing the ICU library dependency.
## Secrets and extension repositories
A URL matches a host or bucket `SECRET` scope only if it equals the scope
or continues with `/`. Use the complete host or bucket name and include
any explicit port. `CREATE SECRET` accepts scalar expressions in option
values; the CLI example in the storage reference uses `getenv('MY_TOKEN')`.
Register a repository by its publisher's hostname:
```sql
CREATE EXTENSION REPOSITORY duckdb.org;
INSTALL AND LOAD spatial FROM duckdb.org;
```
DuckDB reads `/.well-known/duckdb-extension-repo.json` on that host over
verified HTTPS and follows its pointer to the repository publishing the
signing keys. `hosts` permits hostname registration; `allowed` also permits
prefix registration; `hosts_only` permits registration and trust only for
host-resolved repositories; `forbidden` disables custom repositories.
Prefix registration pins fetched RSA public keys and prints their SHA-256
fingerprints for out-of-band verification. Repository syntax may change
in a later release. The storage reference contains the prefix example.
## SQL features and parser selection
A `VARIANT` column can hold differently typed values in different rows;
nested field extraction returns another `VARIANT`. Parquet reads and
exports support shredded `VARIANT` values. Use `variant_type` for the
value kind and `variant_keys` for an object's keys.
Use `INSERT`, `UPDATE`, `DELETE`, and `COPY` as CTE steps. For a table `t(x)`:
```sql
WITH added AS (INSERT INTO t VALUES (42) RETURNING x) SELECT x FROM added;
```
Use an `AFTER` statement trigger with `REFERENCING OLD TABLE` and `NEW TABLE`
to process affected rows. Use `FOR EACH STATEMENT` for `BEFORE` and `UPDATE`
triggers in 2.0. Multiple triggers per event and `RETURNING` on tables with
triggers are supported.
Use `$name` for session variables in most expression positions, `NEAREST`
joins for top-k similarity matching, and `UNNEST` in grouping expressions
to group exploded values. `json_set`, `json_insert`, `json_replace`, and
`json_remove` return modified copies of JSON documents.
DuckDB 2.0 uses the PEG parser by default and lets extensions add SQL syntax.
Use `SET enable_legacy_parser = true;` to switch back through the
`legacy_parser` extension.
## CLI and remote sessions
Query `_` in the interactive CLI to reuse the previous query's result
without rerunning it. The pager opens automatically above 50 rows;
use Page Up/Page Down, or Fn + Up/Fn + Down on macOS, and Q to exit.
Pass a Parquet, CSV, or JSON file as the CLI's database argument to query
it through a temporary in-memory database. Views are named `file` and
after the file's basename.
The CLI detects agents and switches to agent mode. Force it with
`duckdb -agent` or disable it with `duckdb -no-agent`. It prints compact
Markdown tables, marks truncation, emits JSON errors, estimates long-query
cost before execution, and can stop runaway queries early.
Start a local Quack server with `duckdb -serve` and query its database
from another terminal with `duckdb -connect`. SQL sessions can start a
server with `quack_serve` and use `CONNECT` for an attached remote catalog,
including Quack, PostgreSQL, or MySQL. The server listens on localhost by
default; for access from other machines, use a TLS-terminating reverse proxy.
## Spatial axis order and CRS-aware types
`GEOMETRY` is a core type; the `spatial` extension provides most operations.
Declare a CRS in the column type, for example `GEOMETRY('OGC:CRS84')`.
Spatial functions enforce matching input CRSs, and loading `spatial`
registers EPSG definitions.
Set `geometry_always_xy = true` for longitude as X and latitude as Y in
`ST_Distance_Spheroid`, `ST_Perimeter_Spheroid`, `ST_Area_Spheroid`,
`ST_Distance_Sphere`, `ST_DWithin_Spheroid`, and `ST_Transform`.
Set it to `false` for latitude first in the distance, perimeter, and area
functions and CRS-defined axis order in `ST_Transform`. Leaving it unset
keeps the old behavior and emits a warning.
## External catalogs and execution
The `iceberg` extension supports creating and populating tables with
`CREATE TABLE AS SELECT` in an attached Iceberg REST catalog. Precreate
destination schemas for database-wide copies into Iceberg. Supply
`EXTRA_HTTP_HEADERS` for catalogs requiring additional HTTP headers.
`iceberg_rewrite_data_files` now uses Spark's result column names; update
callers that refer to the previous names.
The `delta` extension supports table creation, partitioning, table
properties, and time travel. The experimental `glue` extension attaches a
Glue Data Catalog and reads and writes Hive tables backed by Parquet,
CSV, JSON, or Avro on S3.
Queries touching only one attached PostgreSQL database run entirely in
PostgreSQL. To disable this behavior, set `pg_enable_remote_pushdown = false`
before attaching the database.
The `sirius` core extension runs queries on Linux x86-64 or arm64 with a
GPU and a CUDA 12 or 13 driver. First load downloads the matching backend,
about 1 GB; unsupported queries fall back to CPU execution. See the CLI
and platforms reference for the load sequence.