Skip to content

Conversation

@erikdubbelboer
Copy link
Member

Make sure to include ::numeric when comparing a jsonb field to a numeric scalar. This prevents us from getting:

  ERROR:  operator does not exist: text = numeric

Make sure to include ::numeric when comparing a jsonb field to a numeric
scalar. This prevents us from getting:
  ERROR:  operator does not exist: text = numeric
@erikdubbelboer erikdubbelboer requested a review from Copilot June 30, 2025 05:00
Copy link

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull Request Overview

This pull request enhances the handling of numeric scalars in JSONB field comparisons to prevent type mismatch errors in PostgreSQL. Key changes include:

  • Adding tests in converter_test.go to validate numeric comparisons on nested JSONB fields.
  • Updating converter.go to cast nested JSONB columns to numeric when comparing with numeric scalar values.

Reviewed Changes

Copilot reviewed 2 out of 2 changed files in this pull request and generated 1 comment.

File Description
filter/converter_test.go Added test cases for numeric comparisons using nested JSONB columns
filter/converter.go Introduced logic to cast JSONB columns to numeric to avoid PostgreSQL errors
Comments suppressed due to low confidence (2)

filter/converter.go:342

  • [nitpick] Currently, numeric comparisons in this branch are hardcoded to use the '=' operator; if other operators (e.g. '!=') should be supported for numeric columns, update this logic accordingly.
				if isNumeric(value) && c.isNestedColumn(key) {

filter/converter_test.go:429

  • Consider adding tests for numeric comparisons using non-equality operators (e.g. '!=') to ensure that all numeric operator cases for nested JSONB fields are properly handled.
			"numeric comparison with nested jsonb",

@erikdubbelboer erikdubbelboer merged commit a1eda5a into main Jul 2, 2025
8 checks passed
@erikdubbelboer erikdubbelboer deleted the better-numeric branch July 2, 2025 08:46
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants