数据仓库服务 GAUSSDB(DWS)-字段名重命名:系统表隐藏字段名作字段名

时间:2024-12-10 11:29:05

系统表隐藏字段名作字段名

定义字段名和 GaussDB (DWS)中系统表隐藏字段重名,需重新命名:包括xc_node_id,tableoid, cmax, xmax, cmin, xmin, ctid, tid;重新命名方式,字段后加_new,例如xc_node_id改为xc_node_id_new。

输入示例

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
DROP TABLE IF EXISTS `renameFieldName`;
CREATE TABLE IF NOT EXISTS `renameFieldName`(
    xc_node_id int,
    tableoid char(3),
    cmax smallint,
    xmax bigint auto_increment,
    cmin varchar(10),
    xmin int,
    ctid int auto_increment,
    tid int
);
DROP TABLE IF EXISTS `renameFieldName`;

输出示例

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
DROP TABLE IF EXISTS "public"."renamefieldname";
CREATE TABLE IF NOT EXISTS "public"."renamefieldname" (
  "xc_node_id_new" INTEGER,
  "tableoid_new" CHAR(12),
  "cmax_new" SMALLINT,
  "xmax_new" BIGSERIAL,
  "cmin_new" VARCHAR(40),
  "xmin_new" INTEGER,
  "ctid_new" SERIAL,
  "tid_new" INTEGER
) WITH (ORIENTATION = ROW, COMPRESSION = NO) NOCOMPRESS DISTRIBUTE BY HASH ("xc_node_id_new");
DROP TABLE IF EXISTS "public"."renamefieldname";
support.huaweicloud.com/tg-dws/dws_16_0163.html