Re: CREATE ROUTINE MAPPING - Mailing list pgsql-hackers

From Ashutosh Bapat
Subject Re: CREATE ROUTINE MAPPING
Date
Msg-id CAFjFpReOy2SCU=HRFs9GafP9QgMp0L=kqtYzfMwvAmCh_vJo6Q@mail.gmail.com
Whole thread Raw
In response to CREATE ROUTINE MAPPING  (Corey Huinker <corey.huinker@gmail.com>)
Responses Re: CREATE ROUTINE MAPPING
Re: CREATE ROUTINE MAPPING
List pgsql-hackers
On Fri, Jan 12, 2018 at 8:07 AM, Corey Huinker <corey.huinker@gmail.com> wrote:
> A few months ago, I was researching ways for formalizing calling functions
> on one postgres instance from another. RPC, basically. In doing so, I
> stumbled across an obscure part of the the SQL Standard called ROUTINE
> MAPPING, which is exactly what I'm looking for.
>
> The syntax specified is, roughly:
>
> CREATE ROUTINE MAPPING local_routine_name FOR remote_routine_spec
> SERVER my_server [ OPTIONS( ... ) ]
>
>
> Which isn't too different from CREATE USER MAPPING.
>
> The idea here is that if I had a local query:
>
> SELECT t.x, remote_func1(),  remote_func2(t.y)
>
> FROM remote_table t
>
> WHERE t.active = true;
>
>
> that would become this query on the remote side:
>
> SELECT t.x, local_func1(), local_func2(t.y)
>
> FROM local_table t
>
> WHERE t.active = true;
>

I think this is a desired feature. Being able to call a function on
remote server through local server is often useful.

PostgreSQL allows function overloading, which means that there can be
multiple functions with same name differing in argument types. So, the
syntax has to include the input parameters or their types at least.

-- 
Best Wishes,
Ashutosh Bapat
EnterpriseDB Corporation
The Postgres Database Company


pgsql-hackers by date:

Previous
From: Anthony Bykov
Date:
Subject: Re: Transform for pl/perl
Next
From: David Rowley
Date:
Subject: Re: [HACKERS] path toward faster partition pruning