我想创建一个返回我创建的类型的函数,但是当我执行它时,它说该类型不存在。我认为这是因为它不知道自定义类型。
UDT:
CREATE TYPE building_code AS ENUM ('IT','EMS','HSB','ENG');
功能:
CREATE FUNCTION roomCode(id int ) RETURNS building_code AS
$$
SELECT building_code FROM venue as v WHERE id = v.id;
$$ LANGUAGE SQL;