Re: proposal: possibility to read dumped table's name from file - Mailing list pgsql-hackers

From Pavel Stehule
Subject Re: proposal: possibility to read dumped table's name from file
Date
Msg-id CAFj8pRAZ8DNZY_Wevp7JvD+vw3B87E=B39qkKuXUG9tUCzyDAg@mail.gmail.com
Whole thread Raw
In response to Re: proposal: possibility to read dumped table's name from file  (Pavel Stehule <pavel.stehule@gmail.com>)
Responses Re: proposal: possibility to read dumped table's name from file
List pgsql-hackers
Hi

ne 12. 11. 2023 v 14:17 odesílatel Pavel Stehule <pavel.stehule@gmail.com> napsal:
Hi


What are your thoughts on this version?  It's not in a committable state as it
needs a bit more comments here and there and a triplecheck that nothing was
missed in changing this, but I prefer to get your thoughts before spending the
extra time.

I think using pointer to exit function is an elegant solution. I checked the code and I found only one issue. I fixed warning

[13:57:22.578] time make -s -j${BUILD_JOBS} world-bin
[13:58:20.858] filter.c: In function ‘pg_log_filter_error’:
[13:58:20.858] filter.c:161:2: error: function ‘pg_log_filter_error’ might be a candidate for ‘gnu_printf’ format attribute [-Werror=suggest-attribute=format]
[13:58:20.858] 161 | vsnprintf(buf, sizeof(buf), fmt, argp);
[13:58:20.858] | ^~~~~~~~~
[13:58:20.858] cc1: all warnings being treated as errors

and probably copy/paste bug

diff --git a/src/bin/pg_dump/pg_restore.c b/src/bin/pg_dump/pg_restore.c
index f647bde28d..ab2abedf5f 100644
--- a/src/bin/pg_dump/pg_restore.c
+++ b/src/bin/pg_dump/pg_restore.c
@@ -535,7 +535,7 @@ read_restore_filters(const char *filename, RestoreOptions *opts)
                case FILTER_OBJECT_TYPE_EXTENSION:
                case FILTER_OBJECT_TYPE_FOREIGN_DATA:
                    pg_log_filter_error(&fstate, _("%s filter for \"%s\" is not allowed."),
-                                       "exclude",
+                                       "include",
                                        filter_object_type_name(objtype));
                    exit_nicely(1);

Regards

Pavel

next update - fix used, but uninitialized  "is_include" variable, when filter is of FILTER_OBJECT_TYPE_NONE

fix crash

# Running: pg_ctl -w -D /tmp/cirrus-ci-build/build-32/testrun/pg_dump/005_pg_dump_filterfile/data/t_005_pg_dump_filterfile_main_data/pgdata -l /tmp/cirrus-ci-build/build-32/testrun/pg_dump/005_pg_dump_filterfile/log/005_pg_dump_filterfile_main.log -o --cluster-name=main start
waiting for server to start.... done
server started
# Postmaster PID for node "main" is 71352
# Running: pg_dump -p 65454 -f /tmp/cirrus-ci-build/build-32/testrun/pg_dump/005_pg_dump_filterfile/data/t_005_pg_dump_filterfile_main_data/backup/plain.sql --filter=/tmp/cirrus-ci-build/build-32/testrun/pg_dump/005_pg_dump_filterfile/data/tmp_test_0mO3/inputfile.txt postgres
../src/bin/pg_dump/pg_dump.c:18800:7: runtime error: load of value 86, which is not a valid value for type '_Bool'
==71579==Using libbacktrace symbolizer.    #0 0x566302cd in read_dump_filters ../src/bin/pg_dump/pg_dump.c:18800    #1 0x56663429 in main ../src/bin/pg_dump/pg_dump.c:670    #2 0xf7694e45 in __libc_start_main (/lib/i386-linux-gnu/libc.so.6+0x1ae45)    #3 0x56624d50 in _start (/tmp/cirrus-ci-build/build-32/tmp_install/usr/local/pgsql/bin/pg_dump+0x1ad50)

Regards

Pavel
 

--
Daniel Gustafsson

Attachment

pgsql-hackers by date:

Previous
From: Amul Sul
Date:
Subject: Re: ALTER COLUMN ... SET EXPRESSION to alter stored generated column's expression
Next
From: Andrew Dunstan
Date:
Subject: Re: pg_basebackup check vs Windows file path limits