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 1ucLfg-00BvBi-VT for pgsql-hackers@arkaria.postgresql.org; Thu, 17 Jul 2025 10:17:01 +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 1ucLfe-000v8T-7R for pgsql-hackers@arkaria.postgresql.org; Thu, 17 Jul 2025 10:16:58 +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 1ucLfd-000v7r-RH for pgsql-hackers@lists.postgresql.org; Thu, 17 Jul 2025 10:16:58 +0000 Received: from mail-qt1-x82e.google.com ([2607:f8b0:4864:20::82e]) by magus.postgresql.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256 (Exim 4.96) (envelope-from ) id 1ucLfc-008EU9-0k for pgsql-hackers@lists.postgresql.org; Thu, 17 Jul 2025 10:16:58 +0000 Received: by mail-qt1-x82e.google.com with SMTP id d75a77b69052e-4ab6e66ea68so10737191cf.1 for ; Thu, 17 Jul 2025 03:16:55 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1752747414; x=1753352214; 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=5Uk1UrOt62tejpxsSopfKiNVEcvOawcDIe8CxeyCzHY=; b=bZ7nILt/0dkuCaIDTF/NBEE5xGnXD8jNxG5f46Mhen2lXHrI9TChNEK0psUiKnNxN8 GueMe0qj00CxTOniFT0nqseh8QgDTgbrnlYb+eKktTCzP24GtvffcZx5agaRuaNXcdKn NOjSxANlNLXQviICUEp2X8sWGeFZ4/jMO48ZrBJ/RqXZz8Brhh43CM1QLffCST/uPzVw XpELwmcvDPRtAj9PBRNzx4dczBPhjSSRcGZV9GWiHna71wPzMBZCwyJYvKQeTXu0aAoq mhyywpE/Pe0K/EZU9BzZgYuh4DA8yzKR9ZYYrrwteOQEieoDIdNUSSI10toq8rMVh2ys +gjw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1752747414; x=1753352214; 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=5Uk1UrOt62tejpxsSopfKiNVEcvOawcDIe8CxeyCzHY=; b=W21WqGuQh0WuIY1MidbKPoqtTfUl/zgMxwgJMBWJXlxu73OP1gf128QHSiLq5E9k+M QocUt2zKyCw+VyM9V5KTd+TkqU9Hoa6p9w9400f0l9ua0/E3jEHl5nV3Nu3p95Om8NMN VOcWskjlwyQkY0JYnUAUaG1Dbg5Dl1LXDvPkbPcMAtnXP8V+CJH4hvz6zDs5meHYHvvA VD3j5a1HDuegBLhpLUzliDiBHAf/d6QhQQZUdXHDNSFxg4CinjhmPycwhs0rxI1uPfag RIWzKc7YQgF7FIeNT5GUxMBEm/IUmVEwTGv4pU7a+JtWJR/3ykDGPdWUasiK8omnNYwS T98Q== X-Forwarded-Encrypted: i=1; AJvYcCX0vWWbNg0nzQYzemr1pYvNCfppebh33Z7IwBjPOup4TRXUKU2rvuigRhnR7yzpVJTHHaU3fOJcb4w5LenY@lists.postgresql.org X-Gm-Message-State: AOJu0YymmEZeyax9MseSc+2eqC2WB/DR6paMbY5Uqnnj7xGgpbasQ6J3 H1At5sWQVDE1EVoKS60BJ7EyLYB57+9DrwpIouSPzHTvZP6XNoxBFIn7B5VLWU1MVl/DCm8uSpV v05BeiD5FqZYkxeXEckPJonSb3mBrBp0= X-Gm-Gg: ASbGncuuFGyz4spLViDI48bJey+AiPdUrkPBAB7dqnuqqh55tukr5Mye0Zj1hPUHm6k skHh0c1bmj7VsUvsn47jooTRSZXCzU4f8zmzAXX5WeHuE8wIYovCbP9RVxeA/REeNUjsj5uNe6V Byfwq/qTZCIoGIHQNK9p4+swM84SCMRT160ikDeGhcPw8npY1O3FhJlwU8oPjdcUA3hQfYMA+JA mVCAKUNw0dzKhz0b61rr34TeVDHputQMV5l6gQ+Gw== X-Google-Smtp-Source: AGHT+IFOkfa7vetX7+BKfNbz6KIYg4L018Yd/dzXlTiKr/XmRlq3Q/s4gL/svXnuFM+GlEl0GkVxMKIG4ImFcGmAK7w= X-Received: by 2002:a05:622a:54:b0:4ab:3ec3:c02c with SMTP id d75a77b69052e-4aba3d9760cmr33677311cf.32.1752747413814; Thu, 17 Jul 2025 03:16:53 -0700 (PDT) MIME-Version: 1.0 References: <202503311812.vxg5b7rzfgf6@alvherre.pgsql> <616efe2c-3986-43cf-b88c-4435849acf9e@dunslane.net> <948154fe-0278-4f4c-8f5a-085e12f03163@dunslane.net> <20250708212819.09.nmisch@google.com> <20250716001957.c6.nmisch@google.com> In-Reply-To: <20250716001957.c6.nmisch@google.com> From: Mahendra Singh Thalor Date: Thu, 17 Jul 2025 15:46:41 +0530 X-Gm-Features: Ac12FXxrYsgusEVYvHJCnnwRrzvV3JCUG4c-dN9FFj_kypO13s8M8d4914Jrz5w Message-ID: Subject: Re: Non-text mode for pg_dumpall To: Noah Misch Cc: Andrew Dunstan , =?UTF-8?Q?=C3=81lvaro_Herrera?= , jian he , Srinath Reddy , pgsql-hackers@lists.postgresql.org Content-Type: multipart/mixed; boundary="000000000000fb67ad063a1d4ef8" List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Archived-At: Precedence: bulk --000000000000fb67ad063a1d4ef8 Content-Type: text/plain; charset="UTF-8" Thanks Noah for the feedback. On Wed, 16 Jul 2025 at 05:50, Noah Misch wrote: > > On Thu, Jul 10, 2025 at 12:21:03AM +0530, Mahendra Singh Thalor wrote: > > On Wed, 9 Jul 2025 at 02:58, Noah Misch wrote: > > > On Fri, Apr 04, 2025 at 04:11:05PM -0400, Andrew Dunstan wrote: > > > > Thanks. I have pushed these now with a few further small tweaks. > > > > > > This drops all databases: > > > > > > pg_dumpall --clean -Fd -f /tmp/dump > > > pg_restore -d template1 --globals-only /tmp/dump > > > > > > That didn't match my expectations given this help text: > > > > > > $ pg_restore --help|grep global > > > -g, --globals-only restore only global objects, no databases > > > > Databases are global objects so due to --clean command, we are putting > > drop commands in global.dat for all the databases. While restoring, we > > used the "--globals-only" option so we are dropping all these > > databases by global.dat file. > > > > Please let us know your expectations for this specific case. > > Be consistent with "pg_dump". A quick check suggests "pg_dump --clean" > affects plain format only. For non-plain formats, only the pg_restore > argument governs the final commands: > > $ rm -r /tmp/dump; pg_dump --clean -Fd -f /tmp/dump && pg_restore -f- /tmp/dump | grep DROP > $ rm -r /tmp/dump; pg_dump --clean -Fd -f /tmp/dump && pg_restore --clean -f- /tmp/dump | grep DROP > DROP TABLE public.example; > > That said, you should audit code referencing the --clean flag and see if > there's more to it than that quick test suggests. Note that aligning with > pg_dump will require changes for object types beyond databases. "pg_restore > --clean" of a global dump should emit DROP TABLESPACE and DROP ROLE as > appropriate, regardless of whether the original pg_dumpall had --clean. > > For my earlier example (pg_dumpall --clean; pg_restore --globals-only) I > expect the same outcome as plain-format "pg_dumpall --globals-only", which is > no databases dropped or created. The help line says "no databases". Plain > "pg_dumpall --globals-only" and even "pg_dumpall --globals-only --clean" do > not drop or create databases. To pg_restore, we are giving a dump of pg_dumpall which has a global.dat file and we have drop commands in the global.dat file so when we are using 'globals-only', we are dropping databases as we have DROP commands. As of now, we don't have any filter for global.dat file in restore. If a user wants to restore only globals(without droping db), then they should use 'globals-only' in pg_dumpall. Or if we don't want to DROP databases by global.dat file, then we should add a filter in pg_restore (hard to implement as we have SQL commands in global.dat file). I think, for this case, we can do some more doc changes. Example: pg_restore --globals-only : this will restore the global.dat file(including all drop commands). It might drop databases if any drop commands. @Andrew Dunstan Please add your opinion. > > > > commit 1495eff wrote: > > > > --- a/src/bin/pg_dump/pg_dumpall.c > > > > +++ b/src/bin/pg_dump/pg_dumpall.c > > > > > > > @@ -1612,9 +1683,27 @@ dumpDatabases(PGconn *conn) > > > > continue; > > > > } > > > > > > > > + /* > > > > + * If this is not a plain format dump, then append dboid and dbname to > > > > + * the map.dat file. > > > > + */ > > > > + if (archDumpFormat != archNull) > > > > + { > > > > + if (archDumpFormat == archCustom) > > > > + snprintf(dbfilepath, MAXPGPATH, "\"%s\"/\"%s\".dmp", db_subdir, oid); > > > > + else if (archDumpFormat == archTar) > > > > + snprintf(dbfilepath, MAXPGPATH, "\"%s\"/\"%s\".tar", db_subdir, oid); > > > > + else > > > > + snprintf(dbfilepath, MAXPGPATH, "\"%s\"/\"%s\"", db_subdir, oid); > > > > > > Use appendShellString() instead. Plain mode already does that for the > > > "pg_dumpall -f" argument, which is part of db_subdir here. We don't want > > > weird filename characters to work out differently for plain vs. non-plain > > > mode. Also, it's easier to search for appendShellString() than to search for > > > open-coded shell quoting. > > > > Yes, we can use appendShellString also. We are using snprintf in the > > pg_dump.c file also. > > Ex: snprintf(tagbuf, sizeof(tagbuf), "LARGE OBJECTS %u..%u", > > loinfo->looids[0], loinfo->looids[loinfo->numlos - 1]); > > It's true snprintf() is not banned in these programs, but don't use it to do > the quoting for OS shell command lines or fragments thereof. dbfilepath is a > fragment of an OS shell command line. The LARGE OBJECTS string is not one of > those. Hence, the LARGE OBJECTS scenario should keep using snprintf(). > > > If we want to use appendShellString, I can write a patch for these. > > Please let me know your opinion. > > Use appendShellString() for shell quoting. Don't attempt to use it for other > purposes. Okay. Fixed in attached patch. > > > > > --- a/src/bin/pg_dump/pg_restore.c > > > > +++ b/src/bin/pg_dump/pg_restore.c > > > > > > > +/* > > > > + * read_one_statement > > > > + * > > > > + * This will start reading from passed file pointer using fgetc and read till > > > > + * semicolon(sql statement terminator for global.dat file) > > > > + * > > > > + * EOF is returned if end-of-file input is seen; time to shut down. > > > > > > What makes it okay to use this particular subset of SQL lexing? > > > > To support complex syntax, we used this code from another file. > > I'm hearing that you copied this code from somewhere. Running > "git grep 'time to shut down'" suggests you copied it from > InteractiveBackend(). Is that right? I do see other similarities between > read_one_statement() and InteractiveBackend(). > > Copying InteractiveBackend() provides negligible assurance that this is the > right subset of SQL lexing. Only single-user mode uses InteractiveBackend(). > Single-user mode survives mostly as a last resort for recovering from having > reached xidStopLimit, is rarely used, and only superusers write queries to it. Yes, we copied this from InteractiveBackend to read statements from global.dat file. > > > > > +/* > > > > + * get_dbnames_list_to_restore > > > > + * > > > > + * This will mark for skipping any entries from dbname_oid_list that pattern match an > > > > + * entry in the db_exclude_patterns list. > > > > + * > > > > + * Returns the number of database to be restored. > > > > + * > > > > + */ > > > > +static int > > > > +get_dbnames_list_to_restore(PGconn *conn, > > > > + SimpleOidStringList *dbname_oid_list, > > > > + SimpleStringList db_exclude_patterns) > > > > +{ > > > > + int count_db = 0; > > > > + PQExpBuffer query; > > > > + PGresult *res; > > > > + > > > > + query = createPQExpBuffer(); > > > > + > > > > + if (!conn) > > > > + pg_log_info("considering PATTERN as NAME for --exclude-database option as no db connection while doing pg_restore."); > > > > > > When do we not have a connection here? We'd need to document this behavior > > > variation if it stays, but I'd prefer if we can just rely on having a > > > connection. > > > > Yes, we can document this behavior. > > My review asked a question there. I don't see an answer to that question. > Would you answer that question? Example: if there is no active database, even postgres/template1, then we will consider PATTEREN as NAME. This is the rare case. In attached patch, I added one doc line also for this case. > > @@ -1612,9 +1683,27 @@ dumpDatabases(PGconn *conn) > > continue; > > } > > > > + /* > > + * If this is not a plain format dump, then append dboid and dbname to > > + * the map.dat file. > > + */ > > + if (archDumpFormat != archNull) > > + { > > + if (archDumpFormat == archCustom) > > + snprintf(dbfilepath, MAXPGPATH, "\"%s\"/\"%s\".dmp", db_subdir, oid); > > + else if (archDumpFormat == archTar) > > + snprintf(dbfilepath, MAXPGPATH, "\"%s\"/\"%s\".tar", db_subdir, oid); > > + else > > + snprintf(dbfilepath, MAXPGPATH, "\"%s\"/\"%s\"", db_subdir, oid); > > Use appendShellString() instead. Plain mode already does that for the > "pg_dumpall -f" argument, which is part of db_subdir here. We don't want > weird filename characters to work out differently for plain vs. non-plain > mode. Also, it's easier to search for appendShellString() than to search for > open-coded shell quoting. Fixed. > > > @@ -1641,19 +1727,30 @@ dumpDatabases(PGconn *conn) > > if (filename) > > fclose(OPF); > > > > - ret = runPgDump(dbname, create_opts); > > + ret = runPgDump(dbname, create_opts, dbfilepath, archDumpFormat); > > if (ret != 0) > > pg_fatal("pg_dump failed on database \"%s\", exiting", dbname); > > > > if (filename) > > { > > - OPF = fopen(filename, PG_BINARY_A); > > + char global_path[MAXPGPATH]; > > + > > + if (archDumpFormat != archNull) > > + snprintf(global_path, MAXPGPATH, "%s/global.dat", filename); > > + else > > + snprintf(global_path, MAXPGPATH, "%s", filename); > > + > > + OPF = fopen(global_path, PG_BINARY_A); > > if (!OPF) > > pg_fatal("could not re-open the output file \"%s\": %m", > > - filename); > > + global_path); > > Minor item: plain mode benefits from reopening, because pg_dump appended to > the plain output file. There's no analogous need to reopen global.dat, since > just this one process writes to global.dat. Fixed. > > > @@ -1672,17 +1770,36 @@ runPgDump(const char *dbname, const char *create_opts) > > initPQExpBuffer(&connstrbuf); > > initPQExpBuffer(&cmd); > > > > - printfPQExpBuffer(&cmd, "\"%s\" %s %s", pg_dump_bin, > > - pgdumpopts->data, create_opts); > > - > > /* > > - * If we have a filename, use the undocumented plain-append pg_dump > > - * format. > > + * If this is not a plain format dump, then append file name and dump > > + * format to the pg_dump command to get archive dump. > > */ > > - if (filename) > > - appendPQExpBufferStr(&cmd, " -Fa "); > > + if (archDumpFormat != archNull) > > + { > > + printfPQExpBuffer(&cmd, "\"%s\" -f %s %s", pg_dump_bin, > > + dbfile, create_opts); > > + > > + if (archDumpFormat == archDirectory) > > + appendPQExpBufferStr(&cmd, " --format=directory "); > > + else if (archDumpFormat == archCustom) > > + appendPQExpBufferStr(&cmd, " --format=custom "); > > + else if (archDumpFormat == archTar) > > + appendPQExpBufferStr(&cmd, " --format=tar "); > > + } > > else > > - appendPQExpBufferStr(&cmd, " -Fp "); > > + { > > + printfPQExpBuffer(&cmd, "\"%s\" %s %s", pg_dump_bin, > > + pgdumpopts->data, create_opts); > > This uses pgdumpopts for plain mode only, so many pg_dumpall options silently > have no effect in non-plain mode. Example: > > strace -f pg_dumpall --lock-wait-timeout=10 2>&1 >/dev/null | grep exec > strace -f pg_dumpall --lock-wait-timeout=10 -Fd -f /tmp/dump3 2>&1 >/dev/null | grep exec Fixed. > > + /* If database is already created, then don't set createDB flag. */ > > + if (opts->cparams.dbname) > > + { > > + PGconn *test_conn; > > + > > + test_conn = ConnectDatabase(db_cell->str, NULL, opts->cparams.pghost, > > + opts->cparams.pgport, opts->cparams.username, TRI_DEFAULT, > > + false, progname, NULL, NULL, NULL, NULL); > > + if (test_conn) > > + { > > + PQfinish(test_conn); > > + > > + /* Use already created database for connection. */ > > + opts->createDB = 0; > > + opts->cparams.dbname = db_cell->str; > > + } > > + else > > + { > > + /* we'll have to create it */ > > + opts->createDB = 1; > > + opts->cparams.dbname = connected_db; > > + } > > In released versions, "pg_restore --create" fails if the database exists, and > pg_restore w/o --create fails unless the database exists. I think we should > continue that pattern in this new feature. If not, pg_restore should document > how it treats pg_dumpall-sourced dumps with the "create if not exists" > semantics appearing here. Added one more doc line for this case. Here, I am attaching a patch. Please let me know feedback. -- Thanks and Regards Mahendra Singh Thalor EnterpriseDB: http://www.enterprisedb.com --000000000000fb67ad063a1d4ef8 Content-Type: application/octet-stream; name="v01_db2978-WIP-implement-setNodeValue-function.patch" Content-Disposition: attachment; filename="v01_db2978-WIP-implement-setNodeValue-function.patch" Content-Transfer-Encoding: base64 Content-ID: X-Attachment-Id: f_md78ho6t0 RnJvbSBmZjliMjgyNTBkYzBjMDE2YjM3NDc3NTM2ZWNlMGIxNGI2ZDA3YzAzIE1vbiBTZXAgMTcg MDA6MDA6MDAgMjAwMQpGcm9tOiBNYWhl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