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: Give a better error for duplicate entries in VACUUM/ANALYZE colu
Date: Thu, 21 Sep 2017 22:13:56 +0000
Message-ID: <E1dv9jI-0006oT-Fn@gemulon.postgresql.org> (raw)
List-Unsubscribe:  <mailto:majordomo@postgresql.org?body=unsub%20pgsql-committers>

Give a better error for duplicate entries in VACUUM/ANALYZE column list.

Previously, the code didn't think about this case and would just try to
analyze such a column twice.  That would fail at the point of inserting
the second version of the pg_statistic row, with obscure error messsages
like "duplicate key value violates unique constraint" or "tuple already
updated by self", depending on context and PG version.  We could allow
the case by ignoring duplicate column specifications, but it seems better
to reject it explicitly.

The bogus error messages seem like arguably a bug, so back-patch to
all supported versions.

Nathan Bossart, per a report from Michael Paquier, and whacked
around a bit by me.

Discussion: https://postgr.es/m/E061A8E3-5E3D-494D-94F0-E8A9B312BBFC@amazon.com

Branch
------
master

Details
-------
https://git.postgresql.org/pg/commitdiff/71480501057fee9fa3649b072173ff10e2b842d0

Modified Files
--------------
src/backend/commands/analyze.c       | 25 ++++++++++++++++++-------
src/test/regress/expected/vacuum.out |  5 +++++
src/test/regress/sql/vacuum.sql      |  5 +++++
3 files changed, 28 insertions(+), 7 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 (12+ messages)  latest in thread

Message-ID: <E1dv9jI-0006oT-Fn@gemulon.postgresql.org>
Permalink:  ../E1dv9jI-0006oT-Fn@gemulon.postgresql.org/
Also on:    postgresql.org/message-id/E1dv9jI-0006oT-Fn@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 using the --to and --cc options:
  reply via email

  To: pgsql-committers@postgresql.org
  Cc: tgl@sss.pgh.pa.us
  Subject: Re: pgsql: Give a better error for duplicate entries in VACUUM/ANALYZE colu
  In-Reply-To: <E1dv9jI-0006oT-Fn@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