plpgsql variable assignment with union is broken

easteregg@verfriemelt.org

From: easteregg@verfriemelt.org
To: pgsql-hackers@lists.postgresql.org
Date: 2021-01-05T20:12:57Z
Lists: pgsql-hackers
hi,


i updated our ci pipeline to the latest 14-devel build from the postgresql apt repository:


PostgreSQL 14devel (Debian 14~~devel~20210105.1140-1~285.gitbc43b7c.pgdg110+1) on x86_64-pc-linux-gnu, compiled by gcc (Debian 10.2.1-3) 10.2.1 20201224, 64-bit


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 $$;


before it worked with pg13 and 14-devel with this build:


PostgreSQL 14devel (Debian 14~~devel~20201126.0540-1~210.gitf3a8f73.pgdg110+1) on x86_64-pc-linux-gnu, compiled by gcc (Debian 10.2.0-16) 10.2.0, 64-bit


is this an intended change or is it a bug?


with kind regards,
richard