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 5AEBA11F66E9 for ; Wed, 29 Mar 2006 18:10:14 -0400 (AST) Received: from postgresql.org ([200.46.204.71]) by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) with ESMTP id 42144-06 for ; Wed, 29 Mar 2006 18:10:13 -0400 (AST) X-Greylist: from auto-whitelisted by SQLgrey- Received: from sss.pgh.pa.us (sss.pgh.pa.us [66.207.139.130]) by postgresql.org (Postfix) with ESMTP id A090E11F6657 for ; Wed, 29 Mar 2006 18:10:11 -0400 (AST) Received: from sss2.sss.pgh.pa.us (tgl@localhost [127.0.0.1]) by sss.pgh.pa.us (8.13.6/8.13.6) with ESMTP id k2TM9esc001331; Wed, 29 Mar 2006 17:09:40 -0500 (EST) To: Keary Suska cc: Postgres-Interfaces Subject: Re: Libpq and PGConn In-reply-to: References: Comments: In-reply-to Keary Suska message dated "Wed, 29 Mar 2006 14:18:46 -0700" Date: Wed, 29 Mar 2006 17:09:40 -0500 Message-ID: <1330.1143670180@sss.pgh.pa.us> From: Tom Lane X-Virus-Scanned: by amavisd-new at hub.org X-Spam-Status: No, score=0.114 required=5 tests=[AWL=0.114] X-Spam-Score: 0.114 X-Spam-Level: X-Archive-Number: 200603/30 X-Sequence-Number: 6086 Keary Suska writes: > Is it safe to assume that in these cases--where a PGconn or Pgresult has not > been initialized, but has not been finished() either--that all functions > won't (or shouldn't) choke, will set an error message, and return a defined > value? Well, there isn't any place to "set an error message" if you don't have a PGconn. I think it's reasonable to expect libpq functions not to crash on NULL pointer inputs, but there's a limit to what we can do beyond not crashing. Also, if you pass pointers to garbage memory (rather than NULL pointers) all bets are off; which limits the value of worrying about the NULL case anyway. Ultimately, if the calling app is broken enough to pass bad pointers there isn't a lot that a library can do to defend itself. regards, tom lane