PostgreSQL subquery with syntax error gives a valid result

后端 未结 1 1298
日久生厌
日久生厌 2021-01-20 18:39

What is happening here?

I got two tables, test1 and test2:

create table test1 (id1 int4 primary key);
create table test2 (id2 int4 primary key);


        
相关标签:
1条回答
  • 2021-01-20 19:12

    Columns from outer select are visible in sub-select.

    Your query is equivalent to:

    select * 
    from test1 
    where test1.id1 in (select test1.id1 from test2);
    
    0 讨论(0)
提交回复
热议问题