Preserve replica identity index across ALTER TABLE rewrite
authorPeter Eisentraut <peter@eisentraut.org>
Fri, 13 Mar 2020 10:28:11 +0000 (11:28 +0100)
committerPeter Eisentraut <peter@eisentraut.org>
Fri, 13 Mar 2020 10:57:06 +0000 (11:57 +0100)
commit1cc9c2412cc9a2fbe6a381170097d315fd40ccca
tree7f499b1405f4bec711fea0c9a7a852f8352809c7
parentb7f64c64d3262c309e2c5e8c11fd111b1dbd1a4a
Preserve replica identity index across ALTER TABLE rewrite

If an index was explicitly set as replica identity index, this setting
was lost when a table was rewritten by ALTER TABLE.  Because this
setting is part of pg_index but actually controlled by ALTER
TABLE (not part of CREATE INDEX, say), we have to do some extra work
to restore it.

Based-on-patch-by: Quan Zongliang <quanzongliang@gmail.com>
Reviewed-by: Euler Taveira <euler.taveira@2ndquadrant.com>
Discussion: https://www.postgresql.org/message-id/flat/c70fcab2-4866-0d9f-1d01-e75e189db342@gmail.com
src/backend/commands/tablecmds.c
src/backend/utils/cache/lsyscache.c
src/include/utils/lsyscache.h
src/test/regress/expected/replica_identity.out
src/test/regress/sql/replica_identity.sql