Alvaro Herrera <alvherre@atentus.com> writes:
> I'm trying to JOIN two subselects-in-from clauses and can't get it
> right:
> SELECT foo1.mes, valor1999 AS "1999", valor2000 AS "2000" FROM
> (SELECT valor AS valor1999, mes FROM datos WHERE a�o=1999) AS foo1
> OUTER JOIN
> (SELECT valor AS valor2000, mes FROM datos WHERE a�o=2000) AS foo2
> ON foo1.mes=foo2.mes;
> ERROR: parser: parse error at or near "OUTER"
Should be LEFT JOIN or LEFT OUTER JOIN.
> If I try to do an INNER JOIN, I get instead
> SELECT foo1.mes, valor1999 AS "1999", valor2000 AS "2000" FROM
> (SELECT valor AS valor1999, mes FROM datos WHERE a�o=1999) AS foo1
> INNER JOIN
> (SELECT valor AS valor2000, mes FROM datos WHERE a�o=2000) AS foo2
> ON foo1.mes=foo2.mes;
> ERROR: flatten_join_alias_var: unexpected subtree type
[ scratches head ... ] I do not get that. I think there must be
something broken about your build; or perhaps there's a portability
problem lurking in devel sources. Would you try a full rebuild (make
distclean, configure, build, initdb) to eliminate the possibility of
internal version mismatches?
regards, tom lane