lateral join

This commit is contained in:
Yuri Kuznetsov
2025-06-07 20:34:31 +03:00
parent d35f00b2cb
commit 6aebcaed97
4 changed files with 87 additions and 9 deletions
@@ -1057,6 +1057,39 @@ class MysqlQueryComposerTest extends \PHPUnit\Framework\TestCase
);
}
public function testJoinSubQueryLateral(): void
{
$sql =
"SELECT post.id AS `id` FROM `post` " .
"JOIN LATERAL (SELECT post.id AS `id` FROM `post` LIMIT 0, 1) AS `a` ON TRUE";
$select = SelectBuilder::create()
->select('id')
->from('Post')
->join(
Join::createWithSubQuery(
SelectBuilder::create()
->select('id')
->from('Post')
->limit(0, 1)
->withDeleted()
->build(),
'a',
)
->withLateral()
->withConditions(
Expression::value(true)
)
)
->withDeleted()
->build();
$this->assertEquals(
$sql,
$this->query->composeSelect($select)
);
}
public function testJoinSubQueryException1(): void
{
$this->expectException(LogicException::class);