修改字段名

最近更新时间: 2025-02-18 16:02:00

  • 复制
    复制成功
postgres=# \d+ tbase
                                          Table "public.tbase"
 Column |         Type          | Collation | Nullable | Default | Storage  | Stats target | Description 
--------+-----------------------+-----------+----------+---------+----------+--------------+-------------
 id     | integer               |           | not null |         | plain    |              | 
 city   | character varying(50) |           |          |         | extended |              | 
Distribute By: SHARD(id)
Location Nodes: dn01

postgres=# alter table tbase rename city to cityname;     
ALTER TABLE

postgres=# \d+ tbase
                                           Table "public.tbase"
  Column  |         Type          | Collation | Nullable | Default | Storage  | Stats target | Description 
----------+-----------------------+-----------+----------+---------+----------+--------------+-------------
 id       | integer               |           | not null |         | plain    |              | 
 cityname | character varying(50) |           |          |         | extended |              | 
Distribute By: SHARD(id)
Location Nodes: dn01