Commit 9a915e5
committed
Improve the handling of SET CONSTRAINTS commands by having them search
pg_constraint before searching pg_trigger. This allows saner handling of
corner cases; in particular we now say "constraint is not deferrable"
rather than "constraint does not exist" when the command is applied to
a constraint that's inherently non-deferrable. Per a gripe several months
ago from hubert depesz lubaczewski.
To make this work without breaking user-defined constraint triggers,
we have to add entries for them to pg_constraint. However, in return
we can remove the pgconstrname column from pg_constraint, which represents
a fairly sizable space savings. I also replaced the tgisconstraint column
with tgisinternal; the old meaning of tgisconstraint can now be had by
testing for nonzero tgconstraint, while there is no other way to get
the old meaning of nonzero tgconstraint, namely that the trigger was
internally generated rather than being user-created.
In passing, fix an old misstatement in the docs and comments, namely that
pg_trigger.tgdeferrable is exactly redundant with pg_constraint.condeferrable.
Actually, we mark RI action triggers as nondeferrable even when they belong to
a nominally deferrable FK constraint. The SET CONSTRAINTS code now relies on
that instead of hard-coding a list of exception OIDs.1 parent ee3b418 commit 9a915e5
File tree
17 files changed
+293
-235
lines changed- doc/src/sgml
- src
- backend
- catalog
- commands
- tcop
- utils/adt
- bin
- pg_dump
- psql
- include
- catalog
- commands
- nodes
- utils
17 files changed
+293
-235
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
1 | | - | |
| 1 | + | |
2 | 2 | | |
3 | 3 | | |
4 | 4 | | |
| |||
1721 | 1721 | | |
1722 | 1722 | | |
1723 | 1723 | | |
| 1724 | + | |
| 1725 | + | |
| 1726 | + | |
| 1727 | + | |
| 1728 | + | |
1724 | 1729 | | |
1725 | 1730 | | |
1726 | 1731 | | |
| |||
1764 | 1769 | | |
1765 | 1770 | | |
1766 | 1771 | | |
| 1772 | + | |
1767 | 1773 | | |
1768 | 1774 | | |
1769 | 1775 | | |
| |||
1873 | 1879 | | |
1874 | 1880 | | |
1875 | 1881 | | |
1876 | | - | |
| 1882 | + | |
| 1883 | + | |
1877 | 1884 | | |
1878 | 1885 | | |
1879 | 1886 | | |
| |||
4826 | 4833 | | |
4827 | 4834 | | |
4828 | 4835 | | |
4829 | | - | |
| 4836 | + | |
4830 | 4837 | | |
4831 | 4838 | | |
4832 | | - | |
4833 | | - | |
4834 | | - | |
4835 | | - | |
4836 | | - | |
4837 | | - | |
4838 | | - | |
4839 | | - | |
| 4839 | + | |
| 4840 | + | |
4840 | 4841 | | |
4841 | 4842 | | |
4842 | 4843 | | |
| |||
4857 | 4858 | | |
4858 | 4859 | | |
4859 | 4860 | | |
4860 | | - | |
| 4861 | + | |
4861 | 4862 | | |
4862 | 4863 | | |
4863 | 4864 | | |
| |||
4919 | 4920 | | |
4920 | 4921 | | |
4921 | 4922 | | |
4922 | | - | |
4923 | | - | |
4924 | | - | |
4925 | | - | |
4926 | | - | |
4927 | | - | |
4928 | | - | |
| 4923 | + | |
| 4924 | + | |
| 4925 | + | |
| 4926 | + | |
| 4927 | + | |
| 4928 | + | |
4929 | 4929 | | |
4930 | 4930 | | |
4931 | 4931 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
1 | | - | |
| 1 | + | |
2 | 2 | | |
3 | 3 | | |
4 | 4 | | |
| |||
506 | 506 | | |
507 | 507 | | |
508 | 508 | | |
509 | | - | |
| 509 | + | |
510 | 510 | | |
511 | 511 | | |
512 | 512 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
8 | 8 | | |
9 | 9 | | |
10 | 10 | | |
11 | | - | |
| 11 | + | |
12 | 12 | | |
13 | 13 | | |
14 | 14 | | |
| |||
825 | 825 | | |
826 | 826 | | |
827 | 827 | | |
828 | | - | |
| 828 | + | |
| 829 | + | |
829 | 830 | | |
830 | 831 | | |
831 | 832 | | |
| |||
840 | 841 | | |
841 | 842 | | |
842 | 843 | | |
843 | | - | |
844 | | - | |
845 | | - | |
| 844 | + | |
846 | 845 | | |
847 | 846 | | |
848 | 847 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
4 | 4 | | |
5 | 5 | | |
6 | 6 | | |
7 | | - | |
| 7 | + | |
8 | 8 | | |
9 | 9 | | |
10 | 10 | | |
| |||
1666 | 1666 | | |
1667 | 1667 | | |
1668 | 1668 | | |
1669 | | - | |
| 1669 | + | |
1670 | 1670 | | |
1671 | 1671 | | |
1672 | 1672 | | |
| |||
1868 | 1868 | | |
1869 | 1869 | | |
1870 | 1870 | | |
1871 | | - | |
| 1871 | + | |
1872 | 1872 | | |
1873 | 1873 | | |
1874 | 1874 | | |
| |||
1953 | 1953 | | |
1954 | 1954 | | |
1955 | 1955 | | |
1956 | | - | |
| 1956 | + | |
1957 | 1957 | | |
1958 | 1958 | | |
1959 | 1959 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
8 | 8 | | |
9 | 9 | | |
10 | 10 | | |
11 | | - | |
| 11 | + | |
12 | 12 | | |
13 | 13 | | |
14 | 14 | | |
| |||
5338 | 5338 | | |
5339 | 5339 | | |
5340 | 5340 | | |
5341 | | - | |
| 5341 | + | |
5342 | 5342 | | |
5343 | 5343 | | |
5344 | 5344 | | |
| |||
5399 | 5399 | | |
5400 | 5400 | | |
5401 | 5401 | | |
5402 | | - | |
| 5402 | + | |
5403 | 5403 | | |
5404 | 5404 | | |
5405 | 5405 | | |
| |||
5424 | 5424 | | |
5425 | 5425 | | |
5426 | 5426 | | |
5427 | | - | |
5428 | | - | |
| 5427 | + | |
5429 | 5428 | | |
5430 | 5429 | | |
5431 | 5430 | | |
| |||
5463 | 5462 | | |
5464 | 5463 | | |
5465 | 5464 | | |
5466 | | - | |
| 5465 | + | |
5467 | 5466 | | |
5468 | 5467 | | |
5469 | 5468 | | |
| |||
5506 | 5505 | | |
5507 | 5506 | | |
5508 | 5507 | | |
5509 | | - | |
5510 | | - | |
| 5508 | + | |
5511 | 5509 | | |
5512 | 5510 | | |
5513 | 5511 | | |
| |||
5517 | 5515 | | |
5518 | 5516 | | |
5519 | 5517 | | |
5520 | | - | |
| 5518 | + | |
5521 | 5519 | | |
5522 | 5520 | | |
5523 | 5521 | | |
| |||
5560 | 5558 | | |
5561 | 5559 | | |
5562 | 5560 | | |
5563 | | - | |
5564 | | - | |
| 5561 | + | |
5565 | 5562 | | |
5566 | 5563 | | |
5567 | 5564 | | |
| |||
0 commit comments