Re: why generated columsn cannot be used in COPY TO?

From: Andreas Kretschmer <andreas(at)a-kretschmer(dot)de>
To: pgsql-general(at)lists(dot)postgresql(dot)org
Subject: Re: why generated columsn cannot be used in COPY TO?
Date: 2023-10-06 14:04:33
Message-ID: 8cebb434-d1ff-2744-1ad0-63816019df04@a-kretschmer.de
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

Am 06.10.23 um 15:47 schrieb Tom Lane:
> Luca Ferrari <fluca1978(at)gmail(dot)com> writes:
>> 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?
> There's a comment about that in copy.c:
>
> * We don't include generated columns in the generated full list and we don't
> * allow them to be specified explicitly. They don't make sense for COPY
> * FROM, but we could possibly allow them for COPY TO. But this way it's at
> * least ensured that whatever we copy out can be copied back in.

ha, as always: read the source ;-)

>
> Not sure how convincing that reasoning is, but it was at least
> thought about. I do agree with it as far as the default column
> list goes, but maybe we could allow explicit selection of these
> columns in COPY TO.

sounds okay

Andreas

--
Andreas Kretschmer - currently still (garden leave)
Technical Account Manager (TAM)
www.enterprisedb.com

In response to

Responses

Browse pgsql-general by date

  From Date Subject
Next Message Artur Zakirov 2023-10-06 14:38:29 Re: How to make a map in pg kernel?
Previous Message Tom Lane 2023-10-06 13:47:51 Re: why generated columsn cannot be used in COPY TO?