Re: PL/pgSQL RETURN QUERY and DOMAIN CHECKs - Mailing list pgsql-general

From David G. Johnston
Subject Re: PL/pgSQL RETURN QUERY and DOMAIN CHECKs
Date
Msg-id CAKFQuwaFVo8EyXTe2iRs6TUsEDV6Y_5h5wCZmwj8wwaYUP_vuw@mail.gmail.com
Whole thread Raw
In response to PL/pgSQL RETURN QUERY and DOMAIN CHECKs  (Christian Barthel <bch@online.de>)
List pgsql-general
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.

David J.


pgsql-general by date:

Previous
From: Christian Barthel
Date:
Subject: PL/pgSQL RETURN QUERY and DOMAIN CHECKs
Next
From: Adrian Klaver
Date:
Subject: Re: [EXTERNAL] Oracle FDW version