Re: help with dynamic table name

From: "Peter Schonefeld" <peter(dot)schonefeld(at)gmail(dot)com>
To: pgsql-novice(at)postgresql(dot)org
Subject: Re: help with dynamic table name
Date: 2007-03-06 05:12:31
Message-ID: 9cc0d1180703052112o26fc8c2bs18a1b02a68dd5ec1@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-novice

Still no joy...if i forget about the variables and just try buidling a
string to execute, eg:

sql := 'INSERT INTO application (id,body) VALUES (''asdf'',''lkjh'')';

It works.

but with the variables i still get an error...

I tried putting quotes (two single quote chars) around the VALUES variables

sql := 'INSERT INTO '+ $3 +' (id,body) VALUES ('''+ $1 +''','''+ $2
+''')';

but it still will not work. "ERROR: 42883: operator does not exist:
\"unknown\" + character varying"

Pete

On 3/6/07, Jasbinder Singh Bali <jsbali(at)gmail(dot)com> wrote:
>
>
> sql := 'INSERT INTO '+ $3 +' (id,body) VALUES ('+ $1 +','+ $2 +')';
> remove the double quotes with id and body and see if it works.
> ~Jas
>
> >
> >

In response to

Responses

Browse pgsql-novice by date

  From Date Subject
Next Message Peter Schonefeld 2007-03-06 05:17:55 Re: help with dynamic table name
Previous Message Stephan Szabo 2007-03-06 05:00:04 Re: help with dynamic table name