forked frompostgres/postgres
- Notifications
You must be signed in to change notification settings - Fork6
Commitd6f96ed
committed
Allow specifying column list for foreign key ON DELETE SET actions
Extend the foreign key ON DELETE actions SET NULL and SET DEFAULT byallowing the specification of a column list, like CREATE TABLE posts ( ... FOREIGN KEY (tenant_id, author_id) REFERENCES users ON DELETE SET NULL (author_id) );If a column list is specified, only those columns are set tonull/default, instead of all the columns in the foreign-keyconstraint.This is useful for multitenant or sharded schemas, where the tenant orshard ID is included in the primary key of all tables but shouldn't beset to null.Author: Paul Martinez <paulmtz@google.com>Discussion:https://www.postgresql.org/message-id/flat/CACqFVBZQyMYJV=njbSMxf+rbDHpx=W=B7AEaMKn8dWn9OZJY7w@mail.gmail.com1 parente464cb7 commitd6f96ed
File tree
22 files changed
+557
-72
lines changed- doc/src/sgml
- ref
- src
- backend
- catalog
- commands
- nodes
- parser
- utils
- adt
- cache
- include
- catalog
- nodes
- test/regress
- expected
- sql
22 files changed
+557
-72
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
2708 | 2708 | | |
2709 | 2709 | | |
2710 | 2710 | | |
| 2711 | + | |
| 2712 | + | |
| 2713 | + | |
| 2714 | + | |
| 2715 | + | |
| 2716 | + | |
| 2717 | + | |
| 2718 | + | |
| 2719 | + | |
| 2720 | + | |
| 2721 | + | |
| 2722 | + | |
2711 | 2723 | | |
2712 | 2724 | | |
2713 | 2725 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
1083 | 1083 | | |
1084 | 1084 | | |
1085 | 1085 | | |
| 1086 | + | |
| 1087 | + | |
| 1088 | + | |
| 1089 | + | |
| 1090 | + | |
| 1091 | + | |
| 1092 | + | |
| 1093 | + | |
| 1094 | + | |
| 1095 | + | |
| 1096 | + | |
| 1097 | + | |
| 1098 | + | |
| 1099 | + | |
| 1100 | + | |
| 1101 | + | |
| 1102 | + | |
| 1103 | + | |
| 1104 | + | |
| 1105 | + | |
| 1106 | + | |
| 1107 | + | |
| 1108 | + | |
| 1109 | + | |
| 1110 | + | |
| 1111 | + | |
| 1112 | + | |
| 1113 | + | |
| 1114 | + | |
1086 | 1115 | | |
1087 | 1116 | | |
1088 | 1117 | | |
1089 | | - | |
| 1118 | + | |
| 1119 | + | |
| 1120 | + | |
1090 | 1121 | | |
1091 | 1122 | | |
1092 | 1123 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
138 | 138 | | |
139 | 139 | | |
140 | 140 | | |
141 | | - | |
| 141 | + | |
142 | 142 | | |
143 | 143 | | |
144 | 144 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
108 | 108 | | |
109 | 109 | | |
110 | 110 | | |
111 | | - | |
| 111 | + | |
112 | 112 | | |
113 | 113 | | |
114 | 114 | | |
| |||
1169 | 1169 | | |
1170 | 1170 | | |
1171 | 1171 | | |
1172 | | - | |
| 1172 | + | |
1173 | 1173 | | |
1174 | 1174 | | |
1175 | | - | |
| 1175 | + | |
| 1176 | + | |
| 1177 | + | |
1176 | 1178 | | |
1177 | 1179 | | |
1178 | 1180 | | |
1179 | 1181 | | |
1180 | 1182 | | |
1181 | | - | |
| 1183 | + | |
1182 | 1184 | | |
1183 | 1185 | | |
1184 | | - | |
| 1186 | + | |
| 1187 | + | |
| 1188 | + | |
1185 | 1189 | | |
1186 | 1190 | | |
1187 | 1191 | | |
| |||
2223 | 2227 | | |
2224 | 2228 | | |
2225 | 2229 | | |
| 2230 | + | |
| 2231 | + | |
| 2232 | + | |
| 2233 | + | |
| 2234 | + | |
| 2235 | + | |
| 2236 | + | |
| 2237 | + | |
| 2238 | + | |
| 2239 | + | |
2226 | 2240 | | |
2227 | 2241 | | |
2228 | 2242 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
2441 | 2441 | | |
2442 | 2442 | | |
2443 | 2443 | | |
| 2444 | + | |
| 2445 | + | |
2444 | 2446 | | |
2445 | 2447 | | |
2446 | 2448 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
1969 | 1969 | | |
1970 | 1970 | | |
1971 | 1971 | | |
| 1972 | + | |
| 1973 | + | |
1972 | 1974 | | |
1973 | 1975 | | |
1974 | 1976 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
68 | 68 | | |
69 | 69 | | |
70 | 70 | | |
| 71 | + | |
| 72 | + | |
71 | 73 | | |
72 | 74 | | |
73 | 75 | | |
| |||
88 | 90 | | |
89 | 91 | | |
90 | 92 | | |
| 93 | + | |
91 | 94 | | |
92 | 95 | | |
93 | 96 | | |
| |||
136 | 139 | | |
137 | 140 | | |
138 | 141 | | |
| 142 | + | |
| 143 | + | |
| 144 | + | |
| 145 | + | |
| 146 | + | |
| 147 | + | |
| 148 | + | |
| 149 | + | |
| 150 | + | |
| 151 | + | |
139 | 152 | | |
140 | 153 | | |
141 | 154 | | |
142 | 155 | | |
143 | 156 | | |
144 | 157 | | |
145 | 158 | | |
| 159 | + | |
146 | 160 | | |
147 | 161 | | |
148 | 162 | | |
| |||
211 | 225 | | |
212 | 226 | | |
213 | 227 | | |
| 228 | + | |
| 229 | + | |
| 230 | + | |
| 231 | + | |
| 232 | + | |
214 | 233 | | |
215 | 234 | | |
216 | 235 | | |
| |||
1157 | 1176 | | |
1158 | 1177 | | |
1159 | 1178 | | |
1160 | | - | |
1161 | | - | |
| 1179 | + | |
| 1180 | + | |
| 1181 | + | |
1162 | 1182 | | |
1163 | 1183 | | |
1164 | 1184 | | |
1165 | 1185 | | |
1166 | | - | |
| 1186 | + | |
| 1187 | + | |
1167 | 1188 | | |
1168 | 1189 | | |
1169 | 1190 | | |
| |||
1260 | 1281 | | |
1261 | 1282 | | |
1262 | 1283 | | |
| 1284 | + | |
| 1285 | + | |
| 1286 | + | |
| 1287 | + | |
| 1288 | + | |
| 1289 | + | |
| 1290 | + | |
| 1291 | + | |
| 1292 | + | |
| 1293 | + | |
| 1294 | + | |
| 1295 | + | |
| 1296 | + | |
| 1297 | + | |
| 1298 | + | |
| 1299 | + | |
| 1300 | + | |
| 1301 | + | |
| 1302 | + | |
| 1303 | + | |
| 1304 | + | |
| 1305 | + | |
| 1306 | + | |
| 1307 | + | |
| 1308 | + | |
| 1309 | + | |
1263 | 1310 | | |
1264 | 1311 | | |
1265 | 1312 | | |
| |||
0 commit comments
Comments
(0)