我正在尝试将数据从mysql转移到postgres表格。因此,我使用“Table input”步骤从mysql表中获取数据,并使用“insert/update”步骤将数据插入到postgres表中。
postgres表中有一个枚举数据类型。因此,当我尝试将数据插入到该字段时,会抛出以下错误:
2016/01/18 12:36:56 - Insert / Update.0 - ERROR: column "subject_classification" is of type subject_classification_type but expression is of type character varying
2016/01/18 12:36:56 - Insert / Update.0 - Hint: You will need to rewrite or cast the expression.
2016/01/18 12:36:56 - Insert / Update.0 - Position: 166
我知道这是一个类型转换问题,但我不知道该如何将其转换为枚举数据类型。
这是表格的表结构:
CREATE TABLE subject (
subject_id bigint NOT NULL,
created_at timestamp without time zone DEFAULT timezone('UTC'::text, now()) NOT NULL,
updated_at timestamp without time zone DEFAULT timezone('UTC'::text, now()) NOT NULL,
code character varying(2000) NOT NULL,
display_code character varying(2000) NOT NULL,
subject_classification subject_classification_type NOT NULL,
);
CREATE TYPE subject_classification_type AS ENUM (
'Math',
'Social Science',
'Language Arts'
);
请有人帮助我解决这个问题。谢谢!