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

tuhaihe pushed a commit to branch main
in repository https://gitbox.apache.org/repos/asf/cloudberry.git

commit 4a2eb2fd4cb015d30e53c9a4f32354d2b9a368ea
Author: liushengsong <[email protected]>
AuthorDate: Mon Jun 22 18:15:02 2026 +0800

    Fix rowtypes MERGE16_FIXME: use complex_t and fix record_in tupdesc 
double-release
    
    Cloudberry has a built-in scalar 'complex' type whose complex_in doesn't
    support PG16's soft-error API. Rename to 'complex_t' composite type in
    rowtypes tests to avoid conflict.
    
    Fix record_in double ReleaseTupleDesc bug: remove 6 redundant
    ReleaseTupleDesc calls before 'goto fail', since the fail label already
    releases tupdesc. The double-release caused SIGSEGV on malformed
    composite type input via pg_input_is_valid.
---
 .../pax_storage/src/test/regress/expected/rowtypes.out    | 15 +++++----------
 .../src/test/regress/expected/rowtypes_optimizer.out      | 15 +++++----------
 contrib/pax_storage/src/test/regress/sql/rowtypes.sql     | 15 +++++----------
 src/backend/utils/adt/rowtypes.c                          |  6 ------
 src/test/regress/expected/rowtypes.out                    | 15 +++++----------
 src/test/regress/expected/rowtypes_optimizer.out          | 15 +++++----------
 src/test/regress/sql/rowtypes.sql                         | 15 +++++----------
 7 files changed, 30 insertions(+), 66 deletions(-)

diff --git a/contrib/pax_storage/src/test/regress/expected/rowtypes.out 
b/contrib/pax_storage/src/test/regress/expected/rowtypes.out
index 9c92b2c403d..076f5cbb606 100644
--- a/contrib/pax_storage/src/test/regress/expected/rowtypes.out
+++ b/contrib/pax_storage/src/test/regress/expected/rowtypes.out
@@ -70,41 +70,36 @@ LINE 1: select '(Joe,Blow) /'::fullname;
                ^
 DETAIL:  Junk after right parenthesis.
 -- test non-error-throwing API
--- MERGE16_FIXME: 
--- The greenplum implement complex type by itself, postgres implement
--- it now. should we use the complex type implemented by postgres.
--- start_ignore
-SELECT pg_input_is_valid('(1,2)', 'complex');
+SELECT pg_input_is_valid('(1,2)', 'complex_t');
  pg_input_is_valid 
 -------------------
  t
 (1 row)
 
-SELECT pg_input_is_valid('(1,2', 'complex');
+SELECT pg_input_is_valid('(1,2', 'complex_t');
  pg_input_is_valid 
 -------------------
  f
 (1 row)
 
-SELECT pg_input_is_valid('(1,zed)', 'complex');
+SELECT pg_input_is_valid('(1,zed)', 'complex_t');
  pg_input_is_valid 
 -------------------
  f
 (1 row)
 
-SELECT * FROM pg_input_error_info('(1,zed)', 'complex');
+SELECT * FROM pg_input_error_info('(1,zed)', 'complex_t');
                         message                        | detail | hint | 
sql_error_code 
 
-------------------------------------------------------+--------+------+----------------
  invalid input syntax for type double precision: "zed" |        |      | 22P02
 (1 row)
 
-SELECT * FROM pg_input_error_info('(1,1e400)', 'complex');
+SELECT * FROM pg_input_error_info('(1,1e400)', 'complex_t');
                       message                      | detail | hint | 
sql_error_code 
 
---------------------------------------------------+--------+------+----------------
  "1e400" is out of range for type double precision |        |      | 22003
 (1 row)
 
--- end_ignore
 create temp table quadtable(f1 int, q quad);
 insert into quadtable values (1, ((3.3,4.4),(5.5,6.6)));
 insert into quadtable values (2, ((null,4.4),(5.5,6.6)));
