X-Original-To: pgsql-interfaces-postgresql.org@localhost.postgresql.org Received: from localhost (av.hub.org [200.46.204.144]) by postgresql.org (Postfix) with ESMTP id C51D511F61C7 for ; Tue, 4 Apr 2006 16:41:19 -0300 (ADT) Received: from postgresql.org ([200.46.204.71]) by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) with ESMTP id 95021-06 for ; Tue, 4 Apr 2006 16:41:18 -0300 (ADT) X-Greylist: from auto-whitelisted by SQLgrey- Received: from krusty.pcisys.net (krusty.pcisys.net [216.229.32.178]) by postgresql.org (Postfix) with ESMTP id EE7F211F61C8 for ; Tue, 4 Apr 2006 16:41:16 -0300 (ADT) Received: from [192.168.0.101] (dsl-206-53-31-65.cos.pcisys.net [206.53.31.65]) by krusty.pcisys.net (8.13.3/8.13.3) with ESMTP id k34JfFDa009859 for ; Tue, 4 Apr 2006 13:41:16 -0600 (MDT) User-Agent: Microsoft-Entourage/10.1.4.030702.0 Date: Tue, 04 Apr 2006 13:41:20 -0700 Subject: Re: PQconnectdb et.all. From: Keary Suska To: Postgres-Interfaces Message-ID: In-Reply-To: Mime-version: 1.0 Content-type: text/plain; charset="US-ASCII" Content-transfer-encoding: 7bit X-Virus-Scanned: by amavisd-new at hub.org X-Spam-Status: No, score=0.111 required=5 tests=[AWL=0.111] X-Spam-Score: 0.111 X-Spam-Level: X-Archive-Number: 200604/5 X-Sequence-Number: 6096 on 4/4/06 8:09 AM, danny@cs.huji.ac.il purportedly said: > How can I programatically figure out why PQconnectdb failed? > The reason for this is that my daemon needs to know: > 1- if to try and reconnect (for example, if it's timing out) > 2- abandom, if for example it has not permition. If your question is whether you can reliably parse the result of PQerrorMessage and determine a course of action, I think the answer is "kind of." My understanding is that these error messages are just a human-friendly indicator and are subject to change. You might be able to check "errno", but I can't say whether that will be informative (depends on what libpq does in its depths, scoping issues, among other things). That being said, you could try to catalog the common messages and behave accordingly, but with the caveat that future versions may change the messages. Hope this helps, Keary Suska Esoteritech, Inc. "Demystifying technology for your home or business"