mirror of
https://github.com/postgres/postgres.git
synced 2025-07-28 23:42:10 +03:00
Add information_schema.triggered_update_columns
This reflects the recently added support for triggers on columns.
This commit is contained in:
@ -4,7 +4,7 @@
|
||||
*
|
||||
* Copyright (c) 2003-2009, PostgreSQL Global Development Group
|
||||
*
|
||||
* $PostgreSQL: pgsql/src/backend/catalog/information_schema.sql,v 1.61 2009/12/30 22:48:10 petere Exp $
|
||||
* $PostgreSQL: pgsql/src/backend/catalog/information_schema.sql,v 1.62 2009/12/31 14:41:23 petere Exp $
|
||||
*/
|
||||
|
||||
/*
|
||||
@ -1852,13 +1852,27 @@ GRANT SELECT ON tables TO PUBLIC;
|
||||
|
||||
CREATE VIEW triggered_update_columns AS
|
||||
SELECT CAST(current_database() AS sql_identifier) AS trigger_catalog,
|
||||
CAST(null AS sql_identifier) AS trigger_schema,
|
||||
CAST(null AS sql_identifier) AS trigger_name,
|
||||
CAST(n.nspname AS sql_identifier) AS trigger_schema,
|
||||
CAST(t.tgname AS sql_identifier) AS trigger_name,
|
||||
CAST(current_database() AS sql_identifier) AS event_object_catalog,
|
||||
CAST(null AS sql_identifier) AS event_object_schema,
|
||||
CAST(null AS sql_identifier) AS event_object_table,
|
||||
CAST(null AS sql_identifier) AS event_object_column
|
||||
WHERE false;
|
||||
CAST(n.nspname AS sql_identifier) AS event_object_schema,
|
||||
CAST(c.relname AS sql_identifier) AS event_object_table,
|
||||
CAST(a.attname AS sql_identifier) AS event_object_column
|
||||
|
||||
FROM pg_namespace n, pg_class c, pg_trigger t,
|
||||
(SELECT tgoid, (ta0.tgat).x AS tgattnum, (ta0.tgat).n AS tgattpos
|
||||
FROM (SELECT oid AS tgoid, information_schema._pg_expandarray(tgattr) AS tgat FROM pg_trigger) AS ta0) AS ta,
|
||||
pg_attribute a
|
||||
|
||||
WHERE n.oid = c.relnamespace
|
||||
AND c.oid = t.tgrelid
|
||||
AND t.oid = ta.tgoid
|
||||
AND (a.attrelid, a.attnum) = (t.tgrelid, ta.tgattnum)
|
||||
AND NOT t.tgisconstraint
|
||||
AND (NOT pg_is_other_temp_schema(n.oid))
|
||||
AND (pg_has_role(c.relowner, 'USAGE')
|
||||
-- SELECT privilege omitted, per SQL standard
|
||||
OR has_column_privilege(c.oid, a.attnum, 'INSERT, UPDATE, REFERENCES') );
|
||||
|
||||
GRANT SELECT ON triggered_update_columns TO PUBLIC;
|
||||
|
||||
|
Reference in New Issue
Block a user