Fix overly large values/nulls arrays
authorDavid Rowley <drowley@postgresql.org>
Sun, 29 Dec 2024 10:57:43 +0000 (23:57 +1300)
committerDavid Rowley <drowley@postgresql.org>
Sun, 29 Dec 2024 10:57:43 +0000 (23:57 +1300)
These arrays were sized with Natts_pg_trigger (19) when they should have
been sized with Natts_pg_event_trigger (7).  We'd better fix this as
it's clearly a mistake and it could become problematic if
pg_event_trigger were to gain a dozen or so more columns in the future.

No backpatch as there's no actual bug and the column count on those
tables isn't going to change in released versions.

Author: Xin Zhang <zhanghien@qq.com>
Discussion: https://postgr.es/m/tencent_05AD0FB321A414EC3661204D2102AA6EF605@qq.com

src/backend/commands/event_trigger.c

index dcfc1dbaffd41199af37b3e99666df5148e2c907..1f5872554d40c353c5405cab3884570fea6b81e4 100644 (file)
@@ -276,8 +276,8 @@ insert_event_trigger_tuple(const char *trigname, const char *eventname, Oid evtO
        Relation        tgrel;
        Oid                     trigoid;
        HeapTuple       tuple;
-       Datum           values[Natts_pg_trigger];
-       bool            nulls[Natts_pg_trigger];
+       Datum           values[Natts_pg_event_trigger];
+       bool            nulls[Natts_pg_event_trigger];
        NameData        evtnamedata,
                                evteventdata;
        ObjectAddress myself,