CREATE OR REPLACE FUNCTION get_all_patterns() RETURNS SETOF PATTERN AS $$ SELECT * FROM pattern; $$ LANGUAGE SQL;