citusdata/citus

sqlancer test fail with COLLATE used in string concatenation

Chiusa

#8469 aperta il 9 feb 2026

 (1 commento) (0 reazioni) (0 assegnatari)C (625 fork)batch import
buggood first issuesqlancer

Metriche repository

Star
 (9388 stelle)
Metriche merge PR
 (Merge medio 41g 2h) (16 PR mergiate in 30 g)

Descrizione

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.

Guida contributor