Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

A logic bug about pg_catalog.gin_cmp_tslexeme in citus 13.0.1 #7895

Open
duerwuyi opened this issue Feb 7, 2025 · 0 comments
Open

A logic bug about pg_catalog.gin_cmp_tslexeme in citus 13.0.1 #7895

duerwuyi opened this issue Feb 7, 2025 · 0 comments

Comments

@duerwuyi
Copy link

duerwuyi commented Feb 7, 2025

How to reproduce

Citus version: Citus 13.0.1 on x86_64-pc-linux-gnu, compiled by gcc (Debian 12.2.0-14) 12.2.0, 64-bit
Postgres version: PostgreSQL 17.2 (Debian 17.2-1.pgdg120+1) on x86_64-pc-linux-gnu, compiled by gcc (Debian 12.2.0-14) 12.2.0, 64-bit

the bug is found by a revised edition of sqlsmith, so may be weird and hard to reproduce and minimize manually. I will provide the whole log to help reproducing it.

init state:

DROP TABLE IF EXISTS t0;
create table t0 ( 
vkey int4 ,
pkey int4 ,
c0 numeric ,
c1 text ,
c2 numeric ,
c3 timestamp ,
c4 int4 ,
c5 text ,
c6 int4 ,
c7 numeric ,
c8 int4 

);
DROP TABLE IF EXISTS t1;
create table t1 ( 
vkey int4 ,
pkey int4 ,
c9 int4 

);
DROP TABLE IF EXISTS t2;
create table t2 ( 
vkey int4 ,
pkey int4 ,
c10 text ,
c11 text ,
c12 int4 ,
c13 timestamp ,
c14 timestamp ,
c15 timestamp 

);
DROP TABLE IF EXISTS t3;
create table t3 ( 
vkey int4 ,
pkey int4 ,
c16 timestamp ,
c17 int4 ,
c18 text ,
c19 text ,
c20 text ,
c21 timestamp 

);
DROP TABLE IF EXISTS t4;
create table t4 ( 
vkey int4 ,
pkey int4 ,
c22 int4 ,
c23 int4 ,
c24 text ,
c25 numeric ,
c26 int4 ,
c27 timestamp ,
c28 timestamp ,
c29 numeric ,
c30 text 

);
DROP TABLE IF EXISTS t5;
create table t5 ( 
vkey int4 ,
pkey int4 ,
c31 text ,
c32 timestamp ,
c33 text ,
c34 timestamp ,
c35 numeric ,
c36 int4 ,
c37 text ,
c38 timestamp 

);
DROP TABLE IF EXISTS t6;
create table t6 ( 
vkey int4 ,
pkey int4 ,
c39 int4 ,
c40 numeric ,
c41 text ,
c42 numeric ,
c43 numeric 

);
DROP TABLE IF EXISTS t7;
create table t7 ( 
vkey int4 ,
pkey int4 ,
c44 int4 ,
c45 text ,
c46 numeric ,
c47 timestamp ,
c48 int4 ,
c49 text ,
c50 int4 ,
c51 int4 ,
c52 numeric 

);



