=== Applying patches on top of PostgreSQL commit ID e596e077bbb3b512bbc80610d64dc007a5761ce6 === /etc/rc.d/jail: WARNING: Per-jail configuration via jail_* variables is obsolete. Please consider migrating to /etc/jail.conf. Wed Feb 19 21:57:24 UTC 2025 On branch cf/4980 nothing to commit, working tree clean === applying patch ./v4-0001-Add-prosupport-helpers-to-aggregate-functions.patch Applied patch to 'src/backend/optimizer/plan/planagg.c' cleanly. Applied patch to 'src/backend/optimizer/prep/prepagg.c' cleanly. Applied patch to 'src/include/catalog/pg_proc.dat' cleanly. Applied patch to 'src/include/nodes/supportnodes.h' with conflicts. Applied patch to 'src/test/regress/expected/aggregates.out' cleanly. Applied patch to 'src/test/regress/sql/aggregates.sql' cleanly. Applied patch to 'src/tools/pgindent/typedefs.list' with conflicts. U src/include/nodes/supportnodes.h U src/tools/pgindent/typedefs.list diff --cc src/include/nodes/supportnodes.h index 9c047cc401,5b9a14c855..0000000000 --- a/src/include/nodes/supportnodes.h +++ b/src/include/nodes/supportnodes.h @@@ -343,51 -343,11 +343,60 @@@ typedef struct SupportRequestOptimizeWi * optimizations are possible. */ } SupportRequestOptimizeWindowClause; ++<<<<<<< ours +/* + * The ModifyInPlace request allows the support function to detect whether + * a call to its target function can be allowed to modify a read/write + * expanded object in-place. The context is that we are considering a + * PL/pgSQL (or similar PL) assignment of the form "x := f(x, ...)" where + * the variable x is of a type that can be represented as an expanded object + * (see utils/expandeddatum.h). If f() can usefully optimize by modifying + * the passed-in object in-place, then this request can be implemented to + * instruct PL/pgSQL to pass a read-write expanded pointer to the variable's + * value. (Note that there is no guarantee that later calls to f() will + * actually do so. If f() receives a read-only pointer, or a pointer to a + * non-expanded object, it must follow the usual convention of not modifying + * the pointed-to object.) There are two requirements that must be met + * to make this safe: + * 1. f() must guarantee that it will not have modified the object if it + * fails. Otherwise the variable's value might change unexpectedly. + * 2. If the other arguments to f() ("..." in the above example) contain + * references to x, f() must be able to cope with that; or if that's not + * safe, the support function must scan the other arguments to verify that + * there are no other references to x. An example of the concern here is + * that in "arr := array_append(arr, arr[1])", if the array element type + * is pass-by-reference then array_append would receive a second argument + * that points into the array object it intends to modify. array_append is + * coded to make that safe, but other functions might not be able to cope. + * + * "args" is a node tree list representing the function's arguments. + * One or more nodes within the node tree will be PARAM_EXTERN Params + * with ID "paramid", which represent the assignment target variable. + * (Note that such references are not necessarily at top level in the list, + * for example we might have "x := f(x, g(x))". Generally it's only safe + * to optimize a reference that is at top level, else we're making promises + * about the behavior of g() as well as f().) + * + * If modify-in-place is safe, the support function should return the + * address of the Param node that is to return a read-write pointer. + * (At most one of the references is allowed to do so.) Otherwise, + * return NULL. + */ +typedef struct SupportRequestModifyInPlace +{ + NodeTag type; + + Oid funcid; /* PG_PROC OID of the target function */ + List *args; /* Arguments to the function */ + int paramid; /* ID of Param(s) representing variable */ +} SupportRequestModifyInPlace; ++======= + typedef struct SupportRequestAggregate + { + NodeTag type; + + Aggref *aggref; + } SupportRequestAggregate; ++>>>>>>> theirs #endif /* SUPPORTNODES_H */ diff --cc src/tools/pgindent/typedefs.list index fb39c915d7,53b5136538..0000000000 --- a/src/tools/pgindent/typedefs.list +++ b/src/tools/pgindent/typedefs.list @@@ -2808,7 -2793,7 +2808,11 @@@ SubscriptionRelStat SummarizerReadLocalXLogPrivate SupportRequestCost SupportRequestIndexCondition ++<<<<<<< ours +SupportRequestModifyInPlace ++======= + SupportRequestAggregate ++>>>>>>> theirs SupportRequestOptimizeWindowClause SupportRequestRows SupportRequestSelectivity