BUG #19562: pgcli packaged by the PostgreSQL Yum Repository:ModuleNotFoundError: No module named 'pgspecial'

From: PG Bug reporting form <noreply(at)postgresql(dot)org>
To: pgsql-bugs(at)lists(dot)postgresql(dot)org
Cc: pritt1999(at)gmail(dot)com
Subject: BUG #19562: pgcli packaged by the PostgreSQL Yum Repository:ModuleNotFoundError: No module named 'pgspecial'
Date: 2026-07-21 06:41:32
Message-ID: 19562-9d41f689d05188c3@postgresql.org
Views: Whole Thread | Raw Message | Download mbox | Resend email
Thread:
Lists: pgsql-bugs

The following bug has been logged on the website:

Bug reference: 19562
Logged by: Pritt Balagopal
Email address: pritt1999(at)gmail(dot)com
PostgreSQL version: 18.4
Operating system: Fedora 44
Description:

This bug report does not apply to PostgreSQL 18.4, nor to pgcli either.
Rather, it concerns the specific methodology by which pgcli is packaged for
distribution within the PostgreSQL Yum Repository.

How to reproduce the bug:

Create the Fedora 44 container environment using Podman (Docker is also
applicable here, the commands work the same way):

```
podman create -it --name fedora44 quay.io/fedora/fedora:44 /bin/bash
```

Run the Fedora 44 container environment, and enter its shell:

```
podman start -ai fedora44
```

Within the shell, run a quick `dnf update` and then proceed to import the
PostgreSQL yum repository as outlined in:
https://www.postgresql.org/download/linux/redhat/

```
dnf install
https://download.postgresql.org/pub/repos/yum/reporpms/F-44-x86_64/pgdg-fedora-repo-latest.noarch.rpm
```

Now, install pgcli:

```
dnf install pgcli
```

You should see dnf prompting you for confirmation with the pgcli being
sourced from `pgdg-common`. Accept and import GPG keys as prompted:

```
Package Arch
Version
Repository Size
Installing:
pgcli
noarch 0:4.3.0-2PGDG.f44
pgdg-common 60.3 KiB
Installing dependencies:
expat
x86_64 0:2.8.1-1.fc44
updates 327.4 KiB
mpdecimal
x86_64 0:4.0.1-3.fc44
fedora 217.1 KiB
python-pip-wheel
noarch 0:26.0.1-2.fc44
fedora 1.2 MiB
python3
x86_64 0:3.14.6-1.fc44
updates 28.7 KiB
python3-cli-helpers
noarch 0:2.2.1-2.f44
pgdg-common 115.2 KiB
python3-cli-helpers+styles
noarch 0:2.2.1-2.f44
pgdg-common 0.0 B
python3-click
noarch 1:8.3.3-1.fc44
updates 1.2 MiB
python3-configobj
noarch 0:5.0.9-9.fc44
fedora 399.3 KiB
python3-humanize
noarch 0:4.15.0-2.fc44
fedora 231.5 KiB
python3-jedi
noarch 0:0.19.2-10.fc44
fedora 5.6 MiB
python3-libs
x86_64 0:3.14.6-1.fc44
updates 43.9 MiB
python3-parso
noarch 0:0.8.5-3.fc44
fedora 900.7 KiB
python3-pgcli
noarch 0:4.3.0-2PGDG.f44
pgdg-common 637.8 KiB
python3-pygments
noarch 0:2.19.1-9.fc44
fedora 11.3 MiB
python3-setproctitle
x86_64 0:1.3.7-4.fc44
fedora 41.7 KiB
python3-sqlparse
noarch 0:0.5.3-4.fc44
fedora 386.3 KiB
python3-tabulate
noarch 0:0.9.0-19.fc44
fedora 347.1 KiB
python3-tabulate+widechars
noarch 0:0.9.0-19.fc44
fedora 0.0 B
python3-terminaltables
noarch 0:3.1.10-20.fc44
fedora 94.7 KiB
python3-wcwidth
noarch 0:0.6.0-1.fc44
fedora 470.6 KiB
Installing weak dependencies:
python-unversioned-command
noarch 0:3.14.6-1.fc44
updates
```

Once the installation is complete, invoke the `pgcli` executable and you
will be met with an error:

