Received: from malur.postgresql.org ([217.196.149.56]) by arkaria.postgresql.org with esmtp (Exim 4.84_2) (envelope-from ) id 1dsZRn-0002Gn-CJ for pgsql-hackers@arkaria.postgresql.org; Thu, 14 Sep 2017 19:05:11 +0000 Received: from localhost ([127.0.0.1] helo=postgresql.org) by malur.postgresql.org with smtp (Exim 4.84_2) (envelope-from ) id 1dsZRm-0003p1-MU for pgsql-hackers@arkaria.postgresql.org; Thu, 14 Sep 2017 19:05:10 +0000 Received: from makus.postgresql.org ([2001:4800:1501:1::229]) by malur.postgresql.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA384:256) (Exim 4.84_2) (envelope-from ) id 1dsZRk-0003kE-IN for pgsql-hackers@postgresql.org; Thu, 14 Sep 2017 19:05:08 +0000 Received: from out3-smtp.messagingengine.com ([66.111.4.27]) by makus.postgresql.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA384:256) (Exim 4.84_2) (envelope-from ) id 1dsZRZ-0006vv-7p for pgsql-hackers@postgresql.org; Thu, 14 Sep 2017 19:05:07 +0000 Received: from compute7.internal (compute7.nyi.internal [10.202.2.47]) by mailout.nyi.internal (Postfix) with ESMTP id A541720A74; Thu, 14 Sep 2017 15:04:55 -0400 (EDT) Received: from frontend1 ([10.202.2.160]) by compute7.internal (MEProxy); Thu, 14 Sep 2017 15:04:55 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d= messagingengine.com; h=cc:content-transfer-encoding:content-type :date:from:in-reply-to:message-id:mime-version:references :subject:to:x-me-sender:x-me-sender:x-sasl-enc:x-sasl-enc; s= fm1; bh=9Fk1kTy1ox7RVluBD+BFkk4tYQ0ajbwnygGdpfukvcM=; b=o2E3GYkx MVmK3HQZGjEUeWrBV8CHXiwkwZbf8ihjVXQAViKjYH3iixEhc6Ij3of34TT3OaZO QTi8pv7Ot2bcn3JNqm08cMq2PLPXiUk49ohFFLnLnD2a88+aUCZMHmFcD75Il6GL yTHTnZLNbqnoC2qEd/5rb9Dg341LpxpMPQEYJEJA4kZmf4KEEiwXovoiFoL0DB0y BBtFCCfg08iN+gJjLBc2eUXrwct4Vs8NiCf85yB6UqJwSkPZJFQlkZeO6RNrNV1m 6dS73DYFPvrsn2llz0wxQFyR3h64Lmc2XXqXuUl+VU+VsmpRuZvJXfn7KShVbB39 TWSUl0nAkQLdbw== X-ME-Sender: X-Sasl-enc: rDqwFhKGrqq0oPyD+bFMYYKCblzZ+fh1lKqosOTJ4t5j 1505415895 Received: from april.local (c-73-13-66-39.hsd1.pa.comcast.net [73.13.66.39]) by mail.messagingengine.com (Postfix) with ESMTPA id 392E87E183; Thu, 14 Sep 2017 15:04:55 -0400 (EDT) Subject: Re: DROP SUBSCRIPTION hangs if sub is disabled in the same transaction To: Alvaro Herrera References: <20170914122339.gboxwprodgqtaiu3@alvherre.pgsql> Cc: Tom Lane , Arseny Sher , pgsql-hackers@postgresql.org From: Peter Eisentraut Organization: 2ndQuadrant Message-ID: <7492416f-2e61-d875-6179-ea719f5e5238@2ndquadrant.com> Date: Thu, 14 Sep 2017 15:04:54 -0400 User-Agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10.12; rv:52.0) Gecko/20100101 Thunderbird/52.3.0 MIME-Version: 1.0 In-Reply-To: <20170914122339.gboxwprodgqtaiu3@alvherre.pgsql> Content-Type: text/plain; charset=utf-8 Content-Language: en-US Content-Transfer-Encoding: 7bit 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 9/14/17 08:23, Alvaro Herrera wrote: > Peter Eisentraut wrote: >> On 9/13/17 09:56, Alvaro Herrera wrote: >>> Tom Lane wrote: >>>> Peter Eisentraut writes: >>> >>>>> - Disallow DROP SUBSCRIPTION in a transaction under certain >>>>> circumstances, for example if a transaction has previously manipulated >>>>> the same subscription. >>> >>>> ISTM the second of those (refuse to drop an in-use subscription) is >>>> by far the least surprising behavior. >>> >>> +1 for that option. IIRC this has precedent for other object types such >>> as tables, where we refuse some action if we have already operated on >>> the table in the same transaction. >> >> What are some examples of such behavior? > > Search for CheckTableNotInUse() callers. That one uses the relcache refcount, so we can't use that mechanism here. I think we need something based on xmin. The enum code has something like it, but I don't understand the details. -- Peter Eisentraut http://www.2ndQuadrant.com/ PostgreSQL Development, 24x7 Support, Remote DBA, 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