Received: from malur.postgresql.org ([217.196.149.56]) by arkaria.postgresql.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA1:256) (Exim 4.89) (envelope-from ) id 1ixZpK-0000Y7-EZ for pgsql-bugs@arkaria.postgresql.org; Fri, 31 Jan 2020 17:11:30 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.89) (envelope-from ) id 1ixZpH-0004xi-Hx for pgsql-bugs@arkaria.postgresql.org; Fri, 31 Jan 2020 17:11:27 +0000 Received: from magus.postgresql.org ([2a02:c0:301:0:ffff::29]) by malur.postgresql.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA1:256) (Exim 4.89) (envelope-from ) id 1ixZpH-0004vi-9n for pgsql-bugs@lists.postgresql.org; Fri, 31 Jan 2020 17:11:27 +0000 Received: from sss.pgh.pa.us ([66.207.139.130]) by magus.postgresql.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1ixZpE-0005j0-4j for pgsql-bugs@lists.postgresql.org; Fri, 31 Jan 2020 17:11:26 +0000 Received: from sss1.sss.pgh.pa.us (localhost [127.0.0.1]) by sss.pgh.pa.us (8.14.4/8.14.4) with ESMTP id 00VHBKTr001969; Fri, 31 Jan 2020 12:11:20 -0500 From: Tom Lane To: Jeff Janes cc: Ted Liu , "pgsql-bugs@lists.postgresql.org" Subject: Re: auto_explain logs ERROR: 08P01 for every query using bind variable In-reply-to: References: <1854294856.1773708.1580425497239.ref@mail.yahoo.com> <1854294856.1773708.1580425497239@mail.yahoo.com> Comments: In-reply-to Jeff Janes message dated "Fri, 31 Jan 2020 09:52:36 -0500" MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-ID: <1967.1580490679.1@sss.pgh.pa.us> Content-Transfer-Encoding: quoted-printable Date: Fri, 31 Jan 2020 12:11:19 -0500 Message-ID: <1968.1580490679@sss.pgh.pa.us> List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Precedence: bulk Jeff Janes writes: > On Fri, Jan 31, 2020 at 2:14 AM Ted Liu wrote: >> For performance and security, most of our queries use bind variables. W= e >> also implemented auto_explain for tracking down un-optimized queries. O= ur >> database supports a large application. During the work-hours, there are >> 30,000+ queries executed every hour. PostgreSQL logs rotates every hour= and >> each log contains 30,000+ error message like below. >> = >> 2020-01-27 00:00:03 UTC:xxx.xx.0.189(35556):xxxxxx@xxxxxxdb:[130756]:ER= ROR: >> ERROR: 08P01: bind message supplies 0 parameters, but prepared statemen= t >> "..." requires 1 >> 2020-01-27 00:00:03 UTC:xxx.xx.0.189(35558):xxxxxx@xxxxxxdb:[130756]:LO= CATION: >> exec_bind_message, postgres.c:1601 >> 2020-01-27 00:00:03 UTC:xxx.xx.0.189(35558):xxxxxx@xxxxxxdb:[130756]:ST= ATEMENT: >> EXPLAIN select ...,...,..,... from ... where ....=3D$1 > I agree they shouldn't be logged. And I don't get such messages when us= ing > auto_explain with something like `pgbench -M prepared`. Surely these are reporting a genuine client-side logic error. You need to fix your application, not complain about the fact that we're reporting that it's broken. (Note that auto_explain does NOT issue "EXPLAIN" commands; it works at a lower level than that. These EXPLAIN commands are coming from a client application.) If you really don't care to get log messages about incorrect queries, you could always set log_min_messages higher than ERROR ... regards, tom lane