.gw.syncexec["select sum size by sym from trades";`rdb]

Query Error
We have encountered an error when querying through the gateway process and have discovered that this is due to qStudio not behaving as expected with handling of deferred response.
For example, if I first run a query on the process (rdb) directly, the expected result is returned;
However when I connect to the gateway process and run the exact same query to the rdb, which will use deferred response, I am returned what looks like the result but as an error;

Solution -> Turn off Query Wrapping

Connection Settings
  1. To access the connection options dialog got to Settings->Preferences... then click the Connections tab.
  2. Once there toggle the "Wrap query sent to server" setting.

What is Query Wrapping? Why didn't deferred work?

Query wrapping as mentioned on our preferences page wraps a query to prevent large result sets from locking up the GUI and database as they are transferred. It also allows returning stack traces for function call errors

Query wrapping works by wrapping the users query and returning a nested object. For example if the user calls:
getQuotes[`GBP]
The wrapped query may become something like:
r:getQuotes[GBP]; if[100<count r;'err]; :(r;1b;count r)
The crucial part for us is that it's no longer a simple table returned but a nested structure.