pg.ddx.io  pgsql-interfaces@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Tom Lane <tgl@sss.pgh.pa.us>
To: Keary Suska <hierophant@pcisys.net>
Cc: Postgres-Interfaces <pgsql-interfaces@postgresql.org>
Subject: Re: Libpq and PGConn
Date: Wed, 29 Mar 2006 17:09:40 -0500
Message-ID: <1330.1143670180@sss.pgh.pa.us> (raw)
In-Reply-To: <C05047C6.27A3F%hierophant@pcisys.net>
References: <C05047C6.27A3F%hierophant@pcisys.net>

Keary Suska <hierophant@pcisys.net> 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



view thread (4+ messages)

Message-ID: <1330.1143670180@sss.pgh.pa.us>
Permalink:  ../1330.1143670180@sss.pgh.pa.us/
Also on:    postgresql.org/message-id/1330.1143670180@sss.pgh.pa.us

 · 

reply

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Reply to all the recipients using the --to and --cc options:
  reply via email

  To: pgsql-interfaces@postgresql.org
  Cc: tgl@sss.pgh.pa.us, hierophant@pcisys.net
  Subject: Re: Libpq and PGConn
  In-Reply-To: <1330.1143670180@sss.pgh.pa.us>

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox