Redshift Observatory

System Table Tracker

System view information_schema.triggers version 1.0.60353 / 2023-11-24

schema name column data type
information_schema triggers action_condition character_data
information_schema triggers action_order cardinal_number
information_schema triggers action_orientation character_data
information_schema triggers action_statement character_data
information_schema triggers condition_reference_new_table sql_identifier
information_schema triggers condition_reference_old_table sql_identifier
information_schema triggers condition_timing character_data
information_schema triggers event_manipulation character_data
information_schema triggers event_object_catalog sql_identifier
information_schema triggers event_object_schema sql_identifier
information_schema triggers event_object_table sql_identifier
information_schema triggers trigger_catalog sql_identifier
information_schema triggers trigger_name sql_identifier
information_schema triggers trigger_schema sql_identifier

View Text

SELECT CAST(current_database() AS information_schema.sql_identifier) AS trigger_catalog,
       CAST(n.nspname AS information_schema.sql_identifier) AS trigger_schema,
       CAST(t.tgname AS information_schema.sql_identifier) AS trigger_name,
       CAST(em.text AS information_schema.character_data) AS event_manipulation,
       CAST(current_database() AS information_schema.sql_identifier) AS event_object_catalog,
       CAST(n.nspname AS information_schema.sql_identifier) AS event_object_schema,
       CAST(c.relname AS information_schema.sql_identifier) AS event_object_table,
       CAST(CAST(NULL AS information_schema.cardinal_number) AS information_schema.cardinal_number) AS action_order,
       CAST(CAST(NULL AS information_schema.character_data) AS information_schema.character_data) AS action_condition,
       CAST(substring(pg_get_triggerdef(t.oid),
                      position(substring(pg_get_triggerdef(t.oid),
                                         48),
                               CAST('EXECUTE PROCEDURE' AS text)) + 47) AS information_schema.character_data) AS action_statement,
       CAST(CASE
              WHEN (CAST(t.tgtype AS integer) & 1) = 1
                THEN CAST('ROW' AS text)
              ELSE CAST('STATEMENT' AS text)
            END AS information_schema.character_data) AS action_orientation,
       CAST(CASE
              WHEN (CAST(t.tgtype AS integer) & 2) = 2
                THEN CAST('BEFORE' AS text)
              ELSE CAST('AFTER' AS text)
            END AS information_schema.character_data) AS condition_timing,
       CAST(CAST(NULL AS information_schema.sql_identifier) AS information_schema.sql_identifier) AS condition_reference_old_table,
       CAST(CAST(NULL AS information_schema.sql_identifier) AS information_schema.sql_identifier) AS condition_reference_new_table
FROM pg_namespace AS n,
     pg_class AS c,
     pg_trigger AS t,
     pg_user AS u,
     ((SELECT 4,
              CAST('INSERT' AS varchar)

       UNION ALL

       SELECT 8,
              CAST('DELETE' AS varchar))

      UNION ALL

      SELECT 16,
             CAST('UPDATE' AS varchar)) AS em (num, text)
WHERE n.oid = c.relnamespace
  AND c.oid = t.tgrelid
  AND c.relowner = u.usesysid
  AND (CAST(t.tgtype AS integer) & em.num) <> 0
  AND NOT t.tgisconstraint
  AND u.usename = CAST("current_user"() AS name)


Home 3D Друк Blog Bring-Up Times Consultancy Cross-Region Benchmarks Email Forums IRC Mailing Lists Reddit Redshift Price Tracker Redshift Version Tracker Redshift Workbench System Table Tracker The Known Universe Twitter White Papers