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 1r7I9v-004rWO-EO for pgsql-hackers@arkaria.postgresql.org; Sun, 26 Nov 2023 16:39:04 +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 1r7I9t-008oSS-TV for pgsql-hackers@arkaria.postgresql.org; Sun, 26 Nov 2023 16:39:01 +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.94.2) (envelope-from ) id 1r7I9t-008oSK-Gi for pgsql-hackers@lists.postgresql.org; Sun, 26 Nov 2023 16:39:01 +0000 Received: from forward101b.mail.yandex.net ([178.154.239.148]) by makus.postgresql.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.94.2) (envelope-from ) id 1r7I9p-007T9f-L1 for pgsql-hackers@lists.postgresql.org; Sun, 26 Nov 2023 16:39:00 +0000 Received: from mail-nwsmtp-smtp-production-main-77.iva.yp-c.yandex.net (mail-nwsmtp-smtp-production-main-77.iva.yp-c.yandex.net [IPv6:2a02:6b8:c0c:c008:0:640:847d:0]) by forward101b.mail.yandex.net (Yandex) with ESMTP id BA2C060A90; Sun, 26 Nov 2023 19:38:52 +0300 (MSK) Received: by mail-nwsmtp-smtp-production-main-77.iva.yp-c.yandex.net (smtp/Yandex) with ESMTPSA id ncVUdNdOpSw0-u3f3yW2M; Sun, 26 Nov 2023 19:38:52 +0300 X-Yandex-Fwd: 1 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=yandex.ru; s=mail; t=1701016732; bh=D9+buRSldA7qGToaDf72tv6hm5O2nQTLjqpXChS1K90=; h=From:In-Reply-To:Cc:Date:References:To:Subject:Message-ID; b=vPZx0J9RfP1m5UFUqF36KoyM8qj3TlrbYFmanYqIGGp5tG7fiuYSr+8lGx5RJph2F g40HvJLw2tUWa2O2IQ6JMcKNAhbMrxHwdV4/LqBbMBB5AhdMR7+GZUzeB19vudw6eG nvkR3WJbAvS/KOyQvu4muDxuHleQnyJDA6vg/dAM= Authentication-Results: mail-nwsmtp-smtp-production-main-77.iva.yp-c.yandex.net; dkim=pass header.i=@yandex.ru Message-ID: <2b9c6c1f-d5fc-cc29-c387-95abb815d12d@yandex.ru> Date: Sun, 26 Nov 2023 19:38:49 +0300 MIME-Version: 1.0 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:102.0) Gecko/20100101 Thunderbird/102.13.0 Subject: Re: WIP: libpq: add a possibility to not send D(escribe) when executing a prepared statement Content-Language: en-US To: "Andrey M. Borodin" Cc: pgsql-hackers@lists.postgresql.org References: <82c438b4-d91c-9009-65fc-593124d5a277@yandex.ru> <6E9981D0-F66B-4102-8D6E-E85C7F2BD77B@yandex-team.ru> From: Ivan Trofimov In-Reply-To: <6E9981D0-F66B-4102-8D6E-E85C7F2BD77B@yandex-team.ru> Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 7bit List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Archived-At: Precedence: bulk >> In a presumably very common case of repeatedly executing the same statement, this leads to >> both client and server parsing/sending exactly the same RowDescritpion data over and over again. >> Instead, library user could acquire a statement result RowDescription once (via PQdescribePrepared), >> and reuse it in subsequent calls to PQexecPrepared and/or its async friends. > But what if query result structure changes? Will we detect this error gracefully and return correct error? Afaik changing prepared statement result structure is prohibited by Postgres server-side, and should always lead to "ERROR: cached plan must not change result type", see src/test/regress/sql/plancache.sql. So yes, from the libpq point of view this is just an server error, which would be given to the user, the patch shouldn't change any behavior here. The claim about this always being a server-side error better be reassured from someone from the Postgres team, of course.