这是indexloc提供的服务,不要输入任何密码
Skip to content

boolean keys in explain JSON aren't interpreted correctly #7662

@johnrtian

Description

@johnrtian

Please note that security bugs or issues should be reported to security@pgadmin.org.

Describe the bug

Some fields appear empty in explain details when they shouldn't. So far, I've seen this affect 3 keys, all of which are boolean in the explain JSON:

  • Single Copy
  • Async Capable
  • Parallel Aware

This is most obvious for Parallel Aware. Explain --> Graphical or Analysis will both falsely indicate non-parallel operations when they are actually parallel.

To Reproduce
Below steps were taken on a fresh PG 15.7 database using default parallelism config, and the bundled pgadmin 8.6 that came with the install:

Create a large, unindexed table.

create table test.bool_explain as
select generate_series as v
from generate_series(1,(10^6)::int)
;

Write a select that supports parallel seq scan.

select *
from test.bool_explain
where v % 10 = 0
;

Observe discrepancy between actual explain command output and pgAdmin explain.

Expected behavior
The actual returned text from explain correctly shows parallel seq scan, in both plaintext and JSON formats:

explain
select *
from test.bool_explain
where v % 10 = 0
;
-----------------------
Gather  (cost=1000.00..12175.00 rows=5000 width=4)
  Workers Planned: 2
  ->  Parallel Seq Scan on bool_explain  (cost=0.00..10675.00 rows=2083 width=4)
        Filter: ((v % 10) = 0)
explain (format json)
select *
from test.bool_explain
where v % 10 = 0
;
-----------------------
[
  {
    "Plan": {
      "Node Type": "Gather",
      "Parallel Aware": false,
      "Async Capable": false,
      "Startup Cost": 1000.00,
      "Total Cost": 12175.00,
      "Plan Rows": 5000,
      "Plan Width": 4,
      "Workers Planned": 2,
      "Single Copy": false,
      "Plans": [
        {
          "Node Type": "Seq Scan",
          "Parent Relationship": "Outer",
          "Parallel Aware": true,
          "Async Capable": false,
          "Relation Name": "bool_explain",
          "Alias": "bool_explain",
          "Startup Cost": 0.00,
          "Total Cost": 10675.00,
          "Plan Rows": 2083,
          "Plan Width": 4,
          "Filter": "((v % 10) = 0)"
        }
      ]
    }
  }
]

Error message
pgAdmin explain shows ordinary Seq Scan:
image
image

Note that all boolean keys in the JSON explain are empty in the graphical explain node details, regardless of their value.

Screenshots
Included above

Desktop (please complete the following information):

  • OS: Microsoft Windows 11 Enterprise
  • Version: 8.6
  • Mode: Desktop
  • Browser (if running in server mode): N/A
  • Package type: Bundled w/ PG 15.7

Additional context

Metadata

Metadata

Assignees

Type

No type

Projects

No projects

Milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions