Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
P
Postgres FD Implementation
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Analytics
Analytics
CI / CD
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Abuhujair Javed
Postgres FD Implementation
Commits
c584d11b
Commit
c584d11b
authored
Dec 31, 2009
by
Peter Eisentraut
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Add information_schema.triggered_update_columns
This reflects the recently added support for triggers on columns.
parent
31cf8930
Changes
2
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
96 additions
and
8 deletions
+96
-8
doc/src/sgml/information_schema.sgml
doc/src/sgml/information_schema.sgml
+75
-1
src/backend/catalog/information_schema.sql
src/backend/catalog/information_schema.sql
+21
-7
No files found.
doc/src/sgml/information_schema.sgml
View file @
c584d11b
<!-- $PostgreSQL: pgsql/doc/src/sgml/information_schema.sgml,v 1.4
3 2009/12/30 22:48:10
petere Exp $ -->
<!-- $PostgreSQL: pgsql/doc/src/sgml/information_schema.sgml,v 1.4
4 2009/12/31 14:41:23
petere Exp $ -->
<chapter id="information-schema">
<title>The Information Schema</title>
...
...
@@ -4796,6 +4796,80 @@ ORDER BY c.ordinal_position;
</table>
</sect1>
<sect1 id="infoschema-triggered-update-columns">
<title><literal>triggered_update_columns</literal></title>
<para>
For triggers in the current database that specify a column list
(like <literal>UPDATE OF column1, column2</literal>), the
view <literal>triggered_update_columns</literal> identifies these
columns. Triggers that do not specify a column list are not
included in this view. Only those columns are shown that the
current user owns or has some non-SELECT privilege on.
</para>
<table>
<title><literal>triggered_update_columns</literal> Columns</title>
<tgroup cols="3">
<thead>
<row>
<entry>Name</entry>
<entry>Data Type</entry>
<entry>Description</entry>
</row>
</thead>
<tbody>
<row>
<entry><literal>trigger_catalog</literal></entry>
<entry><type>sql_identifier</type></entry>
<entry>Name of the database that contains the trigger (always the current database)</entry>
</row>
<row>
<entry><literal>trigger_schema</literal></entry>
<entry><type>sql_identifier</type></entry>
<entry>Name of the schema that contains the trigger</entry>
</row>
<row>
<entry><literal>trigger_name</literal></entry>
<entry><type>sql_identifier</type></entry>
<entry>Name of the trigger</entry>
</row>
<row>
<entry><literal>event_object_catalog</literal></entry>
<entry><type>sql_identifier</type></entry>
<entry>
Name of the database that contains the table that the trigger
is defined on (always the current database)
</entry>
</row>
<row>
<entry><literal>event_object_schema</literal></entry>
<entry><type>sql_identifier</type></entry>
<entry>Name of the schema that contains the table that the trigger is defined on</entry>
</row>
<row>
<entry><literal>event_object_table</literal></entry>
<entry><type>sql_identifier</type></entry>
<entry>Name of the table that the trigger is defined on</entry>
</row>
<row>
<entry><literal>event_object_column</literal></entry>
<entry><type>sql_identifier</type></entry>
<entry>Name of the column that the trigger is defined on</entry>
</row>
</tbody>
</tgroup>
</table>
</sect1>
<sect1 id="infoschema-triggers">
<title><literal>triggers</literal></title>
...
...
src/backend/catalog/information_schema.sql
View file @
c584d11b
...
...
@@ -4,7 +4,7 @@
*
* Copyright (c) 2003-2009, PostgreSQL Global Development Group
*
* $PostgreSQL: pgsql/src/backend/catalog/information_schema.sql,v 1.6
1 2009/12/30 22:48:10
petere Exp $
* $PostgreSQL: pgsql/src/backend/catalog/information_schema.sql,v 1.6
2 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
(
n
ull
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
;
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment