Re:Reject columns of permanent relations that depend on temporary objects

From: "Yilin Zhang" <jiezhilove(at)126(dot)com>
To: Manu <manuelreyesbravo(at)gmail(dot)com>
Cc: pgsql-hackers(at)lists(dot)postgresql(dot)org, "Tom Lane" <tgl(at)sss(dot)pgh(dot)pa(dot)us>, "Jim Jones" <jim(dot)jones(at)uni-muenster(dot)de>, "Nikhil Sontakke" <nikhil(at)planetscale(dot)com>, "Zsolt Parragi" <zsolt(dot)parragi(at)percona(dot)com>, "Heikki Linnakangas" <hlinnaka(at)iki(dot)fi>, "Andres Freund" <andres(at)anarazel(dot)de>
Subject: Re:Reject columns of permanent relations that depend on temporary objects
Date: 2026-11-30 06:38:25
Message-ID: 7b438bf8.4c64.1a22b2d193f.Coremail.jiezhilove@126.com
Views: Whole Thread | Raw Message | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

At 2026-11-29 13:25:23, "Manu" <manuelreyesbravo(at)gmail(dot)com> wrote:
>Hi,
>
>The attached patch rejects a column of a permanent table or composite
>type whose type or collation depends on a temporary object. Today such
>a column is dropped with its data at session exit, with no error and no
>......
>Regards,

>Manu

Hi,
Thanks for your work.
While reviewing your v1 patch, I found a small issue.
The v1 patch fixes the direct temporary object path,
but it does not fix the indirectly effectively-temporary function path.
Here is an example:
CREATE TEMP TABLE eff_tt (x int);
CREATE FUNCTION public.eff_f() RETURNS int LANGUAGE sql
BEGIN ATOMIC SELECT count(*)::int FROM eff_tt; END; -- NOTICE: will be effectively temporary
CREATE DOMAIN public.eff_dom AS int DEFAULT public.eff_f();
CREATE TABLE public.eff_perm (a public.eff_dom); -- allowed by the patch
After the session ends, the result is exactly the same as without the patch:
the function, domain, and column are all gone, the table becomes zero-column, and data is lost.

Best regards,
Yilin Zhang

In response to

Browse pgsql-hackers by date

  From Date Subject
Next Message Xuneng Zhou 2026-11-30 06:52:22 Re: Set 1s WaitLatch timeout if standby limit has expired in ResolveRecoveryConflictWithBufferPin
Previous Message Shinya Kato 2026-11-30 06:01:59 Re: Logical replication row filter loses unchanged toasted columns