Bug #117107 DB Notebook: Retrieve Data with SELECT Statements and print result
Submitted: 5 Jan 19:26 Modified: 6 Jan 8:36
Reporter: Marcel Marcel Email Updates:
Status: Not a Bug Impact on me:
None 
Category:Shell VSCode Extension Severity:S2 (Serious)
Version:v1.19.0 OS:Windows
Assigned to: CPU Architecture:Any

[5 Jan 19:26] Marcel Marcel
Description:
ts command
runSql("SELECT A.account as label, A.balance+(SUM(market_price*quantity)-SUM(avg_price*quantity)) as value FROM user_transactions.account_portfolio RIGHT JOIN user_transactions.account A USING (account_id) group by account_id", (res) => {
    print(res);
});

show error

ERROR: Failed to execute 'postMessage' on 'DedicatedWorkerGlobalScope': (res) => {
    print(res);
} could not be cloned. (Ln 1, Col 1)

Query is correct.

How to repeat:
Run any ts command of type:

\ts 
runSql( any select, (res) => {
    print(res);
});
[6 Jan 7:20] MySQL Verification Team
Hello Marcel Marcel,

Thank you for the report and feedback.
Verified as described.

regards,
Umesh
[6 Jan 8:36] Mike Lischke
Posted by developer:
 
You are using the wrong API. The method runSql actually is async and does not take a callback:

const result = await runSql(
"SELECT Name as name," +
"District as district, Population as pop FROM world.city WHERE Name = 'Kabul' "
);

print(result);

If you really need a callback use:

runSqlWithCallback(
"SELECT Name as name," +
"District as district, Population as pop FROM world.city WHERE Name = 'Kabul' ",
(ResultSetRows) => {
print(ResultSetRows);
}
);