-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Fix proper set result field names when using join clause
Closes cznic#137 Context cznic#136 This PR make sure the field names for results nested select are set properly. The observation from postgresql shows that for the following sql. ```sql BEGIN TRANSACTION; CREATE TABLE department ( DepartmentID integer, DepartmentName text ); INSERT INTO department (DepartmentID,DepartmentName) VALUES (31, 'Sales'), (33, 'Engineering'), (34, 'Clerical'), (35, 'Marketing'); CREATE TABLE employee ( LastName text, DepartmentID integer ); INSERT INTO employee VALUES ('Rafferty', 31), ('Jones', 33), ('Heisenberg', 33), ('Robinson', 34), ('Smith', 34), ('Williams', NULL); COMMIT; ``` ``` gernest=# select * from (select * from employee) as a,(select * from department ) as d order by d.DepartmentID desc; lastname | departmentid | departmentid | departmentname ------------+--------------+--------------+---------------- Rafferty | 31 | 35 | Marketing Robinson | 34 | 35 | Marketing Williams | | 35 | Marketing Jones | 33 | 35 | Marketing Smith | 34 | 35 | Marketing Heisenberg | 33 | 35 | Marketing Jones | 33 | 34 | Clerical Williams | | 34 | Clerical Robinson | 34 | 34 | Clerical Heisenberg | 33 | 34 | Clerical Rafferty | 31 | 34 | Clerical Smith | 34 | 34 | Clerical Smith | 34 | 33 | Engineering Jones | 33 | 33 | Engineering Williams | | 33 | Engineering Heisenberg | 33 | 33 | Engineering Robinson | 34 | 33 | Engineering Rafferty | 31 | 33 | Engineering Robinson | 34 | 31 | Sales Jones | 33 | 31 | Sales Heisenberg | 33 | 31 | Sales Rafferty | 31 | 31 | Sales Smith | 34 | 31 | Sales Williams | | 31 | Sales (24 rows) ``` Previously the names were set to empty strings .
- Loading branch information
Showing
4 changed files
with
83 additions
and
23 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters