Skip to content

Commit a4ed8d5

Browse files
authored
Patch postgres orderby fix (c316473) from 5.x into 4.x (#560)
1 parent e3974bb commit a4ed8d5

1 file changed

Lines changed: 4 additions & 0 deletions

File tree

src/QueriesJsonColumns.php

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -69,6 +69,10 @@ protected function toCast(Field $field): string
6969
default => null,
7070
};
7171

72+
if ($cast === 'datetime' && str_contains(get_class($this->builder->getConnection()->getQueryGrammar()), 'PostgresGrammar')) {
73+
$cast = 'timestamp';
74+
}
75+
7276
// Date Ranges are dealt with a little bit differently.
7377
if ($field->type() === 'date' && $field->get('mode') === 'range') {
7478
$cast = "range_{$cast}";

0 commit comments

Comments
 (0)