"Thiede, Christoph" <Christoph.Thiede@student.hpi.uni-potsdam.de> writes:
> as a Postgres user for about half a year, I think I found a bug in psql (PostgreSQL) 12.2 (Debian 12.2-2.pgdg100+1).
> Steps to reproduce:
> postgres=# create table mytable (foo text generated always as (bar) stored, bar text);
> CREATE TABLE
> postgres=# create temporary table mytemp1 (like mytable);
> CREATE TABLE
> postgres=# create temporary table mytemp2 (like mytable including all);
> ERROR: unexpected varattno 2 in expression to be mapped
Thanks for the report! Trying this locally, it seems to work in
either HEAD or v12 branch tip, so I think we fixed the bug already.
I recall some recent work around this area, so that conclusion
is not surprising. What I don't recall is whether those fixes
were before or after 12.3. You might find that updating to 12.3
fixes it; if not, it should be fixed in next month's 12.4 release.
regards, tom lane