explain output infelicity in psql

From: Andrew Dunstan <andrew(at)dunslane(dot)net>
To: PostgreSQL-development <pgsql-hackers(at)postgresql(dot)org>
Subject: explain output infelicity in psql
Date: 2009-12-09 19:37:49
Message-ID: 4B1FFC8D.6070208@dunslane.net
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers


I have just noticed while checking the EXPLAIN YAML patch that the
non-text explain formats are output as a single line with embedded line
feeds, while the text format is delivered as a set of text records, one
per line. The practical effect of this is that psql decorates the
non-text format output with continuation characters:

andrew=# explain select count(*) from pg_class where relname ~ 'pg_';
QUERY PLAN
----------------------------------------------------------------
Aggregate (cost=9.67..9.68 rows=1 width=0)
-> Seq Scan on pg_class (cost=0.00..9.16 rows=204 width=0)
Filter: (relname ~ 'pg_'::text)
(3 rows)

Time: 5.813 ms
andrew=# explain (format yaml) select count(*) from pg_class where
relname ~ 'pg_';
QUERY PLAN
-----------------------------------------
- Plan: +
Node Type: Aggregate +
Strategy: Plain +
Startup Cost: 9.67 +
Total Cost: 9.68 +
Plan Rows: 1 +
Plan Width: 0 +
Plans: +
- Node Type: Seq Scan +
Parent Relationship: Outer +
Relation Name: pg_class +
Alias: pg_class +
Startup Cost: 0.00 +
Total Cost: 9.16 +
Plan Rows: 204 +
Plan Width: 0 +
Filter: (relname ~ 'pg_'::text)
(1 row)

Those + chars at the end of the line are ugly, to say the least, and
they make the supposedly machine-readable formats not so machine
readable if anyone wanted to c&p the output into a parser. (I'm mildly
surprised this hasn't been noticed before).

Maybe we need to teach psql not to do this formatting for EXPLAIN output?

cheers

andrew

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Roman Kononov 2009-12-09 20:06:19 BUG #5237: strange int->bit and bit->int conversions
Previous Message Jaime Casanova 2009-12-09 19:02:53 thread safety on clients