]> granicus.if.org Git - postgresql/commitdiff
Check calling context for connectby_text(), per Joe Conway.
authorTom Lane <tgl@sss.pgh.pa.us>
Fri, 16 May 2003 06:07:58 +0000 (06:07 +0000)
committerTom Lane <tgl@sss.pgh.pa.us>
Fri, 16 May 2003 06:07:58 +0000 (06:07 +0000)
contrib/tablefunc/tablefunc.c

index d5db3ceed73a5b24f2b977d0bbc3a8b9f589158c..4fd3846820b3af5c57a06972bd9daf8ddbe9f034 100644 (file)
@@ -646,6 +646,11 @@ connectby_text(PG_FUNCTION_ARGS)
        MemoryContext per_query_ctx;
        MemoryContext oldcontext;
 
+       /* check to see if caller supports us returning a tuplestore */
+       if (!rsinfo || !(rsinfo->allowedModes & SFRM_Materialize))
+               elog(ERROR, "connectby: materialize mode required, but it is not "
+                        "allowed in this context");
+
        if (fcinfo->nargs == 6)
        {
                branch_delim = GET_STR(PG_GETARG_TEXT_P(5));