Using the Linux command df -Ph > metric.csv to create this output:
Filesystem Size Used Avail Use% Mounted on
udev 3.9G 0 3.9G 0% /dev
tmpfs 786M 2.2M 783M 1% /run'''
I login to postgres and CREATE TABLE:
CREATE TABLE metric(filesystem varchar,size varchar,used
varchar,available varchar,use varchar,mounted_on varchar, PRIMARY
KEY(filesystem));
Next I’m using the COPY command to insert data into this table:
COPY metrics (filesystem,size,used,available,use,mounted_on) FROM '/data/metric.csv' CSV HEADER DELIMITER ',';
I’m getting the following error:
ERROR: missing data for column "size"
CONTEXT: COPY metrics, line 2: "udev 3.9G 0 3.9G 0% /dev"
I’d appreciate any help or advice as to how to correct this so I can insert my data into the database.