Re: enum bug

From: Alvaro Herrera <alvherre(at)2ndquadrant(dot)com>
To: Elein <elein(at)varlena(dot)com>
Cc: GENERAL <pgsql-general(at)postgresql(dot)org>
Subject: Re: enum bug
Date: 2016-03-14 02:22:05
Message-ID: 20160314022205.GA186064@alvherre.pgsql
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

Elein wrote:

Hi Elein,

> * When an insert into an enum column fails give the person a hint as to valid values

> -- Lousy message. Show enum list.
> insert into badinfo values ('green');
> ERROR: invalid input value for enum rainbow: "green"
> LINE 1: insert into badinfo values ('green');

True, we could improve that, though it could easily get messy with large
enums.

> > * Make enum_range to not be dependent on values in the target table.
> > Remove/Obsolete enum_range( enum_column ) and replace with enum_range( typein regtype )
> >
> > Workaround: define the enum_range( typein regtyp ) yourself.

Hmm, this is pretty clunky. I don't think passing the OID of the enum
itself is a lot better, but if you use a regtype cast then perhaps it's
not that bad. Perhaps we could have both functions.

--
Álvaro Herrera http://www.2ndQuadrant.com/
PostgreSQL Development, 24x7 Support, Remote DBA, Training & Services

In response to

  • enum bug at 2016-03-11 21:36:41 from Elein

Responses

Browse pgsql-general by date

  From Date Subject
Next Message James Keener 2016-03-14 02:37:13 Re: retrieve grouping sets/rollup rows
Previous Message Melvin Davidson 2016-03-14 02:20:05 Re: enum bug