user7973129
user7973129

Reputation:

PostgreSQL: Column does not exist after table creation

I am trying to import a postgresql database through sql code. I am creating all the tables with their constraints but when reaching the following code:

COPY "Customers" (Id, "Name") FROM stdin;

psql throws an

ERROR: column "id" of relation "Customers" does not exist.

Here is my Customers table

CREATE TABLE "Customers" (
"Id" serial NOT NULL,
"Name" varchar(30) NOT NULL UNIQUE
);

ALTER TABLE "Customers" OWNER TO postgres;  

ALTER TABLE ONLY "Customers"
    ADD CONSTRAINT "Customers_pkey" PRIMARY KEY ("Id");

I've just started working with postgre and im totally lost, any help will be much appreciated.

Upvotes: 0

Views: 687

Answers (1)

Clodoaldo Neto
Clodoaldo Neto

Reputation: 125244

As commented:

COPY "Customers" ("Id", "Name") FROM stdin;

Bad idea to create identifiers wrapped in double quotes. Only do it if they are otherwise illegal.

Upvotes: 2

Related Questions