pg.ddx.io  pgsql-general@postgresql.org mailing list archive  
help / color / mirror / Atom feed
pg_event_trigger_ddl_commands after GRANT is quite empty
4+ messages / 4 participants
[nested] [flat]

* pg_event_trigger_ddl_commands after GRANT is quite empty
@ 2026-10-12 08:47  Färber, Franz-Josef (StMUK) <Franz-Josef.Faerber@stmuk.bayern.de>
  0 siblings, 3 replies; 4+ messages in thread

From: Färber, Franz-Josef (StMUK) @ 2026-10-12 08:47 UTC (permalink / raw)
  To: pgsql-general

Dear Postgres Community,

pg_event_trigger_ddl_commands after GRANT is quite empty.

If I execute: GRANT SELECT ON TABLE t TO r;

. and in a trigger function I have:

        SELECT classid, objid, objsubid, command_tag, object_type, schema_name, object_identity
        FROM pg_event_trigger_ddl_commands();

This gives me:

	null, null, null, GRANT, TABLE, null, null


How to find out the table involved and the privileges?


Regards,
Franz-Josef Färber






^ permalink  raw  reply  [nested|flat] 4+ messages in thread

* Re: pg_event_trigger_ddl_commands after GRANT is quite empty
@ 2026-10-12 14:17  Adrian Klaver <adrian.klaver@aklaver.com>
  parent: Färber, Franz-Josef (StMUK) <Franz-Josef.Faerber@stmuk.bayern.de>
  2 siblings, 0 replies; 4+ messages in thread

From: Adrian Klaver @ 2026-10-12 14:17 UTC (permalink / raw)
  To: Färber, Franz-Josef (StMUK) <Franz-Josef.Faerber@stmuk.bayern.de>; pgsql-general

On 10/12/26 1:47 AM, Färber, Franz-Josef (StMUK) wrote:
> Dear Postgres Community,
> 
> pg_event_trigger_ddl_commands after GRANT is quite empty.
> 
> If I execute: GRANT SELECT ON TABLE t TO r;
> 
> . and in a trigger function I have:
> 
>          SELECT classid, objid, objsubid, command_tag, object_type, schema_name, object_identity
>          FROM pg_event_trigger_ddl_commands();
> 
> This gives me:
> 
> 	null, null, null, GRANT, TABLE, null, null
> 

Postgres version?

What is the complete trigger and trigger function definition?

> 
> How to find out the table involved and the privileges?
> 
> 
> Regards,
> Franz-Josef Färber
> 
> 


-- 
Adrian Klaver
adrian.klaver@aklaver.com






^ permalink  raw  reply  [nested|flat] 4+ messages in thread

* Re: pg_event_trigger_ddl_commands after GRANT is quite empty
@ 2026-10-12 14:26  Laurenz Albe <laurenz.albe@cybertec.at>
  parent: Färber, Franz-Josef (StMUK) <Franz-Josef.Faerber@stmuk.bayern.de>
  2 siblings, 0 replies; 4+ messages in thread

From: Laurenz Albe @ 2026-10-12 14:26 UTC (permalink / raw)
  To: Färber, "Franz-Josef (StMUK)" <Franz-Josef.Faerber@stmuk.bayern.de>; pgsql-general

On Mon, 2026-10-12 at 08:47 +0000, Färber, Franz-Josef (StMUK) wrote:
> pg_event_trigger_ddl_commands after GRANT is quite empty.
> 
> If I execute: GRANT SELECT ON TABLE t TO r;
> 
> . and in a trigger function I have:
> 
>         SELECT classid, objid, objsubid, command_tag, object_type, schema_name, object_identity
>         FROM pg_event_trigger_ddl_commands();
> 
> This gives me:
> 
> 	null, null, null, GRANT, TABLE, null, null
> 
> 
> How to find out the table involved and the privileges?

I think you have to write a C function that can do something with
pg_ddl_command.

Yours,
Laurenz Albe






^ permalink  raw  reply  [nested|flat] 4+ messages in thread

* Re: pg_event_trigger_ddl_commands after GRANT is quite empty
@ 2026-10-13 18:53  Álvaro Herrera <alvherre@kurilemu.de>
  parent: Färber, Franz-Josef (StMUK) <Franz-Josef.Faerber@stmuk.bayern.de>
  2 siblings, 0 replies; 4+ messages in thread

From: Álvaro Herrera @ 2026-10-13 18:53 UTC (permalink / raw)
  To: Färber, Franz-Josef (StMUK) <Franz-Josef.Faerber@stmuk.bayern.de>; +Cc: pgsql-general

On 2026-Oct-12, Färber, Franz-Josef (StMUK) wrote:

> Dear Postgres Community,
> 
> pg_event_trigger_ddl_commands after GRANT is quite empty.
> 
> If I execute: GRANT SELECT ON TABLE t TO r;
> 
> . and in a trigger function I have:
> 
>         SELECT classid, objid, objsubid, command_tag, object_type, schema_name, object_identity
>         FROM pg_event_trigger_ddl_commands();
> 
> This gives me:
> 
> 	null, null, null, GRANT, TABLE, null, null
> 
> How to find out the table involved and the privileges?

Yeah, I'm afraid the implementation to expose this to SQL was left
incomplete back in 9.5.  You can see in EventTriggerCollectGrant() that
we do try and collect the information, but in pg_event_trigger_ddl_commands()
in event_trigger.c the case for SCT_Grant fills nulls for most columns.
The CollectedCommand pointer is present and should contain all details
of the grant, though, so as Laurenz says you can get by in the meantime
with some C code.

Exposing it in SQL (which we're likely to require now that Sawada-san is
back at implementing DDL replication) is going to require some
additional design for the datatypes and so on.  The difference between
GRANT and all others is that you affect multiple objects and multiple
privileges in a single command, so we cannot just shoehorn an object
name in the same place as for the other commands.

One weird thing I noticed is that there isn't a single GRANT in the
tests in src/test/modules/test_ddl_deparse.  But that wouldn't have
changed things at all, I'm afraid ...  (You could use the code there as
a template to implement your own, BTW.)

-- 
Álvaro Herrera         PostgreSQL Developer  —  https://www.EnterpriseDB.com/






^ permalink  raw  reply  [nested|flat] 4+ messages in thread


end of thread, other threads:[~2026-10-13 18:53 UTC | newest]

Thread overview: 4+ messages (download: mbox mbox.gz follow: Atom feed)
-- links below jump to the message on this page --
2026-10-12 08:47 pg_event_trigger_ddl_commands after GRANT is quite empty Färber, Franz-Josef (StMUK) <Franz-Josef.Faerber@stmuk.bayern.de>
2026-10-12 14:17 ` Adrian Klaver <adrian.klaver@aklaver.com>
2026-10-12 14:26 ` Laurenz Albe <laurenz.albe@cybertec.at>
2026-10-13 18:53 ` Álvaro Herrera <alvherre@kurilemu.de>

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