Обсуждение: [PATCH] Fix FetchRefcursors issues

Поиск
Список
Период
Сортировка

[PATCH] Fix FetchRefcursors issues

От
Adrian Grucza
Дата:
Hi all,

I've created a patch (attached) that fixes some issues with the automatic fetching of refcursors from a function/procedure (the FetchRefcursors setting). It includes updates to the tests.

Below is a summary of the patch:
1. Fix crash if error occurs when fetching noninitial refcursor
2. Fix error when fetching NULL refcursor
3. Return empty result if all refcursors are NULL

Regards,
iress.com
Adrian Grucza  
Technical Lead
Tel: +61390185800
adrian.grucza@iress.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
Вложения

Re: [PATCH] Fix FetchRefcursors issues

От
Adrian Grucza
Дата:
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,
iress.com
Adrian Grucza  
Technical Lead
Tel: +61390185800
adrian.grucza@iress.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
Вложения