Re: PL/pgSQL RETURN QUERY and DOMAIN CHECKs

From: "David G(dot) Johnston" <david(dot)g(dot)johnston(at)gmail(dot)com>
To: Christian Barthel <bch(at)online(dot)de>
Cc: pgsql-general(at)lists(dot)postgresql(dot)org
Subject: Re: PL/pgSQL RETURN QUERY and DOMAIN CHECKs
Date: 2023-08-23 14:44:16
Message-ID: CAKFQuwaFVo8EyXTe2iRs6TUsEDV6Y_5h5wCZmwj8wwaYUP_vuw@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

On Wed, Aug 23, 2023, 07:25 Christian Barthel <bch(at)online(dot)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.

>

In response to

Browse pgsql-general by date

  From Date Subject
Next Message Adrian Klaver 2023-08-23 15:04:30 Re: [EXTERNAL] Oracle FDW version
Previous Message Christian Barthel 2023-08-23 14:24:46 PL/pgSQL RETURN QUERY and DOMAIN CHECKs