pg.ddx.io  pgsql-committers@postgresql.org mailing list archive  
help / color / mirror / Atom feed
pgsql: Fix incorrect error reporting for duplicate data in \crosstabvie
2+ messages / 1 participants
[nested] [flat]

* pgsql: Fix incorrect error reporting for duplicate data in \crosstabvie
@ 2016-12-25 21:04  Tom Lane <tgl@sss.pgh.pa.us>
  0 siblings, 0 replies; 2+ messages in thread

From: Tom Lane @ 2016-12-25 21:04 UTC (permalink / raw)
  To: pgsql-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
------
master

Details
-------
http://git.postgresql.org/pg/commitdiff/a3aef88e6a9c5822eb4a5ad0744b15dc6e8a5d86

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


^ permalink  raw  reply  [nested|flat] 2+ messages in thread

* pgsql: Fix incorrect error reporting for duplicate data in \crosstabvie
@ 2016-12-25 21:04  Tom Lane <tgl@sss.pgh.pa.us>
  0 siblings, 0 replies; 2+ messages in thread

From: Tom Lane @ 2016-12-25 21:04 UTC (permalink / raw)
  To: pgsql-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


^ permalink  raw  reply  [nested|flat] 2+ messages in thread


end of thread, other threads:[~2016-12-25 21:04 UTC | newest]

Thread overview: 2+ messages (download: mbox mbox.gz follow: Atom feed)
-- links below jump to the message on this page --
2016-12-25 21:04 pgsql: Fix incorrect error reporting for duplicate data in \crosstabvie Tom Lane <tgl@sss.pgh.pa.us>
2016-12-25 21:04 pgsql: Fix incorrect error reporting for duplicate data in \crosstabvie Tom Lane <tgl@sss.pgh.pa.us>

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