Received: from malur.postgresql.org ([217.196.149.56]) by arkaria.postgresql.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.96) (envelope-from ) id 1vQ7Wq-00B5zp-0w for pgsql-hackers@arkaria.postgresql.org; Mon, 01 Dec 2025 17:17:36 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.96) (envelope-from ) id 1vQ7Wo-003n5b-2H for pgsql-hackers@arkaria.postgresql.org; Mon, 01 Dec 2025 17:17:35 +0000 Received: from magus.postgresql.org ([2a02:c0:301:0:ffff::29]) by malur.postgresql.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.96) (envelope-from ) id 1vQ7Wo-003n5R-1B for pgsql-hackers@lists.postgresql.org; Mon, 01 Dec 2025 17:17:34 +0000 Received: from mail-ed1-x533.google.com ([2a00:1450:4864:20::533]) by magus.postgresql.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256 (Exim 4.96) (envelope-from ) id 1vQ7Wl-002agS-2V for pgsql-hackers@lists.postgresql.org; Mon, 01 Dec 2025 17:17:33 +0000 Received: by mail-ed1-x533.google.com with SMTP id 4fb4d7f45d1cf-640a3317b89so6997982a12.0 for ; Mon, 01 Dec 2025 09:17:30 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=enterprisedb.com; s=google; t=1764609450; x=1765214250; darn=lists.postgresql.org; h=cc:to:subject:message-id:date:from:in-reply-to:references :mime-version:from:to:cc:subject:date:message-id:reply-to; bh=rA1TC1gq8ga6SlaeuFSLmFF13nKNwMHTz877bW9ai9Q=; b=Vz4jXYLmXTfVMli+UPBzZXmdP5fiR2SPxUZBVdUNLZTvCPzv+xOKZ5NEP83TgxPGKY jpMyEIM2vHTLld61Dm14+rEhm6ISv8zXHw052E3bUf7NQlxAwKq8200SJcD98N7cSksA sk4/5ZQQ9zAcRwsi7li8djx+/Z5qPQt53AkxvblloTNJQOM69ZGyzgq3zcxuU9qOQVvq FD332/yeK+zh/ZZmdrDkq1MHtXhmWDzIN7S38OdeIkrwbyVSpejMtzzfmcCg3eoyZ3Dj D/Za9TmdqKZubNy2wU7RunjYpyltQtgLO8uEqrBM8oVGaDT8OBpz6/WcV2F2E/+NfHg+ fZMg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1764609450; x=1765214250; h=cc:to:subject:message-id:date:from:in-reply-to:references :mime-version:x-gm-gg:x-gm-message-state:from:to:cc:subject:date :message-id:reply-to; bh=rA1TC1gq8ga6SlaeuFSLmFF13nKNwMHTz877bW9ai9Q=; b=n1RcY5QppM6n7V7TaX8pwKCMUQg74lO374Xwm23QU4tI23rVIN03yL1feGlQK/yHZb Hbtm+TMSobdS5DX6BrvwKFB/W+TTsYnNo07o18e/JOdc8FTift578RrOs9A6G82P1m/1 D3t2qEHGxq66DDLNdt6nsiEv8Vnvgn7MAGeRNWksstU0gFj/FuwhbYSmjmnWP7RkfkXj izDMXQheDzSnJt7CdmTPovetVlK6DYB4DiBxhll7hAHUwwhYu5GGGZjmz9CDTM7HadX7 BnJIBG6lMSYaMCTFegloEPi7x/VGQZ/nYB4Kw2rSOUUnHyIbr/Zry3UizdY2BSrFNVa6 kTdQ== X-Forwarded-Encrypted: i=1; AJvYcCVv44KzXaOTlFaXLEMtwfvY4YNnMUdBm3yLKQGn3AI/lOQ2c1nO6qUascI4FUXaaxFSq+xs2ASJZ3b4Yyke@lists.postgresql.org X-Gm-Message-State: AOJu0YxZrn5t6BGPQdMWnnldMFmurEs3WuLDX9iTlDD3rKwlvQXe4sjz vKdlJAvY3GCopyGGZbobUDxoRObrJGSIHAQSLwdrJQDJEp8MKgtpAyBBgaTJckxIMc0vir4YY1R l9opkitcVmL7v7xOSJnfgNRAd2FLgWoISRFk3le6H X-Gm-Gg: ASbGncvlVKcgxUxeaFtKB/VUv9dr8s1g50CFoEDZ6I56bTQJQFAIFtsoGT8wYFxKr+F 247vf5ovh9E+IAEWZq+DOCu5sNlYP4jRseX4VzeIuZ0MQxHxJjeD8AEJfsa3v79eFqoMGijmmLL okqlD1mUoblXs7fuPiK3vBCnF55ULIdLTRNtrltlT/DegeVTJXPI4f/tdBkMydRTmjlLRr+QFAK eJV//r0y0/sgbyUKRuw6nuNZ8pxZkByCxx/rnMIF8a7EWoGagzPbHEp7a+yt8AuwWjCPAO8 X-Google-Smtp-Source: AGHT+IFZAfatBE94Dr8ZrnzK9B5NswdqxZiw7uvRhVkt9ZSzoulz5v/cZX7KEQDmYv/vJzDqekvNFbY9Vtt1OUZMdn4= X-Received: by 2002:a05:6402:280a:b0:645:d75d:3dc2 with SMTP id 4fb4d7f45d1cf-645eb258ff8mr28131566a12.10.1764609449738; Mon, 01 Dec 2025 09:17:29 -0800 (PST) MIME-Version: 1.0 References: <3f22a8bb-29e8-40cc-97a1-309181da2c13@dunslane.net> <2bed001a-462c-42da-9a6b-3c7884502932@dunslane.net> <20250824010811.4d.nmisch@google.com> <82eb35b8-7f07-493b-b689-0934919e1dc3@dunslane.net> <17555e46-4fb2-4265-90e0-95cb8ed584a6@dunslane.net> In-Reply-To: From: tushar Date: Mon, 1 Dec 2025 22:47:17 +0530 X-Gm-Features: AWmQ_bkvKzrxQqRIjaPn9C5dFQcndlIU2rKVfOv6YPNCHULZ3Uqzs7HXgbCzhlo Message-ID: Subject: Re: Non-text mode for pg_dumpall To: Mahendra Singh Thalor Cc: Vaibhav Dalvi , pgsql-hackers@lists.postgresql.org Content-Type: multipart/alternative; boundary="0000000000006b4d8c0644e72745" List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Archived-At: Precedence: bulk --0000000000006b4d8c0644e72745 Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable On Mon, Dec 1, 2025 at 6:36=E2=80=AFPM tushar wrote: > > > On Thu, Nov 27, 2025 at 2:49=E2=80=AFPM Mahendra Singh Thalor > wrote: > >> >> Fixed. Here, I am attaching an updated patch for the review and testing. >> > > Thanks Mahendra, please refer this scenario where restoring the > dump(database contain tablespace) throwing an error > > *Steps to reproduce * > initdb (./initdb -D data) , start the server ( ./pg_ctl -D data start) , > connect to psql terminal ( ./psql postgres) > create a directory ( \! mkdir /tmp/abc) , create a tablespace ( create > tablespace a location '/tmp/abc'); ) > create a table ( create table t(n int) tablespace a; ) , insert data ( > insert into t values ('a'); ) > perform pg_dumpall with option -c ( ./pg_dumpall -Fc -f my.d) > try to perform pg_restore with option --no-tablespaces ( ./pg_restore > --no-tablespaces -Fc my.d -d postgres -C) > Getting this error : > " > pg_restore: error: could not execute query: ERROR: role "edb" already > exists > Command was: CREATE ROLE edb; > ALTER ROLE edb WITH SUPERUSER INHERIT CREATEROLE CREATEDB LOGIN > REPLICATION BYPASSRLS; > > pg_restore: error: could not execute query: ERROR: directory > "/tmp/abc/PG_19_202511281" already in use as a tablespace > Command was: CREATE TABLESPACE a OWNER edb LOCATION '/tmp/abc'; > > pg_restore: warning: errors ignored on restore: 2 > " > > 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. regards, --0000000000006b4d8c0644e72745 Content-Type: text/html; charset="UTF-8" Content-Transfer-Encoding: quoted-printable


