forked frompostgres/postgres
- Notifications
You must be signed in to change notification settings - Fork6
Commit918e21d
committed
Repair pg_upgrade for identity sequences with non-default persistence.
Since we introduced unlogged sequences in v15, identity sequenceshave defaulted to having the same persistence as their owning table.However, it is possible to change that with ALTER SEQUENCE, andpg_dump tries to preserve the logged-ness of sequences when it doesn'tmatch (as indeed it wouldn't for an unlogged table from before v15).The fly in the ointment is that ALTER SEQUENCE SET [UN]LOGGED failsin binary-upgrade mode, because it needs to assign a new relfilenodewhich we cannot permit in that mode. Thus, trying to pg_upgrade adatabase containing a mismatching identity sequence failed.To fix, add syntax to ADD/ALTER COLUMN GENERATED AS IDENTITY to allowthe sequence's persistence to be set correctly at creation, and usethat instead of ALTER SEQUENCE SET [UN]LOGGED in pg_dump. (I tried tomake SET [UN]LOGGED work without any pg_dump modifications, but thatseems too fragile to be a desirable answer. This way should bemarkedly faster anyhow.)In passing, document the previously-undocumented SEQUENCE NAME optionthat pg_dump also relies on for identity sequences; I see no valuein trying to pretend it doesn't exist.Per bug #18618 from Anthony Hsu.Back-patch to v15 where we invented this stuff.Discussion:https://postgr.es/m/18618-d4eb26d669ed110a@postgresql.org1 parent2520226 commit918e21d
File tree
7 files changed
+112
-41
lines changed- doc/src/sgml/ref
- src
- backend
- commands
- parser
- bin/pg_dump
- test/regress
- expected
- sql
7 files changed
+112
-41
lines changedLines changed: 12 additions & 5 deletions
Original file line number | Diff line number | Diff line change | |
---|---|---|---|
| |||
924 | 924 |
| |
925 | 925 |
| |
926 | 926 |
| |
927 |
| - | |
928 |
| - | |
| 927 | + | |
| 928 | + | |
929 | 929 |
| |
930 | 930 |
| |
931 | 931 |
| |
| |||
955 | 955 |
| |
956 | 956 |
| |
957 | 957 |
| |
958 |
| - | |
959 |
| - | |
960 |
| - | |
| 958 | + | |
| 959 | + | |
| 960 | + | |
| 961 | + | |
| 962 | + | |
| 963 | + | |
| 964 | + | |
| 965 | + | |
| 966 | + | |
| 967 | + | |
961 | 968 |
| |
962 | 969 |
| |
963 | 970 |
| |
|
Lines changed: 4 additions & 1 deletion
Original file line number | Diff line number | Diff line change | |
---|---|---|---|
| |||
1347 | 1347 |
| |
1348 | 1348 |
| |
1349 | 1349 |
| |
1350 |
| - | |
| 1350 | + | |
| 1351 | + | |
| 1352 | + | |
| 1353 | + | |
1351 | 1354 |
| |
1352 | 1355 |
| |
1353 | 1356 |
| |
|
Lines changed: 8 additions & 1 deletion
Original file line number | Diff line number | Diff line change | |
---|---|---|---|
| |||
4936 | 4936 |
| |
4937 | 4937 |
| |
4938 | 4938 |
| |
| 4939 | + | |
| 4940 | + | |
| 4941 | + | |
| 4942 | + | |
4939 | 4943 |
| |
4940 | 4944 |
| |
4941 | 4945 |
| |
| |||
4958 | 4962 |
| |
4959 | 4963 |
| |
4960 | 4964 |
| |
4961 |
| - | |
4962 | 4965 |
| |
4963 | 4966 |
| |
4964 | 4967 |
| |
| |||
4973 | 4976 |
| |
4974 | 4977 |
| |
4975 | 4978 |
| |
| 4979 | + | |
| 4980 | + | |
| 4981 | + | |
| 4982 | + | |
4976 | 4983 |
| |
4977 | 4984 |
| |
4978 | 4985 |
| |
|
Lines changed: 54 additions & 26 deletions
Original file line number | Diff line number | Diff line change | |
---|---|---|---|
| |||
365 | 365 |
| |
366 | 366 |
| |
367 | 367 |
| |
| 368 | + | |
368 | 369 |
| |
369 | 370 |
| |
370 | 371 |
| |
| 372 | + | |
371 | 373 |
| |
372 | 374 |
| |
373 | 375 |
| |
374 |
| - | |
375 | 376 |
| |
376 | 377 |
| |
377 | 378 |
| |
378 | 379 |
| |
379 | 380 |
| |
380 |
| - | |
381 |
| - | |
382 |
| - | |
383 |
| - | |
384 |
| - | |
385 |
| - | |
386 |
| - | |
387 |
| - | |
388 |
| - | |
389 |
| - | |
390 |
| - | |
391 |
| - | |
| 381 | + | |
| 382 | + | |
| 383 | + | |
392 | 384 |
| |
393 | 385 |
| |
394 | 386 |
| |
| |||
399 | 391 |
| |
400 | 392 |
| |
401 | 393 |
| |
402 |
| - | |
| 394 | + | |
| 395 | + | |
| 396 | + | |
| 397 | + | |
| 398 | + | |
| 399 | + | |
| 400 | + | |
| 401 | + | |
| 402 | + | |
403 | 403 |
| |
404 | 404 |
| |
405 | 405 |
| |
| 406 | + | |
| 407 | + | |
| 408 | + | |
406 | 409 |
| |
407 | 410 |
| |
| 411 | + | |
408 | 412 |
| |
409 | 413 |
| |
410 | 414 |
| |
| |||
418 | 422 |
| |
419 | 423 |
| |
420 | 424 |
| |
421 |
| - | |
422 |
| - | |
423 | 425 |
| |
424 | 426 |
| |
425 | 427 |
| |
| 428 | + | |
| 429 | + | |
| 430 | + | |
| 431 | + | |
| 432 | + | |
| 433 | + | |
| 434 | + | |
| 435 | + | |
| 436 | + | |
| 437 | + | |
| 438 | + | |
426 | 439 |
| |
427 | 440 |
| |
428 | 441 |
| |
| |||
443 | 456 |
| |
444 | 457 |
| |
445 | 458 |
| |
| 459 | + | |
| 460 | + | |
| 461 | + | |
| 462 | + | |
| 463 | + | |
| 464 | + | |
| 465 | + | |
| 466 | + | |
| 467 | + | |
| 468 | + | |
| 469 | + | |
| 470 | + | |
| 471 | + | |
| 472 | + | |
| 473 | + | |
| 474 | + | |
| 475 | + | |
| 476 | + | |
| 477 | + | |
| 478 | + | |
| 479 | + | |
| 480 | + | |
| 481 | + | |
| 482 | + | |
446 | 483 |
| |
447 | 484 |
| |
448 | 485 |
| |
449 | 486 |
| |
450 | 487 |
| |
451 | 488 |
| |
452 | 489 |
| |
453 |
| - | |
454 |
| - | |
455 |
| - | |
456 |
| - | |
457 |
| - | |
458 |
| - | |
459 |
| - | |
460 |
| - | |
461 |
| - | |
462 |
| - | |
| 490 | + | |
463 | 491 |
| |
464 | 492 |
| |
465 | 493 |
| |
|
Lines changed: 9 additions & 8 deletions
Original file line number | Diff line number | Diff line change | |
---|---|---|---|
| |||
17568 | 17568 |
| |
17569 | 17569 |
| |
17570 | 17570 |
| |
| 17571 | + | |
| 17572 | + | |
| 17573 | + | |
| 17574 | + | |
| 17575 | + | |
| 17576 | + | |
| 17577 | + | |
| 17578 | + | |
| 17579 | + | |
17571 | 17580 |
| |
17572 | 17581 |
| |
17573 | 17582 |
| |
| |||
17600 | 17609 |
| |
17601 | 17610 |
| |
17602 | 17611 |
| |
17603 |
| - | |
17604 | 17612 |
| |
17605 |
| - | |
17606 |
| - | |
17607 |
| - | |
17608 |
| - | |
17609 |
| - | |
17610 |
| - | |
17611 |
| - | |
17612 | 17613 |
| |
17613 | 17614 |
| |
17614 | 17615 |
| |
|
Lines changed: 16 additions & 0 deletions
Original file line number | Diff line number | Diff line change | |
---|---|---|---|
| |||
905 | 905 |
| |
906 | 906 |
| |
907 | 907 |
| |
| 908 | + | |
| 909 | + | |
| 910 | + | |
| 911 | + | |
| 912 | + | |
| 913 | + | |
| 914 | + | |
| 915 | + | |
| 916 | + | |
| 917 | + | |
| 918 | + | |
| 919 | + | |
| 920 | + | |
| 921 | + | |
| 922 | + | |
| 923 | + |
Lines changed: 9 additions & 0 deletions
Original file line number | Diff line number | Diff line change | |
---|---|---|---|
| |||
528 | 528 |
| |
529 | 529 |
| |
530 | 530 |
| |
| 531 | + | |
| 532 | + | |
| 533 | + | |
| 534 | + | |
| 535 | + | |
| 536 | + | |
| 537 | + | |
| 538 | + | |
| 539 | + |
0 commit comments
Comments
(0)