The sandbox framework : 7. Usage

Let’s play a bit with the framework !

We are connected to the sandbox of a user.

We reset the table log :

delete from log;

We connect to the kernel :

select public.connect_kernel('','micheld', 'password')

We connect a database :

select public.connect_database('contacts','micheld', 'password')

We verify that the foreign servers are initialized :

select public.list_fdw_servers();

We must obtain something like that (mgr is the owner of the databases) :


We map the tables of the database database in the sandbox.

select public.attach_database('contacts')

and we go with pgAdmin on the tab Foreign tables to verify that everything works fine.

We disconnect now from the corporate database and all foreign tables will be removed from the sandbox :

select public.disconnect_database('contacts')

We verify in the log table that everything is OK :

select * from log order by 1 desc

That’s simple ! Those functions must be called from the front end applications with the appropriate syntax.

In fact, the function attach_database could be called directly by the function connect_database.

Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out /  Change )

Google photo

You are commenting using your Google account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s