NAME
DBIO::DuckDB::Test::Conformance - Answers the shared conformance case table for the DuckDB driver
VERSION
version 0.900007
SYNOPSIS
use DBIO::DuckDB::Test::Conformance;
DBIO::DuckDB::Test::Conformance->run('DDL');
done_testing;
DESCRIPTION
The driver's half of the shared case table of DBIO::Test::Conformance (core ADR 0060). Core owns the cases and the runner; this class says how to reach an in-memory DuckDB database, how to install a declaration into it through DBIO::DuckDB::Deploy, and how to read a fact back through DBIO::DuckDB::Introspect.
DuckDB runs in the process and needs no server and no gate: every case runs in a plain prove. Each case gets a connection -- and with it a database -- of its own, so the default "conformance_namespace" in DBIO::Test::Conformance is enough.
The class names no storage class and never decides the driver: the schema component and the DSN do (see "conformance_connect").
METHODS
conformance_live_available
True when DBD::DuckDB loads. There is nothing else to gate on.
conformance_connect
Loads the DuckDB schema component into the case's schema class and connects to a private in-memory database.
conformance_install
Installs the declaration with $schema->deploy, the public entry point, which hands over to "install" in DBIO::DuckDB::Deploy.
conformance_cleanup
Disconnects. The database was in memory and goes with the connection. The schema "conformance_upgrade" returns is left to the runner, which closes the schema it shares the handle with: DBD::DuckDB 0.16 segfaults on a second disconnect of one handle.
conformance_diff_is_empty
True when "diff" in DBIO::DuckDB::Deploy of the installed database against the same declaration has no changes.
conformance_upgrade
Connects the target schema class to the handle of the installed one, since a :memory: database is its connection, and runs "upgrade" in DBIO::DuckDB::Deploy -- the public entry point -- through it, with allow_destructive => 1: the cases of the table are about what the diff does (a dropped column, a dropped view, a changed type), the guard that holds a destructive diff back has its own cases (diff-deploy-destructive-guard, run through "conformance_deploy"). A refusal of the diff is thrown from here as it came.
conformance_deploy
The deploy object over the target schema, for the deploy cases of the Diff list (table version 4): the target class is connected to the handle of the installed schema exactly as "conformance_upgrade" connects it. Returns DBIO::DuckDB::Deploy->new(schema => $to); the runner calls apply and upgrade on it, and both are those of DBIO::Deploy::Base.
conformance_name_kinds
{ extension => 1, library => 1 }: the names the driver writes into a statement are the names of the extensions it INSTALLs and LOADs ("_activate_extensions" in DBIO::DuckDB::Storage). DuckDB's extension and the library it loads are one name, so both kinds run through the same statements. There is no schema: the connect key schema has no meaning for this driver and is refused by core (DBIO::DuckDB::Storage does not implement _set_connection_schema), so the driver writes no namespace name from it.
conformance_apply_name
my $shown = $class->conformance_apply_name($kind, $name);
Hands the name to the storage the way a declaration does -- extension through "duckdb_extensions" in DBIO::DuckDB and the activation of the declared list, library through an activation that loads it -- and takes the statements "_extension_activation_sql" in DBIO::DuckDB::Storage writes for it. A name the driver refuses throws its DBIO::Exception from here. For a name it accepts, the answer is the name as the LOAD statement carries it. The server is not asked: DuckDB has no extension of a made-up name, so an INSTALL of it would end in a server error, not in an answer about the name; what the case checks is what the driver puts into the statement.
conformance_answered_through
The table versions the answers were written against, per area: { DDL => 2, Diff => 4, Bind => 1 } (version 2 of the Diff list splits U13 into diff-constraint-changed, which runs, and diff-fk-action-changed). The Bind list needs no declaration: every one of its eleven cases is answered.
Version 3 of the Diff list replaces diff-column-dropped-with-index by diff-indexed-column-dropped; it runs.
Version 4 of the Diff list adds the deploy cases (diff-deploy-*): they run through "conformance_deploy", which hands the runner the DBIO::DuckDB::Deploy object, so apply and upgrade are the base class's.
conformance_refusals
Five refusals and four deviations. Nothing is pending.
diff-indexed-column-dropped, diff-fk-dropped and diff-fk-added-to-new-unique run: DuckDB cannot drop a column while an index or a UNIQUE constraint stands on a later column ("an index depends on a column after it"), cannot drop a constraint and has no ALTER TABLE ... ADD / DROP FOREIGN KEY (https://duckdb.org/docs/stable/sql/statements/alter_table), so the diff rebuilds the table (DBIO::DuckDB::Diff::Rebuild): a new table, the rows copied, the old one dropped, the new one renamed, the indexes made again. In diff-fk-added-to-new-unique the parent is rebuilt as well, since DuckDB takes a foreign key to a UNIQUE constraint and not to a unique index.
ddl-fk-actions, diff-table-added-complete and diff-fk-action-changed declare ON DELETE CASCADE. DuckDB enforces foreign keys but takes RESTRICT and NO ACTION only: its parser refuses CASCADE, SET NULL and SET DEFAULT ("FOREIGN KEY constraints cannot use CASCADE, SET NULL or SET DEFAULT"; https://duckdb.org/docs/stable/sql/constraints#foreign-keys). DBIO::DuckDB::DDL refuses them first, naming table and column, before any statement (maintainer decision 2026-10-25).
The deviations are of one kind: DuckDB parses a length it then drops.
diff-column-added-not-null-populated and diff-not-null-over-nulls: DuckDB cannot give the rows a table holds a value for a new NOT NULL column (ADD COLUMN ... NOT NULL is not supported at all, https://duckdb.org/docs/stable/sql/statements/alter_table), nor accept SET NOT NULL over a NULL. "_check_before_apply" in DBIO::DuckDB::Deploy refuses both before the first statement, naming table and column (maintainer decision 2026-10-25).
diff-column-type-change: the type change and the rows are right; the VARCHAR(20) it ends in reads back without its length, as in ddl-type-size-char.
ddl-type-size-char: VARCHAR(10) is accepted, but the length has no effect -- DuckDB stores the value whole, never truncates it, and shows the column back as plain VARCHAR with no length (https://duckdb.org/docs/stable/sql/data_types/text). The driver adds no CHECK to enforce it, so the case is declared a deviation. The fact is the runner's own failure text for the accepted row, so a different wrong answer is not hidden behind it.
ddl-type-size-bit: BIT is DuckDB's variable-length bitstring (https://duckdb.org/docs/stable/sql/data_types/bitstring); a declared width is parsed and not kept, so introspection shows no size.
conformance_fact
Reads one fact through DBIO::DuckDB::Introspect; the vocabulary is the one of "Facts" in DBIO::Test::Conformance. DuckDB has namespaces (schemas), and the cases declare a table in one only through a qualified name; table_in_namespace asks the catalog.
SEE ALSO
DBIO::Test::Conformance - the runner and the contract of the seams
DBIO::Test::Conformance::Cases::DDL - the DDL case list
DBIO::DuckDB::Deploy - install and diff, as the cases reach them
DBIO::DuckDB::Introspect - what the facts are read through
AUTHOR
DBIO Authors
COPYRIGHT AND LICENSE
Copyright (C) 2026 DBIO Authors
This is free software; you can redistribute it and/or modify it under the same terms as the Perl 5 programming language system itself.