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

From: Laurenz Albe <laurenz(dot)albe(at)cybertec(dot)at>
To: paul(dot)deaudney(at)safetyculture(dot)com, 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 07:58:00
Message-ID: 96b08d4083eb2a5fd39f7b71d34f963aefcabf3c.camel@cybertec.at
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-bugs

On Mon, 2023-07-17 at 12:25 +1000, Paul De Audney wrote:

> We have other queries logging the same error on a different database on the same server infrastructure using golang based connection pools/drivers (jackc/pgx).
>
> 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)
>
> This query does work when re-run exactly as shown there.

To determine if that is a bug in PostgreSQL or the PostgreSQL driver, please reproduce
the problem on a test system with "log_min_duration_statement = 0" and show all relevant
parts of the log file.

Yours,
Laurenz Albe

In response to

Browse pgsql-bugs by date

  From Date Subject
Next Message Michael Paquier 2023-07-17 07:59:53 Re: The same 2PC data maybe recovered twice
Previous Message Laurenz Albe 2023-07-17 07:53:32 Re: BUG #18025: Probably we need to change behaviour of the checkpoint failures in PG