From 561b35e55653962223fcaaba90dee9bda74e6ad8 Mon Sep 17 00:00:00 2001
From: "Vadim B. Mikheev" <vadim4o@yahoo.com>
Date: Fri, 26 Sep 1997 13:57:39 +0000
Subject: [PATCH] Return error if char *query is null in SPI_prepare()

---
 src/backend/executor/spi.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/src/backend/executor/spi.c b/src/backend/executor/spi.c
index c1a584846ae..646cfca401a 100644
--- a/src/backend/executor/spi.c
+++ b/src/backend/executor/spi.c
@@ -229,7 +229,7 @@ SPI_prepare(char *src, int nargs, Oid * argtypes)
 {
 	_SPI_plan  *plan;
 
-	if (nargs < 0 || (nargs > 0 && argtypes == NULL))
+	if (src == NULL || nargs < 0 || (nargs > 0 && argtypes == NULL))
 	{
 		SPI_result = SPI_ERROR_ARGUMENT;
 		return (NULL);
-- 
GitLab