pg.ddx.io pgsql-hackers@postgresql.org mailing list archive
help / color / mirror / Atom feedFrom: David Fetter <david@fetter.org>
To: Daniel Verite <daniel@manitou-mail.org>
Cc: Pavel Stehule <pavel.stehule@gmail.com>
Cc: corey.huinker <corey.huinker@gmail.com>
Cc: nasbyj@amazon.com, Surafel Temsgen <surafel3000@gmail.com>
Cc: Christoph Moench-Tegeder <cmt@burggraben.net>
Cc: PostgreSQL Hackers <pgsql-hackers@lists.postgresql.org>
Subject: Re: COPY FROM WHEN condition
Date: Fri, 2 Nov 2018 18:29:12 +0100
Message-ID: <20181102172912.GK12677@fetter.org> (raw)
In-Reply-To: <b66941d6-fb91-47a0-9e9e-a06075ffb58d@manitou-mail.org>
References: <CAFj8pRCgNX9TUBD2SeoErMHs7bxb6xmxTpTFk1L_SqbEnxfinQ@mail.gmail.com>
<b66941d6-fb91-47a0-9e9e-a06075ffb58d@manitou-mail.org>
On Fri, Nov 02, 2018 at 12:58:12PM +0100, Daniel Verite wrote:
> 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?
tl;dr: \copy support is a very large can of worms.
psql's \copy is something which should probably be handled separately
from COPY, as it's both a way to access the filesystem without
superuser permission and an interface to the COPY part of the
protocol. It seems like poor design to add grammar to support a
single client, so we'd need to think about this in terms of what we
want to support on the client side independent of specific clients. It
also seems like a violation of separation of concerns to couple FEBE
to grammar, so there'd need to be some way to do those things
separately, too.
Best,
David.
--
David Fetter <david(at)fetter(dot)org> http://fetter.org/
Phone: +1 415 235 3778
Remember to vote!
Consider donating to Postgres: http://www.postgresql.org/about/donate
view thread (90+ messages) latest in thread
Message-ID: <20181102172912.GK12677@fetter.org>
Permalink: ../20181102172912.GK12677@fetter.org/
Also on: postgresql.org/message-id/20181102172912.GK12677@fetter.org
reply
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Reply to all the recipients using the --to and --cc options:
reply via email
To: pgsql-hackers@postgresql.org
Cc: david@fetter.org, daniel@manitou-mail.org, pavel.stehule@gmail.com, corey.huinker@gmail.com, surafel3000@gmail.com, cmt@burggraben.net, pgsql-hackers@lists.postgresql.org
Subject: Re: COPY FROM WHEN condition
In-Reply-To: <20181102172912.GK12677@fetter.org>
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox