-- explain output on PG12/13 is missing "Async Capable"
select setting::int < 140000 as pg12_13 from pg_settings where name = 'server_version_num';
 pg12_13 
---------
 f
(1 row)

-- json output
set pg_show_plans.plan_format = 'json';
show pg_show_plans.plan_format;
 pg_show_plans.plan_format 
---------------------------
 json
(1 row)

select * from nest();
 level |                 plan                  
-------+---------------------------------------
     0 | [                                    +
       |   "Plan": {                          +
       |     "Node Type": "Function Scan",    +
       |     "Parallel Aware": false,         +
       |     "Async Capable": false,          +
       |     "Function Name": "nest",         +
       |     "Alias": "nest",                 +
       |     "Startup Cost": 0.25,            +
       |     "Total Cost": 10.25,             +
       |     "Plan Rows": 1000,               +
       |     "Plan Width": 36,                +
       |     "Disabled": false                +
       |   }                                  +
       | ]
     1 | [                                    +
       |   "Plan": {                          +
       |     "Node Type": "Function Scan",    +
       |     "Parallel Aware": false,         +
       |     "Async Capable": false,          +
       |     "Function Name": "pg_show_plans",+
       |     "Alias": "pg_show_plans",        +
       |     "Startup Cost": 0.00,            +
       |     "Total Cost": 12.50,             +
       |     "Plan Rows": 333,                +
       |     "Plan Width": 36,                +
       |     "Disabled": false,               +
       |     "Filter": "(level >= 0)"         +
       |   }                                  +
       | ]
(2 rows)

-- yaml output
set pg_show_plans.plan_format = 'yaml';
show pg_show_plans.plan_format;
 pg_show_plans.plan_format 
---------------------------
 yaml
(1 row)

select * from nest();
 level |               plan               
-------+----------------------------------
     0 | Plan:                           +
       |   Node Type: "Function Scan"    +
       |   Parallel Aware: false         +
       |   Async Capable: false          +
       |   Function Name: "nest"         +
       |   Alias: "nest"                 +
       |   Startup Cost: 0.25            +
       |   Total Cost: 10.25             +
       |   Plan Rows: 1000               +
       |   Plan Width: 36                +
       |   Disabled: false
     1 | Plan:                           +
       |   Node Type: "Function Scan"    +
       |   Parallel Aware: false         +
       |   Async Capable: false          +
       |   Function Name: "pg_show_plans"+
       |   Alias: "pg_show_plans"        +
       |   Startup Cost: 0.00            +
       |   Total Cost: 12.50             +
       |   Plan Rows: 333                +
       |   Plan Width: 36                +
       |   Disabled: false               +
       |   Filter: "(level >= 0)"
(2 rows)

-- xml output
set pg_show_plans.plan_format = 'xml';
show pg_show_plans.plan_format;
 pg_show_plans.plan_format 
---------------------------
 xml
(1 row)

select * from nest();
 level |                           plan                           
-------+----------------------------------------------------------
     0 | <explain xmlns="http://www.postgresql.org/2009/explain">+
       |   <Plan>                                                +
       |     <Node-Type>Function Scan</Node-Type>                +
       |     <Parallel-Aware>false</Parallel-Aware>              +
       |     <Async-Capable>false</Async-Capable>                +
       |     <Function-Name>nest</Function-Name>                 +
       |     <Alias>nest</Alias>                                 +
       |     <Startup-Cost>0.25</Startup-Cost>                   +
       |     <Total-Cost>10.25</Total-Cost>                      +
       |     <Plan-Rows>1000</Plan-Rows>                         +
       |     <Plan-Width>36</Plan-Width>                         +
       |     <Disabled>false</Disabled>                          +
       |   </Plan>                                               +
       | </explain>
     1 | <explain xmlns="http://www.postgresql.org/2009/explain">+
       |   <Plan>                                                +
       |     <Node-Type>Function Scan</Node-Type>                +
       |     <Parallel-Aware>false</Parallel-Aware>              +
       |     <Async-Capable>false</Async-Capable>                +
       |     <Function-Name>pg_show_plans</Function-Name>        +
       |     <Alias>pg_show_plans</Alias>                        +
       |     <Startup-Cost>0.00</Startup-Cost>                   +
       |     <Total-Cost>12.50</Total-Cost>                      +
       |     <Plan-Rows>333</Plan-Rows>                          +
       |     <Plan-Width>36</Plan-Width>                         +
       |     <Disabled>false</Disabled>                          +
       |     <Filter>(level &gt;= 0)</Filter>                    +
       |   </Plan>                                               +
       | </explain>
(2 rows)

-- check plan format after reconnect
\c
show pg_show_plans.plan_format;
 pg_show_plans.plan_format 
---------------------------
 xml
(1 row)

