Received: from malur.postgresql.org ([217.196.149.56]) by arkaria.postgresql.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.94.2) (envelope-from ) id 1tyYsl-008OIY-4j for pgsql-hackers@arkaria.postgresql.org; Sat, 29 Mar 2025 16:18:03 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.94.2) (envelope-from ) id 1tyYsj-00DEnv-PR for pgsql-hackers@arkaria.postgresql.org; Sat, 29 Mar 2025 16:18:01 +0000 Received: from makus.postgresql.org ([2001:4800:3e1:1::229]) by malur.postgresql.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.94.2) (envelope-from ) id 1tyYsj-00DEnn-Ax for pgsql-hackers@lists.postgresql.org; Sat, 29 Mar 2025 16:18:01 +0000 Received: from mail-oa1-x33.google.com ([2001:4860:4864:20::33]) by makus.postgresql.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256 (Exim 4.96) (envelope-from ) id 1tyYsh-001p84-1a for pgsql-hackers@postgresql.org; Sat, 29 Mar 2025 16:18:00 +0000 Received: by mail-oa1-x33.google.com with SMTP id 586e51a60fabf-2c7f876b320so1873408fac.1 for ; Sat, 29 Mar 2025 09:17:59 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1743265079; x=1743869879; darn=postgresql.org; h=cc:to:subject:message-id:date:from:in-reply-to:references :mime-version:from:to:cc:subject:date:message-id:reply-to; bh=8S854KDqmm2aB0B5g9NVX09pPhfHLZvlpBAoFO3DTNk=; b=HqkwKmmlFikklKUhy3+lvv/8k55C7eLh01xRSqWzcafl8leNJdnrZqinkB9iH2ri1F trfSjE63+lKT0rH/J/4f1zM/icxVv62ascd3lCUcuJm5z/X9LfKehKhhPDBxEIYy6qHL Jtrgxbl7oGezBbEpaMCLr94zfCGxDPwTSKJHGSmgYj77R04EELvOSb9UDd7Fjbpoi526 19jQATVhuQ/gSRFvE/9JqYcRyaBmBycoz7ncCHl4gmMPJr44vGTQ8GmbDNP1v156QKam PDazkTDaxfbSZKSIPcj5FWQ1hEHwYYni/SvjPxWZPOqaV7/guMacmZUsGQJKjWbR0PbU YMBA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1743265079; x=1743869879; h=cc:to:subject:message-id:date:from:in-reply-to:references :mime-version:x-gm-message-state:from:to:cc:subject:date:message-id :reply-to; bh=8S854KDqmm2aB0B5g9NVX09pPhfHLZvlpBAoFO3DTNk=; b=ai0Cmh5mTVB6dYHA0PCUZ5yA0iAAhrhhOZSTod1QV9LdB+zwdhXhkXdc4cq3Cre3Xb S13hCCgKt9rb/aF7DYdUDDk/QrI6gH8kFxhrqD6q43m5g/s/eTBO85DLoE0VpJWkuXmq Ei4VQSEzM+O1mnz9HETcmQvoHrExgcvP7FXcVFAS4Fe6KVYNOu+v9EyEfJ7KURhV6i70 GNUb2911ccx4UbxDqQ9iyYKc0IHwzYnpBUYq/vXZFhyrwcjIxUxuVYsncNeCAwIGkQjl ecqhppbvmhNS26BaypoWIvMht3mlORMOXbyGLoiSi1F9M2vvBdD8ANcmMniG6ygpjfel GWuQ== X-Forwarded-Encrypted: i=1; AJvYcCV2TzDhzmn0ULLlcXoFEdtqV+gZSz0cjodOdrNdyOhbLLVomVHA0hHWMxUiLM0GZLXGv7GRx6swArdNlDun@postgresql.org X-Gm-Message-State: AOJu0YzJqMzd7XXBU6XkpGBLuhR6QuIPk2YIhQqgylcNDQH3rB51RmII +sInj3yGEcHmgpLmg3IjQHlOmr/zkDQWdp8e/cI6PZn5hraTew7ZGqWN+Cz96A+fpchaifMfppm OsdYiRxn3bfGQpMamLB/HcBUvW9w= X-Gm-Gg: ASbGncsIMHPSSHYZMn/NOpKgXQcYH8T1jKMZGDSuHB25du5Q/ewVmHtAbwcRS7fk2hv +gxkXfbPNnl6UrEfV0esstnzBFRVF2maR0vwVzxb2fCZWUNcuXB3HgdV7go22Pmo84Xgeg4eG44 eE2ay2vfnXvOw9vQH4gzbzU1lk X-Google-Smtp-Source: AGHT+IF2hYe181LTvlzhKjZmF5wvnKOvlM4QJsr9Smqy8j8jxy8AxKHBwSUPrCT87huyeipZWY/54aGeR//wDnJ0b1U= X-Received: by 2002:a05:6871:554:b0:29e:32e7:5f17 with SMTP id 586e51a60fabf-2cbcf6c7ff8mr1848924fac.28.1743265078845; Sat, 29 Mar 2025 09:17:58 -0700 (PDT) MIME-Version: 1.0 References: In-Reply-To: From: "David G. Johnston" Date: Sat, 29 Mar 2025 09:17:21 -0700 X-Gm-Features: AQ5f1JoTCbuoyelNyrw9MraMDcJK4s8o4SuYTWJoIn8_RZ5sHN1yNqMGsctnXPg Message-ID: Subject: Re: in BeginCopyTo make materialized view using COPY TO instead of COPY (query). To: Andrew Dunstan Cc: Kirill Reshke , jian he , PostgreSQL-development , Tom Lane , Michael Paquier Content-Type: multipart/alternative; boundary="000000000000c6429e06317d8763" List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Archived-At: Precedence: bulk --000000000000c6429e06317d8763 Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable On Sat, Mar 29, 2025 at 9:06=E2=80=AFAM Andrew Dunstan wrote: > > On 2025-03-29 Sa 10:40 AM, David G. Johnston wrote: > > On Saturday, March 29, 2025, Kirill Reshke wrote= : > >> On Sat, 29 Mar 2025 at 09:47, jian he >> 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 no= t > 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. David J. --000000000000c6429e06317d8763 Content-Type: text/html; charset="UTF-8" Content-Transfer-Encoding: quoted-printable
On Sat, Mar 29, 2025 at 9:06=E2=80=AFAM Andrew Dunstan <= ;andrew@dunslane.net> wrote:<= /span>
=20 =20 =20


On 2025-03-29 Sa 10:40 AM, David G. Johnston wrote:
=20 On Saturday, March 29, 2025, Kirill Reshke <reshkekirill@gmail.com> wrote:
On Sat, 29 Mar 2025 at 09:47, jian he <jian.universality@gmail.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 th= e
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.

=C2=A0At present copy {table} to only exists to support pg_dump.= =C2=A0 It is not marketed as a general purpose export facility.=C2=A0


*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 {subquer= y} to" is a general-purpose exporter that makes use of those additiona= l features.=C2=A0 Sure, they also work for the narrowed case of "copy = {relation/table} to" but I make my claim on the very fact that {relati= on} cannot be stuff like foreign tables or partitioned tables, which pg_dum= p has no need to target.

David J.

--000000000000c6429e06317d8763--