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

Поиск
Список
Период
Сортировка
От PG Bug reporting form
Тема BUG #16342: CREATE TABLE LIKE INCLUDING GENERATED column order issue
Дата
Msg-id 16342-50008a509308f4ca@postgresql.org
обсуждение исходный текст
Ответы Re: BUG #16342: CREATE TABLE LIKE INCLUDING GENERATED column orderissue  (Peter Eisentraut <peter.eisentraut@2ndquadrant.com>)
Список pgsql-bugs
The following bug has been logged on the website:

Bug reference:      16342
Logged by:          Ethan Waldo
Email address:      ewaldo@healthetechs.com
PostgreSQL version: 12.2
Operating system:   Debian Buster
Description:

CREATE TABLE succeeds when using generated columns and it doesn't matter
what order they are in.  When CREATE TABLE LIKE INCLUDING GENERATED is used,
it only works if the source column was created first in the original
table.

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

postgres=# DROP TABLE test;
DROP TABLE

# Works with funds and funds_t order flipped
postgres=# CREATE TABLE test (
  funds_t text,
  funds float GENERATED ALWAYS AS (cast(funds_t AS double precision))
STORED,
  id bigserial not null
);
CREATE TABLE

postgres=# CREATE TABLE IF NOT EXISTS test_temp (LIKE test INCLUDING
GENERATED);
CREATE TABLE
postgres=#


В списке pgsql-bugs по дате отправления:

Предыдущее
От: Fujii Masao
Дата:
Сообщение: Re: [BUG] non archived WAL removed during production crash recovery
Следующее
От: Sandeep Thakkar
Дата:
Сообщение: Re: Help to Install Postgre SQL