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 1kts9w-0002pn-A4 for pgsql-hackers@arkaria.postgresql.org; Mon, 28 Dec 2020 13:02:01 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.92) (envelope-from ) id 1kts9v-0001KY-0d for pgsql-hackers@arkaria.postgresql.org; Mon, 28 Dec 2020 13:01:59 +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 1kts9u-0001KR-HX for pgsql-hackers@lists.postgresql.org; Mon, 28 Dec 2020 13:01:58 +0000 Received: from mxout1.routing.net ([2a03:2900:1:a::a]) by magus.postgresql.org with esmtps (TLS1.3:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1kts9q-0004cA-Lp for pgsql-hackers@postgresql.org; Mon, 28 Dec 2020 13:01:58 +0000 Received: from mxbox2.masterlogin.de (unknown [192.168.10.89]) by mxout1.routing.net (Postfix) with ESMTP id 5CC0540033; Mon, 28 Dec 2020 13:01:52 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=mailerdienst.de; s=20200217; t=1609160512; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: in-reply-to:in-reply-to:references:references; bh=kEy40R+1Z6WKdRjJZEgFDJf4bNLpD4yxPWBMWPPtGTk=; b=Y5O64nK7mFboShc3aAWye3TvBTUSaeLvbOcPCcAVHIySyHp23N7a7SohdCP+46jXg2hqBA Ou5o4+2PkhDuiPfa26SiiO97+bZ+pY6JWhSJzpWC++YfC03Q04OsC6zr3Yxc1i5EFdcjov JtV1rWmSUgOMJ73ahbd/QLrYiA7qiuM= Received: from remote.index.de (business-90-187-114-221.pool2.vodafone-ip.de [90.187.114.221]) by mxbox2.masterlogin.de (Postfix) with ESMTPSA id CEC02100605; Mon, 28 Dec 2020 13:01:51 +0000 (UTC) Received: from acedia.index-gruppe.local (192.168.3.121) by acedia.index-gruppe.local (192.168.3.121) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.1034.26; Mon, 28 Dec 2020 14:01:51 +0100 Received: from acedia.index-gruppe.local ([fe80::ecd1:5d0a:a834:dd56]) by acedia.index-gruppe.local ([fe80::ecd1:5d0a:a834:dd56%5]) with mapi id 15.01.1034.033; Mon, 28 Dec 2020 14:01:51 +0100 From: Arne Roland To: Amit Langote CC: Tomas Vondra , "David G. Johnston" , PostgreSQL-development Subject: Re: a misbehavior of partition row movement (?) Thread-Topic: a misbehavior of partition row movement (?) Thread-Index: AQHWmLNk3TJTUi7wd0y+nolzgVoC06mEPugAgADLzICAAI9GgIAAAx+AgEuIyICAJct6AIAALEm6gADJA4CAAACYgIAKLgLQgAENYgCAAAtkAIAAfNeR Date: Mon, 28 Dec 2020 13:01:50 +0000 Message-ID: References: , In-Reply-To: Accept-Language: en-US, de-DE Content-Language: en-US X-MS-Has-Attach: X-MS-TNEF-Correlator: x-originating-ip: [192.168.3.145] Content-Type: multipart/alternative; boundary="_000_dde1b71053e048e9acccc31c69f04050indexde_" MIME-Version: 1.0 X-Mail-ID: 3c4c3d6f-50bd-4b53-8397-289d4c6eb7ca List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Precedence: bulk --_000_dde1b71053e048e9acccc31c69f04050indexde_ Content-Type: text/plain; charset="iso-8859-1" Content-Transfer-Encoding: quoted-printable While I'd agree that simply deleting with "on delete cascade" on tuple rero= uting is a strong enough violation of the spirit of partitioning changing t= hat behavior, I am surprised by the idea to make a differentiation between = fks and other triggers. The way user defined triggers work, is a violation = to the same degree I get complaints about that on a monthly (if not weekly)= basis. It's easy to point towards the docs, but the docs offer no solution= to archive the behavior, that makes partitioning somewhat transparent. Mos= t people I know don't partition because they like to complicate things, but= just because they have to much data. It isn't just a thing with after triggers. Imo before triggers are even wor= se: If we move a row between partitions we fire all three triggers at once = (at different leaf pages obviously). It's easy to point towards the docs. H= eart bleed was well documented, but I am happy that it was fixed. I don't w= ant to imply this totally unrelated security issue has anything to do with = our weird behavior. I just want to raise the question whether that's a good= thing, because frankly I haven't met anyone thus far, who thought it is. To me it seems the RI triggers are just a specific victim of the way we mad= e triggers work in general. What I tried to express, albeit I apparently failed: I care about having tr= iggers, which make partitioning transparent, on the long run. > because what can happen > today with CASCADE triggers does not seem like a useful behavior by > any measure. I wholeheartedly agree. I just want to point out, that you could state the = same about triggers in general. Backwards compatibility is usually a pretty compelling argument. I would st= ill want to raise the question, whether this should change, because I frank= ly think this is a bad idea. You might ask: Why am I raising this question in this thread? In case we can not (instantly) agree on the fact that this behavior should = change, I'd still prefer to think about making that behavior possible for o= ther triggers (possibly later) as well. One possibility would be having an = entry in the catalog to mark when the trigger should fire. I don't want to stall your definitely useful RI-Trigger fix, but I sincerel= y believe, that we have to do better with triggers in general. If we would make the condition when to fire or not dependent something besi= des that fact whether the trigger is internal, we could at a later date cho= ose to make both ways available, if anyone makes a good case for this. Even= though I still think it's not worth it. >I don't quite recall if the decision to implement it like this was > based on assuming that this is what users would like to see happen in > this case or the perceived difficulty of implementing it the other way > around, that is, of firing AFTER UPDATE triggers in this case. I tried to look that up, but I couldn't find any discussion about this. Do = you have any ideas in which thread that was handled? > Sorry, it seems you are right and the 2nd patch indeed fails to apply to = master. Thank you! I hope to have a more in depth look later this week. Regards Arne --_000_dde1b71053e048e9acccc31c69f04050indexde_ Content-Type: text/html; charset="iso-8859-1" Content-Transfer-Encoding: quoted-printable
While I'd agree that simply deleting with "on delete cascade"= ; on tuple rerouting is a strong enough violation of the spirit of partitio= ning changing that behavior, I am surprised by the idea to make a different= iation between fks and other triggers. The way user defined triggers work, is a violation to the same degree I get co= mplaints about that on a monthly (if not weekly) basis. It's easy to point = towards the docs, but the docs offer no solution to archive the behavior, t= hat makes partitioning somewhat transparent. Most people I know don't partition because they like to compl= icate things, but just because they have to much data.

It isn't just a thing with after triggers. Imo before triggers are even wor= se: If we move a row between partitions we fire all three triggers at once = (at different leaf pages obviously). It's easy to point towards the docs. H= eart bleed was well documented, but I am happy that it was fixed. I don't want to imply this totally unrel= ated security issue has anything to do with our weird behavior. I just want= to raise the question whether that's a good thing, because frankly I haven= 't met anyone thus far, who thought it is.

To me it seems the RI triggers are just a specific victim of the way we mad= e triggers work in general.

What I tried to express, albeit I apparently failed: I care about having tr= iggers, which make partitioning transparent, on the long run.

> because what can happen
> today with CASCADE triggers does not seem like a useful behavior by > any measure.

I wholeheartedly agree. I just want to point out, that you could state the = same about triggers in general.

Backwards compatibility is usually a pretty compelling argument. I would st= ill want to raise the question, whether this should change, because I frank= ly think this is a bad idea.

You might ask: Why am I raising this question in this thread?

In case we can not (instantly) agree on the fact that this behavior should = change, I'd still prefer to think about making that behavior possible for o= ther triggers (possibly later) as well. One possibility would be having an = entry in the catalog to mark when the trigger should fire.

I don't want to stall your definitely useful RI-Trigger fix, but I sincerel= y believe, that we have to do better with triggers in general.

If we would make the condition when to fire or not dependent something besi= des that fact whether the trigger is internal, we could at a later date cho= ose to make both ways available, if anyone makes a good case for this. Even= though I still think it's not worth it.

>I don't quite recall if the decision to implement it like this was
> based on assuming that this is what users would like to see happen in<= br> > this case or the perceived difficulty of implementing it the other way=
> around, that is, of firing AFTER UPDATE triggers in this case.

I tried to look that up, but I couldn't find any discussion about this. Do = you have any ideas in which thread that was handled?

> Sorry, it seems you are right and the 2nd patch indeed fails to apply = to master.

Thank you! I hope to have a more in depth look later this week.

Regards
Arne


--_000_dde1b71053e048e9acccc31c69f04050indexde_--