create domain m numeric(5,2); create table t (c m); create function f(t) returns m as $ select case when true then $1.c end $ language sql;
psql:/tmp/t1.sql:3: ERROR: return type mismatch in function declared to return m DETAIL: Actual return type is numeric. CONTEXT: SQL function "f"