Re: Refactoring the Type System

From: Daniel Farina <drfarina(at)acm(dot)org>
To: Darren Duncan <darren(at)darrenduncan(dot)net>
Cc: PG Hackers <pgsql-hackers(at)postgresql(dot)org>
Subject: Re: Refactoring the Type System
Date: 2010-11-14 10:38:10
Message-ID: AANLkTimRgu-g+i_7eyfAw=aT_jwOLTvsrHikDALTwubh@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

On Sat, Nov 13, 2010 at 7:54 PM, Darren Duncan <darren(at)darrenduncan(dot)net> wrote:
> A key component of a good type system is that users can define data types,
> and moreover where possible, system-defined types are defined in the same
> ways as users define types.  For example, stuff like temporal types or
> geospatial types are prime candidates for being defined like user-defined
> types.

They are user defined types, and even separately compiled,
distributed, and dynamically linked.

> You don't have to kludge things by implementing arrays as blobs for example;
> you can implement them as relations instead.  Geospatial types can just be
> tuples. Arrays of structured types can just be relations with an attribute
> per type attribute.  Arrays of simple types can just be unary relations.

In practice, my guess is the performance of these approaches would be
terrible for a number of workloads. I don't agree that arrays having
their own storage implementation is a kludge: there are even operators
like unnest that can be used to turn them back into relations.

I have long thought (but never really gave voice to) there being value
having first-class relation values, but I would also say that's
another kettle of fish. I also want closures, and don't think that's
completely nuts.

> I also want to emphasize that, while I drew inspiration from many sources
> when defining Muldis D, and there was/is a lot I still didn't/don't know
> about Postgres, I have found that as I use and learn Postgres, I'm finding
> frequently that how Postgres does things is similar and compatible to how I
> independently came up with Muldis D's design; I'm finding more similarities
> all the time.

You may want to learn more about this, first. Postgres's type system,
while relatively simple, is not as ill-conceived or primitive as you
seem to assume it is. There are also a lot of important system
details, like expanding/replacing the typmod facility that only allows
Postgres 32 bits of type-augmenting data (such as the (1) in the type
numeric(1)).

fdr

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Daniel Farina 2010-11-14 11:15:25 Re: Refactoring the Type System
Previous Message Dave Page 2010-11-14 10:30:59 Re: [COMMITTERS] pgsql: Improved parallel make support