[pg]: bugfix in join query generation