Setup on MacOs fails with 'security label provider "anon" is not loaded'

Hi @daamien, I tried to install on MacOS M3. I understand it's not officially supported but should work nevertheless.

  • I installed using pg: sudo pgxn install postgresql_anonymizer
    • No errors, outputs beside other lines: /usr/bin/install -c -m 644 .//anon/* '/Applications/Postgres.app/Contents/Versions/16/share/postgresql/extension/anon/'
  • I put in postgresql.conf: session_preload_libraries = 'anon'
    • I checked there are no other session_preload_libraries entries in postgresql.conf
  • I put in .zprofile and .bash_profile: export C_INCLUDE_PATH="$(xcrun --show-sdk-path)/usr/include"
  • My database install script contains after other CREATE EXTENSION entries:
    • ALTER DATABASE :v_db SET session_preload_libraries = 'anon';
    • CREATE EXTENSION IF NOT EXISTS "anon" CASCADE;
    • SELECT anon.init();
  • in PgAdmin
    • SHOW shared_preload_libraries; outputs 'auth_permission_dialog'
    • SHOW session_preload_libraries; outputs 'anon'
    • SHOW local_preload_libraries; outputs nothing
    • SELECT * FROM pg_extension; outputs many extensions, but not 'anon'

If I run my database install script the line CREATE EXTENSION IF NOT EXISTS "anon" CASCADE; fails with error security label provider "anon" is not loaded.

But if I run CREATE EXTENSION anon CASCADE; afterwards e.g. in PgAdmin it works. Why it doesn't run within my PSQL script?

Do you have any hint, what I could check additionally or what could be done wrong? Thx, Rainer

Edited by Rainer