Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

View created from JOIN and LEFT JOIN doesnt order [CORE2870] #3254

Closed
firebird-automations opened this issue Feb 16, 2010 · 9 comments
Closed

Comments

@firebird-automations
Copy link
Collaborator

Submitted by: Tomas Krejzek (respektive)

Duplicates CORE1089
Duplicates CORE2863

When You create view like this

create view unordered_view (
tab1_column1,
tab1_column2,
tab2_column1,
tab3_column1)
as
select
tab1_column1,
tab1_column2,
tab2_column1,
tab3_column1
from tab1
join tab2 on tab1_columnX = tab2_columnY
left join tab3 on tab1_columnY = tab3_columnZ
;

When You call
Select * from unordered_view order by ....

it doesnt order rows a I want. The only columns from tab3 works.

====== Test Details ======

Though this ticket duplicates core-1089 I've decided to put its test into separate file because of data and resultset size (it contains simplified DDL and data of three tables from standard 'employee' database).

@firebird-automations
Copy link
Collaborator Author

Commented by: @dyemanov

Please provide a reproducible test case.

@firebird-automations
Copy link
Collaborator Author

Commented by: Tomas Krejzek (respektive)

I'm so sorry, I forgot word "DISTINCT"

the test case is from employee.fdb distributed with firebird

CREATE VIEW UNORDERED_VIEW(
EMP_NO,
FIRST_NAME,
LAST_NAME,
PHONE_EXT,
HIRE_DATE,
DEPT_NO,
JOB_CODE,
JOB_GRADE,
JOB_COUNTRY,
SALARY,
FULL_NAME,
DEPARTMENT,
HEAD_DEPT,
MNGR_NO,
BUDGET,
LOCATION,
PHONE_NO,
COUNTRY,
CURRENCY)
AS
select distinct
EMP_NO, FIRST_NAME, LAST_NAME, PHONE_EXT, HIRE_DATE, EMPLOYEE.DEPT_NO, JOB_CODE, JOB_GRADE, JOB_COUNTRY,
SALARY, FULL_NAME, DEPARTMENT, HEAD_DEPT, MNGR_NO, BUDGET, LOCATION, PHONE_NO, COUNTRY, CURRENCY from employee
join department on employee.dept_no = department.dept_no
left join country on employee.job_country = country.country
;

The DISTINCT is crutial, on FB2.1.3 if I change first JOIN to LEFT JOIN (in my case I can, the result is same) the view work fine. On FB2.0.5 I have to remove distinct, the change JOIN to LEFT JOIN doesnt help to work fine

My post is described in firebird support list - "FB 2.1.3 - cannot order VIEW rows" from 3.2.2010

@firebird-automations
Copy link
Collaborator Author

Modified by: @dyemanov

Link: This issue duplicates CORE1089 [ CORE1089 ]

@firebird-automations
Copy link
Collaborator Author

Modified by: @dyemanov

Link: This issue duplicates CORE2863 [ CORE2863 ]

@firebird-automations
Copy link
Collaborator Author

Commented by: @dyemanov

It has been already reported as CORE2863. Both tickets are closed as duplicates of CORE1089.

@firebird-automations
Copy link
Collaborator Author

Modified by: @dyemanov

status: Open [ 1 ] => Resolved [ 5 ]

resolution: Duplicate [ 3 ]

@firebird-automations
Copy link
Collaborator Author

Modified by: @pcisar

status: Resolved [ 5 ] => Closed [ 6 ]

@firebird-automations
Copy link
Collaborator Author

Modified by: @pavel-zotov

QA Status: No test

@firebird-automations
Copy link
Collaborator Author

Modified by: @pavel-zotov

status: Closed [ 6 ] => Closed [ 6 ]

QA Status: No test => Done successfully

Test Details: Though this ticket duplicates core-1089 I've decided to put its test into separate file because of data and resultset size (it contains simplified DDL and data of three tables from standard 'employee' database).

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment