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

Function SPI_register_relation

src/backend/executor/spi.c:3560–3588  ·  view source on GitHub ↗

* Register an ephemeral named relation for use by the planner and executor on * subsequent calls using this SPI connection. */

Source from the content-addressed store, hash-verified

3558 * subsequent calls using this SPI connection.
3559 */
3560int
3561SPI_register_relation(EphemeralNamedRelation enr)
3562{
3563 EphemeralNamedRelation match;
3564 int res;
3565
3566 if (enr == NULL || enr->md.name == NULL)
3567 return SPI_ERROR_ARGUMENT;
3568
3569 res = _SPI_begin_call(false); /* keep current memory context */
3570 if (res < 0)
3571 return res;
3572
3573 match = _SPI_find_ENR_by_name(enr->md.name);
3574 if (match)
3575 res = SPI_ERROR_REL_DUPLICATE;
3576 else
3577 {
3578 if (_SPI_current->queryEnv == NULL)
3579 _SPI_current->queryEnv = create_queryEnv();
3580
3581 register_ENR(_SPI_current->queryEnv, enr);
3582 res = SPI_OK_REL_REGISTER;
3583 }
3584
3585 _SPI_end_call(false);
3586
3587 return res;
3588}
3589
3590/*
3591 * Unregister an ephemeral named relation by name. This will probably be a

Callers 2

apply_deltaFunction · 0.85

Calls 5

_SPI_begin_callFunction · 0.85
_SPI_find_ENR_by_nameFunction · 0.85
create_queryEnvFunction · 0.85
register_ENRFunction · 0.85
_SPI_end_callFunction · 0.85

Tested by

no test coverage detected