Hi Alvaro, On Tue, Jul 09, 2019 at 09:23:45PM +0000, Alvaro Herrera wrote: > Propagate trigger arguments to partitions > > We were creating the cloned triggers with an empty list of arguments, > losing the ones that had been specified by the user when creating the > trigger in the partitioned table. Repair. > > This was forgotten in commit 86f575948c77.
This commit has broken the buildfarm on REL_11_STABLE for a couple of animals: https://buildfarm.postgresql.org/cgi-bin/show_log.pl?nm=prion&dt=2019-07-10%2006%3A27%3A02 /home/ec2-user/bf/root/REL_11_STABLE/pgsql.build/../pgsql/src/backend/commands/tablecmds.c: In function ‘CloneRowTriggersToPartition’: /home/ec2-user/bf/root/REL_11_STABLE/pgsql.build/../pgsql/src/backend/commands/tablecmds.c:15283:4: error: ‘for’ loop initial declarations are only allowed in C99 mode for (int i = 0; i < trigForm->tgnargs; i++) This gets fixed with the attached. I would personally keep the code consistent for v12 and HEAD for this code path, but I am fine to let you decide the way you prefer. -- Michael
diff --git a/src/backend/commands/tablecmds.c b/src/backend/commands/tablecmds.c index 5fbe7242c4..70bbe052e1 100644 --- a/src/backend/commands/tablecmds.c +++ b/src/backend/commands/tablecmds.c @@ -15271,6 +15271,7 @@ CloneRowTriggersToPartition(Relation parent, Relation partition) if (trigForm->tgnargs > 0) { char *p; + int i; value = heap_getattr(tuple, Anum_pg_trigger_tgargs, RelationGetDescr(pg_trigger), &isnull); @@ -15280,7 +15281,7 @@ CloneRowTriggersToPartition(Relation parent, Relation partition) p = (char *) VARDATA_ANY(DatumGetByteaPP(value)); - for (int i = 0; i < trigForm->tgnargs; i++) + for (i = 0; i < trigForm->tgnargs; i++) { trigargs = lappend(trigargs, makeString(pstrdup(p))); p += strlen(p) + 1;
signature.asc
Description: PGP signature