Skip to content

Catalog/data split: host-catalog hooks, external indexes, fork-surface reduction (v2026.07.10) - #73

Merged
pashandor789 merged 1 commit into
v2026.07.10from
mbkkt/split-catalog-data-3
Aug 29, 2026
Merged

Catalog/data split: host-catalog hooks, external indexes, fork-surface reduction (v2026.07.10)#73
pashandor789 merged 1 commit into
v2026.07.10from
mbkkt/split-catalog-data-3

Conversation

@pashandor789

Copy link
Copy Markdown

Rebased onto v2026.07.10 (supersedes #70, which targeted v2026.07.07).

Thirteen feature commits, replayed onto the current version branch. Nothing was merged in from the version branch — the work sits on top of it.

Hooks added, each replacing a hand-rolled copy in the host

  • ColumnList::TryGetColumn(Identifier) — the nullable sibling of the throwing GetColumn
  • TableCatalogEntry::IsNotNull(constraints, LogicalIndex)
  • CatalogSet::ClearLocalStorage, called from DropEntry (deliberately not DropEntryInternal, which is also the rename tombstone road where the uncommitted appends must survive)
  • CatalogEntry::CopyPreservingIdentity, used by the five Copy() arms
  • DependencyManager::Attachments + ScanDependentsEverywhere/ScanAllEdgesEverywhere — the cross-attachment dependent walk hoisted out of CheckDropDependencies, taking a catalog filter and a nullable dependent so a counting consumer can ride it. It also skips closed attachments, which the inlined loop did not.
  • LogicalDependency::automatic — lets an index→relation edge be AUTO per edge rather than per object type

Fork surface removed (these files are byte-identical to upstream again: plan_delete.cpp, plan_insert.cpp)

  • default_types.cpp: the namespace-scope BUILTIN_TYPES array restored, matching what default_views.cpp/default_functions.cpp already did correctly
  • SchemaCatalogEntry's pure virtuals restored (the throwing bodies were unreachable — DuckSchemaEntry is the only subclass)
  • EntryToString's per-kind arms dropped; the existing fallback renders byte-identical strings
  • GetStorageTableEntry/GetStorageCatalog deleted — zero overrides existed anywhere, and the defaults were upstream's own expressions, now inlined at the call sites
  • upstream wording restored in CheckTypeIsSupported

Bug fixes worth reviewing on their own

  • DuckIndexEntry::Rollback ignored its prev_entry and removed the index unconditionally, but CatalogSet::Undo calls Rollback for every rolled-back version — so rolling back a COMMENT ON INDEX dropped the table's ART. Now gated on prev_entry.deleted, matching DuckTableEntry::Rollback.
  • CommitDrop and WriteCreateIndex tolerate an index whose table has no DataTable (a view index, a search table).
  • AlterObject's disallow_alter derives from the dependent's cascade flags instead of a type-keyed exemption list, which never matched for a catalog addressing edges by a stable id.

Generated artifacts land in the stacked regen PR.

…e reduction

The hooks a host catalog needs to keep its own definitions while duckdb
runs the machinery: entry lookup and creation seams, external index
deserialization, dependency walks that survive schema-less entries and
foreign attachments, alter and drop dispatch a host can extend, and the
fork-surface reductions that came out of aligning the host with duckdb's
own roads.
@pashandor789
pashandor789 force-pushed the mbkkt/split-catalog-data-3 branch from c1a57b9 to 388aaf0 Compare August 29, 2026 22:38
@pashandor789
pashandor789 merged commit 5166587 into v2026.07.10 Aug 29, 2026
@pashandor789
pashandor789 deleted the mbkkt/split-catalog-data-3 branch August 29, 2026 23:03
pashandor789 added a commit that referenced this pull request Aug 29, 2026
…r artifacts (#76)

The generated artifacts for the catalog/data split feature PR (#73),
regenerated and formatted with the pinned clang-format 11.0.1. Replaces
#74, which was auto-closed when #73's branch was deleted.

Co-authored-by: pavel vedernikoff <pavel.ivanov@serenedb.com>
pashandor789 pushed a commit that referenced this pull request Sep 4, 2026
The catalog/data split (#73) changed several duckdb-core behaviors that CI never
exercised, because classify-changes does not select the `core` suite on a bare
submodule pin bump. Every fix here is facade-safe (verified against serenedb's own
sqllogic):

- macro dependencies: wire MacroFunction::UnionDependencies, which the split defined
  but never called, so a CREATE MACRO under enable_macro_dependencies actually records
  its body's dependencies again -- restoring the self-cycle refusal and the
  drop-of-referenced-object refusal (test_recursive_macro,
  test_macro_default_arg_with_dependencies). serenedb enables this globally and its
  DDL tests already expect the enforcement.

- CREATE OR REPLACE: a definition replace only breaks an *owning* dependent (a sequence
  its table owns), not a plain one (a view over the replaced function, which rebinds).
  Refuse just the ownership case in DependencyManager::AlterObject and report it the way
  a DROP does; SetPermissionsInfo::BreaksDependent stays false so ordinary dependents
  rebind as before (test_alter_dependency_ownership).

- COPY DATABASE: rewrite a copied entry's dependency onto the target database (catalog
  and oid, not only the outer LogicalDependency), so a copied index resolves against the
  destination rather than the source (copy_database).

- ALTER SCHEMA RENAME: reject cleanly with "Altering schemas is not yet supported"
  instead of crashing on an internal assertion (rename_schema).

Three upstream tests asserted stock-duckdb behavior that serenedb deliberately made
PG-compatible -- unknown search_path schemas accepted silently, a single-quoted string
kept as one atomic schema name (only unquoted bare names are a list), schema-only
search_path display, PG-shaped current_schemas. Update them to the serenedb behavior:
test_set_search_path, test_querying_from_detached_catalog,
peg_parser/transformer/set_statement.
pashandor789 pushed a commit that referenced this pull request Sep 4, 2026
The catalog/data split (#73) changed several duckdb-core behaviors that CI never
exercised, because classify-changes does not select the `core` suite on a bare
submodule pin bump. Every fix here is facade-safe (verified against serenedb's own
sqllogic):

- macro dependencies: wire MacroFunction::UnionDependencies, which the split defined
  but never called, so a CREATE MACRO under enable_macro_dependencies actually records
  its body's dependencies again -- restoring the self-cycle refusal and the
  drop-of-referenced-object refusal (test_recursive_macro,
  test_macro_default_arg_with_dependencies). The same union has to run when overloads
  are merged: MacroCatalogEntry::MergedWith starts from the superseded version's info,
  so recompute its top-level dependencies from the merged overload set, or a
  CREATE OR REPLACE MACRO keeps the old body's subjects and never retires them.
  serenedb enables this globally and its DDL tests already expect the enforcement.

- CREATE OR REPLACE: a definition replace only breaks an *owning* dependent (a sequence
  its table owns), not a plain one (a view over the replaced function, which rebinds).
  Refuse just the ownership case in DependencyManager::AlterObject and report it the way
  a DROP does; SetPermissionsInfo::BreaksDependent stays false so ordinary dependents
  rebind as before (test_alter_dependency_ownership).

- COPY DATABASE: rewrite a copied entry's dependency onto the target database (catalog
  and oid, not only the outer LogicalDependency), so a copied index resolves against the
  destination rather than the source (copy_database).

- ALTER SCHEMA RENAME: reject cleanly with "Altering schemas is not yet supported"
  instead of crashing on an internal assertion (rename_schema).

Three upstream tests asserted stock-duckdb behavior that serenedb deliberately made
PG-compatible -- unknown search_path schemas accepted silently, a single-quoted string
kept as one atomic schema name (only unquoted bare names are a list), schema-only
search_path display, PG-shaped current_schemas. Update them to the serenedb behavior:
test_set_search_path, test_querying_from_detached_catalog,
peg_parser/transformer/set_statement.
pashandor789 pushed a commit that referenced this pull request Sep 4, 2026
The catalog/data split (#73) changed several duckdb-core behaviors that CI never
exercised, because classify-changes does not select the `core` suite on a bare
submodule pin bump. Every fix here is facade-safe (verified against serenedb's own
sqllogic):

- macro dependencies: wire MacroFunction::UnionDependencies, which the split defined
  but never called, so a CREATE MACRO under enable_macro_dependencies actually records
  its body's dependencies again -- restoring the self-cycle refusal and the
  drop-of-referenced-object refusal (test_recursive_macro,
  test_macro_default_arg_with_dependencies). The same union has to run when overloads
  are merged: MacroCatalogEntry::MergedWith starts from the superseded version's info,
  so recompute its top-level dependencies from the merged overload set, or a
  CREATE OR REPLACE MACRO keeps the old body's subjects and never retires them.
  serenedb enables this globally and its DDL tests already expect the enforcement.

- CREATE OR REPLACE: a definition replace only breaks an *owning* dependent (a sequence
  its table owns), not a plain one (a view over the replaced function, which rebinds).
  Refuse just the ownership case in DependencyManager::AlterObject and report it the way
  a DROP does; SetPermissionsInfo::BreaksDependent stays false so ordinary dependents
  rebind as before (test_alter_dependency_ownership).

- COPY DATABASE: rewrite a copied entry's dependency onto the target database (catalog
  and oid, not only the outer LogicalDependency), so a copied index resolves against the
  destination rather than the source (copy_database).

- ALTER SCHEMA RENAME: the split left RenameSchemaInfo with no store execution path, so it
  crashed on an internal assertion. Reject it in the base Catalog::Alter with "Altering schemas
  is not yet supported" (rename_schema). A catalog subclass that implements schema rename overrides
  Alter and returns before reaching this, so the rejection is store-only and the transformer stays
  untouched.

Three upstream tests asserted stock-duckdb behavior that serenedb deliberately made
PG-compatible -- unknown search_path schemas accepted silently, a single-quoted string
kept as one atomic schema name (only unquoted bare names are a list), schema-only
search_path display, PG-shaped current_schemas. Update them to the serenedb behavior:
test_set_search_path, test_querying_from_detached_catalog,
peg_parser/transformer/set_statement.
pashandor789 added a commit that referenced this pull request Sep 4, 2026
The catalog/data split (#73) changed several duckdb-core behaviors that CI never
exercised, because classify-changes does not select the `core` suite on a bare
submodule pin bump. Every fix here is facade-safe (verified against serenedb's own
sqllogic):

- macro dependencies: wire MacroFunction::UnionDependencies, which the split defined
  but never called, so a CREATE MACRO under enable_macro_dependencies actually records
  its body's dependencies again -- restoring the self-cycle refusal and the
  drop-of-referenced-object refusal (test_recursive_macro,
  test_macro_default_arg_with_dependencies). The same union has to run when overloads
  are merged: MacroCatalogEntry::MergedWith starts from the superseded version's info,
  so recompute its top-level dependencies from the merged overload set, or a
  CREATE OR REPLACE MACRO keeps the old body's subjects and never retires them.
  serenedb enables this globally and its DDL tests already expect the enforcement.

- CREATE OR REPLACE: a definition replace only breaks an *owning* dependent (a sequence
  its table owns), not a plain one (a view over the replaced function, which rebinds).
  Refuse just the ownership case in DependencyManager::AlterObject and report it the way
  a DROP does; SetPermissionsInfo::BreaksDependent stays false so ordinary dependents
  rebind as before (test_alter_dependency_ownership).

- COPY DATABASE: rewrite a copied entry's dependency onto the target database (catalog
  and oid, not only the outer LogicalDependency), so a copied index resolves against the
  destination rather than the source (copy_database).

- ALTER SCHEMA RENAME: the split left RenameSchemaInfo with no store execution path, so it
  crashed on an internal assertion. Reject it in the base Catalog::Alter with "Altering schemas
  is not yet supported" (rename_schema). A catalog subclass that implements schema rename overrides
  Alter and returns before reaching this, so the rejection is store-only and the transformer stays
  untouched.

Three upstream tests asserted stock-duckdb behavior that serenedb deliberately made
PG-compatible -- unknown search_path schemas accepted silently, a single-quoted string
kept as one atomic schema name (only unquoted bare names are a list), schema-only
search_path display, PG-shaped current_schemas. Update them to the serenedb behavior:
test_set_search_path, test_querying_from_detached_catalog,
peg_parser/transformer/set_statement.
mkornaukhov pushed a commit that referenced this pull request Sep 9, 2026
The catalog/data split (#73) changed several duckdb-core behaviors that CI never
exercised, because classify-changes does not select the `core` suite on a bare
submodule pin bump. Every fix here is facade-safe (verified against serenedb's own
sqllogic):

- macro dependencies: wire MacroFunction::UnionDependencies, which the split defined
  but never called, so a CREATE MACRO under enable_macro_dependencies actually records
  its body's dependencies again -- restoring the self-cycle refusal and the
  drop-of-referenced-object refusal (test_recursive_macro,
  test_macro_default_arg_with_dependencies). The same union has to run when overloads
  are merged: MacroCatalogEntry::MergedWith starts from the superseded version's info,
  so recompute its top-level dependencies from the merged overload set, or a
  CREATE OR REPLACE MACRO keeps the old body's subjects and never retires them.
  serenedb enables this globally and its DDL tests already expect the enforcement.

- CREATE OR REPLACE: a definition replace only breaks an *owning* dependent (a sequence
  its table owns), not a plain one (a view over the replaced function, which rebinds).
  Refuse just the ownership case in DependencyManager::AlterObject and report it the way
  a DROP does; SetPermissionsInfo::BreaksDependent stays false so ordinary dependents
  rebind as before (test_alter_dependency_ownership).

- COPY DATABASE: rewrite a copied entry's dependency onto the target database (catalog
  and oid, not only the outer LogicalDependency), so a copied index resolves against the
  destination rather than the source (copy_database).

- ALTER SCHEMA RENAME: the split left RenameSchemaInfo with no store execution path, so it
  crashed on an internal assertion. Reject it in the base Catalog::Alter with "Altering schemas
  is not yet supported" (rename_schema). A catalog subclass that implements schema rename overrides
  Alter and returns before reaching this, so the rejection is store-only and the transformer stays
  untouched.

Three upstream tests asserted stock-duckdb behavior that serenedb deliberately made
PG-compatible -- unknown search_path schemas accepted silently, a single-quoted string
kept as one atomic schema name (only unquoted bare names are a list), schema-only
search_path display, PG-shaped current_schemas. Update them to the serenedb behavior:
test_set_search_path, test_querying_from_detached_catalog,
peg_parser/transformer/set_statement.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant