On 11 July 2013 11:01, giozh <giozh@xxxxxxxx> wrote:
A few suggestions:
1. Post a statement that actually matches your problem statement. What you posted can't possibly work as [...] is not valid SQL syntax. Post the actual query. You can replace table names and column names and such with example names, if/where necessary.
2. Show the actual error message instead of some interpretation; the actual message would have mentioned the name of the column that doesn't exist. That would have been useful info.
3. Don't concatenate values into a dynamic query, use USING instead so that the values get properly escaped and don't open you up for SQL injection issues.
The problem you ran into was possibly (we really can't tell from the info you provided) an error in how you quote the various parts of the query, or one of your variables/parameters had a value that contained a quote.
-- this is the insert code:
>EXECUTE 'INSERT INTO table VALUES('||value1||','[...]','||value_char||')';
and the error is on value_char. pg told me that "column does not exist".
A few suggestions:
1. Post a statement that actually matches your problem statement. What you posted can't possibly work as [...] is not valid SQL syntax. Post the actual query. You can replace table names and column names and such with example names, if/where necessary.
2. Show the actual error message instead of some interpretation; the actual message would have mentioned the name of the column that doesn't exist. That would have been useful info.
3. Don't concatenate values into a dynamic query, use USING instead so that the values get properly escaped and don't open you up for SQL injection issues.
The problem you ran into was possibly (we really can't tell from the info you provided) an error in how you quote the various parts of the query, or one of your variables/parameters had a value that contained a quote.
If you can't see the forest for the trees,
Cut the trees and you'll see there is no forest.