- Notifications
You must be signed in to change notification settings - Fork5
Commit874fe3a
committed
Fix CREATE MATVIEW/CREATE TABLE AS ... WITH NO DATA to not plan the query.
Previously, these commands always planned the given query and went throughexecutor startup before deciding not to actually run the query if WITH NODATA is specified. This behavior is problematic for pg_dump because itmay cause errors to be raised that we would rather not see before aREFRESH MATERIALIZED VIEW command is issued. See for example bug #13907from Marian Krucina. This change is not sufficient to fix that particularbug, because we also need to tweak pg_dump to issue the REFRESH later,but it's a necessary step on the way.A user-visible side effect of doing things this way is that the returnedcommand tag for WITH NO DATA cases will now be "CREATE MATERIALIZED VIEW"or "CREATE TABLE AS", not "SELECT 0". We could preserve the old behaviorbut it would take more code, and arguably that was just an implementationartifact not intended behavior anyhow.In 9.5 and HEAD, also get rid of the static variable CreateAsReladdr, whichwas trouble waiting to happen; there is not any prohibition on nestedCREATE commands.Back-patch to 9.3 where CREATE MATERIALIZED VIEW was introduced.Michael Paquier and Tom LaneReport: <20160202161407.2778.24659@wrigleys.postgresql.org>1 parent6734a1c commit874fe3a
File tree
8 files changed
+391
-161
lines changed- src
- backend
- commands
- nodes
- include/nodes
- test/regress
- expected
- sql
8 files changed
+391
-161
lines changedLines changed: 237 additions & 141 deletions
Large diffs are not rendered by default.
Lines changed: 5 additions & 17 deletions
Original file line number | Diff line number | Diff line change | |
---|---|---|---|
| |||
82 | 82 |
| |
83 | 83 |
| |
84 | 84 |
| |
85 |
| - | |
| 85 | + | |
86 | 86 |
| |
87 | 87 |
| |
88 | 88 |
| |
89 |
| - | |
90 |
| - | |
91 |
| - | |
92 |
| - | |
93 |
| - | |
94 |
| - | |
95 |
| - | |
96 |
| - | |
97 |
| - | |
98 |
| - | |
99 |
| - | |
100 |
| - | |
101 |
| - | |
102 |
| - | |
103 |
| - | |
| 89 | + | |
| 90 | + | |
| 91 | + | |
| 92 | + | |
104 | 93 |
| |
105 | 94 |
| |
106 | 95 |
| |
| |||
117 | 106 |
| |
118 | 107 |
| |
119 | 108 |
| |
120 |
| - | |
121 | 109 |
| |
122 | 110 |
| |
123 | 111 |
| |
|
Lines changed: 30 additions & 0 deletions
Original file line number | Diff line number | Diff line change | |
---|---|---|---|
| |||
476 | 476 |
| |
477 | 477 |
| |
478 | 478 |
| |
| 479 | + | |
| 480 | + | |
| 481 | + | |
| 482 | + | |
| 483 | + | |
| 484 | + | |
| 485 | + | |
| 486 | + | |
| 487 | + | |
| 488 | + | |
| 489 | + | |
| 490 | + | |
| 491 | + | |
| 492 | + | |
| 493 | + | |
| 494 | + | |
| 495 | + | |
| 496 | + | |
| 497 | + | |
| 498 | + | |
| 499 | + | |
| 500 | + | |
| 501 | + | |
| 502 | + | |
| 503 | + | |
| 504 | + | |
| 505 | + | |
| 506 | + | |
| 507 | + | |
| 508 | + | |
479 | 509 |
| |
480 | 510 |
| |
481 | 511 |
| |
|
Lines changed: 3 additions & 0 deletions
Original file line number | Diff line number | Diff line change | |
---|---|---|---|
| |||
72 | 72 |
| |
73 | 73 |
| |
74 | 74 |
| |
| 75 | + | |
| 76 | + | |
| 77 | + | |
75 | 78 |
| |
76 | 79 |
| |
77 | 80 |
| |
|
Lines changed: 41 additions & 2 deletions
Original file line number | Diff line number | Diff line change | |
---|---|---|---|
| |||
455 | 455 |
| |
456 | 456 |
| |
457 | 457 |
| |
458 |
| - | |
| 458 | + | |
| 459 | + | |
| 460 | + | |
| 461 | + | |
| 462 | + | |
| 463 | + | |
| 464 | + | |
| 465 | + | |
459 | 466 |
| |
460 | 467 |
| |
461 | 468 |
| |
462 | 469 |
| |
463 | 470 |
| |
464 | 471 |
| |
| 472 | + | |
| 473 | + | |
| 474 | + | |
465 | 475 |
| |
466 | 476 |
| |
467 | 477 |
| |
| |||
474 | 484 |
| |
475 | 485 |
| |
476 | 486 |
| |
| 487 | + | |
| 488 | + | |
| 489 | + | |
| 490 | + | |
| 491 | + | |
| 492 | + | |
| 493 | + | |
| 494 | + | |
| 495 | + | |
| 496 | + | |
| 497 | + | |
| 498 | + | |
| 499 | + | |
| 500 | + | |
| 501 | + | |
| 502 | + | |
| 503 | + | |
| 504 | + | |
477 | 505 |
| |
478 |
| - | |
| 506 | + | |
| 507 | + | |
| 508 | + | |
| 509 | + | |
| 510 | + | |
| 511 | + | |
| 512 | + | |
| 513 | + | |
| 514 | + | |
| 515 | + | |
| 516 | + | |
| 517 | + | |
479 | 518 |
| |
480 | 519 |
| |
481 | 520 |
| |
|
Lines changed: 38 additions & 0 deletions
Original file line number | Diff line number | Diff line change | |
---|---|---|---|
| |||
50 | 50 |
| |
51 | 51 |
| |
52 | 52 |
| |
| 53 | + | |
| 54 | + | |
| 55 | + | |
| 56 | + | |
| 57 | + | |
| 58 | + | |
| 59 | + | |
| 60 | + | |
| 61 | + | |
| 62 | + | |
| 63 | + | |
| 64 | + | |
| 65 | + | |
| 66 | + | |
| 67 | + | |
| 68 | + | |
| 69 | + | |
| 70 | + | |
| 71 | + | |
| 72 | + | |
| 73 | + | |
| 74 | + | |
| 75 | + | |
| 76 | + | |
| 77 | + | |
| 78 | + | |
| 79 | + | |
| 80 | + | |
| 81 | + | |
| 82 | + | |
| 83 | + | |
| 84 | + | |
| 85 | + | |
| 86 | + | |
| 87 | + | |
| 88 | + | |
| 89 | + | |
| 90 | + | |
53 | 91 |
| |
54 | 92 |
| |
55 | 93 |
| |
|
Lines changed: 18 additions & 1 deletion
Original file line number | Diff line number | Diff line change | |
---|---|---|---|
| |||
176 | 176 |
| |
177 | 177 |
| |
178 | 178 |
| |
179 |
| - | |
| 179 | + | |
| 180 | + | |
| 181 | + | |
| 182 | + | |
| 183 | + | |
| 184 | + | |
180 | 185 |
| |
181 | 186 |
| |
182 | 187 |
| |
183 | 188 |
| |
184 | 189 |
| |
185 | 190 |
| |
| 191 | + | |
| 192 | + | |
| 193 | + | |
186 | 194 |
| |
187 | 195 |
| |
| 196 | + | |
| 197 | + | |
| 198 | + | |
188 | 199 |
| |
189 | 200 |
| |
| 201 | + | |
| 202 | + | |
| 203 | + | |
| 204 | + | |
| 205 | + | |
| 206 | + | |
190 | 207 |
| |
191 | 208 |
| |
192 | 209 |
| |
|
Lines changed: 19 additions & 0 deletions
Original file line number | Diff line number | Diff line change | |
---|---|---|---|
| |||
53 | 53 |
| |
54 | 54 |
| |
55 | 55 |
| |
| 56 | + | |
| 57 | + | |
| 58 | + | |
| 59 | + | |
| 60 | + | |
| 61 | + | |
| 62 | + | |
| 63 | + | |
| 64 | + | |
| 65 | + | |
| 66 | + | |
| 67 | + | |
| 68 | + | |
| 69 | + | |
| 70 | + | |
| 71 | + | |
| 72 | + | |
| 73 | + | |
| 74 | + | |
56 | 75 |
| |
57 | 76 |
| |
58 | 77 |
| |
|
0 commit comments
Comments
(0)