Time range
Time range
От:
Donald Shtjefni <dnld.sht@gmail.com>
Дата:
Hi,
I was wondering why there is not a type Range of time without time zone, I think it may be useful for someone, Is good if i do PR.
Sorry if I've worte in the wrong place
Re: Time range
От:
Tomas Vondra <tomas.vondra@2ndquadrant.com>
Дата:
On Fri, May 31, 2019 at 08:35:31AM +0200, Donald Shtjefni wrote: >Hi, > >I was wondering why there is not a type Range of time without time zone, I >think it may be useful for someone, Is good if i do PR. > >Sorry if I've worte in the wrong place Doesn't tsrange already do that? That's a timestamp without timezone range type. regards -- Tomas Vondra http://www.2ndQuadrant.com PostgreSQL Development, 24x7 Support, Remote DBA, Training & Services
Re: Time range
От:
Thomas Kellerer <shammat@gmx.net>
Дата:
Donald Shtjefni schrieb am 31.05.2019 um 13:35: > I was wondering why there is not a type Range of time without time zone, I think it may be useful for someone, Is good if i do PR. you can easily create one: create type timerange as range (subtype = time); Thomas
Re: Time range
От:
Isaac Morland <isaac.morland@gmail.com>
Дата:
timetzrange is also missing. In my database I have:
CREATE TYPE timerange AS RANGE (SUBTYPE = time);
COMMENT ON TYPE timerange IS 'range of times without time zone';
GRANT USAGE ON TYPE timerange TO PUBLIC;
CREATE TYPE timetzrange AS RANGE (SUBTYPE = timetz);
COMMENT ON TYPE timetzrange IS 'range of times with time zone';
GRANT USAGE ON TYPE timetzrange TO PUBLIC;
The intent is that these range types are the same as if they were built in. I don't believe I have ever used timetzrange but I did it for completeness.
Given that other built-in types have built-in range types, I think that the time and timetz types should also have built-in range types.
On Fri, 31 May 2019 at 11:40, Thomas Kellerer <shammat@gmx.net> wrote:
Donald Shtjefni schrieb am 31.05.2019 um 13:35:
> I was wondering why there is not a type Range of time without time zone, I think it may be useful for someone, Is good if i do PR.
you can easily create one:
create type timerange as range (subtype = time);
Thomas
Re: Time range
От:
Tom Lane <tgl@sss.pgh.pa.us>
Дата:
Isaac Morland writes: > Given that other built-in types have built-in range types, I think that the > time and timetz types should also have built-in range types. There's only a very small number of built-in range types: postgres=# select typname from pg_type where typtype = 'r' order by 1; typname ----------- daterange int4range int8range numrange tsrange tstzrange (6 rows) I don't think there's any appetite for creating built-in range types across-the-board. The time and timetz types are pretty little used (with good reason), so leaving them out of this list seems fine to me. regards, tom lane