Skip to content

Column aliases still missing even in trivial cases. [CORE1508] #1923

Open
@firebird-automations

Description

@firebird-automations

Submitted by: Claudio Valderrama C. (robocop)

It seems that giving each unnamed column an automatic alias in FB has become a labor for Hercules since FB1 because we can't put an end to the surprises. These are trivial examples:

SQL> select 1, -1, gen_id(rdb$trigger_name, 0), -gen_id(rdb$trigger_name, 0) from rdb$database;

CONSTANT                             GEN\_ID

============ ============ ===================== =====================
1 -1 0 0

SQL> select NULL, -NULL from rdb$database;

CONSTANT
======== ============
<null> <null>

It's hard to explain the end user that because DSQL treats negatives as
neg(absolute_value)
it's seen as an expression by the server and a default column alias is not produced. Generally, each negative expression like
select -char_length('') from rdb$database;
has the same problem of being an unnamed column. I have a fix for the trivial cases of NULL and constant, only:

SQL> set list;
SQL> select 1, -1, NULL, -NULL from rdb$database;

CONSTANT 1
CONSTANT -1
CONSTANT <null>
CONSTANT <null>

Commits: 874d8bb