pg.ddx.io pgsql-general@postgresql.org mailing list archive
help / color / mirror / Atom feedAW: pg_event_trigger_ddl_commands after GRANT is quite empty
3+ messages / 2 participants
[nested] [flat]
* AW: pg_event_trigger_ddl_commands after GRANT is quite empty
@ 2026-10-12 14:36 ` Färber, Franz-Josef (StMUK) <Franz-Josef.Faerber@stmuk.bayern.de>
2026-10-13 11:10 ` Re: AW: pg_event_trigger_ddl_commands after GRANT is quite empty Laurenz Albe <laurenz.albe@cybertec.at>
1 sibling, 1 reply; 3+ messages in thread
From: Färber, Franz-Josef (StMUK) @ 2026-10-12 14:36 UTC (permalink / raw)
To: Laurenz Albe <laurenz.albe@cybertec.at>; pgsql-general
Thanks!
A solution usable from SQL or plpgsql would've been nice.
Regards,
Franz-Josef Färber
-----Ursprüngliche Nachricht-----
Von: Laurenz Albe <laurenz.albe@cybertec.at>
Gesendet: Montag, 12. Oktober 2026 16:27
An: Färber, Franz-Josef (StMUK) <Franz-Josef.Faerber@stmuk.bayern.de>; pgsql-general@postgresql.org
Betreff: Re: pg_event_trigger_ddl_commands after GRANT is quite empty
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] 3+ messages in thread
* Re: AW: pg_event_trigger_ddl_commands after GRANT is quite empty
2026-10-12 14:36 ` AW: pg_event_trigger_ddl_commands after GRANT is quite empty Färber, Franz-Josef (StMUK) <Franz-Josef.Faerber@stmuk.bayern.de>
@ 2026-10-13 11:10 ` Laurenz Albe <laurenz.albe@cybertec.at>
0 siblings, 0 replies; 3+ messages in thread
From: Laurenz Albe @ 2026-10-13 11:10 UTC (permalink / raw)
To: Färber, "Franz-Josef (StMUK)" <Franz-Josef.Faerber@stmuk.bayern.de>; pgsql-general
On Mon, 2026-10-12 at 14:36 +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.
>
> A solution usable from SQL or plpgsql would've been nice.
Indeed. I am surprised that the table is not reported for a GRANT
statement. Perhaps it is because GRANT operates on all kinds of objects,
not sure. You could write a patch for PostgreSQL to improve that.
Yours,
Laurenz Albe
^ permalink raw reply [nested|flat] 3+ messages in thread
* AW: pg_event_trigger_ddl_commands after GRANT is quite empty
@ 2026-10-12 14:36 ` Färber, Franz-Josef (StMUK) <Franz-Josef.Faerber@stmuk.bayern.de>
1 sibling, 0 replies; 3+ messages in thread
From: Färber, Franz-Josef (StMUK) @ 2026-10-12 14:36 UTC (permalink / raw)
To: Adrian Klaver <adrian.klaver@aklaver.com>; pgsql-general
SELECT version();
--PostgreSQL 18.6 (Debian 18.6-1.pgdg13+2) on x86_64-pc-linux-gnu, compiled by gcc (Debian 14.2.0-19) 14.2.0, 64-bit
CREATE FUNCTION ddl_command_end_trigger_func() RETURNS event_trigger
LANGUAGE plpgsql
AS $$
BEGIN
RAISE NOTICE USING MESSAGE = (
SELECT concat_ws(', ', classid, objid, objsubid, command_tag, object_type, schema_name, object_identity)
FROM pg_event_trigger_ddl_commands()
);
END
$$;
CREATE EVENT TRIGGER ddl_command_end_trigger ON ddl_command_end EXECUTE FUNCTION ddl_command_end_trigger_func();
CREATE TABLE t();
GRANT SELECT ON TABLE t TO postgres;
Regards,
Franz-Josef Färber
-----Ursprüngliche Nachricht-----
Von: Adrian Klaver <adrian.klaver@aklaver.com>
Gesendet: Montag, 12. Oktober 2026 16:18
An: Färber, Franz-Josef (StMUK) <Franz-Josef.Faerber@stmuk.bayern.de>; pgsql-general@postgresql.org
Betreff: Re: pg_event_trigger_ddl_commands after GRANT is quite empty
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] 3+ messages in thread
end of thread, other threads:[~2026-10-13 11:10 UTC | newest]
Thread overview: 3+ messages (download: mbox mbox.gz follow: Atom feed)
-- links below jump to the message on this page --
2026-10-12 14:36 ` Färber, Franz-Josef (StMUK) <Franz-Josef.Faerber@stmuk.bayern.de>
2026-10-13 11:10 ` Laurenz Albe <laurenz.albe@cybertec.at>
2026-10-12 14:36 ` Färber, Franz-Josef (StMUK) <Franz-Josef.Faerber@stmuk.bayern.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