Re: BUG #18468: CREATE TABLE ... LIKE leaves orphaned column reference in extended statistics

From: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
To: Tender Wang <tndrwang(at)gmail(dot)com>
Cc: exclusion(at)gmail(dot)com, pgsql-bugs(at)lists(dot)postgresql(dot)org, Tomas Vondra <tomas(dot)vondra(at)enterprisedb(dot)com>
Subject: Re: BUG #18468: CREATE TABLE ... LIKE leaves orphaned column reference in extended statistics
Date: 2024-05-17 20:39:05
Message-ID: 2548234.1715978345@sss.pgh.pa.us
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-bugs

I wrote:
> We don't know the column mapping there, either. What we need to have
> our hands on is the "attmap" computed in expandTableLikeClause, and
> then we can pass the stats expressions through map_variable_attnos().

> I think this might not need to be a really large patch, but it
> definitely has to change where generateClonedExtStatsStmt is
> called from. I can have a go at it if Tomas doesn't want to.

Yeah, this doesn't require a whole lot more than moving the
processing in transformTableLikeClause to expandTableLikeClause.

I chose to get rid of transformExtendedStatistics, because not
only is there nothing for it to do, there will never be any
statements for it to do nothing to.

I plan to sit on this till after the beta1 freeze.

regards, tom lane

Attachment Content-Type Size
fix-bug-18468.patch text/x-diff 10.2 KB

In response to

Responses

Browse pgsql-bugs by date

  From Date Subject
Next Message Tom Lane 2024-05-17 21:52:48 Re: BUG #18470: Time literal accepted in Postgres 15 and below, not accepted in Postgres 16
Previous Message Tom Lane 2024-05-17 18:01:51 Re: BUG #18470: Time literal accepted in Postgres 15 and below, not accepted in Postgres 16