| From: | jian he <jian(dot)universality(at)gmail(dot)com> |
|---|---|
| To: | Kirill Reshke <reshkekirill(at)gmail(dot)com> |
| Cc: | 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 06:46:37 |
| Message-ID: | CACJufxE35HxSMqG6su0txZwOLpbnBsDBav5eigxt6L8Nk8bJwQ@mail.gmail.com |
| Views: | Whole Thread | Raw Message | Download mbox | Resend email |
| Thread: | |
| Lists: | pgsql-hackers |
On Thu, Mar 27, 2025 at 3:04 AM Kirill Reshke <reshkekirill(at)gmail(dot)com> wrote:
> >
> > hi.
> > patch attached.
> > also cc to Tom,
> > since at that time, you are against the idea of ``COPY matview TO``.
>
> Hi! With this patch it is possible to COPY matview TO, but not regular
> view, which is surprising. Let's fix that?
create view v1 as select 1;
copy v1 to stdout;
if you specifying table name, not query, then
{
cstate = BeginCopyTo(pstate, rel, query, relid,
stmt->filename, stmt->is_program,
NULL, stmt->attlist, stmt->options);
*processed = DoCopyTo(cstate); /* copy from database to file *
}
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.
| From | Date | Subject | |
|---|---|---|---|
| Next Message | Alexander Pyhalov | 2025-03-29 07:24:41 | Re: SQLFunctionCache and generic plans |
| Previous Message | jian he | 2025-03-29 06:37:48 | Re: speedup COPY TO for partitioned table. |