Commit fff2a7d
committed
Don't access catalogs to validate GUCs when not connected to a DB.
Vignesh found this bug in the check function for
default_table_access_method's check hook, but that was just copied
from older GUCs. Investigation by Michael and me then found the bug in
further places.
When not connected to a database (e.g. in a walsender connection), we
cannot perform (most) GUC checks that need database access. Even when
only shared tables are needed, unless they're
nailed (c.f. RelationCacheInitializePhase2()), they cannot be accessed
without pg_class etc. being present.
Fix by extending the existing IsTransactionState() checks to also
check for MyDatabaseOid.
Reported-By: Vignesh C, Michael Paquier, Andres Freund
Author: Vignesh C, Andres Freund
Discussion: https://postgr.es/m/CALDaNm1KXK9gbZfY-p_peRFm_XrBh1OwQO1Kk6Gig0c0fVZ2uw%40mail.gmail.com
Backpatch: 9.4-1 parent 92a8864 commit fff2a7d
File tree
3 files changed
+18
-12
lines changed- src/backend
- access/table
- commands
- utils/cache
3 files changed
+18
-12
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
18 | 18 | | |
19 | 19 | | |
20 | 20 | | |
| 21 | + | |
21 | 22 | | |
22 | 23 | | |
23 | 24 | | |
| |||
119 | 120 | | |
120 | 121 | | |
121 | 122 | | |
122 | | - | |
123 | | - | |
| 123 | + | |
| 124 | + | |
| 125 | + | |
124 | 126 | | |
125 | | - | |
| 127 | + | |
126 | 128 | | |
127 | 129 | | |
128 | 130 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
1069 | 1069 | | |
1070 | 1070 | | |
1071 | 1071 | | |
1072 | | - | |
1073 | | - | |
| 1072 | + | |
| 1073 | + | |
| 1074 | + | |
1074 | 1075 | | |
1075 | | - | |
| 1076 | + | |
1076 | 1077 | | |
1077 | 1078 | | |
1078 | 1079 | | |
| |||
1190 | 1191 | | |
1191 | 1192 | | |
1192 | 1193 | | |
1193 | | - | |
1194 | | - | |
| 1194 | + | |
| 1195 | + | |
| 1196 | + | |
1195 | 1197 | | |
1196 | 1198 | | |
1197 | | - | |
| 1199 | + | |
1198 | 1200 | | |
1199 | 1201 | | |
1200 | 1202 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
38 | 38 | | |
39 | 39 | | |
40 | 40 | | |
| 41 | + | |
41 | 42 | | |
42 | 43 | | |
43 | 44 | | |
| |||
590 | 591 | | |
591 | 592 | | |
592 | 593 | | |
593 | | - | |
594 | | - | |
| 594 | + | |
| 595 | + | |
| 596 | + | |
595 | 597 | | |
596 | | - | |
| 598 | + | |
597 | 599 | | |
598 | 600 | | |
599 | 601 | | |
| |||
0 commit comments