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 1tZuEL-00ECGE-HL for pgsql-hackers@arkaria.postgresql.org; Mon, 20 Jan 2025 16:02:25 +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 1tZuEK-003cTr-KS for pgsql-hackers@arkaria.postgresql.org; Mon, 20 Jan 2025 16:02:24 +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.94.2) (envelope-from ) id 1tZuEK-003cTi-9v for pgsql-hackers@lists.postgresql.org; Mon, 20 Jan 2025 16:02:24 +0000 Received: from mail-qk1-x732.google.com ([2607:f8b0:4864:20::732]) by magus.postgresql.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256 (Exim 4.96) (envelope-from ) id 1tZuEH-000Yu6-0g for pgsql-hackers@postgresql.org; Mon, 20 Jan 2025 16:02:23 +0000 Received: by mail-qk1-x732.google.com with SMTP id af79cd13be357-7b9bc648736so456035585a.1 for ; Mon, 20 Jan 2025 08:02:21 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1737388939; x=1737993739; darn=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=kal5AuNPaHaxKsp6TxD/esgVmZpz8T4C61P5gZqsodM=; b=G8K3zCXmLH2ILvXAPvZrjgfH94VyoqxZZEytBJ9VcGZ98jhnMvzbka4tvEb0GmcF6s I61YAHGLUUWJe9KQhKCMMZs+LLFWlFe5DAaRUnkAH8fSN6j6SXVtTWzWGZTMtBdmfao7 qvmSYksMcgxHHvb6Iq8ZgXtK3rkGADHeh+NbQJVClSAwCnUhRaLhsZRHx5PD8IsLfN3b SWBEhEq7il2NJbf76dMc+t5+EvOIC/q5jZgLW6ntMmRiPnXfRU8ciuXPGODmRXoHv87U QmkMcCGIgvLEKWacsRBkX8wOWIp4jcQxrKi/J6TdV3v/TEhlyWvPQDedhflU9NnS5Ljn Rofg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1737388939; x=1737993739; h=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=kal5AuNPaHaxKsp6TxD/esgVmZpz8T4C61P5gZqsodM=; b=mjmPXrC3KB74diAlc/Cr3Ajlw5LFZTTvjrxzWeBD7MhLa5KqGvmSZm0POjsiTOZx/5 byqCTgpMNHJb5eldZLsHqq5X4/e+GC97SNI60vQUxQVbEIJz5yYkc2KozSXuJ/gq/trl Pg+PJRyW58pVS/oPT/TclkDIKQRvTZfICgxeKQ19JSwG0YwYThsf3Vx5/LOGG7CO2wm1 bEZ27Sfykli1aefeKddSvG1RXjRiFW9+VvgOoYLd4ON/9im01pYJBf73UVieFrIw+9q/ /TGYvAf60MdLj4WA0DxITyOJmuHT+3/pw6DTOq+rCuWS9wn1Y/su4uQ6iK72paYKnJzt QoiA== X-Forwarded-Encrypted: i=1; AJvYcCVATeXbjkcpXPRvClzC7tevRGflRQIM6JBZm5jDVXVfeGEjsqZnGxHFnkrKYjtZ6RXmBhscO/GSBb9HIJgZ@postgresql.org X-Gm-Message-State: AOJu0Yz6HT/gpg7ssfXLTjcXJaFpiPJkOoa5+wxLVNmYvXTLKeBAPgeE l8X+ifmkXYVb61khtR3slXoAbWLtJFgD+eYrMSIptLLvh+WWtn5AznPbor0NePS7ZbOhWezVRwD 0+Huoi7UgDDDAkiwqrFACj3xvuK8= X-Gm-Gg: ASbGncv8hMMix4IB4SWe0PODIshNNK08jWZ5i4O06zxKcPsn9X8gPm10mnM2NsU9n1K ogjGqgqaQYnDN1oopmp7hxMOcRXK0QgGpaY045Yw5HhiiK1Tn39cdmu/tfN/4YSXq0xDvaY8rzB KL7xw6 X-Google-Smtp-Source: AGHT+IHOyw+GrYDiAPf1an+JgsLN7TDRPPQiRZj0Hi0ozKqkD1oDtPmc9dGFCk3RE9UKZuC/YB/hiquQVEdzdvfdoPM= X-Received: by 2002:a05:620a:1902:b0:7b1:51df:117f with SMTP id af79cd13be357-7be6325c411mr2475649585a.56.1737388939522; Mon, 20 Jan 2025 08:02:19 -0800 (PST) MIME-Version: 1.0 References: <202501110844.5ztsym4vbflm@alvherre.pgsql> In-Reply-To: From: jian he Date: Tue, 21 Jan 2025 00:01:42 +0800 X-Gm-Features: AbW1kvZ_Irh7A3K0ksD1WfHRyWWXm66yKZztxIgmTdF5LfhZwce5u9huoFck-5w 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" List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Archived-At: Precedence: bulk hi. some minor issues come to my mind when I look at it again. looking at set_null_conf, i think "if (archDumpFormat != archNull)" can be: if (archDumpFormat != archNull) { OPF = fopen(toc_path, "w"); if (!OPF) pg_fatal("could not open global.dat file: \"%s\" for writing: %m", toc_path); } some places we use ``fopen(filename, PG_BINARY_W)``, some places we use ``fopen(filename, "w");`` kind of inconsistent... + printf(_(" -F, --format=c|d|t|p output file format (custom, directory, tar,\n" + " plain text (default))\n")); this indentation level is not right? if we look closely at the surrounding output of `pg_dumpall --help`. pg_dump.sgml --create option description: This option is ignored when emitting an archive (non-text) output file. For the archive formats, you can specify the option when you call pg_restore. in runPgDump, we have: /* * If this is non-plain format dump, then append file name and dump * format to the pg_dump command to get archive dump. */ if (archDumpFormat != archNull) { printfPQExpBuffer(&cmd, "\"%s\" -f %s %s", pg_dump_bin, dbfile, create_opts); ... } so in here, create_opts is not necessary per pg_dump.sgml above description. we can simplify it as: if (archDumpFormat != archNull) { printfPQExpBuffer(&cmd, "\"%s\" --file=%s", pg_dump_bin, dbfile); } ?