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

From Dominique Devienne
Subject Re: why generated columsn cannot be used in COPY TO?
Date
Msg-id CAFCRh-86krUaoSJdnR0Gf5mDuXq=pAGkv1vdXHAoxpPHd5hFaQ@mail.gmail.com
Whole thread Raw
In response to Re: why generated columsn cannot be used in COPY TO?  (Rob Sargent <robjsargent@gmail.com>)
List pgsql-general
On Fri, Oct 6, 2023 at 4:59 PM Rob Sargent <robjsargent@gmail.com> wrote:
What would be copied?  The formula?

Of course not. That's DDL, not DML IMHO.
 
Seems to me one is using “the fast option” so adding the column which can be regenerated is overhead.

Regenerated by whom?  COPY TO to is output to the outside world.
Nothing says it will come back to PostgreSQL later. COPY is not only for backups.
I use COPY to "stream" rows out for processing, combines the best of SELECT
and the incremental nature of CURSOR, for the best latency and throughput.

All that said, that's a work-around like Andreas showed.
I agree with Tom that ignoring them in the default list makes sense,
but that if explicitly asked for, they should be copied out. My $0.02.

pgsql-general by date:

Previous
From: "David G. Johnston"
Date:
Subject: Re: why generated columsn cannot be used in COPY TO?
Next
From: Ron
Date:
Subject: Re: why generated columsn cannot be used in COPY TO?