X-Original-To: pgsql-sql@postgresql.org Received: from localhost (postgresql.org [64.49.215.8]) by postgresql.org (Postfix) with ESMTP id 18CF3475DC8 for ; Sat, 8 Feb 2003 01:07:15 -0500 (EST) Received: from joeconway.com (unknown [63.210.180.150]) by postgresql.org (Postfix) with ESMTP id 94FBC476052 for ; Sat, 8 Feb 2003 01:05:16 -0500 (EST) Received: from [192.168.5.3] (account jconway HELO joeconway.com) by joeconway.com (CommuniGate Pro SMTP 4.0.4) with ESMTP-TLS id 1587616; Fri, 07 Feb 2003 22:40:00 -0800 Message-ID: <3E449DAB.9050106@joeconway.com> Date: Fri, 07 Feb 2003 22:03:23 -0800 From: Joe Conway User-Agent: Mozilla/5.0 (Windows; U; Windows NT 5.0; en-US; rv:1.2.1) Gecko/20021130 X-Accept-Language: en-us, en MIME-Version: 1.0 To: Frankie Cc: pgsql-sql@postgresql.org Subject: Re: plpgsql + dblink() question References: In-Reply-To: Content-Type: text/plain; charset=us-ascii; format=flowed Content-Transfer-Encoding: 7bit X-Virus-Scanned: by AMaViS new-20020517 X-Archive-Number: 200302/167 X-Sequence-Number: 11565 Frankie wrote: > The case is when I call a function (from Server 1 at psql prompt) that will > call dblink to do some operation > on another server(it will take certain time), i.e. Server 2, and meanwhile I > just unplug the network cable to Server 2. > The consequence is that the function will never return except I plug the > cable into it again, moreover I cannot even cancel > the query and stop the postgresql server (have to 'kill -9'.) dblink just uses libpq to handle the communication, so you can use the connect_timeout connection parameter. It defaults to infinite if not explicitly set. Something like this should set a 5 second timeout: select * into tmp from dblink(''host=linux dbname=twins connect_timeout=5'', ''select mysleep();'') as (retval text); See: http://www.us.postgresql.org/users-lounge/docs/7.3/postgres/libpq-connect.html HTH, Joe