Re: [PATCH] Fix FetchRefcursors issues

From: Adrian Grucza <adrian(dot)grucza(at)iress(dot)com>
To: pgsql-odbc(at)lists(dot)postgresql(dot)org
Subject: Re: [PATCH] Fix FetchRefcursors issues
Date: 2022-05-09 02:31:48
Message-ID: CADF4wWqd4a=rRD27a2umxq0EFFog160d0fJrTxrS=74O7hQMRg@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-odbc

Hi all,

I've attached an additional patch that fixes a pre-existing bug where
cursors were being freed prematurely when there are multiple results that
use cursors. It can happen when the fetch cache size is smaller than the
number of rows being fetched. To ensure the bug doesn't resurface, the
patch includes updates to the test that was modified in my previous patch
(Fix-FetchRefcursors-issues.patch).

Some details about this patch:

The patch adds a condition to skip existing code that closes all subsequent
cursors when the current one gets closed. It does not seem logical that
closing one cursor should cause others to also be closed. The code was
originally added in commit c07342d22d82ea6293d27057840babfc2ff6d750 to fix
a crash when using SQL Server linked servers, but it's still not clear
exactly why it was needed, because the change that prevents a crash seems
to be in a different file (parse.c).

I was tempted to remove the code completely because there are no tests that
rely on its existence, but that may be because testing it would have
required integration with SQL Server. So I've assumed that the code is only
required for SQL Server, and therefore made it run only for SQL Server.

Regards,

Adrian Grucza
Technical Lead
Tel: +61390185800
adrian(dot)grucza(at)iress(dot)com
www.iress.com
Level 16 385 Bourke St
Melbourne, Victoria, 3000
The contents of this email originated from Iress. For this purpose Iress includes Iress Limited and/or any of its subsidiaries, holding companies and trading entities. ​If you have received this email in error please notify the sender immediately and delete this email.
nosig

Attachment Content-Type Size
Prevent-cursors-being-closed-prematurely.patch application/octet-stream 4.1 KB

In response to

Browse pgsql-odbc by date

  From Date Subject
Next Message Dirk Hasenbrink 2022-05-20 07:37:32 Bug in psqlodbc 13.02? Bulk updates + ODBC function SQLRowCount(...)
Previous Message Venkata Reddy BIJJAM 2022-04-29 06:06:57 Re: ODBC to Postgres SQL (Aws rds) Connectivity Issue