Copy NULL values present in csv file to postgres
1st Replace all NULL with ' ' (Space).
Then COPY r FROM '/home/y.csv' WITH DELIMITER ',' NULL as ' ' CSV;
Have you tried it?
copy r from '/home/y.csv' delimiter ',' csv WITH NULL AS 'null';
The error is because you are inserting NULL
as string. Remove the quotes around NULL
and it should work.
after giving the path of the file, we need to use 'With' before adding other paramters -
copy r from '/home/y.csv' with delimiter ',' NULL AS 'null' csv header;