Re: [patch] ENUM errdetail should mention bytes, not chars

From: Julien Rouhaud <rjuju123(at)gmail(dot)com>
To: Ian Lawrence Barwick <barwick(at)gmail(dot)com>
Cc: pgsql-hackers <pgsql-hackers(at)postgresql(dot)org>
Subject: Re: [patch] ENUM errdetail should mention bytes, not chars
Date: 2020-10-19 04:34:24
Message-ID: CAOBaU_Z=nqiSGjtD_+bak61QLVwPuaibWg=WgcatdWWaDA4Jcg@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

On Mon, Oct 19, 2020 at 12:18 PM Ian Lawrence Barwick <barwick(at)gmail(dot)com> wrote:
>
> Hi
>
> The errdetail emitted when creating/modifying an ENUM value is misleading:
>
> postgres=# CREATE TYPE enum_valtest AS ENUM (
> 'foo',
> 'ああああああああああああああああああああああ'
> );
> ERROR: invalid enum label "ああああああああああああああああああああああ"
> DETAIL: Labels must be 63 characters or less.
>
> Attached trivial patch changes the message to:
>
> DETAIL: Labels must be 63 bytes or less.
>
> This matches the documentation, which states:
>
> The length of an enum value's textual label is limited by the NAMEDATALEN
> setting compiled into PostgreSQL; in standard builds this means at most
> 63 bytes.
>
> https://www.postgresql.org/docs/current/datatype-enum.html
>
> I don't see any particular need to backpatch this.

Indeed the message is wrong, and patch LGTM.

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Amit Langote 2020-10-19 04:54:27 Re: partition routing layering in nodeModifyTable.c
Previous Message Ian Lawrence Barwick 2020-10-19 04:18:07 [patch] ENUM errdetail should mention bytes, not chars