Re: [PATCH 4/4] Add tests to dblink covering use of COPY TO FUNCTION
От | Pavel Stehule |
---|---|
Тема | Re: [PATCH 4/4] Add tests to dblink covering use of COPY TO FUNCTION |
Дата | |
Msg-id | 162867790911240652j71c9e9f5j9c63ace7e430699@mail.gmail.com обсуждение исходный текст |
Ответ на | Re: [PATCH 4/4] Add tests to dblink covering use of COPY TO FUNCTION (Hannu Krosing <hannu@2ndQuadrant.com>) |
Список | pgsql-hackers |
2009/11/24 Hannu Krosing <hannu@2ndquadrant.com>: > On Tue, 2009-11-24 at 05:00 -0800, Daniel Farina wrote: >> On Tue, Nov 24, 2009 at 4:37 AM, Pavel Stehule <pavel.stehule@gmail.com> wrote: > >> > then syntax should be: >> > >> > COPY table TO streamname(parameters) >> > >> > COPY table TO filestream('/tmp/foo.dta') ... >> > COPY table TO dblinkstream(connectionstring) ... > > You probably meant > > COPY table TO dblinkstream(connectionstring, table) > > ? > >> I like this one quite a bit...it's a bit like an aggregate, except the >> initial condition can be set in a rather function-callish way. >> >> But that does seem to require making a DDL command, which leaves a >> nice green field. > > not necessarily DDL, maybe just a "copystream" type and a set of > functions creating objects of that type. > > if you make it a proper type with input and output function, then you > can probably use it in statements like this > > COPY table TO (select stream::copystream from streams where id = 7); > > COPY table TO 'file:/tmp/outfile':: copystream; > > COPY table TO 'dblink::<connectstring>':: copystream; it interesting - but still you have to have DDL for declaring stream. It is analogous to function: CREATE FUNCTION .... SELECT 'foo'::regprocedure but syntax COPY table TO copystream is good idea. I like it. > >> In particular, we could then make as many hooks, >> flags, and options as we wanted, but sometimes there is a paradox of >> choice...I just did not want to anticipate on Postgres being friendly >> to a new DDL command when writing this the first time. > > fulltext lived for quite some time as set of types and functions before > it was glorified with its own DDL syntax. What is DDL? Wrapper for insert to system catalog. so we can have table pg_catalog.copystream and for first testing CREATE OR REPLACE FUNCTION register_copystream(regproc, regproc, regproc ...) if we will happy - than it is one day work for support statement CREATE COPYSTREAM ( ... Regards Pavel Stehule > > It may be good to have the same approach here - do it as a set of types > and functions first, think about adding DDL once it has stabilised > enough > > > -- > Hannu Krosing http://www.2ndQuadrant.com > PostgreSQL Scalability and Availability > Services, Consulting and Training > > >
В списке pgsql-hackers по дате отправления: