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 1vGKJm-00CZMs-6Y for pgsql-hackers@arkaria.postgresql.org; Tue, 04 Nov 2025 16:55:38 +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 1vGKJl-00FFIK-4A for pgsql-hackers@arkaria.postgresql.org; Tue, 04 Nov 2025 16:55:36 +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 1vGKJk-00FFI6-Hg for pgsql-hackers@lists.postgresql.org; Tue, 04 Nov 2025 16:55:35 +0000 Received: from mail-qk1-x72f.google.com ([2607:f8b0:4864:20::72f]) by makus.postgresql.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256 (Exim 4.96) (envelope-from ) id 1vGKJh-005QyW-0E for pgsql-hackers@lists.postgresql.org; Tue, 04 Nov 2025 16:55:34 +0000 Received: by mail-qk1-x72f.google.com with SMTP id af79cd13be357-8a479c772cfso392933485a.0 for ; Tue, 04 Nov 2025 08:55:32 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=dunslane-net.20230601.gappssmtp.com; s=20230601; t=1762275331; x=1762880131; darn=lists.postgresql.org; h=in-reply-to:autocrypt:content-language:from:references:cc:to :subject:user-agent:mime-version:date:message-id:from:to:cc:subject :date:message-id:reply-to; bh=H1MEidzGrALUCo6jZDJKpY5hsvcKstQfkT8KQ7pdq08=; b=mp1taSVkqTI2aJ1R7NK4/d87dBJqL8xDrOStdFvE+/cUHxjfGLHTeNIS2TJZewDfYq jg9FNxctfZYchhBzYYjQtyjTz2Q3e9C7Fe3pCRLGRYQmy+XiRwICu1aScCsbz7KOqc72 LN2fizZvzoEPPLyktorpL2zKtJS4a8wRQei9KM6Lgpp/it+wBPELj+TlpcXQTf4pQebP Q8A87lkIZKMzD4tjXZkKcrb8XpOJsQh0i/6DbW9gEPGLcVZ3DT3UuxKnYaelCj1E5IE4 VDkWxrhKmuO8PhF/KAkkWs7dWX4ErT2w26US/HywKYCSc+gkUwqB3H8I8xfh972a1QE2 zWIg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1762275331; x=1762880131; h=in-reply-to:autocrypt:content-language:from:references:cc:to :subject:user-agent:mime-version:date:message-id:x-gm-message-state :from:to:cc:subject:date:message-id:reply-to; bh=H1MEidzGrALUCo6jZDJKpY5hsvcKstQfkT8KQ7pdq08=; b=dAEggPgX8WdxWgpLBiPaj6WCifPnU/d9GAqCD7C5RwhVndY39jcS5z2Y7bEY1f/xEk e9r0XMjzdQQTJGgNVr/Pmpyk+mg7LQ54IK/63M+JaOZqTJUuSTuMfYpMzAQApXNcS9q1 VNFgBDR07mp0tRSnsuCWFBU4i+RJY7yQRtKymyLAhmAIhG47hjI0tADoQUvEosYtZwd1 U1vHcddpgJZLI0tItt8OiZSvEFcc1RRskaWn5yQVWHe4vFYgexQJoT5gJxKB3y6t3Zgw kGfoe3bkaQj/iHNEkE9DwA/WzHdnThSoqmd0VXcilCrTT1B8w1J57WKZ1C8e51IYgvCi Vx6w== X-Forwarded-Encrypted: i=1; AJvYcCX/mfnGQ6e42aBFIc1crjJay4tf4Yi59toK6rAjC28iA9x+ZVXaug7wRiVG4sHRwRcmR4c0a0bmTVDtnvTs@lists.postgresql.org X-Gm-Message-State: AOJu0YwoTu/fgbljsdWZBLYRXFSNlxMiULetbM+wp5hHgXqxhxVzVBV7 71Xrem/IXkMEw+il17FGYc5lrEgmYY7ff2NJrfSAOC10t+LJh/BsxZzkkP1n29eJvXs= X-Gm-Gg: ASbGncuWVfXFzFKEKeciFrGEtKhGqgyzGHLkIUHPHj1cebOVIe3kAFGBIccdx70q8aF Ye8Flrcyem8eJ0z9CdicKwyifk8mZAbiId9iJBca8YjqJKuRhQCAxUFZjGhWgzI4ulCfnhbnkXj EOIMyzaBi7DkQKdYqxk2vdxlMVPAo9JlzKd52fA6v/QnU4bMR5YzCHRBZGdaIAYQhGQJCS0H+XI QjfKabsraa/4x2kGaor01/yAPVwc9/UZbaRQCkJvkeaDM6eyef+ftAbd+gMu6TTEAvSQKC+cnEY /KWcrlP6ttIr0+q8LSmeu5/pklfYFVpM4Vp6SrChOpAOK7QbGyEmE64Z6Am6Rx9QBrqy5VYonxV 4lOSF/V1tXblnWs4PpdAjpxPmsQa6rb5GavhS8dR3OSl/hvQEWZWMnMMb42nCxA+YA16cM3bTsY XJPJupkCavF12QEyQk3w== X-Google-Smtp-Source: AGHT+IElPOSDcz6U0TN0AB4Gd7sx+dn689X69SUZv0EICVVh6GW8EKwVxwgNQ2U92HDZ0DdXwyfgKQ== X-Received: by 2002:a05:620a:4688:b0:8a3:cd9e:e40e with SMTP id af79cd13be357-8b220b1cfa0mr36840585a.86.1762275330821; Tue, 04 Nov 2025 08:55:30 -0800 (PST) Received: from ?IPV6:2605:a601:a6b0:500::1cb? ([2605:a601:a6b0:500::1cb]) by smtp.googlemail.com with ESMTPSA id af79cd13be357-8b0f82843easm222113185a.49.2025.11.04.08.55.29 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Tue, 04 Nov 2025 08:55:30 -0800 (PST) Content-Type: multipart/alternative; boundary="------------OkyoXbM7NEuryOQ7AtVGoaha" Message-ID: Date: Tue, 4 Nov 2025 11:55:28 -0500 MIME-Version: 1.0 User-Agent: Mozilla Thunderbird Subject: Re: Non-text mode for pg_dumpall To: tushar , Mahendra Singh Thalor Cc: Vaibhav Dalvi , pgsql-hackers@lists.postgresql.org References: <3f22a8bb-29e8-40cc-97a1-309181da2c13@dunslane.net> <20250725162141.6f.nmisch@google.com> <2225040.1753477169@sss.pgh.pa.us> <20250727235628.e2.nmisch@google.com> <8f2ad50b-ebb7-4adc-997e-25e0ad96ff34@dunslane.net> <2bed001a-462c-42da-9a6b-3c7884502932@dunslane.net> <20250824010811.4d.nmisch@google.com> <82eb35b8-7f07-493b-b689-0934919e1dc3@dunslane.net> From: Andrew Dunstan Content-Language: en-US Autocrypt: addr=andrew@dunslane.net; keydata= xsBNBE7KWFkBCAClridxur2AIc7eW2AR7izbfp3EnNefie2HbLF0izW5Ik5UjX2HBXBx4syI gY6b0ugohXrr274+baoAlvSbq6cAoQuEVrk5IZFzt20b1Xkx65FwGSEj526yiKLocqkJceSq Xr9xcA5SGY+FZv441chh5SU92v4q6z+6LPpoHOh97ptAVXZYNTtU0LevyvD5lja0TzbvJm6C eFXitJfnm1pLEr0DGJCR/iUOl/N62Kh4855zZC7NHIjQHPOvV5Stz/l5ilDhvGVk+xkXFPys SjZoUr1rXhYLpiyi5sR0X9FHXT0KnGuz1F5ERO7ZTLSSQ6fJwPj6gOk9K+vvoKvoeql5ABEB AAHNJEFuZHJldyBEdW5zdGFuIDxhbmRyZXdAZHVuc2xhbmUubmV0PsLAlwQTAQgAQQIbAwIX gAIZAQULCQgHAwUVCgkICwUWAgMBAAIeBRYhBOQ+WEYd/Hy/RGkVpZn6f8tZ/DuBBQJoGNGd BQkdEO8nAAoJEJn6f8tZ/DuBq74H/jkTR4Zi3stbw+xC7v2u3QozssK7MYPL2AsVfh7OealS h182fiWXpfvmmAB7WUHbhk9GC2RAOnHI/2d2jgKaMLAHsGYOT0YopTVIwRY43fCw/mK67yxc wmDcX+zyKfLaivNbf5A7QPLNwda98bEAMSJ8Sn652Uc6cA8t3uKGsVzbRBQOoYzjgvBCfSrE 9ql3PDNg0l4BfAqabd2f70ZUm9VAMEPrgv/v2xI7M2XiL4g5BVmqLCOwxLM8RMCotCuoweUr VO43DeBCIDwLxotMJKvGWDjBzQYlU1NPUAtNcz/gN9ITUe1VUGjyvGj4u1lxBOcQQUw7l1+T 5moZ4iZxXzvOwE0ETspYWQEIANGc4zQULOxhbqO2dyD51YhqCNRmm9oKWaqf+wmW4tpDe/VV cxAnNizd4LWCHfzpb5cHAtGkOPePMfzWVf6nvdF7d3eglbtf59+zG7O7llV0xSSoFiieQBsr GvqDInXYX/4mRRXMtyhM353/tixC9RWLs1oofyYmCPPXXY7h9R7en3B8BoVrRFcdzlIY/NFN hFGW/9dkEiGjgna2Rk6e15kln4ZvFBWUg23p93w/pqXcxY6+k/8TEk+C4R+M6w7o2PLGOjdZ +kPiUcw5H85zf/yZJwQXzisXaNduwWB6Vads9YC9dj6kPR1c4VGRqAaYL++LAEOqrlvm2Tvq QqZRtnEAEQEAAcLAfAQYAQgAJgIbDBYhBOQ+WEYd/Hy/RGkVpZn6f8tZ/DuBBQJoGNI2BQkd EODdAAoJEJn6f8tZ/DuBfw0IAKTsfD40teP/pp+bsLLMSxPXUYrrprTj7WFB5v61p6dkpSr/ qXmMlyahdxQFaPmfVgVirB1Vk/kHiWNnnGjfUV9nB2Zg9LI0Xb9/ts3LsUiRWXzG3tkMY6XL vsVOxW4XFRND9l2q+WW93aZ1DZl+fqWfYgMvsusFRhmGFOKTRfKPta2Pkv+AhA24N4+PrR5p bU4k2MO8PAGiK8eaYKGFG1bHKuAvoDoF7WXJ3FHxuWqLnKEt4dfOLm5pAe3zq1Lt6q8azT9i QWGpSAK5vQUWQHBHpiDjdPeqKZ6HiAXIIKfSmb+jrvXBqoP+D6/K7rUjG2aXiRtTIAXms9sm VRu7cmw= In-Reply-To: List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Archived-At: Precedence: bulk This is a multi-part message in MIME format. --------------OkyoXbM7NEuryOQ7AtVGoaha Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 8bit On 2025-11-04 Tu 7:53 AM, tushar wrote: > > > On Mon, Nov 3, 2025 at 5:25 PM Mahendra Singh Thalor > wrote: > > On Mon, 3 Nov 2025 at 12:06, Vaibhav Dalvi > wrote: > > > > Hi Mahendra, > > > > Thank you for your work on this feature. > > I have just begun reviewing the latest patch and > > encountered the following errors during the initial setup: > > > > ``` > > $ ./db/bin/pg_restore testdump_dir -C -d postgres -F d -p 5556 > > pg_restore: error: could not execute query: ERROR: syntax error > at or near "\\" > > LINE 1: \restrict > aO9K1gzVZTlafidF5fWx8ADGzUnIiAcguFz5qskGaFDygTCjCj... > > ^ > > Command was: \restrict > aO9K1gzVZTlafidF5fWx8ADGzUnIiAcguFz5qskGaFDygTCjCj9vg3Xxys1b3hb > > > > pg_restore: error: could not execute query: ERROR: syntax error > at or near "\\" > > LINE 1: \unrestrict > aO9K1gzVZTlafidF5fWx8ADGzUnIiAcguFz5qskGaFDygTCj... > > ^ > > Command was: \unrestrict > aO9K1gzVZTlafidF5fWx8ADGzUnIiAcguFz5qskGaFDygTCjCj9vg3Xxys1b3hb > > > > pg_restore: error: could not execute query: ERROR: syntax error > at or near "\\" > > LINE 1: \connect template1 > > ^ > > Command was: \connect template1 > > > > pg_restore: error: could not execute query: ERROR: syntax error > at or near "\\" > > LINE 1: \connect postgres > > ^ > > Command was: \connect postgres > > ``` > > To cross-check tried with plain dump(with pg_dumpall) and > >  restored(SQL file restore) without patch and didn't get above > > connection errors. > > > > It appears there might be an issue with the dump file itself. > > Please note that this is my first observation as I have just > > started the review. I will continue with my assessment. > > > > Regards, > > Vaibhav Dalvi > > EnterpriseDB > > Thanks Vaibhav for the review. > This change was added by me in v04. Only in the case of a file, we > should restore these commands. Attached patch is fixing the same. > > Thanks Mahendra, I am getting a segmentation fault against v05 patch. > > [edb@1a1c15437e7c bin]$ ./pg_dumpall -Ft   --file  a.3 -v > pg_dumpall: executing SELECT pg_catalog.set_config('search_path', '', > false); > Segmentation fault > > Issue is coming with all output file formats -F[t/c/d] except plain > > Yeah, I don't think we need to dump the timestamp in non-text modes. This fix worked for me: diff --git a/src/bin/pg_dump/pg_dumpall.c b/src/bin/pg_dump/pg_dumpall.c index 601b9f9738e..f66cc26d9a2 100644 --- a/src/bin/pg_dump/pg_dumpall.c +++ b/src/bin/pg_dump/pg_dumpall.c @@ -638,7 +638,7 @@ main(int argc, char *argv[])     if (quote_all_identifiers)         executeCommand(conn, "SET quote_all_identifiers = true"); -   if (verbose) +   if (verbose && archDumpFormat == archNull)         dumpTimestamp("Started on");     /* create a archive file for global commands. */ @@ -2258,6 +2258,7 @@ createDumpId(void)  static void  createOneArchiveEntry(const char *query, const char *tag)  { +   Assert(fout != NULL);     ArchiveEntry(fout,             nilCatalogId, /* catalog ID */             createDumpId(), /* dump ID */ cheers andrew -- Andrew Dunstan EDB:https://www.enterprisedb.com --------------OkyoXbM7NEuryOQ7AtVGoaha Content-Type: text/html; charset=UTF-8 Content-Transfer-Encoding: 8bit


On 2025-11-04 Tu 7:53 AM, tushar wrote:


On Mon, Nov 3, 2025 at 5:25 PM Mahendra Singh Thalor <mahi6run@gmail.com> wrote:
On Mon, 3 Nov 2025 at 12:06, Vaibhav Dalvi <vaibhav.dalvi@enterprisedb.com> wrote:
>
> Hi Mahendra,
>
> Thank you for your work on this feature.
> I have just begun reviewing the latest patch and
> encountered the following errors during the initial setup:
>
> ```
> $ ./db/bin/pg_restore testdump_dir -C -d postgres -F d -p 5556
> pg_restore: error: could not execute query: ERROR: syntax error at or near "\\"
> LINE 1: \restrict aO9K1gzVZTlafidF5fWx8ADGzUnIiAcguFz5qskGaFDygTCjCj...
> ^
> Command was: \restrict aO9K1gzVZTlafidF5fWx8ADGzUnIiAcguFz5qskGaFDygTCjCj9vg3Xxys1b3hb
>
> pg_restore: error: could not execute query: ERROR: syntax error at or near "\\"
> LINE 1: \unrestrict aO9K1gzVZTlafidF5fWx8ADGzUnIiAcguFz5qskGaFDygTCj...
> ^
> Command was: \unrestrict aO9K1gzVZTlafidF5fWx8ADGzUnIiAcguFz5qskGaFDygTCjCj9vg3Xxys1b3hb
>
> pg_restore: error: could not execute query: ERROR: syntax error at or near "\\"
> LINE 1: \connect template1
> ^
> Command was: \connect template1
>
> pg_restore: error: could not execute query: ERROR: syntax error at or near "\\"
> LINE 1: \connect postgres
> ^
> Command was: \connect postgres
> ```
> To cross-check tried with plain dump(with pg_dumpall) and
>  restored(SQL file restore) without patch and didn't get above
> connection errors.
>
> It appears there might be an issue with the dump file itself.
> Please note that this is my first observation as I have just
> started the review. I will continue with my assessment.
>
> Regards,
> Vaibhav Dalvi
> EnterpriseDB

Thanks Vaibhav for the review.
This change was added by me in v04. Only in the case of a file, we should restore these commands. Attached patch is fixing the same.

Thanks Mahendra, I am getting a segmentation fault against v05 patch.

[edb@1a1c15437e7c bin]$ ./pg_dumpall -Ft   --file  a.3 -v
pg_dumpall: executing SELECT pg_catalog.set_config('search_path', '', false);
Segmentation fault

Issue is coming with all output file formats -F[t/c/d] except plain 




Yeah, I don't think we need to dump the timestamp in non-text modes. This fix worked for me:


diff --git a/src/bin/pg_dump/pg_dumpall.c b/src/bin/pg_dump/pg_dumpall.c
index 601b9f9738e..f66cc26d9a2 100644
--- a/src/bin/pg_dump/pg_dumpall.c
+++ b/src/bin/pg_dump/pg_dumpall.c
@@ -638,7 +638,7 @@ main(int argc, char *argv[])
    if (quote_all_identifiers)
        executeCommand(conn, "SET quote_all_identifiers = true");
 
-   if (verbose)
+   if (verbose && archDumpFormat == archNull)
        dumpTimestamp("Started on");
 
    /* create a archive file for global commands. */
@@ -2258,6 +2258,7 @@ createDumpId(void)
 static void
 createOneArchiveEntry(const char *query, const char *tag)
 {
+   Assert(fout != NULL);
    ArchiveEntry(fout,
            nilCatalogId, /* catalog ID */
            createDumpId(), /* dump ID */



cheers


andrew

--
Andrew Dunstan
EDB: https://www.enterprisedb.com
--------------OkyoXbM7NEuryOQ7AtVGoaha--