Skip to content
This repository has been archived by the owner on Nov 22, 2018. It is now read-only.

Nested select statement result set fields unnamed when using join clause #137

Closed
cznic opened this issue Sep 14, 2016 · 0 comments
Closed
Assignees
Labels

Comments

@cznic
Copy link
Owner

cznic commented Sep 14, 2016

Details in #136 .

@cznic cznic added the bug label Sep 14, 2016
@cznic cznic self-assigned this Sep 14, 2016
gernest added a commit to gernest/ql that referenced this issue May 5, 2017
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 .
gernest added a commit to gernest/ql that referenced this issue May 5, 2017
Closes cznic#137
Context cznic#136

This PR make sure the field names for results nested select are set properly.

Previously the names were set to empty strings .
gernest added a commit to gernest/ql that referenced this issue May 5, 2017
Closes cznic#137
Context cznic#136

This PR make sure the field names for results nested select are set properly.

Previously the names were set to empty strings .
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
Projects
None yet
Development

No branches or pull requests

1 participant