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 66a170d9 fix(test): Remove ELEMENT parameter for Cloudberry 
compatibility (#27)
66a170d9 is described below

commit 66a170d9ee54ca19431b6232df10ea7cad05865f
Author: Robert Mu <db...@hotmail.com>
AuthorDate: Thu Aug 28 20:37:51 2025 +0800

    fix(test): Remove ELEMENT parameter for Cloudberry compatibility (#27)
    
    This commit fixes the "base type with custom configuration" test
    to handle stricter validation in Cloudberry (based on PostgreSQL 14).
    
    Cloudberry enforces stricter CREATE TYPE validation requiring that
    types with ELEMENT parameters must have subscripting functions,
    while Greenplum 7 (based on PostgreSQL 12) was more lenient. Since
    this test focuses on verifying backup of custom type properties
    rather than array functionality, the ELEMENT parameter is removed
    for Cloudberry to comply with validation while preserving test
    coverage.
---
 integration/predata_types_queries_test.go | 17 ++++++++++++++++-
 1 file changed, 16 insertions(+), 1 deletion(-)

diff --git a/integration/predata_types_queries_test.go 
b/integration/predata_types_queries_test.go
index 6ee15640..7cc48270 100644
--- a/integration/predata_types_queries_test.go
+++ b/integration/predata_types_queries_test.go
@@ -115,7 +115,21 @@ var _ = Describe("backup integration tests", func() {
                        if connectionPool.Version.IsGPDB() && 
connectionPool.Version.Before("6") {
                                testhelper.AssertQueryRuns(connectionPool, 
"CREATE TYPE public.base_type(INPUT=public.base_fn_in, 
OUTPUT=public.base_fn_out, INTERNALLENGTH=8, PASSEDBYVALUE, ALIGNMENT=double, 
STORAGE=plain, DEFAULT=0, ELEMENT=integer, DELIMITER=';')")
                        } else {
-                               testhelper.AssertQueryRuns(connectionPool, 
"CREATE TYPE public.base_type(INPUT=public.base_fn_in, 
OUTPUT=public.base_fn_out, INTERNALLENGTH=8, PASSEDBYVALUE, ALIGNMENT=double, 
STORAGE=plain, DEFAULT=0, ELEMENT=integer, DELIMITER=';', CATEGORY='N', 
PREFERRED=true, COLLATABLE=true)")
+                               /*
+                                * In PostgreSQL 14 (Cloudberry is based on), 
the validation for CREATE TYPE has become stricter.
+                                * The 'ELEMENT' parameter can only be 
specified if a 'subscripting function' is also
+                                * provided for the type.
+                                *
+                                * PostgreSQL 12 (GPDB 7 is based on) was more 
lenient and allowed specifying 'ELEMENT'
+                                * as a metadata-only attribute without 
enforcing the presence of a subscripting
+                                * function, even though the type would not 
actually support subscripting.
+                                *
+                                * Since this test's primary purpose is to 
verify the backup of other custom
+                                * type properties (like alignment, storage, 
etc.) and not to create a
+                                * fully-functional array-like type, we remove 
the 'ELEMENT=integer' clause
+                                * test case to comply with the stricter checks.
+                                */
+                               testhelper.AssertQueryRuns(connectionPool, 
"CREATE TYPE public.base_type(INPUT=public.base_fn_in, 
OUTPUT=public.base_fn_out, INTERNALLENGTH=8, PASSEDBYVALUE, ALIGNMENT=double, 
STORAGE=plain, DEFAULT=0, DELIMITER=';', CATEGORY='N', PREFERRED=true, 
COLLATABLE=true)")
                        }
                        testhelper.AssertQueryRuns(connectionPool, "ALTER TYPE 
public.base_type SET DEFAULT ENCODING (compresstype=zlib)")
 
@@ -128,6 +142,7 @@ var _ = Describe("backup integration tests", func() {
                                baseTypeCustom.Category = "N"
                                baseTypeCustom.Preferred = true
                                baseTypeCustom.Collatable = true
+                               baseTypeCustom.Element = ""
                                
structmatcher.ExpectStructsToMatchExcluding(&baseTypeCustom, &results[0], "Oid")
                        }
                })


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

Reply via email to