--- ./pgaudit.c.orig	2019-10-01 21:15:09.659795409 +0200
+++ ./pgaudit.c	2019-10-01 21:17:41.026154419 +0200
@@ -13,7 +13,6 @@
 #include "access/htup_details.h"
 #include "access/sysattr.h"
 #include "access/xact.h"
-#include "access/relation.h"
 #include "catalog/catalog.h"
 #include "catalog/objectaccess.h"
 #include "catalog/pg_class.h"
@@ -40,6 +39,9 @@
 #if PG_VERSION_NUM >= 100000
 #include "utils/varlena.h"
 #endif
+#if PG_VERSION_NUM >= 120000
+#include "access/relation.h"
+#endif
 
 #if (PG_VERSION_NUM >= 90500 && PG_VERSION_NUM < 90600)
 #define LOG_SERVER_ONLY COMMERROR
@@ -1019,7 +1021,11 @@
         relOid = rte->relid;
         rel = relation_open(relOid, NoLock);
 
+#if PG_VERSION_NUM >= 120000
         if (!auditLogCatalog && IsCatalogNamespace(RelationGetNamespace(rel)))
+#else
+        if (!auditLogCatalog && IsSystemNamespace(RelationGetNamespace(rel)))
+#endif
         {
             relation_close(rel, NoLock);
             continue;
@@ -1231,7 +1237,11 @@
      * Logging execution of all pg_catalog functions would make the log
      * unusably noisy.
      */
+#if PG_VERSION_NUM >= 120000
     if (IsCatalogNamespace(proc->pronamespace))
+#else
+    if (IsSystemNamespace(proc->pronamespace))
+#endif
     {
         ReleaseSysCache(proctup);
         return;
