Skip to content

fix: remove append -1 in case of empty string#8

Merged
Sarthak160 merged 2 commits intomasterfrom
null-fix
Oct 11, 2025
Merged

fix: remove append -1 in case of empty string#8
Sarthak160 merged 2 commits intomasterfrom
null-fix

Conversation

@Sarthak160
Copy link
Member

No description provided.

Copilot AI review requested due to automatic review settings October 11, 2025 17:29
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 PR fixes the handling of empty strings in the DataRow.Encode method to properly distinguish between NULL values and empty strings in PostgreSQL protocol encoding. The fix ensures that empty strings are encoded with length 0 rather than being treated as NULL values (length -1).

  • Removed commented-out debug and development code
  • Fixed empty string encoding logic to distinguish between NULL and empty values
  • Added clarifying comments for NULL vs empty string handling

Tip: Customize your code reviews with copilot-instructions.md. Create the file or learn how to get started.

Comment on lines +104 to +106
if len(v) > 0 {
dst = append(dst, v...)
}
Copy link

Copilot AI Oct 11, 2025

Choose a reason for hiding this comment

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

The length check len(v) > 0 is redundant since appending an empty slice is a no-op. This check can be removed to simplify the code without changing behavior.

Suggested change
if len(v) > 0 {
dst = append(dst, v...)
}
dst = append(dst, v...)

Copilot uses AI. Check for mistakes.
@Sarthak160 Sarthak160 merged commit d7fde9f into master Oct 11, 2025
2 checks passed
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.

1 participant