Fixed display of Backward scans on

Yaroslav Schekin (ysch) reported on irc that Index Scans Backward do not display properly.

After checking I found out that if explain is in JSON/YAML/XML – node type is changed to “Index Scan" (or “Index Only Scan" if it was originally “Index Only Scan Backward").

Some more debugging/diagnosing later and I found the problem.

Basically, in case of backward scans, non-text formats store base type (“Index Scan" / “Index Only Scan") in “Node Type", and the direction is saved as another part of structure: “Scan Direction".

Fixed it, and released new version of Pg::Explain parser library.

There were no changes in code itself, so it just works.

If you'd like to see it:

Sorry for the bug, and thanks Yaroslav for the report.