Received: from malur.postgresql.org ([217.196.149.56]) by arkaria.postgresql.org with esmtps (TLS1.3:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1mmeUn-0005Rm-23 for pgsql-bugs@arkaria.postgresql.org; Mon, 15 Nov 2021 16:06:13 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.92) (envelope-from ) id 1mmeUl-0004Yd-W9 for pgsql-bugs@arkaria.postgresql.org; Mon, 15 Nov 2021 16:06:11 +0000 Received: from magus.postgresql.org ([2a02:c0:301:0:ffff::29]) by malur.postgresql.org with esmtps (TLS1.3:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1mmeUl-0004YU-OP for pgsql-bugs@lists.postgresql.org; Mon, 15 Nov 2021 16:06:11 +0000 Received: from out5-smtp.messagingengine.com ([66.111.4.29]) by magus.postgresql.org with esmtps (TLS1.3:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1mmeUi-0006Te-Ra for pgsql-bugs@lists.postgresql.org; Mon, 15 Nov 2021 16:06:11 +0000 Received: from compute6.internal (compute6.nyi.internal [10.202.2.46]) by mailout.nyi.internal (Postfix) with ESMTP id AE3805C0247; Mon, 15 Nov 2021 11:06:05 -0500 (EST) Received: from mailfrontend2 ([10.202.2.163]) by compute6.internal (MEProxy); Mon, 15 Nov 2021 11:06:05 -0500 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:subject:to :x-me-proxy:x-me-proxy:x-me-sender:x-me-sender:x-sasl-enc; s= fm1; bh=I2kiIRhNzKj/4bvVZR3DnDxiQKCpQcbt1bCLb+l4MC0=; b=n2NPpeel O/CHCmqG59icKOQ8ULkHwnyQivdwXg1OxyVIyD8CAsdZQ/4YFmSkVkomqXr+kJY4 wx4C5IEXic1nTvqbECXIH5v2FQHaH1MtgOsfv6UZLqR2VdE/S3GMksHPfOSGwqju St2BWjw413QLtaZ6MI7Z8L09lpB61hu+rnEF80D5QOuXzpV3JhCLrPrEMZ2kvq48 9X8hUx3jFhRC7VMvYjEGHfsbrEAxH6gu8fBnn2wk2vUM024A6UPzogmt3b1qsQtT RAE8H6OXT7WasJp/mexl7zDWiSOq1TR9+lltofgvBdV4YKpTkHleBe7GBesGWOrk I/yhWgp1UG0XyQ== X-ME-Sender: X-ME-Received: X-ME-Proxy-Cause: gggruggvucftvghtrhhoucdtuddrgedvuddrfedtgdehkecutefuodetggdotefrodftvf curfhrohhfihhlvgemucfhrghsthforghilhdpqfgfvfdpuffrtefokffrpgfnqfghnecu uegrihhlohhuthemuceftddtnecunecujfgurhepfffhvffukfggtggugfgjsehtkeertd dttdejnecuhfhrohhmpeetlhhvrghrohcujfgvrhhrvghrrgcuoegrlhhvhhgvrhhrvges rghlvhhhrdhnohdqihhprdhorhhgqeenucggtffrrghtthgvrhhnpedugedvueekgfdule fhtdetueevkeffuefhudfhieegteffhffftefgueetheeuleenucffohhmrghinhepvghn thgvrhhprhhishgvuggsrdgtohhmpdhlfihnrdhnvghtnecuvehluhhsthgvrhfuihiivg eptdenucfrrghrrghmpehmrghilhhfrhhomheprghlvhhhvghrrhgvsegrlhhvhhdrnhho qdhiphdrohhrgh X-ME-Proxy: Received: by mail.messagingengine.com (Postfix) with ESMTPA; Mon, 15 Nov 2021 11:06:05 -0500 (EST) Received: by perhan.alvh.no-ip.org (Postfix, from userid 1000) id 263AE2A05F0; Mon, 15 Nov 2021 13:06:03 -0300 (-03) Date: Mon, 15 Nov 2021 13:06:03 -0300 From: Alvaro Herrera To: Tom Lane Cc: pgsql-bugs@lists.postgresql.org Subject: Re: Bogus NULL object_name from pg_event_trigger_dropped_objects() Message-ID: <202111151606.sgvlucunylgx@alvherre.pgsql> MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Disposition: inline Content-Transfer-Encoding: 8bit In-Reply-To: <2123408.1636990185@sss.pgh.pa.us> List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Archived-At: Precedence: bulk On 2021-Nov-15, Tom Lane wrote: > NOTICE: DROP TABLE dropped object: table constraint public. t1_pkey on public.t1 > NOTICE: DROP TABLE dropped object: index public.t1_pkey public.t1_pkey > DROP TABLE > > Note the faulty output for the pkey constraint. I've not looked > for the cause. Ah yeah. For objects which have a "schema/name" combination that is unique (is_nsp_name_unique in ObjectPropertyType), we supply a name, otherwise we don't. Constraints don't have unique names in a schema (this also applies to other objects that live under such as triggers and rules). Strangely, the schema is also null for triggers, but not for constraints; I don't remember what the reason is for constraints to have namespaces, but triggers don't have them. Anyway, although this is documented, I'm not 100% sure that it was the best possible design decision. As I recall, the idea was that the user should be able to construct an equivalent DROP command for the object in a replica server, and the schema/name combination could not be used for that purpose for things like constraints, so we decided to leave the name null. The code for this is in EventTriggerSQLDropAddObject, which could perhaps stand some additional commentary. -- Álvaro Herrera Valdivia, Chile — https://www.EnterpriseDB.com/ "How strange it is to find the words "Perl" and "saner" in such close proximity, with no apparent sense of irony. I doubt that Larry himself could have managed it." (ncm, http://lwn.net/Articles/174769/)