Background information
Reserved system column names cannot be used in PolarDB O Edition: ctid, oid, cmin,
cmax, xmin, and xmax. The following error is returned if a system column name is used:
ERROR: column name "ctid" conflicts with a system column name
Solutions
- You can handle conflict column names by changing column names.
- Create a shadow table with a different name from the original table, and modify the conflicting column names.
- Create a view with the same name as the original table, and map the column names to those of the original table.
Examples
- Modify the name of a column
Original column name:
create table foo(oid varchar(10))
Modify the key.create table foo(p_oid varchar(10))
- Create a table
The original table is:
create table foo(oid varchar(10), ctid int, xmin int)
Create a new table:create table __foo(p_oid varchar(10), p_ctid int, p_xmin int);
Create a view:create view foo as select p_oid as oid, p_ctid as ctid, p_xmin as xmin from __foo;