public inbox for [email protected]  
help / color / mirror / Atom feed
From: Pierre Forstmann <[email protected]>
To: Dharin Shah <[email protected]>
To: zaidagilist <[email protected]>
To: David G. Johnston <[email protected]>
Cc: Siraj G <[email protected]>
Cc: Pgsql-admin <[email protected]>
Subject: Re: Is PgAudit extension database specific?
Date: Thu, 15 Jan 2026 16:02:34 +0100
Message-ID: <[email protected]> (raw)
In-Reply-To: <CAOj6k6f53Yag0trVUUHq5vrzREVFkicDpiG2WNjpivHMYANzKg@mail.gmail.com>
References: <CAC5iy63sMzJ9j_WBxzjdTjp7y0F_hRuA-=Fjfyy7RFbqdqA16A@mail.gmail.com>
	<CAFS1Kf4ZH0XAcU3H1FCFgy65=tTc+-wnDq=-XunseW30V4KBHw@mail.gmail.com>
	<CAOj6k6f53Yag0trVUUHq5vrzREVFkicDpiG2WNjpivHMYANzKg@mail.gmail.com>

I have just tested pgaudit 18 with PostgreSQL 18.1.

I have only installed pgaudit in postgres database and I have created 2 
other databases db1 and db2.

If I run:

postgres@alma ~]$ psql db1
psql (18.1)
Type "help" for help.

db1=# \dx
                           List of installed extensions
   Name   | Version | Default version |   Schema   |  Description
---------+---------+-----------------+------------+------------------------------
  plpgsql | 1.0     | 1.0             | pg_catalog | PL/pgSQL procedural 
language
(1 row)

db1=# select * from t1;
  x
---
(0 rows)

db1=#
\q
[postgres@alma ~]$ psql db2
psql (18.1)
Type "help" for help.

db2=# \dx
                           List of installed extensions
   Name   | Version | Default version |   Schema   |  Description
---------+---------+-----------------+------------+------------------------------
  plpgsql | 1.0     | 1.0             | pg_catalog | PL/pgSQL procedural 
language
(1 row)

db2=# select * from t2;
  x
---
(0 rows)

db2=#
\q
[postgres@alma ~]$


I get in PG log:


2026-01-15 15:58:23.044 CET [47325] LOG:  AUDIT: 
SESSION,1,1,READ,SELECT,,,"SELECT e.extname AS ""Name"", e.extversion AS 
""Version"", ae.default_version AS ""Default version"",n.nspname AS 
""Schema"", d.description AS ""Description""
     FROM pg_catalog.pg_extension e LEFT JOIN pg_catalog.pg_namespace n 
ON n.oid = e.extnamespace LEFT JOIN pg_catalog.pg_description d ON 
d.objoid = e.oid AND d.classoid = 
'pg_catalog.pg_extension'::pg_catalog.regclass LEFT JOIN 
pg_catalog.pg_available_extensions() ae(name, default_version, comment) 
ON ae.name = e.extname
     ORDER BY 1",<not logged>
2026-01-15 15:58:29.192 CET [47325] LOG:  AUDIT: 
SESSION,2,1,READ,SELECT,,,select * from t1,<not logged>
2026-01-15 15:58:39.620 CET [47332] LOG:  AUDIT: 
SESSION,1,1,READ,SELECT,,,"SELECT e.extname AS ""Name"", e.extversion AS 
""Version"", ae.default_version AS ""Default version"",n.nspname AS 
""Schema"", d.description AS ""Description""
     FROM pg_catalog.pg_extension e LEFT JOIN pg_catalog.pg_namespace n 
ON n.oid = e.extnamespace LEFT JOIN pg_catalog.pg_description d ON 
d.objoid = e.oid AND d.classoid = 
'pg_catalog.pg_extension'::pg_catalog.regclass LEFT JOIN 
pg_catalog.pg_available_extensions() ae(name, default_version, comment) 
ON ae.name = e.extname
     ORDER BY 1",<not logged>
2026-01-15 15:58:42.416 CET [47332] LOG:  AUDIT: 
SESSION,2,1,READ,SELECT,,,select * from t2,<not logged>


We can conclude that  installing pgaudit extension works for all databases.

It seems also that pgaudit does not log database name (I have not 
anything pgaudit documentation about database name).



Le 06/01/2026 à 18:55, Dharin Shah a écrit :
> Hello,
>
> This is standard for all pg extensions as mentioned above.
>
> Just adding a minor doc patch to add clarification in the doc.
>
> Thanks,
> Dharin
>
> On Tue, Jan 6, 2026 at 6:30 PM zaidagilist <[email protected]> wrote:
>
>     Hello Siraj,
>
>     pgAudit is a coupled component build for a specific PG version,
>     for each PG version you are required to install separately. Same
>     behavior as other PG based extensions.
>
>     Regards,
>     Zaid
>
>     On Tue, Jan 6, 2026 at 10:19 PM Siraj G <[email protected]> wrote:
>
>         Hello Experts!
>
>         Here is my observation:
>
>         Connected to postgres DB and ran:
>         CREATE EXTENSION pgaudit;
>
>         Within postgres DB, I ran this:
>         SELECT*FROMpg_catalog.pg_extension WHEREextname ='pgaudit';
>
>         It does return a row.
>
>         I changed the DB and ran the same SQL, but it does not return
>         any thing.
>
>         The PostgreSQL instance is a GCP cloud SQL running with
>         postgres V14.19.
>
>         Would you help me understand this, please.
>
>         Regards
>         Siraj
>

reply

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Reply to all the recipients using the --to and --cc options:
  reply via email

  To: [email protected]
  Cc: [email protected], [email protected], [email protected], [email protected], [email protected], [email protected]
  Subject: Re: Is PgAudit extension database specific?
  In-Reply-To: <[email protected]>

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

This inbox is served by agora; see mirroring instructions
for how to clone and mirror all data and code used for this inbox