- Notifications
You must be signed in to change notification settings - Fork4.9k
Commitf7f83a5
committed
Ensure that expandTableLikeClause() re-examines the same table.
As it stood, expandTableLikeClause() re-did the same relation_openrvcall that transformTableLikeClause() had done. However there arescenarios where this would not find the same table as expected.We hold lock on the LIKE source table, so it can't be renamed ordropped, but another table could appear before it in the search path.This explains the odd behavior reported in bug #16758 when cloning atable as a temp table of the same name. This case worked as expectedbefore commit5028981 introduced the need to open the source tabletwice, so we should fix it.To make really sure we get the same table, let's re-open it by OID notname. That requires adding an OID field to struct TableLikeClause,which is a little nervous-making from an ABI standpoint, but as longas it's at the end I don't think there's any serious risk.Per bug #16758 from Marc Boeren. Like the previous patch,back-patch to all supported branches.Discussion:https://postgr.es/m/16758-840e84a6cfab276d@postgresql.org1 parent677f74e commitf7f83a5
File tree
8 files changed
+45
-3
lines changed- src
- backend
- nodes
- parser
- include/nodes
- test/regress
- expected
- sql
8 files changed
+45
-3
lines changedLines changed: 1 addition & 0 deletions
Original file line number | Diff line number | Diff line change | |
---|---|---|---|
| |||
3411 | 3411 |
| |
3412 | 3412 |
| |
3413 | 3413 |
| |
| 3414 | + | |
3414 | 3415 |
| |
3415 | 3416 |
| |
3416 | 3417 |
| |
|
Lines changed: 1 addition & 0 deletions
Original file line number | Diff line number | Diff line change | |
---|---|---|---|
| |||
1254 | 1254 |
| |
1255 | 1255 |
| |
1256 | 1256 |
| |
| 1257 | + | |
1257 | 1258 |
| |
1258 | 1259 |
| |
1259 | 1260 |
| |
|
Lines changed: 1 addition & 0 deletions
Original file line number | Diff line number | Diff line change | |
---|---|---|---|
| |||
2811 | 2811 |
| |
2812 | 2812 |
| |
2813 | 2813 |
| |
| 2814 | + | |
2814 | 2815 |
| |
2815 | 2816 |
| |
2816 | 2817 |
| |
|
Lines changed: 1 addition & 0 deletions
Original file line number | Diff line number | Diff line change | |
---|---|---|---|
| |||
3643 | 3643 |
| |
3644 | 3644 |
| |
3645 | 3645 |
| |
| 3646 | + | |
3646 | 3647 |
| |
3647 | 3648 |
| |
3648 | 3649 |
| |
|
Lines changed: 11 additions & 3 deletions
Original file line number | Diff line number | Diff line change | |
---|---|---|---|
| |||
1105 | 1105 |
| |
1106 | 1106 |
| |
1107 | 1107 |
| |
1108 |
| - | |
| 1108 | + | |
| 1109 | + | |
1109 | 1110 |
| |
1110 | 1111 |
| |
1111 | 1112 |
| |
1112 | 1113 |
| |
1113 | 1114 |
| |
1114 | 1115 |
| |
| 1116 | + | |
| 1117 | + | |
1115 | 1118 |
| |
| 1119 | + | |
1116 | 1120 |
| |
1117 | 1121 |
| |
1118 | 1122 |
| |
| |||
1185 | 1189 |
| |
1186 | 1190 |
| |
1187 | 1191 |
| |
1188 |
| - | |
| 1192 | + | |
| 1193 | + | |
1189 | 1194 |
| |
1190 |
| - | |
| 1195 | + | |
| 1196 | + | |
| 1197 | + | |
| 1198 | + | |
1191 | 1199 |
| |
1192 | 1200 |
| |
1193 | 1201 |
| |
|
Lines changed: 1 addition & 0 deletions
Original file line number | Diff line number | Diff line change | |
---|---|---|---|
| |||
673 | 673 |
| |
674 | 674 |
| |
675 | 675 |
| |
| 676 | + | |
676 | 677 |
| |
677 | 678 |
| |
678 | 679 |
| |
|
Lines changed: 21 additions & 0 deletions
Original file line number | Diff line number | Diff line change | |
---|---|---|---|
| |||
455 | 455 |
| |
456 | 456 |
| |
457 | 457 |
| |
| 458 | + | |
| 459 | + | |
| 460 | + | |
| 461 | + | |
| 462 | + | |
| 463 | + | |
| 464 | + | |
| 465 | + | |
| 466 | + | |
| 467 | + | |
| 468 | + | |
| 469 | + | |
| 470 | + | |
| 471 | + | |
| 472 | + | |
| 473 | + | |
| 474 | + | |
| 475 | + | |
| 476 | + | |
| 477 | + | |
| 478 | + | |
458 | 479 |
| |
459 | 480 |
| |
460 | 481 |
| |
|
Lines changed: 8 additions & 0 deletions
Original file line number | Diff line number | Diff line change | |
---|---|---|---|
| |||
173 | 173 |
| |
174 | 174 |
| |
175 | 175 |
| |
| 176 | + | |
| 177 | + | |
| 178 | + | |
| 179 | + | |
| 180 | + | |
| 181 | + | |
| 182 | + | |
| 183 | + | |
176 | 184 |
| |
177 | 185 |
| |
178 | 186 |
| |
|
0 commit comments
Comments
(0)