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 1v3YaD-000S94-CI for pgsql-hackers@arkaria.postgresql.org; Tue, 30 Sep 2025 11:31:49 +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 1v3YaB-0091O8-DO for pgsql-hackers@arkaria.postgresql.org; Tue, 30 Sep 2025 11:31:48 +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 1v3YaB-0091Nz-2a for pgsql-hackers@lists.postgresql.org; Tue, 30 Sep 2025 11:31:47 +0000 Received: from mail-wr1-x42b.google.com ([2a00:1450:4864:20::42b]) by magus.postgresql.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256 (Exim 4.96) (envelope-from ) id 1v3Ya9-000tDN-0K for pgsql-hackers@postgresql.org; Tue, 30 Sep 2025 11:31:47 +0000 Received: by mail-wr1-x42b.google.com with SMTP id ffacd0b85a97d-3fc36b99e92so4062138f8f.0 for ; Tue, 30 Sep 2025 04:31:44 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1759231903; x=1759836703; 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=WBYcHP+WByboUSnZxxg8C2Ov8etQ/ZExGiK2hbw/xiw=; b=kUgyz6ReW/nZVGRadsWwUFRaF7SdqAcIeEGYqjLQlsEUo+TRdVBqILIwpNtS+gfneL NnFM1A+Yfx+SHWKfw0yijdYRfR5GU1vVEg6s3GH7b6sdZxp6KdkYDRkVvdn/s80tozCQ inEm9mJ2Fkvmblzr6CnxEanAW79l03z++pMUUe8UW0o00DJ9y7j0mYlqOKxWd6V9avJQ Ipq0hgiDv3ThFbXbnCGjBC8Cu0vPbo3pPieWVf4vf1WNzH/2w086BK5xMwJSRYDZgvNQ aC8UNFun2hJ9riGG1e4K3HCkbGC4OPNvcgNm/W8CMBA3WFhiHKxIdD94lafvtziC9z7L r1+g== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1759231903; x=1759836703; 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=WBYcHP+WByboUSnZxxg8C2Ov8etQ/ZExGiK2hbw/xiw=; b=jUp1JfCvLoMpElD/lCoPj1H1t0ggYQ9IjL4OgYNhzi+A6DqDYaR8Mschz2aTISJfbk wlh4q95sAXh7cCs7zvJGI5Q1MWvHKToWriClKn7hQEdeZLGrrVjVyIoT3JSX5JlahPI3 DjtUIMbIYt2/+ltc2uCezpwdSBHnPJ42+gyxvBDcZDGm93H0fJIzDImBz+NuJyPk5g+u QBSykvJLCACrfYB3LlqG363QD8TX1FkRBBN/aMXsPJvhjOU9EWQ2NDK+oyCn6ey9qk8X MVhZA7t4bbQW9s6P5RIH3sq3dE0aq+bCiGK5hk1CmsOBYpDs4WzIXZp+pbDM1Us8YzrC /GCg== X-Gm-Message-State: AOJu0Yzk44SB5VoJni9JCvIn8HbPJKUQhGQ3ueZ/2MNxy4utcWapfkh8 BtATlWztrprcDoO8XDmZl8t3zcCMskjX8Z9gxl1eZDv+U00YxsVM2rIpDXJ/FQVx7SlTXSuyR32 lywydCMDiyKPmcXRYh8kIDEP8LLbHuwcy3ROE X-Gm-Gg: ASbGncv+iGE7c3gEJIm2sST10V/AXefIsUTZXRirsfkHpjvnJtqSp/pqsl6K6BCjsk5 +TnMctxhBJTb30a3BYkZUPblrsMHv9G1y8TdJXMqFVgsKZwauLCTglMoqR819MHfm7iCNrmuqsX IN2MhEumyo31KE6iKq5Qb+X7AtZrcX5/xiBm9t1W7VUttDk4N3FK0Q5jj1cammEGMddv00aGe0x +5Bov0Fv56/SQ+MID/TiBmuld8VBCrO X-Google-Smtp-Source: AGHT+IEOLpvzxn/wME6EjMUeIk2h+23JnXkyG+kyAQyxD0pfOtwYmOa0i6uygFSPLltHJZQQ4MWJPx5qR0a7N8N24Q8= X-Received: by 2002:a5d:64c6:0:b0:3f0:8d2f:5ed9 with SMTP id ffacd0b85a97d-424107810d7mr3472101f8f.1.1759231903209; Tue, 30 Sep 2025 04:31:43 -0700 (PDT) MIME-Version: 1.0 References: <2ebde3606beab536a8693e8f54c33dc0981b8478.camel@cybertec.at> In-Reply-To: <2ebde3606beab536a8693e8f54c33dc0981b8478.camel@cybertec.at> From: Ashutosh Bapat Date: Tue, 30 Sep 2025 17:01:28 +0530 X-Gm-Features: AS18NWAze4F1f6TMrTqM2ftwva-JWz8SHWJc4I6d4z0ak_UEd2L3CyxNsHxgHg0 Message-ID: Subject: Re: pg_restore documentation and --create/--single-transaction limitation To: Laurenz Albe Cc: pgsql-hackers Content-Type: multipart/mixed; boundary="000000000000ab410b0640031861" List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Archived-At: Precedence: bulk --000000000000ab410b0640031861 Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable On Tue, Sep 30, 2025 at 3:00=E2=80=AFPM Laurenz Albe wrote: > > On Mon, 2025-03-24 at 17:11 +0530, Ashutosh Bapat wrote: > > The pg_restore documentation usually mentions the pair of switches > > which can not be used together. However, it does not mention that > > --create and --single-transaction can not be used together. Here's a > > patch fixing the same. > > > > Looking for a precedence, I found that we have mentioned a similar > > limitation concerning --data-only and --schema-only only under > > --schema and not at both the sections. Maybe it's missing or we chose > > to mention it only at one place. But then I am not sure which one > > place I should use to mention the new limitation. So, I have added the > > note in the sections corresponding to both the switches so that a user > > reading either of them knows about the limitation. > > I grepped the source for all incompatible options: > > pg_log_error("options -d/--dbname and -f/--file cannot be used together= "); > pg_fatal("options -d/--dbname and --restrict-key cannot be used togethe= r"); > pg_fatal("options -s/--schema-only and -a/--data-only cannot be used to= gether"); > pg_fatal("options -s/--schema-only and --statistics-only cannot be used= together"); > pg_fatal("options -a/--data-only and --statistics-only cannot be used t= ogether"); > pg_fatal("options -a/--data-only and --no-data cannot be used together"= ); > pg_fatal("options -s/--schema-only and --no-schema cannot be used toget= her"); > pg_fatal("options --statistics-only and --no-statistics cannot be used = together"); > pg_fatal("options --statistics and --no-statistics cannot be used toget= her"); > pg_fatal("options %s and %s cannot be used together", > "-a/--data-only", "--statistics"); > pg_fatal("options %s and %s cannot be used together", > "-s/--schema-only", "--statistics"); > pg_fatal("options -c/--clean and -a/--data-only cannot be used together= "); > pg_fatal("options -1/--single-transaction and --transaction-size cannot= be used together"); > pg_fatal("options -C/--create and -1/--single-transaction cannot be use= d together"); > pg_fatal("cannot specify both --single-transaction and multiple jobs"); > > Most of them are pretty obvious and need no documentation. The ones > that are not obvious unless you know the inner workings are that last > two, and the last one is already documented under --jobs. Thanks a lot for the research and pointing out missing --jobs. > > So I think that your suggestion makes sense. > > I tried to improve the English, and I have added the incompatibility > with multiple --jobs to the --single-transaction documentation. > > Does that look alright to you? @@ -541,7 +545,9 @@ PostgreSQL documentation emitted commands in BEGIN/COMMIT). Th= is ensures that either all the commands complete successfully, or no changes are applied. This option implies - . + . It cannot be used together with + , which switches database connections, or with I didn't understand ", which switches ..." part. The code comment says /* * -C is not compatible with -1, because we can't create a database inside * a transaction block. */ if (opts->createDB && opts->single_txn) pg_fatal("options -C/--create and -1/--single-transaction cannot be used together"); It doesn't say anything about switching connections. But it's too low level of detail, which we may just eliminate. + multiple . This seems to be confusing. I read it as --single-transaction can not be used when there are multiple --jobs specifications e.g. --single-transaction --jobs 1 --jobs 2. Maybe just say " multiple jobs". Even corresponding --jobs documentation says pipe or standard input). Also, multiple jobs cannot be used together with the option . Attached patch with those changes. --=20 Best Wishes, Ashutosh Bapat --000000000000ab410b0640031861 Content-Type: text/x-patch; charset="US-ASCII"; name="0001-Document-more-incompatible-pg_restore-optio-20250930.patch" Content-Disposition: attachment; filename="0001-Document-more-incompatible-pg_restore-optio-20250930.patch" Content-Transfer-Encoding: base64 Content-ID: X-Attachment-Id: f_mg6h7bm30 RnJvbSAyYzVlYzAyZDkzZWViODRiNmQ5YTExMGRlYWQ5ODExNmY5OGYxODk2IE1vbiBTZXAgMTcg MDA6MDA6MDAgMjAwMQpGcm9tOiBMYXVyZW56IEFsYmUgPGxhdXJlbnouYWxiZUBjeWJlcnRlYy5h dD4KRGF0ZTogVHVlLCAzMCBTZXAgMjAyNSAxMToyMjo0MiArMDIwMApTdWJqZWN0OiBbUEFUQ0hd IERvY3VtZW50IG1vcmUgaW5jb21wYXRpYmxlIHBnX3Jlc3RvcmUgb3B0aW9ucwoKTW9zdCBvZiB0 aGUgcGFpcnMgb2YgaW5jb21wYXRpYmxlIG9wdGlvbnMgKHN1Y2ggYXMgLS1maWxlIGFuZCAtLWRi bmFtZSkgYXJlCnByZXR0eSBvYnZpb3VzIGFuZCBuZWVkIG5vIGV4cGxhbmF0aW9uLiAgQnV0IGl0 IG1heSBub3QgYmUgb2J2aW91cyB0aGF0Ci0tc2luZ2xlLXRyYW5zYWN0aW9uIGNhbm5vdCBiZSB1 c2VkIHRvZ2V0aGVyIHdpdGggLS1jcmVhdGUgb3IgbXVsdGlwbGUKam9icywgc28gbGV0J3MgbWVu dGlvbiB0aGF0IGluIHRoZSBkb2N1bWVudGF0aW9uLgoKQXV0aG9yOiBBc2h1dG9zaCBCYXBhdCA8 YXNodXRvc2guYmFwYXQub3NzQGdtYWlsLmNvbT4KUmV2aWV3ZWQtQnk6IExhdXJlbnogQWxiZSA8 bGF1cmVuei5hbGJlQGN5YmVydGVjLmF0PgpEaXNjdXNzaW9uOiBodHRwczovL3Bvc3Rnci5lcy9t L0NBRXhIVzV0aTVpZ0R3T09kZTZzaGdmUzdKUHRDWTlnTnJrQjN4TnI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