postgres-operator icon indicating copy to clipboard operation
postgres-operator copied to clipboard

[bug] Operator silently fails to enable postgis when pgaudit is enabled

Open kirek007 opened this issue 11 months ago • 0 comments

If you want to create a new database with postgis enabled on the server that have pgaudit enabled it will rise this error:

"pq: PostGIS installation stopped: pgaudit.log is set to 'ddl'. Set pgaudit.log to 'none' before installing PostGIS. You may re-enable pgaudit after installation is complete."

The problem is that operator "is fine" with it saying that all is good, but it should also mark object as "failed to configure".

As simple solution that I could propose would be to check extension name before running create extension here: https://github.com/movetokube/postgres-operator/blob/master/pkg/postgres/database.go#L91 And run it this way:

SET pgaudit.log = 'none';
CREATE EXTENSION IF NOT EXISTS "postgis";

This should disable pgadmin only for this session, so it's safe to use this way I was no tracing which user is used to create extensions, but "set" command required superadmin permissions.

kirek007 avatar Jan 14 '25 12:01 kirek007