pg.ddx.io  pgsql-committers@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Tom Lane <tgl@sss.pgh.pa.us>
To: pgsql-committers@postgresql.org
Subject: pgsql: Fix incorrect error reporting for duplicate data in \crosstabvie
Date: Sun, 25 Dec 2016 21:04:58 +0000
Message-ID: <E1cLFyU-0005T4-4l@gemulon.postgresql.org> (raw)
List-Unsubscribe:  <mailto:majordomo@postgresql.org?body=unsub%20pgsql-committers>

Fix incorrect error reporting for duplicate data in \crosstabview.

\crosstabview's complaint about multiple entries for the same crosstab
cell quoted the wrong row and/or column values.  It would accidentally
appear to work if the data had been in strcmp() order to start with,
which probably explains how we missed noticing this during development.

This could be fixed in more than one way, but the way I chose was to
hang onto both result pointers from bsearch() and use those to get at
the value names.

In passing, avoid casting away const in the bsearch comparison functions.
No bug there, just poor style.

Per bug #14476 from Tomonari Katsumata.  Back-patch to 9.6 where
\crosstabview was introduced.

Report: https://postgr.es/m/20161225021519.10139.45460@wrigleys.postgresql.org

Branch
------
REL9_6_STABLE

Details
-------
http://git.postgresql.org/pg/commitdiff/6a8c67f5070161c721f1a8e2189836d3a73d8ef5

Modified Files
--------------
src/bin/psql/crosstabview.c                 | 48 ++++++++++++++---------------
src/test/regress/expected/psql_crosstab.out | 13 ++++++++
src/test/regress/sql/psql_crosstab.sql      | 11 +++++++
3 files changed, 48 insertions(+), 24 deletions(-)


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


view thread (2+ messages)

Message-ID: <E1cLFyU-0005T4-4l@gemulon.postgresql.org>
Permalink:  ../E1cLFyU-0005T4-4l@gemulon.postgresql.org/
Also on:    postgresql.org/message-id/E1cLFyU-0005T4-4l@gemulon.postgresql.org

 · 

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-committers@postgresql.org
  Cc: tgl@sss.pgh.pa.us
  Subject: Re: pgsql: Fix incorrect error reporting for duplicate data in \crosstabvie
  In-Reply-To: <E1cLFyU-0005T4-4l@gemulon.postgresql.org>
  References: <E1cLFyU-0005T4-4l@gemulon.postgresql.org>

* 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