CREATE FUNCTION _api.get_user_id() RETURNS INTEGER LANGUAGE plpgsql VOLATILE AS $BODY$ BEGIN RETURN CURRENT_SETTING( 'request.jwt.claims', TRUE )::JSON->>'user_id'; END $BODY$;