<strong>Explanation:</strong>

<table style="margin: 5px 0;">
    <thead>
        <tr>
            {% for label in data[0]|keys %}
                <th>{{ label }}</th>
            {% endfor %}
        </tr>
    </thead>
    <tbody>
        {% for row in data %}
        <tr>
            {% for key, item in row %}
                <td>{{ 'possible_keys' == key ? item|replace({',': ', '}) : item }}</td>
            {% endfor %}
        </tr>
        {% endfor %}
    </tbody>
</table>

<strong>Explanation:</strong>

{% if data[0]|length > 1 %}
    {# The platform returns a table for the explanation (e.g. MySQL), display all columns #}
    <table style="margin: 5px 0;">
        <thead>
            <tr>
                {% for label in data[0]|keys %}
                    <th>{{ label }}</th>
                {% endfor %}
            </tr>
        </thead>
        <tbody>
            {% for row in data %}
            <tr>
                {% for key, item in row %}
                    <td>{{ item|replace({',': ', '}) }}</td>
                {% endfor %}
            </tr>
            {% endfor %}
        </tbody>
    </table>
{% else %}
    {# The Platform returns a single column for a textual explanation (e.g. PostgreSQL), display all lines #}
    <pre style="margin: 5px 0;">
        {%- for row in data -%}
            {{ row|first }}{{ "\n" }}
        {%- endfor -%}
    </pre>
{% endif %}

Improve the rendering of the query explanation for Postgres
Improve the rendering of the query explanation for Postgres

Postgres does not return a table for the explanation but a list of lines
displaying the explanation in a formatted text.
