Re: Type Categories for User-Defined Types - Mailing list pgsql-hackers

From Gregory Stark
Subject Re: Type Categories for User-Defined Types
Date
Msg-id 87wsj3hefd.fsf@oxford.xeocode.com
Whole thread Raw
In response to Re: Type Categories for User-Defined Types  (Tom Lane <tgl@sss.pgh.pa.us>)
Responses Re: Type Categories for User-Defined Types  (Tom Lane <tgl@sss.pgh.pa.us>)
List pgsql-hackers
"Tom Lane" <tgl@sss.pgh.pa.us> writes:

> So this can fairly obviously be replaced by two new pg_type columns,
> say "typcategory" and "typpreferred", where the latter is a bool.
> Since the list of categories is pretty short and there's no obvious
> reason to extend it a lot, I propose that we just represent typcategory
> as a "char", using a mapping along the lines of
>
>     BITSTRING_TYPE        b
>     BOOLEAN_TYPE        B
>     DATETIME_TYPE        D
>     GENERIC_TYPE        P (think "pseudotype")
>     GEOMETRIC_TYPE        G
>     INVALID_TYPE        \0 (not allowed in catalog anyway)
>     NETWORK_TYPE        n
...

I had a different thought when you posted the original prompt earlier. Instead
of a static list of type categories we could re-use type oids. So if you
belong to a type category you store the oid of the preferred type of that
category in typcategory.

I can't help thinking from the list above that there's nothing special about
datetime, geometric, and network data types that some user defined set of
types wouldn't necessarily want to define.

I do agree that having SQL commands to create new type categories, even a new
catalog table is overkill, but not because we wouldn't want to create new
ones. Just because there isn't really any other meta data we want to store
about type categories. Aside from the preferred type and the members there
isn't anything more to say about them.

--  Gregory Stark EnterpriseDB          http://www.enterprisedb.com Ask me about EnterpriseDB's Slony Replication
support!


pgsql-hackers by date:

Previous
From: "Stephen R. van den Berg"
Date:
Subject: Re: Protocol 3, Execute, maxrows to return, impact?
Next
From: Alvaro Herrera
Date:
Subject: Re: pg_regress inputdir