I often find myself using (no pun intended) the USING clause in PostgreSQL, and was wondering how the choice would be made in case of multiple USING on the same key name.
Let me explain with a simple example : Let table A, B and C having the userid column. If I am doing :
SELECT A.c1, A.c2, ...
FROM A
JOIN B USING(userid)
JOIN C USING(userid) ;
How does Postrges manages the conflict emerging from the fact that both tables B and C have the column userid ? What is the output resulting from ?
A.userid = B.userid AND A.userid = C.userid
or
A.userid = B.userid AND B.userid = C.userid
I hope I have been clear enough, thank you in advance for your answer.
PS : I am not doing multiple USING clause because I find that unreadable, but I was wondering how it worked.