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.96) (envelope-from ) id 1wdDoW-003y7u-0V for pgsql-hackers@arkaria.postgresql.org; Fri, 26 Jun 2026 21:10:16 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.96) (envelope-from ) id 1wdDoT-00D42t-07 for pgsql-hackers@arkaria.postgresql.org; Fri, 26 Jun 2026 21:10:13 +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.96) (envelope-from ) id 1wdDoS-00D42l-2E for pgsql-hackers@lists.postgresql.org; Fri, 26 Jun 2026 21:10:12 +0000 Received: from mail-pg1-x534.google.com ([2607:f8b0:4864:20::534]) by magus.postgresql.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256 (Exim 4.98.2) (envelope-from ) id 1wdDoQ-00000000PWg-0x4L for pgsql-hackers@lists.postgresql.org; Fri, 26 Jun 2026 21:10:12 +0000 Received: by mail-pg1-x534.google.com with SMTP id 41be03b00d2f7-c8584e80d59so666895a12.2 for ; Fri, 26 Jun 2026 14:10:08 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1782508207; cv=none; d=google.com; s=arc-20260327; b=U3rUAMEW1RHihR4K6H1pehmwXljVwSxgtJRMBJ+cvhse59V2DFmpm53V5INbU9b7Yt aWw4HRdLpoU/9jaZNfp1yAKZ0MA5jZUQu16ZhzU/JsCTCL4wpLOTJxM17JFTT+eB4TmO YK5w5aB6B3Q/tcfo+h+iWhgRiayiIhTPpbm/aGd0xbp1VTYLDQcZXa/pVMpjt5Xcz3ae T5K8HzdarMelKf14mqV8QPegfnVDjQGZJUafpgen/ez5b1EAZFW870Qdw3QJyuVXVoCs ++k1jpUeWJEpor77STdAgtWH8keFDkxIDZ9/JtmLjb2fkDXzz7HNLFKINxH0nGJ/to78 OnFQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20260327; h=content-transfer-encoding:cc:to:subject:message-id:date:from :in-reply-to:references:mime-version:dkim-signature; bh=SNwWKQH+mUnfUWMk/kAyBWFFzd/S0lUZwrG+drwHlxo=; fh=difWPyZhf+FMfWnUHiBJsrLSKQJL23D1+3HP+YAZNos=; b=gUT+/S7RxWGBO9XSgKlMQj3xXJVjVijFjkUc1Rrb6mUK4O0yPXUfEzcnHE5404USmS Q1cIu0d95UdsLF3mxoV7fWiJT/XkeKI94H8WdZF31HBVbXV3kqQyc4GrzOhCIH6OJuZ7 zS7mweOo3EmLGwHqrp1K29yozQCmTsu0u9tpUH8ig4ZRNxXnWWA8Gw3Cq4eBTBxj3Spy 7jwrm5XPRT3snNq53+9DfpowMS6K9oXBNeYRXv/RH/zYBAU4rcQKqA2Vm3TC4zSdwKiK AO55hdYhnM64xg9A73c83VsS3sVP/sy9vE8o6OnkQRA4hwkOsUbVm0Eif+PuR6WOOxjI Afcg==; darn=lists.postgresql.org ARC-Authentication-Results: i=1; mx.google.com; arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20251104; t=1782508207; x=1783113007; darn=lists.postgresql.org; h=content-transfer-encoding:cc:to:subject:message-id:date:from :in-reply-to:references:mime-version:from:to:cc:subject:date :message-id:reply-to; bh=SNwWKQH+mUnfUWMk/kAyBWFFzd/S0lUZwrG+drwHlxo=; b=jMqbjpTLCWSd1rNLMK4UTcMyQ7GY50JwXcYVlgOyYM1+Casw5O14rF+NvmV3UtO7Il rTcmf3CoF9UFKR5G81EBI0NexBaKgHe1bUDkXWQs5whABtX6EBahYebHoeLECX8ViHcc Jg6bxDX2FjxRBisPGCvzpAMBZK8/hfH/RQphIXPOB5sqotL9KrAhUktb/w2ALvu3uZX/ RdE3ASA/W555voyZlefMCFIOWBTUBO5AahvjOozSGTZzq79yFo3/QJC34UmeAIzfGGLN DWmRiimibGygZx1lzQ+aeUZVEk+OvWr+krZuUK30rtoQoNSVFAWzeIc9+HbBjY21VU9N whYg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20251104; t=1782508207; x=1783113007; h=content-transfer-encoding:cc:to:subject:message-id:date:from :in-reply-to:references:mime-version:x-gm-gg:x-gm-message-state:from :to:cc:subject:date:message-id:reply-to; bh=SNwWKQH+mUnfUWMk/kAyBWFFzd/S0lUZwrG+drwHlxo=; b=QgMK5QkhE84ruE7cDFT/E14C8rGOedMOilllPTmw2ZD+eJSZw+1qGLXiRMb9UH1ygn YBFdWokvPfmDcAqRYS/cdULD8NIJNrrpghh6vpihSBqX2CF7zncybDQRislKxMPLh3Ey Bxn8Q1pxzlqpqfTCw01jGoVD+hUwJNrO45up7AZpdRJ9Y9dtVjtP7h+Y3XqGBd5qqqgv vC9JAhI0HeaCeA29gafch+DZvmTzeSFaInl8Mjx6fnJaHlPQ+veHPTbzBKe07oG8EEBl 7u1McIViz46eWLjDtO36yU4rzYq8ZW5iuDl9x1F8pXr0Q9Bz07JNxsgKoXPHB4xZh4TM 5i+Q== X-Gm-Message-State: AOJu0YwhmJp49z0sLduYDpCSpZp+RQfpIMFsYeeG246DbUfatGjfQ/t8 9B9RImH2564l2JAOY147xZ6LpxQvNuHgTcGhAbVMsPspizdOAAU7ZjHFCqqf8YYMKAHMKiuPehC tTUqXRHSrC0SASq5xE4YI/ewYEgY4cYE= X-Gm-Gg: AfdE7cnAVcW/PFwTWBWMqxXVAcLi+roqXknoHR06UdjdzWopjnB2Un3Q1scWyc+ub10 GspstBTn6KteAIZFs3EgTcmshgQ/iRXJoyWYp8WNxS4W5DS9ac5FKnwSXN9Tu2OZTdrZVlXPiMP UvPH37i02Ia5oCFlWj/rH09uWyLCUhEVkqJv/I8ZZxBunILkRk2tdQHh9JTbmM8KgoHpStmnD4A A/N9RlsnCGmk7yEk+3CTGRJ2+wbyq0rAP79M+f+QHkL8HbU5b2O5a77mkDx0sfrxaK6vg== X-Received: by 2002:a05:6a00:7492:b0:845:b735:5ae with SMTP id d2e1a72fcca58-845b73509dcmr6664769b3a.48.1782508206684; Fri, 26 Jun 2026 14:10:06 -0700 (PDT) MIME-Version: 1.0 References: In-Reply-To: From: Masahiko Sawada Date: Fri, 26 Jun 2026 14:09:26 -0700 X-Gm-Features: AVVi8Cf5JgYzQSAwuVSYlofw7c7Pj28Ur2OHfGjsDVY78H52Jz262jlIE4-AX4E Message-ID: Subject: Re: COPY: validate option presence rather than option values To: Chao Li Cc: PostgreSQL Hackers Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Archived-At: Precedence: bulk On Tue, May 5, 2026 at 9:26=E2=80=AFPM Chao Li wro= te: > > Hi, > > While testing COPY TO (FORMAT json), I noticed that the doc says FORCE_AR= RAY is only allowed with FORMAT json: > ``` > > FORCE_ARRAY > > > Force output of square brackets as array decorations at the beginni= ng > and end of output, and commas between the rows. It is allowed only = in > COPY TO, and only when using > json format. The default is > false. > > > > ``` > > However, this succeeds: > ``` > evantest=3D# copy t1 to stdout (format csv, force_array false); > 1 > ``` > > So this is clearly validating the parsed value of force_array, rather tha= n whether the option was specified at all. Hmm, I'm not sure this is actually a problem in practice. It seems straightforward to me that the documentation stating 'it is allowed only when...' can be interpreted as 'it is allowed to be enabled only when...'. My concern is that the proposed patch could make the command unnecessarily less flexible. This is especially true in cases where users programmatically generate a template COPY query and pass explicit boolean values (true/false) to the options. Also, other commands like VACUUM handle their boolean options in the exact same manner: =3D# vacuum (parallel 1, full) pg_class; ERROR: VACUUM FULL cannot be performed in parallel =3D# vacuum (parallel 1, full off) pg_class; VACUUM Regards, --=20 Masahiko Sawada Amazon Web Services: https://aws.amazon.com