Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

COPY command fails on tables with enum columns #407

Closed
kaushalyap opened this issue Dec 6, 2022 · 0 comments
Closed

COPY command fails on tables with enum columns #407

kaushalyap opened this issue Dec 6, 2022 · 0 comments
Labels
bug Something isn't working

Comments

@kaushalyap
Copy link

kaushalyap commented Dec 6, 2022

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).

  1. 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,
);
  1. Create employees.csv in current directory
eid,e_type,e_name,e_gender
'00008,Contract,John
  1. 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.

@kaushalyap kaushalyap added the bug Something isn't working label Dec 6, 2022
@kaushalyap kaushalyap changed the title FATAL Error with copy-from: ERROR: COPY from stdin failed: unable to encode "admin" into binary format for unknown type (OID 16492): cannot find encode plan (SQLSTATE 57014) (line no 2) FATAL Error with copy-from: ERROR: COPY from stdin failed: unable to encode "Contract" into binary format for unknown type (OID 16492): cannot find encode plan (SQLSTATE 57014) (line no 2) Dec 6, 2022
@dosco dosco changed the title FATAL Error with copy-from: ERROR: COPY from stdin failed: unable to encode "Contract" into binary format for unknown type (OID 16492): cannot find encode plan (SQLSTATE 57014) (line no 2) COPY command fails on tables with enum columns Dec 15, 2022
@dosco dosco closed this as completed May 11, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

2 participants