Commit 64d4da5
committed
For foreign keys, check REFERENCES privilege only on the referenced table.
We were requiring that the user have REFERENCES permission on both the
referenced and referencing tables --- but this doesn't seem to have any
support in the SQL standard, which says only that you need REFERENCES
permission on the referenced table. And ALTER TABLE ADD FOREIGN KEY has
already checked that you own the referencing table, so the check could
only fail if a table owner has revoked his own REFERENCES permission.
Moreover, the symmetric interpretation of this permission is unintuitive
and confusing, as per complaint from Paul Jungwirth. So let's drop the
referencing-side check.
In passing, do a bit of wordsmithing on the GRANT reference page so that
all the privilege types are described in similar fashion.
Discussion: https://postgr.es/m/8940.1490906755@sss.pgh.pa.us1 parent 8f18a88 commit 64d4da5
File tree
3 files changed
+20
-15
lines changed- doc/src/sgml/ref
- src/backend/commands
3 files changed
+20
-15
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
750 | 750 | | |
751 | 751 | | |
752 | 752 | | |
753 | | - | |
754 | | - | |
755 | | - | |
| 753 | + | |
| 754 | + | |
| 755 | + | |
| 756 | + | |
| 757 | + | |
756 | 758 | | |
757 | 759 | | |
758 | 760 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
257 | 257 | | |
258 | 258 | | |
259 | 259 | | |
260 | | - | |
261 | | - | |
262 | | - | |
263 | | - | |
| 260 | + | |
| 261 | + | |
| 262 | + | |
264 | 263 | | |
265 | 264 | | |
266 | 265 | | |
| |||
351 | 350 | | |
352 | 351 | | |
353 | 352 | | |
354 | | - | |
| 353 | + | |
355 | 354 | | |
356 | 355 | | |
357 | 356 | | |
| |||
360 | 359 | | |
361 | 360 | | |
362 | 361 | | |
363 | | - | |
364 | | - | |
| 362 | + | |
| 363 | + | |
365 | 364 | | |
366 | 365 | | |
367 | | - | |
368 | | - | |
369 | | - | |
| 366 | + | |
| 367 | + | |
| 368 | + | |
370 | 369 | | |
371 | 370 | | |
372 | 371 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
6817 | 6817 | | |
6818 | 6818 | | |
6819 | 6819 | | |
6820 | | - | |
6821 | 6820 | | |
6822 | 6821 | | |
6823 | 6822 | | |
| |||
7745 | 7744 | | |
7746 | 7745 | | |
7747 | 7746 | | |
7748 | | - | |
| 7747 | + | |
| 7748 | + | |
| 7749 | + | |
| 7750 | + | |
| 7751 | + | |
| 7752 | + | |
7749 | 7753 | | |
7750 | 7754 | | |
7751 | 7755 | | |
| |||
0 commit comments