forked frompostgres/postgres
- Notifications
You must be signed in to change notification settings - Fork6
Commit1978172
committed
Make identity sequence management more robust
Some code could get confused when certain catalog state involving bothidentity and serial sequences was present, perhaps during an attemptto upgrade the latter to the former. Specifically, dropping thedefault of a serial column maintains the ownership of the sequence bythe column, and so it would then be possible to afterwards make thecolumn an identity column that would now own two sequences. Thiscauses the code that looks up the identity sequence to error out,making the new identity column inoperable until the ownership of theprevious sequence is released.To fix this, make the identity sequence lookup only consider sequenceswith the appropriate dependency type for an identity sequence, so itonly ever finds one (unless something else is broken). In the aboveexample, the old serial sequence would then be ignored. Reorganizethe various owned-sequence-lookup functions a bit to make thisclearer.Reported-by: Laurenz Albe <laurenz.albe@cybertec.at>Discussion:https://www.postgresql.org/message-id/flat/470c54fc8590be4de0f41b0d295fd6390d5e8a6c.camel@cybertec.at1 parentefdcca5 commit1978172
File tree
7 files changed
+48
-20
lines changed- src
- backend
- catalog
- commands
- parser
- rewrite
- include/catalog
- test/regress
- expected
- sql
7 files changed
+48
-20
lines changedLines changed: 25 additions & 8 deletions
Original file line number | Diff line number | Diff line change | |
---|---|---|---|
| |||
705 | 705 |
| |
706 | 706 |
| |
707 | 707 |
| |
708 |
| - | |
| 708 | + | |
| 709 | + | |
709 | 710 |
| |
710 |
| - | |
711 |
| - | |
| 711 | + | |
| 712 | + | |
712 | 713 |
| |
713 | 714 |
| |
714 | 715 |
| |
| |||
750 | 751 |
| |
751 | 752 |
| |
752 | 753 |
| |
753 |
| - | |
| 754 | + | |
| 755 | + | |
754 | 756 |
| |
755 | 757 |
| |
756 | 758 |
| |
| |||
762 | 764 |
| |
763 | 765 |
| |
764 | 766 |
| |
765 |
| - | |
| 767 | + | |
| 768 | + | |
| 769 | + | |
| 770 | + | |
| 771 | + | |
| 772 | + | |
| 773 | + | |
| 774 | + | |
| 775 | + | |
| 776 | + | |
| 777 | + | |
766 | 778 |
| |
767 | 779 |
| |
768 |
| - | |
| 780 | + | |
769 | 781 |
| |
770 |
| - | |
| 782 | + | |
771 | 783 |
| |
772 | 784 |
| |
773 | 785 |
| |
774 | 786 |
| |
775 |
| - | |
| 787 | + | |
| 788 | + | |
| 789 | + | |
| 790 | + | |
| 791 | + | |
| 792 | + | |
776 | 793 |
| |
777 | 794 |
| |
778 | 795 |
| |
|
Lines changed: 2 additions & 2 deletions
Original file line number | Diff line number | Diff line change | |
---|---|---|---|
| |||
1689 | 1689 |
| |
1690 | 1690 |
| |
1691 | 1691 |
| |
1692 |
| - | |
| 1692 | + | |
1693 | 1693 |
| |
1694 | 1694 |
| |
1695 | 1695 |
| |
| |||
6635 | 6635 |
| |
6636 | 6636 |
| |
6637 | 6637 |
| |
6638 |
| - | |
| 6638 | + | |
6639 | 6639 |
| |
6640 | 6640 |
| |
6641 | 6641 |
| |
|
Lines changed: 5 additions & 7 deletions
Original file line number | Diff line number | Diff line change | |
---|---|---|---|
| |||
1083 | 1083 |
| |
1084 | 1084 |
| |
1085 | 1085 |
| |
1086 |
| - | |
| 1086 | + | |
1087 | 1087 |
| |
1088 | 1088 |
| |
1089 | 1089 |
| |
| |||
3165 | 3165 |
| |
3166 | 3166 |
| |
3167 | 3167 |
| |
3168 |
| - | |
| 3168 | + | |
3169 | 3169 |
| |
3170 | 3170 |
| |
3171 | 3171 |
| |
| |||
3216 | 3216 |
| |
3217 | 3217 |
| |
3218 | 3218 |
| |
3219 |
| - | |
3220 | 3219 |
| |
3221 | 3220 |
| |
3222 | 3221 |
| |
| |||
3237 | 3236 |
| |
3238 | 3237 |
| |
3239 | 3238 |
| |
3240 |
| - | |
3241 |
| - | |
| 3239 | + | |
| 3240 | + | |
| 3241 | + | |
3242 | 3242 |
| |
3243 | 3243 |
| |
3244 |
| - | |
3245 | 3244 |
| |
3246 | 3245 |
| |
3247 |
| - | |
3248 | 3246 |
| |
3249 | 3247 |
| |
3250 | 3248 |
| |
|
Lines changed: 1 addition & 1 deletion
Original file line number | Diff line number | Diff line change | |
---|---|---|---|
| |||
1130 | 1130 |
| |
1131 | 1131 |
| |
1132 | 1132 |
| |
1133 |
| - | |
| 1133 | + | |
1134 | 1134 |
| |
1135 | 1135 |
| |
1136 | 1136 |
| |
|
Lines changed: 2 additions & 2 deletions
Original file line number | Diff line number | Diff line change | |
---|---|---|---|
| |||
209 | 209 |
| |
210 | 210 |
| |
211 | 211 |
| |
212 |
| - | |
213 |
| - | |
| 212 | + | |
| 213 | + | |
214 | 214 |
| |
215 | 215 |
| |
216 | 216 |
| |
|
Lines changed: 5 additions & 0 deletions
Original file line number | Diff line number | Diff line change | |
---|---|---|---|
| |||
399 | 399 |
| |
400 | 400 |
| |
401 | 401 |
| |
| 402 | + | |
| 403 | + | |
| 404 | + | |
| 405 | + | |
| 406 | + |
Lines changed: 8 additions & 0 deletions
Original file line number | Diff line number | Diff line change | |
---|---|---|---|
| |||
254 | 254 |
| |
255 | 255 |
| |
256 | 256 |
| |
| 257 | + | |
| 258 | + | |
| 259 | + | |
| 260 | + | |
| 261 | + | |
| 262 | + | |
| 263 | + | |
| 264 | + |
0 commit comments
Comments
(0)