Fortran language simple table function conversion
The code from the Fortran 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 Fortran language scalar function section.
Compilation
Compilation is the same as the one performed in local
mode.
$NZ_EXPORT_DIR/ae/utilities/bin/compile_ae --language fortran --version 3 \
--template compile --exe applyopFortran applyop.fRegistration
Register the executables by using the modified command, which changes
--template
and --return to be appropriate for a table
function:$NZ_EXPORT_DIR/ae/utilities/bin/register_ae --language fortran --version 3 \
--template udtf --exe applyopFortran \
--sig "applyop_table(varchar(1), int4, int4)" \
--return "table(result int4)"Running
The AE can now be run in
SQL:
SELECT * FROM TABLE WITH FINAL(applyop_table('+', 4, 5));
RESULT
--------
9
(1 row)