SPI_execute_plan

SPI_execute_plan — выполнить оператор, подготовленный функцией SPI_prepare

Синтаксис

int SPI_execute_plan(SPIPlanPtr plan, Datum * values, const char * nulls,
                     bool read_only, long count)

Описание

SPI_execute_plan выполняет оператор, подготовленный функцией SPI_prepare или родственными ей. Параметры read_only и count имеют тот же смысл, что и в SPI_execute.

Аргументы

SPIPlanPtr plan

подготовленный оператор (возвращаемый функцией SPI_prepare)

Datum * values

Массив фактических значений параметров. Его размер должен равняться числу аргументов оператора.

const char * nulls

Массив, описывающий, в каких параметрах передаётся NULL. Должен иметь размер, равный числу аргументов оператора.

Если в nulls передаётся NULL, SPI_execute_plan считает, что ни один из параметров не равен NULL. В противном случае элемент массива nulls должен содержать ' ', если значение соответствующего параметра не NULL, либо 'n', если это значение — NULL. (В последнем случае значение, переданное в соответствующем элементе values, не учитывается.) Заметьте, что nulls — это не текстовая строка, а просто массив: ноль ('\0') в конце не нужен.

bool read_only

true для режима выполнения «только чтение»

long count

максимальное число строк, которое должно быть возвращено; с 0 ограничения нет

Возвращаемое значение

Возвращаемые значения те же, что и у SPI_execute, со следующими дополнительными вариантами ошибок (отрицательных результатов):

SPI_ERROR_ARGUMENT

Если plan неверный или NULL, либо count меньше 0

SPI_ERROR_PARAM

Если в values передан NULL и plan был подготовлен с другими параметрами

Переменные SPI_processed и SPI_tuptable устанавливаются как в SPI_execute, если вызов был успешным.

38.17. constraint_column_usage

The view constraint_column_usage identifies all columns in the current database that are used by some constraint. Only those columns are shown that are contained in a table owned by a currently enabled role. For a check constraint, this view identifies the columns that are used in the check expression. For a foreign key constraint, this view identifies the columns that the foreign key references. For a unique or primary key constraint, this view identifies the constrained columns.

Table 38.15. constraint_column_usage Columns

NameData TypeDescription
table_catalogsql_identifier Name of the database that contains the table that contains the column that is used by some constraint (always the current database)
table_schemasql_identifier Name of the schema that contains the table that contains the column that is used by some constraint
table_namesql_identifier Name of the table that contains the column that is used by some constraint
column_namesql_identifier Name of the column that is used by some constraint
constraint_catalogsql_identifierName of the database that contains the constraint (always the current database)
constraint_schemasql_identifierName of the schema that contains the constraint
constraint_namesql_identifierName of the constraint