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 1tyOae-0068bH-28 for pgsql-hackers@arkaria.postgresql.org; Sat, 29 Mar 2025 05:18:40 +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 1tyOZc-004rUy-Rf for pgsql-hackers@arkaria.postgresql.org; Sat, 29 Mar 2025 05:17: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 1tyOZc-004rUq-4R for pgsql-hackers@lists.postgresql.org; Sat, 29 Mar 2025 05:17:36 +0000 Received: from mail-qk1-x72c.google.com ([2607:f8b0:4864:20::72c]) by makus.postgresql.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256 (Exim 4.96) (envelope-from ) id 1tyOZZ-001kAe-35 for pgsql-hackers@lists.postgresql.org; Sat, 29 Mar 2025 05:17:34 +0000 Received: by mail-qk1-x72c.google.com with SMTP id af79cd13be357-7c5b2472969so298837785a.1 for ; Fri, 28 Mar 2025 22:17:33 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1743225453; x=1743830253; 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=jTwrZDMs889IDh8NMxY8VXyabiF4eSIqKvnWcUkIk5M=; b=fJONCzKjqgIkQvf5Tgq1hlXHpsLIAFc/DGAWk8lJOx7wYO0gVWAiZc9obGVb6795DY LAiIYp3UQR8Zv2+TVJkVV/4B9Lue9L1r6SJK4vHNBs9ogfpYLj31624nFPkpFc2Qubv+ mSRi84lX5Oo7hfT6BSKboScXzfzfXlI9a/1VeQBbSys7MmwaGtrY23ThfHl1hGfmi0F+ qS/Imqcl5mSZU7S/67s4p3pt5JmhWYmU5EzVsmYPkF7s0GKF8/Ttq5OD4zLgzm34YtHE OhoMQp9VgU3my/h1bfIKzsy6jR8z6SEsICIX2n76YlqGvwDzi77hfSTdyWPw2eP7Np1+ bBpg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1743225453; x=1743830253; 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=jTwrZDMs889IDh8NMxY8VXyabiF4eSIqKvnWcUkIk5M=; b=X4kAQdE+vkHj0xIq31J0D3Tgjz/RFop+FlmOJEznw0dck2glQP80IytfQtBVzbHu4V tcOrTFwNUhCXsaUReNdYcA+2SsTpsP5Fp1tOITunTRWx9yFS2stZPFgHsqkZnM6k5exL l3wZ1EQ9w9iquZYbjmsfXsPzVIhxqVIhZwMHSGH6MzMELi3UgHLhTfimr8Mxnpr1DsNh 4KIrlMidP+xvYCEqzYvHQuytJ1yIkYXaU+YVJr2o1w+CbY0ht9cIMAfQO4pKyH41ewll Or3KiRjTIt66p05neY7XU29pnbfoQDMHAKgTPtt25yBC3Wa5NjTLNQCCcy7avuOBTw2H 4vsA== X-Forwarded-Encrypted: i=1; AJvYcCVsLy75aWEC/HdOeMpzB4xSMjTmgqw/JNdWK0nnXdbmHQNFZ7FJEmDLrYsOop2KzqMoc7f3dXImoh0R8DHl@lists.postgresql.org X-Gm-Message-State: AOJu0YxopOatRCRnfuUODYITnPm0JEeIOQvRlKtNnFVASqkDv1N/QGxI D3ImRFe6joawlRsUZT3JVCwWhklc9mQ17RgRZzI8KNtzEOnkmS2cB1/Iy93Ah+4PXkOCvVk4Ttj 2xSiC/eAKIYxCpXxEaB9OusHkFsg= X-Gm-Gg: ASbGncuCxr0F7TXd90fQn1tL6gNlZW2keqGWkr0WjnIyYwNJ22TKgeJ1rUVOJkB+lmP LCFpf2tbmPRxfSGEL6tcF6fXnIzjBqCYDINawjJCzVWmAstVTH8ffeEpnwWr8FXdG2Pm+AdA2AF uRQGUzDvFcGY1RuYhK1BjMXa/F2OpfwOtueeB+5rVWJOeEvn7FbtX9Ll0Xz/kO X-Google-Smtp-Source: AGHT+IFVPIoA2RzmWTlEXwSsVkzrjMRp9qjCdh6aSEypKav6/bH6X3i9imonYMcW0QquPTfCyS31f5DRGJpmkIZfedI= X-Received: by 2002:a05:620a:1996:b0:7c5:a5cc:bcb9 with SMTP id af79cd13be357-7c6908d1d8amr251036085a.56.1743225452839; Fri, 28 Mar 2025 22:17:32 -0700 (PDT) MIME-Version: 1.0 References: <202503111705.xy7fddu36qae@alvherre.pgsql> <4ef51faa-993f-46ea-9e68-7baf736c07b8@dunslane.net> <763d1c6e-9298-4bac-9bea-9331db78a154@dunslane.net> In-Reply-To: <763d1c6e-9298-4bac-9bea-9331db78a154@dunslane.net> From: Mahendra Singh Thalor Date: Sat, 29 Mar 2025 10:47:21 +0530 X-Gm-Features: AQ5f1JocBGna3UwtYdVe9ZVVedBXd6BQV2zFwO2WjHwkhUnfuiUD6BU81xIv1qA Message-ID: Subject: Re: Non-text mode for pg_dumpall To: Andrew Dunstan Cc: jian he , =?UTF-8?Q?=C3=81lvaro_Herrera?= , Srinath Reddy , pgsql-hackers@lists.postgresql.org Content-Type: multipart/mixed; boundary="000000000000e1938b0631744d09" List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Archived-At: Precedence: bulk --000000000000e1938b0631744d09 Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable On Sat, 29 Mar 2025 at 03:50, Andrew Dunstan wrote: > > > On 2025-03-27 Th 5:15 PM, Andrew Dunstan wrote: > > > > On 2025-03-19 We 2:41 AM, Mahendra Singh Thalor wrote: > >> On Wed, 12 Mar 2025 at 21:18, Andrew Dunstan > >> wrote: > >>> > >>> On 2025-03-12 We 3:03 AM, jian he wrote: > >>>> On Wed, Mar 12, 2025 at 1:06=E2=80=AFAM =C3=81lvaro Herrera > >>>> wrote: > >>>>> Hello, > >>>>> > >>>>> On 2025-Mar-11, Mahendra Singh Thalor wrote: > >>>>> > >>>>>> In map.dat file, I tried to fix this issue by adding number of > >>>>>> characters > >>>>>> in dbname but as per code comments, as of now, we are not > >>>>>> supporting \n\r > >>>>>> in dbnames so i removed handling. > >>>>>> I will do some more study to fix this issue. > >>>>> Yeah, I think this is saying that you should not consider the > >>>>> contents > >>>>> of map.dat as a shell string. After all, you're not going to > >>>>> _execute_ > >>>>> that file via the shell. > >>>>> > >>>>> Maybe for map.dat you need to escape such characters somehow, so th= at > >>>>> they don't appear as literal newlines/carriage returns. > >>>>> > >>>> I am confused. > >>>> currently pg_dumpall plain format will abort when encountering dbnam= e > >>>> containing newline. > >>>> the left dumped plain file does not contain all the cluster > >>>> databases data. > >>>> > >>>> > >>>> if pg_dumpall non-text format aborts earlier, > >>>> it's aligned with pg_dumpall plain format? > >>>> it's also an improvement since aborts earlier, nothing will be dumpe= d? > >>>> > >>>> > >>>> am i missing something? > >>>> > >>>> > >>> I think we should fix that. > >>> > >>> But for the current proposal, =C3=81lvaro and I were talking this mor= ning, > >>> and we thought the simplest thing here would be to have the one line > >>> format and escape NL/CRs in the database name. > >>> > >>> > >>> cheers > >>> > >> Okay. As per discussions, we will keep one line entry for each > >> database into map.file. > >> > >> Thanks all for feedback and review. > >> > >> Here, I am attaching updated patches for review and testing. These > >> patches can be applied on commit a6524105d20b. > > > > > > > > I'm working through this patch set with a view to committing it. > > Attached is some cleanup which is where I got to today, although there > > is more to do. One thing I am wondering is why not put the > > SimpleDatabaseOidList stuff in fe_utils/simle_list.{c,h} ? That's > > where all the similar stuff belongs, and it feels strange to have this > > inline in pg_restore.c. (I also don't like the name much - > > SimpleOidStringList or maybe SimpleOidPlusStringList might be better). > > > > > > > > > OK, I have done that, so here is the result. The first two are you > original patches. patch 3 adds the new list type to fe-utils, and patch > 4 contains my cleanups and use of the new list type. Apart from some > relatively minor cleanup, the one thing I would like to change is how > dumps are named. If we are producing tar or custom format dumps, I think > the file names should reflect that (oid.dmp and oid.tar rather than a > bare oid as the filename), and pg_restore should look for those. I'm > going to work on that tomorrow - I don't think it will be terribly > difficult. > Thanks Andrew. Here, I am attaching a delta patch for oid.tar and oid.dmp format. --=20 Thanks and Regards Mahendra Singh Thalor EnterpriseDB: http://www.enterprisedb.com --000000000000e1938b0631744d09 Content-Type: application/octet-stream; name="delta-0001-pg_dumpall-dump-as-tar-and-dmp-file-for-file.patch" Content-Disposition: attachment; filename="delta-0001-pg_dumpall-dump-as-tar-and-dmp-file-for-file.patch" Content-Transfer-Encoding: base64 Content-ID: X-Attachment-Id: f_m8tret5j0 RnJvbSBiNDNhZTExN2ZlMzgwOWI4MmFiYjViYzg5ZmM2MmQ0NWE1NzA3ZmY2IE1vbiBTZXAgMTcg MDA6MDA6MDAgMjAwMQpGcm9tOiBNYWhlbmRyYSBTaW5naCBUaGFsb3IgPG1haGk2cnVuQGdtYWls LmNvbT4KRGF0ZTogU2F0LCAyOSBNYXIgMjAyNSAxMDoxNDoxOCArMDUzMApTdWJqZWN0OiBbUEFU Q0hdIHBnX2R1bXBhbGwgLSBkdW1wIGFzIC50YXIgYW5kIC5kbXAgZmlsZSBmb3IgdGFyIGFuZCBj dXN0b20KIGZvcm1hdAoKLS0tCiBzcmMvYmluL3BnX2R1bXAvcGdfZHVtcGFsbC5jIHwgIDcgKysr KysrLQogc3JjL2Jpbi9wZ19kdW1wL3BnX3Jlc3RvcmUuYyB8IDIyICsrKysrKysrKysrKysrKysr KysrKy0KIDIgZmlsZXMgY2hhbmdlZCwgMjcgaW5zZXJ0aW9ucygrKSwgMiBkZWxldGlvbnMoLSkK CmRpZmYgLS1naXQgYS9zcmMvYmluL3BnX2R1bXAvcGdfZHVtcGFsbC5jIGIvc3JjL2Jpbi9wZ19k dW1wL3BnX2R1bXBhbGwuYwppbmRleCA2YWFiMW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