Received: from megazone.bigpanda.com ([63.150.15.178]) by postgresql.org (8.11.3/8.11.4) with ESMTP id fA8Gbpm07946 for ; Thu, 8 Nov 2001 11:37:51 -0500 (EST) (envelope-from sszabo@megazone23.bigpanda.com) Received: by megazone.bigpanda.com (Postfix, from userid 1001) id C5C3FD5DB; Thu, 8 Nov 2001 08:37:55 -0800 (PST) Received: from localhost (localhost [127.0.0.1]) by megazone.bigpanda.com (Postfix) with ESMTP id B971C5BDF; Thu, 8 Nov 2001 08:37:55 -0800 (PST) Date: Thu, 8 Nov 2001 08:37:55 -0800 (PST) From: Stephan Szabo To: Ernesto Freyre Cc: Subject: Re: help with sintaxis of quotes on function In-Reply-To: <000a01c167a8$3b430860$a164a8c0@mihost> Message-ID: <20011108083616.I53274-100000@megazone23.bigpanda.com> MIME-Version: 1.0 Content-Type: TEXT/PLAIN; charset=US-ASCII X-Archive-Number: 200111/131 X-Sequence-Number: 5515 On Wed, 7 Nov 2001, Ernesto Freyre wrote: > Dear Sirs: > > Please I am attempting implement a function that update a column to current time + X seconds > > So the query involved looks like: > > update mytable set mytime=now+'X seconds'; > > Here X is a integer value, > > Now I need implement this on my function, But I have problems at > implement this at quotes, e.g. my function could looks like: > > CREATE FUNCTION addtime(integer) RETURNS INTEGER AS ' > DECLARE > additional ALIAS FOR $1; > BEGIN > update mytable set mytime=now()+''additional seconds''; > END; > ' > return 1; > LANGUAGE 'plpgsql'; This may work as the update: update mytable set mytime=now()+CAST((additional || '' seconds'') AS INTERVAL);