Skip to content

Implement write method in PostgreSQLBoolBinaryProtocolValue#35831

Merged
yx9o merged 2 commits intoapache:masterfrom
RaigorJiang:pg-protocol
Jun 28, 2025
Merged

Implement write method in PostgreSQLBoolBinaryProtocolValue#35831
yx9o merged 2 commits intoapache:masterfrom
RaigorJiang:pg-protocol

Conversation

@RaigorJiang
Copy link
Contributor

@RaigorJiang RaigorJiang commented Jun 28, 2025

For #35830.

Test method:

  1. Create a table with a bool column in PostgreSQL
CREATE TABLE IF NOT EXISTS member_summary (
    mid VARCHAR(9) PRIMARY KEY,
    nickname VARCHAR(63),
    previous_champions_season_id BIGINT NOT NULL,
    previous_champions_tier_id  BIGINT NOT NULL,
    account_level BIGINT NOT NULL,
    profile_id BIGINT NOT NULL,
    hide_champions_raid_tier_border boolean NOT NULL,
    title_id BIGINT NOT NULL,
    block_party_invite boolean NOT NULL
);
  1. Insert some records
  2. Use the Go client to query the bool column through Proxy
SELECT mid, hide_champions_raid_tier_border, title_id, block_party_invite from member_summary where mid = $1

Before

image

After

image

FAQ

  • Why not use the Boolean.parseBoolean() method?
    Because Boolean.parseBoolean() only matches the case where the string is "true", and the default bool output by PostgreSQL is a single character "t" or "f";

image

If the output format is specified using ::TEXT or ::INT, the type does not meet the Binary type and will not be processed by PostgreSQLBoolBinaryProtocolValue.

Therefore, PostgreSQLBoolBinaryProtocolValue only needs to process the cases of "t" or "f".

@yx9o yx9o merged commit 6356727 into apache:master Jun 28, 2025
147 checks passed
@RaigorJiang RaigorJiang deleted the pg-protocol branch June 28, 2025 08:23
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.

2 participants