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

From: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
To: paul(dot)deaudney(at)safetyculture(dot)com, Paul De Audney <paul(dot)deaudney(at)safetyculture(dot)io>
Cc: pgsql-bugs(at)lists(dot)postgresql(dot)org
Subject: Re: Query returns error "there is no parameter $1" but server logs that there are two parameters supplied
Date: 2023-07-17 13:45:26
Message-ID: 4011573.1689601526@sss.pgh.pa.us
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-bugs

Paul De Audney <paul(dot)deaudney(at)safetyculture(dot)io> writes:
> 2023-07-17 01:39:20.265 UTC [1857486] user(at)db_name ERROR: there is no
> parameter $1 at character 24
> 2023-07-17 01:39:20.265 UTC [1857486] user(at)db_name CONTEXT: unnamed portal
> with parameters: $1 = 'template_31f98dcda25c482eb0b086a0081d28a8', $2 =
> 'template_31F98DCDA25C482EB0B086A0081D28A8'
> 2023-07-17 01:39:20.265 UTC [1857486] user(at)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

In response to

Responses

Browse pgsql-bugs by date

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