Re: why generated columsn cannot be used in COPY TO? - Mailing list pgsql-general

From Rob Sargent
Subject Re: why generated columsn cannot be used in COPY TO?
Date
Msg-id 8C3C0E91-3515-4E51-8932-1ABE6CE57977@gmail.com
Whole thread Raw
In response to Re: why generated columsn cannot be used in COPY TO?  (Tom Lane <tgl@sss.pgh.pa.us>)
Responses Re: why generated columsn cannot be used in COPY TO?
Re: why generated columsn cannot be used in COPY TO?
List pgsql-general

> On Oct 6, 2023, at 7:47 AM, Tom Lane <tgl@sss.pgh.pa.us> wrote:
>
> Luca Ferrari <fluca1978@gmail.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.
>
> 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.
>
>             regards, tom lane
>
>
What would be copied?  The forumla? Seems to me one is using “the fast option” so adding the column which can be
regeneratedis overhead. 




pgsql-general by date:

Previous
From: Artur Zakirov
Date:
Subject: Re: How to make a map in pg kernel?
Next
From: "David G. Johnston"
Date:
Subject: Re: why generated columsn cannot be used in COPY TO?