Re: help with dynamic table name - Mailing list pgsql-novice

From Peter Schonefeld
Subject Re: help with dynamic table name
Date
Msg-id 9cc0d1180703052112o26fc8c2bs18a1b02a68dd5ec1@mail.gmail.com
Whole thread Raw
In response to Re: help with dynamic table name  ("Jasbinder Singh Bali" <jsbali@gmail.com>)
Responses Re: help with dynamic table name  (Tom Lane <tgl@sss.pgh.pa.us>)
List 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@gmail.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

pgsql-novice by date:

Previous
From: "Peter Schonefeld"
Date:
Subject: Re: help with dynamic table name
Next
From: "Jasbinder Singh Bali"
Date:
Subject: Re: help with dynamic table name