Hello
I have made some deeper investigation:
Steps to reproduce:
```
docker pull ubuntu:18.04 && docker run -it --rm ubuntu:18.04 bash
## or
docker pull ubuntu:20.04 && docker run -it --rm ubuntu:20.04 bash
## or
docker pull ubuntu:22.04 && docker run -it --rm ubuntu:22.04 bash
apt-get update
apt-get install -y vim strace less curl ca-certificates gnupg sudo lsb-release
curl
https://www.postgresql.org/media/keys/ACCC4CF8.asc | gpg --dearmor | sudo tee /etc/apt/
trusted.gpg.d/
apt.postgresql.org.gpg >/dev/null
sh -c 'echo "deb
http://apt.postgresql.org/pub/repos/apt $(lsb_release -cs)-pgdg main" > /etc/apt/
sources.list.d/
pgdg.list'
apt-get update
apt-get install -y postgresql-12
pg_ctlcluster 12 main start
sudo -u postgres -i
psql
CREATE DATABASE database_name;
CREATE USER my_username WITH PASSWORD 'my_password';
GRANT ALL PRIVILEGES ON DATABASE "database_name" to my_username;
exit
echo '*:*:*:my_username:my_password' > .pgpass
chmod 0600 .pgpass
exit
##
## this does not work for ubuntu 18.04 but for ubuntu 20.04/22.04
##
/usr/bin/sudo -u postgres psql -U my_username -h
127.0.0.1 database_name -c "CREATE TABLE foo (foo char);"
##
## this works for all
##
sudo -u postgres -i
psql -U my_username -h
127.0.0.1 database_name -c "CREATE TABLE foo (foo char);"
```
We have narrowed it down to three packages which have been upgraded on ubuntu 18.04 between working and broken state:
- `libpq5` upgraded from `14.5-1.pgdg18.04+1` to `15.0-1.pgdg18.04+1`
- `postgresql-client-common` and `postgresql-common` from `243.pgdg18.04+1` to `244.pgdg18.04+1`
None other packages have been upgraded (incl. ubuntu repo packages)!
For me it does look like a bug with in psql client package.
regards
Mike
--
Diese Nachricht wurde von meinem Android Mobiltelefon mit GMX Mail gesendet.