Loading data from flat files results in the following error message:
ERROR: extra data after last expected column
This error will be encounter if the source data has more columns than the target table.
Ensure that the source data and table columns align.
An example of source data having more columns than the target table is below:
ddata=# \d emp Table "public.emp" Column " Type " Modifiers --------+---------+----------- id " integer " dept " integer " role " integer " Distributed by: (id)
$ cat /tmp/load.dat 1"2"3"4 1"2"3"4 1"2"3"4 1"2"3"4 1"2"3"4 1"2"3"4
ddata=# copy emp from '/tmp/load.dat' with delimiter as '"'; ERROR: extra data after last expected column (seg0 sdw1:55001 pid=12476) CONTEXT: COPY emp, line 1: "1"2"3"4"
As seen from the example above, the source data file has one more column than the target table, resulting in the error described above.