* Emit the start-of-output boilerplate. * * This is just enough different from processing a subgroup that we need * a separate pair of subroutines. */
| 5890 | * a separate pair of subroutines. |
| 5891 | */ |
| 5892 | void |
| 5893 | ExplainBeginOutput(ExplainState *es) |
| 5894 | { |
| 5895 | switch (es->format) |
| 5896 | { |
| 5897 | case EXPLAIN_FORMAT_TEXT: |
| 5898 | /* nothing to do */ |
| 5899 | break; |
| 5900 | |
| 5901 | case EXPLAIN_FORMAT_XML: |
| 5902 | appendStringInfoString(es->str, |
| 5903 | "<explain xmlns=\"http://www.postgresql.org/2009/explain\">\n"); |
| 5904 | es->indent++; |
| 5905 | break; |
| 5906 | |
| 5907 | case EXPLAIN_FORMAT_JSON: |
| 5908 | /* top-level structure is an array of plans */ |
| 5909 | appendStringInfoChar(es->str, '['); |
| 5910 | es->grouping_stack = lcons_int(0, es->grouping_stack); |
| 5911 | es->indent++; |
| 5912 | break; |
| 5913 | |
| 5914 | case EXPLAIN_FORMAT_YAML: |
| 5915 | es->grouping_stack = lcons_int(0, es->grouping_stack); |
| 5916 | break; |
| 5917 | } |
| 5918 | } |
| 5919 | |
| 5920 | /* |
| 5921 | * Emit the end-of-output boilerplate. |
no test coverage detected