COPY command fails on tables with enum columns
kaushalyap opened this issue · 0 comments
kaushalyap commented
What version of GraphJin are you using? graphjin version
v0.21.9 (Go binary install)
Have you tried reproducing the issue with the latest release?
Yes
What is the hardware spec (RAM, OS)?
16GB, Fedora 37
Steps to reproduce the issue (config used to run GraphJin).
- Add following to 0_init.sql
CREATE TYPE employee_type AS ENUM ('Contract', 'Permenant');
CREATE TABLE employees (
id SERIAL,
eid VARCHAR(10) PRIMARY KEY,
e_type employee_type NOT NULL,
e_name VARCHAR(100) NOT NULL,
created_at TIMESTAMP NOT NULL DEFAULT CURRENT_TIMESTAMP,
);
- Create
employees.csv
in current directory
eid,e_type,e_name,e_gender
'00008,Contract,John
- Add following line to
seed.js
import_csv("employees", "employees.csv");
Expected behaviour and actual result.
❯ docker-compose run api db setup
FATAL Error with copy-from: ERROR: COPY from stdin failed: unable to encode "Contract" into binary format for unknown type (OID 16394): cannot find encode plan (SQLSTATE 57014) (line no 2)
Notes
This seems to coming from this line probably a bug in an external dependency,
current solution is to avoid enum custom types and using check constraints.