Search Postgresql Archives

Re: range of composite types!

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Tuesday, April 26, 2022, Jian He <hejian.mark@xxxxxxxxx> wrote:

-- composite type range.
create type mytype as (t1 int, t2 date);
-- create type my_interval as (t1 int, t2 interval);
select (2,'2022-01-02')::mytype ;
create type mytyperange as range(subtype = mytype);
 
I am thinking construct a composite type range that would be equivalent as:
select a, b::date
from generate_series(1,8) a,
generate_series('2022-01-01'::timestamp,
    '2022-01-31'::timestamp, interval '1 day') b;
Ranges have to be ordered.  How do you propose to order the above?  Composite type comparisons have defined ordering semantics.  Your results demonstrate what those are (namely, subsequent fields are used only to break ties).  If you want different behavior you will have to code it yourself - possibly including ignoring the generic composite type infrastructure and make a formal base type of whatever it is you need.

David J.


[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Index of Archives]     [Postgresql Jobs]     [Postgresql Admin]     [Postgresql Performance]     [Linux Clusters]     [PHP Home]     [PHP on Windows]     [Kernel Newbies]     [PHP Classes]     [PHP Databases]     [Postgresql & PHP]     [Yosemite]

  Powered by Linux