]> begriffs open source - ai-pg/blob - full-docs/man7/ALTER_TRIGGER.7
Convert HTML docs to more streamlined TXT
[ai-pg] / full-docs / man7 / ALTER_TRIGGER.7
1 '\" t
2 .\"     Title: ALTER TRIGGER
3 .\"    Author: The PostgreSQL Global Development Group
4 .\" Generator: DocBook XSL Stylesheets vsnapshot <http://docbook.sf.net/>
5 .\"      Date: 2025
6 .\"    Manual: PostgreSQL 18.0 Documentation
7 .\"    Source: PostgreSQL 18.0
8 .\"  Language: English
9 .\"
10 .TH "ALTER TRIGGER" "7" "2025" "PostgreSQL 18.0" "PostgreSQL 18.0 Documentation"
11 .\" -----------------------------------------------------------------
12 .\" * Define some portability stuff
13 .\" -----------------------------------------------------------------
14 .\" ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
15 .\" http://bugs.debian.org/507673
16 .\" http://lists.gnu.org/archive/html/groff/2009-02/msg00013.html
17 .\" ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
18 .ie \n(.g .ds Aq \(aq
19 .el       .ds Aq '
20 .\" -----------------------------------------------------------------
21 .\" * set default formatting
22 .\" -----------------------------------------------------------------
23 .\" disable hyphenation
24 .nh
25 .\" disable justification (adjust text to left margin only)
26 .ad l
27 .\" -----------------------------------------------------------------
28 .\" * MAIN CONTENT STARTS HERE *
29 .\" -----------------------------------------------------------------
30 .SH "NAME"
31 ALTER_TRIGGER \- change the definition of a trigger
32 .SH "SYNOPSIS"
33 .sp
34 .nf
35 ALTER TRIGGER \fIname\fR ON \fItable_name\fR RENAME TO \fInew_name\fR
36 ALTER TRIGGER \fIname\fR ON \fItable_name\fR [ NO ] DEPENDS ON EXTENSION \fIextension_name\fR
37 .fi
38 .SH "DESCRIPTION"
39 .PP
40 \fBALTER TRIGGER\fR
41 changes properties of an existing trigger\&.
42 .PP
43 The
44 RENAME
45 clause changes the name of the given trigger without otherwise changing the trigger definition\&. If the table that the trigger is on is a partitioned table, then corresponding clone triggers in the partitions are renamed too\&.
46 .PP
47 The
48 DEPENDS ON EXTENSION
49 clause marks the trigger as dependent on an extension, such that if the extension is dropped, the trigger will automatically be dropped as well\&.
50 .PP
51 You must own the table on which the trigger acts to be allowed to change its properties\&.
52 .SH "PARAMETERS"
53 .PP
54 \fIname\fR
55 .RS 4
56 The name of an existing trigger to alter\&.
57 .RE
58 .PP
59 \fItable_name\fR
60 .RS 4
61 The name of the table on which this trigger acts\&.
62 .RE
63 .PP
64 \fInew_name\fR
65 .RS 4
66 The new name for the trigger\&.
67 .RE
68 .PP
69 \fIextension_name\fR
70 .RS 4
71 The name of the extension that the trigger is to depend on (or no longer dependent on, if
72 NO
73 is specified)\&. A trigger that\*(Aqs marked as dependent on an extension is automatically dropped when the extension is dropped\&.
74 .RE
75 .SH "NOTES"
76 .PP
77 The ability to temporarily enable or disable a trigger is provided by
78 \fBALTER TABLE\fR, not by
79 \fBALTER TRIGGER\fR, because
80 \fBALTER TRIGGER\fR
81 has no convenient way to express the option of enabling or disabling all of a table\*(Aqs triggers at once\&.
82 .SH "EXAMPLES"
83 .PP
84 To rename an existing trigger:
85 .sp
86 .if n \{\
87 .RS 4
88 .\}
89 .nf
90 ALTER TRIGGER emp_stamp ON emp RENAME TO emp_track_chgs;
91 .fi
92 .if n \{\
93 .RE
94 .\}
95 .PP
96 To mark a trigger as being dependent on an extension:
97 .sp
98 .if n \{\
99 .RS 4
100 .\}
101 .nf
102 ALTER TRIGGER emp_stamp ON emp DEPENDS ON EXTENSION emplib;
103 .fi
104 .if n \{\
105 .RE
106 .\}
107 .SH "COMPATIBILITY"
108 .PP
109 \fBALTER TRIGGER\fR
110 is a
111 PostgreSQL
112 extension of the SQL standard\&.
113 .SH "SEE ALSO"
114 ALTER TABLE (\fBALTER_TABLE\fR(7))