Re: How to get CURRENT_DATE in a pl/pgSQL function - Mailing list pgsql-sql

From Jasen Betts
Subject Re: How to get CURRENT_DATE in a pl/pgSQL function
Date
Msg-id ht0hs5$i3d$2@reversiblemaps.ath.cx
Whole thread Raw
In response to How to get CURRENT_DATE in a pl/pgSQL function  (Kenneth Marshall <ktm@rice.edu>)
List pgsql-sql
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.   


pgsql-sql by date:

Previous
From: Tim Landscheidt
Date:
Subject: Re: How to get CURRENT_DATE in a pl/pgSQL function
Next
From: Kenneth Marshall
Date:
Subject: Re: How to get CURRENT_DATE in a pl/pgSQL function