```
Traceback (most recent call last):
File "/usr/bin/pgcli", line 3, in <module>
from pgcli.main import cli
File "/usr/lib/python3.14/site-packages/pgcli/main.py", line 3, in
<module>
from pgspecial.namedqueries import NamedQueries
ModuleNotFoundError: No module named 'pgspecial'
```

The fact that this module is not imported by default when `pgcli` is
packaged for RPM is not the expected behavior. However, even if one were to
bypass this limitation by manually installing the `pgspecial` python module
via:

```
dnf install python3-pgspecial
```

This still does not solve the problem of using `pgcli` as packaged by the
PostgreSQL Yum repository:

```
Traceback (most recent call last):
File "/usr/bin/pgcli", line 3, in <module>
from pgcli.main import cli
File "/usr/lib/python3.14/site-packages/pgcli/main.py", line 23, in
<module>
from cli_helpers.tabular_output.preprocessors import (
...<3 lines>...
)
ImportError: cannot import name 'format_timestamps' from
'cli_helpers.tabular_output.preprocessors'
(/usr/lib/python3.14/site-packages/cli_helpers/tabular_output/preprocessors.py)
```

Note. This is NOT a bug within `pgcli` itself. Rather, this is a bug in the
packaging of `pgcli` within the PostgreSQL Yum repository. We can verify
this by installing `pgcli` from Fedora official repositories instead of
`pgdg-common`. To do this, delete the previous container and begin anew.
This time, do not import the PostgreSQL Yum Repository:

```
dnf install pgcli
```

```
Package Arch
Version
Repository Size
Installing:
pgcli
noarch 0:4.5.0-1.fc44
updates 649.9 KiB
Installing dependencies:
expat
x86_64 0:2.8.1-1.fc44
updates 327.4 KiB
libpq
x86_64 0:18.0-4.fc44
fedora 1.0 MiB
mpdecimal
x86_64 0:4.0.1-3.fc44
fedora 217.1 KiB
python-pip-wheel
noarch 0:26.0.1-2.fc44
fedora 1.2 MiB
python3
x86_64 0:3.14.6-1.fc44
updates 28.7 KiB
python3-cli-helpers
noarch 0:2.10.1-1.fc44
fedora 129.6 KiB
python3-cli-helpers+styles
noarch 0:2.10.1-1.fc44
fedora 0.0 B
python3-click
noarch 1:8.3.3-1.fc44
updates 1.2 MiB
python3-configobj
noarch 0:5.0.9-9.fc44
fedora 399.3 KiB
python3-libs
x86_64 0:3.14.6-1.fc44
updates 43.9 MiB
python3-pgspecial
noarch 0:2.2.1-7.fc44
fedora 363.8 KiB
python3-prompt-toolkit
noarch 0:3.0.52-2.fc44
fedora 4.2 MiB
python3-psycopg3
noarch 0:3.3.4-1.fc44
updates 2.0 MiB
python3-pygments
noarch 0:2.19.1-9.fc44
fedora 11.3 MiB
python3-setproctitle
x86_64 0:1.3.7-4.fc44
fedora 41.7 KiB
python3-sqlparse
noarch 0:0.5.3-4.fc44
fedora 386.3 KiB
python3-tabulate
noarch 0:0.9.0-19.fc44
fedora 347.1 KiB
python3-tabulate+widechars
noarch 0:0.9.0-19.fc44
fedora 0.0 B
python3-terminaltables
noarch 0:3.1.10-20.fc44
fedora 94.7 KiB
python3-tzlocal
noarch 0:5.3.1-6.fc44
fedora 125.3 KiB
python3-wcwidth
noarch 0:0.6.0-1.fc44
fedora 470.6 KiB
Installing weak dependencies:
python-unversioned-command
noarch 0:3.14.6-1.fc44
updates
```

Once the installation of pgcli from Fedora packaging has completed, invoking
the command `pgcli` shows the expected response:

```
connection is bad: connection to server on socket
"/var/run/postgresql/.s.PGSQL.5432" failed: No such file or directory
Is the server running locally and accepting connections on that
socket?
```

Browse pgsql-bugs by date

  From Date Subject
Next Message Andrey Borodin 2026-07-21 09:55:11 Re: Two bugs around ALTER TYPE
Previous Message surya poondla 2026-07-20 21:24:48 Re: Two bugs around ALTER TYPE