I am brand new to PostgreSQL.
I created a test table named Activity, with a column structure that looks as follows:
id Color Dimension Style COUNT SUM Date
I defined the columns as follows:
id: bigint, primary key, not null
Color: character varying 255
Dimension: character varying 255
Style: character varying 255
COUNT: bigint
SUM: double precision
DATE: date
My csv file has data that looks as follows:
Color Dimension Style COUNT SUM Date
Blue Circle Large 4 800 6/19/2020
Blue Circle Small 5 1500 6/19/2020
Blue Square Medium 1 15 6/19/2020
In pgAdmin4, I go through the following steps:
- in the tree on the left-side pane, I right-click on the Activity table and select "Import/Export"
- on the resulting dialogue, I switch the "Export" flag to "Import"
- browse for the file name and select it
- select the "csv" format
- select Header = YES
After clikcing "OK", I see the following error message:
ERROR: invalid input syntax for type bigint: "Blue"
CONTEXT: COPY Trades, line 2, column id: "Blue"
The csv file does not contain the id column (which is the primary key) because my understanding is that PostgreSQL will automatically insert and increment that number based on the number of records I import.
Does anyone see why I'm getting the error message above?
Thanks in advance!