You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@cloudberry.apache.org by re...@apache.org on 2025/01/23 14:13:33 UTC

(cloudberry) 13/16: Show more information about logerrors in pg_exttable view. (#17182)

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

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

commit 5373babee3f7812a2d76253239697fabc76747fe
Author: Jingwen Yang <ji...@outlook.com>
AuthorDate: Wed Mar 20 10:33:32 2024 +0800

    Show more information about logerrors in pg_exttable view. (#17182)
    
    This commit is to fix issue #17180.
    
    With this commit, we can provide more detailed information about logerrors in pg_exttable view in GP7. This is to keep consistent with older GP version.
    
    ```
    testdb=# SELECT logerrors, options FROM pg_exttable WHERE reloid = 'public.test_ext'::regclass;
     logerrors |           options
    -----------+-----------------------------
     t         | {error_log_persistent=true}
    (1 row)
    ```
---
 gpcontrib/gp_exttable_fdw/gp_exttable_fdw.c        |  7 ++++++-
 src/test/regress/input/external_table.source       |  6 +++---
 src/test/regress/output/external_table.source      | 24 +++++++++++-----------
 .../regress/output/external_table_optimizer.source | 24 +++++++++++-----------
 4 files changed, 33 insertions(+), 28 deletions(-)

diff --git a/gpcontrib/gp_exttable_fdw/gp_exttable_fdw.c b/gpcontrib/gp_exttable_fdw/gp_exttable_fdw.c
index 70d36b09bf..19dde78a44 100644
--- a/gpcontrib/gp_exttable_fdw/gp_exttable_fdw.c
+++ b/gpcontrib/gp_exttable_fdw/gp_exttable_fdw.c
@@ -328,8 +328,13 @@ Datum pg_exttable(PG_FUNCTION_ARGS)
 		 * options. Since our document not contains the OPTION clause, so we
 		 * assume no external table options in used for now.  Except
 		 * gpextprotocol.c.
+		 * 
+		 * Besides, we need to provide extra information about error_log_persisitent here.
 		 */
-		nulls[5] = true;
+		if IS_LOG_ERRORS_PERSISTENTLY(extentry->logerrors)
+			values[5] = strListToArray(list_make1(makeString("error_log_persistent=true")));
+		else
+			nulls[5] = true;
 
 		/* command */
 		if (extentry->command)
diff --git a/src/test/regress/input/external_table.source b/src/test/regress/input/external_table.source
index 0edba1e896..590188ab5d 100644
--- a/src/test/regress/input/external_table.source
+++ b/src/test/regress/input/external_table.source
@@ -3655,9 +3655,9 @@ CREATE EXTERNAL TABLE ext_persistently (c INT)
 location ('file://@hostname@@abs_srcdir@/data/ext_persistently.tbl' )
 FORMAT 'text' (delimiter '|') LOG ERRORS PERSISTENTLY SEGMENT REJECT LIMIT 100;
 
-SELECT logerrors from pg_exttable a, pg_class b where a.reloid = b.oid and b.relname = 'ext_false';
-SELECT logerrors from pg_exttable a, pg_class b where a.reloid = b.oid and b.relname = 'ext_true';
-SELECT logerrors from pg_exttable a, pg_class b where a.reloid = b.oid and b.relname = 'ext_persistently';
+SELECT logerrors, options from pg_exttable a, pg_class b where a.reloid = b.oid and b.relname = 'ext_false';
+SELECT logerrors, options from pg_exttable a, pg_class b where a.reloid = b.oid and b.relname = 'ext_true';
+SELECT logerrors, options from pg_exttable a, pg_class b where a.reloid = b.oid and b.relname = 'ext_persistently';
 
 -- drop tables
 DROP EXTERNAL TABLE ext_false;
diff --git a/src/test/regress/output/external_table.source b/src/test/regress/output/external_table.source
index 8977af744a..fab5fab478 100644
--- a/src/test/regress/output/external_table.source
+++ b/src/test/regress/output/external_table.source
@@ -4973,22 +4973,22 @@ FORMAT 'text' (delimiter '|') LOG ERRORS SEGMENT REJECT LIMIT 100;
 CREATE EXTERNAL TABLE ext_persistently (c INT)
 location ('file://@hostname@@abs_srcdir@/data/ext_persistently.tbl' )
 FORMAT 'text' (delimiter '|') LOG ERRORS PERSISTENTLY SEGMENT REJECT LIMIT 100;
-SELECT logerrors from pg_exttable a, pg_class b where a.reloid = b.oid and b.relname = 'ext_false';
- logerrors 
------------
- f
+SELECT logerrors, options from pg_exttable a, pg_class b where a.reloid = b.oid and b.relname = 'ext_false';
+ logerrors | options 
+-----------+---------
+ f         | 
 (1 row)
 
-SELECT logerrors from pg_exttable a, pg_class b where a.reloid = b.oid and b.relname = 'ext_true';
- logerrors 
------------
- t
+SELECT logerrors, options from pg_exttable a, pg_class b where a.reloid = b.oid and b.relname = 'ext_true';
+ logerrors | options 
+-----------+---------
+ t         | 
 (1 row)
 
-SELECT logerrors from pg_exttable a, pg_class b where a.reloid = b.oid and b.relname = 'ext_persistently';
- logerrors 
------------
- t
+SELECT logerrors, options from pg_exttable a, pg_class b where a.reloid = b.oid and b.relname = 'ext_persistently';
+ logerrors |           options           
+-----------+-----------------------------
+ t         | {error_log_persistent=true}
 (1 row)
 
 -- drop tables
diff --git a/src/test/regress/output/external_table_optimizer.source b/src/test/regress/output/external_table_optimizer.source
index 731a25c5a5..d0de6416bd 100644
--- a/src/test/regress/output/external_table_optimizer.source
+++ b/src/test/regress/output/external_table_optimizer.source
@@ -4975,22 +4975,22 @@ FORMAT 'text' (delimiter '|') LOG ERRORS SEGMENT REJECT LIMIT 100;
 CREATE EXTERNAL TABLE ext_persistently (c INT)
 location ('file://@hostname@@abs_srcdir@/data/ext_persistently.tbl' )
 FORMAT 'text' (delimiter '|') LOG ERRORS PERSISTENTLY SEGMENT REJECT LIMIT 100;
-SELECT logerrors from pg_exttable a, pg_class b where a.reloid = b.oid and b.relname = 'ext_false';
- logerrors 
------------
- f
+SELECT logerrors, options from pg_exttable a, pg_class b where a.reloid = b.oid and b.relname = 'ext_false';
+ logerrors | options 
+-----------+---------
+ f         | 
 (1 row)
 
-SELECT logerrors from pg_exttable a, pg_class b where a.reloid = b.oid and b.relname = 'ext_true';
- logerrors 
------------
- t
+SELECT logerrors, options from pg_exttable a, pg_class b where a.reloid = b.oid and b.relname = 'ext_true';
+ logerrors | options 
+-----------+---------
+ t         | 
 (1 row)
 
-SELECT logerrors from pg_exttable a, pg_class b where a.reloid = b.oid and b.relname = 'ext_persistently';
- logerrors 
------------
- t
+SELECT logerrors, options from pg_exttable a, pg_class b where a.reloid = b.oid and b.relname = 'ext_persistently';
+ logerrors |           options           
+-----------+-----------------------------
+ t         | {error_log_persistent=true}
 (1 row)
 
 -- drop tables


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