Loading topic
COPY command moves many rows between a table and a data stream in one statement. The stream can be a file, a program, or the connection to your client. This chapter covers what COPY is, its general shape, and why it is the standard tool for bulk loading and exporting. Later chapters7 min readFORMAT, HEADER, DELIMITER, QUOTE, ESCAPE and ENCODING. It also covers the FORCE_* options briefly. The next chapters use these options in real imports7 min readCOPY ... FROM. It covers what the command does with each line, the options you need most often, and how to read its error messages.7 min readCREATE TABLE, INSERT and SELECT, and that you can connect with psql. It also assumes you have seen the COPY command and its CSV options from the earlier chapters. The question here is where the file lives and which program reads or writes it. Many "COPY doe7 min readSELECT queries and use psql. It also assumes you have read the earlier chapters on COPY basics, the CSV format options, and server-side COPY versus \copy. The examples use the products table from earlier in the tutorial. Here it holds four rows:7 min readCOPY in CSV mode tells a missing value (NULL) apart from an empty string, and how quoting protects delimiters, quotes, and line breaks inside fields. It assumes you can already run COPY ... FROM and COPY ... TO with FORMAT csv and HEADER, and that you know the `prod8 min readCOPY ... FROM and \copy with the CSV options from earlier chapters. You should also know what a column default is and how INSERT ... SELECT works. The examples use the products table from the start of the tutorial.7 min readCOPY against files, what that access exposes, and how to limit the risk. It assumes you can run COPY FROM and COPY TO with the CSV options, and that you know the difference between server-side COPY and psql's \copy. It also assumes you know what 7 min readCREATE TABLE, INSERT, and SELECT, that you use psql, and that you have read the earlier chapters on COPY FROM, \copy, and column lists. The examples use the products table from the start of the tutorial.7 min readCOPY FROM and \copy with the CSV options from earlier chapters. You should also know what a transaction is and how PostgreSQL data types work. Here you will learn what happens when one row in a large file is bad, why that is usually a good thing, and what to do w7 min read