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 1wVcdE-0025Tw-34 for pgsql-hackers@arkaria.postgresql.org; Fri, 05 Jun 2026 22:03:12 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.96) (envelope-from ) id 1wVcdD-00EyEU-1c for pgsql-hackers@arkaria.postgresql.org; Fri, 05 Jun 2026 22:03:11 +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 1wVcdD-00EyEK-0R for pgsql-hackers@lists.postgresql.org; Fri, 05 Jun 2026 22:03:11 +0000 Received: from mail-oi1-x22d.google.com ([2607:f8b0:4864:20::22d]) by makus.postgresql.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256 (Exim 4.98.2) (envelope-from ) id 1wVcdB-00000001IvR-1aah for pgsql-hackers@postgresql.org; Fri, 05 Jun 2026 22:03:10 +0000 Received: by mail-oi1-x22d.google.com with SMTP id 5614622812f47-4865b9e16d4so883157b6e.1 for ; Fri, 05 Jun 2026 15:03:09 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20251104; t=1780696987; x=1781301787; darn=postgresql.org; h=in-reply-to:content-disposition:mime-version:references:message-id :subject:cc:to:from:date:from:to:cc:subject:date:message-id:reply-to; bh=MJnrGXDCbizwIKVRLyp5H6bqR+4tbhkgeJXwE3rHwFA=; b=QmOMXRYSzKNMXknlzYHThhWPhhC3wQUbFp7L5JDvOhPfmLXSnNL7PH4yOhCwnDs5bs FUVd7dNxZtG5lBTj24cFQVDw9W3O4+T9sXVvh6o6jPGvigG9SlBBYK/F6Ms1fc83KI5l 6k9D/yuuk96E8FqpSNlTCMKIPbHLfHVdMf8Z1Jq0ZKI+R2jh7rCBW3Q++IfzSgOnIUkF fS2LQI/oPayiLnqgdUUSbEAqmY7HG+1fmB0vQEj7kwq0Ja2AmS/P9eUlA0OTlmmV/rZl B10IvMGKupLPwfGRUqDfexV+7Ek7KkQjxiOspCTBNhD+9QiqO4nhGGmM/7li9d2KTDHP AkJA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20251104; t=1780696987; x=1781301787; h=in-reply-to:content-disposition:mime-version:references:message-id :subject:cc:to:from:date:x-gm-gg:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=MJnrGXDCbizwIKVRLyp5H6bqR+4tbhkgeJXwE3rHwFA=; b=rftXYviKZ54Z0OTf94c/YUM6XJYtnEhNbYjmKNEl7oD7xZkdWg5U/NVw3LIal5F+hb 7l8b0Vpp+grkx96BZh8iPTlXSyKfjOoing2KnkgTEl+L6kJfhUw+r1yyjKsZYEiZkGZ4 VqezYf0hEjQWYfkVVZW5PHSzb9z/WTnZLCgdDbadXDa5gU4raRdYzUw30ywT+qgHVbQQ FlQEbCj1gRcz3xwpnQemfxTzYWR1ujQX7P3y6CZfyHGxZV0Mw8ydZHZMzRBCVwSLaKLJ w7Of6cHidkEQrUsugSU5nBxWaPM1iIo7Ho9JkX3dBV9fBugJcDK1RDh0fhNftrBH2Ayp O/yg== X-Forwarded-Encrypted: i=1; AFNElJ+AkxvoeeWI/mdJcxdY+TeF7tM0oZE8071Lj7YAwm4HSpbNztKNqFxCm97tcSPkQ8YMja1NJFheVbISgyWl@postgresql.org X-Gm-Message-State: AOJu0YwwQkS7R2l9o3vHppS7O2MN1h3xQSZaKa8gs53UfBZ5NBxDZCC/ yGQx/aoZpqvtk9koVIx5Gt60LFgW1maCZZNYWyNmKrLBsuTc7foq/G0F X-Gm-Gg: Acq92OFqiCJaRJI9uWePza2rJ9sOnRPdyK/J7VV4mCcx7WLxq/Jysd8KLaVsTr8jjM3 QrbTo9294WaYjiWfzQNx/bJr5AZWhw9MLe3IuY5pzZJ7lkzaRVf9MKc/5IvuPwfEMhKGRlTSJoj CQ7XHPL34buMXJDPDDBAv/LBM9mcxqOBTVChD3G3b4eUnSUHXO7GV9X7G+rfBAnPbrAH/ffniwM gOIOnehYuvsTC9A+gJ8Pnr546mJYKlHv3EHJq24EWTAXYHDnamLQSenCnw1zO8XCTZmPYq0FvP8 pTFv5mkWnvzUt+RkvZSDy4QcafJqsbiyU8jBnz3+G0KmygBqlBwPinHhMCYim1x76qszYKgYUBj gRZCLUzYj4THHQTMSRdiUtnlIpzkLm0AH2z6+k4o46XwiTZr4ianpf2HUrOvuoCbzYKgWrMDjL9 xKW68hk1cOMgykmjz3R7MCxLD1lxsXmHGqmUePmixHacFXFhBP04wC9B1RTeuzIFyjB1LqZz4sk BYEhsF1QT69tFWE0nU3yuXbbBoSC1p8 X-Received: by 2002:a05:6808:d50:b0:46a:c987:ba00 with SMTP id 5614622812f47-4868df01eebmr3248469b6e.32.1780696987313; Fri, 05 Jun 2026 15:03:07 -0700 (PDT) Received: from nathan (162-195-168-172.lightspeed.stlsmo.sbcglobal.net. [162.195.168.172]) by smtp.gmail.com with ESMTPSA id 586e51a60fabf-440d7b79b7asm8693893fac.2.2026.06.05.15.03.06 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 05 Jun 2026 15:03:06 -0700 (PDT) Date: Fri, 5 Jun 2026 17:03:05 -0500 From: Nathan Bossart To: Jelte Fennema-Nio Cc: Jacob Champion , pgsql-hackers@postgresql.org Subject: Re: alert clients when prepared statements are deallocated Message-ID: References: MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Archived-At: Precedence: bulk On Fri, Jun 05, 2026 at 11:34:14AM +0200, Jelte Fennema-Nio wrote: > I think I like option 2 best (and after that 1). I'm often annoyed > that our application layer and protocol layer is so intertwined, so > any attempt to separate them is a welcome addition in my opinion. > > One approach would be to: > 1. add an optional additional text field to the Parse message as a > kind of "namespace" for prepared statements. Leaving this field out or > set to the empty string, would create an "application-level" prepared > statement. Setting it to anything else would create a protocol-level > prepared statement within that namespace. This would allow libpq to > create its own prepared statements, without conflicting with > protocol-level statements created by client libraries like psycopopg. > 2. Application-level DISCARD/DEALLOCATE would not clean up these > namespaced protocol level prepared statements > 3. Add a protocol-level version of DEALLOCATE ALL and DISCARD ALL > which also clean up all the protocol-level prepared statements > 4. Add a protocol-level message to deallocate all prepared statements > in a certain schema. Do we need to guard who can create protocol-level statements? And if so, how would we do that? -- nathan