The tsquery, ltxtquery and query_int data types have a common ancestor.
Having acquired check_stack_depth() calls independently, each was
missing at least one call. Back-patch to 9.0 (all supported versions).
static void
infix(INFIX *in, bool first)
{
+ /* since this function recurses, it could be driven to stack overflow. */
+ check_stack_depth();
+
if (in->curpol->type == VAL)
{
RESIZEBUF(in, 11);
static void
infix(INFIX *in, bool first)
{
+ /* since this function recurses, it could be driven to stack overflow. */
+ check_stack_depth();
+
if (in->curpol->type == VAL)
{
char *op = in->op + in->curpol->distance;
#include <ctype.h>
#include "ltree.h"
+#include "miscadmin.h"
PG_FUNCTION_INFO_V1(ltxtq_exec);
PG_FUNCTION_INFO_V1(ltxtq_rexec);
bool
ltree_execute(ITEM *curitem, void *checkval, bool calcnot, bool (*chkcond) (void *checkval, ITEM *val))
{
+ /* since this function recurses, it could be driven to stack overflow */
+ check_stack_depth();
+
if (curitem->type == VAL)
return (*chkcond) (checkval, curitem);
else if (curitem->val == (int4) '!')
{
NODE *node = (NODE *) palloc(sizeof(NODE));
+ /* since this function recurses, it could be driven to stack overflow. */
+ check_stack_depth();
+
node->valnode = in;
node->right = node->left = NULL;
if (in->type == QI_OPR)