This is an automated email from the ASF dual-hosted git repository.

gfphoenix78 pushed a commit to branch sync-with-upstream
in repository https://gitbox.apache.org/repos/asf/cloudberry-gpbackup.git


The following commit(s) were added to refs/heads/sync-with-upstream by this 
push:
     new 60d60911 fix(test): Use DROP EXTENSION to clean up language in 
Cloudberry (#22)
60d60911 is described below

commit 60d609116b66b48d3a9e386059e59b6dd792d22e
Author: Robert Mu <db...@hotmail.com>
AuthorDate: Tue Aug 26 16:25:58 2025 +0800

    fix(test): Use DROP EXTENSION to clean up language in Cloudberry (#22)
    
    The test for procedural language metadata was failing during cleanup
    on Cloudberry. The test creates a procedural language (e.g., plpython3u)
    and defers a `DROP LANGUAGE` command to clean it up.
    
    This fails because Cloudberry, being based on a newer PostgreSQL
    version (14), treats `CREATE LANGUAGE` as a wrapper for `CREATE
    EXTENSION`. This creates a dependency where the language is owned by the
    extension and cannot be dropped directly. The correct cleanup command
    is `DROP EXTENSION`.
    
    This commit adapts the test's cleanup logic. It now checks if the
    database is Cloudberry:
    - If it is, it defers `DROP EXTENSION`.
    - Otherwise, it continues to use `DROP LANGUAGE` for compatibility with
      older Greenplum versions.
    
    This ensures the test cleans up correctly on both platforms.
---
 integration/predata_acl_queries_test.go | 9 ++++++++-
 1 file changed, 8 insertions(+), 1 deletion(-)

diff --git a/integration/predata_acl_queries_test.go 
b/integration/predata_acl_queries_test.go
index 05d607c5..78e48aad 100644
--- a/integration/predata_acl_queries_test.go
+++ b/integration/predata_acl_queries_test.go
@@ -134,7 +134,14 @@ var _ = Describe("backup integration tests", func() {
                                        plpythonString = "plpython3u"
                                }
                                testhelper.AssertQueryRuns(connectionPool, 
fmt.Sprintf("CREATE LANGUAGE %s", plpythonString))
-                               defer 
testhelper.AssertQueryRuns(connectionPool, fmt.Sprintf("DROP LANGUAGE %s", 
plpythonString))
+                               // In Cloudberry (based on PG 14), CREATE 
LANGUAGE is a wrapper around CREATE EXTENSION.
+                               // To clean up, we must DROP THE EXTENSION, not 
the language itself.
+                               // For older GPDB versions, we still need to 
DROP THE LANGUAGE.
+                               if connectionPool.Version.IsCBDB() {
+                                       defer 
testhelper.AssertQueryRuns(connectionPool, fmt.Sprintf("DROP EXTENSION %s", 
plpythonString))
+                               } else {
+                                       defer 
testhelper.AssertQueryRuns(connectionPool, fmt.Sprintf("DROP LANGUAGE %s", 
plpythonString))
+                               }
                                testhelper.AssertQueryRuns(connectionPool, 
fmt.Sprintf("COMMENT ON LANGUAGE %s IS 'This is a language comment.'", 
plpythonString))
                                
testutils.CreateSecurityLabelIfGPDB6(connectionPool, toc.OBJ_LANGUAGE, 
plpythonString)
 


---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscr...@cloudberry.apache.org
For additional commands, e-mail: commits-h...@cloudberry.apache.org

Reply via email to