Add dblink function to check if a named connection exists

From: Tommy Gildseth <tommy(dot)gildseth(at)usit(dot)uio(dot)no>
To: pgsql-hackers(at)postgresql(dot)org
Cc: mail(at)joeconway(dot)com
Subject: Add dblink function to check if a named connection exists
Date: 2008-05-28 08:23:10
Message-ID: 483D166E.5030507@usit.uio.no
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

I have locked down access to all dblink_* functions, so that only
certain privileged users have access to them, and instead provide a set
of SRF functions defined as security definer functions, where I connect
to the remote server, fetch some data, disconnect from remote server,
and return the data.
One obvious disadvantage of this approach, is that I need to connect and
disconnect in every function. A possible solution to this, would be
having a function f.ex dblink_exists('connection_name') that returns
true/false depending on whether the connection already exists. This
way, I could just check if a named connection exists, and establish a
connection if not, and wait until the end of the session to disconnect
all established connections.

I've attached a patch with a suggested implementation of such a function.

--
Tommy Gildseth

Attachment Content-Type Size
dblink.patch text/x-diff 4.3 KB

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Simon Riggs 2008-05-28 08:25:54 Re: Hint Bits and Write I/O
Previous Message Radek Strnad 2008-05-28 00:22:39 Proposal - Collation at database level