apache / apache/shardingsphere

Implement write methods that are not yet supported in PostgreSQLBinaryProtocolValue

Open
#35,830 3 comments 0 reactions 0 assignees View on GitHub
db: PostgreSQL in: protocol in: proxy type: enhancement
Dominant language
Java
Stars
20.8k
Forks
6.9k
Avg merge
11h 38m
Merged PRs (30d)
326

Description

`PostgreSQLBinaryProtocolValue` is an interface for handling `Binary` type data in the PostgreSQL protocol, and currently has 21 implementation classes.

Image

---

However, some `write` methods have not been implemented, which needs to be improved.
For example:

```java
public final class PostgreSQLBoolBinaryProtocolValue implements PostgreSQLBinaryProtocolValue {

@Override
public int getColumnLength(final Object value) {
return 1;
}

@Override
public Object read(final PostgreSQLPacketPayload payload, final int parameterValueLength) {
return payload.getByteBuf().readBoolean();
}

@Override
public void write(final PostgreSQLPacketPayload payload, final Object value) {
throw new UnsupportedSQLOperationException("PostgreSQLBoolBinaryProtocolValue.write()");
}
}
```

### task list
- [ ] PostgreSQLBoolArrayBinaryProtocolValue
- [x] PostgreSQLBoolBinaryProtocolValue
- [ ] PostgreSQLFloat4ArrayBinaryProtocolValue
- [ ] PostgreSQLFloat8ArrayBinaryProtocolValue
- [ ] PostgreSQLInt2ArrayBinaryProtocolValue
- [ ] PostgreSQLInt4ArrayBinaryProtocolValue
- [ ] PostgreSQLInt8ArrayBinaryProtocolValue
- [ ] PostgreSQLArrayParameterDecoder
- [ ] PostgreSQLTextArrayBinaryProtocolValue
- [x] PostgreSQLUnspecifiedBinaryProtocolValue

### Note:
PostgreSQL supports text and binary data transfer. PostgreSQL drivers used by different development languages ​​may choose different way.
These binary write methods may not be triggered by JDBC clients and need to be verified using other clients.

Contributor guide

Open the contributing guide

Research direction

Review the PostgreSQLBinaryProtocolValue implementations and the unchecked entries in the task list, including the array value classes and PostgreSQLArrayParameterDecoder. Compare their existing read and getColumnLength behavior before determining the corresponding write behavior. Done means the listed unsupported write methods are implemented and verified with clients that use binary transfer, since JDBC clients may not trigger them.

Written by the indexing model from the issue text.

Assessment

Tech stack
java, postgresql
Domain
databases
Issue type
Feature
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
45/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.