\c dbplpython

CREATE language plpythonu;

CREATE TABLE employees_table(enum integer, ename text);
INSERT INTO employees_table VALUES (1, '1');

CREATE TYPE e_record AS (
  enum INTEGER,
  ename TEXT
);

CREATE OR REPLACE FUNCTION get_boss_records ()
RETURNS SETOF e_record
AS $$
	rv = plpy.execute("SELECT * FROM employees_table WHERE enum = 1")
	return rv;
$$ LANGUAGE plpythonu;

BEGIN;
	SELECT get_boss_records();
END;

DROP TABLE employees_table;

