On 2018/06/14 22:45, Ashutosh Bapat wrote: > On Thu, Jun 14, 2018 at 6:49 PM, Robert Haas <robertmh...@gmail.com> wrote: >> It sounds like you want to try to hide from users the fact that they >> can create triggers on the individual partitions. > > No. I never said that in my mails (see [1], [2]) I object to the > explicit suggestion that they can/should create BEFORE ROW triggers on > partitions since those are not supported on the partitioned table.
I understand Ashutosh's worry as follows: A workaround for the limitation that BR triggers cannot be defined on partitioned tables yet is to define that *same* trigger on all partitions, which works from the beginning (PG 10), so that gets the job done. But... some users may however fail to ensure that the trigger's definition is exactly alike for each partition, especially they are likely to make each trigger call a different function, although each of those functions may have the same body of code. When in some future release, one is able to define the trigger on the partitioned table and does so, the trigger will end up being created again on each partition, because the existing trigger on each partition (after upgrading) would be different due to a different function being called in each. I proposed that we reword the sentence that describes this particular limitation to warn users about that. See if the attached patch is any good for that. Thanks, Amit
diff --git a/doc/src/sgml/ddl.sgml b/doc/src/sgml/ddl.sgml index 0258391154..781536c44b 100644 --- a/doc/src/sgml/ddl.sgml +++ b/doc/src/sgml/ddl.sgml @@ -3349,8 +3349,10 @@ ALTER TABLE measurement ATTACH PARTITION measurement_y2008m02 <listitem> <para> - <literal>BEFORE ROW</literal> triggers, if necessary, must be defined - on individual partitions, not the partitioned table. + Creating <literal>BEFORE ROW</literal> triggers on partitioned tables + is not supported. A workaround is to create such a trigger on individual + partitions, but make sure that its definition is identical across all + partitions, including the function that's called from the trigger. </para> </listitem> </itemizedlist>