Import a CSV file into postgres - skip the first line

How to import a CSV file into postgres and skip the first row (these are just column headers).

I'm trying to:

\COPY products(sight, department) from 'coy.csv' with (FORMAT CSV); 
+4
source share
1 answer

Adding a HEADER row will cause the first row to be the column heading.

 COPY products (sight,department) FROM 'coy.csv' CSV HEADER; 

http://www.postgresql.org/docs/current/static/sql-copy.html

+8
source

Source: https://habr.com/ru/post/1499650/


All Articles