Re: Add dblink function to check if a named connection exists

From: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
To: Tommy Gildseth <tommy(dot)gildseth(at)usit(dot)uio(dot)no>
Cc: pgsql-hackers(at)postgresql(dot)org, mail(at)joeconway(dot)com
Subject: Re: Add dblink function to check if a named connection exists
Date: 2008-05-28 15:17:06
Message-ID: 28839.1211987826@sss.pgh.pa.us
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

Tommy Gildseth <tommy(dot)gildseth(at)usit(dot)uio(dot)no> writes:
> 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.

Can't you do this already?

SELECT 'myconn' = ANY (dblink_get_connections());

A dedicated function might be a tad faster, but it probably isn't going
to matter compared to the overhead of sending a remote query.

regards, tom lane

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Tom Lane 2008-05-28 15:20:04 Re: Remove redundant extra_desc info for enum GUC variables?
Previous Message Andrew Dunstan 2008-05-28 14:37:08 Re: pg_regress: dbname in PostgreSQL test suite