Postgres seems to not evaluate table alias when the table row does not exist due to left join. The execution fails saying 'alias is not known'

I can use some workarounds without left join, but I don't want to go that way.

This simple query does work on SQL Server, but fails on Postgresql because in, the a alias does not exist if the room has no guests.

Select, b.* 
from rooms b 
left join guests a on a.room_id = b.a_id

Actual: alias 'a' is not known

Expected: that it would give results just like in SQL Server

0 Answers