From: Jasen Betts <jasen@xnet.co.nz>
To: pgsql-sql@postgresql.org
Subject: Re: How to get CURRENT_DATE in a pl/pgSQL function
Date: 19 May 2010 11:25:57 GMT
Message-ID: <ht0hs5$i3d$2@reversiblemaps.ath.cx> (raw)
References: <20100518190832.GQ3892@aart.is.rice.edu>
On 2010-05-18, Kenneth Marshall <ktm@rice.edu> wrote:
> I am trying to write a function that updates the
> date column to the current date. According to:
>
> http://www.postgresql.org/docs/8.4/static/functions-datetime.html#FUNCTIONS-DATETIME-CURRENT
>
> you can use CURRENT_DATE. When I try to use it in
> the following pl/pgSQL function it gives the error:
>
> ERROR: date/time value "current" is no longer supported
> CONTEXT: PL/pgSQL function "merge_data" line 4 at assignment
>
> Here is the code I am using:
>
> CREATE FUNCTION merge_data(key INT, i INT) RETURNS
> VOID AS
> $$
> DECLARE
> curtime date;
> BEGIN
> curtime := 'CURRENT_DATE';
use one of
CURRENT_DATE
'today'
NOW()
CURRENT_TIMESTAMP
'now'
there are probably others which will work too.
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 using the --to and --cc options:
reply via email
To: pgsql-sql@postgresql.org
Cc: jasen@xnet.co.nz
Subject: Re: How to get CURRENT_DATE in a pl/pgSQL function
In-Reply-To: <ht0hs5$i3d$2@reversiblemaps.ath.cx>
* 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