Skip to content

Commit

Permalink
Show more information about logerrors in pg_exttable view. (#17182)
Browse files Browse the repository at this point in the history
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)
```
  • Loading branch information
jingwen-yang-yjw authored Mar 20, 2024
1 parent 576d0b5 commit ebd496d
Show file tree
Hide file tree
Showing 4 changed files with 33 additions and 28 deletions.
7 changes: 6 additions & 1 deletion gpcontrib/gp_exttable_fdw/gp_exttable_fdw.c
Original file line number Diff line number Diff line change
Expand Up @@ -327,8 +327,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)
Expand Down
6 changes: 3 additions & 3 deletions src/test/regress/input/external_table.source
Original file line number Diff line number Diff line change
Expand Up @@ -3670,9 +3670,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;
Expand Down
24 changes: 12 additions & 12 deletions src/test/regress/output/external_table.source
Original file line number Diff line number Diff line change
Expand Up @@ -4999,22 +4999,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
Expand Down
24 changes: 12 additions & 12 deletions src/test/regress/output/external_table_optimizer.source
Original file line number Diff line number Diff line change
Expand Up @@ -5001,22 +5001,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
Expand Down

0 comments on commit ebd496d

Please sign in to comment.