Learning from bugs using together : list,distinct,case,extract weekday

Seems that the bug CORE-3302 is triggered when there are millions of rows and only in firebird 2.5 and 3.0 (Bug is already fixed in svn)
What you can learn from the bug is the usage of list,distinct,case,extract weekday in the same query

First i have created the query to extract the day in string format from current date
select
list(case extract(weekday from CURRENT_DATE) when 0 then 'Sun' when 1 then 'Mon' when 2 then 'Tue' when 3 then 'Wed' when 4 then 'Thu' when 5 then 'Fri' when 6 then 'Sat' end)
from RDB$DATABASE

In my case the result was Fri.
Then you can create a table with different dates:

CREATE table tasks
(
DATE_OF_TASK DATE
);

Populate the table

INSERT INTO TASKS (DATE_OF_TASK) VALUES ('2011-01-07');
INSERT INTO TASKS (DATE_OF_TASK) VALUES ('2011-01-07');
INSERT INTO TASKS (DATE_OF_TASK) VALUES ('2011-01-07');
INSERT INTO TASKS (DATE_OF_TASK) VALUES ('2011-01-06');
INSERT INTO TASKS (DATE_OF_TASK) VALUES ('2011-01-06');
INSERT INTO TASKS (DATE_OF_TASK) VALUES ('2011-01-06');
INSERT INTO TASKS (DATE_OF_TASK) VALUES ('2011-01-08');
INSERT INTO TASKS (DATE_OF_TASK) VALUES ('2011-01-08');
INSERT INTO TASKS (DATE_OF_TASK) VALUES ('2011-01-08');

Then start to run the query

select
list(distinct case extract(weekday from date_of_task) when 0 then 'Sun' when 1 then 'Mon' when 2 then 'Tue' when 3 then 'Wed' when 4 then 'Thu' when 5 then 'Fri' when 6 then 'Sat' end)
from tasks

Result should be:

Fri,Sat,Thu

Firebird SQL linkedin Community is now an open group

I am pleased to announce that, as the owner of this group, I have just switched us to an open discussion group. All future discussions will be fully visible, searchable, and shareable on the Web. All past discussions are now closed in a members-only archive. I look forward to our future discussions now joining the broader conversation of the wider Web.

Posted By Dumitru Condrea
Go to the complete announcement

Testing identity columns in Firebird 3.0

Someone on support list asked about identity column in Firebird and how it can be managed easier and i remembered that identity is already supported firebird 3.0 so i fired up flamerobin and created a table with new identity column type similar to MSSQL “identity”, MySQL “auto_increment” or PostgreSQL “serial”
All worked as in documentation 🙂 inserting and selecting from the table no generators/triggers were needed to be created by hand

ibphoenix.com relaunched with new interface

I like the new style for ibphoenix , minor glitch is the firebird image in corner is quite blurry and should be replaced with higher quality image
also on my monitor is too small 1920×1080 and i have to do 3xCTRL+ to fit the screen, maybe a liquid layout should be applied (i will send the bug and the fix) . In rest is great maybe is too much white in background and the stripped green background should be a added back ?

1 131 132 133 134 135 200