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

2008-06-03 Thread Tommy Gildseth
Joe Conway wrote: Tom Lane wrote: Tommy Gildseth <[EMAIL PROTECTED]> 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/f

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

2008-06-02 Thread Tommy Gildseth
Joe Conway wrote: If you really want the notational simplicity, you could use an SQL function to wrap it: CREATE OR REPLACE FUNCTION dblink_exists(text) RETURNS bool AS $$ SELECT $1 = ANY (dblink_get_connections()) $$ LANGUAGE sql; Thanks, that seems like a reasonable way to solve this.

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

2008-06-02 Thread Asko Oja
Just use plproxy and skip all the hassle of dblink :) On Mon, Jun 2, 2008 at 3:14 AM, Joe Conway <[EMAIL PROTECTED]> wrote: > Tom Lane wrote: > >> Tommy Gildseth <[EMAIL PROTECTED]> writes: >> >>> One obvious disadvantage of this approach, is that I need to connect and >>> disconnect in every fun

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

2008-06-01 Thread Joe Conway
Tom Lane wrote: Tommy Gildseth <[EMAIL PROTECTED]> 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 w

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

2008-05-28 Thread Tom Lane
Tommy Gildseth <[EMAIL PROTECTED]> 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

[HACKERS] Add dblink function to check if a named connection exists

2008-05-28 Thread Tommy Gildseth
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