-- -- bt_bug__name/1 -- create or replace function bt_bug__name( integer ) returns varchar as $$ declare p_bug_id alias for $1; v_name varchar; begin select 'Bug #'||bug_number||': '||summary into v_name from bt_bugs where bug_id = p_bug_id; return v_name; end; $$ language plpgsql;