We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
1 parent 1a00d45 commit 5a06e0eCopy full SHA for 5a06e0e
1 file changed
system/Model.php
@@ -473,9 +473,13 @@ public function first()
473
474
// Some databases, like PostgreSQL, need order
475
// information to consistently return correct results when there is group by
476
- if (! empty($this->QBGroupBy) && empty($builder->QBOrderBy) && ! empty($this->primaryKey))
+ // except when soft delete is enabled
477
+ if (empty($builder->QBOrderBy) && ! empty($this->primaryKey))
478
{
- $builder->orderBy($this->table . '.' . $this->primaryKey, 'asc');
479
+ if (! empty($this->QBGroupBy) || $this->tempUseSoftDeletes === true)
480
+ {
481
+ $builder->orderBy($this->table . '.' . $this->primaryKey, 'asc');
482
+ }
483
}
484
485
$row = $builder->limit(1, 0)
0 commit comments