Skip site navigation (1) Skip section navigation (2)

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: (view raw, whole thread or download thread mbox)
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: dblink.patch
Description: text/x-diff (4.3 KB)


pgsql-hackers by date

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

Privacy Policy | About PostgreSQL
Copyright © 1996-2017 The PostgreSQL Global Development Group