Redshift picks wrong column when ambiguity occurs
Affects | Status | Importance | Assigned to | Milestone | |
---|---|---|---|---|---|
Redshift |
Invalid
|
Undecided
|
Unassigned |
Bug Description
Redshift picks wrong column when ambiguity occurs instead of throwing errors
Steps to reproduce:
Step #1)
create table #temp1 (
col1 int,
col2 int
);
Step #2)
insert into #temp1 (col1, col2) values (1,1);
insert into #temp1 (col1, col2) values (2,2);
insert into #temp1 (col1, col2) values (3,3);
insert into #temp1 (col1, col2) values (4,4);
Step #3)
SELECT col1 AS tempcol INTO #temp2 FROM #temp1 where #temp1.col1 <=2;
Step #4)
DELETE from #temp1 where col1 in (select col1 from #temp2);
Here in the inner query "select col1 from #temp2" col1 doesn't exists in #temp2 (#temp2 has a column tempcol). So it picks col1 from #temp1 and trying to runn the query. So as a result all the records has been deleted. But actually it should throw error saying that col1 is not present in #temp2.
description: | updated |
description: | updated |
description: | updated |
description: | updated |
Related to Amazon Redshift, not to this software called Redshift.