joinx : fromtable jointype fromtable
             | fromtable jointype fromtable kw_on expression
             | fromtable jointype fromtable kw_using '(' namelist ')'

def p_joinx(self,t):
    # todo: support join types http://www.postgresql.org/docs/9.4/static/queries-table-expressions.html#QUERIES-JOIN
    """joinx : fromtable jointype fromtable
             | fromtable jointype fromtable kw_on expression
             | fromtable jointype fromtable kw_using '(' namelist ')'
    """
    if len(t)==4: t[0] = JoinX(t[1],t[3],None,t[2])
    elif len(t)==6: t[0] = JoinX(t[1],t[3],t[5],t[2])
    else: raise NotImplementedError('todo: join .. using')