Re: STATISTICS retained in CREATE TABLE ... LIKE (INCLUDING ALL)? - Mailing list pgsql-hackers

From Alvaro Herrera
Subject Re: STATISTICS retained in CREATE TABLE ... LIKE (INCLUDING ALL)?
Date
Msg-id 20180305220815.3of7vohbbhhzngpk@alvherre.pgsql
Whole thread Raw
In response to Re: STATISTICS retained in CREATE TABLE ... LIKE (INCLUDING ALL)?  (Tomas Vondra <tomas.vondra@2ndquadrant.com>)
List pgsql-hackers
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


pgsql-hackers by date:

Previous
From: Alexander Korotkov
Date:
Subject: Re: [HACKERS] [PATCH] Incremental sort
Next
From: Tom Lane
Date:
Subject: Re: PATCH: Configurable file mode mask