COUNT(DISTINCT <DECFLOAT_FIELD>) leads FB to crash when there are duplicate 
values of this field
------------------------------------------------------------------------------------------------

                 Key: CORE-6218
                 URL: http://tracker.firebirdsql.org/browse/CORE-6218
             Project: Firebird Core
          Issue Type: Bug
          Components: Engine
    Affects Versions: 4.0 Beta 1
            Reporter: Pavel Zotov
         Attachments: 
firebird.20200109_102731.704191.WI-T4_0_0_1714.stack_trace.7z

Consider following script:
==========
recreate table test0(n decfloat);
commit;

insert into test0 values( 0 );
insert into test0 values( 0 );
commit;

set sqlda_display on;
select n as test0_n from test0;
set sqlda_display off;
commit;

set list on;
set explain on;

select n as n_grouped_from_test0 from test0 group by 1; --- [ 1 ]

select distinct n as n_uniq_from_test0 from test0; -- [ 2 ]

select count(distinct n) as count_uniq_from_test0 from test0; -- [ 3 ]
==========

Statement [ 3 ] will raise crash on recent FB 4.x.


firebird.log will contain after this:
=======
IMAGE-PC1       Thu Jan  9 10:27:31 2020
         Access violation.
                The code attempted to access a virtual
                address without privilege to do so.
        This exception will cause the Firebird server
        to terminate abnormally.

IMAGE-PC1       Thu Jan  9 10:27:31 2020
        INET/inet_error: read errno = 10054, server host = Image-PC1, address = 
fe80::fcf1:e33c:e924:969d%16/3439

IMAGE-PC1       Thu Jan  9 10:27:31 2020
        REMOTE INTERFACE/gds__detach: Unsuccesful detach from database.
        Uncommitted work may have been lost.
        Error writing data to the connection.
        send_packet/send
=======

Stack trace can be seen in attached .7z

PS.

If replace records with unique values:
=====
insert into test0 values( 0 );
insert into test0 values( 1 );
=====
-- then count(distinct N) works OK.


Checked on WI-T4.0.0.1714

-- 
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators: 
http://tracker.firebirdsql.org/secure/Administrators.jspa
-
For more information on JIRA, see: http://www.atlassian.com/software/jira

        


Firebird-Devel mailing list, web interface at 
https://lists.sourceforge.net/lists/listinfo/firebird-devel

Reply via email to