Invalid return type

Hello,

I’m dealing with postgres functions, and a unexpected thing happen when creating an invalid function.

Given this function:

CREATE OR REPLACE FUNCTION calculate_factorial(n INT)
    RETURNS INT AS
$$
BEGIN
    IF n <= 1 THEN
        RETURN 'some value';
    ELSE
        RETURN 'other value';
    END IF;
END;
$$ LANGUAGE plpgsql;

select calculate_factorial(5);

On my local Postgres 15.3 this error happens:
[22P02] ERROR: invalid input syntax for type integer: "other value"

But on my fly machine running flyio/postgres-flex 15.2 the query just wont return and is stuck in a execution loop. The error happens with plpgsql, also with plpython3u.

Is it a image version error or something?

This topic was automatically closed 7 days after the last reply. New replies are no longer allowed.