I am populating a postgres table with millions of records. In order to speed up the process, I am making use of the pg_putcopydata in DBD:Pg. I am following this example :
$dbh->do("COPY mytable(flavor, slices) FROM STDIN WITH DELIMITER '~'");
$dbh->pg_putcopydata("Pepperoni~123\n");
$dbh->pg_putcopydata("Mushroom~314\n");
$dbh->pg_putcopydata("Anchovies~6\n");
$dbh->pg_putcopyend();
There are records where one of the fields may be emtpy. In order to insert empty values, I tried using "undef", "Null", "null", "", "NULL" inside pg_putcopydata. None of them worked.
How do I insert NULL values using pg_putcopydata ?