Re: Incremental results from libpq
От | Tom Lane |
---|---|
Тема | Re: Incremental results from libpq |
Дата | |
Msg-id | 9994.1131642192@sss.pgh.pa.us обсуждение исходный текст |
Ответ на | Re: Incremental results from libpq (Frank van Vugt <ftm.van.vugt@foxi.nl>) |
Ответы |
Re: Incremental results from libpq
|
Список | pgsql-interfaces |
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
В списке pgsql-interfaces по дате отправления: