pg.ddx.io  pgsql-sql@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Kenneth Marshall <ktm@rice.edu>
To: Richard Broersma <richard.broersma@gmail.com>
Cc: pgsql-sql@postgresql.org
Subject: Re: How to get CURRENT_DATE in a pl/pgSQL function
Date: Tue, 18 May 2010 14:27:21 -0500
Message-ID: <20100518192721.GS3892@aart.is.rice.edu> (raw)
In-Reply-To: <AANLkTimTUkyiFR0-o90bTmRHwK3T13mZTgyOu3m-gYMH@mail.gmail.com>
References: <20100518190832.GQ3892@aart.is.rice.edu>
	<AANLkTimTUkyiFR0-o90bTmRHwK3T13mZTgyOu3m-gYMH@mail.gmail.com>

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
> 



view thread (11+ messages)  latest in thread

Message-ID: <20100518192721.GS3892@aart.is.rice.edu>
Permalink:  ../20100518192721.GS3892@aart.is.rice.edu/
Also on:    postgresql.org/message-id/20100518192721.GS3892@aart.is.rice.edu

 · 

reply

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: ktm@rice.edu, richard.broersma@gmail.com
  Subject: Re: How to get CURRENT_DATE in a pl/pgSQL function
  In-Reply-To: <20100518192721.GS3892@aart.is.rice.edu>

* 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