I'm mostly a newcomer to databases and am building a postgres database of student achievement in a series of courses. My database uses a type called "class" that consists of the course, the academic term (year and quarter), and the section number (1,2,3,...), e.g. ('Bio 101', (17, 'F'), 1). I'm trying to copy a CSV containing such data into a table and am getting an error message saying ERROR: extra data after last expected column
. I've tried the pgAdmin III import wizard, COPY and \copy, all with the same results. However, manually copying a line from the file and IMPORTing it (using the appropriate parentheses) works fine. What's going on and what can I do?
Here are the table and some data:
CREATE TABLE public."GradedItems"
(
class class NOT NULL,
category text NOT NULL,
"number" smallint NOT NULL DEFAULT 1,
topic text[],
points integer,
weight double precision, -- Weight of item within category
CONSTRAINT primary_key PRIMARY KEY (class, category, number)
)
'class','category','number','points'
('LS 30A', (18, 'W'), 2),'Homework',1,60
('LS 30A', (18, 'W'), 2),'Homework',2,36
class
type definition.