Perl language simple table function conversion
The code from the Perl language scalar function can be reused as a simple table function by making minor modifications to the registration.
Code
The code is the same as found in the Perl language scalar function section.
Deployment
Deploy the script by using the same steps as found in the Perl language scalar function
section.
$NZ_EXPORT_DIR/ae/utilities/bin/compile_ae --language perl --version 3 \
--template deploy ApplyOp.pmRegistration
Register the executables by using the modified command, which changes
--template, --return and --sig to be appropriate
for a table
function:$NZ_EXPORT_DIR/ae/utilities/bin/register_ae --language perl --version 3 \
--template udtf --exe ApplyOp.pm \
--sig "applyopPl_table(varchar(1), int4, int4)" \
--return "table(result int4)"Running
The AE can now be run in SQL on the system
database:
SELECT * FROM TABLE WITH FINAL(applyopPl_table('+', 4, 5));
RESULT
--------
9
(1 row)