Re: help with generation_series in pg10 - Mailing list pgsql-general

From Alvaro Herrera
Subject Re: help with generation_series in pg10
Date
Msg-id 20180109100125.65ws2rpygq6az4eo@alvherre.pgsql
Whole thread Raw
In response to help with generation_series in pg10  (Márcio A. Sepp <marcio@zyontecnologia.com.br>)
Responses Re: help with generation_series in pg10
RES: help with generation_series in pg10
List pgsql-general
Márcio A. Sepp wrote:

> 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; 

> 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?

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


pgsql-general by date:

Previous
From: Agnar Renolen
Date:
Subject: Getting started with first user.
Next
From: Vincenzo Romano
Date:
Subject: Re: help with generation_series in pg10