How to add a variable to a timestamp.

From: Eagna <eagna(at)protonmail(dot)com>
To: "pgsql-general(at)lists(dot)postgresql(dot)org" <pgsql-general(at)lists(dot)postgresql(dot)org>
Subject: How to add a variable to a timestamp.
Date: 2022-10-29 17:35:22
Message-ID: xXb-4R7uS7KbJF86CCk3x54iPj_ZoDNpAE33QlL7UUD27u0POej_mrycXGj9wYvc_N9XSP5Ed2cw5YF9YLGynDEWAq0aMY_7NkzO4BykQnw=@protonmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

Hi,

I'm trying to do something like this.

SELECT
d.i,
h.i,

'2022-10-31 00:00:00'::TIMESTAMP + INTERVAL 'd.i DAY'
FROM
GENERATE_SERIES(0, 6) AS d(i),
GENERATE_SERIES(0, 23) AS h(i);

where I add d.i days (and also h.i hours) to a timestamp.

I can't seem to get this to work. Any ideas appreciated.

E.

Sent with [Proton Mail](https://proton.me/) secure email.

Responses

Browse pgsql-general by date

  From Date Subject
Next Message Erik Wienhold 2022-10-29 18:35:30 Re: How to add a variable to a timestamp.
Previous Message Adrian Klaver 2022-10-29 17:14:04 Re: "peer" authentication: cannot make "pg_ident.conf" work as I believe that the doc says that it should