Re: STATISTICS retained in CREATE TABLE ... LIKE (INCLUDING ALL)?

From: Alvaro Herrera <alvherre(at)alvh(dot)no-ip(dot)org>
To: Tomas Vondra <tomas(dot)vondra(at)2ndquadrant(dot)com>
Cc: David Rowley <david(dot)rowley(at)2ndquadrant(dot)com>, "David G(dot) Johnston" <david(dot)g(dot)johnston(at)gmail(dot)com>, Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>, Tels <nospam-pg-abuse(at)bloodgate(dot)com>, Stephen Froehlich <s(dot)froehlich(at)cablelabs(dot)com>, PostgreSQL-development <pgsql-hackers(at)postgresql(dot)org>
Subject: Re: STATISTICS retained in CREATE TABLE ... LIKE (INCLUDING ALL)?
Date: 2018-03-05 22:08:15
Message-ID: 20180305220815.3of7vohbbhhzngpk@alvherre.pgsql
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers pgsql-novice

I admit to much head-scratching, erasing my entire ccache cache, the
autoconf cache and doing two complete rebuilds from scratch, because
I was seeing 40 errors in regression tests. But it
turned out to be about this hunk, which was identical to the idea I had
while skimming David's original, "hey why don't we just copy the list":

> +/*
> + * transformExtendedStatistics
> + * handle extended statistics
> + *
> + * Right now, there's nothing to do here, so we just copy the list.
> + */
> static void
> transformExtendedStatistics(CreateStmtContext *cxt)
> {
> - ListCell *lc;
> -
> - foreach(lc, cxt->extstats)
> - cxt->alist = lappend(cxt->alist, lfirst(lc));
> + cxt->alist = list_copy(cxt->extstats);
> }
>
> /*

But as it turns out, it's wrong! list_concat() is what is needed here,
not list_copy.

--
Álvaro Herrera https://www.2ndQuadrant.com/
PostgreSQL Development, 24x7 Support, Remote DBA, Training & Services

In response to

Browse pgsql-hackers by date

  From Date Subject
Next Message Tom Lane 2018-03-05 22:11:29 Re: PATCH: Configurable file mode mask
Previous Message Alexander Korotkov 2018-03-05 22:07:18 Re: [HACKERS] [PATCH] Incremental sort

Browse pgsql-novice by date

  From Date Subject
Next Message Alvaro Herrera 2018-03-05 22:43:20 Re: STATISTICS retained in CREATE TABLE ... LIKE (INCLUDING ALL)?
Previous Message Tomas Vondra 2018-03-05 21:33:22 Re: STATISTICS retained in CREATE TABLE ... LIKE (INCLUDING ALL)?