I know this is not an uncommon question and I have been looking at the other questions. But after reading through them I haven't been able to solve my problem.
I'm using PostgreSQL and want to fill my TPC-H tables i created with my generated table files. I filled all tables successfully with the following command except partsupp.
postgres=# COPY tpch1g.partsupp FROM '/home/user/TPC-H_1gb/partsupp.tbl' DELIMITER '|' CSV;
Then I get this Message:
ERROR: extra data after last expected column CONTEXT: COPY partsupp, line 1: "1|2|3325|771.64|, even theodolites. regular, final theodolites eat after the carefully pending foxes..."
As far as I understand this message tells me that the number of columns in the data does not match the expected number of columns for the partsupp table.
The partsupp table has 5 columns:
\d tpch1g.partsupp
Table "tpch1g.partsupp"
Column | Type | Collation | Nullable | Default
---------------+------------------------+-----------+----------+---------
ps_partkey | integer | | not null |
ps_suppkey | integer | | not null |
ps_availqty | integer | | |
ps_supplycost | numeric(15,2) | | |
ps_comment | character varying(199) | | |
Indexes:
"partsupp_pkey" PRIMARY KEY, btree (ps_partkey, ps_suppkey)
and a line in my partsupp.tbl looks like this:
1|2|3325|771.64|, even theodolites. regular, final theodolites eat after the carefully pending foxes. furiously regular deposits sleep slyly. carefully bold realms above the ironic dependencies haggle careful|
It has the same amount of columns so I don't get what went wrong. My copy command worked for the other tables perfectly. Is there something i did wrong or overlooked?
your sample from partsupp.tbl ends with a separator, so there is an extra column of data not matching the table structure.