MCPcopy Create free account
hub / github.com/apache/cloudberry / SetConstraintStateCreate

Function SetConstraintStateCreate

src/backend/commands/trigger.c:5257–5277  ·  view source on GitHub ↗

* Create an empty SetConstraintState with room for numalloc trigstates */

Source from the content-addressed store, hash-verified

5255 * Create an empty SetConstraintState with room for numalloc trigstates
5256 */
5257static SetConstraintState
5258SetConstraintStateCreate(int numalloc)
5259{
5260 SetConstraintState state;
5261
5262 /* Behave sanely with numalloc == 0 */
5263 if (numalloc <= 0)
5264 numalloc = 1;
5265
5266 /*
5267 * We assume that zeroing will correctly initialize the state values.
5268 */
5269 state = (SetConstraintState)
5270 MemoryContextAllocZero(TopTransactionContext,
5271 offsetof(SetConstraintStateData, trigstates) +
5272 numalloc * sizeof(SetConstraintTriggerData));
5273
5274 state->numalloc = numalloc;
5275
5276 return state;
5277}
5278
5279/*
5280 * Copy a SetConstraintState

Callers 2

SetConstraintStateCopyFunction · 0.85
AfterTriggerSetStateFunction · 0.85

Calls 1

MemoryContextAllocZeroFunction · 0.85

Tested by

no test coverage detected