1
0
mirror of https://github.com/postgres/postgres.git synced 2025-07-28 23:42:10 +03:00

Fix enum errdetail to mention bytes, not chars

The enum label length is in terms of bytes, not charactes.

Author: Ian Lawrence Barwick <barwick@gmail.com>
Reviewed-by: Julien Rouhaud <rjuju123@gmail.com>
Discussion: https://www.postgresql.org/message-id/flat/CAB8KJ=itZEJ7C9BacTHSYgeUysH4xx8wDiOnyppnSLyn6-g+Bw@mail.gmail.com
This commit is contained in:
Peter Eisentraut
2020-10-27 11:50:18 +01:00
parent 9213462c53
commit 0525572860
2 changed files with 4 additions and 4 deletions

View File

@ -125,7 +125,7 @@ EnumValuesCreate(Oid enumTypeOid, List *vals)
ereport(ERROR,
(errcode(ERRCODE_INVALID_NAME),
errmsg("invalid enum label \"%s\"", lab),
errdetail("Labels must be %d characters or less.",
errdetail("Labels must be %d bytes or less.",
NAMEDATALEN - 1)));
values[Anum_pg_enum_oid - 1] = ObjectIdGetDatum(oids[elemno]);
@ -228,7 +228,7 @@ AddEnumLabel(Oid enumTypeOid,
ereport(ERROR,
(errcode(ERRCODE_INVALID_NAME),
errmsg("invalid enum label \"%s\"", newVal),
errdetail("Labels must be %d characters or less.",
errdetail("Labels must be %d bytes or less.",
NAMEDATALEN - 1)));
/*
@ -523,7 +523,7 @@ RenameEnumLabel(Oid enumTypeOid,
ereport(ERROR,
(errcode(ERRCODE_INVALID_NAME),
errmsg("invalid enum label \"%s\"", newVal),
errdetail("Labels must be %d characters or less.",
errdetail("Labels must be %d bytes or less.",
NAMEDATALEN - 1)));
/*

View File

@ -92,7 +92,7 @@ ORDER BY enumlabel::planets;
ALTER TYPE planets ADD VALUE
'plutoplutoplutoplutoplutoplutoplutoplutoplutoplutoplutoplutoplutopluto';
ERROR: invalid enum label "plutoplutoplutoplutoplutoplutoplutoplutoplutoplutoplutoplutoplutopluto"
DETAIL: Labels must be 63 characters or less.
DETAIL: Labels must be 63 bytes or less.
ALTER TYPE planets ADD VALUE 'pluto' AFTER 'zeus';
ERROR: "zeus" is not an existing enum label
-- if not exists tests