Re: plpgsql variable assignment with union is broken - Mailing list pgsql-hackers

From Tom Lane
Subject Re: plpgsql variable assignment with union is broken
Date
Msg-id 3425546.1609882846@sss.pgh.pa.us
Whole thread Raw
In response to plpgsql variable assignment with union is broken  (easteregg@verfriemelt.org)
Responses Re: plpgsql variable assignment with union is broken
List pgsql-hackers
easteregg@verfriemelt.org writes:
> i found, that the behaviour of variable assignment in combination with union is not working anymore:
>   DO $$
>   DECLARE t bool;
>   begin
>       t := a FROM ( SELECT true WHERE false ) t(a) UNION SELECT true AS a;
>   END $$;

> is this an intended change or is it a bug?

It's an intended change, or at least I considered the case and thought
that it was useless because assignment will reject any result with more
than one row.  Do you have any non-toy example that wouldn't be as
clear or clearer without using UNION?  The above sure seems like an
example of awful SQL code.

            regards, tom lane



pgsql-hackers by date:

Previous
From: Paul Martinez
Date:
Subject: [PATCH] Partial foreign key updates in referential integrity triggers
Next
From: Tom Lane
Date:
Subject: Re: set_config() documentation clarification