0

I have created language plperlu in Postgres 9.3 (OS - UBUNTU 12.04.5), using below command

CREATE LANGUAGE plperlu;

I wanted to call shell script from postgres function So I written below function using plperlu.

Below is function

CREATE OR REPLACE FUNCTION tet_func (integer) RETURNS boolean
AS $$
$checkexitcode = system
("sh test_shell.sh");
if ($checkexitcode > 0) { return false; }
return true;
$$ LANGUAGE plperlu;

While compiling I am getting below error

ERROR: didn't get a CODE reference from compiling function "tet_func" CONTEXT: compilation of PL/Perl function "tet_func" ********** Error **********

ERROR: didn't get a CODE reference from compiling function "tet_func" SQL state: XX000 Context: compilation of PL/Perl function "tet_func"

Does anybody have idea why this error is occurring? Or anyone has other solution to call shell script from postgres function.

GAK
  • 1
  • 1
  • Are you sure that is valid perl? Does pl/perl define true/false for you, or have you done so somewhere and not shown it? – Richard Huxton Jul 23 '15 at 07:38
  • Hi Richard, How can I test it is valid perl or not? I have tested one perl script on ubuntu and it working fine. – GAK Jul 23 '15 at 09:53

0 Answers0