1

This is what my data looks like -

"to_claim_id"   "NEW_PATIENT"        "from_rend"     "from_bill"     "to_rend"       "to_bill"       "from_date"     "to_date"       "days_diff"
"10193136348200818391"  "102657"    "103325"    "174597"    "1830139"    "17497"    20180904        20181002        28 

How do I import this data into my database using \copy?

I have tried \copy public.data from '/data/test' with delimiter E'\t' csv header quote '"' but I get ERROR: value too long for type character varying(25) error.

Aaron
  • 1,345
  • 2
  • 13
  • 32

1 Answers1

0

That means at least one column in the target table public.data is type varchar(25) and a corresponding value in the CSV file has more characters.

You might change the data type of such columns (temporarily) to just varchar or text, import, and then identify and trim offending values - or just live happily ever after as you probably don't need that restriction to begin with.

Related:

Erwin Brandstetter
  • 605,456
  • 145
  • 1,078
  • 1,228