Skip to content

Commit 0525572

Browse files
committed
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
1 parent 9213462 commit 0525572

File tree

2 files changed

+4
-4
lines changed

2 files changed

+4
-4
lines changed

src/backend/catalog/pg_enum.c

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -125,7 +125,7 @@ EnumValuesCreate(Oid enumTypeOid, List *vals)
125125
ereport(ERROR,
126126
(errcode(ERRCODE_INVALID_NAME),
127127
errmsg("invalid enum label \"%s\"", lab),
128-
errdetail("Labels must be %d characters or less.",
128+
errdetail("Labels must be %d bytes or less.",
129129
NAMEDATALEN - 1)));
130130

131131
values[Anum_pg_enum_oid - 1] = ObjectIdGetDatum(oids[elemno]);
@@ -228,7 +228,7 @@ AddEnumLabel(Oid enumTypeOid,
228228
ereport(ERROR,
229229
(errcode(ERRCODE_INVALID_NAME),
230230
errmsg("invalid enum label \"%s\"", newVal),
231-
errdetail("Labels must be %d characters or less.",
231+
errdetail("Labels must be %d bytes or less.",
232232
NAMEDATALEN - 1)));
233233

234234
/*
@@ -523,7 +523,7 @@ RenameEnumLabel(Oid enumTypeOid,
523523
ereport(ERROR,
524524
(errcode(ERRCODE_INVALID_NAME),
525525
errmsg("invalid enum label \"%s\"", newVal),
526-
errdetail("Labels must be %d characters or less.",
526+
errdetail("Labels must be %d bytes or less.",
527527
NAMEDATALEN - 1)));
528528

529529
/*

src/test/regress/expected/enum.out

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -92,7 +92,7 @@ ORDER BY enumlabel::planets;
9292
ALTER TYPE planets ADD VALUE
9393
'plutoplutoplutoplutoplutoplutoplutoplutoplutoplutoplutoplutoplutopluto';
9494
ERROR: invalid enum label "plutoplutoplutoplutoplutoplutoplutoplutoplutoplutoplutoplutoplutopluto"
95-
DETAIL: Labels must be 63 characters or less.
95+
DETAIL: Labels must be 63 bytes or less.
9696
ALTER TYPE planets ADD VALUE 'pluto' AFTER 'zeus';
9797
ERROR: "zeus" is not an existing enum label
9898
-- if not exists tests

0 commit comments

Comments
 (0)
pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy