Re: Non-text mode for pg_dumpall

From: tushar <tushar(dot)ahuja(at)enterprisedb(dot)com>
To: Mahendra Singh Thalor <mahi6run(at)gmail(dot)com>
Cc: Vaibhav Dalvi <vaibhav(dot)dalvi(at)enterprisedb(dot)com>, pgsql-hackers(at)lists(dot)postgresql(dot)org
Subject: Re: Non-text mode for pg_dumpall
Date: 2025-12-02 13:15:06
Message-ID: CAC6VRoYWPQZeLDuKVNeMz5z-iiVnv0zWyBwWhxdm4UQO17-AUQ@mail.gmail.com
Views: Whole Thread | Raw Message | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

On Mon, Dec 1, 2025 at 10:47 PM tushar <tushar(dot)ahuja(at)enterprisedb(dot)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(at)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,

In response to

Browse pgsql-hackers by date

  From Date Subject
Next Message Andres Freund 2025-12-02 13:20:03 Re: Buffer locking is special (hints, checksums, AIO writes)
Previous Message Julien Tachoires 2025-12-02 13:09:01 Re: Qual push down to table AM