1

Topic: Glitches with temporary tables

Glitches with temporary tables
Wanted was to use new syntax with cursors, but not here that was (Firebird 3.0.3)
Here outlined a small example.
How you think what result?

create procedure test
returns (id integer)
as
declare gtt_cursor cursor for (select id from gtt_table);
begin
/*create global temporary table gtt_table (id integer) on commit preserve rows*/
delete from gtt_table;
insert into gtt_table (id) values (1);
insert into gtt_table (id) values (2);
open gtt_cursor;
while (true) do
begin
fetch gtt_cursor into:id;
if (row_count = 0) then
leave;
suspend;
end
close gtt_cursor;
for select id from gtt_table into:id do suspend;
end

2

Re: Glitches with temporary tables

someonesomeone;
The main thing implicit cursors work stablly and predicted. And here explicit there any casual .
Wait while Vlad comes, well or at once write in

3

Re: Glitches with temporary tables

And in what  a bug essence?
With GTT does not work or with
Cursors 0 returns?
P.S. There should be 4 records.

4

Re: Glitches with temporary tables

Gadzhimuradov Rustam;
There

open gtt_cursor;
while (true) do
begin
fetch gtt_cursor into:id;
if (row_count = 0) then
leave;
suspend;
end
close gtt_cursor;

Casual rubbish produces. That 1, 2, and even 3 records

5

Re: Glitches with temporary tables

If GTT to replace on normal - correctly works?

6

Re: Glitches with temporary tables

Gadzhimuradov Rustam;
No. To a campaign again stability of the cursor. It would be necessary on  to try, Vlad something there rules

7

Re: Glitches with temporary tables

Release. In  3.0.4.32980 it is corrected.
To campaign here it was http://tracker.firebirdsql.org/browse/CORE-5773

8

Re: Glitches with temporary tables

That is interesting if to delete the last line in procedure produces nothing

9

Re: Glitches with temporary tables

someonesomeone wrote:

if to delete the last line in procedure produces nothing

All is correct. Stability of the cursor is based on the relative account  (a minus
One from leaking, a minus two from leaking etc.). Therefore it  on requests, which
Do not create new . As Vlad got out - no concept I have. Perhaps translated on
The absolute account under numbers, can still that invented...

10

Re: Glitches with temporary tables

someonesomeone;
When I made experiment without the last line on 3.0.3 at me each time a different amount of lines was from 1 to 3.
In  like all correctly works

11

Re: Glitches with temporary tables

Denis wrote:

at me each time the different amount of lines was from 1 to 3.

It because of delete in the beginning.