Skip to content

Wrong AST in self-joined query #17

@staabm

Description

@staabm

I have the feeling the AST for a query like SELECT a.email, b.adaid FROM ada a LEFT JOIN ada b ON a.adaid=b.adaid is not correct.

        $queryString = 'SELECT a.email, b.adaid FROM ada a LEFT JOIN ada b ON a.adaid=b.adaid';

        // returns a Generator. will not parse anything if you don't iterate over it
        $commands = $parser->parse($queryString);

        foreach ($commands as list($command)) {
            // Parser does not throw exceptions. this allows to parse partially invalid code and not fail on first error
            if ($command instanceof SelectCommand) {
                $from = $command->getFrom();
                var_dump(get_class($from));
            }
        }

only output:

SqlFtw\Sql\Dml\TableReference\OuterJoin

I am wondering why the ast does not contain a TableReferenceTable in addition to the Join.
Also: I don't think OuterJoin is correct in this case.

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions