Re: help with generation_series in pg10

From: Alvaro Herrera <alvherre(at)alvh(dot)no-ip(dot)org>
To: Márcio A(dot) Sepp <marcio(at)zyontecnologia(dot)com(dot)br>
Cc: 'pgsql-general' <pgsql-general(at)postgresql(dot)org>
Subject: Re: help with generation_series in pg10
Date: 2018-01-09 10:01:25
Message-ID: 20180109100125.65ws2rpygq6az4eo@alvherre.pgsql
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: 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

In response to

Responses

Browse pgsql-general by date

  From Date Subject
Next Message Vincenzo Romano 2018-01-09 10:03:58 Re: help with generation_series in pg10
Previous Message Agnar Renolen 2018-01-09 09:48:04 Getting started with first user.