pg.ddx.io  pgsql-general@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Alvaro Herrera <alvherre@alvh.no-ip.org>
To: Márcio A. Sepp <marcio@zyontecnologia.com.br>
Cc: pgsql-general <pgsql-general@postgresql.org>
Subject: Re: help with generation_series in pg10
Date: Tue, 9 Jan 2018 07:01:25 -0300
Message-ID: <20180109100125.65ws2rpygq6az4eo@alvherre.pgsql> (raw)
In-Reply-To: <00bb01d388e8$c9607b50$5c2171f0$@com.br>

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




view thread (7+ messages)  latest in thread

Message-ID: <20180109100125.65ws2rpygq6az4eo@alvherre.pgsql>
Permalink:  ../20180109100125.65ws2rpygq6az4eo@alvherre.pgsql/
Also on:    postgresql.org/message-id/20180109100125.65ws2rpygq6az4eo@alvherre.pgsql

 · 

reply

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Reply to all the recipients from your mail client; the link fills in
  the headers below: reply via email
  Some clients, webmail especially, drop In-Reply-To and References from
  a link, and the reply then starts a new thread: use the mbox below.

  To: pgsql-general@postgresql.org
  Cc: alvherre@alvh.no-ip.org, marcio@zyontecnologia.com.br
  Subject: Re: help with generation_series in pg10
  In-Reply-To: <20180109100125.65ws2rpygq6az4eo@alvherre.pgsql>
  References: <00bb01d388e8$c9607b50$5c2171f0$@com.br> <20180109100125.65ws2rpygq6az4eo@alvherre.pgsql>

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox