Received: from maia.hub.org (maia-3.hub.org [200.46.204.243]) by mail.postgresql.org (Postfix) with ESMTP id 232DF65AA6E for ; Wed, 19 May 2010 08:26:17 -0300 (ADT) Received: from mail.postgresql.org ([200.46.204.86]) by maia.hub.org (mx1.hub.org [200.46.204.243]) (amavisd-maia, port 10024) with ESMTP id 20113-02 for ; Wed, 19 May 2010 11:26:08 +0000 (UTC) X-Greylist: from auto-whitelisted by SQLgrey-1.7.6 Received: from smtpcorp.com (smtpcorp.com [67.192.120.76]) by mail.postgresql.org (Postfix) with ESMTP id 301B965A8B8 for ; Wed, 19 May 2010 08:26:10 -0300 (ADT) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=smtpcorp.com; s=main; h=Content-Transfer-Encoding:Content-Type:Mime-Version:References:Message-ID:Date:Subject:From:To; bh=Gj+CmgghZAQ+4qhGDaiWsueBKDJpi9G1INsWgyRrNps=; b=TBco5vz/uA8KelPq9dIdhLW6jglep3nEROsP0mnYSAi5mfVaq6u2xhW7cRAp12eV8luNFV/3pNF2LUlAD035RYcr8Ug0+AuS9ioeneIq08lzCseKg7H9nDVuMRs0gca+; Received: from ip-118-90-137-252.xdsl.xnet.co.nz ([118.90.137.252] helo=gonzo) by smtpcorp.com with esmtpsa (TLSv1:AES256-SHA:256) (Exim 4.70) id 1OEhPc-0008Ly-AA; mid 144 for pgsql-sql@postgresql.org; Wed, 19 May 2010 11:25:44 +0000 Received: from news by gonzo with local (Exim 4.69) (envelope-from ) id 1OEhPS-0004tW-5e for pgsql-sql@postgresql.org; Wed, 19 May 2010 23:25:58 +1200 To: pgsql-sql@postgresql.org Path: not-for-mail From: Jasen Betts Newsgroups: gmane.comp.db.postgresql.sql Subject: Re: How to get CURRENT_DATE in a pl/pgSQL function Date: 19 May 2010 11:25:57 GMT Organization: Dis (not Dat) Organisation Lines: 33 Message-ID: References: <20100518190832.GQ3892@aart.is.rice.edu> NNTP-Posting-Host: localhost Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Transfer-Encoding: 7bit X-Trace: reversiblemaps.ath.cx 1274268357 18541 127.0.0.1 (19 May 2010 11:25:57 GMT) X-Face: ?)Aw4rXwN5u0~$nqKj`xPz>xHCwgi^q+^?Ri*+R(&uv2=E1Q0Zk(>h!~o2ID@6{uf8s; a +M[5[U[QT7xFN%^gR"=tuJw%TXXR'Fp~W; (T"1(739R%m0Yyyv*gkGoPA.$b,D.w:z+<'"=-lVT?6 {T?=R^:W5g|E2#EhjKCa+nt":4b}dU7GYB*HBxn&Td$@f%.kl^:7X8rQWd[NTc"P"u6nkisze/Q; 8 "9Z{peQF,w)7UjV$c|RO/mQW/NMgWfr5*$-Z%u46"/00mx-,\R'fLPe.)^ User-Agent: slrn/pre1.0.0-2 (Linux) X-Smtpcorp-Track: 2932974.1.55331929 X-Virus-Scanned: Maia Mailguard 1.0.1 X-Spam-Status: No, hits=-0.001 tagged_above=-5 required=5 tests=BAYES_20=-0.001 X-Spam-Level: X-Archive-Number: 201005/88 X-Sequence-Number: 34136 On 2010-05-18, Kenneth Marshall 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.