Re: Is the PL/pgSQL refcursor useful in a modern three-tier app?

From: Bryn Llewellyn <bryn(at)yugabyte(dot)com>
To: Adrian Klaver <adrian(dot)klaver(at)aklaver(dot)com>
Cc: Laurenz Albe <laurenz(dot)albe(at)cybertec(dot)at>, pgsql-general list <pgsql-general(at)lists(dot)postgresql(dot)org>
Subject: Re: Is the PL/pgSQL refcursor useful in a modern three-tier app?
Date: 2023-03-15 22:09:34
Message-ID: 5637673F-472A-49F6-87EF-DCE57879039B@yugabyte.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

> adrian(dot)klaver(at)aklaver(dot)com wrote:
>
>> bryn(at)yugabyte(dot)com wrote:
>>
>>> laurenz(dot)albe(at)cybertec(dot)at wrote:
>>>
>>> You seem to think that a client request corresponds to a single database request
>>
>> …I can’t picture a concrete use case where, not withstanding the "where" restriction that my "select" used, I can't tell how much of the result set I'll need or where reading result #n1 informs me that I next need to scroll and read result #n2. So I was looking for a convincing example.
>
> Huh?
>
> You provided your own example earlier:
>
> "Of course, it all falls into place now. I can see how I could write a client app in, say, Python to write a humongous report to a file by fetching manageably-sized chunks, time and again until done with a function like my "g()" here, from a cursor that I'd opened using a function like my "f()"."

My “Humongous report via client-side Python” example doesn’t call for me to abandon it part way through. Nor does it call for me to leap forwards as I discover facts along the way that make me realize that I need immediately to see a far distant fact by scrolling to where it is (and especially by scrolling backwards to what I’ve already seen). It was an example of this that I was asking for. The bare ability to do controlled piecewise materialization and fetch is clear.

In response to

Responses

Browse pgsql-general by date

  From Date Subject
Next Message Martin Goodson 2023-03-15 23:47:35 Re: Help? Unexpected PostgreSQL compilation failure using generic compile script
Previous Message Adrian Klaver 2023-03-15 21:00:49 Re: Is the PL/pgSQL refcursor useful in a modern three-tier app?