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 1w0RZL-001uXl-2P for pgsql-hackers@arkaria.postgresql.org; Wed, 11 Mar 2026 21:58:19 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.96) (envelope-from ) id 1w0RZJ-00C8UZ-08 for pgsql-hackers@arkaria.postgresql.org; Wed, 11 Mar 2026 21:58:17 +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 1w0RZI-00C8UR-2O for pgsql-hackers@lists.postgresql.org; Wed, 11 Mar 2026 21:58:17 +0000 Received: from mail-dl1-x1233.google.com ([2607:f8b0:4864:20::1233]) by magus.postgresql.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256 (Exim 4.98.2) (envelope-from ) id 1w0RZG-00000002Cf1-4ByN for pgsql-hackers@lists.postgresql.org; Wed, 11 Mar 2026 21:58:16 +0000 Received: by mail-dl1-x1233.google.com with SMTP id a92af1059eb24-12732165d1eso460665c88.1 for ; Wed, 11 Mar 2026 14:58:14 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1773266293; cv=none; d=google.com; s=arc-20240605; b=g99yReIglpDYzSXQUoOrLu0TKIM5HLu/NUGANDqoVQusjqsBN8xNOoyA2E7zz22fHf Ko4viImhmAKIUsd5C1WmI7RYvLEvTG6hui8/s631/jHCBl9T8gmIEiAI+ia9W6TEybWc bouv+TWmjtb8v0/5vI8Kek1UX4PPdpejlj08P5tgfYaCrsJnJKSzeqDHDIOCgCsxECr/ 8c0gMrJJHg7fct20ctZXMR6rRjjzIGyFHnSlEAMrM++IAA/4YAh+Y265B8VmHLb/d757 BNgUJ8I5updMyVYKi6VMXO1wHFMaSJ2nzNUDjq6wlh0q9dUlTFXbv7HHjKXvRwxGPDeQ kswA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20240605; h=content-transfer-encoding:cc:to:subject:message-id:date:from :in-reply-to:references:mime-version:dkim-signature; bh=9j6whEeaYNFBV2L5Y2T6/jkPZtw4zXNNC8owpHFPO2k=; fh=d1h2PcRUmSq8fmvqT2SpiZbYECSefipyGPHLB2U1K5s=; b=hKTJ2uDIKCQge9qrjZ4pR/G5dEtGuKxOWFrvj6MofaCbFZsjgTMJBsFCCq+pn+6tIz Sd3Lbt49Z42JrRTbZQdkxvuwJna8Tbk3EEqVUpu8CYxMB5vlWKbsegnycV/txRWIj8Un 5TohAZ65qNDTdzlvKC6BV49EBX9fllyRpQdmXPvkgHa8iQgynaSzlnkh9L0wdIkjLTgI g+JtD9T79rGUFbkgDJP4MleRbPPAYTY8cLe5bWKSecaRMz1ARmUZyreB5Vv0EYuq0q3m aV7UdtLMV+4sYpvkV9qa9qCUp2Ii6bJQR53tn7hlQOpf6Hi63RPhgBfHEIWFoShJLlUN N5lg==; 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=postgres.ai; s=google; t=1773266293; x=1773871093; 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=9j6whEeaYNFBV2L5Y2T6/jkPZtw4zXNNC8owpHFPO2k=; b=Kt4daHxveyXcCIYCwL00l4bZY77jTqha+VpnbXUvVygPb1uiI2u5gMAJm2G2cKkhN/ CW08bgs2+TxIHHA/UwvqAuXqVaCqmxHs0h5I6BPize5EkvKrKu79fFMtT6jkPO3loNbH 1PKDMu+X7yxlT74ilFIggcJEVFdpwvod44QuLZ3F0hyhO3UjGT7fuFr7b7szjVxh+qWB xpJ+QZEaCCHoSZ4t72adWZcopPdV8M7gFLUConUr9Irfx7vmMlEgWuzJIWRLMFxb9GkL GyYvFBJY7BC5z2rlyejC+pIrkvw5BWDmcb35mH56GLZMF5aZDPvSlZ4Au9lwuc0AvZHN OOwQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1773266293; x=1773871093; 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=9j6whEeaYNFBV2L5Y2T6/jkPZtw4zXNNC8owpHFPO2k=; b=GgyUa35i+w8zluSyeFy5db38+28/4yYDGHJirBJM2kY7l8ogtY1v6c5Bd9KCqI6J8o AQ+gqWFmTOydxraKk0LzwTJ57PDrxJwASA4Cly52IYdqCS2h4rQqeq8jff2MlAZRPLeH z5AGFACdVMKtIcV6uebeBG397UYakMnMSkLXbYjOUmEKT4WeCxSE1iU0LT+NYEDi3U8I mGHYhYQFjjLLVCz5nZTb6Sms3yWOfPI/wcK95GC9qEH61FxNtKZwwy/eixtnX7yq6gPa hFMstXi1JS5tw/0fVNIV2ZjuaTqEHhxvxLTIY13UPDGBLOm6X++S2OU3ot0Ey3NblZSq JI/A== X-Gm-Message-State: AOJu0Yw0HWAkg1boNgeB1Th2++J3ehlLSfjgLh6qpNvoipDJCmBX43eG 0VAs/aH/Z7CI2F3T1uT2hiCmzJ+pLhZYftN2B+wb23vceq9xhs26BPrWmcOQ6nfFqs9eoj/O2f5 Y0cNzE0iAYn5CG2rfAemj4HwkOJ8FFEWzw4ljJaUerQ== X-Gm-Gg: ATEYQzzmRXU0DfLlV2KjkzHXXH9yDShN73wkNRl/Mi7YKcvPJ0c9foRhvJ4q2x+GoBw dCTnFGOr8jLvbZYBoFOGAbKALyb3VxRCZ5x/q0WAkIwZmzZmVm6XoBGYGyYlS//nXA3PsIp49zv 9Cceza4M6sSTzXE1MXrhCPjxPDPEgkEB6vV6tSIMVu5wtJEQerBNV5I7GaCnH7t9aiXCf2A2BgD cFWYAWF6kE/8vVOX0sye7zmCN/VYUhvRZ+/FvRZSh1Qq0ESBlrt+QxqTzLlEqSg1EDeQqIaLGCJ 0jUNsUXe X-Received: by 2002:a05:7022:497:b0:128:cf75:42a3 with SMTP id a92af1059eb24-128e78184f8mr1856876c88.21.1773266293083; Wed, 11 Mar 2026 14:58:13 -0700 (PDT) MIME-Version: 1.0 References: In-Reply-To: From: Nikolay Samokhvalov Date: Wed, 11 Mar 2026 14:58:02 -0700 X-Gm-Features: AaiRm52EzEkey63hF6PuuFUL5VhHnJPyyM3rzeMuliDvVHeFA0VeC9UibRvvwGQ Message-ID: Subject: =?UTF-8?Q?Re=3A_=5BPATCH_v1=5D_command=5Ftag=5Fformat_=E2=80=94_protocol=2Dlevel?= =?UTF-8?Q?_command_tag_negotiation_via_=5Fpq=5F?= To: Andres Freund Cc: pgsql-hackers@lists.postgresql.org, wolakk@gmail.com, amborodin86@gmail.com 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 Wed, Mar 11, 2026 at 2:39=E2=80=AFPM Andres Freund = wrote: > > Hi, > > On 2026-03-11 21:22:14 +0000, nik@postgres.ai wrote: > > PostgreSQL has had a protocol feature negotiation framework since > > 7.4 (the _pq_ namespace in startup parameters) -- over 20 years -- > > but it's never been used in practice. > > Wasn't that added in > > commit ae65f6066dc > Author: Robert Haas > Date: 2017-11-21 13:56:24 -0500 > > Provide for forward compatibility with future minor protocol versions= . > > Previously, any attempt to request a 3.x protocol version other than > 3.0 would lead to a hard connection failure, which made the minor > protocol version really no different from the major protocol version > and precluded gentle protocol version breaks. Instead, when the > client requests a 3.x protocol version where x is greater than 0, sen= d > the new NegotiateProtocolVersion message to convey that we support > only 3.0. This makes it possible to introduce new minor protocol > versions without requiring a connection retry when the server is > older. > > PG 14 / 2017 is quite a while after 7.4... Right, I confused it, _pq_ namespace reserved long, long ago, but the actual NegotiateProtocolVersion mechanism is from 2017 indeed. My bad. > > legacy - INSERT 0 N (default, fully backward compatible) > > verbose - INSERT tablename N > > fqn - INSERT schema.tablename N > > Pretty doubtful this survives the complexity / gain tradeoff. > > > > Separately, doing extra work during command handling isn't free either. W= e've > spent a decent amount of effort in the past lowering it, see e.g. > > commit ac998020802 > Author: David Rowley > Date: 2022-12-16 10:31:25 +1300 > > Speed up creation of command completion tags > > > I'm loathe to add work to every statement. On performance: the extra work (relname lookup) only runs when a client explicitly opts in. The default legacy path adds just one integer comparison, so almost nothing. The two new QueryCompletion pointers are initialized to NULL and never touched in legacy/default mode. That said, this was meant purely as a discussion starter -- is pq the right mechanism for per-connection feature negotiation like this, or would something else be preferred? For example, when restoring from a large dump, we see a lot of "INSERT 0 N" emitted =E2=80=93 that's not super convenient. If pg_dump would use th= is (and I think, in this case the overhead would be really acceptable), then we would see something like "INSERT tblname N", understanding what table already received data. Nik