From: | "Relyea, Mike" <Mike(dot)Relyea(at)xerox(dot)com> |
---|---|
To: | <pgsql-general(at)postgresql(dot)org> |
Subject: | Error in insert statement |
Date: | 2009-07-16 19:40:10 |
Message-ID: | AF7D9319B29A0242A33C3BF843BD3133087397AA@USA7061MS03.na.xerox.net |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | pgsql-general |
I need help understanding what I'm doing wrong with an insert statement.
I'm running 8.3.7 on Windows and the DB is complaining about the select
statement in my insert statement.
I'm trying to execute
DROP TABLE IF EXISTS "tblTempSpecs";
CREATE TEMP TABLE "tblTempSpecs" AS SELECT "tblSpecs"."CartridgeTypeID",
"tblSpecs"."ColorID", "tblTestTypes"."TestTypeID", "tblZones"."ZoneID",
"tblSpecs"."PaperID",
"tblSpecs"."AttributeID", "tblSpecs"."Spec"
FROM "tblSpecs", "tblZones", "tblTestTypes"
WHERE "tblSpecs"."ZoneID" IS NULL AND "tblTestTypes"."TestTypeID" IN
(SELECT DISTINCT "TestTypeID" FROM "tblCartridgePQSetIntervals" WHERE
"CartridgeTypeID" = 74);
INSERT INTO "tblSpecs" ("CartridgeTypeID", "ColorID", "TestTypeID",
"ZoneID", "PaperID", "AttributeID", "Spec") VALUES SELECT * FROM
"tblTempSpecs";
To insert data into
CREATE TABLE "tblSpecs"
(
"SpecID" integer NOT NULL DEFAULT
nextval('"sequence_SpecID"'::regclass),
"CartridgeTypeID" integer NOT NULL,
"ColorID" integer NOT NULL,
"TestTypeID" integer,
"ZoneID" integer,
"PaperID" integer,
"PrintCopyID" integer,
"AttributeID" integer NOT NULL,
"Spec" numeric NOT NULL,
CONSTRAINT "tblSpecs_pkey" PRIMARY KEY ("SpecID"),
CONSTRAINT "tblSpecs_AttributeID_fkey" FOREIGN KEY ("AttributeID")
REFERENCES "tblAttributes" ("AttributeID") MATCH SIMPLE
ON UPDATE NO ACTION ON DELETE NO ACTION,
CONSTRAINT "tblSpecs_CartridgeTypeID_fkey" FOREIGN KEY
("CartridgeTypeID")
REFERENCES "tblCartridgeTypes" ("CartridgeTypeID") MATCH SIMPLE
ON UPDATE NO ACTION ON DELETE NO ACTION,
CONSTRAINT "tblSpecs_ColorID_fkey" FOREIGN KEY ("ColorID")
REFERENCES "tblColors" ("ColorID") MATCH SIMPLE
ON UPDATE NO ACTION ON DELETE NO ACTION,
CONSTRAINT "tblSpecs_PaperID_fkey" FOREIGN KEY ("PaperID")
REFERENCES "tblPaperTypes" ("PaperID") MATCH SIMPLE
ON UPDATE NO ACTION ON DELETE NO ACTION,
CONSTRAINT "tblSpecs_TestTypeID_fkey" FOREIGN KEY ("TestTypeID")
REFERENCES "tblTestTypes" ("TestTypeID") MATCH SIMPLE
ON UPDATE NO ACTION ON DELETE NO ACTION,
CONSTRAINT "tblSpecs_ZoneID_fkey" FOREIGN KEY ("ZoneID")
REFERENCES "tblZones" ("ZoneID") MATCH SIMPLE
ON UPDATE NO ACTION ON DELETE NO ACTION
)
WITH (
OIDS=FALSE
);
What am I doing wrong?
Mike
From | Date | Subject | |
---|---|---|---|
Next Message | Thomas Kellerer | 2009-07-16 20:05:08 | Re: Error in insert statement |
Previous Message | Kevin Grittner | 2009-07-16 19:19:22 | Re: Incr/Decr Integer |