diff options
author | Tom Lane <tgl@sss.pgh.pa.us> | 2025-09-02 13:50:56 -0400 |
---|---|---|
committer | Tom Lane <tgl@sss.pgh.pa.us> | 2025-09-02 13:50:56 -0400 |
commit | 1b1960c8c9e81171efabdd9e3393b4eec1ffc477 (patch) | |
tree | 1fdd5cd413a1fc9f7277f59426c10da7d819603e /contrib/postgres_fdw/sql/postgres_fdw.sql | |
parent | eccba079c2ea7d6b40a02de774e773e3aaf4bdda (diff) |
Improve error message for duplicate labels when creating an enum type.
Previously, duplicate labels in CREATE TYPE AS ENUM were caught by
the unique index on pg_enum, resulting in a generic error message.
While this was evidently intentional, it's not terribly user-friendly,
nor consistent with the ALTER TYPE cases which take more care with
such errors. This patch adds an explicit check to produce a more
user-friendly and descriptive error message.
A potential objection to this implementation is that it adds O(N^2)
work to the creation operation. However, quick testing finds that
that's pretty negligible below 1000 enum labels, and tolerable even
at 10000. So it doesn't really seem worth being smarter.
Author: Yugo Nagata <nagata@sraoss.co.jp>
Reviewed-by: Rahila Syed <rahilasyed90@gmail.com>
Reviewed-by: Jim Jones <jim.jones@uni-muenster.de>
Reviewed-by: Tom Lane <tgl@sss.pgh.pa.us>
Discussion: https://postgr.es/m/20250704000402.37e605ab0c59c300965a17ee@sraoss.co.jp
Diffstat (limited to 'contrib/postgres_fdw/sql/postgres_fdw.sql')
0 files changed, 0 insertions, 0 deletions