From 2672fc88423705be209494fcfe2a908e193569a3 Mon Sep 17 00:00:00 2001 From: Sandro Santilli Date: Wed, 30 Apr 2014 11:48:00 +0200 Subject: [PATCH] Do not fire trigger on drop table performed by superuser --- cartodb_hooks.sql | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/cartodb_hooks.sql b/cartodb_hooks.sql index 5fc7658..e871e17 100644 --- a/cartodb_hooks.sql +++ b/cartodb_hooks.sql @@ -51,6 +51,12 @@ BEGIN RAISE DEBUG 'Relation % of kind % dropped from namespace oid %', event_info.old_relation_oid, (event_info.old).relkind, (event_info.old).relnamespace; + -- We don't want to react to alters triggered by superuser, + IF current_setting('is_superuser') = 'on' THEN + RAISE DEBUG 'no ddl trigger for superuser'; + RETURN; + END IF; + -- delete record from CDB_TableMetadata (should invalidate varnish) DELETE FROM public.CDB_TableMetadata WHERE tabname = event_info.old_relation_oid;