Create database and table on both sides.
create table employees(id int, name text);
Setup replication
Load data and validate data at both sides
Rename table at both sides
alter table employees rename to new_table;
Alter table at source and add a column.
alter table new_table add column age int;
Rename table at source
alter table new_table rename to old_table;
Rename table at target
demo=# alter table new_table rename to old_table;
ERROR: Illegal state: New Schema not compatible with XCluster Producer Schema:
new={Schema [
]
properties: contain_counters: false is_transactional: false consistency_level: STRONG use_mangled_column_name: false is_ysql_catalog_table: false retain_delete_markers: false partitioning_version: 1}
producer={Schema [
0:ybrowid[binary NOT NULL PARTITION KEY],
1:id[int32 NULLABLE NOT A PARTITION KEY],
2:name[string NULLABLE NOT A PARTITION KEY],
3:age[int32 NULLABLE NOT A PARTITION KEY]
]
properties: contain_counters: false is_transactional: true consistency_level: STRONG use_mangled_column_name: false is_ysql_catalog_table: false retain_delete_markers: false partitioning_version: 1}
8. Now alter table at target and add column
`alter table new_table add column age int;`
9. Now rename table at target and check the behaviour
`alter table new_table rename to old_table;`
**Actual**:
1. After Step#7: It is displaying empty Schema for target.
2. After Step#9: it throws `ERROR: relation "old_table" already exists`
**Expected**:
1. After Step#7: It should show current target table's schema
2. After Step#9: It should not throw an error - It should rename it correctly
**Note**: Workaround for Step#9 is exit from the current session and reconnect and try Step#9.
Jira Link: DB-4122
Description
Version: `2.17.1.0-b122'
Steps:
create table employees(id int, name text);
alter table employees rename to new_table;
alter table new_table add column age int;
alter table new_table rename to old_table;
] properties: contain_counters: false is_transactional: false consistency_level: STRONG use_mangled_column_name: false is_ysql_catalog_table: false retain_delete_markers: false partitioning_version: 1} producer={Schema [ 0:ybrowid[binary NOT NULL PARTITION KEY], 1:id[int32 NULLABLE NOT A PARTITION KEY], 2:name[string NULLABLE NOT A PARTITION KEY], 3:age[int32 NULLABLE NOT A PARTITION KEY] ] properties: contain_counters: false is_transactional: true consistency_level: STRONG use_mangled_column_name: false is_ysql_catalog_table: false retain_delete_markers: false partitioning_version: 1}