select open change scope Open full search

PG.CENTER connects PostgreSQL documentation, reference, and ecosystem knowledge. Maintained by Pigsty.

Unsupported versions: 6.3
Historical version. PostgreSQL 6.3 reached end of support in March 2003. See the current manual for supported releases.
PostgreSQL
Prev Chapter 44. libpq Next

Fast Path

  • Postgres provides a fast path interface to send function calls to the backend. This is a trapdoor into system internals and can be a potential security hole. Most users will not need this feature.

    PGresult* PQfn(PGconn* conn,
                   int fnid,
                   int *result_buf,
                   int *result_len,
                   int result_is_int,
                   PQArgBlock *args,
                   int nargs);
    
    The fnid argument is the object identifier of the function to be executed. result_buf is the buffer in which to load the return value. The caller must have allocated sufficient space to store the return value. The result length will be returned in the storage pointed to by result_len. If the result is to be an integer value, than result_is_int should be set to 1; otherwise it should be set to 0. args and nargs specify the arguments to the function.
    typedef struct {
                 int len;
                 int isint;
                 union {
                     int *ptr;
                  int integer;
                 } u;
             } PQArgBlock;
    
    PQfn always returns a valid PGresult*. The resultStatus should be checked before the result is used. The caller is responsible for freeing the PGresult with PQclear when it is not longer needed.

Prev Home Next
Query Execution Functions Up Asynchronous Notification

Report a documentation issue

Read the upstream documentation. For corrections, first check the current manual.