Location via proxy:   [ UP ]  
[Report a bug]   [Manage cookies]                
Skip to content

Commit 3c505ef

Browse files
committed
Fill in information schema column for trigger WHEN condition
1 parent e6df063 commit 3c505ef

File tree

2 files changed

+13
-4
lines changed

2 files changed

+13
-4
lines changed

doc/src/sgml/information_schema.sgml

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
<!-- $PostgreSQL: pgsql/doc/src/sgml/information_schema.sgml,v 1.42 2009/12/05 21:31:05 petere Exp $ -->
1+
<!-- $PostgreSQL: pgsql/doc/src/sgml/information_schema.sgml,v 1.43 2009/12/30 22:48:10 petere Exp $ -->
22

33
<chapter id="information-schema">
44
<title>The Information Schema</title>
@@ -4875,7 +4875,11 @@ ORDER BY c.ordinal_position;
48754875
<row>
48764876
<entry><literal>action_condition</literal></entry>
48774877
<entry><type>character_data</type></entry>
4878-
<entry>Applies to a feature not available in <productname>PostgreSQL</></entry>
4878+
<entry>
4879+
<literal>WHEN</literal> condition of the trigger, null if none
4880+
(also null if the table is not owned by a currently enabled
4881+
role)
4882+
</entry>
48794883
</row>
48804884

48814885
<row>

src/backend/catalog/information_schema.sql

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44
*
55
* Copyright (c) 2003-2009, PostgreSQL Global Development Group
66
*
7-
* $PostgreSQL: pgsql/src/backend/catalog/information_schema.sql,v 1.60 2009/12/07 05:22:21 tgl Exp $
7+
* $PostgreSQL: pgsql/src/backend/catalog/information_schema.sql,v 1.61 2009/12/30 22:48:10 petere Exp $
88
*/
99

1010
/*
@@ -1909,7 +1909,12 @@ CREATE VIEW triggers AS
19091909
CAST(n.nspname AS sql_identifier) AS event_object_schema,
19101910
CAST(c.relname AS sql_identifier) AS event_object_table,
19111911
CAST(null AS cardinal_number) AS action_order,
1912-
CAST(null AS character_data) AS action_condition,
1912+
-- XXX strange hacks follow
1913+
CAST(
1914+
CASE WHEN pg_has_role(c.relowner, 'USAGE')
1915+
THEN (SELECT m[1] FROM regexp_matches(pg_get_triggerdef(t.oid), E'.{35,} WHEN \\((.+)\\) EXECUTE PROCEDURE') AS rm(m) LIMIT 1)
1916+
ELSE null END
1917+
AS character_data) AS action_condition,
19131918
CAST(
19141919
substring(pg_get_triggerdef(t.oid) from
19151920
position('EXECUTE PROCEDURE' in substring(pg_get_triggerdef(t.oid) from 48)) + 47)

0 commit comments

Comments
 (0)