Re: Reuse of REF Cursor

2021-04-12 Thread Ron
On 4/11/21 1:02 PM, Abraham, Danny wrote: 2021-04-09 08:00:08.692 IDTERROR: canceling statement due to statement timeout 2021-04-09 08:00:08.692 IDTCONTEXT: PL/pgSQL function orhpans_active_clean_table(character varying,integer) line 42 at FETCH PL/pgSQL function orhpans_active_remova

RE: Re: Reuse of REF Cursor

2021-04-11 Thread Abraham, Danny
I speculate that I am in the good old problem .. of a very slow plan of NOT IN (We used to convert it to NOT EXISTS in V8). Is this planner issue still in V9? Has the planner fixed for it in V10? Thanks Danny

Re: Reuse of REF Cursor

2021-04-11 Thread Tom Lane
"Abraham, Danny" writes: > 2021-04-09 08:00:08.692 IDTERROR: canceling statement due to statement > timeout I don't know why you would think that a statement timeout is somehow the fault of the refcursor variable you used. You need to look at whether your timeout is a sane value, and if so, wh

RE: Re: Reuse of REF Cursor

2021-04-11 Thread Abraham, Danny
2021-04-09 08:00:08.692 IDTERROR: canceling statement due to statement timeout 2021-04-09 08:00:08.692 IDTCONTEXT: PL/pgSQL function orhpans_active_clean_table(character varying,integer) line 42 at FETCH PL/pgSQL function orhpans_active_removal() line 31 at assignment PL/pgSQL fu

Re: Reuse of REF Cursor

2021-04-11 Thread Tom Lane
"Abraham, Danny" writes: > stmt := 'select count(*) from ' || table_name; >open C1 for execute stmt; >fetch C1 into rc; >close C1; >... That still isn't a self-contained example; perhaps more usefully, you've not told us exactly what error you're seeing, either. FWIW, I tried

RE: Re: Reuse of REF Cursor

2021-04-11 Thread Abraham, Danny
stmt := 'select count(*) from ' || table_name; open C1 for execute stmt; fetch C1 into rc; close C1; if (debug_level = 1) then if rc > 0 then perform diag_print(func_name,format('Counted %s records in table %s',rc,table_name) ); else perform diag_print

Re: Reuse of REF Cursor

2021-04-11 Thread Tom Lane
"Abraham, Danny" writes: > Has anybody faced a problem with reusing a ref cursor? Your fragment looks like it ought to work, but it's hard to say where the problem is without seeing a complete example. > PG Version 9.5.5 on Linux. 9.5.x is EOL, and the last release in that series was 9.5.25, so

Re: Reuse of REF Cursor

2021-04-11 Thread David G. Johnston
On Sunday, April 11, 2021, Abraham, Danny wrote: > > PG Version 9.5.5 on Linux. > > As neither your minor nor major version are supported you will find support to find limited if you get any at all. David J.