Re: Range Types, constructors, and the type system - Mailing list pgsql-hackers

From Florian Pflug
Subject Re: Range Types, constructors, and the type system
Date
Msg-id 150CAF5F-E764-4539-94CF-7C6B643836F5@phlo.org
Whole thread Raw
In response to Range Types, constructors, and the type system  (Jeff Davis <pgsql@j-davis.com>)
Responses Re: Range Types, constructors, and the type system
List pgsql-hackers
On Jun26, 2011, at 00:29 , Jeff Davis wrote:
> declare the return type of a function, and then use the declared type to
> infer the argument types. That would be nice because you would just have
> to do:
>  range(1,10)::int8range
> However, that's kind of backwards from how our type inference system
> works now, and sounds like a big change.

Well, there actually *is* some precedence for that kind of top-down
(form a syntactic perspective) type inference. We *enforce* the cast
in  array[]::<arraytype>
and actually for a very similar reason - without the case, there's no
way of knowing which type of empty array was meant. I think we also
special-case 'literal'::<type>
to use the input function of type directly, instead of first creating
a text value and later casting it to <type>.

best regards,
Florian Pflug



pgsql-hackers by date:

Previous
From: Florian Pflug
Date:
Subject: Re: Another issue with invalid XML values
Next
From: Jeff Davis
Date:
Subject: Re: Range Types, constructors, and the type system