Re: plpgsql and escape

From: Richard Huxton <dev(at)archonet(dot)com>
To: darthxiong(at)libero(dot)it, pgsql-general(at)postgresql(dot)org
Subject: Re: plpgsql and escape
Date: 2002-10-21 16:59:47
Message-ID: 200210211659.47154.dev@archonet.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

On Monday 21 Oct 2002 3:00 pm, darthxiong(at)libero(dot)it wrote:
> hi all!
> i'm trying to do this ( converting unix time to human readable time in
> another table )
>
> create function align_vs() returns opaque as
> '
> declare
> line_vs vs%ROWTYPE;
> itime vs.step_time%TYPE;
> begin
>
> itime := to_char( timestamp ''epoch'' + interval ''NEW.step_time
> seconds'', ''YYYY-MM-DD HH24:MI:SS'' ); update vs set w_id = NEW.w_id,

> the double ' around NEW.step_time blocks its interpolation. which is the
> correct escaping sintax here?

Try (NEW.step_time || '' seconds'') - that should do it. If not, try casting
step_time to text first.

--
Richard Huxton

In response to

Browse pgsql-general by date

  From Date Subject
Next Message scott.marlowe 2002-10-21 17:13:11 Re: transactions
Previous Message Nigel J. Andrews 2002-10-21 16:59:13 Re: Can't write lock file