citusdata / citusdata/citus

Binary protocol for Function call delegation with ENUM types fail

Open
#3,969 0 comments 0 reactions 0 assignees View on GitHub
bug
Dominant language
C
Stars
12.8k
Forks
794
Avg merge
2d 14h
Merged PRs (30d)
31

Description

```SQL
create type mx_call_enum as enum ('A', 'S', 'D', 'F');

create table mx_call_dist_table_enum(id int, key mx_call_enum);
select create_distributed_table('mx_call_dist_table_enum', 'key');
insert into mx_call_dist_table_enum values (1,'S'),(2,'A'),(3,'D'),(4,'F');

CREATE FUNCTION mx_call_func_custom_types(INOUT x mx_call_enum, INOUT y mx_call_enum)
LANGUAGE plpgsql AS $$
BEGIN
y := x;
x := (select case groupid when 0 then 'F' else 'S' end from pg_dist_local_group);
END;$$;

select create_distributed_function('mx_call_func_custom_types(mx_call_enum, mx_call_enum)', '$1', 'mx_call_dist_table_enum');

set citus.enable_binary_protocol TO OFF;

select mx_call_func_custom_types('S', 'A');
DEBUG: pushing down the function call
mx_call_func_custom_types
---------------------------
(S,S)
(1 row)

set citus.enable_binary_protocol TO ON;
select mx_call_func_custom_types('S', 'A');
DEBUG: pushing down the function call
ERROR: wrong data type: 33462, expected 65646

```

Contributor guide

Open the contributing guide

Research direction

Start by running the SQL reproducer with citus.enable_binary_protocol both OFF and ON, then trace function-call delegation and binary handling for the mx_call_enum INOUT arguments. Done means the binary-protocol call succeeds and returns the same result as the non-binary call without the wrong-data-type error.

Written by the indexing model from the issue text.

Assessment

Tech stack
c, postgresql, sql
Domain
databases, distributed-systems
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.