insert into t4 (vkey, pkey, c22, c23, c24, c25, c26, c27, c28, c29, c30) values 
(1, 11000, -30, 2, ',:eQ<', 0.0, -99, make_timestamp(1983, 5, 3, 12, 41, 6), make_timestamp(2039, 2, 19, 6, 41, 45), 56.100, 'E');
create index i0 on t1 (pkey desc);
insert into t0 (vkey, pkey, c0, c1, c2, c3, c4, c5, c6, c7, c8) values
(2, 12000, -36.77, 'b-G;', -45.7, make_timestamp(2083, 1, 21, 22, 53, 11), -0, 'D9-Q', -0, -65.80, -0);
insert into t3 (vkey, pkey, c16, c17, c18, c19, c20, c21) values
(3, 13000, make_timestamp(1989, 9, 22, 4, 22, 32), 21, '.0', '5&sG9', '8', make_timestamp(2066, 7, 10, 18, 7, 8));
insert into t4 (vkey, pkey, c22, c23, c24, c25, c26, c27, c28, c29, c30) values
(4, 14000, -0, -39, 'aLK?;', -57.30, 51, make_timestamp(2041, 3, 6, 11, 51, 28), make_timestamp(2089, 8, 8, 4, 20, 54), -0.0, '9M');
insert into t4 (vkey, pkey, c22, c23, c24, c25, c26, c27, c28, c29, c30) values
(5, 15000, -56, -66, 'V', 24.46, 16, make_timestamp(1986, 5, 19, 11, 36, 51), make_timestamp(2033, 5, 1, 16, 21, 4), -0.0, 'wP2#');
insert into t2 (vkey, pkey, c10, c11, c12, c13, c14, c15) values
(6, 16000, '', '', 45, make_timestamp(2049, 1, 6, 3, 48, 50), make_timestamp(1974, 8, 24, 17, 55, 50), make_timestamp(2047, 1, 19, 15, 17, 53));
insert into t0 (vkey, pkey, c0, c1, c2, c3, c4, c5, c6, c7, c8) values
(7, 17000, -53.87, '.n=', -0.0, make_timestamp(2038, 9, 23, 21, 23, 43), -27, 'ek', -25, 55.8, -52);
insert into t3 (vkey, pkey, c16, c17, c18, c19, c20, c21) values
(8, 18000, make_timestamp(2068, 2, 1, 23, 0, 30), -27, 'f:X', '', 'MtH', make_timestamp(1989, 3, 4, 17, 52, 6));
insert into t4 (vkey, pkey, c22, c23, c24, c25, c26, c27, c28, c29, c30) values
(9, 19000, -75, 0, 'FV?', -52.63, -0, make_timestamp(2103, 8, 11, 14, 6, 20), make_timestamp(2069, 4, 5, 14, 52, 44), 0.0, '(N{X^');
insert into t5 (vkey, pkey, c31, c32, c33, c34, c35, c36, c37, c38) values
(10, 20000, '', make_timestamp(2032, 7, 20, 3, 33, 21), 'P(J', make_timestamp(2102, 6, 13, 17, 29, 10), 0.0, -69, 'R^', make_timestamp(2028, 2, 23, 17, 23, 48));
insert into t6 (vkey, pkey, c39, c40, c41, c42, c43) values
(11, 21000, -78, -0.0, '-t', 19.53, 66.17);
insert into t3 (vkey, pkey, c16, c17, c18, c19, c20, c21) values
(12, 22000, make_timestamp(2101, 10, 1, 12, 59, 5), -0, 'W]:uA', 'JVma', '', make_timestamp(2057, 6, 12, 12, 15, 50));
insert into t7 (vkey, pkey, c44, c45, c46, c47, c48, c49, c50, c51, c52) values
(13, 23000, -75, '/W+0', -100.18, make_timestamp(2031, 10, 20, 18, 2, 12), -0, '', 32, -78, -60.1);
insert into t3 (vkey, pkey, c16, c17, c18, c19, c20, c21) values
(14, 24000, make_timestamp(2071, 10, 7, 19, 4, 59), 74, 'xaH[', '8', '7', make_timestamp(2019, 2, 17, 8, 7, 1));
insert into t2 (vkey, pkey, c10, c11, c12, c13, c14, c15) values
(15, 25000, 'hm', 'f.(', -98, make_timestamp(1984, 6, 17, 4, 32, 2), make_timestamp(1971, 11, 2, 22, 53, 58), make_timestamp(2088, 11, 21, 3, 40, 43));
insert into t6 (vkey, pkey, c39, c40, c41, c42, c43) values
(16, 26000, 76, -84.87, '&HAo', -85.69, -15.92);
create index i1 on t1 (pkey desc);
insert into t2 (vkey, pkey, c10, c11, c12, c13, c14, c15) values
(17, 27000, 'ISVl', 'HJ', 0, make_timestamp(1977, 5, 14, 4, 22, 58), make_timestamp(2067, 12, 8, 22, 22, 47), make_timestamp(2049, 3, 20, 1, 41, 27));
insert into t4 (vkey, pkey, c22, c23, c24, c25, c26, c27, c28, c29, c30) values
(18, 28000, -0, 13, '', -58.73, -0, make_timestamp(2085, 11, 25, 4, 48, 29), make_timestamp(2104, 9, 13, 15, 36, 9), 32.95, '[a]79');
insert into t2 (vkey, pkey, c10, c11, c12, c13, c14, c15) values
(19, 29000, 'F.', 'aRq', -71, make_timestamp(2063, 4, 16, 11, 57, 0), make_timestamp(2065, 10, 3, 10, 46, 42), make_timestamp(2062, 2, 26, 23, 29, 35));
insert into t2 (vkey, pkey, c10, c11, c12, c13, c14, c15) values
(20, 30000, ':T$', '', -53, make_timestamp(2001, 11, 27, 12, 32, 30), make_timestamp(1977, 7, 11, 22, 31, 53), make_timestamp(2027, 10, 9, 16, 38, 35));
insert into t3 (vkey, pkey, c16, c17, c18, c19, c20, c21) values
(21, 31000, make_timestamp(2033, 9, 15, 6, 7, 59), 47, '^:Z', 'fa5/e', '5KYT9', make_timestamp(2094, 4, 16, 9, 53, 55));
insert into t5 (vkey, pkey, c31, c32, c33, c34, c35, c36, c37, c38) values
(22, 32000, '-94?H', make_timestamp(2030, 1, 16, 14, 37, 12), ']!@}2', make_timestamp(2007, 12, 17, 18, 17, 26), 92.12, 0, 'Lkk', make_timestamp(1971, 9, 16, 2, 28, 31));   
insert into t7 (vkey, pkey, c44, c45, c46, c47, c48, c49, c50, c51, c52) values
(23, 33000, -18, '5t', 41.32, make_timestamp(2066, 6, 1, 19, 56, 58), -23, 'B~', 92, -98, 41.27);
insert into t3 (vkey, pkey, c16, c17, c18, c19, c20, c21) values
(24, 34000, make_timestamp(2047, 6, 28, 22, 37, 10), -11, 'F', 'luQ', 'w5=', make_timestamp(1987, 5, 14, 13, 43, 20));
insert into t2 (vkey, pkey, c10, c11, c12, c13, c14, c15) values
(25, 35000, 'I', '', 30, make_timestamp(2011, 3, 4, 0, 42, 41), make_timestamp(2077, 2, 21, 16, 13, 53), make_timestamp(1976, 5, 21, 21, 38, 36));
insert into t0 (vkey, pkey, c0, c1, c2, c3, c4, c5, c6, c7, c8) values
(26, 36000, 0.0, '', -0.0, make_timestamp(1995, 7, 4, 3, 31, 29), 85, '`', 44, 79.13, -97);
insert into t4 (vkey, pkey, c22, c23, c24, c25, c26, c27, c28, c29, c30) values
(27, 37000, -73, 17, '{:', 0.0, 0, make_timestamp(2028, 5, 15, 2, 45, 9), make_timestamp(2069, 4, 15, 22, 1, 47), 74.49, '');
insert into t0 (vkey, pkey, c0, c1, c2, c3, c4, c5, c6, c7, c8) values
(28, 38000, 87.31, '', -65.12, make_timestamp(2009, 9, 14, 7, 4, 34), -0, 'G)T8-', 48, -34.48, -53);
insert into t6 (vkey, pkey, c39, c40, c41, c42, c43) values
(29, 39000, -56, 66.78, '=857N', -23.8, 0.0);
insert into t6 (vkey, pkey, c39, c40, c41, c42, c43) values
(30, 40000, 0, -0.0, '{MI', 73.99, -82.93);
insert into t7 (vkey, pkey, c44, c45, c46, c47, c48, c49, c50, c51, c52) values
(31, 41000, -17, '**', -88.55, make_timestamp(2026, 11, 21, 8, 52, 14), -79, 'w', 44, -12, 0.0);
insert into t6 (vkey, pkey, c39, c40, c41, c42, c43) values
(32, 42000, -0, 38.70, 'Y^.E', 44.94, -74.28);
insert into t6 (vkey, pkey, c39, c40, c41, c42, c43) values
(33, 43000, -42, -79.84, '+', -60.66, 29.91);
insert into t0 (vkey, pkey, c0, c1, c2, c3, c4, c5, c6, c7, c8) values
(34, 44000, -60.86, '/*J', 4.17, make_timestamp(1973, 9, 4, 5, 49, 7), 38, 'm,', 6, 29.82, -60);
insert into t3 (vkey, pkey, c16, c17, c18, c19, c20, c21) values
(35, 45000, make_timestamp(1980, 12, 25, 23, 2, 7), -77, '2byM', ' /g', '9]K', make_timestamp(2088, 9, 8, 5, 51, 4));
insert into t7 (vkey, pkey, c44, c45, c46, c47, c48, c49, c50, c51, c52) values
(36, 46000, 0, 'uS<?', -0.0, make_timestamp(2017, 3, 27, 22, 50, 35), 68, '9TIO?', 0, 0, 0.0);
insert into t6 (vkey, pkey, c39, c40, c41, c42, c43) values
(37, 47000, -0, -0.0, ':A', 23.41, 0.0);
insert into t6 (vkey, pkey, c39, c40, c41, c42, c43) values
(38, 48000, -92, 10.13, ']', -21.99, -0.0);
insert into t5 (vkey, pkey, c31, c32, c33, c34, c35, c36, c37, c38) values
(39, 49000, 'P|jS', make_timestamp(2039, 1, 22, 8, 54, 47), '', make_timestamp(2055, 4, 5, 21, 34, 33), -56.100, -0, 'j', make_timestamp(1985, 7, 26, 14, 7, 36));
insert into t1 (vkey, pkey, c9) values
(40, 50000, -0);
insert into t1 (vkey, pkey, c9) values
(41, 51000, -0);
insert into t0 (vkey, pkey, c0, c1, c2, c3, c4, c5, c6, c7, c8) values
(42, 52000, 83.51, 'st?', 0.0, make_timestamp(2050, 5, 10, 20, 18, 29), 38, '', -27, -27.74, -70);
create index i2 on t3 (c17 desc);
insert into t6 (vkey, pkey, c39, c40, c41, c42, c43) values
(43, 53000, 34, -0.0, '', -41.95, -1.77);
insert into t1 (vkey, pkey, c9) values
(44, 54000, -0);
insert into t3 (vkey, pkey, c16, c17, c18, c19, c20, c21) values
(45, 55000, make_timestamp(2025, 8, 18, 8, 5, 13), -99, '', 'SF/', '', make_timestamp(2091, 9, 11, 17, 29, 18));
insert into t4 (vkey, pkey, c22, c23, c24, c25, c26, c27, c28, c29, c30) values
(46, 56000, 77, 0, '|', -0.0, 6, make_timestamp(2077, 12, 15, 18, 28, 13), make_timestamp(2078, 4, 5, 20, 26, 48), 24.59, ' ');
insert into t6 (vkey, pkey, c39, c40, c41, c42, c43) values
(47, 57000, -0, -70.30, 'M>', 0.0, -0.0);
insert into t4 (vkey, pkey, c22, c23, c24, c25, c26, c27, c28, c29, c30) values
(48, 58000, 82, 63, ']1', -22.1, -0, make_timestamp(1993, 2, 14, 18, 39, 53), make_timestamp(2005, 11, 13, 17, 42, 46), 0.0, '/ifC(');
insert into t1 (vkey, pkey, c9) values
(49, 59000, 92);
insert into t5 (vkey, pkey, c31, c32, c33, c34, c35, c36, c37, c38) values
(50, 60000, 'C', make_timestamp(2091, 6, 6, 21, 10, 6), 'xuK ', make_timestamp(2104, 10, 15, 15, 56, 54), 79.32, 0, ':,njo', make_timestamp(2022, 6, 2, 22, 44, 42));        
insert into t4 (vkey, pkey, c22, c23, c24, c25, c26, c27, c28, c29, c30) values
(51, 61000, -0, -0, 'x?q59', -91.14, 0, make_timestamp(2059, 1, 10, 9, 12, 38), make_timestamp(2092, 4, 8, 9, 21, 15), 55.65, 'X');
insert into t3 (vkey, pkey, c16, c17, c18, c19, c20, c21) values
(52, 62000, make_timestamp(1981, 5, 3, 6, 36, 30), 12, '<4', 'j', '', make_timestamp(2085, 7, 4, 5, 19, 12));
insert into t7 (vkey, pkey, c44, c45, c46, c47, c48, c49, c50, c51, c52) values
(53, 63000, 0, 'Q', -4.23, make_timestamp(1982, 4, 25, 1, 58, 25), -0, '', -83, 11, 29.24);
insert into t2 (vkey, pkey, c10, c11, c12, c13, c14, c15) values
(54, 64000, '', 't', -0, make_timestamp(2068, 11, 23, 7, 43, 39), make_timestamp(1972, 12, 13, 21, 13, 47), make_timestamp(2097, 3, 1, 11, 11, 34));
insert into t2 (vkey, pkey, c10, c11, c12, c13, c14, c15) values
(55, 65000, 'gC{', '|O1-', -0, make_timestamp(2093, 11, 4, 23, 50, 47), make_timestamp(2059, 11, 14, 11, 43, 24), make_timestamp(1982, 5, 15, 5, 0, 39));
insert into t0 (vkey, pkey, c0, c1, c2, c3, c4, c5, c6, c7, c8) values
(56, 66000, -51.1, 'q 4X', 46.70, make_timestamp(2079, 8, 23, 7, 13, 14), -9, ']', 0, 53.55, -0);
insert into t3 (vkey, pkey, c16, c17, c18, c19, c20, c21) values
(57, 67000, make_timestamp(2051, 11, 7, 10, 44, 21), 87, '', '', 'p3 ', make_timestamp(2019, 9, 15, 20, 42, 50));
insert into t5 (vkey, pkey, c31, c32, c33, c34, c35, c36, c37, c38) values
(58, 68000, '', make_timestamp(2092, 9, 11, 2, 22, 52), '', make_timestamp(1972, 8, 25, 18, 12, 59), 97.42, 25, '^|', make_timestamp(1981, 7, 2, 6, 1, 1));
insert into t5 (vkey, pkey, c31, c32, c33, c34, c35, c36, c37, c38) values
(59, 69000, '', make_timestamp(2081, 12, 9, 9, 49, 57), '5p', make_timestamp(2024, 11, 9, 21, 2, 15), -12.98, -80, '6', make_timestamp(2096, 10, 17, 2, 17, 24));
insert into t1 (vkey, pkey, c9) values
(60, 70000, -75);
insert into t7 (vkey, pkey, c44, c45, c46, c47, c48, c49, c50, c51, c52) values
(61, 71000, -0, '9uYeB', -0.0, make_timestamp(2105, 5, 28, 0, 4, 42), 57, 'r>', 0, 41, -0.0);
insert into t0 (vkey, pkey, c0, c1, c2, c3, c4, c5, c6, c7, c8) values
(62, 72000, -1.99, ')', 56.28, make_timestamp(1992, 11, 17, 6, 44, 26), -1, 'y)', -0, 0.0, 0);
insert into t7 (vkey, pkey, c44, c45, c46, c47, c48, c49, c50, c51, c52) values
(63, 73000, 4, 'o*U0', -0.0, make_timestamp(2061, 6, 1, 20, 32, 34), -62, 'pm*[?', 0, -36, 64.8);
insert into t5 (vkey, pkey, c31, c32, c33, c34, c35, c36, c37, c38) values
(64, 74000, 'q0B2W', make_timestamp(2056, 1, 9, 12, 47, 57), 'VTa9G', make_timestamp(2058, 4, 17, 15, 34, 29), -27.54, -51, '38SM@', make_timestamp(2090, 4, 17, 2, 4, 36)); 
insert into t7 (vkey, pkey, c44, c45, c46, c47, c48, c49, c50, c51, c52) values
(65, 75000, -78, '-WE?o', -0.0, make_timestamp(2047, 11, 27, 11, 25, 12), -0, '', 0, 31, -0.0);
insert into t2 (vkey, pkey, c10, c11, c12, c13, c14, c15) values
(66, 76000, '[><cF', 'j@Kz', 0, make_timestamp(2070, 7, 7, 7, 26, 53), make_timestamp(2091, 2, 24, 22, 50, 40), make_timestamp(1987, 3, 10, 5, 55, 7));
insert into t2 (vkey, pkey, c10, c11, c12, c13, c14, c15) values
(67, 77000, '(5!$/', 'F80c', -0, make_timestamp(2022, 5, 3, 12, 28, 30), make_timestamp(2042, 1, 11, 5, 1, 5), make_timestamp(2015, 3, 28, 15, 5, 49));
insert into t7 (vkey, pkey, c44, c45, c46, c47, c48, c49, c50, c51, c52) values
(68, 78000, -13, 'ylB<C', -64.7, make_timestamp(2066, 12, 18, 12, 48, 40), -0, 'ao', 0, 0, -0.0);
insert into t0 (vkey, pkey, c0, c1, c2, c3, c4, c5, c6, c7, c8) values
(69, 79000, 60.72, '', 46.77, make_timestamp(2073, 9, 17, 12, 52, 53), 0, '<l', 3, -0.0, 55);
create index i4 on t3 (c17 desc, c21 asc, c18 desc, c19  , pkey asc, c20 asc, vkey  , c16 desc);
insert into t0 (vkey, pkey, c0, c1, c2, c3, c4, c5, c6, c7, c8) values
(70, 80000, -45.80, '', -0.0, make_timestamp(2025, 5, 8, 1, 22, 9), -37, ')UA', 0, 0.0, 0);
insert into t0 (vkey, pkey, c0, c1, c2, c3, c4, c5, c6, c7, c8) values
(71, 81000, -74.65, ')Nw$', 12.55, make_timestamp(2105, 6, 18, 12, 49, 4), 89, 'r`>', 20, -26.83, -0);
insert into t6 (vkey, pkey, c39, c40, c41, c42, c43) values
(72, 82000, -78, -12.6, 'R', 55.18, -78.80);
insert into t5 (vkey, pkey, c31, c32, c33, c34, c35, c36, c37, c38) values
(73, 83000, '', make_timestamp(1973, 7, 25, 15, 5, 42), 'E~?w', make_timestamp(2094, 4, 21, 11, 26, 37), 97.98, -46, '9zY9o', make_timestamp(2054, 2, 21, 11, 32, 16));      
insert into t6 (vkey, pkey, c39, c40, c41, c42, c43) values
(74, 84000, 71, -0.0, '=', -5.4, 45.72);
insert into t1 (vkey, pkey, c9) values
(75, 85000, -65);
insert into t5 (vkey, pkey, c31, c32, c33, c34, c35, c36, c37, c38) values
(76, 86000, 'VR', make_timestamp(2033, 12, 2, 20, 48, 11), ':', make_timestamp(2012, 1, 11, 20, 14, 4), 43.81, -93, 'js$', make_timestamp(2017, 10, 13, 21, 0, 23));
insert into t3 (vkey, pkey, c16, c17, c18, c19, c20, c21) values
(77, 87000, make_timestamp(1986, 12, 24, 4, 19, 3), 34, '7', '', 'SmD', make_timestamp(2072, 2, 24, 23, 50, 8));
insert into t7 (vkey, pkey, c44, c45, c46, c47, c48, c49, c50, c51, c52) values
(78, 88000, -77, ']g', -44.47, make_timestamp(1996, 6, 9, 13, 56, 29), -64, '', -34, -69, 55.8);
insert into t5 (vkey, pkey, c31, c32, c33, c34, c35, c36, c37, c38) values
(79, 89000, '2wU6T', make_timestamp(2005, 3, 15, 17, 46, 59), 'A2R^V', make_timestamp(2011, 4, 19, 23, 7, 14), -91.58, -100, ':z', make_timestamp(1978, 10, 11, 20, 32, 46));
insert into t2 (vkey, pkey, c10, c11, c12, c13, c14, c15) values
(80, 90000, ':4', 'vs?W', -0, make_timestamp(2064, 3, 10, 12, 45, 38), make_timestamp(2080, 6, 27, 6, 47, 1), make_timestamp(2093, 3, 5, 18, 24, 51));
insert into t0 (vkey, pkey, c0, c1, c2, c3, c4, c5, c6, c7, c8) values
(81, 91000, -36.84, '9|vDY', 37.31, make_timestamp(2026, 7, 11, 5, 58, 54), 49, 'PN*', 88, -0.0, -86);

