#463 EXECUTE DIRECT queries with particular GROUP BY clause return strange binary results.

1.2 Dev Q
open
nobody
None
8
2013-12-13
2013-12-11
cbx
No

The next query returns strange result.
EXECUTE DIRECT ON (datanode1) $$SELECT relkind FROM pg_class GROUP BY relname, relkind$$;

It should return like Table A, but it returns 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

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 target does not contain all of the columns listed in the GROUP BY clause.

Discussion

  • cbx
    cbx
    2013-12-13

    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.

    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.
    !>
    

    This query doesn't make coordinator to be aborted.

     
  • cbx
    cbx
    2013-12-13

    A datanode is returning the right result but a coordinator is returning wrong result.
    I think this issue is bug of coordinator.