Invalid EXPLAIN results
coreybutler opened this issue · comments
It appears the EXPLAIN
command isn't parsing/processing results correctly.
Consider the following statement executed in DBeaver:
Now consider the same thing in Deno-Postgres:
await conn.connect()
const r = await conn.query(`
EXPLAIN SELECT *
FROM account.acct a
JOIN account.acct_user au on a.id = au.acct_id;`
)
console.log(JSON.stringify(r, null, 2))
Only the second result exists in the Deno-postgres output (I expected the results to match the output of DBeaver).
Hello there @coreybutler. I'm testing with the latest driver version https://raw.githubusercontent.com/denodrivers/postgres/72f523cb9d8f863204a3fa02f52d534e7ce30ccf/mod.ts
and I can't seem to be able to replicate this problem
I believe this had to do with the way I was evaluating arrays when coming as a response from Postgres, which was recently refactored
Try and see if you can replicate locally, I'll assume this issue is closed in the meanwhile
Can you send me a reproduction example? Something like the following:
await client.queryArray`CREATE TEMP TABLE A (X INT)`;
await client.queryArray`CREATE TEMP TABLE B (Y INT)`;
const {rows} = await client.queryArray`EXPLAIN SELECT A.X FROM A JOIN B ON A.X = B.Y`;
As I just told you, I can't replicate the issue by using latest main
In a simple demo, I also cannot recreate the problem. However; I have a class with a function that executes a serializable transaction. When executing the exact same code from that class, there are missing results. I'll keep hunting today and post my findings when I narrow down the problem.
I found the issue, and it isn't related to this library. In my case, the query results are written to stdout
as part of an error/informational message in a unit testing suite. The suite produces TAP output. The raw TAP output displays the results correctly:
However; displaying pretty results with tap-spec yield output like those from my prior messages. Clearly this is the result of using tap-spec, not deno-postgres.
Thanks for your time, and thanks for your work on this library.