zabbix / zabbix-docker

Official Zabbix Dockerfiles
https://www.zabbix.com
GNU Affero General Public License v3.0
2.4k stars 1.38k forks source link

PostgreSQL 17 support for zabbix-server-pgsql (all flavors) #1572

Open neothematrix opened 4 days ago

neothematrix commented 4 days ago

hello! I've just updated zabbix-server-pgsql container to zabbix 7.0.6 and I tried upgrading my postgresql from 16 to 17 (it's actually a postgres with timescaledb extension provided by timescaledb, but it shouldn't be too different).

After upgrading to Postgres 17, I'm not able to start zabbix-server-pgsql container anymore, with this error repeated in the container logs:

**** PostgreSQL server is not available. Waiting 5 seconds...

upon inspecting a little bit more, this is a message generated by the docker-entrypoint.sh when trying to test database availability:

psql --host ${DB_SERVER_HOST} --port ${DB_SERVER_PORT} --username ${DB_SERVER_ROOT_USER} --list

I tried manually executing that command and this is the output:

psql: ERROR: column d.daticulocale does not exist LINE 8: d.daticulocale as "ICU Locale", ^ HINT: Perhaps you meant to reference the column "d.datlocale".

I think the issue here is that all zabbix-server-pgsql images are still using "postgresql 16" client and possibly the "--list" command doesn't work properly with different DB versions.

I checked all the flavors (alpine, ubuntu and redhat) and they all show the same issue.

fibbs commented 1 day ago

Same here. Problem is that the postgresql CLIENT inside the image is still version 16.

dotneft commented 1 day ago

Sorry, how is it related to Zabbix Docker? The issue caused by PostgreSQL client. Please wait when fix will be available in OS distributions.

TriDvaRas commented 1 day ago

The error occurs when using old psql client with v17 server So the issue(?) is that official zabbix images are using psql 16

Manually bumping psql to match the version 17 fixes this

[~]$ psql -V
psql (PostgreSQL) 16.6
[~]$ psql -h  dbhostname  -p 5432 -U zabbix -d zabbix --list
Password for user zabbix: 
psql: ERROR:  column d.daticulocale does not exist
LINE 8:   d.daticulocale as "ICU Locale",
          ^
HINT:  Perhaps you meant to reference the column "d.datlocale".
[~]$ psql -V
psql (PostgreSQL) 17.2
[~]$ psql -h  dbhostname  -p 5432 -U zabbix -d zabbix --list
Password for user zabbix: 
                                                 List of databases
   Name    |  Owner   | Encoding | Locale Provider | Collate |  Ctype  | Locale | ICU Rules |   Access privileges   
-----------+----------+----------+-----------------+---------+---------+--------+-----------+-----------------------
 postgres  | postgres | UTF8     | libc            | C.UTF-8 | C.UTF-8 |        |           | 
 template0 | postgres | UTF8     | libc            | C.UTF-8 | C.UTF-8 |        |           | =c/postgres          +
           |          |          |                 |         |         |        |           | postgres=CTc/postgres
 template1 | postgres | UTF8     | libc            | C.UTF-8 | C.UTF-8 |        |           | =c/postgres          +
           |          |          |                 |         |         |        |           | postgres=CTc/postgres
 zabbix    | zabbix   | UTF8     | libc            | C.UTF-8 | C.UTF-8 |        |           | 
(4 rows)