Bug in CREATE TABLE .. LIKE .. INCLUDING STATISTICS?
Julien Tachoires <julien@tachoires.me>
From: Julien Tachoires <julien@tachoires.me>
To: pgsql-bugs@lists.postgresql.org
Date: 2026-04-15T10:57:18Z
Lists: pgsql-bugs
Attachments
- v1-0001-Add-test-for-CTL-.-INCLUDING-STATS.patch (text/x-diff)
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. 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. Best regards, -- Julien Tachoires
Commits
-
Fix attnum remapping in generateClonedExtStatsStmt()
- a0104b4474e9 17.10 landed
- 7bb519635806 16.14 landed
- 76d15a7ee9de 15.18 landed
- 81b56b47c29d 14.23 landed
- 149c875fc20b 18.4 landed
- 6cf49e804c9b 19 (unreleased) landed