TransWikia.com

Problems loading pgAudit library on Postgres 12.2

Database Administrators Asked by Ivanovich on October 28, 2021

I’m trying to add the pgAudit extension to register the events of my database. I downloaded pgAudit and installed via git.

git clone https://github.com/pgaudit/pgaudit.git
cd pgaudit
git checkout REL_11_STABLE
gmake install USE_PGXS=1 

And added 'pgaudit' to the shared_preload_libraries. However, when I try to start the server, it throws the following error:

FATAL: could not load library "/usr/local/lib/postgresql/pgaudit.so": /usr/local/lib/postgresql/pgaudit.so: Undefined symbol "IsSystemNamespace". 

I’ve googled for a while but cannot find what’s wrong. I’ve checked that the library is really there and uninstalled/reinstalled it. I’m currently working with FreeBSD-12.0 RELEASE and PostgreSQL 12.12.
Thanks in advance for your time.

2 Answers

You did git checkout REL_11_STABLE according to README.md but that branch is just an example chosen when PostgreSQL 11 was the latest version.

In the case of PostgreSQL 12, the branch you should choose is REL_12_STABLE.

git remote show origin can be issued to show the available branches:

$ git remote show origin
* remote origin
  Fetch URL: https://github.com/pgaudit/pgaudit.git
  Push  URL: https://github.com/pgaudit/pgaudit.git
  HEAD branch: master
  Remote branches:
    REL9_5_STABLE tracked
    REL9_6_STABLE tracked
    REL_10_STABLE tracked
    REL_11_STABLE tracked
    REL_12_STABLE tracked
    dev-stack     tracked
    master        tracked
  Local branch configured for 'git pull':
    master merges with remote master
  Local ref configured for 'git push':
    master pushes to master (up to date)

This way of making the user select a specific branch is unusual. In general, extensions have a common branch for all versions of PostgreSQL, and pg_config is used by the build to know which version is the target. When there are several versions of PostgreSQL installed, the build invoker should take care of using specifically the pg_config of the desired version, as shown in Laurenz Albe's answer.

Answered by Daniel Vérité on October 28, 2021

This commit renamed IsSystemNamespace to IsCatalogNamespace in PostgreSQL v12, so you must have built the extension with PostgreSQL v11 or older by mistake.

Check the result of

which pg_config

to see what was first on your PATH when you built the extension.

Be explicit with

make USE_PGXS=1 PG_CONFIG=/path/to/pg12/bin/pg_config

Answered by Laurenz Albe on October 28, 2021

Add your own answers!

Ask a Question

Get help from others!

© 2024 TransWikia.com. All rights reserved. Sites we Love: PCI Database, UKBizDB, Menu Kuliner, Sharing RPP