Restore replication settings when modifying a field type

Поиск
Список
Период
Сортировка
Искать
От
Quan Zongliang
Тема
Restore replication settings when modifying a field type
Дата
Msg-id
c70fcab2-4866-0d9f-1d01-e75e189db342@gmail.com
Список
Дерево обсуждения
Restore replication settings when modifying a field type Quan Zongliang <quanzongliang@gmail.com>
Re: Restore replication settings when modifying a field type Kyotaro Horiguchi <horikyota.ntt@gmail.com>
Re: Restore replication settings when modifying a field type Quan Zongliang <quanzongliang@gmail.com>
Re: Restore replication settings when modifying a field type Euler Taveira <euler@timbira.com.br>
Re: Restore replication settings when modifying a field type Peter Eisentraut <peter.eisentraut@2ndquadrant.com>
Re: Restore replication settings when modifying a field type Quan Zongliang <quanzongliang@foxmail.com>
Re: Restore replication settings when modifying a field type Quan Zongliang <quanzongliang@foxmail.com>
Re: Restore replication settings when modifying a field type Peter Eisentraut <peter.eisentraut@2ndquadrant.com>
Re: Restore replication settings when modifying a field type Euler Taveira <euler.taveira@2ndquadrant.com>
Re: Restore replication settings when modifying a field type Peter Eisentraut <peter.eisentraut@2ndquadrant.com>
Re: Restore replication settings when modifying a field type Quan Zongliang <quanzongliang@gmail.com>

When the user modifies the REPLICA IDENTIFY field type, the logical 
replication settings are lost.

For example:

postgres=# \d+ t1
                                     Table "public.t1"
  Column |  Type   | Collation | Nullable | Default | Storage | Stats 
target | Description
--------+---------+-----------+----------+---------+---------+--------------+-------------
  col1   | integer |           |          |         | plain   | 
     |
  col2   | integer |           | not null |         | plain   | 
     |
Indexes:
     "t1_col2_key" UNIQUE CONSTRAINT, btree (col2) REPLICA IDENTITY


postgres=# alter table t1 alter col2 type smallint;
ALTER TABLE
postgres=# \d+ t1
                                      Table "public.t1"
  Column |   Type   | Collation | Nullable | Default | Storage | Stats 
target | Description
--------+----------+-----------+----------+---------+---------+--------------+-------------
  col1   | integer  |           |          |         | plain   | 
      |
  col2   | smallint |           | not null |         | plain   | 
      |
Indexes:
     "t1_col2_key" UNIQUE CONSTRAINT, btree (col2)

In fact, the replication property of the table has not been modified, 
and it is still 'i'(REPLICA_IDENTITY_INDEX). But the previously 
specified index property 'indisreplident' is set to false because of the 
rebuild.

So I developed a patch. If the user modifies the field type. The 
associated index is REPLICA IDENTITY. Rebuild and restore replication 
settings.

Regards,
Quan Zongliang
В списке pgsql-hackers по дате отправления
От: Michael Meskes
Дата:
От: Peter Eisentraut
Дата:
Сообщение: Re: errbacktrace
FAQ