postgresql - When exactly will the result of a SQL join collapse two columns into one? -


i use postgresql quite frequently, , i've observed equality joins merge 2 columns involved in equality comparison single column in result set, , don't. seems related whether or not join inner or outer, , whether or not join condition expressing using syntax or on syntax. i'd know when 2 columns collapsed/merged one, or better: i'd know behavior specified.

it collapsed when using used

create table (id int); create table b (id int);  select *         inner join     b using (id);  id  ---- (0 rows) 

if on used return 2 columns:

select *         inner join     b on a.id = b.id;  id | id  ----+---- (0 rows) 

and column without table name qualification ambiguous

select id         inner join     b on a.id = b.id; error:  column reference "id" ambiguous line 1: select id inner join b on a.id = b.id; 

the same outer join

select *         full outer join     b on a.id = b.id;  id | id  ----+---- (0 rows) 

Comments

Popular posts from this blog

android - Get AccessToken using signpost OAuth without opening a browser (Two legged Oauth) -

org.mockito.exceptions.misusing.InvalidUseOfMatchersException: mockito -

google shop client API returns 400 bad request error while adding an item -