Received: from malur.postgresql.org ([217.196.149.56]) by arkaria.postgresql.org with esmtp (Exim 4.80) (envelope-from ) id 1VVqcS-0002hd-42 for pgsql-hackers@arkaria.postgresql.org; Mon, 14 Oct 2013 22:28:08 +0000 Received: from localhost ([127.0.0.1] helo=postgresql.org) by malur.postgresql.org with smtp (Exim 4.80) (envelope-from ) id 1VVqcR-000098-2T for pgsql-hackers@arkaria.postgresql.org; Mon, 14 Oct 2013 22:28:07 +0000 Received: from magus.postgresql.org ([2a02:c0:301:0:ffff::29]) by malur.postgresql.org with esmtp (Exim 4.80) (envelope-from ) id 1VVqcP-00008z-No for pgsql-hackers@postgresql.org; Mon, 14 Oct 2013 22:28:05 +0000 Received: from moutng.kundenserver.de ([212.227.126.186]) by magus.postgresql.org with esmtp (Exim 4.80) (envelope-from ) id 1VVqcM-0003kx-W1 for pgsql-hackers@postgresql.org; Mon, 14 Oct 2013 22:28:05 +0000 Received: from anarazel.de (p54AF432E.dip0.t-ipconnect.de [84.175.67.46]) by mrelayeu.kundenserver.de (node=mreu0) with ESMTP (Nemesis) id 0LnX10-1Vy2EJ2aTO-00hyZm; Tue, 15 Oct 2013 00:28:01 +0200 Received: by anarazel.de (Postfix, from userid 1000) id BDED01016DE; Tue, 15 Oct 2013 00:28:00 +0200 (CEST) Date: Tue, 15 Oct 2013 00:28:00 +0200 From: Andres Freund To: Tomas Vondra Cc: pgsql-hackers@postgresql.org Subject: Re: Re: [BUGS] BUG #7873: pg_restore --clean tries to drop tables that don't exist Message-ID: <20131014222800.GH25013@awork2.anarazel.de> References: <5236B11B.8040700@uptime.jp> <5256DBBF.8010605@dunslane.net> <20131014214421.GE25013@awork2.anarazel.de> <525C6ED3.9090701@fuzzy.cz> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <525C6ED3.9090701@fuzzy.cz> X-Provags-ID: V02:K0:/fTBhRR3w2oSgN0YigSVXiRXJXlYj3562yoB95bJ7my 8p4BfVT3qPOVCO9B+E4stLPbCkLCqEIfX/rUZo0hzJvTXiQs8d 3X+69pD/qtmBFAZXM6aTf3U48AC8Qh9UspQFzooJjU7cmiKFBH nSYQalFX5BRYE2pp6DNzo0AGHT5Xxv8SnKwtpO+7Ja1mETfKLE Nh5YLoaRiwKdWhkvYGnlyPYz2LSUCKbQPm97oUDfhCVPQYWi1T 878wj3tlbHQhe5ikH3H+S1z4lK+GZAvNY5t/UofB4sZ26enCbr xjN1qMqoXWqV5pyrMXGiKsxDiFsNMHgLaTbPovO5bFoMwZaJO4 6TtxtiX2VQwIsIb/kjCC8wZlgdQf+rAoMDtJcd8ZY X-Pg-Spam-Score: -1.9 (-) List-Archive: List-Help: List-ID: List-Owner: List-Post: List-Subscribe: List-Unsubscribe: X-Mailing-List: pgsql-hackers Precedence: bulk Sender: pgsql-hackers-owner@postgresql.org On 2013-10-15 00:23:15 +0200, Tomas Vondra wrote: > Hi, > > On 14.10.2013 23:44, Andres Freund wrote: > > On 2013-10-10 12:54:23 -0400, Andrew Dunstan wrote: > >> On 09/19/2013 06:12 PM, Pavel Stehule wrote: > >>> 2013/9/16 Satoshi Nagayasu >>> > > >>> > >>> I'm looking at this patch, and I have a question here. > >>> > >>> Should "DROP TRIGGER IF EXISTS" ignore error for non-existing > >>> trigger and non-existing table? Or just only for non-existing > >>> trigger? > >>> > >>> My opinion is so, both variants should be ignored - it should be > >>> fully fault tolerant in this use case. > >> > >> This thread seems to have gone cold, but I'm inclined to agree with > >> Pavel. If the table doesn't exist, neither does the trigger, and > >> the whole point of the 'IF EXISTS' variants is to provide the > >> ability to issue DROP commands that don't fail if their target is > >> missing. > > > > -1, this seems to likely to just hide typos. > > Not sure I agree with your reasoning. Isn't that equally true for 'IF > EXISTS' clause with all commands in general? Why should we use "likely > to hide typos" argument in this case and not the others? Because there simply is no reason to issue a DROP TRIGGER IF EXISTS if you don't need the contents of the table. In that case you can just issue a DROP TABLE IF EXISTS and start anew. > The purpose of this patch was to add support for quiet "pg_restore > --clean" and pg_restore should not do typos (if it does, we're in much > deeper troubles I guess). Why does that even have to do anything for triggers? Emitting DROP TABLE should be enough. Greetings, Andres Freund -- Andres Freund http://www.2ndQuadrant.com/ PostgreSQL Development, 24x7 Support, Training & Services -- Sent via pgsql-hackers mailing list (pgsql-hackers@postgresql.org) To make changes to your subscription: http://www.postgresql.org/mailpref/pgsql-hackers