如何修改postgresql中的类型?

how to modify Type in postgresql?

我定义了一个类型:

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

但它不起作用。它给出:

ERROR: syntax error at or near "arrived"

您可以使用 alter attribute 子句:

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

详情请参考the documentation