Received: from malur.postgresql.org ([217.196.149.56]) by arkaria.postgresql.org with esmtps (TLS1.3:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1krA6v-00025w-0C for pgsql-sql@arkaria.postgresql.org; Mon, 21 Dec 2020 01:35:41 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.92) (envelope-from ) id 1krA6s-0001Ls-R9 for pgsql-sql@arkaria.postgresql.org; Mon, 21 Dec 2020 01:35:38 +0000 Received: from magus.postgresql.org ([2a02:c0:301:0:ffff::29]) by malur.postgresql.org with esmtps (TLS1.3:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1krA6s-0001Lj-Kl for pgsql-sql@lists.postgresql.org; Mon, 21 Dec 2020 01:35:38 +0000 Received: from einhorn-mail-out.in-berlin.de ([217.197.80.21]) by magus.postgresql.org with esmtps (TLS1.3:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1krA6q-0006m9-Gj for pgsql-sql@lists.postgresql.org; Mon, 21 Dec 2020 01:35:38 +0000 X-Envelope-From: ml@ft-c.de X-Envelope-To: Received: from authenticated.user (localhost [127.0.0.1]) by einhorn.in-berlin.de with ESMTPSA id 0BL1ZXRw030839 (version=TLSv1.3 cipher=TLS_AES_256_GCM_SHA384 bits=256 verify=NOT) for ; Mon, 21 Dec 2020 02:35:34 +0100 Message-ID: Subject: dblink_exists From: ml@ft-c.de Reply-To: ml@ft-c.de To: pgsql-sql@lists.postgresql.org Date: Mon, 21 Dec 2020 02:35:32 +0100 Content-Type: text/plain; charset="UTF-8" User-Agent: Evolution 3.38.0 FreeBSD GNOME Team MIME-Version: 1.0 Content-Transfer-Encoding: 7bit List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Precedence: bulk Hello, I need a function like "dblink_exists()", but there is no one. Here is my script: create function trading.stats_symbols() returns boolean as $$ declare sql text; begin sql='...'; truncate trading.stats_symbols ; perform dblink_connect('updatesymbols', 'dbname=ftc') ; perform dblink_send_query('updatesymbols', sql) ; perform dblink_disconnect('updatesymbols') ; end; $$ language plpgsql; My general problem: I need a command that send a answer immediately and not, when the query if finished. dblink_send_query connect with the own database and runs a long time. When someone start the script again (when it is running), so I need a section like: if dblink_exists(updatesymbols) -- but this function do not exists then return false -- or do nothing end if; dblink_is_busy is not usable: when the function is not running, it stops. 2. question: When dlink_send_query is running, select dblink_get_connections() send NULL as answer. Franz