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.94.2) (envelope-from ) id 1tXzFF-000K8L-Pb for pgsql-hackers@arkaria.postgresql.org; Wed, 15 Jan 2025 08:59:26 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.94.2) (envelope-from ) id 1tXzFD-009Fb4-IP for pgsql-hackers@arkaria.postgresql.org; Wed, 15 Jan 2025 08:59:24 +0000 Received: from makus.postgresql.org ([2001:4800:3e1:1::229]) by malur.postgresql.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.94.2) (envelope-from ) id 1tXzFD-009Faw-8u for pgsql-hackers@lists.postgresql.org; Wed, 15 Jan 2025 08:59:23 +0000 Received: from mail-vs1-xe2f.google.com ([2607:f8b0:4864:20::e2f]) by makus.postgresql.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256 (Exim 4.96) (envelope-from ) id 1tXzFC-000Vas-1j for pgsql-hackers@postgresql.org; Wed, 15 Jan 2025 08:59:22 +0000 Received: by mail-vs1-xe2f.google.com with SMTP id ada2fe7eead31-4afed7b7d1bso2127613137.2 for ; Wed, 15 Jan 2025 00:59:21 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1736931561; x=1737536361; darn=postgresql.org; h=content-transfer-encoding:cc:to:subject:message-id:date:from :in-reply-to:references:mime-version:from:to:cc:subject:date :message-id:reply-to; bh=AKG2OH4jdc3aMWK0cQ4lups2h4FTwQsb5hNu1svsKo8=; b=V/NL7XV59zlN1mjz+3RDzi2JBLe3EcRK6iUZ+VcTwzZSwX2Kqt2SGsj5X0m2nO58sN T2V8b+AxVBFKEnOttQlAFDQOAlDCLvhdW8FOeKsKCyIIb4e5v1s2bYrA8+zEnNIZge/6 wl9qtVjqRCgE8nyqrjnjW/xKObUq/3tgOZw07slaQoCtapR2bhA/druo33AkyrLP+kGv d4fmNJ49REyQ8w8IbAuAdyKvAojt7N0/V2KKXOSgWQWnrQeee1sh5STUYx6Q8+sTB9te MkiJDA2u9D7VcehBui4IfviidjZlu3qGg2ccxrW5JDIONHdUXGzc4MojuQOpnWSY/rwj i7EA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1736931561; x=1737536361; h=content-transfer-encoding:cc:to:subject:message-id:date:from :in-reply-to:references:mime-version:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=AKG2OH4jdc3aMWK0cQ4lups2h4FTwQsb5hNu1svsKo8=; b=EZAtrHegDBpAlt9g6DktoUV9yTEGkLfIiWDhCdwKoLLYCfNZzrBAtmqJdttnyDuuDH W8YZUbpUjPlgQM6+yl38JaVlTurPgKpr7rPDNsFGlrwfk6WfpIYVxP1CU7r3TrjXlobC wNvwT78RHVoBbDqc3KnSdV2tnsVxzUHpt0rf69URgb/YvF6gjv0iE4/KRPp2R6+vMhOQ mb/ARS/BIJtLSQzieOWu51W17mCy8GGDJYjj2XvzpawE+TS9EddyL0kv6cZAIB6U+gTy zM/bnuSOQVQb+au2n/U1O5MY+nJsIyhbVS5wh27GfxSg3VZAb/uBeJZmpxWPiR2rniga R6ZQ== X-Forwarded-Encrypted: i=1; AJvYcCWI4q++pKPypXQyC0unsSuUPwi1ePAj17s9iBE7CgOyWfS4c2IItksaIwEk4arq+U9a9F+SDFEl8tdRz/Aj@postgresql.org X-Gm-Message-State: AOJu0YzaYD3F3vWYXXj+hb+riMl7wRcrcQo6oDBhpDx4/veTIBbX3zkj qZR7VUCCLoFmWnWmjoFC9OFnihPGx+zr67s4og6WWcK81wbED/t0+vEcGflWqsJG9Kv1FGsU0sZ eO+AS/DS21rG26Rm+VPagDFpiH4q2kOly X-Gm-Gg: ASbGnctpg+7uFWpC8SvzG4AhMhEAlzbb+HokqHj3PDyEj2bgFytU8SpS7oljgfvdk3s 6vGZmOVS6K/NKMTs2O3OTr6nJyptHehcoNZeYucB5j9nFO7irbsq81y+a8WAGIX5XcfAvhA== X-Google-Smtp-Source: AGHT+IEo/4/51RfmHFn9JJ5XDbPdFe2qgalnVF+LCcjln8eoR8T+vt/LbaTcdX9+may56/XwfV0LPoKw0DRywFKOOm0= X-Received: by 2002:a05:6102:38c8:b0:4b2:c391:7d16 with SMTP id ada2fe7eead31-4b3d0f90aacmr24513416137.7.1736931561208; Wed, 15 Jan 2025 00:59:21 -0800 (PST) MIME-Version: 1.0 References: <202501110844.5ztsym4vbflm@alvherre.pgsql> In-Reply-To: From: jian he Date: Wed, 15 Jan 2025 16:58:45 +0800 X-Gm-Features: AbW1kvYOf11UBcBMYSWU50io4fyjYjuc42Agz3XGJZB3_9KzNDO3fiS5gLO0dQE Message-ID: Subject: Re: Non-text mode for pg_dumpall To: Mahendra Singh Thalor Cc: Alvaro Herrera , Guillaume Lelarge , Nathan Bossart , Magnus Hagander , Tom Lane , Andrew Dunstan , PostgreSQL-development , Dilip Kumar Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Archived-At: Precedence: bulk On Sun, Jan 12, 2025 at 5:31=E2=80=AFAM Mahendra Singh Thalor wrote: > > > > > you also need change > > > > > > > > > > > > Send output to the specified file. If this is omitted, the > > standard output is used. > > > > > > > > ? > > > > since if --format=3Dd, > > > > can not be omitted. > > No, we don't need this change. With --fromat=3Dd, we can omit the --file = option. > I think this is not correct. since the following three will fail. $BIN6/pg_dumpall --format=3Dcustom --exclude-database=3D*template* --schema= -only $BIN6/pg_dumpall --format=3Ddirectory --exclude-database=3D*template* --sch= ema-only $BIN6/pg_dumpall --format=3Dtar --exclude-database=3D*template* --schema-on= ly that means, pg_dumpall, when format is {custom|directory|tar} --file option cannot be omitted. you introduced a format p(plain) for pg_restore? since $BIN6/pg_restore --dbname=3Dsrc6 --format=3Dp will not error out. but doc/src/sgml/ref/pg_restore.sgml didn't mention this format. + if (archDumpFormat =3D=3D archDirectory) + appendPQExpBufferStr(&cmd, " -F d "); + else if (archDumpFormat =3D=3D archCustom) + appendPQExpBufferStr(&cmd, " -F c "); + else if (archDumpFormat =3D=3D archTar) + appendPQExpBufferStr(&cmd, " -F t "); can we use long format, i think that would improve the readability. like changing from appendPQExpBufferStr(&cmd, " -F d "); to appendPQExpBufferStr(&cmd, " --format=3Ddirectory"); ------------------------<<>>>------ I have tested {pg_dump && pg_restore --list}. pg_restore --list works fine with format {directory|custom|tar} but it seems there may be some problems with {pg_dumpall && pg_restore --list} where format is not plain. with your v08 patch, in my local environment. $BIN6/pg_dumpall --format=3Dcustom --exclude-database=3D*template* --schema-only --file=3Ddumpall_src6.custom $BIN6/pg_restore --dbname=3Dsrc6 --verbose --schema-only --list $SRC6/dumpall_src6.custom error: pg_restore: error: option -C/--create should be specified when using dump of pg_dumpall $BIN6/pg_restore --dbname=3Dsrc6 --create --verbose --schema-only --list $SRC6/dumpall_src6.custom following is some of the output: pg_restore: found dbname as : "`s3or" and db_oid:1 in map.dat file while restoring pg_restore: found dbname as : "`s3or" and db_oid:5 in map.dat file while restoring pg_restore: found total 2 database names in map.dat file pg_restore: needs to restore 2 databases out of 2 databases pg_restore: restoring database "`s3or" pg_restore: error: could not open input file "/home/jian/Desktop/pg_src/src6/postgres/dumpall_src6.custom/databases/1": No such file or directory