]> granicus.if.org Git - postgresql/commit
Give a better error for duplicate entries in VACUUM/ANALYZE column list.
authorTom Lane <tgl@sss.pgh.pa.us>
Thu, 21 Sep 2017 22:13:11 +0000 (18:13 -0400)
committerTom Lane <tgl@sss.pgh.pa.us>
Thu, 21 Sep 2017 22:13:11 +0000 (18:13 -0400)
commit71480501057fee9fa3649b072173ff10e2b842d0
tree33e61536d26161f06a5e818e7aaf0f5d24d0b701
parent28ae524bbf865d23eb10f6ae1b996d59dcc30e4e
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
src/backend/commands/analyze.c
src/test/regress/expected/vacuum.out
src/test/regress/sql/vacuum.sql