* Register an ephemeral named relation for use by the planner and executor on * subsequent calls using this SPI connection. */
| 3558 | * subsequent calls using this SPI connection. |
| 3559 | */ |
| 3560 | int |
| 3561 | SPI_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 |
no test coverage detected