Received: from localhost (maia-2.hub.org [200.46.204.187]) by postgresql.org (Postfix) with ESMTP id 665A39FB463 for ; Fri, 19 Jan 2007 13:15:42 -0400 (AST) Received: from postgresql.org ([200.46.204.71]) by localhost (mx1.hub.org [200.46.204.187]) (amavisd-new, port 10024) with ESMTP id 69184-04 for ; Fri, 19 Jan 2007 13:13:42 -0400 (AST) X-Greylist: delayed 00:06:39.829763 by SQLgrey-1.7.4 Received: from ds528.dedicated.turbodns.co.uk (ds528.dedicated.turbodns.co.uk [81.21.72.118]) by postgresql.org (Postfix) with ESMTP id CD8139FB437 for ; Fri, 19 Jan 2007 13:12:18 -0400 (AST) Received: (qmail 31076 invoked from network); 19 Jan 2007 17:05:37 -0000 Received: from howardnews@selestial.com by ds528.dedicated.turbodns.co.uk by uid 1005 with qmail-scanner-1.22 ( Clear:RC:1(62.3.231.11):. Processed in 0.021714 secs); 19 Jan 2007 17:05:37 -0000 Received: from unknown (HELO ?10.202.6.101?) (selestial-howard.cole@62.3.231.11) by ds528.dedicated.turbodns.co.uk with SMTP; 19 Jan 2007 17:05:37 -0000 Message-ID: <45B0FA5A.3010106@selestial.com> Date: Fri, 19 Jan 2007 17:05:30 +0000 From: Howard Cole User-Agent: Thunderbird 1.5.0.9 (Windows/20061207) MIME-Version: 1.0 To: 'PgSql General' Subject: Query Help Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit X-Virus-Scanned: Maia Mailguard 1.0.1 X-Archive-Number: 200701/1071 X-Sequence-Number: 107611 Hi All, I am getting an error I do not understand from the following setup CREATE TABLE timesheet_booking ( timesheet_booking_id bigserial NOT NULL, operator_id integer, booking_item_id integer, "day" date NOT NULL, minutes integer NOT NULL, CONSTRAINT timesheet_booking_pkey PRIMARY KEY (timesheet_booking_id), CONSTRAINT timesheet_booking_booking_item_id_fkey FOREIGN KEY (booking_item_id) REFERENCES booking_item (booking_item_id) MATCH SIMPLE ON UPDATE NO ACTION ON DELETE CASCADE, CONSTRAINT timesheet_booking_operator_id_fkey FOREIGN KEY (operator_id) REFERENCES "operator" (operator_id) MATCH SIMPLE ON UPDATE NO ACTION ON DELETE SET NULL ) WITHOUT OIDS; CREATE UNIQUE INDEX timesheet_booking_unique_idx ON timesheet_booking USING btree (operator_id, booking_item_id, "day"); Now the timesheet booking contains the following data: timesheet_booking_id, operator_id,booking_item_id,day,minutes 2;284;1;"2007-01-18";10 4;284;2;"2007-01-18";10 If I try the following query: delete from operator where operator_id=283; I get the following error message: ERROR: could not open relation with OID 438427 SQL state: XX000 Context: SQL statement "UPDATE ONLY "public"."timesheet_booking" SET "operator_id" = NULL WHERE "operator_id" = $1" If I try this sql statement directly it works OK. What does this error mean and how can I get rid of it? Thanks Howard.