pg.ddx.io  pgsql-admin@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Joe Conway <mail@joeconway.com>
To: francescoboccacci@libero.it <francescoboccacci@libero.it>
Cc: pgsql-admin@postgresql.org
Subject: Re: dblink question about duplicate connection
Date: Tue, 02 Aug 2011 13:46:20 -0700
Message-ID: <4E38621C.1040206@joeconway.com> (raw)
In-Reply-To: <13669451.4531041312288568915.JavaMail.defaultUser@defaultHost>
References: <13669451.4531041312288568915.JavaMail.defaultUser@defaultHost>

On 08/02/2011 05:36 AM, francescoboccacci@libero.it wrote:
> Somentimes happend that an error accours in insert data and when i try to run 
> new insert posgresql return and error like duplicate connection.
> I would like to change my functions in this way:

>      If 'conn_test' exist  PERFORM dblink_disconnect('conn_test');
>      else
> 
>      PERFORM dblink_connect('conn_test', 'dbname=database_test');

> How can write my new function?

See dblink_get_connections():
http://www.postgresql.org/docs/9.0/interactive/contrib-dblink-get-connections.html

HTH,

Joe

-- 
Joe Conway
credativ LLC: http://www.credativ.us
Linux, PostgreSQL, and general Open Source
Training, Service, Consulting, & 24x7 Support



view thread (2+ messages)

Message-ID: <4E38621C.1040206@joeconway.com>
Permalink:  ../4E38621C.1040206@joeconway.com/
Also on:    postgresql.org/message-id/4E38621C.1040206@joeconway.com

 · 

reply

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Reply to all the recipients using the --to and --cc options:
  reply via email

  To: pgsql-admin@postgresql.org
  Cc: mail@joeconway.com, francescoboccacci@libero.it
  Subject: Re: dblink question about duplicate connection
  In-Reply-To: <4E38621C.1040206@joeconway.com>

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox