Skip to content

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

@kirek007

Description

@kirek007

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.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions