Re: syntax error during function call

From: Sam Mason <sam(at)samason(dot)me(dot)uk>
To: pgsql-general(at)postgresql(dot)org
Subject: Re: syntax error during function call
Date: 2010-01-27 17:07:21
Message-ID: 20100127170721.GY5407@samason.me.uk
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

On Wed, Jan 27, 2010 at 10:40:17AM -0500, Aycock, Jeff R. wrote:
> EXECUTE 'SELECT *, $1, now() INTO schema_1.'||whoami||' FROM schema_2.'||whoami||' where created_dt between $2 and $3;'

You'll also need to expand those other parameters. The code is executed
in an independent scope and hence PG doesn't know what $1, $2 or $3 are.

The builtin function "quote_literal" is probably best to use here,
especially for the TEXT type.

--
Sam http://samason.me.uk/

In response to

Browse pgsql-general by date

  From Date Subject
Next Message Aycock, Jeff R. 2010-01-27 17:09:03 Re: syntax error during function call
Previous Message Adrian Klaver 2010-01-27 17:02:20 Re: syntax error during function call