Skip to content

PostgreSQL proxy: timestamp output adds trailing ".0" compared to native PostgreSQL #37437

@duerwuyi

Description

@duerwuyi

Bug Report

Which version of ShardingSphere did you use?

shardingsphere-proxy 5.5.2
postgres 17.6 as backend

Expected behavior

DROP TABLE IF EXISTS t1;
CREATE TABLE t1 (c8 TIMESTAMP);

INSERT INTO t1 VALUES ('1973-06-03 10:30:01'); -- no fractional seconds
SELECT c8 FROM t1;

should return (in native PG):

1973-06-03 10:30:01

Actual behavior

testdb=> CREATE TABLE t100 (c8 TIMESTAMP);
CREATE TABLE
testdb=> INSERT INTO t100 VALUES ('1973-06-03 10:30:01');
INSERT 0 1
testdb=> SELECT c8 FROM t100 ;
          c8           
-----------------------
 1973-06-03 10:30:01.0
(1 row)

The semantic value seems identical, but the textual representation differs and may break clients/tests relying on stable output formatting.

We guess the bug is related to Timestamp.toString() in java.sql.Timestamp.

Steps to reproduce the behavior, such as: SQL to execute, sharding rule configuration, when exception occur etc.

ss_postgres.zip

run docker compose up -d in this file.

SQL to execute are shown above

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions