On Wed, Aug 23, 2023, 07:25 Christian Barthel <bch@online.de> wrote:
Hello,
can anyone explain why the domain check is not generating an exception when used within PL/pgSQL ‘RETURN QUERY’ statement?
45 -- works not as expected: 46 CREATE OR REPLACE FUNCTION tf2() RETURNS SETOF t 47 AS $$ 48 DECLARE 49 BEGIN 50 RETURN QUERY select 4::double precision, 5::double precision; 51 END; $$ LANGUAGE plpgsql SECURITY DEFINER; 52 /* 53 *** *x=# SELECT tf2(); 54 *** +-------+ 55 *** | tf2 | 56 *** +-------+ 57 *** | (4,5) | 58 *** +-------+ 59 *** (1 row) 60 ***
The above (and the type definition...) is all that is relevant for the bug report. Once you've gotten a value of some type nothing else in the system that is simply passed that value is going to reevaluate the constraints.