Received: from magus.postgresql.org ([2a02:c0:301:0:ffff::29]) by malur.postgresql.org with esmtp (Exim 4.72) (envelope-from ) id 1TWVuT-0002oO-Gk for pgsql-bugs@postgresql.org; Thu, 08 Nov 2012 17:28:57 +0000 Received: from mail-yh0-f46.google.com ([209.85.213.46]) by magus.postgresql.org with esmtp (Exim 4.72) (envelope-from ) id 1TWVuP-0001LE-Ne for pgsql-bugs@postgresql.org; Thu, 08 Nov 2012 17:28:57 +0000 Received: by mail-yh0-f46.google.com with SMTP id m54so628274yhm.19 for ; Thu, 08 Nov 2012 09:28:52 -0800 (PST) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20120113; h=message-id:date:from:user-agent:mime-version:to:cc:subject :references:in-reply-to:content-type:content-transfer-encoding :x-gm-message-state; bh=bq4bIauqeUr8CxonG9RtX+awyatVSluiAFhi1wynwsQ=; b=h8IrEwDUwfSmhAiXgKLrbWI97nBbLPh3CA47AOrelKOTTCeyGkL0cl5JTIASQ0HC8+ 7g61w60ffAqzcBDDSe51TQsRWut+/eoTXJXMOCETfJ0IEW1dyyoZAyQ7KJqbQs+OkV74 hp3bsA4XHiQQB2q9IAi8I4GBkqAs+rg/Ody5eyHYfbnRUHKeOAynrj56OoJwx8PaDsbZ 0Cc9x5wtWi1qaFv4K/ZPPskqY46A6IWP5SyqsSB4CjxG+9DyLkzNGW1bGA49p4zsvU3z zUO3mprU6DoB6DBKPkvFsDTG8+OWkOIU7dVSb4NkEp/gIHyuk57EDqcM4NXdLsFzv2pT DT9Q== Received: by 10.101.70.13 with SMTP id x13mr2546245ank.67.1352395732428; Thu, 08 Nov 2012 09:28:52 -0800 (PST) Received: from [192.168.10.204] (trav-f-207-111-162-65.rev.booksys.com. [207.111.162.65]) by mx.google.com with ESMTPS id z1sm2552578anj.2.2012.11.08.09.28.51 (version=SSLv3 cipher=OTHER); Thu, 08 Nov 2012 09:28:51 -0800 (PST) Message-ID: <509BEBD1.2090100@booksys.com> Date: Thu, 08 Nov 2012 11:28:49 -0600 From: Sergey User-Agent: Mozilla/5.0 (Windows NT 5.1; rv:16.0) Gecko/20121026 Thunderbird/16.0.2 MIME-Version: 1.0 To: Tom Lane CC: pgsql-bugs@postgresql.org Subject: Re: BUG #7641: ERROR: must specify relation and object name when function contains DROP TRIGGER References: <25022.1352391261@sss.pgh.pa.us> In-Reply-To: <25022.1352391261@sss.pgh.pa.us> Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit X-Gm-Message-State: ALoCoQlAD5uV15WQDD3VRqQXhQD0Mwj0AkNzRpIS7gsizwhloBIz2FEuGbdYZp5bEzk4wIXlBgRY X-Pg-Spam-Score: -2.6 (--) X-Archive-Number: 201211/39 X-Sequence-Number: 34597 Tom, There is also a minor bug when trying to do same thing with RULE (it doesn't produce an error but the notice is not correct when function is called for the second time): CREATE OR REPLACE FUNCTION drop_rule_test() RETURNS void AS $$ BEGIN DROP RULE IF EXISTS invalid_rule ON test1; END; $$ LANGUAGE plpgsql; SELECT drop_rule_test(); NOTICE: rule "invalid_rule" for relation "test1" does not exist, skipping CONTEXT: SQL statement "DROP RULE IF EXISTS invalid_rule ON test1" PL/pgSQL function drop_rule_test() line 3 at SQL statement SELECT drop_rule_test(); NOTICE: rule "test1" for relation "" does not exist, skipping CONTEXT: SQL statement "DROP RULE IF EXISTS invalid_rule ON test1" PL/pgSQL function drop_rule_test() line 3 at SQL statement Thanks, Sergey On 11/8/2012 10:14 AM, Tom Lane wrote: > 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