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 183c842e fix(test): Enable operator metadata schema test on Cloudberry 
(#21)
183c842e is described below

commit 183c842ea0cb5d09599aaff37869e4271a4fdb60
Author: Robert Mu <db...@hotmail.com>
AuthorDate: Tue Aug 26 16:25:13 2025 +0800

    fix(test): Enable operator metadata schema test on Cloudberry (#21)
    
    The test for schema-filtered operator metadata would previously fail
    on Cloudberry instances. This was because its setup relied on creating
    postfix (unary) operators, a feature Cloudberry does not support.
    
    This commit refactors the test to use a binary operator, which is
    compatible with both Greenplum and Cloudberry. This change fixes the
    failing test and ensures this core functionality is now tested across
    all platforms, increasing our test coverage.
---
 integration/predata_acl_queries_test.go | 16 +++++++++++-----
 1 file changed, 11 insertions(+), 5 deletions(-)

diff --git a/integration/predata_acl_queries_test.go 
b/integration/predata_acl_queries_test.go
index b22663c2..05d607c5 100644
--- a/integration/predata_acl_queries_test.go
+++ b/integration/predata_acl_queries_test.go
@@ -688,13 +688,19 @@ LANGUAGE SQL`)
                                
structmatcher.ExpectStructsToMatchExcluding(&expectedMetadata, &resultMetadata, 
"Oid")
                        })
                        It("returns a slice of default metadata for an operator 
in a specific schema", func() {
-                               testhelper.AssertQueryRuns(connectionPool, 
"CREATE OPERATOR public.#### (LEFTARG = bigint, PROCEDURE = numeric_fac)")
-                               defer 
testhelper.AssertQueryRuns(connectionPool, "DROP OPERATOR public.#### (bigint, 
NONE)")
+                               // Cloudberry does not support postfix 
operators, which this test originally required.
+                               // To ensure this test for schema filtering 
runs on all platforms, we refactor it
+                               // to use a binary operator, which is supported 
by both Greenplum and Cloudberry.
+                               testhelper.AssertQueryRuns(connectionPool, 
"CREATE FUNCTION public.binary_op_func(bigint, bigint) RETURNS bigint AS 
'SELECT $1 + $2' LANGUAGE SQL IMMUTABLE;")
+                               defer 
testhelper.AssertQueryRuns(connectionPool, "DROP FUNCTION 
public.binary_op_func(bigint, bigint);")
+
+                               testhelper.AssertQueryRuns(connectionPool, 
"CREATE OPERATOR public.#### (LEFTARG = bigint, RIGHTARG = bigint, PROCEDURE = 
public.binary_op_func)")
+                               defer 
testhelper.AssertQueryRuns(connectionPool, "DROP OPERATOR public.#### (bigint, 
bigint)")
                                testhelper.AssertQueryRuns(connectionPool, 
"CREATE SCHEMA testschema")
                                defer 
testhelper.AssertQueryRuns(connectionPool, "DROP SCHEMA testschema")
-                               testhelper.AssertQueryRuns(connectionPool, 
"CREATE OPERATOR testschema.#### (LEFTARG = bigint, PROCEDURE = numeric_fac)")
-                               defer 
testhelper.AssertQueryRuns(connectionPool, "DROP OPERATOR testschema.#### 
(bigint, NONE)")
-                               testhelper.AssertQueryRuns(connectionPool, 
"COMMENT ON OPERATOR testschema.#### (bigint, NONE) IS 'This is an operator 
comment.'")
+                               testhelper.AssertQueryRuns(connectionPool, 
"CREATE OPERATOR testschema.#### (LEFTARG = bigint, RIGHTARG = bigint, 
PROCEDURE = public.binary_op_func)")
+                               defer 
testhelper.AssertQueryRuns(connectionPool, "DROP OPERATOR testschema.#### 
(bigint, bigint)")
+                               testhelper.AssertQueryRuns(connectionPool, 
"COMMENT ON OPERATOR testschema.#### (bigint, bigint) IS 'This is an operator 
comment.'")
 
                                _ = backupCmdFlags.Set(options.INCLUDE_SCHEMA, 
"testschema")
                                resultMetadataMap := 
backup.GetMetadataForObjectType(connectionPool, backup.TYPE_OPERATOR)


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

Reply via email to