RES: help with generation_series in pg10
| От | Márcio A. Sepp |
|---|---|
| Тема | RES: help with generation_series in pg10 |
| Дата | |
| Msg-id | 00ee01d38964$f7bfbf70$e73f3e50$@com.br обсуждение исходный текст |
| Ответ на | Re: help with generation_series in pg10 (Alvaro Herrera <alvherre@alvh.no-ip.org>) |
| Ответы |
Re: RES: help with generation_series in pg10
Re: help with generation_series in pg10 |
| Список | pgsql-general |
> > how can i have the same in pg10 as i have had in pg 9.x?
>
> Move the function call to the FROM clause:
>
> select g, (g - 1) % 5 + 1 from generate_series(1, 10) g;
thank you. That is exact what i need.
> > I need it to date type to... if possible.
>
> 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.
thanks
В списке pgsql-general по дате отправления: