Hi, all.
I got an error report that EXECUTE DIRECT queries with particular GROUP BY
clause return strange binary results and I made brief analysis.
The next query returns strang result.
EXECUTE DIRECT ON (datanode1) $$SELECT relkind FROM pg_class GROUP BY
relname, relkind$$;
It should return a result like Table A, but it returns a result like Table
B.
*Table A*
relkind
---------
i
r
v
t
(4 rows)
*Table B*
relkind
---------
h
\x18
`
8
\x10
X
0
x
\x08
P
(
p
H
A query to a regular table work well.
cx=# create table tbl as select generate_series(1,10) as a,
generate_series(1,10) as b;
INSERT 0 10
cx=# execute direct on (datanode2) $$select b from tbl group by a,b$$;
b
----
7
10
4
3
(4 rows)
On master_pg93_merge, this issue may cause psql disconnection. This query
doesn't make coordinator to be aborted.
cx=# execute direct on (datanode1) $$select tablename from
pg_catalog.pg_tables group by schemaname,tablename$$;
The connection to the server was lost. Attempting reset: Failed.
!>
And next queries return the right results.
# execute direct on (datanode1) $$select relkind from pg_class group
by relkind$$;
# execute direct on (datanode1) $$select relname, relkind from
pg_class group by relname, relkind$$;
It seems that this problem is produced when SELECT statement to pg_catalog
is issued and the selection target does not contain all of the columns
listed in the GROUP BY clause.
A datanode is returning the right result but a coordinator is returning
wrong result.
I think this issue is a bug of coordinator.
Regards.
|