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-11 16:09:39
Message-ID: CAKYtNAryvnS15DKdE-4QdiYeR1XKwz0RrOnsaNL72G5ubmn_hw@mail.gmail.com
Views: Whole Thread | Raw Message | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

On Wed, 10 Dec 2025 at 19:08, tushar <tushar(dot)ahuja(at)enterprisedb(dot)com> wrote:
>
>
>
> On Tue, Dec 9, 2025 at 12:18 AM Mahendra Singh Thalor <mahi6run(at)gmail(dot)com> wrote:
>>
>> On Mon, 8 Dec 2025 at 22:39, tushar <tushar(dot)ahuja(at)enterprisedb(dot)com> wrote:
>>
>> Here, I am attaching an updated patch for the review and testing. This
>> can be applied on commit d0d0ba6cf66c4043501f6f7.
>>
>
> Thanks, Mahendra, please refer to this scenario where if "--transaction-size" switch is used with pg_dumpall/pg_restore, then the table creation fails (or the table is not created)
>
> Steps to reproduce:
> 1. Connect to the psql terminal, create a table/insert rows { create table t(n int); insert into t values (generate_series(1,15)); }
> 2. Perform pg_dump operation { ./pg_dumpall -Ft -f tar.dump }
> 3. new cluster:
> try to restore with --transaction-size switch { ./pg_restore -Ft tar.dump -C -d postgres --transaction-size=10 } = Table failed to create
>
> I have checked via pg_dump/pg_restore using --transaction-size, and it is working fine, i.e, table is created successfully
>
> ./pg_dump -Ft -f tar.d postgres
> ./pg_restore --transaction-size=10 -Ft -d new_database tar.d
>
> regards,
>
>
Thanks Tushar for the report.

If transaction-size is given as non-zero, then pg_restore behaves like
"-e/--exit-on-error". means if there is any error in restore, then
exit without restoring the full cluster.

Here, in our case, as the cluster already has a role with the current
user in restore, we are reporting error "pg_restore: error: could not
execute query: ERROR: role "role" already exists" and after this
error, restore is exiting.

If you restore using a different role, then you will not get any error
and the full cluster will be restored. I will add some handling to
ignore the "CREATE ROLE current_user" command in pg_restore.

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

In response to

Browse pgsql-hackers by date

  From Date Subject
Next Message Greg Burd 2025-12-11 16:16:28 Re: [PATCH] Fix ARM64/MSVC atomic memory ordering issues on Win11 by adding explicit DMB ​barriers
Previous Message Andres Freund 2025-12-11 16:05:12 Re: [PATCH] Fix severe performance regression with gettext 0.20+ on Windows