Received: from localhost (maia-3.hub.org [200.46.204.184]) by postgresql.org (Postfix) with ESMTP id 3C14F9FB472 for ; Fri, 19 Jan 2007 14:52:44 -0400 (AST) Received: from postgresql.org ([200.46.204.71]) by localhost (mx1.hub.org [200.46.204.184]) (amavisd-new, port 10024) with ESMTP id 34655-03 for ; Fri, 19 Jan 2007 14:52:28 -0400 (AST) X-Greylist: from auto-whitelisted by SQLgrey-1.7.4 Received: from sss.pgh.pa.us (sss.pgh.pa.us [66.207.139.130]) by postgresql.org (Postfix) with ESMTP id EB3209FB46F for ; Fri, 19 Jan 2007 14:52:40 -0400 (AST) Received: from sss2.sss.pgh.pa.us (tgl@localhost [127.0.0.1]) by sss.pgh.pa.us (8.13.6/8.13.6) with ESMTP id l0JIqd9X017900; Fri, 19 Jan 2007 13:52:40 -0500 (EST) To: Howard Cole cc: "'PgSql General'" Subject: Re: Query Help In-reply-to: <45B0FA5A.3010106@selestial.com> References: <45B0FA5A.3010106@selestial.com> Comments: In-reply-to Howard Cole message dated "Fri, 19 Jan 2007 17:05:30 +0000" Date: Fri, 19 Jan 2007 13:52:39 -0500 Message-ID: <17899.1169232759@sss.pgh.pa.us> From: Tom Lane X-Virus-Scanned: Maia Mailguard 1.0.1 X-Archive-Number: 200701/1081 X-Sequence-Number: 107621 Howard Cole writes: > 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" It looks like you have a stale plan for that ON DELETE SET NULL constraint. Was there perhaps an index on operator_id that you removed? Postgres is not very good about flushing cached plans when you change table schemas (something I hope will be fixed in 8.3). If that is the problem, starting a fresh session would be enough to take care of it. regards, tom lane