Subject | select count in view Firebird 2.5 |
---|---|
Author | raivis83 |
Post date | 2010-12-14T09:20:20Z |
Hi All!
I have table and view, thats returning grouped field with the count of fields records in it.
After upgrading from 2.1 to 2.5 I noticed that select count is returning null. Has anyone experienced anything like this and can confirm that it' s a bug and has reported it?
Here is DDL:
--------------------------------------------------------------------------------------
-- Test table T_EMPLOYEE:
SET SQL DIALECT 3;
CREATE TABLE T_EMPLOYEE (
ID INTEGER,
NAME VARCHAR(20),
DEPT_NO INTEGER
);
-- View
SET SQL DIALECT 3;
CREATE VIEW V_EMP_DEP(
DEPT_NO,
EMP_COUNT)
AS
select
e.dept_no,
(select count(*) from t_employee e1 where e1.dept_no = e.dept_no) as emp_count
from t_employee e
group by e.dept_no
;
-- Data
INSERT INTO T_EMPLOYEE (ID, NAME, DEPT_NO) VALUES (1, 'John', 100);
INSERT INTO T_EMPLOYEE (ID, NAME, DEPT_NO) VALUES (2, 'Bob', 100);
INSERT INTO T_EMPLOYEE (ID, NAME, DEPT_NO) VALUES (3, 'Dilan', 200);
--------------------------------------------------------------------------------------
select * from v_emp_dep in version 2.1 returns:
dept_no emp_count
-----------------
100 2
200 1
select * from v_emp_dep in version 2.5 returns:
dept_no emp_count
-----------------
100 <null>
200 <null>
I have table and view, thats returning grouped field with the count of fields records in it.
After upgrading from 2.1 to 2.5 I noticed that select count is returning null. Has anyone experienced anything like this and can confirm that it' s a bug and has reported it?
Here is DDL:
--------------------------------------------------------------------------------------
-- Test table T_EMPLOYEE:
SET SQL DIALECT 3;
CREATE TABLE T_EMPLOYEE (
ID INTEGER,
NAME VARCHAR(20),
DEPT_NO INTEGER
);
-- View
SET SQL DIALECT 3;
CREATE VIEW V_EMP_DEP(
DEPT_NO,
EMP_COUNT)
AS
select
e.dept_no,
(select count(*) from t_employee e1 where e1.dept_no = e.dept_no) as emp_count
from t_employee e
group by e.dept_no
;
-- Data
INSERT INTO T_EMPLOYEE (ID, NAME, DEPT_NO) VALUES (1, 'John', 100);
INSERT INTO T_EMPLOYEE (ID, NAME, DEPT_NO) VALUES (2, 'Bob', 100);
INSERT INTO T_EMPLOYEE (ID, NAME, DEPT_NO) VALUES (3, 'Dilan', 200);
--------------------------------------------------------------------------------------
select * from v_emp_dep in version 2.1 returns:
dept_no emp_count
-----------------
100 2
200 1
select * from v_emp_dep in version 2.5 returns:
dept_no emp_count
-----------------
100 <null>
200 <null>