citusdata/citus

sqlancer test fail with COLLATE used in string concatenation

已關閉

#8,469 建立於 2026年2月9日

 (1 則留言) (0 個反應) (0 位負責人)C (625 個分叉)batch import
buggood first issuesqlancer

倉庫指標

星標
 (9,388 顆星)
PR 合併指標
 (平均合併 41天 2小時) (30 天內合併 16 個 PR)

描述

ERROR: attribute 1/2 of type record has wrong type --  Detail: Table has type text, but query expects character varying.

Reproducing the error at database10

  
CREATE TEMP TABLE t0(
c0 money ,
c1 inet ,
c2 DECIMAL  UNIQUE NOT NULL PRIMARY KEY,
c3 inet ,
EXCLUDE (c0 interval_minmax_ops DESC NULLS LAST WITH <>)
WHERE ((CAST(t0.c2 AS VARCHAR) SIMILAR TO (((('8' COLLATE "en_US.utf8"))||(t0.c0)) COLLATE "en_US.utf8"))), UNIQUE(c2, c0, c3, c1)) PARTITION BY LIST((0.6478838)timetz_minmax_multi_ops) ON COMMIT PRESERVE ROWS ;

...
CREATE TEMP TABLE IF NOT EXISTS t1(LIKE t0);

CREATE UNLOGGED TABLE t2(c0 boolean ) INHERITS(t1) USING heap;
CREATE UNLOGGED TABLE IF NOT EXISTS t2(LIKE t1);

SELECT create_distributed_table('t2', 'c0');
SELECT create_distributed_table('t3', 'c0');

(Please see the exact steps in attached database10.log file). database10.log

  
-- reproduces:

SELECT SUM(agg0)
FROM (
    SELECT ALL SUM(0.3888104409795754) as agg0
    FROM ONLY t3
    GROUP BY
        (((('fooText')||(t3.c1)))::VARCHAR COLLATE "C.utf8")
) as asdf;

ERROR:  attribute 2 of type record has wrong type
DETAIL:  Table has type text, but query expects character varying.
test=#



-- does not reproduce:

SELECT SUM(agg0)
FROM (
    SELECT ALL SUM(0.3888104409795754) as agg0
    FROM ONLY t3
    GROUP BY
        ((('fooText')||(t3.c1)))::VARCHAR
) as asdf;

        sum
--------------------
 3.8881044097957540
(1 row)

It looks like when COLLATE is used, conversion from text to VARCHAR cannot happen smoothly.

Note: This does not cause a problem in vanilla postgres.

貢獻者指南