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 1tybLp-008oTI-E7 for pgsql-hackers@arkaria.postgresql.org; Sat, 29 Mar 2025 18:56:13 +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 1tybLn-00FGN4-BD for pgsql-hackers@arkaria.postgresql.org; Sat, 29 Mar 2025 18:56:11 +0000 Received: from magus.postgresql.org ([2a02:c0:301:0:ffff::29]) by malur.postgresql.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.94.2) (envelope-from ) id 1tybLm-00FGMw-W5 for pgsql-hackers@lists.postgresql.org; Sat, 29 Mar 2025 18:56:11 +0000 Received: from mail-qv1-xf2c.google.com ([2607:f8b0:4864:20::f2c]) by magus.postgresql.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256 (Exim 4.96) (envelope-from ) id 1tybLk-001wDT-0k for pgsql-hackers@postgresql.org; Sat, 29 Mar 2025 18:56:10 +0000 Received: by mail-qv1-xf2c.google.com with SMTP id 6a1803df08f44-6e904f53151so28958006d6.3 for ; Sat, 29 Mar 2025 11:56:07 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=dunslane-net.20230601.gappssmtp.com; s=20230601; t=1743274566; x=1743879366; darn=postgresql.org; h=in-reply-to:autocrypt:content-language:from:references:cc:to :subject:user-agent:mime-version:date:message-id:from:to:cc:subject :date:message-id:reply-to; bh=XDb3CCd2Mp5tR1Xc0ReyiAk1UvybDCgvsIQJdyQtdCA=; b=Q9/CWu4h/2l/l+/Yu362lNIXCz1yHug2UEHwb62At5TUqPPm+n1bdJiZd1oeFnG118 SALxkjkQmKEqnuO6OOEge/ClFZO8BMoxfi83FxfD46Lx03PiPRicRBfaFqTGqzKJ9M6i BNaJTlQIin2lvpXCzS+aaBX0VjecDIeXvwhGWOpHbEj7DSXRZP2GU90MWGGBT6HbsAyB FEOLN7BlrBibOZssK6x2u8o5++onulcNpH9bzFYJBT+HWKQ7ky9dXe0Hmtv3yV15elbO lpu5ZLKWN2YO432WC3L8YWWScZD2NTfHXh5tc3zCACkoE2/UcvarZmD4fkle3xIW+jZN XlJQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1743274566; x=1743879366; h=in-reply-to:autocrypt:content-language:from:references:cc:to :subject:user-agent:mime-version:date:message-id:x-gm-message-state :from:to:cc:subject:date:message-id:reply-to; bh=XDb3CCd2Mp5tR1Xc0ReyiAk1UvybDCgvsIQJdyQtdCA=; b=qY8KNoLY/ZR51xU0HH4qWHq7qnE3GWStwguyLGWnNQW5TRoR5r7ErLL5tWirbtnFHH Ed8MXXd2WVI4w7HEWifAR1T7d4ECCp0+6EM8RTl22iuLttjIcAlpBiP3iRvZ3IotoBu+ hPALHnggMy8YuTOG0iU2E2yY1tAXHIOM1pVp70npeth3fcQF8UOQEAWOwjALlYNvueV/ 5YjLSXsGJaA0Ui/JP5hvpslKkLmIlBBSLCVq6NGfDx5RzvWCq4MsDmcT1QK0fJABI0ws l/ZdTNoeySCRTKagmdFkouuomcRb264gS94xcMJGRfZx4xo9LNelBtGQfT2avI+wRVh1 4q9Q== X-Forwarded-Encrypted: i=1; AJvYcCVcgeVwODGwbY2QC6zJ22G9C8FZopF5GOFDKnUWwLBRmnl2tz4PWTy8mWBShcMXPzX2IwP8pbB2JO+0AlBB@postgresql.org X-Gm-Message-State: AOJu0YyE/HswopZVlo6/Oa7YArHHbNlU5RKY/qbQbStmbGMsq9j9pzqq 13kR7o82DR6R+AQLlfSv6OpP7temdOaGdmYWN/LIIUfu3yGdtpMqy+0i4r+qGSQ= X-Gm-Gg: ASbGncv8lnITKZ0+rN2Bz8U5Z2asnVZVaFzMJvGHOwYykCOYVgflA7M/GHSzH+UDqtO RjvKBsb7tUzSVN2esOjT+DZ2M7a2yIz5EWCtwZTwxULz5Sh7A4Z8rLoLrrzAegjj/rsRVbQwpa1 vEXFnfvoiklG3HaO79q1PeL9zEEKqugsOjCx+COYZoXQtLL2Ag/Awk8Advv8YjaGOOF13eKfbaz U7QWg+nVsrTk7E22Bhbp5PSEPYIB6EbNs+/eE4koial8+U+unVvzvHDvWhG+qVvrwhK20456/v4 5t+CX50wfpwwEO8ETD0bjVxmrSs6zyvrhbRaJ42VrksfDAqHSnNaSPY= X-Google-Smtp-Source: AGHT+IEFgUqUQwjHgSm3bPlccHSVNaIASXOETf1pvxYTarNFWm87oAgzCRsyZPfrjYnqdocaLvZgwA== X-Received: by 2002:a05:6214:224c:b0:6eb:2e88:d47b with SMTP id 6a1803df08f44-6eed5fe38d1mr44882466d6.17.1743274566430; Sat, 29 Mar 2025 11:56:06 -0700 (PDT) Received: from ?IPV6:2605:a601:a681:6b00::1cb? ([2605:a601:a681:6b00::1cb]) by smtp.googlemail.com with ESMTPSA id 6a1803df08f44-6eec977193csm25504276d6.77.2025.03.29.11.56.04 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Sat, 29 Mar 2025 11:56:05 -0700 (PDT) Content-Type: multipart/alternative; boundary="------------0ijNBDOjUu0VSys7M6X0dvw3" Message-ID: <442e62f7-ef64-4df1-8453-d682fe9bdaa3@dunslane.net> Date: Sat, 29 Mar 2025 14:56:03 -0400 MIME-Version: 1.0 User-Agent: Mozilla Thunderbird Subject: Re: in BeginCopyTo make materialized view using COPY TO instead of COPY (query). To: "David G. Johnston" Cc: Kirill Reshke , jian he , PostgreSQL-development , Tom Lane , Michael Paquier References: From: Andrew Dunstan Content-Language: en-US Autocrypt: addr=andrew@dunslane.net; keydata= xsBNBE7KWFkBCAClridxur2AIc7eW2AR7izbfp3EnNefie2HbLF0izW5Ik5UjX2HBXBx4syI gY6b0ugohXrr274+baoAlvSbq6cAo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4lHMOR/Oc3/8mScEF84rF2jXbsFgelWnbPWAvXY+pD0dXOFRkagGmC/viwBDqq5b 5tk76kKmUbZxABEBAAHCwHwEGAEIACYCGwwWIQTkPlhGHfx8v0RpFaWZ+n/LWfw7gQUCZFlx 5wUJGVGAjgAKCRCZ+n/LWfw7gf+iB/4g8CPY5jihf5r/8EsoIGe2H+dpVmpPF8YGBzTIvCz/ fQoOq8AX/pE76QEuFnFZWfjw+wgBXgCVmkox2Eflkk6z4ND3pcwGZ6CfCxTQCDk/dij+2DQ4 6bmDCy/sBgcbz9mTpoLC11HLoPae6YN9nBNQRZDcEFEu54OaVOqlIdbA6m+POIBCXZdHOFc0 WoDTgxHRzC1jgQNidyd6tKqcsVJs0dzF0oKTmFFmUAqTdJO12LBuNA1rlqrR3EtpYk8B/wtS 5dIMD7Q8hwQpL+4C6GNpb6ZKnPkLi47pDOLhz2qBrqN+rqUEsT3YnExYpzj5yOBi+FlmV1Hw 49QYe1sn2ZPs In-Reply-To: List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Archived-At: Precedence: bulk This is a multi-part message in MIME format. --------------0ijNBDOjUu0VSys7M6X0dvw3 Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 8bit On 2025-03-29 Sa 12:17 PM, David G. Johnston wrote: > On Sat, Mar 29, 2025 at 9:06 AM 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 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 --------------0ijNBDOjUu0VSys7M6X0dvw3 Content-Type: text/html; charset=UTF-8 Content-Transfer-Encoding: 8bit


On 2025-03-29 Sa 12:17 PM, David G. Johnston wrote:
On Sat, Mar 29, 2025 at 9:06 AM Andrew Dunstan <andrew@dunslane.net> wrote:


On 2025-03-29 Sa 10:40 AM, David G. Johnston wrote:
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.

 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
--------------0ijNBDOjUu0VSys7M6X0dvw3--