public inbox for [email protected]
help / color / mirror / Atom feedFrom: Srinath Reddy Sadipiralla <[email protected]>
To: Julien Tachoires <[email protected]>
To: [email protected]
Cc: [email protected]
Subject: Re: Bug in CREATE TABLE .. LIKE .. INCLUDING STATISTICS?
Date: Thu, 16 Apr 2026 13:14:39 +0530
Message-ID: <CAFC+b6q4pF=BSdfOaagRcW74Nmnyz1UMgPcNKRJMFrAe7K3gHQ@mail.gmail.com> (raw)
In-Reply-To: <[email protected]>
References: <[email protected]>
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.
>
> Please find attached 2 patches for the master branch, the first one adds
> a test that triggers the problem, the 2nd one is an attempt to fix it.
>
I think it's better to write a 4 column test, with this it covers both
cases of lookup either returning the wrong column name or errors
out when the attnum does not exist in the child, thoughts?
something like this ....
CREATE TABLE parent_like_stats (a int, b int, c int, d int);
ALTER TABLE parent_like_stats DROP COLUMN b;
CREATE STATISTICS s_parent ON a, c FROM parent_like_stats;
CREATE TABLE child_like_stats (LIKE parent_like_stats INCLUDING STATISTICS);
other than this patches LGTM.
--
Thanks,
Srinath Reddy Sadipiralla
EDB: https://www.enterprisedb.com/
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]
Subject: Re: Bug in CREATE TABLE .. LIKE .. INCLUDING STATISTICS?
In-Reply-To: <CAFC+b6q4pF=BSdfOaagRcW74Nmnyz1UMgPcNKRJMFrAe7K3gHQ@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