Re: [rfc,patch] PL/Proxy in core

Поиск
Список
Период
Сортировка
От Hannu Krosing
Тема Re: [rfc,patch] PL/Proxy in core
Дата
Msg-id 1211283047.8174.45.camel@huvostro
обсуждение исходный текст
Ответ на [rfc,patch] PL/Proxy in core  ("Marko Kreen" <markokr@gmail.com>)
Список pgsql-hackers
On Wed, 2008-05-14 at 23:29 +0300, Marko Kreen wrote:

> There are few code beautification ideas on which I'd like to
> get feedback from wider audience:
> 
> - Drop CONNECT statement.  This was added to make creating
>   simple dblink style calls easier, but actually its not
>   maintainable compared to CLUSTER, it can be used only
>   for occasional hacks.  OTOH, if we want to deprecate
>   dblink and replace it with PL/Proxy, it should probably stay.
> 
> - Drop SELECT statement.  This was added as it was simple to do
>   and also to be straightforward replacement for dblink.  But
>   it's conceptually ugly.  Also it gives impression that there
>   will be UPDATE, DELETE and IF... which will not happen.

I'd also suggest one feature request

- Add COPY FROM/TO support 

The way It could be done is similar to (now deprecated) SELECT

CREATE FUNCTION copy_users_to_partitions()
RETURNS VOID AS $$   CLUSTER 'userdb';   RUN ON hashtext(text::$1);   COPY users FROM stdin;
$$ LANGUAGE plproxy;

and it should be used like COPY is currently

proxydb# SELECT copy_users_to_partitions();
bob    bobspwd    bob@email.com
ben    benspwd    ben@email.com
...
amy    amyspwd    amy@email.com
.copy_users_to_partitions 
--------------------------
(1 row)

I am not sure how easy it is to get access to "stdin" from inside a function, 
but the version of COPY which copies from filesystem can surely be done.

On slaves it will always be plain COPY with STDIN/STDOUT.

As this reintroduces "direct access to partition tables" feature removed with 
SELECT, it should be a feature that can be used by superusers only. 

Notice that field type should be given, as it can't be deduced from arguments.

COPY .. TO would usually (but not neccessarily) be RUN ON ALL

--------------------
Hannu





В списке pgsql-hackers по дате отправления:

Предыдущее
От: Hannu Krosing
Дата:
Сообщение: Re: triggers on prepare, commit, rollback... ?
Следующее
От: Fabien COELHO
Дата:
Сообщение: Re: triggers on prepare, commit, rollback... ?