Received: from magus.postgresql.org ([87.238.57.229]) by malur.postgresql.org with esmtp (Exim 4.72) (envelope-from ) id 1TWUkM-0004az-OG for pgsql-bugs@postgresql.org; Thu, 08 Nov 2012 16:14:26 +0000 Received: from sss.pgh.pa.us ([66.207.139.130]) by magus.postgresql.org with esmtp (Exim 4.72) (envelope-from ) id 1TWUkK-00005G-Jq for pgsql-bugs@postgresql.org; Thu, 08 Nov 2012 16:14:26 +0000 Received: from sss2.sss.pgh.pa.us (tgl@localhost [127.0.0.1]) by sss.pgh.pa.us (8.14.5/8.14.5) with ESMTP id qA8GELqu025023; Thu, 8 Nov 2012 11:14:22 -0500 (EST) From: Tom Lane To: sergey@booksys.com cc: pgsql-bugs@postgresql.org Subject: Re: BUG #7641: ERROR: must specify relation and object name when function contains DROP TRIGGER In-reply-to: References: Comments: In-reply-to sergey@booksys.com message dated "Wed, 07 Nov 2012 18:21:35 +0000" Date: Thu, 08 Nov 2012 11:14:21 -0500 Message-ID: <25022.1352391261@sss.pgh.pa.us> X-Pg-Spam-Score: -2.3 (--) X-Archive-Number: 201211/38 X-Sequence-Number: 34596 sergey@booksys.com writes: > CREATE OR REPLACE FUNCTION drop_trigger_test() RETURNS void AS $$ > BEGIN > DROP TRIGGER IF EXISTS invalid_trigger ON test1; > END; $$ LANGUAGE plpgsql; > 4. SELECT drop_trigger_test(); > Result: > NOTICE: trigger "invalid_trigger" for table "test1" does not exist, > skipping > CONTEXT: SQL statement "DROP TRIGGER IF EXISTS invalid_trigger ON test1" > PL/pgSQL function drop_trigger_test() line 3 at SQL statement > 5. SELECT drop_trigger_test(); > Result: > ERROR: must specify relation and object name > CONTEXT: SQL statement "drop trigger if exists invalid_trigger on test2" > PL/pgSQL function drop_trigger_test2() line 3 at SQL statement > For some reason I can run this function without error only once on a fresh > connection. Did not have this problem in 8.4.x and 9.1.6 That's a bug all right --- the does_not_exist_skipping() function thinks it's okay to trash its input data structure, so the DropStmt is corrupted for next time. Will fix, thanks for the report! regards, tom lane