pg.ddx.io  pgsql-hackers@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Daniel Gustafsson <daniel@yesql.se>
To: PostgreSQL-development <pgsql-hackers@postgresql.org>
Subject: Bug in intarray bench script
Date: Tue, 17 May 2016 11:18:17 +0200
Message-ID: <B97BDCB7-A3B3-4734-90B5-EDD586941629@yesql.se> (raw)
List-Unsubscribe: <mailto:majordomo@postgresql.org?body=unsub%20pgsql-hackers>

In the contrib/intarray benchmarking script bench.pl, the -e option to print
the plan via EXPLAIN is using the DBI do() method which discards output
resulting in nothing being printed.  Judging by the usage help (“show explain”)
I assume the intention is to print the plan to STDOUT when invoked (which is
exactly what I wanted in this case, thus bumping into this) but at least on
recent DBI/DBD::Pg versions the do() method is not returning the rows.

Attached patch use the selectall_arrayref() method instead and output the plan
when -e is invoked.

cheers ./daniel

-- 
Sent via pgsql-hackers mailing list (pgsql-hackers@postgresql.org)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-hackers

Attachments:

intarray_bench.diff (application/octet-stream, 389B) download diff --git a/contrib/intarray/bench/bench.pl b/contrib/intarray/bench/bench.pl index 8746291..395d616 100755 --- a/contrib/intarray/bench/bench.pl +++ b/contrib/intarray/bench/bench.pl @@ -92,7 +92,8 @@ if ($opt{v}) if ($opt{e}) { - $dbi->do("explain $sql"); + my @plan = map { "$_->[0]\n" } @{$dbi->selectall_arrayref("explain $sql")}; + print @plan; } my $t0 = [gettimeofday];

view thread (3+ messages)  latest in thread

Message-ID: <B97BDCB7-A3B3-4734-90B5-EDD586941629@yesql.se>
Permalink:  ../B97BDCB7-A3B3-4734-90B5-EDD586941629@yesql.se/
Also on:    postgresql.org/message-id/B97BDCB7-A3B3-4734-90B5-EDD586941629@yesql.se

 ·  · 

reply

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Reply to all the recipients from your mail client; the link fills in
  the headers below: reply via email
  Some clients, webmail especially, drop In-Reply-To and References from
  a link, and the reply then starts a new thread: use the mbox below.

  To: pgsql-hackers@postgresql.org
  Cc: daniel@yesql.se
  Subject: Re: Bug in intarray bench script
  In-Reply-To: <B97BDCB7-A3B3-4734-90B5-EDD586941629@yesql.se>
  References: <B97BDCB7-A3B3-4734-90B5-EDD586941629@yesql.se>

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox