Re: BUG #16342: CREATE TABLE LIKE INCLUDING GENERATED column order issue

From: Peter Eisentraut <peter(dot)eisentraut(at)2ndquadrant(dot)com>
To: ewaldo(at)healthetechs(dot)com, pgsql-bugs(at)lists(dot)postgresql(dot)org
Subject: Re: BUG #16342: CREATE TABLE LIKE INCLUDING GENERATED column order issue
Date: 2020-04-05 11:28:20
Message-ID: db920c8a-063e-a320-c5e8-096f0eedc154@2ndquadrant.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-bugs

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

Attachment Content-Type Size
0001-Fix-CREATE-TABLE-LIKE-INCLUDING-GENERATED-column-ord.patch text/plain 8.1 KB

In response to

Responses

Browse pgsql-bugs by date

  From Date Subject
Next Message Tom Lane 2020-04-05 15:26:36 Re: BUG #16342: CREATE TABLE LIKE INCLUDING GENERATED column order issue
Previous Message Peter Eisentraut 2020-04-05 10:41:51 Re: BUG #16333: position() function not equivalent to strpos() function when comparing citext