pg.ddx.io  pgsql-interfaces@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Tom Lane <tgl@sss.pgh.pa.us>
To: Frank van Vugt <ftm.van.vugt@foxi.nl>
Cc: pgsql-interfaces@postgresql.org
Subject: Re: Incremental results from libpq
Date: Thu, 10 Nov 2005 12:03:12 -0500
Message-ID: <9994.1131642192@sss.pgh.pa.us> (raw)
In-Reply-To: <200511101751.55377.ftm.van.vugt@foxi.nl>
References: <4D426B54-E08F-4DE9-9776-D46610CA4968@slamb.org>
	<19391.1131571328@sss.pgh.pa.us>
	<84C7635D-EAF2-40CF-A71C-976077D5465A@slamb.org>
	<200511101751.55377.ftm.van.vugt@foxi.nl>

Frank van Vugt <ftm.van.vugt@foxi.nl> writes:
> The main reason why libpq does what it does is that this way we do not
> have to expose in the API the notion of a command that fails part way
> through.  If you support partial result fetching then you'll have to
> deal with the idea that a SELECT could fail after you've already
> returned some rows to the client.

> I'm wondering, what kind of failure do you have in mind, here?

There are lots of possibilities, but one fairly obvious example is

	SELECT 1/x FROM tab;

where the 10000'th row of tab contains x = 0.  The server will detect
the zero-divide error only after it's already shipped 9999 rows to the
client.  Currently, when libpq gets the error it throws away the 9999
rows and just returns an "error" PQresult to the application.  If you
let libpq return some rows before it's got the whole result set, then
you need to decide what the API behavior ought to be for a failure after
a partial result set has been returned.  This in turn requires a little
thought about how client apps are likely to want to cope with this
scenario, so that you don't come up with a painful-to-use API.

			regards, tom lane



view thread (30+ messages)  latest in thread

Message-ID: <9994.1131642192@sss.pgh.pa.us>
Permalink:  ../9994.1131642192@sss.pgh.pa.us/
Also on:    postgresql.org/message-id/9994.1131642192@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, ftm.van.vugt@foxi.nl
  Subject: Re: Incremental results from libpq
  In-Reply-To: <9994.1131642192@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