Copilot commented on code in PR #2438:
URL: https://github.com/apache/age/pull/2438#discussion_r3399190599


##########
src/backend/catalog/ag_catalog.c:
##########
@@ -45,9 +51,46 @@ void ag_ProcessUtility_hook(PlannedStmt *pstmt, const char 
*queryString, bool re
                             QueryEnvironment *queryEnv, DestReceiver *dest,
                             QueryCompletion *qc);
 
-static bool is_age_drop(PlannedStmt *pstmt);
+static bool is_age_drop(DropStmt *drop_stmt);
 static void drop_age_extension(DropStmt *stmt);
 
+static void
+invalidate_extension_cache_callback(Datum argument, Oid relationId)
+{
+    if (relationId == ExtensionRelationId)
+        extension_cache_is_valid = false;
+}

Review Comment:
   The relcache invalidation callback only clears the cache when relationId == 
ExtensionRelationId. Relcache callbacks can be invoked with InvalidOid to mean 
“invalidate everything”; in that case the extension-existence cache would 
remain marked valid and could become stale.



##########
src/include/catalog/ag_catalog.h:
##########
@@ -24,6 +24,8 @@
 
 #include "utils/agtype.h"
 
+bool is_age_extension_exist(void);

Review Comment:
   Function name is grammatically off and inconsistent with existing codebase 
patterns that use “*_exists” (e.g., graph_exists/label_exists). Consider 
renaming to is_age_extension_exists() (or age_extension_exists()) to better 
match the surrounding naming conventions.



##########
regress/sql/drop.sql:
##########
@@ -28,6 +28,13 @@ SELECT nspname FROM pg_catalog.pg_namespace WHERE nspname = 
'drop';
 
 SELECT tablename FROM pg_catalog.pg_tables WHERE schemaname = 'ag_catalog';
 
+-- When ag_catalog is missing extension hooks shouldn't fail with the
+-- ERROR  schema "ag_catalog" does not exist.
+-- It might happen when 'age' is loaded but extension isn't created yet.
+DROP SCHEMA ag_catalog;

Review Comment:
   This test assumes ag_catalog exists after `DROP EXTENSION age;`. To make the 
regression test resilient to catalog/cleanup behavior changes (or different PG 
versions), use `IF EXISTS` so the test still validates the “hooks don’t error 
when ag_catalog is absent” scenario even if the schema was already removed.



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]

Reply via email to