Re: Modify the DECLARE CURSOR command tag depending on the scrollable flag

From: Boszormenyi Zoltan <zb(at)cybertec(dot)at>
To: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
Cc: Alvaro Herrera <alvherre(at)2ndquadrant(dot)com>, Michael Meskes <meskes(at)postgresql(dot)org>, Noah Misch <noah(at)leadboat(dot)com>, Peter Eisentraut <peter_e(at)gmx(dot)net>, Robert Haas <robertmhaas(at)gmail(dot)com>, PG Hackers <pgsql-hackers(at)postgresql(dot)org>, Heikki Linnakangas <hlinnakangas(at)vmware(dot)com>, Bruce Momjian <bruce(at)momjian(dot)us>, Hans-Jürgen Schönig <hs(at)cybertec(dot)at>
Subject: Re: Modify the DECLARE CURSOR command tag depending on the scrollable flag
Date: 2013-11-27 16:54:37
Message-ID: 529623CD.30806@cybertec.at
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

2013-11-23 22:01 keltezéssel, Tom Lane írta:
> Boszormenyi Zoltan <zb(at)cybertec(dot)at> writes:
>> Attached is the patch that modified the command tag returned by
>> the DECLARE CURSOR command. It returns "DECLARE SCROLL CURSOR"
>> or "DECLARE NO SCROLL CURSOR" depending on the cursor's
>> scrollable flag that can be determined internally even if neither is
>> asked explicitly.
> This does not strike me as an acceptable change. It will break any code
> that's expecting the existing command tag, for little or no benefit
> to most applications. Even if backwards compatibility were of no concern,
> I'm not convinced it's a good thing to expose the backend's internal
> choices about query plans used for cursors, which is what this is
> basically doing.

I saw code in the backend allowing a cursor to be scrollable, although
it was not declared as such. How about ripping that out?

That way there would be no incentive for lazy SQL coding using simple cursors.

You can argue that it would also break application compatibility but
on the other hand, such a code has always been buggy and should be fixed.

>> It is expected by the ECPG cursor readahead code.
> And that doesn't sound like a sufficient excuse. You should only assume a
> cursor is scrollable if SCROLL was specified in the cursor declaration
> command, which it'd seem to me is something ECPG would or easily could
> know about commands it issues.

Yes, it can and I have a patch in the series passing this info to ecpglib.

I am also arguing for backward compatibility on a different angle:
this small backend change would still allow using simple cursors
in ECPG while using the cursor readahead.

And it's not the first time drivers have to adapt to new PostgreSQL major versions.
If it was, I wouldn't have the courage to set a precedent either.

Best regards,
Zoltán Böszörményi

--
----------------------------------
Zoltán Böszörményi
Cybertec Schönig & Schönig GmbH
Gröhrmühlgasse 26
A-2700 Wiener Neustadt, Austria
Web: http://www.postgresql-support.de
http://www.postgresql.at/

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Alvaro Herrera 2013-11-27 16:57:52 Re: Errors on missing pg_subtrans/ files with 9.3
Previous Message Shigeru Hanada 2013-11-27 16:52:57 Re: Status of FDW pushdowns