why generated columsn cannot be used in COPY TO?

Поиск
Список
Период
Сортировка
От Luca Ferrari
Тема why generated columsn cannot be used in COPY TO?
Дата
Msg-id CAKoxK+5=P6wJw=_UrzAQOBnGiHuq3kaXuPxuFh9_hTQc4nv89Q@mail.gmail.com
обсуждение исходный текст
Ответы Re: why generated columsn cannot be used in COPY TO?
Re: why generated columsn cannot be used in COPY TO?
Список pgsql-general
Hi all,
I'm wondering why in COPY TO (file or program) I cannot use generated
columns: since I'm pushing data out of the table, why they are not
allowed?

Example:

testdb=# CREATE TABLE test( pk int generated always as identity primary key
, ts timestamp default current_timestamp
, month int generated always as ( extract( month from ts ) ) stored
);

testdb=# insert into test( ts ) values( current_timestamp );

testdb=# copy test to program 'head'; -- ok but silently removes the column
COPY 1
testdb=# copy test( month ) to program 'head';
ERROR:  column "month" is a generated column
DETAIL:  Generated columns cannot be used in COPY.

Thanks,
Luca



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

Предыдущее
От: Anuwat Sagulmontreechai
Дата:
Сообщение: RE: Ask about Foreign Table Plug-in on Windows Server.
Следующее
От: Andreas Kretschmer
Дата:
Сообщение: Re: why generated columsn cannot be used in COPY TO?