> For the complete documentation index, see [llms.txt](https://docs.postgresql.tw/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://docs.postgresql.tw/server-programming/spi/spi-interface.md).

# 45.1. Interface Functions \#

[SPI\_connect](/server-programming/spi/spi-interface/spi-spi-connect.md) — connect a C function to the SPI manager

[SPI\_finish](/server-programming/spi/spi-interface/spi-spi-finish.md) — disconnect a C function from the SPI manager

[SPI\_execute](/server-programming/spi/spi-interface/spi-spi-execute.md) — execute a command

[SPI\_exec](/server-programming/spi/spi-interface/spi-spi-exec.md) — execute a read/write command

[SPI\_execute\_extended](/server-programming/spi/spi-interface/spi-spi-execute-extended.md) — execute a command with out-of-line parameters

[SPI\_execute\_with\_args](/server-programming/spi/spi-interface/spi-spi-execute-with-args.md) — execute a command with out-of-line parameters

[SPI\_prepare](/server-programming/spi/spi-interface/spi-spi-prepare.md) — prepare a statement, without executing it yet

[SPI\_prepare\_cursor](/server-programming/spi/spi-interface/spi-spi-prepare-cursor.md) — prepare a statement, without executing it yet

[SPI\_prepare\_extended](/server-programming/spi/spi-interface/spi-spi-prepare-extended.md) — prepare a statement, without executing it yet

[SPI\_prepare\_params](/server-programming/spi/spi-interface/spi-spi-prepare-params.md) — prepare a statement, without executing it yet

[SPI\_getargcount](/server-programming/spi/spi-interface/spi-spi-getargcount.md) — return the number of arguments needed by a statement prepared by `SPI_prepare`

[SPI\_getargtypeid](/server-programming/spi/spi-interface/spi-spi-getargtypeid.md) — return the data type OID for an argument of a statement prepared by `SPI_prepare`

[SPI\_is\_cursor\_plan](/server-programming/spi/spi-interface/spi-spi-is-cursor-plan.md) — return `true` if a statement prepared by `SPI_prepare` can be used with `SPI_cursor_open`

[SPI\_execute\_plan](/server-programming/spi/spi-interface/spi-spi-execute-plan.md) — execute a statement prepared by `SPI_prepare`

[SPI\_execute\_plan\_extended](/server-programming/spi/spi-interface/spi-spi-execute-plan-extended.md) — execute a statement prepared by `SPI_prepare`

[SPI\_execute\_plan\_with\_paramlist](/server-programming/spi/spi-interface/spi-spi-execute-plan-with-paramlist.md) — execute a statement prepared by `SPI_prepare`

[SPI\_execp](/server-programming/spi/spi-interface/spi-spi-execp.md) — execute a statement in read/write mode

[SPI\_cursor\_open](/server-programming/spi/spi-interface/spi-spi-cursor-open.md) — set up a cursor using a statement created with `SPI_prepare`

[SPI\_cursor\_open\_with\_args](/server-programming/spi/spi-interface/spi-spi-cursor-open-with-args.md) — set up a cursor using a query and parameters

[SPI\_cursor\_open\_with\_paramlist](/server-programming/spi/spi-interface/spi-spi-cursor-open-with-paramlist.md) — set up a cursor using parameters

[SPI\_cursor\_parse\_open](/server-programming/spi/spi-interface/spi-spi-cursor-parse-open.md) — set up a cursor using a query string and parameters

[SPI\_cursor\_find](/server-programming/spi/spi-interface/spi-spi-cursor-find.md) — find an existing cursor by name

[SPI\_cursor\_fetch](/server-programming/spi/spi-interface/spi-spi-cursor-fetch.md) — fetch some rows from a cursor

[SPI\_cursor\_move](/server-programming/spi/spi-interface/spi-spi-cursor-move.md) — move a cursor

[SPI\_scroll\_cursor\_fetch](/server-programming/spi/spi-interface/spi-spi-scroll-cursor-fetch.md) — fetch some rows from a cursor

[SPI\_scroll\_cursor\_move](/server-programming/spi/spi-interface/spi-spi-scroll-cursor-move.md) — move a cursor

[SPI\_cursor\_close](/server-programming/spi/spi-interface/spi-spi-cursor-close.md) — close a cursor

[SPI\_keepplan](/server-programming/spi/spi-interface/spi-spi-keepplan.md) — save a prepared statement

[SPI\_saveplan](/server-programming/spi/spi-interface/spi-spi-saveplan.md) — save a prepared statement

[SPI\_register\_relation](/server-programming/spi/spi-interface/spi-spi-register-relation.md) — make an ephemeral named relation available by name in SPI queries

[SPI\_unregister\_relation](/server-programming/spi/spi-interface/spi-spi-unregister-relation.md) — remove an ephemeral named relation from the registry

[SPI\_register\_trigger\_data](/server-programming/spi/spi-interface/spi-spi-register-trigger-data.md) — make ephemeral trigger data available in SPI queries

***

原文：[PostgreSQL 18.6 Documentation](https://www.postgresql.org/docs/18/spi-interface.html)（英文原文，待翻譯）


---

# Agent Instructions
This documentation is published with GitBook. GitBook is the documentation platform designed so that both humans and AI agents can read, navigate, and reason over technical content effectively. Learn more at gitbook.com.

## Querying This Documentation
If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter, and the optional `goal` query parameter:

```
GET https://docs.postgresql.tw/server-programming/spi/spi-interface.md?ask=<question>&goal=<endgoal>
```

`ask` is the immediate question: it should be specific, self-contained, and written in natural language.
`goal` is optional and describes the broader end goal you are ultimately trying to accomplish on behalf of the user. GitBook uses it to tailor the answer towards what is most useful for that goal.

The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
