diff --git a/core/filter_api.php b/core/filter_api.php
index f8de0f8..75f0dc2 100644
--- a/core/filter_api.php
+++ b/core/filter_api.php
@@ -1956,7 +1956,14 @@ function filter_get_bug_rows( &$p_page_number, &$p_per_page, &$p_page_count, &$p
 			$t_where_params[] = $c_search;
 			$t_where_params[] = $c_search;
 
-			if( is_numeric( $t_search_term ) ) {
+			// PostgreSQL on 64-bit OS hack (see #14014)
+			if( PHP_INT_MAX > 0x7FFFFFFF && db_is_pgsql() ) {
+				$t_search_max = 0x7FFFFFFF;
+			} else {
+				$t_search_max = PHP_INT_MAX;
+			}
+			// Note: no need to test negative values, '-' sign is removed above
+			if( is_numeric( $t_search_term ) && $t_search_term <= $t_search_max ) {
 				$c_search_int = (int) $t_search_term;
 				$t_textsearch_where_clause .= " OR $t_bug_table.id = " . db_param();
 				$t_textsearch_where_clause .= " OR $t_bugnote_table.id = " . db_param();
