From: | Elein <elein(at)varlena(dot)com> |
---|---|
To: | "David G(dot) Johnston" <david(dot)g(dot)johnston(at)gmail(dot)com> |
Cc: | GENERAL <pgsql-general(at)postgresql(dot)org> |
Subject: | Re: enum bug |
Date: | 2016-03-12 02:22:43 |
Message-ID: | 0DE6954F-A46F-4B9B-874C-FA54B29E1A5F@varlena.com |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | pgsql-general |
Elein Mustain
elein(at)varlena(dot)com
510-637-9106
> On Mar 11, 2016, at 3:45 PM, David G. Johnston <david(dot)g(dot)johnston(at)gmail(dot)com> wrote:
>
>> On Fri, Mar 11, 2016 at 4:19 PM, Elein <elein(at)varlena(dot)com> wrote:
>
>> An unused (yet) enum type cannot display the enum ranges. An empty table containing that type cannot display enum ranges.
>
> Yes, it can.
>
> CREATE TYPE rainbow AS enum ('red','orange','yellow','blue','purple');
> SELECT enum_range(null::rainbow);
> enum_range
> {red,orange,yellow,blue,purple}
Yes you are right about this point. It is a workaround for poor syntax sugar design.
>
> I get the distinction between classes and objects. But in many cases, like this one, you need to obtain an instance of a class - a null is generally sufficient - and pass that instance to a function. The function can then use "pg_typeof(instance_value)::oid" to derive the oid for the corresponding class. This is a common idiom in PostgreSQL.
This is not a common idiom of postgres according to the ORDBMS model.
>
> The only improvement, besides the error handling point, that I see to be had here is your understanding of how the system works.
I know how it was designed to work. Been there done that.
>
> David J.
>
From | Date | Subject | |
---|---|---|---|
Next Message | Tom Lane | 2016-03-12 03:40:38 | Re: OS X 10.11.3, psql, bus error 10, 9.5.1 |
Previous Message | Chris Ruprecht | 2016-03-12 01:42:20 | OS X 10.11.3, psql, bus error 10, 9.5.1 |