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 1qLOXf-0030N6-1d for pgsql-bugs@arkaria.postgresql.org; Mon, 17 Jul 2023 13:45:35 +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 1qLOXb-009oo8-S6 for pgsql-bugs@arkaria.postgresql.org; Mon, 17 Jul 2023 13:45:31 +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.94.2) (envelope-from ) id 1qLOXb-009oo0-KK for pgsql-bugs@lists.postgresql.org; Mon, 17 Jul 2023 13:45:31 +0000 Received: from sss.pgh.pa.us ([66.207.139.130]) by magus.postgresql.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.94.2) (envelope-from ) id 1qLOXY-0014V6-Qe for pgsql-bugs@lists.postgresql.org; Mon, 17 Jul 2023 13:45:31 +0000 Received: from sss1.sss.pgh.pa.us (localhost [127.0.0.1]) by sss.pgh.pa.us (8.15.2/8.15.2) with ESMTP id 36HDjQrA4011574; Mon, 17 Jul 2023 09:45:26 -0400 From: Tom Lane To: paul.deaudney@safetyculture.com, Paul De Audney cc: pgsql-bugs@lists.postgresql.org Subject: Re: Query returns error "there is no parameter $1" but server logs that there are two parameters supplied In-reply-to: References: Comments: In-reply-to Paul De Audney message dated "Mon, 17 Jul 2023 12:25:05 +1000" MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-ID: <4011572.1689601526.1@sss.pgh.pa.us> Date: Mon, 17 Jul 2023 09:45:26 -0400 Message-ID: <4011573.1689601526@sss.pgh.pa.us> List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Archived-At: Precedence: bulk Paul De Audney writes: > 2023-07-17 01:39:20.265 UTC [1857486] user@db_name ERROR: there is no > parameter $1 at character 24 > 2023-07-17 01:39:20.265 UTC [1857486] user@db_name CONTEXT: unnamed portal > with parameters: $1 = 'template_31f98dcda25c482eb0b086a0081d28a8', $2 = > 'template_31F98DCDA25C482EB0B086A0081D28A8' > 2023-07-17 01:39:20.265 UTC [1857486] user@db_name STATEMENT: > SELECT templates.id, templates.rev, templates.json, > meta.template_data as meta_template_data, meta.date_draft_modified, > meta.draft_author_name > FROM templates > LEFT JOIN templates_meta as meta > ON templates.id = meta.id > WHERE (templates.id = $1 OR templates.id = $2) "character 24" is not anywhere near where the $1 symbol is in that query string, so I'm betting that this error does not refer to the outer client-submitted query but to some plpgsql or sql function that is getting invoked along the way. Since you've provided exactly no context for this log snippet, it's hard to speculate further than that. (And yeah, if that is how such a problem gets logged then I agree we could stand to work on providing better error context. But again, without a reproducible test case it's hard to make any progress.) regards, tom lane