]> granicus.if.org Git - postgresql/commit
Fix incorrect error reporting for duplicate data in \crosstabview.
authorTom Lane <tgl@sss.pgh.pa.us>
Sun, 25 Dec 2016 21:04:31 +0000 (16:04 -0500)
committerTom Lane <tgl@sss.pgh.pa.us>
Sun, 25 Dec 2016 21:04:45 +0000 (16:04 -0500)
commita3aef88e6a9c5822eb4a5ad0744b15dc6e8a5d86
treeab5e5834ff940b27ab897c463fa4f4515b9ac689
parent86d216c77549e200b95bed487b6fb87d99a1e789
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
src/bin/psql/crosstabview.c
src/test/regress/expected/psql_crosstab.out
src/test/regress/sql/psql_crosstab.sql