Search Postgresql Archives

Re: Event Triggers and Dropping Objects

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Le lundi 16 décembre 2019 à 11:13:10 UTC+1, Luca Ferrari <fluca1978@xxxxxxxxx> a écrit :


On Mon, Oct 7, 2019 at 10:12 PM Bruce Momjian <bruce@xxxxxxxxxx> wrote:
> Do the Postgres docs need improvement here?

I don't know, but I would probably add a flag column in the firing
matrix to indicate when the related function will return a null tuple.

Luca


Hi folks,

i think the docs are confusing, in chapter 39.1 it tell us that the following event trigger ddl_command_start and ddl_command_end
are trapping the DROP but in the real they returns nothing usable.

The matrix in chapter 39.2 also tells us that DROP is trapped by these two.


I'm also wondering using event trigger sql_drop why 3 lines are returned :


zof [20410]=# CREATE OR REPLACE FUNCTION ddl_log_sql_drop()
zof-#  RETURNS event_trigger
zof-#  LANGUAGE plpgsql
zof-#  SECURITY DEFINER
zof-# AS $function$
zof$# DECLARE
zof$#     obj record;
zof$# BEGIN
zof$#     FOR obj IN
zof$#         SELECT *
zof$#         FROM pg_catalog.pg_event_trigger_dropped_objects()
zof$#     LOOP
zof$#         RAISE NOTICE 'DROP objet : % % % %',
zof$#                      obj.object_type,
zof$#                      obj.schema_name,
zof$#                      obj.object_name,
zof$#                      obj.object_identity;
zof$#     END LOOP;
zof$# END;
zof$# $function$;


CREATE EVENT TRIGGER ddl_log_sql_drop ON sql_drop
NOTICE:  CREATE FUNCTION objet : function zof.zof.ddl_log_sql_drop()
   EXECUTE PROCEDURE ddl_log_sql_drop();  CREATE FUNCTION

zof [20410]=# CREATE EVENT TRIGGER ddl_log_sql_drop ON sql_drop
zof-#    EXECUTE PROCEDURE ddl_log_sql_drop();
CREATE EVENT TRIGGER

zof [20410]=# drop table za;
NOTICE:  DROP objet : table zof za zof.za
NOTICE:  DROP objet : type zof za zof.za
NOTICE:  DROP objet : type zof _za zof.za[]
DROP TABLE


Thx
Olf







[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Index of Archives]     [Postgresql Jobs]     [Postgresql Admin]     [Postgresql Performance]     [Linux Clusters]     [PHP Home]     [PHP on Windows]     [Kernel Newbies]     [PHP Classes]     [PHP Books]     [PHP Databases]     [Postgresql & PHP]     [Yosemite]

  Powered by Linux