Menu

#1590 Bug with selection of multiple boolean constants

version 2.5.x
open-fixed
None
5
2020-08-05
2020-08-05
No

Thank you for great database. We use it a lot for automatic testing of our DB layer. We have found strange issue related to selecting constants together with the actual data from the table. If we select two boolean constants with different names, the result set contains duplicated name. Query:

CREATE TABLE IF NOT EXISTS device (
id uuid NOT NULL CONSTRAINT device_pkey PRIMARY KEY
);

insert into device (id) values ('13814000-1dd2-11b2-8080-808080808080');

select
id,
True as read_flag,
True as write_flag
from device;

While this might be bad design for most cases, we use this functionality in a very specific case.

Attaching the image that shows that the result set contains two "WRITE_FLAG" columns. Please note that this is not the IDE bug, since the issue happends during automatic tests built with mvn.
Also, the following query works fine:

select
id,
1 as read_flag,
1 as write_flag
from device;

1 Attachments

Discussion

  • Fred Toussi

    Fred Toussi - 2020-08-05
    • assigned_to: Fred Toussi
     
  • Fred Toussi

    Fred Toussi - 2020-08-05

    Thanks for reporting. Good find. My checks show this happens only with boolean literals and not with any other type. The workaround is to use an expression instead of the literal. For example:

    select
    id,
    1=1 as read_flag,
    True as write_flag
    from device;

    Will be fixed in the next update

     
  • Andrii Shvaika

    Andrii Shvaika - 2020-08-05

    Yes, this is correct. I have reproduced it only with boolean literals. Thank you for the workaround!

     
  • Fred Toussi

    Fred Toussi - 2020-08-05
    • status: open --> open-fixed
     
  • Fred Toussi

    Fred Toussi - 2020-08-05

    Fixed and committed to SVN.

     

Log in to post a comment.

MongoDB Logo MongoDB