Unbreak plperl building - Mailing list pgsql-patches

From Alex Kapranoff
Subject Unbreak plperl building
Date
Msg-id 20000826164624.A89716@kapran.bitmcnit.bryansk.su
Whole thread Raw
Responses Re: Unbreak plperl building
Re: Unbreak plperl building
List pgsql-patches
This patch, when applied in src/pl will unbreak plperl in
7.0.2 release. Sorry, if that's fixed ages ago - I don't track
development versions of PostgreSQL.

Patch is just a little bit tested (some valid functions created and
successfully run as well as some erroneous ones created and emitted proper
error messages when used).

My platform is FreeBSD 5.0-CURRENT (with perl 5.6.0 provided in the
base system).

I'm not subscribed to any of pgsql lists, sorry. Cc: please.

*** ./Makefile.orig    Sat Aug 26 16:22:25 2000
--- ./Makefile    Sat Aug 26 16:14:24 2000
***************
*** 20,30 ****
  ifeq ($(USE_TCL), true)
      $(MAKE) -C tcl $@
  endif
  # does't work bjm 2000-04-11
! #ifeq ($(USE_PERL), true)
! #    -$(MAKE) $(MFLAGS) plperl/Makefile
! #    -$(MAKE) $(MFLAGS) -C plperl $@
! #endif

  plperl/Makefile: plperl/Makefile.PL
      cd plperl && $(PERL) Makefile.PL POLLUTE=1
--- 20,32 ----
  ifeq ($(USE_TCL), true)
      $(MAKE) -C tcl $@
  endif
+
  # does't work bjm 2000-04-11
! # works again, 2000-08-26, Alex Kapranoff <kapr@crosswinds.net>
! ifeq ($(USE_PERL), true)
!     -$(MAKE) $(MFLAGS) plperl/Makefile
!     -$(MAKE) $(MFLAGS) -C plperl $@
! endif

  plperl/Makefile: plperl/Makefile.PL
      cd plperl && $(PERL) Makefile.PL POLLUTE=1
*** ./plperl/plperl.c.orig    Sat Aug 26 16:22:49 2000
--- ./plperl/plperl.c    Sat Aug 26 16:03:07 2000
***************
*** 325,337 ****
      count = perl_call_pv("mksafefunc", G_SCALAR | G_EVAL | G_KEEPERR);
      SPAGAIN;

!     if (SvTRUE(GvSV(errgv)))
      {
          POPs;
          PUTBACK;
          FREETMPS;
          LEAVE;
!         elog(ERROR, "creation of function failed : %s", SvPV(GvSV(errgv), na));
      }

      if (count != 1) {
--- 325,337 ----
      count = perl_call_pv("mksafefunc", G_SCALAR | G_EVAL | G_KEEPERR);
      SPAGAIN;

!     if (SvTRUE(ERRSV))
      {
          POPs;
          PUTBACK;
          FREETMPS;
          LEAVE;
!         elog(ERROR, "creation of function failed : %s", SvPV_nolen(ERRSV));
      }

      if (count != 1) {
***************
*** 441,453 ****
          elog(ERROR, "plperl : didn't get a return item from function");
      }

!     if (SvTRUE(GvSV(errgv)))
      {
          POPs;
          PUTBACK;
          FREETMPS;
          LEAVE;
!         elog(ERROR, "plperl : error from function : %s", SvPV(GvSV(errgv), na));
      }

      retval = newSVsv(POPs);
--- 441,453 ----
          elog(ERROR, "plperl : didn't get a return item from function");
      }

!     if (SvTRUE(ERRSV))
      {
          POPs;
          PUTBACK;
          FREETMPS;
          LEAVE;
!         elog(ERROR, "plperl : error from function : %s", SvPV_nolen(ERRSV));
      }

      retval = newSVsv(POPs);
***************
*** 651,657 ****
          elog(ERROR, "plperl: SPI_finish() failed");

      retval = (Datum) (*fmgr_faddr(&prodesc->result_in_func))
!         (SvPV(perlret, na),
           prodesc->result_in_elem,
           prodesc->result_in_len);

--- 651,657 ----
          elog(ERROR, "plperl: SPI_finish() failed");

      retval = (Datum) (*fmgr_faddr(&prodesc->result_in_func))
!         (SvPV_nolen(perlret),
           prodesc->result_in_elem,
           prodesc->result_in_len);

***************
*** 2189,2194 ****
              sv_catpvf(output, "'%s' => undef,", attname);
      }
      sv_catpv(output, "}");
!     output = perl_eval_pv(SvPV(output, na), TRUE);
      return output;
  }
--- 2189,2194 ----
              sv_catpvf(output, "'%s' => undef,", attname);
      }
      sv_catpv(output, "}");
!     output = perl_eval_pv(SvPV_nolen(output), TRUE);
      return output;
  }

--
Alex Kapranoff,                              Voice: +7(0832)791845.
127 days till brand new millenium...

pgsql-patches by date:

Previous
From: "Jaykumar Ahir"
Date:
Subject: to_char() function's bug and it's patch
Next
From: Karel Zak
Date:
Subject: Re: to_char() function's bug and it's patch