How do I specify columns when loading new rows into PostgreSQL using pg_bulkload -


I am experimenting with using the pg_bulkload project to import millions of rows of database data. However, none of the new rows is a primary key and only two columns are very useful in my input file. How can i tell pg_bulkload what column I am importing and how do i generate the primary key field? Do I need to match my import file properly so that the output of a coppy command should be created and make the id field itself?

For example, say my database column title

I have the data title and published and one tab are listed in the delimited file. My .ctl file looks like this:

  tab = post INFILE = stdin TYPE = CSV DELIMITER = ""  

You can use the pg_loader's FILTER functionality. Something like this:

Build

  in the database pg_bulkload_filter (text, text) Select $$ Record next generation ('tablen_id_sec'), zero, Zero, $ 1, $ 2, null $ $ language sql;  

and in the pg_bulkload control file:

FILTER = pg_bulkload_filter


Comments