After updating the referenced column in TiDB, the virtual column is not updated

Note:
This topic has been translated from a Chinese forum by GPT and might contain errors.

Original topic: TiDB中更新虚拟列引用列后,虚拟列没有更新

| username: Miracle

[Overview] Scenario + Problem Summary
When conducting compatibility tests between MySQL and TiDB, there is a virtual column C in the table. Virtual column C references virtual column B, and virtual column B references field A. When updating field A, the virtual column C in TiDB does not update, but it does update in MySQL.

[Background] Operations performed
I conducted the following tests in both MySQL and TiDB:
TiDB:


MySQL:

[Problem] Current issue encountered
I also found during testing that if there is no virtual column C, meaning the address directly references the value in field A, the update works correctly.

Is it a misuse on my part or a bug?

[TiDB Version]
V5.4.0

| username: 啦啦啦啦啦 | Original post link

I tried to reproduce it in version 6.1, and it might be a bug. Currently, virtual columns are still an experimental feature and are not recommended for use in a production environment.

| username: dba-kit | Original post link

It should be a bug in TiDB. However, if TiDB is not used as the write end but as the downstream of DM synchronization, you might consider directly changing the field to a regular varchar or json type on the TiDB side.

| username: dba-kit | Original post link

I tested it, and the values of virtual columns are also written into the BINLOG.

| username: cs58_dba | Original post link

Mark, we do use virtual columns in our MySQL.

| username: 啦啦啦啦啦 | Original post link

We also use virtual columns in MySQL, but currently, JSON in TiDB is still an experimental feature.

| username: cs58_dba | Original post link

However, virtual columns are indeed not very compatible, and our downstream big data CDH cannot synchronize virtual columns.

| username: system | Original post link

This topic was automatically closed 60 days after the last reply. New replies are no longer allowed.