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 2d0880a5 fix(test): Adapt operator metadata test for Cloudberry support (#31) 2d0880a5 is described below commit 2d0880a56016eca247292633075968555570d892 Author: Robert Mu <db...@hotmail.com> AuthorDate: Thu Aug 28 20:45:41 2025 +0800 fix(test): Adapt operator metadata test for Cloudberry support (#31) This commit modifies the operator metadata integration test to support Cloudberry in addition to the original Greenplum support. The original test created a unary prefix operator, which worked fine for Greenplum. However, Cloudberry (based on PostgreSQL 14) no longer supports user-defined unary operators, causing the test to fail. To ensure compatibility across both platforms, the test now uses a binary operator approach universally, which is supported by both Greenplum and Cloudberry. This eliminates the need for conditional logic while maintaining the same test coverage. Changes: - Replace unary prefix operator with binary operator - Use `binary_op_func(bigint, bigint)` instead of `numeric_fac` - Update operator syntax to `(LEFTARG = bigint, RIGHTARG = bigint)` - Remove database-specific conditional branching This change ensures the test passes on both Greenplum and Cloudberry without compromising the metadata validation logic. --- integration/predata_acl_queries_test.go | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) diff --git a/integration/predata_acl_queries_test.go b/integration/predata_acl_queries_test.go index 78e48aad..525d3be5 100644 --- a/integration/predata_acl_queries_test.go +++ b/integration/predata_acl_queries_test.go @@ -376,10 +376,15 @@ LANGUAGE SQL`) structmatcher.ExpectStructsToMatchExcluding(&expectedMetadata, &resultMetadata, "Oid") }) It("returns a slice of default metadata for an operator", 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 user-defined unary operators (based on PostgreSQL 14). + // To ensure this test runs on all platforms, we 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, "COMMENT ON OPERATOR public.#### (bigint, NONE) IS 'This is an operator comment.'") + 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, "COMMENT ON OPERATOR public.#### (bigint, bigint) IS 'This is an operator comment.'") 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