query:

select  
  ref_0.c42 as c_0, 
  ref_0.c39 as c_1, 
  ref_0.pkey as c_2, 
  ref_0.vkey as c_3, 
  ref_0.c43 as c_4, 
  pg_catalog.text_lt((select c24 from t4 order by c24 limit 1 offset 73)
        ,
      (select pg_catalog.max(c41) from t6)
        )
     as c_5, 
  (select pg_catalog.stddev_pop(c46) from t7)
     as c_6, 
  (select c24 from t4 order by c24 limit 1 offset 6)
     as c_7, 
  (ref_0.vkey) < (ref_0.pkey) as c_8, 
  ref_0.c42 as c_9, 
  ref_0.c41 as c_10
from 
  t6 as ref_0
where (pg_catalog.gin_cmp_tslexeme(ref_0.c41,
    (select c18 from t3 order by c18 limit 1 offset 4)
      )) < ((select vkey from t1 order by vkey limit 1 offset 1)
    )
order by c_0 desc, c_1 desc, c_2 desc, c_3 asc, c_4 desc,
 c_5 desc, c_6 asc, c_7 asc, c_8 desc, c_9 desc, c_10 asc

Excepted result:

result: 11 rows updated

Image

Citus result:

when I use citus to create some distributed or reference table, I got a different result:

SELECT create_reference_table('t5');
SELECT create_reference_table('t6');
SELECT create_reference_table('t1');
SELECT create_distributed_table('t4', 'c25', shard_count:=49);
SELECT create_reference_table('t0');
SELECT create_distributed_table('t7', 'c47', shard_count:=43);

then the query returns 10 rows:

Image

the core of the query is function: pg_catalog.gin_cmp_tslexeme, and the result will be same if it was removed. I guess that this function may have some wrongly interaction with citus.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants