forked frompostgres/postgres
- Notifications
You must be signed in to change notification settings - Fork6
Commitb488c58
committed
Allow on-the-fly capture of DDL event details
This feature lets user code inspect and take action on DDL events.Whenever a ddl_command_end event trigger is installed, DDL actionsexecuted are saved to a list which can be inspected during execution ofa function attached to ddl_command_end.The set-returning function pg_event_trigger_ddl_commands can be used tolist actions so captured; it returns data about the type of commandexecuted, as well as the affected object. This is sufficient for manyuses of this feature. For the cases where it is not, we also provide a"command" column of a new pseudo-type pg_ddl_command, which is apointer to a C structure that can be accessed by C code. The structcontains all the info necessary to completely inspect and evenreconstruct the executed command.There is no actual deparse code here; that's expected to come later.What we have is enough infrastructure that the deparsing can be done inan external extension. The intention is that we will add some deparsingcode in a later release, as an in-core extension.A new test module is included. It's probably insufficient as is, but itshould be sufficient as a starting point for a more complete andfuture-proof approach.Authors: Álvaro Herrera, with some help from Andres Freund, Ian Barwick,Abhijit Menon-Sen.Reviews by Andres Freund, Robert Haas, Amit Kapila, Michael Paquier,Craig Ringer, David Steele.Additional input from Chris Browne, Dimitri Fontaine, Stephen Frost,Petr Jelínek, Tom Lane, Jim Nasby, Steven Singer, Pavel Stěhule.Based on original work by Dimitri Fontaine, though I didn't use hiscode.Discussion:https://www.postgresql.org/message-id/m2txrsdzxa.fsf@2ndQuadrant.frhttps://www.postgresql.org/message-id/20131108153322.GU5809@eldon.alvh.no-ip.orghttps://www.postgresql.org/message-id/20150215044814.GL3391@alvh.no-ip.org1 parentfa26424 commitb488c58
File tree
72 files changed
+2667
-155
lines changed- doc/src/sgml
- src
- backend
- catalog
- commands
- nodes
- parser
- tcop
- utils/adt
- include
- catalog
- commands
- nodes
- tcop
- utils
- test/modules
- test_ddl_deparse
- expected
- sql
Some content is hidden
Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.
72 files changed
+2667
-155
lines changedLines changed: 9 additions & 2 deletions
Original file line number | Diff line number | Diff line change | |
---|---|---|---|
| |||
29 | 29 |
| |
30 | 30 |
| |
31 | 31 |
| |
32 |
| - | |
| 32 | + | |
| 33 | + | |
33 | 34 |
| |
34 | 35 |
| |
35 | 36 |
| |
| |||
52 | 53 |
| |
53 | 54 |
| |
54 | 55 |
| |
55 |
| - | |
| 56 | + | |
| 57 | + | |
| 58 | + | |
| 59 | + | |
| 60 | + | |
| 61 | + | |
| 62 | + | |
56 | 63 |
| |
57 | 64 |
| |
58 | 65 |
| |
|
Lines changed: 92 additions & 1 deletion
Original file line number | Diff line number | Diff line change | |
---|---|---|---|
| |||
18066 | 18066 |
| |
18067 | 18067 |
| |
18068 | 18068 |
| |
| 18069 | + | |
| 18070 | + | |
| 18071 | + | |
| 18072 | + | |
| 18073 | + | |
| 18074 | + | |
| 18075 | + | |
| 18076 | + | |
| 18077 | + | |
| 18078 | + | |
| 18079 | + | |
| 18080 | + | |
| 18081 | + | |
| 18082 | + | |
| 18083 | + | |
| 18084 | + | |
| 18085 | + | |
| 18086 | + | |
| 18087 | + | |
| 18088 | + | |
| 18089 | + | |
| 18090 | + | |
| 18091 | + | |
| 18092 | + | |
| 18093 | + | |
| 18094 | + | |
| 18095 | + | |
| 18096 | + | |
| 18097 | + | |
| 18098 | + | |
| 18099 | + | |
| 18100 | + | |
| 18101 | + | |
| 18102 | + | |
| 18103 | + | |
| 18104 | + | |
| 18105 | + | |
| 18106 | + | |
| 18107 | + | |
| 18108 | + | |
| 18109 | + | |
| 18110 | + | |
| 18111 | + | |
| 18112 | + | |
| 18113 | + | |
| 18114 | + | |
| 18115 | + | |
| 18116 | + | |
| 18117 | + | |
| 18118 | + | |
| 18119 | + | |
| 18120 | + | |
| 18121 | + | |
| 18122 | + | |
| 18123 | + | |
| 18124 | + | |
| 18125 | + | |
| 18126 | + | |
| 18127 | + | |
| 18128 | + | |
| 18129 | + | |
| 18130 | + | |
| 18131 | + | |
| 18132 | + | |
| 18133 | + | |
| 18134 | + | |
| 18135 | + | |
| 18136 | + | |
| 18137 | + | |
| 18138 | + | |
| 18139 | + | |
| 18140 | + | |
| 18141 | + | |
| 18142 | + | |
| 18143 | + | |
| 18144 | + | |
| 18145 | + | |
| 18146 | + | |
| 18147 | + | |
| 18148 | + | |
| 18149 | + | |
| 18150 | + | |
| 18151 | + | |
| 18152 | + | |
| 18153 | + | |
| 18154 | + | |
| 18155 | + | |
| 18156 | + | |
| 18157 | + | |
| 18158 | + | |
| 18159 | + | |
18069 | 18160 |
| |
18070 |
| - | |
| 18161 | + | |
18071 | 18162 |
| |
18072 | 18163 |
| |
18073 | 18164 |
| |
|
Lines changed: 11 additions & 26 deletions
Original file line number | Diff line number | Diff line change | |
---|---|---|---|
| |||
48 | 48 |
| |
49 | 49 |
| |
50 | 50 |
| |
| 51 | + | |
51 | 52 |
| |
52 | 53 |
| |
53 | 54 |
| |
| |||
56 | 57 |
| |
57 | 58 |
| |
58 | 59 |
| |
| 60 | + | |
59 | 61 |
| |
60 | 62 |
| |
61 | 63 |
| |
| |||
64 | 66 |
| |
65 | 67 |
| |
66 | 68 |
| |
67 |
| - | |
68 |
| - | |
69 |
| - | |
70 |
| - | |
71 |
| - | |
72 |
| - | |
73 |
| - | |
74 |
| - | |
75 |
| - | |
76 |
| - | |
77 |
| - | |
78 |
| - | |
79 |
| - | |
80 |
| - | |
81 |
| - | |
82 |
| - | |
83 |
| - | |
84 |
| - | |
85 |
| - | |
86 |
| - | |
87 |
| - | |
88 |
| - | |
89 |
| - | |
90 |
| - | |
91 |
| - | |
92 |
| - | |
93 | 69 |
| |
94 | 70 |
| |
95 | 71 |
| |
| |||
605 | 581 |
| |
606 | 582 |
| |
607 | 583 |
| |
| 584 | + | |
| 585 | + | |
| 586 | + | |
| 587 | + | |
| 588 | + | |
| 589 | + | |
| 590 | + | |
| 591 | + | |
| 592 | + | |
608 | 593 |
| |
609 | 594 |
| |
610 | 595 |
| |
|
0 commit comments
Comments
(0)