Re: Range types

From: Robert Haas <robertmhaas(at)gmail(dot)com>
To: tomas(at)tuxteam(dot)de
Cc: hackers <pgsql-hackers(at)postgresql(dot)org>
Subject: Re: Range types
Date: 2009-12-14 11:02:04
Message-ID: 603c8f070912140302r185954d8yb15f174fbdb1a4f5@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

On Mon, Dec 14, 2009 at 4:06 AM, <tomas(at)tuxteam(dot)de> wrote:
>> As another approach, what about storing typeid in typmod?
>> (Oid can be assumed to be stored in int32.)
>>
>> For example,
>>     CREATE TABLE tbl ( r range(timestamp) );
>>     SELECT '[ 2.0, 3.0 )'::range(float);
>>
>> There might be some overhead to store typeid for each range instance,
>> but the typmod approach does not require additinal catalogs and syntax
>> changes. It can be possible even on 8.4.
>
> This looks more natural to me too.

It 's very different than the way we've traditionally used typmod,
though, which Tom described pretty well here:

http://archives.postgresql.org/pgsql-hackers/2009-11/msg01183.php

For example, function signatures ignore typmod, so you'll be able to
write a function that takes a range, but you won't know what kind of
range you're getting. Pavel proposed changing that, but the problem
is that while you might want to discriminate on the basis of what sort
of range you're getting, you probably DON'T want to discriminate on
the length of the character string being passed in with a varchar
argument, or the number of decimal places in a numeric.

So I think this is going to be awkward.

Also, typid is unsigned and typmod is signed. Again, awkward. Maybe
with a big enough crowbar you can make it work, but it seems like it
won't be pretty...

...Robert

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Fred Janon 2009-12-14 11:04:07 pgAdmin III: timestamp displayed in what time zone?
Previous Message Magnus Hagander 2009-12-14 10:09:49 Re: Hot Standby, release candidate?