Re: Query returns error "there is no parameter $1" but server logs that there are two parameters supplied - Mailing list pgsql-bugs

From Tom Lane
Subject Re: Query returns error "there is no parameter $1" but server logs that there are two parameters supplied
Date
Msg-id 4011573.1689601526@sss.pgh.pa.us
Whole thread Raw
In response to Query returns error "there is no parameter $1" but server logs that there are two parameters supplied  (Paul De Audney <paul.deaudney@safetyculture.io>)
Responses Re: Query returns error "there is no parameter $1" but server logs that there are two parameters supplied
List pgsql-bugs
Paul De Audney <paul.deaudney@safetyculture.io> 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



pgsql-bugs by date:

Previous
From: "suyu.cmj"
Date:
Subject: Re: The same 2PC data maybe recovered twice
Next
From: PG Bug reporting form
Date:
Subject: BUG #18026: compile error / fe-auth.c:807:64: error: 'CHAR_BIT' undeclared (first use in this function)