Received: from maia.hub.org (maia-5.hub.org [200.46.204.29]) by mail.postgresql.org (Postfix) with ESMTP id A3913B5DBC6 for ; Wed, 3 Aug 2011 04:02:44 -0300 (ADT) Received: from mail.postgresql.org ([200.46.204.86]) by maia.hub.org (mx1.hub.org [200.46.204.29]) (amavisd-maia, port 10024) with ESMTP id 53971-05 for ; Wed, 3 Aug 2011 07:02:37 +0000 (UTC) X-Greylist: domain auto-whitelisted by SQLgrey-1.7.6 Received: from outrelay03.libero.it (outrelay03.libero.it [212.52.84.103]) by mail.postgresql.org (Postfix) with ESMTP id 41A5BB5D80A for ; Wed, 3 Aug 2011 04:02:37 -0300 (ADT) X-CTCH-Spam: Unknown X-CTCH-RefID: str=0001.0A0B0205.4E38F288.015D,ss=1,re=0.000,fgs=0 X-libjamoibt: 1821 Received: from wmail48 (172.31.0.238) by outrelay03.libero.it (8.5.133) (authenticated as francescoboccacci@libero.it) id 4DE4FF1D04D88D26; Wed, 3 Aug 2011 09:02:32 +0200 Message-ID: <30237998.4729401312354952745.JavaMail.defaultUser@defaultHost> Date: Wed, 3 Aug 2011 09:02:32 +0200 (CEST) From: "francescoboccacci@libero.it" Reply-To: "francescoboccacci@libero.it" To: Subject: R: Re: dblink question about duplicate connection Cc: MIME-Version: 1.0 Content-Type: text/plain;charset="UTF-8" Content-Transfer-Encoding: 7bit X-SenderIP: 213.182.95.210 X-Virus-Scanned: Maia Mailguard 1.0.1 X-Spam-Status: No, hits=-2.7 tagged_above=-10 required=5 tests=BAYES_00=-1.9, FREEMAIL_FROM=0.001, RCVD_IN_DNSWL_NONE=-0.0001, RP_MATCHES_RCVD=-0.801 X-Spam-Level: X-Archive-Number: 201108/14 X-Sequence-Number: 38001 Thanks, I solved it with your help. Francesco Boccacci >----Messaggio originale---- >Da: mail@joeconway.com >Data: 02/08/2011 22.46 >A: "francescoboccacci@libero.it" >Cc: >Ogg: Re: [ADMIN] dblink question about duplicate connection > >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 > >-- >Sent via pgsql-admin mailing list (pgsql-admin@postgresql.org) >To make changes to your subscription: >http://www.postgresql.org/mailpref/pgsql-admin >