diff options
author | Peter Eisentraut <peter@eisentraut.org> | 2019-07-22 12:05:03 +0200 |
---|---|---|
committer | Peter Eisentraut <peter@eisentraut.org> | 2019-07-22 12:07:10 +0200 |
commit | 19781729f789f3c6b2540e02b96f8aa500460322 (patch) | |
tree | edff25ecb10caac6e7783cf6a04570aa9ff0d753 /src/backend/utils/adt/xml.c | |
parent | efdcca55a3df27a12efb84a18bce6ea739927b80 (diff) | |
download | postgresql-19781729f789f3c6b2540e02b96f8aa500460322.tar.gz postgresql-19781729f789f3c6b2540e02b96f8aa500460322.zip |
Make identity sequence management more robust
Some code could get confused when certain catalog state involving both
identity and serial sequences was present, perhaps during an attempt
to upgrade the latter to the former. Specifically, dropping the
default of a serial column maintains the ownership of the sequence by
the column, and so it would then be possible to afterwards make the
column an identity column that would now own two sequences. This
causes the code that looks up the identity sequence to error out,
making the new identity column inoperable until the ownership of the
previous sequence is released.
To fix this, make the identity sequence lookup only consider sequences
with the appropriate dependency type for an identity sequence, so it
only ever finds one (unless something else is broken). In the above
example, the old serial sequence would then be ignored. Reorganize
the various owned-sequence-lookup functions a bit to make this
clearer.
Reported-by: Laurenz Albe <laurenz.albe@cybertec.at>
Discussion: https://www.postgresql.org/message-id/flat/470c54fc8590be4de0f41b0d295fd6390d5e8a6c.camel@cybertec.at
Diffstat (limited to 'src/backend/utils/adt/xml.c')
0 files changed, 0 insertions, 0 deletions