Re: RES: help with generation_series in pg10

Поиск
Список
Период
Сортировка
От Alvaro Herrera
Тема Re: RES: help with generation_series in pg10
Дата
Msg-id 20180109162357.nyd2jlw3l33rd3hs@alvherre.pgsql
обсуждение исходный текст
Ответ на RES: help with generation_series in pg10  (Márcio A. Sepp <marcio@zyontecnologia.com.br>)
Список pgsql-general
Márcio A. Sepp wrote:

> > There is a generate_series() variant that can return dates (more
> > precisely, timestamp with time zone).  But what exactly would you like
> > returned?
> 
> In the past i use querys like this to generate some timestamp field:
> select generate_series (1, 10), generate_series('2018-01-01
> 10:00'::timestamp, '2018-01-02 10:00'::timestamp, '10 hours');
> 
> 
> in some case I need to order the timestamp data field and in others I just
> need an interval. So, in some moments an random data already help me and in
> others it is necessary to have both fields aligned.

Maybe something like this

select *
from generate_series(date '2018-01-01 10:00', '2018-01-02 10:00', '10 hours')
   with ordinality;

-- 
Álvaro Herrera                https://www.2ndQuadrant.com/
PostgreSQL Development, 24x7 Support, Remote DBA, Training & Services


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

Предыдущее
От: John McKown
Дата:
Сообщение: Re: Getting started with first user.
Следующее
От: Raymond O'Donnell
Дата:
Сообщение: Re: Getting started with first user.