diff options
| author | Tom Lane | 2017-09-21 22:13:11 +0000 |
|---|---|---|
| committer | Tom Lane | 2017-09-21 22:13:11 +0000 |
| commit | 71480501057fee9fa3649b072173ff10e2b842d0 (patch) | |
| tree | 33e61536d26161f06a5e818e7aaf0f5d24d0b701 /src/test | |
| parent | 28ae524bbf865d23eb10f6ae1b996d59dcc30e4e (diff) | |
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
Diffstat (limited to 'src/test')
| -rw-r--r-- | src/test/regress/expected/vacuum.out | 5 | ||||
| -rw-r--r-- | src/test/regress/sql/vacuum.sql | 5 |
2 files changed, 10 insertions, 0 deletions
diff --git a/src/test/regress/expected/vacuum.out b/src/test/regress/expected/vacuum.out index 6f686630875..a16f26da7e7 100644 --- a/src/test/regress/expected/vacuum.out +++ b/src/test/regress/expected/vacuum.out @@ -90,4 +90,9 @@ UPDATE vacparted SET b = 'b'; VACUUM (ANALYZE) vacparted; VACUUM (FULL) vacparted; VACUUM (FREEZE) vacparted; +-- check behavior with duplicate column mentions +VACUUM ANALYZE vacparted(a,b,a); +ERROR: column "a" of relation "vacparted" is specified twice +ANALYZE vacparted(a,b,b); +ERROR: column "b" of relation "vacparted" is specified twice DROP TABLE vacparted; diff --git a/src/test/regress/sql/vacuum.sql b/src/test/regress/sql/vacuum.sql index 7c5fb049176..96a848ca954 100644 --- a/src/test/regress/sql/vacuum.sql +++ b/src/test/regress/sql/vacuum.sql @@ -73,4 +73,9 @@ UPDATE vacparted SET b = 'b'; VACUUM (ANALYZE) vacparted; VACUUM (FULL) vacparted; VACUUM (FREEZE) vacparted; + +-- check behavior with duplicate column mentions +VACUUM ANALYZE vacparted(a,b,a); +ANALYZE vacparted(a,b,b); + DROP TABLE vacparted; |
