Skip to content

Fix utility commands when AGE is preloaded but not installed - #2578

Open
crdv7 wants to merge 1 commit into
apache:masterfrom
crdv7:fix/truncate-without-age
Open

crdv7 wants to merge 1 commit into
apache:masterfrom
crdv7:fix/truncate-without-age

Conversation

@crdv7

@crdv7 crdv7 commented Sep 24, 2026

Copy link
Copy Markdown
Contributor

With age in shared_preload_libraries, TRUNCATE, VACUUM FULL, and CLUSTER fail in databases without the AGE extension because the ProcessUtility hook accesses missing AGE catalogs.

Follow-up to #2438: guard these three utility paths with is_age_extension_exists(), allowing normal utility processing when AGE is absent and preserving graph-cache invalidation when installed.

Reproduction

Preload AGE and restart PostgreSQL, then connect to a database without the extension or an ag_catalog schema and run:

CREATE TABLE public.utility_test (id int);
CREATE INDEX utility_test_idx ON public.utility_test (id);

TRUNCATE public.utility_test;
VACUUM FULL public.utility_test;
CLUSTER public.utility_test USING utility_test_idx;
-- Each fails: ERROR: schema "ag_catalog" does not exist

With an empty ag_catalog schema, all three instead fail with ERROR: table "ag_label" does not exist. All succeed with this patch.

Closes #2520

When AGE is loaded through shared_preload_libraries, TRUNCATE,
VACUUM FULL on a table, and CLUSTER on a table attempt to access
AGE catalogs even if the extension is not installed in the current
database. This fails with a missing ag_catalog schema or ag_label
table.

Check is_age_extension_exists() before these utility branches perform
graph-cache invalidation. If AGE is absent, continue through the normal
ProcessUtility chain. Preserve existing invalidation when AGE is
installed.

Add regression coverage for missing and empty ag_catalog schemas.
Verify data preservation after VACUUM FULL and CLUSTER, the selected
index's clustering flag, and an empty table after TRUNCATE.

Follow-up to apache#2438.
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.

TRUNCATE fails with schema "ag_catalog" does not exist in databases without AGE, when AGE is in shared_preload_libraries

1 participant