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

2023-03-26 Thread Bryn Llewellyn
> adrian.kla...@aklaver.com wrote: > >> b...@yugabyte.com replied to laurenz.a...@cybertec.at: >> >> Thanks for the link to your SQL file at the line where you get the row count >> in the way that you describe... I noted that neither of these functions has >> a refcursor formal argument and

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

2023-03-23 Thread Bryn Llewellyn
> laurenz.a...@cybertec.at wrote: > >> b...@yugabyte.com wrote: >> >>> laurenz.a...@cybertec.at wrote: >>> >>> I recently used cursor scrollability, so I can show you a use case: >>> >>> github.com/cybertec-postgresql/db_migrator/blob/master/db_migrator--1.0.0.sql#L49 >> >> However, source

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

2023-03-22 Thread Adrian Klaver
On 3/22/23 12:09, Bryn Llewellyn wrote: laurenz.a...@cybertec.at wrote: ...I understand that you ask questions to gain deeper understanding. b...@yugabyte.com wrote: ...I had never come across use cases where [scrollability] was

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

2023-03-22 Thread Laurenz Albe
On Wed, 2023-03-22 at 12:09 -0700, Bryn Llewellyn wrote: > > laurenz.a...@cybertec.at wrote: > > I recently used cursor scrollability, so I can show you a use case: > > > > github.com/cybertec-postgresql/db_migrator/blob/master/db_migrator--1.0.0.sql#L49 > > However, source code famously reveals

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

2023-03-22 Thread Bryn Llewellyn
> laurenz.a...@cybertec.at wrote: > > ...I understand that you ask questions to gain deeper understanding. > >> b...@yugabyte.com wrote: >> >> ...I had never come across use cases where [scrollability] was beneficial. I >> wanted, therefore, to hear about some. I thought that insights here

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

2023-03-21 Thread Laurenz Albe
I may have been one of the respondents who showed some annoyance, and I am sorry for that. I understand that you ask questions to gain deeper understanding. On Mon, 2023-03-20 at 13:46 -0700, Bryn Llewellyn wrote: > Oracle Database doesn't expose scrollability for PL/SQL's equivalent of >

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

2023-03-20 Thread Adrian Klaver
On 3/20/23 1:46 PM, Bryn Llewellyn wrote: adrian.kla...@aklaver.com wrote: b...@yugabyte.com wrote: adrian.kla...@aklaver.com wrote: I have a hard time fathoming why someone who writes documentation does not actually read documentation. Ouch. In fact, I had read the whole of the "43.7.

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

2023-03-20 Thread Bryn Llewellyn
> adrian.kla...@aklaver.com wrote: > >> b...@yugabyte.com wrote: >> >>> adrian.kla...@aklaver.com wrote: >>> >>> I have a hard time fathoming why someone who writes documentation does not >>> actually read documentation. >> >> >> Ouch. In fact, I had read the whole of the "43.7. Cursors"

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

2023-03-17 Thread Peter J. Holzer
On 2023-03-16 11:52:47 +0100, Dominique Devienne wrote: > On Thu, Mar 16, 2023 at 11:15 AM Pavel Stehule > wrote: > čt 16. 3. 2023 v 9:55 odesílatel Dominique Devienne > napsal: > That's a nice way to put it Pavel. > And to have it both ways, use COPY in binary protocol?

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

2023-03-16 Thread Adrian Klaver
On 3/15/23 18:41, Bryn Llewellyn wrote: adrian.kla...@aklaver.com wrote: I have a hard time fathoming why someone who writes documentation does not actually read documentation. Ouch. In fact, I had read the whole of the "43.7. Cursors" section in the

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

2023-03-16 Thread Pavel Stehule
čt 16. 3. 2023 v 11:52 odesílatel Dominique Devienne napsal: > On Thu, Mar 16, 2023 at 11:15 AM Pavel Stehule > wrote: > >> čt 16. 3. 2023 v 9:55 odesílatel Dominique Devienne >> napsal: >> >>> On Thu, Mar 16, 2023 at 9:23 AM Pavel Stehule >>> wrote: >>> čt 16. 3. 2023 v 9:18 odesílatel

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

2023-03-16 Thread Dominique Devienne
On Thu, Mar 16, 2023 at 11:15 AM Pavel Stehule wrote: > čt 16. 3. 2023 v 9:55 odesílatel Dominique Devienne > napsal: > >> On Thu, Mar 16, 2023 at 9:23 AM Pavel Stehule >> wrote: >> >>> čt 16. 3. 2023 v 9:18 odesílatel Dominique Devienne >>> napsal: >>> [...] depends on what you value in

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

2023-03-16 Thread Pavel Stehule
čt 16. 3. 2023 v 9:55 odesílatel Dominique Devienne napsal: > On Thu, Mar 16, 2023 at 9:23 AM Pavel Stehule > wrote: > >> čt 16. 3. 2023 v 9:18 odesílatel Dominique Devienne >> napsal: >> >>> [...] depends on what you value in a particular situation, latency or >>> throughput. --DD >>> >> >>

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

