/* * PostgreSQL include file for sql_in files. */ /* * During build time, macro definitions will be inserted here. */ @M4_DEFINES_CODE@ /* * There is no way in m4 to escape the quote characters, so we change it * temporarily to something different than the default. */ m4_changequote() /* * PythonFunction * * @param $1 directory * @param $2 python file (without suffix) * @param $3 function * * Example: * CREATE FUNCTION MADLIB_SCHEMA.logregr_coef( * "source" VARCHAR, * "depColumn" VARCHAR, * "indepColumn" VARCHAR) * RETURNS DOUBLE PRECISION[] * AS $$PythonFunction(regress, logistic, compute_logregr_coef)$$ * LANGUAGE plpythonu VOLATILE; */ m4_define(, _", # of which we want the oid rv = plpy.execute('SELECT nspname, proname FROM pg_proc p ' \ 'JOIN pg_namespace n ON (p.pronamespace = n.oid) ' \ 'WHERE p.oid = %s' % foid, 1) global schema_madlib schema_madlib = rv[0]['nspname'] return $2.$3(**globals()) !>) /* * PythonFunctionBodyOnly * * @param $1 directory * @param $2 python file (without suffix) * */ m4_define(, _", # of which we want the oid rv = plpy.execute('SELECT nspname, proname FROM pg_proc p ' \ 'JOIN pg_namespace n ON (p.pronamespace = n.oid) ' \ 'WHERE p.oid = %s' % foid, 1) global schema_madlib schema_madlib = rv[0]['nspname'] !>) /* * PythonFunctionBodyOnlyNoSchema * * @param $1 directory * @param $2 python file (without suffix) * */ m4_define(, ) /* * Change the quote character back to their defaults. */ m4_changequote(,)