citus icon indicating copy to clipboard operation
citus copied to clipboard

Intermediate result has invalid oidvector data

Open naisila opened this issue 3 months ago • 2 comments

In the very peculiar case of including an oidvector type in a subquery that involves a distributed table:

-- dist_table is any distributed table
SELECT * FROM(
    SELECT
      (SELECT count(*) FROM dist_table),
      proargtypes
    FROM
      pg_catalog.pg_proc) as subq_0;

ERROR:  invalid oidvector data
DETAIL:  on server postgres@localhost:9701

Error coming from worker node:

NOTICE:  executing the command locally: SELECT count, proargtypes FROM
(SELECT intermediate_result.count, intermediate_result.proargtypes
FROM read_intermediate_result('111_2'::text, 'binary'::citus_copy_format)
intermediate_result(count bigint, proargtypes oidvector)) subq_0
ERROR:  invalid oidvector data

naisila avatar Aug 26 '25 14:08 naisila

For reference, this is the original SQLSMITH query:

select
   pg_catalog.json_build_array() as c0,
   subq_0.c7 as c1,
   cast(nullif(subq_0.c4,
     subq_0.c4) as int8) as c2,
   subq_0.c4 as c3
 from
   (select
         sample_0.prosrc as c0,
         (select outer_xid from pg_catalog.pg_dist_transaction limit 1 offset 4)
            as c1,
         sample_0.prorows as c2,
         sample_0.prosupport as c3,
         (select pg_catalog.sum(event_type) from public.events)
            as c4,
         sample_0.procost as c5,
         sample_0.prokind as c6,
         pg_catalog.numrange(
           cast(cast(null as "numeric") as "numeric"),
           cast((select pg_catalog.stddev(idx_blks_read) from pg_catalog.pg_statio_user_indexes)
              as "numeric")) as c7,
         sample_0.prosupport as c8,
         sample_0.protrftypes as c9,
         sample_0.proargtypes as c10,
         sample_0.prosqlbody as c11
       from
         pg_catalog.pg_proc as sample_0 tablesample system (3.5)
       where ((sample_0.proargdefaults is NULL)
           and ((select waitstart from pg_catalog.citus_locks limit 1 offset 51)
                <> (select event_time from public.events limit 1 offset 44)
               ))
         or (case when sample_0.proargnames is NULL then sample_0.prosecdef else sample_0.prosecdef end
              is not NULL)) as subq_0
 where subq_0.c1 = subq_0.c1
 limit 124

naisila avatar Aug 26 '25 14:08 naisila

Even reproduces on Citus 9.5.12.

onurctirtir avatar Sep 08 '25 15:09 onurctirtir