Re: in BeginCopyTo make materialized view using COPY TO instead of COPY (query).

From: Andrew Dunstan <andrew(at)dunslane(dot)net>
To: "David G(dot) Johnston" <david(dot)g(dot)johnston(at)gmail(dot)com>
Cc: Kirill Reshke <reshkekirill(at)gmail(dot)com>, jian he <jian(dot)universality(at)gmail(dot)com>, PostgreSQL-development <pgsql-hackers(at)postgresql(dot)org>, Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>, Michael Paquier <michael(at)paquier(dot)xyz>
Subject: Re: in BeginCopyTo make materialized view using COPY TO instead of COPY (query).
Date: 2025-03-29 18:56:03
Message-ID: 442e62f7-ef64-4df1-8453-d682fe9bdaa3@dunslane.net
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers


On 2025-03-29 Sa 12:17 PM, David G. Johnston wrote:
> On Sat, Mar 29, 2025 at 9:06 AM Andrew Dunstan <andrew(at)dunslane(dot)net>
> wrote:
>
>
> On 2025-03-29 Sa 10:40 AM, David G. Johnston wrote:
>> On Saturday, March 29, 2025, Kirill Reshke
>> <reshkekirill(at)gmail(dot)com> wrote:
>>
>> On Sat, 29 Mar 2025 at 09:47, jian he
>> <jian(dot)universality(at)gmail(dot)com> wrote:
>> >
>> > will use {table_beginscan, table_scan_getnextslot,
>> table_endscan}
>> > to output the data.
>> > but views don't have storage, table_beginscan mechanism
>> won't work.
>> >
>> > so i don't think this is possible for view.
>>
>> Well... So you are saying that let us have inconsistent features
>> because of how things are implemented in core... I don't sure I'm
>> buying that, but whatever, let's hear some other voices from the
>> community. My argument is that while we are working on it,
>> perhaps we
>> should revise certain implementation specifics along the way.
>> However,
>> this is merely my opinion on the matter.
>>
>>
>>  At present copy {table} to only exists to support pg_dump.  It
>> is not marketed as a general purpose export facility.
>
>
> *ahem*
>
>
> What is your evidence for that proposition? If this were true we
> would not support CSV mode, which pg_dump does not use. It might
> have limitations, but its use goes far beyond just pg_dump, both
> in theory and practice.
>
>
>
>
> "copy {subquery} to" is a general-purpose exporter that makes use of
> those additional features.  Sure, they also work for the narrowed case
> of "copy {relation/table} to" but I make my claim on the very fact
> that {relation} cannot be stuff like foreign tables or partitioned
> tables, which pg_dump has no need to target.
>
>

I don't believe that the premise supports the conclusion.

cheers

andrew

--
Andrew Dunstan
EDB:https://www.enterprisedb.com

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message David G. Johnston 2025-03-29 18:58:22 Re: in BeginCopyTo make materialized view using COPY TO instead of COPY (query).
Previous Message Srinath Reddy 2025-03-29 18:50:36 Re: getting "shell command argument contains a newline or carriage return:" error with pg_dumpall when db name have new line in double quote