Solved thread

This post is marked as solved. If you think the information contained on this thread must be part of the official documentation, please contribute submitting a pull request to its repository.

LEFT JOIN LATERAL in PHQL

Hello,

is there a way to do LEFT JOIN LATERAL in PHQL?

Like in this example:

http://sqlfiddle.com/#!15/06dfe/6

https://stackoverflow.com/questions/30628950/postgresql-left-outer-join-on-json-array

by using some kind of dialect extension?

I can replace "->>" by postgresql function and update dialect similar to this:

$dialect = new \Phalcon\Db\Dialect\Postgresql();
$dialect->registerCustomFunction(
    'jsonb_exists',
    function($dialect, $expression) {
        $arguments = $expression['arguments'];
        return sprintf(
            "jsonb_exists(%s, %s)",
            $dialect->getSqlExpression($arguments[0]),
            $dialect->getSqlExpression($arguments[1])
        );
    }
);

but how can I extend dialect to recognize LEFT JOIN LATERAL?



24.1k
Accepted
answer

Hi @tomasz here you have the docuentantion to extend mysql dialect and you can check some examples in incubator repo

Good luck