Solved question about zabbix7 import schema.sql to postgresql17 in freebsd14.2 ?

dear all:
now , i am testing zabbix7 with postgresql17 in freebsd14.2 . below was my question :
1. postgresql17 work normal , and create a zabbix7 database and grant user zb1 full permission on zabbix7database.
psql> GRANT ALL PRIVILEGES ON DATABASE zb1 to zabbix7;

2. when i run below sql , got a errors in below .
$ psql -U zb1 zabbix7
psql> \i schema.sql
psql> \i images.sql
psql> \i data.sql
psql> exit

zabbix7=> \i schema.sql
psql:schema.sql:7: ERROR: permission denied for schema public
LINE 1: CREATE TABLE role (
^
psql:schema.sql:8: ERROR: relation "role" does not exist
psql:schema.sql:13: ERROR: permission denied for schema public
LINE 1: CREATE TABLE ugset (
etc....

please help me . thanks.
 
Dear all :
1. psql> GRANT ALL PRIVILEGES ON DATABASE zb1 to zabbix7;
this command let zb1 user can access zabbix7, but can't modify or delete any thing ?
2. zabbix7 ower was postgres , access privileges was zb1 and postgres .
3. because database zabbix7 ower was not zb1 user. so we can't run "psql \i schema.sql " in database zabbix7. right ?

note: if i let zb1 user to zabbix7 database ower, command "psql \i schema.sql" was running ok...

please let me know difference power range between database of access privileges and ower ? thanks.
 
I could be mistaken but I get the impression that you're treating PostgreSQL as if it were MySQL...

First things first... there is no such thing as "users" within PSQL; only roles. I know I'm nitpicking but details like these are important: if a role has ownership over a database then you don't need to grant it extra permissions because they can do everything they need.

Judging by the errors I think you may have an issue with your permission scheme; this may be a good read for later.

For now, my suggestion would be to check the roles using \du and to make sure you didn't give zb1 too many attributes; casual roles like that shouldn't have any at all. Next: alter database zabbix7 owner to zb1 (you probably need to do this as postgres).

After that you should be good.
 
I could be mistaken but I get the impression that you're treating PostgreSQL as if it were MySQL...

First things first... there is no such thing as "users" within PSQL; only roles. I know I'm nitpicking but details like these are important: if a role has ownership over a database then you don't need to grant it extra permissions because they can do everything they need.

Judging by the errors I think you may have an issue with your permission scheme; this may be a good read for later.

For now, my suggestion would be to check the roles using \du and to make sure you didn't give zb1 too many attributes; casual roles like that shouldn't have any at all. Next: alter database zabbix7 owner to zb1 (you probably need to do this as postgres).

After that you should be good.
DEar shelLuser:
thanks for your help.now i have let zabbix7 connect to postgresql17 isn't supported. i have replace postgresql17 with postgresql16 ... still got errors in below . whatever i do , the zabbix7 server can't use postgresql, just only use mysql. please help me . thanks.
5061:20250401:151544.720 [Z3001] connection to database 'zabbix2025' failed: [2002] Can't connect to local MySQL server through socket '/tmp/mysql.sock' (2)
 
Default zabbix7 from packages are build with support of MySQL. If you want to use PostgreSQL you need to build zabbix7 from ports with PGSQL option.
 
Back
Top