Re: Range types
От | Robert Haas |
---|---|
Тема | Re: Range types |
Дата | |
Msg-id | 603c8f070912140302r185954d8yb15f174fbdb1a4f5@mail.gmail.com обсуждение исходный текст |
Ответ на | Re: Range types (tomas@tuxteam.de) |
Ответы |
Re: Range types
Re: Range types |
Список | pgsql-hackers |
On Mon, Dec 14, 2009 at 4:06 AM, <tomas@tuxteam.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
В списке pgsql-hackers по дате отправления: