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 1tyXMr-0083e3-F0 for pgsql-hackers@arkaria.postgresql.org; Sat, 29 Mar 2025 14:41:01 +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 1tyXMp-00BpVX-Sh for pgsql-hackers@arkaria.postgresql.org; Sat, 29 Mar 2025 14:40:59 +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 1tyXMp-00BpUp-Bc for pgsql-hackers@lists.postgresql.org; Sat, 29 Mar 2025 14:40:59 +0000 Received: from mail-oa1-x2e.google.com ([2001:4860:4864:20::2e]) by makus.postgresql.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256 (Exim 4.96) (envelope-from ) id 1tyXMn-001oLv-1Y for pgsql-hackers@postgresql.org; Sat, 29 Mar 2025 14:40:58 +0000 Received: by mail-oa1-x2e.google.com with SMTP id 586e51a60fabf-2c759bf1b2eso1652029fac.1 for ; Sat, 29 Mar 2025 07:40:57 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1743259257; x=1743864057; darn=postgresql.org; h=cc:to:subject:message-id:date:from:references:in-reply-to :mime-version:from:to:cc:subject:date:message-id:reply-to; bh=Aq8gDi+eej2A0JvwBKYDdaryr2RFruHgi0gOgiwxIvI=; b=BlWix9WDBzRp6a27UPymhxc54A2jbZ2Ft3WUN2pwsYTbqrYO/E8dQZei13cYyMIPug yK7QZQE1qzK9ePX7Yoo77fWJb+1UwDgfbjg9kChyKTRUwVo2jLnDs25JFHPy2zwpmA5t p14tYGQPfILx2nPFhQtPMEmiNxrYwiWlNBL81WCQa+h01sVe6y2v7s2ywaz+aHURWUKp nAYbO98TpKP+nTY3VVu1Z7LoCvQAU/4xzpRnO7WBrDW2Xpn2c5M0qj0WwdUDXRt8/ERZ QfjHekyP+HAtzA+GmxWaEdYClf/G7J7uLYuoogiYP4Jqd3k4PC8JN30XqErOtsBOTOcv dDLg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1743259257; x=1743864057; h=cc:to:subject:message-id:date:from:references:in-reply-to :mime-version:x-gm-message-state:from:to:cc:subject:date:message-id :reply-to; bh=Aq8gDi+eej2A0JvwBKYDdaryr2RFruHgi0gOgiwxIvI=; b=w1hFYmw0/Z4bl/QLAsxUXD+lAOe5YV57QoyLWvtD+TIWu3EMq6yBuLmi59MDw8BSrv rapalcJixPFRh1EnP2sztbgc7fBHOUYJ3HNvRDzyGda7fgClzWnUCLV1aHmG4fMS+R9C e6SDwVQ5lXGPGZtKpK+57ybrFTbB4s+4PVQFcGCIamlIbS1/AP3147BosJQ0fBZOuQvm Xh604S6svmaFTN/2RxGx1UPobSKjBNgURedWtnk2gK3jkNVqK9S1Tcquzc/c0sfXPxWY Jyeh+W2d4B2xs0CfLBd7u8i8D3UGk+jLfdbxc9HgRgxfS5nJBpAHzdCMtqWTKZRhWU3z ZLvQ== X-Forwarded-Encrypted: i=1; AJvYcCVPqFB7Kb1aCecWcy6zbZAJMmqLYJwMqY1Tf94M3deWAb3R05eiaZim88oHrIDM6RJR0xlR1LJbK1NZ+k/M@postgresql.org X-Gm-Message-State: AOJu0YyauPLhfMNYWhFphuY2LHOqBVCoQbrtt0+vA2/22hV/nqfX1cTa a5+xlF7qxIb3iwc66EchDgWh0YGI11yMKoMkKczEAIWQiZDekCzuWOhQQ5zek5PvfzdUnkSumt5 KWz16UL9L0Jy6rrujPr961/DwJCI= X-Gm-Gg: ASbGncuw2JiXSVBUN6oD6JSlufJviAzlL49vIEXy5y3/KYbivwA1G+16zKOsh5GFBGZ t3q/QLA1Q3cWXeuZSLvT29+AYpC0jfY61RrRd/Amzk2BNR/bMBherEKRoJ6V3GTSa6EN7grTb/e 11gMa/L8PXkYVZlHnvULEoii8d X-Google-Smtp-Source: AGHT+IHY/nayI8d7ImeBT13po/iM2VJuEs/QoM7TBrwzvWuuTlLLjSb2HSjwR4+Ws0w1y0shid+Vr6HSWQTTBZ7x3rA= X-Received: by 2002:a05:6870:5253:b0:29e:69d9:8847 with SMTP id 586e51a60fabf-2cbcefe8cd0mr1812065fac.0.1743259256856; Sat, 29 Mar 2025 07:40:56 -0700 (PDT) MIME-Version: 1.0 Received: by 2002:ac9:53c2:0:b0:589:13f9:e937 with HTTP; Sat, 29 Mar 2025 07:40:55 -0700 (PDT) In-Reply-To: References: From: "David G. Johnston" Date: Sat, 29 Mar 2025 07:40:55 -0700 X-Gm-Features: AQ5f1Jo3fMeVlQiD3gRYTubwZgn7FIbIvIwm2OsESRKJeJDppm4NGfJh1-cafSk Message-ID: Subject: Re: in BeginCopyTo make materialized view using COPY TO instead of COPY (query). To: Kirill Reshke Cc: jian he , PostgreSQL-development , Tom Lane , Michael Paquier Content-Type: multipart/alternative; boundary="000000000000c1a81d06317c2cff" List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Archived-At: Precedence: bulk --000000000000c1a81d06317c2cff Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable 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. While copy {relation} from is a general purpose importer. Do we want to turn copy to into a general purpose exporter and start accepting patches to export foreign tables, deal with partitioned tables, views of both kinds? Given we already accept things in copy from that copy to cannot produce the symmetry argument seems flawed. I=E2=80=99m on board with making copy {relation} to a general purpose expor= t facility and allowing for incremental implementations as people wish to spend time developing them. Consistency should not prevent progress here. On the topic of copy {matview} from, why not permit it? In particular, with dump/restore we could dump the materialized view and restore it, which seems like a win in terms of time spent restoring. That wouldn=E2=80=99t b= e this patch. David J. --000000000000c1a81d06317c2cff Content-Type: text/html; charset="UTF-8" Content-Transfer-Encoding: quoted-printable 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 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.

=C2=A0At present copy {table} to only exis= ts to support pg_dump.=C2=A0 It is not marketed as a general purpose export= facility.=C2=A0 While copy {relation} from is a general purpose importer.= =C2=A0 Do we want to turn copy to into a general purpose exporter and start= accepting patches to export foreign tables, deal with partitioned tables, = views of both kinds?=C2=A0 Given we already accept things in copy from that= copy to cannot produce the symmetry argument seems flawed.

<= /div>
I=E2=80=99m on board with making copy {relation} to a general pur= pose export facility and allowing for incremental implementations as people= wish to spend time developing them.=C2=A0 Consistency should not prevent p= rogress here.

On the topic of copy {matview} from,= why not permit it?=C2=A0 In particular, with dump/restore we could dump th= e materialized view and restore it, which seems like a win in terms of time= spent restoring.=C2=A0 That wouldn=E2=80=99t be this patch.

=
David J.

--000000000000c1a81d06317c2cff--