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

From Kenneth Marshall
Subject Re: How to get CURRENT_DATE in a pl/pgSQL function
Date
Msg-id 20100518192721.GS3892@aart.is.rice.edu
Whole thread Raw
In response to Re: How to get CURRENT_DATE in a pl/pgSQL function  (Richard Broersma <richard.broersma@gmail.com>)
Responses Re: How to get CURRENT_DATE in a pl/pgSQL function
List pgsql-sql
To follow-up,

It works using 'now' and I assume that since curtime is
of type DATE that the assignment casts the return automatically
to type DATE. Thank you for the ideas.

Regards,
Ken

On Tue, May 18, 2010 at 12:12:46PM -0700, Richard Broersma wrote:
> On Tue, May 18, 2010 at 12:08 PM, Kenneth Marshall <ktm@rice.edu> wrote:
> 
> > 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:
> 
> > BEGIN
> > ? ?curtime := 'CURRENT_DATE';
> > ? ?LOOP
> 
> 
> I'm not "up" on my pl/pgSQL, but isn't CURRENT_DATE a literal value so
> it shouldn't to be enclosed in single quotes?
> 
> Another idea would be to:  CAST( now() AS DATE )
> 
> 
> 
> -- 
> Regards,
> Richard Broersma Jr.
> 
> Visit the Los Angeles PostgreSQL Users Group (LAPUG)
> http://pugs.postgresql.org/lapug
> 


pgsql-sql by date:

Previous
From: Pavel Stehule
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