Skip to content

[YSQL] Unexpected truncated data returned by MAX() #26620

@bajinsheng

Description

@bajinsheng

Jira Link: DB-15997

Description

Please see this test case:

CREATE TABLE t1(c0 CHAR(100));
INSERT INTO t1(c0) VALUES('a');
SELECT MAX(t1.c0) FROM t1;

The query returns the column with truncated data:

 max 
-----
 a
(1 row)

While the data type is CHAR(100), based on the doc, I believe the returned data should not be truncated.

To further explore this issue, I ran the same query on PostgreSQL, and it returned:

                                                 max                                                  
------------------------------------------------------------------------------------------------------
 a                                                                                                   
(1 row)

I also ran another query SELECT t1.c0 FROM t1 on YugabyteDB, and the result is also expected:

                                                  c0                                                  
------------------------------------------------------------------------------------------------------
 a                                                                                                   
(1 row)

Version:

                                                                                         version                                                                                         
-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
 PostgreSQL 15.2-YB-2.25.1.0-b0 on x86_64-pc-linux-gnu, compiled by clang version 17.0.6 (https://github.com/yugabyte/llvm-project.git 9b881774e40024e901fc6f3d313607b071c08631), 64-bit
(1 row)

Issue Type

kind/bug

Warning: Please confirm that this issue does not contain any sensitive information

  • I confirm this issue does not contain any sensitive information.

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions