Re: Non-text mode for pg_dumpall

From: Mahendra Singh Thalor <mahi6run(at)gmail(dot)com>
To: tushar <tushar(dot)ahuja(at)enterprisedb(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-08 06:44:06
Message-ID: CAKYtNAoNi8O1wbSZx0a1oSi-YzQtprxqpfZqryRq39hXn_p-OA@mail.gmail.com
Views: Whole Thread | Raw Message | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

Thanks Tushar for the testing and reports.

On Tue, 2 Dec 2025 at 18:45, tushar <tushar(dot)ahuja(at)enterprisedb(dot)com> wrote:
>
>
>
> 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,

I tried to fix these issues in the attached patch.

Here, I am attaching an updated patch for the review and testing.

--
Thanks and Regards
Mahendra Singh Thalor
EnterpriseDB: http://www.enterprisedb.com

Attachment Content-Type Size
v11_08122025-Non-text-modes-for-pg_dumpall-correspondingly-change.patch application/octet-stream 89.8 KB

In response to

Browse pgsql-hackers by date

  From Date Subject
Next Message cca5507 2025-12-08 06:46:40 Re: Support loser tree for k-way merge
Previous Message Michael Paquier 2025-12-08 06:35:23 Re: [Proposal] Adding callback support for custom statistics kinds