PL patches (one more)

Поиск
Список
Период
Сортировка
От jwieck@debis.com (Jan Wieck)
Тема PL patches (one more)
Дата
Msg-id m0zRYPN-000EBPC@orion.SAPserv.Hamburg.dsh.de
обсуждение исходный текст
Ответ на PL patches  (Brook Milligan <brook@trillium.NMSU.Edu>)
Ответы Re: [PATCHES] PL patches (one more)
Список pgsql-hackers
Bruce, please apply this too.

>
> I have had a few problems with the PL stuff recently committed.  The
> following patches fix the problems (i.e., all regression tests pass)
> in what I hope to be a platform-independent fashion.  The accomplish
> the following:

    Thanks for assisting in that area, Brook. It all really needs
    to become platform independent.

    There where a few more problems fixed by the patch below.

      o configure.in

        The tclConfig.sh file here  doesn't  reside  in  the  tcl
        subdirectory.   It  is  sitting  in  /usr/lib directly. I
        added another check for that.

        NOTE: run autoconf

      o pl/tcl/mkMakefile.tcldefs.sh.in

        At least one bash I'm using on one of my  systems  single
        quotes  the  values in the output of the set command. But
        make interprets CC=gcc -O2 different from CC='gcc -O2'.

      o pl/tcl/pltcl.c

        Return values where allocated in SPI memory  context  and
        got freed on SPI_finish().

      o pl/pgsql/Makefile.in

        David Hartwig had some bad problems compiling PL/pgSQL on
        AIX.  I found that the AIX specific mkldexport.sh doesn't
        support  multiple  object  files. I added another linking
        step where  all  the  objects  are  combined  first  into
        plpgsql.o  and only this one is then linked into a shared
        object.

        David (or someone else with access  to  AIX),  could  you
        please check if this works now?


Jan

--

#======================================================================#
# It's easier to get forgiveness for being wrong than for being right. #
# Let's break this rule - forgive me.                                  #
#======================================== jwieck@debis.com (Jan Wieck) #


diff -cr src.orig/configure.in src/configure.in
*** src.orig/configure.in    Fri Oct  9 09:13:14 1998
--- src/configure.in    Fri Oct  9 09:54:18 1998
***************
*** 812,817 ****
--- 812,822 ----
                  fi
              fi
          done
+         if test -z "$TCL_CONFIG_SH"; then
+             if test -d "$dir" -a -r "$dir/tclConfig.sh"; then
+                 TCL_CONFIG_SH=$dir/tclConfig.sh
+             fi
+         fi
      done
      if test -z "$TCL_CONFIG_SH"; then
          AC_MSG_RESULT(no)
diff -cr src.orig/pl/plpgsql/src/Makefile.in src/pl/plpgsql/src/Makefile.in
*** src.orig/pl/plpgsql/src/Makefile.in    Fri Oct  9 09:13:42 1998
--- src/pl/plpgsql/src/Makefile.in    Fri Oct  9 09:26:59 1998
***************
*** 79,85 ****
  #
  DLOBJ= plpgsql$(DLSUFFIX)

! OBJS=    pl_parse.o pl_handler.o pl_comp.o pl_exec.o pl_funcs.o

  ALL=    $(DLOBJ)

--- 79,87 ----
  #
  DLOBJ= plpgsql$(DLSUFFIX)

! OBJS=    plpgsql.o
!
! PLOBJS=    pl_parse.o pl_handler.o pl_comp.o pl_exec.o pl_funcs.o

  ALL=    $(DLOBJ)

***************
*** 87,92 ****
--- 89,97 ----
  # Build the shared object
  #
  all: $(ALL)
+
+ $(OBJS):    $(PLOBJS)
+     $(LD) -r -o $(OBJS) $(PLOBJS)

  $(DLOBJ):    $(OBJS)

diff -cr src.orig/pl/tcl/mkMakefile.tcldefs.sh.in src/pl/tcl/mkMakefile.tcldefs.sh.in
*** src.orig/pl/tcl/mkMakefile.tcldefs.sh.in    Fri Oct  9 09:13:41 1998
--- src/pl/tcl/mkMakefile.tcldefs.sh.in    Fri Oct  9 09:15:44 1998
***************
*** 8,12 ****
      exit 1
  fi

! set | grep '^TCL' > Makefile.tcldefs
  exit 0
--- 8,15 ----
      exit 1
  fi

! for v in `set | grep '^TCL' | sed -e 's/=.*//'` ; do
!     echo $v = `eval "echo \\$$v"`
! done >Makefile.tcldefs
!
  exit 0
diff -cr src.orig/pl/tcl/pltcl.c src/pl/tcl/pltcl.c
*** src.orig/pl/tcl/pltcl.c    Fri Oct  9 09:13:41 1998
--- src/pl/tcl/pltcl.c    Fri Oct  9 10:40:08 1998
***************
*** 417,428 ****

      pltcl_call_level--;

-     /************************************************************
-      * Disconnect from SPI manager
-      ************************************************************/
-     if (SPI_finish() != SPI_OK_FINISH)
-         elog(ERROR, "pltcl: SPI_finish() failed");
-
      return retval;
  }

--- 417,422 ----
***************
*** 731,736 ****
--- 725,739 ----
          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,
***************
*** 1051,1058 ****
       * 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)
          return rettup;
      if (strcmp(pltcl_safe_interp->result, "SKIP") == 0)
      {
          return (HeapTuple) NULL;;
--- 1054,1065 ----
       * The return value from the procedure might be one of
       * the magic strings OK or SKIP or a list from array get
       ************************************************************/
!     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;;
***************
*** 1309,1315 ****
      int            loop_rc;
      int            ntuples;
      HeapTuple  *tuples;
!     TupleDesc    tupdesc;
      sigjmp_buf    save_restart;

      char       *usage = "syntax error - 'SPI_exec "
--- 1316,1322 ----
      int            loop_rc;
      int            ntuples;
      HeapTuple  *tuples;
!     TupleDesc    tupdesc = NULL;
      sigjmp_buf    save_restart;

      char       *usage = "syntax error - 'SPI_exec "

В списке pgsql-hackers по дате отправления:

Предыдущее
От: Tom Ivar Helbekkmo
Дата:
Сообщение: Re: [HACKERS] Open 6.4 items
Следующее
От: jwieck@debis.com (Jan Wieck)
Дата:
Сообщение: Re: [HACKERS] version functions (was NT port of PGSQL - success)