Re: Range Types, constructors, and the type system
От | Jeff Davis |
---|---|
Тема | Re: Range Types, constructors, and the type system |
Дата | |
Msg-id | 1309929585.3012.97.camel@jdavis обсуждение исходный текст |
Ответ на | Re: Range Types, constructors, and the type system (Robert Haas <robertmhaas@gmail.com>) |
Ответы |
Re: Range Types, constructors, and the type system
|
Список | pgsql-hackers |
On Tue, 2011-07-05 at 13:06 -0400, Robert Haas wrote: > On Tue, Jul 5, 2011 at 12:54 PM, Jeff Davis <pgsql@j-davis.com> wrote: > > It would be something like: range_co(1,8)::int8range > > > > (just so we're comparing apples to apples) > > > > The intermediate type proposal doesn't require that we move the "c" and > > "o" into the parameter list. > > Well, you have to specify the bounds somewhere... That's true. In my example it's in the function name. > OK, so let's pass the information on the bounds as a separate > argument. Like this: > > int8range(1,8,'co') That has a lot going for it, in the sense that it avoids dealing with the type problems. > Then you can instead pass 'o' for open or 'i' for infinity (passing > NULL for the corresponding argument position in that case). The third > argument can be optional and default to 'cc'. The fact that there can be a default for the third argument makes this quite a lot more appealing than I had originally thought (although I think 'co' is the generally-accepted default). There's some slight ugliness around the NULL/infinity business, but I think that I could be convinced. I'd like to avoid confusion between NULL and infinity if possible. Regards,Jeff Davis
В списке pgsql-hackers по дате отправления: