From da77b44057c953b494eb721a1e17d095946c86df Mon Sep 17 00:00:00 2001 From: Chris Lu Date: Tue, 21 Oct 2025 11:25:35 -0700 Subject: [PATCH 1/2] Fix 32-bit architecture build: use int64 for position variables On 32-bit architectures (like OpenBSD ARM), int is 32-bit and cannot hold math.MaxInt64. Changed lPos and rPos to int64 to fix overflow errors when building for GOOS=openbsd GOARCH=arm. --- pkg/util/tsearch/eval.go | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/pkg/util/tsearch/eval.go b/pkg/util/tsearch/eval.go index a1eaec7..8bb236b 100644 --- a/pkg/util/tsearch/eval.go +++ b/pkg/util/tsearch/eval.go @@ -168,9 +168,9 @@ func (e *tsEvaluator) evalFollowedBy( if lExhausted && rExhausted { break } - var lPos, rPos int + var lPos, rPos int64 if !lExhausted { - lPos = int(lPositions.positions[lIdx].position) + lOffset + lPos = int64(lPositions.positions[lIdx].position) + int64(lOffset) } else { // Quit unless we're outputting all of the RHS, which we will if we have // a negative match on the LHS. @@ -180,7 +180,7 @@ func (e *tsEvaluator) evalFollowedBy( lPos = math.MaxInt64 } if !rExhausted { - rPos = int(rPositions.positions[rIdx].position) + rOffset + rPos = int64(rPositions.positions[rIdx].position) + int64(rOffset) } else { // Quit unless we're outputting all of the LHS, which we will if we have // a negative match on the RHS. From c0df054a5b9e7407bf32d1f78ddbe9c3a7df7af2 Mon Sep 17 00:00:00 2001 From: Chris Lu Date: Tue, 21 Oct 2025 11:27:48 -0700 Subject: [PATCH 2/2] Fix 32-bit architecture build: use int64 for flag types On 32-bit architectures, EncodeFlags and FmtFlags need to be int64 to accommodate large bit shift operations that exceed 32 bits. This fixes overflow errors when building for GOOS=openbsd GOARCH=arm. --- pkg/sql/lexbase/encode.go | 2 +- pkg/sql/sem/tree/format.go | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/pkg/sql/lexbase/encode.go b/pkg/sql/lexbase/encode.go index 5b31fd0..3980fc3 100644 --- a/pkg/sql/lexbase/encode.go +++ b/pkg/sql/lexbase/encode.go @@ -23,7 +23,7 @@ import ( ) // EncodeFlags influence the formatting of strings and identifiers. -type EncodeFlags int +type EncodeFlags int64 // HasFlags tests whether the given flags are set. func (f EncodeFlags) HasFlags(subset EncodeFlags) bool { diff --git a/pkg/sql/sem/tree/format.go b/pkg/sql/sem/tree/format.go index df15c15..ded254a 100644 --- a/pkg/sql/sem/tree/format.go +++ b/pkg/sql/sem/tree/format.go @@ -22,7 +22,7 @@ import ( ) // FmtFlags carries options for the pretty-printer. -type FmtFlags int +type FmtFlags int64 // HasFlags tests whether the given flags are all set. func (f FmtFlags) HasFlags(subset FmtFlags) bool {