Commit 35c8dd9
committed
Simplify some logic around setting pg_attribute.atthasdef.
DefineRelation was of the opinion that it could usefully pre-fill
atthasdef flags to eliminate work for StoreAttrDefault. This is not
the case, however: the tupledesc that it's filling is not the one that
InsertPgAttributeTuples will work from. The tupledesc used there is
made by RelationBuildLocalRelation, which deliberately doesn't copy
atthasdef. Moreover, if this did happen as the code thinks, it would
be wrong for the case of plain "DEFAULT NULL" clauses, since we detect
and ignore simple-null-Const defaults later on. Hence, remove the
useless code.
It also emerges that it's not really worth a special-case path in
StoreAttrDefault() for atthasdef already being set, because as far as
we can see that never happens: cases where an existing default gets
updated always do RemoveAttrDefault first, so as to clean up
possibly-no-longer-correct dependency entries. If it were the case
the code would still work, anyway.
Also remove a nearby comment made moot by 5eaa0e9.
Author: jian he <jian.universality@gmail.com>
Discussion: https://postgr.es/m/CACJufxHFssPvkP1we7WMhPD_1kwgbG52o=kQgL+TnVoX5LOyCQ@mail.gmail.com1 parent 4528768 commit 35c8dd9
2 files changed
+10
-24
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
43 | 43 | | |
44 | 44 | | |
45 | 45 | | |
| 46 | + | |
| 47 | + | |
| 48 | + | |
46 | 49 | | |
47 | 50 | | |
48 | 51 | | |
| |||
92 | 95 | | |
93 | 96 | | |
94 | 97 | | |
95 | | - | |
96 | | - | |
97 | | - | |
98 | | - | |
99 | | - | |
100 | 98 | | |
101 | | - | |
102 | | - | |
| 99 | + | |
| 100 | + | |
103 | 101 | | |
104 | | - | |
105 | | - | |
| 102 | + | |
| 103 | + | |
| 104 | + | |
| 105 | + | |
106 | 106 | | |
107 | | - | |
108 | | - | |
109 | 107 | | |
110 | 108 | | |
111 | 109 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
941 | 941 | | |
942 | 942 | | |
943 | 943 | | |
944 | | - | |
945 | | - | |
946 | | - | |
947 | | - | |
948 | 944 | | |
949 | 945 | | |
950 | 946 | | |
| |||
953 | 949 | | |
954 | 950 | | |
955 | 951 | | |
956 | | - | |
957 | 952 | | |
958 | 953 | | |
959 | | - | |
960 | | - | |
961 | 954 | | |
962 | 955 | | |
963 | 956 | | |
| |||
969 | 962 | | |
970 | 963 | | |
971 | 964 | | |
972 | | - | |
973 | 965 | | |
974 | 966 | | |
975 | 967 | | |
| |||
987 | 979 | | |
988 | 980 | | |
989 | 981 | | |
990 | | - | |
991 | 982 | | |
992 | | - | |
993 | | - | |
994 | 983 | | |
995 | 984 | | |
996 | 985 | | |
| |||
7363 | 7352 | | |
7364 | 7353 | | |
7365 | 7354 | | |
7366 | | - | |
7367 | | - | |
| 7355 | + | |
7368 | 7356 | | |
7369 | 7357 | | |
7370 | 7358 | | |
| |||
0 commit comments