如何修改postgresql中的Type?

时间:2015-10-13 05:39:16

标签: sql postgresql ddl alter

我的类型定义为:

CREATE TYPE New_A AS
   (id integer,
    id_new integer,
    arrived date,
    sum numeric);

我想将arriveddate类型更改为timestamp without time zone类型

我试过了:

ALTER TYPE New_A SET arrived TO timestamp without time zone

但它不起作用。它给出了:

  

错误:"到达"

时或附近出现语法错误

1 个答案:

答案 0 :(得分:2)

您可以使用alter attribute子句:

ALTER TYPE new_a ALTER ATTRIBUTE arrived TYPE timestamp without time zone;

有关详细信息,请参阅the documentation