diff --git 
a/contrib/pax_storage/src/test/regress/expected/rowtypes_optimizer.out 
b/contrib/pax_storage/src/test/regress/expected/rowtypes_optimizer.out
index 32d93a68e4d..f0a84ed44d4 100644
--- a/contrib/pax_storage/src/test/regress/expected/rowtypes_optimizer.out
+++ b/contrib/pax_storage/src/test/regress/expected/rowtypes_optimizer.out
@@ -70,41 +70,36 @@ LINE 1: select '(Joe,Blow) /'::fullname;
                ^
 DETAIL:  Junk after right parenthesis.
 -- test non-error-throwing API
--- MERGE16_FIXME: 
--- The greenplum implement complex type by itself, postgres implement
--- it now. should we use the complex type implemented by postgres.
--- start_ignore
-SELECT pg_input_is_valid('(1,2)', 'complex');
+SELECT pg_input_is_valid('(1,2)', 'complex_t');
  pg_input_is_valid 
 -------------------
  t
 (1 row)
 
-SELECT pg_input_is_valid('(1,2', 'complex');
+SELECT pg_input_is_valid('(1,2', 'complex_t');
  pg_input_is_valid 
 -------------------
  f
 (1 row)
 
-SELECT pg_input_is_valid('(1,zed)', 'complex');
+SELECT pg_input_is_valid('(1,zed)', 'complex_t');
  pg_input_is_valid 
 -------------------
  f
 (1 row)
 
-SELECT * FROM pg_input_error_info('(1,zed)', 'complex');
+SELECT * FROM pg_input_error_info('(1,zed)', 'complex_t');
                         message                        | detail | hint | 
sql_error_code 
 
-------------------------------------------------------+--------+------+----------------
  invalid input syntax for type double precision: "zed" |        |      | 22P02
 (1 row)
 
-SELECT * FROM pg_input_error_info('(1,1e400)', 'complex');
+SELECT * FROM pg_input_error_info('(1,1e400)', 'complex_t');
                       message                      | detail | hint | 
sql_error_code 
 
---------------------------------------------------+--------+------+----------------
  "1e400" is out of range for type double precision |        |      | 22003
 (1 row)
 
--- end_ignore
 create temp table quadtable(f1 int, q quad);
 insert into quadtable values (1, ((3.3,4.4),(5.5,6.6)));
 insert into quadtable values (2, ((null,4.4),(5.5,6.6)));
diff --git a/contrib/pax_storage/src/test/regress/sql/rowtypes.sql 
b/contrib/pax_storage/src/test/regress/sql/rowtypes.sql
index 7db4925dbe8..93319bf7e81 100644
--- a/contrib/pax_storage/src/test/regress/sql/rowtypes.sql
+++ b/contrib/pax_storage/src/test/regress/sql/rowtypes.sql
@@ -42,16 +42,11 @@ select ' (Joe,Blow)  '::fullname;  -- ok, extra whitespace
 select '(Joe,Blow) /'::fullname;  -- bad
 
 -- test non-error-throwing API
--- MERGE16_FIXME: 
--- The greenplum implement complex type by itself, postgres implement
--- it now. should we use the complex type implemented by postgres.
--- start_ignore
-SELECT pg_input_is_valid('(1,2)', 'complex');
-SELECT pg_input_is_valid('(1,2', 'complex');
-SELECT pg_input_is_valid('(1,zed)', 'complex');
-SELECT * FROM pg_input_error_info('(1,zed)', 'complex');
-SELECT * FROM pg_input_error_info('(1,1e400)', 'complex');
--- end_ignore
+SELECT pg_input_is_valid('(1,2)', 'complex_t');
+SELECT pg_input_is_valid('(1,2', 'complex_t');
+SELECT pg_input_is_valid('(1,zed)', 'complex_t');
+SELECT * FROM pg_input_error_info('(1,zed)', 'complex_t');
+SELECT * FROM pg_input_error_info('(1,1e400)', 'complex_t');
 
 create temp table quadtable(f1 int, q quad);
 
