Commit 3a07ba1
committed
Ensure that pg_get_ruledef()'s output matches pg_get_viewdef()'s.
Various cases involving renaming of view columns are handled by having
make_viewdef pass down the view's current relation tupledesc to
get_query_def, which then takes care to use the column names from the
tupledesc for the output column names of the SELECT. For some reason
though, we'd missed teaching make_ruledef to do similarly when it is
printing an ON SELECT rule, even though this is exactly the same case.
The results from pg_get_ruledef would then be different and arguably wrong.
In particular, this breaks pre-v10 versions of pg_dump, which in some
situations would define views by means of emitting a CREATE RULE ... ON
SELECT command. Third-party tools might not be happy either.
In passing, clean up some crufty code in make_viewdef; we'd apparently
modernized the equivalent code in make_ruledef somewhere along the way,
and missed this copy.
Per report from Gilles Darold. Back-patch to all supported versions.
Discussion: https://postgr.es/m/ec05659a-40ff-4510-fc45-ca9d965d0838@dalibo.com1 parent bcc2c3b commit 3a07ba1
File tree
3 files changed
+60
-5
lines changed- src
- backend/utils/adt
- test/regress
- expected
- sql
3 files changed
+60
-5
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
4220 | 4220 | | |
4221 | 4221 | | |
4222 | 4222 | | |
| 4223 | + | |
| 4224 | + | |
4223 | 4225 | | |
4224 | 4226 | | |
4225 | 4227 | | |
| |||
4256 | 4258 | | |
4257 | 4259 | | |
4258 | 4260 | | |
| 4261 | + | |
| 4262 | + | |
4259 | 4263 | | |
4260 | 4264 | | |
4261 | 4265 | | |
| |||
4272 | 4276 | | |
4273 | 4277 | | |
4274 | 4278 | | |
| 4279 | + | |
4275 | 4280 | | |
4276 | 4281 | | |
4277 | 4282 | | |
| |||
4361 | 4366 | | |
4362 | 4367 | | |
4363 | 4368 | | |
4364 | | - | |
| 4369 | + | |
4365 | 4370 | | |
4366 | 4371 | | |
4367 | 4372 | | |
| |||
4379 | 4384 | | |
4380 | 4385 | | |
4381 | 4386 | | |
4382 | | - | |
| 4387 | + | |
4383 | 4388 | | |
4384 | 4389 | | |
4385 | 4390 | | |
| 4391 | + | |
| 4392 | + | |
4386 | 4393 | | |
4387 | 4394 | | |
4388 | 4395 | | |
| |||
4404 | 4411 | | |
4405 | 4412 | | |
4406 | 4413 | | |
| 4414 | + | |
4407 | 4415 | | |
4408 | 4416 | | |
4409 | 4417 | | |
4410 | 4418 | | |
4411 | 4419 | | |
4412 | 4420 | | |
4413 | | - | |
| 4421 | + | |
| 4422 | + | |
| 4423 | + | |
4414 | 4424 | | |
4415 | 4425 | | |
4416 | | - | |
| 4426 | + | |
| 4427 | + | |
| 4428 | + | |
4417 | 4429 | | |
4418 | 4430 | | |
4419 | | - | |
| 4431 | + | |
| 4432 | + | |
| 4433 | + | |
4420 | 4434 | | |
| 4435 | + | |
4421 | 4436 | | |
4422 | 4437 | | |
4423 | 4438 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
1619 | 1619 | | |
1620 | 1620 | | |
1621 | 1621 | | |
| 1622 | + | |
| 1623 | + | |
| 1624 | + | |
| 1625 | + | |
| 1626 | + | |
| 1627 | + | |
| 1628 | + | |
| 1629 | + | |
| 1630 | + | |
| 1631 | + | |
| 1632 | + | |
| 1633 | + | |
| 1634 | + | |
| 1635 | + | |
| 1636 | + | |
| 1637 | + | |
| 1638 | + | |
| 1639 | + | |
| 1640 | + | |
| 1641 | + | |
| 1642 | + | |
| 1643 | + | |
| 1644 | + | |
| 1645 | + | |
| 1646 | + | |
| 1647 | + | |
| 1648 | + | |
| 1649 | + | |
| 1650 | + | |
1622 | 1651 | | |
1623 | 1652 | | |
1624 | 1653 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
541 | 541 | | |
542 | 542 | | |
543 | 543 | | |
| 544 | + | |
| 545 | + | |
| 546 | + | |
| 547 | + | |
| 548 | + | |
| 549 | + | |
| 550 | + | |
| 551 | + | |
| 552 | + | |
| 553 | + | |
| 554 | + | |
544 | 555 | | |
545 | 556 | | |
546 | 557 | | |
| |||
0 commit comments