postgresql delete alias fix

This commit is contained in:
Yuri Kuznetsov
2025-05-14 13:58:35 +03:00
parent 11d9d2aee4
commit b71a237cad
2 changed files with 55 additions and 0 deletions

View File

@@ -617,4 +617,40 @@ class PostgresqlQueryComposer extends BaseQueryComposer
return null;
}
protected function composeDeleteQuery(
string $table,
?string $alias,
string $where,
?string $joins,
?string $order,
?int $limit
): string {
$sql = "DELETE ";
$sql .= "FROM " . $this->quoteIdentifier($table);
if ($alias) {
$sql .= " AS " . $this->quoteIdentifier($alias);
}
if ($joins) {
$sql .= " $joins";
}
if ($where) {
$sql .= " WHERE $where";
}
if ($order) {
$sql .= " ORDER BY $order";
}
if ($limit !== null) {
$sql = $this->limit($sql, null, $limit);
}
return $sql;
}
}