git.postgresql.org Git - postgresql.git/commitdiff

git projects / postgresql.git / commitdiff
? search:
summary | shortlog | log | commit | commitdiff | tree
raw | patch | inline | side by side (parent: 9213462)
Fix enum errdetail to mention bytes, not chars
2020年10月27日 10:50:18 +0000 (11:50 +0100)
2020年10月27日 10:50:18 +0000 (11:50 +0100)
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


diff --git a/src/backend/catalog/pg_enum.c b/src/backend/catalog/pg_enum.c
index 27e4100a6f4d8d0c598f9adc37bb15808f041965..6a2c6685a0a56b6e2d27779ef4e106c8c4b3b3b5 100644 (file)
--- a/src/backend/catalog/pg_enum.c
+++ b/src/backend/catalog/pg_enum.c
@@ -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)));
/*
diff --git a/src/test/regress/expected/enum.out b/src/test/regress/expected/enum.out
index dffff88928e8912c5b4fce0f8ed9bed58b1300e9..908f67efffb8a1bc285b222e49fef157669612dd 100644 (file)
--- a/src/test/regress/expected/enum.out
+++ b/src/test/regress/expected/enum.out
@@ -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
This is the main PostgreSQL git repository.
RSS Atom

AltStyle によって変換されたページ (->オリジナル) /