CREATE OR REPLACE FUNCTION transactions.is_normally_debit(_account_id bigint)
RETURNS boolean
LANGUAGE plpgsql
AS $function$
BEGIN
RETURN
core.account_masters.normally_debit
FROM core.accounts
INNER JOIN core.account_masters
ON core.accounts.account_master_id = core.account_masters.account_master_id
WHERE account_id = $1;
END
$function$