firebird icon indicating copy to clipboard operation
firebird copied to clipboard

ISQL does not show 'CONSTANT' for some / all non-aliased columns if UNION presents in the query

Open pavel-zotov opened this issue 8 months ago • 1 comments

Consdier following script:

--set list on;
set echo on;

-- q1
select '12345', '', ''
from rdb$database
;

------------------------------------------
-- q2
select '12345', '', ''
from rdb$database

union all

select
    '12345',
    'y' as y,
    'z' as z
from rdb$database
;

------------------------------------------
-- q3
select
    '12345', '', ''
from rdb$database

union all

select
    '123456',
    'y' as y,
    'z' as z
from rdb$database
;

Its output will be:

-- q1:
CONSTANT CONSTANT CONSTANT
======== ======== ========
12345

-- q2:
CONSTANT
======== ====== ======
12345
12345    y      z

-- q3:

====== ====== ======
12345
123456 y      z

Image

Not let's uncomment set list on; and repeat. Output will be:

-- q1:
CONSTANT                        12345
CONSTANT
CONSTANT

--q2:
CONSTANT                        12345



CONSTANT                        12345
                                y
                                z
-- q3:
                                12345



                                123456
                                y
                                z

Image

PS. Result is the same on 3.x ... 6.x, i.e. this is not regression.

pavel-zotov avatar Apr 26 '25 09:04 pavel-zotov

It's not ISQL that decides on that name, but the server.

mrotteveel avatar Apr 26 '25 10:04 mrotteveel