# Makefile for the plpgsql shared object
#
# IDENTIFICATION
-# $Header: /cvsroot/pgsql/src/pl/plpgsql/src/Attic/Makefile.in,v 1.4 1998/10/09 04:50:12 momjian Exp $
+# $Header: /cvsroot/pgsql/src/pl/plpgsql/src/Attic/Makefile.in,v 1.5 1998/10/09 16:57:07 momjian Exp $
#
#-------------------------------------------------------------------------
#
DLOBJ= plpgsql$(DLSUFFIX)
-OBJS= pl_parse.o pl_handler.o pl_comp.o pl_exec.o pl_funcs.o
+OBJS= plpgsql.o
+
+PLOBJS= pl_parse.o pl_handler.o pl_comp.o pl_exec.o pl_funcs.o
ALL= $(DLOBJ)
#
all: $(ALL)
+$(OBJS): $(PLOBJS)
+ $(LD) -r -o $(OBJS) $(PLOBJS)
+
$(DLOBJ): $(OBJS)
#
* procedural language (PL)
*
* IDENTIFICATION
- * $Header: /cvsroot/pgsql/src/pl/tcl/pltcl.c,v 1.6 1998/09/01 04:40:28 momjian Exp $
+ * $Header: /cvsroot/pgsql/src/pl/tcl/pltcl.c,v 1.7 1998/10/09 16:57:10 momjian Exp $
*
* This software is copyrighted by Jan Wieck - Hamburg.
*
pltcl_call_level--;
- /************************************************************
- * Disconnect from SPI manager
- ************************************************************/
- if (SPI_finish() != SPI_OK_FINISH)
- elog(ERROR, "pltcl: SPI_finish() failed");
-
return retval;
}
siglongjmp(Warn_restart, 1);
}
+ /************************************************************
+ * Disconnect from SPI manager and then create the return
+ * values datum (if the input function does a palloc for it
+ * this must not be allocated in the SPI memory context
+ * because SPI_finish would free it).
+ ************************************************************/
+ if (SPI_finish() != SPI_OK_FINISH)
+ elog(ERROR, "pltcl: SPI_finish() failed");
+
retval = (Datum) (*fmgr_faddr(&prodesc->result_in_func))
(pltcl_safe_interp->result,
prodesc->result_in_elem,
* The return value from the procedure might be one of
* the magic strings OK or SKIP or a list from array get
************************************************************/
- if (strcmp(pltcl_safe_interp->result, "OK") == 0)
+ if (SPI_finish() != SPI_OK_FINISH)
+ elog(ERROR, "pltcl: SPI_finish() failed");
+
+ if (strcmp(pltcl_safe_interp->result, "OK") == 0) {
return rettup;
+ }
if (strcmp(pltcl_safe_interp->result, "SKIP") == 0)
{
return (HeapTuple) NULL;;
int loop_rc;
int ntuples;
HeapTuple *tuples;
- TupleDesc tupdesc;
+ TupleDesc tupdesc = NULL;
sigjmp_buf save_restart;
char *usage = "syntax error - 'SPI_exec "