pl/proxy and sequence generation

Поиск
Список
Период
Сортировка
От Igor Katson
Тема pl/proxy and sequence generation
Дата
Msg-id 495252B6.5090702@gmail.com
обсуждение исходный текст
Ответы Re: pl/proxy and sequence generation
Список pgsql-general
Hello!

The problem, i'm going to describe is about pl/proxy usage. I'll call
the bases, which are proxied to, the node-based and the base, which
contains pl/proxy the proxy-base.

The task, I need to accomplish, is to make an insert into node-bases,
using the sequence, generated inside the proxy-base, as the primary key.

As far as I understand, this is not a good idea to generate the keys
inside the node-bases, simply because the values will not be unique,
cause they will have different sequence generators. So I decided to make
a sequence in the proxy-base. And the sequence number should be passed
to the node-bases as a fucntion argument. As far as I know, you should
have the same number and types of arguments for this function both in
the node-bases and the proxy-base. So I should have a sequence number as
an argument in the proxy-base too.

Usually, the application calls the function in the proxy-base, and this
function calls the same ones in the node-bases. But the application
should not generate the sequence, and it should not pass it as an
argument to the function.

So, should I make a wrapper in e.g. PL/pgsql for every insert function
writen in PL/Proxy to remove the sequence from the argument list and to
call the sequence generator?
Is there a better way to do that?

Thanks in advance,
Igor Katson.

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

Предыдущее
От: "Roderick A. Anderson"
Дата:
Сообщение: Multi-tenant cluster
Следующее
От: "Jonah H. Harris"
Дата:
Сообщение: Re: pl/proxy and sequence generation