Re: Event Triggers and GRANT/REVOKE

Поиск
Список
Период
Сортировка
От Miles Elam
Тема Re: Event Triggers and GRANT/REVOKE
Дата
Msg-id CAALojA93Dmh=QP63S=CvLtEEPuFdB07Ca4rb6Y_7FB9Ndz3wFg@mail.gmail.com
обсуждение исходный текст
Ответ на Re: Event Triggers and GRANT/REVOKE  (Adrian Klaver <adrian.klaver@aklaver.com>)
Ответы Re: Event Triggers and GRANT/REVOKE  (Adrian Klaver <adrian.klaver@aklaver.com>)
Список pgsql-general
Using my example below from another thread, GRANTs and REVOKEs leave all fields NULL except for command_tag (set to 'GRANT' or 'REVOKE'), object_type (set to upper case target like 'TABLE'), and in_extension (set to whatever is appropriate, but typically false).

-----

CREATE TABLE IF NOT EXISTS ddl_info (
  classid oid,
  objid oid,
  objsubid integer,
  command_tag text,
  object_type text,
  schema_name text,
  object_identity text,
  in_extension bool,
  transaction_id bigint NOT NULL DEFAULT txid_current(),
  inserted timestamptz NOT NULL DEFAULT clock_timestamp()
);

CREATE OR REPLACE FUNCTION ddl_log()
RETURNS EVENT_TRIGGER
LANGUAGE plpgsql AS $$
BEGIN
  INSERT INTO ddl_info (
    classid, objid, objsubid, command_tag, object_type,
    schema_name, object_identity, in_extension
  )
  SELECT
    classid, objid, objsubid, command_tag, object_type,
    schema_name, object_identity, in_extension
  FROM pg_event_trigger_ddl_commands();
END;
$$;

CREATE EVENT TRIGGER aa_ddl_info ON ddl_command_end
EXECUTE PROCEDURE ddl_log();

On Wed, Oct 9, 2019 at 2:27 PM Adrian Klaver <adrian.klaver@aklaver.com> wrote:
On 10/9/19 1:56 PM, Miles Elam wrote:
> GRANT and REVOKE trigger on a ddl_command_end event trigger but don't
> provide any information beyond whether it was a table, schema, function,
> etc. that was affected. No object IDs or the like are included. How
> would you find out which table had its ACLs modified?

What is the code for trigger and function?

>
> Also, why do grants and revokes have an object_type of 'TABLE' instead
> of lower case names like 'table' for all other event types?
>
>
> Thanks,
>
> Miles Elam
>


--
Adrian Klaver
adrian.klaver@aklaver.com

В списке pgsql-general по дате отправления:

Предыдущее
От: Adrian Klaver
Дата:
Сообщение: Re: Event Triggers and GRANT/REVOKE
Следующее
От: Pól Ua Laoínecháin
Дата:
Сообщение: Re: Is my lecturer wrong about PostgreSQL? I think he is!