Skip to content

Commit

Permalink
Fix TypeError
Browse files Browse the repository at this point in the history
  • Loading branch information
campbell-m committed Jul 20, 2024
1 parent 22c0842 commit 9673264
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions web/lib/MRBS/DB_pgsql.php
Original file line number Diff line number Diff line change
Expand Up @@ -393,8 +393,10 @@ public function syntax_limit(int $count, int $offset) : string
public function syntax_timestamp_to_unix(string $fieldname) : string
{
// A PostgreSQL timestamp can be a float. We need to round it
// to the nearest integer.
return " ROUND(DATE_PART('epoch', $fieldname)) ";
// to the nearest integer. Note that ROUND still returns a float type
// even though the value is an integer, so we need to cast it as well.
// (But the casting may round as well? If so the round is redundant.)
return " CAST(ROUND(DATE_PART('epoch', $fieldname)) AS integer) ";
}


Expand Down

0 comments on commit 9673264

Please sign in to comment.