[Bug] Comment Directive --Tab=Name uses first seen Tab= if multiple exist

zitot

Member²

SQL:
-- Tab=Window 1
--select 1 from dual;

-- Tab=Window 2
select 2 from dual;

-- Tab=Window 3
select 3 from dual;

Expected Result: You should have two tabs, Window 2 and Window 3

Actual Result: Window 1, Window 3



It's a little annoying. As far as affects, here is an example where I am debugging a chain of CTEs. By commenting out the first select statement, the name used for CTE2+ was Window 1, which I didn't initially figure out.

With CTE1 as (select 1 from dual), CTE2 as (select 2 from dual), ...
-- Tab=Window 1
--select * from CTE1;
-- Tab=Window 2
select * from CTE2;
-- Tab=Window 3
select * from CTE3;

Strictly speaking, it uses the first comment directive -- Tab= that is seen AFTER the previous query which ended with a semicolon, best as I can tell. Then it looks for the next valid SQL query and applies that first comment directive it found. Don't know if this applies to other comment directive types or just this.

So, what do you think this results in?

SQL:
-- Tab=Window 0
--select 0 from dual;
-- Tab=Window 1
select 1 from dual;
-- Tab=Window 2
--select 2 from dual;
-- Tab=Window 3
select 3 from dual;
 
Last edited:
Back
Top