2023-03-16 Thread Dominique Devienne
On Thu, Mar 16, 2023 at 9:23 AM Pavel Stehule wrote: > čt 16. 3. 2023 v 9:18 odesílatel Dominique Devienne > napsal: > >> [...] depends on what you value in a particular situation, latency or >> throughput. --DD >> > > cursors are optimized for minimal cost of first row, queries are optimized >

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

2023-03-16 Thread Pavel Stehule
čt 16. 3. 2023 v 9:18 odesílatel Dominique Devienne napsal: > On Thu, Mar 16, 2023 at 6:48 AM Laurenz Albe > wrote: > >> As we wrote, some of us think that cursors are useful, and we tried to >> explain why we think that. If you don't think that cursors are useful, >> don't use them. We are

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

2023-03-16 Thread Dominique Devienne
On Thu, Mar 16, 2023 at 6:48 AM Laurenz Albe wrote: > As we wrote, some of us think that cursors are useful, and we tried to > explain why we think that. If you don't think that cursors are useful, > don't use them. We are not out to convince you otherwise. > Perhaps OT (I only skimed this

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

2023-03-15 Thread Laurenz Albe
Well, it is simple. As we wrote, some of us think that cursors are useful, and we tried to explain why we think that. If you don't think that cursors are useful, don't use them. We are not out to convince you otherwise. Yours, Laurenz Albe

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

2023-03-15 Thread Bryn Llewellyn
> adrian.kla...@aklaver.com wrote: > > I have a hard time fathoming why someone who writes documentation does not > actually read documentation. Ouch. In fact, I had read the whole of the "43.7. Cursors" section in the "PL/pgSQL" chapter (www.postgresql.org/docs/15/plpgsql-cursors.html). And

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

2023-03-15 Thread Bryn Llewellyn
> adrian.kla...@aklaver.com wrote: > >> b...@yugabyte.com wrote: >> >>> laurenz.a...@cybertec.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

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

2023-03-15 Thread Adrian Klaver
On 3/15/23 13:37, Bryn Llewellyn wrote: laurenz.a...@cybertec.at wrote: Re « You seem to think that a client request corresponds to a single database request », I meant no more than what psql models when you hit "return"after terminating an ordinary SQL statement with semi-colon (i.e. not a

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

2023-03-15 Thread Bryn Llewellyn
> laurenz.a...@cybertec.at wrote: > >> b...@yugabyte.com wrote: >> >> Section "43.7. Cursors” in the PL/pgSQL chapter of the doc >> (www.postgresql.org/docs/current/plpgsql-cursors.html#PLPGSQL-CURSOR-DECLARATIONS) >> starts with this: >> >> « >> [...] >> A more interesting usage is to return

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

2023-03-15 Thread Laurenz Albe
On Tue, 2023-03-14 at 17:50 -0700, Bryn Llewellyn wrote: > Section "43.7. Cursors” in the PL/pgSQL chapter of the doc > (www.postgresql.org/docs/current/plpgsql-cursors.html#PLPGSQL-CURSOR-DECLARATIONS) > starts with this: > > « > [...] > A more interesting usage is to return a reference to a

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

2023-03-14 Thread Adrian Klaver
On 3/14/23 20:29, Bryn Llewellyn wrote: adrian.kla...@aklaver.com wrote: b...@yugabyte.com wrote: Section "43.7. Cursors” in the PL/pgSQL chapter of the doc (www.postgresql.org/docs/current/plpgsql-cursors.html#PLPGSQL-CURSOR-

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

2023-03-14 Thread Bryn Llewellyn
> adrian.kla...@aklaver.com wrote: > >> b...@yugabyte.com wrote: >> >> Section "43.7. Cursors” in the PL/pgSQL chapter of the doc >> (www.postgresql.org/docs/current/plpgsql-cursors.html#PLPGSQL-CURSOR-DECLARATIONS) >> starts with this: >> « >> Rather than executing a whole query at once, it

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

2023-03-14 Thread Adrian Klaver
On 3/14/23 17:50, Bryn Llewellyn wrote: Section "43.7. Cursors” in the PL/pgSQL chapter of the doc (www.postgresql.org/docs/current/plpgsql-cursors.html#PLPGSQL-CURSOR-DECLARATIONS) starts with this: « Rather than executing a whole query at once, it is possible to set up a cursor that

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

2023-03-14 Thread Bryn Llewellyn
Section "43.7. Cursors” in the PL/pgSQL chapter of the doc (www.postgresql.org/docs/current/plpgsql-cursors.html#PLPGSQL-CURSOR-DECLARATIONS) starts with this: « Rather than executing a whole query at once, it is possible to set up a cursor that encapsulates the query, and then read the query