diff --git a/src/backend/utils/adt/rowtypes.c b/src/backend/utils/adt/rowtypes.c
index 3250d285e02..f0fa5838e66 100644
--- a/src/backend/utils/adt/rowtypes.c
+++ b/src/backend/utils/adt/rowtypes.c
@@ -154,7 +154,6 @@ record_in(PG_FUNCTION_ARGS)
                ptr++;
        if (*ptr++ != '(')
        {
-               ReleaseTupleDesc(tupdesc);
                errsave(escontext,
                                (errcode(ERRCODE_INVALID_TEXT_REPRESENTATION),
                                 errmsg("malformed record literal: \"%s\"", 
string),
@@ -186,7 +185,6 @@ record_in(PG_FUNCTION_ARGS)
                                ptr++;
                        else
                        {
-                               ReleaseTupleDesc(tupdesc);
                                /* *ptr must be ')' */
                                errsave(escontext,
                                                
(errcode(ERRCODE_INVALID_TEXT_REPRESENTATION),
@@ -214,7 +212,6 @@ record_in(PG_FUNCTION_ARGS)
 
                                if (ch == '\0')
                                {
-                                       ReleaseTupleDesc(tupdesc);
                                        errsave(escontext,
                                                        
(errcode(ERRCODE_INVALID_TEXT_REPRESENTATION),
                                                         errmsg("malformed 
record literal: \"%s\"",
@@ -226,7 +223,6 @@ record_in(PG_FUNCTION_ARGS)
                                {
                                        if (*ptr == '\0')
                                        {
-                                               ReleaseTupleDesc(tupdesc);
                                                errsave(escontext,
                                                                
(errcode(ERRCODE_INVALID_TEXT_REPRESENTATION),
                                                                 
errmsg("malformed record literal: \"%s\"",
@@ -285,7 +281,6 @@ record_in(PG_FUNCTION_ARGS)
 
        if (*ptr++ != ')')
        {
-               ReleaseTupleDesc(tupdesc);
                errsave(escontext,
                                (errcode(ERRCODE_INVALID_TEXT_REPRESENTATION),
                                 errmsg("malformed record literal: \"%s\"", 
string),
@@ -297,7 +292,6 @@ record_in(PG_FUNCTION_ARGS)
                ptr++;
        if (*ptr)
        {
-               ReleaseTupleDesc(tupdesc);
                errsave(escontext,
                                (errcode(ERRCODE_INVALID_TEXT_REPRESENTATION),
                                 errmsg("malformed record literal: \"%s\"", 
string),
diff --git a/src/test/regress/expected/rowtypes.out 
b/src/test/regress/expected/rowtypes.out
index ecd4ee0deb3..d86bab812db 100644
--- a/src/test/regress/expected/rowtypes.out
+++ b/src/test/regress/expected/rowtypes.out
@@ -70,41 +70,36 @@ LINE 1: select '(Joe,Blow) /'::fullname;
                ^
 DETAIL:  Junk after right parenthesis.
 -- test non-error-throwing API
--- MERGE16_FIXME: 
--- The greenplum implement complex type by itself, postgres implement
--- it now. should we use the complex type implemented by postgres.
--- start_ignore
-SELECT pg_input_is_valid('(1,2)', 'complex');
+SELECT pg_input_is_valid('(1,2)', 'complex_t');
  pg_input_is_valid 
 -------------------
  t
 (1 row)
 
-SELECT pg_input_is_valid('(1,2', 'complex');
+SELECT pg_input_is_valid('(1,2', 'complex_t');
  pg_input_is_valid 
 -------------------
  f
 (1 row)
 
-SELECT pg_input_is_valid('(1,zed)', 'complex');
+SELECT pg_input_is_valid('(1,zed)', 'complex_t');
  pg_input_is_valid 
 -------------------
  f
 (1 row)
 
-SELECT * FROM pg_input_error_info('(1,zed)', 'complex');
+SELECT * FROM pg_input_error_info('(1,zed)', 'complex_t');
                         message                        | detail | hint | 
sql_error_code 
 
-------------------------------------------------------+--------+------+----------------
  invalid input syntax for type double precision: "zed" |        |      | 22P02
 (1 row)
 
-SELECT * FROM pg_input_error_info('(1,1e400)', 'complex');
+SELECT * FROM pg_input_error_info('(1,1e400)', 'complex_t');
                       message                      | detail | hint | 
sql_error_code 
 
---------------------------------------------------+--------+------+----------------
  "1e400" is out of range for type double precision |        |      | 22003
 (1 row)
 
--- end_ignore
 create temp table quadtable(f1 int, q quad);
 insert into quadtable values (1, ((3.3,4.4),(5.5,6.6)));
 insert into quadtable values (2, ((null,4.4),(5.5,6.6)));
diff --git a/src/test/regress/expected/rowtypes_optimizer.out 
b/src/test/regress/expected/rowtypes_optimizer.out
index e937a160d96..6edc5cbda2a 100644
--- a/src/test/regress/expected/rowtypes_optimizer.out
+++ b/src/test/regress/expected/rowtypes_optimizer.out
@@ -70,41 +70,36 @@ LINE 1: select '(Joe,Blow) /'::fullname;
                ^
 DETAIL:  Junk after right parenthesis.
 -- test non-error-throwing API
--- MERGE16_FIXME: 
--- The greenplum implement complex type by itself, postgres implement
--- it now. should we use the complex type implemented by postgres.
--- start_ignore
-SELECT pg_input_is_valid('(1,2)', 'complex');
+SELECT pg_input_is_valid('(1,2)', 'complex_t');
  pg_input_is_valid 
 -------------------
  t
 (1 row)
 
-SELECT pg_input_is_valid('(1,2', 'complex');
+SELECT pg_input_is_valid('(1,2', 'complex_t');
  pg_input_is_valid 
 -------------------
  f
 (1 row)
 
-SELECT pg_input_is_valid('(1,zed)', 'complex');
+SELECT pg_input_is_valid('(1,zed)', 'complex_t');
  pg_input_is_valid 
 -------------------
  f
 (1 row)
 
-SELECT * FROM pg_input_error_info('(1,zed)', 'complex');
+SELECT * FROM pg_input_error_info('(1,zed)', 'complex_t');
                         message                        | detail | hint | 
sql_error_code 
 
-------------------------------------------------------+--------+------+----------------
  invalid input syntax for type double precision: "zed" |        |      | 22P02
 (1 row)
 
-SELECT * FROM pg_input_error_info('(1,1e400)', 'complex');
+SELECT * FROM pg_input_error_info('(1,1e400)', 'complex_t');
                       message                      | detail | hint | 
sql_error_code 
 
---------------------------------------------------+--------+------+----------------
  "1e400" is out of range for type double precision |        |      | 22003
 (1 row)
 
--- end_ignore
 create temp table quadtable(f1 int, q quad);
 insert into quadtable values (1, ((3.3,4.4),(5.5,6.6)));
 insert into quadtable values (2, ((null,4.4),(5.5,6.6)));
diff --git a/src/test/regress/sql/rowtypes.sql 
b/src/test/regress/sql/rowtypes.sql
index 8175022c3f4..655fe4c0349 100644
--- a/src/test/regress/sql/rowtypes.sql
+++ b/src/test/regress/sql/rowtypes.sql
@@ -42,16 +42,11 @@ select ' (Joe,Blow)  '::fullname;  -- ok, extra whitespace
 select '(Joe,Blow) /'::fullname;  -- bad
 
 -- test non-error-throwing API
--- MERGE16_FIXME: 
--- The greenplum implement complex type by itself, postgres implement
--- it now. should we use the complex type implemented by postgres.
--- start_ignore
-SELECT pg_input_is_valid('(1,2)', 'complex');
-SELECT pg_input_is_valid('(1,2', 'complex');
-SELECT pg_input_is_valid('(1,zed)', 'complex');
-SELECT * FROM pg_input_error_info('(1,zed)', 'complex');
-SELECT * FROM pg_input_error_info('(1,1e400)', 'complex');
--- end_ignore
+SELECT pg_input_is_valid('(1,2)', 'complex_t');
+SELECT pg_input_is_valid('(1,2', 'complex_t');
+SELECT pg_input_is_valid('(1,zed)', 'complex_t');
+SELECT * FROM pg_input_error_info('(1,zed)', 'complex_t');
+SELECT * FROM pg_input_error_info('(1,1e400)', 'complex_t');
 
 create temp table quadtable(f1 int, q quad);
 


---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to