Re: Non-text mode for pg_dumpall - Mailing list pgsql-hackers

From tushar
Subject Re: Non-text mode for pg_dumpall
Date
Msg-id CAC6VRoYWPQZeLDuKVNeMz5z-iiVnv0zWyBwWhxdm4UQO17-AUQ@mail.gmail.com
Whole thread Raw
In response to Re: Non-text mode for pg_dumpall  (tushar <tushar.ahuja@enterprisedb.com>)
List pgsql-hackers


On Mon, Dec 1, 2025 at 10:47 PM tushar <tushar.ahuja@enterprisedb.com> wrote:

 
I have observed that when combining the --globals-only option with certain other switches during a pg_restore - operation fails silently.
The attempted restore does not execute, but no error message or warning is displayed unless the --verbose option is also used.

--this will just run without any message but objects also not going to create  
./pg_restore -Fc ok31. -C -d postgres  -t mytable  --globals-only 
./pg_restore -Fc ok31. -C -d postgres  -no-tablespace     --globals-only
./pg_restore -Fc ok31. -C -d postgres  -no-data  --globals-only

with --verbose
[edb@1a1c15437e7c bin]$ ./pg_restore -Fc ok31. -C -d postgres  -t myable  --globals-only -v
pg_restore: connecting to database for restore
pg_restore: executing SELECT pg_catalog.set_config('search_path', '', false);
pg_restore: implied no-schema restore
pg_restore: database restoring skipped because option -g/--globals-only was specified

we should probably add some message there. 


Please refer this scenario where "--no-comments"  switch  is ignoring when used with -Ft/c option of pg_dumpall  

Test Case to reproduce:
--Connect to psql terminal , create a table and comment : 
postgres=# create table t(n int);
CREATE TABLE
postgres=# insert into t values (1);
INSERT 0 1
postgres=# comment on table t is 'testing...';
COMMENT
postgres=# SELECT obj_description('public.t'::regclass, 'pg_class') AS table_comment ;
table_comment
---------------
 testing...
(1 row)
 
--perform pg_dumpall with 
(a) -Fp      (./pg_dumpall -Fp --no-comments -f dump.plain) 
(b) -Ft       (./pg_dumpall -Ft  --no-comments -f dump.tar) 

Case 1:  restore (a) , just run the file (dump.plain) on psql terminal , fire this query :
postgres=# SELECT
    obj_description('public.t'::regclass, 'pg_class') AS table_comment;
 table_comment
---------------
 
(1 row)
Seems expected .

Case 2: restore (b) via command ( ./pg_restore -Ft dump.tar -d postgres -p 5806  -C )
fire this query :
postgres=# SELECT obj_description('public.t'::regclass, 'pg_class') AS table_comment ;
table_comment
---------------
 testing...
(1 row)

Seems not expected i.e pg_dumpall with option -Ft still taking table comments and ignoring --no-comments switch. 

regards, 

pgsql-hackers by date:

Previous
From: Julien Tachoires
Date:
Subject: Re: Qual push down to table AM
Next
From: Andres Freund
Date:
Subject: Re: Buffer locking is special (hints, checksums, AIO writes)