distinct on extract returns composite type

Поиск
Список
Период
Сортировка
От Mariel Cherkassky
Тема distinct on extract returns composite type
Дата
Msg-id CA+t6e1=FjpvAOwGXveustdC11VbSBrZ2_pVKGKaVFqAvVJh+QQ@mail.gmail.com
обсуждение исходный текст
Ответы Re: distinct on extract returns composite type  (Félix GERZAGUET <felix.gerzaguet@gmail.com>)
Список pgsql-performance
Hey,

I'm working on PG12.
I have the following table : 
\d dates_table
                             Table "public. dates_table "
  Column  |  Type   | Collation | Nullable |                    Default
----------+---------+-----------+----------+-----------------------------------------------
 id       | integer |           | not null | nextval(' dates_table_seq'::regclass)
 end_time | date    |           |          |

I tried to get all the quarters of the dates(and the years) in order to create a range partition by quarters. I used the following query : 
select distinct(extract(year from end_time),extract(quarter from end_time))   from dates_table where end_time is not null;
   row
----------
 (2017,3)
 (2017,4)
 (2018,1)
 (2018,2)
 (2018,3)
 (2018,4)
 (2019,1)
 (2019,2)
 (2019,3)
(9 rows)

I'm keep getting composite type (row) instead of two columns. Is there any sql way to convert the row type into two columns ? I want to get the first and last dates of each quarter with those columns and with this composite type I failed doing it

Thanks.

В списке pgsql-performance по дате отправления:

Предыдущее
От: Mariel Cherkassky
Дата:
Сообщение: Re: sequence depends on many tables
Следующее
От: Félix GERZAGUET
Дата:
Сообщение: Re: distinct on extract returns composite type