I am trying to move data from mysql to postgres table. so I am using Table input step to get data from mysql table and using insert/update step to insert data to postgres table.
The postgres table has a enum data type in it. so, when I try to insert the data to that field it throws this error:
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
I know this is a casting issue, but I didn't know how to cast it to enum data type.
This is the table schema of the table:
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'
);
Please somebody help me with this. Thanks!