Skip to content

Commit 69fd09b

Browse files
author
Karina Litskevich
committed
[PGPRO-9881] Check return value of SPI_prepare() for NULL
Tags: vops
1 parent db0b703 commit 69fd09b

File tree

1 file changed

+3
-0
lines changed

1 file changed

+3
-0
lines changed

Diff for: vops.c

+3
Original file line numberDiff line numberDiff line change
@@ -2565,6 +2565,9 @@ Datum vops_populate(PG_FUNCTION_ARGS)
25652565
n += sprintf(stmt + n, " order by %s", sort);
25662566
}
25672567
plan = SPI_prepare(stmt, 0, NULL);
2568+
if (plan == NULL)
2569+
elog(ERROR, "SPI_prepare(\"%s\") failed:%s",
2570+
stmt, SPI_result_code_string(SPI_result));
25682571
portal = SPI_cursor_open(NULL, plan, NULL, NULL, true);
25692572

25702573
begin_batch_insert(destination);

0 commit comments

Comments
 (0)