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 1we2Zn-004W3K-0n for pgsql-hackers@arkaria.postgresql.org; Mon, 29 Jun 2026 03:22:27 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.96) (envelope-from ) id 1we2Zm-000dSA-09 for pgsql-hackers@arkaria.postgresql.org; Mon, 29 Jun 2026 03:22:26 +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.96) (envelope-from ) id 1we2Zl-000dS1-2R for pgsql-hackers@lists.postgresql.org; Mon, 29 Jun 2026 03:22:25 +0000 Received: from mail-pf1-x42e.google.com ([2607:f8b0:4864:20::42e]) by makus.postgresql.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256 (Exim 4.98.2) (envelope-from ) id 1we2Zj-00000000hHb-2B7J for pgsql-hackers@lists.postgresql.org; Mon, 29 Jun 2026 03:22:24 +0000 Received: by mail-pf1-x42e.google.com with SMTP id d2e1a72fcca58-8453427d3f4so1145259b3a.3 for ; Sun, 28 Jun 2026 20:22:23 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20251104; t=1782703341; x=1783308141; darn=lists.postgresql.org; h=to:references:message-id:content-transfer-encoding:cc:date :in-reply-to:from:subject:mime-version:from:to:cc:subject:date :message-id:reply-to; bh=QN3Lc8SEvnJgr+CaplegkAQ0WKeITbdxy1iEJxIUz/s=; b=BnfSvTOmvq/fzK6Ml2LLFh2w7fYGzaLlnbNOd75iaVb/kSQUINjCMA4PlXAWVTQnp1 MFcwnKH65MhthGZegUiVCu3P6AEh9a5pNZQq3y1tgHrkdAxEHL70YfWQ8YVefaSWIIK+ XcAIkE7d1U7ihZoJ3fipDUqIw2uzYH45VyCbveUHcXdrGHmRu7jgVlPzCvsIQq8gEW7z BzjGB66/E3F0AW4Mh9RbWmjikwBAljok6OSoSoO8fT5jFm3b5MuM63ii/YUrn7aPnMbi 5XmlpPYrW9t5XIw7vx3ozE2VEIrWLPv+H6+JwnQJ4rKAPgo0dVGEpUcRvB9pgGXBg8SZ hIGQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20251104; t=1782703341; x=1783308141; h=to:references:message-id:content-transfer-encoding:cc:date :in-reply-to:from:subject:mime-version:x-gm-gg:x-gm-message-state :from:to:cc:subject:date:message-id:reply-to; bh=QN3Lc8SEvnJgr+CaplegkAQ0WKeITbdxy1iEJxIUz/s=; b=UQ3pOcfH5zT59ly55INg7l7pJgqsF2KOjHzFS6uZXyxaKalcB13M/Rm2ZeMTXJJ5yW 9gkWaPc4qGeT/I4p6PHXcM4rAw96YCKZpI2ohd5H2gS8tcBWJB6sUVVn4qpK+ImezTVY A2dNN0rUAdgDBUmnEQZeqGaHAe8cYPGWScPq+3AMaS4Giq31F9f6vywhuJR8snbly8dA BxKEBHEvpJKiXZIb2eaygBG3oRg2WnUbrCcXwgKkDyDDFXXqHCbtZdw8CY5ZsZAWtQJB glfIBTaxcefUMRynyAJU2paM/XraGIJZuBYAsiFuHIUw2RJNDI1Nm7JC8mb0WT0sUKh9 rYwg== X-Gm-Message-State: AOJu0Yxv1IRjZPy6UOtbTeKX53+nvBn0xHhEsD2aMm75YNSOPm/IoVPL rah5aHaFIaV+rTrEkQCj04p9VnkmXHlzf/vDBmc5k1Khcx9JAQouO9lU X-Gm-Gg: AfdE7ckdKlAqYQEbvB+ugWr7NeMCTtfrhMUYTGWvCIKVovcfmz5xT0/KCS39xcMVldR yM7j3F8daO80AyWJ9l9/NqZamy+3AYmXUly6uTgKRnu08wGpxXUNNQfQ1dNyOxxjqOyg9eM7bHy HlFLE9ZR7ZqVaFUuzFa5+fFQMK37l+BXrJ7iMtD6byO6a6hSIxy3Lytb3grGybwhOK7uBWf0Erd k0kGukm9xR+hdnJJxk0oq8/kyEUBeItGlZqn4OXZk3mUzJnkpoZDnp0jtZeFjVXKzbKHy1DlaZx QBoVaTKs6ELpOYDdwzdqLvsxIWUjlY3Rx+8RrGZpKuW/6a8wh+WUk8VB7E6fzpeTTOTiSh1Lqi4 ySCEdGqUR3rbr/rLCnwO6P4eOF/BPnW8D+7dKPQ1zvRVB5LNgbPdiC1AiyqKOwJsinnxuuCLCXH 2vKdIJULmifC70CtkMbXLC9g== X-Received: by 2002:a05:6a00:4614:b0:842:5a8d:3036 with SMTP id d2e1a72fcca58-845b3ae25d5mr15736200b3a.35.1782703341258; Sun, 28 Jun 2026 20:22:21 -0700 (PDT) Received: from smtpclient.apple ([185.135.79.125]) by smtp.gmail.com with ESMTPSA id d2e1a72fcca58-8477594750esm1662288b3a.21.2026.06.28.20.22.19 (version=TLS1_2 cipher=ECDHE-ECDSA-AES128-GCM-SHA256 bits=128/128); Sun, 28 Jun 2026 20:22:20 -0700 (PDT) Content-Type: text/plain; charset=utf-8 Mime-Version: 1.0 (Mac OS X Mail 16.0 \(3864.600.51.1.1\)) Subject: Re: COPY: validate option presence rather than option values From: Chao Li In-Reply-To: Date: Mon, 29 Jun 2026 11:21:46 +0800 Cc: PostgreSQL Hackers Content-Transfer-Encoding: quoted-printable Message-Id: <09E83EBC-66D3-4C35-9988-B7812A8D81FC@gmail.com> References: To: Masahiko Sawada X-Mailer: Apple Mail (2.3864.600.51.1.1) List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Archived-At: Precedence: bulk > On Jun 27, 2026, at 05:09, Masahiko Sawada = wrote: >=20 > On Tue, May 5, 2026 at 9:26=E2=80=AFPM Chao Li = wrote: >>=20 >> Hi, >>=20 >> While testing COPY TO (FORMAT json), I noticed that the doc says = FORCE_ARRAY is only allowed with FORMAT json: >> ``` >> >> FORCE_ARRAY >> >> >> Force output of square brackets as array decorations at the = beginning >> 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. >> >> >> >> ``` >>=20 >> However, this succeeds: >> ``` >> evantest=3D# copy t1 to stdout (format csv, force_array false); >> 1 >> ``` >>=20 >> So this is clearly validating the parsed value of force_array, rather = than whether the option was specified at all. >=20 > 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: >=20 > =3D# vacuum (parallel 1, full) pg_class; > ERROR: VACUUM FULL cannot be performed in parallel > =3D# vacuum (parallel 1, full off) pg_class; > VACUUM >=20 > Regards, >=20 > --=20 > Masahiko Sawada > Amazon Web Services: https://aws.amazon.com It seems there is no consistency even within the VACUUM command. = BUFFER_USAGE_LIMIT is checked based on its presence, not its value: ``` evantest=3D# vacuum (full, BUFFER_USAGE_LIMIT 0) t; ERROR: BUFFER_USAGE_LIMIT cannot be specified for VACUUM FULL ``` Here, 0 disables BUFFER_USAGE_LIMIT, but it is still not allowed when = the option is not supposed to be used. I posted a similar patch [1], and Fujii-san expressed the same opinion = as you. So, let me withdraw both patches for now. [1] = https://www.postgresql.org/message-id/CD33AC99-0175-4AD9-A33F-88E57736DA8E= %40gmail.com Best regards, -- Chao Li (Evan) HighGo Software Co., Ltd. https://www.highgo.com/