Skip to content

Fix tuple comparison logic and record_le operator#2815

Open
AniruthKarthik wants to merge 1 commit into
dolthub:mainfrom
AniruthKarthik:fix-tuple-comparison-2807
Open

Fix tuple comparison logic and record_le operator#2815
AniruthKarthik wants to merge 1 commit into
dolthub:mainfrom
AniruthKarthik:fix-tuple-comparison-2807

Conversation

@AniruthKarthik
Copy link
Copy Markdown

This PR fixes issue #2807 where tuple comparisons (specifically greater-than) were returning incorrect results due to lexicographical comparison logic in CompareRecords.

Changes:

  • Fixed CompareRecords in server/compare/utils.go to correctly return false for < and > when element comparison determines it.
  • Fixed the final return value of CompareRecords to distinguish between equality-based and inequality-based operators.
  • Corrected record_le in server/functions/binary/less_equal.go to use the LessOrEqual operator.
  • Added a safety nil check in callComparisonFunction.
  • Added unit tests in server/compare/utils_test.go covering various comparison operators and NULL cases.

Fixes #2807

@AniruthKarthik AniruthKarthik force-pushed the fix-tuple-comparison-2807 branch from c540331 to fbf804d Compare June 6, 2026 07:27
@AniruthKarthik
Copy link
Copy Markdown
Author

@dolthub/doltgresql-maintainers @coffeegoddd Merge conflicts resolved and rebased. Ready for review!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

invalid tuple comparison

2 participants