forked frompostgres/postgres
- Notifications
You must be signed in to change notification settings - Fork6
Commit0fe1650


Jan Wieck
Jan Wieck
Changes pg_trigger and extend pg_rewrite in order to allow triggers and
rules to be defined with different, per session controllable, behaviorsfor replication purposes.This will allow replication systems like Slony-I and, as has been statedon pgsql-hackers, other products to control the firing mechanism oftriggers and rewrite rules without modifying the system catalog directly.The firing mechanisms are controlled by a new superuser-only GUCvariable, session_replication_role, together with a change topg_trigger.tgenabled and a new column pg_rewrite.ev_enabled. Bothcolumns are a single char data type now (tgenabled was a bool before).The possible values in these attributes are: 'O' - Trigger/Rule fires when session_replication_role is "origin" (default) or "local". This is the default behavior. 'D' - Trigger/Rule is disabled and fires never 'A' - Trigger/Rule fires always regardless of the setting of session_replication_role 'R' - Trigger/Rule fires when session_replication_role is "replica"The GUC variable can only be changed as long as the system does not haveany cached query plans. This will prevent changing the session role andaccidentally executing stored procedures or functions that have planscached that expand to the wrong query set due to differences in the rulefiring semantics.The SQL syntax for changing a triggers/rules firing semantics is ALTER TABLE <tabname> <when> TRIGGER|RULE <name>; <when> ::= ENABLE | ENABLE ALWAYS | ENABLE REPLICA | DISABLEpsql's \d command as well as pg_dump are extended in a backwardcompatible fashion.Jan1 parente927f8f commit0fe1650
File tree
24 files changed
+706
-154
lines changed- doc/src/sgml
- ref
- src
- backend
- commands
- parser
- rewrite
- utils
- cache
- misc
- bin
- pg_dump
- psql
- include
- catalog
- commands
- nodes
- rewrite
- utils
24 files changed
+706
-154
lines changedLines changed: 24 additions & 3 deletions
Original file line number | Diff line number | Diff line change | |
---|---|---|---|
| |||
1 |
| - | |
| 1 | + | |
2 | 2 |
| |
3 | 3 |
| |
4 | 4 |
| |
| |||
3639 | 3639 |
| |
3640 | 3640 |
| |
3641 | 3641 |
| |
| 3642 | + | |
| 3643 | + | |
| 3644 | + | |
| 3645 | + | |
| 3646 | + | |
| 3647 | + | |
| 3648 | + | |
| 3649 | + | |
| 3650 | + | |
| 3651 | + | |
| 3652 | + | |
| 3653 | + | |
| 3654 | + | |
| 3655 | + | |
3642 | 3656 |
| |
3643 | 3657 |
| |
3644 | 3658 |
| |
| |||
4178 | 4192 |
| |
4179 | 4193 |
| |
4180 | 4194 |
| |
4181 |
| - | |
| 4195 | + | |
4182 | 4196 |
| |
4183 |
| - | |
| 4197 | + | |
| 4198 | + | |
| 4199 | + | |
| 4200 | + | |
| 4201 | + | |
| 4202 | + | |
| 4203 | + | |
| 4204 | + | |
4184 | 4205 |
| |
4185 | 4206 |
| |
4186 | 4207 |
| |
|
Lines changed: 18 additions & 1 deletion
Original file line number | Diff line number | Diff line change | |
---|---|---|---|
| |||
1 |
| - | |
| 1 | + | |
2 | 2 |
| |
3 | 3 |
| |
4 | 4 |
| |
| |||
3523 | 3523 |
| |
3524 | 3524 |
| |
3525 | 3525 |
| |
| 3526 | + | |
| 3527 | + | |
| 3528 | + | |
| 3529 | + | |
| 3530 | + | |
| 3531 | + | |
| 3532 | + | |
| 3533 | + | |
| 3534 | + | |
| 3535 | + | |
| 3536 | + | |
| 3537 | + | |
| 3538 | + | |
| 3539 | + | |
| 3540 | + | |
| 3541 | + | |
| 3542 | + | |
3526 | 3543 |
| |
3527 | 3544 |
| |
3528 | 3545 |
| |
|
Lines changed: 30 additions & 3 deletions
Original file line number | Diff line number | Diff line change | |
---|---|---|---|
| |||
1 | 1 |
| |
2 |
| - | |
| 2 | + | |
3 | 3 |
| |
4 | 4 |
| |
5 | 5 |
| |
| |||
43 | 43 |
| |
44 | 44 |
| |
45 | 45 |
| |
| 46 | + | |
| 47 | + | |
| 48 | + | |
| 49 | + | |
| 50 | + | |
| 51 | + | |
46 | 52 |
| |
47 | 53 |
| |
48 | 54 |
| |
| |||
193 | 199 |
| |
194 | 200 |
| |
195 | 201 |
| |
196 |
| - | |
| 202 | + | |
197 | 203 |
| |
198 | 204 |
| |
199 |
| - | |
| 205 | + | |
200 | 206 |
| |
201 | 207 |
| |
202 | 208 |
| |
| |||
207 | 213 |
| |
208 | 214 |
| |
209 | 215 |
| |
| 216 | + | |
| 217 | + | |
| 218 | + | |
| 219 | + | |
| 220 | + | |
| 221 | + | |
| 222 | + | |
| 223 | + | |
| 224 | + | |
| 225 | + | |
| 226 | + | |
| 227 | + | |
| 228 | + | |
| 229 | + | |
| 230 | + | |
| 231 | + | |
| 232 | + | |
| 233 | + | |
| 234 | + | |
| 235 | + | |
| 236 | + | |
210 | 237 |
| |
211 | 238 |
| |
212 | 239 |
| |
|
Lines changed: 66 additions & 12 deletions
Original file line number | Diff line number | Diff line change | |
---|---|---|---|
| |||
8 | 8 |
| |
9 | 9 |
| |
10 | 10 |
| |
11 |
| - | |
| 11 | + | |
12 | 12 |
| |
13 | 13 |
| |
14 | 14 |
| |
| |||
53 | 53 |
| |
54 | 54 |
| |
55 | 55 |
| |
| 56 | + | |
56 | 57 |
| |
57 | 58 |
| |
58 | 59 |
| |
| |||
253 | 254 |
| |
254 | 255 |
| |
255 | 256 |
| |
256 |
| - | |
| 257 | + | |
| 258 | + | |
| 259 | + | |
257 | 260 |
| |
258 | 261 |
| |
259 | 262 |
| |
| |||
1955 | 1958 |
| |
1956 | 1959 |
| |
1957 | 1960 |
| |
| 1961 | + | |
| 1962 | + | |
1958 | 1963 |
| |
1959 | 1964 |
| |
1960 | 1965 |
| |
1961 | 1966 |
| |
1962 | 1967 |
| |
| 1968 | + | |
| 1969 | + | |
| 1970 | + | |
| 1971 | + | |
1963 | 1972 |
| |
1964 | 1973 |
| |
1965 | 1974 |
| |
| |||
2127 | 2136 |
| |
2128 | 2137 |
| |
2129 | 2138 |
| |
2130 |
| - | |
2131 |
| - | |
| 2139 | + | |
| 2140 | + | |
| 2141 | + | |
| 2142 | + | |
| 2143 | + | |
| 2144 | + | |
| 2145 | + | |
| 2146 | + | |
| 2147 | + | |
| 2148 | + | |
| 2149 | + | |
| 2150 | + | |
2132 | 2151 |
| |
2133 | 2152 |
| |
2134 |
| - | |
| 2153 | + | |
| 2154 | + | |
2135 | 2155 |
| |
2136 | 2156 |
| |
2137 |
| - | |
| 2157 | + | |
| 2158 | + | |
2138 | 2159 |
| |
2139 | 2160 |
| |
2140 |
| - | |
| 2161 | + | |
| 2162 | + | |
2141 | 2163 |
| |
2142 | 2164 |
| |
2143 |
| - | |
| 2165 | + | |
| 2166 | + | |
2144 | 2167 |
| |
2145 | 2168 |
| |
2146 |
| - | |
| 2169 | + | |
| 2170 | + | |
| 2171 | + | |
| 2172 | + | |
| 2173 | + | |
| 2174 | + | |
| 2175 | + | |
| 2176 | + | |
| 2177 | + | |
| 2178 | + | |
| 2179 | + | |
| 2180 | + | |
| 2181 | + | |
| 2182 | + | |
| 2183 | + | |
| 2184 | + | |
| 2185 | + | |
| 2186 | + | |
| 2187 | + | |
2147 | 2188 |
| |
| 2189 | + | |
2148 | 2190 |
| |
2149 | 2191 |
| |
2150 | 2192 |
| |
| |||
4380 | 4422 |
| |
4381 | 4423 |
| |
4382 | 4424 |
| |
4383 |
| - | |
| 4425 | + | |
4384 | 4426 |
| |
4385 | 4427 |
| |
4386 | 4428 |
| |
| |||
5877 | 5919 |
| |
5878 | 5920 |
| |
5879 | 5921 |
| |
5880 |
| - | |
| 5922 | + | |
| 5923 | + | |
| 5924 | + | |
| 5925 | + | |
| 5926 | + | |
| 5927 | + | |
| 5928 | + | |
| 5929 | + | |
| 5930 | + | |
| 5931 | + | |
| 5932 | + | |
| 5933 | + | |
| 5934 | + | |
5881 | 5935 |
| |
5882 |
| - | |
| 5936 | + | |
5883 | 5937 |
| |
5884 | 5938 |
| |
5885 | 5939 |
| |
|
0 commit comments
Comments
(0)