• Tom Lane's avatar
    Give a better error for duplicate entries in VACUUM/ANALYZE column list. · 71480501
    Tom Lane authored
    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
    71480501
analyze.c 84.3 KB