Received: from malur.postgresql.org ([2a02:16a8:dc51::56]) by arkaria.postgresql.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA384:256) (Exim 4.89) (envelope-from ) id 1g9RbB-0005cL-Vf for pgsql-hackers@arkaria.postgresql.org; Mon, 08 Oct 2018 09:13:10 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.89) (envelope-from ) id 1g9RbA-00076K-4S for pgsql-hackers@arkaria.postgresql.org; Mon, 08 Oct 2018 09:13:08 +0000 Received: from magus.postgresql.org ([2a02:c0:301:0:ffff::29]) by malur.postgresql.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA384:256) (Exim 4.89) (envelope-from ) id 1g9Rb9-00076C-TD for pgsql-hackers@lists.postgresql.org; Mon, 08 Oct 2018 09:13:07 +0000 Received: from wout1-smtp.messagingengine.com ([64.147.123.24]) by magus.postgresql.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA384:256) (Exim 4.89) (envelope-from ) id 1g9Rb7-0001jS-Oo for pgsql-hackers@postgresql.org; Mon, 08 Oct 2018 09:13:07 +0000 Received: from compute4.internal (compute4.nyi.internal [10.202.2.44]) by mailout.west.internal (Postfix) with ESMTP id 389C77FE; Mon, 8 Oct 2018 05:13:03 -0400 (EDT) Received: from mailfrontend1 ([10.202.2.162]) by compute4.internal (MEProxy); Mon, 08 Oct 2018 05:13:03 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=paquier.xyz; h= date:from:to:cc:subject:message-id:references:mime-version :content-type:in-reply-to; s=fm2; bh=xIiNm1nyw7tx9YCV1i/TvGnv210 vWVlzQU6ndpAenMk=; b=Ql0jaiEtfn2kAhYAsFIxqhzkBK0hjKOtPPotu1FilKl D6+T7H9qwDD9R9Lbrnc7jTlJNe7KZt+3ZohrKJMQP7FAtucdIcBRMEwMup7rQOsT 7GQX0YldiKL9z/KmApoNsCJGuo8CUYXVcqo4OiEMTkMTbnMoafK+OPWx5QdxKff8 yYc/rlBGOO5CjL5GYZlWbyQ8HIBhbp/92H5cBLXf02MYSFs6b3Jgc1aceEQRjDmP qSSYKPy1yw2bsUyWJ+KkjPYD+OPdEkbgPerJo3h9c1mQFPUoHkcUb8Lrg7yLbrE9 HU1fb9bQqpV/iUmfm2JdXa+Z15wsg0EvQI1fUVg1F5g== DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d= messagingengine.com; h=cc:content-type:date:from:in-reply-to :message-id:mime-version:references:subject:to:x-me-proxy :x-me-proxy:x-me-sender:x-me-sender:x-sasl-enc; s=fm3; bh=xIiNm1 nyw7tx9YCV1i/TvGnv210vWVlzQU6ndpAenMk=; b=ss7dJ2O0SqVVm1qKL5pcC2 ChO6koIv+ic42Bi6TsluyjLISyjvN5bGOhR//ctMAN99VkT/xUXjmf17B6fq/XEJ TMPIByPgsiXk8YIErWJSbOBKdSFuXAnc7rl34xMOGT/+HpdgHX0GCeFTTAg0jhX9 TLjdNjJz/adOKGk0bBtrJCQrDZGnk5nPU8ReQJX4OIyl4ugeBSjMbkgQNfi//i9l F6p/xQGuoRoJEjKIZ9mebkCgUD8jQQzLV6C6KqHk+FNwmp7v/DtnpLv3McCXQ1a2 ip8qNsJTAwynxElzEw5hysO9616Fpjx/gzTPdHaHUP50c4LzIjmzIYtUiLjcw4lA == X-ME-Sender: X-ME-Proxy: Received: from paquier.xyz (c137162.net61215.cablenet.ne.jp [61.215.137.162]) by mail.messagingengine.com (Postfix) with ESMTPA id 448D3E4307; Mon, 8 Oct 2018 05:13:00 -0400 (EDT) Date: Mon, 8 Oct 2018 18:12:58 +0900 From: Michael Paquier To: Alvaro Herrera Cc: Postgres hackers Subject: Re: pgsql: Fix event triggers for partitioned tables Message-ID: <20181008091258.GC2754@paquier.xyz> References: MIME-Version: 1.0 Content-Type: multipart/signed; micalg=pgp-sha512; protocol="application/pgp-signature"; boundary="C+ts3FVlLX8+P6JN" Content-Disposition: inline In-Reply-To: List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Precedence: bulk --C+ts3FVlLX8+P6JN Content-Type: multipart/mixed; boundary="i7F3eY7HS/tUJxUd" Content-Disposition: inline --i7F3eY7HS/tUJxUd Content-Type: text/plain; charset=utf-8 Content-Disposition: inline Content-Transfer-Encoding: quoted-printable Hi Alvaro, On Sat, Oct 06, 2018 at 10:18:46PM +0000, Alvaro Herrera wrote: > Fix event triggers for partitioned tables >=20 > Index DDL cascading on partitioned tables introduced a way for ALTER > TABLE to be called reentrantly. This caused an an important deficiency > in event trigger support to be exposed: on exiting the reentrant call, > the alter table state object was clobbered, causing a crash when the > outer alter table tries to finalize its processing. Fix the crash by > creating a stack of event trigger state objects. There are still ways > to cause things to misbehave (and probably other crashers) with more > elaborate tricks, but at least it now doesn't crash in the obvious > scenario. This commit is producing a warning with my compiler: event_trigger.c:1764:9: note: in expansion of macro =E2=80=98OidIsValid=E2= =80=99 Assert(OidIsValid(currentEventTriggerState->currentCommand)); The fix is obvious because currentCommand is a pointer and not an Oid. Please see attached. Should I fix it myself? -- Michael --i7F3eY7HS/tUJxUd Content-Type: text/x-diff; charset=us-ascii Content-Disposition: attachment; filename="event-trigger-warning.patch" Content-Transfer-Encoding: quoted-printable diff --git a/src/backend/commands/event_trigger.c b/src/backend/commands/ev= ent_trigger.c index 2c1dc47541..9a702e4097 100644 --- a/src/backend/commands/event_trigger.c +++ b/src/backend/commands/event_trigger.c @@ -1761,7 +1761,7 @@ EventTriggerCollectAlterTableSubcmd(Node *subcmd, Obj= ectAddress address) return; =20 Assert(IsA(subcmd, AlterTableCmd)); - Assert(OidIsValid(currentEventTriggerState->currentCommand)); + Assert(currentEventTriggerState->currentCommand !=3D NULL); Assert(OidIsValid(currentEventTriggerState->currentCommand->d.alterTable.= objectId)); =20 oldcxt =3D MemoryContextSwitchTo(currentEventTriggerState->cxt); --i7F3eY7HS/tUJxUd-- --C+ts3FVlLX8+P6JN Content-Type: application/pgp-signature; name="signature.asc" -----BEGIN PGP SIGNATURE----- iQIzBAABCgAdFiEEG72nH6vTowiyblFKnvQgOdbyQH0FAlu7H5oACgkQnvQgOdby QH1obA/7B8/h5AxVIke2023Ip0FalgcPAAyAhtAIyaY9JL3R7W8K2f0JH+MuuLcy ymMMpeNqn1fBvKhZSasNwUpqGdUZ+iKyvQgL1b3wCgNtrSh5cz0a4EGlAGtutJSq QzNrmc0RyC3qAJt/fWfrZrizrUenaEX73rgp1WL5r7N7oE/kpQ7Esy7pfcWjv4vR GRPoxHHfSi6AdD1jcO7op+EXql0ZOCDW7L9V+1kLqgEaMF3gkoyOWeyFnJTbgBOe h8Uui+NZQpm4lzY4Ek2/F+mlu97/HNiG6k2Xm84FoU9xgZVqisIoX58XXtIWljS9 +ECfJhaWEMfjxEnlJqQkQ996fnzr9xFwHtfvhoyiWxL7SdJhBvUSlWkuGDugm1w8 s/tJGJH8YHnL8ho0KVEiD/6Zbl16pwiI+uoGVq0SP8zHOgeEhBg/7DfyK09UcLD3 D6Ix0WkYL9wt3kdcYaXa6qiMIeAezpzMAT/iBPoseLb9RRqc1o9D+0istz2iaSLy 5ZrvA7Ma/NMa/mmojQlBmL7FRKHQchflkmNJtXX9cs2pycjiuKBFO3eNkPXhE541 9jdCIDvCAlLgCq9niK3NJzoOGbYMQ8x6fC/UszWktKo8ZbT9HysqmHHTHraWsgfj iNh/5giXZKg1dRY3Tee76W0H3szvuvsXOryeD+sIrR1q9/3lcYI= =DGUq -----END PGP SIGNATURE----- --C+ts3FVlLX8+P6JN--