"there is no parameter $1" for named queries with numeric parameters
Affects | Status | Importance | Assigned to | Milestone | |
---|---|---|---|---|---|
pgcli (Ubuntu) |
New
|
Undecided
|
Unassigned |
Bug Description
If a named query has positional parameters (with $1, $2, and so on), attempting to use it just gives the error message “there is no parameter $1”, the same as if no argument had been provided for that query.
Documentation of how the feature is supposed to work:
https:/
Example:
postgres> \ns i SELECT $1
Saved.
Time: 0.003s
postgres> \n i 42
there is no parameter $1
LINE 1: SELECT $1
It does work using %s instead of $1, but that isn't documented, and doesn't allow for re-ordering parameters or using one multiple times.
This broke on upgrading Ubuntu to 20.04 LTS (from 16.04), which has pgcli version 2.2.0. Existing named queries that I had saved in my config and which had previously worked started giving the above error message.
Update: This is caused by an insufficiently recent pgspecial Python library.
pgcli requires pgspecial 1.10 or newer for $1 placeholders to work properly. The current pgspecial release is 1.11.10.
Ubuntu's python3-pgspecial package is only 1.9.0-2, from 2017 October — in both Ubuntu 20.04 and currently in the repository for 20.10.
The pgcli package in 20.04 has pgcli version 2.2.0, from 2019 December.
pgcli and pgspecial come from the same GitHub organization. The problem basically is having a recent pgcli and an old pgspecial.