pl/proxy and sequence generation - Mailing list pgsql-general

From Igor Katson
Subject pl/proxy and sequence generation
Date
Msg-id 495252B6.5090702@gmail.com
Whole thread Raw
Responses Re: pl/proxy and sequence generation  ("Jonah H. Harris" <jonah.harris@gmail.com>)
List 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 by date:

Previous
From: "Roderick A. Anderson"
Date:
Subject: Multi-tenant cluster
Next
From: "Jonah H. Harris"
Date:
Subject: Re: pl/proxy and sequence generation