SPI_is_cursor_plan
SPI_is_cursor_plan — выдать true
, если оператор, подготовленный функцией SPI_prepare
, можно использовать с SPI_cursor_open
Синтаксис
bool SPI_is_cursor_plan(SPIPlanPtr plan
)
Описание
SPI_is_cursor_plan
возвращает true
, если оператор, подготовленный функцией SPI_prepare
, можно передать в качестве аргумента SPI_cursor_open
, или false
в противном случае. Для положительного ответа в plan
должна быть представлена одна команда, и эта команда должна возвращать кортежи; например, SELECT
может быть подходящей командой, если он не содержит предложения INTO
, а UPDATE
подходит, только если он содержит предложение RETURNING
.
Аргументы
SPIPlanPtr
plan
подготовленный оператор (возвращаемый функцией
SPI_prepare
)
Возвращаемое значение
Значение true
или false
, показывающее, можно ли для подготовленного оператора, заданного параметром plan
, получить курсор, при SPI_result
равном нулю. Если дать ответ невозможно (например, если значение plan
неверное или NULL
, либо вызывающий не подключён к SPI), в SPI_result
устанавливается соответствующий код ошибки и возвращается false
.
27.3. Viewing Locks #
Another useful tool for monitoring database activity is the pg_locks
system table. It allows the database administrator to view information about the outstanding locks in the lock manager. For example, this capability can be used to:
View all the locks currently outstanding, all the locks on relations in a particular database, all the locks on a particular relation, or all the locks held by a particular PostgreSQL session.
Determine the relation in the current database with the most ungranted locks (which might be a source of contention among database clients).
Determine the effect of lock contention on overall database performance, as well as the extent to which contention varies with overall database traffic.
Details of the pg_locks
view appear in Section 52.12. For more information on locking and managing concurrency with PostgreSQL, refer to Chapter 13.