Received: from malur.postgresql.org ([217.196.149.56]) by arkaria.postgresql.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.96) (envelope-from ) id 1wFWEK-005FAP-3C for pgsql-bugs@arkaria.postgresql.org; Wed, 22 Apr 2026 11:58:57 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.96) (envelope-from ) id 1wFWEK-00DZqa-0h for pgsql-bugs@arkaria.postgresql.org; Wed, 22 Apr 2026 11:58:56 +0000 Received: from makus.postgresql.org ([2001:4800:3e1:1::229]) by malur.postgresql.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.96) (envelope-from ) id 1wFWEJ-00DZqS-2i for pgsql-bugs@lists.postgresql.org; Wed, 22 Apr 2026 11:58:55 +0000 Received: from mail-yw1-x1130.google.com ([2607:f8b0:4864:20::1130]) by makus.postgresql.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256 (Exim 4.98.2) (envelope-from ) id 1wFWEH-00000002FOX-37C4 for pgsql-bugs@lists.postgresql.org; Wed, 22 Apr 2026 11:58:54 +0000 Received: by mail-yw1-x1130.google.com with SMTP id 00721157ae682-794719afcd4so57304217b3.1 for ; Wed, 22 Apr 2026 04:58:53 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1776859133; cv=none; d=google.com; s=arc-20240605; b=IvF8iFhdvrbkH8j7VBfXwTuX0AjoIwzkFuAypuKqprBHs0sdDNU4i7Dk79WOXaHdJ4 h9hcp3dPnmUtWcwkMm7UMkQqrLthR6+m75I9mFGxueLmp6ZNcGkZyvnalY05V1DOk11l Am/IPbeBK8OSNJRsjClhctYPYTTfGWM1/V+qhTY5RqopJOoUkHbojXu6t9fZ3wbs7oZf CtO6t/8TpdBqMNoAeoebmS3FTNabXBgnF6Y4dh0B6N8f7F5hhtJHiA6Uf2KaSmkCUkk+ a1sJ2y4IcgW3mY4r12JGc1VGsnpKOzy01xiT9vS3o+P/ua2V/zI3XuJvpVkgsssw3ywO Y89Q== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20240605; h=cc:to:subject:message-id:date:from:in-reply-to:references :mime-version:dkim-signature; bh=tVDTUKeKbjNCR4V8znZ+IR11JBxCIkCqPcfmirgKr8M=; fh=KP8Xbk1I91XyAr0msPWzEatPl3cNmL9UXNfIqfnTjt4=; b=CgYD4vWzobqATodVq/zeqMQ8FZUMrYNsGZ7PK6OqN5jQ9x0U15ogcf7idiNOvp/tJC xCYWyxzNGnoMEbtKWmBjbY6Rqq2diDfqwWcYyQNwUcgdTm0CqyMr9mggmbT2i3tz3Qlo zGP0pUNC01WvLZxpWSc1azNzr8sD8H52CbzqO/5MJWL2XVrAwJ01qrRv7CNIAXSuwr5e pSLM4zMZ+3BjF3HO7Pd3EXhp9+vpOlV3W+AMdUH3Rsf+AiwSZa4+gnMhNVlamwenycAB C2LWI0EgFatijo1CoG9nXpP6chxCmh65HKQ3Ynbv7+WQeia4d19eRGxgODnhlv6IYX6K VLQw==; darn=lists.postgresql.org ARC-Authentication-Results: i=1; mx.google.com; arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20251104; t=1776859133; x=1777463933; darn=lists.postgresql.org; h=cc:to:subject:message-id:date:from:in-reply-to:references :mime-version:from:to:cc:subject:date:message-id:reply-to; bh=tVDTUKeKbjNCR4V8znZ+IR11JBxCIkCqPcfmirgKr8M=; b=WSgLUnfpqVypecDE66dHxRtPdMYnn7JszwkY1rn+8qPmPdDDkeEO9waO0zMs9mF2Fs HF1TDrG5q6IRM7Wi9uMQt2h4kv74US9M616gQ62lsKg6dDyst5SrO4j9JTcOY8scu2Ze YDFam8dBw9CFHzikVxwOEZqb6XtRN2lXropQy+C6ysGzlbsq2jQNihek0h/N1DCAt/lJ VwyejWyr0uCeT+6IpjpsmNgMOrzY3+qNBjxRRZI85kMW+wkZ/q3byhGMJrHrzEfQc9+c f+o/4Ymj62R8ley9BdCyYsOkf2qCCXtyKOWCzAbF+6pGCp2PIZYdpMzfrxGroA64870h PD1g== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20251104; t=1776859133; x=1777463933; h=cc:to:subject:message-id:date:from:in-reply-to:references :mime-version:x-gm-gg:x-gm-message-state:from:to:cc:subject:date :message-id:reply-to; bh=tVDTUKeKbjNCR4V8znZ+IR11JBxCIkCqPcfmirgKr8M=; b=ozBRLEd8xy+wkPXGsDPzk/zldlBi5SwgHdVjwLrgXUre5Sm9DTsNQL7Kynb3BaffVQ Hng8wNr98zqV8mMtJTVMYY5LluWwh01gYFT4fCCpmvJyg5z0BTdQJp4HIN1i6cZHImeN KVs8NZNRRGuio71cIwM3Tpq8THFDewdcG9MBqqrkoDARqsvIpU7vyVKjfp5Mmk650P32 u3Rnobjpkopjevx0bR21VdP1nC9njlpbZ3ZLLpI5k1reEQ98UHjQe7CRy6vfhiTV4Ced eZshSy8IeVuGUJIPgpoq/+dRCrlyI1pZviOdnM0LivfeDQeTBIszqUed/pUGnDAqQtPu e0Ow== X-Forwarded-Encrypted: i=1; AFNElJ9HOJQwaoQFVuP1JPFT3R4uN3puCn9qKU1knJaVRzRsRfCoVyPROgyffKhGgw3ouo45TtD/RXCliZQU@lists.postgresql.org X-Gm-Message-State: AOJu0YwLhBd2ajvUpXwOHALagYCpTGQcZmFUvaoHzBf7fI70Q6uoTLUS KQV1Cm8iKqpCsObzboPKlgj9eLnC99cC/YYjhBkDqsF3BnR51356XJYW4IWUIfdJEKaLH82ta1l XK0iVU+RhF2ovL8yRy9/TQpJp68vEg88= X-Gm-Gg: AeBDietQHvsn/wLRZeMFpcExduTDF6iL5+RijoWg2n2F1FtAjSg2tcVp91y6DC974Dd abUR706BWDvMIMeu/zg8FhgWfX3GSFvpkIW9wdXcxU+JbAl47soFgWDjb7wzWURtybaXUZyCfPh C+DjbmUvDkVtZpYHvik8lOnjyu5UiVu/+Abt2EHDoOZtkpuNCtfzVeQx4wxO5v3PonEXhn/0qG7 QELFVQb/a+duNDWYAJDeExVGELop4VysPDe0B+4OoAQFO+oY0jdg5ObRgMVpmsom8j96KNFlbRG erNXH4EGLudnyugytLg= X-Received: by 2002:a05:690c:110:b0:79b:73dc:d2fb with SMTP id 00721157ae682-7b9ecffb551mr229896027b3.46.1776859133124; Wed, 22 Apr 2026 04:58:53 -0700 (PDT) MIME-Version: 1.0 References: <20260415105718.tomuncfbmlt67oel@poseidon.home.virt> In-Reply-To: From: Ayush Tiwari Date: Wed, 22 Apr 2026 17:28:41 +0530 X-Gm-Features: AQROBzC2o4WkdiDOStZr_cNDeQnf5R0xEaTi4t0pJfKA5eb1nHQNAisSO3rEXWE Message-ID: Subject: Re: Bug in CREATE TABLE .. LIKE .. INCLUDING STATISTICS? To: Srinath Reddy Sadipiralla Cc: Julien Tachoires , dgrowleyml@gmail.com, pgsql-bugs@lists.postgresql.org Content-Type: multipart/alternative; boundary="0000000000007224e206500b412c" List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Archived-At: Precedence: bulk --0000000000007224e206500b412c Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable Hi, On Thu, 16 Apr 2026 at 13:14, Srinath Reddy Sadipiralla < srinath2133@gmail.com> wrote: > Hi Julien, > > On Wed, Apr 15, 2026 at 7:47=E2=80=AFPM Julien Tachoires > 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 --0000000000007224e206500b412c Content-Type: text/html; charset="UTF-8" Content-Transfer-Encoding: quoted-printable
Hi,=C2=A0

On Thu, 16 Apr 2026 at 13:1= 4, Srinath Reddy Sadipiralla <srinath2133@gmail.com> wrote:
Hi= =C2=A0Julien,

On Wed, Apr 15, 2026 at 7:47=E2=80=AFPM Julien Tachoires <<= a href=3D"mailto:julien@tachoires.me" target=3D"_blank">julien@tachoires.me= > 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=C2=A0and also= check the flow which is the same
as you mentioned.

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

Julien's patch fi= xes that, it likely needs to be backported too.
=C2=A0
= Regards,
Ayush

=C2=A0

=

=C2=A0
--0000000000007224e206500b412c--