- Notifications
You must be signed in to change notification settings - Fork5
Commit473ab40
committed
Add sql_drop event for event triggers
This event takes place just before ddl_command_end, and is fired if andonly if at least one object has been dropped by the command. (Forinstance, DROP TABLE IF EXISTS of a table that does not in fact existwill not lead to such a trigger firing). Commands that drop multipleobjects (such as DROP SCHEMA or DROP OWNED BY) will cause a single eventto fire. Some firings might be surprising, such asALTER TABLE DROP COLUMN.The trigger is fired after the drop has taken place, because that hasbeen deemed the safest design, to avoid exposing possibly-inconsistentinternal state (system catalogs as well as current transaction) to theuser function code. This means that careful tracking of objectidentification is required during the object removal phase.Like other currently existing events, there is support for tagfiltering.To support the new event, add a new pg_event_trigger_dropped_objects()set-returning function, which returns a set of rows comprising theobjects affected by the command. This is to be used within the userfunction code, and is mostly modelled after the recently introducedpg_identify_object() function.Catalog version bumped due to the new function.Dimitri Fontaine and Álvaro HerreraReview by Robert Haas, Tom Lane1 parent593c39d commit473ab40
File tree
15 files changed
+1083
-115
lines changed- doc/src/sgml
- src
- backend
- catalog
- commands
- parser
- tcop
- utils
- adt
- cache
- include
- catalog
- commands
- utils
- test/regress
- expected
- sql
15 files changed
+1083
-115
lines changedLines changed: 105 additions & 5 deletions
Large diffs are not rendered by default.
Lines changed: 113 additions & 0 deletions
Original file line number | Diff line number | Diff line change | |
---|---|---|---|
| |||
15980 | 15980 |
| |
15981 | 15981 |
| |
15982 | 15982 |
| |
| 15983 | + | |
| 15984 | + | |
| 15985 | + | |
| 15986 | + | |
| 15987 | + | |
| 15988 | + | |
| 15989 | + | |
| 15990 | + | |
| 15991 | + | |
| 15992 | + | |
| 15993 | + | |
| 15994 | + | |
| 15995 | + | |
| 15996 | + | |
| 15997 | + | |
| 15998 | + | |
| 15999 | + | |
| 16000 | + | |
| 16001 | + | |
| 16002 | + | |
| 16003 | + | |
| 16004 | + | |
| 16005 | + | |
| 16006 | + | |
| 16007 | + | |
| 16008 | + | |
| 16009 | + | |
| 16010 | + | |
| 16011 | + | |
| 16012 | + | |
| 16013 | + | |
| 16014 | + | |
| 16015 | + | |
| 16016 | + | |
| 16017 | + | |
| 16018 | + | |
| 16019 | + | |
| 16020 | + | |
| 16021 | + | |
| 16022 | + | |
| 16023 | + | |
| 16024 | + | |
| 16025 | + | |
| 16026 | + | |
| 16027 | + | |
| 16028 | + | |
| 16029 | + | |
| 16030 | + | |
| 16031 | + | |
| 16032 | + | |
| 16033 | + | |
| 16034 | + | |
| 16035 | + | |
| 16036 | + | |
| 16037 | + | |
| 16038 | + | |
| 16039 | + | |
| 16040 | + | |
| 16041 | + | |
| 16042 | + | |
| 16043 | + | |
| 16044 | + | |
| 16045 | + | |
| 16046 | + | |
| 16047 | + | |
| 16048 | + | |
| 16049 | + | |
| 16050 | + | |
| 16051 | + | |
| 16052 | + | |
| 16053 | + | |
| 16054 | + | |
| 16055 | + | |
| 16056 | + | |
| 16057 | + | |
| 16058 | + | |
| 16059 | + | |
| 16060 | + | |
| 16061 | + | |
| 16062 | + | |
| 16063 | + | |
| 16064 | + | |
| 16065 | + | |
| 16066 | + | |
| 16067 | + | |
| 16068 | + | |
| 16069 | + | |
| 16070 | + | |
| 16071 | + | |
| 16072 | + | |
| 16073 | + | |
| 16074 | + | |
| 16075 | + | |
| 16076 | + | |
| 16077 | + | |
| 16078 | + | |
| 16079 | + | |
| 16080 | + | |
| 16081 | + | |
| 16082 | + | |
| 16083 | + | |
| 16084 | + | |
| 16085 | + | |
| 16086 | + | |
| 16087 | + | |
| 16088 | + | |
| 16089 | + | |
| 16090 | + | |
| 16091 | + | |
| 16092 | + | |
| 16093 | + | |
| 16094 | + | |
| 16095 | + | |
15983 | 16096 |
|
Lines changed: 46 additions & 19 deletions
Original file line number | Diff line number | Diff line change | |
---|---|---|---|
| |||
190 | 190 |
| |
191 | 191 |
| |
192 | 192 |
| |
| 193 | + | |
| 194 | + | |
| 195 | + | |
| 196 | + | |
| 197 | + | |
| 198 | + | |
| 199 | + | |
| 200 | + | |
| 201 | + | |
| 202 | + | |
| 203 | + | |
| 204 | + | |
| 205 | + | |
| 206 | + | |
| 207 | + | |
| 208 | + | |
| 209 | + | |
| 210 | + | |
| 211 | + | |
| 212 | + | |
| 213 | + | |
| 214 | + | |
| 215 | + | |
| 216 | + | |
| 217 | + | |
| 218 | + | |
| 219 | + | |
| 220 | + | |
| 221 | + | |
| 222 | + | |
| 223 | + | |
| 224 | + | |
| 225 | + | |
| 226 | + | |
| 227 | + | |
| 228 | + | |
| 229 | + | |
| 230 | + | |
193 | 231 |
| |
194 | 232 |
| |
195 | 233 |
| |
| |||
215 | 253 |
| |
216 | 254 |
| |
217 | 255 |
| |
218 |
| - | |
219 | 256 |
| |
220 | 257 |
| |
221 | 258 |
| |
| |||
250 | 287 |
| |
251 | 288 |
| |
252 | 289 |
| |
253 |
| - | |
254 |
| - | |
255 |
| - | |
256 |
| - | |
257 |
| - | |
258 |
| - | |
259 |
| - | |
260 |
| - | |
261 |
| - | |
| 290 | + | |
| 291 | + | |
262 | 292 |
| |
263 | 293 |
| |
264 | 294 |
| |
| |||
332 | 362 |
| |
333 | 363 |
| |
334 | 364 |
| |
335 |
| - | |
336 |
| - | |
337 |
| - | |
338 |
| - | |
339 |
| - | |
340 |
| - | |
341 |
| - | |
342 |
| - | |
343 |
| - | |
| 365 | + | |
| 366 | + | |
344 | 367 |
| |
345 | 368 |
| |
346 | 369 |
| |
| |||
356 | 379 |
| |
357 | 380 |
| |
358 | 381 |
| |
| 382 | + | |
| 383 | + | |
| 384 | + | |
| 385 | + | |
359 | 386 |
| |
360 | 387 |
| |
361 | 388 |
| |
|
0 commit comments
Comments
(0)