apache / apache/shardingsphere
Support resolving more PostgreSQL datetime format in ShardingSphere-Proxy PostgreSQL
- Dominant language
- Java
- Stars
- 20.8k
- Forks
- 6.9k
- Avg merge
- 11h 38m
- Merged PRs (30d)
- 326
Description
## Enhancement
### Is your feature request related to a problem?
PostgreSQL datetime type has various format and special keywords (such as `epoch`, `tomorrow`, `today`, `infinity`).
* https://www.postgresql.org/docs/current/datatype-datetime.html
* https://github.com/postgres/postgres/blob/4f985aba6963b8669325e1c58585d04257977fda/src/backend/utils/adt/datetime.c#L1388-L1422
But ShardingSphere-Proxy only support parts of format.
First, ShardingSphere-Proxy try resolving format by DateTimeFormatter.
https://github.com/apache/shardingsphere/blob/a5bf03ce0c09e8ba37ed65ebadb7f900e3d08202/db-protocol/postgresql/src/main/java/org/apache/shardingsphere/db/protocol/postgresql/packet/command/query/extended/bind/protocol/PostgreSQLTextTimestampUtils.java#L37-L43
If DateTimeFormatter failed to resolve, fallback to PostgreSQL TimestampUtils.
https://github.com/apache/shardingsphere/blob/a5bf03ce0c09e8ba37ed65ebadb7f900e3d08202/db-protocol/postgresql/src/main/java/org/apache/shardingsphere/db/protocol/postgresql/packet/command/query/extended/bind/protocol/PostgreSQLTextTimestampUtils.java#L61
### Describe the feature you would like.
Support more datetime format of PostgreSQL in ShardingSphere-Proxy.
Contributor guide
Research direction
Start in db-protocol/postgresql/src/main/java/org/apache/shardingsphere/db/protocol/postgresql/packet/command/query/extended/bind/protocol/PostgreSQLTextTimestampUtils.java, especially the DateTimeFormatter path and TimestampUtils fallback. Compare their supported inputs with the PostgreSQL datetime documentation and referenced PostgreSQL source; done means additional PostgreSQL datetime formats and keywords resolve correctly in ShardingSphere-Proxy.
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
- 38/100