From: Ron <ronljohnsonjr@gmail.com>
To: pgsql-general@lists.postgresql.org
Subject: Re: why generated columsn cannot be used in COPY TO?
Date: Fri, 6 Oct 2023 11:17:38 -0500
Message-ID: <10519e75-1903-ebd2-2625-4f5b655a02bb@gmail.com> (raw)
In-Reply-To: <CAKFQuwY2j=P50HpXwB-KpZZN3J-71bt18U0zirjOADpBezVSWw@mail.gmail.com>
References: <CAKoxK+5=P6wJw=_UrzAQOBnGiHuq3kaXuPxuFh9_hTQc4nv89Q@mail.gmail.com>
<2949797.1696600071@sss.pgh.pa.us>
<8cebb434-d1ff-2744-1ad0-63816019df04@a-kretschmer.de>
<7f80a4a3-af51-6863-b72d-bee1118b8f79@gmail.com>
<4edb5259-10e6-4103-9d4b-9d63992a6a91@aklaver.com>
<CAKFQuwY2j=P50HpXwB-KpZZN3J-71bt18U0zirjOADpBezVSWw@mail.gmail.com>
On 10/6/23 11:08, David G. Johnston wrote:
> On Fri, Oct 6, 2023 at 8:54 AM Adrian Klaver <adrian.klaver@aklaver.com>
> wrote:
>
> On 10/6/23 08:45, Ron wrote:
> > On 10/6/23 09:04, Andreas Kretschmer wrote:
> >>
>
> >>> 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
> >
> > Nah. "The programmer -- and DBA -- on the Clapham omnibus" quite
> > reasonably expects that COPY table_name TO (output)" copies all the
> > columns listed in "\d table_name".
> >
>
> Yeah, I would agree.
>
>
> Sure, but it doesn't. Mainly since copy's original design was intended to
> solve the dump/restore problem and it doesn't make sense to specify data
> for inbound generated data. So while we do have a POLA violation here the
> desirability to now fix it years later is basically zero. And the current
> behavior is at least defensible and consistent. And there is a very easy
> way to get the desired output making any change that much harder a sell.
At least it's explicitly mentioned in the docs that generated columns are
excluded.
>
> The error message maybe could use some help though, and if there isn't a
> hint maybe add one.
>
> David J.
>
--
Born in Arizona, moved to Babylonia.
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Reply to all the recipients from your mail client; the link fills in
the headers below: reply via email
Some clients, webmail especially, drop In-Reply-To and References from
a link, and the reply then starts a new thread: use the mbox below.
To: pgsql-general@postgresql.org
Cc: ronljohnsonjr@gmail.com
Subject: Re: why generated columsn cannot be used in COPY TO?
In-Reply-To: <10519e75-1903-ebd2-2625-4f5b655a02bb@gmail.com>
References: <CAKoxK+5=P6wJw=_UrzAQOBnGiHuq3kaXuPxuFh9_hTQc4nv89Q@mail.gmail.com> <2949797.1696600071@sss.pgh.pa.us> <8cebb434-d1ff-2744-1ad0-63816019df04@a-kretschmer.de> <7f80a4a3-af51-6863-b72d-bee1118b8f79@gmail.com> <4edb5259-10e6-4103-9d4b-9d63992a6a91@aklaver.com> <CAKFQuwY2j=P50HpXwB-KpZZN3J-71bt18U0zirjOADpBezVSWw@mail.gmail.com> <10519e75-1903-ebd2-2625-4f5b655a02bb@gmail.com>
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox