Multiple insert - Mailing list pgsql-general

From FarjadFarid\(ChkNet\)
Subject Multiple insert
Date
Msg-id 000301d0f309$75056f10$5f104d30$@checknetworks.com
Whole thread Raw
Responses Re: Multiple insert
Re: Multiple insert
Re: Multiple insert
List pgsql-general

Hi,

 

I am getting errors trying to insert multiple records in single statement in table like this

 

CREATE TABLE "Lookup"."CNEnum1"

(

  "Id" integer NOT NULL,

  "Description" character varying(50),

  CONSTRAINT "PK_Lookup_CNEnum1 " PRIMARY KEY ("Id")

)

WITH (

  OIDS=FALSE

);

 

INSERT INTO "Lookup"." CNEnum1"(" Id ","Description")VALUES((1::integer,'Desc1'::varchar) ,(2::ineger,''Desc2'::varchar))

 

I have tried various versions of sql statement. With field casting and without casting.  Both work when a single record is inserted but with multiple records the same error is reported.

 

ERROR:  column "Id" is of type integer but expression is of type record

LINE 1: ... CNEnum1"("Id","Description")VALUES((1::int,'D...

                                                             ^

HINT:  You will need to rewrite or cast the expression.

********** Error **********

 

ERROR: column "Id" is of type integer but expression is of type record

SQL state: 42804

Hint: You will need to rewrite or cast the expression.

Character: 73

 

Any suggestion would be greatly welcomed! And thank you in advance.

 

Kind Regards

 

 

Farjad

 

 

pgsql-general by date:

Previous
From: David Steele
Date:
Subject: Re: Broken primary key after backup restore.
Next
From: James Keener
Date:
Subject: Re: Multiple insert