public inbox for [email protected]  
help / color / mirror / Atom feed
From: Ayush Tiwari <[email protected]>
To: Srinath Reddy Sadipiralla <[email protected]>
Cc: Julien Tachoires <[email protected]>
Cc: [email protected]
Cc: [email protected]
Subject: Re: Bug in CREATE TABLE .. LIKE .. INCLUDING STATISTICS?
Date: Wed, 22 Apr 2026 17:28:41 +0530
Message-ID: <CAJTYsWX5jTfC41mN7G8o05NRQdkpML-MJSB8kx3TM_u44pPb7Q@mail.gmail.com> (raw)
In-Reply-To: <CAFC+b6q4pF=BSdfOaagRcW74Nmnyz1UMgPcNKRJMFrAe7K3gHQ@mail.gmail.com>
References: <[email protected]>
	<CAFC+b6q4pF=BSdfOaagRcW74Nmnyz1UMgPcNKRJMFrAe7K3gHQ@mail.gmail.com>

Hi,

On Thu, 16 Apr 2026 at 13:14, Srinath Reddy Sadipiralla <
[email protected]> wrote:

> Hi Julien,
>
> On Wed, Apr 15, 2026 at 7:47 PM Julien Tachoires <[email protected]>
> wrote:
>
>> Hi,
>>
>> One of our customer is experiencing an issue when executing CREATE TABLE
>> .. LIKE .. INCLUDING ALL; on 14, the following kind of error happens:
>> ERROR: cache lookup failed for attribute X of relation ZZZZZZ
>>
>> It seems to come from generateClonedExtStatsStmt(): get_attname()
>> appears to be called with an attribute number (attnum) that does not
>> exist.
>>
>
> yeah, i was able to reproduce and also check the flow which is the same
> as you mentioned.
>

I looked into this and the issue is in generateClonedExtStatsStmt().
It passes the child's relation OID
to get_attname() with attribute numbers from the parent's stxkeys.
With dropped columns the attnums don't match.

Julien's patch fixes that, it likely needs to be backported too.

Regards,
Ayush


reply

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Reply to all the recipients using the --to and --cc options:
  reply via email

  To: [email protected]
  Cc: [email protected], [email protected], [email protected], [email protected], [email protected]
  Subject: Re: Bug in CREATE TABLE .. LIKE .. INCLUDING STATISTICS?
  In-Reply-To: <CAJTYsWX5jTfC41mN7G8o05NRQdkpML-MJSB8kx3TM_u44pPb7Q@mail.gmail.com>

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

This inbox is served by agora; see mirroring instructions
for how to clone and mirror all data and code used for this inbox