On Mon, Dec 1, = 2025 at 6:36=E2=80=AFPM tushar <tushar.ahuja@enterprisedb.com> wrote:

On Thu, Nov 27, 2025 at 2:49=E2=80=AFPM Mahendra Singh Thalor <mahi6run@gmail.com>= wrote:

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

Thanks Mahendra, please refer this scenar= io where restoring the dump(database contain tablespace) throwing an error= =C2=A0

Steps to reproduce=C2=A0
i= nitdb (./initdb -D data) , start the server ( ./pg_ctl -D data start) , con= nect to psql terminal ( ./psql postgres)
create a directory ( \! = mkdir /tmp/abc) , create a tablespace ( create tablespace a location '/= tmp/abc'); )=C2=A0
create a table ( create table t(n int) tab= lespace a; ) , insert data ( insert into t values ('a');=C2=A0 )=C2= =A0
perform=C2=A0pg_dumpall with option -c=C2=A0 (=C2=A0./pg_dump= all -Fc -f my.d)
try to perform pg_restore with option --no-table= spaces=C2=A0 (=C2=A0./pg_restore --no-tablespaces -Fc my.d =C2=A0-d postgre= s -C)=C2=A0
Getting=C2=A0this error :
"
= pg_restore: error: could not execute query: ERROR: =C2=A0role "edb&quo= t; already exists
Command was: CREATE ROLE edb;
ALTER ROLE edb WITH S= UPERUSER INHERIT CREATEROLE CREATEDB LOGIN REPLICATION BYPASSRLS;

pg= _restore: error: could not execute query: ERROR: =C2=A0directory "/tmp= /abc/PG_19_202511281" already in use as a tablespace
Command was: C= REATE TABLESPACE a OWNER edb LOCATION '/tmp/abc';

pg_restore= : warning: errors ignored on restore: 2
"

=C2=A0
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 n= ot execute, but no error message or warning is displayed unless the --verbo= se option is also used.

--this will just run witho= ut any message but objects also not going to create=C2=A0=C2=A0
.= /pg_restore -Fc ok31. -C -d postgres =C2=A0-t mytable=C2=A0 --globals-only= =C2=A0
./pg_restore -Fc ok31. -C -d postgres =C2=A0-no-table= space =C2=A0 =C2=A0 --globals-only
./pg_restore -Fc ok31. -C -d p= ostgres =C2=A0-no-data =C2=A0--globals-only

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

we should probabl= y add some message there.=C2=A0

regards,
--0000000000006b4d8c0644e72745--