Re: BUG #6300: duplicate key value violates unique constraint

Поиск
Список
Период
Сортировка
От Peter Geoghegan
Тема Re: BUG #6300: duplicate key value violates unique constraint
Дата
Msg-id CAEYLb_XdgKec2rNBhbj4HxU5PZ4UBZ75fp-D92+4BLqhAkNSUA@mail.gmail.com
обсуждение исходный текст
Ответ на Re: BUG #6300: duplicate key value violates unique constraint  (Robert Haas <robertmhaas@gmail.com>)
Ответы Re: BUG #6300: duplicate key value violates unique constraint  (Robert Haas <robertmhaas@gmail.com>)
Список pgsql-bugs
On 23 November 2011 02:49, Robert Haas <robertmhaas@gmail.com> wrote:
> There is no sort of systematic labeling of error messages in the log
> to enable the DBA to figure out that the first error message is likely
> nothing more serious than an integrity constraint doing its bit to
> preserve data integrity, while the second is likely a sign of
> impending disaster.

+1

I suggested that there be an INTERNAL_ERROR severity level before on
this list, in response to an opaque internal error that was raised in
the planner due to a bug in master (it was a simple elog() call that
raised the error), and the idea was not well received. Tom said that
"Well, the SQLSTATE for this sort of thing is already
ERRCODE_INTERNAL_ERROR". A quick search of that shows that it only
appears in the following places:

src/pl/plpgsql/src/plerrcodes.h
876:    "internal_error", ERRCODE_INTERNAL_ERROR

src/backend/access/gist/gistsplit.c
374:                (errcode(ERRCODE_INTERNAL_ERROR),

src/backend/access/nbtree/nbtinsert.c
455:                (errcode(ERRCODE_INTERNAL_ERROR),

src/backend/utils/misc/guc.c
6369:                (errcode(ERRCODE_INTERNAL_ERROR),

src/backend/utils/adt/xml.c
259:    xml_ereport_by_code(WARNING, ERRCODE_INTERNAL_ERROR,
3787:            xml_ereport(xmlerrcxt, ERROR, ERRCODE_INTERNAL_ERROR,
3816:            xml_ereport(xmlerrcxt, ERROR, ERRCODE_INTERNAL_ERROR,
3828:            xml_ereport(xmlerrcxt, ERROR, ERRCODE_INTERNAL_ERROR,

src/backend/utils/adt/ri_triggers.c
3501:                (errcode(ERRCODE_INTERNAL_ERROR),

src/backend/utils/mb/conversion_procs/utf8_and_win/utf8_and_win.c
125:            (errcode(ERRCODE_INTERNAL_ERROR),
152:            (errcode(ERRCODE_INTERNAL_ERROR),

src/backend/utils/mb/conversion_procs/utf8_and_iso8859/utf8_and_iso8859.c
135:            (errcode(ERRCODE_INTERNAL_ERROR),
162:            (errcode(ERRCODE_INTERNAL_ERROR),

src/backend/utils/error/elog.c
353:        edata->sqlerrcode =3D ERRCODE_INTERNAL_ERROR;
612:            edata->sqlerrcode =3D ERRCODE_INTERNAL_ERROR;
648:            edata->sqlerrcode =3D ERRCODE_INTERNAL_ERROR;

src/backend/utils/errcodes.h
322:#define ERRCODE_INTERNAL_ERROR MAKE_SQLSTATE('X','X','0','0','0')

src/backend/postmaster/pgstat.c
493:                    (errcode(ERRCODE_INTERNAL_ERROR),

src/include/utils/elog.h
93: * ERRCODE_INTERNAL_ERROR if elevel is ERROR or more, ERRCODE_WARNING

contrib/sepgsql/uavc.c
184:                    (errcode(ERRCODE_INTERNAL_ERROR),
521:                (errcode(ERRCODE_INTERNAL_ERROR),

contrib/sepgsql/hooks.c
94:                (errcode(ERRCODE_INTERNAL_ERROR),
426:                (errcode(ERRCODE_INTERNAL_ERROR),

contrib/sepgsql/selinux.c
768:                (errcode(ERRCODE_INTERNAL_ERROR),
854:                (errcode(ERRCODE_INTERNAL_ERROR),

contrib/sepgsql/label.c
84:                    (errcode(ERRCODE_INTERNAL_ERROR),
194:                (errcode(ERRCODE_INTERNAL_ERROR),
234:                (errcode(ERRCODE_INTERNAL_ERROR),
464:                    (errcode(ERRCODE_INTERNAL_ERROR),
526:                (errcode(ERRCODE_INTERNAL_ERROR),

A new severity level is called for. In addition, if we had a new
severity level, the footprint wouldn't be too bad on all those legacy
elog() calls as compared to using errcode(ERRCODE_INTERNAL_ERROR).

--=20
Peter Geoghegan =A0 =A0 =A0 http://www.2ndQuadrant.com/
PostgreSQL Development, 24x7 Support, Training and Services

В списке pgsql-bugs по дате отправления:

Предыдущее
От: Robert Haas
Дата:
Сообщение: Re: BUG #6300: duplicate key value violates unique constraint
Следующее
От: "Robert Balser"
Дата:
Сообщение: BUG #6304: initdb fails with loale ko_KR.eucKR