2
CREATE FUNCTION foo() RETURNS text
    LANGUAGE plperl
    AS $$
        return 'foo';
$$;

CREATE FUNCTION foobar() RETURNS text
    LANGUAGE plperl
    AS $$
        return foo() . 'bar';
$$;

I'm trying to compose results using multiple functions, but when I call foobar() I get an empty result.

Peter Lang
  • 54,264
  • 27
  • 148
  • 161
maxxtack
  • 31
  • 1

1 Answers1

4

From the documentation:

PL/Perl functions cannot call each other directly (because they are anonymous subroutines inside Perl).

The solution appears to be either calling the function as a postgres function (using spi_query) or you can put references to your functions in the globally available hash %_SHARED as shown here

Milen A. Radev
  • 60,241
  • 22
  • 105
  • 110
MadCoder
  • 1,344
  • 8
  • 7