Re: COPY FROM WHEN condition - Mailing list pgsql-hackers

From Daniel Verite
Subject Re: COPY FROM WHEN condition
Date
Msg-id b66941d6-fb91-47a0-9e9e-a06075ffb58d@manitou-mail.org
Whole thread Raw
In response to Re: COPY FROM WHEN condition  (Pavel Stehule <pavel.stehule@gmail.com>)
Responses Re: COPY FROM WHEN condition
List pgsql-hackers
    Pavel Stehule wrote:

> > SELECT x.a, sum(x.b)
> > FROM ( COPY INLINE '/path/to/foo.txt' FORMAT CSV ) as x( a integer, b
> > numeric, c text, d date, e json) )
> > WHERE x.d >= '2018-11-01'
> >
> >
> Without some special feature this example is not extra useful. It is based
> on copy on server that can use only super user with full rights.

And if superuser, one might use the file data wrapper [1]  to get
the same results without the need for the explicit COPY in the query.

BTW, this brings into question whether the [WHEN condition] clause
should be included in the options of file_fdw, as it supports pretty
much all COPY options.

Also, psql's \copy should gain the option too?


[1] https://www.postgresql.org/docs/current/static/file-fdw.html


Best regards,
--
Daniel Vérité
PostgreSQL-powered mailer: http://www.manitou-mail.org
Twitter: @DanielVerite


pgsql-hackers by date:

Previous
From: Surafel Temesgen
Date:
Subject: Re: COPY FROM WHEN condition
Next
From: "Daniel Verite"
Date:
Subject: Re: csv format for psql