On 2020-04-04 01:50, PG Bug reporting form wrote:
> postgres=# CREATE TABLE test (
> funds float GENERATED ALWAYS AS (cast(funds_t AS double precision))
> STORED,
> funds_t text,
> id bigserial not null
> );
> CREATE TABLE
>
> postgres=# CREATE TABLE IF NOT EXISTS test_temp (LIKE test INCLUDING
> GENERATED);
> ERROR: XX000: unexpected varattno 3 in expression to be mapped
> LOCATION: map_variable_attnos_mutator, rewriteManip.c:1255
Confirmed. Attached is a patch to fix it. Thanks for the report!
--
Peter Eisentraut http://www.2ndQuadrant.com/
PostgreSQL Development, 24x7 Support, Remote DBA, Training & Services